@alfadocs/ui-kit-debug 1.12.6 → 1.13.0

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 (138) hide show
  1. package/dist/_chunks/{actions-cell-renderer-DnSLrgQD.js → actions-cell-renderer-ReurEy5i.js} +2 -2
  2. package/dist/_chunks/{actions-cell-renderer-DnSLrgQD.js.map → actions-cell-renderer-ReurEy5i.js.map} +1 -1
  3. package/dist/_chunks/{address-fields-CZP4Wncx.js → address-fields-CZ0pEdEI.js} +4 -4
  4. package/dist/_chunks/{address-fields-CZP4Wncx.js.map → address-fields-CZ0pEdEI.js.map} +1 -1
  5. package/dist/_chunks/{ai-prompt-input-DnbfEJnr.js → ai-prompt-input-CrHr-5H8.js} +2 -2
  6. package/dist/_chunks/{ai-prompt-input-DnbfEJnr.js.map → ai-prompt-input-CrHr-5H8.js.map} +1 -1
  7. package/dist/_chunks/{anamnesis-summary-rows-BfhxWPO3.js → anamnesis-summary-rows-CRWO8x8g.js} +4 -4
  8. package/dist/_chunks/{anamnesis-summary-rows-BfhxWPO3.js.map → anamnesis-summary-rows-CRWO8x8g.js.map} +1 -1
  9. package/dist/_chunks/{audio-recorder-EWBCNIsd.js → audio-recorder-DXG6LTtO.js} +2 -2
  10. package/dist/_chunks/{audio-recorder-EWBCNIsd.js.map → audio-recorder-DXG6LTtO.js.map} +1 -1
  11. package/dist/_chunks/{autocomplete-BrONKN8l.js → autocomplete-MpBhz-fG.js} +86 -74
  12. package/dist/_chunks/{autocomplete-BrONKN8l.js.map → autocomplete-MpBhz-fG.js.map} +1 -1
  13. package/dist/_chunks/{balance-badge-cell-7L6nzB29.js → balance-badge-cell--iQ_gtmi.js} +4 -4
  14. package/dist/_chunks/{balance-badge-cell-7L6nzB29.js.map → balance-badge-cell--iQ_gtmi.js.map} +1 -1
  15. package/dist/_chunks/{bishop-score-Cnu0xs-z.js → bishop-score-CJUVBfAu.js} +2 -2
  16. package/dist/_chunks/{bishop-score-Cnu0xs-z.js.map → bishop-score-CJUVBfAu.js.map} +1 -1
  17. package/dist/_chunks/{booking-CBHKdsZl.js → booking-DQbo6mQF.js} +609 -591
  18. package/dist/_chunks/booking-DQbo6mQF.js.map +1 -0
  19. package/dist/_chunks/{care-plan-card-aDN4oem9.js → care-plan-card-D-FMfDKH.js} +2 -2
  20. package/dist/_chunks/{care-plan-card-aDN4oem9.js.map → care-plan-card-D-FMfDKH.js.map} +1 -1
  21. package/dist/_chunks/{care-plan-entry-card-BEhANdBE.js → care-plan-entry-card-Bvw_9T-d.js} +2 -2
  22. package/dist/_chunks/{care-plan-entry-card-BEhANdBE.js.map → care-plan-entry-card-Bvw_9T-d.js.map} +1 -1
  23. package/dist/_chunks/{care-plan-header-CkpPyQqG.js → care-plan-header-B5CBE0zu.js} +2 -2
  24. package/dist/_chunks/{care-plan-header-CkpPyQqG.js.map → care-plan-header-B5CBE0zu.js.map} +1 -1
  25. package/dist/_chunks/{city-input-towzBenY.js → city-input-DaQc-Hbj.js} +2 -2
  26. package/dist/_chunks/{city-input-towzBenY.js.map → city-input-DaQc-Hbj.js.map} +1 -1
  27. package/dist/_chunks/{combobox-DiMLItyu.js → combobox-D7_NLE2Z.js} +89 -81
  28. package/dist/_chunks/{combobox-DiMLItyu.js.map → combobox-D7_NLE2Z.js.map} +1 -1
  29. package/dist/_chunks/{contact-profile-card-BMIBr5s9.js → contact-profile-card-BZqi8Hck.js} +38 -36
  30. package/dist/_chunks/{contact-profile-card-BMIBr5s9.js.map → contact-profile-card-BZqi8Hck.js.map} +1 -1
  31. package/dist/_chunks/{country-select-UEF9BEeQ.js → country-select-DzbPFktV.js} +2 -2
  32. package/dist/_chunks/{country-select-UEF9BEeQ.js.map → country-select-DzbPFktV.js.map} +1 -1
  33. package/dist/_chunks/{document-preview-oyx9RhCo.js → document-preview-CDb-n_W7.js} +2 -2
  34. package/dist/_chunks/{document-preview-oyx9RhCo.js.map → document-preview-CDb-n_W7.js.map} +1 -1
  35. package/dist/_chunks/{face-scheme-CZaKm6fG.js → face-scheme-DA2vjqaM.js} +2 -2
  36. package/dist/_chunks/{face-scheme-CZaKm6fG.js.map → face-scheme-DA2vjqaM.js.map} +1 -1
  37. package/dist/_chunks/{file-manager-C0y7HBAN.js → file-manager-UsD8e_AB.js} +2 -2
  38. package/dist/_chunks/{file-manager-C0y7HBAN.js.map → file-manager-UsD8e_AB.js.map} +1 -1
  39. package/dist/_chunks/{gestational-age-calculator-CxZelpu2.js → gestational-age-calculator-CiOQjzgx.js} +2 -2
  40. package/dist/_chunks/{gestational-age-calculator-CxZelpu2.js.map → gestational-age-calculator-CiOQjzgx.js.map} +1 -1
  41. package/dist/_chunks/key-value-pair-BIBdZBLg.js +188 -0
  42. package/dist/_chunks/key-value-pair-BIBdZBLg.js.map +1 -0
  43. package/dist/_chunks/{link-cell-renderer-CenJx-_7.js → link-cell-renderer-CIASXsVM.js} +4 -4
  44. package/dist/_chunks/{link-cell-renderer-CenJx-_7.js.map → link-cell-renderer-CIASXsVM.js.map} +1 -1
  45. package/dist/_chunks/{multi-select-DqL4o0qV.js → multi-select-DYOvx2SJ.js} +56 -48
  46. package/dist/_chunks/{multi-select-DqL4o0qV.js.map → multi-select-DYOvx2SJ.js.map} +1 -1
  47. package/dist/_chunks/{muscle-scheme-yfzP_xoJ.js → muscle-scheme-BSJsI4-I.js} +2 -2
  48. package/dist/_chunks/{muscle-scheme-yfzP_xoJ.js.map → muscle-scheme-BSJsI4-I.js.map} +1 -1
  49. package/dist/_chunks/{optical-prescription-Dj3Eh5Ok.js → optical-prescription-BvwuqTpl.js} +2 -2
  50. package/dist/_chunks/{optical-prescription-Dj3Eh5Ok.js.map → optical-prescription-BvwuqTpl.js.map} +1 -1
  51. package/dist/_chunks/{patient-details-xrqe13az.js → patient-details-BQaUzPqp.js} +5 -5
  52. package/dist/_chunks/{patient-details-xrqe13az.js.map → patient-details-BQaUzPqp.js.map} +1 -1
  53. package/dist/_chunks/{patient-search-D5ufYoRc.js → patient-search-HeEUB-_X.js} +2 -2
  54. package/dist/_chunks/{patient-search-D5ufYoRc.js.map → patient-search-HeEUB-_X.js.map} +1 -1
  55. package/dist/_chunks/{patient-summary-card-CBfuDvJ5.js → patient-summary-card-CvDxhbBR.js} +2 -2
  56. package/dist/_chunks/{patient-summary-card-CBfuDvJ5.js.map → patient-summary-card-CvDxhbBR.js.map} +1 -1
  57. package/dist/_chunks/{payment-request-card-YVCcCZ25.js → payment-request-card-lmKLwsDs.js} +2 -2
  58. package/dist/_chunks/{payment-request-card-YVCcCZ25.js.map → payment-request-card-lmKLwsDs.js.map} +1 -1
  59. package/dist/_chunks/{periodontal-chart-BatZEFar.js → periodontal-chart-B9fphroR.js} +2 -2
  60. package/dist/_chunks/{periodontal-chart-BatZEFar.js.map → periodontal-chart-B9fphroR.js.map} +1 -1
  61. package/dist/_chunks/{periodontal-chart-card-BBpY_rBc.js → periodontal-chart-card-qEZPXj83.js} +2 -2
  62. package/dist/_chunks/{periodontal-chart-card-BBpY_rBc.js.map → periodontal-chart-card-qEZPXj83.js.map} +1 -1
  63. package/dist/_chunks/{pregnancy-dating-DtToyMyc.js → pregnancy-dating-D2wchD11.js} +2 -2
  64. package/dist/_chunks/{pregnancy-dating-DtToyMyc.js.map → pregnancy-dating-D2wchD11.js.map} +1 -1
  65. package/dist/_chunks/{province-select-BDywtmL-.js → province-select-BBc7s7vR.js} +2 -2
  66. package/dist/_chunks/{province-select-BDywtmL-.js.map → province-select-BBc7s7vR.js.map} +1 -1
  67. package/dist/_chunks/{select-BW5ecXlX.js → select-Bi8zril7.js} +165 -136
  68. package/dist/_chunks/select-Bi8zril7.js.map +1 -0
  69. package/dist/_chunks/{signature-request-DVDTKLjM.js → signature-request-CUe903hj.js} +2 -2
  70. package/dist/_chunks/{signature-request-DVDTKLjM.js.map → signature-request-CUe903hj.js.map} +1 -1
  71. package/dist/_chunks/{tabs-CBb2AidH.js → tabs-DqKtTIjZ.js} +2 -2
  72. package/dist/_chunks/{tabs-CBb2AidH.js.map → tabs-DqKtTIjZ.js.map} +1 -1
  73. package/dist/_chunks/{tasks-panel-Do5SFp-j.js → tasks-panel-DPCNaRko.js} +2 -2
  74. package/dist/_chunks/{tasks-panel-Do5SFp-j.js.map → tasks-panel-DPCNaRko.js.map} +1 -1
  75. package/dist/_chunks/{tooth-scheme-WdyVymQ1.js → tooth-scheme-2IsmbE6w.js} +2 -2
  76. package/dist/_chunks/{tooth-scheme-WdyVymQ1.js.map → tooth-scheme-2IsmbE6w.js.map} +1 -1
  77. package/dist/_chunks/{unit-converter-BPumXMA6.js → unit-converter-C6jMjqL9.js} +2 -2
  78. package/dist/_chunks/{unit-converter-BPumXMA6.js.map → unit-converter-C6jMjqL9.js.map} +1 -1
  79. package/dist/_chunks/{workflow-map-DE_ribRM.js → workflow-map-wcw3t6g4.js} +2 -2
  80. package/dist/_chunks/{workflow-map-DE_ribRM.js.map → workflow-map-wcw3t6g4.js.map} +1 -1
  81. package/dist/agent-catalog.json +1 -1
  82. package/dist/components/_shared/option.d.ts +1 -0
  83. package/dist/components/_shared/option.d.ts.map +1 -1
  84. package/dist/components/address-fields/index.js +1 -1
  85. package/dist/components/ai-prompt-input/index.js +1 -1
  86. package/dist/components/audio-recorder/index.js +1 -1
  87. package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
  88. package/dist/components/autocomplete/index.js +1 -1
  89. package/dist/components/bishop-score/index.js +1 -1
  90. package/dist/components/booking/booking.d.ts.map +1 -1
  91. package/dist/components/booking/index.js +1 -1
  92. package/dist/components/care-plan-card/index.js +1 -1
  93. package/dist/components/care-plan-entry-card/index.js +1 -1
  94. package/dist/components/care-plan-header/index.js +1 -1
  95. package/dist/components/city-input/index.js +1 -1
  96. package/dist/components/combobox/combobox.d.ts.map +1 -1
  97. package/dist/components/combobox/index.js +1 -1
  98. package/dist/components/contact-profile-card/contact-profile-card.d.ts.map +1 -1
  99. package/dist/components/contact-profile-card/index.js +1 -1
  100. package/dist/components/country-select/index.js +1 -1
  101. package/dist/components/data-table/index.js +2 -2
  102. package/dist/components/document-preview/index.js +1 -1
  103. package/dist/components/face-scheme/index.js +1 -1
  104. package/dist/components/file-manager/index.js +1 -1
  105. package/dist/components/gestational-age-calculator/index.js +1 -1
  106. package/dist/components/key-value-pair/index.js +1 -1
  107. package/dist/components/key-value-pair/key-value-pair.d.ts +16 -0
  108. package/dist/components/key-value-pair/key-value-pair.d.ts.map +1 -1
  109. package/dist/components/multi-select/index.js +1 -1
  110. package/dist/components/multi-select/multi-select.d.ts.map +1 -1
  111. package/dist/components/muscle-scheme/index.js +1 -1
  112. package/dist/components/optical-prescription/index.js +1 -1
  113. package/dist/components/patient-details/index.js +1 -1
  114. package/dist/components/patient-search/index.js +1 -1
  115. package/dist/components/patient-summary-card/index.js +1 -1
  116. package/dist/components/patient-table/index.js +1 -1
  117. package/dist/components/payment-card/index.js +1 -1
  118. package/dist/components/periodontal-chart/index.js +1 -1
  119. package/dist/components/periodontal-chart-card/index.js +1 -1
  120. package/dist/components/pregnancy-dating/index.js +1 -1
  121. package/dist/components/province-select/index.js +1 -1
  122. package/dist/components/select/index.js +1 -1
  123. package/dist/components/select/select.d.ts +24 -0
  124. package/dist/components/select/select.d.ts.map +1 -1
  125. package/dist/components/skeleton-scheme/index.js +1 -1
  126. package/dist/components/tabs/index.js +1 -1
  127. package/dist/components/tasks-panel/index.js +1 -1
  128. package/dist/components/tooth-scheme/index.js +1 -1
  129. package/dist/components/unit-converter/index.js +1 -1
  130. package/dist/components/workflow/index.js +1 -1
  131. package/dist/index.js +40 -40
  132. package/dist/patterns/anamnesis/index.js +1 -1
  133. package/dist/patterns/signature-request/index.js +1 -1
  134. package/package.json +1 -1
  135. package/dist/_chunks/booking-CBHKdsZl.js.map +0 -1
  136. package/dist/_chunks/key-value-pair-BubG4fUa.js +0 -144
  137. package/dist/_chunks/key-value-pair-BubG4fUa.js.map +0 -1
  138. package/dist/_chunks/select-BW5ecXlX.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"booking-DQbo6mQF.js","sources":["../../node_modules/lucide-react/dist/esm/icons/activity.mjs","../../node_modules/lucide-react/dist/esm/icons/baby.mjs","../../node_modules/lucide-react/dist/esm/icons/bone.mjs","../../node_modules/lucide-react/dist/esm/icons/brain.mjs","../../node_modules/lucide-react/dist/esm/icons/calendar-range.mjs","../../node_modules/lucide-react/dist/esm/icons/ear.mjs","../../node_modules/lucide-react/dist/esm/icons/microscope.mjs","../../node_modules/lucide-react/dist/esm/icons/pill.mjs","../../node_modules/lucide-react/dist/esm/icons/scissors.mjs","../../node_modules/lucide-react/dist/esm/icons/smile.mjs","../../node_modules/lucide-react/dist/esm/icons/sunset.mjs","../../node_modules/lucide-react/dist/esm/icons/syringe.mjs","../../node_modules/date-fns/subMonths.js","../../src/components/booking/booking.agent.ts","../../src/components/booking/booking-types.ts","../../src/components/booking/cascade.ts","../../src/components/booking/details-form.tsx","../../src/components/booking/booking.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2\",\n key: \"169zse\"\n }\n ]\n];\nconst Activity = createLucideIcon(\"activity\", __iconNode);\n\nexport { __iconNode, Activity as default };\n//# sourceMappingURL=activity.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M10 16c.5.3 1.2.5 2 .5s1.5-.2 2-.5\", key: \"1u7htd\" }],\n [\"path\", { d: \"M15 12h.01\", key: \"1k8ypt\" }],\n [\n \"path\",\n {\n d: \"M19.38 6.813A9 9 0 0 1 20.8 10.2a2 2 0 0 1 0 3.6 9 9 0 0 1-17.6 0 2 2 0 0 1 0-3.6A9 9 0 0 1 12 3c2 0 3.5 1.1 3.5 2.5s-.9 2.5-2 2.5c-.8 0-1.5-.4-1.5-1\",\n key: \"11xh7x\"\n }\n ],\n [\"path\", { d: \"M9 12h.01\", key: \"157uk2\" }]\n];\nconst Baby = createLucideIcon(\"baby\", __iconNode);\n\nexport { __iconNode, Baby as default };\n//# sourceMappingURL=baby.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M17 10c.7-.7 1.69 0 2.5 0a2.5 2.5 0 1 0 0-5 .5.5 0 0 1-.5-.5 2.5 2.5 0 1 0-5 0c0 .81.7 1.8 0 2.5l-7 7c-.7.7-1.69 0-2.5 0a2.5 2.5 0 0 0 0 5c.28 0 .5.22.5.5a2.5 2.5 0 1 0 5 0c0-.81-.7-1.8 0-2.5Z\",\n key: \"w610uw\"\n }\n ]\n];\nconst Bone = createLucideIcon(\"bone\", __iconNode);\n\nexport { __iconNode, Bone as default };\n//# sourceMappingURL=bone.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M12 18V5\", key: \"adv99a\" }],\n [\"path\", { d: \"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4\", key: \"1e3is1\" }],\n [\"path\", { d: \"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5\", key: \"1gqd8o\" }],\n [\"path\", { d: \"M17.997 5.125a4 4 0 0 1 2.526 5.77\", key: \"iwvgf7\" }],\n [\"path\", { d: \"M18 18a4 4 0 0 0 2-7.464\", key: \"efp6ie\" }],\n [\"path\", { d: \"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517\", key: \"1gq6am\" }],\n [\"path\", { d: \"M6 18a4 4 0 0 1-2-7.464\", key: \"k1g0md\" }],\n [\"path\", { d: \"M6.003 5.125a4 4 0 0 0-2.526 5.77\", key: \"q97ue3\" }]\n];\nconst Brain = createLucideIcon(\"brain\", __iconNode);\n\nexport { __iconNode, Brain as default };\n//# sourceMappingURL=brain.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"rect\", { width: \"18\", height: \"18\", x: \"3\", y: \"4\", rx: \"2\", key: \"1hopcy\" }],\n [\"path\", { d: \"M16 2v4\", key: \"4m81vk\" }],\n [\"path\", { d: \"M3 10h18\", key: \"8toen8\" }],\n [\"path\", { d: \"M8 2v4\", key: \"1cmpym\" }],\n [\"path\", { d: \"M17 14h-6\", key: \"bkmgh3\" }],\n [\"path\", { d: \"M13 18H7\", key: \"bb0bb7\" }],\n [\"path\", { d: \"M7 14h.01\", key: \"1qa3f1\" }],\n [\"path\", { d: \"M17 18h.01\", key: \"1bdyru\" }]\n];\nconst CalendarRange = createLucideIcon(\"calendar-range\", __iconNode);\n\nexport { __iconNode, CalendarRange as default };\n//# sourceMappingURL=calendar-range.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M6 8.5a6.5 6.5 0 1 1 13 0c0 6-6 6-6 10a3.5 3.5 0 1 1-7 0\", key: \"1dfaln\" }],\n [\"path\", { d: \"M15 8.5a2.5 2.5 0 0 0-5 0v1a2 2 0 1 1 0 4\", key: \"1qnva7\" }]\n];\nconst Ear = createLucideIcon(\"ear\", __iconNode);\n\nexport { __iconNode, Ear as default };\n//# sourceMappingURL=ear.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M6 18h8\", key: \"1borvv\" }],\n [\"path\", { d: \"M3 22h18\", key: \"8prr45\" }],\n [\"path\", { d: \"M14 22a7 7 0 1 0 0-14h-1\", key: \"1jwaiy\" }],\n [\"path\", { d: \"M9 14h2\", key: \"197e7h\" }],\n [\"path\", { d: \"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z\", key: \"1bmzmy\" }],\n [\"path\", { d: \"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3\", key: \"1drr47\" }]\n];\nconst Microscope = createLucideIcon(\"microscope\", __iconNode);\n\nexport { __iconNode, Microscope as default };\n//# sourceMappingURL=microscope.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n { d: \"m10.5 20.5 10-10a4.95 4.95 0 1 0-7-7l-10 10a4.95 4.95 0 1 0 7 7Z\", key: \"wa1lgi\" }\n ],\n [\"path\", { d: \"m8.5 8.5 7 7\", key: \"rvfmvr\" }]\n];\nconst Pill = createLucideIcon(\"pill\", __iconNode);\n\nexport { __iconNode, Pill as default };\n//# sourceMappingURL=pill.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"circle\", { cx: \"6\", cy: \"6\", r: \"3\", key: \"1lh9wr\" }],\n [\"path\", { d: \"M8.12 8.12 12 12\", key: \"1alkpv\" }],\n [\"path\", { d: \"M20 4 8.12 15.88\", key: \"xgtan2\" }],\n [\"circle\", { cx: \"6\", cy: \"18\", r: \"3\", key: \"fqmcym\" }],\n [\"path\", { d: \"M14.8 14.8 20 20\", key: \"ptml3r\" }]\n];\nconst Scissors = createLucideIcon(\"scissors\", __iconNode);\n\nexport { __iconNode, Scissors as default };\n//# sourceMappingURL=scissors.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"10\", key: \"1mglay\" }],\n [\"path\", { d: \"M8 14s1.5 2 4 2 4-2 4-2\", key: \"1y1vjs\" }],\n [\"line\", { x1: \"9\", x2: \"9.01\", y1: \"9\", y2: \"9\", key: \"yxxnd0\" }],\n [\"line\", { x1: \"15\", x2: \"15.01\", y1: \"9\", y2: \"9\", key: \"1p4y9e\" }]\n];\nconst Smile = createLucideIcon(\"smile\", __iconNode);\n\nexport { __iconNode, Smile as default };\n//# sourceMappingURL=smile.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M12 10V2\", key: \"16sf7g\" }],\n [\"path\", { d: \"m4.93 10.93 1.41 1.41\", key: \"2a7f42\" }],\n [\"path\", { d: \"M2 18h2\", key: \"j10viu\" }],\n [\"path\", { d: \"M20 18h2\", key: \"wocana\" }],\n [\"path\", { d: \"m19.07 10.93-1.41 1.41\", key: \"15zs5n\" }],\n [\"path\", { d: \"M22 22H2\", key: \"19qnx5\" }],\n [\"path\", { d: \"m16 6-4 4-4-4\", key: \"6wukr\" }],\n [\"path\", { d: \"M16 18a4 4 0 0 0-8 0\", key: \"1lzouq\" }]\n];\nconst Sunset = createLucideIcon(\"sunset\", __iconNode);\n\nexport { __iconNode, Sunset as default };\n//# sourceMappingURL=sunset.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"m18 2 4 4\", key: \"22kx64\" }],\n [\"path\", { d: \"m17 7 3-3\", key: \"1w1zoj\" }],\n [\"path\", { d: \"M19 9 8.7 19.3c-1 1-2.5 1-3.4 0l-.6-.6c-1-1-1-2.5 0-3.4L15 5\", key: \"1exhtz\" }],\n [\"path\", { d: \"m9 11 4 4\", key: \"rovt3i\" }],\n [\"path\", { d: \"m5 19-3 3\", key: \"59f2uf\" }],\n [\"path\", { d: \"m14 4 6 6\", key: \"yqp9t2\" }]\n];\nconst Syringe = createLucideIcon(\"syringe\", __iconNode);\n\nexport { __iconNode, Syringe as default };\n//# sourceMappingURL=syringe.mjs.map\n","import { addMonths } from \"./addMonths.js\";\n\n/**\n * The subMonths function options.\n */\n\n/**\n * @name subMonths\n * @category Month Helpers\n * @summary Subtract the specified number of months from the given date.\n *\n * @description\n * Subtract the specified number of months from the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of months to be subtracted.\n * @param options - An object with options\n *\n * @returns The new date with the months subtracted\n *\n * @example\n * // Subtract 5 months from 1 February 2015:\n * const result = subMonths(new Date(2015, 1, 1), 5)\n * //=> Mon Sep 01 2014 00:00:00\n */\nexport function subMonths(date, amount, options) {\n return addMonths(date, -amount, options);\n}\n\n// Fallback for modularized imports:\nexport default subMonths;\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — Booking (0.26.0). */\n/* */\n/* The Booking component consolidates the seven-step patient booking */\n/* flow into a single component. The adapter exposes variant + step */\n/* navigation. The booking value itself is owned by the consumer and */\n/* flows through `value` / `onChange` — never read here (PHI: patient */\n/* identity + contact stays on the page). */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { BookingHandle } from './booking-types';\n\nexport const bookingAgent: AgentAdapter<BookingHandle> = {\n id: 'booking',\n // `view_change` removed (0.69): the layout `variant` is a fixed prop — the\n // handle exposes only `getVariant` (state), no action mutates it. The flow's\n // only navigation is step-to-step (`goto_step` → `navigate`).\n capabilities: ['navigate'],\n state: {\n variant: {\n type: 'string',\n descriptionKey: 'ui.agent.booking.state.variant',\n description:\n 'Active variant — one of `inline-list`, `accordion`, `calendar`, `flexible`, `progress`.',\n read: (handle) => handle.getVariant(),\n },\n currentStep: {\n type: 'number',\n descriptionKey: 'ui.agent.booking.state.currentStep',\n description:\n 'The step the flow is on — 1 insurance, 2 specialty, 3 service, 4 provider, 5 date, 6 time, 7 patient details, 8 confirmation (after a successful submit). Read this back after `goto_step` to see where the clamp landed.',\n read: (handle) => handle.getCurrentStep(),\n },\n },\n actions: {\n reset: {\n // destructive: clears the whole in-progress booking value (patient\n // identity, contact, slot choice) — irreversibly loses user input.\n safety: 'destructive',\n idempotent: true,\n descriptionKey: 'ui.agent.booking.actions.reset',\n description:\n 'Clear the booking value back to an empty state. Use to abandon an in-progress flow.',\n errors: ['Resetting after submit has no effect — the flow is on step 8.'],\n invoke: (handle) => {\n handle.reset();\n },\n },\n goto_step: {\n safety: 'read',\n argsType: '{ step: 1 | 2 | 3 | 4 | 5 | 6 | 7 }',\n argsSchema: {\n type: 'object',\n properties: {\n step: {\n type: 'integer',\n enum: [1, 2, 3, 4, 5, 6, 7],\n description: 'Target step (1-7).',\n },\n },\n required: ['step'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.booking.actions.gotoStep',\n description:\n 'Jump to the given step. A step that is hidden for this practice, or that sits ahead of the first incomplete step, clamps to that first incomplete step — read `currentStep` back to see where it landed.',\n errors: [\n 'Requested step is not yet reachable — clamped to the first incomplete step.',\n 'Requested step is hidden for this practice (e.g. insurance outside Germany, or provider choice turned off) — clamped to the first incomplete step.',\n ],\n examples: [{ args: { step: 1 }, note: 'Return to the first step.' }],\n invoke: (handle, args: { step: 1 | 2 | 3 | 4 | 5 | 6 | 7 }) => {\n handle.goToStep(args.step);\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'booking',\n description: 'Marks the Booking root region.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","/* -------------------------------------------------------------------- */\n/* Booking — public type surface (0.26.0). */\n/* */\n/* Re-exported from `booking.tsx`. Lives in its own module so */\n/* `cascade.ts` can import the types without a circular dependency on */\n/* the main component file. */\n/* -------------------------------------------------------------------- */\n\nimport type { ComponentPropsWithoutRef, ReactNode } from 'react';\n\n/* -------------------------------------------------------------------- */\n/* Variant */\n/* -------------------------------------------------------------------- */\n\nexport type BookingVariant =\n | 'inline-list'\n | 'accordion'\n | 'calendar'\n | 'flexible'\n | 'progress';\n\n/* -------------------------------------------------------------------- */\n/* Domain shapes */\n/* -------------------------------------------------------------------- */\n\nexport type InsuranceType = 'private' | 'public';\n\n/** Channels the patient can pick to receive the confirmation link. */\nexport type ConfirmationChannel = 'email' | 'whatsapp' | 'sms';\n\n/** Fixed order — email first, then WhatsApp, then SMS. */\nexport const CONFIRMATION_CHANNEL_ORDER: readonly ConfirmationChannel[] = [\n 'email',\n 'whatsapp',\n 'sms',\n] as const;\n\nexport interface BookingSpecialty {\n id: string;\n label: string;\n /** Optional ordering hint; falls back to array order. */\n sequenceNumber?: number;\n /** Restrict to operators-on-page when lockedOperatorId is set. */\n operatorIds?: string[];\n}\n\nexport interface BookingService {\n id: string;\n label: string;\n /** Minutes — required for slot fetching. */\n durationMin: number;\n /**\n * Pre-formatted price label (e.g. \"€ 80\", \"da € 60\"). When present, the\n * service picker shows the price INSTEAD of the duration — durations vary\n * case by case and set the wrong expectation, while price is what patients\n * compare. `durationMin` keeps driving slot fetching either way. Currency\n * and number formatting are the consumer's domain — the kit renders the\n * string verbatim. Added in 1.6.0.\n */\n priceLabel?: string;\n /** Required when useSpecialties is true. */\n specialtyId?: string;\n /** Operators who can perform this service. */\n operatorIds?: string[];\n}\n\nexport interface BookingOperator {\n id: string;\n name: string;\n specialtyIds?: string[];\n appointmentBookingReasonIds?: string[];\n}\n\nexport interface BookingSlot {\n /** Opaque unique key within `availableSlots[date]`. */\n key: string;\n /** HH:mm 24h — used for display. */\n time: string;\n available: boolean;\n /** Opaque passthrough so the consumer can resolve operatorId / chairId\n * / dateTime when `onSubmit` fires. */\n meta?: Record<string, unknown>;\n}\n\nexport interface BookingDetails {\n firstName: string;\n lastName: string;\n email: string;\n mobilePhone: string;\n privacyConsent: boolean;\n termsConsent: boolean;\n // Opt-in fields — typed optional, required only when their `require*`\n // prop is true on `BookingProps`.\n codiceFiscale?: string;\n dateOfBirth?: string;\n insuranceNumber?: string;\n // Optional, gated by `show*` props.\n note?: string;\n returningPatient?: boolean;\n /**\n * Channels the patient picked for the confirmation link. Guaranteed to\n * be a non-empty subset of the practice's enabled `confirmationChannels`\n * when present. Omitted when only one channel is enabled (implicit —\n * backend infers from the practice config).\n */\n confirmationChannels?: ConfirmationChannel[];\n}\n\nexport interface BookingValue {\n insuranceType?: InsuranceType;\n specialtyId?: string;\n /**\n * Multi-select form of `specialtyId` — set this instead of (or alongside)\n * `specialtyId` when `specialtyPickerStyle='multi-select'`. The cascade\n * reads this array first and treats services / operators / slots as a\n * union of the selected specialties. When both are set, the array wins.\n * Added in 0.34.0.\n */\n specialtyIds?: string[];\n serviceId?: string;\n /**\n * Multi-select form of `serviceId` — see `specialtyIds`. Set when\n * `servicePickerStyle='multi-select'`. Union semantics. Added in 0.34.0.\n */\n serviceIds?: string[];\n /** May be the literal `'all'` sentinel to mean \"no operator preference\". */\n operatorId?: string;\n /**\n * Multi-select form of `operatorId` — see `specialtyIds`. Set when\n * `operatorPickerStyle='multi-select'`. The kit doesn't filter slots by\n * operator itself (the consumer owns slot resolution), but consumers\n * using multi-select operator typically filter `availableSlots` to the\n * union of `operatorIds` before passing the data in. Added in 0.34.0.\n */\n operatorIds?: string[];\n /** YYYY-MM-DD. */\n date?: string;\n /** Opaque key from `availableSlots[date]`. */\n slotKey?: string;\n /** Partial details — fully populated when the user is ready to submit. */\n details?: Partial<BookingDetails>;\n}\n\n/* -------------------------------------------------------------------- */\n/* Submit payload — fully resolved. */\n/* -------------------------------------------------------------------- */\n\nexport interface BookingSubmitPayload {\n slot: BookingSlot;\n value: BookingValue;\n /** Fully populated + validated (privacy + terms ticked, required fields filled). */\n details: BookingDetails;\n}\n\n/* -------------------------------------------------------------------- */\n/* Async validator return shape */\n/* -------------------------------------------------------------------- */\n\nexport interface BookingValidationResult {\n valid: boolean;\n /** Optional localised hint shown next to the field on failure. */\n hint?: string;\n}\n\nexport type BookingValidator = (\n value: string,\n) => Promise<BookingValidationResult>;\n\n/* -------------------------------------------------------------------- */\n/* Imperative handle */\n/* -------------------------------------------------------------------- */\n\nexport interface BookingHandle {\n getVariant: () => BookingVariant;\n /**\n * The step the flow is on — 1-7 while the cascade is in progress, and 8\n * once `onSubmit` has resolved and the confirmation view is showing.\n *\n * This is the read-back for `goToStep`: it reports the **cursor**, which\n * can sit behind the cascade's frontier after a backwards edit. It is\n * therefore NOT always the number `onStepChange` emits — that callback\n * reports the frontier (the first incomplete step), so moving the cursor\n * back to step 3 with everything filled makes this return `3` while\n * `onStepChange` stays silent on `7`.\n */\n getCurrentStep: () => 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;\n /** Clear `value` back to an empty state via `onChange`. */\n reset: () => void;\n /**\n * Jump to a specific step. A step that is not in the visible ladder, or\n * that sits ahead of the first incomplete step, clamps to that first\n * incomplete step rather than stranding the cursor.\n */\n goToStep: (step: 1 | 2 | 3 | 4 | 5 | 6 | 7) => void;\n}\n\n/* -------------------------------------------------------------------- */\n/* Component props */\n/* -------------------------------------------------------------------- */\n\nexport interface BookingProps extends Omit<\n ComponentPropsWithoutRef<'div'>,\n 'aria-label' | 'onChange' | 'onSubmit'\n> {\n variant?: BookingVariant;\n\n // Policy\n country?: string;\n useSpecialties?: boolean;\n allowOperatorSelection?: boolean;\n /** Pins step 4 to this operator. */\n lockedOperatorId?: string;\n\n // Data (any may be empty — the cascade handles it)\n specialties?: BookingSpecialty[];\n services: BookingService[];\n operators?: BookingOperator[];\n availableDates: string[];\n availableSlots: Record<string, BookingSlot[]>;\n /** Server-side hint of the next free date when the current window is empty. */\n nextAvailableDate?: string;\n\n // Step 7 controls (all opt-in, default false)\n requireCodiceFiscale?: boolean;\n requireDateOfBirth?: boolean;\n requireInsuranceNumber?: boolean;\n showNote?: boolean;\n showReturningPatientFlag?: boolean;\n privacyPolicyUrl?: string;\n termsUrl?: string;\n\n // Validation hooks (consumer-injected)\n validateCodiceFiscale?: BookingValidator;\n validateInsuranceNumber?: BookingValidator;\n\n // Auto-select policy\n /** Default: false. Specialty auto-select on length=1 is always on. */\n autoSelectSingleService?: boolean;\n\n // Confirmation-channel delivery\n /**\n * Channels the practice has enabled. The picker renders one checkbox\n * per channel; when length === 1, the picker is hidden and the single\n * channel is implicit. Defaults to `['email']` when omitted.\n */\n confirmationChannels?: ConfirmationChannel[];\n /**\n * Pre-checked channels. Intersected with `confirmationChannels` for\n * safety. When omitted, the kit applies a smart default (always email;\n * +whatsapp when mobile is plausibly filled; +sms when whatsapp isn't\n * available).\n */\n defaultConfirmationChannels?: ConfirmationChannel[];\n\n // State\n value: BookingValue;\n onChange: (next: BookingValue) => void;\n onSubmit: (payload: BookingSubmitPayload) => void | Promise<void>;\n\n // UX\n /**\n * Calendar/date-strip shimmer — set true while `availableDates` is being\n * fetched. When omitted, the kit falls back to `loadingSlots` for the\n * calendar shimmer (the long-standing behaviour). Split from\n * `loadingSlots` in 0.33.9 so consumers using a two-query pattern\n * (\"which days have availability\" + per-day slot fetch) can shimmer\n * the calendar independently of the slot list — without this split a\n * per-day slot fetch re-shimmers the whole calendar on every date click.\n */\n loadingDates?: boolean;\n /**\n * Slot-list shimmer — set true while `availableSlots[value.date]` is\n * being fetched. Drives the `<GroupedTimeSlots>` and the calendar-\n * variant time-slot list. When `loadingDates` is omitted, this flag\n * also drives the calendar shimmer (backward-compat fallback).\n */\n loadingSlots?: boolean;\n submitting?: boolean;\n /**\n * @default 'flat'\n * `'elevated'` wraps the kit-rendered surface in the equivalent of\n * `Card variant=\"elevated\"` (same tokens, same padding). Use to drop\n * the consumer-side Card wrap.\n */\n surface?: 'flat' | 'elevated';\n /**\n * Fires whenever the displayed step changes — steps 1..7 from the\n * cascade engine + step `8` when the success view mounts. Useful for\n * analytics events that aren't already kit-internal, custom focus\n * management, or page-title updates. The kit also auto-scrolls the\n * success container into view on the 1..7 → 8 transition; consumers\n * don't need to do that themselves.\n */\n onStepChange?: (step: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8) => void;\n /**\n * Fires when the patient picks a date in the calendar — sugar for\n * consumers using a two-query pattern who need to kick off the\n * per-day slot fetch on date click. Consumers can already detect\n * a date change by diffing `value.date` inside `onChange`; this\n * callback just spares them that diff. Fires AFTER the kit has\n * applied the date change through `onChange` — `value.date` will\n * reflect the new ISO when this fires.\n */\n onDateSelect?: (iso: string) => void;\n /**\n * Fires when the visible 4-day window starts or shifts. Used by\n * two-query consumers to lazy-fetch `dailySlots/{date}` for the\n * newly-visible days. Receives the inclusive ISO date strings of\n * the first and last visible day in the window. Fires on mount\n * (with the resolved initial window) and on every prev/next\n * arrow click, internal jump-to-next-available action, and\n * automatic re-sync triggered by `availableDates` arriving.\n *\n * Only fires when `datePickerStyle='four-day-grid'` — the\n * month-calendar picker has no \"window\" concept; consumers using\n * that style fetch availability per visible month and don't need\n * this signal.\n */\n onWindowChange?: (startIso: string, endIso: string) => void;\n /**\n * @default 'select'\n * UI rendered for the Specialty step. Independent of layout `variant`.\n *\n * - `'select'` (default): the kit's `<Select>` dropdown — current behaviour.\n * - `'combobox'`: single-select `<Combobox>` with type-ahead search.\n * Pays off for long specialty lists (>10 entries).\n * - `'multi-select'`: multi-select `<MultiSelect>` with chip-rendered\n * selections. Writes to `value.specialtyIds` (array). The cascade reads\n * the array as a union — services / operators / slots are filtered\n * by ANY of the selected specialties. Added in 0.34.0.\n */\n specialtyPickerStyle?: 'select' | 'combobox' | 'multi-select';\n /**\n * @default 'cards' for `variant='inline-list'`, `'select'` for others\n * UI rendered for the Service step. Independent of layout `variant`.\n *\n * - `'cards'`: visual card grid (the long-standing `ServiceCardGroup`\n * used by inline-list). Card layout, one row per service with icon,\n * label, and duration.\n * - `'select'`: compact `<Select>` dropdown (default for the chrome-\n * denser variants — calendar / flexible / accordion / progress).\n * - `'combobox'`: single-select `<Combobox>` with type-ahead search.\n * - `'multi-select'`: multi-select `<MultiSelect>` writing to\n * `value.serviceIds`. Cascade reads as union — operators / slots are\n * filtered by ANY of the selected services. Added in 0.34.0.\n */\n servicePickerStyle?: 'select' | 'combobox' | 'multi-select' | 'cards';\n /**\n * @default 'select'\n * UI rendered for the Operator step. Independent of layout `variant`.\n *\n * - `'select'` (default): `<Select>` dropdown including the implicit\n * `'all'` \"any operator\" sentinel.\n * - `'combobox'`: single-select `<Combobox>` with type-ahead search.\n * - `'multi-select'`: multi-select `<MultiSelect>` writing to\n * `value.operatorIds`. The kit doesn't filter slots by operator\n * itself — the consumer owns slot resolution — but consumers using\n * multi-select operator typically filter `availableSlots` to the\n * union of selected operators before passing the data in. Added\n * in 0.34.0.\n */\n operatorPickerStyle?: 'select' | 'combobox' | 'multi-select';\n /**\n * @default 'month-calendar'\n * Selects the date + slot picker rendered inside the cascade's date\n * and slot steps. Independent of the layout `variant`:\n *\n * - `'month-calendar'` (default): the 6×7 `<MonthGrid>` followed by\n * the morning/afternoon/evening `<GroupedTimeSlots>`. Two-step flow\n * — patient picks a date, slots reveal underneath.\n *\n * - `'four-day-grid'`: a 4-column day-strip (`<SlotGrid>`) with ±4-day\n * arrow nav and per-day vertical slot tiles. One-step flow —\n * patient picks a slot directly; clicking a slot atomically sets\n * both `value.date` and `value.slotKey`. The cascade's separate\n * \"slot\" step is suppressed because the slots are inline with the\n * date strip.\n *\n * The data contract is unchanged — `availableDates`, `availableSlots`,\n * `loadingDates`, `loadingSlots`, `onDateSelect` all behave the same\n * way for both styles. Defaults to `'month-calendar'` so existing\n * consumers see no behavioural change.\n */\n datePickerStyle?: 'month-calendar' | 'four-day-grid';\n /**\n * Surface a submit-failure message inside the form (Alert variant=destructive\n * above the submit button). The consumer owns the state — set it after an\n * `onSubmit` rejection, clear it when retrying or on a field edit. When set,\n * the kit's normal \"form stays mounted on rejected promise\" behaviour is\n * unchanged; this just gives the failure a sanctioned slot to render.\n */\n submitError?: ReactNode;\n /**\n * @default 'live'\n * In `'demo'` mode the kit's step-8 success view swaps its description to\n * a localised \"This was a demo — no confirmation was sent.\" so the copy\n * stays honest when no real API call was made.\n */\n mode?: 'live' | 'demo';\n /**\n * @default true\n * Render a \"Modify booking\" button on the step-8 success view that returns\n * to step 7 without clearing `value`/`details`. Practices that want a\n * one-shot booking flow can hide this.\n */\n showModifyOnSuccess?: boolean;\n emptyServicesSlot?: ReactNode;\n onboardingIncompleteSlot?: ReactNode;\n\n // a11y\n 'aria-label'?: string;\n id?: string;\n}\n","/* -------------------------------------------------------------------- */\n/* Booking cascade engine — pure functions, no React. */\n/* */\n/* The seven-step state machine that drives every variant. Visibility */\n/* gates, downstream filtering, auto-skip rules, and reset semantics */\n/* live here so each variant only renders a phase of the cascade — it */\n/* doesn't re-implement the logic. The booking-website's legacy */\n/* `useBookingState.js` is the behavioural source-of-truth; the */\n/* mapping is documented inline at each gate. */\n/* -------------------------------------------------------------------- */\n\nimport type {\n BookingOperator,\n BookingService,\n BookingSlot,\n BookingSpecialty,\n BookingValue,\n ConfirmationChannel,\n InsuranceType,\n} from './booking-types';\nimport { CONFIRMATION_CHANNEL_ORDER } from './booking-types';\n\n/**\n * Sentinel for the operator filter's \"All operators\" pseudo-option. Mirrors\n * `OPERATORS_ALL = '0'` in the legacy `useBookingState.js`, but the kit\n * uses `'all'` as the well-known string so consumers can't accidentally\n * collide with a real operator id of `'0'`.\n */\nexport const OPERATORS_ALL = 'all' as const;\n\nconst COUNTRY_GERMANY = 'de';\n\n/* -------------------------------------------------------------------- */\n/* Inputs / outputs */\n/* -------------------------------------------------------------------- */\n\nexport interface CascadePolicy {\n /** ISO 3166-1 alpha-2 country code. Currently only `'de'` toggles a gate. */\n country?: string;\n useSpecialties?: boolean;\n allowOperatorSelection?: boolean;\n /** When set, locks step 4 to this operator id and hides the picker. */\n lockedOperatorId?: string;\n /** Defaults to `false`. When true, single-service lists auto-pre-fill. */\n autoSelectSingleService?: boolean;\n}\n\nexport interface CascadeInputs extends CascadePolicy {\n specialties: BookingSpecialty[];\n services: BookingService[];\n operators: BookingOperator[];\n availableDates: string[];\n availableSlots: Record<string, BookingSlot[]>;\n value: BookingValue;\n}\n\nexport interface CascadeGates {\n insurance: boolean;\n specialty: boolean;\n service: boolean;\n operator: boolean;\n date: boolean;\n slot: boolean;\n details: boolean;\n /** True when a service is picked but no eligible operators can perform it. */\n onboardingIncomplete: boolean;\n}\n\nexport interface CascadeFiltered {\n specialties: BookingSpecialty[];\n services: BookingService[];\n /**\n * Eligible operators for the active specialty (when `useSpecialties=true`)\n * OR the active service. Excludes the \"All operators\" sentinel — that's\n * always prepended in the UI layer.\n */\n operators: BookingOperator[];\n}\n\n/** Step number — 1-indexed, matches the docs / a11y order. */\nexport type CascadeStep = 1 | 2 | 3 | 4 | 5 | 6 | 7;\n\nexport interface CascadeOutputs {\n gates: CascadeGates;\n filtered: CascadeFiltered;\n /** Current step: the first visible step that has an unfulfilled requirement. */\n currentStep: CascadeStep;\n /** Total visible steps (1..7 minus any auto-skipped). */\n totalSteps: number;\n /** Ordered list of the visible step indices, used by variants that show a stepper. */\n visibleSteps: CascadeStep[];\n /** Whether every required step is satisfied — the submit button is gated on this. */\n isReadyToSubmit: boolean;\n /** Selected service's duration, if any — needed for slot fetching. */\n durationMin?: number;\n /** Selected slot resolved from `value.date` + `value.slotKey`. */\n selectedSlot?: BookingSlot;\n}\n\n/* -------------------------------------------------------------------- */\n/* Filtering helpers */\n/* -------------------------------------------------------------------- */\n\nfunction filterSpecialties(inputs: CascadeInputs): BookingSpecialty[] {\n const list = inputs.lockedOperatorId\n ? inputs.specialties.filter((s) =>\n s.operatorIds?.includes(inputs.lockedOperatorId as string),\n )\n : inputs.specialties;\n // Stable copy + sort by `sequenceNumber` (falsy → bottom).\n return [...list].sort((a, b) => {\n const aSeq = a.sequenceNumber ?? Number.POSITIVE_INFINITY;\n const bSeq = b.sequenceNumber ?? Number.POSITIVE_INFINITY;\n return aSeq - bSeq;\n });\n}\n\nfunction filterServices(inputs: CascadeInputs): BookingService[] {\n let list = inputs.services;\n if (inputs.lockedOperatorId) {\n list = list.filter((s) =>\n s.operatorIds?.includes(inputs.lockedOperatorId as string),\n );\n }\n // Mirror the `gates.specialty` auto-on rule — see computeGates().\n const useSpecialtiesResolved =\n inputs.useSpecialties === undefined\n ? inputs.specialties.length > 0\n : inputs.useSpecialties;\n if (useSpecialtiesResolved) {\n // 0.34.0: read array form first (`specialtyIds` for multi-select);\n // fall back to single `specialtyId`. Union semantics — show any\n // service matching ANY of the selected specialties.\n const specialtyIds = resolveSpecialtyIds(inputs.value);\n if (specialtyIds.length > 0) {\n list = list.filter(\n (s) =>\n s.specialtyId !== undefined && specialtyIds.includes(s.specialtyId),\n );\n }\n }\n return list;\n}\n\nfunction eligibleOperators(inputs: CascadeInputs): BookingOperator[] {\n // Mirror the gates.specialty auto-on rule.\n const useSpecialtiesResolved =\n inputs.useSpecialties === undefined\n ? inputs.specialties.length > 0\n : inputs.useSpecialties;\n // When `useSpecialties` is on, eligibility is by specialty. Otherwise by\n // the selected service's reverse-link. Both are inclusive — if a service\n // says any operator can perform it, all operators are eligible.\n // 0.34.0: union semantics — read array form first, fall back to single.\n if (useSpecialtiesResolved) {\n const specialtyIds = resolveSpecialtyIds(inputs.value);\n if (specialtyIds.length > 0) {\n return inputs.operators.filter((op) =>\n op.specialtyIds?.some((sid) => specialtyIds.includes(sid)),\n );\n }\n }\n if (!useSpecialtiesResolved) {\n const serviceIds = resolveServiceIds(inputs.value);\n if (serviceIds.length > 0) {\n return inputs.operators.filter((op) =>\n op.appointmentBookingReasonIds?.some((rid) => serviceIds.includes(rid)),\n );\n }\n }\n return [];\n}\n\n/* -------------------------------------------------------------------- */\n/* Gates */\n/* -------------------------------------------------------------------- */\n\nfunction computeGates(\n inputs: CascadeInputs,\n filtered: CascadeFiltered,\n): CascadeGates {\n const insuranceVisible = inputs.country === COUNTRY_GERMANY;\n // Insurance gate is satisfied either if it's not visible or the user has\n // picked one of the two values.\n const insuranceSatisfied =\n !insuranceVisible || inputs.value.insuranceType !== undefined;\n\n // Specialty visibility — 0.30.4: auto-on when `specialties` has items.\n // - `useSpecialties === true` → visible (legacy explicit opt-in)\n // - `useSpecialties === false` → hidden (explicit opt-out)\n // - `useSpecialties === undefined` (default) → visible iff `specialties`\n // has items. Previously the default `false` meant the step never\n // rendered unless the consumer explicitly opted in, which silently\n // dropped the step in every variant for the common case where the\n // consumer passed `specialties` data but not the boolean.\n const useSpecialtiesResolved =\n inputs.useSpecialties === undefined\n ? inputs.specialties.length > 0\n : inputs.useSpecialties;\n const specialtyVisible = useSpecialtiesResolved && insuranceSatisfied;\n // 0.34.0: array-or-single semantics — a step is \"satisfied\" when\n // EITHER the single field is set OR the array field has at least\n // one entry. Same applies to service / operator picks below.\n const specialtyPicked = resolveSpecialtyIds(inputs.value).length > 0;\n const specialtySatisfied = !specialtyVisible || specialtyPicked;\n\n const serviceVisible = specialtySatisfied;\n const servicePicked = resolveServiceIds(inputs.value).length > 0;\n const serviceSatisfied = !serviceVisible || servicePicked;\n\n // Operator: visible only when the user can pick from >1 eligible.\n const eligibleOps = filtered.operators;\n const operatorVisible =\n Boolean(inputs.allowOperatorSelection) &&\n serviceSatisfied &&\n servicePicked &&\n !inputs.lockedOperatorId &&\n eligibleOps.length > 1;\n // operator is always \"satisfied\" because the \"All operators\" sentinel is\n // the implicit default — patients who don't pick still flow through.\n const operatorSatisfied = true;\n void operatorSatisfied;\n\n const dateVisible = serviceSatisfied && servicePicked;\n const dateSatisfied = !dateVisible || inputs.value.date !== undefined;\n\n const slotVisible = dateSatisfied && inputs.value.date !== undefined;\n const slotSatisfied = !slotVisible || inputs.value.slotKey !== undefined;\n\n const detailsVisible = slotSatisfied && inputs.value.slotKey !== undefined;\n\n const onboardingIncomplete = servicePicked && eligibleOps.length === 0;\n\n return {\n insurance: insuranceVisible,\n specialty: specialtyVisible,\n service: serviceVisible,\n operator: operatorVisible,\n date: dateVisible,\n slot: slotVisible,\n details: detailsVisible,\n onboardingIncomplete,\n };\n}\n\n/* -------------------------------------------------------------------- */\n/* Step number derivation */\n/* -------------------------------------------------------------------- */\n\nfunction deriveStep(\n inputs: CascadeInputs,\n gates: CascadeGates,\n): { currentStep: CascadeStep; visibleSteps: CascadeStep[] } {\n const visible: CascadeStep[] = [];\n if (gates.insurance) visible.push(1);\n if (gates.specialty) visible.push(2);\n visible.push(3); // service is always required\n if (gates.operator) visible.push(4);\n visible.push(5); // date is always required (after service)\n visible.push(6); // slot is always required\n visible.push(7); // details is always required (the final submit step)\n\n const isFulfilled: Record<CascadeStep, boolean> = {\n 1: inputs.value.insuranceType !== undefined,\n // 0.34.0: array-or-single — satisfied when EITHER form is present.\n 2: resolveSpecialtyIds(inputs.value).length > 0,\n 3: resolveServiceIds(inputs.value).length > 0,\n 4:\n inputs.value.operatorId !== undefined ||\n (inputs.value.operatorIds !== undefined &&\n inputs.value.operatorIds.length > 0),\n 5: inputs.value.date !== undefined,\n 6: inputs.value.slotKey !== undefined,\n 7: false, // details fulfilment is owned by the form's own validation\n };\n\n const firstIncomplete = visible.find((s) => !isFulfilled[s]);\n return {\n currentStep: firstIncomplete ?? 7,\n visibleSteps: visible,\n };\n}\n\n/* -------------------------------------------------------------------- */\n/* Main derive */\n/* -------------------------------------------------------------------- */\n\nexport function deriveCascade(inputs: CascadeInputs): CascadeOutputs {\n const filtered: CascadeFiltered = {\n specialties: filterSpecialties(inputs),\n services: filterServices(inputs),\n operators: eligibleOperators(inputs),\n };\n const gates = computeGates(inputs, filtered);\n const { currentStep, visibleSteps } = deriveStep(inputs, gates);\n\n // Look up the selected slot for variant bodies that want to render it\n // (e.g. the \"Confirm at HH:mm on DATE\" summary line above the details\n // form). Cheaper to do here than make each variant re-search.\n let selectedSlot: BookingSlot | undefined;\n if (inputs.value.date && inputs.value.slotKey) {\n const day = inputs.availableSlots[inputs.value.date];\n if (day) selectedSlot = day.find((s) => s.key === inputs.value.slotKey);\n }\n\n // 0.34.0: when multi-select is active we resolve to \"first picked\" for\n // the duration-min / selected-service indicator. The submit payload\n // carries the full value (including arrays) so the consumer can fan\n // out per service / operator if needed.\n const serviceIds = resolveServiceIds(inputs.value);\n const selectedService =\n serviceIds.length > 0\n ? inputs.services.find((s) => s.id === serviceIds[0])\n : undefined;\n\n const specialtyPickedFinal = resolveSpecialtyIds(inputs.value).length > 0;\n\n const isReadyToSubmit =\n serviceIds.length > 0 &&\n inputs.value.date !== undefined &&\n inputs.value.slotKey !== undefined &&\n (!gates.insurance || inputs.value.insuranceType !== undefined) &&\n (!gates.specialty || specialtyPickedFinal);\n\n return {\n gates,\n filtered,\n currentStep,\n totalSteps: visibleSteps.length,\n visibleSteps,\n isReadyToSubmit,\n durationMin: selectedService?.durationMin,\n selectedSlot,\n };\n}\n\n/* -------------------------------------------------------------------- */\n/* Reset helpers — pure, return next value */\n/* */\n/* Every cascade change clears downstream selections so the user never */\n/* lands on a fulfilled-but-inconsistent state. */\n/* -------------------------------------------------------------------- */\n\nexport function resetOnInsuranceChange(\n value: BookingValue,\n next: InsuranceType | undefined,\n): BookingValue {\n return {\n ...value,\n insuranceType: next,\n specialtyId: undefined,\n serviceId: undefined,\n operatorId: undefined,\n date: undefined,\n slotKey: undefined,\n details: undefined,\n };\n}\n\nexport function resetOnSpecialtyChange(\n value: BookingValue,\n next: string | undefined,\n): BookingValue {\n return {\n ...value,\n specialtyId: next,\n specialtyIds: undefined,\n serviceId: undefined,\n serviceIds: undefined,\n operatorId: undefined,\n operatorIds: undefined,\n date: undefined,\n slotKey: undefined,\n details: undefined,\n };\n}\n\n/**\n * Multi-select counterpart to `resetOnSpecialtyChange`. Writes the\n * `specialtyIds` array form and clears any single-form `specialtyId`\n * so the cascade reads the array. Added in 0.34.0.\n */\nexport function resetOnSpecialtyIdsChange(\n value: BookingValue,\n next: string[] | undefined,\n): BookingValue {\n return {\n ...value,\n specialtyId: undefined,\n specialtyIds: next,\n serviceId: undefined,\n serviceIds: undefined,\n operatorId: undefined,\n operatorIds: undefined,\n date: undefined,\n slotKey: undefined,\n details: undefined,\n };\n}\n\nexport function resetOnServiceChange(\n value: BookingValue,\n next: string | undefined,\n): BookingValue {\n return {\n ...value,\n serviceId: next,\n serviceIds: undefined,\n // Default the operator to the \"All operators\" sentinel so a patient\n // who doesn't care about picking lands on a satisfied step 4 without\n // any further input.\n operatorId: next ? OPERATORS_ALL : undefined,\n operatorIds: undefined,\n date: undefined,\n slotKey: undefined,\n details: undefined,\n };\n}\n\n/** Multi-select counterpart to `resetOnServiceChange`. Added in 0.34.0. */\nexport function resetOnServiceIdsChange(\n value: BookingValue,\n next: string[] | undefined,\n): BookingValue {\n const hasAny = !!next && next.length > 0;\n return {\n ...value,\n serviceId: undefined,\n serviceIds: next,\n operatorId: hasAny ? OPERATORS_ALL : undefined,\n operatorIds: undefined,\n date: undefined,\n slotKey: undefined,\n details: undefined,\n };\n}\n\nexport function resetOnOperatorChange(\n value: BookingValue,\n next: string | undefined,\n): BookingValue {\n return {\n ...value,\n operatorId: next,\n operatorIds: undefined,\n date: undefined,\n slotKey: undefined,\n details: undefined,\n };\n}\n\n/** Multi-select counterpart to `resetOnOperatorChange`. Added in 0.34.0. */\nexport function resetOnOperatorIdsChange(\n value: BookingValue,\n next: string[] | undefined,\n): BookingValue {\n return {\n ...value,\n operatorId: undefined,\n operatorIds: next,\n date: undefined,\n slotKey: undefined,\n details: undefined,\n };\n}\n\n/* -------------------------------------------------------------------- */\n/* Multi-select resolution helpers — 0.34.0 */\n/* */\n/* The cascade reads the array form of each step's value first, falling */\n/* back to the single-string form. This lets the picker style switch at */\n/* runtime without rewriting the entire cascade. */\n/* -------------------------------------------------------------------- */\n\n/** Returns the effective specialty selection as an array. Empty when nothing picked. */\nexport function resolveSpecialtyIds(value: BookingValue): string[] {\n if (value.specialtyIds && value.specialtyIds.length > 0) {\n return value.specialtyIds;\n }\n if (value.specialtyId) return [value.specialtyId];\n return [];\n}\n\n/** Returns the effective service selection as an array. Empty when nothing picked. */\nexport function resolveServiceIds(value: BookingValue): string[] {\n if (value.serviceIds && value.serviceIds.length > 0) {\n return value.serviceIds;\n }\n if (value.serviceId) return [value.serviceId];\n return [];\n}\n\n/** Returns the effective operator selection as an array. Empty when nothing picked. */\nexport function resolveOperatorIds(value: BookingValue): string[] {\n if (value.operatorIds && value.operatorIds.length > 0) {\n return value.operatorIds;\n }\n if (value.operatorId) return [value.operatorId];\n return [];\n}\n\nexport function resetOnDateChange(\n value: BookingValue,\n next: string | undefined,\n): BookingValue {\n return {\n ...value,\n date: next,\n slotKey: undefined,\n // Keep details — date/slot changes shouldn't wipe the patient form\n // since the user has already filled some fields.\n };\n}\n\nexport function resetOnSlotChange(\n value: BookingValue,\n next: string | undefined,\n): BookingValue {\n return {\n ...value,\n slotKey: next,\n };\n}\n\n/* -------------------------------------------------------------------- */\n/* Auto-pre-select normalisation */\n/* */\n/* Called once on mount (and whenever the inputs that trigger them */\n/* arrive — e.g. when `specialties` populates from a fetch). Returns the */\n/* value possibly mutated with the auto-picked fields. Callers should */\n/* compare the result to the input and fire `onChange` once if they */\n/* differ so the consumer sees the normalised value. */\n/* -------------------------------------------------------------------- */\n\nexport function applyAutoSelects(\n value: BookingValue,\n inputs: CascadePolicy & {\n specialties: BookingSpecialty[];\n services: BookingService[];\n },\n): BookingValue {\n let next = value;\n\n // Rule 1: locked operator pins step 4.\n if (inputs.lockedOperatorId && next.operatorId !== inputs.lockedOperatorId) {\n next = { ...next, operatorId: inputs.lockedOperatorId };\n }\n\n // Rule 2: single specialty auto-skips step 2. Skipped when the consumer\n // is operating in multi-select mode (specialtyIds is set) — the patient\n // is explicitly picking, don't override.\n const useSpecialtiesResolved =\n inputs.useSpecialties === undefined\n ? inputs.specialties.length > 0\n : inputs.useSpecialties;\n if (\n useSpecialtiesResolved &&\n inputs.specialties.length === 1 &&\n next.specialtyId === undefined &&\n next.specialtyIds === undefined\n ) {\n next = { ...next, specialtyId: inputs.specialties[0].id };\n }\n\n // Rule 3: single resolved service auto-fills step 3 — only when explicitly\n // opted into. The spec says specialty auto-select is always on, but\n // service auto-select is opt-in because UX teams may want explicit\n // confirmation. Skipped when serviceIds is set (multi-select).\n if (inputs.autoSelectSingleService) {\n const specialtyIds = resolveSpecialtyIds(next);\n const resolvedServices =\n specialtyIds.length > 0\n ? inputs.services.filter(\n (s) => s.specialtyId && specialtyIds.includes(s.specialtyId),\n )\n : inputs.services;\n if (\n resolvedServices.length === 1 &&\n next.serviceId === undefined &&\n next.serviceIds === undefined\n ) {\n next = { ...next, serviceId: resolvedServices[0].id };\n // Mirror resetOnServiceChange's operator default.\n if (next.operatorId === undefined && next.operatorIds === undefined) {\n next = { ...next, operatorId: OPERATORS_ALL };\n }\n }\n }\n\n return next;\n}\n\n/* -------------------------------------------------------------------- */\n/* Helpers exposed for the variants (and tests). */\n/* -------------------------------------------------------------------- */\n\n/** Resolve the active operator id, treating the `'all'` sentinel as `undefined`. */\nexport function resolveOperatorId(value: BookingValue): string | undefined {\n if (!value.operatorId) return undefined;\n if (value.operatorId === OPERATORS_ALL) return undefined;\n return value.operatorId;\n}\n\n/* -------------------------------------------------------------------- */\n/* Confirmation channels — smart default + ordering */\n/* -------------------------------------------------------------------- */\n\n/**\n * Naïve E.164-ish check for the smart-default heuristic. Doesn't validate\n * the phone fully — just confirms the patient has typed *something* that\n * looks like a phone number, so we can decide whether to pre-tick WhatsApp.\n */\nfunction looksLikePhone(value: string | undefined): boolean {\n if (!value) return false;\n const trimmed = value.trim();\n // Require a leading \"+\" or country code-style digits + at least 8 chars.\n return /^\\+?\\d[\\d\\s\\-()]{6,}$/.test(trimmed);\n}\n\n/**\n * Resolve the effective list of enabled channels. Falls back to `['email']`\n * when the consumer omits the prop, preserving the pre-amendment behaviour.\n */\nexport function resolveConfirmationChannels(\n enabled: ConfirmationChannel[] | undefined,\n): ConfirmationChannel[] {\n const list = enabled && enabled.length > 0 ? enabled : ['email'];\n // Canonical order: email → whatsapp → sms.\n const set = new Set(list);\n return CONFIRMATION_CHANNEL_ORDER.filter((c) => set.has(c));\n}\n\n/**\n * Compute the channels to pre-check. Result is intersected with `enabled`\n * for safety so a channel the practice didn't enable never gets ticked.\n *\n * Rules (per spec):\n * 1. Always include 'email'.\n * 2. Include 'whatsapp' if enabled AND mobile looks plausible.\n * 3. Include 'sms' ONLY when whatsapp is NOT in `enabled`.\n * 4. If the consumer passes `override`, honour it verbatim (still\n * intersected with `enabled` for safety).\n */\nexport function defaultConfirmationSelection(\n enabled: ConfirmationChannel[] | undefined,\n mobile: string | undefined,\n override?: ConfirmationChannel[],\n): ConfirmationChannel[] {\n const resolvedEnabled = resolveConfirmationChannels(enabled);\n const enabledSet = new Set(resolvedEnabled);\n\n if (override) {\n return CONFIRMATION_CHANNEL_ORDER.filter(\n (c) => override.includes(c) && enabledSet.has(c),\n );\n }\n\n const out: ConfirmationChannel[] = [];\n if (enabledSet.has('email')) out.push('email');\n\n const mobilePlausible = looksLikePhone(mobile);\n const hasWhatsApp = enabledSet.has('whatsapp');\n if (hasWhatsApp && mobilePlausible) out.push('whatsapp');\n // SMS is pre-checked whenever WhatsApp is not in the enabled set —\n // the spec doesn't gate this on a mobile-present check (matches rule 3).\n if (!hasWhatsApp && enabledSet.has('sms')) out.push('sms');\n\n // Final canonical order pass.\n const outSet = new Set(out);\n return CONFIRMATION_CHANNEL_ORDER.filter((c) => outSet.has(c));\n}\n","import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type FormEvent,\n type ReactNode,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Trans } from 'react-i18next';\nimport { Alert } from '../alert/alert';\nimport { Button } from '../button/button';\nimport { Checkbox } from '../checkbox/checkbox';\nimport { CheckboxGroup } from '../checkbox-group/checkbox-group';\nimport { DatePicker } from '../date-picker/date-picker';\nimport { EmailInput } from '../email-input/email-input';\nimport { FormField } from '../form-field/form-field';\nimport { PhoneInput } from '../phone-input/phone-input';\nimport { TextArea } from '../text-area/text-area';\nimport { TextInput } from '../text-input/text-input';\nimport { Spinner } from '../spinner/spinner';\nimport {\n defaultConfirmationSelection,\n resolveConfirmationChannels,\n} from './cascade';\nimport type {\n BookingDetails,\n BookingValidator,\n ConfirmationChannel,\n} from './booking-types';\n\n/* -------------------------------------------------------------------- */\n/* BookingDetailsForm — step 7 of the cascade. */\n/* */\n/* Captures the patient's identity + contact + consents before submit. */\n/* The form's `onChange` fires per-field so the parent value can persist */\n/* a partial across step navigation; the parent's `onSubmit` is called */\n/* with the full `BookingDetails` payload only when every required field */\n/* + both consents validate. */\n/* -------------------------------------------------------------------- */\n\nconst NOTE_MAX_LENGTH = 500;\nconst CF_REGEX = /^[A-Z0-9]{16}$/;\nconst EMAIL_REGEX = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\nconst VALIDATE_DEBOUNCE_MS = 300;\n\n/* -------------------------------------------------------------------- */\n/* Props */\n/* -------------------------------------------------------------------- */\n\nexport interface BookingDetailsFormProps {\n value: Partial<BookingDetails>;\n onChange: (next: Partial<BookingDetails>) => void;\n onSubmit: (details: BookingDetails) => void | Promise<void>;\n\n // Opt-in fields\n requireCodiceFiscale?: boolean;\n requireDateOfBirth?: boolean;\n /** When `true` AND `insuranceType === 'public'`, render the Versichertennummer field. */\n requireInsuranceNumber?: boolean;\n insuranceType?: 'private' | 'public';\n showNote?: boolean;\n showReturningPatientFlag?: boolean;\n\n // Consent labels\n privacyPolicyUrl?: string;\n termsUrl?: string;\n\n // Validation hooks\n validateCodiceFiscale?: BookingValidator;\n validateInsuranceNumber?: BookingValidator;\n\n // UX\n submitting?: boolean;\n /** Optional summary node rendered above the form (e.g. confirm-time chip). */\n summarySlot?: ReactNode;\n\n // Phone country default — propagated from the practice country code so\n // the country prefix selector starts on the right option.\n defaultPhoneCountry?: string;\n\n // Confirmation-channel picker (sub-section of step 7)\n /**\n * Channels the practice has enabled. When omitted, defaults to\n * `['email']` (picker hidden — single implicit channel). When the\n * resolved list has length 1 the picker stays hidden.\n */\n confirmationChannels?: ConfirmationChannel[];\n /** Pre-checked channels override; falls back to a smart default. */\n defaultConfirmationChannels?: ConfirmationChannel[];\n /**\n * Render an error Alert above the submit button. Set after an\n * `onSubmit` rejection, clear before retrying. The kit doesn't\n * disable the submit button while this is set — the patient can\n * re-submit immediately.\n */\n submitError?: ReactNode;\n}\n\n/* -------------------------------------------------------------------- */\n/* Component */\n/* -------------------------------------------------------------------- */\n\ninterface AsyncStatus {\n state: 'idle' | 'pending' | 'valid' | 'invalid';\n hint?: string;\n}\n\nconst idleStatus: AsyncStatus = { state: 'idle' };\n\nexport const BookingDetailsForm = forwardRef<\n HTMLFormElement,\n BookingDetailsFormProps\n>(\n (\n {\n value,\n onChange,\n onSubmit,\n requireCodiceFiscale = false,\n requireDateOfBirth = false,\n requireInsuranceNumber = false,\n insuranceType,\n showNote = false,\n showReturningPatientFlag = false,\n privacyPolicyUrl,\n termsUrl,\n validateCodiceFiscale,\n validateInsuranceNumber,\n submitting = false,\n summarySlot,\n defaultPhoneCountry,\n confirmationChannels,\n defaultConfirmationChannels,\n submitError,\n },\n ref,\n ) => {\n const { t } = useTranslation();\n const formId = useId();\n\n // Async-validation state per field.\n const [cfStatus, setCfStatus] = useState<AsyncStatus>(idleStatus);\n const [insuranceStatus, setInsuranceStatus] =\n useState<AsyncStatus>(idleStatus);\n\n // Show-validation-error toggle — flips on first blur / submit attempt\n // so the inline errors don't shout at the user mid-typing.\n const [touched, setTouched] = useState<Record<string, boolean>>({});\n const markTouched = useCallback(\n (field: string) => setTouched((t) => ({ ...t, [field]: true })),\n [],\n );\n\n // Per-field debounce timers for the async validators.\n const cfTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const insuranceTimerRef = useRef<ReturnType<typeof setTimeout> | null>(\n null,\n );\n\n useEffect(\n () => () => {\n if (cfTimerRef.current) clearTimeout(cfTimerRef.current);\n if (insuranceTimerRef.current) clearTimeout(insuranceTimerRef.current);\n },\n [],\n );\n\n /* -------------------------- Mutators ---------------------------- */\n\n const update = useCallback(\n (patch: Partial<BookingDetails>) => onChange({ ...value, ...patch }),\n [value, onChange],\n );\n\n /* -------------------- Confirmation-channel picker ---------------- */\n\n const resolvedEnabledChannels = useMemo(\n () => resolveConfirmationChannels(confirmationChannels),\n [confirmationChannels],\n );\n const pickerVisible = resolvedEnabledChannels.length >= 2;\n\n // Smart-default the selection once on mount (and whenever the inputs\n // that drive it change — `mobilePhone` toggles WhatsApp eligibility).\n // We only seed when the parent value is undefined so the patient's own\n // changes win.\n const seededRef = useRef(false);\n useEffect(() => {\n if (!pickerVisible) {\n // Implicit single channel — strip any stale selection.\n if (value.confirmationChannels !== undefined) {\n update({ confirmationChannels: undefined });\n }\n return;\n }\n if (value.confirmationChannels !== undefined) {\n seededRef.current = true;\n return;\n }\n const seed = defaultConfirmationSelection(\n resolvedEnabledChannels,\n value.mobilePhone,\n defaultConfirmationChannels,\n );\n seededRef.current = true;\n update({ confirmationChannels: seed });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n pickerVisible,\n resolvedEnabledChannels,\n value.mobilePhone,\n defaultConfirmationChannels,\n ]);\n\n const selectedChannels = useMemo<ConfirmationChannel[]>(\n () => value.confirmationChannels ?? [],\n [value.confirmationChannels],\n );\n const noChannelsSelected = pickerVisible && selectedChannels.length === 0;\n\n /* -------------------------- CF async ---------------------------- */\n\n useEffect(() => {\n const cf = value.codiceFiscale;\n if (!requireCodiceFiscale || !validateCodiceFiscale || !cf) {\n setCfStatus(idleStatus);\n return;\n }\n if (!CF_REGEX.test(cf)) {\n // Don't fire the async validator until the format is plausible.\n setCfStatus({\n state: 'invalid',\n hint: t('booking.details.codiceFiscale.invalidFormat'),\n });\n return;\n }\n setCfStatus({ state: 'pending' });\n if (cfTimerRef.current) clearTimeout(cfTimerRef.current);\n cfTimerRef.current = setTimeout(() => {\n validateCodiceFiscale(cf)\n .then((res) =>\n setCfStatus(\n res.valid\n ? { state: 'valid' }\n : { state: 'invalid', hint: res.hint },\n ),\n )\n .catch(() =>\n setCfStatus({\n state: 'invalid',\n hint: t('booking.details.codiceFiscale.unavailable'),\n }),\n );\n }, VALIDATE_DEBOUNCE_MS);\n }, [requireCodiceFiscale, validateCodiceFiscale, value.codiceFiscale, t]);\n\n /* ----------------------- Insurance async ------------------------ */\n\n const insuranceShown = requireInsuranceNumber && insuranceType === 'public';\n useEffect(() => {\n const n = value.insuranceNumber;\n if (!insuranceShown || !validateInsuranceNumber || !n) {\n setInsuranceStatus(idleStatus);\n return;\n }\n setInsuranceStatus({ state: 'pending' });\n if (insuranceTimerRef.current) clearTimeout(insuranceTimerRef.current);\n insuranceTimerRef.current = setTimeout(() => {\n validateInsuranceNumber(n)\n .then((res) =>\n setInsuranceStatus(\n res.valid\n ? { state: 'valid' }\n : { state: 'invalid', hint: res.hint },\n ),\n )\n .catch(() =>\n setInsuranceStatus({\n state: 'invalid',\n hint: t('booking.details.insuranceNumber.unavailable'),\n }),\n );\n }, VALIDATE_DEBOUNCE_MS);\n }, [insuranceShown, validateInsuranceNumber, value.insuranceNumber, t]);\n\n /* ------------------------- Validation --------------------------- */\n\n const emailValid = useMemo(\n () => Boolean(value.email && EMAIL_REGEX.test(value.email)),\n [value.email],\n );\n const phoneValid = useMemo(\n () => Boolean(value.mobilePhone && value.mobilePhone.length >= 6),\n [value.mobilePhone],\n );\n\n const requiredFieldsValid = useMemo(() => {\n if (!value.firstName?.trim()) return false;\n if (!value.lastName?.trim()) return false;\n if (!emailValid) return false;\n if (!phoneValid) return false;\n if (requireCodiceFiscale && cfStatus.state !== 'valid') return false;\n if (requireDateOfBirth && !value.dateOfBirth) return false;\n if (insuranceShown && insuranceStatus.state !== 'valid') return false;\n return true;\n }, [\n value.firstName,\n value.lastName,\n emailValid,\n phoneValid,\n requireCodiceFiscale,\n cfStatus.state,\n requireDateOfBirth,\n value.dateOfBirth,\n insuranceShown,\n insuranceStatus.state,\n ]);\n\n const consentsTicked = Boolean(value.privacyConsent && value.termsConsent);\n const channelsSatisfied = !pickerVisible || selectedChannels.length > 0;\n const canSubmit =\n requiredFieldsValid && consentsTicked && channelsSatisfied && !submitting;\n\n /* --------------------------- Submit ----------------------------- */\n\n const handleSubmit = (e: FormEvent<HTMLFormElement>) => {\n e.preventDefault();\n // Surface every validation error on submit attempt.\n setTouched({\n firstName: true,\n lastName: true,\n email: true,\n mobilePhone: true,\n codiceFiscale: true,\n dateOfBirth: true,\n insuranceNumber: true,\n });\n if (!canSubmit) return;\n const payload: BookingDetails = {\n firstName: value.firstName!.trim(),\n lastName: value.lastName!.trim(),\n email: value.email!.trim(),\n mobilePhone: value.mobilePhone!,\n privacyConsent: true,\n termsConsent: true,\n codiceFiscale: value.codiceFiscale,\n dateOfBirth: value.dateOfBirth,\n insuranceNumber: value.insuranceNumber,\n note: value.note,\n returningPatient: value.returningPatient,\n // Only include when the picker was visible; otherwise the single\n // implicit channel is inferred backend-side from the practice\n // config.\n confirmationChannels: pickerVisible ? selectedChannels : undefined,\n };\n onSubmit(payload);\n };\n\n /* ---------------------- Consent label JSX ----------------------- */\n\n // Translated label with an embedded link to the policy URL. Uses\n // <Trans> so the link target is bound at render rather than baked\n // into the localised string.\n const renderConsentLabel = (\n i18nKey: string,\n url: string | undefined,\n ): ReactNode => {\n // Strip the link if the URL isn't http(s) — guards against\n // `javascript:` / `data:` URIs reaching the rendered `href`.\n const safeUrl = url && /^https?:\\/\\//i.test(url) ? url : undefined;\n if (!safeUrl) {\n return t(i18nKey);\n }\n return (\n <Trans\n i18nKey={i18nKey}\n components={{\n // The `<Trans>` runtime injects link text from the i18n\n // string. The anchor renders empty at static-analysis time,\n // so `jsx-a11y/anchor-has-content` would false-flag — silence\n // it; the runtime content is the localised policy / terms\n // label.\n policyLink: (\n // eslint-disable-next-line jsx-a11y/anchor-has-content\n <a\n href={safeUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"ds:underline ds:text-[var(--primary)]\"\n />\n ),\n }}\n />\n );\n };\n\n return (\n <form\n ref={ref}\n id={formId}\n noValidate\n onSubmit={handleSubmit}\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\"\n >\n {summarySlot}\n\n {/* Identity */}\n <div className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-sm)] ds:sm:grid-cols-2\">\n <FormField\n label={t('booking.details.firstName.label')}\n required\n error={\n touched.firstName && !value.firstName?.trim()\n ? t('booking.details.firstName.required')\n : undefined\n }\n >\n <TextInput\n autoComplete=\"given-name\"\n value={value.firstName ?? ''}\n onChange={(e) => update({ firstName: e.target.value })}\n onBlur={() => markTouched('firstName')}\n />\n </FormField>\n <FormField\n label={t('booking.details.lastName.label')}\n required\n error={\n touched.lastName && !value.lastName?.trim()\n ? t('booking.details.lastName.required')\n : undefined\n }\n >\n <TextInput\n autoComplete=\"family-name\"\n value={value.lastName ?? ''}\n onChange={(e) => update({ lastName: e.target.value })}\n onBlur={() => markTouched('lastName')}\n />\n </FormField>\n </div>\n\n {/* Contact */}\n <div className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-sm)] ds:sm:grid-cols-2\">\n <FormField\n label={t('booking.details.email.label')}\n required\n error={\n touched.email && !emailValid\n ? t('booking.details.email.invalid')\n : undefined\n }\n >\n <EmailInput\n value={value.email ?? ''}\n onChange={(e) => update({ email: e.target.value })}\n onBlur={() => markTouched('email')}\n />\n </FormField>\n <FormField\n label={t('booking.details.mobilePhone.label')}\n required\n error={\n touched.mobilePhone && !phoneValid\n ? t('booking.details.mobilePhone.invalid')\n : undefined\n }\n >\n <PhoneInput\n value={value.mobilePhone ?? ''}\n defaultCountry={\n defaultPhoneCountry?.toUpperCase() as\n | 'IT'\n | 'DE'\n | 'GB'\n | undefined\n }\n onChange={(e164) => {\n update({ mobilePhone: e164 });\n markTouched('mobilePhone');\n }}\n />\n </FormField>\n </div>\n\n {/* Optional identity fields */}\n {requireCodiceFiscale || requireDateOfBirth ? (\n <div className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-sm)] ds:sm:grid-cols-2\">\n {requireCodiceFiscale ? (\n <FormField\n label={t('booking.details.codiceFiscale.label')}\n required\n description={\n cfStatus.state === 'pending'\n ? t('booking.details.codiceFiscale.checking')\n : t('booking.details.codiceFiscale.helper')\n }\n error={\n touched.codiceFiscale && cfStatus.state === 'invalid'\n ? (cfStatus.hint ??\n t('booking.details.codiceFiscale.invalid'))\n : undefined\n }\n >\n <TextInput\n value={value.codiceFiscale ?? ''}\n maxLength={16}\n onChange={(e) =>\n update({\n codiceFiscale: e.target.value.slice(0, 16).toUpperCase(),\n })\n }\n onBlur={() => markTouched('codiceFiscale')}\n />\n </FormField>\n ) : null}\n {requireDateOfBirth ? (\n <FormField\n label={t('booking.details.dateOfBirth.label')}\n required\n error={\n touched.dateOfBirth && !value.dateOfBirth\n ? t('booking.details.dateOfBirth.required')\n : undefined\n }\n >\n <DatePicker\n value={\n value.dateOfBirth ? new Date(value.dateOfBirth) : undefined\n }\n onChange={(next: Date | undefined) => {\n update({\n dateOfBirth: next\n ? next.toISOString().slice(0, 10)\n : undefined,\n });\n markTouched('dateOfBirth');\n }}\n />\n </FormField>\n ) : null}\n </div>\n ) : null}\n\n {insuranceShown ? (\n <FormField\n label={t('booking.details.insuranceNumber.label')}\n required\n description={\n insuranceStatus.state === 'pending'\n ? t('booking.details.insuranceNumber.checking')\n : undefined\n }\n error={\n touched.insuranceNumber && insuranceStatus.state === 'invalid'\n ? (insuranceStatus.hint ??\n t('booking.details.insuranceNumber.invalid'))\n : undefined\n }\n >\n <TextInput\n value={value.insuranceNumber ?? ''}\n onChange={(e) => update({ insuranceNumber: e.target.value })}\n onBlur={() => markTouched('insuranceNumber')}\n />\n </FormField>\n ) : null}\n\n {showNote ? (\n <FormField\n label={t('booking.details.note.label')}\n description={t('booking.details.note.helper', {\n max: NOTE_MAX_LENGTH,\n })}\n >\n <TextArea\n value={value.note ?? ''}\n maxLength={NOTE_MAX_LENGTH}\n rows={3}\n onChange={(e) => update({ note: e.target.value })}\n />\n </FormField>\n ) : null}\n\n {showReturningPatientFlag ? (\n <Checkbox\n checked={Boolean(value.returningPatient)}\n onCheckedChange={(checked) =>\n update({ returningPatient: checked === true })\n }\n label={t('booking.details.returningPatient.label')}\n />\n ) : null}\n\n {/* Consents — privacy + T&C. Both required for submit. */}\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\">\n <Checkbox\n checked={Boolean(value.privacyConsent)}\n onCheckedChange={(checked) =>\n update({ privacyConsent: checked === true })\n }\n label={\n <>\n {renderConsentLabel(\n 'booking.details.consent.privacy.label',\n privacyPolicyUrl,\n )}\n <span\n aria-hidden=\"true\"\n className=\"ds:text-[var(--destructive)] ds:ms-[var(--spacing-2xs)]\"\n >\n *\n </span>\n </>\n }\n />\n <Checkbox\n checked={Boolean(value.termsConsent)}\n onCheckedChange={(checked) =>\n update({ termsConsent: checked === true })\n }\n label={\n <>\n {renderConsentLabel(\n 'booking.details.consent.terms.label',\n termsUrl,\n )}\n <span\n aria-hidden=\"true\"\n className=\"ds:text-[var(--destructive)] ds:ms-[var(--spacing-2xs)]\"\n >\n *\n </span>\n </>\n }\n />\n </div>\n\n {pickerVisible ? (\n <div\n data-component=\"booking-confirmation-channels\"\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\"\n >\n <CheckboxGroup\n label={t('booking.confirmation.heading')}\n helperText={t('booking.confirmation.helper')}\n value={selectedChannels}\n onChange={(next) =>\n update({\n confirmationChannels: next as ConfirmationChannel[],\n })\n }\n orientation=\"vertical\"\n options={resolvedEnabledChannels.map((c) => ({\n value: c,\n label: t(`booking.confirmation.channel.${c}`),\n }))}\n error={\n noChannelsSelected\n ? t('booking.confirmation.atLeastOne')\n : undefined\n }\n />\n </div>\n ) : null}\n\n {submitError ? (\n <Alert variant=\"error\">\n <Alert.Description>{submitError}</Alert.Description>\n </Alert>\n ) : null}\n\n <Button\n intent=\"primary\"\n size=\"md\"\n type=\"submit\"\n disabled={!canSubmit}\n startIcon={\n submitting ? <Spinner variant=\"pulse\" size=\"sm\" /> : undefined\n }\n >\n {t('booking.details.submit')}\n </Button>\n </form>\n );\n },\n);\n\nBookingDetailsForm.displayName = 'BookingDetailsForm';\n","import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type KeyboardEvent,\n type ReactNode,\n} from 'react';\nimport { cva } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport {\n Activity,\n Baby,\n Bone,\n Brain,\n CalendarRange,\n ChevronDown,\n ChevronLeft,\n ChevronRight,\n ClipboardCheck,\n Ear,\n Eye,\n HeartPulse,\n Microscope,\n Moon,\n Pill,\n ScanLine,\n Scissors,\n Smile,\n Astroid,\n Stethoscope,\n Sun,\n Sunset,\n Syringe,\n type LucideIcon,\n} from 'lucide-react';\nimport {\n addDays,\n addMonths,\n endOfMonth,\n format as fnsFormat,\n isAfter,\n isBefore,\n isSameDay,\n isSameMonth,\n parseISO,\n startOfDay,\n startOfMonth,\n subDays,\n subMonths,\n} from 'date-fns';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { bookingAgent } from './booking.agent';\nimport {\n OPERATORS_ALL,\n applyAutoSelects,\n deriveCascade,\n resetOnDateChange,\n resetOnInsuranceChange,\n resetOnOperatorChange,\n resetOnOperatorIdsChange,\n resetOnServiceChange,\n resetOnServiceIdsChange,\n resetOnSlotChange,\n resetOnSpecialtyChange,\n resetOnSpecialtyIdsChange,\n resolveOperatorId,\n resolveOperatorIds,\n resolveServiceIds,\n resolveSpecialtyIds,\n type CascadeOutputs,\n type CascadeStep,\n} from './cascade';\nimport { BookingDetailsForm } from './details-form';\nimport type {\n BookingDetails,\n BookingHandle,\n BookingOperator,\n BookingProps,\n BookingService,\n BookingSlot,\n BookingSpecialty,\n BookingValue,\n BookingVariant,\n InsuranceType,\n} from './booking-types';\nimport { Alert } from '../alert/alert';\nimport { Badge } from '../badge/badge';\nimport { Button } from '../button/button';\nimport { IconButton } from '../button/icon-button';\nimport { Select, type SelectOption } from '../select/select';\nimport { Combobox } from '../combobox/combobox';\nimport { MultiSelect } from '../multi-select/multi-select';\nimport type { OptionShape } from '../_shared/option';\nimport { Skeleton } from '../skeleton/skeleton';\nimport { EmptyState } from '../empty-state/empty-state';\nimport { StepperAccordion } from '../stepper-accordion/stepper-accordion';\nimport { StepperProgress } from '../stepper-progress/stepper-progress';\nimport type { StepStatus } from '../_shared/stepper';\nimport {\n SlotGrid,\n type SlotGridDay,\n type SlotGridSlot,\n} from '../slot-grid/slot-grid';\n\n/* -------------------------------------------------------------------- */\n/* Re-exports */\n/* */\n/* Public types live in `booking-types.ts` so the cascade engine can */\n/* import them without a circular dep. Re-exported here so consumers */\n/* keep importing from `@alfadocs/ui-kit/booking`. */\n/* -------------------------------------------------------------------- */\n\nexport type {\n BookingDetails,\n BookingHandle,\n BookingOperator,\n BookingProps,\n BookingService,\n BookingSlot,\n BookingSpecialty,\n BookingSubmitPayload,\n BookingValidationResult,\n BookingValidator,\n BookingValue,\n BookingVariant,\n ConfirmationChannel,\n InsuranceType,\n} from './booking-types';\nexport { CONFIRMATION_CHANNEL_ORDER } from './booking-types';\nexport { OPERATORS_ALL } from './cascade';\n\n/* -------------------------------------------------------------------- */\n/* Root variant CVA */\n/* -------------------------------------------------------------------- */\n\nconst rootVariants = cva(\n 'ds:flex ds:w-full ds:flex-col ds:text-[var(--foreground)]',\n {\n variants: {\n variant: {\n 'inline-list': 'ds:gap-[var(--spacing-md)]',\n accordion: 'ds:gap-[var(--spacing-md)]',\n calendar: 'ds:gap-[var(--spacing-md)]',\n flexible: 'ds:gap-[var(--spacing-lg)]',\n progress: 'ds:gap-[var(--spacing-sm)]',\n },\n // `surface=\"elevated\"` matches `Card variant=\"elevated\"` — same\n // tokens, same padding, same boundary behaviour — so consumers can\n // drop their own Card wraps without a double-card look. Default\n // `'flat'` preserves 0.30.x rendering.\n surface: {\n flat: '',\n elevated: [\n 'ds:rounded-[var(--radius-lg)]',\n 'ds:bg-[var(--card)] ds:text-[var(--card-foreground)]',\n 'ds:border ds:border-[color:var(--card-border)]',\n 'ds:shadow-[var(--shadow-card)]',\n 'ds:p-[var(--spacing-md)]',\n ].join(' '),\n },\n },\n defaultVariants: { variant: 'inline-list', surface: 'flat' },\n },\n);\n\n/* -------------------------------------------------------------------- */\n/* Icon inference (kept from 0.25.x — services don't carry an explicit */\n/* icon prop, so we fall back to a keyword-matched Lucide icon). */\n/* -------------------------------------------------------------------- */\n\ntype IconRule = readonly [RegExp, LucideIcon];\n\nconst SERVICE_ICON_RULES: readonly IconRule[] = [\n [\n /\\b(estetic|aesthetic|botox|filler|mesoterap|chirurgia\\s*plastic)/i,\n Syringe,\n ],\n [/\\b(cardio|ecg|elettrocardio|ecocardio|cuore|heart)/i, HeartPulse],\n [/\\b(dent|odonto|tooth|teeth|pulizia|igien|smile)/i, Smile],\n [/\\b(oftalmo|ocul|ophthal|vision|occhi|eye)/i, Eye],\n [/\\b(otorin|udito|orecchi|hearing|ear)/i, Ear],\n [/\\b(neuro|brain|cervello)/i, Brain],\n [/\\b(pediatr|child|bambin)/i, Baby],\n [/\\b(ortop|ortho|osteo|skeleton|ossa|bone)/i, Bone],\n [/\\b(lab|analis|test|sang|esami)/i, Microscope],\n [/\\b(farmaco|pharm|pillol|refill)/i, Pill],\n [/\\b(chirurg|surg|intervent|operat)/i, Scissors],\n [/\\b(scan|rx|x-?ray|raggi|imag|radio|risonan|ecograf|ultras)/i, ScanLine],\n [/\\b(vacc|inject|inie|punto)/i, Syringe],\n [/\\b(derma|skin|pelle)/i, Astroid],\n [/\\b(prima\\s*visit|first\\s*visit|consult|consulto|valutaz)/i, ClipboardCheck],\n [/\\b(general|medicin|family|control|check[-\\s]?up)/i, Activity],\n];\n\nfunction pickIcon(text: string): LucideIcon | null {\n for (const [pattern, Icon] of SERVICE_ICON_RULES) {\n if (pattern.test(text)) return Icon;\n }\n return null;\n}\n\nfunction inferServiceIcon(service: BookingService): ReactNode {\n const Icon = pickIcon(service.label) ?? Stethoscope;\n return <Icon aria-hidden=\"true\" className=\"ds:size-5\" />;\n}\n\n/**\n * Normalised price label — a blank/whitespace-only `priceLabel` counts as\n * absent, so the visible summary and the accessible name always agree on\n * which of the two shapes (price vs duration) they use.\n */\nfunction servicePriceLabel(service: BookingService): string | undefined {\n return service.priceLabel?.trim() ? service.priceLabel : undefined;\n}\n\n/* -------------------------------------------------------------------- */\n/* Shared helpers */\n/* -------------------------------------------------------------------- */\n\nfunction isoOf(date: Date): string {\n return fnsFormat(date, 'yyyy-MM-dd');\n}\n\n/* -------------------------------------------------------------------- */\n/* MonthGrid — inline 6×7 calendar with roving tabindex */\n/* -------------------------------------------------------------------- */\n\ninterface MonthGridProps {\n availableDates: string[];\n selectedDate?: string;\n onSelectDate: (iso: string) => void;\n locale: string;\n loading?: boolean;\n}\n\nconst monthCellBase = [\n 'ds:relative ds:flex ds:items-center ds:justify-center',\n 'ds:min-h-[var(--min-target-size)] ds:min-w-[var(--min-target-size)]',\n 'ds:rounded-[var(--radius-sm)]',\n 'ds:text-[length:var(--font-size-sm)]',\n 'ds:transition-colors ds:duration-[var(--animation-duration)]',\n 'ds:motion-reduce:transition-none',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:forced-colors:focus-visible:outline-[CanvasText]',\n].join(' ');\n\nconst monthCellVariants = cva(monthCellBase, {\n variants: {\n state: {\n available:\n 'ds:cursor-pointer ds:text-[var(--foreground)] ds:hover:bg-[var(--muted)]/30',\n unavailable: 'ds:cursor-not-allowed ds:text-[var(--muted-foreground)]/60',\n selected:\n 'ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)] ds:font-[var(--font-weight-semibold)]',\n outside: 'ds:text-[var(--muted-foreground)]/40',\n },\n },\n defaultVariants: { state: 'unavailable' },\n});\n\nfunction MonthGrid({\n availableDates,\n selectedDate,\n onSelectDate,\n locale,\n loading,\n}: MonthGridProps) {\n const { t } = useTranslation();\n\n const initialMonth = useMemo<Date>(() => {\n if (selectedDate) return startOfMonth(parseISO(selectedDate));\n if (availableDates.length > 0) {\n return startOfMonth(parseISO(availableDates[0]));\n }\n return startOfMonth(new Date());\n }, [selectedDate, availableDates]);\n\n const [viewMonth, setViewMonth] = useState<Date>(initialMonth);\n const [focusDate, setFocusDate] = useState<Date | null>(null);\n\n const cells = useMemo(() => {\n const monthStart = startOfMonth(viewMonth);\n const monthEnd = endOfMonth(viewMonth);\n const startWeekday = monthStart.getDay();\n const totalDays = monthEnd.getDate();\n const grid: Date[] = [];\n for (let i = startWeekday; i > 0; i -= 1) {\n const d = new Date(monthStart);\n d.setDate(monthStart.getDate() - i);\n grid.push(d);\n }\n for (let i = 0; i < totalDays; i += 1) {\n const d = new Date(monthStart);\n d.setDate(monthStart.getDate() + i);\n grid.push(d);\n }\n while (grid.length < 42) {\n const last = grid[grid.length - 1];\n const d = new Date(last);\n d.setDate(last.getDate() + 1);\n grid.push(d);\n }\n return grid;\n }, [viewMonth]);\n\n const monthLabel = useMemo(() => {\n try {\n return new Intl.DateTimeFormat(locale, {\n month: 'long',\n year: 'numeric',\n }).format(viewMonth);\n } catch {\n return fnsFormat(viewMonth, 'MMMM yyyy');\n }\n }, [viewMonth, locale]);\n\n const weekdayLabels = useMemo(() => {\n const base = new Date(2024, 0, 7);\n return Array.from({ length: 7 }, (_, i) => {\n const d = new Date(base);\n d.setDate(base.getDate() + i);\n try {\n return new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(d);\n } catch {\n return fnsFormat(d, 'EEE');\n }\n });\n }, [locale]);\n\n const availableSet = useMemo(() => new Set(availableDates), [availableDates]);\n const isAvailable = useCallback(\n (date: Date) => availableSet.has(isoOf(date)),\n [availableSet],\n );\n\n const rovingDate = useMemo<Date | null>(() => {\n if (focusDate) return focusDate;\n if (selectedDate) return parseISO(selectedDate);\n const firstAvailable = cells.find(\n (d) => isSameMonth(d, viewMonth) && isAvailable(d),\n );\n if (firstAvailable) return firstAvailable;\n return cells.find((d) => isSameMonth(d, viewMonth)) ?? null;\n }, [focusDate, selectedDate, cells, viewMonth, isAvailable]);\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLButtonElement>, current: Date) => {\n let next: Date | null = null;\n switch (event.key) {\n case 'ArrowLeft':\n next = new Date(current);\n next.setDate(current.getDate() - 1);\n break;\n case 'ArrowRight':\n next = new Date(current);\n next.setDate(current.getDate() + 1);\n break;\n case 'ArrowUp':\n next = new Date(current);\n next.setDate(current.getDate() - 7);\n break;\n case 'ArrowDown':\n next = new Date(current);\n next.setDate(current.getDate() + 7);\n break;\n case 'Home':\n next = new Date(current);\n next.setDate(current.getDate() - current.getDay());\n break;\n case 'End':\n next = new Date(current);\n next.setDate(current.getDate() + (6 - current.getDay()));\n break;\n case 'Enter':\n case ' ': {\n event.preventDefault();\n if (isAvailable(current)) onSelectDate(isoOf(current));\n return;\n }\n default:\n return;\n }\n if (!next) return;\n event.preventDefault();\n if (!isSameMonth(next, viewMonth)) {\n setViewMonth(startOfMonth(next));\n }\n setFocusDate(next);\n },\n [isAvailable, onSelectDate, viewMonth],\n );\n\n if (loading) {\n return (\n <div\n role=\"status\"\n aria-live=\"polite\"\n aria-label={t('common.loading')}\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\"\n >\n <Skeleton variant=\"text\" width=\"40%\" />\n <div className=\"ds:grid ds:grid-cols-7 ds:gap-[var(--spacing-2xs)]\">\n {Array.from({ length: 42 }, (_, i) => (\n <Skeleton key={`mg-skel-${i}`} variant=\"rounded\" height=\"2.5rem\" />\n ))}\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n <div className=\"ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]\">\n <IconButton\n icon={<ChevronLeft />}\n aria-label={t('booking.previousMonth')}\n size=\"sm\"\n intent=\"ghost\"\n flipIconInRtl\n onClick={() => {\n setViewMonth((m) => subMonths(m, 1));\n setFocusDate(null);\n }}\n />\n <span\n className=\"type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)]\"\n aria-live=\"polite\"\n >\n {monthLabel}\n </span>\n <IconButton\n icon={<ChevronRight />}\n aria-label={t('booking.nextMonth')}\n size=\"sm\"\n intent=\"ghost\"\n flipIconInRtl\n onClick={() => {\n setViewMonth((m) => addMonths(m, 1));\n setFocusDate(null);\n }}\n />\n </div>\n <div\n role=\"grid\"\n aria-label={t('booking.monthGridLabel')}\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]\"\n >\n <div\n role=\"row\"\n className=\"ds:grid ds:grid-cols-7 ds:gap-[var(--spacing-2xs)]\"\n >\n {weekdayLabels.map((label, i) => (\n <div\n key={`wd-${i}`}\n role=\"columnheader\"\n className=\"type-meta ds:text-center ds:text-[var(--muted-foreground)] ds:font-[var(--font-weight-medium)]\"\n >\n {label}\n </div>\n ))}\n </div>\n {Array.from({ length: 6 }, (_, rowIndex) => (\n <div\n key={`mg-row-${rowIndex}`}\n role=\"row\"\n className=\"ds:grid ds:grid-cols-7 ds:gap-[var(--spacing-2xs)]\"\n >\n {cells\n .slice(rowIndex * 7, rowIndex * 7 + 7)\n .map((date, colIndex) => {\n const i = rowIndex * 7 + colIndex;\n const inMonth = isSameMonth(date, viewMonth);\n const available = inMonth && isAvailable(date);\n const isSelected = selectedDate\n ? isSameDay(date, parseISO(selectedDate))\n : false;\n const state:\n | 'available'\n | 'unavailable'\n | 'selected'\n | 'outside' = !inMonth\n ? 'outside'\n : isSelected\n ? 'selected'\n : available\n ? 'available'\n : 'unavailable';\n const isRoving = rovingDate\n ? isSameDay(rovingDate, date)\n : false;\n const dayLabel = (() => {\n try {\n return new Intl.DateTimeFormat(locale, {\n dateStyle: 'full',\n }).format(date);\n } catch {\n return fnsFormat(date, 'PPP');\n }\n })();\n return (\n <button\n key={`mg-cell-${i}`}\n type=\"button\"\n role=\"gridcell\"\n aria-label={dayLabel}\n aria-selected={isSelected || undefined}\n aria-disabled={!available || undefined}\n tabIndex={isRoving ? 0 : -1}\n disabled={!available}\n onClick={() => {\n if (available) onSelectDate(isoOf(date));\n }}\n onKeyDown={(e) => handleKeyDown(e, date)}\n className={monthCellVariants({ state })}\n >\n <span aria-hidden=\"true\">{date.getDate()}</span>\n </button>\n );\n })}\n </div>\n ))}\n </div>\n </div>\n );\n}\n\n/* -------------------------------------------------------------------- */\n/* ServiceCardGroup — hand-rolled radiogroup for service selection. */\n/* */\n/* Used by the `inline-list` variant where services render as full-row */\n/* cards with the inferred icon. Other variants use a Select dropdown */\n/* via `ServiceStep` below. */\n/* -------------------------------------------------------------------- */\n\nconst serviceCardVariants = cva(\n [\n 'ds:relative ds:flex ds:w-full ds:items-center ds:gap-[var(--spacing-md)]',\n 'ds:min-h-[var(--min-target-size)]',\n 'ds:rounded-[var(--radius-md)]',\n 'ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]',\n 'ds:pt-[var(--spacing-sm)] ds:pb-[var(--spacing-sm)]',\n 'ds:text-start',\n 'ds:transition-[background-color,box-shadow]',\n 'ds:duration-[var(--animation-duration)]',\n 'ds:motion-reduce:transition-none',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:forced-colors:[outline:1px_solid_CanvasText]',\n 'ds:cursor-pointer',\n ].join(' '),\n {\n variants: {\n state: {\n idle: 'ds:bg-[var(--card)] ds:shadow-[var(--shadow-sm)] ds:hover:shadow-[var(--shadow-md)]',\n selected:\n 'ds:bg-[color-mix(in_srgb,var(--primary)_8%,var(--card))] ds:shadow-[var(--shadow-sm)]',\n },\n },\n defaultVariants: { state: 'idle' },\n },\n);\n\ninterface ServiceCardGroupProps {\n services: BookingService[];\n selectedServiceId?: string;\n onSelect: (id: string) => void;\n}\n\nfunction ServiceCardGroup({\n services,\n selectedServiceId,\n onSelect,\n}: ServiceCardGroupProps) {\n const { t } = useTranslation();\n const groupId = useId();\n\n const [focusIndex, setFocusIndex] = useState<number>(() => {\n if (selectedServiceId) {\n const i = services.findIndex((s) => s.id === selectedServiceId);\n if (i >= 0) return i;\n }\n return 0;\n });\n\n const cardRefs = useRef<Map<number, HTMLButtonElement>>(new Map());\n const focusAt = useCallback((index: number) => {\n cardRefs.current.get(index)?.focus();\n }, []);\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLButtonElement>, index: number, id: string) => {\n const total = services.length;\n if (total === 0) return;\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowRight': {\n event.preventDefault();\n const next = (index + 1) % total;\n setFocusIndex(next);\n focusAt(next);\n break;\n }\n case 'ArrowUp':\n case 'ArrowLeft': {\n event.preventDefault();\n const prev = (index - 1 + total) % total;\n setFocusIndex(prev);\n focusAt(prev);\n break;\n }\n case 'Home': {\n event.preventDefault();\n setFocusIndex(0);\n focusAt(0);\n break;\n }\n case 'End': {\n event.preventDefault();\n const last = total - 1;\n setFocusIndex(last);\n focusAt(last);\n break;\n }\n case 'Enter':\n case ' ': {\n event.preventDefault();\n onSelect(id);\n break;\n }\n default:\n break;\n }\n },\n [services.length, focusAt, onSelect],\n );\n\n if (services.length === 0) {\n return null;\n }\n\n return (\n <div\n role=\"radiogroup\"\n aria-label={t('booking.serviceListLabel')}\n id={groupId}\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\"\n >\n {services.map((service, index) => {\n const isSelected = selectedServiceId === service.id;\n const isFocused = focusIndex === index;\n const priceLabel = servicePriceLabel(service);\n const ariaLabel = priceLabel\n ? t('booking.serviceCardLabelPrice', {\n label: service.label,\n price: priceLabel,\n })\n : t('booking.serviceCardLabel', {\n label: service.label,\n duration: service.durationMin,\n });\n const iconNode = inferServiceIcon(service);\n return (\n <button\n key={service.id}\n ref={(node) => {\n if (node) cardRefs.current.set(index, node);\n else cardRefs.current.delete(index);\n }}\n type=\"button\"\n role=\"radio\"\n aria-checked={isSelected}\n aria-label={ariaLabel}\n tabIndex={isFocused ? 0 : -1}\n onClick={() => onSelect(service.id)}\n onFocus={() => setFocusIndex(index)}\n onKeyDown={(e) => handleKeyDown(e, index, service.id)}\n className={serviceCardVariants({\n state: isSelected ? 'selected' : 'idle',\n })}\n >\n <span\n aria-hidden=\"true\"\n className=\"ds:flex ds:size-10 ds:shrink-0 ds:items-center ds:justify-center ds:rounded-[var(--radius-sm)] ds:bg-[var(--primary)]/10 ds:text-[var(--primary)]\"\n >\n {iconNode}\n </span>\n <span className=\"ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-2xs)]\">\n <span className=\"type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)]\">\n {service.label}\n </span>\n {/* Only the duration fallback stays stacked under the\n name. A price leaves the column entirely so it can\n pin to the end of the card — see below. */}\n {priceLabel ? null : (\n <span className=\"type-meta ds:text-[var(--muted-foreground)]\">\n {t('booking.serviceSummary', {\n minutes: service.durationMin,\n })}\n </span>\n )}\n </span>\n {/* The price is the figure a patient compares between\n services, so it gets a chip at a fixed inline-end\n position rather than trailing a name of variable\n length.\n\n `aria-hidden` because the button's own `aria-label`\n already carries the price, making the chip redundant to\n assistive tech. Note `aria-label` REPLACES the subtree in\n name computation, so this is belt-and-braces for verbose\n and browse modes rather than the only thing preventing a\n double announcement. The pairing is load-bearing in the\n other direction though: both this chip and that label are\n gated on the same `priceLabel` const, so the price can\n never be hidden here without also being present there. */}\n {priceLabel ? (\n <span\n aria-hidden=\"true\"\n className=\"ds:inline-flex ds:shrink-0 ds:items-center ds:ms-auto\"\n >\n <Badge variant=\"accentSoft\" size=\"lg\">\n {priceLabel}\n </Badge>\n </span>\n ) : null}\n </button>\n );\n })}\n </div>\n );\n}\n\n/* -------------------------------------------------------------------- */\n/* GroupedTimeSlots — calendar variant's morning/afternoon/evening slots */\n/* -------------------------------------------------------------------- */\n\nconst slotChipVariants = cva(\n [\n 'ds:inline-flex ds:items-center ds:justify-center ds:gap-[var(--spacing-2xs)]',\n 'ds:min-h-[var(--min-target-size)]',\n 'ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]',\n 'ds:pt-[var(--spacing-2xs)] ds:pb-[var(--spacing-2xs)]',\n 'ds:rounded-[var(--radius-md)]',\n 'ds:text-[length:var(--font-size-sm)] ds:font-[var(--font-weight-medium)]',\n 'ds:transition-[background-color,color,box-shadow] ds:duration-[var(--animation-duration)]',\n 'ds:motion-reduce:transition-none',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:disabled:cursor-not-allowed ds:disabled:opacity-50',\n 'ds:forced-colors:[border:1px_solid_ButtonText] ds:forced-colors:text-[ButtonText]',\n ].join(' '),\n {\n variants: {\n state: {\n idle: 'ds:bg-[color:var(--card)] ds:text-[color:var(--foreground)] ds:shadow-[var(--shadow-sm)] ds:hover:enabled:bg-[color:var(--muted)]/40 ds:hover:enabled:shadow-[var(--shadow-md)]',\n selected:\n 'ds:bg-[color:var(--primary)] ds:text-[color:var(--primary-foreground)] ds:shadow-[var(--shadow-sm)]',\n unavailable:\n 'ds:[outline:1px_dashed_color:var(--border)] ds:[outline-offset:-1px] ds:bg-transparent ds:text-[color:var(--muted-foreground)]',\n },\n },\n defaultVariants: { state: 'idle' },\n },\n);\n\ntype TimeOfDay = 'morning' | 'afternoon' | 'evening';\n\nfunction bucketForTime(time: string): TimeOfDay {\n const [hh] = time.split(':').map((s) => parseInt(s, 10));\n const hour = Number.isFinite(hh) ? hh : 0;\n if (hour < 12) return 'morning';\n if (hour < 17) return 'afternoon';\n return 'evening';\n}\n\nconst BUCKET_ICONS: Record<TimeOfDay, LucideIcon> = {\n morning: Sun,\n afternoon: Sunset,\n evening: Moon,\n};\n\ninterface GroupedTimeSlotsProps {\n date: string;\n slots: BookingSlot[];\n selectedSlotKey?: string;\n onSelect: (slot: BookingSlot) => void;\n loading?: boolean;\n locale: string;\n}\n\nfunction GroupedTimeSlots({\n date,\n slots,\n selectedSlotKey,\n onSelect,\n loading,\n locale,\n}: GroupedTimeSlotsProps) {\n const { t } = useTranslation();\n\n const dateLabel = useMemo(() => {\n try {\n return new Intl.DateTimeFormat(locale, {\n weekday: 'long',\n day: 'numeric',\n month: 'long',\n }).format(parseISO(date));\n } catch {\n return date;\n }\n }, [date, locale]);\n\n const groups = useMemo(() => {\n const result: Record<TimeOfDay, BookingSlot[]> = {\n morning: [],\n afternoon: [],\n evening: [],\n };\n for (const slot of slots) {\n result[bucketForTime(slot.time)].push(slot);\n }\n return result;\n }, [slots]);\n\n const availableCount = slots.filter((s) => s.available).length;\n const order: TimeOfDay[] = ['morning', 'afternoon', 'evening'];\n\n if (loading) {\n return (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n <Skeleton variant=\"text\" width=\"60%\" />\n {[0, 1].map((row) => (\n <div\n key={row}\n className=\"ds:grid ds:grid-cols-3 ds:gap-[var(--spacing-xs)]\"\n >\n {[0, 1, 2].map((c) => (\n <Skeleton key={c} variant=\"rounded\" height=\"44px\" />\n ))}\n </div>\n ))}\n </div>\n );\n }\n\n if (availableCount === 0) {\n return (\n <EmptyState variant=\"no-results\" title={t('booking.noSlotsForDate')} />\n );\n }\n\n return (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n <div className=\"ds:flex ds:items-baseline ds:justify-between ds:gap-[var(--spacing-sm)]\">\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-xs)]\">\n <CalendarRange\n aria-hidden=\"true\"\n className=\"ds:size-4 ds:text-[color:var(--accent)]\"\n />\n <h3 className=\"type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0\">\n {dateLabel}\n </h3>\n </div>\n <span className=\"type-meta ds:text-[var(--muted-foreground)]\">\n {t('booking.slotsAvailable', { count: availableCount })}\n </span>\n </div>\n {order.map((bucket) => {\n const items = groups[bucket];\n if (items.length === 0) return null;\n const Icon = BUCKET_ICONS[bucket];\n return (\n <div\n key={bucket}\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\"\n >\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-xs)] ds:text-[color:var(--muted-foreground)]\">\n <Icon aria-hidden=\"true\" className=\"ds:size-3.5\" />\n <span className=\"type-meta ds:font-[var(--font-weight-semibold)] ds:uppercase\">\n {t(`booking.timeOfDay.${bucket}`)}\n </span>\n </div>\n <div\n role=\"group\"\n aria-label={t(`booking.timeOfDay.${bucket}`)}\n className=\"ds:grid ds:grid-cols-3 ds:gap-[var(--spacing-xs)] ds:sm:grid-cols-4\"\n >\n {items.map((slot) => {\n const isSelected = slot.key === selectedSlotKey;\n const state = !slot.available\n ? 'unavailable'\n : isSelected\n ? 'selected'\n : 'idle';\n return (\n <button\n key={slot.key}\n type=\"button\"\n data-slot-id={slot.key}\n disabled={!slot.available}\n aria-pressed={isSelected}\n aria-label={t('booking.slotAvailableLabel', {\n time: slot.time,\n })}\n onClick={() => slot.available && onSelect(slot)}\n className={slotChipVariants({ state })}\n >\n {slot.time}\n </button>\n );\n })}\n </div>\n </div>\n );\n })}\n </div>\n );\n}\n\n/* -------------------------------------------------------------------- */\n/* FourDayPicker — adapter for `datePickerStyle='four-day-grid'` */\n/* */\n/* Thin wrapper around the kit's `<SlotGrid>` primitive that translates */\n/* Booking's data shape (`availableDates`, `availableSlots`, `value`) */\n/* into the SlotGrid `days` array, and back from SlotGrid's `onSlotSelect`*/\n/* into Booking's atomic date+slot onChange. Window of 4 days, ±4-day */\n/* arrow navigation, \"Show more\" expander at 6 slots (matches prod). */\n/* */\n/* Slot selection sets `value.date` and `value.slotKey` atomically (one */\n/* onChange call composing resetOnDateChange + resetOnSlotChange). That */\n/* matches the prod UX where a user clicks a tile directly without a */\n/* separate date pick. `onDateSelect` fires alongside so consumers using */\n/* the two-query lazy-load pattern get the same signal as the month- */\n/* calendar picker. The cascade's separate \"slot\" step is suppressed */\n/* (see `renderSlotStep`) because the slots are inline with the strip. */\n/* -------------------------------------------------------------------- */\n\nconst FOUR_DAY_WINDOW_SIZE = 4;\n\ninterface FourDayPickerProps {\n availableDates: string[];\n availableSlots: Record<string, BookingSlot[]>;\n value: BookingValue;\n onChange: (next: BookingValue) => void;\n onDateSelect?: (iso: string) => void;\n onWindowChange?: (startIso: string, endIso: string) => void;\n loadingDates?: boolean;\n loadingSlots?: boolean;\n locale: string;\n agentIdBase?: string;\n}\n\nfunction FourDayPicker({\n availableDates,\n availableSlots,\n value,\n onChange,\n onDateSelect,\n onWindowChange,\n loadingDates,\n loadingSlots,\n locale,\n agentIdBase,\n}: FourDayPickerProps) {\n const today = useMemo(() => startOfDay(new Date()), []);\n\n // Initial window: snap to value.date if set and not in the past;\n // otherwise to the first availableDate when it's in the future;\n // otherwise today. Saves the user from manually advancing 4-day\n // chunks when availability is days or weeks out.\n const [windowStart, setWindowStart] = useState<Date>(() => {\n if (value.date) {\n const d = startOfDay(parseISO(value.date));\n if (!isAfter(today, d)) return d;\n }\n if (availableDates.length > 0) {\n const first = startOfDay(parseISO(availableDates[0]));\n if (isAfter(first, today)) return first;\n }\n return today;\n });\n\n const windowEnd = useMemo(\n () => addDays(windowStart, FOUR_DAY_WINDOW_SIZE - 1),\n [windowStart],\n );\n\n // Build the SlotGrid days array — one entry per visible calendar\n // day in the 4-day window. Columns without availability render as\n // empty columns (SlotGrid handles the \"no slots\" rendering itself).\n const days = useMemo<SlotGridDay[]>(() => {\n return Array.from({ length: FOUR_DAY_WINDOW_SIZE }, (_, i) => {\n const d = addDays(windowStart, i);\n const iso = isoOf(d);\n const bookingSlots = availableSlots[iso] ?? [];\n const slots: SlotGridSlot[] = bookingSlots.map((s) => ({\n id: s.key,\n // SlotGrid formats `start` as a time via Intl.DateTimeFormat —\n // compose a full ISO from the column's date + the slot's HH:mm\n // so the locale-formatter has a real timestamp to work with.\n start: `${iso}T${s.time}:00`,\n available: s.available,\n }));\n return { date: iso, slots };\n });\n }, [windowStart, availableSlots]);\n\n const hasPrevious = isAfter(windowStart, today);\n // 0.33.11: forward navigation is unconditional. With two-query\n // consumers, `availableDates` reflects only what's been fetched —\n // gating on it would lock the user out of exploring further\n // windows the consumer hasn't fetched yet. `onWindowChange` lets\n // the consumer lazy-load as the user advances; the \"no slots in\n // window\" state is handled by the next-available banner (fix 2).\n const hasNext = true;\n\n const handlePreviousDays = useCallback(() => {\n setWindowStart((prev) => {\n const next = subDays(prev, FOUR_DAY_WINDOW_SIZE);\n // Clamp at today so the strip never shows past dates.\n return isAfter(today, next) ? today : next;\n });\n }, [today]);\n\n const handleNextDays = useCallback(() => {\n setWindowStart((prev) => addDays(prev, FOUR_DAY_WINDOW_SIZE));\n }, []);\n\n // Fix 1 (0.33.11): re-sync windowStart when availableDates arrives.\n // Two-query consumers ship [] on first render and the real list\n // arrives a frame later — the useState initialiser has already\n // locked windowStart at today and the picker shows today..today+3\n // empty even when the summary returned dates starting day+7.\n //\n // Only snap when the current window has zero overlap with\n // availability AND the first available date is in the future. The\n // overlap check (any availableDate inside [windowStart..windowEnd])\n // preserves user navigation — once they've advanced past the first\n // available date to look further out, we don't yank them back.\n useEffect(() => {\n if (availableDates.length === 0) return;\n const firstAvailable = startOfDay(parseISO(availableDates[0]));\n if (!isAfter(firstAvailable, today)) return;\n const overlaps = availableDates.some((iso) => {\n const d = startOfDay(parseISO(iso));\n return !isAfter(d, windowEnd) && !isBefore(d, windowStart);\n });\n if (overlaps) return;\n setWindowStart(firstAvailable);\n // Intentionally omits windowStart / windowEnd / today — react\n // only to new availability lists. Re-snapping every time the\n // window moves would trap the user inside the first-available\n // 4-day chunk.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [availableDates]);\n\n // Fix 3 (0.33.11): notify two-query consumers whenever the\n // visible window starts or shifts so they can lazy-fetch\n // dailySlots/{date} for the now-visible dates. Fires on mount\n // with the resolved initial window, then on every prev/next\n // arrow click, the fix-1 auto-sync, and the fix-2 jump CTA.\n useEffect(() => {\n onWindowChange?.(isoOf(windowStart), isoOf(windowEnd));\n }, [windowStart, windowEnd, onWindowChange]);\n\n const handleSlotSelect = useCallback(\n (slot: SlotGridSlot, day: SlotGridDay) => {\n const dateIso = typeof day.date === 'string' ? day.date : isoOf(day.date);\n // Atomic: set date + slot in one onChange so cascade.gates.slot\n // observes both together. Without this the consumer would see\n // two renders (date set, then slotKey set) which can re-fire\n // analytics / loading effects unnecessarily.\n onChange({\n ...resetOnSlotChange(resetOnDateChange(value, dateIso), slot.id),\n });\n onDateSelect?.(dateIso);\n },\n [onChange, onDateSelect, value],\n );\n\n // SlotGrid has a single loading state — either flag triggers the\n // shimmer (granular per-header vs per-tile shimmer would require\n // a SlotGrid API extension; treating both as one loading state\n // already satisfies the 0.33.9 split for two-query consumers since\n // only one of the two flags is set at a time in that pattern).\n const state: 'default' | 'loading' =\n loadingDates || loadingSlots ? 'loading' : 'default';\n\n // Fix 2 (0.33.11): \"Next available\" banner above the SlotGrid\n // when the visible window has no slots but the consumer told us\n // availability exists somewhere. Covers two cases the original\n // picker had no recovery for: (a) the user hasn't yet reached\n // the first available date (window is BEFORE availability), and\n // (b) the user advanced past availability (window is AFTER all\n // known available dates). Both render the same banner pointing\n // back to `availableDates[0]` with a jump button.\n //\n // The SlotGrid itself stays mounted so the column headers remain\n // visible — the banner sits above as the recovery affordance.\n const visibleWindowHasSlots = days.some((d) => d.slots.length > 0);\n const firstAvailableIso = availableDates[0];\n const showJumpCta = !visibleWindowHasSlots && !!firstAvailableIso;\n\n return (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n {showJumpCta ? (\n <NextAvailableCta\n nextAvailableDate={firstAvailableIso}\n onJump={() => setWindowStart(startOfDay(parseISO(firstAvailableIso)))}\n locale={locale}\n />\n ) : null}\n <SlotGrid\n id={agentIdBase ? `${agentIdBase}-slots` : undefined}\n days={days}\n state={state}\n selectedSlotId={value.slotKey}\n maxInitialSlotsPerDay={6}\n locale={locale}\n hasPrevious={hasPrevious}\n hasNext={hasNext}\n onSlotSelect={handleSlotSelect}\n onPreviousDays={handlePreviousDays}\n onNextDays={handleNextDays}\n />\n </div>\n );\n}\n\n/* -------------------------------------------------------------------- */\n/* renderDateStep / renderSlotStep — variant-agnostic picker renderers */\n/* */\n/* Both InlineListBody and getStepNode (the cascade-variant body shared */\n/* renderer) call these helpers instead of inlining `<MonthGrid>` / */\n/* `<GroupedTimeSlots>`. Switches on `datePickerStyle`: */\n/* */\n/* - 'month-calendar' (default): MonthGrid for date, GroupedTimeSlots */\n/* for slot. Byte-identical to pre-0.33.10 behaviour. */\n/* - 'four-day-grid': FourDayPicker for date (slots embedded); */\n/* renderSlotStep returns null since slots are inline. */\n/* -------------------------------------------------------------------- */\n\ninterface DateStepRenderProps {\n inputs: VariantBodyProps['inputs'];\n value: BookingValue;\n onChange: (next: BookingValue) => void;\n onDateSelect?: (iso: string) => void;\n onWindowChange?: (startIso: string, endIso: string) => void;\n loadingDates?: boolean;\n loadingSlots?: boolean;\n locale: string;\n datePickerStyle: 'month-calendar' | 'four-day-grid';\n agentIdBase?: string;\n}\n\nfunction renderDateStep(props: DateStepRenderProps): ReactNode {\n const {\n inputs,\n value,\n onChange,\n onDateSelect,\n onWindowChange,\n loadingDates,\n loadingSlots,\n locale,\n datePickerStyle,\n agentIdBase,\n } = props;\n if (datePickerStyle === 'four-day-grid') {\n return (\n <FourDayPicker\n availableDates={inputs.availableDates}\n availableSlots={inputs.availableSlots}\n value={value}\n onChange={onChange}\n onDateSelect={onDateSelect}\n onWindowChange={onWindowChange}\n loadingDates={loadingDates}\n loadingSlots={loadingSlots}\n locale={locale}\n agentIdBase={agentIdBase}\n />\n );\n }\n return (\n <MonthGrid\n availableDates={inputs.availableDates}\n selectedDate={value.date}\n onSelectDate={(iso) => {\n onChange(resetOnDateChange(value, iso));\n onDateSelect?.(iso);\n }}\n locale={locale}\n loading={loadingDates ?? loadingSlots}\n />\n );\n}\n\nfunction renderSlotStep(props: DateStepRenderProps): ReactNode {\n const { inputs, value, onChange, loadingSlots, locale, datePickerStyle } =\n props;\n // four-day-grid embeds the slot tiles inside the picker itself —\n // no separate slot block needed in the variant body.\n if (datePickerStyle === 'four-day-grid') return null;\n if (!value.date) return null;\n return (\n <GroupedTimeSlots\n date={value.date}\n slots={inputs.availableSlots[value.date] ?? []}\n selectedSlotKey={value.slotKey}\n onSelect={(slot) => onChange(resetOnSlotChange(value, slot.key))}\n loading={loadingSlots}\n locale={locale}\n />\n );\n}\n\n/* -------------------------------------------------------------------- */\n/* Step subcomponents */\n/* */\n/* Each step is rendered by every variant that needs it. The variants */\n/* differ in layout (chip rail vs accordion vs vertical list) but the */\n/* step content itself is the same. */\n/* -------------------------------------------------------------------- */\n\ninterface InsuranceStepProps {\n value?: InsuranceType;\n onChange: (next: InsuranceType) => void;\n}\n\nfunction InsuranceStep({ value, onChange }: InsuranceStepProps) {\n const { t } = useTranslation();\n const options: SelectOption[] = [\n { value: 'private', label: t('booking.insurance.private') },\n { value: 'public', label: t('booking.insurance.public') },\n ];\n return (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n <h3 className=\"type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0\">\n {t('booking.insurance.heading')}\n </h3>\n <Select\n options={options}\n value={value ?? ''}\n onValueChange={(next) => {\n if (next === 'private' || next === 'public') onChange(next);\n }}\n placeholder={t('booking.insurance.placeholder')}\n aria-label={t('booking.insurance.heading')}\n />\n </div>\n );\n}\n\ninterface SpecialtyStepProps {\n specialties: BookingSpecialty[];\n value?: string;\n valueIds?: string[];\n onChange: (next: string) => void;\n onChangeIds?: (next: string[]) => void;\n pickerStyle?: 'select' | 'combobox' | 'multi-select';\n}\n\nfunction SpecialtyStep({\n specialties,\n value,\n valueIds,\n onChange,\n onChangeIds,\n pickerStyle = 'select',\n}: SpecialtyStepProps) {\n const { t } = useTranslation();\n const options: OptionShape[] = specialties.map((s) => ({\n value: s.id,\n label: s.label,\n }));\n const heading = (\n <h3 className=\"type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0\">\n {t('booking.specialty.heading')}\n </h3>\n );\n if (pickerStyle === 'multi-select' && onChangeIds) {\n return (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n {heading}\n <MultiSelect\n options={options}\n value={valueIds ?? []}\n onChange={onChangeIds}\n placeholder={t('booking.specialty.placeholder')}\n aria-label={t('booking.specialty.heading')}\n allowClear\n />\n </div>\n );\n }\n if (pickerStyle === 'combobox') {\n return (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n {heading}\n <Combobox\n options={options}\n value={value ?? ''}\n onValueChange={(next) => onChange(next === '' ? '' : next)}\n placeholder={t('booking.specialty.placeholder')}\n aria-label={t('booking.specialty.heading')}\n clearable\n />\n </div>\n );\n }\n return (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n {heading}\n <Select\n options={options as SelectOption[]}\n value={value ?? ''}\n onValueChange={(next) => onChange(next)}\n placeholder={t('booking.specialty.placeholder')}\n aria-label={t('booking.specialty.heading')}\n />\n </div>\n );\n}\n\ninterface ServiceStepProps {\n services: BookingService[];\n value?: string;\n valueIds?: string[];\n onChange: (next: string) => void;\n onChangeIds?: (next: string[]) => void;\n /**\n * 0.34.0: explicit picker style. When undefined, falls back to the\n * `compact` boolean (true → 'select', false → 'cards') so existing\n * variant-body code continues to work unchanged.\n */\n pickerStyle?: 'select' | 'combobox' | 'multi-select' | 'cards';\n /** @deprecated 0.34.0 — pass `pickerStyle='cards'` (default) or `'select'` instead. */\n compact?: boolean;\n}\n\nfunction ServiceStep({\n services,\n value,\n valueIds,\n onChange,\n onChangeIds,\n pickerStyle,\n compact,\n}: ServiceStepProps) {\n const { t } = useTranslation();\n const resolvedStyle = pickerStyle ?? (compact ? 'select' : 'cards');\n // A priced service puts the price in `endContent`, so it renders as a\n // chip pinned to the row's end and the label stays just the service\n // name. `endContent` is not aria-hidden, so the price still reaches\n // the option's accessible name — it must NOT also be repeated in\n // `label` or it is announced twice.\n //\n // A service with no price keeps the duration appended to the label as\n // before: it is a fallback, not the comparable figure, so it does not\n // earn a chip.\n const options: OptionShape[] = services.map((s) => {\n const price = servicePriceLabel(s);\n if (price) {\n return {\n value: s.id,\n label: s.label,\n endContent: (\n <Badge variant=\"accentSoft\" size=\"lg\">\n {price}\n </Badge>\n ),\n };\n }\n return {\n value: s.id,\n label: `${s.label} · ${t('booking.serviceSummary', {\n minutes: s.durationMin,\n })}`,\n };\n });\n const heading = (\n <h3 className=\"type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0\">\n {t('booking.service.heading')}\n </h3>\n );\n if (resolvedStyle === 'multi-select' && onChangeIds) {\n return (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n {heading}\n <MultiSelect\n options={options}\n value={valueIds ?? []}\n onChange={onChangeIds}\n placeholder={t('booking.service.placeholder')}\n aria-label={t('booking.service.heading')}\n allowClear\n />\n </div>\n );\n }\n if (resolvedStyle === 'combobox') {\n return (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n {heading}\n <Combobox\n options={options}\n value={value ?? ''}\n onValueChange={(next) => onChange(next === '' ? '' : next)}\n placeholder={t('booking.service.placeholder')}\n aria-label={t('booking.service.heading')}\n clearable\n />\n </div>\n );\n }\n if (resolvedStyle === 'select') {\n return (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n {heading}\n <Select\n options={options as SelectOption[]}\n value={value ?? ''}\n onValueChange={(next) => onChange(next)}\n placeholder={t('booking.service.placeholder')}\n aria-label={t('booking.service.heading')}\n />\n </div>\n );\n }\n return (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n {heading}\n <ServiceCardGroup\n services={services}\n selectedServiceId={value}\n onSelect={onChange}\n />\n </div>\n );\n}\n\ninterface OperatorStepProps {\n operators: BookingOperator[];\n value?: string;\n valueIds?: string[];\n onChange: (next: string) => void;\n onChangeIds?: (next: string[]) => void;\n pickerStyle?: 'select' | 'combobox' | 'multi-select';\n}\n\nfunction OperatorStep({\n operators,\n value,\n valueIds,\n onChange,\n onChangeIds,\n pickerStyle = 'select',\n}: OperatorStepProps) {\n const { t } = useTranslation();\n const heading = (\n <h3 className=\"type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0\">\n {t('booking.operator.heading')}\n </h3>\n );\n // Multi-select drops the \"all\" sentinel — selecting zero operators\n // (an empty array) already means \"no preference.\"\n if (pickerStyle === 'multi-select' && onChangeIds) {\n const options: OptionShape[] = operators.map((op) => ({\n value: op.id,\n label: op.name,\n }));\n return (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n {heading}\n <MultiSelect\n options={options}\n value={valueIds ?? []}\n onChange={onChangeIds}\n placeholder={t('booking.operator.placeholder')}\n aria-label={t('booking.operator.heading')}\n allowClear\n />\n </div>\n );\n }\n // \"All operators\" is always the first option — matches the legacy\n // `OPERATORS_ALL` sentinel from the booking-website state hook.\n const options: OptionShape[] = [\n { value: OPERATORS_ALL, label: t('booking.operator.all') },\n ...operators.map((op) => ({ value: op.id, label: op.name })),\n ];\n if (pickerStyle === 'combobox') {\n return (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n {heading}\n <Combobox\n options={options}\n value={value ?? OPERATORS_ALL}\n onValueChange={(next) => onChange(next === '' ? OPERATORS_ALL : next)}\n placeholder={t('booking.operator.placeholder')}\n aria-label={t('booking.operator.heading')}\n clearable\n />\n </div>\n );\n }\n return (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n {heading}\n <Select\n options={options as SelectOption[]}\n value={value ?? OPERATORS_ALL}\n onValueChange={(next) => onChange(next)}\n placeholder={t('booking.operator.placeholder')}\n aria-label={t('booking.operator.heading')}\n />\n </div>\n );\n}\n\ninterface OnboardingIncompleteAlertProps {\n customSlot?: ReactNode;\n}\n\nfunction OnboardingIncompleteAlert({\n customSlot,\n}: OnboardingIncompleteAlertProps) {\n const { t } = useTranslation();\n if (customSlot) return <>{customSlot}</>;\n // Use Alert.Title with `as=\"h4\"` so the heading-order stays valid\n // inside the booking section (which has h2 panel + h3 step headers).\n // The default h5 would skip the h4 level and trip\n // `heading-order` in axe.\n return (\n <Alert variant=\"warning\">\n <Alert.Title as=\"h4\">\n {t('booking.onboardingIncomplete.title')}\n </Alert.Title>\n <Alert.Description>\n {t('booking.onboardingIncomplete.description')}\n </Alert.Description>\n </Alert>\n );\n}\n\ninterface NextAvailableCtaProps {\n nextAvailableDate: string;\n onJump: () => void;\n locale: string;\n}\n\nfunction NextAvailableCta({\n nextAvailableDate,\n onJump,\n locale,\n}: NextAvailableCtaProps) {\n const { t } = useTranslation();\n const formatted = useMemo(() => {\n try {\n return new Intl.DateTimeFormat(locale, { dateStyle: 'long' }).format(\n parseISO(nextAvailableDate),\n );\n } catch {\n return nextAvailableDate;\n }\n }, [nextAvailableDate, locale]);\n return (\n <Alert variant=\"info\">\n <Alert.Description>\n {t('booking.nextAvailable.description', { date: formatted })}\n </Alert.Description>\n <Alert.Action>\n <Button intent=\"secondary\" size=\"sm\" onClick={onJump}>\n {t('booking.nextAvailable.cta')}\n </Button>\n </Alert.Action>\n </Alert>\n );\n}\n\ninterface BookingSuccessProps {\n snapshot: {\n slot: BookingSlot;\n details: BookingDetails;\n insuranceType?: InsuranceType;\n operatorId?: string;\n specialtyId?: string;\n serviceId?: string;\n date?: string;\n };\n operators: BookingOperator[];\n specialties: BookingSpecialty[];\n services: BookingService[];\n locale: string;\n mode: 'live' | 'demo';\n showModify: boolean;\n onReset: () => void;\n onModify: () => void;\n}\n\nfunction BookingSuccess({\n snapshot,\n operators,\n specialties,\n services,\n locale,\n mode,\n showModify,\n onReset,\n onModify,\n}: BookingSuccessProps) {\n const { t } = useTranslation();\n const channels = snapshot.details.confirmationChannels ?? ['email'];\n\n const channelLabels = channels.map((c) =>\n t(`booking.confirmation.channel.${c}`),\n );\n // In demo mode, override the channel-aware description with the\n // honest \"this was a demo\" copy — consumers running in mock mode\n // (no real API call) shouldn't tell the patient an email was sent.\n const description =\n mode === 'demo'\n ? t('booking.success.descriptionDemo')\n : channelLabels.length > 1\n ? t('booking.success.descriptionMultiple', {\n channels: channelLabels.join(' · '),\n })\n : t('booking.success.descriptionSingle', { channel: channelLabels[0] });\n\n const formattedDate = useMemo(() => {\n if (!snapshot.date) return undefined;\n try {\n return new Intl.DateTimeFormat(locale, {\n weekday: 'long',\n day: 'numeric',\n month: 'long',\n }).format(parseISO(snapshot.date));\n } catch {\n return snapshot.date;\n }\n }, [snapshot.date, locale]);\n\n const operator = snapshot.operatorId\n ? operators.find((op) => op.id === snapshot.operatorId)\n : undefined;\n const specialty = snapshot.specialtyId\n ? specialties.find((s) => s.id === snapshot.specialtyId)\n : undefined;\n const service = snapshot.serviceId\n ? services.find((s) => s.id === snapshot.serviceId)\n : undefined;\n\n return (\n <div\n data-component=\"booking-success\"\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\"\n >\n <Alert variant=\"success\">\n <Alert.Title as=\"h3\">{t('booking.success.heading')}</Alert.Title>\n <Alert.Description>{description}</Alert.Description>\n </Alert>\n\n <div className=\"ds:rounded-[var(--radius-md)] ds:bg-[var(--secondary)] ds:p-[var(--spacing-md)]\">\n <dl className=\"ds:grid ds:grid-cols-[auto_minmax(0,1fr)] ds:gap-x-[var(--spacing-md)] ds:gap-y-[var(--spacing-xs)] ds:m-0\">\n {specialty ? (\n <>\n <dt className=\"type-label ds:text-[var(--muted-foreground)]\">\n {t('booking.success.summarySpecialty')}\n </dt>\n <dd className=\"type-body ds:m-0 ds:text-[var(--foreground)]\">\n {specialty.label}\n </dd>\n </>\n ) : null}\n {service ? (\n <>\n <dt className=\"type-label ds:text-[var(--muted-foreground)]\">\n {t('booking.success.summaryService')}\n </dt>\n <dd className=\"type-body ds:m-0 ds:text-[var(--foreground)]\">\n {service.label}\n </dd>\n </>\n ) : null}\n {formattedDate ? (\n <>\n <dt className=\"type-label ds:text-[var(--muted-foreground)]\">\n {t('booking.success.summaryDate')}\n </dt>\n <dd className=\"type-body ds:m-0 ds:text-[var(--foreground)]\">\n {formattedDate}\n </dd>\n </>\n ) : null}\n <dt className=\"type-label ds:text-[var(--muted-foreground)]\">\n {t('booking.success.summaryTime')}\n </dt>\n <dd className=\"type-body ds:m-0 ds:text-[var(--foreground)]\">\n {snapshot.slot.time}\n </dd>\n {operator ? (\n <>\n <dt className=\"type-label ds:text-[var(--muted-foreground)]\">\n {t('booking.success.summaryProvider')}\n </dt>\n <dd className=\"type-body ds:m-0 ds:text-[var(--foreground)]\">\n {operator.name}\n </dd>\n </>\n ) : null}\n </dl>\n </div>\n\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]\">\n <Button intent=\"secondary\" size=\"md\" onClick={onReset}>\n {t('booking.success.bookAnother')}\n </Button>\n {showModify ? (\n <Button intent=\"ghost\" size=\"md\" onClick={onModify}>\n {t('booking.success.modifyBooking')}\n </Button>\n ) : null}\n </div>\n </div>\n );\n}\n\ninterface EmptyServicesProps {\n customSlot?: ReactNode;\n}\n\nfunction EmptyServicesAlert({ customSlot }: EmptyServicesProps) {\n const { t } = useTranslation();\n if (customSlot) return <>{customSlot}</>;\n return (\n <EmptyState\n variant=\"no-results\"\n title={t('booking.emptyServices.title')}\n description={t('booking.emptyServices.description')}\n />\n );\n}\n\n/* -------------------------------------------------------------------- */\n/* StepRegion — the focus anchor for one cascade step. */\n/* */\n/* Every variant body wraps each step it renders in one of these, and */\n/* flags exactly one as `active`. The root's focus effect looks for that */\n/* single `[data-booking-step-active]` node, so focus management is one */\n/* query rather than five variant-specific DOM walks. */\n/* */\n/* `tabIndex={-1}` makes it a programmatic focus target without adding a */\n/* Tab stop. It carries deliberately NO role and NO aria-label: every */\n/* step already contains a labelled control or heading of its own, and a */\n/* second copy of that name on the wrapper both doubles the announcement */\n/* and puts two nodes with the same accessible name in the tree. What */\n/* the patient hears on landing is the root's polite live region — */\n/* \"Step 3 of 7: Service\" — followed by the step's own content. */\n/* -------------------------------------------------------------------- */\n\n/** Marks the step the cursor is on — the focus effect's only selector. */\nconst ACTIVE_STEP_ATTR = 'data-booking-step-active';\nconst ACTIVE_STEP_SELECTOR = `[${ACTIVE_STEP_ATTR}]`;\n\ninterface StepRegionProps {\n step: CascadeStep;\n active: boolean;\n className?: string;\n /** Set when a disclosure control points at this region via `aria-controls`. */\n id?: string;\n children: ReactNode;\n}\n\n/**\n * `:focus-visible` matches a programmatic focus when the patient was already\n * driving by keyboard, so without an explicit ring the browser draws its own\n * default outline around the whole panel — a different shape and colour in\n * each of the four themes. Paint the kit's ring instead: it also makes the\n * repaired focus visible, which is the point of moving it.\n */\nconst stepRegionFocusClasses = [\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)]',\n 'ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-[var(--ring)]',\n 'ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:forced-colors:focus-visible:outline-[CanvasText]',\n].join(' ');\n\nfunction StepRegion({\n step,\n active,\n className,\n id,\n children,\n}: StepRegionProps) {\n return (\n <div\n id={id}\n data-booking-step={String(step)}\n {...(active ? { [ACTIVE_STEP_ATTR]: '' } : null)}\n tabIndex={-1}\n className={\n className\n ? `${className} ${stepRegionFocusClasses}`\n : stepRegionFocusClasses\n }\n >\n {children}\n </div>\n );\n}\n\n/* -------------------------------------------------------------------- */\n/* Ladder folding */\n/* */\n/* four-day-grid sets `value.date` AND `value.slotKey` atomically from */\n/* one tile click, so step 6 (slot) renders nothing of its own. The */\n/* variants that visibly enumerate the cascade — accordion, progress — */\n/* drop it from their ladder, and the root's step announcement has to */\n/* count the same ladder or it reports \"step 6 of 7\" against a 6-rung */\n/* list. */\n/* -------------------------------------------------------------------- */\n\nfunction foldLadder(\n visibleSteps: CascadeStep[],\n datePickerStyle: VariantBodyProps['datePickerStyle'],\n): CascadeStep[] {\n return datePickerStyle === 'four-day-grid'\n ? visibleSteps.filter((s) => s !== 6)\n : visibleSteps;\n}\n\n/* -------------------------------------------------------------------- */\n/* Variant body shared props */\n/* -------------------------------------------------------------------- */\n\ninterface VariantBodyProps {\n cascade: CascadeOutputs;\n inputs: {\n specialties: BookingSpecialty[];\n services: BookingService[];\n operators: BookingOperator[];\n availableDates: string[];\n availableSlots: Record<string, BookingSlot[]>;\n nextAvailableDate?: string;\n };\n value: BookingValue;\n onChange: (next: BookingValue) => void;\n onSubmit: (details: BookingDetails) => void | Promise<void>;\n policy: {\n country?: string;\n lockedOperatorId?: string;\n };\n detailsProps: Omit<\n React.ComponentProps<typeof BookingDetailsForm>,\n 'value' | 'onChange' | 'onSubmit' | 'summarySlot' | 'defaultPhoneCountry'\n >;\n emptyServicesSlot?: ReactNode;\n onboardingIncompleteSlot?: ReactNode;\n loadingDates?: boolean;\n loadingSlots?: boolean;\n onDateSelect?: (iso: string) => void;\n onWindowChange?: (startIso: string, endIso: string) => void;\n datePickerStyle: 'month-calendar' | 'four-day-grid';\n specialtyPickerStyle?: 'select' | 'combobox' | 'multi-select';\n servicePickerStyle?: 'select' | 'combobox' | 'multi-select' | 'cards';\n operatorPickerStyle?: 'select' | 'combobox' | 'multi-select';\n submitting?: boolean;\n locale: string;\n activeStep: CascadeStep;\n setActiveStep: (step: CascadeStep) => void;\n /** Booking's own `id`. Nested agent-registering primitives derive theirs from it. */\n agentIdBase?: string;\n}\n\n/* -------------------------------------------------------------------- */\n/* InlineListBody */\n/* -------------------------------------------------------------------- */\n\nfunction InlineListBody(props: VariantBodyProps) {\n const {\n cascade,\n inputs,\n value,\n onChange,\n onSubmit,\n emptyServicesSlot,\n onboardingIncompleteSlot,\n loadingDates,\n loadingSlots,\n onDateSelect,\n onWindowChange,\n datePickerStyle,\n specialtyPickerStyle,\n servicePickerStyle,\n operatorPickerStyle,\n submitting,\n locale,\n detailsProps,\n agentIdBase,\n activeStep,\n } = props;\n const { t } = useTranslation();\n // inline-list paints every gated step at once, so \"active\" here means\n // \"the step the cursor is on\" — the one the focus effect lands in. Fold\n // the cursor first: four-day-grid renders no separate slot block, so a\n // step-6 cursor belongs on the date region or nothing would be marked.\n const cursorStep = foldCursorStep(activeStep, datePickerStyle);\n const region = (step: CascadeStep, className?: string) => ({\n step,\n active: step === cursorStep,\n className,\n });\n\n return (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n {cascade.gates.insurance ? (\n <StepRegion {...region(1)}>\n <InsuranceStep\n value={value.insuranceType}\n onChange={(next) => onChange(resetOnInsuranceChange(value, next))}\n />\n </StepRegion>\n ) : null}\n\n {cascade.gates.specialty ? (\n <StepRegion {...region(2)}>\n <SpecialtyStep\n specialties={cascade.filtered.specialties}\n value={value.specialtyId}\n valueIds={value.specialtyIds}\n onChange={(next) => onChange(resetOnSpecialtyChange(value, next))}\n onChangeIds={(next) =>\n onChange(resetOnSpecialtyIdsChange(value, next))\n }\n pickerStyle={specialtyPickerStyle}\n />\n </StepRegion>\n ) : null}\n\n {cascade.gates.service ? (\n <StepRegion {...region(3)}>\n {cascade.filtered.services.length === 0 ? (\n <EmptyServicesAlert customSlot={emptyServicesSlot} />\n ) : (\n <ServiceStep\n services={cascade.filtered.services}\n value={value.serviceId}\n valueIds={value.serviceIds}\n onChange={(next) => onChange(resetOnServiceChange(value, next))}\n onChangeIds={(next) =>\n onChange(resetOnServiceIdsChange(value, next))\n }\n pickerStyle={servicePickerStyle}\n />\n )}\n </StepRegion>\n ) : null}\n\n {cascade.gates.onboardingIncomplete ? (\n <OnboardingIncompleteAlert customSlot={onboardingIncompleteSlot} />\n ) : null}\n\n {cascade.gates.operator ? (\n <StepRegion {...region(4)}>\n <OperatorStep\n operators={cascade.filtered.operators}\n value={value.operatorId}\n valueIds={value.operatorIds}\n onChange={(next) => onChange(resetOnOperatorChange(value, next))}\n onChangeIds={(next) =>\n onChange(resetOnOperatorIdsChange(value, next))\n }\n pickerStyle={operatorPickerStyle}\n />\n </StepRegion>\n ) : null}\n\n {cascade.gates.date ? (\n <StepRegion\n {...region(5, 'ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]')}\n >\n <h3 className=\"type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0\">\n {t('booking.date.heading')}\n </h3>\n {inputs.availableDates.length === 0 && inputs.nextAvailableDate ? (\n <NextAvailableCta\n nextAvailableDate={inputs.nextAvailableDate}\n onJump={() =>\n onChange(resetOnDateChange(value, inputs.nextAvailableDate))\n }\n locale={locale}\n />\n ) : (\n renderDateStep({\n inputs,\n value,\n onChange,\n onDateSelect,\n onWindowChange,\n loadingDates,\n loadingSlots,\n locale,\n datePickerStyle,\n agentIdBase,\n })\n )}\n </StepRegion>\n ) : null}\n\n {cascade.gates.slot &&\n value.date &&\n datePickerStyle === 'month-calendar' ? (\n <StepRegion\n {...region(6, 'ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]')}\n >\n <h3 className=\"type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0\">\n {t('booking.slot.heading')}\n </h3>\n {renderSlotStep({\n inputs,\n value,\n onChange,\n onDateSelect,\n onWindowChange,\n loadingDates,\n loadingSlots,\n locale,\n datePickerStyle,\n })}\n </StepRegion>\n ) : null}\n\n {cascade.gates.details && cascade.selectedSlot ? (\n <StepRegion {...region(7)}>\n <BookingDetailsForm\n {...detailsProps}\n value={value.details ?? {}}\n onChange={(next) => onChange({ ...value, details: next })}\n onSubmit={onSubmit}\n submitting={submitting}\n defaultPhoneCountry={props.policy.country}\n />\n </StepRegion>\n ) : null}\n </div>\n );\n}\n\n/* -------------------------------------------------------------------- */\n/* getStepNode — render a single cascade step's content. */\n/* */\n/* Shared by all variants so the cascade renders the same content; */\n/* variants just choose how to chrome / sequence it. */\n/* -------------------------------------------------------------------- */\n\ninterface GetStepNodeOptions {\n /** When true, ServiceStep renders as a compact Select (used by all\n * variants except inline-list, which gets the full ServiceCardGroup). */\n compactService?: boolean;\n}\n\nfunction getStepNode(\n step: CascadeStep,\n props: VariantBodyProps,\n options: GetStepNodeOptions = {},\n): ReactNode {\n const {\n cascade,\n inputs,\n value,\n onChange,\n onSubmit,\n emptyServicesSlot,\n onboardingIncompleteSlot,\n loadingDates,\n loadingSlots,\n onDateSelect,\n onWindowChange,\n datePickerStyle,\n specialtyPickerStyle,\n servicePickerStyle,\n operatorPickerStyle,\n submitting,\n locale,\n detailsProps,\n policy,\n agentIdBase,\n } = props;\n\n switch (step) {\n case 1:\n return (\n <InsuranceStep\n value={value.insuranceType}\n onChange={(next) => onChange(resetOnInsuranceChange(value, next))}\n />\n );\n case 2:\n return (\n <SpecialtyStep\n specialties={cascade.filtered.specialties}\n value={value.specialtyId}\n valueIds={value.specialtyIds}\n onChange={(next) => onChange(resetOnSpecialtyChange(value, next))}\n onChangeIds={(next) =>\n onChange(resetOnSpecialtyIdsChange(value, next))\n }\n pickerStyle={specialtyPickerStyle}\n />\n );\n case 3:\n if (cascade.filtered.services.length === 0) {\n return <EmptyServicesAlert customSlot={emptyServicesSlot} />;\n }\n if (cascade.gates.onboardingIncomplete) {\n return (\n <OnboardingIncompleteAlert customSlot={onboardingIncompleteSlot} />\n );\n }\n return (\n <ServiceStep\n services={cascade.filtered.services}\n value={value.serviceId}\n valueIds={value.serviceIds}\n onChange={(next) => onChange(resetOnServiceChange(value, next))}\n onChangeIds={(next) => onChange(resetOnServiceIdsChange(value, next))}\n pickerStyle={servicePickerStyle}\n compact={options.compactService}\n />\n );\n case 4:\n return (\n <OperatorStep\n operators={cascade.filtered.operators}\n value={value.operatorId}\n valueIds={value.operatorIds}\n onChange={(next) => onChange(resetOnOperatorChange(value, next))}\n onChangeIds={(next) =>\n onChange(resetOnOperatorIdsChange(value, next))\n }\n pickerStyle={operatorPickerStyle}\n />\n );\n case 5:\n if (inputs.availableDates.length === 0 && inputs.nextAvailableDate) {\n return (\n <NextAvailableCta\n nextAvailableDate={inputs.nextAvailableDate}\n onJump={() =>\n onChange(resetOnDateChange(value, inputs.nextAvailableDate))\n }\n locale={locale}\n />\n );\n }\n return renderDateStep({\n inputs,\n value,\n onChange,\n onDateSelect,\n onWindowChange,\n loadingDates,\n loadingSlots,\n locale,\n datePickerStyle,\n agentIdBase,\n });\n case 6:\n return renderSlotStep({\n inputs,\n value,\n onChange,\n onDateSelect,\n onWindowChange,\n loadingDates,\n loadingSlots,\n locale,\n datePickerStyle,\n });\n case 7:\n if (!cascade.selectedSlot) return null;\n return (\n <BookingDetailsForm\n {...detailsProps}\n value={value.details ?? {}}\n onChange={(next) => onChange({ ...value, details: next })}\n onSubmit={onSubmit}\n submitting={submitting}\n defaultPhoneCountry={policy.country}\n />\n );\n /* c8 ignore next 2 */\n default:\n return null;\n }\n}\n\n/* -------------------------------------------------------------------- */\n/* getStepLabel — i18n label per cascade step. */\n/* -------------------------------------------------------------------- */\n\nfunction useStepLabels(): Record<CascadeStep, string> {\n const { t } = useTranslation();\n return useMemo(\n () => ({\n 1: t('booking.insurance.heading'),\n 2: t('booking.specialty.heading'),\n 3: t('booking.service.heading'),\n 4: t('booking.operator.heading'),\n 5: t('booking.date.heading'),\n 6: t('booking.slot.heading'),\n 7: t('booking.details.heading'),\n }),\n [t],\n );\n}\n\n/* -------------------------------------------------------------------- */\n/* AccordionBody — StepperAccordion-backed flow with per-step summaries. */\n/* -------------------------------------------------------------------- */\n\n/**\n * four-day-grid folds step 6 into step 5 — the slot tiles live inside the\n * date picker — so a step-6 cursor belongs on the date panel. Both ladder\n * variants drop step 6 from their step list and must fold the cursor to\n * match, or `indexOf` misses and the ladder snaps to its first step.\n */\nfunction foldCursorStep(\n step: CascadeStep,\n datePickerStyle: VariantBodyProps['datePickerStyle'],\n): CascadeStep {\n return datePickerStyle === 'four-day-grid' && step === 6 ? 5 : step;\n}\n\nfunction AccordionBody(props: VariantBodyProps) {\n const { cascade, value, activeStep, setActiveStep, datePickerStyle } = props;\n const labels = useStepLabels();\n const { t } = useTranslation();\n const allOperatorsLabel = t('booking.operator.all');\n\n // four-day-grid embeds slot tiles inside the date step's picker —\n // step 6 (slot) renders nothing of its own. Drop it from the\n // accordion ladder so the user doesn't see an empty \"Orario\"\n // panel that would just expand to whitespace.\n const visibleStepsForBody = useMemo(\n () => foldLadder(cascade.visibleSteps, datePickerStyle),\n [cascade.visibleSteps, datePickerStyle],\n );\n\n // Map the 1-indexed cascade step onto the ladder we actually rendered —\n // not `cascade.visibleSteps`, which still holds the step 6 that\n // four-day-grid drops.\n const cursorStep = foldCursorStep(activeStep, datePickerStyle);\n const activeIndex = Math.max(0, visibleStepsForBody.indexOf(cursorStep));\n\n // Compose accordion specs from the visible cascade steps. Pull a\n // localised summary off `value` for completed steps so collapsed\n // panels still convey what was picked.\n const accordionSteps = useMemo(\n () =>\n visibleStepsForBody.map((stepNum) => ({\n label: labels[stepNum],\n summary: getStepSummary(stepNum, value, cascade, allOperatorsLabel),\n status: statusForStep(stepNum, value, cascade),\n content: (\n <StepRegion step={stepNum} active={stepNum === cursorStep}>\n {getStepNode(stepNum, props, { compactService: true })}\n </StepRegion>\n ),\n })),\n [\n visibleStepsForBody,\n value,\n labels,\n cascade,\n props,\n cursorStep,\n allOperatorsLabel,\n ],\n );\n\n return (\n <StepperAccordion\n activeStep={activeIndex}\n steps={accordionSteps}\n onStepChange={(idx) => {\n const next = visibleStepsForBody[idx];\n if (next) setActiveStep(next);\n }}\n />\n );\n}\n\n/**\n * The status the ladder variants hand each step.\n *\n * `completed` is the step that holds a value and sits behind the cascade's\n * own frontier. `unlocked` is every other step the cascade has legitimately\n * *reached* — including step 7, whose fulfilment is owned by the details\n * form and which therefore never reports itself completed. Without the\n * `unlocked` rung, pressing Edit on an earlier row left every step from the\n * frontier onwards HTML-`disabled`, escapable only by changing a selection\n * (which wipes the date and slot). Steps ahead of the frontier still return\n * `undefined` and stay locked, exactly as before.\n */\nfunction statusForStep(\n step: CascadeStep,\n value: BookingValue,\n cascade: CascadeOutputs,\n): StepStatus | undefined {\n if (stepIsFulfilled(step, value) && step < cascade.currentStep) {\n return 'completed';\n }\n return step <= cascade.currentStep ? 'unlocked' : undefined;\n}\n\n// Reads the array form first, exactly as the cascade's own `deriveStep`\n// does — a step picked through a `multi-select` picker is fulfilled too.\n// Reading only the single form marked those steps unfulfilled, which locks\n// them in the accordion and permanently disables Next in the wizard.\nfunction stepIsFulfilled(step: CascadeStep, value: BookingValue): boolean {\n switch (step) {\n case 1:\n return value.insuranceType !== undefined;\n case 2:\n return resolveSpecialtyIds(value).length > 0;\n case 3:\n return resolveServiceIds(value).length > 0;\n case 4:\n return resolveOperatorIds(value).length > 0;\n case 5:\n return value.date !== undefined;\n case 6:\n return value.slotKey !== undefined;\n case 7:\n return false;\n }\n}\n\n/** Labels of the picked entries — multi-select steps can hold several. */\nfunction pickedLabels(\n ids: string[],\n items: { id: string; label: string }[],\n): string | undefined {\n const labels = ids\n .map((id) => items.find((item) => item.id === id)?.label)\n .filter((label): label is string => label !== undefined);\n return labels.length > 0 ? labels.join(', ') : undefined;\n}\n\nfunction getStepSummary(\n step: CascadeStep,\n value: BookingValue,\n cascade: CascadeOutputs,\n /** Translated `booking.operator.all` — summarises the `'all'` sentinel. */\n allOperatorsLabel: string,\n): ReactNode {\n if (!stepIsFulfilled(step, value)) return undefined;\n switch (step) {\n case 1:\n return value.insuranceType;\n case 2:\n return pickedLabels(\n resolveSpecialtyIds(value),\n cascade.filtered.specialties,\n );\n case 3:\n return pickedLabels(resolveServiceIds(value), cascade.filtered.services);\n case 4: {\n const raw = resolveOperatorIds(value);\n const ids = raw.filter((id) => id !== OPERATORS_ALL);\n const named = pickedLabels(\n ids,\n cascade.filtered.operators.map((op) => ({\n id: op.id,\n label: op.name,\n })),\n );\n if (named !== undefined) return named;\n // The `'all'` sentinel means \"no preference\". Resolving it to\n // `undefined` suppressed the chip entirely in the calendar variant,\n // so the step vanished from the rail even though it was answered —\n // say \"Any available provider\" instead.\n return raw.includes(OPERATORS_ALL) ? allOperatorsLabel : undefined;\n }\n case 5:\n return value.date;\n case 6:\n return cascade.selectedSlot?.time;\n case 7:\n return undefined;\n }\n}\n\n/* -------------------------------------------------------------------- */\n/* CalendarBody — chip rail of completed selections + calendar dominant. */\n/* -------------------------------------------------------------------- */\n\nfunction CalendarBody(props: VariantBodyProps) {\n const { cascade, value, activeStep, setActiveStep } = props;\n const { t } = useTranslation();\n const labels = useStepLabels();\n const allOperatorsLabel = t('booking.operator.all');\n const panelId = `${useId()}-filter`;\n const cursorStep = foldCursorStep(activeStep, props.datePickerStyle);\n\n // Filters that come before the calendar (insurance/specialty/service/operator).\n const filterSteps = cascade.visibleSteps.filter(\n (s) => s === 1 || s === 2 || s === 3 || s === 4,\n );\n const hasUnfulfilledFilter = filterSteps.some(\n (s) => !stepIsFulfilled(s, value),\n );\n\n // Which filter is open. The rail's chips write `activeStep` — reading it\n // back here is what makes them controls rather than decoration. When the\n // cursor is past the filters (or on a step the rail doesn't own) fall\n // back to the first filter still missing an answer, which is the\n // behaviour the variant has always had.\n //\n // This is also what makes step 4 reachable at all: the `OPERATORS_ALL`\n // sentinel pre-fulfils the provider step, so it is never the \"first\n // unfulfilled filter\" and the old first-unfulfilled-only rule meant the\n // picker could not be rendered by any sequence of user actions — in\n // contradiction with the documented cascade, which gates step 4 on\n // `allowOperatorSelection` + a service + >1 eligible operator and carves\n // out no variant.\n const expandedFilter: CascadeStep | undefined = filterSteps.some(\n (s) => s === activeStep,\n )\n ? activeStep\n : filterSteps.find((s) => !stepIsFulfilled(s, value));\n\n return (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n {filterSteps.length > 0 ? (\n <div\n role=\"group\"\n aria-label={t('booking.filtersLabel')}\n className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]\"\n >\n {filterSteps.map((s) => {\n const summary = getStepSummary(\n s,\n value,\n cascade,\n allOperatorsLabel,\n );\n const isExpanded = s === expandedFilter;\n // A filter that already holds an answer is a true disclosure —\n // it can be closed again by handing the cursor back to the\n // cascade's own frontier. The one the cascade is still waiting\n // on is not: closing it would hide the only thing the patient\n // can usefully do next, so it is marked as the current step\n // rather than claiming a toggle it cannot honour.\n const collapsible = stepIsFulfilled(s, value);\n return (\n <Button\n key={`csc-${s}`}\n // `tonal` falls back to the primary palette outside a\n // tint-painting container, so an expanded `primary` chip\n // and a collapsed `tonal` one were pixel-identical at rest\n // — the rail read as N identical CTAs with no cue as to\n // which one had opened the panel. `outline` gives the\n // collapsed chips their own resting treatment, and the\n // chevron carries the state without relying on colour.\n intent={isExpanded ? 'primary' : 'outline'}\n size=\"sm\"\n endIcon={\n <ChevronDown\n aria-hidden=\"true\"\n className={isExpanded ? 'ds:rotate-180' : undefined}\n />\n }\n aria-expanded={collapsible ? isExpanded : undefined}\n aria-controls={collapsible && isExpanded ? panelId : undefined}\n aria-current={!collapsible && isExpanded ? 'step' : undefined}\n onClick={() =>\n setActiveStep(\n collapsible && isExpanded ? cascade.currentStep : s,\n )\n }\n >\n {/* Rendered as children rather than a concatenated string\n so the browser resolves the bidi run itself — a\n JS-built \"label: value\" puts the colon on the wrong\n side under `dir=\"rtl\"`. */}\n {summary ? (\n <>\n {labels[s]}: {summary}\n </>\n ) : (\n labels[s]\n )}\n </Button>\n );\n })}\n </div>\n ) : null}\n\n {expandedFilter !== undefined ? (\n <StepRegion\n step={expandedFilter}\n active={expandedFilter === cursorStep}\n id={panelId}\n >\n {getStepNode(expandedFilter, props, { compactService: true })}\n </StepRegion>\n ) : null}\n\n {!hasUnfulfilledFilter && cascade.gates.date ? (\n // four-day-grid embeds slots inline with the day strip — the\n // historic 2-col date|slot split collapses to a single column\n // so the picker spans the full width instead of orphaning an\n // empty right cell.\n props.datePickerStyle === 'four-day-grid' ? (\n <StepRegion step={5} active={cursorStep === 5}>\n {getStepNode(5, props)}\n </StepRegion>\n ) : (\n <div className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:md:grid-cols-2\">\n <StepRegion\n step={5}\n active={cursorStep === 5}\n className=\"ds:min-w-0\"\n >\n {getStepNode(5, props)}\n </StepRegion>\n {value.date ? (\n <StepRegion\n step={6}\n active={cursorStep === 6}\n className=\"ds:min-w-0\"\n >\n {getStepNode(6, props)}\n </StepRegion>\n ) : (\n <div className=\"ds:min-w-0\" />\n )}\n </div>\n )\n ) : null}\n\n {cascade.gates.details ? (\n <StepRegion step={7} active={cursorStep === 7}>\n {getStepNode(7, props)}\n </StepRegion>\n ) : null}\n </div>\n );\n}\n\n/* -------------------------------------------------------------------- */\n/* FlexibleBody — 2-col desktop (filters L, calendar+slots R), inline */\n/* below md. */\n/* -------------------------------------------------------------------- */\n\nfunction FlexibleBody(props: VariantBodyProps) {\n const { cascade, datePickerStyle, activeStep } = props;\n const cursorStep = foldCursorStep(activeStep, datePickerStyle);\n\n const filterStepNumbers = cascade.visibleSteps.filter(\n (s) => s === 1 || s === 2 || s === 3 || s === 4,\n );\n\n // 0.33.12: four-day-grid renders 4 day columns + ±arrows. The\n // historic 2-col split (filters left, picker right) crushes\n // that 4-column strip into ~half the widget width — slot tiles\n // truncate, day headers become unreadable. Stack to single\n // column when four-day-grid so the picker gets the full width.\n // (The calendar variant already does this in 0.33.10.)\n const stackedLayout = datePickerStyle === 'four-day-grid';\n\n return (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n <div\n className={\n stackedLayout\n ? 'ds:flex ds:flex-col ds:gap-[var(--spacing-md)]'\n : 'ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:md:grid-cols-2'\n }\n >\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n {filterStepNumbers.map((s) => (\n <StepRegion key={`fbf-${s}`} step={s} active={s === cursorStep}>\n {getStepNode(s, props, { compactService: true })}\n </StepRegion>\n ))}\n </div>\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n {cascade.gates.date ? (\n <StepRegion step={5} active={cursorStep === 5}>\n {getStepNode(5, props)}\n </StepRegion>\n ) : null}\n {cascade.gates.slot &&\n props.value.date &&\n datePickerStyle === 'month-calendar' ? (\n <StepRegion step={6} active={cursorStep === 6}>\n {getStepNode(6, props)}\n </StepRegion>\n ) : null}\n </div>\n </div>\n {cascade.gates.details ? (\n <StepRegion step={7} active={cursorStep === 7}>\n {getStepNode(7, props)}\n </StepRegion>\n ) : null}\n </div>\n );\n}\n\n/* -------------------------------------------------------------------- */\n/* ProgressBody — wizard with stepper + one step on screen + Back/Next. */\n/* -------------------------------------------------------------------- */\n\nfunction ProgressBody(props: VariantBodyProps) {\n const { cascade, value, activeStep, setActiveStep, datePickerStyle } = props;\n const { t } = useTranslation();\n const labels = useStepLabels();\n\n // four-day-grid sets both value.date and value.slotKey atomically\n // when the user picks a tile, so step 6 (slot) has nothing of its\n // own to render. Drop it from the wizard ladder so the user\n // doesn't land on an empty page mid-flow.\n const visibleSteps = useMemo(\n () => foldLadder(cascade.visibleSteps, datePickerStyle),\n [cascade.visibleSteps, datePickerStyle],\n );\n const cursorStep = foldCursorStep(activeStep, datePickerStyle);\n const activeIndex = Math.max(0, visibleSteps.indexOf(cursorStep));\n const totalSteps = visibleSteps.length;\n\n const stepSpecs = useMemo(\n () => visibleSteps.map((s) => ({ label: labels[s] })),\n [visibleSteps, labels],\n );\n\n const canGoBack = activeIndex > 0;\n // Forward navigation is gated by the cascade — can only advance when the\n // active step is fulfilled.\n //\n // Folding the cursor changes what that asks: under four-day-grid a step-6\n // cursor reads as 5, so \"is the date set?\" would stand in for \"is the SLOT\n // set?\". FourDayPicker sets both atomically, so a user-driven flow cannot\n // reach date-without-slot — but a consumer hydrating a saved draft or a\n // deep link can, and Next would then land the wizard on step 7, which\n // renders nothing without a slot and whose only exit is Back.\n const nextNeedsSlot = cursorStep === 5 && datePickerStyle === 'four-day-grid';\n const canGoNext =\n activeIndex < totalSteps - 1 &&\n stepIsFulfilled(cursorStep, value) &&\n (!nextNeedsSlot || stepIsFulfilled(6, value));\n\n return (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n <StepperProgress activeStep={activeIndex} steps={stepSpecs} />\n <StepRegion step={cursorStep} active>\n {getStepNode(cursorStep, props, { compactService: true })}\n </StepRegion>\n <div className=\"ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]\">\n <Button\n intent=\"ghost\"\n size=\"md\"\n disabled={!canGoBack}\n onClick={() => {\n const prev = visibleSteps[activeIndex - 1];\n if (prev) setActiveStep(prev);\n }}\n >\n {t('booking.actions.back')}\n </Button>\n {cursorStep < 7 ? (\n <Button\n intent=\"primary\"\n size=\"md\"\n disabled={!canGoNext}\n onClick={() => {\n const next = visibleSteps[activeIndex + 1];\n if (next) setActiveStep(next);\n }}\n >\n {t('booking.actions.next')}\n </Button>\n ) : null}\n </div>\n </div>\n );\n}\n\n/* -------------------------------------------------------------------- */\n/* Root Booking component */\n/* -------------------------------------------------------------------- */\n\nconst EMPTY_SPECIALTIES: BookingSpecialty[] = [];\nconst EMPTY_OPERATORS: BookingOperator[] = [];\n\n/** Read the OS motion preference at call time — it can change mid-session. */\nfunction prefersReducedMotion(): boolean {\n return (\n typeof window !== 'undefined' &&\n typeof window.matchMedia === 'function' &&\n window.matchMedia('(prefers-reduced-motion: reduce)').matches\n );\n}\n\nexport const Booking = forwardRef<HTMLDivElement, BookingProps>(\n (\n {\n variant = 'inline-list',\n country,\n // No default — the cascade engine treats `undefined` as \"auto-on\n // when `specialties` has items\" so consumers who pass specialty\n // data without the explicit flag still get the step.\n useSpecialties,\n allowOperatorSelection = false,\n lockedOperatorId,\n autoSelectSingleService = false,\n specialties: specialtiesProp,\n services,\n operators: operatorsProp,\n availableDates,\n availableSlots,\n nextAvailableDate,\n requireCodiceFiscale,\n requireDateOfBirth,\n requireInsuranceNumber,\n showNote,\n showReturningPatientFlag,\n privacyPolicyUrl,\n termsUrl,\n validateCodiceFiscale,\n validateInsuranceNumber,\n confirmationChannels,\n defaultConfirmationChannels,\n value,\n onChange,\n onSubmit,\n onStepChange,\n onDateSelect,\n onWindowChange,\n datePickerStyle = 'month-calendar',\n specialtyPickerStyle,\n servicePickerStyle,\n operatorPickerStyle,\n loadingDates,\n loadingSlots,\n submitting,\n submitError,\n mode = 'live',\n showModifyOnSuccess = true,\n surface = 'flat',\n emptyServicesSlot,\n onboardingIncompleteSlot,\n 'aria-label': ariaLabel,\n id,\n className,\n onFocus: onFocusProp,\n ...rest\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n const resolvedVariant = (variant ?? 'inline-list') as BookingVariant;\n const locale = i18n.language ?? 'en';\n\n const specialties = specialtiesProp ?? EMPTY_SPECIALTIES;\n const operators = operatorsProp ?? EMPTY_OPERATORS;\n\n // Auto-pre-select on mount + whenever the inputs that drive them\n // arrive (e.g. when `specialties` populates from an async fetch).\n useEffect(() => {\n const next = applyAutoSelects(value, {\n country,\n useSpecialties,\n allowOperatorSelection,\n lockedOperatorId,\n autoSelectSingleService,\n specialties,\n services,\n });\n // Shallow compare the keys we might have changed.\n if (\n next.specialtyId !== value.specialtyId ||\n next.operatorId !== value.operatorId ||\n next.serviceId !== value.serviceId\n ) {\n onChange(next);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n lockedOperatorId,\n useSpecialties,\n autoSelectSingleService,\n specialties,\n services,\n ]);\n\n const cascade = useMemo(\n () =>\n deriveCascade({\n country,\n useSpecialties,\n allowOperatorSelection,\n lockedOperatorId,\n autoSelectSingleService,\n specialties,\n services,\n operators,\n availableDates,\n availableSlots,\n value,\n }),\n [\n country,\n useSpecialties,\n allowOperatorSelection,\n lockedOperatorId,\n autoSelectSingleService,\n specialties,\n services,\n operators,\n availableDates,\n availableSlots,\n value,\n ],\n );\n\n // Signature of every cascade-relevant selection. `details` is\n // deliberately excluded so typing in the form never moves the cursor.\n const selectionSignature = useMemo(\n () =>\n JSON.stringify([\n value.insuranceType,\n resolveSpecialtyIds(value),\n resolveServiceIds(value),\n resolveOperatorIds(value),\n value.date,\n value.slotKey,\n ]),\n [value],\n );\n\n const [activeStep, setActiveStep] = useState<CascadeStep>(\n cascade.currentStep,\n );\n // Re-sync the cursor on any selection change — either direction, and\n // even when `currentStep` doesn't move (an operator pick: the `'all'`\n // sentinel makes step 4 fulfilled before and after). A forward-only\n // sync stranded the accordion, leaving later steps HTML-disabled.\n // Also re-sync when late-arriving data or a policy prop opens/closes a\n // gate and drops the cursor out of the ladder — the variant bodies\n // would otherwise silently clamp it to their first step.\n const lastSignatureRef = useRef(selectionSignature);\n useEffect(() => {\n const selectionChanged = selectionSignature !== lastSignatureRef.current;\n lastSignatureRef.current = selectionSignature;\n if (!selectionChanged && cascade.visibleSteps.includes(activeStep)) {\n return;\n }\n setActiveStep(cascade.currentStep);\n }, [\n selectionSignature,\n cascade.currentStep,\n cascade.visibleSteps,\n activeStep,\n ]);\n\n // Declared here rather than beside the imperative handle below: the\n // focus effect needs it, and a ref must exist before its first reader.\n const rootRef = useRef<HTMLDivElement>(null);\n\n /* ---------- Focus management + step announcement ---------- */\n\n // The ladder the user actually sees — four-day-grid folds the slot step\n // into the date picker, so counting `cascade.visibleSteps` raw would\n // announce \"step 6 of 7\" against a six-rung list.\n const ladder = useMemo(\n () => foldLadder(cascade.visibleSteps, datePickerStyle),\n [cascade.visibleSteps, datePickerStyle],\n );\n const stepLabels = useStepLabels();\n const [stepAnnouncement, setStepAnnouncement] = useState('');\n // The element inside the widget that last held focus — including inside\n // a Radix portal, which React's synthetic `focusin` still routes through\n // this subtree. The effect below repairs focus only when THAT element\n // has since left the document, which is precisely the \"the control I was\n // using was unmounted by the cursor move\" case. A boolean \"focus was in\n // here\" flag is not enough: clicking non-focusable page content blurs\n // with a null `relatedTarget`, so the flag would stay set and a later\n // consumer- or agent-driven cursor move would yank the viewport back.\n const lastFocusedRef = useRef<HTMLElement | null>(null);\n const announcedStepRef = useRef<CascadeStep | null>(null);\n\n useEffect(() => {\n const cursor = foldCursorStep(activeStep, datePickerStyle);\n // First run is mount: nothing has moved, so neither announce nor grab\n // focus — otherwise every page embedding the widget would steal it.\n if (announcedStepRef.current === null) {\n announcedStepRef.current = cursor;\n return;\n }\n if (announcedStepRef.current === cursor) return;\n announcedStepRef.current = cursor;\n\n const position = ladder.indexOf(cursor);\n setStepAnnouncement(\n position === -1\n ? ''\n : t('booking.stepAnnouncement', {\n current: position + 1,\n total: ladder.length,\n label: stepLabels[cursor],\n }),\n );\n\n // WCAG 2.4.3 — moving the cursor unmounts the control the patient just\n // used, dropping focus to <body> and restarting the tab order at the\n // top of the host page. Put focus in the step that just opened.\n //\n // Two guards keep this from hijacking anything. The element the\n // patient was last on must have LEFT THE DOCUMENT — if it is still\n // connected they either still have it or deliberately moved away, and\n // either way nothing is broken. And focus must actually be lost right\n // now, so a Radix Select restoring focus to its own trigger, or a\n // click on an accordion header, keeps the focus its primitive chose.\n const previous = lastFocusedRef.current;\n if (!previous || previous.isConnected) return;\n const root = rootRef.current;\n if (!root) return;\n const active = document.activeElement;\n const focusWasLost =\n active === null || active === document.body || !root.contains(active);\n if (!focusWasLost) return;\n // Fall back to the root so focus lands somewhere inside the widget\n // even if no step is currently flagged active (e.g. a cursor on a\n // step this variant does not paint).\n const target =\n root.querySelector<HTMLElement>(ACTIVE_STEP_SELECTOR) ?? root;\n target.focus({ preventScroll: true });\n // jsdom does not implement `scrollIntoView` at all, so a try/catch\n // round the options form would just throw again from the fallback.\n // Check for the method itself; focus has already been repaired, which\n // is the part that matters.\n if (typeof target.scrollIntoView !== 'function') return;\n try {\n target.scrollIntoView({\n behavior: prefersReducedMotion() ? 'auto' : 'smooth',\n block: 'nearest',\n });\n } catch {\n // Older browsers may implement the method but reject the options\n // form — a plain scroll is still better than nothing.\n target.scrollIntoView();\n }\n }, [activeStep, datePickerStyle, ladder, stepLabels, t]);\n\n const [submitState, setSubmitState] = useState<\n 'idle' | 'submitting' | 'success' | 'error'\n >('idle');\n const [submittedSnapshot, setSubmittedSnapshot] = useState<{\n slot: BookingSlot;\n details: BookingDetails;\n insuranceType?: InsuranceType;\n operatorId?: string;\n specialtyId?: string;\n serviceId?: string;\n date?: string;\n } | null>(null);\n\n const handleSubmit = useCallback(\n async (details: BookingDetails) => {\n if (!cascade.selectedSlot) return;\n const payload = {\n slot: cascade.selectedSlot,\n value: {\n ...value,\n details,\n operatorId: resolveOperatorId(value) ?? value.operatorId,\n },\n details,\n };\n setSubmitState('submitting');\n try {\n await onSubmit(payload);\n setSubmittedSnapshot({\n slot: cascade.selectedSlot,\n details,\n specialtyId: value.specialtyId,\n serviceId: value.serviceId,\n insuranceType: value.insuranceType,\n operatorId: resolveOperatorId(value),\n date: value.date,\n });\n setSubmitState('success');\n } catch {\n setSubmitState('error');\n // Re-throw so the consumer can observe + log. The form\n // stays mounted so the patient can retry.\n throw new Error('Booking submission failed');\n }\n },\n [cascade.selectedSlot, onSubmit, value],\n );\n\n /* ---------- Imperative handle ---------- */\n\n useImperativeHandle(ref, () => rootRef.current as HTMLDivElement, []);\n\n /* ---------- onStepChange + auto-scroll on success ---------- */\n\n // The displayed step is `8` when the success view is mounted, and\n // matches the cascade's `currentStep` otherwise. Tracked via a ref\n // so the effect only fires when the displayed step actually changes\n // (vs every time `currentStep` or `submitState` updates).\n const displayedStep: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 =\n submitState === 'success' ? 8 : cascade.currentStep;\n // Initialise to `null` so the first effect-fire (after mount) still\n // emits onStepChange with the initial step. Subsequent fires only\n // emit when the step actually changes.\n const lastDisplayedStepRef = useRef<typeof displayedStep | null>(null);\n useEffect(() => {\n if (displayedStep === lastDisplayedStepRef.current) return;\n lastDisplayedStepRef.current = displayedStep;\n onStepChange?.(displayedStep);\n // Auto-scroll the booking surface into view on the transition to\n // step 8 — the success card is much shorter than the form, so\n // without this the patient often ends up below the booking column\n // and has to scroll up to see \"Booking submitted.\" See the\n // 0.30.0-adoption follow-up notes for the failure mode.\n if (displayedStep === 8 && rootRef.current) {\n try {\n rootRef.current.scrollIntoView({\n behavior: prefersReducedMotion() ? 'auto' : 'smooth',\n block: 'start',\n });\n } catch {\n // jsdom + older browsers may not implement smooth scroll.\n // Fall back to a plain scroll — still better than nothing.\n rootRef.current.scrollIntoView();\n }\n }\n }, [displayedStep, onStepChange]);\n\n // Snapshot of everything the agent handle reads. Kept in a ref so\n // `cascade` stays out of the handle's useMemo deps — otherwise every\n // keystroke in the details form would re-register the component with\n // the host registry. (`onChange` is still a dep, so a consumer passing\n // an inline arrow re-registers on every render regardless; memoise it\n // if that matters to the host.)\n const flowRef = useRef({ activeStep, cascade, submitState });\n useEffect(() => {\n flowRef.current = { activeStep, cascade, submitState };\n }, [activeStep, cascade, submitState]);\n\n const agentHandle = useMemo<BookingHandle>(\n () => ({\n getVariant: () => resolvedVariant,\n getCurrentStep: () => {\n const flow = flowRef.current;\n // 8 is the terminal confirmation view, matching `onStepChange`.\n return flow.submitState === 'success' ? 8 : flow.activeStep;\n },\n reset: () => {\n // Clear the value to an empty state + drop any success view;\n // the consumer's onChange observes the normalised value.\n onChange({});\n setSubmittedSnapshot(null);\n setSubmitState('idle');\n setActiveStep(1);\n },\n goToStep: (step) => {\n // The adapter has always declared that an unreachable step clamps\n // to the first incomplete one; until 1.11.0 it did no such thing\n // and set the cursor blind. `cascade.currentStep` IS the first\n // incomplete step, and `visibleSteps` is the ladder the variant\n // renders, so honour both: a step outside the ladder, or ahead of\n // the frontier, lands on the frontier instead.\n const flow = flowRef.current;\n const inLadder = flow.cascade.visibleSteps.includes(step);\n const frontier = flow.cascade.currentStep;\n const next = !inLadder || step > frontier ? frontier : step;\n // Write the clamped value into the snapshot HERE, not just via the\n // effect that mirrors it after paint. The adapter tells hosts to\n // read `currentStep` back after `goto_step`, and a bridge doing\n // both in one tick would otherwise get the pre-move step.\n flowRef.current = { ...flow, activeStep: next };\n setActiveStep(next);\n },\n }),\n [resolvedVariant, onChange],\n );\n useAgentRegistration(bookingAgent, agentHandle, id);\n\n const resolvedAriaLabel = ariaLabel ?? t('booking.regionLabel');\n\n // Success view replaces the entire cascade body once `onSubmit`\n // resolves. The header still renders so the patient sees their\n // booking context above the confirmation card.\n const successBody = useMemo(() => {\n if (submitState !== 'success' || !submittedSnapshot) return null;\n return (\n <BookingSuccess\n snapshot={submittedSnapshot}\n operators={operators}\n specialties={specialties}\n services={services}\n locale={locale}\n mode={mode}\n showModify={showModifyOnSuccess}\n onReset={() => agentHandle.reset()}\n onModify={() => {\n // Modify path — keep `value` + `details` intact, just drop\n // the success view + return to step 7. The form will paint\n // pre-populated.\n setSubmittedSnapshot(null);\n setSubmitState('idle');\n setActiveStep(7);\n }}\n />\n );\n }, [\n submitState,\n submittedSnapshot,\n operators,\n specialties,\n services,\n locale,\n mode,\n showModifyOnSuccess,\n agentHandle,\n ]);\n\n const variantBody = useMemo(() => {\n if (submitState === 'success') return null;\n const Body =\n resolvedVariant === 'accordion'\n ? AccordionBody\n : resolvedVariant === 'calendar'\n ? CalendarBody\n : resolvedVariant === 'flexible'\n ? FlexibleBody\n : resolvedVariant === 'progress'\n ? ProgressBody\n : InlineListBody;\n const bodyProps: VariantBodyProps = {\n cascade,\n inputs: {\n specialties,\n services,\n operators,\n availableDates,\n availableSlots,\n nextAvailableDate,\n },\n value,\n onChange,\n onSubmit: handleSubmit,\n policy: { country, lockedOperatorId },\n detailsProps: {\n requireCodiceFiscale,\n requireDateOfBirth,\n requireInsuranceNumber,\n insuranceType: value.insuranceType,\n showNote,\n showReturningPatientFlag,\n privacyPolicyUrl,\n termsUrl,\n validateCodiceFiscale,\n validateInsuranceNumber,\n confirmationChannels,\n defaultConfirmationChannels,\n submitError,\n },\n emptyServicesSlot,\n onboardingIncompleteSlot,\n loadingDates,\n loadingSlots,\n onDateSelect,\n onWindowChange,\n datePickerStyle,\n specialtyPickerStyle,\n servicePickerStyle,\n operatorPickerStyle,\n submitting,\n locale,\n activeStep,\n setActiveStep,\n agentIdBase: id,\n };\n return <Body {...bodyProps} />;\n }, [\n submitState,\n resolvedVariant,\n cascade,\n specialties,\n services,\n operators,\n availableDates,\n availableSlots,\n nextAvailableDate,\n value,\n onChange,\n handleSubmit,\n country,\n lockedOperatorId,\n requireCodiceFiscale,\n requireDateOfBirth,\n requireInsuranceNumber,\n submitError,\n showNote,\n showReturningPatientFlag,\n privacyPolicyUrl,\n termsUrl,\n validateCodiceFiscale,\n validateInsuranceNumber,\n confirmationChannels,\n defaultConfirmationChannels,\n emptyServicesSlot,\n onboardingIncompleteSlot,\n loadingDates,\n loadingSlots,\n onDateSelect,\n onWindowChange,\n datePickerStyle,\n specialtyPickerStyle,\n servicePickerStyle,\n operatorPickerStyle,\n submitting,\n locale,\n activeStep,\n id,\n ]);\n\n return (\n <div\n ref={rootRef}\n role=\"region\"\n aria-label={resolvedAriaLabel}\n id={id}\n data-component=\"booking\"\n data-component-id={id}\n data-variant={resolvedVariant}\n className={rootVariants({\n variant: resolvedVariant,\n surface,\n className,\n })}\n // Programmatic focus target of last resort for the step effect —\n // never a Tab stop.\n tabIndex={-1}\n onFocus={(event) => {\n // React routes `focusin` through the React tree, so this fires for\n // Radix portal content too — which is what makes the unmount test\n // in the step effect correct for a Select's listbox.\n lastFocusedRef.current = event.target as HTMLElement;\n onFocusProp?.(event);\n }}\n {...rest}\n >\n {/* Step changes are otherwise silent for screen readers: the panel\n swaps under them with no announcement. `role=\"status\"` already\n implies aria-live=\"polite\" + aria-atomic — setting them again\n double-announces in some AT combinations. */}\n <div role=\"status\" className=\"ds:sr-only\">\n {stepAnnouncement}\n </div>\n <div\n // Hero gradient backdrop is shared across every Booking\n // variant — the header is the kit's brand marker for the\n // surface and should not visually fragment by variant.\n // (0.31.x gated this to `inline-list` only; lifted in\n // 0.32.0 so `accordion` / `calendar` / `flexible` /\n // `progress` carry the same chrome.)\n className={[\n 'ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]',\n 'ds:rounded-[var(--radius-md)]',\n 'ds:bg-[color-mix(in_srgb,var(--primary)_35%,var(--background))]',\n 'ds:bg-[image:var(--gradient-hero-brand)]',\n 'ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]',\n 'ds:pt-[var(--spacing-md)] ds:pb-[var(--spacing-md)]',\n ].join(' ')}\n >\n <h2 className=\"type-title-card ds:text-[var(--foreground)] ds:m-0\">\n {t('booking.regionLabel')}\n </h2>\n <p className=\"type-body-sm ds:text-[var(--muted-foreground)] ds:m-0\">\n {t('booking.headingSubtitle')}\n </p>\n </div>\n {successBody ?? variantBody}\n </div>\n );\n },\n);\n\nBooking.displayName = 'Booking';\n"],"names":["__iconNode","Activity","createLucideIcon","Baby","Bone","Brain","CalendarRange","Ear","Microscope","Pill","Scissors","Smile","Sunset","Syringe","subMonths","date","amount","options","addMonths","bookingAgent","handle","args","CONFIRMATION_CHANNEL_ORDER","OPERATORS_ALL","COUNTRY_GERMANY","filterSpecialties","inputs","s","_a","b","aSeq","bSeq","filterServices","list","specialtyIds","resolveSpecialtyIds","eligibleOperators","useSpecialtiesResolved","op","sid","serviceIds","resolveServiceIds","rid","computeGates","filtered","insuranceVisible","insuranceSatisfied","specialtyVisible","specialtyPicked","serviceVisible","servicePicked","serviceSatisfied","eligibleOps","operatorVisible","dateVisible","slotVisible","detailsVisible","onboardingIncomplete","deriveStep","gates","visible","isFulfilled","deriveCascade","currentStep","visibleSteps","selectedSlot","day","selectedService","specialtyPickedFinal","isReadyToSubmit","resetOnInsuranceChange","value","next","resetOnSpecialtyChange","resetOnSpecialtyIdsChange","resetOnServiceChange","resetOnServiceIdsChange","hasAny","resetOnOperatorChange","resetOnOperatorIdsChange","resolveOperatorIds","resetOnDateChange","resetOnSlotChange","applyAutoSelects","resolvedServices","resolveOperatorId","looksLikePhone","trimmed","resolveConfirmationChannels","enabled","set","c","defaultConfirmationSelection","mobile","override","resolvedEnabled","enabledSet","out","mobilePlausible","hasWhatsApp","outSet","NOTE_MAX_LENGTH","CF_REGEX","EMAIL_REGEX","VALIDATE_DEBOUNCE_MS","idleStatus","BookingDetailsForm","forwardRef","onChange","onSubmit","requireCodiceFiscale","requireDateOfBirth","requireInsuranceNumber","insuranceType","showNote","showReturningPatientFlag","privacyPolicyUrl","termsUrl","validateCodiceFiscale","validateInsuranceNumber","submitting","summarySlot","defaultPhoneCountry","confirmationChannels","defaultConfirmationChannels","submitError","ref","t","useTranslation","formId","useId","cfStatus","setCfStatus","useState","insuranceStatus","setInsuranceStatus","touched","setTouched","markTouched","useCallback","field","cfTimerRef","useRef","insuranceTimerRef","useEffect","update","patch","resolvedEnabledChannels","useMemo","pickerVisible","seededRef","seed","selectedChannels","noChannelsSelected","cf","res","insuranceShown","n","emailValid","phoneValid","requiredFieldsValid","_b","consentsTicked","channelsSatisfied","canSubmit","handleSubmit","e","payload","renderConsentLabel","i18nKey","url","safeUrl","jsx","Trans","jsxs","FormField","TextInput","EmailInput","PhoneInput","e164","DatePicker","TextArea","Checkbox","checked","Fragment","CheckboxGroup","Alert","Button","Spinner","rootVariants","cva","SERVICE_ICON_RULES","HeartPulse","Eye","ScanLine","Astroid","ClipboardCheck","pickIcon","text","pattern","Icon","inferServiceIcon","service","Stethoscope","servicePriceLabel","isoOf","fnsFormat","monthCellBase","monthCellVariants","MonthGrid","availableDates","selectedDate","onSelectDate","locale","loading","initialMonth","startOfMonth","parseISO","viewMonth","setViewMonth","focusDate","setFocusDate","cells","monthStart","monthEnd","endOfMonth","startWeekday","totalDays","grid","i","d","last","monthLabel","weekdayLabels","base","_","availableSet","isAvailable","rovingDate","firstAvailable","isSameMonth","handleKeyDown","event","current","Skeleton","IconButton","ChevronLeft","m","ChevronRight","label","rowIndex","colIndex","inMonth","available","isSelected","isSameDay","state","isRoving","dayLabel","serviceCardVariants","ServiceCardGroup","services","selectedServiceId","onSelect","groupId","focusIndex","setFocusIndex","cardRefs","focusAt","index","id","total","prev","isFocused","priceLabel","ariaLabel","iconNode","node","Badge","slotChipVariants","bucketForTime","time","hh","hour","BUCKET_ICONS","Sun","Moon","GroupedTimeSlots","slots","selectedSlotKey","dateLabel","groups","result","slot","availableCount","order","row","EmptyState","bucket","items","FOUR_DAY_WINDOW_SIZE","FourDayPicker","availableSlots","onDateSelect","onWindowChange","loadingDates","loadingSlots","agentIdBase","today","startOfDay","windowStart","setWindowStart","isAfter","first","windowEnd","addDays","days","iso","hasPrevious","hasNext","handlePreviousDays","subDays","handleNextDays","isBefore","handleSlotSelect","dateIso","visibleWindowHasSlots","firstAvailableIso","NextAvailableCta","SlotGrid","renderDateStep","props","datePickerStyle","renderSlotStep","InsuranceStep","Select","SpecialtyStep","specialties","valueIds","onChangeIds","pickerStyle","heading","MultiSelect","Combobox","ServiceStep","compact","resolvedStyle","price","OperatorStep","operators","OnboardingIncompleteAlert","customSlot","nextAvailableDate","onJump","formatted","BookingSuccess","snapshot","mode","showModify","onReset","onModify","channelLabels","description","formattedDate","operator","specialty","EmptyServicesAlert","ACTIVE_STEP_ATTR","ACTIVE_STEP_SELECTOR","stepRegionFocusClasses","StepRegion","step","active","className","children","foldLadder","InlineListBody","cascade","emptyServicesSlot","onboardingIncompleteSlot","specialtyPickerStyle","servicePickerStyle","operatorPickerStyle","detailsProps","activeStep","cursorStep","foldCursorStep","region","getStepNode","policy","useStepLabels","AccordionBody","setActiveStep","labels","allOperatorsLabel","visibleStepsForBody","activeIndex","accordionSteps","stepNum","getStepSummary","statusForStep","StepperAccordion","idx","stepIsFulfilled","pickedLabels","ids","item","raw","named","CalendarBody","panelId","filterSteps","hasUnfulfilledFilter","expandedFilter","summary","isExpanded","collapsible","ChevronDown","FlexibleBody","filterStepNumbers","ProgressBody","totalSteps","stepSpecs","canGoBack","nextNeedsSlot","canGoNext","StepperProgress","EMPTY_SPECIALTIES","EMPTY_OPERATORS","prefersReducedMotion","Booking","variant","country","useSpecialties","allowOperatorSelection","lockedOperatorId","autoSelectSingleService","specialtiesProp","operatorsProp","onStepChange","showModifyOnSuccess","surface","onFocusProp","rest","i18n","resolvedVariant","selectionSignature","lastSignatureRef","selectionChanged","rootRef","ladder","stepLabels","stepAnnouncement","setStepAnnouncement","lastFocusedRef","announcedStepRef","cursor","position","previous","root","target","submitState","setSubmitState","submittedSnapshot","setSubmittedSnapshot","details","useImperativeHandle","displayedStep","lastDisplayedStepRef","flowRef","agentHandle","flow","inLadder","frontier","useAgentRegistration","resolvedAriaLabel","successBody","variantBody","Body","bodyProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AACA,GACMC,KAAWC,EAAiB,YAAYF,EAAU;AClBxD;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,sCAAsC,KAAK,SAAQ,CAAE;AAAA,EACnE,CAAC,QAAQ,EAAE,GAAG,cAAc,KAAK,SAA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