react-menubar-cs
Version:
An menubar component.
14 lines (13 loc) • 39.3 kB
JavaScript
import*as e from"react";import t,{useState as n}from"react";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function a(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],u=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t);else for(;!(u=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);u=!0);}catch(e){s=!0,a=e}finally{try{if(!u&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return r(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var u,s={};!function(){if(u)return s;u=1,Object.defineProperty(s,"__esModule",{value:!0}),s.parse=function(e,t){const n=new o,r=e.length;if(r<2)return n;const a=t?.decode||c;let u=0;do{const t=e.indexOf("=",u);if(-1===t)break;const o=e.indexOf(";",u),s=-1===o?r:o;if(t>s){u=e.lastIndexOf(";",t-1)+1;continue}const c=i(e,u,t),h=l(e,t,c),m=e.slice(c,h);if(void 0===n[m]){let r=i(e,t+1,s),o=l(e,s,r);const u=a(e.slice(r,o));n[m]=u}u=s+1}while(u<r);return n},s.serialize=function(o,i,l){const u=l?.encode||encodeURIComponent;if(!e.test(o))throw new TypeError(`argument name is invalid: ${o}`);const s=u(i);if(!t.test(s))throw new TypeError(`argument val is invalid: ${i}`);let c=o+"="+s;if(!l)return c;if(void 0!==l.maxAge){if(!Number.isInteger(l.maxAge))throw new TypeError(`option maxAge is invalid: ${l.maxAge}`);c+="; Max-Age="+l.maxAge}if(l.domain){if(!n.test(l.domain))throw new TypeError(`option domain is invalid: ${l.domain}`);c+="; Domain="+l.domain}if(l.path){if(!r.test(l.path))throw new TypeError(`option path is invalid: ${l.path}`);c+="; Path="+l.path}if(l.expires){if(!function(e){return"[object Date]"===a.call(e)}(l.expires)||!Number.isFinite(l.expires.valueOf()))throw new TypeError(`option expires is invalid: ${l.expires}`);c+="; Expires="+l.expires.toUTCString()}l.httpOnly&&(c+="; HttpOnly");l.secure&&(c+="; Secure");l.partitioned&&(c+="; Partitioned");if(l.priority){switch("string"==typeof l.priority?l.priority.toLowerCase():void 0){case"low":c+="; Priority=Low";break;case"medium":c+="; Priority=Medium";break;case"high":c+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${l.priority}`)}}if(l.sameSite){switch("string"==typeof l.sameSite?l.sameSite.toLowerCase():l.sameSite){case!0:case"strict":c+="; SameSite=Strict";break;case"lax":c+="; SameSite=Lax";break;case"none":c+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${l.sameSite}`)}}return c};const e=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,t=/^[\u0021-\u003A\u003C-\u007E]*$/,n=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,r=/^[\u0020-\u003A\u003D-\u007E]*$/,a=Object.prototype.toString,o=(()=>{const e=function(){};return e.prototype=Object.create(null),e})();function i(e,t,n){do{const n=e.charCodeAt(t);if(32!==n&&9!==n)return t}while(++t<n);return n}function l(e,t,n){for(;t>n;){const n=e.charCodeAt(--t);if(32!==n&&9!==n)return t+1}return n}function c(e){if(-1===e.indexOf("%"))return e;try{return decodeURIComponent(e)}catch(t){return e}}}();
/**
* react-router v7.3.0
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
var c="popstate";function h(e={}){return function(e,t,n,r={}){let{window:a=document.defaultView,v5Compat:o=!1}=r,i=a.history,l="POP",u=null,s=h();null==s&&(s=0,i.replaceState({...i.state,idx:s},""));function h(){return(i.state||{idx:null}).idx}function p(){l="POP";let e=h(),t=null==e?null:e-s;s=e,u&&u({action:l,location:w.location,delta:t})}function y(e,t){l="PUSH";let n=f(w.location,e,t);s=h()+1;let r=d(n,s),c=w.createHref(n);try{i.pushState(r,"",c)}catch(e){if(e instanceof DOMException&&"DataCloneError"===e.name)throw e;a.location.assign(c)}o&&u&&u({action:l,location:w.location,delta:1})}function g(e,t){l="REPLACE";let n=f(w.location,e,t);s=h();let r=d(n,s),a=w.createHref(n);i.replaceState(r,"",a),o&&u&&u({action:l,location:w.location,delta:0})}function b(e){let t="null"!==a.location.origin?a.location.origin:a.location.href,n="string"==typeof e?e:v(e);return n=n.replace(/ $/,"%20"),m(t,`No window.location.(origin|href) available to create URL for href: ${n}`),new URL(n,t)}let w={get action(){return l},get location(){return e(a,i)},listen(e){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(c,p),u=e,()=>{a.removeEventListener(c,p),u=null}},createHref:e=>t(a,e),createURL:b,encodeLocation(e){let t=b(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:y,replace:g,go:e=>i.go(e)};return w}((function(e,t){let{pathname:n,search:r,hash:a}=e.location;return f("",{pathname:n,search:r,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){return"string"==typeof t?t:v(t)}),0,e)}function m(e,t){if(!1===e||null==e)throw new Error(t)}function p(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function d(e,t){return{usr:e.state,key:e.key,idx:t}}function f(e,t,n=null,r){return{pathname:"string"==typeof e?e:e.pathname,search:"",hash:"",..."string"==typeof t?y(t):t,state:n,key:t&&t.key||r||Math.random().toString(36).substring(2,10)}}function v({pathname:e="/",search:t="",hash:n=""}){return t&&"?"!==t&&(e+="?"===t.charAt(0)?t:"?"+t),n&&"#"!==n&&(e+="#"===n.charAt(0)?n:"#"+n),e}function y(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function g(e,t,n="/"){return function(e,t,n,r){let a="string"==typeof t?y(t):t,o=N(a.pathname||"/",n);if(null==o)return null;let i=b(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){let n=e.length===t.length&&e.slice(0,-1).every(((e,n)=>e===t[n]));return n?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(i);let l=null;for(let e=0;null==l&&e<i.length;++e){let t=L(o);l=k(i[e],t,r)}return l}(e,t,n,!1)}function b(e,t=[],n=[],r=""){let a=(e,a,o)=>{let i={relativePath:void 0===o?e.path||"":o,caseSensitive:!0===e.caseSensitive,childrenIndex:a,route:e};i.relativePath.startsWith("/")&&(m(i.relativePath.startsWith(r),`Absolute route path "${i.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),i.relativePath=i.relativePath.slice(r.length));let l=D([r,i.relativePath]),u=n.concat(i);e.children&&e.children.length>0&&(m(!0!==e.index,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),b(e.children,t,u,l)),(null!=e.path||e.index)&&t.push({path:l,score:P(l,e.index),routesMeta:u})};return e.forEach(((e,t)=>{if(""!==e.path&&e.path?.includes("?"))for(let n of w(e.path))a(e,t,n);else a(e,t)})),t}function w(e){let t=e.split("/");if(0===t.length)return[];let[n,...r]=t,a=n.endsWith("?"),o=n.replace(/\?$/,"");if(0===r.length)return a?[o,""]:[o];let i=w(r.join("/")),l=[];return l.push(...i.map((e=>""===e?o:[o,e].join("/")))),a&&l.push(...i),l.map((t=>e.startsWith("/")&&""===t?"/":t))}var E=/^:[\w-]+$/,x=3,C=2,S=1,O=10,R=-2,$=e=>"*"===e;function P(e,t){let n=e.split("/"),r=n.length;return n.some($)&&(r+=R),t&&(r+=C),n.filter((e=>!$(e))).reduce(((e,t)=>e+(E.test(t)?x:""===t?S:O)),r)}function k(e,t,n=!1){let{routesMeta:r}=e,a={},o="/",i=[];for(let e=0;e<r.length;++e){let l=r[e],u=e===r.length-1,s="/"===o?t:t.slice(o.length)||"/",c=M({path:l.relativePath,caseSensitive:l.caseSensitive,end:u},s),h=l.route;if(!c&&u&&n&&!r[r.length-1].route.index&&(c=M({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},s)),!c)return null;Object.assign(a,c.params),i.push({params:a,pathname:D([o,c.pathname]),pathnameBase:F(D([o,c.pathnameBase])),route:h}),"/"!==c.pathnameBase&&(o=D([o,c.pathnameBase]))}return i}function M(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=function(e,t=!1,n=!0){p("*"===e||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,((e,t,n)=>(r.push({paramName:t,isOptional:null!=n}),n?"/?([^\\/]+)?":"/([^\\/]+)")));e.endsWith("*")?(r.push({paramName:"*"}),a+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":""!==e&&"/"!==e&&(a+="(?:(?=\\/|$))");let o=new RegExp(a,t?void 0:"i");return[o,r]}(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let o=a[0],i=o.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:r.reduce(((e,{paramName:t,isOptional:n},r)=>{if("*"===t){let e=l[r]||"";i=o.slice(0,o.length-e.length).replace(/(.)\/+$/,"$1")}const a=l[r];return e[t]=n&&!a?void 0:(a||"").replace(/%2F/g,"/"),e}),{}),pathname:o,pathnameBase:i,pattern:e}}function L(e){try{return e.split("/").map((e=>decodeURIComponent(e).replace(/\//g,"%2F"))).join("/")}catch(t){return p(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function N(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&"/"!==r?null:e.slice(n)||"/"}function T(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function j(e){let t=function(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}(e);return t.map(((e,n)=>n===t.length-1?e.pathname:e.pathnameBase))}function A(e,t,n,r=!1){let a;"string"==typeof e?a=y(e):(a={...e},m(!a.pathname||!a.pathname.includes("?"),T("?","pathname","search",a)),m(!a.pathname||!a.pathname.includes("#"),T("#","pathname","hash",a)),m(!a.search||!a.search.includes("#"),T("#","search","hash",a)));let o,i=""===e||""===a.pathname,l=i?"/":a.pathname;if(null==l)o=n;else{let e=t.length-1;if(!r&&l.startsWith("..")){let t=l.split("/");for(;".."===t[0];)t.shift(),e-=1;a.pathname=t.join("/")}o=e>=0?t[e]:"/"}let u=function(e,t="/"){let{pathname:n,search:r="",hash:a=""}="string"==typeof e?y(e):e,o=n?n.startsWith("/")?n:function(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?n.length>1&&n.pop():"."!==e&&n.push(e)})),n.length>1?n.join("/"):"/"}(n,t):t;return{pathname:o,search:U(r),hash:W(a)}}(a,o),s=l&&"/"!==l&&l.endsWith("/"),c=(i||"."===l)&&n.endsWith("/");return u.pathname.endsWith("/")||!s&&!c||(u.pathname+="/"),u}var D=e=>e.join("/").replace(/\/\/+/g,"/"),F=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),U=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",W=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";var B=["POST","PUT","PATCH","DELETE"];new Set(B);var z=["GET",...B];new Set(z);var I=e.createContext(null);I.displayName="DataRouter";var _=e.createContext(null);_.displayName="DataRouterState";var H=e.createContext({isTransitioning:!1});H.displayName="ViewTransition",e.createContext(new Map).displayName="Fetchers",e.createContext(null).displayName="Await";var Y=e.createContext(null);Y.displayName="Navigation";var J=e.createContext(null);J.displayName="Location";var K=e.createContext({outlet:null,matches:[],isDataRoute:!1});K.displayName="Route";var V=e.createContext(null);function q(){return null!=e.useContext(J)}function G(){return m(q(),"useLocation() may be used only in the context of a <Router> component."),e.useContext(J).location}V.displayName="RouteError";var X="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Q(t){e.useContext(Y).static||e.useLayoutEffect(t)}function Z(){let{isDataRoute:t}=e.useContext(K);return t?function(){let{router:t}=function(t){let n=e.useContext(I);return m(n,ie(t)),n}("useNavigate"),n=le("useNavigate"),r=e.useRef(!1);return Q((()=>{r.current=!0})),e.useCallback((async(e,a={})=>{p(r.current,X),r.current&&("number"==typeof e?t.navigate(e):await t.navigate(e,{fromRouteId:n,...a}))}),[t,n])}():function(){m(q(),"useNavigate() may be used only in the context of a <Router> component.");let t=e.useContext(I),{basename:n,navigator:r}=e.useContext(Y),{matches:a}=e.useContext(K),{pathname:o}=G(),i=JSON.stringify(j(a)),l=e.useRef(!1);return Q((()=>{l.current=!0})),e.useCallback(((e,a={})=>{if(p(l.current,X),!l.current)return;if("number"==typeof e)return void r.go(e);let u=A(e,JSON.parse(i),o,"path"===a.relative);null==t&&"/"!==n&&(u.pathname="/"===u.pathname?n:D([n,u.pathname])),(a.replace?r.replace:r.push)(u,a.state,a)}),[n,r,i,o,t])}()}function ee(t,{relative:n}={}){let{matches:r}=e.useContext(K),{pathname:a}=G(),o=JSON.stringify(j(r));return e.useMemo((()=>A(t,JSON.parse(o),a,"path"===n)),[t,o,a,n])}function te(t,n,r,a){m(q(),"useRoutes() may be used only in the context of a <Router> component.");let o,{navigator:i,static:l}=e.useContext(Y),{matches:u}=e.useContext(K),s=u[u.length-1],c=s?s.params:{},h=s?s.pathname:"/",d=s?s.pathnameBase:"/",f=s&&s.route;{let e=f&&f.path||"";se(h,!f||e.endsWith("*")||e.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${h}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.\n\nPlease change the parent <Route path="${e}"> to <Route path="${"/"===e?"*":`${e}/*`}">.`)}o=G();let v=o.pathname||"/",y=v;if("/"!==d){let e=d.replace(/^\//,"").split("/");y="/"+v.replace(/^\//,"").split("/").slice(e.length).join("/")}let b=!l&&r&&r.matches&&r.matches.length>0?r.matches:g(t,{pathname:y});p(f||null!=b,`No routes matched location "${o.pathname}${o.search}${o.hash}" `),p(null==b||void 0!==b[b.length-1].route.element||void 0!==b[b.length-1].route.Component||void 0!==b[b.length-1].route.lazy,`Matched leaf route at location "${o.pathname}${o.search}${o.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let w=function(t,n=[],r=null){if(null==t){if(!r)return null;if(r.errors)t=r.matches;else{if(0!==n.length||r.initialized||!(r.matches.length>0))return null;t=r.matches}}let a=t,o=r?.errors;if(null!=o){let e=a.findIndex((e=>e.route.id&&void 0!==o?.[e.route.id]));m(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),a=a.slice(0,Math.min(a.length,e+1))}let i=!1,l=-1;if(r)for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(l=e),t.route.id){let{loaderData:e,errors:n}=r,o=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!n||void 0===n[t.route.id]);if(t.route.lazy||o){i=!0,a=l>=0?a.slice(0,l+1):[a[0]];break}}}return a.reduceRight(((t,u,s)=>{let c,h=!1,m=null,p=null;r&&(c=o&&u.route.id?o[u.route.id]:void 0,m=u.route.errorElement||re,i&&(l<0&&0===s?(se("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),h=!0,p=null):l===s&&(h=!0,p=u.route.hydrateFallbackElement||null)));let d=n.concat(a.slice(0,s+1)),f=()=>{let n;return n=c?m:h?p:u.route.Component?e.createElement(u.route.Component,null):u.route.element?u.route.element:t,e.createElement(oe,{match:u,routeContext:{outlet:t,matches:d,isDataRoute:null!=r},children:n})};return r&&(u.route.ErrorBoundary||u.route.errorElement||0===s)?e.createElement(ae,{location:r.location,revalidation:r.revalidation,component:m,error:c,children:f(),routeContext:{outlet:null,matches:d,isDataRoute:!0}}):f()}),null)}(b&&b.map((e=>Object.assign({},e,{params:Object.assign({},c,e.params),pathname:D([d,i.encodeLocation?i.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?d:D([d,i.encodeLocation?i.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),u,r,a);return w}function ne(){let t=function(){let t=e.useContext(V),n=function(t){let n=e.useContext(_);return m(n,ie(t)),n}("useRouteError"),r=le("useRouteError");if(void 0!==t)return t;return n.errors?.[r]}(),n=function(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,a="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:a},i={padding:"2px 4px",backgroundColor:a},l=null;return console.error("Error handled by React Router default ErrorBoundary:",t),l=e.createElement(e.Fragment,null,e.createElement("p",null,"💿 Hey developer 👋"),e.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",e.createElement("code",{style:i},"ErrorBoundary")," or"," ",e.createElement("code",{style:i},"errorElement")," prop on your route.")),e.createElement(e.Fragment,null,e.createElement("h2",null,"Unexpected Application Error!"),e.createElement("h3",{style:{fontStyle:"italic"}},n),r?e.createElement("pre",{style:o},r):null,l)}e.createContext(null);var re=e.createElement(ne,null),ae=class extends e.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return void 0!==this.state.error?e.createElement(K.Provider,{value:this.props.routeContext},e.createElement(V.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function oe({routeContext:t,match:n,children:r}){let a=e.useContext(I);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),e.createElement(K.Provider,{value:t},r)}function ie(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function le(t){let n=function(t){let n=e.useContext(K);return m(n,ie(t)),n}(t),r=n.matches[n.matches.length-1];return m(r.route.id,`${t} can only be used on routes that contain a unique "id"`),r.route.id}var ue={};function se(e,t,n){t||ue[e]||(ue[e]=!0,p(!1,n))}function ce({basename:t="/",children:n=null,location:r,navigationType:a="POP",navigator:o,static:i=!1}){m(!q(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=t.replace(/^\/*/,"/"),u=e.useMemo((()=>({basename:l,navigator:o,static:i,future:{}})),[l,o,i]);"string"==typeof r&&(r=y(r));let{pathname:s="/",search:c="",hash:h="",state:d=null,key:f="default"}=r,v=e.useMemo((()=>{let e=N(s,l);return null==e?null:{location:{pathname:e,search:c,hash:h,state:d,key:f},navigationType:a}}),[l,s,c,h,d,f,a]);return p(null!=v,`<Router basename="${l}"> is not able to match the URL "${s}${c}${h}" because it does not start with the basename, so the <Router> won't render anything.`),null==v?null:e.createElement(Y.Provider,{value:u},e.createElement(J.Provider,{children:n,value:v}))}e.memo((function({routes:e,future:t,state:n}){return te(e,0,n,t)}));var he="get",me="application/x-www-form-urlencoded";function pe(e){return null!=e&&"string"==typeof e.tagName}var de=null;var fe=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function ve(e){return null==e||fe.has(e)?e:(p(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${me}"`),null)}function ye(e,t){let n,r,a,o,i;if(pe(l=e)&&"form"===l.tagName.toLowerCase()){let i=e.getAttribute("action");r=i?N(i,t):null,n=e.getAttribute("method")||he,a=ve(e.getAttribute("enctype"))||me,o=new FormData(e)}else if(function(e){return pe(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return pe(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let i=e.form;if(null==i)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=e.getAttribute("formaction")||i.getAttribute("action");if(r=l?N(l,t):null,n=e.getAttribute("formmethod")||i.getAttribute("method")||he,a=ve(e.getAttribute("formenctype"))||ve(i.getAttribute("enctype"))||me,o=new FormData(i,e),!function(){if(null===de)try{new FormData(document.createElement("form"),0),de=!1}catch(e){de=!0}return de}()){let{name:t,type:n,value:r}=e;if("image"===n){let e=t?`${t}.`:"";o.append(`${e}x`,"0"),o.append(`${e}y`,"0")}else t&&o.append(t,r)}}else{if(pe(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=he,r=null,a=me,i=e}var l;return o&&"text/plain"===a&&(i=o,o=void 0),{action:r,method:n.toLowerCase(),encType:a,formData:o,body:i}}function ge(e,t){if(!1===e||null==e)throw new Error(t)}function be(e){return null!=e&&(null==e.href?"preload"===e.rel&&"string"==typeof e.imageSrcSet&&"string"==typeof e.imageSizes:"string"==typeof e.rel&&"string"==typeof e.href)}async function we(e,t,n){return function(e,t){let n=new Set;return new Set(t),e.reduce(((e,t)=>{let r=JSON.stringify(function(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}(t));return n.has(r)||(n.add(r),e.push({key:r,link:t})),e}),[])}((await Promise.all(e.map((async e=>{let r=t.routes[e.route.id];if(r){let e=await async function(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(t){if(console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode&&import.meta.hot)throw t;return window.location.reload(),new Promise((()=>{}))}}(r,n);return e.links?e.links():[]}return[]})))).flat(1).filter(be).filter((e=>"stylesheet"===e.rel||"preload"===e.rel)).map((e=>"stylesheet"===e.rel?{...e,rel:"prefetch",as:"style"}:{...e,rel:"prefetch"})))}function Ee(e,t,n,r,a,o){let i=(e,t)=>!n[t]||e.route.id!==n[t].route.id,l=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith("*")&&n[t].params["*"]!==e.params["*"];return"assets"===o?t.filter(((e,t)=>i(e,t)||l(e,t))):"data"===o?t.filter(((t,o)=>{let u=r.routes[t.route.id];if(!u||!u.hasLoader)return!1;if(i(t,o)||l(t,o))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if("boolean"==typeof r)return r}return!0})):[]}function xe(e,t,{includeHydrateFallback:n}={}){return r=e.map((e=>{let r=t.routes[e.route.id];if(!r)return[];let a=[r.module];return r.clientActionModule&&(a=a.concat(r.clientActionModule)),r.clientLoaderModule&&(a=a.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(a=a.concat(r.hydrateFallbackModule)),r.imports&&(a=a.concat(r.imports)),a})).flat(1),[...new Set(r)];var r}function Ce(){let t=e.useContext(I);return ge(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}var Se=e.createContext(void 0);function Oe(){let t=e.useContext(Se);return ge(t,"You must render this element inside a <HydratedRouter> element"),t}function Re(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function $e({page:t,...n}){let{router:r}=Ce(),a=e.useMemo((()=>g(r.routes,t,r.basename)),[r.routes,t,r.basename]);return a?e.createElement(Pe,{page:t,matches:a,...n}):null}function Pe({page:t,matches:n,...r}){let a=G(),{manifest:o,routeModules:i}=Oe(),{basename:l}=Ce(),{loaderData:u,matches:s}=function(){let t=e.useContext(_);return ge(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}(),c=e.useMemo((()=>Ee(t,n,s,o,a,"data")),[t,n,s,o,a]),h=e.useMemo((()=>Ee(t,n,s,o,a,"assets")),[t,n,s,o,a]),m=e.useMemo((()=>{if(t===a.pathname+a.search+a.hash)return[];let e=new Set,r=!1;if(n.forEach((t=>{let n=o.routes[t.route.id];n&&n.hasLoader&&(!c.some((e=>e.route.id===t.route.id))&&t.route.id in u&&i[t.route.id]?.shouldRevalidate||n.hasClientLoader?r=!0:e.add(t.route.id))})),0===e.size)return[];let s=function(e,t){let n="string"==typeof e?new URL(e,"undefined"==typeof window?"server://singlefetch/":window.location.origin):e;return"/"===n.pathname?n.pathname="_root.data":t&&"/"===N(n.pathname,t)?n.pathname=`${t.replace(/\/$/,"")}/_root.data`:n.pathname=`${n.pathname.replace(/\/$/,"")}.data`,n}(t,l);return r&&e.size>0&&s.searchParams.set("_routes",n.filter((t=>e.has(t.route.id))).map((e=>e.route.id)).join(",")),[s.pathname+s.search]}),[l,u,a,o,c,n,t,i]),p=e.useMemo((()=>xe(h,o)),[h,o]),d=function(t){let{manifest:n,routeModules:r}=Oe(),[a,o]=e.useState([]);return e.useEffect((()=>{let e=!1;return we(t,n,r).then((t=>{e||o(t)})),()=>{e=!0}}),[t,n,r]),a}(h);return e.createElement(e.Fragment,null,m.map((t=>e.createElement("link",{key:t,rel:"prefetch",as:"fetch",href:t,...r}))),p.map((t=>e.createElement("link",{key:t,rel:"modulepreload",href:t,...r}))),d.map((({key:t,link:n})=>e.createElement("link",{key:t,...n}))))}function ke(...e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}}Se.displayName="FrameworkContext";var Me="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;try{Me&&(window.__reactRouterVersion="7.3.0")}catch(e){}function Le({basename:t,children:n,window:r}){let a=e.useRef();null==a.current&&(a.current=h({window:r,v5Compat:!0}));let o=a.current,[i,l]=e.useState({action:o.action,location:o.location}),u=e.useCallback((t=>{e.startTransition((()=>l(t)))}),[l]);return e.useLayoutEffect((()=>o.listen(u)),[o,u]),e.createElement(ce,{basename:t,children:n,location:i.location,navigationType:i.action,navigator:o})}var Ne=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Te=e.forwardRef((function({onClick:t,discover:n="render",prefetch:r="none",relative:a,reloadDocument:o,replace:i,state:l,target:u,to:s,preventScrollReset:c,viewTransition:h,...d},f){let y,{basename:g}=e.useContext(Y),b="string"==typeof s&&Ne.test(s),w=!1;if("string"==typeof s&&b&&(y=s,Me))try{let e=new URL(window.location.href),t=s.startsWith("//")?new URL(e.protocol+s):new URL(s),n=N(t.pathname,g);t.origin===e.origin&&null!=n?s=n+t.search+t.hash:w=!0}catch(e){p(!1,`<Link to="${s}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let E=function(t,{relative:n}={}){m(q(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:a}=e.useContext(Y),{hash:o,pathname:i,search:l}=ee(t,{relative:n}),u=i;return"/"!==r&&(u="/"===i?r:D([r,i])),a.createHref({pathname:u,search:l,hash:o})}(s,{relative:a}),[x,C,S]=function(t,n){let r=e.useContext(Se),[a,o]=e.useState(!1),[i,l]=e.useState(!1),{onFocus:u,onBlur:s,onMouseEnter:c,onMouseLeave:h,onTouchStart:m}=n,p=e.useRef(null);e.useEffect((()=>{if("render"===t&&l(!0),"viewport"===t){let e=new IntersectionObserver((e=>{e.forEach((e=>{l(e.isIntersecting)}))}),{threshold:.5});return p.current&&e.observe(p.current),()=>{e.disconnect()}}}),[t]),e.useEffect((()=>{if(a){let e=setTimeout((()=>{l(!0)}),100);return()=>{clearTimeout(e)}}}),[a]);let d=()=>{o(!0)},f=()=>{o(!1),l(!1)};return r?"intent"!==t?[i,p,{}]:[i,p,{onFocus:Re(u,d),onBlur:Re(s,f),onMouseEnter:Re(c,d),onMouseLeave:Re(h,f),onTouchStart:Re(m,d)}]:[!1,p,{}]}(r,d),O=function(t,{target:n,replace:r,state:a,preventScrollReset:o,relative:i,viewTransition:l}={}){let u=Z(),s=G(),c=ee(t,{relative:i});return e.useCallback((e=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(e,n)){e.preventDefault();let n=void 0!==r?r:v(s)===v(c);u(t,{replace:n,state:a,preventScrollReset:o,relative:i,viewTransition:l})}}),[s,u,c,r,a,n,t,o,i,l])}(s,{replace:i,state:l,target:u,preventScrollReset:c,relative:a,viewTransition:h});let R=e.createElement("a",{...d,...S,href:y||E,onClick:w||o?t:function(e){t&&t(e),e.defaultPrevented||O(e)},ref:ke(f,C),target:u,"data-discover":b||"render"!==n?void 0:"true"});return x&&!b?e.createElement(e.Fragment,null,R,e.createElement($e,{page:E})):R}));function je(t){let n=e.useContext(I);return m(n,function(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}(t)),n}Te.displayName="Link",e.forwardRef((function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:a=!1,style:o,to:i,viewTransition:l,children:u,...s},c){let h=ee(i,{relative:s.relative}),p=G(),d=e.useContext(_),{navigator:f,basename:v}=e.useContext(Y),y=null!=d&&function(t,n={}){let r=e.useContext(H);m(null!=r,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=je("useViewTransitionState"),o=ee(t,{relative:n.relative});if(!r.isTransitioning)return!1;let i=N(r.currentLocation.pathname,a)||r.currentLocation.pathname,l=N(r.nextLocation.pathname,a)||r.nextLocation.pathname;return null!=M(o.pathname,l)||null!=M(o.pathname,i)}(h)&&!0===l,g=f.encodeLocation?f.encodeLocation(h).pathname:h.pathname,b=p.pathname,w=d&&d.navigation&&d.navigation.location?d.navigation.location.pathname:null;n||(b=b.toLowerCase(),w=w?w.toLowerCase():null,g=g.toLowerCase()),w&&v&&(w=N(w,v)||w);const E="/"!==g&&g.endsWith("/")?g.length-1:g.length;let x,C=b===g||!a&&b.startsWith(g)&&"/"===b.charAt(E),S=null!=w&&(w===g||!a&&w.startsWith(g)&&"/"===w.charAt(g.length)),O={isActive:C,isPending:S,isTransitioning:y},R=C?t:void 0;x="function"==typeof r?r(O):[r,C?"active":null,S?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let $="function"==typeof o?o(O):o;return e.createElement(Te,{...s,"aria-current":R,className:x,ref:c,style:$,to:i,viewTransition:l},"function"==typeof u?u(O):u)})).displayName="NavLink",e.forwardRef((({discover:t="render",fetcherKey:n,navigate:r,reloadDocument:a,replace:o,state:i,method:l=he,action:u,onSubmit:s,relative:c,preventScrollReset:h,viewTransition:p,...d},f)=>{let y=function(){let{router:t}=je("useSubmit"),{basename:n}=e.useContext(Y),r=le("useRouteId");return e.useCallback((async(e,a={})=>{let{action:o,method:i,encType:l,formData:u,body:s}=ye(e,n);if(!1===a.navigate){let e=a.fetcherKey||De();await t.fetch(e,r,a.action||o,{preventScrollReset:a.preventScrollReset,formData:u,body:s,formMethod:a.method||i,formEncType:a.encType||l,flushSync:a.flushSync})}else await t.navigate(a.action||o,{preventScrollReset:a.preventScrollReset,formData:u,body:s,formMethod:a.method||i,formEncType:a.encType||l,replace:a.replace,state:a.state,fromRouteId:r,flushSync:a.flushSync,viewTransition:a.viewTransition})}),[t,n,r])}(),g=function(t,{relative:n}={}){let{basename:r}=e.useContext(Y),a=e.useContext(K);m(a,"useFormAction must be used inside a RouteContext");let[o]=a.matches.slice(-1),i={...ee(t||".",{relative:n})},l=G();if(null==t){i.search=l.search;let e=new URLSearchParams(i.search),t=e.getAll("index");if(t.some((e=>""===e))){e.delete("index"),t.filter((e=>e)).forEach((t=>e.append("index",t)));let n=e.toString();i.search=n?`?${n}`:""}}t&&"."!==t||!o.route.index||(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index");"/"!==r&&(i.pathname="/"===i.pathname?r:D([r,i.pathname]));return v(i)}(u,{relative:c}),b="get"===l.toLowerCase()?"get":"post",w="string"==typeof u&&Ne.test(u);return e.createElement("form",{ref:f,method:b,action:g,onSubmit:a?s:e=>{if(s&&s(e),e.defaultPrevented)return;e.preventDefault();let t=e.nativeEvent.submitter,a=t?.getAttribute("formmethod")||l;y(t||e.currentTarget,{fetcherKey:n,method:a,navigate:r,replace:o,state:i,relative:c,preventScrollReset:h,viewTransition:p})},...d,"data-discover":w||"render"!==t?void 0:"true"})})).displayName="Form";var Ae=0,De=()=>`__${String(++Ae)}__`;new TextEncoder;var Fe={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Ue=t.createContext&&t.createContext(Fe),We=["attr","size","title"];function Be(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function ze(){return ze=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ze.apply(this,arguments)}function Ie(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _e(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ie(Object(n),!0).forEach((function(t){He(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ie(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function He(e,t,n){var r;return(t="symbol"==typeof(r=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ye(e){return e&&e.map(((e,n)=>t.createElement(e.tag,_e({key:n},e.attr),Ye(e.child))))}function Je(e){return n=>t.createElement(Ke,ze({attr:_e({},e.attr)},n),Ye(e.child))}function Ke(e){var n=n=>{var r,{attr:a,size:o,title:i}=e,l=Be(e,We),u=o||n.size||"1em";return n.className&&(r=n.className),e.className&&(r=(r?r+" ":"")+e.className),t.createElement("svg",ze({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,a,l,{className:r,style:_e(_e({color:e.color||n.color},n.style),e.style),height:u,width:u,xmlns:"http://www.w3.org/2000/svg"}),i&&t.createElement("title",null,i),e.children)};return void 0!==Ue?t.createElement(Ue.Consumer,null,(e=>n(e))):n(Fe)}function Ve(e){return Je({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M143 352.3L7 216.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.2 9.4-24.4 9.4-33.8 0z"},child:[]}]})(e)}function qe(e){return Je({attr:{viewBox:"0 0 256 512"},child:[{tag:"path",attr:{d:"M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"},child:[]}]})(e)}var Ge=function(e){var r=e.menuData,a=e.textColor,o=void 0===a?"#fff":a,u=e.bgColor,s=void 0===u?"#222":u,c=e.hoverColor,h=void 0===c?"#FFD700":c,m=e.dropdownBgColor,p=void 0===m?"#333":m,d=e.dropdownTextColor,f=void 0===d?"#fff":d,v=e.onMenuClick,y=l(n({menu:null,subMenu:null,deepSubMenu:null}),2),g=y[0],b=y[1],w=Z(),E=function(e){e&&(w(e),v&&v(e))},x=function(e,t){return g[e]===t?h:"menu"===e?o:f};return t.createElement("nav",{className:"menu-bar",style:{backgroundColor:s}},t.createElement("ul",{className:"menu-list"},r.map((function(e){return t.createElement("li",{key:e.name,className:"menu-item",style:{color:x("menu",e.name)},onMouseEnter:function(){return b(i(i({},g),{},{menu:e.name}))},onMouseLeave:function(){return b(i(i({},g),{},{menu:null,subMenu:null,deepSubMenu:null}))},onClick:function(){return E(e.path)}},t.createElement("div",{className:"menu-title"},e.icon&&t.createElement("span",{className:"menu-icon",style:{color:x("menu",e.name)}},e.icon),e.name,e.subMenu&&t.createElement(Ve,{className:"arrow",style:{color:x("menu",e.name)}})),g.menu===e.name&&e.subMenu&&t.createElement("ul",{className:"dropdown",style:{backgroundColor:p}},e.subMenu.map((function(e){return t.createElement("li",{key:e.name,className:"submenu-item",style:{color:x("subMenu",e.name)},onMouseEnter:function(){return b(i(i({},g),{},{subMenu:e.name}))},onMouseLeave:function(){return b(i(i({},g),{},{subMenu:null,deepSubMenu:null}))},onClick:function(){return E(e.path)}},t.createElement("div",{className:"submenu-title"},e.icon&&t.createElement("span",{className:"submenu-icon",style:{color:x("subMenu",e.name)}},e.icon),e.name,e.subMenu&&t.createElement(qe,{className:"arrow-right",style:{color:x("subMenu",e.name)}})),g.subMenu===e.name&&e.subMenu&&t.createElement("ul",{className:"sub-dropdown",style:{backgroundColor:p}},e.subMenu.map((function(e){return t.createElement("li",{key:e.name,className:"deep-submenu-item",style:{color:x("deepSubMenu",e.name)},onMouseEnter:function(){return b(i(i({},g),{},{deepSubMenu:e.name}))},onMouseLeave:function(){return b(i(i({},g),{},{deepSubMenu:null}))},onClick:function(){return E(e.path)}},e.icon&&t.createElement("span",{className:"deep-submenu-icon",style:{color:x("deepSubMenu",e.name)}},e.icon),e.name)}))))}))))}))))},Xe=function(e){return t.createElement(Le,null,t.createElement(Ge,e))};export{Xe as default};
//# sourceMappingURL=index.js.map