@ukpc-lib/react 0.12.1-dev.3 → 0.12.1-dev.5

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.
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),T=require("react"),m=require("../index.esm2017-Bv5RJIus.cjs"),X=require("moment"),N=require("@mui/material");require("axios");require("@r2wc/react-to-web-component");const pr=require("react-router-dom");require("react-query");require("react-dom");function $o(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const A=$o(T),Ao=e=>{var n,o;const{tabs:t}=e,r=s=>{e.setCurrentTab(s.target.id)};return console.log("🚀 ~ brandColors:",e.currentTab),l.jsxs(l.Fragment,{children:[l.jsx("style",{children:`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),T=require("react"),m=require("../index.esm2017-BGlUC1FO.cjs"),X=require("moment"),N=require("@mui/material");require("axios");require("@r2wc/react-to-web-component");const pr=require("react-router-dom");require("react-query");require("react-dom");function $o(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const A=$o(T),Ao=e=>{var n,o;const{tabs:t}=e,r=s=>{e.setCurrentTab(s.target.id)};return console.log("🚀 ~ brandColors:",e.currentTab),l.jsxs(l.Fragment,{children:[l.jsx("style",{children:`
2
2
  .tab-title {
3
3
  min-width: 90px;
4
4
  padding: 5px 16px;
@@ -1,8 +1,8 @@
1
1
  import ii, { jsxs as M, Fragment as le, jsx as u } from "react/jsx-runtime";
2
2
  import * as N from "react";
3
3
  import ye, { useState as W, useContext as $e, useEffect as q, useRef as Se, useCallback as Mt, forwardRef as ai, createElement as sr, PureComponent as si } from "react";
4
- import { c as ne, a as gt, C as Le, t as ct, p as li, L as Xr, u as ci, b as ui, S as qn, d as di, e as fi, Q as Zn, f as Et, g as Xn, h as hi, s as Ct, _ as B, P as R, i as pe, j as mi, o as pi, k as Ne, l as gi, m as yi, n as Jr, q as Ot, r as Qr, I as vi, v as bi, w as en, D as xi, x as Jn, y as Qn, z as Si, A as wi, B as _i } from "../index.esm2017-CjxlZYES.js";
5
- import { H as au, G as su, K as lu, E as cu, F as uu, J as du } from "../index.esm2017-CjxlZYES.js";
4
+ import { c as ne, a as gt, C as Le, t as ct, p as li, L as Xr, u as ci, b as ui, S as qn, d as di, e as fi, Q as Zn, f as Et, g as Xn, h as hi, s as Ct, _ as B, P as R, i as pe, j as mi, o as pi, k as Ne, l as gi, m as yi, n as Jr, q as Ot, r as Qr, I as vi, v as bi, w as en, D as xi, x as Jn, y as Qn, z as Si, A as wi, B as _i } from "../index.esm2017-Cal8p_6q.js";
5
+ import { H as au, G as su, K as lu, E as cu, F as uu, J as du } from "../index.esm2017-Cal8p_6q.js";
6
6
  import Q from "moment";
7
7
  import { Stack as me, Dialog as Ei, DialogTitle as Ci, Typography as Ce, DialogContent as Ti, DialogActions as Ii, Button as pr, Box as ki, ClickAwayListener as Mi, TextField as eo, IconButton as Oi, CircularProgress as $i, Fade as Ai, Paper as Ni, Checkbox as Ri, Breadcrumbs as Pi } from "@mui/material";
8
8
  import "axios";
@@ -133,7 +133,7 @@ Previous: %s
133
133
  Incoming: %s`,Ki,"["+v.join(", ")+"]","["+l.join(", ")+"]");for(var d=0;d<l.length&&d<v.length;d++)if(!qt(v[d],l[d]))return!1;return!0}function ju(){if(So>0)throw new Error("Rendered more hooks than during the previous render");return{memoizedState:null,queue:null,next:null}}function xi(){return Zt===null?Us===null?(hs=!1,Us=Zt=ju()):(hs=!0,Zt=Us):Zt.next===null?(hs=!1,Zt=Zt.next=ju()):(hs=!0,Zt=Zt.next),Zt}function Bu(v,l){bi=l,xa=v,$r=!1,ti=0}function zs(v,l,d,m){for(;el;)el=!1,ti=0,So+=1,Zt=null,d=v(l,m);return $u(),d}function Vr(){var v=ti!==0;return v}function $u(){$r=!1,bi=null,xa=null,el=!1,Us=null,So=0,wi=null,Zt=null}function Vu(v){return $r&&i("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()."),wa(v)}function Hu(v){return Ki="useContext",Ws(),wa(v)}function Ys(v,l){return typeof l=="function"?l(v):l}function ps(v){return Ki="useState",Uu(Ys,v)}function Uu(v,l,d){if(v!==Ys&&(Ki="useReducer"),bi=Ws(),Zt=xi(),hs){var m=Zt.queue,x=m.dispatch;if(wi!==null){var R=wi.get(m);if(R!==void 0){wi.delete(m);var B=Zt.memoizedState,Y=R;do{var ne=Y.action;$r=!0,B=v(B,ne),$r=!1,Y=Y.next}while(Y!==null);return Zt.memoizedState=B,[B,x]}}return[Zt.memoizedState,x]}else{$r=!0;var we;v===Ys?we=typeof l=="function"?l():l:we=d!==void 0?d(l):l,$r=!1,Zt.memoizedState=we;var je=Zt.queue={last:null,dispatch:null},qe=je.dispatch=$c.bind(null,bi,je);return[Zt.memoizedState,qe]}}function Bc(v,l){bi=Ws(),Zt=xi();var d=l===void 0?null:l;if(Zt!==null){var m=Zt.memoizedState;if(m!==null&&d!==null){var x=m[1];if(jc(d,x))return m[0]}}$r=!0;var R=v();return $r=!1,Zt.memoizedState=[R,d],R}function jl(v){bi=Ws(),Zt=xi();var l=Zt.memoizedState;if(l===null){var d={current:v};return Object.seal(d),Zt.memoizedState=d,d}else return l}function zf(v,l){Ki="useLayoutEffect",i("useLayoutEffect does nothing on the server, because its effect cannot be encoded into the server renderer's output format. This will lead to a mismatch between the initial, non-hydrated UI and the intended UI. To avoid this, useLayoutEffect should only be used in components that render exclusively on the client. See https://reactjs.org/link/uselayouteffect-ssr for common fixes.")}function $c(v,l,d){if(So>=Nu)throw new Error("Too many re-renders. React limits the number of renders to prevent an infinite loop.");if(v===bi){el=!0;var m={action:d,next:null};wi===null&&(wi=new Map);var x=wi.get(l);if(x===void 0)wi.set(l,m);else{for(var R=x;R.next!==null;)R=R.next;R.next=m}}}function fr(v,l){return Bc(function(){return v},l)}function Wu(v,l,d){return Ws(),l(v._source)}function Vc(v,l,d){if(d===void 0)throw new Error("Missing getServerSnapshot, which is required for server-rendered content. Will revert to client rendering.");return d()}function Si(v){return Ws(),v}function Bl(){throw new Error("startTransition cannot be called during server rendering.")}function Sa(){return Ws(),[!1,Bl]}function gs(){var v=xa,l=Ho(v.treeContext),d=Gs;if(d===null)throw new Error("Invalid hook call. Hooks can only be called inside of the body of a function component.");var m=ti++;return jn(d,l,m)}function tl(){}var rr={readContext:Vu,useContext:Hu,useMemo:Bc,useReducer:Uu,useRef:jl,useState:ps,useInsertionEffect:tl,useLayoutEffect:zf,useCallback:fr,useImperativeHandle:tl,useEffect:tl,useDebugValue:tl,useDeferredValue:Si,useTransition:Sa,useId:gs,useMutableSource:Wu,useSyncExternalStore:Vc},Gs=null;function $l(v){Gs=v}function Ta(v){try{var l="",d=v;do{switch(d.tag){case 0:l+=Xi(d.type,null,null);break;case 1:l+=ga(d.type,null,null);break;case 2:l+=Ac(d.type,null,null);break}d=d.parent}while(d);return l}catch(m){return`
134
134
  Error generating stack: `+m.message+`
135
135
  `+m.stack}}var Vl=n.ReactCurrentDispatcher,Ca=n.ReactDebugCurrentFrame,Hl=0,To=1,Ul=2,qs=3,Hc=4,nl=0,Ea=1,ka=2,zu=12800;function Uc(v){return console.error(v),null}function Xs(){}function Wl(v,l,d,m,x,R,B,Y,ne){var we=[],je=new Set,qe={destination:null,responseState:l,progressiveChunkSize:m===void 0?zu:m,status:nl,fatalError:null,nextSegmentId:0,allPendingTasks:0,pendingRootTasks:0,completedRootSegment:null,abortableTasks:je,pingedTasks:we,clientRenderedBoundaries:[],completedBoundaries:[],partialBoundaries:[],onError:x===void 0?Uc:x,onAllReady:R===void 0?Xs:R,onShellReady:B===void 0?Xs:B,onShellError:Y===void 0?Xs:Y,onFatalError:ne===void 0?Xs:ne},nt=rl(qe,0,null,d,!1,!1);nt.parentFlushed=!0;var xt=Wo(qe,v,null,nt,je,Gn,Il,Vf);return we.push(xt),qe}function Uo(v,l){var d=v.pingedTasks;d.push(l),d.length===1&&a(function(){return Ju(v)})}function zl(v,l){return{id:_i,rootSegmentID:-1,parentFlushed:!1,pendingTasks:0,forceClientRender:!1,completedSegments:[],byteSize:0,fallbackAbortableTasks:l,errorDigest:null}}function Wo(v,l,d,m,x,R,B,Y){v.allPendingTasks++,d===null?v.pendingRootTasks++:d.pendingTasks++;var ne={node:l,ping:function(){return Uo(v,ne)},blockedBoundary:d,blockedSegment:m,abortSet:x,legacyContext:R,context:B,treeContext:Y};return ne.componentStack=null,x.add(ne),ne}function rl(v,l,d,m,x,R){return{status:Hl,id:-1,index:l,parentFlushed:!1,chunks:[],children:[],formatContext:m,boundary:d,lastPushedText:x,textEmbedded:R}}var Zi=null;function Ji(){return Zi===null||Zi.componentStack===null?"":Ta(Zi.componentStack)}function Co(v,l){v.componentStack={tag:0,parent:v.componentStack,type:l}}function il(v,l){v.componentStack={tag:1,parent:v.componentStack,type:l}}function ms(v,l){v.componentStack={tag:2,parent:v.componentStack,type:l}}function Qi(v){v.componentStack===null?i("Unexpectedly popped too many stack frames. This is a bug in React."):v.componentStack=v.componentStack.parent}var Da=null;function Yl(v,l){{var d;typeof l=="string"?d=l:l&&typeof l.message=="string"?d=l.message:d=String(l);var m=Da||Ji();Da=null,v.errorMessage=d,v.errorComponentStack=m}}function ol(v,l){var d=v.onError(l);if(d!=null&&typeof d!="string")throw new Error('onError returned something with a type other than "string". onError should return a string and may return null or undefined but must not return anything else. It received something of type "'+typeof d+'" instead');return d}function Pa(v,l){var d=v.onShellError;d(l);var m=v.onFatalError;m(l),v.destination!==null?(v.status=ka,H(v.destination,l)):(v.status=Ea,v.fatalError=l)}function Wc(v,l,d){Co(l,"Suspense");var m=l.blockedBoundary,x=l.blockedSegment,R=d.fallback,B=d.children,Y=new Set,ne=zl(v,Y),we=x.chunks.length,je=rl(v,we,ne,x.formatContext,!1,!1);x.children.push(je),x.lastPushedText=!1;var qe=rl(v,0,null,x.formatContext,!1,!1);qe.parentFlushed=!0,l.blockedBoundary=ne,l.blockedSegment=qe;try{if(Ti(v,l,B),_n(qe.chunks,v.responseState,qe.lastPushedText,qe.textEmbedded),qe.status=To,bs(ne,qe),ne.pendingTasks===0){Qi(l);return}}catch(xt){qe.status=Hc,ne.forceClientRender=!0,ne.errorDigest=ol(v,xt),Yl(ne,xt)}finally{l.blockedBoundary=m,l.blockedSegment=x}var nt=Wo(v,R,m,je,Y,l.legacyContext,l.context,l.treeContext);nt.componentStack=l.componentStack,v.pingedTasks.push(nt),Qi(l)}function Yu(v,l,d,m){Co(l,d);var x=l.blockedSegment,R=co(x.chunks,d,m,v.responseState,x.formatContext);x.lastPushedText=!1;var B=x.formatContext;x.formatContext=pi(B,d,m),Ti(v,l,R),x.formatContext=B,Mo(x.chunks,d),x.lastPushedText=!1,Qi(l)}function Gu(v){return v.prototype&&v.prototype.isReactComponent}function Ks(v,l,d,m,x){var R={};Bu(l,R);var B=d(m,x);return zs(d,m,B,x)}function qu(v,l,d,m,x){var R=d.render();d.props!==x&&(ql||i("It looks like %s is reassigning its own `this.props` while rendering. This is not supported and can lead to confusing bugs.",pn(m)||"a component"),ql=!0);{var B=m.childContextTypes;if(B!=null){var Y=l.legacyContext,ne=Ru(d,m,Y,B);l.legacyContext=ne,dr(v,l,R),l.legacyContext=Y;return}}dr(v,l,R)}function Gl(v,l,d,m){ms(l,d);var x=ls(d,l.legacyContext),R=xo(d,m,x);Qa(R,d,m,x),qu(v,l,R,d,m),Qi(l)}var Bt={},sl={},Xu={},Zs={},ql=!1,zc={},Yc=!1,ni=!1,Gc=!1;function Xl(v,l,d,m){var x;if(x=ls(d,l.legacyContext),il(l,d),d.prototype&&typeof d.prototype.render=="function"){var R=pn(d)||"Unknown";Bt[R]||(i("The <%s /> component appears to have a render method, but doesn't extend React.Component. This is likely to cause errors. Change %s to extend React.Component instead.",R,R),Bt[R]=!0)}var B=Ks(v,l,d,m,x),Y=Vr();if(typeof B=="object"&&B!==null&&typeof B.render=="function"&&B.$$typeof===void 0){var ne=pn(d)||"Unknown";sl[ne]||(i("The <%s /> component appears to be a function component that returns a class instance. Change %s to a class that extends React.Component instead. If you can't use a class try assigning the prototype on the function as a workaround. `%s.prototype = React.Component.prototype`. Don't use an arrow function since it cannot be called with `new` by React.",ne,ne,ne),sl[ne]=!0)}if(typeof B=="object"&&B!==null&&typeof B.render=="function"&&B.$$typeof===void 0){{var we=pn(d)||"Unknown";sl[we]||(i("The <%s /> component appears to be a function component that returns a class instance. Change %s to a class that extends React.Component instead. If you can't use a class try assigning the prototype on the function as a workaround. `%s.prototype = React.Component.prototype`. Don't use an arrow function since it cannot be called with `new` by React.",we,we,we),sl[we]=!0)}Qa(B,d,m,x),qu(v,l,B,d,m)}else if(Ku(d),Y){var je=l.treeContext,qe=1,nt=0;l.treeContext=Lu(je,qe,nt);try{dr(v,l,B)}finally{l.treeContext=je}}else dr(v,l,B);Qi(l)}function Ku(v){{if(v&&v.childContextTypes&&i("%s(...): childContextTypes cannot be defined on a function component.",v.displayName||v.name||"Component"),v.defaultProps!==void 0){var l=pn(v)||"Unknown";zc[l]||(i("%s: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.",l),zc[l]=!0)}if(typeof v.getDerivedStateFromProps=="function"){var d=pn(v)||"Unknown";Zs[d]||(i("%s: Function components do not support getDerivedStateFromProps.",d),Zs[d]=!0)}if(typeof v.contextType=="object"&&v.contextType!==null){var m=pn(v)||"Unknown";Xu[m]||(i("%s: Function components do not support contextType.",m),Xu[m]=!0)}}}function Zu(v,l){if(v&&v.defaultProps){var d=J({},l),m=v.defaultProps;for(var x in m)d[x]===void 0&&(d[x]=m[x]);return d}return l}function qc(v,l,d,m,x){il(l,d.render);var R=Ks(v,l,d.render,m,x),B=Vr();if(B){var Y=l.treeContext,ne=1,we=0;l.treeContext=Lu(Y,ne,we);try{dr(v,l,R)}finally{l.treeContext=Y}}else dr(v,l,R);Qi(l)}function Hr(v,l,d,m,x){var R=d.type,B=Zu(R,m);Js(v,l,R,B,x)}function vs(v,l,d,m){d._context===void 0?d!==d.Consumer&&(Gc||(Gc=!0,i("Rendering <Context> directly is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?"))):d=d._context;var x=m.children;typeof x!="function"&&i("A context consumer was rendered with multiple children, or a child that isn't a function. A context consumer expects a single child that is a function. If you did pass a function, make sure there is no trailing or leading whitespace around it.");var R=wa(d),B=x(R);dr(v,l,B)}function Ur(v,l,d,m){var x=d._context,R=m.value,B=m.children,Y;Y=l.context,l.context=Au(x,R),dr(v,l,B),l.context=Nf(x),Y!==l.context&&i("Popping the context provider did not return back to the original snapshot. This is a bug in React.")}function Xc(v,l,d,m,x){Co(l,"Lazy");var R=d._payload,B=d._init,Y=B(R),ne=Zu(Y,m);Js(v,l,Y,ne,x),Qi(l)}function Js(v,l,d,m,x){if(typeof d=="function")if(Gu(d)){Gl(v,l,d,m);return}else{Xl(v,l,d,m);return}if(typeof d=="string"){Yu(v,l,d,m);return}switch(d){case Yn:case Vt:case K:case ae:case Ce:{dr(v,l,m.children);return}case lt:{Co(l,"SuspenseList"),dr(v,l,m.children),Qi(l);return}case wt:throw new Error("ReactDOMServer does not yet support scope components.");case st:{Wc(v,l,m);return}}if(typeof d=="object"&&d!==null)switch(d.$$typeof){case Le:{qc(v,l,d,m,x);return}case rt:{Hr(v,l,d,m,x);return}case se:{Ur(v,l,d,m);return}case Re:{vs(v,l,d,m);return}case It:{Xc(v,l,d,m);return}}var R="";throw(d===void 0||typeof d=="object"&&d!==null&&Object.keys(d).length===0)&&(R+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),new Error("Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) "+("but got: "+(d==null?d:typeof d)+"."+R))}function Kc(v,l){typeof Symbol=="function"&&v[Symbol.toStringTag]==="Generator"&&(Yc||i("Using Generators as children is unsupported and will likely yield unexpected results because enumerating a generator mutates it. You may convert it to an array with `Array.from()` or the `[...spread]` operator before rendering. Keep in mind you might need to polyfill these features for older browsers."),Yc=!0),v.entries===l&&(ni||i("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),ni=!0)}function dr(v,l,d){try{return Zc(v,l,d)}catch(m){throw typeof m=="object"&&m!==null&&typeof m.then=="function"||(Da=Da!==null?Da:Ji()),m}}function Zc(v,l,d){if(l.node=d,typeof d=="object"&&d!==null){switch(d.$$typeof){case ce:{var m=d,x=m.type,R=m.props,B=m.ref;Js(v,l,x,R,B);return}case Se:throw new Error("Portals are not currently supported by the server renderer. Render them conditionally so that they only appear on the client render.");case It:{var Y=d,ne=Y._payload,we=Y._init,je;try{je=we(ne)}catch(eo){throw typeof eo=="object"&&eo!==null&&typeof eo.then=="function"&&Co(l,"Lazy"),eo}dr(v,l,je);return}}if(er(d)){Kl(v,l,d);return}var qe=jr(d);if(qe){Kc(d,qe);var nt=qe.call(d);if(nt){var xt=nt.next();if(!xt.done){var en=[];do en.push(xt.value),xt=nt.next();while(!xt.done);Kl(v,l,en);return}return}}var ir=Object.prototype.toString.call(d);throw new Error("Objects are not valid as a React child (found: "+(ir==="[object Object]"?"object with keys {"+Object.keys(d).join(", ")+"}":ir)+"). If you meant to render a collection of children, use an array instead.")}if(typeof d=="string"){var Eo=l.blockedSegment;Eo.lastPushedText=On(l.blockedSegment.chunks,d,v.responseState,Eo.lastPushedText);return}if(typeof d=="number"){var ws=l.blockedSegment;ws.lastPushedText=On(l.blockedSegment.chunks,""+d,v.responseState,ws.lastPushedText);return}typeof d=="function"&&i("Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it.")}function Kl(v,l,d){for(var m=d.length,x=0;x<m;x++){var R=l.treeContext;l.treeContext=Lu(R,m,x);try{Ti(v,l,d[x])}finally{l.treeContext=R}}}function Zl(v,l,d){var m=l.blockedSegment,x=m.chunks.length,R=rl(v,x,null,m.formatContext,m.lastPushedText,!0);m.children.push(R),m.lastPushedText=!1;var B=Wo(v,l.node,l.blockedBoundary,R,l.abortSet,l.legacyContext,l.context,l.treeContext);l.componentStack!==null&&(B.componentStack=l.componentStack.parent);var Y=B.ping;d.then(Y,Y)}function Ti(v,l,d){var m=l.blockedSegment.formatContext,x=l.legacyContext,R=l.context,B=null;B=l.componentStack;try{return dr(v,l,d)}catch(Y){if($u(),typeof Y=="object"&&Y!==null&&typeof Y.then=="function"){Zl(v,l,Y),l.blockedSegment.formatContext=m,l.legacyContext=x,l.context=R,fs(R),l.componentStack=B;return}else throw l.blockedSegment.formatContext=m,l.legacyContext=x,l.context=R,fs(R),l.componentStack=B,Y}}function Jc(v,l,d,m){var x=ol(v,m);if(l===null?Pa(v,m):(l.pendingTasks--,l.forceClientRender||(l.forceClientRender=!0,l.errorDigest=x,Yl(l,m),l.parentFlushed&&v.clientRenderedBoundaries.push(l))),v.allPendingTasks--,v.allPendingTasks===0){var R=v.onAllReady;R()}}function ys(v){var l=this,d=v.blockedBoundary,m=v.blockedSegment;m.status=qs,Qs(l,d,m)}function Jl(v,l,d){var m=v.blockedBoundary,x=v.blockedSegment;if(x.status=qs,m===null)l.allPendingTasks--,l.status!==ka&&(l.status=ka,l.destination!==null&&A(l.destination));else{if(m.pendingTasks--,!m.forceClientRender){m.forceClientRender=!0;var R=d===void 0?new Error("The render was aborted by the server without a reason."):d;m.errorDigest=l.onError(R);{var B="The server did not finish this Suspense boundary: ";R&&typeof R.message=="string"?R=B+R.message:R=B+String(R);var Y=Zi;Zi=v;try{Yl(m,R)}finally{Zi=Y}}m.parentFlushed&&l.clientRenderedBoundaries.push(m)}if(m.fallbackAbortableTasks.forEach(function(we){return Jl(we,l,d)}),m.fallbackAbortableTasks.clear(),l.allPendingTasks--,l.allPendingTasks===0){var ne=l.onAllReady;ne()}}}function bs(v,l){if(l.chunks.length===0&&l.children.length===1&&l.children[0].boundary===null){var d=l.children[0];d.id=l.id,d.parentFlushed=!0,d.status===To&&bs(v,d)}else{var m=v.completedSegments;m.push(l)}}function Qs(v,l,d){if(l===null){if(d.parentFlushed){if(v.completedRootSegment!==null)throw new Error("There can only be one root segment. This is a bug in React.");v.completedRootSegment=d}if(v.pendingRootTasks--,v.pendingRootTasks===0){v.onShellError=Xs;var m=v.onShellReady;m()}}else if(l.pendingTasks--,!l.forceClientRender){if(l.pendingTasks===0)d.parentFlushed&&d.status===To&&bs(l,d),l.parentFlushed&&v.completedBoundaries.push(l),l.fallbackAbortableTasks.forEach(ys,v),l.fallbackAbortableTasks.clear();else if(d.parentFlushed&&d.status===To){bs(l,d);var x=l.completedSegments;x.length===1&&l.parentFlushed&&v.partialBoundaries.push(l)}}if(v.allPendingTasks--,v.allPendingTasks===0){var R=v.onAllReady;R()}}function Yf(v,l){var d=l.blockedSegment;if(d.status===Hl){fs(l.context);var m=null;m=Zi,Zi=l;try{dr(v,l,l.node),_n(d.chunks,v.responseState,d.lastPushedText,d.textEmbedded),l.abortSet.delete(l),d.status=To,Qs(v,l.blockedBoundary,d)}catch(R){if($u(),typeof R=="object"&&R!==null&&typeof R.then=="function"){var x=l.ping;R.then(x,x)}else l.abortSet.delete(l),d.status=Hc,Jc(v,l.blockedBoundary,d,R)}finally{Zi=m}}}function Ju(v){if(v.status!==ka){var l=Mc(),d=Vl.current;Vl.current=rr;var m;m=Ca.getCurrentStack,Ca.getCurrentStack=Ji;var x=Gs;$l(v.responseState);try{var R=v.pingedTasks,B;for(B=0;B<R.length;B++){var Y=R[B];Yf(v,Y)}R.splice(0,B),v.destination!==null&&Ii(v,v.destination)}catch(ne){ol(v,ne),Pa(v,ne)}finally{$l(x),Vl.current=d,Ca.getCurrentStack=m,d===rr&&fs(l)}}}function al(v,l,d){switch(d.parentFlushed=!0,d.status){case Hl:{var m=d.id=v.nextSegmentId++;return d.lastPushedText=!1,d.textEmbedded=!1,cr(l,v.responseState,m)}case To:{d.status=Ul;for(var x=!0,R=d.chunks,B=0,Y=d.children,ne=0;ne<Y.length;ne++){for(var we=Y[ne];B<we.index;B++)g(l,R[B]);x=ll(v,l,we)}for(;B<R.length-1;B++)g(l,R[B]);return B<R.length&&(x=T(l,R[B])),x}default:throw new Error("Aborted, errored or already flushed boundaries should not be flushed again. This is a bug in React.")}}function ll(v,l,d){var m=d.boundary;if(m===null)return al(v,l,d);if(m.parentFlushed=!0,m.forceClientRender)return Be(l,v.responseState,m.errorDigest,m.errorMessage,m.errorComponentStack),al(v,l,d),Et(l,v.responseState);if(m.pendingTasks>0){m.rootSegmentID=v.nextSegmentId++,m.completedSegments.length>0&&v.partialBoundaries.push(m);var x=m.id=nn(v.responseState);return xe(l,v.responseState,x),al(v,l,d),Tt(l,v.responseState)}else{if(m.byteSize>v.progressiveChunkSize)return m.rootSegmentID=v.nextSegmentId++,v.completedBoundaries.push(m),xe(l,v.responseState,m.id),al(v,l,d),Tt(l,v.responseState);_e(l,v.responseState);var R=m.completedSegments;if(R.length!==1)throw new Error("A previously unvisited boundary must have exactly one root segment. This is a bug in React.");var B=R[0];return ll(v,l,B),ot(l,v.responseState)}}function Qu(v,l,d){return Ol(l,v.responseState,d.id,d.errorDigest,d.errorMessage,d.errorComponentStack)}function Ql(v,l,d){return St(l,v.responseState,d.formatContext,d.id),ll(v,l,d),vt(l,d.formatContext)}function ec(v,l,d){for(var m=d.completedSegments,x=0;x<m.length;x++){var R=m[x];Wr(v,l,d,R)}return m.length=0,mo(l,v.responseState,d.id,d.rootSegmentID)}function Qc(v,l,d){for(var m=d.completedSegments,x=0;x<m.length;x++){var R=m[x];if(!Wr(v,l,d,R))return x++,m.splice(0,x),!1}return m.splice(0,x),!0}function Wr(v,l,d,m){if(m.status===Ul)return!0;var x=m.id;if(x===-1){var R=m.id=d.rootSegmentID;if(R===-1)throw new Error("A root segment ID must have been assigned by now. This is a bug in React.");return Ql(v,l,m)}else return Ql(v,l,m),Wa(l,v.responseState,x)}function Ii(v,l){w();try{var d=v.completedRootSegment;d!==null&&v.pendingRootTasks===0&&(ll(v,l,d),v.completedRootSegment=null,yi(l,v.responseState));var m=v.clientRenderedBoundaries,x;for(x=0;x<m.length;x++){var R=m[x];Qu(v,l,R)}m.splice(0,x);var B=v.completedBoundaries;for(x=0;x<B.length;x++){var Y=B[x];ec(v,l,Y)}B.splice(0,x),E(l),w(l);var ne=v.partialBoundaries;for(x=0;x<ne.length;x++){var we=ne[x];if(!Qc(v,l,we)){v.destination=null,x++,ne.splice(0,x);return}}ne.splice(0,x);var je=v.completedBoundaries;for(x=0;x<je.length;x++){var qe=je[x];ec(v,l,qe)}je.splice(0,x)}finally{E(l),v.allPendingTasks===0&&v.pingedTasks.length===0&&v.clientRenderedBoundaries.length===0&&v.completedBoundaries.length===0&&(v.abortableTasks.size!==0&&i("There was still abortable task at the root when we closed. This is a bug in React."),A(l))}}function ef(v){a(function(){return Ju(v)})}function Gf(v,l){if(v.status===Ea){v.status=ka,H(l,v.fatalError);return}if(v.status!==ka&&v.destination===null){v.destination=l;try{Ii(v,l)}catch(d){ol(v,d),Pa(v,d)}}}function ul(v,l){try{var d=v.abortableTasks;d.forEach(function(m){return Jl(m,v,l)}),d.clear(),v.destination!==null&&Ii(v,v.destination)}catch(m){ol(v,m),Pa(v,m)}}function Oa(v,l){return new Promise(function(d,m){var x,R,B=new Promise(function(nt,xt){R=nt,x=xt});function Y(){var nt=new ReadableStream({type:"bytes",pull:function(xt){Gf(we,xt)},cancel:function(xt){ul(we)}},{highWaterMark:0});nt.allReady=B,d(nt)}function ne(nt){B.catch(function(){}),m(nt)}var we=Wl(v,Oi(l?l.identifierPrefix:void 0,l?l.nonce:void 0,l?l.bootstrapScriptContent:void 0,l?l.bootstrapScripts:void 0,l?l.bootstrapModules:void 0),hi(l?l.namespaceURI:void 0),l?l.progressiveChunkSize:void 0,l?l.onError:void 0,R,Y,ne,x);if(l&&l.signal){var je=l.signal,qe=function(){ul(we,je.reason),je.removeEventListener("abort",qe)};je.addEventListener("abort",qe)}ef(we)})}Ah.renderToReadableStream=Oa,Ah.version=e}()),Ah}var Cc,wv;process.env.NODE_ENV==="production"?(Cc=w4(),wv=x4()):(Cc=S4(),wv=T4());Cc.version;var C4=Cc.renderToString;Cc.renderToStaticMarkup;Cc.renderToNodeStream;Cc.renderToStaticNodeStream;wv.renderToReadableStream;var E4=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function DD(t,e){return t(e={exports:{}},e.exports),e.exports}var k4=DD(function(t){(function(e){var n=function(j,_,H){if(!f(_)||w(_)||g(_)||T(_)||c(_))return _;var W,re=0,Z=0;if(p(_))for(W=[],Z=_.length;re<Z;re++)W.push(n(j,_[re],H));else for(var de in W={},_)Object.prototype.hasOwnProperty.call(_,de)&&(W[j(de,H)]=n(j,_[de],H));return W},r=function(j){return E(j)?j:(j=j.replace(/[\-_\s]+(.)?/g,function(_,H){return H?H.toUpperCase():""})).substr(0,1).toLowerCase()+j.substr(1)},i=function(j){var _=r(j);return _.substr(0,1).toUpperCase()+_.substr(1)},o=function(j,_){return function(H,W){var re=(W=W||{}).separator||"_",Z=W.split||/(?=[A-Z])/;return H.split(Z).join(re)}(j,_).toLowerCase()},a=Object.prototype.toString,c=function(j){return typeof j=="function"},f=function(j){return j===Object(j)},p=function(j){return a.call(j)=="[object Array]"},w=function(j){return a.call(j)=="[object Date]"},g=function(j){return a.call(j)=="[object RegExp]"},T=function(j){return a.call(j)=="[object Boolean]"},E=function(j){return(j-=0)==j},A=function(j,_){var H=_&&"process"in _?_.process:_;return typeof H!="function"?j:function(W,re){return H(W,j,re)}},I={camelize:r,decamelize:o,pascalize:i,depascalize:o,camelizeKeys:function(j,_){return n(A(r,_),j)},decamelizeKeys:function(j,_){return n(A(o,_),j,_)},pascalizeKeys:function(j,_){return n(A(i,_),j)},depascalizeKeys:function(){return this.decamelizeKeys.apply(this,arguments)}};t.exports?t.exports=I:e.humps=I})(E4)}).decamelize,D4=function(t){if(Array.isArray(t))return t},P4=function(t,e){if(typeof Symbol<"u"&&Symbol.iterator in Object(t)){var n=[],r=!0,i=!1,o=void 0;try{for(var a,c=t[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(f){i=!0,o=f}finally{try{r||c.return==null||c.return()}finally{if(i)throw o}}return n}},g1=function(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r},O4=function(t,e){if(t){if(typeof t=="string")return g1(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g1(t,e):void 0}},_4=function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
136
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)},R4=function(t,e){return D4(t)||P4(t,e)||O4(t,e)||_4()},PD=DD(function(t){function e(){return t.exports=e=Object.assign||function(n){for(var r=1;r<arguments.length;r++){var i=arguments[r];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])}return n},e.apply(this,arguments)}t.exports=e}),A4=function(t,e){if(t==null)return{};var n,r,i={},o=Object.keys(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||(i[n]=t[n]);return i},OD=function(t,e){if(t==null)return{};var n,r,i=A4(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i},I4=q.createContext(null);function _D(t){var e=t.children,n=e===void 0?"":e,r=OD(t,["children"]);return typeof n!="string"&&(n=C4(n)),q.createElement("template",PD({},r,{dangerouslySetInnerHTML:{__html:n}}))}function RD(t){var e=t.root,n=t.children;return Ov.createPortal(n===void 0?null:n,e)}function M4(t){var e=q.forwardRef(function(n,r){var i,o,a=n.mode,c=a===void 0?"open":a,f=n.delegatesFocus,p=f!==void 0&&f,w=n.styleSheets,g=w===void 0?[]:w,T=n.ssr,E=T!==void 0&&T,A=n.children,I=OD(n,["mode","delegatesFocus","styleSheets","ssr","children"]),j=(o=q.useRef((i=r)&&i.current),q.useEffect(function(){i&&(i.current=o.current)},[i]),o),_=q.useState(null),H=R4(_,2),W=H[0],re=H[1],Z="node_".concat(c).concat(p);return q.useLayoutEffect(function(){if(j.current)try{if(typeof r=="function"&&r(j.current),E){var de=j.current.shadowRoot;return void re(de)}var S=j.current.attachShadow({mode:c,delegatesFocus:p});g.length>0&&(S.adoptedStyleSheets=g),re(S)}catch(le){(function(ue){var ze=ue.error,Me=ue.styleSheets,Fe=ue.root;switch(ze.name){case"NotSupportedError":Me.length>0&&(Fe.adoptedStyleSheets=Me);break;default:throw ze}})({error:le,styleSheets:g,root:W})}},[r,j,g]),q.createElement(q.Fragment,null,q.createElement(t.tag,PD({key:Z,ref:j},I),(W||E)&&q.createElement(I4.Provider,{value:W},E?q.createElement(_D,{shadowroot:c,shadowrootmode:c},t.render({root:W,ssr:E,children:A})):q.createElement(RD,{root:W},t.render({root:W,ssr:E,children:A})))))});return e.propTypes={mode:_s.oneOf(["open","closed"]),delegatesFocus:_s.bool,styleSheets:_s.arrayOf(_s.instanceOf(globalThis.CSSStyleSheet)),ssr:_s.bool,children:_s.node},e}_D.propTypes={children:_s.oneOfType([_s.string,_s.node])},RD.propTypes={root:_s.object.isRequired,children:_s.node};var hm=new Map;function L4(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"core",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(r){return r.children};return new Proxy(t,{get:function(r,i){var o=k4(i,{separator:"-"}),a="".concat(e,"-").concat(o);return hm.has(a)||hm.set(a,M4({tag:o,render:n})),hm.get(a)}})}var AD=L4();const F4=".app,.treeRoot{height:100%}.draggingSource{opacity:.3}.placeholderContainer{position:relative}.dropTarget{background-color:#8d878711}",N4=".favorite-bar{position:sticky;top:64px;z-index:900;transition:transform .3s ease,opacity .3s ease;border-bottom:1px solid #ddd}.favorite-bar--hidden{transform:translateY(-100%);opacity:0}.favorite-bar--visible{transform:translateY(0);opacity:1}",j4=t=>{const e=t.depth*16;return Ie.jsx("div",{style:{backgroundColor:t.color||"#93D500",height:"2px",position:"absolute",right:"0",top:"0",left:e}})};function B4(t){const e=new CustomEvent("updateFavoriteMenu",{detail:{menuItem:t}});window.dispatchEvent(e)}function $4(t){const e=bp.useLocation(),n=q.useRef(null),[r,i]=q.useState([]),[o,a]=q.useState(!1);console.log("isSubmit",o);const[c,f]=q.useState([]),p=q.useRef(null),[w,g]=q.useState(window.location.href);q.useEffect(()=>{g(window.location.href)},[e]);const T=_=>`${_}`;function E(_,H){for(const W of _){if(W.id===H)return W;if(W.children){const re=E(W.children,H);if(re)return re}}return null}function A(_,H){const W=E(r,_);W?(W.isFavorite=H,B4(W),Xy(_,H)):console.error(`Item with id ${_} not found`)}const I=_=>{console.log("Favorite menus changed",_);const H=_.detail.favoriteMenus||[];i(H)};q.useEffect(()=>(window.addEventListener("favoriteMenusChange",I),()=>{window.removeEventListener("favoriteMenusChange",I)}),[]);function j(_){a(!0);const H=[...c];f(_),console.log("tree",_),console.log("prev",H);const W={menuItemIds:_.map(re=>re.id)};console.log(W),Rs.post("global-menu-config/api/v1/menu-items/user/order-favorites",W,{baseURL:t.baseUrl}).then(()=>{}).catch(re=>{console.error(re),f(H)}).finally(()=>{a(!1)})}return q.useEffect(()=>{const _=r.map(H=>({id:H.id,parent:0,text:H.name,data:H}));f(_),console.log("nodes",_)},[r]),Ie.jsx(Ie.Fragment,{children:r.length?Ie.jsx("div",{className:T("favorite-menu"),children:Ie.jsx(Nv,{ref:p,className:T("wrap-section favorite-menu__menu"),style:{marginTop:4,flex:1,overflow:"auto",height:"100%",overflowY:"hidden"},children:Ie.jsx(PE,{backend:jE,options:zE(),children:Ie.jsx(XE,{ref:n,classes:{root:"treeFavorited"},tree:c,rootId:0,sort:!1,insertDroppableFirst:!1,enableAnimateExpand:!0,dropTargetOffset:10,onDrop:j,render:(_,H)=>{console.log("1111111111111");const W=_.data;return console.log("item favorite",W),console.log("params",H),Ie.jsx(kD,{replacePath:t.replacePath,ssr:t.ssr,brandColors:t.brandColors,baseUrl:t.baseUrl,node:_,params:H,nodes:c,item:W,level:H.depth+1,onSetFavoriteSuccess:A})},placeholderRender:(_,{depth:H})=>{var W;return console.log("aaaa"),Ie.jsx(j4,{node:_,depth:H,color:(W=t.brandColors)==null?void 0:W.primary300})},canDrag:()=>!o,canDrop:(_,{dragSource:H,dropTargetId:W})=>(H==null?void 0:H.parent)===W,onDragStart:_=>{console.log("onDragStart",_)}})})})}):""})}function V4(t=32){const[e,n]=q.useState(!0),[r,i]=q.useState(0),o=()=>{const a=window.scrollY;a>r&&a>t?n(!1):a<r&&n(!0),i(a)};return q.useEffect(()=>(window.addEventListener("scroll",o),()=>window.removeEventListener("scroll",o)),[r]),{isFavoriteBarVisible:e}}function H4(t){const{isFavoriteBarVisible:e}=V4();return Ie.jsxs(Ie.Fragment,{children:[Ie.jsx("style",{children:N4}),Ie.jsx("div",{className:`favorite-bar ${e?"favorite-bar--visible":"favorite-bar--hidden"}`,children:Ie.jsx(AD.div,{children:Ie.jsx(Mv,{styles:[DT,b4,F4],children:Ie.jsx($4,{...t})})})})]})}function Xy(t,e){const n=JSON.parse(localStorage.getItem("favoriteItems")||"[]");if(e)n.includes(t)||n.push(t);else{const r=n.indexOf(t);r>-1&&n.splice(r,1)}localStorage.setItem("favoriteItems",JSON.stringify(n))}function ID({...t}){var me,Ee,Ye;const e=t.item,n=t.level||0,r=!!((me=t.item.children)!=null&&me.length),{isActive:i,isCollapsed:o}=t,a=`level-${n}`,c=o?"collapsed":"expanded",f=i(e.id)?"active":"",p=r?"parent":"child",w=t.params.isOpen?"isOpen":"isClose",g=(We,Je=a)=>`${We} ${Je} ${c} ${f} ${p} ${w}`,[T,E]=q.useState(!1),[A,I]=q.useState(e.isFavorite||!1);q.useEffect(()=>{I(!!t.item.isFavorite)},[t.item.isFavorite]);const j=q.useRef(),_=q.useRef();_!=null&&_.current&&((Ee=_==null?void 0:_.current)==null?void 0:Ee.scrollWidth)>((Ye=_==null?void 0:_.current)==null?void 0:Ye.clientWidth);const H=window.location.origin,W=e.path&&e.path.includes("http")?new URL(e.path):{origin:"",pathname:""},re=window.location.pathname.split("/")[1],Z=W.pathname.split("/")[1],de=t.item.redirectUrl||t.ssr||!H.includes("local")&&H!==W.origin||Z!==re,S=r?"div":de?"a":bp.Link,le=e.path||"#",ue=n+1,ze=r&&o&&T,Me=o||n===0?void 0:`${n+.25}rem`,Fe=()=>{E(!0)},Ve=()=>{E(!1)},Ue="/global-menu-config/api/v1/menu-items/user/set-favorite",he=e.serviceKey==="mn_poms";t.params.depth*20,t.params.depth,vH(e.id,t.params.isOpen,t.params.onToggle);const Oe=he||o&&n===0?e.name==="POMs"?"Parking Operations Management":e.description||e.name:null,Ne=Object.entries(t.brandColors||{}).reduce((We,[Je,Ze])=>(Ze&&(We[`--${Je}`]=Ze),We),{}),tt=H!==W.origin||t.item.redirectUrl?"_blank":"_self";return Ie.jsxs("div",{ref:j,className:g("menu-item__wrapper tree-node"),style:{borderRadius:"8px",transition:"all 0.3s",...Ne},onMouseOver:Fe,onMouseOut:Ve,onDragStart:We=>{o&&n>1&&We.preventDefault()},children:[Ie.jsx(oa.Tooltip,{placement:"top",title:Oe,disableInteractive:!0,children:Ie.jsxs(S,{target:tt,to:le,href:le,draggable:"true",className:g("menu-item__link"),style:{paddingLeft:Me},onClick:We=>{S==="a"&&tt==="_blank"||o||t.toggleExpand(We)},children:[Ie.jsx(U4,{cls:g,item:e}),Ie.jsx("span",{className:g("menu-item__label"),ref:_,children:e.name}),Ie.jsx(W4,{tooltipPosition:Oe?"right":"top",menuLevel:n,hasChildren:r,isHovered:T,isFavorite:A,onClick:We=>{const Je={menuConfigId:e.id,isFavorite:We},Ze=t.baseUrl+Ue;Rs.post(Ze,Je).then(Qe=>{var it;I(We),Bv("Set favorite menu item successfully"),(it=t.onSetFavoriteSuccess)==null||it.call(t,t.item.id,We),Xy(t.item.id,We)}).catch(Qe=>{var it,ht;Hd(((ht=(it=Qe.response)==null?void 0:it.data)==null?void 0:ht.errorMessage)||"Have error when set favorite menu item")})}}),r&&Ie.jsx("div",{className:g("menu-item__icon-arrow__wrapper"),children:Ie.jsx(B5,{className:g(`menu-item__icon-arrow__icon ${t.params.isOpen?"open":"close"}`)})})]})}),ze&&Ie.jsx($5,{parentRef:j,onlyChild:!o,renderChildren:({maxHeight:We})=>{var Je;return Ie.jsx(vD.div,{className:g(`menu-item__dropdown ${t.params.isOpen?"menu-item__dropdown--open":"menu-item__dropdown--close"}`,`level-${ue}`),style:Gy({maxHeight:We,overflowY:"auto",paddingRight:3},We!=="auto"&&!!ue),children:(Je=e.children)==null?void 0:Je.map(Ze=>q.createElement(ID,{...t,key:Ze.id,item:Ze,level:ue}))})}})]})}function U4({item:t,cls:e}){return Ie.jsx("div",{className:e("menu-item__icon"),children:Ie.jsx(ED,{item:t})})}function W4(t){const e={marginRight:t.hasChildren?10:0,fontSize:18,fill:ki.warning};return Ie.jsxs(Ie.Fragment,{children:[t.isHovered&&!t.isFavorite&&Ie.jsx(oa.Tooltip,{placement:t.tooltipPosition||"top",title:"Add to favorites",disableInteractive:!0,children:Ie.jsx("div",{children:Ie.jsx(yD,{style:e,onClick:n=>{var r;n.preventDefault(),n.stopPropagation(),(r=t.onClick)==null||r.call(t,!0)}})})}),t.isFavorite&&Ie.jsx(oa.Tooltip,{placement:t.tooltipPosition||"top",title:"Remove from favorites",disableInteractive:!0,children:Ie.jsx("div",{children:Ie.jsx(bD,{style:e,onClick:n=>{var r;n.preventDefault(),n.stopPropagation(),(r=t.onClick)==null||r.call(t,!1)}})})})]})}function z4(){return Ie.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",fill:"currentColor",stroke:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",children:Ie.jsx("path",{d:"M21 18v2H3v-2h18zM6.596 3.903L8.01 5.318 4.828 8.5 8.01 11.68l-1.414 1.415L2 8.5l4.596-4.597zM21 11v2h-9v-2h9zm0-7v2h-9V4h9z"})})}function Y4(){return Ie.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",fill:"currentColor",stroke:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",children:Ie.jsx("path",{d:"M3 4h18v2H3V4zm0 7h18v2H3v-2zm0 7h18v2H3v-2z"})})}function G4(t){return Ie.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"20",fill:"none",viewBox:"0 0 18 20",...t,children:Ie.jsx("path",{fill:"#E01B00",fillRule:"evenodd",d:"M.179 2.875A2.375 2.375 0 012.554.5h3.393a1.018 1.018 0 010 2.036H2.554a.34.34 0 00-.34.339v14.25c0 .187.152.34.34.34h3.393a1.018 1.018 0 110 2.035H2.554a2.375 2.375 0 01-2.375-2.375V2.875zm14.167 6.107h-7.72a1.018 1.018 0 000 2.036h7.72l-2.673 2.673a1.018 1.018 0 101.44 1.44l4.41-4.411a1.018 1.018 0 000-1.44l-4.41-4.41a1.018 1.018 0 10-1.44 1.439l2.673 2.673z",clipRule:"evenodd"})})}const q4=".flex-col-center{display:flex;flex-direction:column;justify-content:center}.wrap-section{padding:0 8px;transition:all .3s}.wrap-section.collapsed{padding:0 4px}.side-bar{position:fixed;top:64px;left:0;height:calc(100vh - 64px);max-width:18rem;display:flex;flex-direction:column;border-right:1px solid #ddd;background-color:#fafafa;transition:all .3s}.side-bar.expanded{width:17rem}.side-bar.collapsed{width:64px}.side-bar__wrap-btn-logout,.side-bar__btn-logout{margin:5px 0}.side-bar__logout-btn__text{margin-left:12px;font-size:.875rem;opacity:1}.side-bar__logout-btn__text.collapsed{opacity:0;transition:ease-in-out .2s;transition-delay:.15s}.side-bar__wrapper-toggle-btn{display:flex;flex-direction:row;justify-content:flex-end;transition:all .3s;margin-right:-8px;margin-top:40px}.side-bar__wrapper-toggle-btn.collapsed{justify-content:center;width:100%}.side-bar__toggle-btn{margin-top:-6px;color:#85858a}.side-bar__logout-btn{width:100%;text-align:left;display:flex;flex-direction:row;align-items:center;padding:8px 16px 8px 18.6665px;min-height:48px;border-radius:.375rem;overflow:hidden;transition:all .3s ease-in-out;background-color:initial}.side-bar__logout-btn:hover{background-color:#919eab14}.side-bar__icon-logout{flex-shrink:0}.menu-item__wrapper{display:flex;flex-direction:column;position:relative;width:100%;color:#292929}.menu-item__wrapper.collapsed.active,.menu-item__wrapper.expanded.active.parent.isClose,.menu-item__wrapper.expanded.active.child{color:var(--primary400);background-color:var(--primary200)}.menu-item__link{display:flex;flex-direction:row;border-radius:.375rem;align-items:center;padding:.5rem;position:relative;height:48px;cursor:pointer}.menu-item__link.expanded.level-0{padding:.5rem 10px}.menu-item__link:hover{background-color:#919eab14}.menu-item__link.collapsed.level-0{padding-left:calc(.5rem + 7.665px)!important}.menu-item__link.active{background-color:#009d4f1a;color:inherit}.menu-item__link.active.level-0,.menu-item__link.active.level-1,.menu-item__link.active.level-2,.menu-item__link.active.level-3,.menu-item__link.active.level-4,.menu-item__link.active.level-5,.menu-item__link.active.level-6,.menu-item__link.active.level-7,.menu-item__link.active.level-8,.menu-item__link.active.level-9{background-color:inherit;color:inherit}.menu-item__link.active.level-1:hover,.menu-item__link.active.level-2:hover,.menu-item__link.active.level-3:hover,.menu-item__link.active.level-4:hover,.menu-item__link.active.level-5:hover,.menu-item__link.active.level-6:hover,.menu-item__link.active.level-7:hover,.menu-item__link.active.level-8:hover,.menu-item__link.active.level-9:hover,.menu-item__link.active.level-0:hover{background-color:#919eab14}.menu-item__link.level-0{transition:padding .2s}.menu-item__link.menu-item__link.collapsed.level-0{padding:0}.menu-item__icon{width:1.5rem;height:1.5rem;flex-shrink:0;display:grid;place-items:center;color:#85858a}.menu-item__icon.collapsed.active,.menu-item__icon.expanded.active.parent.isClose,.menu-item__icon.expanded.active.child{color:inherit}.menu-item__icon.collapsed.level-0>*{margin:0 auto}.menu-item__label{font-size:.875rem;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;width:100%;flex-shrink:1;margin-left:12px;padding-right:12px;opacity:1}.menu-item__label.level-0.collapsed{text-overflow:unset}.menu-item__label.active{color:inherit}.menu-item__label.collapsed{margin-left:8px;font-size:.75rem;line-height:1rem}.menu-item__label.collapsed.level-0{font-size:.875rem;opacity:0;transition-delay:.15s}.menu-item__label.level-0{margin-left:8px;font-weight:500;font-size:.951rem}.menu-item__icon-arrow__wrapper{display:grid;place-items:center;position:absolute;top:50%;transform:translateY(-50%);right:0}.menu-item__icon-arrow__wrapper.expanded{right:4px}.menu-item__icon-arrow__icon{transition:transform .3s!important;transform:rotate(-90deg)!important}.menu-item__icon-arrow__icon.active{color:inherit}.menu-item__icon-arrow__icon.expanded.open{transform:rotate(0)!important}.menu-item__dropdown.collapsed{background-color:#fafafa;border:1px solid #ddd;box-shadow:#0000001a 0 10px 15px -3px,#0000000d 0 4px 6px -2px;border-radius:4px;width:210px;max-width:210px;padding:4px;z-index:1200}.menu-item__dropdown::-webkit-scrollbar{width:4px}.menu-item__dropdown::-webkit-scrollbar-thumb{background-color:#9b9b9b99;border-radius:2px}.menu-item__dropdown,.menu-item__dropdown>*{margin-top:4px}.menu-item__dropdown.expanded.menu-item__dropdown--close{margin-top:0;transition:margin-top .3s}.menu-item__dropdown:first-of-type{margin-top:0}.menu-item__dropdown>*:first-child{margin-top:0}.menu-item__dropdown.collapsed .menu-item__link{height:40px}.menu-item__dropdown.collapsed .menu-item__link.level-0{height:48px}.menu-item__dropdown.collapsed.level-0{width:auto;max-width:unset;box-shadow:none;border:none;padding:0;background-color:unset}.menu-item__dropdown.expanded{overflow:hidden}.icon-btn{display:inline-flex;align-items:center;justify-content:center;padding:8px;border-radius:50%;background-color:transparent;transition:background-color .3s ease;border:none}.icon-btn:hover{background-color:var(--btn-bg-hover)}.simplebar-scrollbar:before{background-color:#0000002d}.side-bar__menu.collapsed .simplebar-track.simplebar-vertical{display:none}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}",X4=t=>{const e=t.isCollapsed?0:t.depth*16;return Ie.jsx("div",{style:{backgroundColor:t.color||"#93D500",height:"2px",position:"absolute",right:"0",top:"0",left:e}})},K4=".app,.treeRoot{height:100%}.draggingSource{opacity:.3}.placeholderContainer{position:relative}.dropTarget{background-color:#8d878711}",Z4=t=>{const[e,n]=q.useState(()=>{const r=localStorage.getItem("openingMenuIds");return r&&r!=="[]"?JSON.parse(r):(t==null?void 0:t.initOpenIds)||[]});return q.useEffect(()=>{localStorage.setItem("openingMenuIds",JSON.stringify(e))},[e]),[e,n]};function MD(t){document.documentElement.style.setProperty("--global-menu-width",!t||t==="true"?"64px":"17rem")}const zh=localStorage.getItem("isCollapsed");MD(zh);function J4(t){const e=new CustomEvent("favoriteMenusChange",{detail:{favoriteMenus:t}});window.dispatchEvent(e)}function Q4(t){const e=bp.useLocation(),[n,r]=q.useState([]),i=n.map(Me=>Me.data),[o,a]=q.useState(!1),[c,f]=q.useState([]),[p,w]=q.useState(zh===null?!0:zh==="true"),[g,T]=q.useState(window.location.href),E=q.useRef(null);q.useEffect(()=>{var Me;(Me=t.handleCallback)==null||Me.call(t,i)},[i,t.handleCallback]),q.useEffect(()=>{T(window.location.href)},[e]);const A=t6(i,g),[I,j]=Z4({initOpenIds:t.initOpenIds}),_=()=>{var Me,Fe;if(w(!p),localStorage.setItem("isCollapsed",JSON.stringify(!p)),MD(p),p)I&&((Me=E.current)==null||Me.open(I));else{const Ve=n.filter(Ue=>Ue.parent===0).map(Ue=>Ue.id);console.log("closeIds:",Ve),(Fe=E.current)==null||Fe.close(Ve)}},[H,W]=q.useState(!1),re=p?"collapsed":"expanded",Z=Me=>`${Me} ${re}`,de=q.useRef(null);q.useLayoutEffect(()=>{(async()=>{var Fe,Ve;try{const Ue=t.menuPath||"/global-menu-config/api/v1/menu-items/user",he=t.baseUrl+Ue,{data:ke}=await Rs.get(he);let Oe=ke.map(tt=>({...tt,parentKey:tt.parentKey||0}));Oe=FD(Oe),t.replacePath&&(Oe=LD(Oe,t.replacePath));const Ne=Oe.map(tt=>({id:tt.id,parent:tt.parentKey,text:tt.name,data:tt}));r(Ne)}catch(Ue){console.error("Global menu",Ue),Hd(((Ve=(Fe=Ue.response)==null?void 0:Fe.data)==null?void 0:Ve.errorMessage)||"Have error when get menu items")}})()},[t.baseUrl,t.menuPath,t.replacePath]);const S=async()=>{try{const Me=await fetch(`${t.baseUrl}/global-menu-config/api/v1/menu-items/user/get-favorites`);if(!Me.ok)throw new Error("Failed to fetch favorite items");const Fe=await Me.json();f(Fe)}catch(Me){console.error("Error fetching favorite items:",Me)}};q.useEffect(()=>{S()},[t.baseUrl]),q.useEffect(()=>{let Me=[];c.forEach(Ue=>{const he=i.find(ke=>ke.id===Ue&&ke.isFavorite===!0);he&&(Me=[...Me,he])}),console.log(Me);function Fe(Ue){return i.every(he=>he.parentKey!==Ue.id)?Ue:{...Ue,children:i.filter(he=>he.parentKey===Ue.id).map(he=>Fe(he))}}const Ve=Me.map(Ue=>Fe(Ue));J4(Ve)},[i]);function le(Me){const Fe=Me.detail.menuItem;r(Ve=>Ve.map(Ue=>Ue.id!==Fe.id?Ue:{...Ue,data:Fe}))}q.useEffect(()=>(window.addEventListener("updateFavoriteMenu",le),()=>{window.removeEventListener("updateFavoriteMenu",le)}),[]),q.useLayoutEffect(()=>{var Ue;const Me=localStorage.getItem("scrollPos");Me&&de.current&&setTimeout(()=>{const he=de.current.getScrollElement();he.scrollTop=parseInt(Me)},0);const Fe=()=>{if(de.current){const he=de.current.getScrollElement();localStorage.setItem("scrollPos",he.scrollTop.toString())}},Ve=(Ue=de.current)==null?void 0:Ue.getScrollElement();return Ve==null||Ve.addEventListener("scroll",Fe),()=>{Ve==null||Ve.removeEventListener("scroll",Fe)}},[i]);function ue(Me){a(!0);const Fe=[...n];r(Me);const Ve=Me.map((Ue,he)=>({menuItemId:Ue.id,order:he}));Rs.post("/global-menu-config/api/v1/menu-items/user",Ve,{baseURL:t.baseUrl}).then(()=>{}).catch(Ue=>{console.error(Ue),r(Fe)}).finally(()=>{a(!1)})}const ze=q.useMemo(()=>zh==="false"?I:[],[]);return console.log("nodesglobal menu",n),Ie.jsxs("div",{className:Z("side-bar"),children:[Ie.jsx("div",{className:Z("wrap-section side-bar__wrapper-toggle-btn"),children:Ie.jsx("button",{className:"icon-btn side-bar__toggle-btn",onClick:_,children:p?Ie.jsx(Y4,{}):Ie.jsx(z4,{})})}),Ie.jsx(Nv,{ref:de,className:Z("wrap-section side-bar__menu"),style:{marginTop:24,flex:1,overflow:"auto",height:"100%",overflowX:"hidden"},children:Ie.jsx(PE,{backend:jE,options:zE(),children:Ie.jsx(XE,{ref:E,classes:{root:"treeRoot",draggingSource:"draggingSource",placeholder:"placeholderContainer"},tree:n,rootId:0,sort:!1,insertDroppableFirst:!1,enableAnimateExpand:!0,dropTargetOffset:10,onDrop:ue,render:(Me,Fe)=>{function Ve(Oe){return n.every(Ne=>Ne.parent!==Oe.id)?Oe:{...Oe,children:n.filter(Ne=>Ne.parent===Oe.id).map(Ne=>Ve(Ne.data))}}const Ue=Ve(Me.data),he=Oe=>A.some(Ne=>Ne.id===Oe);function ke(Oe,Ne){r(tt=>tt.map(me=>me.id===Oe?{...me,data:{...me.data,isFavorite:Ne}}:me)),S()}return Ie.jsx(ID,{isActive:he,isCollapsed:p,replacePath:t.replacePath,ssr:t.ssr,brandColors:t.brandColors,baseUrl:t.baseUrl,node:Me,params:Fe,nodes:n,item:Ue,expanded:()=>!1,toggleExpand:Oe=>{var Ne;if(Oe.stopPropagation(),Fe.isOpen)console.log("open toggleExpand"),Fe.onToggle();else{console.log("close toggleExpand");const tt=n.filter(me=>me.parent===Me.parent&&me.id!==Me.id).map(me=>me.id);console.log(" closeIds:",tt),(Ne=E.current)==null||Ne.open(Me.id),setTimeout(()=>{var me;(me=E.current)==null||me.close(tt)},0)}},level:Fe.depth,onSetFavoriteSuccess:ke})},placeholderRender:(Me,{depth:Fe})=>{var Ve;return Ie.jsx(X4,{node:Me,depth:Fe,color:(Ve=t.brandColors)==null?void 0:Ve.primary300,isCollapsed:p})},canDrag:()=>!o,canDrop:(Me,{dragSource:Fe,dropTargetId:Ve})=>(Fe==null?void 0:Fe.parent)===Ve,onDragStart:Me=>{console.log("onDragStart",Me)},onChangeOpen:Me=>{localStorage.getItem("isCollapsed")==="false"&&(console.log("onChangeOpen:",Me),j(Me))},initialOpen:ze})})}),Ie.jsxs("div",{className:Z("wrap-section side-bar__wrap-btn-logout"),children:[Ie.jsxs("button",{className:Z("side-bar__logout-btn"),onClick:()=>W(!0),children:[Ie.jsx(G4,{className:Z("side-bar__icon-logout")}),Ie.jsx("span",{className:Z("side-bar__logout-btn__text"),children:"Logout"})]}),Ie.jsx(L1,{isOpen:H,onClose:()=>W(!1),onConfirm:()=>t.logout?t.logout():z1(t.baseUrl)})]})]})}function e6(t,e){const n=new URL(t).searchParams,r=new URL(e).searchParams;return Array.from(r).filter(([i,o])=>o===n.get(i)).length}function t6(t,e){var f;console.log("menuItems:",t);const n=new URL(e);let r=t.filter(p=>p.path&&p.path.includes("http")).map(p=>({item:p,itemUrl:new URL(p.path),matchingParamsCount:e6(e,p.path)})).sort((p,w)=>{const g=new URL(p.itemUrl).searchParams,T=new URL(w.itemUrl).searchParams;return Array.from(g).length-Array.from(T).length}).filter(({itemUrl:p})=>n.origin===p.origin);const i=r.filter(({itemUrl:p})=>n.pathname===p.pathname),o=r.filter(({itemUrl:p})=>n.pathname.includes(p.pathname));r=i.length>0?i:o,r=r.sort((p,w)=>w.matchingParamsCount-p.matchingParamsCount);let a=r.length>0?(f=r.find(p=>p.item.parentKey))==null?void 0:f.item:null;console.log("matchingItems:",r);let c=[];for(;a;)c=[a,...c],a=t.find(p=>p.id===(a==null?void 0:a.parentKey))||null;return console.log("parents:",c),c}function LD(t,e){return t.map(n=>{var r;return(r=n.children)!=null&&r.length?(n.path="",n.children=LD(n.children,e)):n.path=e(n.path),n})}function FD(t){return t.map(n=>n.path&&!n.path.includes("http")&&n.path.includes("/")?{...n,path:window.location.origin+n.path}:(n.children&&(n.children=FD(n.children)),n))}function n6(t){return Ie.jsx(AD.div,{children:Ie.jsx(Mv,{styles:[DT,q4,K4],style:{position:"sticky",zIndex:1300},children:Ie.jsx(Q4,{...t})})})}const r6={"page-container":"_page-container_1pwo1_1","page-main-content":"_page-main-content_1pwo1_8","page-title":"_page-title_1pwo1_19","text-base":"_text-base_1pwo1_26","mt-4":"_mt-4_1pwo1_33"};var mp={exports:{}};/**
136
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)},R4=function(t,e){return D4(t)||P4(t,e)||O4(t,e)||_4()},PD=DD(function(t){function e(){return t.exports=e=Object.assign||function(n){for(var r=1;r<arguments.length;r++){var i=arguments[r];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])}return n},e.apply(this,arguments)}t.exports=e}),A4=function(t,e){if(t==null)return{};var n,r,i={},o=Object.keys(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||(i[n]=t[n]);return i},OD=function(t,e){if(t==null)return{};var n,r,i=A4(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i},I4=q.createContext(null);function _D(t){var e=t.children,n=e===void 0?"":e,r=OD(t,["children"]);return typeof n!="string"&&(n=C4(n)),q.createElement("template",PD({},r,{dangerouslySetInnerHTML:{__html:n}}))}function RD(t){var e=t.root,n=t.children;return Ov.createPortal(n===void 0?null:n,e)}function M4(t){var e=q.forwardRef(function(n,r){var i,o,a=n.mode,c=a===void 0?"open":a,f=n.delegatesFocus,p=f!==void 0&&f,w=n.styleSheets,g=w===void 0?[]:w,T=n.ssr,E=T!==void 0&&T,A=n.children,I=OD(n,["mode","delegatesFocus","styleSheets","ssr","children"]),j=(o=q.useRef((i=r)&&i.current),q.useEffect(function(){i&&(i.current=o.current)},[i]),o),_=q.useState(null),H=R4(_,2),W=H[0],re=H[1],Z="node_".concat(c).concat(p);return q.useLayoutEffect(function(){if(j.current)try{if(typeof r=="function"&&r(j.current),E){var de=j.current.shadowRoot;return void re(de)}var S=j.current.attachShadow({mode:c,delegatesFocus:p});g.length>0&&(S.adoptedStyleSheets=g),re(S)}catch(le){(function(ue){var ze=ue.error,Me=ue.styleSheets,Fe=ue.root;switch(ze.name){case"NotSupportedError":Me.length>0&&(Fe.adoptedStyleSheets=Me);break;default:throw ze}})({error:le,styleSheets:g,root:W})}},[r,j,g]),q.createElement(q.Fragment,null,q.createElement(t.tag,PD({key:Z,ref:j},I),(W||E)&&q.createElement(I4.Provider,{value:W},E?q.createElement(_D,{shadowroot:c,shadowrootmode:c},t.render({root:W,ssr:E,children:A})):q.createElement(RD,{root:W},t.render({root:W,ssr:E,children:A})))))});return e.propTypes={mode:_s.oneOf(["open","closed"]),delegatesFocus:_s.bool,styleSheets:_s.arrayOf(_s.instanceOf(globalThis.CSSStyleSheet)),ssr:_s.bool,children:_s.node},e}_D.propTypes={children:_s.oneOfType([_s.string,_s.node])},RD.propTypes={root:_s.object.isRequired,children:_s.node};var hm=new Map;function L4(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"core",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(r){return r.children};return new Proxy(t,{get:function(r,i){var o=k4(i,{separator:"-"}),a="".concat(e,"-").concat(o);return hm.has(a)||hm.set(a,M4({tag:o,render:n})),hm.get(a)}})}var AD=L4();const F4=".app,.treeRoot{height:100%}.draggingSource{opacity:.3}.placeholderContainer{position:relative}.dropTarget{background-color:#8d878711}",N4=".favorite-bar{position:sticky;top:64px;z-index:900;transition:transform .3s ease,opacity .3s ease;border-bottom:1px solid #ddd}.favorite-bar--hidden{transform:translateY(-100%);opacity:0}.favorite-bar--visible{transform:translateY(0);opacity:1}",j4=t=>{const e=t.depth*16;return Ie.jsx("div",{style:{backgroundColor:t.color||"#93D500",height:"2px",position:"absolute",right:"0",top:"0",left:e}})};function B4(t){const e=new CustomEvent("updateFavoriteMenu",{detail:{menuItem:t}});window.dispatchEvent(e)}function $4(t){const e=bp.useLocation(),n=q.useRef(null),[r,i]=q.useState([]),[o,a]=q.useState(!1);console.log("isSubmit",o);const[c,f]=q.useState([]),p=q.useRef(null),[w,g]=q.useState(window.location.href);q.useEffect(()=>{g(window.location.href)},[e]);const T=_=>`${_}`;function E(_,H){for(const W of _){if(W.id===H)return W;if(W.children){const re=E(W.children,H);if(re)return re}}return null}function A(_,H){const W=E(r,_);W?(W.isFavorite=H,B4(W),Xy(_,H)):console.error(`Item with id ${_} not found`)}const I=_=>{console.log("Favorite menus changed",_);const H=_.detail.favoriteMenus||[];i(H)};q.useEffect(()=>(window.addEventListener("favoriteMenusChange",I),()=>{window.removeEventListener("favoriteMenusChange",I)}),[]);function j(_){a(!0);const H=[...c];f(_),console.log("tree",_),console.log("prev",H);const W={menuItemIds:_.map(re=>re.id)};console.log(W),Rs.post("global-menu-config/api/v1/menu-items/user/order-favorites",W,{baseURL:t.baseUrl}).then(()=>{}).catch(re=>{console.error(re),f(H)}).finally(()=>{a(!1)})}return q.useEffect(()=>{const _=r.map(H=>({id:H.id,parent:0,text:H.name,data:H}));f(_),console.log("nodes",_)},[r]),Ie.jsx(Ie.Fragment,{children:r.length?Ie.jsx("div",{className:T("favorite-menu"),children:Ie.jsx(Nv,{ref:p,className:T("wrap-section favorite-menu__menu"),style:{marginTop:4,flex:1,overflow:"auto",height:"100%",overflowY:"hidden"},children:Ie.jsx(PE,{backend:jE,options:zE(),children:Ie.jsx(XE,{ref:n,classes:{root:"treeFavorited"},tree:c,rootId:0,sort:!1,insertDroppableFirst:!1,enableAnimateExpand:!0,dropTargetOffset:10,onDrop:j,render:(_,H)=>{console.log("1111111111111");const W=_.data;return console.log("item favorite",W),console.log("params",H),Ie.jsx(kD,{replacePath:t.replacePath,ssr:t.ssr,brandColors:t.brandColors,baseUrl:t.baseUrl,node:_,params:H,nodes:c,item:W,level:H.depth+1,onSetFavoriteSuccess:A})},placeholderRender:(_,{depth:H})=>{var W;return console.log("aaaa"),Ie.jsx(j4,{node:_,depth:H,color:(W=t.brandColors)==null?void 0:W.primary300})},canDrag:()=>!o,canDrop:(_,{dragSource:H,dropTargetId:W})=>(H==null?void 0:H.parent)===W,onDragStart:_=>{console.log("onDragStart",_)}})})})}):""})}function V4(t=32){const[e,n]=q.useState(!0),[r,i]=q.useState(0),o=()=>{const a=window.scrollY;a>r&&a>t?n(!1):a<r&&n(!0),i(a)};return q.useEffect(()=>(window.addEventListener("scroll",o),()=>window.removeEventListener("scroll",o)),[r]),{isFavoriteBarVisible:e}}function H4(t){const{isFavoriteBarVisible:e}=V4();return Ie.jsxs(Ie.Fragment,{children:[Ie.jsx("style",{children:N4}),Ie.jsx("div",{className:`favorite-bar ${e?"favorite-bar--visible":"favorite-bar--hidden"}`,children:Ie.jsx(AD.div,{children:Ie.jsx(Mv,{styles:[DT,b4,F4],children:Ie.jsx($4,{...t})})})})]})}function Xy(t,e){const n=JSON.parse(localStorage.getItem("favoriteItems")||"[]");if(e)n.includes(t)||n.push(t);else{const r=n.indexOf(t);r>-1&&n.splice(r,1)}localStorage.setItem("favoriteItems",JSON.stringify(n))}function ID({...t}){var me,Ee,Ye;const e=t.item,n=t.level||0,r=!!((me=t.item.children)!=null&&me.length),{isActive:i,isCollapsed:o}=t,a=`level-${n}`,c=o?"collapsed":"expanded",f=i(e.id)?"active":"",p=r?"parent":"child",w=t.params.isOpen?"isOpen":"isClose",g=(We,Je=a)=>`${We} ${Je} ${c} ${f} ${p} ${w}`,[T,E]=q.useState(!1),[A,I]=q.useState(e.isFavorite||!1);q.useEffect(()=>{I(!!t.item.isFavorite)},[t.item.isFavorite]);const j=q.useRef(),_=q.useRef();_!=null&&_.current&&((Ee=_==null?void 0:_.current)==null?void 0:Ee.scrollWidth)>((Ye=_==null?void 0:_.current)==null?void 0:Ye.clientWidth);const H=window.location.origin,W=e.path&&e.path.includes("http")?new URL(e.path):{origin:"",pathname:""},re=window.location.pathname.split("/")[1],Z=W.pathname.split("/")[1],de=t.item.redirectUrl||t.ssr||!H.includes("local")&&H!==W.origin||Z!==re,S=r?"div":de?"a":bp.Link,le=e.redirectUrl||e.path||"#",ue=n+1,ze=r&&o&&T,Me=o||n===0?void 0:`${n+.25}rem`,Fe=()=>{E(!0)},Ve=()=>{E(!1)},Ue="/global-menu-config/api/v1/menu-items/user/set-favorite",he=e.serviceKey==="mn_poms";t.params.depth*20,t.params.depth,vH(e.id,t.params.isOpen,t.params.onToggle);const Oe=he||o&&n===0?e.name==="POMs"?"Parking Operations Management":e.description||e.name:null,Ne=Object.entries(t.brandColors||{}).reduce((We,[Je,Ze])=>(Ze&&(We[`--${Je}`]=Ze),We),{}),tt=H!==W.origin||t.item.redirectUrl?"_blank":"_self";return Ie.jsxs("div",{ref:j,className:g("menu-item__wrapper tree-node"),style:{borderRadius:"8px",transition:"all 0.3s",...Ne},onMouseOver:Fe,onMouseOut:Ve,onDragStart:We=>{o&&n>1&&We.preventDefault()},children:[Ie.jsx(oa.Tooltip,{placement:"top",title:Oe,disableInteractive:!0,children:Ie.jsxs(S,{target:tt,to:le,href:le,draggable:"true",className:g("menu-item__link"),style:{paddingLeft:Me},onClick:We=>{S==="a"&&tt==="_blank"||o||t.toggleExpand(We)},children:[Ie.jsx(U4,{cls:g,item:e}),Ie.jsx("span",{className:g("menu-item__label"),ref:_,children:e.name}),Ie.jsx(W4,{tooltipPosition:Oe?"right":"top",menuLevel:n,hasChildren:r,isHovered:T,isFavorite:A,onClick:We=>{const Je={menuConfigId:e.id,isFavorite:We},Ze=t.baseUrl+Ue;Rs.post(Ze,Je).then(Qe=>{var it;I(We),Bv("Set favorite menu item successfully"),(it=t.onSetFavoriteSuccess)==null||it.call(t,t.item.id,We),Xy(t.item.id,We)}).catch(Qe=>{var it,ht;Hd(((ht=(it=Qe.response)==null?void 0:it.data)==null?void 0:ht.errorMessage)||"Have error when set favorite menu item")})}}),r&&Ie.jsx("div",{className:g("menu-item__icon-arrow__wrapper"),children:Ie.jsx(B5,{className:g(`menu-item__icon-arrow__icon ${t.params.isOpen?"open":"close"}`)})})]})}),ze&&Ie.jsx($5,{parentRef:j,onlyChild:!o,renderChildren:({maxHeight:We})=>{var Je;return Ie.jsx(vD.div,{className:g(`menu-item__dropdown ${t.params.isOpen?"menu-item__dropdown--open":"menu-item__dropdown--close"}`,`level-${ue}`),style:Gy({maxHeight:We,overflowY:"auto",paddingRight:3},We!=="auto"&&!!ue),children:(Je=e.children)==null?void 0:Je.map(Ze=>q.createElement(ID,{...t,key:Ze.id,item:Ze,level:ue}))})}})]})}function U4({item:t,cls:e}){return Ie.jsx("div",{className:e("menu-item__icon"),children:Ie.jsx(ED,{item:t})})}function W4(t){const e={marginRight:t.hasChildren?10:0,fontSize:18,fill:ki.warning};return Ie.jsxs(Ie.Fragment,{children:[t.isHovered&&!t.isFavorite&&Ie.jsx(oa.Tooltip,{placement:t.tooltipPosition||"top",title:"Add to favorites",disableInteractive:!0,children:Ie.jsx("div",{children:Ie.jsx(yD,{style:e,onClick:n=>{var r;n.preventDefault(),n.stopPropagation(),(r=t.onClick)==null||r.call(t,!0)}})})}),t.isFavorite&&Ie.jsx(oa.Tooltip,{placement:t.tooltipPosition||"top",title:"Remove from favorites",disableInteractive:!0,children:Ie.jsx("div",{children:Ie.jsx(bD,{style:e,onClick:n=>{var r;n.preventDefault(),n.stopPropagation(),(r=t.onClick)==null||r.call(t,!1)}})})})]})}function z4(){return Ie.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",fill:"currentColor",stroke:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",children:Ie.jsx("path",{d:"M21 18v2H3v-2h18zM6.596 3.903L8.01 5.318 4.828 8.5 8.01 11.68l-1.414 1.415L2 8.5l4.596-4.597zM21 11v2h-9v-2h9zm0-7v2h-9V4h9z"})})}function Y4(){return Ie.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",fill:"currentColor",stroke:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",children:Ie.jsx("path",{d:"M3 4h18v2H3V4zm0 7h18v2H3v-2zm0 7h18v2H3v-2z"})})}function G4(t){return Ie.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"20",fill:"none",viewBox:"0 0 18 20",...t,children:Ie.jsx("path",{fill:"#E01B00",fillRule:"evenodd",d:"M.179 2.875A2.375 2.375 0 012.554.5h3.393a1.018 1.018 0 010 2.036H2.554a.34.34 0 00-.34.339v14.25c0 .187.152.34.34.34h3.393a1.018 1.018 0 110 2.035H2.554a2.375 2.375 0 01-2.375-2.375V2.875zm14.167 6.107h-7.72a1.018 1.018 0 000 2.036h7.72l-2.673 2.673a1.018 1.018 0 101.44 1.44l4.41-4.411a1.018 1.018 0 000-1.44l-4.41-4.41a1.018 1.018 0 10-1.44 1.439l2.673 2.673z",clipRule:"evenodd"})})}const q4=".flex-col-center{display:flex;flex-direction:column;justify-content:center}.wrap-section{padding:0 8px;transition:all .3s}.wrap-section.collapsed{padding:0 4px}.side-bar{position:fixed;top:64px;left:0;height:calc(100vh - 64px);max-width:18rem;display:flex;flex-direction:column;border-right:1px solid #ddd;background-color:#fafafa;transition:all .3s}.side-bar.expanded{width:17rem}.side-bar.collapsed{width:64px}.side-bar__wrap-btn-logout,.side-bar__btn-logout{margin:5px 0}.side-bar__logout-btn__text{margin-left:12px;font-size:.875rem;opacity:1}.side-bar__logout-btn__text.collapsed{opacity:0;transition:ease-in-out .2s;transition-delay:.15s}.side-bar__wrapper-toggle-btn{display:flex;flex-direction:row;justify-content:flex-end;transition:all .3s;margin-right:-8px;margin-top:40px}.side-bar__wrapper-toggle-btn.collapsed{justify-content:center;width:100%}.side-bar__toggle-btn{margin-top:-6px;color:#85858a}.side-bar__logout-btn{width:100%;text-align:left;display:flex;flex-direction:row;align-items:center;padding:8px 16px 8px 18.6665px;min-height:48px;border-radius:.375rem;overflow:hidden;transition:all .3s ease-in-out;background-color:initial}.side-bar__logout-btn:hover{background-color:#919eab14}.side-bar__icon-logout{flex-shrink:0}.menu-item__wrapper{display:flex;flex-direction:column;position:relative;width:100%;color:#292929}.menu-item__wrapper.collapsed.active,.menu-item__wrapper.expanded.active.parent.isClose,.menu-item__wrapper.expanded.active.child{color:var(--primary400);background-color:var(--primary200)}.menu-item__link{display:flex;flex-direction:row;border-radius:.375rem;align-items:center;padding:.5rem;position:relative;height:48px;cursor:pointer}.menu-item__link.expanded.level-0{padding:.5rem 10px}.menu-item__link:hover{background-color:#919eab14}.menu-item__link.collapsed.level-0{padding-left:calc(.5rem + 7.665px)!important}.menu-item__link.active{background-color:#009d4f1a;color:inherit}.menu-item__link.active.level-0,.menu-item__link.active.level-1,.menu-item__link.active.level-2,.menu-item__link.active.level-3,.menu-item__link.active.level-4,.menu-item__link.active.level-5,.menu-item__link.active.level-6,.menu-item__link.active.level-7,.menu-item__link.active.level-8,.menu-item__link.active.level-9{background-color:inherit;color:inherit}.menu-item__link.active.level-1:hover,.menu-item__link.active.level-2:hover,.menu-item__link.active.level-3:hover,.menu-item__link.active.level-4:hover,.menu-item__link.active.level-5:hover,.menu-item__link.active.level-6:hover,.menu-item__link.active.level-7:hover,.menu-item__link.active.level-8:hover,.menu-item__link.active.level-9:hover,.menu-item__link.active.level-0:hover{background-color:#919eab14}.menu-item__link.level-0{transition:padding .2s}.menu-item__link.menu-item__link.collapsed.level-0{padding:0}.menu-item__icon{width:1.5rem;height:1.5rem;flex-shrink:0;display:grid;place-items:center;color:#85858a}.menu-item__icon.collapsed.active,.menu-item__icon.expanded.active.parent.isClose,.menu-item__icon.expanded.active.child{color:inherit}.menu-item__icon.collapsed.level-0>*{margin:0 auto}.menu-item__label{font-size:.875rem;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;width:100%;flex-shrink:1;margin-left:12px;padding-right:12px;opacity:1}.menu-item__label.level-0.collapsed{text-overflow:unset}.menu-item__label.active{color:inherit}.menu-item__label.collapsed{margin-left:8px;font-size:.75rem;line-height:1rem}.menu-item__label.collapsed.level-0{font-size:.875rem;opacity:0;transition-delay:.15s}.menu-item__label.level-0{margin-left:8px;font-weight:500;font-size:.951rem}.menu-item__icon-arrow__wrapper{display:grid;place-items:center;position:absolute;top:50%;transform:translateY(-50%);right:0}.menu-item__icon-arrow__wrapper.expanded{right:4px}.menu-item__icon-arrow__icon{transition:transform .3s!important;transform:rotate(-90deg)!important}.menu-item__icon-arrow__icon.active{color:inherit}.menu-item__icon-arrow__icon.expanded.open{transform:rotate(0)!important}.menu-item__dropdown.collapsed{background-color:#fafafa;border:1px solid #ddd;box-shadow:#0000001a 0 10px 15px -3px,#0000000d 0 4px 6px -2px;border-radius:4px;width:210px;max-width:210px;padding:4px;z-index:1200}.menu-item__dropdown::-webkit-scrollbar{width:4px}.menu-item__dropdown::-webkit-scrollbar-thumb{background-color:#9b9b9b99;border-radius:2px}.menu-item__dropdown,.menu-item__dropdown>*{margin-top:4px}.menu-item__dropdown.expanded.menu-item__dropdown--close{margin-top:0;transition:margin-top .3s}.menu-item__dropdown:first-of-type{margin-top:0}.menu-item__dropdown>*:first-child{margin-top:0}.menu-item__dropdown.collapsed .menu-item__link{height:40px}.menu-item__dropdown.collapsed .menu-item__link.level-0{height:48px}.menu-item__dropdown.collapsed.level-0{width:auto;max-width:unset;box-shadow:none;border:none;padding:0;background-color:unset}.menu-item__dropdown.expanded{overflow:hidden}.icon-btn{display:inline-flex;align-items:center;justify-content:center;padding:8px;border-radius:50%;background-color:transparent;transition:background-color .3s ease;border:none}.icon-btn:hover{background-color:var(--btn-bg-hover)}.simplebar-scrollbar:before{background-color:#0000002d}.side-bar__menu.collapsed .simplebar-track.simplebar-vertical{display:none}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}",X4=t=>{const e=t.isCollapsed?0:t.depth*16;return Ie.jsx("div",{style:{backgroundColor:t.color||"#93D500",height:"2px",position:"absolute",right:"0",top:"0",left:e}})},K4=".app,.treeRoot{height:100%}.draggingSource{opacity:.3}.placeholderContainer{position:relative}.dropTarget{background-color:#8d878711}",Z4=t=>{const[e,n]=q.useState(()=>{const r=localStorage.getItem("openingMenuIds");return r&&r!=="[]"?JSON.parse(r):(t==null?void 0:t.initOpenIds)||[]});return q.useEffect(()=>{localStorage.setItem("openingMenuIds",JSON.stringify(e))},[e]),[e,n]};function MD(t){document.documentElement.style.setProperty("--global-menu-width",!t||t==="true"?"64px":"17rem")}const zh=localStorage.getItem("isCollapsed");MD(zh);function J4(t){const e=new CustomEvent("favoriteMenusChange",{detail:{favoriteMenus:t}});window.dispatchEvent(e)}function Q4(t){const e=bp.useLocation(),[n,r]=q.useState([]),i=n.map(Me=>Me.data),[o,a]=q.useState(!1),[c,f]=q.useState([]),[p,w]=q.useState(zh===null?!0:zh==="true"),[g,T]=q.useState(window.location.href),E=q.useRef(null);q.useEffect(()=>{var Me;(Me=t.handleCallback)==null||Me.call(t,i)},[i,t.handleCallback]),q.useEffect(()=>{T(window.location.href)},[e]);const A=t6(i,g),[I,j]=Z4({initOpenIds:t.initOpenIds}),_=()=>{var Me,Fe;if(w(!p),localStorage.setItem("isCollapsed",JSON.stringify(!p)),MD(p),p)I&&((Me=E.current)==null||Me.open(I));else{const Ve=n.filter(Ue=>Ue.parent===0).map(Ue=>Ue.id);console.log("closeIds:",Ve),(Fe=E.current)==null||Fe.close(Ve)}},[H,W]=q.useState(!1),re=p?"collapsed":"expanded",Z=Me=>`${Me} ${re}`,de=q.useRef(null);q.useLayoutEffect(()=>{(async()=>{var Fe,Ve;try{const Ue=t.menuPath||"/global-menu-config/api/v1/menu-items/user",he=t.baseUrl+Ue,{data:ke}=await Rs.get(he);let Oe=ke.map(tt=>({...tt,parentKey:tt.parentKey||0}));Oe=FD(Oe),t.replacePath&&(Oe=LD(Oe,t.replacePath));const Ne=Oe.map(tt=>({id:tt.id,parent:tt.parentKey,text:tt.name,data:tt}));r(Ne)}catch(Ue){console.error("Global menu",Ue),Hd(((Ve=(Fe=Ue.response)==null?void 0:Fe.data)==null?void 0:Ve.errorMessage)||"Have error when get menu items")}})()},[t.baseUrl,t.menuPath,t.replacePath]);const S=async()=>{try{const Me=await fetch(`${t.baseUrl}/global-menu-config/api/v1/menu-items/user/get-favorites`);if(!Me.ok)throw new Error("Failed to fetch favorite items");const Fe=await Me.json();f(Fe)}catch(Me){console.error("Error fetching favorite items:",Me)}};q.useEffect(()=>{S()},[t.baseUrl]),q.useEffect(()=>{let Me=[];c.forEach(Ue=>{const he=i.find(ke=>ke.id===Ue&&ke.isFavorite===!0);he&&(Me=[...Me,he])}),console.log(Me);function Fe(Ue){return i.every(he=>he.parentKey!==Ue.id)?Ue:{...Ue,children:i.filter(he=>he.parentKey===Ue.id).map(he=>Fe(he))}}const Ve=Me.map(Ue=>Fe(Ue));J4(Ve)},[i]);function le(Me){const Fe=Me.detail.menuItem;r(Ve=>Ve.map(Ue=>Ue.id!==Fe.id?Ue:{...Ue,data:Fe}))}q.useEffect(()=>(window.addEventListener("updateFavoriteMenu",le),()=>{window.removeEventListener("updateFavoriteMenu",le)}),[]),q.useLayoutEffect(()=>{var Ue;const Me=localStorage.getItem("scrollPos");Me&&de.current&&setTimeout(()=>{const he=de.current.getScrollElement();he.scrollTop=parseInt(Me)},0);const Fe=()=>{if(de.current){const he=de.current.getScrollElement();localStorage.setItem("scrollPos",he.scrollTop.toString())}},Ve=(Ue=de.current)==null?void 0:Ue.getScrollElement();return Ve==null||Ve.addEventListener("scroll",Fe),()=>{Ve==null||Ve.removeEventListener("scroll",Fe)}},[i]);function ue(Me){a(!0);const Fe=[...n];r(Me);const Ve=Me.map((Ue,he)=>({menuItemId:Ue.id,order:he}));Rs.post("/global-menu-config/api/v1/menu-items/user",Ve,{baseURL:t.baseUrl}).then(()=>{}).catch(Ue=>{console.error(Ue),r(Fe)}).finally(()=>{a(!1)})}const ze=q.useMemo(()=>zh==="false"?I:[],[]);return console.log("nodesglobal menu",n),Ie.jsxs("div",{className:Z("side-bar"),children:[Ie.jsx("div",{className:Z("wrap-section side-bar__wrapper-toggle-btn"),children:Ie.jsx("button",{className:"icon-btn side-bar__toggle-btn",onClick:_,children:p?Ie.jsx(Y4,{}):Ie.jsx(z4,{})})}),Ie.jsx(Nv,{ref:de,className:Z("wrap-section side-bar__menu"),style:{marginTop:24,flex:1,overflow:"auto",height:"100%",overflowX:"hidden"},children:Ie.jsx(PE,{backend:jE,options:zE(),children:Ie.jsx(XE,{ref:E,classes:{root:"treeRoot",draggingSource:"draggingSource",placeholder:"placeholderContainer"},tree:n,rootId:0,sort:!1,insertDroppableFirst:!1,enableAnimateExpand:!0,dropTargetOffset:10,onDrop:ue,render:(Me,Fe)=>{function Ve(Oe){return n.every(Ne=>Ne.parent!==Oe.id)?Oe:{...Oe,children:n.filter(Ne=>Ne.parent===Oe.id).map(Ne=>Ve(Ne.data))}}const Ue=Ve(Me.data),he=Oe=>A.some(Ne=>Ne.id===Oe);function ke(Oe,Ne){r(tt=>tt.map(me=>me.id===Oe?{...me,data:{...me.data,isFavorite:Ne}}:me)),S()}return Ie.jsx(ID,{isActive:he,isCollapsed:p,replacePath:t.replacePath,ssr:t.ssr,brandColors:t.brandColors,baseUrl:t.baseUrl,node:Me,params:Fe,nodes:n,item:Ue,expanded:()=>!1,toggleExpand:Oe=>{var Ne;if(Oe.stopPropagation(),Fe.isOpen)console.log("open toggleExpand"),Fe.onToggle();else{console.log("close toggleExpand");const tt=n.filter(me=>me.parent===Me.parent&&me.id!==Me.id).map(me=>me.id);console.log(" closeIds:",tt),(Ne=E.current)==null||Ne.open(Me.id),setTimeout(()=>{var me;(me=E.current)==null||me.close(tt)},0)}},level:Fe.depth,onSetFavoriteSuccess:ke})},placeholderRender:(Me,{depth:Fe})=>{var Ve;return Ie.jsx(X4,{node:Me,depth:Fe,color:(Ve=t.brandColors)==null?void 0:Ve.primary300,isCollapsed:p})},canDrag:()=>!o,canDrop:(Me,{dragSource:Fe,dropTargetId:Ve})=>(Fe==null?void 0:Fe.parent)===Ve,onDragStart:Me=>{console.log("onDragStart",Me)},onChangeOpen:Me=>{localStorage.getItem("isCollapsed")==="false"&&(console.log("onChangeOpen:",Me),j(Me))},initialOpen:ze})})}),Ie.jsxs("div",{className:Z("wrap-section side-bar__wrap-btn-logout"),children:[Ie.jsxs("button",{className:Z("side-bar__logout-btn"),onClick:()=>W(!0),children:[Ie.jsx(G4,{className:Z("side-bar__icon-logout")}),Ie.jsx("span",{className:Z("side-bar__logout-btn__text"),children:"Logout"})]}),Ie.jsx(L1,{isOpen:H,onClose:()=>W(!1),onConfirm:()=>t.logout?t.logout():z1(t.baseUrl)})]})]})}function e6(t,e){const n=new URL(t,window.location.origin),r=new URL(e,window.location.origin);return n.pathname===r.pathname&&n.search===r.search?3:n.pathname===r.pathname?2:r.pathname.startsWith(n.pathname)?1:0}function t6(t,e){const n=t.map(a=>({item:a,priority:a.path?e6(a.path,e):0})).filter(a=>a.priority>0),r=n.length>0?n.reduce((a,c)=>c.priority>a.priority?c:a).item:null,i=[];let o=r;for(;o;)i.unshift(o),o=t.find(a=>a.id===(o==null?void 0:o.parentKey))||null;return i}function LD(t,e){return t.map(n=>{var r;return(r=n.children)!=null&&r.length?(n.path="",n.children=LD(n.children,e)):n.path=e(n.path),n})}function FD(t){return t.map(n=>n.path&&!n.path.includes("http")&&n.path.includes("/")?{...n,path:window.location.origin+n.path}:(n.children&&(n.children=FD(n.children)),n))}function n6(t){return Ie.jsx(AD.div,{children:Ie.jsx(Mv,{styles:[DT,q4,K4],style:{position:"sticky",zIndex:1300},children:Ie.jsx(Q4,{...t})})})}const r6={"page-container":"_page-container_1pwo1_1","page-main-content":"_page-main-content_1pwo1_8","page-title":"_page-title_1pwo1_19","text-base":"_text-base_1pwo1_26","mt-4":"_mt-4_1pwo1_33"};var mp={exports:{}};/**
137
137
  * @license
138
138
  * Lodash <https://lodash.com/>
139
139
  * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
@@ -29662,7 +29662,7 @@ function VD({ ...t }) {
29662
29662
  }, [t.item.isFavorite]);
29663
29663
  const B = un(), _ = un();
29664
29664
  _ != null && _.current && ((Ce = _ == null ? void 0 : _.current) == null ? void 0 : Ce.scrollWidth) > ((ze = _ == null ? void 0 : _.current) == null ? void 0 : ze.clientWidth);
29665
- const H = window.location.origin, W = e.path && e.path.includes("http") ? new URL(e.path) : { origin: "", pathname: "" }, ne = window.location.pathname.split("/")[1], K = W.pathname.split("/")[1], fe = t.item.redirectUrl || t.ssr || !H.includes("local") && H !== W.origin || K !== ne, S = r ? "div" : fe ? "a" : z1, ae = e.path || "#", le = n + 1, We = r && o && T, Re = o || n === 0 ? void 0 : `${n + 0.25}rem`, Me = () => {
29665
+ const H = window.location.origin, W = e.path && e.path.includes("http") ? new URL(e.path) : { origin: "", pathname: "" }, ne = window.location.pathname.split("/")[1], K = W.pathname.split("/")[1], fe = t.item.redirectUrl || t.ssr || !H.includes("local") && H !== W.origin || K !== ne, S = r ? "div" : fe ? "a" : z1, ae = e.redirectUrl || e.path || "#", le = n + 1, We = r && o && T, Re = o || n === 0 ? void 0 : `${n + 0.25}rem`, Me = () => {
29666
29666
  E(!0);
29667
29667
  }, $e = () => {
29668
29668
  E(!1);
@@ -30196,37 +30196,20 @@ function a6(t) {
30196
30196
  ] });
30197
30197
  }
30198
30198
  function l6(t, e) {
30199
- const n = new URL(t).searchParams, r = new URL(e).searchParams;
30200
- return Array.from(r).filter(
30201
- ([i, o]) => o === n.get(i)
30202
- ).length;
30199
+ const n = new URL(t, window.location.origin), r = new URL(e, window.location.origin);
30200
+ return n.pathname === r.pathname && n.search === r.search ? 3 : n.pathname === r.pathname ? 2 : r.pathname.startsWith(n.pathname) ? 1 : 0;
30203
30201
  }
30204
30202
  function u6(t, e) {
30205
- var f;
30206
- console.log("menuItems:", t);
30207
- const n = new URL(e);
30208
- let r = t.filter((p) => p.path && p.path.includes("http")).map((p) => ({
30209
- item: p,
30210
- itemUrl: new URL(p.path),
30211
- matchingParamsCount: l6(e, p.path)
30212
- })).sort((p, w) => {
30213
- const g = new URL(p.itemUrl).searchParams, T = new URL(w.itemUrl).searchParams;
30214
- return Array.from(g).length - Array.from(T).length;
30215
- }).filter(({ itemUrl: p }) => n.origin === p.origin);
30216
- const i = r.filter(
30217
- ({ itemUrl: p }) => n.pathname === p.pathname
30218
- ), o = r.filter(
30219
- ({ itemUrl: p }) => n.pathname.includes(p.pathname)
30220
- );
30221
- r = i.length > 0 ? i : o, r = r.sort(
30222
- (p, w) => w.matchingParamsCount - p.matchingParamsCount
30223
- );
30224
- let a = r.length > 0 ? (f = r.find((p) => p.item.parentKey)) == null ? void 0 : f.item : null;
30225
- console.log("matchingItems:", r);
30226
- let c = [];
30227
- for (; a; )
30228
- c = [a, ...c], a = t.find((p) => p.id === (a == null ? void 0 : a.parentKey)) || null;
30229
- return console.log("parents:", c), c;
30203
+ const n = t.map((a) => ({
30204
+ item: a,
30205
+ priority: a.path ? l6(a.path, e) : 0
30206
+ })).filter((a) => a.priority > 0), r = n.length > 0 ? n.reduce(
30207
+ (a, c) => c.priority > a.priority ? c : a
30208
+ ).item : null, i = [];
30209
+ let o = r;
30210
+ for (; o; )
30211
+ i.unshift(o), o = t.find((a) => a.id === (o == null ? void 0 : o.parentKey)) || null;
30212
+ return i;
30230
30213
  }
30231
30214
  function UD(t, e) {
30232
30215
  return t.map((n) => {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index.esm2017-Bv5RJIus.cjs"),m=require("axios"),u=require("react"),i=require("react/jsx-runtime");require("@r2wc/react-to-web-component");const l=require("react-router-dom");require("@mui/material");const c=s=>{const[t,o]=u.useState([]);return u.useEffect(()=>{m.get(`${s}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(r=>o(r.data)).catch(r=>{console.error("Getting user permission error:",r)})},[s]),t},a=s=>(t,o)=>{const r=c(s);return o?t.every(n=>r==null?void 0:r.includes(n)):t.some(n=>r==null?void 0:r.includes(n))},h=({baseUrl:s,accessWith:t,requireAll:o,children:r})=>a(s)(t,o)?i.jsx(i.Fragment,{children:r}):null,P=({accessWith:s,requireAll:t,baseUrl:o,unAuthorizedPath:r,children:n})=>a(o)(s,t)?i.jsx(i.Fragment,{children:n}):i.jsx(l.Navigate,{to:r,replace:!0});exports.AuthContext=e.AuthContext;exports.AuthProvider=e.AuthProvider;exports.ERROR_MESSAGE=e.ERROR_MESSAGE;exports.SaasThemeProvider=e.SaasThemeProvider;exports.TranslationProvider=e.TranslationProvider;exports.axiosInstance=e.axiosInstance;exports.color=e.color;exports.createCustomTheme=e.createCustomTheme;exports.handleErrorAxios=e.handleErrorAxios;exports.login=e.login;exports.logout=e.logout;exports.responseInterceptor=e.responseInterceptor;exports.search=e.search;exports.setFavicon=e.setFavicon;exports.translate=e.translate;exports.translationConfig=e.translationConfig;exports.useAuth=e.useAuth;exports.useCustomTranslation=e.useCustomTranslation;exports.useTheme=e.useTheme;exports.useTranslation=e.useTranslation$1;exports.HasPermission=h;exports.PermissionRoute=P;exports.getUseHasPermission=a;exports.useGetPermission=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index.esm2017-BGlUC1FO.cjs"),m=require("axios"),u=require("react"),i=require("react/jsx-runtime");require("@r2wc/react-to-web-component");const l=require("react-router-dom");require("@mui/material");const c=s=>{const[t,o]=u.useState([]);return u.useEffect(()=>{m.get(`${s}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(r=>o(r.data)).catch(r=>{console.error("Getting user permission error:",r)})},[s]),t},a=s=>(t,o)=>{const r=c(s);return o?t.every(n=>r==null?void 0:r.includes(n)):t.some(n=>r==null?void 0:r.includes(n))},h=({baseUrl:s,accessWith:t,requireAll:o,children:r})=>a(s)(t,o)?i.jsx(i.Fragment,{children:r}):null,P=({accessWith:s,requireAll:t,baseUrl:o,unAuthorizedPath:r,children:n})=>a(o)(s,t)?i.jsx(i.Fragment,{children:n}):i.jsx(l.Navigate,{to:r,replace:!0});exports.AuthContext=e.AuthContext;exports.AuthProvider=e.AuthProvider;exports.ERROR_MESSAGE=e.ERROR_MESSAGE;exports.SaasThemeProvider=e.SaasThemeProvider;exports.TranslationProvider=e.TranslationProvider;exports.axiosInstance=e.axiosInstance;exports.color=e.color;exports.createCustomTheme=e.createCustomTheme;exports.handleErrorAxios=e.handleErrorAxios;exports.login=e.login;exports.logout=e.logout;exports.responseInterceptor=e.responseInterceptor;exports.search=e.search;exports.setFavicon=e.setFavicon;exports.translate=e.translate;exports.translationConfig=e.translationConfig;exports.useAuth=e.useAuth;exports.useCustomTranslation=e.useCustomTranslation;exports.useTheme=e.useTheme;exports.useTranslation=e.useTranslation$1;exports.HasPermission=h;exports.PermissionRoute=P;exports.getUseHasPermission=a;exports.useGetPermission=c;
@@ -1,4 +1,4 @@
1
- import { M as R, N as S, O as G, a0 as y, Y as F, a as H, c as I, Z as M, U as N, R as O, T as $, V as j, v as w, $ as U, t as V, W as X, b as Y, u as Z, g as _, X as b } from "../index.esm2017-CjxlZYES.js";
1
+ import { M as R, N as S, O as G, a0 as y, Y as F, a as H, c as I, Z as M, U as N, R as O, T as $, V as j, v as w, $ as U, t as V, W as X, b as Y, u as Z, g as _, X as b } from "../index.esm2017-Cal8p_6q.js";
2
2
  import u from "axios";
3
3
  import { useState as m, useEffect as c } from "react";
4
4
  import { jsx as a, Fragment as n } from "react/jsx-runtime";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ukpc-lib/react",
3
3
  "private": false,
4
- "version": "0.12.1-dev.3",
4
+ "version": "0.12.1-dev.5",
5
5
  "type": "module",
6
6
  "main": "./dist/",
7
7
  "module": "./dist/",
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-CXwKHjZr.js";
2
- import { F as i, u as m } from "../index-DHKcEd2K.js";
2
+ import { F as i, u as m } from "../index-Bgdqkq7M.js";
3
3
  import "../index-BSe1av43.js";
4
4
  import "../index-BziS9Had.js";
5
5
  export {
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-CXwKHjZr.js";
2
- import { G as i } from "../index-DHKcEd2K.js";
2
+ import { G as i } from "../index-Bgdqkq7M.js";
3
3
  import "../index-BSe1av43.js";
4
4
  import "../index-BziS9Had.js";
5
5
  export {
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-CXwKHjZr.js";
2
- import { L as n, T as s } from "../index-DHKcEd2K.js";
2
+ import { L as n, T as s } from "../index-Bgdqkq7M.js";
3
3
  import "../index-BSe1av43.js";
4
4
  import "../index-T58UE-6b.js";
5
5
  import "../index-BziS9Had.js";
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-CXwKHjZr.js";
2
- import { H as e, g as m } from "../index-DHKcEd2K.js";
2
+ import { H as e, g as m } from "../index-Bgdqkq7M.js";
3
3
  import "../index-BziS9Had.js";
4
4
  export {
5
5
  e as HasPermission,
@@ -39337,7 +39337,7 @@ function DL({ ...e }) {
39337
39337
  }, [e.item.isFavorite]);
39338
39338
  const O = M.useRef(), _ = M.useRef();
39339
39339
  _ != null && _.current && ((Ne = _ == null ? void 0 : _.current) == null ? void 0 : Ne.scrollWidth) > ((Je = _ == null ? void 0 : _.current) == null ? void 0 : Je.clientWidth);
39340
- const L = window.location.origin, A = t.path && t.path.includes("http") ? new URL(t.path) : { origin: "", pathname: "" }, V = window.location.pathname.split("/")[1], H = A.pathname.split("/")[1], F = e.item.redirectUrl || e.ssr || !L.includes("local") && L !== A.origin || H !== V, v = r ? "div" : F ? "a" : RD, G = t.path || "#", K = n + 1, re = r && s && y, J = s || n === 0 ? void 0 : `${n + 0.25}rem`, ae = () => {
39340
+ const L = window.location.origin, A = t.path && t.path.includes("http") ? new URL(t.path) : { origin: "", pathname: "" }, V = window.location.pathname.split("/")[1], H = A.pathname.split("/")[1], F = e.item.redirectUrl || e.ssr || !L.includes("local") && L !== A.origin || H !== V, v = r ? "div" : F ? "a" : RD, G = t.redirectUrl || t.path || "#", K = n + 1, re = r && s && y, J = s || n === 0 ? void 0 : `${n + 0.25}rem`, ae = () => {
39341
39341
  x(!0);
39342
39342
  }, se = () => {
39343
39343
  x(!1);
@@ -39871,37 +39871,20 @@ function Wue(e) {
39871
39871
  ] });
39872
39872
  }
39873
39873
  function Hue(e, t) {
39874
- const n = new URL(e).searchParams, r = new URL(t).searchParams;
39875
- return Array.from(r).filter(
39876
- ([i, s]) => s === n.get(i)
39877
- ).length;
39874
+ const n = new URL(e, window.location.origin), r = new URL(t, window.location.origin);
39875
+ return n.pathname === r.pathname && n.search === r.search ? 3 : n.pathname === r.pathname ? 2 : r.pathname.startsWith(n.pathname) ? 1 : 0;
39878
39876
  }
39879
39877
  function Uue(e, t) {
39880
- var c;
39881
- console.log("menuItems:", e);
39882
- const n = new URL(t);
39883
- let r = e.filter((d) => d.path && d.path.includes("http")).map((d) => ({
39884
- item: d,
39885
- itemUrl: new URL(d.path),
39886
- matchingParamsCount: Hue(t, d.path)
39887
- })).sort((d, h) => {
39888
- const p = new URL(d.itemUrl).searchParams, y = new URL(h.itemUrl).searchParams;
39889
- return Array.from(p).length - Array.from(y).length;
39890
- }).filter(({ itemUrl: d }) => n.origin === d.origin);
39891
- const i = r.filter(
39892
- ({ itemUrl: d }) => n.pathname === d.pathname
39893
- ), s = r.filter(
39894
- ({ itemUrl: d }) => n.pathname.includes(d.pathname)
39895
- );
39896
- r = i.length > 0 ? i : s, r = r.sort(
39897
- (d, h) => h.matchingParamsCount - d.matchingParamsCount
39898
- );
39899
- let o = r.length > 0 ? (c = r.find((d) => d.item.parentKey)) == null ? void 0 : c.item : null;
39900
- console.log("matchingItems:", r);
39901
- let l = [];
39902
- for (; o; )
39903
- l = [o, ...l], o = e.find((d) => d.id === (o == null ? void 0 : o.parentKey)) || null;
39904
- return console.log("parents:", l), l;
39878
+ const n = e.map((o) => ({
39879
+ item: o,
39880
+ priority: o.path ? Hue(o.path, t) : 0
39881
+ })).filter((o) => o.priority > 0), r = n.length > 0 ? n.reduce(
39882
+ (o, l) => l.priority > o.priority ? l : o
39883
+ ).item : null, i = [];
39884
+ let s = r;
39885
+ for (; s; )
39886
+ i.unshift(s), s = e.find((o) => o.id === (s == null ? void 0 : s.parentKey)) || null;
39887
+ return i;
39905
39888
  }
39906
39889
  function OL(e, t) {
39907
39890
  return e.map((n) => {