{"ast":null,"code":"import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { jsxs as _jsxs } from \"react/jsx-runtime\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport cn from 'classnames';\nimport BoxButton from 'components/gui/BoxButton';\nimport CustomBlockContent from 'components/gui/CustomBlockContent';\nimport useLocale from 'contexts/useLocale';\nimport styles from './HouseInfos.module.scss';\nimport HTMLReactParser from 'html-react-parser';\nimport Bubble from 'components/bubble/Bubble';\nimport Link from 'next/link';\nexport const HouseInfos = ({\n  house,\n  style,\n  className,\n  smaller,\n  narrow,\n  buttonLabel,\n  buttonHref,\n  buttonClassName,\n  renderTitle,\n  renderText,\n  white\n}) => {\n  const {\n    title,\n    status,\n    statusTextKey,\n    statusColor,\n    area,\n    surface,\n    canApply,\n    accommodations,\n    accommodationsCount,\n    availableCount,\n    fullHouse,\n    cheapest,\n    text,\n    open\n  } = house;\n  const locale = useLocale();\n  const accommodationsCountHtml = locale(`accommodations-count`, accommodationsCount).replace('#', `<span class='bold'>${accommodationsCount}</span>`);\n  const availableCountHtml = accommodations.length > 0 && (fullHouse ? `<span class='bold'>${locale(`house-full`)}.</span>` : locale(`available-accommodations`, availableCount).replace('#', `<span class='bold'>${availableCount}</span>`));\n  const cheapestHtml = !fullHouse && cheapest < 9999 && locale(`price-from`).replace('#', `<span class='bold'>${cheapest}€</span>`);\n  return /*#__PURE__*/_jsxs(\"div\", {\n    className: cn(styles.houseInfos, (smaller || narrow) && styles.smaller, className),\n    style: _objectSpread({}, style),\n    children: [/*#__PURE__*/_jsxs(\"div\", {\n      children: [/*#__PURE__*/_jsx(\"div\", {\n        className: cn(styles.houseInfosGrid),\n        children: renderTitle && /*#__PURE__*/_jsx(\"div\", {\n          style: {\n            flex: 1\n          },\n          children: smaller ? /*#__PURE__*/_jsx(Link, {\n            href: house.url,\n            as: house.url,\n            children: /*#__PURE__*/_jsx(\"a\", {\n              children: /*#__PURE__*/_jsx(\"h2\", {\n                className: cn(smaller ? 'h--3' : 'h--1', styles.title),\n                children: title\n              })\n            })\n          }) : /*#__PURE__*/_jsx(\"h2\", {\n            className: cn(smaller ? 'h--3' : 'h--1', styles.title),\n            children: title\n          })\n        })\n      }), /*#__PURE__*/_jsxs(\"div\", {\n        className: cn(styles.houseInfosGrid),\n        children: [/*#__PURE__*/_jsx(\"div\", {\n          style: {\n            flex: 1\n          },\n          children: area && area.split('\\n').map((line, i) => /*#__PURE__*/_jsx(\"p\", {\n            className: cn('p--m'),\n            children: line\n          }, i))\n        }), /*#__PURE__*/_jsxs(\"div\", {\n          style: {\n            flex: 0.7\n          },\n          children: [accommodationsCount > 0 && house.status == 'future-closed' && /*#__PURE__*/_jsx(\"p\", {\n            className: cn('p--m', 'bold'),\n            children: locale('soon')\n          }), accommodationsCount > 0 && /*#__PURE__*/_jsx(\"p\", {\n            className: cn('p--m'),\n            children: HTMLReactParser(accommodationsCountHtml)\n          }), availableCountHtml && /*#__PURE__*/_jsx(\"p\", {\n            className: cn('p--m'),\n            children: HTMLReactParser(availableCountHtml)\n          })]\n        })]\n      }), (!smaller || !fullHouse || !open) && /*#__PURE__*/_jsxs(\"div\", {\n        className: cn(styles.houseInfosGrid),\n        children: [surface && /*#__PURE__*/_jsxs(\"div\", {\n          style: {\n            flex: 1\n          },\n          children: [/*#__PURE__*/_jsx(\"p\", {\n            className: cn('p--m'),\n            children: locale('house-surface-area')\n          }), /*#__PURE__*/_jsx(\"p\", {\n            className: cn('p--m', 'bold'),\n            children: surface\n          })]\n        }), cheapestHtml && /*#__PURE__*/_jsx(\"div\", {\n          style: {\n            flex: 0.7\n          },\n          children: /*#__PURE__*/_jsx(\"p\", {\n            className: cn('p--m'),\n            children: HTMLReactParser(cheapestHtml)\n          })\n        })]\n      })]\n    }), renderText && text && /*#__PURE__*/_jsx(CustomBlockContent, {\n      className: cn('p--m', styles.text),\n      blocks: text\n    }), buttonLabel && /*#__PURE__*/_jsx(\"div\", {\n      children: /*#__PURE__*/_jsx(BoxButton, {\n        className: cn(styles.button, buttonClassName),\n        label: buttonLabel,\n        href: buttonHref,\n        fullWidth: true,\n        icon: \"right\",\n        white: white\n      })\n    })]\n  });\n};\nexport default HouseInfos;","map":null,"metadata":{},"sourceType":"module"}