@ukpc-lib/react 0.2.6 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/index.cjs +3 -3
- package/dist/components/index.js +5 -5
- package/dist/index.css +1 -1
- package/dist/{index.module-34bab88b.js → index.module-331f7b11.js} +5089 -5086
- package/dist/{index.module-9c4fe97a.cjs → index.module-4e0ade57.cjs} +75 -75
- package/dist/share/index.cjs +1 -1
- package/dist/share/index.js +2 -2
- package/package.json +1 -1
- package/web-components-bundle/global-menu/index.cjs +2 -2
- package/web-components-bundle/global-menu/index.js +2 -2
- package/web-components-bundle/has-permission/index.cjs +74 -74
- package/web-components-bundle/has-permission/index.js +5678 -5681
- package/web-components-bundle/{index-dd30b753.cjs → index-5a2ec4da.cjs} +1 -1
- package/web-components-bundle/{index-d10944d5.js → index-8330a770.js} +1 -1
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
* content-type
|
|
35
35
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
36
36
|
* MIT Licensed
|
|
37
|
-
*/var pi=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,Ip=/\\([\u000b\u0020-\u00ff])/g,Up=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,Wp=zp;function zp(t){if(!t)throw new TypeError("argument string is required");var e=typeof t=="object"?Hp(t):t;if(typeof e!="string")throw new TypeError("argument string is required to be a string");var n=e.indexOf(";"),r=n!==-1?e.slice(0,n).trim():e.trim();if(!Up.test(r))throw new TypeError("invalid media type");var s=new $p(r.toLowerCase());if(n!==-1){var o,i,a;for(pi.lastIndex=n;i=pi.exec(e);){if(i.index!==n)throw new TypeError("invalid parameter format");n+=i[0].length,o=i[1].toLowerCase(),a=i[2],a.charCodeAt(0)===34&&(a=a.slice(1,-1),a.indexOf("\\")!==-1&&(a=a.replace(Ip,"$1"))),s.parameters[o]=a}if(n!==e.length)throw new TypeError("invalid parameter format")}return s}function Hp(t){var e;if(typeof t.getHeader=="function"?e=t.getHeader("content-type"):typeof t.headers=="object"&&(e=t.headers&&t.headers["content-type"]),typeof e!="string")throw new TypeError("content-type header is missing from object");return e}function $p(t){this.parameters=Object.create(null),this.type=t}var Wt=new Map,ja=function(e){return e.cloneNode(!0)},mi=function(){return window.location.protocol==="file:"},Da=function(e,n,r){var s=new XMLHttpRequest;s.onreadystatechange=function(){try{if(!/\.svg/i.test(e)&&s.readyState===2){var o=s.getResponseHeader("Content-Type");if(!o)throw new Error("Content type not found");var i=Wp(o).type;if(!(i==="image/svg+xml"||i==="text/plain"))throw new Error("Invalid content type: ".concat(i))}if(s.readyState===4){if(s.status===404||s.responseXML===null)throw new Error(mi()?"Note: SVG injection ajax calls do not work locally without adjusting security settings in your browser. Or consider using a local webserver.":"Unable to load SVG file: "+e);if(s.status===200||mi()&&s.status===0)r(null,s);else throw new Error("There was a problem injecting the SVG: "+s.status+" "+s.statusText)}}catch(a){if(s.abort(),a instanceof Error)r(a,s);else throw a}},s.open("GET",e),s.withCredentials=n,s.overrideMimeType&&s.overrideMimeType("text/xml"),s.send()},wt={},gi=function(e,n){wt[e]=wt[e]||[],wt[e].push(n)},qp=function(e){for(var n=function(i,a){setTimeout(function(){if(Array.isArray(wt[e])){var l=Wt.get(e),c=wt[e][i];l instanceof SVGSVGElement&&c(null,ja(l)),l instanceof Error&&c(l),i===wt[e].length-1&&delete wt[e]}},0)},r=0,s=wt[e].length;r<s;r++)n(r)},Gp=function(e,n,r){if(Wt.has(e)){var s=Wt.get(e);if(s===void 0){gi(e,r);return}if(s instanceof SVGSVGElement){r(null,ja(s));return}}Wt.set(e,void 0),gi(e,r),Da(e,n,function(o,i){var a;o?Wt.set(e,o):((a=i.responseXML)===null||a===void 0?void 0:a.documentElement)instanceof SVGSVGElement&&Wt.set(e,i.responseXML.documentElement),qp(e)})},Xp=function(e,n,r){Da(e,n,function(s,o){var i;s?r(s):((i=o.responseXML)===null||i===void 0?void 0:i.documentElement)instanceof SVGSVGElement&&r(null,o.responseXML.documentElement)})},Kp=0,Yp=function(){return++Kp},rt=[],yi={},Jp="http://www.w3.org/2000/svg",_n="http://www.w3.org/1999/xlink",vi=function(e,n,r,s,o,i,a){var l=e.getAttribute("data-src")||e.getAttribute("src");if(!l){a(new Error("Invalid data-src or src attribute"));return}if(rt.indexOf(e)!==-1){rt.splice(rt.indexOf(e),1),e=null;return}rt.push(e),e.setAttribute("src","");var c=s?Gp:Xp;c(l,o,function(f,u){if(!u){rt.splice(rt.indexOf(e),1),e=null,a(f);return}var h=e.getAttribute("id");h&&u.setAttribute("id",h);var d=e.getAttribute("title");d&&u.setAttribute("title",d);var m=e.getAttribute("width");m&&u.setAttribute("width",m);var g=e.getAttribute("height");g&&u.setAttribute("height",g);var y=Array.from(new Set(Dn(Dn(Dn([],(u.getAttribute("class")||"").split(" "),!0),["injected-svg"],!1),(e.getAttribute("class")||"").split(" "),!0))).join(" ").trim();u.setAttribute("class",y);var b=e.getAttribute("style");b&&u.setAttribute("style",b),u.setAttribute("data-src",l);var w=[].filter.call(e.attributes,function(z){return/^data-\w[\w-]*$/.test(z.name)});if(Array.prototype.forEach.call(w,function(z){z.name&&z.value&&u.setAttribute(z.name,z.value)}),r){var v={clipPath:["clip-path"],"color-profile":["color-profile"],cursor:["cursor"],filter:["filter"],linearGradient:["fill","stroke"],marker:["marker","marker-start","marker-mid","marker-end"],mask:["mask"],path:[],pattern:["fill","stroke"],radialGradient:["fill","stroke"]},E,S,T,P,A;Object.keys(v).forEach(function(z){E=z,T=v[z],S=u.querySelectorAll(E+"[id]");for(var pt=function(Ft,pn){P=S[Ft].id,A=P+"-"+Yp();var Ct;Array.prototype.forEach.call(T,function(mn){Ct=u.querySelectorAll("["+mn+'*="'+P+'"]');for(var Se=0,Ua=Ct.length;Se<Ua;Se++){var Br=Ct[Se].getAttribute(mn);Br&&!Br.match(new RegExp('url\\("?#'+P+'"?\\)'))||Ct[Se].setAttribute(mn,"url(#"+A+")")}});for(var lt=u.querySelectorAll("[*|href]"),Bt=[],It=0,te=lt.length;It<te;It++){var Rt=lt[It].getAttributeNS(_n,"href");Rt&&Rt.toString()==="#"+S[Ft].id&&Bt.push(lt[It])}for(var Q=0,Fr=Bt.length;Q<Fr;Q++)Bt[Q].setAttributeNS(_n,"href","#"+A);S[Ft].id=A},_t=0,k=S.length;_t<k;_t++)pt(_t)})}u.removeAttribute("xmlns:a");for(var R=u.querySelectorAll("script"),_=[],V,j,U=0,W=R.length;U<W;U++)j=R[U].getAttribute("type"),(!j||j==="application/ecmascript"||j==="application/javascript"||j==="text/javascript")&&(V=R[U].innerText||R[U].textContent,V&&_.push(V),u.removeChild(R[U]));if(_.length>0&&(n==="always"||n==="once"&&!yi[l])){for(var et=0,I=_.length;et<I;et++)new Function(_[et])(window);yi[l]=!0}var nt=u.querySelectorAll("style");if(Array.prototype.forEach.call(nt,function(z){z.textContent+=""}),u.setAttribute("xmlns",Jp),u.setAttribute("xmlns:xlink",_n),i(u),!e.parentNode){rt.splice(rt.indexOf(e),1),e=null,a(new Error("Parent node is null"));return}e.parentNode.replaceChild(u,e),rt.splice(rt.indexOf(e),1),e=null,a(null,u)})},Zp=function(e,n){var r=n===void 0?{}:n,s=r.afterAll,o=s===void 0?function(){}:s,i=r.afterEach,a=i===void 0?function(){}:i,l=r.beforeEach,c=l===void 0?function(){}:l,f=r.cacheRequests,u=f===void 0?!0:f,h=r.evalScripts,d=h===void 0?"never":h,m=r.httpRequestWithCredentials,g=m===void 0?!1:m,y=r.renumerateIRIElements,b=y===void 0?!0:y;if(e&&"length"in e)for(var w=0,v=0,E=e.length;v<E;v++)vi(e[v],d,b,u,g,c,function(S,T){a(S,T),e&&"length"in e&&e.length===++w&&o(w)});else e?vi(e,d,b,u,g,c,function(S,T){a(S,T),o(1),e=null}):o(0)},Qp=function(e){var n=(e==null?void 0:e.ownerDocument)||document;return n.defaultView||window},tm=function(e,n){for(var r in e)if(!(r in n))return!0;for(var s in n)if(e[s]!==n[s])return!0;return!1},em=["afterInjection","beforeInjection","desc","evalScripts","fallback","httpRequestWithCredentials","loading","renumerateIRIElements","src","title","useRequestCache","wrapper"],Ve="http://www.w3.org/2000/svg",xi="http://www.w3.org/1999/xlink",_r=function(t){La(e,t);function e(){for(var r,s=arguments.length,o=new Array(s),i=0;i<s;i++)o[i]=arguments[i];return r=t.call.apply(t,[this].concat(o))||this,r.initialState={hasError:!1,isLoading:!0},r.state=r.initialState,r._isMounted=!1,r.reactWrapper=void 0,r.nonReactWrapper=void 0,r.refCallback=function(a){r.reactWrapper=a},r}var n=e.prototype;return n.renderSVG=function(){var s=this;if(this.reactWrapper instanceof Qp(this.reactWrapper).Node){var o=this.props,i=o.desc,a=o.evalScripts,l=o.httpRequestWithCredentials,c=o.renumerateIRIElements,f=o.src,u=o.title,h=o.useRequestCache,d=this.props.onError,m=this.props.beforeInjection,g=this.props.afterInjection,y=this.props.wrapper,b,w;y==="svg"?(b=document.createElementNS(Ve,y),b.setAttribute("xmlns",Ve),b.setAttribute("xmlns:xlink",xi),w=document.createElementNS(Ve,y)):(b=document.createElement(y),w=document.createElement(y)),b.appendChild(w),w.dataset.src=f,this.nonReactWrapper=this.reactWrapper.appendChild(b);var v=function(P){if(s.removeSVG(),!s._isMounted){d(P);return}s.setState(function(){return{hasError:!0,isLoading:!1}},function(){d(P)})},E=function(P,A){if(P){v(P);return}s._isMounted&&s.setState(function(){return{isLoading:!1}},function(){try{g(A)}catch(R){v(R)}})},S=function(P){if(P.setAttribute("role","img"),i){var A=P.querySelector(":scope > desc");A&&P.removeChild(A);var R=document.createElement("desc");R.innerHTML=i,P.prepend(R)}if(u){var _=P.querySelector(":scope > title");_&&P.removeChild(_);var V=document.createElement("title");V.innerHTML=u,P.prepend(V)}try{m(P)}catch(j){v(j)}};Zp(w,{afterEach:E,beforeEach:S,cacheRequests:h,evalScripts:a,httpRequestWithCredentials:l,renumerateIRIElements:c})}},n.removeSVG=function(){var s;(s=this.nonReactWrapper)!=null&&s.parentNode&&(this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper),this.nonReactWrapper=null)},n.componentDidMount=function(){this._isMounted=!0,this.renderSVG()},n.componentDidUpdate=function(s){var o=this;tm(Jt({},s),this.props)&&this.setState(function(){return o.initialState},function(){o.removeSVG(),o.renderSVG()})},n.componentWillUnmount=function(){this._isMounted=!1,this.removeSVG()},n.render=function(){var s=this.props;s.afterInjection,s.beforeInjection,s.desc,s.evalScripts;var o=s.fallback;s.httpRequestWithCredentials;var i=s.loading;s.renumerateIRIElements,s.src,s.title,s.useRequestCache;var a=s.wrapper,l=Dr(s,em),c=a;return p.reactExports.createElement(c,Jt({},l,{ref:this.refCallback},a==="svg"?{xmlns:Ve,xmlnsXlink:xi}:{}),this.state.isLoading&&i&&p.reactExports.createElement(i,null),this.state.hasError&&o&&p.reactExports.createElement(o,null))},e}(p.reactExports.Component);_r.defaultProps={afterInjection:function(){},beforeInjection:function(){},desc:"",evalScripts:"never",fallback:null,httpRequestWithCredentials:!1,loading:null,onError:function(){},renumerateIRIElements:!0,title:"",useRequestCache:!0,wrapper:"div"};_r.propTypes={afterInjection:p.propTypesExports.func,beforeInjection:p.propTypesExports.func,desc:p.propTypesExports.string,evalScripts:p.propTypesExports.oneOf(["always","once","never"]),fallback:p.propTypesExports.oneOfType([p.propTypesExports.func,p.propTypesExports.object,p.propTypesExports.string]),httpRequestWithCredentials:p.propTypesExports.bool,loading:p.propTypesExports.oneOfType([p.propTypesExports.func,p.propTypesExports.object,p.propTypesExports.string]),onError:p.propTypesExports.func,renumerateIRIElements:p.propTypesExports.bool,src:p.propTypesExports.string.isRequired,title:p.propTypesExports.string,useRequestCache:p.propTypesExports.bool,wrapper:p.propTypesExports.oneOf(["div","span","svg"])};function nm(t){return p.jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 16 16",...t,children:p.jsxRuntimeExports.jsx("path",{fill:"currenColor",d:"M4.427 7.427l3.396 3.396a.25.25 0 00.354 0l3.396-3.396A.25.25 0 0011.396 7H4.604a.25.25 0 00-.177.427z"})})}function rm(t){const{children:e,parentRef:n,onlyChild:r}=t,[s,o]=p.reactExports.useState({top:0,left:0});return p.reactExports.useLayoutEffect(()=>{if(n.current){const i=n.current.getBoundingClientRect();o({top:i.top,left:i.left+i.width})}},[n]),r?e:p.reactDomExports.createPortal(p.jsxRuntimeExports.jsx("div",{style:{position:"fixed",top:s.top,left:s.left,zIndex:1200},children:e}),n.current)}function _a({item:t,level:e=0,...n}){var R,_;const{isActive:r,isCollapsed:s,expanded:o,toggleExpand:i}=n,a=`level-${e}`,l=s?"collapsed":"expanded",c=r(t.id)?"active":"",f=(V,j=a)=>`${V} ${j} ${l} ${c}`,u=!!((R=t.children)!=null&&R.length),[h,d]=p.reactExports.useState(!1),m=p.reactExports.useRef(),g=window.location.origin,y=t.path&&t.path.includes("http")?new URL(t.path):{origin:"",pathname:""},b=window.location.pathname.split("/")[1],w=y.pathname.split("/")[1],v=n.ssr||!g.includes("local")&&g!==y.origin||w!==b,E=u?"div":v?"a":_p,S=t.path||"#",T=e+1,P=u&&!(s&&T>=2&&!h),A=s||e===0?void 0:`${e}rem`;return p.jsxRuntimeExports.jsxs("div",{ref:m,className:f("menu-item__wrapper"),onMouseEnter:()=>s&&d(!0),onMouseLeave:()=>s&&d(!1),children:[p.jsxRuntimeExports.jsxs(E,{to:S,href:S,style:{paddingLeft:A,transition:"all 0.3s"},className:f("menu-item__link"),onClick:V=>{u&&(V.preventDefault(),s||i(t.id))},children:[e!==0&&p.jsxRuntimeExports.jsx(sm,{cls:f,item:t}),p.jsxRuntimeExports.jsx("span",{className:f("menu-item__label"),children:t.name}),u&&p.jsxRuntimeExports.jsx("div",{className:f("menu-item__icon-arrow__wrapper"),children:p.jsxRuntimeExports.jsx(nm,{className:f(`menu-item__icon-arrow__icon ${o(t.id)?"open":"close"}`)})})]}),P&&p.jsxRuntimeExports.jsx(rm,{parentRef:m,onlyChild:!s||s&&T<2,children:p.jsxRuntimeExports.jsx(cp.div,{className:f("menu-item__dropdown",`level-${T}`),initial:{height:s||o(t.id)?"auto":0},animate:{height:s||o(t.id)?"auto":0},transition:{duration:.25},children:(_=t.children)==null?void 0:_.map(V=>p.reactExports.createElement(_a,{...n,key:V.id,item:V,level:T}))})})]})}function sm({item:t,cls:e}){var i,a;const[n,r]=p.reactExports.useState(!t.icon),s=()=>{r(!0)},o=(i=t.icon)==null?void 0:i.endsWith(".svg");return p.jsxRuntimeExports.jsx("div",{className:e("menu-item__icon"),children:n?p.jsxRuntimeExports.jsx("div",{style:{width:24,height:24,backgroundColor:"#dadada",borderRadius:"5px",display:"flex",justifyContent:"center",alignItems:"center"},children:(a=t.name.trim().at(0))==null?void 0:a.toUpperCase()}):o?p.jsxRuntimeExports.jsx(_r,{src:t.icon,beforeInjection:l=>{l.setAttribute("style","margin: 0 auto;"),l.querySelectorAll("path").forEach(f=>{f.hasAttribute("fill")&&f.setAttribute("fill","currentColor"),f.hasAttribute("stroke")&&f.setAttribute("stroke","currentColor")})}}):p.jsxRuntimeExports.jsx("img",{src:t.icon||"/",alt:" ",style:{height:24,maxHeight:24},onError:s})})}function im(){return p.jsxRuntimeExports.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:p.jsxRuntimeExports.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 om(){return p.jsxRuntimeExports.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:p.jsxRuntimeExports.jsx("path",{d:"M3 4h18v2H3V4zm0 7h18v2H3v-2zm0 7h18v2H3v-2z"})})}function am(t){return p.jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"20",fill:"none",viewBox:"0 0 18 20",...t,children:p.jsxRuntimeExports.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 lm=`.wrap-section{padding:0 8px;transition:all .3s}.wrap-section.collapsed{padding:0 4px}.side-bar{display:flex;flex-direction:column;max-width:18rem;height:calc(100vh - 64px);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:40px 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}.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%}.menu-item__link{display:flex;flex-direction:row;border-radius:.375rem;align-items:center;padding:.5rem;position:relative;height:48px;cursor:pointer;color:#85858a}.menu-item__link:hover{background-color:#919eab14}.menu-item__link.collapsed.level-1{padding-left:calc(.5rem + 7.665px)!important}.menu-item__link.active{background-color:#009d4f1a!important;color:#009d4f!important}.menu-item__link.level-0{height:37px}.menu-item__link.menu-item__link.collapsed.level-0{padding:0;height:0;transition:all .15s}.menu-item__icon{width:1.5rem;height:1.5rem;flex-shrink:0;display:grid;place-items:center}.menu-item__icon.collapsed.level-1>*{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;color:#292929;opacity:1;transition:all .15s ease-in-out}.menu-item__label.level-1.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,.menu-item__label.collapsed.level-1{font-size:.875rem;opacity:0;transition-delay:.15s}.menu-item__label.level-0{color:#85858a;margin-left:0}.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__wrapper.level-0.collapsed{display:none}.menu-item__icon-arrow__icon{transition:all .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:180px;max-width:180px;padding:4px;z-index:1200}.menu-item__dropdown,.menu-item__dropdown>*{margin-top:4px}.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-1{height:48px}.menu-item__dropdown.collapsed.level-1{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}
|
|
37
|
+
*/var pi=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,Ip=/\\([\u000b\u0020-\u00ff])/g,Up=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,Wp=zp;function zp(t){if(!t)throw new TypeError("argument string is required");var e=typeof t=="object"?Hp(t):t;if(typeof e!="string")throw new TypeError("argument string is required to be a string");var n=e.indexOf(";"),r=n!==-1?e.slice(0,n).trim():e.trim();if(!Up.test(r))throw new TypeError("invalid media type");var s=new $p(r.toLowerCase());if(n!==-1){var o,i,a;for(pi.lastIndex=n;i=pi.exec(e);){if(i.index!==n)throw new TypeError("invalid parameter format");n+=i[0].length,o=i[1].toLowerCase(),a=i[2],a.charCodeAt(0)===34&&(a=a.slice(1,-1),a.indexOf("\\")!==-1&&(a=a.replace(Ip,"$1"))),s.parameters[o]=a}if(n!==e.length)throw new TypeError("invalid parameter format")}return s}function Hp(t){var e;if(typeof t.getHeader=="function"?e=t.getHeader("content-type"):typeof t.headers=="object"&&(e=t.headers&&t.headers["content-type"]),typeof e!="string")throw new TypeError("content-type header is missing from object");return e}function $p(t){this.parameters=Object.create(null),this.type=t}var Wt=new Map,ja=function(e){return e.cloneNode(!0)},mi=function(){return window.location.protocol==="file:"},Da=function(e,n,r){var s=new XMLHttpRequest;s.onreadystatechange=function(){try{if(!/\.svg/i.test(e)&&s.readyState===2){var o=s.getResponseHeader("Content-Type");if(!o)throw new Error("Content type not found");var i=Wp(o).type;if(!(i==="image/svg+xml"||i==="text/plain"))throw new Error("Invalid content type: ".concat(i))}if(s.readyState===4){if(s.status===404||s.responseXML===null)throw new Error(mi()?"Note: SVG injection ajax calls do not work locally without adjusting security settings in your browser. Or consider using a local webserver.":"Unable to load SVG file: "+e);if(s.status===200||mi()&&s.status===0)r(null,s);else throw new Error("There was a problem injecting the SVG: "+s.status+" "+s.statusText)}}catch(a){if(s.abort(),a instanceof Error)r(a,s);else throw a}},s.open("GET",e),s.withCredentials=n,s.overrideMimeType&&s.overrideMimeType("text/xml"),s.send()},wt={},gi=function(e,n){wt[e]=wt[e]||[],wt[e].push(n)},qp=function(e){for(var n=function(i,a){setTimeout(function(){if(Array.isArray(wt[e])){var l=Wt.get(e),c=wt[e][i];l instanceof SVGSVGElement&&c(null,ja(l)),l instanceof Error&&c(l),i===wt[e].length-1&&delete wt[e]}},0)},r=0,s=wt[e].length;r<s;r++)n(r)},Gp=function(e,n,r){if(Wt.has(e)){var s=Wt.get(e);if(s===void 0){gi(e,r);return}if(s instanceof SVGSVGElement){r(null,ja(s));return}}Wt.set(e,void 0),gi(e,r),Da(e,n,function(o,i){var a;o?Wt.set(e,o):((a=i.responseXML)===null||a===void 0?void 0:a.documentElement)instanceof SVGSVGElement&&Wt.set(e,i.responseXML.documentElement),qp(e)})},Xp=function(e,n,r){Da(e,n,function(s,o){var i;s?r(s):((i=o.responseXML)===null||i===void 0?void 0:i.documentElement)instanceof SVGSVGElement&&r(null,o.responseXML.documentElement)})},Kp=0,Yp=function(){return++Kp},rt=[],yi={},Jp="http://www.w3.org/2000/svg",_n="http://www.w3.org/1999/xlink",vi=function(e,n,r,s,o,i,a){var l=e.getAttribute("data-src")||e.getAttribute("src");if(!l){a(new Error("Invalid data-src or src attribute"));return}if(rt.indexOf(e)!==-1){rt.splice(rt.indexOf(e),1),e=null;return}rt.push(e),e.setAttribute("src","");var c=s?Gp:Xp;c(l,o,function(f,u){if(!u){rt.splice(rt.indexOf(e),1),e=null,a(f);return}var h=e.getAttribute("id");h&&u.setAttribute("id",h);var d=e.getAttribute("title");d&&u.setAttribute("title",d);var m=e.getAttribute("width");m&&u.setAttribute("width",m);var g=e.getAttribute("height");g&&u.setAttribute("height",g);var y=Array.from(new Set(Dn(Dn(Dn([],(u.getAttribute("class")||"").split(" "),!0),["injected-svg"],!1),(e.getAttribute("class")||"").split(" "),!0))).join(" ").trim();u.setAttribute("class",y);var b=e.getAttribute("style");b&&u.setAttribute("style",b),u.setAttribute("data-src",l);var w=[].filter.call(e.attributes,function(z){return/^data-\w[\w-]*$/.test(z.name)});if(Array.prototype.forEach.call(w,function(z){z.name&&z.value&&u.setAttribute(z.name,z.value)}),r){var v={clipPath:["clip-path"],"color-profile":["color-profile"],cursor:["cursor"],filter:["filter"],linearGradient:["fill","stroke"],marker:["marker","marker-start","marker-mid","marker-end"],mask:["mask"],path:[],pattern:["fill","stroke"],radialGradient:["fill","stroke"]},E,S,T,P,A;Object.keys(v).forEach(function(z){E=z,T=v[z],S=u.querySelectorAll(E+"[id]");for(var pt=function(Ft,pn){P=S[Ft].id,A=P+"-"+Yp();var Ct;Array.prototype.forEach.call(T,function(mn){Ct=u.querySelectorAll("["+mn+'*="'+P+'"]');for(var Se=0,Ua=Ct.length;Se<Ua;Se++){var Br=Ct[Se].getAttribute(mn);Br&&!Br.match(new RegExp('url\\("?#'+P+'"?\\)'))||Ct[Se].setAttribute(mn,"url(#"+A+")")}});for(var lt=u.querySelectorAll("[*|href]"),Bt=[],It=0,te=lt.length;It<te;It++){var Rt=lt[It].getAttributeNS(_n,"href");Rt&&Rt.toString()==="#"+S[Ft].id&&Bt.push(lt[It])}for(var Q=0,Fr=Bt.length;Q<Fr;Q++)Bt[Q].setAttributeNS(_n,"href","#"+A);S[Ft].id=A},_t=0,k=S.length;_t<k;_t++)pt(_t)})}u.removeAttribute("xmlns:a");for(var R=u.querySelectorAll("script"),_=[],V,j,U=0,W=R.length;U<W;U++)j=R[U].getAttribute("type"),(!j||j==="application/ecmascript"||j==="application/javascript"||j==="text/javascript")&&(V=R[U].innerText||R[U].textContent,V&&_.push(V),u.removeChild(R[U]));if(_.length>0&&(n==="always"||n==="once"&&!yi[l])){for(var et=0,I=_.length;et<I;et++)new Function(_[et])(window);yi[l]=!0}var nt=u.querySelectorAll("style");if(Array.prototype.forEach.call(nt,function(z){z.textContent+=""}),u.setAttribute("xmlns",Jp),u.setAttribute("xmlns:xlink",_n),i(u),!e.parentNode){rt.splice(rt.indexOf(e),1),e=null,a(new Error("Parent node is null"));return}e.parentNode.replaceChild(u,e),rt.splice(rt.indexOf(e),1),e=null,a(null,u)})},Zp=function(e,n){var r=n===void 0?{}:n,s=r.afterAll,o=s===void 0?function(){}:s,i=r.afterEach,a=i===void 0?function(){}:i,l=r.beforeEach,c=l===void 0?function(){}:l,f=r.cacheRequests,u=f===void 0?!0:f,h=r.evalScripts,d=h===void 0?"never":h,m=r.httpRequestWithCredentials,g=m===void 0?!1:m,y=r.renumerateIRIElements,b=y===void 0?!0:y;if(e&&"length"in e)for(var w=0,v=0,E=e.length;v<E;v++)vi(e[v],d,b,u,g,c,function(S,T){a(S,T),e&&"length"in e&&e.length===++w&&o(w)});else e?vi(e,d,b,u,g,c,function(S,T){a(S,T),o(1),e=null}):o(0)},Qp=function(e){var n=(e==null?void 0:e.ownerDocument)||document;return n.defaultView||window},tm=function(e,n){for(var r in e)if(!(r in n))return!0;for(var s in n)if(e[s]!==n[s])return!0;return!1},em=["afterInjection","beforeInjection","desc","evalScripts","fallback","httpRequestWithCredentials","loading","renumerateIRIElements","src","title","useRequestCache","wrapper"],Ve="http://www.w3.org/2000/svg",xi="http://www.w3.org/1999/xlink",_r=function(t){La(e,t);function e(){for(var r,s=arguments.length,o=new Array(s),i=0;i<s;i++)o[i]=arguments[i];return r=t.call.apply(t,[this].concat(o))||this,r.initialState={hasError:!1,isLoading:!0},r.state=r.initialState,r._isMounted=!1,r.reactWrapper=void 0,r.nonReactWrapper=void 0,r.refCallback=function(a){r.reactWrapper=a},r}var n=e.prototype;return n.renderSVG=function(){var s=this;if(this.reactWrapper instanceof Qp(this.reactWrapper).Node){var o=this.props,i=o.desc,a=o.evalScripts,l=o.httpRequestWithCredentials,c=o.renumerateIRIElements,f=o.src,u=o.title,h=o.useRequestCache,d=this.props.onError,m=this.props.beforeInjection,g=this.props.afterInjection,y=this.props.wrapper,b,w;y==="svg"?(b=document.createElementNS(Ve,y),b.setAttribute("xmlns",Ve),b.setAttribute("xmlns:xlink",xi),w=document.createElementNS(Ve,y)):(b=document.createElement(y),w=document.createElement(y)),b.appendChild(w),w.dataset.src=f,this.nonReactWrapper=this.reactWrapper.appendChild(b);var v=function(P){if(s.removeSVG(),!s._isMounted){d(P);return}s.setState(function(){return{hasError:!0,isLoading:!1}},function(){d(P)})},E=function(P,A){if(P){v(P);return}s._isMounted&&s.setState(function(){return{isLoading:!1}},function(){try{g(A)}catch(R){v(R)}})},S=function(P){if(P.setAttribute("role","img"),i){var A=P.querySelector(":scope > desc");A&&P.removeChild(A);var R=document.createElement("desc");R.innerHTML=i,P.prepend(R)}if(u){var _=P.querySelector(":scope > title");_&&P.removeChild(_);var V=document.createElement("title");V.innerHTML=u,P.prepend(V)}try{m(P)}catch(j){v(j)}};Zp(w,{afterEach:E,beforeEach:S,cacheRequests:h,evalScripts:a,httpRequestWithCredentials:l,renumerateIRIElements:c})}},n.removeSVG=function(){var s;(s=this.nonReactWrapper)!=null&&s.parentNode&&(this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper),this.nonReactWrapper=null)},n.componentDidMount=function(){this._isMounted=!0,this.renderSVG()},n.componentDidUpdate=function(s){var o=this;tm(Jt({},s),this.props)&&this.setState(function(){return o.initialState},function(){o.removeSVG(),o.renderSVG()})},n.componentWillUnmount=function(){this._isMounted=!1,this.removeSVG()},n.render=function(){var s=this.props;s.afterInjection,s.beforeInjection,s.desc,s.evalScripts;var o=s.fallback;s.httpRequestWithCredentials;var i=s.loading;s.renumerateIRIElements,s.src,s.title,s.useRequestCache;var a=s.wrapper,l=Dr(s,em),c=a;return p.reactExports.createElement(c,Jt({},l,{ref:this.refCallback},a==="svg"?{xmlns:Ve,xmlnsXlink:xi}:{}),this.state.isLoading&&i&&p.reactExports.createElement(i,null),this.state.hasError&&o&&p.reactExports.createElement(o,null))},e}(p.reactExports.Component);_r.defaultProps={afterInjection:function(){},beforeInjection:function(){},desc:"",evalScripts:"never",fallback:null,httpRequestWithCredentials:!1,loading:null,onError:function(){},renumerateIRIElements:!0,title:"",useRequestCache:!0,wrapper:"div"};_r.propTypes={afterInjection:p.propTypesExports.func,beforeInjection:p.propTypesExports.func,desc:p.propTypesExports.string,evalScripts:p.propTypesExports.oneOf(["always","once","never"]),fallback:p.propTypesExports.oneOfType([p.propTypesExports.func,p.propTypesExports.object,p.propTypesExports.string]),httpRequestWithCredentials:p.propTypesExports.bool,loading:p.propTypesExports.oneOfType([p.propTypesExports.func,p.propTypesExports.object,p.propTypesExports.string]),onError:p.propTypesExports.func,renumerateIRIElements:p.propTypesExports.bool,src:p.propTypesExports.string.isRequired,title:p.propTypesExports.string,useRequestCache:p.propTypesExports.bool,wrapper:p.propTypesExports.oneOf(["div","span","svg"])};function nm(t){return p.jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 16 16",...t,children:p.jsxRuntimeExports.jsx("path",{fill:"currenColor",d:"M4.427 7.427l3.396 3.396a.25.25 0 00.354 0l3.396-3.396A.25.25 0 0011.396 7H4.604a.25.25 0 00-.177.427z"})})}function rm(t){const{children:e,parentRef:n,onlyChild:r}=t,[s,o]=p.reactExports.useState({top:0,left:0});return p.reactExports.useLayoutEffect(()=>{if(n.current){const i=n.current.getBoundingClientRect();o({top:i.top,left:i.left+i.width})}},[n]),r?e:p.reactDomExports.createPortal(p.jsxRuntimeExports.jsx("div",{style:{position:"fixed",top:s.top,left:s.left,zIndex:1200},children:e}),n.current)}function _a({item:t,level:e=0,...n}){var R,_;const{isActive:r,isCollapsed:s,expanded:o,toggleExpand:i}=n,a=`level-${e}`,l=s?"collapsed":"expanded",c=r(t.id)?"active":"",f=(V,j=a)=>`${V} ${j} ${l} ${c}`,u=!!((R=t.children)!=null&&R.length),[h,d]=p.reactExports.useState(!1),m=p.reactExports.useRef(),g=window.location.origin,y=t.path&&t.path.includes("http")?new URL(t.path):{origin:"",pathname:""},b=window.location.pathname.split("/")[1],w=y.pathname.split("/")[1],v=n.ssr||!g.includes("local")&&g!==y.origin||w!==b,E=u||e===0?"div":v?"a":_p,S=t.path||"#",T=e+1,P=u&&!(s&&T>=2&&!h),A=s||e===0?void 0:`${e}rem`;return p.jsxRuntimeExports.jsxs("div",{ref:m,className:f("menu-item__wrapper"),onMouseEnter:()=>s&&d(!0),onMouseLeave:()=>s&&d(!1),children:[p.jsxRuntimeExports.jsxs(E,{to:S,href:S,style:{paddingLeft:A,transition:"all 0.3s"},className:f("menu-item__link"),onClick:V=>{u&&(V.preventDefault(),s||i(t.id))},children:[e!==0&&p.jsxRuntimeExports.jsx(sm,{cls:f,item:t}),p.jsxRuntimeExports.jsx("span",{className:f("menu-item__label"),children:t.name}),u&&p.jsxRuntimeExports.jsx("div",{className:f("menu-item__icon-arrow__wrapper"),children:p.jsxRuntimeExports.jsx(nm,{className:f(`menu-item__icon-arrow__icon ${o(t.id)?"open":"close"}`)})})]}),P&&p.jsxRuntimeExports.jsx(rm,{parentRef:m,onlyChild:!s||s&&T<2,children:p.jsxRuntimeExports.jsx(cp.div,{className:f("menu-item__dropdown",`level-${T}`),initial:{height:s||o(t.id)?"auto":0},animate:{height:s||o(t.id)?"auto":0},transition:{duration:.25},children:(_=t.children)==null?void 0:_.map(V=>p.reactExports.createElement(_a,{...n,key:V.id,item:V,level:T}))})})]})}function sm({item:t,cls:e}){var i,a;const[n,r]=p.reactExports.useState(!t.icon),s=()=>{r(!0)},o=(i=t.icon)==null?void 0:i.endsWith(".svg");return p.jsxRuntimeExports.jsx("div",{className:e("menu-item__icon"),children:n?p.jsxRuntimeExports.jsx("div",{style:{width:24,height:24,backgroundColor:"#dadada",borderRadius:"5px",display:"flex",justifyContent:"center",alignItems:"center"},children:(a=t.name.trim().at(0))==null?void 0:a.toUpperCase()}):o?p.jsxRuntimeExports.jsx(_r,{src:t.icon,beforeInjection:l=>{l.setAttribute("style","margin: 0 auto;"),l.querySelectorAll("path").forEach(f=>{f.hasAttribute("fill")&&f.setAttribute("fill","currentColor"),f.hasAttribute("stroke")&&f.setAttribute("stroke","currentColor")})}}):p.jsxRuntimeExports.jsx("img",{src:t.icon||"/",alt:" ",style:{height:24,maxHeight:24},onError:s})})}function im(){return p.jsxRuntimeExports.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:p.jsxRuntimeExports.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 om(){return p.jsxRuntimeExports.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:p.jsxRuntimeExports.jsx("path",{d:"M3 4h18v2H3V4zm0 7h18v2H3v-2zm0 7h18v2H3v-2z"})})}function am(t){return p.jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"20",fill:"none",viewBox:"0 0 18 20",...t,children:p.jsxRuntimeExports.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 lm=`.wrap-section{padding:0 8px;transition:all .3s}.wrap-section.collapsed{padding:0 4px}.side-bar{display:flex;flex-direction:column;max-width:18rem;height:calc(100vh - 64px);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:40px 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}.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%}.menu-item__link{display:flex;flex-direction:row;border-radius:.375rem;align-items:center;padding:.5rem;position:relative;height:48px;cursor:pointer;color:#85858a}.menu-item__link:hover{background-color:#919eab14}.menu-item__link.collapsed.level-1{padding-left:calc(.5rem + 7.665px)!important}.menu-item__link.active{background-color:#009d4f1a!important;color:#009d4f!important}.menu-item__link.level-0{height:37px}.menu-item__link.menu-item__link.collapsed.level-0{padding:0;height:0;transition:all .15s}.menu-item__icon{width:1.5rem;height:1.5rem;flex-shrink:0;display:grid;place-items:center}.menu-item__icon.collapsed.level-1>*{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;color:#292929;opacity:1;transition:all .15s ease-in-out}.menu-item__label.level-1.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,.menu-item__label.collapsed.level-1{font-size:.875rem;opacity:0;transition-delay:.15s}.menu-item__label.level-0{color:#85858a;margin-left:0}.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__wrapper.level-0.collapsed{display:none}.menu-item__icon-arrow__icon{transition:all .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:180px;max-width:180px;padding:4px;z-index:1200}.menu-item__dropdown,.menu-item__dropdown>*{margin-top:4px}.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-1{height:48px}.menu-item__dropdown.collapsed.level-1{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}
|
|
38
38
|
`;function cm(t){const{baseUrl:e,menuPath:n}=t,r=dn(),[s,o]=p.reactExports.useState([]),[i,a]=p.reactExports.useState(localStorage.getItem("isCollapsed")==="true"),[l,c]=p.reactExports.useState({}),f=Nr(s),[u,h]=p.reactExports.useState(window.location.href);p.reactExports.useEffect(()=>{h(window.location.href)},[r]);const d=Na(f,u).filter(S=>S.parentKey!==0);console.log("matchPaths:",u,r,d);const m=S=>{c({...l,[S]:!l[S]})},g=()=>{a(!i),localStorage.setItem("isCollapsed",JSON.stringify(!i))};p.reactExports.useLayoutEffect(()=>{(async()=>{var T,P;try{const R=e+(n||"/global-menu-config/api/v1/menu-items/user"),{data:_}=await Ui.get(R,{withCredentials:!0});let V=_.map(U=>({...U,parentKey:0}));V=Ba(V),t.replacePath&&(V=Fa(V,t.replacePath));const j=fm(V);c(j),o(V)}catch(A){console.log(A),Yc(((P=(T=A.response)==null?void 0:T.data)==null?void 0:P.errorMessage)||"Have error when get menu items")}})()},[e,n,t.replacePath]);const[y,b]=p.reactExports.useState(!1),w=i?"collapsed":"expanded",v=S=>`${S} ${w}`,E=p.reactExports.useRef(null);return p.jsxRuntimeExports.jsxs("div",{className:v("side-bar"),children:[p.jsxRuntimeExports.jsx("div",{className:v("wrap-section side-bar__wrapper-toggle-btn"),children:p.jsxRuntimeExports.jsx("button",{className:"icon-btn side-bar__toggle-btn",onClick:g,children:i?p.jsxRuntimeExports.jsx(om,{}):p.jsxRuntimeExports.jsx(im,{})})}),p.jsxRuntimeExports.jsx(Ji,{ref:E,className:v("wrap-section side-bar__menu"),style:{marginTop:24,flex:1,overflow:"auto",height:"100%",overflowX:"hidden"},children:s.map(S=>{const T=P=>d.some(A=>A.id===P);return p.jsxRuntimeExports.jsx(_a,{item:S,isActive:T,isCollapsed:i,expanded:P=>l[P],toggleExpand:m,replacePath:t.replacePath,ssr:t.ssr},S.id)})}),p.jsxRuntimeExports.jsxs("div",{className:v("wrap-section side-bar__wrap-btn-logout"),children:[p.jsxRuntimeExports.jsxs("button",{className:v("side-bar__logout-btn"),onClick:()=>b(!0),children:[p.jsxRuntimeExports.jsx(am,{className:v("side-bar__icon-logout")}),p.jsxRuntimeExports.jsx("span",{className:v("side-bar__logout-btn__text"),children:"Logout"})]}),p.jsxRuntimeExports.jsx(p.LogoutConfirmModal,{isOpen:y,onClose:()=>b(!1),onConfirm:()=>t.logout?t.logout():Wc(t.baseUrl)})]})]})}function Nr(t){let e=[];for(const n of t)e.push(n),n.children&&(e=e.concat(Nr(n.children)));return e}function um(t,e){const n=new URL(t).searchParams,r=new URL(e).searchParams;return Array.from(r).filter(([s,o])=>o===n.get(s)).length}function Na(t,e){const n=new URL(e),r=t.filter(i=>i.path&&i.path.includes("http")).map(i=>({item:i,itemUrl:new URL(i.path),matchingParamsCount:um(e,i.path)})).sort((i,a)=>{const l=new URL(i.itemUrl).searchParams,c=new URL(a.itemUrl).searchParams;return Array.from(l).length-Array.from(c).length}).filter(({itemUrl:i})=>n.pathname===i.pathname).sort((i,a)=>a.matchingParamsCount-i.matchingParamsCount);let s=r.length>0?r[0].item:null;console.log("matchingItems:",r);let o=[];for(;s;)o=[s,...o],s=t.find(i=>i.id===(s==null?void 0:s.parentKey))||null;return o}function Fa(t,e){return t.map(n=>(n.path&&(n.path=e(n.path)),n.children&&n.children.length>0&&(n.children=Fa(n.children,e)),n))}function Ba(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=Ba(n.children)),n))}function fm(t){const e=Nr(t),n=Na(e,window.location.href),r={};return n.forEach(s=>r[s.id]=!0),e.forEach(s=>{var o;(o=s.children)!=null&&o.length&&(r[s.id]=!0)}),r}function Ia(t){return p.jsxRuntimeExports.jsx(p.ShadowDomWrapper,{styles:[Uc,lm],style:{position:"sticky",zIndex:1200},children:p.jsxRuntimeExports.jsx(cm,{...t})})}function hm(t){return p.jsxRuntimeExports.jsx(Lp,{children:p.jsxRuntimeExports.jsx(Ia,{...t,ssr:!0})})}{const t=p.s(hm,{props:{baseUrl:"string",menuPath:"string",logout:"function",replacePath:"function",ssr:"boolean"}});customElements.define("global-menu",t)}exports.GlobalMenu=Ia;exports._extends=Jt;exports._extends$1=Bp;exports._inheritsLoose=La;exports._objectWithoutPropertiesLoose=Dr;exports.axios=Ui;exports.color=zn;exports.objectWithoutPropertiesLoose=Fp;
|
|
@@ -7339,7 +7339,7 @@ function cm(t) {
|
|
|
7339
7339
|
}
|
|
7340
7340
|
function Na({ item: t, level: e = 0, ...n }) {
|
|
7341
7341
|
var O, N;
|
|
7342
|
-
const { isActive: r, isCollapsed: i, expanded: o, toggleExpand: s } = n, a = `level-${e}`, l = i ? "collapsed" : "expanded", c = r(t.id) ? "active" : "", f = (k, _ = a) => `${k} ${_} ${l} ${c}`, u = !!((O = t.children) != null && O.length), [h, d] = b.useState(!1), p = b.useRef(), m = window.location.origin, g = t.path && t.path.includes("http") ? new URL(t.path) : { origin: "", pathname: "" }, x = window.location.pathname.split("/")[1], w = g.pathname.split("/")[1], y = n.ssr || !m.includes("local") && m !== g.origin || w !== x, S = u ? "div" : y ? "a" : zp, E = t.path || "#", P = e + 1, T = u && !(i && P >= 2 && !h), A = i || e === 0 ? void 0 : `${e}rem`;
|
|
7342
|
+
const { isActive: r, isCollapsed: i, expanded: o, toggleExpand: s } = n, a = `level-${e}`, l = i ? "collapsed" : "expanded", c = r(t.id) ? "active" : "", f = (k, _ = a) => `${k} ${_} ${l} ${c}`, u = !!((O = t.children) != null && O.length), [h, d] = b.useState(!1), p = b.useRef(), m = window.location.origin, g = t.path && t.path.includes("http") ? new URL(t.path) : { origin: "", pathname: "" }, x = window.location.pathname.split("/")[1], w = g.pathname.split("/")[1], y = n.ssr || !m.includes("local") && m !== g.origin || w !== x, S = u || e === 0 ? "div" : y ? "a" : zp, E = t.path || "#", P = e + 1, T = u && !(i && P >= 2 && !h), A = i || e === 0 ? void 0 : `${e}rem`;
|
|
7343
7343
|
return /* @__PURE__ */ R.jsxs(
|
|
7344
7344
|
"div",
|
|
7345
7345
|
{
|