@sito/dashboard-app 0.0.52 → 0.0.53
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/README.md
CHANGED
|
@@ -19,7 +19,7 @@ pnpm add @sito/dashboard-app
|
|
|
19
19
|
- React DOM `18.3.1`
|
|
20
20
|
- `@tanstack/react-query` `5.83.0`
|
|
21
21
|
- `react-hook-form` `7.61.1`
|
|
22
|
-
- `@sito/dashboard` `^0.0.
|
|
22
|
+
- `@sito/dashboard` `^0.0.72`
|
|
23
23
|
- Font Awesome + Emotion peers defined in `package.json`
|
|
24
24
|
|
|
25
25
|
Install all peers in consumer apps:
|
|
@@ -27,7 +27,7 @@ Install all peers in consumer apps:
|
|
|
27
27
|
```bash
|
|
28
28
|
npm install \
|
|
29
29
|
react@18.3.1 react-dom@18.3.1 \
|
|
30
|
-
@sito/dashboard@^0.0.
|
|
30
|
+
@sito/dashboard@^0.0.72 \
|
|
31
31
|
@tanstack/react-query@5.83.0 \
|
|
32
32
|
react-hook-form@7.61.1 \
|
|
33
33
|
@fortawesome/fontawesome-svg-core@7.0.0 \
|
|
@@ -148,6 +148,36 @@ const importDialog = useImportDialog<ProductDto, ProductImportPreviewDto>({
|
|
|
148
148
|
});
|
|
149
149
|
```
|
|
150
150
|
|
|
151
|
+
### Dialog extra actions
|
|
152
|
+
|
|
153
|
+
`ConfirmationDialog`, `FormDialog`, and `ImportDialog` support optional `extraActions`.
|
|
154
|
+
Use this when you need secondary actions in the dialog footer (for example, "Save draft", "Help", or "Download template").
|
|
155
|
+
|
|
156
|
+
```tsx
|
|
157
|
+
import { ConfirmationDialog, type ButtonPropsType } from "@sito/dashboard-app";
|
|
158
|
+
|
|
159
|
+
const extraActions: ButtonPropsType[] = [
|
|
160
|
+
{
|
|
161
|
+
id: "help-action",
|
|
162
|
+
type: "button",
|
|
163
|
+
variant: "outlined",
|
|
164
|
+
color: "secondary",
|
|
165
|
+
children: "Help",
|
|
166
|
+
onClick: () => openHelpPanel(),
|
|
167
|
+
},
|
|
168
|
+
];
|
|
169
|
+
|
|
170
|
+
<ConfirmationDialog
|
|
171
|
+
open={open}
|
|
172
|
+
title="Confirm delete"
|
|
173
|
+
handleClose={close}
|
|
174
|
+
handleSubmit={confirm}
|
|
175
|
+
extraActions={extraActions}
|
|
176
|
+
/>;
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
For `FormDialog`, set `type: "button"` on extra actions unless you explicitly want submit behavior.
|
|
180
|
+
|
|
151
181
|
### PrettyGrid infinite scroll
|
|
152
182
|
|
|
153
183
|
`PrettyGrid` supports optional infinite loading with `IntersectionObserver`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ImportPreviewDto } from '../../../lib';
|
|
3
|
-
import { DialogPropsType } from '../..';
|
|
3
|
+
import { ButtonPropsType, DialogPropsType } from '../..';
|
|
4
4
|
export interface ImportDialogPropsType<EntityDto extends ImportPreviewDto> extends DialogPropsType {
|
|
5
5
|
handleSubmit: () => void;
|
|
6
6
|
isLoading?: boolean;
|
|
@@ -10,4 +10,5 @@ export interface ImportDialogPropsType<EntityDto extends ImportPreviewDto> exten
|
|
|
10
10
|
onFileProcessed?: (items: EntityDto[]) => void;
|
|
11
11
|
renderCustomPreview?: (items?: EntityDto[] | null) => ReactNode;
|
|
12
12
|
onOverrideChange?: (override: boolean) => void;
|
|
13
|
+
extraActions?: ButtonPropsType[];
|
|
13
14
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { FieldValues } from 'react-hook-form';
|
|
3
3
|
import { FormContainerPropsType } from '../Form';
|
|
4
|
+
import { ButtonPropsType } from '..';
|
|
4
5
|
export type DialogPropsType = {
|
|
5
6
|
open?: boolean;
|
|
6
7
|
title: string;
|
|
@@ -13,8 +14,10 @@ export type DialogPropsType = {
|
|
|
13
14
|
export interface ConfirmationDialogPropsType extends DialogPropsType {
|
|
14
15
|
handleSubmit: () => void;
|
|
15
16
|
isLoading?: boolean;
|
|
17
|
+
extraActions?: ButtonPropsType[];
|
|
16
18
|
}
|
|
17
19
|
export interface FormDialogPropsType<TFormType extends FieldValues> extends DialogPropsType, Omit<FormContainerPropsType<TFormType>, "children"> {
|
|
20
|
+
extraActions?: ButtonPropsType[];
|
|
18
21
|
}
|
|
19
22
|
export type DialogActionsProps = {
|
|
20
23
|
primaryText: string;
|
|
@@ -31,4 +34,5 @@ export type DialogActionsProps = {
|
|
|
31
34
|
primaryAriaLabel?: string;
|
|
32
35
|
cancelName?: string;
|
|
33
36
|
cancelAriaLabel?: string;
|
|
37
|
+
extraActions?: ButtonPropsType[];
|
|
34
38
|
};
|
package/dist/dashboard-app.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var Xe=Object.defineProperty;var Ze=(n,e,t)=>e in n?Xe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var $=(n,e,t)=>Ze(n,typeof e!="symbol"?e+"":e,t);var rs=require("./main.css");Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("@sito/dashboard"),l=require("react/jsx-runtime"),M=require("@fortawesome/react-fontawesome"),d=require("react"),A=require("@fortawesome/free-solid-svg-icons"),ve=require("react-dom"),L=require("@tanstack/react-query"),et=require("@fortawesome/free-regular-svg-icons"),Ee=require("react-hook-form"),ke=n=>n==null?!1:`${n}`.length>0,tt=d.forwardRef(function(n,e){const{value:t,defaultValue:s,onChange:r,state:a=w.State.default,name:o="",id:c="",label:i="",disabled:m=!1,required:u=!1,containerClassName:f="",inputClassName:h="",labelClassName:p="",helperText:g="",helperTextClassName:b="",...y}=n,x=t!==void 0,[C,v]=d.useState(()=>ke(s)),k=x?ke(t):C,E=q=>{x||v(q.currentTarget.value.length>0),r==null||r(q)};return l.jsxs("div",{className:`form-paragraph-container group ${f}`,children:[l.jsx("textarea",{ref:e,name:o,id:c,className:`text-input text-area form-paragraph-textarea peer ${w.inputStateClassName(a)} ${k?"has-value":""} ${y.placeholder?"has-placeholder":""} ${h}`,required:u,defaultValue:s,...x?{value:t}:{},onChange:E,disabled:m,...y}),l.jsxs("label",{htmlFor:c,className:`text-input-label ${w.labelStateClassName(a)} ${p}`,children:[i,u?" *":""]}),!!g&&l.jsx("p",{className:`text-input-helper-text ${w.helperTextStateClassName(a)} ${b}`,children:g})]})}),st=n=>{const{t:e}=w.useTranslation(),{children:t,handleSubmit:s,onSubmit:r,isLoading:a=!1,buttonEnd:o=!0,reset:c}=n;return l.jsxs("form",{className:"form-container",onSubmit:s(r),children:[t,l.jsxs("div",{className:`form-actions ${o?"end":""}`,children:[l.jsxs(w.Button,{type:"submit",color:"primary",variant:"submit",disabled:a,name:e("_accessibility:buttons.submit"),"aria-label":e("_accessibility:ariaLabels.submit"),children:[a?l.jsx(w.Loading,{color:"stroke-base",loaderClass:"!w-6 mt-1",strokeWidth:"6"}):null,e("_accessibility:buttons.submit")]}),l.jsx(w.Button,{type:"button",variant:"outlined",onClick:()=>c==null?void 0:c(),name:e("_accessibility:buttons.cancel"),"aria-label":e("_accessibility:ariaLabels.cancel"),children:e("_accessibility:buttons.cancel")})]})]})},nt=d.forwardRef(function(n,e){const{t}=w.useTranslation(),[s,r]=d.useState(!1);return l.jsx(w.TextInput,{...n,type:s?"text":"password",ref:e,children:l.jsx(O,{type:"button",tabIndex:-1,"aria-label":t(s?"_accessibility:ariaLabels.hidePassword":"_accessibility:ariaLabels.showPassword"),className:"password-icon",onClick:()=>r(!s),icon:s?A.faEyeSlash:A.faEye})})}),ie=n=>{const{t:e}=w.useTranslation(),{title:t,children:s,handleClose:r,open:a=!1,containerClassName:o="",className:c="",animationClass:i="appear"}=n,m=d.useCallback(f=>{f.key==="Escape"&&a&&r()},[a,r]);d.useEffect(()=>(window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m)}),[m]);const u=d.useCallback(f=>{f.target===f.currentTarget&&r()},[r]);return d.useEffect(()=>{const f=h=>{h?document.body.style.overflow="hidden":document.body.style.overflow="auto"};return f(a),()=>{f(!1)}},[a]),ve.createPortal(l.jsx("div",{"aria-label":e("_accessibility:ariaLabels.closeDialog"),"aria-hidden":!a,onClick:u,className:`dialog-backdrop animated ${a?`opened ${i}`:"closed"} ${o}`,children:l.jsxs("div",{className:`dialog elevated animated ${a?`opened ${i}`:"closed"} ${c}`,children:[l.jsxs("div",{className:"dialog-header",children:[l.jsx("h3",{className:"dialog-title",children:t}),l.jsx(O,{icon:A.faClose,disabled:!a,"aria-disabled":!a,onClick:r,variant:"text",color:"error",className:"icon-button dialog-close-btn",name:e("_accessibility:buttons.closeDialog"),"aria-label":e("_accessibility:ariaLabels.closeDialog")})]}),s]})}),document.body)},ce=n=>{const{primaryText:e,cancelText:t,onPrimaryClick:s,onCancel:r,isLoading:a=!1,disabled:o=!1,primaryType:c="submit",containerClassName:i="",primaryClassName:m="",alignEnd:u=!1,primaryName:f,primaryAriaLabel:h,cancelName:p,cancelAriaLabel:g}=n;return l.jsxs("div",{className:`dialog-actions ${u?"end":""} ${i}`,children:[l.jsxs(w.Button,{type:c,color:"primary",variant:"submit",className:m,disabled:o,onClick:s,name:f,"aria-label":h,children:[a?l.jsx(w.Loading,{color:"stroke-base",loaderClass:"!w-6 mt-1",strokeWidth:"6"}):null,e]}),l.jsx(w.Button,{type:"button",variant:"outlined",disabled:o,onClick:r,name:p,"aria-label":g,children:t})]})},rt=n=>{const{t:e}=w.useTranslation(),{children:t,handleSubmit:s,onSubmit:r,handleClose:a,isLoading:o=!1,buttonEnd:c=!0,...i}=n;return l.jsx(ie,{...i,handleClose:a,children:l.jsxs("form",{onSubmit:s(r),children:[l.jsx("div",{className:"form-container",children:t}),l.jsx(ce,{primaryType:"submit",primaryText:e("_accessibility:buttons.submit"),cancelText:e("_accessibility:buttons.cancel"),onCancel:a,isLoading:o,disabled:o,primaryClassName:"dialog-form-primary",alignEnd:c,primaryName:e("_accessibility:buttons.submit"),primaryAriaLabel:e("_accessibility:ariaLabels.submit"),cancelName:e("_accessibility:buttons.cancel"),cancelAriaLabel:e("_accessibility:ariaLabels.cancel")})]})})},at=n=>{const{t:e}=w.useTranslation(),{children:t,handleSubmit:s,handleClose:r,isLoading:a=!1,...o}=n;return l.jsxs(ie,{...o,handleClose:r,children:[t,l.jsx(ce,{primaryText:e("_accessibility:buttons.ok"),cancelText:e("_accessibility:buttons.cancel"),onPrimaryClick:s,onCancel:r,isLoading:a,disabled:a,primaryType:"button",containerClassName:"mt-5",primaryName:e("_accessibility:buttons.ok"),primaryAriaLabel:e("_accessibility:ariaLabels.ok"),cancelName:e("_accessibility:buttons.cancel"),cancelAriaLabel:e("_accessibility:ariaLabels.cancel")})]})};function ot(n){const{message:e,className:t=""}=n,{t:s}=w.useTranslation();return l.jsx("p",{className:`import-error-message ${t}`,children:e??s("_messages:errors.parseFile",{defaultValue:"Failed to process file"})})}function it(n){const{message:e,className:t=""}=n,{t:s}=w.useTranslation();return l.jsxs("div",{className:`import-loading ${t}`,children:[l.jsx(w.Loading,{loaderClass:"w-5 h-5",className:"!w-auto"}),l.jsx("span",{children:e??s("_messages:loading.processingFile",{defaultValue:"Processing file..."})})]})}function ct(n){const{items:e,max:t=5,className:s=""}=n,{t:r}=w.useTranslation();if(!e||e.length===0)return null;const a=e.slice(0,t);return l.jsxs("div",{className:`import-preview ${s}`,children:[l.jsx("p",{className:"import-preview-count",children:r("_pages:common.actions.import.previewCount",{count:e.length,defaultValue:`Preview: ${e.length} items`})}),l.jsx("pre",{className:"import-preview-content",children:JSON.stringify(a,null,2)})]})}const Ne=()=>({file:null,previewItems:null,parseError:null,processing:!1,overrideExisting:!1,inputKey:0});function lt(n,e){switch(e.type){case"SET_FILE":return{...n,file:e.file,previewItems:null,parseError:null,processing:!1};case"START_PROCESSING":return{...n,processing:!0};case"SET_PREVIEW":return{...n,previewItems:e.items,parseError:null,processing:!1};case"SET_ERROR":return{...n,previewItems:null,parseError:e.message,processing:!1};case"SET_OVERRIDE":return{...n,overrideExisting:e.value};case"RESET":return{...Ne(),inputKey:n.inputKey+1}}}const ut=n=>{const{t:e}=w.useTranslation(),{children:t,handleSubmit:s,handleClose:r,isLoading:a=!1,fileProcessor:o,onFileProcessed:c,renderCustomPreview:i,onOverrideChange:m,open:u,...f}=n,[h,p]=d.useReducer(lt,Ne()),{file:g,previewItems:b,parseError:y,processing:x,overrideExisting:C,inputKey:v}=h,k=d.useRef(c),E=d.useRef(o);d.useEffect(()=>{k.current=c},[c]),d.useEffect(()=>{E.current=o},[o]),d.useEffect(()=>{u||p({type:"RESET"})},[u]);const q=d.useCallback(async(F,S)=>{var j;if(E.current){p({type:"START_PROCESSING"});try{const N=await E.current(F,{override:S});p({type:"SET_PREVIEW",items:N??[]}),(j=k.current)==null||j.call(k,N??[])}catch(N){console.error(N);const P=N instanceof Error?N.message:"Failed to parse file";p({type:"SET_ERROR",message:P})}}},[]);return l.jsxs(ie,{...f,open:u,handleClose:r,children:[l.jsx(w.FileInput,{onClear:()=>{var F;p({type:"SET_FILE",file:null}),(F=k.current)==null||F.call(k,[])},onChange:F=>{var j,N;const S=(j=F.target.files)==null?void 0:j[0];if(!S){p({type:"SET_FILE",file:null}),(N=k.current)==null||N.call(k,[]);return}p({type:"SET_FILE",file:S}),q(S,C)},label:e("_accessibility:labels.file")},v),l.jsxs("label",{className:"import-override-label",children:[l.jsx("input",{type:"checkbox",checked:C,onChange:F=>{const S=F.target.checked;p({type:"SET_OVERRIDE",value:S}),m==null||m(S),g&&q(g,S)}}),l.jsx("span",{children:e("_pages:common.actions.import.override",{defaultValue:"Override existing items"})})]}),l.jsx(ot,{message:y}),x&&l.jsx(it,{}),i?i(b):!!b&&b.length>0&&l.jsx(ct,{items:b}),t,l.jsx(ce,{primaryText:e("_accessibility:buttons.ok"),cancelText:e("_accessibility:buttons.cancel"),onPrimaryClick:()=>{(!o||!!b&&b.length>0)&&s()},onCancel:r,isLoading:a,primaryType:"button",containerClassName:"import-dialog-actions",primaryName:e("_accessibility:buttons.ok"),primaryAriaLabel:e("_accessibility:ariaLabels.ok"),cancelName:e("_accessibility:buttons.cancel"),cancelAriaLabel:e("_accessibility:ariaLabels.cancel")})]})};var R=(n=>(n[n.success=0]="success",n[n.error=1]="error",n[n.warning=2]="warning",n[n.info=3]="info",n))(R||{}),I=(n=>(n.GET="GET",n.POST="POST",n.PUT="PUT",n.PATCH="PATCH",n.DELETE="DELETE",n))(I||{});const dt=n=>Array.isArray(n)||n instanceof Headers?!1:typeof n=="object"&&n!==null&&("headers"in n||"credentials"in n),mt=n=>n?dt(n)?n:{headers:n}:{},ft=n=>n?n instanceof Headers?Object.fromEntries(n.entries()):Array.isArray(n)?Object.fromEntries(n):n:{};async function oe(n,e="GET",t,s){const r=mt(s),a={...t!==void 0?{"Content-Type":"application/json"}:{},...ft(r.headers)};try{const o=await fetch(n,{method:e,headers:a,...r.credentials?{credentials:r.credentials}:{},...t!==void 0?{body:JSON.stringify(t)}:{}}),c=await o.text();let i=null;try{i=c?JSON.parse(c):null}catch{i=null}if(!o.ok){const m=typeof i=="object"&&i!==null?i.message??i.error??c:c||o.statusText;return{data:null,status:o.status,error:{status:o.status,message:m||"Unknown error occurred"}}}return{data:o.status!==204&&i!==null?i:null,status:o.status,error:null}}catch(o){return{data:null,status:500,error:{status:500,message:o instanceof Error?o.message:"Unknown error occurred"}}}}function je(n,e){if(e){const t=Object.entries(e).filter(([,s])=>s!=null).map(([s,r])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(r))}`).join("&");return t?`${n}?${t}`:n}return n}const fe=(n,e,t)=>{const s=[];if(e){const{sortingBy:r,sortingOrder:a,currentPage:o,pageSize:c}=e;r!==void 0&&s.push(`sort=${String(r)}`),a!==void 0&&s.push(`order=${a}`),o!==void 0&&s.push(`page=${o}`),c!==void 0&&s.push(`pageSize=${c}`)}if(t){const r=Object.entries(t).filter(([,a])=>a!=null&&a!=="").flatMap(([a,o])=>{if(Array.isArray(o))return o.map(c=>`${a}==${encodeURIComponent((c==null?void 0:c.id)??c)}`);if(typeof o=="object"&&o!==null&&"start"in o&&"end"in o){const c=[];return o.start!=null&&o.start!==""&&c.push(`${a}>=${encodeURIComponent(o.start)}`),o.end!=null&&o.end!==""&&c.push(`${a}<=${encodeURIComponent(o.end)}`),c}return typeof o=="object"&&o!==null?`${a}==${encodeURIComponent(o.id??"")}`:`${a}==${encodeURIComponent(o)}`});r.length>0&&s.push(`filters=${r.join(",")}`)}return s.length?`${n}?${s.join("&")}`:n},J=class J{constructor(e,t="user",s=!0,r,a={}){$(this,"baseUrl");$(this,"userKey");$(this,"rememberKey");$(this,"refreshTokenKey");$(this,"accessTokenExpiresAtKey");$(this,"refreshEndpoint");$(this,"refreshExpirySkewMs");$(this,"secured");$(this,"tokenAcquirer");this.baseUrl=e,this.secured=s,this.userKey=t,this.rememberKey=a.rememberKey??"remember",this.refreshTokenKey=a.refreshTokenKey??"refreshToken",this.accessTokenExpiresAtKey=a.accessTokenExpiresAtKey??"accessTokenExpiresAt",this.refreshEndpoint=a.refreshEndpoint??"auth/refresh",this.refreshExpirySkewMs=a.refreshExpirySkewMs??5e3,this.tokenAcquirer=r??this.defaultTokenAcquirer}defaultTokenAcquirer(e){if(e)return{credentials:"include"};const t=V(this.userKey);if(t&&t.length)return{Authorization:`Bearer ${t}`}}getRefreshLockKey(){return`${this.baseUrl}|${this.userKey}|${this.refreshTokenKey}|${this.accessTokenExpiresAtKey}`}buildUrl(e){const t=this.baseUrl.endsWith("/")?this.baseUrl.slice(0,-1):this.baseUrl,s=e.startsWith("/")?e:`/${e}`;return`${t}${s}`}getRefreshToken(){const e=V(this.refreshTokenKey);if(typeof e=="string"&&e.length)return e}getAccessTokenExpiresAt(){const e=V(this.accessTokenExpiresAtKey);if(typeof e=="string"&&e.length)return e}canRefresh(){return!!this.getRefreshToken()}shouldRefreshBeforeRequest(){const e=this.getRefreshToken(),t=this.getAccessTokenExpiresAt();if(!e||!t)return!1;const s=Date.parse(t);return Number.isNaN(s)?!1:Date.now()>=s-this.refreshExpirySkewMs}clearStoredSession(){_(this.userKey),_(this.rememberKey),_(this.refreshTokenKey),_(this.accessTokenExpiresAtKey)}storeSession(e,t){U(this.userKey,e.token);const s=e.refreshToken===void 0?t:e.refreshToken;typeof s=="string"&&s.length?U(this.refreshTokenKey,s):_(this.refreshTokenKey),typeof e.accessTokenExpiresAt=="string"&&e.accessTokenExpiresAt.length?U(this.accessTokenExpiresAtKey,e.accessTokenExpiresAt):_(this.accessTokenExpiresAtKey)}async refreshAccessTokenWithMutex(){const e=this.getRefreshToken();if(!e)throw{status:401,message:"Missing refresh token"};const t=this.getRefreshLockKey(),s=J.refreshInFlight.get(t);if(s){await s;return}const r=(async()=>{const{data:a,status:o,error:c}=await oe(this.buildUrl(this.refreshEndpoint),I.POST,{refreshToken:e});if(c||!(a!=null&&a.token))throw this.clearStoredSession(),c??{status:o,message:"Unable to refresh session"};this.storeSession(a,e)})();J.refreshInFlight.set(t,r);try{await r}finally{J.refreshInFlight.delete(t)}}isRequestOptions(e){return Array.isArray(e)||e instanceof Headers?!1:typeof e=="object"&&e!==null&&("headers"in e||"credentials"in e)}toRequestOptions(e){return e?this.isRequestOptions(e)?e:{headers:e}:{}}toHeaderRecord(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):e:{}}mergeRequestConfig(e){const t=this.secured?this.tokenAcquirer():void 0,s=this.toRequestOptions(t),r=this.toRequestOptions(e),a={...this.toHeaderRecord(s.headers),...this.toHeaderRecord(r.headers)},o=r.credentials??s.credentials,c=Object.keys(a).length>0;if(o)return c?{headers:a,credentials:o}:{credentials:o};if(c)return a}async makeRequestWithRefresh(e,t,s,r){this.secured&&this.shouldRefreshBeforeRequest()&&await this.refreshAccessTokenWithMutex();let a=await oe(this.buildUrl(e),t,s,this.mergeRequestConfig(r));return this.secured&&a.status===401&&this.canRefresh()&&(await this.refreshAccessTokenWithMutex(),a=await oe(this.buildUrl(e),t,s,this.mergeRequestConfig(r))),a}async doQuery(e,t=I.GET,s,r){const{data:a,status:o,error:c}=await this.makeRequestWithRefresh(e,t,s,r);if(c||o<200||o>=300)throw c??{status:o,message:String(o)};return a}async get(e,t,s){const r=fe(e,t,s),{data:a,error:o,status:c}=await this.makeRequestWithRefresh(r,I.GET);if(o||c<200||c>=300||!a)throw o??{status:c,message:String(c)};return a}async patch(e,t){const{error:s,data:r,status:a}=await this.makeRequestWithRefresh(e,I.PATCH,t);if(s||r===null||r===void 0)throw s??{status:a,message:"Unknown error"};return r}async delete(e,t){const{error:s,data:r,status:a}=await this.makeRequestWithRefresh(e,I.DELETE,t);if(s||r===null||r===void 0)throw s??{status:a,message:"Unknown error"};return r}async post(e,t){const{error:s,data:r,status:a}=await this.makeRequestWithRefresh(e,I.POST,t);if(s||r===null||r===void 0)throw s??{status:a,message:"Unknown error"};return r}};$(J,"refreshInFlight",new Map);let Z=J;class Ae{constructor(e,t="user",s={}){$(this,"api");this.api=new Z(e,t,!1,void 0,s)}async login(e){const t="auth/sign-in",s=e;return await this.api.doQuery(t,I.POST,s)}async refresh(e){return await this.api.doQuery("auth/refresh",I.POST,e)}async logout(e){const t="auth/sign-out",s=e!=null&&e.accessToken?{Authorization:`Bearer ${e.accessToken}`}:void 0,r=e!=null&&e.refreshToken?{refreshToken:e.refreshToken}:void 0;return await this.api.doQuery(t,I.POST,r,s)}async register(e){return await this.api.doQuery("auth/sign-up",I.POST,e)}async getSession(){return await this.api.doQuery("auth/session",I.GET,void 0,this.api.defaultTokenAcquirer())}}class ht{constructor(e,t,s={}){$(this,"auth");this.auth=new Ae(e,t,s)}get Auth(){return this.auth}}class pt{constructor(e,t,s="user",r=!0,a={}){$(this,"table");$(this,"secured");$(this,"api");this.table=e,this.secured=r,this.api=new Z(t,s,r,void 0,a)}async insert(e){return await this.api.post(`${this.table}`,e)}async insertMany(e){return await this.api.doQuery(`${this.table}/batch`,I.POST,e)}async update(e){return await this.api.patch(`${this.table}/${e.id}`,e)}async get(e,t){return await this.api.get(`${this.table}`,e,t)}async export(e){const t=fe(`${this.table}/export`,void 0,e);return await this.api.doQuery(t,I.GET,void 0)}async import(e){return await this.api.doQuery(`${this.table}/import`,I.POST,e)}async commonGet(e){return await this.api.doQuery(je(`${this.table}/common`,e),I.GET)}async getById(e){return await this.api.doQuery(`${this.table}/${e}`)}async softDelete(e){return await this.api.delete(`${this.table}`,e)}async restore(e){return await this.api.patch(`${this.table}/restore`,e)}}class gt{constructor(e,t,s=1){$(this,"table");$(this,"dbName");$(this,"version");$(this,"db",null);this.table=e,this.dbName=t,this.version=s}close(){this.db&&(this.db.onversionchange=null,this.db.close(),this.db=null)}open(){return this.db?Promise.resolve(this.db):new Promise((e,t)=>{const s=indexedDB.open(this.dbName,this.version);s.onupgradeneeded=r=>{const a=r.target.result;a.objectStoreNames.contains(this.table)||a.createObjectStore(this.table,{keyPath:"id",autoIncrement:!0})},s.onsuccess=r=>{this.db=r.target.result,this.db.onversionchange=()=>{this.close()},e(this.db)},s.onerror=r=>{t(r.target.error)}})}async transaction(e){return(await this.open()).transaction(this.table,e).objectStore(this.table)}request(e){return new Promise((t,s)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>s(e.error)})}async insert(e){const t=await this.transaction("readwrite"),s=await this.request(t.add(e));return{...e,id:s}}async insertMany(e){const t=await this.transaction("readwrite");let s=0;for(const r of e)s=await this.request(t.add(r));return{...e[e.length-1],id:s}}async update(e,t){const s=typeof e=="number"?t:e;if(!s)throw new Error("IndexedDBClient.update requires a value payload");const r=typeof e=="number"?{...s,id:s.id??e}:s,a=await this.transaction("readwrite");return await this.request(a.put(r)),r}async get(e,t){var p;const s=await this.transaction("readonly"),r=await this.request(s.getAll()),a=this.applyFilter(r,t),o=(e==null?void 0:e.sortingBy)??"id",c=((p=e==null?void 0:e.sortingOrder)==null?void 0:p.toLowerCase())??"asc";a.sort((g,b)=>{const y=g[o],x=b[o];return y<x?c==="asc"?-1:1:y>x?c==="asc"?1:-1:0});const i=(e==null?void 0:e.pageSize)??10,m=(e==null?void 0:e.currentPage)??0,u=a.length,f=Math.ceil(u/i),h=a.slice(m*i,m*i+i);return{sort:o,order:c,currentPage:m,pageSize:i,totalElements:u,totalPages:f,items:h}}async export(e){const t=await this.transaction("readonly"),s=await this.request(t.getAll());return this.applyFilter(s,e)}async import(e){const t=await this.transaction("readwrite");let s=0;for(const r of e.items)e.override?await this.request(t.put(r)):await this.request(t.add(r)),s++;return s}async commonGet(e){const t=await this.transaction("readonly"),s=await this.request(t.getAll());return this.applyFilter(s,e)}async getById(e){const t=await this.transaction("readonly"),s=await this.request(t.get(e));if(!s)throw new Error(`Record ${e} not found in ${this.table}`);return s}async softDelete(e){const t=await this.transaction("readwrite");let s=0;for(const r of e){const a=await this.request(t.get(r));a&&(await this.request(t.put({...a,deletedAt:new Date})),s++)}return s}async restore(e){const t=await this.transaction("readwrite");let s=0;for(const r of e){const a=await this.request(t.get(r));a&&(await this.request(t.put({...a,deletedAt:null})),s++)}return s}applyFilter(e,t){return t?e.filter(s=>Object.entries(t).every(([r,a])=>this.matchesFilterValue(r,a,s[r]))):e}matchesFilterValue(e,t,s){if(t===void 0)return!0;if(e==="deletedAt"&&typeof t=="boolean"){const r=s!=null;return t?r:!r}return s===t}}function yt(n){return Object.keys(n).filter(e=>isNaN(Number(e))).map(e=>({key:e,value:n[e]}))}const V=(n,e="")=>{const t=localStorage.getItem(n)??void 0;if(t&&e.length)switch(e){case"object":return JSON.parse(t);case"number":return Number(t);case"boolean":return t==="true"||t==="1";default:return t}return t},U=(n,e)=>localStorage.setItem(n,typeof e=="object"?JSON.stringify(e):e),_=n=>localStorage.removeItem(n);function bt(n){const e=n?new Date(n):new Date,t={weekday:"long",day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0};return e.toLocaleString(navigator.language||"es-ES",t)}function wt(n){const e=n?new Date(n):new Date,t=String(e.getDate()).padStart(2,"0"),s=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getFullYear()).slice(-2),a=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0");return`${t}/${s}/${r} ${a}:${o}`}function xt(n){const e=n?new Date(n):new Date,t=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0"),a=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0");return`${t}-${s}-${r}T${a}:${o}`}const $e=()=>{var t;const n=navigator,e=((t=n==null?void 0:n.userAgentData)==null?void 0:t.platform)||(n==null?void 0:n.platform)||"";return/Mac|iPhone|iPod|iPad/i.test(e)};function ee(n){if(!n||typeof n!="object")return!1;const e=n;return Array.isArray(e.errors)&&e.errors.every(t=>Array.isArray(t)&&t.length===2&&typeof t[0]=="string")}function te(n){if(!n||typeof n!="object")return!1;const e=n;return typeof(e==null?void 0:e.status)=="number"&&typeof(e==null?void 0:e.message)=="string"}function Ct(n,e){return n!=null&&n.errors?n.errors.map(([t,s])=>e(t,s)):[]}const Le=d.createContext(void 0);function kt(n){const{children:e}=n,t=d.useRef(0),[s,r]=d.useReducer((h,p)=>{const{type:g,items:b,id:y}=p;switch(g){case"set":return b??[];case"remove":return y!==void 0?h.filter(x=>x.id!==y):[]}return h},[],()=>[]),a=h=>h.map(p=>({...p,id:t.current++})),o=d.useCallback(h=>r({type:"set",items:a([{...h,type:R.error}])}),[]),c=d.useCallback(h=>r({type:"set",items:a([{...h}])}),[]),i=d.useCallback(h=>r({type:"set",items:a(h)}),[]),m=d.useCallback(h=>r({type:"set",items:a([{...h,type:R.success}])}),[]),u=h=>r({type:"remove",id:h}),f=d.useMemo(()=>({notification:s,removeNotification:u,showErrorNotification:o,showNotification:c,showSuccessNotification:m,showStackNotifications:i}),[s,o,c,i,m]);return l.jsx(Le.Provider,{value:f,children:e})}const W=()=>{const n=d.useContext(Le);if(!n)throw new Error("NotificationContext must be used within a Provider");return n},he=()=>new L.QueryClient({defaultOptions:{queries:{refetchInterval:!1,refetchOnMount:!0,refetchOnReconnect:!1,retry:!1,retryOnMount:!0,refetchOnWindowFocus:!1}}}),St=he(),Re=d.createContext(void 0),Tt=n=>{const{children:e,manager:t,queryClient:s}=n,[r]=d.useState(he),a=s??r;return l.jsx(Re.Provider,{value:{client:t},children:l.jsx(L.QueryClientProvider,{client:a,children:e})})},Ie=()=>{const n=d.useContext(Re);if(!n)throw new Error("managerContext must be used within a Provider");return n.client},Fe=d.createContext(void 0),vt=n=>{const{children:e,guestMode:t="guest_mode",user:s="user",remember:r="remember",refreshTokenKey:a="refreshToken",accessTokenExpiresAtKey:o="accessTokenExpiresAt"}=n,c=Ie(),[i,m]=d.useState({}),u=d.useCallback(()=>{_(s),_(r),_(a),_(o)},[o,a,r,s]),f=d.useCallback(()=>!!V(t,"boolean")&&i.token===void 0,[i.token,t]),h=d.useCallback(x=>{U(t,x)},[t]),p=d.useCallback((x,C)=>{if(!x)return;const v=V(r,"boolean"),k=C??(typeof v=="boolean"?v:!1);m(x),_(t),U(s,x.token),U(r,k),typeof x.refreshToken=="string"&&x.refreshToken.length?U(a,x.refreshToken):_(a),typeof x.accessTokenExpiresAt=="string"&&x.accessTokenExpiresAt.length?U(o,x.accessTokenExpiresAt):_(o)},[o,t,a,r,s]),g=d.useCallback(async()=>{const x=V(s)??i.token,C=V(a)??(typeof i.refreshToken=="string"?i.refreshToken:void 0);try{await c.Auth.logout({accessToken:x,refreshToken:C})}catch(v){console.error(v)}m({}),u()},[i.refreshToken,i.token,u,c.Auth,a,s]),b=d.useCallback(async()=>{try{const x=await c.Auth.getSession();p(x)}catch(x){console.error(x),g()}},[p,g,c.Auth]),y=d.useMemo(()=>({account:i,logUser:p,logoutUser:g,logUserFromLocal:b,isInGuestMode:f,setGuestMode:h}),[i,p,g,b,f,h]);return l.jsx(Fe.Provider,{value:y,children:e})},pe=()=>{const n=d.useContext(Fe);if(!n)throw new Error("authContext must be used within a Provider");return n},_e=d.createContext({}),Et=n=>{const{children:e,location:t,navigate:s,linkComponent:r,searchComponent:a}=n;return l.jsx(_e.Provider,{value:{location:t,navigate:s,linkComponent:r,searchComponent:a},children:e})},Y=()=>{const n=d.useContext(_e);if(n===void 0||Object.keys(n).length===0)throw new Error("Config provider has not been set. This step is required and cannot be skipped.");return n},Nt={addChildItem:()=>{},removeChildItem:()=>{},clearDynamicItems:()=>{},dynamicItems:{}},ge=d.createContext(Nt),jt=n=>{const{children:e}=n,[t,s]=d.useState({}),r=d.useCallback((i,m)=>s(u=>({...u,[i]:[...u[i]??[],m]})),[]),a=d.useCallback((i,m)=>s(u=>({...u,[i]:(u[i]??[]).filter((f,h)=>h!==m)})),[]),o=d.useCallback(i=>{s(i?m=>({...m,[i]:[]}):{})},[]),c=d.useMemo(()=>({dynamicItems:t,addChildItem:r,removeChildItem:a,clearDynamicItems:o}),[t,o,a,r]);return l.jsx(ge.Provider,{value:c,children:e})},De=()=>d.useContext(ge);function At(n){const{t:e}=w.useTranslation(),{open:t,onClose:s,menuMap:r,logo:a}=n,{account:o}=pe(),{dynamicItems:c}=De(),{linkComponent:i,location:m}=Y(),u=i,f=d.useMemo(()=>r.filter(y=>{const x=y.auth,C=!!(o!=null&&o.email);return x==null||x&&C||!x&&!C}),[o==null?void 0:o.email,r]),h=d.useCallback(y=>{y.key==="Escape"&&t&&s()},[s,t]);d.useEffect(()=>(document.addEventListener("keydown",h),()=>{document.removeEventListener("keydown",h)}),[h]);const p=d.useCallback((y,x)=>x?y===`${m.pathname}${m.search}`:y===m.pathname,[m.pathname,m.search]),g=d.useCallback(y=>l.jsx("li",{className:`drawer-list-item-child ${p(y.path,!0)?"active":""} animated`,children:y.path?l.jsx(u,{tabIndex:t?0:-1,to:y.path??"/","aria-label":e(`_accessibility:ariaLabels.${y.id}`,{defaultValue:y.label}),className:"drawer-link",children:y.label}):y.label},y.id),[u,t,e,p]),b=d.useMemo(()=>f.map((y,x)=>{const C=y.page??String(x),v=`drawer-list-item ${p(y.path)?"active":""} animated`;if(y.type==="divider")return l.jsx("li",{className:v,children:l.jsx("hr",{className:"drawer-divider"})},C);const k=y.children??(y.page&&c?c[y.page]:null);return l.jsxs("li",{className:v,children:[l.jsxs(u,{tabIndex:t?0:-1,to:y.path??"/","aria-label":e(`_accessibility:ariaLabels.${String(y.page)}`,{defaultValue:e(`_pages:${String(y.page)}.title`)}),className:"drawer-link",children:[y.icon,e(`_pages:${y.page}.title`)]}),k&&l.jsx("ul",{className:"drawer-children-list",children:k.map(g)})]},C)}),[u,c,p,t,f,g,e]);return l.jsx("div",{"aria-label":e("_accessibility:ariaLabels.closeMenu"),"aria-disabled":!t,className:`${t?"opened":"closed"} drawer-backdrop`,onClick:()=>s(),children:l.jsxs("aside",{className:`${t?"opened":"closed"} drawer animated`,children:[l.jsxs("div",{className:"drawer-header-container",children:[a,l.jsx("h2",{className:"drawer-header poppins",children:e("_pages:home.appName")})]}),l.jsx("ul",{className:"drawer-menu-list",children:b})]})})}const O=({icon:n,...e})=>l.jsx(w.IconButton,{icon:l.jsx(M.FontAwesomeIcon,{icon:n}),...e});var de,Se;function $t(){if(Se)return de;Se=1;const n=(c,i="local",m=void 0)=>{if(i==="local"){if(localStorage.getItem(c)!==void 0&&localStorage.getItem(c)!=="undefined"&&localStorage.getItem(c)!==null)return m===void 0||m!==void 0&&localStorage.getItem(c)===m}else if(i==="session"&&sessionStorage.getItem(c)!==void 0&&sessionStorage.getItem(c)!=="undefined"&&sessionStorage.getItem(c)!==null)return m===void 0||m!==void 0&&sessionStorage.getItem(c)===m;return!1},e=c=>{const i={};return c.substring(1).split("&").forEach(u=>{const[f,h]=u.split("=");i[f]=h}),i},t=(c="")=>{if(a(c)&&c.length)return a(c);{let i=navigator.language||navigator.userLanguage;if(i.indexOf("en")<0&&i.indexOf("es")<0&&(i="en-US"),i=i.split("-")[0],i)return c.length&&r(c,730,i),i}return"en"},s=(c=0,i=0,m=window,u="smooth")=>m.scroll({top:c,left:i,behavior:u}),r=(c,i,m,u="/",f="Lax")=>{var h=new Date;h.setTime(h.getTime()+i*24*60*60*1e3);const p="; expires="+h.toUTCString();document.cookie=`${c}=${m||""}${p};path=${u};SameSite=${f}`},a=c=>{const i=`${c}=`,u=decodeURIComponent(document.cookie).split(";");for(let f=0;f<u.length;f+=1){let h=u[f];for(;h.charAt(0)===" ";)h=h.substring(1);if(h.indexOf(i)===0)return h.substring(i.length,h.length)}return""};return de={getCookie:a,createCookie:r,deleteCookie:c=>document.cookie=`${c}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`,getUserLanguage:t,scrollTo:s,parseQueries:e,validation:n},de}var Lt=$t();function Rt(){const{t:n,language:e}=w.useTranslation();return{timeAge:d.useCallback(s=>{const a=new Date-s,o=Math.floor(a/(1e3*60)),c=Math.floor(o/60),i=e==="es",m=n("_accessibility:labels.ago"),u=n("_accessibility:labels.minute"),f=n("_accessibility:labels.minutes"),h=n("_accessibility:labels.hour"),p=n("_accessibility:labels.hours"),g=n("_accessibility:labels.yesterday"),b=n("_accessibility:labels.justNow");return a<1e3*60?b:o<60?`${i?m:""} ${o} ${o===1?u:f} ${i?"":m}`:c<24?`${i?m:""} ${c} ${c===1?h:p} ${i?"":m}`:c<48?g:s.toLocaleDateString(navigator.language||"es-ES",{day:"2-digit",month:"2-digit",year:"numeric"})},[n,e])}}const ye=n=>{const{showSuccessNotification:e}=W(),{mutationFn:t,onError:s,onSuccess:r,onSuccessMessage:a}=n,[o,c]=d.useState([]),{open:i,handleClose:m,handleOpen:u}=be(),f=()=>{m(),c([])},h=async g=>{c(g),u()},p=L.useMutation({mutationFn:()=>t(Array.isArray(o)?o:[o]),onError:g=>{console.error(g),s&&s(g),f()},onSuccess:async g=>{r&&r(g),e({message:a}),f()}});return{open:i,onClick:h,close:f,dialogFn:p,isLoading:p.isPending}},It=n=>{const{t:e}=w.useTranslation(),{showStackNotifications:t,showSuccessNotification:s,showErrorNotification:r}=W(),a=L.useQueryClient(),{defaultValues:o,mutationFn:c,formToDto:i,onError:m,onSuccess:u,queryKey:f,onSuccessMessage:h}=n,{control:p,handleSubmit:g,reset:b,setError:y,getValues:x,setValue:C}=Ee.useForm({defaultValues:o}),v=d.useRef(null),k=d.useCallback(()=>{const S=document.activeElement;if(!(S instanceof HTMLElement)){v.current=null;return}v.current=S.closest("form")},[]),E=d.useCallback(S=>{const j=S==null?void 0:S.errors,N=[],P=v.current;if(!P)return N;let B=!1;return j&&j.forEach(([ne,le])=>{const H=P.querySelector(`[name="${ne}"]`);(H instanceof HTMLInputElement||H instanceof HTMLTextAreaElement||H instanceof HTMLSelectElement)&&(B||(H.focus(),B=!0),H.classList.add("error"),N.push(e(`_entities:${f}.${ne}.${le}`)))}),N},[e,f]),q=d.useCallback(()=>{const S=v.current;if(!S)return;S.querySelectorAll("input, textarea, select").forEach(N=>{N.classList.remove("error")})},[]),F=L.useMutation({mutationFn:c,onError:S=>{console.error(S);const j=S;if(m)m(S);else if(ee(j)){const N=E(j);t(N.map(P=>({message:P,type:R.error})))}else if(te(j)){const N=j.message||e("_accessibility:errors.500"),P=e(`_accessibility:errors.${j.status}`);r({message:P||N})}else r({message:e("_accessibility:errors.500")})},onSuccess:async S=>{await a.invalidateQueries({queryKey:f}),u&&u(S),h&&s({message:h})}});return{control:p,getValues:x,setValue:C,handleSubmit:g,onSubmit:S=>{k(),q(),F.mutate(i?i(S):S)},reset:b,setError:y,isLoading:F.isPending}},Me=n=>{const{t:e}=w.useTranslation(),{onClick:t,icon:s=A.faTrash,sticky:r=!0,hidden:a=!1,multiple:o=!0,disabled:c=!1,id:i=Q.Delete,tooltip:m=e("_pages:common.actions.delete.text")}=n;return{action:d.useCallback(f=>({id:i,sticky:r,tooltip:m,multiple:o,onClick:()=>t([f==null?void 0:f.id]),hidden:!!f.deletedAt||a,disabled:!!f.deletedAt||c,icon:l.jsx(M.FontAwesomeIcon,{className:"text-bg-error",icon:s}),onMultipleClick:h=>t(h.map(p=>p.id))}),[c,a,s,i,o,t,r,m])}},Pe=n=>{const{t:e}=w.useTranslation(),{onClick:t,sticky:s=!0,hidden:r=!1,disabled:a=!1,multiple:o=!1,icon:c=A.faRotateLeft,id:i=Q.Restore,tooltip:m=e("_pages:common.actions.restore.text")}=n;return{action:d.useCallback(f=>({id:i,sticky:s,tooltip:m,multiple:o,onClick:()=>t([f==null?void 0:f.id]),hidden:!f.deletedAt||r,disabled:!f.deletedAt||a,icon:l.jsx(M.FontAwesomeIcon,{className:"text-bg-error",icon:c}),onMultipleClick:h=>t(h.map(p=>p.id))}),[a,r,c,i,o,t,s,m])}},Ft=n=>{const{t:e}=w.useTranslation(),{onClick:t,hidden:s=!1,sticky:r=!0,disabled:a=!1,id:o=Q.Edit,icon:c=A.faPencil,tooltip:i=e("_pages:common.actions.edit.text")}=n;return{action:d.useCallback(u=>({id:o,sticky:r,tooltip:i,onClick:()=>t(u==null?void 0:u.id),hidden:!!u.deletedAt||s,disabled:!!u.deletedAt||a,icon:l.jsx(M.FontAwesomeIcon,{className:"primary",icon:c})}),[a,s,c,o,t,r,i])}};var Q=(n=>(n.Add="add",n.Edit="edit",n.Delete="delete",n.Restore="restore",n.Refresh="refresh",n.Export="export",n.Import="import",n))(Q||{});const Oe=n=>{const{t:e}=w.useTranslation(),{onClick:t,hidden:s=!1,disabled:r=!1,isLoading:a=!1}=n;return{action:d.useCallback(()=>({id:Q.Export,hidden:s,disabled:r,icon:l.jsx(M.FontAwesomeIcon,{className:`${a?"rotate":""}`,icon:a?A.faCircleNotch:A.faCloudArrowDown}),tooltip:e("_pages:common.actions.export.text"),onClick:t}),[r,s,a,t,e])}},qe=n=>{const{t:e}=w.useTranslation(),{onClick:t,hidden:s=!1,disabled:r=!1,isLoading:a=!1}=n;return{action:d.useCallback(()=>({id:Q.Import,hidden:s,disabled:r,icon:l.jsx(M.FontAwesomeIcon,{className:`${a?"rotate":""}`,icon:a?A.faCircleNotch:A.faCloudUpload}),tooltip:e("_pages:common.actions.import.text"),onClick:t}),[r,s,a,t,e])}},_t=n=>{const{queryKey:e,onSuccess:t,...s}=n,r=L.useQueryClient(),{showStackNotifications:a}=W(),{t:o}=w.useTranslation(),{open:c,onClick:i,close:m,dialogFn:u,isLoading:f}=ye({onSuccessMessage:o("_pages:common.actions.delete.successMessage"),onError:p=>{const g=p;if(ee(g))a(g.errors.map(([b,y])=>({message:o(`_pages:${b}.errors.${y}`),type:R.error})));else if(te(g)){const b=g.message||o("_accessibility:errors.500"),y=o(`_accessibility:errors.${g.status}`);a([{message:y||b,type:R.error}])}},onSuccess:async p=>{await r.invalidateQueries({queryKey:e}),t&&t(p)},...s}),{action:h}=Me({onClick:i});return{onClick:i,title:o("_pages:common.actions.delete.dialog.title"),open:c,isLoading:f,handleSubmit:()=>u.mutate(),handleClose:m,action:h}},be=()=>{const[n,e]=d.useState(!1);return{open:n,setOpen:e,handleClose:()=>e(!1),handleOpen:()=>e(!0)}},Dt=n=>"mutationFn"in n&&"queryKey"in n,se=n=>{const e=Dt(n),t=e?n:void 0,s=e?void 0:n,r=e?"entity":(s==null?void 0:s.mode)??"state",{t:a}=w.useTranslation(),o=L.useQueryClient(),{showErrorNotification:c,showStackNotifications:i,showSuccessNotification:m}=W(),[u,f]=d.useState(),[h,p]=d.useState(!1),g=d.useRef(!1),b=d.useRef(),{open:y,handleClose:x,handleOpen:C}=be(),{control:v,handleSubmit:k,reset:E,setError:q,getValues:F,setValue:S}=Ee.useForm({defaultValues:(t==null?void 0:t.defaultValues)||(s==null?void 0:s.defaultValues)||{}}),j=d.useRef(null),N=d.useCallback(()=>{const T=document.activeElement;if(!(T instanceof HTMLElement)){j.current=null;return}j.current=T.closest("form")},[]),P=t?[...t.queryKey,u??0]:["__legacy-form-dialog-disabled__",u??0],{data:B,isLoading:ne}=L.useQuery({queryFn:async()=>{if(!(!(t!=null&&t.getFunction)||!u))return t.getFunction(u)},queryKey:P,enabled:!!(t!=null&&t.getFunction)&&!!u});d.useEffect(()=>{!t||!B||!t.dtoToForm||b.current!==B&&(E({...t.dtoToForm(B)}),b.current=B)},[B,t,E]),d.useEffect(()=>{if(s){if(!y){g.current=!1;return}if(!g.current){if(g.current=!0,s.reinitializeOnOpen&&s.mapIn){E(s.mapIn());return}if(s.reinitializeOnOpen&&s.defaultValues){E(s.defaultValues);return}s.resetOnOpen&&E(s.defaultValues||{})}}},[s,y,E]);const le=d.useCallback(T=>{const D=T==null?void 0:T.errors,K=[],z=j.current;if(!z||!t)return K;let xe=!1;return D&&D.forEach(([Ce,Ye])=>{const X=z.querySelector(`[name="${Ce}"]`);(X instanceof HTMLInputElement||X instanceof HTMLTextAreaElement||X instanceof HTMLSelectElement)&&(xe||(X.focus(),xe=!0),X.classList.add("error"),K.push(a(`_entities:${t.queryKey}.${Ce}.${Ye}`)))}),K},[t,a]),H=d.useCallback(()=>{const T=j.current;if(!T)return;T.querySelectorAll("input, textarea, select").forEach(K=>{K.classList.remove("error")})},[]),G=d.useCallback(()=>{H(),j.current=null,x(),E()},[x,H,E]),We=d.useCallback(T=>{f(T),C()},[C]),ue=L.useMutation({mutationFn:async T=>{if(t)return t.mutationFn(T)},onError:T=>{if(t)if(t.onError)t.onError(T);else{const D=T;if(ee(D)){const K=le(D);i(K.map(z=>({message:z,type:R.error})))}else if(te(D)){const K=D.message||a("_accessibility:errors.500"),z=a(`_accessibility:errors.${D.status}`);c({message:z||K})}else c({message:a("_accessibility:errors.500")})}},onSuccess:async T=>{t&&(await o.invalidateQueries({queryKey:t.queryKey}),t.onSuccess&&await t.onSuccess(T),m({message:t.onSuccessMessage}),G())}}),re=d.useCallback(T=>t?T:s!=null&&s.mapOut?s.mapOut(T,{id:u}):T,[s,u,t]),Ge=d.useCallback(async()=>{if(!(s!=null&&s.onApply))return;const T=F(),D=re(T);p(!0);try{await s.onApply(D,{close:G,id:u,values:T})}finally{p(!1)}},[G,s,F,u,re]),ze=d.useCallback(async()=>{if(s){if(s.onClear){p(!0);try{await s.onClear()}finally{p(!1)}}E(s.defaultValues||{})}},[s,E]),Je=d.useCallback(async T=>{if(t){N(),ue.mutate(t.formToDto?t.formToDto(T):T);return}const D=re(T);p(!0);try{s!=null&&s.onSubmit&&await s.onSubmit(D,{close:G,id:u,values:T}),((s==null?void 0:s.closeOnSubmit)??!0)&&G()}finally{p(!1)}},[N,G,s,u,ue,t,re]);return{open:y,mode:r,id:u,openDialog:We,handleClose:G,control:v,getValues:F,setValue:S,handleSubmit:k,onSubmit:Je,reset:E,setError:q,title:n.title,isSubmitting:h,onApply:Ge,onClear:ze,isLoading:ne||ue.isPending||h}},Mt=se,Pt=n=>se(n),Ot=n=>{const e=L.useQueryClient(),{mutationFn:t,queryKey:s,onSuccess:r,onError:a,mapOut:o,...c}=n,i=L.useMutation({mutationFn:t});return se({...c,mode:"entity",mapOut:o,onSubmit:async m=>{try{const u=await i.mutateAsync(m);s&&await e.invalidateQueries({queryKey:s}),r&&await r(u)}catch(u){throw a&&a(u),u}}})},qt=n=>{const e=L.useQueryClient(),t=d.useRef(),s=d.useRef(),{mutationFn:r,queryKey:a,onSuccess:o,onError:c,mapOut:i,getFunction:m,dtoToForm:u,title:f,...h}=n,p=d.useRef(u);d.useEffect(()=>{p.current=u},[u]);const g=L.useMutation({mutationFn:r}),b=se({...h,mode:"entity",title:f,onSubmit:async v=>{try{const k=await g.mutateAsync(v);a&&await e.invalidateQueries({queryKey:a}),o&&await o(k)}catch(k){throw c&&c(k),k}},mapOut:v=>i?i(v,t.current):v}),{reset:y}=b,x=a||["put-dialog",f],C=L.useQuery({queryFn:()=>m(b.id),queryKey:[...x,b.id],enabled:b.open&&!!b.id});return d.useEffect(()=>{if(C.data&&s.current!==C.data){if(t.current=C.data,s.current=C.data,p.current&&y){y(p.current(C.data));return}y==null||y(C.data)}},[C.data,y]),{...b,isLoading:b.isLoading||g.isPending||C.isFetching||C.isLoading}},Kt=n=>{const{queryKey:e,onSuccess:t,...s}=n,r=L.useQueryClient(),{showStackNotifications:a}=W(),{t:o}=w.useTranslation(),{open:c,onClick:i,close:m,dialogFn:u,isLoading:f}=ye({onSuccessMessage:o("_pages:common.actions.restore.successMessage"),onError:p=>{const g=p;if(ee(g))a(g.errors.map(([b,y])=>({message:o(`_pages:${b}.errors.${y}`),type:R.error})));else if(te(g)){const b=g.message||o("_accessibility:errors.500"),y=o(`_accessibility:errors.${g.status}`);a([{message:y||b,type:R.error}])}},onSuccess:async p=>{await r.invalidateQueries({queryKey:e}),t&&t(p)},...s}),{action:h}=Pe({onClick:i});return{onClick:i,title:o("_pages:common.actions.restore.dialog.title"),open:c,isLoading:f,handleSubmit:()=>u.mutate(),handleClose:m,action:h}};function Ut(n){const{t:e}=w.useTranslation(),t=L.useQueryClient(),{queryKey:s,mutationFn:r,entity:a,fileProcessor:o,renderCustomPreview:c,onError:i}=n,[m,u]=d.useState(!1),[f,h]=d.useState(null),[p,g]=d.useState(!1),b=L.useMutation({mutationFn:r,onError:x=>{console.error(x),i==null||i(x)},onSuccess:async()=>{await t.invalidateQueries({queryKey:s})}}),{action:y}=qe({onClick:()=>u(!0)});return{handleSubmit:async()=>{if(!(!f||f.length===0))try{await b.mutateAsync({items:f,override:p}),u(!1),h(null),g(!1)}catch(x){console.error(x)}},isLoading:b.isPending,fileProcessor:o,onFileProcessed:x=>h(x),renderCustomPreview:c,onOverrideChange:x=>g(x),open:m,title:e("_pages:common.actions.import.dialog.title",{entity:e(`_pages:${a}.title`)}),handleClose:()=>{u(!1),h(null),g(!1)},action:y}}const Qt=n=>{const{showSuccessNotification:e}=W(),{t}=w.useTranslation(),{entity:s,mutationFn:r,onError:a,onSuccess:o,onSuccessMessage:c=t("_pages:common.actions.export.successMessage")}=n,i=L.useMutation({mutationFn:()=>r(),onError:f=>{console.error(f),a&&a(f)},onSuccess:async f=>{const h=JSON.stringify(f,null,2),p=new Blob([h],{type:"application/json"}),g=URL.createObjectURL(p),b=document.createElement("a");b.href=g,b.download=`${s}.json`,b.click(),URL.revokeObjectURL(g),o&&o(f),e({message:c})}}),m=d.useCallback(()=>{i.mutate()},[i]),{action:u}=Oe({onClick:m,isLoading:i.isPending});return{action:u}},Te=()=>typeof window<"u"?window.scrollY:0;function Ke(n){const[e,t]=d.useState(Te),s=d.useCallback(()=>{t(Te())},[]);return d.useEffect(()=>(window.addEventListener("scroll",s),()=>{window.removeEventListener("scroll",s)}),[s]),e>n}const Bt=n=>{const{t:e}=w.useTranslation(),{icon:t=A.faArrowUp,threshold:s=200,scrollTop:r=0,scrollLeft:a=0,tooltip:o=e("_accessibility:buttons.toTop"),scrollOnClick:c=!0,onClick:i,className:m="",variant:u="submit",color:f="primary",...h}=n,p=Ke(s),g=()=>{i==null||i(),c&&Lt.scrollTo(a,r)};return l.jsx(O,{variant:u,color:f,icon:t,"data-tooltip-id":"tooltip",onClick:g,className:`to-top ${p?"show":"hide"} ${m}`.trim(),"data-tooltip-content":o,...h})};function Ht(n){const{t:e}=w.useTranslation();if("children"in n){const{children:k,className:E}=n;return l.jsx("div",{className:`error-container${E?` ${E}`:""}`,children:k})}const{error:s,message:r,iconProps:a,onRetry:o,retryLabel:c,retryButtonProps:i,messageProps:m,className:u,resetErrorBoundary:f}=n,h=o??f,{className:p,children:g,onClick:b,...y}=i??{},{className:x,...C}=m??{},v=a!==null;return l.jsxs("div",{className:`error-container${u?` ${u}`:""}`,children:[v&&l.jsx(M.FontAwesomeIcon,{...a,icon:(a==null?void 0:a.icon)??et.faSadTear,className:`error-icon${a!=null&&a.className?` ${a.className}`:""}`}),l.jsx("p",{...C,className:`error-message${x?` ${x}`:""}`,children:r??(s==null?void 0:s.message)??e("_accessibility:errors.unknownError")}),h&&l.jsx(w.Button,{type:"button",variant:"submit",color:"primary",...y,className:`error-retry ${p?` ${p}`:""}`,onClick:k=>{b==null||b(k),k.defaultPrevented||h()},children:g??c??e("_accessibility:actions.retry",{defaultValue:"Retry"})})]})}const Vt=n=>{const{showBackButton:e,title:t,actions:s}=n,{t:r}=w.useTranslation(),{navigate:a}=Y();return l.jsxs("div",{className:"page-header",children:[l.jsxs("div",{className:"page-header-left",children:[e&&l.jsx(O,{icon:A.faArrowLeft,onClick:()=>a(-1),className:"page-header-back",name:r("_accessibility:buttons.back"),"data-tooltip-id":"tooltip","data-tooltip-content":r("_accessibility:buttons.back")}),l.jsx("h2",{className:"page-header-title",children:t})]}),l.jsxs("div",{children:[l.jsx(w.Actions,{className:"page-header-actions-desktop",actions:s??[]}),l.jsx(w.ActionsDropdown,{className:"page-header-actions-mobile",actions:s??[]})]})]})},Wt=n=>{const{title:e,children:t,addOptions:s,filterOptions:r,actions:a,queryKey:o,isLoading:c=!1,isAnimated:i=!0,showBackButton:m=!1}=n,{t:u}=w.useTranslation(),f=L.useQueryClient(),{countOfFilters:h}=w.useTableOptions(),p=d.useMemo(()=>{const g=Array.isArray(a)?[...a]:[];if(o){const b={id:Q.Refresh,onClick:()=>f.invalidateQueries({queryKey:o}),icon:l.jsx(M.FontAwesomeIcon,{icon:A.faRotateLeft}),tooltip:u("_pages:common.actions.refresh.text")};g.unshift(b)}if(s){const b={...s,id:Q.Add,icon:l.jsx(M.FontAwesomeIcon,{icon:A.faAdd})};g.unshift(b)}if(r){const b={...r,id:"filter",icon:l.jsx(M.FontAwesomeIcon,{icon:A.faFilter}),children:l.jsx(w.Badge,{className:`${h>0?"show":"hide"} `,count:h})};g.push(b)}return g},[a,s,h,r,f,o,u]);return l.jsxs("main",{className:"page-main",children:[l.jsx(Vt,{showBackButton:m,actions:p,title:e}),l.jsx("div",{className:`page-main-content ${i?"appear":""}`,children:c?l.jsx(w.Loading,{className:"page-loading"}):t}),s&&l.jsx(O,{icon:s.icon??A.faAdd,color:s.color??"primary",variant:s.variant??"submit",onClick:()=>{var g;return(g=s.onClick)==null?void 0:g.call(s)},className:`button page-fab ${s.className??""}`})]})},Gt=n=>{const{t:e}=w.useTranslation(),{className:t="",itemClassName:s="",loading:r=!1,emptyComponent:a=null,emptyMessage:o=e("_accessibility:messages.empty"),renderComponent:c,data:i=[],hasMore:m=!1,loadingMore:u=!1,onLoadMore:f,loadMoreComponent:h=null,observerRootMargin:p="0px 0px 200px 0px",observerThreshold:g=0}=n,b=d.useRef(!1),y=d.useRef(null),x=d.useCallback(async()=>{if(!(!m||!f)&&!(u||b.current)){b.current=!0;try{await f()}finally{b.current=!1}}},[m,u,f]);return d.useEffect(()=>{if(!m||!f||!y.current||typeof IntersectionObserver>"u")return;const C=new IntersectionObserver(v=>{v.some(k=>k.isIntersecting)&&x()},{rootMargin:p,threshold:g});return C.observe(y.current),()=>C.disconnect()},[m,f,p,g,x]),r?l.jsx(w.Loading,{}):l.jsx(l.Fragment,{children:i!=null&&i.length?l.jsxs("ul",{className:`pretty-grid-main ${t}`,children:[i==null?void 0:i.map(C=>l.jsx("li",{className:`pretty-grid-item ${s}`,children:c(C)},C.id)),m&&f&&l.jsx("li",{className:"pretty-grid-load-more",ref:y,children:h})]}):l.jsx(l.Fragment,{children:a||l.jsx(Ve,{message:o})})})},we=d.createContext({title:"",setTitle:()=>{},rightContent:null,setRightContent:()=>{}}),zt=n=>{const{children:e}=n,[t,s]=d.useState(""),[r,a]=d.useState(null),o=d.useCallback(m=>{s(m)},[]),c=d.useCallback(m=>{a(m)},[]),i=d.useMemo(()=>({title:t,setTitle:o,rightContent:r,setRightContent:c}),[t,o,r,c]);return l.jsx(we.Provider,{value:i,children:e})},Ue=()=>d.useContext(we);function Jt(n){const{t:e}=w.useTranslation(),{openDrawer:t,showSearch:s=!0,menuButtonProps:r}=n,{searchComponent:a,location:o}=Y(),{title:c,rightContent:i}=Ue(),[m,u]=d.useState(!1),f=d.useCallback(g=>{($e()?g.metaKey:g.ctrlKey)&&g.shiftKey&&g.key.toLowerCase()==="f"&&(u(!0),g.preventDefault())},[]);d.useEffect(()=>(window.addEventListener("keydown",f),()=>{window.removeEventListener("keydown",f)}),[f]);const h=a,p=s&&!!h;return l.jsxs(l.Fragment,{children:[o.pathname!=="/"&&!!h&&l.jsx(h,{open:m,onClose:()=>u(!1)}),l.jsxs("header",{id:"header",className:"header",children:[l.jsxs("div",{className:"navbar-left",children:[l.jsx(O,{...r,type:(r==null?void 0:r.type)??"button",icon:(r==null?void 0:r.icon)??A.faBars,onClick:g=>{var b;(b=r==null?void 0:r.onClick)==null||b.call(r,g),t()},name:(r==null?void 0:r.name)??e("_accessibility:buttons.openMenu"),"aria-label":(r==null?void 0:r["aria-label"])??e("_accessibility:ariaLabels.openMenu"),className:`navbar-menu animated ${(r==null?void 0:r.className)??""}`}),l.jsx("h1",{className:"poppins navbar-title",children:c||e("_pages:home.appName")})]}),l.jsxs("div",{className:"navbar-right",children:[i,p&&l.jsx(O,{icon:A.faSearch,className:"navbar-search-btn",onClick:()=>u(!0)})]})]})]})}const ae=300,Yt=n=>n??R.error,Xt=n=>{switch(n){case R.error:return A.faWarning;default:return A.faCircleCheck}},me=n=>{switch(n){case R.success:return"!text-success";case R.error:return"!text-error";case R.warning:return"!text-warning";default:return"!text-info"}},Zt=n=>{switch(n){case R.success:return"bg-bg-success";case R.error:return"bg-bg-error";case R.warning:return"bg-bg-warning";default:return"bg-bg-info"}};function es(){const{t:n}=w.useTranslation(),{notification:e,removeNotification:t}=W(),[s,r]=d.useState([]),a=d.useRef(s);d.useLayoutEffect(()=>{a.current=s});const o=d.useRef(null),c=d.useCallback(i=>{r(m=>i!==void 0?m.map(u=>u.id===i?{...u,closing:!0}:u):m.map(u=>({...u,closing:!0}))),i!==void 0?setTimeout(()=>{t(i),r(m=>m.filter(u=>u.id!==i))},ae):(o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{t(),r([]),o.current=null},ae))},[t]);return d.useEffect(()=>{let i=null;const m=()=>{i&&clearTimeout(i),o.current&&(clearTimeout(o.current),o.current=null)};if(e.length===0)return a.current.length===0?void 0:(o.current&&clearTimeout(o.current),i=setTimeout(()=>{r(p=>p.map(g=>({...g,closing:!0}))),i=null},0),o.current=setTimeout(()=>{r([]),o.current=null},ae),m);const u=new Set(a.current.map(p=>p.id));if(!e.some(p=>p.id!==void 0&&!u.has(p.id)))return;if(a.current.length===0){const p=[...e];return i=setTimeout(()=>{r(p.map(g=>({...g,closing:!1}))),i=null},0),()=>{i&&clearTimeout(i)}}o.current&&clearTimeout(o.current),i=setTimeout(()=>{r(p=>p.every(g=>g.closing)?p:p.map(g=>({...g,closing:!0}))),i=null},0);const h=[...e];return o.current=setTimeout(()=>{r(h.map(p=>({...p,closing:!1}))),o.current=null},ae),m},[e]),d.useEffect(()=>{if(!s.length)return;let i;const m=window.setTimeout(()=>{i=()=>c(),window.addEventListener("click",i)},0),u=f=>{f.key==="Escape"&&c()};return window.addEventListener("keydown",u),()=>{window.clearTimeout(m),i&&window.removeEventListener("click",i),window.removeEventListener("keydown",u)}},[s.length,c]),ve.createPortal(l.jsx("div",{className:`notification-portal ${s.length?"active":""}`,children:s.map(({id:i,type:m,message:u,closing:f})=>{const h=Yt(m);return l.jsxs("div",{className:`notification ${f?"closing":""} ${Zt(h)}`,onClick:p=>p.stopPropagation(),children:[l.jsxs("div",{className:"notification-body",children:[l.jsx(M.FontAwesomeIcon,{icon:Xt(h),className:`notification-icon ${me(h)}`}),l.jsx("p",{className:`notification-text ${me(h)}`,children:u})]}),l.jsx(O,{type:"button",icon:A.faClose,color:"error",className:"notification-close group",onClick:p=>{p.stopPropagation(),i!==void 0&&c(i)},iconClassName:`${me(h)} notification-close-icon`,name:n("_accessibility:buttons.closeNotification"),"aria-label":n("_accessibility:ariaLabels.closeNotification")})]},i)})}),document.body)}function ts(n){const{className:e,...t}=n;return l.jsx("div",{className:"splash-screen",children:l.jsx(w.Loading,{className:`blur-appear ${e?` ${e}`:""}`,...t})})}const Qe=n=>{const{id:e,active:t,onClick:s,children:r,to:a,useLinks:o=!0,tabButtonProps:c}=n,{linkComponent:i}=Y(),m=i;if(!o){const{className:f="",variant:h=t?"submit":"outlined",color:p=t?"primary":"default",...g}=c??{};return l.jsx(w.Button,{type:"button",variant:h,color:p,className:`tab ${f}`,onClick:s,...g,children:r})}const u=`button submit tab ${t?"primary":"outlined"} ${(c==null?void 0:c.className)??""}`.trim();return l.jsx(m,{to:a??`#${e}`,onClick:()=>s(),className:u,children:r})},Be=n=>{var p;const{tabs:e=[],defaultTab:t,currentTab:s,onTabChange:r,className:a="",tabsContainerClassName:o="",useLinks:c=!0,tabButtonProps:i}=n,[m,u]=d.useState(t??((p=e[0])==null?void 0:p.id)),f=s??m,h=d.useMemo(()=>e.find(g=>g.id===f),[e,f]);return l.jsxs("div",{className:`tabs-layout-main ${a}`,children:[l.jsx("ul",{className:`horizontal tabs tabs-container ${o}`,children:e.map(({id:g,to:b,label:y})=>l.jsx("li",{children:l.jsx(Qe,{onClick:()=>{s===void 0&&u(g),r==null||r(g)},id:g,to:b,siblings:e.length>1,active:f===g,useLinks:c,tabButtonProps:i,children:y})},g))}),h==null?void 0:h.content]})},He=n=>{const{title:e,body:t,content:s,onClickNext:r,onSkip:a,onStartAsGuest:o,onSignIn:c,image:i="",alt:m="",final:u=!1}=n,{t:f}=w.useTranslation();return l.jsxs("div",{className:"big-appear step-container",children:[i&&l.jsx("img",{src:i,alt:m}),e!=null&&l.jsx("h2",{className:"step-title",children:e}),t!=null&&l.jsx("div",{className:"step-body",children:t}),s!=null&&l.jsx("div",{className:"step-content",children:s}),l.jsx("div",{className:"step-actions",children:u?l.jsxs(l.Fragment,{children:[l.jsx(w.Button,{color:"primary",className:"step-button",variant:"outlined",onClick:o,"aria-label":f("_accessibility:ariaLabels.start"),children:f("_accessibility:buttons.startAsGuest")}),l.jsx(w.Button,{color:"primary",variant:"submit",className:"step-button","aria-label":f("_accessibility:ariaLabels.start"),onClick:c,children:f("_accessibility:buttons.signIn")})]}):l.jsxs(l.Fragment,{children:[l.jsx(w.Button,{color:"primary",className:"step-button",variant:"outlined",onClick:a,"aria-label":f("_accessibility:ariaLabels.skip"),children:f("_accessibility:buttons.skip")}),l.jsx(w.Button,{color:"primary",className:"step-button",variant:"outlined",onClick:()=>r(),"aria-label":f("_accessibility:ariaLabels.next"),children:f("_accessibility:buttons.next")})]})})]})},ss=n=>{const{steps:e,signInPath:t="/auth/sign-in",guestPath:s="/",onSkip:r,onSignIn:a,onStartAsGuest:o}=n,{setGuestMode:c}=pe(),{navigate:i}=Y(),[m,u]=d.useState(1),f=d.useCallback(()=>{if(r){r();return}i(t)},[i,r,t]),h=d.useCallback(()=>{if(a){a();return}i(t)},[i,a,t]),p=d.useCallback(()=>{if(o){o();return}c(!0),i(s)},[s,i,o,c]),g=d.useMemo(()=>e.map((b,y)=>({id:y+1,label:"",content:l.jsx(He,{...b,final:y===e.length-1,onClickNext:()=>u(x=>x+1),onSkip:f,onStartAsGuest:p,onSignIn:h})})),[h,f,p,e]);return l.jsx("div",{className:"onboarding-main",children:l.jsx(Be,{currentTab:m,onTabChange:b=>u(Number(b)),tabs:g,useLinks:!1})})},Ve=n=>{const{message:e,messageProps:t={className:"empty-message"},action:s,iconProps:r}=n;return l.jsxs("div",{className:"empty-container",children:[r&&l.jsx(M.FontAwesomeIcon,{...r}),l.jsx("p",{...t,children:e}),s&&l.jsx(w.Action,{showTooltips:!1,showText:!0,...s})]})};Object.defineProperty(exports,"Action",{enumerable:!0,get:()=>w.Action});Object.defineProperty(exports,"Actions",{enumerable:!0,get:()=>w.Actions});Object.defineProperty(exports,"ActionsDropdown",{enumerable:!0,get:()=>w.ActionsDropdown});Object.defineProperty(exports,"Button",{enumerable:!0,get:()=>w.Button});exports.APIClient=Z;exports.AppIconButton=O;exports.AuthClient=Ae;exports.AuthProvider=vt;exports.BaseClient=pt;exports.ConfigProvider=Et;exports.ConfirmationDialog=at;exports.Dialog=ie;exports.DialogActions=ce;exports.Drawer=At;exports.DrawerMenuContext=ge;exports.DrawerMenuProvider=jt;exports.Empty=Ve;exports.Error=Ht;exports.FormContainer=st;exports.FormDialog=rt;exports.GlobalActions=Q;exports.IManager=ht;exports.IconButton=O;exports.ImportDialog=ut;exports.IndexedDBClient=gt;exports.ManagerProvider=Tt;exports.Methods=I;exports.Navbar=Jt;exports.NavbarContext=we;exports.NavbarProvider=zt;exports.Notification=es;exports.NotificationEnumType=R;exports.NotificationProvider=kt;exports.Onboarding=ss;exports.Page=Wt;exports.ParagraphInput=tt;exports.PasswordInput=nt;exports.PrettyGrid=Gt;exports.SplashScreen=ts;exports.Step=He;exports.Tab=Qe;exports.TabsLayout=Be;exports.ToTop=Bt;exports.buildQueryUrl=je;exports.createQueryClient=he;exports.enumToKeyValueArray=yt;exports.formatForDatetimeLocal=xt;exports.fromLocal=V;exports.getFormattedDateTime=bt;exports.getShortFormattedDateTime=wt;exports.isHttpError=te;exports.isMac=$e;exports.isValidationError=ee;exports.makeRequest=oe;exports.mapValidationErrors=Ct;exports.parseQueries=fe;exports.queryClient=St;exports.removeFromLocal=_;exports.toLocal=U;exports.useAuth=pe;exports.useConfig=Y;exports.useConfirmationForm=ye;exports.useDeleteAction=Me;exports.useDeleteDialog=_t;exports.useDialog=be;exports.useDrawerMenu=De;exports.useEditAction=Ft;exports.useEntityFormDialog=Pt;exports.useExportAction=Oe;exports.useExportActionMutate=Qt;exports.useFormDialog=se;exports.useFormDialogLegacy=Mt;exports.useImportAction=qe;exports.useImportDialog=Ut;exports.useManager=Ie;exports.useNavbar=Ue;exports.useNotification=W;exports.usePostDialog=Ot;exports.usePostForm=It;exports.usePutDialog=qt;exports.useRestoreAction=Pe;exports.useRestoreDialog=Kt;exports.useScrollTrigger=Ke;exports.useTimeAge=Rt;Object.keys(w).forEach(n=>{n!=="default"&&!Object.prototype.hasOwnProperty.call(exports,n)&&Object.defineProperty(exports,n,{enumerable:!0,get:()=>w[n]})});
|
|
1
|
+
var Xe=Object.defineProperty;var Ze=(n,e,t)=>e in n?Xe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var A=(n,e,t)=>Ze(n,typeof e!="symbol"?e+"":e,t);var rs=require("./main.css");Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("@sito/dashboard"),l=require("react/jsx-runtime"),M=require("@fortawesome/react-fontawesome"),d=require("react"),j=require("@fortawesome/free-solid-svg-icons"),ve=require("react-dom"),$=require("@tanstack/react-query"),et=require("@fortawesome/free-regular-svg-icons"),Ee=require("react-hook-form"),ke=n=>n==null?!1:`${n}`.length>0,tt=d.forwardRef(function(n,e){const{value:t,defaultValue:s,onChange:r,state:a=w.State.default,name:o="",id:c="",label:i="",disabled:m=!1,required:u=!1,containerClassName:f="",inputClassName:p="",labelClassName:g="",helperText:h="",helperTextClassName:b="",...y}=n,x=t!==void 0,[C,v]=d.useState(()=>ke(s)),N=x?ke(t):C,T=P=>{x||v(P.currentTarget.value.length>0),r==null||r(P)};return l.jsxs("div",{className:`form-paragraph-container group ${f}`,children:[l.jsx("textarea",{ref:e,name:o,id:c,className:`text-input text-area form-paragraph-textarea peer ${w.inputStateClassName(a)} ${N?"has-value":""} ${y.placeholder?"has-placeholder":""} ${p}`,required:u,defaultValue:s,...x?{value:t}:{},onChange:T,disabled:m,...y}),l.jsxs("label",{htmlFor:c,className:`text-input-label ${w.labelStateClassName(a)} ${g}`,children:[i,u?" *":""]}),!!h&&l.jsx("p",{className:`text-input-helper-text ${w.helperTextStateClassName(a)} ${b}`,children:h})]})}),st=n=>{const{t:e}=w.useTranslation(),{children:t,handleSubmit:s,onSubmit:r,isLoading:a=!1,buttonEnd:o=!0,reset:c}=n;return l.jsxs("form",{className:"form-container",onSubmit:s(r),children:[t,l.jsxs("div",{className:`form-actions ${o?"end":""}`,children:[l.jsxs(w.Button,{type:"submit",color:"primary",variant:"submit",disabled:a,name:e("_accessibility:buttons.submit"),"aria-label":e("_accessibility:ariaLabels.submit"),children:[a?l.jsx(w.Loading,{color:"stroke-base",loaderClass:"!w-6 mt-1",strokeWidth:"6"}):null,e("_accessibility:buttons.submit")]}),l.jsx(w.Button,{type:"button",variant:"outlined",onClick:()=>c==null?void 0:c(),name:e("_accessibility:buttons.cancel"),"aria-label":e("_accessibility:ariaLabels.cancel"),children:e("_accessibility:buttons.cancel")})]})]})},nt=d.forwardRef(function(n,e){const{t}=w.useTranslation(),[s,r]=d.useState(!1);return l.jsx(w.TextInput,{...n,type:s?"text":"password",ref:e,children:l.jsx(q,{type:"button",tabIndex:-1,"aria-label":t(s?"_accessibility:ariaLabels.hidePassword":"_accessibility:ariaLabels.showPassword"),className:"password-icon",onClick:()=>r(!s),icon:s?j.faEyeSlash:j.faEye})})}),ie=n=>{const{t:e}=w.useTranslation(),{title:t,children:s,handleClose:r,open:a=!1,containerClassName:o="",className:c="",animationClass:i="appear"}=n,m=d.useCallback(f=>{f.key==="Escape"&&a&&r()},[a,r]);d.useEffect(()=>(window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m)}),[m]);const u=d.useCallback(f=>{f.target===f.currentTarget&&r()},[r]);return d.useEffect(()=>{const f=p=>{p?document.body.style.overflow="hidden":document.body.style.overflow="auto"};return f(a),()=>{f(!1)}},[a]),ve.createPortal(l.jsx("div",{"aria-label":e("_accessibility:ariaLabels.closeDialog"),"aria-hidden":!a,onClick:u,className:`dialog-backdrop animated ${a?`opened ${i}`:"closed"} ${o}`,children:l.jsxs("div",{className:`dialog elevated animated ${a?`opened ${i}`:"closed"} ${c}`,children:[l.jsxs("div",{className:"dialog-header",children:[l.jsx("h3",{className:"dialog-title",children:t}),l.jsx(q,{icon:j.faClose,disabled:!a,"aria-disabled":!a,onClick:r,variant:"text",color:"error",className:"icon-button dialog-close-btn",name:e("_accessibility:buttons.closeDialog"),"aria-label":e("_accessibility:ariaLabels.closeDialog")})]}),s]})}),document.body)},ce=n=>{const{primaryText:e,cancelText:t,onPrimaryClick:s,onCancel:r,isLoading:a=!1,disabled:o=!1,primaryType:c="submit",containerClassName:i="",primaryClassName:m="",alignEnd:u=!1,primaryName:f,primaryAriaLabel:p,cancelName:g,cancelAriaLabel:h,extraActions:b=[]}=n;return l.jsxs("div",{className:`dialog-actions ${u?"end":""} ${i}`,children:[l.jsxs(w.Button,{type:c,color:"primary",variant:"submit",className:m,disabled:o,onClick:s,name:f,"aria-label":p,children:[a?l.jsx(w.Loading,{color:"stroke-base",loaderClass:"!w-6 mt-1",strokeWidth:"6"}):null,e]}),b==null?void 0:b.map(y=>l.jsx(w.Button,{...y},y.id)),l.jsx(w.Button,{type:"button",variant:"outlined",disabled:o,onClick:r,name:g,"aria-label":h,children:t})]})},rt=n=>{const{t:e}=w.useTranslation(),{children:t,handleSubmit:s,onSubmit:r,handleClose:a,isLoading:o=!1,buttonEnd:c=!0,extraActions:i=[],...m}=n;return l.jsx(ie,{...m,handleClose:a,children:l.jsxs("form",{onSubmit:s(r),children:[l.jsx("div",{className:"form-container",children:t}),l.jsx(ce,{primaryType:"submit",primaryText:e("_accessibility:buttons.submit"),cancelText:e("_accessibility:buttons.cancel"),onCancel:a,isLoading:o,disabled:o,primaryClassName:"dialog-form-primary",alignEnd:c,primaryName:e("_accessibility:buttons.submit"),primaryAriaLabel:e("_accessibility:ariaLabels.submit"),cancelName:e("_accessibility:buttons.cancel"),cancelAriaLabel:e("_accessibility:ariaLabels.cancel"),extraActions:i})]})})},at=n=>{const{t:e}=w.useTranslation(),{children:t,handleSubmit:s,handleClose:r,isLoading:a=!1,extraActions:o=[],...c}=n;return l.jsxs(ie,{...c,handleClose:r,children:[t,l.jsx(ce,{primaryText:e("_accessibility:buttons.ok"),cancelText:e("_accessibility:buttons.cancel"),onPrimaryClick:s,onCancel:r,isLoading:a,disabled:a,primaryType:"button",containerClassName:"mt-5",primaryName:e("_accessibility:buttons.ok"),primaryAriaLabel:e("_accessibility:ariaLabels.ok"),cancelName:e("_accessibility:buttons.cancel"),cancelAriaLabel:e("_accessibility:ariaLabels.cancel"),extraActions:o})]})};function ot(n){const{message:e,className:t=""}=n,{t:s}=w.useTranslation();return l.jsx("p",{className:`import-error-message ${t}`,children:e??s("_messages:errors.parseFile",{defaultValue:"Failed to process file"})})}function it(n){const{message:e,className:t=""}=n,{t:s}=w.useTranslation();return l.jsxs("div",{className:`import-loading ${t}`,children:[l.jsx(w.Loading,{loaderClass:"w-5 h-5",className:"!w-auto"}),l.jsx("span",{children:e??s("_messages:loading.processingFile",{defaultValue:"Processing file..."})})]})}function ct(n){const{items:e,max:t=5,className:s=""}=n,{t:r}=w.useTranslation();if(!e||e.length===0)return null;const a=e.slice(0,t);return l.jsxs("div",{className:`import-preview ${s}`,children:[l.jsx("p",{className:"import-preview-count",children:r("_pages:common.actions.import.previewCount",{count:e.length,defaultValue:`Preview: ${e.length} items`})}),l.jsx("pre",{className:"import-preview-content",children:JSON.stringify(a,null,2)})]})}const Ne=()=>({file:null,previewItems:null,parseError:null,processing:!1,overrideExisting:!1,inputKey:0});function lt(n,e){switch(e.type){case"SET_FILE":return{...n,file:e.file,previewItems:null,parseError:null,processing:!1};case"START_PROCESSING":return{...n,processing:!0};case"SET_PREVIEW":return{...n,previewItems:e.items,parseError:null,processing:!1};case"SET_ERROR":return{...n,previewItems:null,parseError:e.message,processing:!1};case"SET_OVERRIDE":return{...n,overrideExisting:e.value};case"RESET":return{...Ne(),inputKey:n.inputKey+1}}}const ut=n=>{const{t:e}=w.useTranslation(),{children:t,handleSubmit:s,handleClose:r,isLoading:a=!1,fileProcessor:o,onFileProcessed:c,renderCustomPreview:i,onOverrideChange:m,open:u,extraActions:f=[],...p}=n,[g,h]=d.useReducer(lt,Ne()),{file:b,previewItems:y,parseError:x,processing:C,overrideExisting:v,inputKey:N}=g,T=d.useRef(c),P=d.useRef(o);d.useEffect(()=>{T.current=c},[c]),d.useEffect(()=>{P.current=o},[o]),d.useEffect(()=>{u||h({type:"RESET"})},[u]);const K=d.useCallback(async(k,E)=>{var L;if(P.current){h({type:"START_PROCESSING"});try{const R=await P.current(k,{override:E});h({type:"SET_PREVIEW",items:R??[]}),(L=T.current)==null||L.call(T,R??[])}catch(R){console.error(R);const O=R instanceof Error?R.message:"Failed to parse file";h({type:"SET_ERROR",message:O})}}},[]);return l.jsxs(ie,{...p,open:u,handleClose:r,children:[l.jsx(w.FileInput,{onClear:()=>{var k;h({type:"SET_FILE",file:null}),(k=T.current)==null||k.call(T,[])},onChange:k=>{var L,R;const E=(L=k.target.files)==null?void 0:L[0];if(!E){h({type:"SET_FILE",file:null}),(R=T.current)==null||R.call(T,[]);return}h({type:"SET_FILE",file:E}),K(E,v)},label:e("_accessibility:labels.file")},N),l.jsxs("label",{className:"import-override-label",children:[l.jsx("input",{type:"checkbox",checked:v,onChange:k=>{const E=k.target.checked;h({type:"SET_OVERRIDE",value:E}),m==null||m(E),b&&K(b,E)}}),l.jsx("span",{children:e("_pages:common.actions.import.override",{defaultValue:"Override existing items"})})]}),l.jsx(ot,{message:x}),C&&l.jsx(it,{}),i?i(y):!!y&&y.length>0&&l.jsx(ct,{items:y}),t,l.jsx(ce,{primaryText:e("_accessibility:buttons.ok"),cancelText:e("_accessibility:buttons.cancel"),onPrimaryClick:()=>{(!o||!!y&&y.length>0)&&s()},onCancel:r,isLoading:a,primaryType:"button",containerClassName:"import-dialog-actions",primaryName:e("_accessibility:buttons.ok"),primaryAriaLabel:e("_accessibility:ariaLabels.ok"),cancelName:e("_accessibility:buttons.cancel"),cancelAriaLabel:e("_accessibility:ariaLabels.cancel"),extraActions:f})]})};var I=(n=>(n[n.success=0]="success",n[n.error=1]="error",n[n.warning=2]="warning",n[n.info=3]="info",n))(I||{}),F=(n=>(n.GET="GET",n.POST="POST",n.PUT="PUT",n.PATCH="PATCH",n.DELETE="DELETE",n))(F||{});const dt=n=>Array.isArray(n)||n instanceof Headers?!1:typeof n=="object"&&n!==null&&("headers"in n||"credentials"in n),mt=n=>n?dt(n)?n:{headers:n}:{},ft=n=>n?n instanceof Headers?Object.fromEntries(n.entries()):Array.isArray(n)?Object.fromEntries(n):n:{};async function oe(n,e="GET",t,s){const r=mt(s),a={...t!==void 0?{"Content-Type":"application/json"}:{},...ft(r.headers)};try{const o=await fetch(n,{method:e,headers:a,...r.credentials?{credentials:r.credentials}:{},...t!==void 0?{body:JSON.stringify(t)}:{}}),c=await o.text();let i=null;try{i=c?JSON.parse(c):null}catch{i=null}if(!o.ok){const m=typeof i=="object"&&i!==null?i.message??i.error??c:c||o.statusText;return{data:null,status:o.status,error:{status:o.status,message:m||"Unknown error occurred"}}}return{data:o.status!==204&&i!==null?i:null,status:o.status,error:null}}catch(o){return{data:null,status:500,error:{status:500,message:o instanceof Error?o.message:"Unknown error occurred"}}}}function je(n,e){if(e){const t=Object.entries(e).filter(([,s])=>s!=null).map(([s,r])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(r))}`).join("&");return t?`${n}?${t}`:n}return n}const fe=(n,e,t)=>{const s=[];if(e){const{sortingBy:r,sortingOrder:a,currentPage:o,pageSize:c}=e;r!==void 0&&s.push(`sort=${String(r)}`),a!==void 0&&s.push(`order=${a}`),o!==void 0&&s.push(`page=${o}`),c!==void 0&&s.push(`pageSize=${c}`)}if(t){const r=Object.entries(t).filter(([,a])=>a!=null&&a!=="").flatMap(([a,o])=>{if(Array.isArray(o))return o.map(c=>`${a}==${encodeURIComponent((c==null?void 0:c.id)??c)}`);if(typeof o=="object"&&o!==null&&"start"in o&&"end"in o){const c=[];return o.start!=null&&o.start!==""&&c.push(`${a}>=${encodeURIComponent(o.start)}`),o.end!=null&&o.end!==""&&c.push(`${a}<=${encodeURIComponent(o.end)}`),c}return typeof o=="object"&&o!==null?`${a}==${encodeURIComponent(o.id??"")}`:`${a}==${encodeURIComponent(o)}`});r.length>0&&s.push(`filters=${r.join(",")}`)}return s.length?`${n}?${s.join("&")}`:n},J=class J{constructor(e,t="user",s=!0,r,a={}){A(this,"baseUrl");A(this,"userKey");A(this,"rememberKey");A(this,"refreshTokenKey");A(this,"accessTokenExpiresAtKey");A(this,"refreshEndpoint");A(this,"refreshExpirySkewMs");A(this,"secured");A(this,"tokenAcquirer");this.baseUrl=e,this.secured=s,this.userKey=t,this.rememberKey=a.rememberKey??"remember",this.refreshTokenKey=a.refreshTokenKey??"refreshToken",this.accessTokenExpiresAtKey=a.accessTokenExpiresAtKey??"accessTokenExpiresAt",this.refreshEndpoint=a.refreshEndpoint??"auth/refresh",this.refreshExpirySkewMs=a.refreshExpirySkewMs??5e3,this.tokenAcquirer=r??this.defaultTokenAcquirer}defaultTokenAcquirer(e){if(e)return{credentials:"include"};const t=V(this.userKey);if(t&&t.length)return{Authorization:`Bearer ${t}`}}getRefreshLockKey(){return`${this.baseUrl}|${this.userKey}|${this.refreshTokenKey}|${this.accessTokenExpiresAtKey}`}buildUrl(e){const t=this.baseUrl.endsWith("/")?this.baseUrl.slice(0,-1):this.baseUrl,s=e.startsWith("/")?e:`/${e}`;return`${t}${s}`}getRefreshToken(){const e=V(this.refreshTokenKey);if(typeof e=="string"&&e.length)return e}getAccessTokenExpiresAt(){const e=V(this.accessTokenExpiresAtKey);if(typeof e=="string"&&e.length)return e}canRefresh(){return!!this.getRefreshToken()}shouldRefreshBeforeRequest(){const e=this.getRefreshToken(),t=this.getAccessTokenExpiresAt();if(!e||!t)return!1;const s=Date.parse(t);return Number.isNaN(s)?!1:Date.now()>=s-this.refreshExpirySkewMs}clearStoredSession(){_(this.userKey),_(this.rememberKey),_(this.refreshTokenKey),_(this.accessTokenExpiresAtKey)}storeSession(e,t){Q(this.userKey,e.token);const s=e.refreshToken===void 0?t:e.refreshToken;typeof s=="string"&&s.length?Q(this.refreshTokenKey,s):_(this.refreshTokenKey),typeof e.accessTokenExpiresAt=="string"&&e.accessTokenExpiresAt.length?Q(this.accessTokenExpiresAtKey,e.accessTokenExpiresAt):_(this.accessTokenExpiresAtKey)}async refreshAccessTokenWithMutex(){const e=this.getRefreshToken();if(!e)throw{status:401,message:"Missing refresh token"};const t=this.getRefreshLockKey(),s=J.refreshInFlight.get(t);if(s){await s;return}const r=(async()=>{const{data:a,status:o,error:c}=await oe(this.buildUrl(this.refreshEndpoint),F.POST,{refreshToken:e});if(c||!(a!=null&&a.token))throw this.clearStoredSession(),c??{status:o,message:"Unable to refresh session"};this.storeSession(a,e)})();J.refreshInFlight.set(t,r);try{await r}finally{J.refreshInFlight.delete(t)}}isRequestOptions(e){return Array.isArray(e)||e instanceof Headers?!1:typeof e=="object"&&e!==null&&("headers"in e||"credentials"in e)}toRequestOptions(e){return e?this.isRequestOptions(e)?e:{headers:e}:{}}toHeaderRecord(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):e:{}}mergeRequestConfig(e){const t=this.secured?this.tokenAcquirer():void 0,s=this.toRequestOptions(t),r=this.toRequestOptions(e),a={...this.toHeaderRecord(s.headers),...this.toHeaderRecord(r.headers)},o=r.credentials??s.credentials,c=Object.keys(a).length>0;if(o)return c?{headers:a,credentials:o}:{credentials:o};if(c)return a}async makeRequestWithRefresh(e,t,s,r){this.secured&&this.shouldRefreshBeforeRequest()&&await this.refreshAccessTokenWithMutex();let a=await oe(this.buildUrl(e),t,s,this.mergeRequestConfig(r));return this.secured&&a.status===401&&this.canRefresh()&&(await this.refreshAccessTokenWithMutex(),a=await oe(this.buildUrl(e),t,s,this.mergeRequestConfig(r))),a}async doQuery(e,t=F.GET,s,r){const{data:a,status:o,error:c}=await this.makeRequestWithRefresh(e,t,s,r);if(c||o<200||o>=300)throw c??{status:o,message:String(o)};return a}async get(e,t,s){const r=fe(e,t,s),{data:a,error:o,status:c}=await this.makeRequestWithRefresh(r,F.GET);if(o||c<200||c>=300||!a)throw o??{status:c,message:String(c)};return a}async patch(e,t){const{error:s,data:r,status:a}=await this.makeRequestWithRefresh(e,F.PATCH,t);if(s||r===null||r===void 0)throw s??{status:a,message:"Unknown error"};return r}async delete(e,t){const{error:s,data:r,status:a}=await this.makeRequestWithRefresh(e,F.DELETE,t);if(s||r===null||r===void 0)throw s??{status:a,message:"Unknown error"};return r}async post(e,t){const{error:s,data:r,status:a}=await this.makeRequestWithRefresh(e,F.POST,t);if(s||r===null||r===void 0)throw s??{status:a,message:"Unknown error"};return r}};A(J,"refreshInFlight",new Map);let Z=J;class Ae{constructor(e,t="user",s={}){A(this,"api");this.api=new Z(e,t,!1,void 0,s)}async login(e){const t="auth/sign-in",s=e;return await this.api.doQuery(t,F.POST,s)}async refresh(e){return await this.api.doQuery("auth/refresh",F.POST,e)}async logout(e){const t="auth/sign-out",s=e!=null&&e.accessToken?{Authorization:`Bearer ${e.accessToken}`}:void 0,r=e!=null&&e.refreshToken?{refreshToken:e.refreshToken}:void 0;return await this.api.doQuery(t,F.POST,r,s)}async register(e){return await this.api.doQuery("auth/sign-up",F.POST,e)}async getSession(){return await this.api.doQuery("auth/session",F.GET,void 0,this.api.defaultTokenAcquirer())}}class ht{constructor(e,t,s={}){A(this,"auth");this.auth=new Ae(e,t,s)}get Auth(){return this.auth}}class pt{constructor(e,t,s="user",r=!0,a={}){A(this,"table");A(this,"secured");A(this,"api");this.table=e,this.secured=r,this.api=new Z(t,s,r,void 0,a)}async insert(e){return await this.api.post(`${this.table}`,e)}async insertMany(e){return await this.api.doQuery(`${this.table}/batch`,F.POST,e)}async update(e){return await this.api.patch(`${this.table}/${e.id}`,e)}async get(e,t){return await this.api.get(`${this.table}`,e,t)}async export(e){const t=fe(`${this.table}/export`,void 0,e);return await this.api.doQuery(t,F.GET,void 0)}async import(e){return await this.api.doQuery(`${this.table}/import`,F.POST,e)}async commonGet(e){return await this.api.doQuery(je(`${this.table}/common`,e),F.GET)}async getById(e){return await this.api.doQuery(`${this.table}/${e}`)}async softDelete(e){return await this.api.delete(`${this.table}`,e)}async restore(e){return await this.api.patch(`${this.table}/restore`,e)}}class gt{constructor(e,t,s=1){A(this,"table");A(this,"dbName");A(this,"version");A(this,"db",null);this.table=e,this.dbName=t,this.version=s}close(){this.db&&(this.db.onversionchange=null,this.db.close(),this.db=null)}open(){return this.db?Promise.resolve(this.db):new Promise((e,t)=>{const s=indexedDB.open(this.dbName,this.version);s.onupgradeneeded=r=>{const a=r.target.result;a.objectStoreNames.contains(this.table)||a.createObjectStore(this.table,{keyPath:"id",autoIncrement:!0})},s.onsuccess=r=>{this.db=r.target.result,this.db.onversionchange=()=>{this.close()},e(this.db)},s.onerror=r=>{t(r.target.error)}})}async transaction(e){return(await this.open()).transaction(this.table,e).objectStore(this.table)}request(e){return new Promise((t,s)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>s(e.error)})}async insert(e){const t=await this.transaction("readwrite"),s=await this.request(t.add(e));return{...e,id:s}}async insertMany(e){const t=await this.transaction("readwrite");let s=0;for(const r of e)s=await this.request(t.add(r));return{...e[e.length-1],id:s}}async update(e,t){const s=typeof e=="number"?t:e;if(!s)throw new Error("IndexedDBClient.update requires a value payload");const r=typeof e=="number"?{...s,id:s.id??e}:s,a=await this.transaction("readwrite");return await this.request(a.put(r)),r}async get(e,t){var g;const s=await this.transaction("readonly"),r=await this.request(s.getAll()),a=this.applyFilter(r,t),o=(e==null?void 0:e.sortingBy)??"id",c=((g=e==null?void 0:e.sortingOrder)==null?void 0:g.toLowerCase())??"asc";a.sort((h,b)=>{const y=h[o],x=b[o];return y<x?c==="asc"?-1:1:y>x?c==="asc"?1:-1:0});const i=(e==null?void 0:e.pageSize)??10,m=(e==null?void 0:e.currentPage)??0,u=a.length,f=Math.ceil(u/i),p=a.slice(m*i,m*i+i);return{sort:o,order:c,currentPage:m,pageSize:i,totalElements:u,totalPages:f,items:p}}async export(e){const t=await this.transaction("readonly"),s=await this.request(t.getAll());return this.applyFilter(s,e)}async import(e){const t=await this.transaction("readwrite");let s=0;for(const r of e.items)e.override?await this.request(t.put(r)):await this.request(t.add(r)),s++;return s}async commonGet(e){const t=await this.transaction("readonly"),s=await this.request(t.getAll());return this.applyFilter(s,e)}async getById(e){const t=await this.transaction("readonly"),s=await this.request(t.get(e));if(!s)throw new Error(`Record ${e} not found in ${this.table}`);return s}async softDelete(e){const t=await this.transaction("readwrite");let s=0;for(const r of e){const a=await this.request(t.get(r));a&&(await this.request(t.put({...a,deletedAt:new Date})),s++)}return s}async restore(e){const t=await this.transaction("readwrite");let s=0;for(const r of e){const a=await this.request(t.get(r));a&&(await this.request(t.put({...a,deletedAt:null})),s++)}return s}applyFilter(e,t){return t?e.filter(s=>Object.entries(t).every(([r,a])=>this.matchesFilterValue(r,a,s[r]))):e}matchesFilterValue(e,t,s){if(t===void 0)return!0;if(e==="deletedAt"&&typeof t=="boolean"){const r=s!=null;return t?r:!r}return s===t}}function yt(n){return Object.keys(n).filter(e=>isNaN(Number(e))).map(e=>({key:e,value:n[e]}))}const V=(n,e="")=>{const t=localStorage.getItem(n)??void 0;if(t&&e.length)switch(e){case"object":return JSON.parse(t);case"number":return Number(t);case"boolean":return t==="true"||t==="1";default:return t}return t},Q=(n,e)=>localStorage.setItem(n,typeof e=="object"?JSON.stringify(e):e),_=n=>localStorage.removeItem(n);function bt(n){const e=n?new Date(n):new Date,t={weekday:"long",day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0};return e.toLocaleString(navigator.language||"es-ES",t)}function wt(n){const e=n?new Date(n):new Date,t=String(e.getDate()).padStart(2,"0"),s=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getFullYear()).slice(-2),a=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0");return`${t}/${s}/${r} ${a}:${o}`}function xt(n){const e=n?new Date(n):new Date,t=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0"),a=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0");return`${t}-${s}-${r}T${a}:${o}`}const $e=()=>{var t;const n=navigator,e=((t=n==null?void 0:n.userAgentData)==null?void 0:t.platform)||(n==null?void 0:n.platform)||"";return/Mac|iPhone|iPod|iPad/i.test(e)};function ee(n){if(!n||typeof n!="object")return!1;const e=n;return Array.isArray(e.errors)&&e.errors.every(t=>Array.isArray(t)&&t.length===2&&typeof t[0]=="string")}function te(n){if(!n||typeof n!="object")return!1;const e=n;return typeof(e==null?void 0:e.status)=="number"&&typeof(e==null?void 0:e.message)=="string"}function Ct(n,e){return n!=null&&n.errors?n.errors.map(([t,s])=>e(t,s)):[]}const Le=d.createContext(void 0);function kt(n){const{children:e}=n,t=d.useRef(0),[s,r]=d.useReducer((p,g)=>{const{type:h,items:b,id:y}=g;switch(h){case"set":return b??[];case"remove":return y!==void 0?p.filter(x=>x.id!==y):[]}return p},[],()=>[]),a=p=>p.map(g=>({...g,id:t.current++})),o=d.useCallback(p=>r({type:"set",items:a([{...p,type:I.error}])}),[]),c=d.useCallback(p=>r({type:"set",items:a([{...p}])}),[]),i=d.useCallback(p=>r({type:"set",items:a(p)}),[]),m=d.useCallback(p=>r({type:"set",items:a([{...p,type:I.success}])}),[]),u=p=>r({type:"remove",id:p}),f=d.useMemo(()=>({notification:s,removeNotification:u,showErrorNotification:o,showNotification:c,showSuccessNotification:m,showStackNotifications:i}),[s,o,c,i,m]);return l.jsx(Le.Provider,{value:f,children:e})}const W=()=>{const n=d.useContext(Le);if(!n)throw new Error("NotificationContext must be used within a Provider");return n},he=()=>new $.QueryClient({defaultOptions:{queries:{refetchInterval:!1,refetchOnMount:!0,refetchOnReconnect:!1,retry:!1,retryOnMount:!0,refetchOnWindowFocus:!1}}}),St=he(),Re=d.createContext(void 0),Tt=n=>{const{children:e,manager:t,queryClient:s}=n,[r]=d.useState(he),a=s??r;return l.jsx(Re.Provider,{value:{client:t},children:l.jsx($.QueryClientProvider,{client:a,children:e})})},Ie=()=>{const n=d.useContext(Re);if(!n)throw new Error("managerContext must be used within a Provider");return n.client},Fe=d.createContext(void 0),vt=n=>{const{children:e,guestMode:t="guest_mode",user:s="user",remember:r="remember",refreshTokenKey:a="refreshToken",accessTokenExpiresAtKey:o="accessTokenExpiresAt"}=n,c=Ie(),[i,m]=d.useState({}),u=d.useCallback(()=>{_(s),_(r),_(a),_(o)},[o,a,r,s]),f=d.useCallback(()=>!!V(t,"boolean")&&i.token===void 0,[i.token,t]),p=d.useCallback(x=>{Q(t,x)},[t]),g=d.useCallback((x,C)=>{if(!x)return;const v=V(r,"boolean"),N=C??(typeof v=="boolean"?v:!1);m(x),_(t),Q(s,x.token),Q(r,N),typeof x.refreshToken=="string"&&x.refreshToken.length?Q(a,x.refreshToken):_(a),typeof x.accessTokenExpiresAt=="string"&&x.accessTokenExpiresAt.length?Q(o,x.accessTokenExpiresAt):_(o)},[o,t,a,r,s]),h=d.useCallback(async()=>{const x=V(s)??i.token,C=V(a)??(typeof i.refreshToken=="string"?i.refreshToken:void 0);try{await c.Auth.logout({accessToken:x,refreshToken:C})}catch(v){console.error(v)}m({}),u()},[i.refreshToken,i.token,u,c.Auth,a,s]),b=d.useCallback(async()=>{try{const x=await c.Auth.getSession();g(x)}catch(x){console.error(x),h()}},[g,h,c.Auth]),y=d.useMemo(()=>({account:i,logUser:g,logoutUser:h,logUserFromLocal:b,isInGuestMode:f,setGuestMode:p}),[i,g,h,b,f,p]);return l.jsx(Fe.Provider,{value:y,children:e})},pe=()=>{const n=d.useContext(Fe);if(!n)throw new Error("authContext must be used within a Provider");return n},_e=d.createContext({}),Et=n=>{const{children:e,location:t,navigate:s,linkComponent:r,searchComponent:a}=n;return l.jsx(_e.Provider,{value:{location:t,navigate:s,linkComponent:r,searchComponent:a},children:e})},Y=()=>{const n=d.useContext(_e);if(n===void 0||Object.keys(n).length===0)throw new Error("Config provider has not been set. This step is required and cannot be skipped.");return n},Nt={addChildItem:()=>{},removeChildItem:()=>{},clearDynamicItems:()=>{},dynamicItems:{}},ge=d.createContext(Nt),jt=n=>{const{children:e}=n,[t,s]=d.useState({}),r=d.useCallback((i,m)=>s(u=>({...u,[i]:[...u[i]??[],m]})),[]),a=d.useCallback((i,m)=>s(u=>({...u,[i]:(u[i]??[]).filter((f,p)=>p!==m)})),[]),o=d.useCallback(i=>{s(i?m=>({...m,[i]:[]}):{})},[]),c=d.useMemo(()=>({dynamicItems:t,addChildItem:r,removeChildItem:a,clearDynamicItems:o}),[t,o,a,r]);return l.jsx(ge.Provider,{value:c,children:e})},De=()=>d.useContext(ge);function At(n){const{t:e}=w.useTranslation(),{open:t,onClose:s,menuMap:r,logo:a}=n,{account:o}=pe(),{dynamicItems:c}=De(),{linkComponent:i,location:m}=Y(),u=i,f=d.useMemo(()=>r.filter(y=>{const x=y.auth,C=!!(o!=null&&o.email);return x==null||x&&C||!x&&!C}),[o==null?void 0:o.email,r]),p=d.useCallback(y=>{y.key==="Escape"&&t&&s()},[s,t]);d.useEffect(()=>(document.addEventListener("keydown",p),()=>{document.removeEventListener("keydown",p)}),[p]);const g=d.useCallback((y,x)=>x?y===`${m.pathname}${m.search}`:y===m.pathname,[m.pathname,m.search]),h=d.useCallback(y=>l.jsx("li",{className:`drawer-list-item-child ${g(y.path,!0)?"active":""} animated`,children:y.path?l.jsx(u,{tabIndex:t?0:-1,to:y.path??"/","aria-label":e(`_accessibility:ariaLabels.${y.id}`,{defaultValue:y.label}),className:"drawer-link",children:y.label}):y.label},y.id),[u,t,e,g]),b=d.useMemo(()=>f.map((y,x)=>{const C=y.page??String(x),v=`drawer-list-item ${g(y.path)?"active":""} animated`;if(y.type==="divider")return l.jsx("li",{className:v,children:l.jsx("hr",{className:"drawer-divider"})},C);const N=y.children??(y.page&&c?c[y.page]:null);return l.jsxs("li",{className:v,children:[l.jsxs(u,{tabIndex:t?0:-1,to:y.path??"/","aria-label":e(`_accessibility:ariaLabels.${String(y.page)}`,{defaultValue:e(`_pages:${String(y.page)}.title`)}),className:"drawer-link",children:[y.icon,e(`_pages:${y.page}.title`)]}),N&&l.jsx("ul",{className:"drawer-children-list",children:N.map(h)})]},C)}),[u,c,g,t,f,h,e]);return l.jsx("div",{"aria-label":e("_accessibility:ariaLabels.closeMenu"),"aria-disabled":!t,className:`${t?"opened":"closed"} drawer-backdrop`,onClick:()=>s(),children:l.jsxs("aside",{className:`${t?"opened":"closed"} drawer animated`,children:[l.jsxs("div",{className:"drawer-header-container",children:[a,l.jsx("h2",{className:"drawer-header poppins",children:e("_pages:home.appName")})]}),l.jsx("ul",{className:"drawer-menu-list",children:b})]})})}const q=({icon:n,...e})=>l.jsx(w.IconButton,{icon:l.jsx(M.FontAwesomeIcon,{icon:n}),...e});var de,Se;function $t(){if(Se)return de;Se=1;const n=(c,i="local",m=void 0)=>{if(i==="local"){if(localStorage.getItem(c)!==void 0&&localStorage.getItem(c)!=="undefined"&&localStorage.getItem(c)!==null)return m===void 0||m!==void 0&&localStorage.getItem(c)===m}else if(i==="session"&&sessionStorage.getItem(c)!==void 0&&sessionStorage.getItem(c)!=="undefined"&&sessionStorage.getItem(c)!==null)return m===void 0||m!==void 0&&sessionStorage.getItem(c)===m;return!1},e=c=>{const i={};return c.substring(1).split("&").forEach(u=>{const[f,p]=u.split("=");i[f]=p}),i},t=(c="")=>{if(a(c)&&c.length)return a(c);{let i=navigator.language||navigator.userLanguage;if(i.indexOf("en")<0&&i.indexOf("es")<0&&(i="en-US"),i=i.split("-")[0],i)return c.length&&r(c,730,i),i}return"en"},s=(c=0,i=0,m=window,u="smooth")=>m.scroll({top:c,left:i,behavior:u}),r=(c,i,m,u="/",f="Lax")=>{var p=new Date;p.setTime(p.getTime()+i*24*60*60*1e3);const g="; expires="+p.toUTCString();document.cookie=`${c}=${m||""}${g};path=${u};SameSite=${f}`},a=c=>{const i=`${c}=`,u=decodeURIComponent(document.cookie).split(";");for(let f=0;f<u.length;f+=1){let p=u[f];for(;p.charAt(0)===" ";)p=p.substring(1);if(p.indexOf(i)===0)return p.substring(i.length,p.length)}return""};return de={getCookie:a,createCookie:r,deleteCookie:c=>document.cookie=`${c}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`,getUserLanguage:t,scrollTo:s,parseQueries:e,validation:n},de}var Lt=$t();function Rt(){const{t:n,language:e}=w.useTranslation();return{timeAge:d.useCallback(s=>{const a=new Date-s,o=Math.floor(a/(1e3*60)),c=Math.floor(o/60),i=e==="es",m=n("_accessibility:labels.ago"),u=n("_accessibility:labels.minute"),f=n("_accessibility:labels.minutes"),p=n("_accessibility:labels.hour"),g=n("_accessibility:labels.hours"),h=n("_accessibility:labels.yesterday"),b=n("_accessibility:labels.justNow");return a<1e3*60?b:o<60?`${i?m:""} ${o} ${o===1?u:f} ${i?"":m}`:c<24?`${i?m:""} ${c} ${c===1?p:g} ${i?"":m}`:c<48?h:s.toLocaleDateString(navigator.language||"es-ES",{day:"2-digit",month:"2-digit",year:"numeric"})},[n,e])}}const ye=n=>{const{showSuccessNotification:e}=W(),{mutationFn:t,onError:s,onSuccess:r,onSuccessMessage:a}=n,[o,c]=d.useState([]),{open:i,handleClose:m,handleOpen:u}=be(),f=()=>{m(),c([])},p=async h=>{c(h),u()},g=$.useMutation({mutationFn:()=>t(Array.isArray(o)?o:[o]),onError:h=>{console.error(h),s&&s(h),f()},onSuccess:async h=>{r&&r(h),e({message:a}),f()}});return{open:i,onClick:p,close:f,dialogFn:g,isLoading:g.isPending}},It=n=>{const{t:e}=w.useTranslation(),{showStackNotifications:t,showSuccessNotification:s,showErrorNotification:r}=W(),a=$.useQueryClient(),{defaultValues:o,mutationFn:c,formToDto:i,onError:m,onSuccess:u,queryKey:f,onSuccessMessage:p}=n,{control:g,handleSubmit:h,reset:b,setError:y,getValues:x,setValue:C}=Ee.useForm({defaultValues:o}),v=d.useRef(null),N=d.useCallback(()=>{const k=document.activeElement;if(!(k instanceof HTMLElement)){v.current=null;return}v.current=k.closest("form")},[]),T=d.useCallback(k=>{const E=k==null?void 0:k.errors,L=[],R=v.current;if(!R)return L;let O=!1;return E&&E.forEach(([ne,le])=>{const H=R.querySelector(`[name="${ne}"]`);(H instanceof HTMLInputElement||H instanceof HTMLTextAreaElement||H instanceof HTMLSelectElement)&&(O||(H.focus(),O=!0),H.classList.add("error"),L.push(e(`_entities:${f}.${ne}.${le}`)))}),L},[e,f]),P=d.useCallback(()=>{const k=v.current;if(!k)return;k.querySelectorAll("input, textarea, select").forEach(L=>{L.classList.remove("error")})},[]),K=$.useMutation({mutationFn:c,onError:k=>{console.error(k);const E=k;if(m)m(k);else if(ee(E)){const L=T(E);t(L.map(R=>({message:R,type:I.error})))}else if(te(E)){const L=E.message||e("_accessibility:errors.500"),R=e(`_accessibility:errors.${E.status}`);r({message:R||L})}else r({message:e("_accessibility:errors.500")})},onSuccess:async k=>{await a.invalidateQueries({queryKey:f}),u&&u(k),p&&s({message:p})}});return{control:g,getValues:x,setValue:C,handleSubmit:h,onSubmit:k=>{N(),P(),K.mutate(i?i(k):k)},reset:b,setError:y,isLoading:K.isPending}},Me=n=>{const{t:e}=w.useTranslation(),{onClick:t,icon:s=j.faTrash,sticky:r=!0,hidden:a=!1,multiple:o=!0,disabled:c=!1,id:i=B.Delete,tooltip:m=e("_pages:common.actions.delete.text")}=n;return{action:d.useCallback(f=>({id:i,sticky:r,tooltip:m,multiple:o,onClick:()=>t([f==null?void 0:f.id]),hidden:!!f.deletedAt||a,disabled:!!f.deletedAt||c,icon:l.jsx(M.FontAwesomeIcon,{className:"text-bg-error",icon:s}),onMultipleClick:p=>t(p.map(g=>g.id))}),[c,a,s,i,o,t,r,m])}},Pe=n=>{const{t:e}=w.useTranslation(),{onClick:t,sticky:s=!0,hidden:r=!1,disabled:a=!1,multiple:o=!1,icon:c=j.faRotateLeft,id:i=B.Restore,tooltip:m=e("_pages:common.actions.restore.text")}=n;return{action:d.useCallback(f=>({id:i,sticky:s,tooltip:m,multiple:o,onClick:()=>t([f==null?void 0:f.id]),hidden:!f.deletedAt||r,disabled:!f.deletedAt||a,icon:l.jsx(M.FontAwesomeIcon,{className:"text-bg-error",icon:c}),onMultipleClick:p=>t(p.map(g=>g.id))}),[a,r,c,i,o,t,s,m])}},Ft=n=>{const{t:e}=w.useTranslation(),{onClick:t,hidden:s=!1,sticky:r=!0,disabled:a=!1,id:o=B.Edit,icon:c=j.faPencil,tooltip:i=e("_pages:common.actions.edit.text")}=n;return{action:d.useCallback(u=>({id:o,sticky:r,tooltip:i,onClick:()=>t(u==null?void 0:u.id),hidden:!!u.deletedAt||s,disabled:!!u.deletedAt||a,icon:l.jsx(M.FontAwesomeIcon,{className:"primary",icon:c})}),[a,s,c,o,t,r,i])}};var B=(n=>(n.Add="add",n.Edit="edit",n.Delete="delete",n.Restore="restore",n.Refresh="refresh",n.Export="export",n.Import="import",n))(B||{});const Oe=n=>{const{t:e}=w.useTranslation(),{onClick:t,hidden:s=!1,disabled:r=!1,isLoading:a=!1}=n;return{action:d.useCallback(()=>({id:B.Export,hidden:s,disabled:r,icon:l.jsx(M.FontAwesomeIcon,{className:`${a?"rotate":""}`,icon:a?j.faCircleNotch:j.faCloudArrowDown}),tooltip:e("_pages:common.actions.export.text"),onClick:t}),[r,s,a,t,e])}},qe=n=>{const{t:e}=w.useTranslation(),{onClick:t,hidden:s=!1,disabled:r=!1,isLoading:a=!1}=n;return{action:d.useCallback(()=>({id:B.Import,hidden:s,disabled:r,icon:l.jsx(M.FontAwesomeIcon,{className:`${a?"rotate":""}`,icon:a?j.faCircleNotch:j.faCloudUpload}),tooltip:e("_pages:common.actions.import.text"),onClick:t}),[r,s,a,t,e])}},_t=n=>{const{queryKey:e,onSuccess:t,...s}=n,r=$.useQueryClient(),{showStackNotifications:a}=W(),{t:o}=w.useTranslation(),{open:c,onClick:i,close:m,dialogFn:u,isLoading:f}=ye({onSuccessMessage:o("_pages:common.actions.delete.successMessage"),onError:g=>{const h=g;if(ee(h))a(h.errors.map(([b,y])=>({message:o(`_pages:${b}.errors.${y}`),type:I.error})));else if(te(h)){const b=h.message||o("_accessibility:errors.500"),y=o(`_accessibility:errors.${h.status}`);a([{message:y||b,type:I.error}])}},onSuccess:async g=>{await r.invalidateQueries({queryKey:e}),t&&t(g)},...s}),{action:p}=Me({onClick:i});return{onClick:i,title:o("_pages:common.actions.delete.dialog.title"),open:c,isLoading:f,handleSubmit:()=>u.mutate(),handleClose:m,action:p}},be=()=>{const[n,e]=d.useState(!1);return{open:n,setOpen:e,handleClose:()=>e(!1),handleOpen:()=>e(!0)}},Dt=n=>"mutationFn"in n&&"queryKey"in n,se=n=>{const e=Dt(n),t=e?n:void 0,s=e?void 0:n,r=e?"entity":(s==null?void 0:s.mode)??"state",{t:a}=w.useTranslation(),o=$.useQueryClient(),{showErrorNotification:c,showStackNotifications:i,showSuccessNotification:m}=W(),[u,f]=d.useState(),[p,g]=d.useState(!1),h=d.useRef(!1),b=d.useRef(),{open:y,handleClose:x,handleOpen:C}=be(),{control:v,handleSubmit:N,reset:T,setError:P,getValues:K,setValue:k}=Ee.useForm({defaultValues:(t==null?void 0:t.defaultValues)||(s==null?void 0:s.defaultValues)||{}}),E=d.useRef(null),L=d.useCallback(()=>{const S=document.activeElement;if(!(S instanceof HTMLElement)){E.current=null;return}E.current=S.closest("form")},[]),R=t?[...t.queryKey,u??0]:["__legacy-form-dialog-disabled__",u??0],{data:O,isLoading:ne}=$.useQuery({queryFn:async()=>{if(!(!(t!=null&&t.getFunction)||!u))return t.getFunction(u)},queryKey:R,enabled:!!(t!=null&&t.getFunction)&&!!u});d.useEffect(()=>{!t||!O||!t.dtoToForm||b.current!==O&&(T({...t.dtoToForm(O)}),b.current=O)},[O,t,T]),d.useEffect(()=>{if(s){if(!y){h.current=!1;return}if(!h.current){if(h.current=!0,s.reinitializeOnOpen&&s.mapIn){T(s.mapIn());return}if(s.reinitializeOnOpen&&s.defaultValues){T(s.defaultValues);return}s.resetOnOpen&&T(s.defaultValues||{})}}},[s,y,T]);const le=d.useCallback(S=>{const D=S==null?void 0:S.errors,U=[],z=E.current;if(!z||!t)return U;let xe=!1;return D&&D.forEach(([Ce,Ye])=>{const X=z.querySelector(`[name="${Ce}"]`);(X instanceof HTMLInputElement||X instanceof HTMLTextAreaElement||X instanceof HTMLSelectElement)&&(xe||(X.focus(),xe=!0),X.classList.add("error"),U.push(a(`_entities:${t.queryKey}.${Ce}.${Ye}`)))}),U},[t,a]),H=d.useCallback(()=>{const S=E.current;if(!S)return;S.querySelectorAll("input, textarea, select").forEach(U=>{U.classList.remove("error")})},[]),G=d.useCallback(()=>{H(),E.current=null,x(),T()},[x,H,T]),We=d.useCallback(S=>{f(S),C()},[C]),ue=$.useMutation({mutationFn:async S=>{if(t)return t.mutationFn(S)},onError:S=>{if(t)if(t.onError)t.onError(S);else{const D=S;if(ee(D)){const U=le(D);i(U.map(z=>({message:z,type:I.error})))}else if(te(D)){const U=D.message||a("_accessibility:errors.500"),z=a(`_accessibility:errors.${D.status}`);c({message:z||U})}else c({message:a("_accessibility:errors.500")})}},onSuccess:async S=>{t&&(await o.invalidateQueries({queryKey:t.queryKey}),t.onSuccess&&await t.onSuccess(S),m({message:t.onSuccessMessage}),G())}}),re=d.useCallback(S=>t?S:s!=null&&s.mapOut?s.mapOut(S,{id:u}):S,[s,u,t]),Ge=d.useCallback(async()=>{if(!(s!=null&&s.onApply))return;const S=K(),D=re(S);g(!0);try{await s.onApply(D,{close:G,id:u,values:S})}finally{g(!1)}},[G,s,K,u,re]),ze=d.useCallback(async()=>{if(s){if(s.onClear){g(!0);try{await s.onClear()}finally{g(!1)}}T(s.defaultValues||{})}},[s,T]),Je=d.useCallback(async S=>{if(t){L(),ue.mutate(t.formToDto?t.formToDto(S):S);return}const D=re(S);g(!0);try{s!=null&&s.onSubmit&&await s.onSubmit(D,{close:G,id:u,values:S}),((s==null?void 0:s.closeOnSubmit)??!0)&&G()}finally{g(!1)}},[L,G,s,u,ue,t,re]);return{open:y,mode:r,id:u,openDialog:We,handleClose:G,control:v,getValues:K,setValue:k,handleSubmit:N,onSubmit:Je,reset:T,setError:P,title:n.title,isSubmitting:p,onApply:Ge,onClear:ze,isLoading:ne||ue.isPending||p}},Mt=se,Pt=n=>se(n),Ot=n=>{const e=$.useQueryClient(),{mutationFn:t,queryKey:s,onSuccess:r,onError:a,mapOut:o,...c}=n,i=$.useMutation({mutationFn:t});return se({...c,mode:"entity",mapOut:o,onSubmit:async m=>{try{const u=await i.mutateAsync(m);s&&await e.invalidateQueries({queryKey:s}),r&&await r(u)}catch(u){throw a&&a(u),u}}})},qt=n=>{const e=$.useQueryClient(),t=d.useRef(),s=d.useRef(),{mutationFn:r,queryKey:a,onSuccess:o,onError:c,mapOut:i,getFunction:m,dtoToForm:u,title:f,...p}=n,g=d.useRef(u);d.useEffect(()=>{g.current=u},[u]);const h=$.useMutation({mutationFn:r}),b=se({...p,mode:"entity",title:f,onSubmit:async v=>{try{const N=await h.mutateAsync(v);a&&await e.invalidateQueries({queryKey:a}),o&&await o(N)}catch(N){throw c&&c(N),N}},mapOut:v=>i?i(v,t.current):v}),{reset:y}=b,x=a||["put-dialog",f],C=$.useQuery({queryFn:()=>m(b.id),queryKey:[...x,b.id],enabled:b.open&&!!b.id});return d.useEffect(()=>{if(C.data&&s.current!==C.data){if(t.current=C.data,s.current=C.data,g.current&&y){y(g.current(C.data));return}y==null||y(C.data)}},[C.data,y]),{...b,isLoading:b.isLoading||h.isPending||C.isFetching||C.isLoading}},Kt=n=>{const{queryKey:e,onSuccess:t,...s}=n,r=$.useQueryClient(),{showStackNotifications:a}=W(),{t:o}=w.useTranslation(),{open:c,onClick:i,close:m,dialogFn:u,isLoading:f}=ye({onSuccessMessage:o("_pages:common.actions.restore.successMessage"),onError:g=>{const h=g;if(ee(h))a(h.errors.map(([b,y])=>({message:o(`_pages:${b}.errors.${y}`),type:I.error})));else if(te(h)){const b=h.message||o("_accessibility:errors.500"),y=o(`_accessibility:errors.${h.status}`);a([{message:y||b,type:I.error}])}},onSuccess:async g=>{await r.invalidateQueries({queryKey:e}),t&&t(g)},...s}),{action:p}=Pe({onClick:i});return{onClick:i,title:o("_pages:common.actions.restore.dialog.title"),open:c,isLoading:f,handleSubmit:()=>u.mutate(),handleClose:m,action:p}};function Ut(n){const{t:e}=w.useTranslation(),t=$.useQueryClient(),{queryKey:s,mutationFn:r,entity:a,fileProcessor:o,renderCustomPreview:c,onError:i}=n,[m,u]=d.useState(!1),[f,p]=d.useState(null),[g,h]=d.useState(!1),b=$.useMutation({mutationFn:r,onError:x=>{console.error(x),i==null||i(x)},onSuccess:async()=>{await t.invalidateQueries({queryKey:s})}}),{action:y}=qe({onClick:()=>u(!0)});return{handleSubmit:async()=>{if(!(!f||f.length===0))try{await b.mutateAsync({items:f,override:g}),u(!1),p(null),h(!1)}catch(x){console.error(x)}},isLoading:b.isPending,fileProcessor:o,onFileProcessed:x=>p(x),renderCustomPreview:c,onOverrideChange:x=>h(x),open:m,title:e("_pages:common.actions.import.dialog.title",{entity:e(`_pages:${a}.title`)}),handleClose:()=>{u(!1),p(null),h(!1)},action:y}}const Qt=n=>{const{showSuccessNotification:e}=W(),{t}=w.useTranslation(),{entity:s,mutationFn:r,onError:a,onSuccess:o,onSuccessMessage:c=t("_pages:common.actions.export.successMessage")}=n,i=$.useMutation({mutationFn:()=>r(),onError:f=>{console.error(f),a&&a(f)},onSuccess:async f=>{const p=JSON.stringify(f,null,2),g=new Blob([p],{type:"application/json"}),h=URL.createObjectURL(g),b=document.createElement("a");b.href=h,b.download=`${s}.json`,b.click(),URL.revokeObjectURL(h),o&&o(f),e({message:c})}}),m=d.useCallback(()=>{i.mutate()},[i]),{action:u}=Oe({onClick:m,isLoading:i.isPending});return{action:u}},Te=()=>typeof window<"u"?window.scrollY:0;function Ke(n){const[e,t]=d.useState(Te),s=d.useCallback(()=>{t(Te())},[]);return d.useEffect(()=>(window.addEventListener("scroll",s),()=>{window.removeEventListener("scroll",s)}),[s]),e>n}const Bt=n=>{const{t:e}=w.useTranslation(),{icon:t=j.faArrowUp,threshold:s=200,scrollTop:r=0,scrollLeft:a=0,tooltip:o=e("_accessibility:buttons.toTop"),scrollOnClick:c=!0,onClick:i,className:m="",variant:u="submit",color:f="primary",...p}=n,g=Ke(s),h=()=>{i==null||i(),c&&Lt.scrollTo(a,r)};return l.jsx(q,{variant:u,color:f,icon:t,"data-tooltip-id":"tooltip",onClick:h,className:`to-top ${g?"show":"hide"} ${m}`.trim(),"data-tooltip-content":o,...p})};function Ht(n){const{t:e}=w.useTranslation();if("children"in n){const{children:N,className:T}=n;return l.jsx("div",{className:`error-container${T?` ${T}`:""}`,children:N})}const{error:s,message:r,iconProps:a,onRetry:o,retryLabel:c,retryButtonProps:i,messageProps:m,className:u,resetErrorBoundary:f}=n,p=o??f,{className:g,children:h,onClick:b,...y}=i??{},{className:x,...C}=m??{},v=a!==null;return l.jsxs("div",{className:`error-container${u?` ${u}`:""}`,children:[v&&l.jsx(M.FontAwesomeIcon,{...a,icon:(a==null?void 0:a.icon)??et.faSadTear,className:`error-icon${a!=null&&a.className?` ${a.className}`:""}`}),l.jsx("p",{...C,className:`error-message${x?` ${x}`:""}`,children:r??(s==null?void 0:s.message)??e("_accessibility:errors.unknownError")}),p&&l.jsx(w.Button,{type:"button",variant:"submit",color:"primary",...y,className:`error-retry ${g?` ${g}`:""}`,onClick:N=>{b==null||b(N),N.defaultPrevented||p()},children:h??c??e("_accessibility:actions.retry",{defaultValue:"Retry"})})]})}const Vt=n=>{const{showBackButton:e,title:t,actions:s}=n,{t:r}=w.useTranslation(),{navigate:a}=Y();return l.jsxs("div",{className:"page-header",children:[l.jsxs("div",{className:"page-header-left",children:[e&&l.jsx(q,{icon:j.faArrowLeft,onClick:()=>a(-1),className:"page-header-back",name:r("_accessibility:buttons.back"),"data-tooltip-id":"tooltip","data-tooltip-content":r("_accessibility:buttons.back")}),l.jsx("h2",{className:"page-header-title",children:t})]}),l.jsxs("div",{children:[l.jsx(w.Actions,{className:"page-header-actions-desktop",actions:s??[]}),l.jsx(w.ActionsDropdown,{className:"page-header-actions-mobile",actions:s??[]})]})]})},Wt=n=>{const{title:e,children:t,addOptions:s,filterOptions:r,actions:a,queryKey:o,isLoading:c=!1,isAnimated:i=!0,showBackButton:m=!1}=n,{t:u}=w.useTranslation(),f=$.useQueryClient(),{countOfFilters:p}=w.useTableOptions(),g=d.useMemo(()=>{const h=Array.isArray(a)?[...a]:[];if(o){const b={id:B.Refresh,onClick:()=>f.invalidateQueries({queryKey:o}),icon:l.jsx(M.FontAwesomeIcon,{icon:j.faRotateLeft}),tooltip:u("_pages:common.actions.refresh.text")};h.unshift(b)}if(s){const b={...s,id:B.Add,icon:l.jsx(M.FontAwesomeIcon,{icon:j.faAdd})};h.unshift(b)}if(r){const b={...r,id:"filter",icon:l.jsx(M.FontAwesomeIcon,{icon:j.faFilter}),children:l.jsx(w.Badge,{className:`${p>0?"show":"hide"} `,count:p})};h.push(b)}return h},[a,s,p,r,f,o,u]);return l.jsxs("main",{className:"page-main",children:[l.jsx(Vt,{showBackButton:m,actions:g,title:e}),l.jsx("div",{className:`page-main-content ${i?"appear":""}`,children:c?l.jsx(w.Loading,{className:"page-loading"}):t}),s&&l.jsx(q,{icon:s.icon??j.faAdd,color:s.color??"primary",variant:s.variant??"submit",onClick:()=>{var h;return(h=s.onClick)==null?void 0:h.call(s)},className:`button page-fab ${s.className??""}`})]})},Gt=n=>{const{t:e}=w.useTranslation(),{className:t="",itemClassName:s="",loading:r=!1,emptyComponent:a=null,emptyMessage:o=e("_accessibility:messages.empty"),renderComponent:c,data:i=[],hasMore:m=!1,loadingMore:u=!1,onLoadMore:f,loadMoreComponent:p=null,observerRootMargin:g="0px 0px 200px 0px",observerThreshold:h=0}=n,b=d.useRef(!1),y=d.useRef(null),x=d.useCallback(async()=>{if(!(!m||!f)&&!(u||b.current)){b.current=!0;try{await f()}finally{b.current=!1}}},[m,u,f]);return d.useEffect(()=>{if(!m||!f||!y.current||typeof IntersectionObserver>"u")return;const C=new IntersectionObserver(v=>{v.some(N=>N.isIntersecting)&&x()},{rootMargin:g,threshold:h});return C.observe(y.current),()=>C.disconnect()},[m,f,g,h,x]),r?l.jsx(w.Loading,{}):l.jsx(l.Fragment,{children:i!=null&&i.length?l.jsxs("ul",{className:`pretty-grid-main ${t}`,children:[i==null?void 0:i.map(C=>l.jsx("li",{className:`pretty-grid-item ${s}`,children:c(C)},C.id)),m&&f&&l.jsx("li",{className:"pretty-grid-load-more",ref:y,children:p})]}):l.jsx(l.Fragment,{children:a||l.jsx(Ve,{message:o})})})},we=d.createContext({title:"",setTitle:()=>{},rightContent:null,setRightContent:()=>{}}),zt=n=>{const{children:e}=n,[t,s]=d.useState(""),[r,a]=d.useState(null),o=d.useCallback(m=>{s(m)},[]),c=d.useCallback(m=>{a(m)},[]),i=d.useMemo(()=>({title:t,setTitle:o,rightContent:r,setRightContent:c}),[t,o,r,c]);return l.jsx(we.Provider,{value:i,children:e})},Ue=()=>d.useContext(we);function Jt(n){const{t:e}=w.useTranslation(),{openDrawer:t,showSearch:s=!0,menuButtonProps:r}=n,{searchComponent:a,location:o}=Y(),{title:c,rightContent:i}=Ue(),[m,u]=d.useState(!1),f=d.useCallback(h=>{($e()?h.metaKey:h.ctrlKey)&&h.shiftKey&&h.key.toLowerCase()==="f"&&(u(!0),h.preventDefault())},[]);d.useEffect(()=>(window.addEventListener("keydown",f),()=>{window.removeEventListener("keydown",f)}),[f]);const p=a,g=s&&!!p;return l.jsxs(l.Fragment,{children:[o.pathname!=="/"&&!!p&&l.jsx(p,{open:m,onClose:()=>u(!1)}),l.jsxs("header",{id:"header",className:"header",children:[l.jsxs("div",{className:"navbar-left",children:[l.jsx(q,{...r,type:(r==null?void 0:r.type)??"button",icon:(r==null?void 0:r.icon)??j.faBars,onClick:h=>{var b;(b=r==null?void 0:r.onClick)==null||b.call(r,h),t()},name:(r==null?void 0:r.name)??e("_accessibility:buttons.openMenu"),"aria-label":(r==null?void 0:r["aria-label"])??e("_accessibility:ariaLabels.openMenu"),className:`navbar-menu animated ${(r==null?void 0:r.className)??""}`}),l.jsx("h1",{className:"poppins navbar-title",children:c||e("_pages:home.appName")})]}),l.jsxs("div",{className:"navbar-right",children:[i,g&&l.jsx(q,{icon:j.faSearch,className:"navbar-search-btn",onClick:()=>u(!0)})]})]})]})}const ae=300,Yt=n=>n??I.error,Xt=n=>{switch(n){case I.error:return j.faWarning;default:return j.faCircleCheck}},me=n=>{switch(n){case I.success:return"!text-success";case I.error:return"!text-error";case I.warning:return"!text-warning";default:return"!text-info"}},Zt=n=>{switch(n){case I.success:return"bg-bg-success";case I.error:return"bg-bg-error";case I.warning:return"bg-bg-warning";default:return"bg-bg-info"}};function es(){const{t:n}=w.useTranslation(),{notification:e,removeNotification:t}=W(),[s,r]=d.useState([]),a=d.useRef(s);d.useLayoutEffect(()=>{a.current=s});const o=d.useRef(null),c=d.useCallback(i=>{r(m=>i!==void 0?m.map(u=>u.id===i?{...u,closing:!0}:u):m.map(u=>({...u,closing:!0}))),i!==void 0?setTimeout(()=>{t(i),r(m=>m.filter(u=>u.id!==i))},ae):(o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{t(),r([]),o.current=null},ae))},[t]);return d.useEffect(()=>{let i=null;const m=()=>{i&&clearTimeout(i),o.current&&(clearTimeout(o.current),o.current=null)};if(e.length===0)return a.current.length===0?void 0:(o.current&&clearTimeout(o.current),i=setTimeout(()=>{r(g=>g.map(h=>({...h,closing:!0}))),i=null},0),o.current=setTimeout(()=>{r([]),o.current=null},ae),m);const u=new Set(a.current.map(g=>g.id));if(!e.some(g=>g.id!==void 0&&!u.has(g.id)))return;if(a.current.length===0){const g=[...e];return i=setTimeout(()=>{r(g.map(h=>({...h,closing:!1}))),i=null},0),()=>{i&&clearTimeout(i)}}o.current&&clearTimeout(o.current),i=setTimeout(()=>{r(g=>g.every(h=>h.closing)?g:g.map(h=>({...h,closing:!0}))),i=null},0);const p=[...e];return o.current=setTimeout(()=>{r(p.map(g=>({...g,closing:!1}))),o.current=null},ae),m},[e]),d.useEffect(()=>{if(!s.length)return;let i;const m=window.setTimeout(()=>{i=()=>c(),window.addEventListener("click",i)},0),u=f=>{f.key==="Escape"&&c()};return window.addEventListener("keydown",u),()=>{window.clearTimeout(m),i&&window.removeEventListener("click",i),window.removeEventListener("keydown",u)}},[s.length,c]),ve.createPortal(l.jsx("div",{className:`notification-portal ${s.length?"active":""}`,children:s.map(({id:i,type:m,message:u,closing:f})=>{const p=Yt(m);return l.jsxs("div",{className:`notification ${f?"closing":""} ${Zt(p)}`,onClick:g=>g.stopPropagation(),children:[l.jsxs("div",{className:"notification-body",children:[l.jsx(M.FontAwesomeIcon,{icon:Xt(p),className:`notification-icon ${me(p)}`}),l.jsx("p",{className:`notification-text ${me(p)}`,children:u})]}),l.jsx(q,{type:"button",icon:j.faClose,color:"error",className:"notification-close group",onClick:g=>{g.stopPropagation(),i!==void 0&&c(i)},iconClassName:`${me(p)} notification-close-icon`,name:n("_accessibility:buttons.closeNotification"),"aria-label":n("_accessibility:ariaLabels.closeNotification")})]},i)})}),document.body)}function ts(n){const{className:e,...t}=n;return l.jsx("div",{className:"splash-screen",children:l.jsx(w.Loading,{className:`blur-appear ${e?` ${e}`:""}`,...t})})}const Qe=n=>{const{id:e,active:t,onClick:s,children:r,to:a,useLinks:o=!0,tabButtonProps:c}=n,{linkComponent:i}=Y(),m=i;if(!o){const{className:f="",variant:p=t?"submit":"outlined",color:g=t?"primary":"default",...h}=c??{};return l.jsx(w.Button,{type:"button",variant:p,color:g,className:`tab ${f}`,onClick:s,...h,children:r})}const u=`button submit tab ${t?"primary":"outlined"} ${(c==null?void 0:c.className)??""}`.trim();return l.jsx(m,{to:a??`#${e}`,onClick:()=>s(),className:u,children:r})},Be=n=>{var g;const{tabs:e=[],defaultTab:t,currentTab:s,onTabChange:r,className:a="",tabsContainerClassName:o="",useLinks:c=!0,tabButtonProps:i}=n,[m,u]=d.useState(t??((g=e[0])==null?void 0:g.id)),f=s??m,p=d.useMemo(()=>e.find(h=>h.id===f),[e,f]);return l.jsxs("div",{className:`tabs-layout-main ${a}`,children:[l.jsx("ul",{className:`horizontal tabs tabs-container ${o}`,children:e.map(({id:h,to:b,label:y})=>l.jsx("li",{children:l.jsx(Qe,{onClick:()=>{s===void 0&&u(h),r==null||r(h)},id:h,to:b,siblings:e.length>1,active:f===h,useLinks:c,tabButtonProps:i,children:y})},h))}),p==null?void 0:p.content]})},He=n=>{const{title:e,body:t,content:s,onClickNext:r,onSkip:a,onStartAsGuest:o,onSignIn:c,image:i="",alt:m="",final:u=!1}=n,{t:f}=w.useTranslation();return l.jsxs("div",{className:"big-appear step-container",children:[i&&l.jsx("img",{src:i,alt:m}),e!=null&&l.jsx("h2",{className:"step-title",children:e}),t!=null&&l.jsx("div",{className:"step-body",children:t}),s!=null&&l.jsx("div",{className:"step-content",children:s}),l.jsx("div",{className:"step-actions",children:u?l.jsxs(l.Fragment,{children:[l.jsx(w.Button,{color:"primary",className:"step-button",variant:"outlined",onClick:o,"aria-label":f("_accessibility:ariaLabels.start"),children:f("_accessibility:buttons.startAsGuest")}),l.jsx(w.Button,{color:"primary",variant:"submit",className:"step-button","aria-label":f("_accessibility:ariaLabels.start"),onClick:c,children:f("_accessibility:buttons.signIn")})]}):l.jsxs(l.Fragment,{children:[l.jsx(w.Button,{color:"primary",className:"step-button",variant:"outlined",onClick:a,"aria-label":f("_accessibility:ariaLabels.skip"),children:f("_accessibility:buttons.skip")}),l.jsx(w.Button,{color:"primary",className:"step-button",variant:"outlined",onClick:()=>r(),"aria-label":f("_accessibility:ariaLabels.next"),children:f("_accessibility:buttons.next")})]})})]})},ss=n=>{const{steps:e,signInPath:t="/auth/sign-in",guestPath:s="/",onSkip:r,onSignIn:a,onStartAsGuest:o}=n,{setGuestMode:c}=pe(),{navigate:i}=Y(),[m,u]=d.useState(1),f=d.useCallback(()=>{if(r){r();return}i(t)},[i,r,t]),p=d.useCallback(()=>{if(a){a();return}i(t)},[i,a,t]),g=d.useCallback(()=>{if(o){o();return}c(!0),i(s)},[s,i,o,c]),h=d.useMemo(()=>e.map((b,y)=>({id:y+1,label:"",content:l.jsx(He,{...b,final:y===e.length-1,onClickNext:()=>u(x=>x+1),onSkip:f,onStartAsGuest:g,onSignIn:p})})),[p,f,g,e]);return l.jsx("div",{className:"onboarding-main",children:l.jsx(Be,{currentTab:m,onTabChange:b=>u(Number(b)),tabs:h,useLinks:!1})})},Ve=n=>{const{message:e,messageProps:t={className:"empty-message"},action:s,iconProps:r}=n;return l.jsxs("div",{className:"empty-container",children:[r&&l.jsx(M.FontAwesomeIcon,{...r}),l.jsx("p",{...t,children:e}),s&&l.jsx(w.Action,{showTooltips:!1,showText:!0,...s})]})};Object.defineProperty(exports,"Action",{enumerable:!0,get:()=>w.Action});Object.defineProperty(exports,"Actions",{enumerable:!0,get:()=>w.Actions});Object.defineProperty(exports,"ActionsDropdown",{enumerable:!0,get:()=>w.ActionsDropdown});Object.defineProperty(exports,"Button",{enumerable:!0,get:()=>w.Button});exports.APIClient=Z;exports.AppIconButton=q;exports.AuthClient=Ae;exports.AuthProvider=vt;exports.BaseClient=pt;exports.ConfigProvider=Et;exports.ConfirmationDialog=at;exports.Dialog=ie;exports.DialogActions=ce;exports.Drawer=At;exports.DrawerMenuContext=ge;exports.DrawerMenuProvider=jt;exports.Empty=Ve;exports.Error=Ht;exports.FormContainer=st;exports.FormDialog=rt;exports.GlobalActions=B;exports.IManager=ht;exports.IconButton=q;exports.ImportDialog=ut;exports.IndexedDBClient=gt;exports.ManagerProvider=Tt;exports.Methods=F;exports.Navbar=Jt;exports.NavbarContext=we;exports.NavbarProvider=zt;exports.Notification=es;exports.NotificationEnumType=I;exports.NotificationProvider=kt;exports.Onboarding=ss;exports.Page=Wt;exports.ParagraphInput=tt;exports.PasswordInput=nt;exports.PrettyGrid=Gt;exports.SplashScreen=ts;exports.Step=He;exports.Tab=Qe;exports.TabsLayout=Be;exports.ToTop=Bt;exports.buildQueryUrl=je;exports.createQueryClient=he;exports.enumToKeyValueArray=yt;exports.formatForDatetimeLocal=xt;exports.fromLocal=V;exports.getFormattedDateTime=bt;exports.getShortFormattedDateTime=wt;exports.isHttpError=te;exports.isMac=$e;exports.isValidationError=ee;exports.makeRequest=oe;exports.mapValidationErrors=Ct;exports.parseQueries=fe;exports.queryClient=St;exports.removeFromLocal=_;exports.toLocal=Q;exports.useAuth=pe;exports.useConfig=Y;exports.useConfirmationForm=ye;exports.useDeleteAction=Me;exports.useDeleteDialog=_t;exports.useDialog=be;exports.useDrawerMenu=De;exports.useEditAction=Ft;exports.useEntityFormDialog=Pt;exports.useExportAction=Oe;exports.useExportActionMutate=Qt;exports.useFormDialog=se;exports.useFormDialogLegacy=Mt;exports.useImportAction=qe;exports.useImportDialog=Ut;exports.useManager=Ie;exports.useNavbar=Ue;exports.useNotification=W;exports.usePostDialog=Ot;exports.usePostForm=It;exports.usePutDialog=qt;exports.useRestoreAction=Pe;exports.useRestoreDialog=Kt;exports.useScrollTrigger=Ke;exports.useTimeAge=Rt;Object.keys(w).forEach(n=>{n!=="default"&&!Object.prototype.hasOwnProperty.call(exports,n)&&Object.defineProperty(exports,n,{enumerable:!0,get:()=>w[n]})});
|