@redneckz/wildless-cms-uni-blocks 0.2.86 → 0.2.89

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +512 -449
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/dist/components/Accordion/AccordionBlocks.d.ts +3 -0
  5. package/dist/components/Accordion/AccordionBlocks.js +6 -0
  6. package/dist/components/Accordion/AccordionBlocks.js.map +1 -1
  7. package/dist/components/Accordion/AccordionContent.d.ts +14 -6
  8. package/dist/components/BaseTile/BaseTile.js +14 -6
  9. package/dist/components/BaseTile/BaseTile.js.map +1 -1
  10. package/dist/components/BaseTile/BaseTileProps.d.ts +10 -0
  11. package/dist/components/BenefitsBlock/BenefitsBlockContent.d.ts +1 -1
  12. package/dist/components/BlockContent.d.ts +3 -1
  13. package/dist/components/Blocks.d.ts +17 -14
  14. package/dist/components/Blocks.js +23 -17
  15. package/dist/components/Blocks.js.map +1 -1
  16. package/dist/components/Headline/Headline.d.ts +5 -0
  17. package/dist/components/Headline/Headline.js +9 -0
  18. package/dist/components/Headline/Headline.js.map +1 -0
  19. package/dist/components/Headline/HeadlineContent.d.ts +15 -0
  20. package/dist/components/Headline/HeadlineContent.js +2 -0
  21. package/dist/components/Headline/HeadlineContent.js.map +1 -0
  22. package/dist/components/LinkDocs/LinkDocs.d.ts +5 -0
  23. package/dist/components/LinkDocs/LinkDocs.js +42 -0
  24. package/dist/components/LinkDocs/LinkDocs.js.map +1 -0
  25. package/dist/components/LinkDocs/LinkDocsContent.d.ts +23 -0
  26. package/dist/components/LinkDocs/LinkDocsContent.js +2 -0
  27. package/dist/components/LinkDocs/LinkDocsContent.js.map +1 -0
  28. package/dist/components/MobileAppTile/MobileAppTileContent.d.ts +1 -3
  29. package/dist/components/MobileBlocks.d.ts +8 -6
  30. package/dist/components/MobileBlocks.js +10 -6
  31. package/dist/components/MobileBlocks.js.map +1 -1
  32. package/dist/components/PictureText/PictureText.d.ts +5 -0
  33. package/dist/components/PictureText/PictureText.js +14 -0
  34. package/dist/components/PictureText/PictureText.js.map +1 -0
  35. package/dist/components/PictureText/PictureTextContent.d.ts +11 -0
  36. package/dist/components/PictureText/PictureTextContent.js +2 -0
  37. package/dist/components/PictureText/PictureTextContent.js.map +1 -0
  38. package/dist/components/ProductGallery/ProductGalleryContent.d.ts +2 -2
  39. package/dist/ui-kit/Button/ButtonProps.d.ts +2 -1
  40. package/dist/ui-kit/Icon/IconProps.d.ts +22 -18
  41. package/dist/ui-kit/Icon/IconProps.js +20 -18
  42. package/dist/ui-kit/Icon/IconProps.js.map +1 -1
  43. package/lib/common.css +1 -1
  44. package/lib/components/Accordion/Accordion.fixture.d.ts +1 -0
  45. package/lib/components/Accordion/AccordionBlocks.d.ts +3 -0
  46. package/lib/components/Accordion/AccordionBlocks.js +6 -0
  47. package/lib/components/Accordion/AccordionBlocks.js.map +1 -1
  48. package/lib/components/Accordion/AccordionContent.d.ts +14 -6
  49. package/lib/components/BaseTile/BaseTile.js +14 -6
  50. package/lib/components/BaseTile/BaseTile.js.map +1 -1
  51. package/lib/components/BaseTile/BaseTileProps.d.ts +10 -0
  52. package/lib/components/BenefitsBlock/BenefitsBlockContent.d.ts +1 -1
  53. package/lib/components/BlockContent.d.ts +3 -1
  54. package/lib/components/Blocks.d.ts +17 -14
  55. package/lib/components/Blocks.js +23 -17
  56. package/lib/components/Blocks.js.map +1 -1
  57. package/lib/components/Headline/Headline.d.ts +5 -0
  58. package/lib/components/Headline/Headline.fixture.d.ts +7 -0
  59. package/lib/components/Headline/Headline.js +7 -0
  60. package/lib/components/Headline/Headline.js.map +1 -0
  61. package/lib/components/Headline/HeadlineContent.d.ts +15 -0
  62. package/lib/components/Headline/HeadlineContent.js +2 -0
  63. package/lib/components/Headline/HeadlineContent.js.map +1 -0
  64. package/lib/components/LinkDocs/LinkDocs.d.ts +5 -0
  65. package/lib/components/LinkDocs/LinkDocs.fixture.d.ts +12 -0
  66. package/lib/components/LinkDocs/LinkDocs.js +40 -0
  67. package/lib/components/LinkDocs/LinkDocs.js.map +1 -0
  68. package/lib/components/LinkDocs/LinkDocsContent.d.ts +23 -0
  69. package/lib/components/LinkDocs/LinkDocsContent.js +2 -0
  70. package/lib/components/LinkDocs/LinkDocsContent.js.map +1 -0
  71. package/lib/components/MobileAppTile/MobileAppTileContent.d.ts +1 -3
  72. package/lib/components/MobileBlocks.d.ts +8 -6
  73. package/lib/components/MobileBlocks.js +10 -6
  74. package/lib/components/MobileBlocks.js.map +1 -1
  75. package/lib/components/PictureText/PictureText.d.ts +5 -0
  76. package/lib/components/PictureText/PictureText.fixture.d.ts +4 -0
  77. package/lib/components/PictureText/PictureText.js +12 -0
  78. package/lib/components/PictureText/PictureText.js.map +1 -0
  79. package/lib/components/PictureText/PictureTextContent.d.ts +11 -0
  80. package/lib/components/PictureText/PictureTextContent.js +2 -0
  81. package/lib/components/PictureText/PictureTextContent.js.map +1 -0
  82. package/lib/components/ProductGallery/ProductGalleryContent.d.ts +2 -2
  83. package/lib/ui-kit/Button/ButtonProps.d.ts +2 -1
  84. package/lib/ui-kit/Icon/IconProps.d.ts +22 -18
  85. package/lib/ui-kit/Icon/IconProps.js +20 -18
  86. package/lib/ui-kit/Icon/IconProps.js.map +1 -1
  87. package/package.json +1 -1
  88. package/src/components/Accordion/Accordion.fixture.tsx +104 -3
  89. package/src/components/Accordion/AccordionBlocks.tsx +6 -0
  90. package/src/components/Accordion/AccordionContent.ts +18 -6
  91. package/src/components/BaseTile/BaseTile.tsx +24 -15
  92. package/src/components/BaseTile/BaseTileProps.ts +11 -0
  93. package/src/components/BenefitsBlock/BenefitsBlockContent.ts +1 -1
  94. package/src/components/BlockContent.ts +15 -11
  95. package/src/components/Blocks.ts +23 -17
  96. package/src/components/ContentPage/ContentPage.page.json +88 -2
  97. package/src/components/Headline/Headline.example.json +6 -0
  98. package/src/components/Headline/Headline.fixture.tsx +42 -0
  99. package/src/components/Headline/Headline.tsx +15 -0
  100. package/src/components/Headline/HeadlineContent.ts +18 -0
  101. package/src/components/LinkDocs/LinkDocs.fixture.tsx +51 -0
  102. package/src/components/LinkDocs/LinkDocs.tsx +81 -0
  103. package/src/components/LinkDocs/LinkDocsContent.ts +26 -0
  104. package/src/components/MobileAppTile/MobileAppTileContent.ts +1 -3
  105. package/src/components/MobileBlocks.ts +10 -6
  106. package/src/components/PictureText/PictureText.example.json +20 -0
  107. package/src/components/PictureText/PictureText.fixture.tsx +36 -0
  108. package/src/components/PictureText/PictureText.tsx +45 -0
  109. package/src/components/PictureText/PictureTextContent.ts +13 -0
  110. package/src/components/ProductGallery/ProductGalleryContent.ts +2 -2
  111. package/src/icons/DiscountShape.svg +7 -0
  112. package/src/icons/DocIcon.svg +1 -1
  113. package/src/icons/DocumentText.svg +6 -0
  114. package/src/ui-kit/Button/ButtonProps.ts +2 -1
  115. package/src/ui-kit/Icon/IconProps.ts +4 -0
  116. package/src/icons/MinusIcon.svg +0 -1
  117. package/src/icons/PlusIcon.svg +0 -1
@@ -185,6 +185,20 @@
185
185
  };
186
186
  }
187
187
 
188
+ var SizeTableClass;
189
+ (function (SizeTableClass) {
190
+ SizeTableClass["XL"] = "text-title-lg";
191
+ SizeTableClass["L"] = "text-title";
192
+ SizeTableClass["M"] = "text-title-sm";
193
+ SizeTableClass["S"] = "text-title-xs";
194
+ })(SizeTableClass || (SizeTableClass = {}));
195
+
196
+ const Title = JSX(({ size = 'L', className, children, ...rest }) => {
197
+ const Tag = size === 'XL' ? 'h1' : 'h2';
198
+ return (jsx(Tag, { className: getClasses(SizeTableClass[size], className), ...rest, children: children }));
199
+ });
200
+ const getClasses = (...classes) => classes.filter(Boolean).join(' ');
201
+
188
202
  const projectSettings = new (class {
189
203
  _ = {
190
204
  PROD_BRANCH: 'master',
@@ -224,27 +238,6 @@
224
238
  return (jsx("img", { className: className, src: href, alt: alt, title: title, ...imgProps, "aria-hidden": "true" }));
225
239
  });
226
240
 
227
- var SizeTableClass;
228
- (function (SizeTableClass) {
229
- SizeTableClass["XL"] = "text-title-lg";
230
- SizeTableClass["L"] = "text-title";
231
- SizeTableClass["M"] = "text-title-sm";
232
- SizeTableClass["S"] = "text-title-xs";
233
- })(SizeTableClass || (SizeTableClass = {}));
234
-
235
- const Title = JSX(({ size = 'L', className, children, ...rest }) => {
236
- const Tag = size === 'XL' ? 'h1' : 'h2';
237
- return (jsx(Tag, { className: getClasses(SizeTableClass[size], className), ...rest, children: children }));
238
- });
239
- const getClasses = (...classes) => classes.filter(Boolean).join(' ');
240
-
241
- const BenefitsBlock = JSX(({ className, title, benefits }) => {
242
- return (jsxs("section", { className: `font-sans text-primary-text bg-white p-12 pb-2 flex flex-col items-center ${className || ''}`, children: [title ? jsx(Title, { className: "font-medium m-0 max-w-[47rem] text-center", children: title }) : null, benefits?.length ? (jsx("div", { className: "grid grid-cols-2 gap-5 mt-9", children: benefits.map(renderStep) })) : null] }));
243
- });
244
- const renderStep = (benefit, i) => {
245
- return (jsxs("div", { className: "flex items-center p-10 gap-5 max-w-[580px]", children: [benefit.icon && (jsx(Icon, { className: "h-[70px] w-[70px] min-w-[70px] min-h-[70px]", name: benefit.icon, width: "70", height: "70" })), jsxs("div", { children: [jsx("h3", { className: "font-medium text-xl m-0", children: benefit.label }), benefit.description && (jsx("div", { className: "font-normal text-sm mt-2", children: benefit.description }))] })] }, String(i)));
246
- };
247
-
248
241
  const MOBILE_URL_PATH = '/mobile';
249
242
  const isURL = (href) => href?.includes('//');
250
243
  const isHrefActive = (href, router, cmp = (href, baseHref) => href === baseHref) => {
@@ -355,11 +348,21 @@
355
348
  return colSpanStr ? parseInt(colSpanStr.substring(colSpanPrefix.length), 10) : 12;
356
349
  };
357
350
 
351
+ const alignBlock = {
352
+ left: 'items-start',
353
+ center: 'items-center',
354
+ right: 'items-end',
355
+ };
356
+ const alignText = {
357
+ left: 'text-left',
358
+ center: 'text-center',
359
+ right: 'text-right',
360
+ };
358
361
  const TITLE_CLASSES = 'font-medium m-0 mb-4 whitespace-pre-wrap max-w-[600px]';
359
- const BaseTile = JSX(({ className, context, title, titleSize, description, children, buttons, image, items, version = 'primary', }) => {
362
+ const BaseTile = JSX(({ className, context, title, titleSize, description, children, buttons, image, items, version = 'primary', align = 'left', }) => {
360
363
  const router = context.useRouter();
361
364
  const { handlerDecorator } = context;
362
- return (jsxs("div", { className: `font-sans flex flex-col grow h-full`, children: [title && (jsx(Title, { size: titleSize || getTitleSizeByClassName(className), className: TITLE_CLASSES, children: title })), jsxs("div", { className: "flex grow justify-between", children: [jsxs("div", { className: "flex flex-col justify-between items-start", children: [jsxs("div", { children: [description ? (jsx("div", { className: "font-normal text-base max-w-[600px] mb-5", children: description })) : null, children, items?.length ? renderItems$1(items, version) : null] }), buttons?.length ? (jsx("div", { className: "flex mt-9 gap-3", children: buttons.map((button, index) => renderButton$1(useLink({ router, handlerDecorator }, button), index)) })) : null] }), image?.src && jsx(Img, { className: "mt-auto ml-7", image: image })] })] }));
365
+ return (jsxs("div", { className: `font-sans flex flex-col grow h-full ${alignBlock[align]}`, children: [title && (jsx(Title, { size: titleSize || getTitleSizeByClassName(className), className: TITLE_CLASSES, children: title })), jsxs("div", { className: "flex grow justify-between", children: [jsxs("div", { className: `flex flex-col justify-between ${alignBlock[align]}`, children: [jsxs("div", { children: [description ? (jsx("div", { className: `font-normal text-base max-w-[600px] ${alignText[align]}`, children: description })) : null, children, items?.length ? renderItems$1(items, version) : null] }), buttons?.length ? (jsx("div", { className: "flex mt-9 gap-3", children: buttons.map((button, index) => renderButton$1(useLink({ router, handlerDecorator }, button), index)) })) : null] }), image?.src && jsx(Img, { className: "mt-auto ml-7", image: image })] })] }));
363
366
  });
364
367
  function getTitleSizeByClassName(className = '') {
365
368
  const colSpan = getColSpan(className);
@@ -374,189 +377,137 @@
374
377
  }
375
378
  }
376
379
  function renderItems$1(items = [], version) {
377
- return (jsx("section", { className: "max-w-[600px]", role: "list", children: items.map((_, i) => (jsx(BlockItem, { className: i ? 'mt-2.5' : '', text: _, version: version }, String(i)))) }));
380
+ return (jsx("section", { className: "max-w-[600px] mt-5", role: "list", children: items.map((_, i) => (jsx(BlockItem, { className: i ? 'mt-2.5' : '', text: _, version: version }, String(i)))) }));
378
381
  }
379
382
  function renderButton$1({ icon, ...button }, i) {
380
383
  if (!button?.text)
381
384
  return;
382
- if (icon)
383
- return (jsx(Button, { appendLeft: jsx(Icon, { name: icon, width: "24", height: "24" }), ...button }, String(i)));
384
- return jsx(Button, { ...button }, String(i));
385
+ return icon ? (jsx(Button, { appendLeft: jsx(Icon, { name: icon, width: "24", height: "24" }), ...button }, String(i))) : (jsx(Button, { ...button }, String(i)));
385
386
  }
386
387
 
387
- const tileStyleMap = {
388
- primary: 'bg-white text-primary-text',
389
- secondary: 'bg-primary-main text-white',
390
- };
391
- const Tile = JSX((props) => {
392
- const { children, className, version = 'primary' } = props;
393
- return (jsx("section", { className: `font-sans p-9 min-h-[320px] box-border ${className || ''} ${tileStyleMap[version]} ${getContainerPaddingRight(className)} `, children: jsx(BaseTile, { ...props, children: children }) }));
388
+ const Headline = JSX(({ bgColor = 'bg-white', className, ...props }) => {
389
+ return (jsx("section", { className: `p-10 ${bgColor} ${className || ''} `, children: jsx(BaseTile, { ...props }) }));
394
390
  });
395
- function getContainerPaddingRight(className = '') {
396
- const colSpan = getColSpan(className);
397
- if (colSpan <= 6) {
398
- return 'pr-9';
399
- }
400
- else if (colSpan <= 8) {
401
- return 'pr-[4.75rem]';
402
- }
403
- else {
404
- return 'pr-[9.4rem]';
405
- }
406
- }
407
391
 
408
- const CBR_EXCHANGE_RATE_URL = 'https://www.cbr-xml-daily.ru/daily_json.js';
409
- const CURRENCY_CODES = ['USD', 'EUR'];
410
- const CURRENCY_ICONS_MAP = {
411
- USD: 'DollarIcon',
412
- EUR: 'EuroIcon',
392
+ const titleAlignStyleMap = {
393
+ left: 'text-left',
394
+ center: 'text-center',
395
+ right: 'text-right',
413
396
  };
414
- const buttons = [
415
- {
416
- text: 'Все показатели',
417
- href: 'https://cbr.ru/currency_base/daily/',
418
- version: 'secondary',
419
- },
420
- ];
421
- const ExchangeRateTile = JSX(({ className, context, title }) => {
422
- const { data } = context.useAsyncData(CBR_EXCHANGE_RATE_URL, fetchExchangeRate);
423
- return (jsx(Tile, { className: className, context: context, title: title || 'Курсы обмена валют', buttons: buttons, children: jsxs("table", { children: [jsx("thead", { children: jsxs("tr", { children: [jsx(CurrencyTH, { children: "\u0412\u0430\u043B\u044E\u0442\u0430" }), jsx(CurrencyTH, { className: "pl-11", children: "\u041A\u0443\u0440\u0441" })] }) }), jsx("tbody", { children: CURRENCY_CODES.map((code) => {
424
- const value = (data?.Valute || {})[code]?.Value;
425
- return (jsxs("tr", { children: [jsx(CurrencyTD, { className: "pt-4", children: jsxs("div", { className: "flex items-center", children: [jsx(Icon, { name: CURRENCY_ICONS_MAP[code], width: "24", height: "24" }), jsx("span", { className: "ml-2", children: code })] }) }), jsx(CurrencyTD, { className: "pt-4 pl-11", children: formatCurrency(value) })] }, code));
426
- }) })] }) }));
427
- });
428
- const CurrencyTH = JSX(({ className = '', children }) => (jsx("th", { className: `text-left font-normal text-sm text-secondary-text ${className}`, children: children })));
429
- const CurrencyTD = JSX(({ className = '', children }) => (jsx("td", { className: `text-left font-normal text-base text-primary-text ${className}`, children: children })));
430
- async function fetchExchangeRate() {
431
- const response = await fetch(CBR_EXCHANGE_RATE_URL);
432
- return await response.json();
433
- }
434
- const currencyNumberFormat = new Intl.NumberFormat('ru', { style: 'currency', currency: 'RUB' });
435
- const formatCurrency = (value) => (value ? currencyNumberFormat.format(value) : '');
436
-
437
- const SVG = JSX(({ className, viewBox, fill = 'none', width, height, paths, ...commonOptions }) => {
438
- return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: className, viewBox: viewBox, fill: fill, width: width, height: height, children: paths.map(({ d, fill, ...options }, i) => (jsx("path", { d: d, fill: fill || 'currentColor', ...commonOptions, ...options }, i))) }));
439
- });
440
-
441
- const LOGO_PATHS = [
442
- 'm13.72 25.51 4.42-4.33v-2.95l-4.42 4.32v2.96Zm0-10.98 4.42-4.35V7.41l-4.42 4.31v2.8Zm0 3.63 4.42-4.33v-2.78l-4.42 4.32v2.8ZM12.46 7.44l-.6-.56V0h-.66v6.22l-.58-.57V0h-.67v5l-.59-.58V0H8.7v6.56l4.44 4.33V0h-.67v7.44Zm1.26 14.35 4.42-4.33v-2.78L13.72 19v2.8Zm-5.03-.61 4.44 4.33v-2.96l-4.44-4.32v2.95Zm8.79-16.76-.59.58V0h-.66v5.66l-.6.56V0h-.66v6.87l-.58.57V0h-.67v10.9l4.42-4.34V0h-.66v4.42Zm-8.79 5.76 4.44 4.35v-2.8L8.69 7.4v2.77Zm0 3.65 4.44 4.33v-2.8l-4.44-4.3v2.77Zm0 3.63 4.44 4.33V19l-4.44-4.31v2.78Zm26.37 2.29H24.3a2.25 2.25 0 0 0 .36-1.22 2.32 2.32 0 0 0-2.33-2.31 2.32 2.32 0 0 0-2.31 2.31c0 .5.16.96.43 1.34a.74.74 0 0 0-.33.61c0 .26.14.49.33.62a2.32 2.32 0 0 0-.43 1.34 2.31 2.31 0 0 0 2.31 2.31 2.32 2.32 0 0 0 2.33-2.31c0-.45-.13-.87-.36-1.22h8.01v.49h-.8v.68h.8v.7h-.8v1.3h.8v-.58h1.17v.58h.79v-1.3h-.79v-.7h.79v-.68h-.79v-.5h1.58a.56.56 0 0 0 .56-.56v-.34a.57.57 0 0 0-.56-.56Zm-11.53 2.7a1.2 1.2 0 0 1-2.4 0c0-.24.08-.47.2-.66l.34-.56a.97.97 0 0 1-.34-.75c0-.3.13-.56.33-.74l-.32-.56a1.13 1.13 0 0 1-.2-.66 1.2 1.2 0 0 1 2.4 0c0 .49-.56 1.65-.56 1.65v.62c-.01.01.55 1.17.55 1.66ZM4.67 18.34v2.89c0 2.75 1.2 4.53 1.9 5.21l4.58 4.5c1.28 1.25 1.5 1.66 1.79 2.37v-3.2c0-2.84-1.44-3.94-2.19-4.67-1.73-1.68-2.89-2.8-3.82-3.73a8.98 8.98 0 0 1-2.26-3.37Zm6.08 14.24c-1.73-1.7-2.89-2.8-3.82-3.73a10 10 0 0 1-2.25-2.98v2.49a7.87 7.87 0 0 0 1.89 5.24l4.58 4.47c1.28 1.25 1.5 1.85 1.79 2.55v-3.37c0-2.85-1.45-3.95-2.19-4.67Z',
443
- 'M19.88 5.34c-.32 0-.64 0-.96.02V6.7a18.5 18.5 0 1 1 .95 36.94A18.5 18.5 0 0 1 1.35 25.17c0-5.67 2.55-10.73 6.58-14.13V9.32A19.78 19.78 0 0 0 0 25.17C0 36.12 8.9 45 19.88 45a19.85 19.85 0 0 0 19.86-19.83c0-10.95-8.9-19.83-19.87-19.83Z',
444
- 'M33.93 35.53c.3-.41.6-.85.87-1.3v-2.66h-.87v3.96Zm2.54-4.92c.12-.4.24-.78.34-1.16h-2.88v.7h.43c.77-.02 1.63-.03 2.11.46Zm-19.19-1.27h-.78v7.91h.78v-7.9Z',
445
- 'M14.7 27.83h2.58c.67 0 1.14.14 1.4.4.27.25.4.72.4 1.38v7.4c0 .66-.12 1.12-.4 1.38-.4.41-1.16.41-1.78.41l-.4-.01v3.5l.78.14v-2.88c1.2 0 1.97-.4 2.34-1.22v4.29h.26l.5-.01V29.74c0-.68.13-1.16.4-1.43.25-.27.72-.4 1.37-.4.67 0 1.65-.1 2.16.4.26.27.38.76.38 1.43v3.8h-1.77v-4.06h-.77v12.99c.26-.03.5-.07.77-.12V34.3h1.77v7.64c.36-.1.72-.21 1.08-.34v-7c0-.8.19-1.4 1-1.67l-.9-4.87h1.8l.3 5.31h.22l.3-5.31h1.88l-1.01 4.87c.84.3 1.01.81 1.01 1.66v4.53a16.63 16.63 0 0 0 1.5-1.27v-9.83h5.25l.1-.72H24.93l.17.89c-.38-.72-1.12-1.08-2.2-1.08h-.77c-1.3 0-2.1.52-2.4 1.55-.27-1.08-1.1-1.62-2.46-1.62h-3.36v14.52c.26.09.52.18.78.25V27.84Zm16.29 5.58-.85-.8.85-4.37v5.17Z',
446
- 'M27.66 40.79c.27-.14.55-.28.8-.43v-5.98h-.8v6.4Z',
447
- ];
448
- const Logo = JSX(({ className, href, children, targetBlank }) => {
449
- return (jsxs("a", { className: `inline-flex items-center font-sans no-underline ${className || ''}`, href: href || 'https://rshb.ru/', target: targetBlank ? '_blank' : '_self', children: [jsx(SVG, { className: "text-primary-main w-10", viewBox: "0 0 40 45", paths: LOGO_PATHS.map((d) => ({ d })) }), jsx("span", { className: "text-black text-base font-medium ml-2.5", children: children || 'Россельхозбанк' })] }));
450
- });
451
-
452
- const SearchBar = JSX(({ className, context }) => {
453
- const { term, setTerm } = context.useSearch();
454
- return (jsxs("form", { className: `relative ${className || ''}`, children: [jsxs("div", { className: "absolute rounded h-full flex items-center justify-center pl-4 max-w-[170px] gap-3.5 pointer-events-none", children: [jsx("div", { className: "w-[24px] h-[24px]", children: jsx(Icon, { name: "LoupeIcon", width: "24", height: "24" }) }), !term && (jsx("span", { className: "font-sans font-normal text-base text-secondary-text", children: "\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u0441\u0430\u0439\u0442\u0443" }))] }), jsx("input", { className: "pl-12 w-full font-sans font-normal text-base text-black border border-solid border-main-divider rounded h-full box-border outline-none pr-[6%]", value: term, onChange: (e) => setTerm(e.target.value), type: "text", name: "s" }), term && (jsx("button", { type: "submit", className: "absolute font-sans font-normal text-sm cursor-pointer bg-transparent hover:bg-primary-hover active:bg-primary-active text-primary-main hover:text-white border-none px-5 py-2 rounded top-1 right-1 outline-none", onClick: (e) => {
455
- e.preventDefault();
456
- console.log('click');
457
- }, children: "\u041D\u0430\u0439\u0442\u0438" }))] }));
458
- });
459
-
460
- const Contacts = JSX(({ className, items, hasButton, context }) => {
461
- const router = context.useRouter();
462
- const { handlerDecorator } = context;
463
- return (jsxs("div", { className: `flex flex-col ${className || ''}`, children: [items?.length ? items.map(renderContact) : null, hasButton ? (jsx(Button, { version: "primary", className: "my-4", ...useLink({ router, handlerDecorator }, {
464
- text: 'Обратная связь',
465
- href: '/',
466
- target: '_blank',
467
- }) })) : null] }));
397
+ const titleMarginsStyleMap = {
398
+ double: 'mb-8',
399
+ single: '',
400
+ };
401
+ const linkColumnsModeStyleMap = {
402
+ double: 'gap-x-5 gap-y-[26px] flex-wrap',
403
+ single: 'gap-3.5 flex-col',
404
+ };
405
+ const LinkDocs = JSX(({ className, title, align, documents, icon, columnsMode = 'double' }) => {
406
+ const containerClasses = linkColumnsModeStyleMap[columnsMode];
407
+ return (jsxs("section", { className: `font-sans p-[50px] bg-white ${className}`, children: [title && (jsx(Title, { className: `font-medium m-0 ${titleMarginsStyleMap[columnsMode]} ${titleAlignStyleMap[align ?? 'center']}`, children: title })), jsx("div", { className: `flex ${containerClasses}`, role: "list", children: documents?.length
408
+ ? documents.map(({ text, fileSize, ...linkProps }) => (jsxs("a", { className: `group flex items-center text-sm
409
+ text-sm font-sans align-middle items-center text-primary-text no-underline group hover:text-primary-main
410
+ ${columnsMode === 'double' ? 'basis-[calc(50%-20px)]' : ''}`, role: "listitem", ...linkProps, children: [icon && jsx(Icon, { className: "mr-3.5", name: icon, width: "24px", height: "24px" }), jsxs("span", { children: [text, jsx("span", { className: "text-secondary-text group-hover:text-primary-main", children: linkProps?.href && formatSuffix(getExtFromHref(linkProps.href), fileSize) })] })] })))
411
+ : null })] }));
468
412
  });
469
- const renderContact = (item, index) => {
470
- const { type, text, description } = item;
471
- return (jsxs("div", { className: "mb-4", children: [jsx("div", { children: renderText(type, text) }), jsx("div", { className: "font-sans text-sm text-secondary-text", children: description })] }, String(index)));
413
+ const getExtFromHref = (href) => {
414
+ if (!href)
415
+ return '';
416
+ const lastChunk = href.split('.').pop();
417
+ if (!lastChunk || lastChunk.includes('/'))
418
+ return '';
419
+ return lastChunk;
472
420
  };
473
- const renderText = (type, text = '') => {
474
- switch (type) {
475
- case 'tel':
476
- return (jsx("a", { className: "font-sans font-medium text-xl text-primary-text no-underline", href: `tel:${formatTel(text)}`, children: text }));
477
- case 'email':
478
- return (jsx("a", { className: "font-sans font-medium text-xl text-primary-text no-underline", href: `mailto:${text}`, children: text }));
479
- default:
480
- return jsx("span", { children: text });
481
- }
421
+ const formatSuffix = (ext, fileSize) => {
422
+ const prefix = ext || fileSize ? ',' : '';
423
+ const extension = ext ? ` ${ext}` : '';
424
+ const size = fileSize ? ` (${fileSize})` : '';
425
+ return prefix + extension + size;
482
426
  };
483
- const formatTel = (s) => s.replaceAll(/(\-|\s|\(|\)|\D+)/g, '');
484
427
 
485
- const HorizontalNavigation = JSX(({ className, links, context }) => {
486
- const router = context.useRouter();
487
- const { handlerDecorator } = context;
488
- return (jsx("div", { className: `${className || ''}`, children: links?.length ? (jsx("div", { className: "flex justify-between items-center gap-5 py-5 border-solid border-x-0 border-y border-y-main-divider", children: links.map((_, i) => (jsx(HorizontalNavigationLink, { index: i, ...useLink({ router, handlerDecorator }, _) }, String(i)))) })) : null }));
428
+ const PictureText = JSX(({ className, title, image, benefits }) => {
429
+ return (jsxs("section", { className: `relative font-sans text-primary-text bg-white p-14 ${className}`, children: [jsx(Title, { className: "font-medium m-0 text-center", children: title }), jsxs("div", { className: 'flex justify-center mt-9', children: [image?.src && jsx(Img, { className: "mr-6", image: image }), benefits?.length ? (jsx("div", { className: "flex flex-col", children: benefits.map(renderBenefit$1) })) : null] })] }));
489
430
  });
490
- const HorizontalNavigationLink = JSX(({ className, index, text, href, target, onClick }) => (jsx("a", { className: `font-sans font-normal text-sm text-secondary-text hover:text-primary-text inline-block no-underline max-w-[292px] ${className || ''}`, href: href, target: target, onClick: onClick, children: text || `Документ ${index}` })));
491
-
492
- function useSitemap(useAsyncData) {
493
- const { data } = useAsyncData(sitemapURL(), fetchSitemap);
494
- return data || {};
431
+ function renderBenefit$1(benefit, i) {
432
+ return (jsxs("div", { className: "flex flex-row mb-8", children: [benefit.icon && (jsx(Icon, { className: "w-[48px] h-[48px] bg-main rounded-full box-border p-[12px]", name: benefit.icon, width: "48", height: "48" })), jsxs("div", { className: "flex gap-1 flex-col h-full ml-5 max-w-[490px]", children: [jsx("div", { className: "font-medium text-primary-text text-xl m-0", children: benefit.label }), benefit.description && (jsx("div", { className: "font-normal text-sm text-secondary-text", children: benefit.description }))] })] }, String(i)));
495
433
  }
496
- async function fetchSitemap() {
497
- const response = await fetch(sitemapURL());
498
- return await response.json();
434
+
435
+ const textBlockStyleMaps = {
436
+ primary: {
437
+ background: 'bg-white',
438
+ icon: 'bg-primary-main text-white',
439
+ title: 'text-primary-text',
440
+ description: 'text-secondary-text',
441
+ },
442
+ secondary: {
443
+ background: 'bg-primary-main',
444
+ icon: 'bg-white text-primary-main',
445
+ title: 'text-white',
446
+ description: 'text-white',
447
+ },
448
+ 'secondary-light': {
449
+ background: 'bg-primary-main/10',
450
+ icon: 'bg-primary-main text-white',
451
+ title: 'text-primary-text',
452
+ description: 'text-secondary-text',
453
+ },
454
+ };
455
+ const TextBlock = JSX(({ title, description, blockVersion = 'primary', iconVersion, image, className }) => {
456
+ const textBlockStyleMap = textBlockStyleMaps[blockVersion];
457
+ return (jsxs("section", { className: `font-sans px-9 py-4 flex ${textBlockStyleMap.background} ${className || ''}`, children: [iconVersion && iconVersion === 'small' ? renderIcon(textBlockStyleMap.icon) : null, iconVersion && iconVersion === 'big' ? renderImage(image) : null, jsxs("div", { className: "py-0.5", children: [title && (jsx("div", { className: `font-medium text-base mb-1 ${textBlockStyleMap.title}`, children: title })), description && (jsx("div", { className: `text-sm ${textBlockStyleMap.description}`, children: description }))] })] }));
458
+ });
459
+ function renderIcon(className) {
460
+ return (jsx("div", { className: `pt-1.5 pr-4`, children: jsx("div", { className: `rounded-full h-4 w-4 text-center text-xs ${className}`, children: "i" }) }));
499
461
  }
500
- function sitemapURL() {
501
- return `/wcms-resources/${projectSettings.SITEMAP || 'sitemap'}.json`;
462
+ function renderImage(image) {
463
+ return image?.src ? jsx(Img, { className: "pt-0.5 pr-3", image: image }) : null;
502
464
  }
503
465
 
504
- const cmp = (a) => (b) => a?.href === b?.href;
505
- const substitute = (items, substitution) => (items || []).map((_) => substitution?.find(cmp(_)) || _);
506
- const subtract = (minuend, subtrahend) => (minuend || []).filter((_) => !subtrahend?.find(cmp(_)));
507
- function mergeTopItems(left, right) {
508
- return substitute(left, right).concat(subtract(right, left));
509
- }
466
+ const AccordionBlocks = {
467
+ Headline,
468
+ LinkDocs,
469
+ TextBlock,
470
+ PictureText,
471
+ };
510
472
 
511
- const Sitemap = JSX(({ className, items, context }) => {
512
- const sitemap = useSitemap(context.useAsyncData);
513
- const mergedItems = mergeTopItems(sitemap.topItems, items);
514
- const linkParams = {
515
- router: context.useRouter(),
516
- handlerDecorator: context.handlerDecorator,
473
+ const AccordionItem = JSX(({ label, blocks, context }) => {
474
+ const [isActive, setIsActive] = context.useState(false);
475
+ const hasContent = blocks?.length;
476
+ const icon = isActive ? 'MinusIcon' : 'PlusIcon';
477
+ const handleToggle = (e) => {
478
+ if (!hasContent)
479
+ return null;
480
+ setIsActive(!isActive);
481
+ const contentBlock = getContentBlock(e);
482
+ contentBlock.style.maxHeight = contentBlock.style.maxHeight
483
+ ? null
484
+ : `${contentBlock.scrollHeight}px`;
517
485
  };
518
- return (jsx("div", { className: `flex items-start justify-start gap-11 xl:gap-5 ${className || ''}`, children: mergedItems?.map((_, i) => renderColumn(_, i, linkParams)) }));
486
+ return (jsxs("li", { className: "border-0 border-b border-solid border-main-divider last:border-b-0", children: [jsxs("button", { className: `border-none bg-transparent px-0 py-5 flex justify-between text-left w-full font-sans text-primary-text
487
+ ${hasContent ? 'group cursor-pointer' : ''}`, onClick: handleToggle, children: [jsx("span", { className: `m-0 text-xl pr-2.5 font-medium ${hasContent ? 'group-hover:text-primary-main' : ''}`, children: label }), hasContent ? jsx(Icon, { name: icon, width: "24", height: "24" }) : null] }), hasContent ? (jsx("div", { className: `${isActive ? 'pb-5' : ''} text-sm transition-all duration-300 max-h-0 overflow-hidden group-last:last:pb-0 `, children: blocks?.length ? blocks.map((block, i) => renderBlock(block, i, context)) : null })) : null] }));
519
488
  });
520
- const renderColumn = (c, index, { router, handlerDecorator }) => {
521
- const { text, href, items, target } = c;
522
- return (jsxs("div", { className: "flex flex-col w-[235px] gap-[14px]", children: [jsx("a", { className: "block font-sans font-medium text-base text-primary-text no-underline", href: href, target: target || '_self', children: text || `Раздел ${index}` }), items?.map((_, i) => (jsx(ColumnItem, { ...useLink({ router, handlerDecorator }, _) }, String(i))))] }, String(index)));
489
+ const renderBlock = (block, i, context) => {
490
+ if (!block.type || !block.data || !AccordionBlocks.hasOwnProperty(block.type)) {
491
+ return null;
492
+ }
493
+ const AccordionBlock = AccordionBlocks[block.type];
494
+ return (jsx("div", { className: "mb-5 last:mb-0", children: jsx(AccordionBlock, { context: context, ...block.data }) }, `block_${i}`));
523
495
  };
524
- const ColumnItem = JSX(({ text, href, target, index }) => (jsx("a", { className: "block font-sans font-normal text-base text-secondary-text hover:text-primary-main no-underline", href: href, target: target || '_self', children: text || `Раздел ${index}` })));
496
+ const getContentBlock = (e) => e.target.tagName === 'BUTTON' ? e.target.nextSibling : e.target.parentNode.nextSibling;
525
497
 
526
- const ICONS_MAP = [
527
- {
528
- origins: ['t.me', 'telegram.org'],
529
- icon: 'TelegramIcon',
530
- label: 'Телеграм',
531
- width: '20px',
532
- height: '16px',
533
- },
534
- { origins: ['vk.com'], icon: 'VKIcon', label: 'ВКонтакте', width: '24px', height: '12px' },
535
- { origins: ['ok.ru'], icon: 'OkIcon', label: 'Одноклассники', width: '12px', height: '20px' },
536
- ];
537
- const SocialMedia = JSX(({ className, media, context }) => {
538
- const router = context.useRouter();
539
- const { handlerDecorator } = context;
540
- return (jsx("div", { className: `flex items-end justify-end gap-2 pt-[30px] pb-7 ${className || ''}`, children: media?.map((_, index) => (jsx(MediaButton, { ...useLink({ router, handlerDecorator }, _) }, String(index)))) }));
541
- });
542
- const MediaButton = JSX(({ href }) => {
543
- const { icon, label, width, height } = ICONS_MAP.find(({ origins }) => origins.some((_) => href?.includes(_))) || {};
544
- if (!icon)
545
- return null;
546
- return (jsx(Button, { rounded: true, href: href, target: "_blank", rel: "noopener noreferrer", "aria-label": label, className: "border-solid border border-main-divider w-9 h-9 flex items-center justify-center hover:fill-primary-main", appendLeft: jsx(Icon, { name: icon, width: width, height: height, asSVG: true }) }));
498
+ const Accordion = JSX(({ title, accordionItems, context, className }) => {
499
+ return (jsxs("section", { className: `p-[50px] font-sans bg-white text-primary-text ${className || ''}`, children: [title ? jsx(Title, { className: "m-0 mb-2.5", children: title }) : null, accordionItems?.length ? (jsx("ul", { className: "list-none m-0 p-0", children: accordionItems.map((item, i) => (jsx(AccordionItem, { ...item, context: context }, `AccordionItem${i}`))) })) : null] }));
547
500
  });
548
501
 
549
- const TextInformation = JSX(({ className, links, context }) => {
550
- const router = context.useRouter();
551
- const { handlerDecorator } = context;
552
- return (jsxs("div", { className: `${className || ''}`, children: [jsx("div", { className: "pt-5 pb-[5px]", children: jsx("span", { className: "font-sans font-normal text-xs text-secondary-text", children: `\u00a9\u00A02000-${new Date().getFullYear()}\u00A0АО \u00ABРоссельхозбанк\u00BB Генеральная лицензия Банка России \u2116\u00A03349 от\u00A012.08.2015\u00A0г.` }) }), links?.length ? (jsx("div", { className: "flex justify-start items-start gap-5 pt-[5px]", children: links.map((_, i) => (jsx(TextInformationLink, { index: i, ...useLink({ router, handlerDecorator }, _) }, String(i)))) })) : null] }));
502
+ const BenefitsBlock = JSX(({ className, title, benefits }) => {
503
+ return (jsxs("section", { className: `font-sans text-primary-text bg-white p-12 pb-2 flex flex-col items-center ${className || ''}`, children: [title ? jsx(Title, { className: "font-medium m-0 max-w-[47rem] text-center", children: title }) : null, benefits?.length ? (jsx("div", { className: "grid grid-cols-2 gap-5 mt-9", children: benefits.map(renderStep) })) : null] }));
553
504
  });
554
- const TextInformationLink = JSX(({ className, index, text, href, target, onClick }) => (jsx("a", { className: `font-sans font-normal text-xs text-secondary-text visited:text-secondary-text hover:text-primary-text inline-block no-underline max-w-[292px] ${className || ''}`, href: href, target: target, onClick: onClick, children: text || `Документ ${index}` })));
505
+ const renderStep = (benefit, i) => {
506
+ return (jsxs("div", { className: "flex items-center p-10 gap-5 max-w-[580px]", children: [benefit.icon && (jsx(Icon, { className: "h-[70px] w-[70px] min-w-[70px] min-h-[70px]", name: benefit.icon, width: "70", height: "70" })), jsxs("div", { children: [jsx("h3", { className: "font-medium text-xl m-0", children: benefit.label }), benefit.description && (jsx("div", { className: "font-normal text-sm mt-2", children: benefit.description }))] })] }, String(i)));
507
+ };
555
508
 
556
- const LEFT_COL_WIDTH_FULL_HD = 'w-[280px]';
557
- const LEFT_COL_WIDTH_SMALL_DESKTOP = 'xl:w-[220px]';
558
- const Footer$1 = JSX(({ className, documents, relatedEnterprises, contacts, socialMedia, topItems, context }) => {
559
- return (jsxs("footer", { className: `${className} px-9 py-10 bg-white`, children: [jsxs("div", { className: "flex items-stretch gap-32 pb-8 xl:gap-8", children: [jsx(Logo, { className: `${LEFT_COL_WIDTH_FULL_HD} ${LEFT_COL_WIDTH_SMALL_DESKTOP}` }), jsx(SearchBar, { context: context, className: "grow" })] }), jsxs("div", { className: "flex items-stretch gap-32 xl:gap-8", children: [jsx(Contacts, { className: `${LEFT_COL_WIDTH_FULL_HD} shrink-0 overflow-hidden ${LEFT_COL_WIDTH_SMALL_DESKTOP}`, items: contacts, context: context, hasButton: true }), jsx(Sitemap, { className: "pt-[3px]", context: context, items: topItems })] }), jsx(SocialMedia, { media: socialMedia, context: context }), jsx(HorizontalNavigation, { links: relatedEnterprises, context: context }), jsx(TextInformation, { links: documents, context: context })] }));
509
+ const SVG = JSX(({ className, viewBox, fill = 'none', width, height, paths, ...commonOptions }) => {
510
+ return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: className, viewBox: viewBox, fill: fill, width: width, height: height, children: paths.map(({ d, fill, ...options }, i) => (jsx("path", { d: d, fill: fill || 'currentColor', ...commonOptions, ...options }, i))) }));
560
511
  });
561
512
 
562
513
  const ARROW_PATHS = [
@@ -575,222 +526,6 @@
575
526
  ? 'bg-secondary-light text-secondary-text'
576
527
  : 'bg-white text-primary-text hover:text-primary-main'} ${className || ''}`, disabled: disabled, ...rest, children: jsx(SVG, { paths: ARROW_PATHS, viewBox: "0 0 16 16", fill: "none", width: "16", height: "16" }) })));
577
528
 
578
- const cardStyleMap = {
579
- normal: 'min-w-[364px] w-[364px]',
580
- mini: 'min-w-[260px] w-[260px]',
581
- };
582
- const cardWidthMap = {
583
- normal: 380,
584
- mini: 276,
585
- };
586
- const galleryLengthForScrollMap = {
587
- normal: 3,
588
- mini: 4,
589
- };
590
- const GalleryInner = JSX(({ title, description, context, cards = [], className, version = 'normal' }) => {
591
- const [activeCardIndex, setActiveCardIndex] = context.useState(0);
592
- function handleNextClick() {
593
- setActiveCardIndex(activeCardIndex + 1);
594
- }
595
- function handlePrevClick() {
596
- setActiveCardIndex(activeCardIndex - 1);
597
- }
598
- const isGalleryScrollAvailable = cards?.length > galleryLengthForScrollMap[version];
599
- const showNextButton = isGalleryScrollAvailable &&
600
- cards?.length - activeCardIndex > galleryLengthForScrollMap[version];
601
- const showPrevButton = isGalleryScrollAvailable && activeCardIndex > 0;
602
- return (jsxs("section", { className: `relative font-sans text-primary-text bg-white p-12 overflow-hidden ${className}`, children: [jsxs("div", { className: "flex flex-col items-center mb-8", children: [title ? jsx(Title, { className: "font-medium m-0 text-center", children: title }) : null, description ? (jsx("div", { className: "font-normal text-base max-w-[600px] mt-3", children: description })) : null] }), jsx("div", {
603
- // Need to place all cards at the center if count of cards less than 4
604
- className: `flex ${cards?.length <= galleryLengthForScrollMap[version] ? 'justify-center' : ''} duration-1000`,
605
- // All cards has same width
606
- style: { transform: `translateX(-${activeCardIndex * cardWidthMap[version]}px)` }, role: "list", children: cards?.map((card, i) => renderCard$1(card, i, version)) }), showPrevButton && (jsx(ArrowButton, { className: "absolute top-1/2 left-8 rotate-180", onClick: handlePrevClick, ariaLabel: "\u041F\u0440\u043E\u043B\u0438\u0441\u0442\u0430\u0442\u044C \u0432\u043B\u0435\u0432\u043E" })), showNextButton && (jsx(ArrowButton, { className: "absolute top-1/2 right-1 z-10", onClick: handleNextClick, ariaLabel: "\u041F\u0440\u043E\u043B\u0438\u0441\u0442\u0430\u0442\u044C \u0432\u043F\u0440\u0430\u0432\u043E" })), jsx("div", { className: "absolute top-0 right-0 bottom-0 w-[84px] bg-opacity-to-white" })] }));
607
- });
608
- function renderCard$1(card, i, version) {
609
- return (jsxs("div", { className: `box-border border-solid border rounded-md border-main-divider p-7 mx-2 flex flex-col justify-between items-stretch ${cardStyleMap[version]} w-full`, role: "listitem", children: [jsxs("div", { children: [card.image?.src ? (jsx("div", { className: "flex justify-center", children: jsx(Img, { className: "mb-6", image: card.image }) })) : null, card.title ? (jsx("h4", { className: `font-medium text-xl m-0 ${!card.description && !card.items?.length ? 'text-center' : ''}`, children: card.title })) : null, card.description ? (jsx("div", { className: "font-normal text-sm text-secondary-text mt-2", children: card.description })) : null, card.items?.length ? (jsx("section", { className: "max-w-[308px] mt-2", role: "list", children: card.items.map(renderItem) })) : null] }), card.href ? (jsx(Button, { className: "mt-6", text: "\u041F\u043E\u0434\u0440\u043E\u0431\u043D\u0435\u0435", version: "secondary", href: card.href })) : null] }, String(i)));
610
- }
611
- function renderItem(item, i) {
612
- return (jsx(BlockItem, { children: jsx("span", { className: "text-sm text-secondary-text", children: item }) }, String(i)));
613
- }
614
-
615
- const Gallery$1 = JSX((props) => jsx(GalleryInner, { ...props, version: "normal" }));
616
-
617
- const HeaderItem = JSX(({ className, text, href, target, active, onClick, children }) => {
618
- const textStyle = active ? 'text-primary-main' : 'text-primary-text hover:text-primary-main';
619
- return (jsxs("a", { className: `relative inline-block bg-transparent text-center no-underline ${className || ''}`, href: href, target: target, onClick: onClick, children: [jsx("span", { className: `font-sans font-normal text-base ${textStyle}`, children: text || children }), active ? (jsx("div", { className: "absolute left-0 -bottom-2 w-full h-[2px] bg-primary-main" })) : null] }));
620
- });
621
-
622
- const TopItem = JSX(({ className, text, href, target, active, flat, onClick, children, ariaLabel }) => {
623
- const linkStyle = active ? 'border-primary-main rounded-md' : 'border-transparent';
624
- const textStyle = active
625
- ? 'text-primary-main'
626
- : `${flat ? 'text-primary-text' : 'text-secondary-text'} hover:text-primary-main`;
627
- return (jsx("a", { className: `inline-block border border-solid bg-transparent text-center no-underline ${flat ? '' : 'px-4 py-2'} ${linkStyle} ${className || ''}`, href: href, target: target, onClick: onClick, rel: "noopener noreferrer", "aria-label": ariaLabel, children: jsx("span", { className: `font-sans font-normal text-sm ${textStyle}`, children: text || children }) }));
628
- });
629
-
630
- const HeaderSecondaryMenuButton = JSX(({ className, children, ariaLabel }) => (jsx("button", { type: "button", className: `border-0 p-0 w-[24px] h-[24px] flex items-center bg-inherit cursor-pointer ${className || ''}`, disabled: true, "aria-label": ariaLabel, children: children })));
631
-
632
- const HeaderSecondaryMenu = JSX(({ context, className, defaultLocation = '' }) => {
633
- const [city, getCity] = context.useGeolocation(defaultLocation);
634
- return (jsxs("div", { className: `flex items-center ${className || ''}`, children: [jsx(TopItem, { className: "mr-5", flat: true, href: "#", text: city, ariaLabel: "\u041C\u0435\u0441\u0442\u043E\u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435", onClick: getCity }), jsx(TopItem, { className: "mr-7", flat: true, href: "#", text: "\u041E\u0444\u0438\u0441\u044B \u0438 \u0431\u0430\u043D\u043A\u043E\u043C\u0430\u0442\u044B", ariaLabel: "\u0421\u043F\u0438\u0441\u043E\u043A \u0432\u0441\u0435\u0445 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0445 \u043E\u0444\u0438\u0441\u043E\u0432 \u0438 \u0431\u0430\u043D\u043A\u043E\u043C\u0430\u0442\u043E\u0432" }), jsx(HeaderSecondaryMenuButton, { className: "mr-5 text-primary-text hover:text-primary-main", ariaLabel: "\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u0441\u0430\u0439\u0442\u0443", children: jsx(Icon, { name: "LoupeIcon", "aria-hidden": "true", className: "h-full", asSVG: true }) }), jsx(HeaderSecondaryMenuButton, { className: "mr-5 text-primary-text hover:text-primary-main", ariaLabel: "\u041F\u0440\u043E\u0444\u0438\u043B\u044C", children: jsx(Icon, { name: "ProfileIcon", "aria-hidden": "true", className: "h-full", asSVG: true }) }), jsx(HeaderSecondaryMenuButton, { className: "min-w-[32px] min-h-[32px] fill-secondary-light hover:fill-secondary-hover", ariaLabel: "\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0441\u0441\u044B\u043B\u043A\u0438", children: jsx(Icon, { name: "GridIcon", "aria-hidden": "true", className: "h-full", asSVG: true }) })] }));
635
- });
636
-
637
- function isSubItemActive(router) {
638
- return (subItem) => isHrefActive(subItem.href, router);
639
- }
640
-
641
- function isTopItemActive(router) {
642
- return (topItem) => isHrefActive(topItem.href, router, (topItemHref, baseHref) => baseHref.startsWith(topItemHref));
643
- }
644
-
645
- const Header = JSX(({ className, defaultLocation, context, topItems }) => {
646
- const router = context.useRouter();
647
- const sitemap = useSitemap(context.useAsyncData);
648
- const { handlerDecorator } = context;
649
- const mergedItems = mergeTopItems(sitemap.topItems, topItems);
650
- const activeTopItem = mergedItems.find(isTopItemActive(router));
651
- const subItems = activeTopItem?.items;
652
- const activeSubItem = subItems?.find(isSubItemActive(router));
653
- const topMenu = mergedItems.map((_, i) => (jsx(TopItem, { active: _ === activeTopItem, ...useLink({ router, handlerDecorator }, _), ariaLabel: _.text }, String(i))));
654
- const subMenu = subItems?.map((_) => (jsx(HeaderItem, { className: "mr-8", active: _ === activeSubItem, ...useLink({ router, handlerDecorator }, _) }, _.href)));
655
- return (jsxs("header", { className: `pt-5 pb-8 px-20 bg-white ${className || ''}`, children: [jsxs("div", { className: "flex items-center", children: [jsx(Logo, { className: "mr-8" }), topMenu, jsx(HeaderSecondaryMenu, { context: context, className: "ml-auto", defaultLocation: defaultLocation })] }), jsx("div", { className: "mt-5 h-[1px] bg-main-divider" }), jsx("nav", { className: "mt-5", children: subMenu })] }));
656
- });
657
-
658
- const MiniGallery = JSX((props) => (jsx(GalleryInner, { ...props, version: "mini" })));
659
-
660
- const MobileAppTile = JSX(({ className, context, title = 'Мобильное приложение', qr, buttons = [] }) => {
661
- return (jsx(Tile, { className: className, context: context, title: title, buttons: buttons, children: jsxs("div", { className: "flex items-center", children: [qr?.src && qr?.href && (jsx("a", { href: qr.href, target: "_blank", children: jsx("img", { src: qr.src, alt: title, title: title, width: "164", height: "164", className: "w-[90px] h-[90px] min-w-[90px] min-h-[90px] bg-secondary-light" }) })), jsx("span", { className: "font-normal text-sm text-secondary-text ml-4", children: "\u041D\u0430\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u0430\u043C\u0435\u0440\u0443 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430 \u043D\u0430 QR-\u043A\u043E\u0434 \u0438 \u0441\u043A\u0430\u0447\u0430\u0439\u0442\u0435 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0435" })] }) }));
662
- });
663
-
664
- const GOLDEN_RATIO = 1.618;
665
- const Placeholder = JSX(({ className, context, title }) => {
666
- return (jsx(Tile, { className: className, context: context, title: title, description: "\u0411\u043B\u043E\u043A \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043E\u0442\u043A\u0435...", children: jsx("figure", { className: "m-0 min-w-[600px]", children: renderShimmer() }) }));
667
- });
668
- const renderShimmer = (size = 3) => goldenSequence(100, size)
669
- .map((_) => Math.floor(_))
670
- .map(renderShimmerItem);
671
- const renderShimmerItem = (width = 100, index) => (jsx("div", { style: { width: `${width}%` }, className: "h-4 mt-2 bg-secondary-light" }, String(index)));
672
- const goldenSequence = (first, size) => [first].concat(size > 0 ? goldenSequence(first / GOLDEN_RATIO, size - 1) : []);
673
-
674
- const ProductBlockInner = JSX(({ className, context, title, titleSize, description, benefits, buttons, image, items }) => {
675
- return (jsxs("div", { className: `flex grow justify-between items-stretch ${className || ''}`, children: [jsxs("div", { className: 'flex flex-col', children: [title && (
676
- /* TODO Why <Title> is duplicated here? */
677
- jsx(Title, { size: titleSize || 'XL', className: "font-medium m-0 mb-4 whitespace-pre-wrap max-w-[600px] text-primary-text", children: title })), jsx(BaseTile, { context: context, description: description, items: items, buttons: buttons, children: benefits?.length ? (jsx("div", { className: "flex gap-6 mt-6 mb-3.5", children: benefits.map(renderBenefit) })) : null })] }), image?.src && jsx(Img, { className: "mt-auto", image: image })] }));
678
- });
679
- function renderBenefit(benefit, i) {
680
- return (jsxs("div", { className: "flex gap-4 items-center", children: [benefit.icon && (jsx(Icon, { className: "w-[50px] h-[50px] min-w-[50px] min-h-[50px] bg-main rounded-full p-[10px] box-border", name: benefit.icon, width: "24", height: "24" })), jsxs("div", { className: "flex gap-1 flex-col h-full", children: [jsx("h4", { className: "font-medium text-primary-text text-xl m-0", children: benefit.label }), benefit.description && (jsx("div", { className: "font-normal text-sm text-secondary-text", children: benefit.description }))] })] }, String(i)));
681
- }
682
-
683
- const Breadcrumb = JSX(({ text, href, target, onClick, className, children }) => {
684
- if (href) {
685
- return (jsx("a", { className: `no-underline ${className || ''}`, href: href, target: target, onClick: onClick, children: jsx("span", { className: `${className || ''}`, children: text || children }) }));
686
- }
687
- else {
688
- return jsx("span", { className: `${className || ''}`, children: text || children });
689
- }
690
- });
691
-
692
- function joinList(sep) {
693
- return (list) => list.reduce((acc, el, i) => (acc.length ? acc.concat({ ...sep, key: i }, el) : [el]), []);
694
- }
695
-
696
- const ProductBlock$1 = JSX((props) => {
697
- const { context, className, breadcrumbs } = props;
698
- const router = context.useRouter();
699
- const { handlerDecorator } = context;
700
- return (jsxs("section", { className: `font-sans bg-white pt-10 pl-[50px] pb-[50px] pr-[7.5rem] ${className || ''}`, children: [breadcrumbs?.length ? (jsx("div", { className: "text-xs mb-6", children: joinList(jsx("span", { className: "text-secondary-text mx-2", children: "/" }))(breadcrumbs.map((breadcrumb, i) => (jsx(Breadcrumb, { ...useLink({ router, handlerDecorator }, { className: 'text-secondary-text', ...breadcrumb }) }, String(i))))) })) : null, jsx(ProductBlockInner, { ...props })] }));
701
- });
702
-
703
- const ProductGallery = JSX(({ className, context, duration = 0, slides = [] }) => {
704
- const galleryNav = slides.map((s) => s.nav);
705
- const galleryBlocks = slides.map((s) => s.productBlock);
706
- const [activeSlideIndex, setActiveSlideIndex] = context.useState(0);
707
- return (jsxs("section", { className: `font-sans bg-white overflow-hidden w-100 ${className || ''}`, children: [jsx("div", { className: `flex duration-1000`, style: { transform: `translateX(-${activeSlideIndex}00%)` }, role: "list", children: galleryBlocks.map((_, i) => renderProductBlock(_, i, context)) }), jsx("div", { className: `border-t border-solid border-main-divider flex`, children: galleryNav.map((slide, i) => renderNavButton({
708
- slide,
709
- i,
710
- activeSlideIndex,
711
- onClick: () => setActiveSlideIndex(i),
712
- duration,
713
- })) })] }));
714
- });
715
- function renderProductBlock(block, i, context) {
716
- return (jsx("section", { className: "flex grow-0 shrink-0 basis-full", role: "listitem", children: jsx("div", { className: "p-10 flex grow", children: jsx(ProductBlockInner, { className: "pl-2.5 pt-2.5 pb-1.5 pr-[6.25rem]", context: context, ...block }) }) }, String(i)));
717
- }
718
- function renderNavButton({ slide, i, activeSlideIndex, onClick, duration }) {
719
- const isActiveBtn = i === activeSlideIndex;
720
- const progressBarClassName = isActiveBtn ? 'animate-slide' : '';
721
- const btnTitleClassName = isActiveBtn ? 'text-primary-text' : 'text-secondary-text';
722
- return (jsxs("button", { type: "button", onClick: onClick, className: `group relative overflow-hidden border-0 bg-inherit cursor-pointer text-left px-0 py-4 grow basis-0`, children: [jsxs("div", { className: "border-0 border-r border-solid border-main-divider px-6", children: [jsx("div", { className: `text-sm font-medium group-hover:text-primary-text ${btnTitleClassName}`, children: slide?.title }), jsx("div", { className: "text-xs text-secondary-text", children: slide.desc })] }), jsx("div", { className: `absolute bottom-0 left-0 w-full h-[3px] bg-primary-main -translate-x-full ${progressBarClassName}`, style: { animationDuration: `${duration}s` } })] }, String(i)));
723
- }
724
-
725
- const ProductTile = JSX((props) => {
726
- const { benefits, version } = props;
727
- return (jsx(Tile, { ...props, children: jsxs("div", { className: "flex mt-5 mb-1", children: [benefits?.length ? (jsx("div", { className: "mr-8", children: benefits.map(renderBenefitDescription) })) : null, benefits?.length ? (jsx("div", { className: "pt-1", children: benefits.map((_, i) => renderBenefitLabel(_, i, version)) })) : null] }) }));
728
- });
729
- function renderBenefitLabel(benefit, i, version = 'primary') {
730
- const labelStyleMap = {
731
- primary: 'text-secondary-text',
732
- secondary: 'text-white',
733
- };
734
- return (jsx("div", { className: `text-sm ${i ? 'mt-4' : ''} ${labelStyleMap[version]}`, children: benefit.label }, String(i)));
735
- }
736
- function renderBenefitDescription(benefit, i) {
737
- return (jsx("div", { className: `text-xl font-medium ${i ? 'mt-2.5' : ''}`, children: benefit.description }, String(i)));
738
- }
739
-
740
- const PromoTile = JSX(({ className, context, title = 'Акции и спецпредложения', date, description, buttons = [], version, }) => {
741
- return (jsx(Tile, { className: className, context: context, title: title, buttons: buttons, version: version, children: jsxs("div", { children: [date && jsx("div", { className: "text-sm mb-2", children: formatDate(date) }), jsx("div", { className: "text-base", children: description })] }) }));
742
- });
743
- function formatDate(date) {
744
- const dateObj = new Date(date);
745
- const dateFormat = {
746
- day: 'numeric',
747
- month: 'long',
748
- year: 'numeric',
749
- };
750
- return dateObj.toLocaleString('ru-RU', dateFormat).replace('г.', '');
751
- }
752
-
753
- const StepsBlock = JSX(({ className, title, steps }) => {
754
- return (jsxs("section", { className: `font-sans text-primary-text bg-white px-12 py-12 flex flex-col items-center ${className || ''}`, children: [jsx(Title, { className: "font-medium m-0 max-w-[47rem] text-center", children: title }), steps?.length ? (jsxs("div", { children: [jsx("div", { className: "flex mt-9 items-center px-[88px]", children: joinList(jsx("div", { className: "h-0.5 w-full bg-secondary-light" }))(steps.map((step, i) => renderStepIcon(step, i))) }), jsx("div", { className: "flex mt-9 justify-between gap-x-24", children: steps.map(renderStepTitle) })] })) : null] }));
755
- });
756
- const renderStepIcon = (step, i) => {
757
- return (jsx("div", { className: "flex flex-col items-center text-center relative", children: jsx("div", { className: "h-[100px] w-[100px] min-w-[100px] min-h-[100px] bg-secondary-light rounded-full p-[26px] box-border z-10", children: (step.icon && jsx(Icon, { name: step.icon, width: "48", height: "48" })) || (jsx("span", { className: "font-medium text-title-sm text-secondary-text", children: i + 1 })) }) }, String(i)));
758
- };
759
- const renderStepTitle = (step, i) => {
760
- return (jsx("div", { className: "flex flex-col items-center text-center relative w-[276px]", children: jsxs("div", { className: "max-w-min", children: [jsx("h5", { className: "font-medium text-xl m-0 mt-4 whitespace-nowrap px-3", children: step.label }), step.description && (jsx("div", { className: "font-normal text-sm text-secondary-text mt-2", children: step.description }))] }) }, String(i)));
761
- };
762
-
763
- const textBlockStyleMaps = {
764
- primary: {
765
- background: 'bg-white',
766
- icon: 'bg-primary-main text-white',
767
- title: 'text-primary-text',
768
- description: 'text-secondary-text',
769
- },
770
- secondary: {
771
- background: 'bg-primary-main',
772
- icon: 'bg-white text-primary-main',
773
- title: 'text-white',
774
- description: 'text-white',
775
- },
776
- 'secondary-light': {
777
- background: 'bg-primary-main/10',
778
- icon: 'bg-primary-main text-white',
779
- title: 'text-primary-text',
780
- description: 'text-secondary-text',
781
- },
782
- };
783
- const TextBlock = JSX(({ title, description, blockVersion = 'primary', iconVersion, image, className }) => {
784
- const textBlockStyleMap = textBlockStyleMaps[blockVersion];
785
- return (jsxs("section", { className: `font-sans px-9 py-4 flex ${textBlockStyleMap.background} ${className || ''}`, children: [iconVersion && iconVersion === 'small' ? renderIcon(textBlockStyleMap.icon) : null, iconVersion && iconVersion === 'big' ? renderImage(image) : null, jsxs("div", { className: "py-0.5", children: [title && (jsx("div", { className: `font-medium text-base mb-1 ${textBlockStyleMap.title}`, children: title })), description && (jsx("div", { className: `text-sm ${textBlockStyleMap.description}`, children: description }))] })] }));
786
- });
787
- function renderIcon(className) {
788
- return (jsx("div", { className: `pt-1.5 pr-4`, children: jsx("div", { className: `rounded-full h-4 w-4 text-center text-xs ${className}`, children: "i" }) }));
789
- }
790
- function renderImage(image) {
791
- return image?.src ? jsx(Img, { className: "pt-0.5 pr-3", image: image }) : null;
792
- }
793
-
794
529
  const TableRowContainer = JSX(({ children }) => (jsx("div", { className: "self-start flex flex-col", role: "row", children: jsx("div", { className: "flex", children: children }) })));
795
530
 
796
531
  const GRADIENT = 'bg-gradient-to-r from-main-gradient-start to-main-gradient-end';
@@ -835,39 +570,6 @@
835
570
  return (jsxs("section", { className: `bg-white font-sans py-[50px] pl-[50px] overflow-hidden text-primary-text relative ${className || ''}`, children: [jsx(Title, { className: "font-medium m-0 max-w-[47rem] text-center mb-9 mx-auto", children: title }), jsxs("div", { role: "table", children: [colHeaders?.length ? (jsxs(TableRowContainer, { children: [jsx("div", { className: FIRST_CELL_CLASSES, role: "columnheader", scope: "col" }), jsx(TableCarouselContainer, { activeCardIndex: activeCardIndex, children: colHeaders.map((header, i) => (jsx(HeaderCell, { ...header, link: header.link && useLink({ router, handlerDecorator }, header.link) }, String(i)))) })] })) : null, rowData?.length ? (jsxs("div", { className: "relative", children: [rowData.map((row, i, { length }) => (jsx(TableRow, { row: row, isFirstRow: i === 0, isLastRow: i + 1 === length, activeCardIndex: activeCardIndex, isColoredFirstColumn: isColoredFirstColumn }, String(i)))), isScrollAvailable ? (jsx("div", { children: jsxs("div", { className: "absolute top-7 right-7 z-10", children: [jsx(ArrowButton, { onClick: nextClick, disabled: !showNextButton, ariaLabel: "\u041F\u0440\u043E\u043B\u0438\u0441\u0442\u0430\u0442\u044C \u0432\u043F\u0440\u0430\u0432\u043E" }), jsx(ArrowButton, { className: "mt-4 rotate-180", onClick: prevClick, disabled: !showPrevButton, ariaLabel: "\u041F\u0440\u043E\u043B\u0438\u0441\u0442\u0430\u0442\u044C \u0432\u043B\u0435\u0432\u043E" })] }) })) : null] })) : null] }), isScrollAvailable ? (jsx("div", { className: "absolute top-0 right-0 bottom-0 w-[84px] bg-opacity-to-white" })) : null, visibleRowLength ? (jsx("div", { className: "pr-[50px]", children: jsxs("div", { className: "flex w-full", children: [jsx("div", { className: FIRST_CELL_CLASSES }), jsx("button", { onClick: showToggle, className: "mt-5 flex-1 border-main-stroke border-solid border text-primary-text bg-white hover:border-primary-main hover:text-primary-main", children: jsx("div", { className: "font-sans font-medium text-xs py-[11px]", children: !isShowAllRow ? 'Показать все параметры' : 'Скрыть' }) })] }) })) : null] }));
836
571
  });
837
572
 
838
- const AccordionBlocks = {
839
- TextBlock,
840
- };
841
-
842
- const AccordionItem = JSX(({ label, blocks, context }) => {
843
- const [isActive, setIsActive] = context.useState(false);
844
- const hasContent = blocks?.length;
845
- const icon = isActive ? 'MinusIcon' : 'PlusIcon';
846
- const handleToggle = (e) => {
847
- if (!hasContent)
848
- return null;
849
- setIsActive(!isActive);
850
- const contentBlock = getContentBlock(e);
851
- contentBlock.style.maxHeight = contentBlock.style.maxHeight
852
- ? null
853
- : `${contentBlock.scrollHeight}px`;
854
- };
855
- return (jsxs("li", { className: "border-0 border-b border-solid border-main-divider last:border-b-0", children: [jsxs("button", { className: `border-none bg-transparent px-0 py-5 flex justify-between text-left w-full font-sans text-primary-text
856
- ${hasContent ? 'group cursor-pointer' : ''}`, onClick: handleToggle, children: [jsx("span", { className: `m-0 text-xl pr-2.5 font-medium ${hasContent ? 'group-hover:text-primary-main' : ''}`, children: label }), hasContent ? jsx(Icon, { name: icon, width: "24", height: "24" }) : null] }), hasContent ? (jsx("div", { className: `${isActive ? 'pb-5' : ''} text-sm transition-all duration-300 max-h-0 overflow-hidden group-last:last:pb-0 `, children: blocks?.length ? blocks.map((block, i) => renderBlock(block, i, context)) : null })) : null] }));
857
- });
858
- const renderBlock = (block, i, context) => {
859
- if (!block.type || !block.data || !AccordionBlocks.hasOwnProperty(block.type)) {
860
- return null;
861
- }
862
- const AccordionBlock = AccordionBlocks[block.type];
863
- return (jsx("div", { className: "mb-5 last:mb-0", children: jsx(AccordionBlock, { context: context, ...block.data }) }, `block_${i}`));
864
- };
865
- const getContentBlock = (e) => e.target.tagName === 'BUTTON' ? e.target.nextSibling : e.target.parentNode.nextSibling;
866
-
867
- const Accordion = JSX(({ title, accordionItems, context, className }) => {
868
- return (jsxs("section", { className: `p-[50px] font-sans bg-white text-primary-text ${className || ''}`, children: [title ? jsx(Title, { className: "m-0 mb-2.5", children: title }) : null, accordionItems?.length ? (jsx("ul", { className: "list-none m-0 p-0", children: accordionItems.map((item, i) => (jsx(AccordionItem, { ...item, context: context }, `AccordionItem${i}`))) })) : null] }));
869
- });
870
-
871
573
  function useCreditCalculatorData(useAsyncData, directoryName) {
872
574
  const { data } = useAsyncData(creditCalculatorUrl(directoryName), () => fetchCreditCalculatorData(directoryName));
873
575
  return data || {};
@@ -1010,25 +712,384 @@
1010
712
  return (jsx("button", { className: "bg-secondary-light rounded-3xl h-10 w-[75px] box-border mr-2 flex items-center justify-center cursor-pointer border-none", onClick: () => handleClick(number), children: jsxs("span", { className: "font-semibold text-sm", children: [number, " ", number === 1 ? 'год' : number > 4 ? 'лет' : 'года'] }) }, String(i)));
1011
713
  }
1012
714
 
1013
- const Blocks = {
1014
- Header,
1015
- Footer: Footer$1,
1016
- Placeholder,
1017
- Tile,
1018
- PromoTile,
1019
- TextBlock,
1020
- ProductTile,
1021
- ProductBlock: ProductBlock$1,
1022
- StepsBlock,
715
+ const tileStyleMap = {
716
+ primary: 'bg-white text-primary-text',
717
+ secondary: 'bg-primary-main text-white',
718
+ };
719
+ const Tile = JSX((props) => {
720
+ const { children, className, version = 'primary' } = props;
721
+ return (jsx("section", { className: `font-sans p-9 min-h-[320px] box-border ${className || ''} ${tileStyleMap[version]} ${getContainerPaddingRight(className)} `, children: jsx(BaseTile, { ...props, children: children }) }));
722
+ });
723
+ function getContainerPaddingRight(className = '') {
724
+ const colSpan = getColSpan(className);
725
+ if (colSpan <= 6) {
726
+ return 'pr-9';
727
+ }
728
+ else if (colSpan <= 8) {
729
+ return 'pr-[4.75rem]';
730
+ }
731
+ else {
732
+ return 'pr-[9.4rem]';
733
+ }
734
+ }
735
+
736
+ const CBR_EXCHANGE_RATE_URL = 'https://www.cbr-xml-daily.ru/daily_json.js';
737
+ const CURRENCY_CODES = ['USD', 'EUR'];
738
+ const CURRENCY_ICONS_MAP = {
739
+ USD: 'DollarIcon',
740
+ EUR: 'EuroIcon',
741
+ };
742
+ const buttons = [
743
+ {
744
+ text: 'Все показатели',
745
+ href: 'https://cbr.ru/currency_base/daily/',
746
+ version: 'secondary',
747
+ },
748
+ ];
749
+ const ExchangeRateTile = JSX(({ className, context, title }) => {
750
+ const { data } = context.useAsyncData(CBR_EXCHANGE_RATE_URL, fetchExchangeRate);
751
+ return (jsx(Tile, { className: className, context: context, title: title || 'Курсы обмена валют', buttons: buttons, children: jsxs("table", { children: [jsx("thead", { children: jsxs("tr", { children: [jsx(CurrencyTH, { children: "\u0412\u0430\u043B\u044E\u0442\u0430" }), jsx(CurrencyTH, { className: "pl-11", children: "\u041A\u0443\u0440\u0441" })] }) }), jsx("tbody", { children: CURRENCY_CODES.map((code) => {
752
+ const value = (data?.Valute || {})[code]?.Value;
753
+ return (jsxs("tr", { children: [jsx(CurrencyTD, { className: "pt-4", children: jsxs("div", { className: "flex items-center", children: [jsx(Icon, { name: CURRENCY_ICONS_MAP[code], width: "24", height: "24" }), jsx("span", { className: "ml-2", children: code })] }) }), jsx(CurrencyTD, { className: "pt-4 pl-11", children: formatCurrency(value) })] }, code));
754
+ }) })] }) }));
755
+ });
756
+ const CurrencyTH = JSX(({ className = '', children }) => (jsx("th", { className: `text-left font-normal text-sm text-secondary-text ${className}`, children: children })));
757
+ const CurrencyTD = JSX(({ className = '', children }) => (jsx("td", { className: `text-left font-normal text-base text-primary-text ${className}`, children: children })));
758
+ async function fetchExchangeRate() {
759
+ const response = await fetch(CBR_EXCHANGE_RATE_URL);
760
+ return await response.json();
761
+ }
762
+ const currencyNumberFormat = new Intl.NumberFormat('ru', { style: 'currency', currency: 'RUB' });
763
+ const formatCurrency = (value) => (value ? currencyNumberFormat.format(value) : '');
764
+
765
+ const LOGO_PATHS = [
766
+ 'm13.72 25.51 4.42-4.33v-2.95l-4.42 4.32v2.96Zm0-10.98 4.42-4.35V7.41l-4.42 4.31v2.8Zm0 3.63 4.42-4.33v-2.78l-4.42 4.32v2.8ZM12.46 7.44l-.6-.56V0h-.66v6.22l-.58-.57V0h-.67v5l-.59-.58V0H8.7v6.56l4.44 4.33V0h-.67v7.44Zm1.26 14.35 4.42-4.33v-2.78L13.72 19v2.8Zm-5.03-.61 4.44 4.33v-2.96l-4.44-4.32v2.95Zm8.79-16.76-.59.58V0h-.66v5.66l-.6.56V0h-.66v6.87l-.58.57V0h-.67v10.9l4.42-4.34V0h-.66v4.42Zm-8.79 5.76 4.44 4.35v-2.8L8.69 7.4v2.77Zm0 3.65 4.44 4.33v-2.8l-4.44-4.3v2.77Zm0 3.63 4.44 4.33V19l-4.44-4.31v2.78Zm26.37 2.29H24.3a2.25 2.25 0 0 0 .36-1.22 2.32 2.32 0 0 0-2.33-2.31 2.32 2.32 0 0 0-2.31 2.31c0 .5.16.96.43 1.34a.74.74 0 0 0-.33.61c0 .26.14.49.33.62a2.32 2.32 0 0 0-.43 1.34 2.31 2.31 0 0 0 2.31 2.31 2.32 2.32 0 0 0 2.33-2.31c0-.45-.13-.87-.36-1.22h8.01v.49h-.8v.68h.8v.7h-.8v1.3h.8v-.58h1.17v.58h.79v-1.3h-.79v-.7h.79v-.68h-.79v-.5h1.58a.56.56 0 0 0 .56-.56v-.34a.57.57 0 0 0-.56-.56Zm-11.53 2.7a1.2 1.2 0 0 1-2.4 0c0-.24.08-.47.2-.66l.34-.56a.97.97 0 0 1-.34-.75c0-.3.13-.56.33-.74l-.32-.56a1.13 1.13 0 0 1-.2-.66 1.2 1.2 0 0 1 2.4 0c0 .49-.56 1.65-.56 1.65v.62c-.01.01.55 1.17.55 1.66ZM4.67 18.34v2.89c0 2.75 1.2 4.53 1.9 5.21l4.58 4.5c1.28 1.25 1.5 1.66 1.79 2.37v-3.2c0-2.84-1.44-3.94-2.19-4.67-1.73-1.68-2.89-2.8-3.82-3.73a8.98 8.98 0 0 1-2.26-3.37Zm6.08 14.24c-1.73-1.7-2.89-2.8-3.82-3.73a10 10 0 0 1-2.25-2.98v2.49a7.87 7.87 0 0 0 1.89 5.24l4.58 4.47c1.28 1.25 1.5 1.85 1.79 2.55v-3.37c0-2.85-1.45-3.95-2.19-4.67Z',
767
+ 'M19.88 5.34c-.32 0-.64 0-.96.02V6.7a18.5 18.5 0 1 1 .95 36.94A18.5 18.5 0 0 1 1.35 25.17c0-5.67 2.55-10.73 6.58-14.13V9.32A19.78 19.78 0 0 0 0 25.17C0 36.12 8.9 45 19.88 45a19.85 19.85 0 0 0 19.86-19.83c0-10.95-8.9-19.83-19.87-19.83Z',
768
+ 'M33.93 35.53c.3-.41.6-.85.87-1.3v-2.66h-.87v3.96Zm2.54-4.92c.12-.4.24-.78.34-1.16h-2.88v.7h.43c.77-.02 1.63-.03 2.11.46Zm-19.19-1.27h-.78v7.91h.78v-7.9Z',
769
+ 'M14.7 27.83h2.58c.67 0 1.14.14 1.4.4.27.25.4.72.4 1.38v7.4c0 .66-.12 1.12-.4 1.38-.4.41-1.16.41-1.78.41l-.4-.01v3.5l.78.14v-2.88c1.2 0 1.97-.4 2.34-1.22v4.29h.26l.5-.01V29.74c0-.68.13-1.16.4-1.43.25-.27.72-.4 1.37-.4.67 0 1.65-.1 2.16.4.26.27.38.76.38 1.43v3.8h-1.77v-4.06h-.77v12.99c.26-.03.5-.07.77-.12V34.3h1.77v7.64c.36-.1.72-.21 1.08-.34v-7c0-.8.19-1.4 1-1.67l-.9-4.87h1.8l.3 5.31h.22l.3-5.31h1.88l-1.01 4.87c.84.3 1.01.81 1.01 1.66v4.53a16.63 16.63 0 0 0 1.5-1.27v-9.83h5.25l.1-.72H24.93l.17.89c-.38-.72-1.12-1.08-2.2-1.08h-.77c-1.3 0-2.1.52-2.4 1.55-.27-1.08-1.1-1.62-2.46-1.62h-3.36v14.52c.26.09.52.18.78.25V27.84Zm16.29 5.58-.85-.8.85-4.37v5.17Z',
770
+ 'M27.66 40.79c.27-.14.55-.28.8-.43v-5.98h-.8v6.4Z',
771
+ ];
772
+ const Logo = JSX(({ className, href, children, targetBlank }) => {
773
+ return (jsxs("a", { className: `inline-flex items-center font-sans no-underline ${className || ''}`, href: href || 'https://rshb.ru/', target: targetBlank ? '_blank' : '_self', children: [jsx(SVG, { className: "text-primary-main w-10", viewBox: "0 0 40 45", paths: LOGO_PATHS.map((d) => ({ d })) }), jsx("span", { className: "text-black text-base font-medium ml-2.5", children: children || 'Россельхозбанк' })] }));
774
+ });
775
+
776
+ const SearchBar = JSX(({ className, context }) => {
777
+ const { term, setTerm } = context.useSearch();
778
+ return (jsxs("form", { className: `relative ${className || ''}`, children: [jsxs("div", { className: "absolute rounded h-full flex items-center justify-center pl-4 max-w-[170px] gap-3.5 pointer-events-none", children: [jsx("div", { className: "w-[24px] h-[24px]", children: jsx(Icon, { name: "LoupeIcon", width: "24", height: "24" }) }), !term && (jsx("span", { className: "font-sans font-normal text-base text-secondary-text", children: "\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u0441\u0430\u0439\u0442\u0443" }))] }), jsx("input", { className: "pl-12 w-full font-sans font-normal text-base text-black border border-solid border-main-divider rounded h-full box-border outline-none pr-[6%]", value: term, onChange: (e) => setTerm(e.target.value), type: "text", name: "s" }), term && (jsx("button", { type: "submit", className: "absolute font-sans font-normal text-sm cursor-pointer bg-transparent hover:bg-primary-hover active:bg-primary-active text-primary-main hover:text-white border-none px-5 py-2 rounded top-1 right-1 outline-none", onClick: (e) => {
779
+ e.preventDefault();
780
+ console.log('click');
781
+ }, children: "\u041D\u0430\u0439\u0442\u0438" }))] }));
782
+ });
783
+
784
+ const Contacts = JSX(({ className, items, hasButton, context }) => {
785
+ const router = context.useRouter();
786
+ const { handlerDecorator } = context;
787
+ return (jsxs("div", { className: `flex flex-col ${className || ''}`, children: [items?.length ? items.map(renderContact) : null, hasButton ? (jsx(Button, { version: "primary", className: "my-4", ...useLink({ router, handlerDecorator }, {
788
+ text: 'Обратная связь',
789
+ href: '/',
790
+ target: '_blank',
791
+ }) })) : null] }));
792
+ });
793
+ const renderContact = (item, index) => {
794
+ const { type, text, description } = item;
795
+ return (jsxs("div", { className: "mb-4", children: [jsx("div", { children: renderText(type, text) }), jsx("div", { className: "font-sans text-sm text-secondary-text", children: description })] }, String(index)));
796
+ };
797
+ const renderText = (type, text = '') => {
798
+ switch (type) {
799
+ case 'tel':
800
+ return (jsx("a", { className: "font-sans font-medium text-xl text-primary-text no-underline", href: `tel:${formatTel(text)}`, children: text }));
801
+ case 'email':
802
+ return (jsx("a", { className: "font-sans font-medium text-xl text-primary-text no-underline", href: `mailto:${text}`, children: text }));
803
+ default:
804
+ return jsx("span", { children: text });
805
+ }
806
+ };
807
+ const formatTel = (s) => s.replaceAll(/(\-|\s|\(|\)|\D+)/g, '');
808
+
809
+ const HorizontalNavigation = JSX(({ className, links, context }) => {
810
+ const router = context.useRouter();
811
+ const { handlerDecorator } = context;
812
+ return (jsx("div", { className: `${className || ''}`, children: links?.length ? (jsx("div", { className: "flex justify-between items-center gap-5 py-5 border-solid border-x-0 border-y border-y-main-divider", children: links.map((_, i) => (jsx(HorizontalNavigationLink, { index: i, ...useLink({ router, handlerDecorator }, _) }, String(i)))) })) : null }));
813
+ });
814
+ const HorizontalNavigationLink = JSX(({ className, index, text, href, target, onClick }) => (jsx("a", { className: `font-sans font-normal text-sm text-secondary-text hover:text-primary-text inline-block no-underline max-w-[292px] ${className || ''}`, href: href, target: target, onClick: onClick, children: text || `Документ ${index}` })));
815
+
816
+ function useSitemap(useAsyncData) {
817
+ const { data } = useAsyncData(sitemapURL(), fetchSitemap);
818
+ return data || {};
819
+ }
820
+ async function fetchSitemap() {
821
+ const response = await fetch(sitemapURL());
822
+ return await response.json();
823
+ }
824
+ function sitemapURL() {
825
+ return `/wcms-resources/${projectSettings.SITEMAP || 'sitemap'}.json`;
826
+ }
827
+
828
+ const cmp = (a) => (b) => a?.href === b?.href;
829
+ const substitute = (items, substitution) => (items || []).map((_) => substitution?.find(cmp(_)) || _);
830
+ const subtract = (minuend, subtrahend) => (minuend || []).filter((_) => !subtrahend?.find(cmp(_)));
831
+ function mergeTopItems(left, right) {
832
+ return substitute(left, right).concat(subtract(right, left));
833
+ }
834
+
835
+ const Sitemap = JSX(({ className, items, context }) => {
836
+ const sitemap = useSitemap(context.useAsyncData);
837
+ const mergedItems = mergeTopItems(sitemap.topItems, items);
838
+ const linkParams = {
839
+ router: context.useRouter(),
840
+ handlerDecorator: context.handlerDecorator,
841
+ };
842
+ return (jsx("div", { className: `flex items-start justify-start gap-11 xl:gap-5 ${className || ''}`, children: mergedItems?.map((_, i) => renderColumn(_, i, linkParams)) }));
843
+ });
844
+ const renderColumn = (c, index, { router, handlerDecorator }) => {
845
+ const { text, href, items, target } = c;
846
+ return (jsxs("div", { className: "flex flex-col w-[235px] gap-[14px]", children: [jsx("a", { className: "block font-sans font-medium text-base text-primary-text no-underline", href: href, target: target || '_self', children: text || `Раздел ${index}` }), items?.map((_, i) => (jsx(ColumnItem, { ...useLink({ router, handlerDecorator }, _) }, String(i))))] }, String(index)));
847
+ };
848
+ const ColumnItem = JSX(({ text, href, target, index }) => (jsx("a", { className: "block font-sans font-normal text-base text-secondary-text hover:text-primary-main no-underline", href: href, target: target || '_self', children: text || `Раздел ${index}` })));
849
+
850
+ const ICONS_MAP = [
851
+ {
852
+ origins: ['t.me', 'telegram.org'],
853
+ icon: 'TelegramIcon',
854
+ label: 'Телеграм',
855
+ width: '20px',
856
+ height: '16px',
857
+ },
858
+ { origins: ['vk.com'], icon: 'VKIcon', label: 'ВКонтакте', width: '24px', height: '12px' },
859
+ { origins: ['ok.ru'], icon: 'OkIcon', label: 'Одноклассники', width: '12px', height: '20px' },
860
+ ];
861
+ const SocialMedia = JSX(({ className, media, context }) => {
862
+ const router = context.useRouter();
863
+ const { handlerDecorator } = context;
864
+ return (jsx("div", { className: `flex items-end justify-end gap-2 pt-[30px] pb-7 ${className || ''}`, children: media?.map((_, index) => (jsx(MediaButton, { ...useLink({ router, handlerDecorator }, _) }, String(index)))) }));
865
+ });
866
+ const MediaButton = JSX(({ href }) => {
867
+ const { icon, label, width, height } = ICONS_MAP.find(({ origins }) => origins.some((_) => href?.includes(_))) || {};
868
+ if (!icon)
869
+ return null;
870
+ return (jsx(Button, { rounded: true, href: href, target: "_blank", rel: "noopener noreferrer", "aria-label": label, className: "border-solid border border-main-divider w-9 h-9 flex items-center justify-center hover:fill-primary-main", appendLeft: jsx(Icon, { name: icon, width: width, height: height, asSVG: true }) }));
871
+ });
872
+
873
+ const TextInformation = JSX(({ className, links, context }) => {
874
+ const router = context.useRouter();
875
+ const { handlerDecorator } = context;
876
+ return (jsxs("div", { className: `${className || ''}`, children: [jsx("div", { className: "pt-5 pb-[5px]", children: jsx("span", { className: "font-sans font-normal text-xs text-secondary-text", children: `\u00a9\u00A02000-${new Date().getFullYear()}\u00A0АО \u00ABРоссельхозбанк\u00BB Генеральная лицензия Банка России \u2116\u00A03349 от\u00A012.08.2015\u00A0г.` }) }), links?.length ? (jsx("div", { className: "flex justify-start items-start gap-5 pt-[5px]", children: links.map((_, i) => (jsx(TextInformationLink, { index: i, ...useLink({ router, handlerDecorator }, _) }, String(i)))) })) : null] }));
877
+ });
878
+ const TextInformationLink = JSX(({ className, index, text, href, target, onClick }) => (jsx("a", { className: `font-sans font-normal text-xs text-secondary-text visited:text-secondary-text hover:text-primary-text inline-block no-underline max-w-[292px] ${className || ''}`, href: href, target: target, onClick: onClick, children: text || `Документ ${index}` })));
879
+
880
+ const LEFT_COL_WIDTH_FULL_HD = 'w-[280px]';
881
+ const LEFT_COL_WIDTH_SMALL_DESKTOP = 'xl:w-[220px]';
882
+ const Footer$1 = JSX(({ className, documents, relatedEnterprises, contacts, socialMedia, topItems, context }) => {
883
+ return (jsxs("footer", { className: `${className} px-9 py-10 bg-white`, children: [jsxs("div", { className: "flex items-stretch gap-32 pb-8 xl:gap-8", children: [jsx(Logo, { className: `${LEFT_COL_WIDTH_FULL_HD} ${LEFT_COL_WIDTH_SMALL_DESKTOP}` }), jsx(SearchBar, { context: context, className: "grow" })] }), jsxs("div", { className: "flex items-stretch gap-32 xl:gap-8", children: [jsx(Contacts, { className: `${LEFT_COL_WIDTH_FULL_HD} shrink-0 overflow-hidden ${LEFT_COL_WIDTH_SMALL_DESKTOP}`, items: contacts, context: context, hasButton: true }), jsx(Sitemap, { className: "pt-[3px]", context: context, items: topItems })] }), jsx(SocialMedia, { media: socialMedia, context: context }), jsx(HorizontalNavigation, { links: relatedEnterprises, context: context }), jsx(TextInformation, { links: documents, context: context })] }));
884
+ });
885
+
886
+ const cardStyleMap = {
887
+ normal: 'min-w-[364px] w-[364px]',
888
+ mini: 'min-w-[260px] w-[260px]',
889
+ };
890
+ const cardWidthMap = {
891
+ normal: 380,
892
+ mini: 276,
893
+ };
894
+ const galleryLengthForScrollMap = {
895
+ normal: 3,
896
+ mini: 4,
897
+ };
898
+ const GalleryInner = JSX(({ title, description, context, cards = [], className, version = 'normal' }) => {
899
+ const [activeCardIndex, setActiveCardIndex] = context.useState(0);
900
+ function handleNextClick() {
901
+ setActiveCardIndex(activeCardIndex + 1);
902
+ }
903
+ function handlePrevClick() {
904
+ setActiveCardIndex(activeCardIndex - 1);
905
+ }
906
+ const isGalleryScrollAvailable = cards?.length > galleryLengthForScrollMap[version];
907
+ const showNextButton = isGalleryScrollAvailable &&
908
+ cards?.length - activeCardIndex > galleryLengthForScrollMap[version];
909
+ const showPrevButton = isGalleryScrollAvailable && activeCardIndex > 0;
910
+ return (jsxs("section", { className: `relative font-sans text-primary-text bg-white p-12 overflow-hidden ${className}`, children: [jsxs("div", { className: "flex flex-col items-center mb-8", children: [title ? jsx(Title, { className: "font-medium m-0 text-center", children: title }) : null, description ? (jsx("div", { className: "font-normal text-base max-w-[600px] mt-3", children: description })) : null] }), jsx("div", {
911
+ // Need to place all cards at the center if count of cards less than 4
912
+ className: `flex ${cards?.length <= galleryLengthForScrollMap[version] ? 'justify-center' : ''} duration-1000`,
913
+ // All cards has same width
914
+ style: { transform: `translateX(-${activeCardIndex * cardWidthMap[version]}px)` }, role: "list", children: cards?.map((card, i) => renderCard$1(card, i, version)) }), showPrevButton && (jsx(ArrowButton, { className: "absolute top-1/2 left-8 rotate-180", onClick: handlePrevClick, ariaLabel: "\u041F\u0440\u043E\u043B\u0438\u0441\u0442\u0430\u0442\u044C \u0432\u043B\u0435\u0432\u043E" })), showNextButton && (jsx(ArrowButton, { className: "absolute top-1/2 right-1 z-10", onClick: handleNextClick, ariaLabel: "\u041F\u0440\u043E\u043B\u0438\u0441\u0442\u0430\u0442\u044C \u0432\u043F\u0440\u0430\u0432\u043E" })), jsx("div", { className: "absolute top-0 right-0 bottom-0 w-[84px] bg-opacity-to-white" })] }));
915
+ });
916
+ function renderCard$1(card, i, version) {
917
+ return (jsxs("div", { className: `box-border border-solid border rounded-md border-main-divider p-7 mx-2 flex flex-col justify-between items-stretch ${cardStyleMap[version]} w-full`, role: "listitem", children: [jsxs("div", { children: [card.image?.src ? (jsx("div", { className: "flex justify-center", children: jsx(Img, { className: "mb-6", image: card.image }) })) : null, card.title ? (jsx("h4", { className: `font-medium text-xl m-0 ${!card.description && !card.items?.length ? 'text-center' : ''}`, children: card.title })) : null, card.description ? (jsx("div", { className: "font-normal text-sm text-secondary-text mt-2", children: card.description })) : null, card.items?.length ? (jsx("section", { className: "max-w-[308px] mt-2", role: "list", children: card.items.map(renderItem) })) : null] }), card.href ? (jsx(Button, { className: "mt-6", text: "\u041F\u043E\u0434\u0440\u043E\u0431\u043D\u0435\u0435", version: "secondary", href: card.href })) : null] }, String(i)));
918
+ }
919
+ function renderItem(item, i) {
920
+ return (jsx(BlockItem, { children: jsx("span", { className: "text-sm text-secondary-text", children: item }) }, String(i)));
921
+ }
922
+
923
+ const Gallery$1 = JSX((props) => jsx(GalleryInner, { ...props, version: "normal" }));
924
+
925
+ const HeaderItem = JSX(({ className, text, href, target, active, onClick, children }) => {
926
+ const textStyle = active ? 'text-primary-main' : 'text-primary-text hover:text-primary-main';
927
+ return (jsxs("a", { className: `relative inline-block bg-transparent text-center no-underline ${className || ''}`, href: href, target: target, onClick: onClick, children: [jsx("span", { className: `font-sans font-normal text-base ${textStyle}`, children: text || children }), active ? (jsx("div", { className: "absolute left-0 -bottom-2 w-full h-[2px] bg-primary-main" })) : null] }));
928
+ });
929
+
930
+ const TopItem = JSX(({ className, text, href, target, active, flat, onClick, children, ariaLabel }) => {
931
+ const linkStyle = active ? 'border-primary-main rounded-md' : 'border-transparent';
932
+ const textStyle = active
933
+ ? 'text-primary-main'
934
+ : `${flat ? 'text-primary-text' : 'text-secondary-text'} hover:text-primary-main`;
935
+ return (jsx("a", { className: `inline-block border border-solid bg-transparent text-center no-underline ${flat ? '' : 'px-4 py-2'} ${linkStyle} ${className || ''}`, href: href, target: target, onClick: onClick, rel: "noopener noreferrer", "aria-label": ariaLabel, children: jsx("span", { className: `font-sans font-normal text-sm ${textStyle}`, children: text || children }) }));
936
+ });
937
+
938
+ const HeaderSecondaryMenuButton = JSX(({ className, children, ariaLabel }) => (jsx("button", { type: "button", className: `border-0 p-0 w-[24px] h-[24px] flex items-center bg-inherit cursor-pointer ${className || ''}`, disabled: true, "aria-label": ariaLabel, children: children })));
939
+
940
+ const HeaderSecondaryMenu = JSX(({ context, className, defaultLocation = '' }) => {
941
+ const [city, getCity] = context.useGeolocation(defaultLocation);
942
+ return (jsxs("div", { className: `flex items-center ${className || ''}`, children: [jsx(TopItem, { className: "mr-5", flat: true, href: "#", text: city, ariaLabel: "\u041C\u0435\u0441\u0442\u043E\u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435", onClick: getCity }), jsx(TopItem, { className: "mr-7", flat: true, href: "#", text: "\u041E\u0444\u0438\u0441\u044B \u0438 \u0431\u0430\u043D\u043A\u043E\u043C\u0430\u0442\u044B", ariaLabel: "\u0421\u043F\u0438\u0441\u043E\u043A \u0432\u0441\u0435\u0445 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0445 \u043E\u0444\u0438\u0441\u043E\u0432 \u0438 \u0431\u0430\u043D\u043A\u043E\u043C\u0430\u0442\u043E\u0432" }), jsx(HeaderSecondaryMenuButton, { className: "mr-5 text-primary-text hover:text-primary-main", ariaLabel: "\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u0441\u0430\u0439\u0442\u0443", children: jsx(Icon, { name: "LoupeIcon", "aria-hidden": "true", className: "h-full", asSVG: true }) }), jsx(HeaderSecondaryMenuButton, { className: "mr-5 text-primary-text hover:text-primary-main", ariaLabel: "\u041F\u0440\u043E\u0444\u0438\u043B\u044C", children: jsx(Icon, { name: "ProfileIcon", "aria-hidden": "true", className: "h-full", asSVG: true }) }), jsx(HeaderSecondaryMenuButton, { className: "min-w-[32px] min-h-[32px] fill-secondary-light hover:fill-secondary-hover", ariaLabel: "\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0441\u0441\u044B\u043B\u043A\u0438", children: jsx(Icon, { name: "GridIcon", "aria-hidden": "true", className: "h-full", asSVG: true }) })] }));
943
+ });
944
+
945
+ function isSubItemActive(router) {
946
+ return (subItem) => isHrefActive(subItem.href, router);
947
+ }
948
+
949
+ function isTopItemActive(router) {
950
+ return (topItem) => isHrefActive(topItem.href, router, (topItemHref, baseHref) => baseHref.startsWith(topItemHref));
951
+ }
952
+
953
+ const Header = JSX(({ className, defaultLocation, context, topItems }) => {
954
+ const router = context.useRouter();
955
+ const sitemap = useSitemap(context.useAsyncData);
956
+ const { handlerDecorator } = context;
957
+ const mergedItems = mergeTopItems(sitemap.topItems, topItems);
958
+ const activeTopItem = mergedItems.find(isTopItemActive(router));
959
+ const subItems = activeTopItem?.items;
960
+ const activeSubItem = subItems?.find(isSubItemActive(router));
961
+ const topMenu = mergedItems.map((_, i) => (jsx(TopItem, { active: _ === activeTopItem, ...useLink({ router, handlerDecorator }, _), ariaLabel: _.text }, String(i))));
962
+ const subMenu = subItems?.map((_) => (jsx(HeaderItem, { className: "mr-8", active: _ === activeSubItem, ...useLink({ router, handlerDecorator }, _) }, _.href)));
963
+ return (jsxs("header", { className: `pt-5 pb-8 px-20 bg-white ${className || ''}`, children: [jsxs("div", { className: "flex items-center", children: [jsx(Logo, { className: "mr-8" }), topMenu, jsx(HeaderSecondaryMenu, { context: context, className: "ml-auto", defaultLocation: defaultLocation })] }), jsx("div", { className: "mt-5 h-[1px] bg-main-divider" }), jsx("nav", { className: "mt-5", children: subMenu })] }));
964
+ });
965
+
966
+ const MiniGallery = JSX((props) => (jsx(GalleryInner, { ...props, version: "mini" })));
967
+
968
+ const MobileAppTile = JSX(({ className, context, title = 'Мобильное приложение', qr, buttons = [] }) => {
969
+ return (jsx(Tile, { className: className, context: context, title: title, buttons: buttons, children: jsxs("div", { className: "flex items-center", children: [qr?.src && qr?.href && (jsx("a", { href: qr.href, target: "_blank", children: jsx("img", { src: qr.src, alt: title, title: title, width: "164", height: "164", className: "w-[90px] h-[90px] min-w-[90px] min-h-[90px] bg-secondary-light" }) })), jsx("span", { className: "font-normal text-sm text-secondary-text ml-4", children: "\u041D\u0430\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u0430\u043C\u0435\u0440\u0443 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430 \u043D\u0430 QR-\u043A\u043E\u0434 \u0438 \u0441\u043A\u0430\u0447\u0430\u0439\u0442\u0435 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0435" })] }) }));
970
+ });
971
+
972
+ const GOLDEN_RATIO = 1.618;
973
+ const Placeholder = JSX(({ className, context, title }) => {
974
+ return (jsx(Tile, { className: className, context: context, title: title, description: "\u0411\u043B\u043E\u043A \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043E\u0442\u043A\u0435...", children: jsx("figure", { className: "m-0 min-w-[600px]", children: renderShimmer() }) }));
975
+ });
976
+ const renderShimmer = (size = 3) => goldenSequence(100, size)
977
+ .map((_) => Math.floor(_))
978
+ .map(renderShimmerItem);
979
+ const renderShimmerItem = (width = 100, index) => (jsx("div", { style: { width: `${width}%` }, className: "h-4 mt-2 bg-secondary-light" }, String(index)));
980
+ const goldenSequence = (first, size) => [first].concat(size > 0 ? goldenSequence(first / GOLDEN_RATIO, size - 1) : []);
981
+
982
+ const ProductBlockInner = JSX(({ className, context, title, titleSize, description, benefits, buttons, image, items }) => {
983
+ return (jsxs("div", { className: `flex grow justify-between items-stretch ${className || ''}`, children: [jsxs("div", { className: 'flex flex-col', children: [title && (
984
+ /* TODO Why <Title> is duplicated here? */
985
+ jsx(Title, { size: titleSize || 'XL', className: "font-medium m-0 mb-4 whitespace-pre-wrap max-w-[600px] text-primary-text", children: title })), jsx(BaseTile, { context: context, description: description, items: items, buttons: buttons, children: benefits?.length ? (jsx("div", { className: "flex gap-6 mt-6 mb-3.5", children: benefits.map(renderBenefit) })) : null })] }), image?.src && jsx(Img, { className: "mt-auto", image: image })] }));
986
+ });
987
+ function renderBenefit(benefit, i) {
988
+ return (jsxs("div", { className: "flex gap-4 items-center", children: [benefit.icon && (jsx(Icon, { className: "w-[50px] h-[50px] min-w-[50px] min-h-[50px] bg-main rounded-full p-[10px] box-border", name: benefit.icon, width: "24", height: "24" })), jsxs("div", { className: "flex gap-1 flex-col h-full", children: [jsx("h4", { className: "font-medium text-primary-text text-xl m-0", children: benefit.label }), benefit.description && (jsx("div", { className: "font-normal text-sm text-secondary-text", children: benefit.description }))] })] }, String(i)));
989
+ }
990
+
991
+ const Breadcrumb = JSX(({ text, href, target, onClick, className, children }) => {
992
+ if (href) {
993
+ return (jsx("a", { className: `no-underline ${className || ''}`, href: href, target: target, onClick: onClick, children: jsx("span", { className: `${className || ''}`, children: text || children }) }));
994
+ }
995
+ else {
996
+ return jsx("span", { className: `${className || ''}`, children: text || children });
997
+ }
998
+ });
999
+
1000
+ function joinList(sep) {
1001
+ return (list) => list.reduce((acc, el, i) => (acc.length ? acc.concat({ ...sep, key: i }, el) : [el]), []);
1002
+ }
1003
+
1004
+ const ProductBlock$1 = JSX((props) => {
1005
+ const { context, className, breadcrumbs } = props;
1006
+ const router = context.useRouter();
1007
+ const { handlerDecorator } = context;
1008
+ return (jsxs("section", { className: `font-sans bg-white pt-10 pl-[50px] pb-[50px] pr-[7.5rem] ${className || ''}`, children: [breadcrumbs?.length ? (jsx("div", { className: "text-xs mb-6", children: joinList(jsx("span", { className: "text-secondary-text mx-2", children: "/" }))(breadcrumbs.map((breadcrumb, i) => (jsx(Breadcrumb, { ...useLink({ router, handlerDecorator }, { className: 'text-secondary-text', ...breadcrumb }) }, String(i))))) })) : null, jsx(ProductBlockInner, { ...props })] }));
1009
+ });
1010
+
1011
+ const ProductGallery = JSX(({ className, context, duration = 0, slides = [] }) => {
1012
+ const galleryNav = slides.map((s) => s.nav);
1013
+ const galleryBlocks = slides.map((s) => s.productBlock);
1014
+ const [activeSlideIndex, setActiveSlideIndex] = context.useState(0);
1015
+ return (jsxs("section", { className: `font-sans bg-white overflow-hidden w-100 ${className || ''}`, children: [jsx("div", { className: `flex duration-1000`, style: { transform: `translateX(-${activeSlideIndex}00%)` }, role: "list", children: galleryBlocks.map((_, i) => renderProductBlock(_, i, context)) }), jsx("div", { className: `border-t border-solid border-main-divider flex`, children: galleryNav.map((slide, i) => renderNavButton({
1016
+ slide,
1017
+ i,
1018
+ activeSlideIndex,
1019
+ onClick: () => setActiveSlideIndex(i),
1020
+ duration,
1021
+ })) })] }));
1022
+ });
1023
+ function renderProductBlock(block, i, context) {
1024
+ return (jsx("section", { className: "flex grow-0 shrink-0 basis-full", role: "listitem", children: jsx("div", { className: "p-10 flex grow", children: jsx(ProductBlockInner, { className: "pl-2.5 pt-2.5 pb-1.5 pr-[6.25rem]", context: context, ...block }) }) }, String(i)));
1025
+ }
1026
+ function renderNavButton({ slide, i, activeSlideIndex, onClick, duration }) {
1027
+ const isActiveBtn = i === activeSlideIndex;
1028
+ const progressBarClassName = isActiveBtn ? 'animate-slide' : '';
1029
+ const btnTitleClassName = isActiveBtn ? 'text-primary-text' : 'text-secondary-text';
1030
+ return (jsxs("button", { type: "button", onClick: onClick, className: `group relative overflow-hidden border-0 bg-inherit cursor-pointer text-left px-0 py-4 grow basis-0`, children: [jsxs("div", { className: "border-0 border-r border-solid border-main-divider px-6", children: [jsx("div", { className: `text-sm font-medium group-hover:text-primary-text ${btnTitleClassName}`, children: slide?.title }), jsx("div", { className: "text-xs text-secondary-text", children: slide.desc })] }), jsx("div", { className: `absolute bottom-0 left-0 w-full h-[3px] bg-primary-main -translate-x-full ${progressBarClassName}`, style: { animationDuration: `${duration}s` } })] }, String(i)));
1031
+ }
1032
+
1033
+ const ProductTile = JSX((props) => {
1034
+ const { benefits, version } = props;
1035
+ return (jsx(Tile, { ...props, children: jsxs("div", { className: "flex mt-5 mb-1", children: [benefits?.length ? (jsx("div", { className: "mr-8", children: benefits.map(renderBenefitDescription) })) : null, benefits?.length ? (jsx("div", { className: "pt-1", children: benefits.map((_, i) => renderBenefitLabel(_, i, version)) })) : null] }) }));
1036
+ });
1037
+ function renderBenefitLabel(benefit, i, version = 'primary') {
1038
+ const labelStyleMap = {
1039
+ primary: 'text-secondary-text',
1040
+ secondary: 'text-white',
1041
+ };
1042
+ return (jsx("div", { className: `text-sm ${i ? 'mt-4' : ''} ${labelStyleMap[version]}`, children: benefit.label }, String(i)));
1043
+ }
1044
+ function renderBenefitDescription(benefit, i) {
1045
+ return (jsx("div", { className: `text-xl font-medium ${i ? 'mt-2.5' : ''}`, children: benefit.description }, String(i)));
1046
+ }
1047
+
1048
+ const PromoTile = JSX(({ className, context, title = 'Акции и спецпредложения', date, description, buttons = [], version, }) => {
1049
+ return (jsx(Tile, { className: className, context: context, title: title, buttons: buttons, version: version, children: jsxs("div", { children: [date && jsx("div", { className: "text-sm mb-2", children: formatDate(date) }), jsx("div", { className: "text-base", children: description })] }) }));
1050
+ });
1051
+ function formatDate(date) {
1052
+ const dateObj = new Date(date);
1053
+ const dateFormat = {
1054
+ day: 'numeric',
1055
+ month: 'long',
1056
+ year: 'numeric',
1057
+ };
1058
+ return dateObj.toLocaleString('ru-RU', dateFormat).replace('г.', '');
1059
+ }
1060
+
1061
+ const StepsBlock = JSX(({ className, title, steps }) => {
1062
+ return (jsxs("section", { className: `font-sans text-primary-text bg-white px-12 py-12 flex flex-col items-center ${className || ''}`, children: [jsx(Title, { className: "font-medium m-0 max-w-[47rem] text-center", children: title }), steps?.length ? (jsxs("div", { children: [jsx("div", { className: "flex mt-9 items-center px-[88px]", children: joinList(jsx("div", { className: "h-0.5 w-full bg-secondary-light" }))(steps.map((step, i) => renderStepIcon(step, i))) }), jsx("div", { className: "flex mt-9 justify-between gap-x-24", children: steps.map(renderStepTitle) })] })) : null] }));
1063
+ });
1064
+ const renderStepIcon = (step, i) => {
1065
+ return (jsx("div", { className: "flex flex-col items-center text-center relative", children: jsx("div", { className: "h-[100px] w-[100px] min-w-[100px] min-h-[100px] bg-secondary-light rounded-full p-[26px] box-border z-10", children: (step.icon && jsx(Icon, { name: step.icon, width: "48", height: "48" })) || (jsx("span", { className: "font-medium text-title-sm text-secondary-text", children: i + 1 })) }) }, String(i)));
1066
+ };
1067
+ const renderStepTitle = (step, i) => {
1068
+ return (jsx("div", { className: "flex flex-col items-center text-center relative w-[276px]", children: jsxs("div", { className: "max-w-min", children: [jsx("h5", { className: "font-medium text-xl m-0 mt-4 whitespace-nowrap px-3", children: step.label }), step.description && (jsx("div", { className: "font-normal text-sm text-secondary-text mt-2", children: step.description }))] }) }, String(i)));
1069
+ };
1070
+
1071
+ const Blocks = {
1072
+ Accordion,
1023
1073
  BenefitsBlock,
1024
- ProductGallery,
1074
+ ComparisonTable,
1075
+ CreditCalculator,
1025
1076
  ExchangeRateTile,
1026
- MobileAppTile,
1077
+ Footer: Footer$1,
1027
1078
  Gallery: Gallery$1,
1079
+ Header,
1080
+ Headline,
1081
+ LinkDocs,
1028
1082
  MiniGallery,
1029
- ComparisonTable,
1030
- Accordion,
1031
- CreditCalculator,
1083
+ MobileAppTile,
1084
+ PictureText,
1085
+ Placeholder,
1086
+ ProductBlock: ProductBlock$1,
1087
+ ProductGallery,
1088
+ ProductTile,
1089
+ PromoTile,
1090
+ StepsBlock,
1091
+ TextBlock,
1092
+ Tile,
1032
1093
  };
1033
1094
 
1034
1095
  const LikeButton = JSX(({ className, onClick, ariaLabel }) => (jsx("button", { type: "button", className: `border-0 w-[36px] bg-inherit cursor-pointer ${className || ''}`, onClick: onClick, "aria-label": ariaLabel, children: renderLikeIcon() })));
@@ -1115,16 +1176,18 @@
1115
1176
  });
1116
1177
 
1117
1178
  const MobileBlocks = {
1118
- Header,
1179
+ ExchangeRateTile,
1119
1180
  Footer,
1181
+ Gallery,
1182
+ Header,
1183
+ Headline,
1184
+ MobileAppTile,
1185
+ PictureText,
1120
1186
  Placeholder,
1121
- Tile,
1122
- ProductTile,
1123
1187
  ProductBlock,
1188
+ ProductTile,
1124
1189
  TextBlock,
1125
- ExchangeRateTile,
1126
- MobileAppTile,
1127
- Gallery,
1190
+ Tile,
1128
1191
  // TODO StepsBlock,
1129
1192
  // TODO BenefitsBlock,
1130
1193
  // TODO ProductGallery