{"ast":null,"code":"import React from 'react';\nimport useToken from '../../theme/useToken';\nimport { devUseWarning } from '../warning';\nimport zIndexContext from '../zindexContext';\n// Z-Index control range\n// Container: 1000 + offset 100 (max base + 10 * offset = 2000)\n// Popover: offset 50\n// Notification: Container Max zIndex + componentOffset\nconst CONTAINER_OFFSET = 100;\nconst CONTAINER_OFFSET_MAX_COUNT = 10;\nexport const CONTAINER_MAX_OFFSET = CONTAINER_OFFSET * CONTAINER_OFFSET_MAX_COUNT;\nexport const containerBaseZIndexOffset = {\n Modal: CONTAINER_OFFSET,\n Drawer: CONTAINER_OFFSET,\n Popover: CONTAINER_OFFSET,\n Popconfirm: CONTAINER_OFFSET,\n Tooltip: CONTAINER_OFFSET,\n Tour: CONTAINER_OFFSET\n};\nexport const consumerBaseZIndexOffset = {\n SelectLike: 50,\n Dropdown: 50,\n DatePicker: 50,\n Menu: 50,\n ImagePreview: 1\n};\nfunction isContainerType(type) {\n return type in containerBaseZIndexOffset;\n}\nexport function useZIndex(componentType, customZIndex) {\n const [, token] = useToken();\n const parentZIndex = React.useContext(zIndexContext);\n const isContainer = isContainerType(componentType);\n let result;\n if (customZIndex !== undefined) {\n result = [customZIndex, customZIndex];\n } else {\n let zIndex = parentZIndex !== null && parentZIndex !== void 0 ? parentZIndex : 0;\n if (isContainer) {\n zIndex +=\n // Use preset token zIndex by default but not stack when has parent container\n (parentZIndex ? 0 : token.zIndexPopupBase) +\n // Container offset\n containerBaseZIndexOffset[componentType];\n } else {\n zIndex += consumerBaseZIndexOffset[componentType];\n }\n result = [parentZIndex === undefined ? customZIndex : zIndex, zIndex];\n }\n if (process.env.NODE_ENV !== 'production') {\n const warning = devUseWarning(componentType);\n const maxZIndex = token.zIndexPopupBase + CONTAINER_MAX_OFFSET;\n const currentZIndex = result[0] || 0;\n process.env.NODE_ENV !== \"production\" ? warning(customZIndex !== undefined || currentZIndex <= maxZIndex, 'usage', '`zIndex` is over design token `zIndexPopupBase` too much. It may cause unexpected override.') : void 0;\n }\n return result;\n}","map":{"version":3,"names":["React","useToken","devUseWarning","zIndexContext","CONTAINER_OFFSET","CONTAINER_OFFSET_MAX_COUNT","CONTAINER_MAX_OFFSET","containerBaseZIndexOffset","Modal","Drawer","Popover","Popconfirm","Tooltip","Tour","consumerBaseZIndexOffset","SelectLike","Dropdown","DatePicker","Menu","ImagePreview","isContainerType","type","useZIndex","componentType","customZIndex","token","parentZIndex","useContext","isContainer","result","undefined","zIndex","zIndexPopupBase","process","env","NODE_ENV","warning","maxZIndex","currentZIndex"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/antd/es/_util/hooks/useZIndex.js"],"sourcesContent":["import React from 'react';\nimport useToken from '../../theme/useToken';\nimport { devUseWarning } from '../warning';\nimport zIndexContext from '../zindexContext';\n// Z-Index control range\n// Container: 1000 + offset 100 (max base + 10 * offset = 2000)\n// Popover: offset 50\n// Notification: Container Max zIndex + componentOffset\nconst CONTAINER_OFFSET = 100;\nconst CONTAINER_OFFSET_MAX_COUNT = 10;\nexport const CONTAINER_MAX_OFFSET = CONTAINER_OFFSET * CONTAINER_OFFSET_MAX_COUNT;\nexport const containerBaseZIndexOffset = {\n Modal: CONTAINER_OFFSET,\n Drawer: CONTAINER_OFFSET,\n Popover: CONTAINER_OFFSET,\n Popconfirm: CONTAINER_OFFSET,\n Tooltip: CONTAINER_OFFSET,\n Tour: CONTAINER_OFFSET\n};\nexport const consumerBaseZIndexOffset = {\n SelectLike: 50,\n Dropdown: 50,\n DatePicker: 50,\n Menu: 50,\n ImagePreview: 1\n};\nfunction isContainerType(type) {\n return type in containerBaseZIndexOffset;\n}\nexport function useZIndex(componentType, customZIndex) {\n const [, token] = useToken();\n const parentZIndex = React.useContext(zIndexContext);\n const isContainer = isContainerType(componentType);\n let result;\n if (customZIndex !== undefined) {\n result = [customZIndex, customZIndex];\n } else {\n let zIndex = parentZIndex !== null && parentZIndex !== void 0 ? parentZIndex : 0;\n if (isContainer) {\n zIndex +=\n // Use preset token zIndex by default but not stack when has parent container\n (parentZIndex ? 0 : token.zIndexPopupBase) +\n // Container offset\n containerBaseZIndexOffset[componentType];\n } else {\n zIndex += consumerBaseZIndexOffset[componentType];\n }\n result = [parentZIndex === undefined ? customZIndex : zIndex, zIndex];\n }\n if (process.env.NODE_ENV !== 'production') {\n const warning = devUseWarning(componentType);\n const maxZIndex = token.zIndexPopupBase + CONTAINER_MAX_OFFSET;\n const currentZIndex = result[0] || 0;\n process.env.NODE_ENV !== \"production\" ? warning(customZIndex !== undefined || currentZIndex <= maxZIndex, 'usage', '`zIndex` is over design token `zIndexPopupBase` too much. It may cause unexpected override.') : void 0;\n }\n return result;\n}"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,QAAQ,MAAM,sBAAsB;AAC3C,SAASC,aAAa,QAAQ,YAAY;AAC1C,OAAOC,aAAa,MAAM,kBAAkB;AAC5C;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG,GAAG;AAC5B,MAAMC,0BAA0B,GAAG,EAAE;AACrC,OAAO,MAAMC,oBAAoB,GAAGF,gBAAgB,GAAGC,0BAA0B;AACjF,OAAO,MAAME,yBAAyB,GAAG;EACvCC,KAAK,EAAEJ,gBAAgB;EACvBK,MAAM,EAAEL,gBAAgB;EACxBM,OAAO,EAAEN,gBAAgB;EACzBO,UAAU,EAAEP,gBAAgB;EAC5BQ,OAAO,EAAER,gBAAgB;EACzBS,IAAI,EAAET;AACR,CAAC;AACD,OAAO,MAAMU,wBAAwB,GAAG;EACtCC,UAAU,EAAE,EAAE;EACdC,QAAQ,EAAE,EAAE;EACZC,UAAU,EAAE,EAAE;EACdC,IAAI,EAAE,EAAE;EACRC,YAAY,EAAE;AAChB,CAAC;AACD,SAASC,eAAeA,CAACC,IAAI,EAAE;EAC7B,OAAOA,IAAI,IAAId,yBAAyB;AAC1C;AACA,OAAO,SAASe,SAASA,CAACC,aAAa,EAAEC,YAAY,EAAE;EACrD,MAAM,GAAGC,KAAK,CAAC,GAAGxB,QA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