{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nvar _excluded = [\"children\", \"label\", \"key\", \"collapsible\", \"onItemClick\", \"destroyInactivePanel\"];\nimport toArray from \"rc-util/es/Children/toArray\";\nimport React from 'react';\nimport CollapsePanel from \"../Panel\";\nvar convertItemsToNodes = function convertItemsToNodes(items, props) {\n var prefixCls = props.prefixCls,\n accordion = props.accordion,\n collapsible = props.collapsible,\n destroyInactivePanel = props.destroyInactivePanel,\n onItemClick = props.onItemClick,\n activeKey = props.activeKey,\n openMotion = props.openMotion,\n expandIcon = props.expandIcon;\n return items.map(function (item, index) {\n var children = item.children,\n label = item.label,\n rawKey = item.key,\n rawCollapsible = item.collapsible,\n rawOnItemClick = item.onItemClick,\n rawDestroyInactivePanel = item.destroyInactivePanel,\n restProps = _objectWithoutProperties(item, _excluded);\n\n // You may be puzzled why you want to convert them all into strings, me too.\n // Maybe: https://github.com/react-component/collapse/blob/aac303a8b6ff30e35060b4f8fecde6f4556fcbe2/src/Collapse.tsx#L15\n var key = String(rawKey !== null && rawKey !== void 0 ? rawKey : index);\n var mergeCollapsible = rawCollapsible !== null && rawCollapsible !== void 0 ? rawCollapsible : collapsible;\n var mergeDestroyInactivePanel = rawDestroyInactivePanel !== null && rawDestroyInactivePanel !== void 0 ? rawDestroyInactivePanel : destroyInactivePanel;\n var handleItemClick = function handleItemClick(value) {\n if (mergeCollapsible === 'disabled') return;\n onItemClick(value);\n rawOnItemClick === null || rawOnItemClick === void 0 || rawOnItemClick(value);\n };\n var isActive = false;\n if (accordion) {\n isActive = activeKey[0] === key;\n } else {\n isActive = activeKey.indexOf(key) > -1;\n }\n return /*#__PURE__*/React.createElement(CollapsePanel, _extends({}, restProps, {\n prefixCls: prefixCls,\n key: key,\n panelKey: key,\n isActive: isActive,\n accordion: accordion,\n openMotion: openMotion,\n expandIcon: expandIcon,\n header: label,\n collapsible: mergeCollapsible,\n onItemClick: handleItemClick,\n destroyInactivePanel: mergeDestroyInactivePanel\n }), children);\n });\n};\n\n/**\n * @deprecated The next major version will be removed\n */\nvar getNewChild = function getNewChild(child, index, props) {\n if (!child) return null;\n var prefixCls = props.prefixCls,\n accordion = props.accordion,\n collapsible = props.collapsible,\n destroyInactivePanel = props.destroyInactivePanel,\n onItemClick = props.onItemClick,\n activeKey = props.activeKey,\n openMotion = props.openMotion,\n expandIcon = props.expandIcon;\n var key = child.key || String(index);\n var _child$props = child.props,\n header = _child$props.header,\n headerClass = _child$props.headerClass,\n childDestroyInactivePanel = _child$props.destroyInactivePanel,\n childCollapsible = _child$props.collapsible,\n childOnItemClick = _child$props.onItemClick;\n var isActive = false;\n if (accordion) {\n isActive = activeKey[0] === key;\n } else {\n isActive = activeKey.indexOf(key) > -1;\n }\n var mergeCollapsible = childCollapsible !== null && childCollapsible !== void 0 ? childCollapsible : collapsible;\n var handleItemClick = function handleItemClick(value) {\n if (mergeCollapsible === 'disabled') return;\n onItemClick(value);\n childOnItemClick === null || childOnItemClick === void 0 || childOnItemClick(value);\n };\n var childProps = {\n key: key,\n panelKey: key,\n header: header,\n headerClass: headerClass,\n isActive: isActive,\n prefixCls: prefixCls,\n destroyInactivePanel: childDestroyInactivePanel !== null && childDestroyInactivePanel !== void 0 ? childDestroyInactivePanel : destroyInactivePanel,\n openMotion: openMotion,\n accordion: accordion,\n children: child.props.children,\n onItemClick: handleItemClick,\n expandIcon: expandIcon,\n collapsible: mergeCollapsible\n };\n\n // https://github.com/ant-design/ant-design/issues/20479\n if (typeof child.type === 'string') {\n return child;\n }\n Object.keys(childProps).forEach(function (propName) {\n if (typeof childProps[propName] === 'undefined') {\n delete childProps[propName];\n }\n });\n return /*#__PURE__*/React.cloneElement(child, childProps);\n};\nfunction useItems(items, rawChildren, props) {\n if (Array.isArray(items)) {\n return convertItemsToNodes(items, props);\n }\n return toArray(rawChildren).map(function (child, index) {\n return getNewChild(child, index, props);\n });\n}\nexport default useItems;","map":{"version":3,"names":["_extends","_objectWithoutProperties","_excluded","toArray","React","CollapsePanel","convertItemsToNodes","items","props","prefixCls","accordion","collapsible","destroyInactivePanel","onItemClick","activeKey","openMotion","expandIcon","map","item","index","children","label","rawKey","key","rawCollapsible","rawOnItemClick","rawDestroyInactivePanel","restProps","String","mergeCollapsible","mergeDestroyInactivePanel","handleItemClick","value","isActive","indexOf","createElement","panelKey","header","getNewChild","child","_child$props","headerClass","childDestroyInactivePanel","childCollapsible","childOnItemClick","childProps","type","Object","keys","forEach","propName","cloneElement","useItems","rawChildren","Array","isArray"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/rc-collapse/es/hooks/useItems.js"],"sourcesContent":["import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nvar _excluded = [\"children\", \"label\", \"key\", \"collapsible\", \"onItemClick\", \"destroyInactivePanel\"];\nimport toArray from \"rc-util/es/Children/toArray\";\nimport React from 'react';\nimport CollapsePanel from \"../Panel\";\nvar convertItemsToNodes = function convertItemsToNodes(items, props) {\n var prefixCls = props.prefixCls,\n accordion = props.accordion,\n collapsible = props.collapsible,\n destroyInactivePanel = props.destroyInactivePanel,\n onItemClick = props.onItemClick,\n activeKey = props.activeKey,\n openMotion = props.openMotion,\n expandIcon = props.expandIcon;\n return items.map(function (item, index) {\n var children = item.children,\n label = item.label,\n rawKey = item.key,\n rawCollapsible = item.collapsible,\n rawOnItemClick = item.onItemClick,\n rawDestroyInactivePanel = item.destroyInactivePanel,\n restProps = _objectWithoutProperties(item, _excluded);\n\n // You may be puzzled why you want to convert them all into strings, me too.\n // Maybe: https://github.com/react-component/collapse/blob/aac303a8b6ff30e35060b4f8fecde6f4556fcbe2/src/Collapse.tsx#L15\n var key = String(rawKey !== null && rawKey !== void 0 ? rawKey : index);\n var mergeCollapsible = rawCollapsible !== null && rawCollapsible !== void 0 ? rawCollapsible : collapsible;\n var mergeDestroyInactivePanel = rawDestroyInactivePanel !== null && rawDestroyInactivePanel !== void 0 ? rawDestroyInactivePanel : destroyInactivePanel;\n var handleItemClick = function handleItemClick(value) {\n if (mergeCollapsible === 'disabled') return;\n onItemClick(value);\n rawOnItemClick === null || rawOnItemClick === void 0 || rawOnItemClick(value);\n };\n var isActive = false;\n if (accordion) {\n isActive = activeKey[0] === key;\n } else {\n isActive = activeKey.indexOf(key) > -1;\n }\n return /*#__PURE__*/React.createElement(CollapsePanel, _extends({}, restProps, {\n prefixCls: prefixCls,\n key: key,\n panelKey: key,\n isActive: isActive,\n accordion: accordion,\n openMotion: openMotion,\n expandIcon: expandIcon,\n header: label,\n collapsible: mergeCollapsible,\n onItemClick: handleItemClick,\n destroyInactivePanel: mergeDestroyInactivePanel\n }), children);\n });\n};\n\n/**\n * @deprecated The next major version will be removed\n */\nvar getNewChild = function getNewChild(child, index, props) {\n if (!child) return null;\n var prefixCls = props.prefixCls,\n accordion = props.accordion,\n collapsible = props.collapsible,\n destroyInactivePanel = props.destroyInactivePanel,\n onItemClick = props.onItemClick,\n activeKey = props.activeKey,\n openMotion = props.openMotion,\n expandIcon = props.expandIcon;\n var key = child.key || String(index);\n var _child$props = child.props,\n header = _child$props.header,\n headerClass = _child$props.headerClass,\n childDestroyInactivePanel = _child$props.destroyInactivePanel,\n childCollapsible = _child$props.collapsible,\n childOnItemClick = _child$props.onItemClick;\n var isActive = false;\n if (accordion) {\n isActive = activeKey[0] === key;\n } else {\n isActive = activeKey.indexOf(key) > -1;\n }\n var mergeCollapsible = childCollapsible !== null && childCollapsible !== void 0 ? childCollapsible : collapsible;\n var handleItemClick = function handleItemClick(value) {\n if (mergeCollapsible === 'disabled') return;\n onItemClick(value);\n childOnItemClick === null || childOnItemClick === void 0 || childOnItemClick(value);\n };\n var childProps = {\n key: key,\n panelKey: key,\n header: header,\n headerClass: headerClass,\n isActive: isActive,\n prefixCls: prefixCls,\n destroyInactivePanel: childDestroyInactivePanel !== null && childDestroyInactivePanel !== void 0 ? childDestroyInactivePanel : destroyInactivePanel,\n openMotion: openMotion,\n accordion: accordion,\n children: child.props.children,\n onItemClick: handleItemClick,\n expandIcon: expandIcon,\n collapsible: mergeCollapsible\n };\n\n // https://github.com/ant-design/ant-design/issues/20479\n if (typeof child.type === 'string') {\n return child;\n }\n Object.keys(childProps).forEach(function (propName) {\n if (typeof childProps[propName] === 'undefined') {\n delete childProps[propName];\n }\n });\n return /*#__PURE__*/React.cloneElement(child, childProps);\n};\nfunction useItems(items, rawChildren, props) {\n if (Array.isArray(items)) {\n return convertItemsToNodes(items, props);\n }\n return toArray(rawChildren).map(function (child, index) {\n return getNewChild(child, index, props);\n });\n}\nexport default useItems;"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,oCAAoC;AACzD,OAAOC,wBAAwB,MAAM,oDAAoD;AACzF,IAAIC,SAAS,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,sBAAsB,CAAC;AAClG,OAAOC,OAAO,MAAM,6BAA6B;AACjD,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,aAAa,MAAM,UAAU;AACpC,IAAIC,mBAAmB,GAAG,SAASA,mBAAmBA,CAACC,KAAK,EAAEC,KAAK,EAAE;EACnE,IAAIC,SAAS,GAAGD,KAAK,CAACC,SAAS;IAC7BC,SAAS,GAAGF,KAAK,CAACE,SAAS;IAC3BC,WAAW,GAAGH,KAAK,CAACG,WAAW;IAC/BC,oBAAoB,GAAGJ,KAAK,CAACI,oBAAoB;IACjDC,WAAW,GAAGL,KAAK,CAACK,WAAW;IAC/BC,SAAS,GAAGN,KAAK,CAACM,SAAS;IAC3BC,UAAU,GAAGP,KAAK,CAACO,UAAU;IAC7BC,UAAU,GAAGR,KAAK,CAACQ,UAAU;EAC/B,OAAOT,KAAK,CAACU,GAAG,CAAC,UAAUC,IAAI,EAAEC,KAAK,EAAE;IACtC,IAAIC,QAAQ,GAAGF,IAAI,CAACE,QAAQ;MAC1BC,KA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