"use strict"; exports.id = 424; exports.ids = [424]; exports.modules = { /***/ 424: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": () => (/* binding */ Breadcrumbs) /* harmony export */ }); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(997); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6689); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); // @ts-check /** * ============================================================================== * Imports * ============================================================================== */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** * ============================================================================== * Main Component { Functional } * ============================================================================== * @param {Object} props - Server props * @param {any} [props.confirmedDelegetedUser] * @param {any} [props.linksArray] * @param {import("@/package-shared/types").UserType} [props.user] */ function Breadcrumbs({ confirmedDelegetedUser , linksArray , user , }) { /** * Get Contexts * * @abstract { React.useContext } */ //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// /** * Javascript Variables * * @abstract Non hook variables and functions */ const isDelegated = confirmedDelegetedUser?.delegated; const isTableEditable = confirmedDelegetedUser?.priviledges?.match(/Edit Tables/i); const isTableDeletable = confirmedDelegetedUser?.priviledges?.match(/Delete Tables/i); const isTableCreatable = confirmedDelegetedUser?.priviledges?.match(/Create Tables/i); //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// /** * React Hooks * * @abstract { useState, useEffect, useRef, etc ... } */ /** @type {any} */ const linksState = react__WEBPACK_IMPORTED_MODULE_1___default().useState(linksArray ? linksArray : null); /** @type { [ links:any[], setLinks: React.Dispatch> ] } */ const [links, setLinks] = linksState; react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(()=>{ if (linksArray) return; let pathname = window.location.pathname; let pathLinks = pathname.split("/"); let validPathLinks = []; validPathLinks.push({ title: "Home", path: pathname.match(/admin/) ? "/admin" : "/" }); const isDelegated = window.location.search?.match(/delegated=true/); pathLinks.forEach((linkText, index, array)=>{ if (!linkText?.match(/./) || index == 1) { return; } if (linkText.match(/^\d+$/) && user) { // validPathLinks.push({ // title: user.first_name, // path: `/admin/${linkText}`, // }); return; } validPathLinks.push({ title: linkText, path: (()=>{ let path = ""; for(let i = 0; i < array.length; i++){ const lnText = array[i]; if (i > index || !lnText.match(/./)) continue; path += `/${lnText}`; } return path; })() }); }); setLinks(validPathLinks); }, []); //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// /** * Function Return * * @abstract Main Function Return */ if (!links || !links[1]) { return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx((react__WEBPACK_IMPORTED_MODULE_1___default().Fragment), {}); } return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", { className: "text-sm mt-2 flex-wrap", children: links.map((linkObject, index, array)=>{ if (index === links.length - 1) { return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("a", { href: linkObject.path, className: "text-slate-400 dark:text-slate-500 pointer-events-none", children: linkObject.title }, index); } else { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)((react__WEBPACK_IMPORTED_MODULE_1___default().Fragment), { children: [ /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("a", { href: linkObject.path, className: "query-url", children: linkObject.title }), /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", { className: "opacity-20", children: "|" }) ] }, index); } }) }); //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// } /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /***/ }) }; ;