Files
ETB/ETB-FrontEnd/node_modules/.cache/babel-loader/a863fe8d708d19897c3ca5d5d5b555d39418fcaae5c382e5dfee54e36cd4e75b.json
Iliyan Angelov 306b20e24a Frontend start
2025-09-14 00:54:48 +03:00

1 line
9.3 KiB
JSON

{"ast":null,"code":"'use client';\n\nimport * as React from 'react';\nexport const CompoundComponentContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== 'production') {\n CompoundComponentContext.displayName = 'CompoundComponentContext';\n}\n/**\n * Sorts the subitems by their position in the DOM.\n */\nfunction sortSubitems(subitems) {\n const subitemsArray = Array.from(subitems.keys()).map(key => {\n const subitem = subitems.get(key);\n return {\n key,\n subitem\n };\n });\n subitemsArray.sort((a, b) => {\n const aNode = a.subitem.ref.current;\n const bNode = b.subitem.ref.current;\n if (aNode === null || bNode === null || aNode === bNode) {\n return 0;\n }\n\n // eslint-disable-next-line no-bitwise\n return aNode.compareDocumentPosition(bNode) & Node.DOCUMENT_POSITION_PRECEDING ? 1 : -1;\n });\n return new Map(subitemsArray.map(item => [item.key, item.subitem]));\n}\n\n/**\n * Provides a way for a component to know about its children.\n *\n * Child components register themselves with the `useCompoundItem` hook, passing in arbitrary metadata to the parent.\n *\n * This is a more powerful altervantive to `children` traversal, as child components don't have to be placed\n * directly inside the parent component. They can be anywhere in the tree (and even rendered by other components).\n *\n * The downside is that this doesn't work with SSR as it relies on the useEffect hook.\n *\n * @ignore - internal hook.\n */\nexport function useCompoundParent() {\n const [subitems, setSubitems] = React.useState(new Map());\n const subitemKeys = React.useRef(new Set());\n const deregisterItem = React.useCallback(function deregisterItem(id) {\n subitemKeys.current.delete(id);\n setSubitems(previousState => {\n const newState = new Map(previousState);\n newState.delete(id);\n return newState;\n });\n }, []);\n const registerItem = React.useCallback(function registerItem(id, item) {\n let providedOrGeneratedId;\n if (typeof id === 'function') {\n providedOrGeneratedId = id(subitemKeys.current);\n } else {\n providedOrGeneratedId = id;\n }\n subitemKeys.current.add(providedOrGeneratedId);\n setSubitems(previousState => {\n const newState = new Map(previousState);\n newState.set(providedOrGeneratedId, item);\n return newState;\n });\n return {\n id: providedOrGeneratedId,\n deregister: () => deregisterItem(providedOrGeneratedId)\n };\n }, [deregisterItem]);\n const sortedSubitems = React.useMemo(() => sortSubitems(subitems), [subitems]);\n const getItemIndex = React.useCallback(function getItemIndex(id) {\n return Array.from(sortedSubitems.keys()).indexOf(id);\n }, [sortedSubitems]);\n const contextValue = React.useMemo(() => ({\n getItemIndex,\n registerItem,\n totalSubitemCount: subitems.size\n }), [getItemIndex, registerItem, subitems.size]);\n return {\n contextValue,\n subitems: sortedSubitems\n };\n}","map":{"version":3,"names":["React","CompoundComponentContext","createContext","process","env","NODE_ENV","displayName","sortSubitems","subitems","subitemsArray","Array","from","keys","map","key","subitem","get","sort","a","b","aNode","ref","current","bNode","compareDocumentPosition","Node","DOCUMENT_POSITION_PRECEDING","Map","item","useCompoundParent","setSubitems","useState","subitemKeys","useRef","Set","deregisterItem","useCallback","id","delete","previousState","newState","registerItem","providedOrGeneratedId","add","set","deregister","sortedSubitems","useMemo","getItemIndex","indexOf","contextValue","totalSubitemCount","size"],"sources":["/home/gnx/Desktop/ETB/ETB-FrontEnd/node_modules/@mui/base/useCompound/useCompoundParent.js"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nexport const CompoundComponentContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== 'production') {\n CompoundComponentContext.displayName = 'CompoundComponentContext';\n}\n/**\n * Sorts the subitems by their position in the DOM.\n */\nfunction sortSubitems(subitems) {\n const subitemsArray = Array.from(subitems.keys()).map(key => {\n const subitem = subitems.get(key);\n return {\n key,\n subitem\n };\n });\n subitemsArray.sort((a, b) => {\n const aNode = a.subitem.ref.current;\n const bNode = b.subitem.ref.current;\n if (aNode === null || bNode === null || aNode === bNode) {\n return 0;\n }\n\n // eslint-disable-next-line no-bitwise\n return aNode.compareDocumentPosition(bNode) & Node.DOCUMENT_POSITION_PRECEDING ? 1 : -1;\n });\n return new Map(subitemsArray.map(item => [item.key, item.subitem]));\n}\n\n/**\n * Provides a way for a component to know about its children.\n *\n * Child components register themselves with the `useCompoundItem` hook, passing in arbitrary metadata to the parent.\n *\n * This is a more powerful altervantive to `children` traversal, as child components don't have to be placed\n * directly inside the parent component. They can be anywhere in the tree (and even rendered by other components).\n *\n * The downside is that this doesn't work with SSR as it relies on the useEffect hook.\n *\n * @ignore - internal hook.\n */\nexport function useCompoundParent() {\n const [subitems, setSubitems] = React.useState(new Map());\n const subitemKeys = React.useRef(new Set());\n const deregisterItem = React.useCallback(function deregisterItem(id) {\n subitemKeys.current.delete(id);\n setSubitems(previousState => {\n const newState = new Map(previousState);\n newState.delete(id);\n return newState;\n });\n }, []);\n const registerItem = React.useCallback(function registerItem(id, item) {\n let providedOrGeneratedId;\n if (typeof id === 'function') {\n providedOrGeneratedId = id(subitemKeys.current);\n } else {\n providedOrGeneratedId = id;\n }\n subitemKeys.current.add(providedOrGeneratedId);\n setSubitems(previousState => {\n const newState = new Map(previousState);\n newState.set(providedOrGeneratedId, item);\n return newState;\n });\n return {\n id: providedOrGeneratedId,\n deregister: () => deregisterItem(providedOrGeneratedId)\n };\n }, [deregisterItem]);\n const sortedSubitems = React.useMemo(() => sortSubitems(subitems), [subitems]);\n const getItemIndex = React.useCallback(function getItemIndex(id) {\n return Array.from(sortedSubitems.keys()).indexOf(id);\n }, [sortedSubitems]);\n const contextValue = React.useMemo(() => ({\n getItemIndex,\n registerItem,\n totalSubitemCount: subitems.size\n }), [getItemIndex, registerItem, subitems.size]);\n return {\n contextValue,\n subitems: sortedSubitems\n };\n}"],"mappings":"AAAA,YAAY;;AAEZ,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAO,MAAMC,wBAAwB,GAAG,aAAaD,KAAK,CAACE,aAAa,CAAC,IAAI,CAAC;AAC9E,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;EACzCJ,wBAAwB,CAACK,WAAW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