{"version":3,"file":"index.Bj1vtew5.js","sources":["../../../../../../../node_modules/@babylon/ui-kit-forms/components/inputs/accommodation/hooks/useFormAccommodationWithDiscounts.js","../../../../../../../node_modules/@babylon/ui-kit-forms/components/inputs/accommodation/variants/with-discounts/components/discount/views/desktop/index.js","../../../../../../../node_modules/@babylon/ui-kit-forms/components/inputs/accommodation/variants/with-discounts/views/desktop/index.js"],"sourcesContent":["import { useInput } from '../../../../hooks/useInput/index.js';\n\nconst useFormAccommodationWithDiscounts = (props)=>{\n const { isHiddenRequired: _isHiddenRequired, ...rest } = props;\n const { field, label, error, hasError } = useInput(props);\n const { field: discountField, error: discountError, hasError: discountHasError } = useInput(props.discount);\n const { field: residentField, error: residentError, hasError: residentHasError } = useInput(props.resident);\n return {\n ...rest,\n ...field,\n discount: discountField,\n resident: residentField,\n label: label,\n hasError: hasError || discountHasError || residentHasError,\n error: error ?? discountError ?? residentError\n };\n};\n\nexport { useFormAccommodationWithDiscounts as default };\n","import { jsxs, jsx } from 'react/jsx-runtime';\nimport { DiscountWrapper, DiscountBody, ContainerSelect, DiscountSelect } from './styled.js';\n\nconst DiscountDesktop = ({ title, discount, resident, discounts, residents })=>{\n const discountLength = discounts && discounts.items?.length && discounts.items.length > 1;\n const residentsLength = residents && residents.items?.length && residents.items.length > 1;\n if (!discountLength && !residentsLength) return null;\n return /*#__PURE__*/ jsxs(DiscountWrapper, {\n \"data-testid\": \"Discount\",\n children: [\n /*#__PURE__*/ jsx(\"p\", {\n children: title\n }),\n /*#__PURE__*/ jsxs(DiscountBody, {\n children: [\n discounts && discount && discounts.items?.length && discounts.items.length > 1 && /*#__PURE__*/ jsx(ContainerSelect, {\n children: /*#__PURE__*/ jsx(DiscountSelect, {\n ref: discount.ref,\n onBlur: discount.onBlur,\n value: discount.value,\n onChange: discount.onChange,\n placeholder: discounts.label,\n options: discounts.items\n })\n }),\n residents && resident && residents.items?.length && residents.items.length > 1 && /*#__PURE__*/ jsx(ContainerSelect, {\n children: /*#__PURE__*/ jsx(DiscountSelect, {\n ref: resident.ref,\n onBlur: resident.onBlur,\n value: resident.value,\n onChange: resident.onChange,\n placeholder: residents.label,\n options: residents.items\n })\n })\n ]\n })\n ]\n });\n};\n\nexport { DiscountDesktop as default };\n","import { jsxs, jsx, Fragment } from 'react/jsx-runtime';\nimport PanelAccommodationDesktop from '../../../../components/panel-accommodation/views/desktop/index.js';\nimport InputPanelDesktop from '../../../../../../others/input-panel/views/desktop/index.js';\nimport { forwardRef, useMemo } from 'react';\nimport AddRoom from '../../../../components/add-room/index.js';\nimport PanelErrorDesktop from '../../../../components/panel-accommodation/components/panel-error/views/desktop/index.js';\nimport useAccommodation from '../../../../hooks/useAccommodation.js';\nimport useFormAccommodationWithDiscounts from '../../../../hooks/useFormAccommodationWithDiscounts.js';\nimport DiscountDesktop from '../../components/discount/views/desktop/index.js';\nimport { Header, InputPanelFooter, AccomodationWithDiscounts } from './styled.js';\n\nconst AccommodationWithDiscountsDesktop = /*#__PURE__*/ forwardRef((props, ref)=>{\n const { literals, discount, discounts, resident, residents, tooltipOptions, disableAges = false } = props;\n const { addRoom = '', accommodationTitle = '', discountTitle = '', accommodationLabel = '' } = literals ?? {};\n const { inputProps, panelRooms, config, people, goToLast, hasError, error, onAddRoom, onChangeRooms, renderFooter } = useAccommodation(props);\n const hasDiscounts = !!(discount && discounts) || !!(resident && residents);\n const headerTitle = accommodationTitle || accommodationLabel;\n const panel = useMemo(()=>({\n header: /*#__PURE__*/ jsxs(Header, {\n children: [\n headerTitle && /*#__PURE__*/ jsx(\"p\", {\n children: headerTitle\n }),\n /*#__PURE__*/ jsx(AddRoom, {\n addRoom: addRoom,\n onAddRoom: onAddRoom,\n hasError: hasError\n })\n ]\n }),\n content: /*#__PURE__*/ jsx(PanelAccommodationDesktop, {\n config: config,\n onChange: onChangeRooms,\n people: people,\n rooms: panelRooms,\n error: error,\n goToLast: goToLast,\n disableAges: disableAges\n }),\n footer: (renderProps)=>/*#__PURE__*/ jsxs(Fragment, {\n children: [\n (hasDiscounts || error) && /*#__PURE__*/ jsxs(InputPanelFooter, {\n children: [\n error && /*#__PURE__*/ jsx(PanelErrorDesktop, {\n error: error\n }),\n hasDiscounts && /*#__PURE__*/ jsx(DiscountDesktop, {\n title: discountTitle,\n discount: discount,\n resident: resident,\n discounts: discounts,\n residents: residents\n })\n ]\n }),\n literals?.accept ? renderFooter(renderProps) : undefined\n ]\n })\n }), [\n addRoom,\n config,\n disableAges,\n discount,\n discountTitle,\n discounts,\n error,\n goToLast,\n hasDiscounts,\n hasError,\n headerTitle,\n literals?.accept,\n onAddRoom,\n onChangeRooms,\n panelRooms,\n people,\n renderFooter,\n resident,\n residents\n ]);\n const tooltipProps = useMemo(()=>({\n options: tooltipOptions\n }), [\n tooltipOptions\n ]);\n return /*#__PURE__*/ jsx(AccomodationWithDiscounts, {\n \"data-testid\": \"AccommodationWithDiscounts\",\n children: /*#__PURE__*/ jsx(InputPanelDesktop, {\n ref: ref,\n inputProps: inputProps,\n footerVariant: \"noStyle\",\n panel: panel,\n tooltipProps: tooltipProps\n })\n });\n});\nAccommodationWithDiscountsDesktop.displayName = 'AccommodationWithDiscountsDesktop';\nconst FormAccommodationWithDiscountsDesktop = (props)=>{\n const finalProps = useFormAccommodationWithDiscounts(props);\n return /*#__PURE__*/ jsx(AccommodationWithDiscountsDesktop, {\n ...finalProps\n });\n};\n\nexport { FormAccommodationWithDiscountsDesktop, AccommodationWithDiscountsDesktop as default };\n"],"names":["useFormAccommodationWithDiscounts","props","_isHiddenRequired","rest","field","label","error","hasError","useInput","discountField","discountError","discountHasError","residentField","residentError","residentHasError","DiscountDesktop","title","discount","resident","discounts","residents","discountLength","_a","residentsLength","_b","jsxs","DiscountWrapper","jsx","DiscountBody","_c","ContainerSelect","DiscountSelect","_d","AccommodationWithDiscountsDesktop","forwardRef","ref","literals","tooltipOptions","disableAges","addRoom","accommodationTitle","discountTitle","accommodationLabel","inputProps","panelRooms","config","people","goToLast","onAddRoom","onChangeRooms","renderFooter","useAccommodation","hasDiscounts","headerTitle","panel","useMemo","Header","AddRoom","PanelAccommodationDesktop","renderProps","Fragment","InputPanelFooter","PanelErrorDesktop","tooltipProps","AccomodationWithDiscounts","InputPanelDesktop","FormAccommodationWithDiscountsDesktop","finalProps"],"mappings":"qLAEK,MAACA,EAAqCC,GAAQ,CAC/C,KAAM,CAAE,iBAAkBC,EAAmB,GAAGC,CAAI,EAAKF,EACnD,CAAE,MAAAG,EAAO,MAAAC,EAAO,MAAAC,EAAO,SAAAC,GAAaC,EAASP,CAAK,EAClD,CAAE,MAAOQ,EAAe,MAAOC,EAAe,SAAUC,GAAqBH,EAASP,EAAM,QAAQ,EACpG,CAAE,MAAOW,EAAe,MAAOC,EAAe,SAAUC,GAAqBN,EAASP,EAAM,QAAQ,EAC1G,MAAO,CACH,GAAGE,EACH,GAAGC,EACH,SAAUK,EACV,SAAUG,EACV,MAAOP,EACP,SAAUE,GAAYI,GAAoBG,EAC1C,MAAOR,GAASI,GAAiBG,CACzC,CACA,ECbME,EAAkB,CAAC,CAAE,MAAAC,EAAO,SAAAC,EAAU,SAAAC,EAAU,UAAAC,EAAW,UAAAC,KAAc,aAC3E,MAAMC,EAAiBF,KAAaG,EAAAH,EAAU,QAAV,YAAAG,EAAiB,SAAUH,EAAU,MAAM,OAAS,EAClFI,EAAkBH,KAAaI,EAAAJ,EAAU,QAAV,YAAAI,EAAiB,SAAUJ,EAAU,MAAM,OAAS,EACzF,MAAI,CAACC,GAAkB,CAACE,EAAwB,KAC3BE,EAAAA,KAAKC,EAAiB,CACvC,cAAe,WACf,SAAU,CACQC,EAAAA,IAAI,IAAK,CACnB,SAAUX,CAC1B,CAAa,EACaS,EAAAA,KAAKG,EAAc,CAC7B,SAAU,CACNT,GAAaF,KAAYY,EAAAV,EAAU,QAAV,YAAAU,EAAiB,SAAUV,EAAU,MAAM,OAAS,GAAmBQ,EAAAA,IAAIG,EAAiB,CACjH,SAAwBH,EAAG,IAACI,EAAgB,CACxC,IAAKd,EA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