@sheerid/jslib-nightly 3.0.0-preview.1621 → 3.0.0-preview.1628
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.
- package/_mysheerid-preview.css +4 -4
- package/_mysheerid-preview.js +1177 -1046
- package/_mysheerid-preview.js.map +1 -1
- package/chunk/{AddressComponent-CicgG-Ap.js → AddressComponent-BtJQiY48.js} +9 -9
- package/chunk/{AddressComponent-CicgG-Ap.js.map → AddressComponent-BtJQiY48.js.map} +1 -1
- package/chunk/{AddressComponent-SyKsvFCQ.js → AddressComponent-DP9ULqtw.js} +9 -9
- package/chunk/{AddressComponent-SyKsvFCQ.js.map → AddressComponent-DP9ULqtw.js.map} +1 -1
- package/chunk/AddressFieldRow-BWYhS8VE.js +15 -0
- package/chunk/AddressFieldRow-BWYhS8VE.js.map +1 -0
- package/chunk/AddressFieldRow-DjhsZq8R.js +19 -0
- package/chunk/AddressFieldRow-DjhsZq8R.js.map +1 -0
- package/chunk/{AnnouncingHeader-CNUB901t.js → AnnouncingHeader-CmgyK603.js} +6 -6
- package/chunk/{AnnouncingHeader-CNUB901t.js.map → AnnouncingHeader-CmgyK603.js.map} +1 -1
- package/chunk/{AnnouncingHeader-DCiZuMUz.js → AnnouncingHeader-TMbsnXRN.js} +6 -6
- package/chunk/{AnnouncingHeader-DCiZuMUz.js.map → AnnouncingHeader-TMbsnXRN.js.map} +1 -1
- package/chunk/{ApiUrls-B4z1Ry3u.js → ApiUrls-CIgwmz09.js} +6 -6
- package/chunk/{ApiUrls-B4z1Ry3u.js.map → ApiUrls-CIgwmz09.js.map} +1 -1
- package/chunk/{ApiUrls-2RecghDh.js → ApiUrls-Cbvfd-lx.js} +6 -6
- package/chunk/{ApiUrls-2RecghDh.js.map → ApiUrls-Cbvfd-lx.js.map} +1 -1
- package/chunk/{BirthDateComponent-BvW3thf7.js → BirthDateComponent-BhzBNnhz.js} +9 -9
- package/chunk/{BirthDateComponent-BvW3thf7.js.map → BirthDateComponent-BhzBNnhz.js.map} +1 -1
- package/chunk/{BirthDateComponent-R-9mMaGu.js → BirthDateComponent-COtwQq3l.js} +9 -9
- package/chunk/{BirthDateComponent-R-9mMaGu.js.map → BirthDateComponent-COtwQq3l.js.map} +1 -1
- package/chunk/{CaptchaComponent-CELn5byp.js → CaptchaComponent-B6F_IroY.js} +642 -612
- package/chunk/CaptchaComponent-B6F_IroY.js.map +1 -0
- package/chunk/{CaptchaComponent-jgmYS8PD.js → CaptchaComponent-Cvfnq94R.js} +687 -657
- package/chunk/CaptchaComponent-Cvfnq94R.js.map +1 -0
- package/chunk/{ChangeLocaleComponent-Dp2emhBO.js → ChangeLocaleComponent-Bo_VnyV_.js} +11 -11
- package/chunk/{ChangeLocaleComponent-Dp2emhBO.js.map → ChangeLocaleComponent-Bo_VnyV_.js.map} +1 -1
- package/chunk/{ChangeLocaleComponent-H3FlQ3cA.js → ChangeLocaleComponent-QEzC2ahY.js} +11 -11
- package/chunk/{ChangeLocaleComponent-H3FlQ3cA.js.map → ChangeLocaleComponent-QEzC2ahY.js.map} +1 -1
- package/chunk/{City-BawrEn1_.js → City-BTjuf99s.js} +9 -9
- package/chunk/{City-BQKUXtCs.js.map → City-BTjuf99s.js.map} +1 -1
- package/chunk/{City-BQKUXtCs.js → City-Dd-sI-wK.js} +9 -9
- package/chunk/{City-BawrEn1_.js.map → City-Dd-sI-wK.js.map} +1 -1
- package/chunk/{CollegeNameComponent-CAIRXL5p.js → CollegeNameComponent-B-C-9pQI.js} +12 -12
- package/chunk/{CollegeNameComponent-CAIRXL5p.js.map → CollegeNameComponent-B-C-9pQI.js.map} +1 -1
- package/chunk/{CollegeNameComponent-BZ2MjvAc.js → CollegeNameComponent-CBDIIWG3.js} +12 -12
- package/chunk/{CollegeNameComponent-BZ2MjvAc.js.map → CollegeNameComponent-CBDIIWG3.js.map} +1 -1
- package/chunk/{CopyToClipboardComponent-BrWPnNPn.js → CopyToClipboardComponent-CWnba0yN.js} +6 -6
- package/chunk/{CopyToClipboardComponent-BrWPnNPn.js.map → CopyToClipboardComponent-CWnba0yN.js.map} +1 -1
- package/chunk/{CopyToClipboardComponent-uJ-6jBXB.js → CopyToClipboardComponent-Cb9wlwWJ.js} +6 -6
- package/chunk/{CopyToClipboardComponent-uJ-6jBXB.js.map → CopyToClipboardComponent-Cb9wlwWJ.js.map} +1 -1
- package/chunk/{CountryComponentWrapper-C20l0Hp9.js → CountryComponentWrapper-BKnHFvsi.js} +13 -13
- package/chunk/{CountryComponentWrapper-C20l0Hp9.js.map → CountryComponentWrapper-BKnHFvsi.js.map} +1 -1
- package/chunk/{CountryComponentWrapper-Cbo3tE2x.js → CountryComponentWrapper-Cjtba0XQ.js} +13 -13
- package/chunk/{CountryComponentWrapper-Cbo3tE2x.js.map → CountryComponentWrapper-Cjtba0XQ.js.map} +1 -1
- package/chunk/{DischargeDateComponent-DYymcxuK.js → DischargeDateComponent-DI4byXKt.js} +14 -14
- package/chunk/{DischargeDateComponent-DYymcxuK.js.map → DischargeDateComponent-DI4byXKt.js.map} +1 -1
- package/chunk/{DischargeDateComponent-H6vRxx9K.js → DischargeDateComponent-DJsMxV6V.js} +14 -14
- package/chunk/{DischargeDateComponent-H6vRxx9K.js.map → DischargeDateComponent-DJsMxV6V.js.map} +1 -1
- package/chunk/{DriverLicenseNumberComponent-GeE_vJ-6.js → DriverLicenseNumberComponent-2kNyRBoD.js} +9 -9
- package/chunk/{DriverLicenseNumberComponent-BTXjrzCy.js.map → DriverLicenseNumberComponent-2kNyRBoD.js.map} +1 -1
- package/chunk/{DriverLicenseNumberComponent-BTXjrzCy.js → DriverLicenseNumberComponent-D8-T8RG1.js} +9 -9
- package/chunk/{DriverLicenseNumberComponent-GeE_vJ-6.js.map → DriverLicenseNumberComponent-D8-T8RG1.js.map} +1 -1
- package/chunk/{EmailLoopPending-cFuBbba2.js → EmailLoopPending-B6XvUCzv.js} +14 -14
- package/chunk/{EmailLoopPending-cFuBbba2.js.map → EmailLoopPending-B6XvUCzv.js.map} +1 -1
- package/chunk/{EmailLoopPending-8SpBGanx.js → EmailLoopPending-CgoO6Cj0.js} +14 -14
- package/chunk/{EmailLoopPending-8SpBGanx.js.map → EmailLoopPending-CgoO6Cj0.js.map} +1 -1
- package/chunk/{ExtraMessage-WH33nlul.js → ExtraMessage-BOUiL1v2.js} +7 -7
- package/chunk/{ExtraMessage-At4-m1_R.js.map → ExtraMessage-BOUiL1v2.js.map} +1 -1
- package/chunk/{ExtraMessage-At4-m1_R.js → ExtraMessage-C3rLE7pH.js} +7 -7
- package/chunk/{ExtraMessage-WH33nlul.js.map → ExtraMessage-C3rLE7pH.js.map} +1 -1
- package/chunk/{FirstResponderOrganizationComponent-B6Kpl__I.js → FirstResponderOrganizationComponent-CZQlt29E.js} +11 -11
- package/chunk/{FirstResponderOrganizationComponent-B6Kpl__I.js.map → FirstResponderOrganizationComponent-CZQlt29E.js.map} +1 -1
- package/chunk/{FirstResponderOrganizationComponent-HZN2oyQe.js → FirstResponderOrganizationComponent-DympWWsT.js} +11 -11
- package/chunk/{FirstResponderOrganizationComponent-HZN2oyQe.js.map → FirstResponderOrganizationComponent-DympWWsT.js.map} +1 -1
- package/chunk/{FormFieldInputSelect-D6KB_lSA.js → FormFieldInputSelect-DcLExjg1.js} +7 -7
- package/chunk/{FormFieldInputSelect-BkP4JViC.js.map → FormFieldInputSelect-DcLExjg1.js.map} +1 -1
- package/chunk/{FormFieldInputSelect-BkP4JViC.js → FormFieldInputSelect-DjvrXRYz.js} +7 -7
- package/chunk/{FormFieldInputSelect-D6KB_lSA.js.map → FormFieldInputSelect-DjvrXRYz.js.map} +1 -1
- package/chunk/{FormFieldLayout-CdAF5eOb.js → FormFieldLayout-C0SpJlpv.js} +7 -7
- package/chunk/{FormFieldLayout-B6UWlgPZ.js.map → FormFieldLayout-C0SpJlpv.js.map} +1 -1
- package/chunk/{FormFieldLayout-B6UWlgPZ.js → FormFieldLayout-lJ_u3Dgo.js} +7 -7
- package/chunk/{FormFieldLayout-CdAF5eOb.js.map → FormFieldLayout-lJ_u3Dgo.js.map} +1 -1
- package/chunk/{FormFieldText-C95_VXFp.js → FormFieldText-BC4bIifh.js} +7 -7
- package/chunk/{FormFieldText-C95_VXFp.js.map → FormFieldText-BC4bIifh.js.map} +1 -1
- package/chunk/{FormFieldText-DF4JNdNJ.js → FormFieldText-mvrX2IIF.js} +7 -7
- package/chunk/{FormFieldText-DF4JNdNJ.js.map → FormFieldText-mvrX2IIF.js.map} +1 -1
- package/chunk/{FormFieldTypeahead-BbMRLwcq.js → FormFieldTypeahead-DQ7HUrTC.js} +556 -552
- package/chunk/{FormFieldTypeahead-BWO62nSf.js.map → FormFieldTypeahead-DQ7HUrTC.js.map} +1 -1
- package/chunk/{FormFieldTypeahead-BWO62nSf.js → FormFieldTypeahead-Ds8Iad_j.js} +362 -366
- package/chunk/{FormFieldTypeahead-BbMRLwcq.js.map → FormFieldTypeahead-Ds8Iad_j.js.map} +1 -1
- package/chunk/{FormFooterComponent-T4dnyYOP.js → FormFooterComponent-CnOOoGJa.js} +6 -6
- package/chunk/{FormFooterComponent-C4nUMHpv.js.map → FormFooterComponent-CnOOoGJa.js.map} +1 -1
- package/chunk/{FormFooterComponent-C4nUMHpv.js → FormFooterComponent-SVXUJ4ta.js} +6 -6
- package/chunk/{FormFooterComponent-T4dnyYOP.js.map → FormFooterComponent-SVXUJ4ta.js.map} +1 -1
- package/chunk/FormSelectChoice-Da11OJMy.js +4 -4
- package/chunk/{InputSelectComponent-DFomMBKx.js → InputSelectComponent-D54U7YXX.js} +759 -759
- package/chunk/{InputSelectComponent-DFomMBKx.js.map → InputSelectComponent-D54U7YXX.js.map} +1 -1
- package/chunk/{InputSelectComponent-xKOg0Mfy.js → InputSelectComponent-DYUtOb7C.js} +613 -613
- package/chunk/{InputSelectComponent-xKOg0Mfy.js.map → InputSelectComponent-DYUtOb7C.js.map} +1 -1
- package/chunk/{InputText-DO36IbjF.js → InputText-DVLYDw0h.js} +7 -7
- package/chunk/{InputText-DO36IbjF.js.map → InputText-DVLYDw0h.js.map} +1 -1
- package/chunk/{InputText-XskZSQrt.js → InputText-DjdofHyX.js} +7 -7
- package/chunk/{InputText-XskZSQrt.js.map → InputText-DjdofHyX.js.map} +1 -1
- package/chunk/{LicensedProfessionalOrganizationComponent-B79SU_Ho.js → LicensedProfessionalOrganizationComponent-BNzpkSMd.js} +11 -11
- package/chunk/{LicensedProfessionalOrganizationComponent-B79SU_Ho.js.map → LicensedProfessionalOrganizationComponent-BNzpkSMd.js.map} +1 -1
- package/chunk/{LicensedProfessionalOrganizationComponent-Bh2HJaux.js → LicensedProfessionalOrganizationComponent-D4fMc-74.js} +11 -11
- package/chunk/{LicensedProfessionalOrganizationComponent-Bh2HJaux.js.map → LicensedProfessionalOrganizationComponent-D4fMc-74.js.map} +1 -1
- package/chunk/{LogoComponent-D3p_K04d.js → LogoComponent-6tFjcgVM.js} +7 -7
- package/chunk/{LogoComponent-D3p_K04d.js.map → LogoComponent-6tFjcgVM.js.map} +1 -1
- package/chunk/{LogoComponent-waBbF_Hz.js → LogoComponent-mUZySaE6.js} +7 -7
- package/chunk/{LogoComponent-waBbF_Hz.js.map → LogoComponent-mUZySaE6.js.map} +1 -1
- package/chunk/{LowIncomeOrganizationComponent-B7nmTUWV.js → LowIncomeOrganizationComponent-BVwf7jjC.js} +16 -16
- package/chunk/{LowIncomeOrganizationComponent-B7nmTUWV.js.map → LowIncomeOrganizationComponent-BVwf7jjC.js.map} +1 -1
- package/chunk/{LowIncomeOrganizationComponent-BAf5x0-f.js → LowIncomeOrganizationComponent-lYkGVIRC.js} +16 -16
- package/chunk/{LowIncomeOrganizationComponent-BAf5x0-f.js.map → LowIncomeOrganizationComponent-lYkGVIRC.js.map} +1 -1
- package/chunk/{LowRewardPoolNote-D53DGp7d.js → LowRewardPoolNote-CtOLmlnn.js} +27 -25
- package/chunk/LowRewardPoolNote-CtOLmlnn.js.map +1 -0
- package/chunk/{LowRewardPoolNote-CAcUOjXU.js → LowRewardPoolNote-DG_MMjGN.js} +27 -25
- package/chunk/LowRewardPoolNote-DG_MMjGN.js.map +1 -0
- package/chunk/{MedicalProfessionalOrganizationComponent-CIPYgOg7.js → MedicalProfessionalOrganizationComponent-BLl6Da9c.js} +11 -11
- package/chunk/{MedicalProfessionalOrganizationComponent-CIPYgOg7.js.map → MedicalProfessionalOrganizationComponent-BLl6Da9c.js.map} +1 -1
- package/chunk/{MedicalProfessionalOrganizationComponent-BnURpR77.js → MedicalProfessionalOrganizationComponent-DIZA7RvJ.js} +11 -11
- package/chunk/{MedicalProfessionalOrganizationComponent-BnURpR77.js.map → MedicalProfessionalOrganizationComponent-DIZA7RvJ.js.map} +1 -1
- package/chunk/{MemberIdComponent-CvBccNKk.js → MemberIdComponent-BTlvABAU.js} +9 -9
- package/chunk/{MemberIdComponent-CYJuZbZS.js.map → MemberIdComponent-BTlvABAU.js.map} +1 -1
- package/chunk/{MemberIdComponent-CYJuZbZS.js → MemberIdComponent-ClI7Lrzf.js} +9 -9
- package/chunk/{MemberIdComponent-CvBccNKk.js.map → MemberIdComponent-ClI7Lrzf.js.map} +1 -1
- package/chunk/{MembershipOrganizationComponent-Hyvx9XaK.js → MembershipOrganizationComponent-BPizE5cP.js} +11 -11
- package/chunk/{MembershipOrganizationComponent-Hyvx9XaK.js.map → MembershipOrganizationComponent-BPizE5cP.js.map} +1 -1
- package/chunk/{MembershipOrganizationComponent-CgwT1kz9.js → MembershipOrganizationComponent-ChUpP3B6.js} +11 -11
- package/chunk/{MembershipOrganizationComponent-CgwT1kz9.js.map → MembershipOrganizationComponent-ChUpP3B6.js.map} +1 -1
- package/chunk/{Message-CCPUNbvb.js → Message-5IZ4lXNe.js} +22 -20
- package/chunk/Message-5IZ4lXNe.js.map +1 -0
- package/chunk/{Message-BJpuZuCw.js → Message-CwmUrRnS.js} +22 -20
- package/chunk/Message-CwmUrRnS.js.map +1 -0
- package/chunk/Onfido-CTCgAwnB.js +4 -4
- package/chunk/PersonalInfoStepFrame-ClEKETJL.js +52 -0
- package/chunk/PersonalInfoStepFrame-ClEKETJL.js.map +1 -0
- package/chunk/PersonalInfoStepFrame-DHPclK45.js +83 -0
- package/chunk/PersonalInfoStepFrame-DHPclK45.js.map +1 -0
- package/chunk/PersonalInfoStepSubmitButton-BzrRG3Jn.js +101 -0
- package/chunk/PersonalInfoStepSubmitButton-BzrRG3Jn.js.map +1 -0
- package/chunk/PersonalInfoStepSubmitButton-DFwDHOdp.js +97 -0
- package/chunk/PersonalInfoStepSubmitButton-DFwDHOdp.js.map +1 -0
- package/chunk/{PostalCodeComponent-D-Wlqd3h.js → PostalCodeComponent-CP0rzyjy.js} +9 -9
- package/chunk/{PostalCodeComponent-D-Wlqd3h.js.map → PostalCodeComponent-CP0rzyjy.js.map} +1 -1
- package/chunk/{PostalCodeComponent-Bfyrs-OS.js → PostalCodeComponent-KP-2qj83.js} +9 -9
- package/chunk/{PostalCodeComponent-Bfyrs-OS.js.map → PostalCodeComponent-KP-2qj83.js.map} +1 -1
- package/chunk/{SSN-CpZKLMZh.js → SSN-CLxg9aqc.js} +8 -8
- package/chunk/{SSN-CpZKLMZh.js.map → SSN-CLxg9aqc.js.map} +1 -1
- package/chunk/{SSN-DfQKic30.js → SSN-TkC3k_yT.js} +8 -8
- package/chunk/{SSN-DfQKic30.js.map → SSN-TkC3k_yT.js.map} +1 -1
- package/chunk/{StateSelectComponent-uRb4CZto.js → StateSelectComponent-BSKbExE7.js} +7 -7
- package/chunk/{StateSelectComponent-uRb4CZto.js.map → StateSelectComponent-BSKbExE7.js.map} +1 -1
- package/chunk/{StateSelectComponent-B0vfzaHI.js → StateSelectComponent-C5zsszV4.js} +7 -7
- package/chunk/{StateSelectComponent-B0vfzaHI.js.map → StateSelectComponent-C5zsszV4.js.map} +1 -1
- package/chunk/{StatusComponent-ZjAfp6D1.js → StatusComponent-CjJzTs66.js} +10 -10
- package/chunk/{StatusComponent-RqqyyDyR.js.map → StatusComponent-CjJzTs66.js.map} +1 -1
- package/chunk/{StatusComponent-RqqyyDyR.js → StatusComponent-DLYbEtYO.js} +10 -10
- package/chunk/{StatusComponent-ZjAfp6D1.js.map → StatusComponent-DLYbEtYO.js.map} +1 -1
- package/chunk/StepAgePersonalInfo-5MpjInxr.js +154 -0
- package/chunk/StepAgePersonalInfo-5MpjInxr.js.map +1 -0
- package/chunk/StepAgePersonalInfo-BLIpWgcW.js +158 -0
- package/chunk/StepAgePersonalInfo-BLIpWgcW.js.map +1 -0
- package/chunk/{StepCard-wwdNHa6o.js → StepCard-C76ZfmqM.js} +5 -5
- package/chunk/{StepCard-ELVyeUE5.js.map → StepCard-C76ZfmqM.js.map} +1 -1
- package/chunk/{StepCard-ELVyeUE5.js → StepCard-CXGXGFI-.js} +5 -5
- package/chunk/{StepCard-wwdNHa6o.js.map → StepCard-CXGXGFI-.js.map} +1 -1
- package/chunk/StepCollectIdentifier-4GqjrMR9.js +64 -0
- package/chunk/StepCollectIdentifier-4GqjrMR9.js.map +1 -0
- package/chunk/StepCollectIdentifier-IsEVaXVN.js +60 -0
- package/chunk/StepCollectIdentifier-IsEVaXVN.js.map +1 -0
- package/chunk/StepCollectMilitaryPersonalInfoComponent-CGsMi0Qe.js +224 -0
- package/chunk/StepCollectMilitaryPersonalInfoComponent-CGsMi0Qe.js.map +1 -0
- package/chunk/StepCollectMilitaryPersonalInfoComponent-CgRV67Kn.js +220 -0
- package/chunk/StepCollectMilitaryPersonalInfoComponent-CgRV67Kn.js.map +1 -0
- package/chunk/StepCollectPersonalInfo-B0-Tj9ms.js +348 -0
- package/chunk/StepCollectPersonalInfo-B0-Tj9ms.js.map +1 -0
- package/chunk/StepCollectPersonalInfo-BgSOHYiZ.js +352 -0
- package/chunk/StepCollectPersonalInfo-BgSOHYiZ.js.map +1 -0
- package/chunk/{StepCompleteAuthentication-B3iM05Rm.js → StepCompleteAuthentication-CbjrrB6R.js} +10 -10
- package/chunk/{StepCompleteAuthentication-B3iM05Rm.js.map → StepCompleteAuthentication-CbjrrB6R.js.map} +1 -1
- package/chunk/{StepCompleteAuthentication-DmURi_hs.js → StepCompleteAuthentication-D_LaDe1h.js} +10 -10
- package/chunk/{StepCompleteAuthentication-DmURi_hs.js.map → StepCompleteAuthentication-D_LaDe1h.js.map} +1 -1
- package/chunk/{StepConsolation-CFWMHxRq.js → StepConsolation-CHt2g_dn.js} +10 -10
- package/chunk/{StepConsolation-CFWMHxRq.js.map → StepConsolation-CHt2g_dn.js.map} +1 -1
- package/chunk/{StepConsolation-nN23KvH2.js → StepConsolation-CkVYeAFw.js} +10 -10
- package/chunk/{StepConsolation-nN23KvH2.js.map → StepConsolation-CkVYeAFw.js.map} +1 -1
- package/chunk/{StepDocUpload-DAI4hd-K.js → StepDocUpload-BDxM8MmK.js} +613 -611
- package/chunk/StepDocUpload-BDxM8MmK.js.map +1 -0
- package/chunk/{StepDocUpload-DXj4mEM6.js → StepDocUpload-V99c9o9B.js} +526 -524
- package/chunk/StepDocUpload-V99c9o9B.js.map +1 -0
- package/chunk/StepDriverLicensePersonalInfoComponent-CO_D9enW.js +121 -0
- package/chunk/StepDriverLicensePersonalInfoComponent-CO_D9enW.js.map +1 -0
- package/chunk/StepDriverLicensePersonalInfoComponent-S3GMlNVG.js +125 -0
- package/chunk/StepDriverLicensePersonalInfoComponent-S3GMlNVG.js.map +1 -0
- package/chunk/{StepEmailLoop-CuaFZ_b2.js → StepEmailLoop-Dw2_8QHT.js} +14 -14
- package/chunk/{StepEmailLoop-CuaFZ_b2.js.map → StepEmailLoop-Dw2_8QHT.js.map} +1 -1
- package/chunk/{StepEmailLoop-C490ilfk.js → StepEmailLoop-cJGhzoxB.js} +14 -14
- package/chunk/{StepEmailLoop-C490ilfk.js.map → StepEmailLoop-cJGhzoxB.js.map} +1 -1
- package/chunk/StepEmploymentPersonalInfo-C1p6zQJU.js +195 -0
- package/chunk/StepEmploymentPersonalInfo-C1p6zQJU.js.map +1 -0
- package/chunk/StepEmploymentPersonalInfo-Cf5-yMap.js +191 -0
- package/chunk/StepEmploymentPersonalInfo-Cf5-yMap.js.map +1 -0
- package/chunk/StepFirstResponderPersonalInfo-BgZVPaDN.js +159 -0
- package/chunk/StepFirstResponderPersonalInfo-BgZVPaDN.js.map +1 -0
- package/chunk/StepFirstResponderPersonalInfo-nM5k1qr0.js +163 -0
- package/chunk/StepFirstResponderPersonalInfo-nM5k1qr0.js.map +1 -0
- package/chunk/StepGeneralIdentityPersonalInfoComponent-CpTD4_cn.js +155 -0
- package/chunk/StepGeneralIdentityPersonalInfoComponent-CpTD4_cn.js.map +1 -0
- package/chunk/StepGeneralIdentityPersonalInfoComponent-DBLhfod8.js +159 -0
- package/chunk/StepGeneralIdentityPersonalInfoComponent-DBLhfod8.js.map +1 -0
- package/chunk/StepHybridIdentityPersonalInfoComponent-BlPU1xTJ.js +164 -0
- package/chunk/StepHybridIdentityPersonalInfoComponent-BlPU1xTJ.js.map +1 -0
- package/chunk/StepHybridIdentityPersonalInfoComponent-t80dX6ge.js +168 -0
- package/chunk/StepHybridIdentityPersonalInfoComponent-t80dX6ge.js.map +1 -0
- package/chunk/{StepIDCheckLoop-CGuZberW.js → StepIDCheckLoop-DixyWIxE.js} +9 -9
- package/chunk/{StepIDCheckLoop-CGuZberW.js.map → StepIDCheckLoop-DixyWIxE.js.map} +1 -1
- package/chunk/{StepIDCheckLoop-DDNgoWKs.js → StepIDCheckLoop-DxYk4IJu.js} +9 -9
- package/chunk/{StepIDCheckLoop-DDNgoWKs.js.map → StepIDCheckLoop-DxYk4IJu.js.map} +1 -1
- package/chunk/{StepIDCheckLoopOnfido-2fSt4PC7.js → StepIDCheckLoopOnfido-BNbAwHVt.js} +15 -15
- package/chunk/{StepIDCheckLoopOnfido-2fSt4PC7.js.map → StepIDCheckLoopOnfido-BNbAwHVt.js.map} +1 -1
- package/chunk/{StepIDCheckLoopOnfido-BajgwcIU.js → StepIDCheckLoopOnfido-COVPb_S5.js} +15 -15
- package/chunk/{StepIDCheckLoopOnfido-BajgwcIU.js.map → StepIDCheckLoopOnfido-COVPb_S5.js.map} +1 -1
- package/chunk/{StepIDCheckLoopRegula-BWkVIExj.js → StepIDCheckLoopRegula-DKbVSfuV.js} +15 -15
- package/chunk/{StepIDCheckLoopRegula-BWkVIExj.js.map → StepIDCheckLoopRegula-DKbVSfuV.js.map} +1 -1
- package/chunk/{StepIDCheckLoopRegula-DBEhCcOx.js → StepIDCheckLoopRegula-mvQ8qDWR.js} +13 -13
- package/chunk/{StepIDCheckLoopRegula-DBEhCcOx.js.map → StepIDCheckLoopRegula-mvQ8qDWR.js.map} +1 -1
- package/chunk/StepLicensedProfessionalPersonalInfo-C2CIk-nr.js +152 -0
- package/chunk/StepLicensedProfessionalPersonalInfo-C2CIk-nr.js.map +1 -0
- package/chunk/StepLicensedProfessionalPersonalInfo-CTE2jZqH.js +156 -0
- package/chunk/StepLicensedProfessionalPersonalInfo-CTE2jZqH.js.map +1 -0
- package/chunk/StepLowIncomePersonalInfo-Be9qCxGX.js +208 -0
- package/chunk/StepLowIncomePersonalInfo-Be9qCxGX.js.map +1 -0
- package/chunk/StepLowIncomePersonalInfo-Bzh9WTNR.js +212 -0
- package/chunk/StepLowIncomePersonalInfo-Bzh9WTNR.js.map +1 -0
- package/chunk/StepMedicalProfessionalPersonalInfo-B2BR4rqc.js +181 -0
- package/chunk/StepMedicalProfessionalPersonalInfo-B2BR4rqc.js.map +1 -0
- package/chunk/StepMedicalProfessionalPersonalInfo-DUc_JDXL.js +177 -0
- package/chunk/StepMedicalProfessionalPersonalInfo-DUc_JDXL.js.map +1 -0
- package/chunk/StepMemberPersonalInfo-B_lcCFCr.js +143 -0
- package/chunk/StepMemberPersonalInfo-B_lcCFCr.js.map +1 -0
- package/chunk/StepMemberPersonalInfo-gHVsFx6L.js +139 -0
- package/chunk/StepMemberPersonalInfo-gHVsFx6L.js.map +1 -0
- package/chunk/StepMoverPersonalInfo-1u0Ayivh.js +124 -0
- package/chunk/StepMoverPersonalInfo-1u0Ayivh.js.map +1 -0
- package/chunk/StepMoverPersonalInfo-BqcbV8cH.js +120 -0
- package/chunk/StepMoverPersonalInfo-BqcbV8cH.js.map +1 -0
- package/chunk/{StepOverrideComponent-Df7suQby.js → StepOverrideComponent-BRdS2H3m.js} +14 -14
- package/chunk/{StepOverrideComponent-Df7suQby.js.map → StepOverrideComponent-BRdS2H3m.js.map} +1 -1
- package/chunk/{StepOverrideComponent-_2tBwss0.js → StepOverrideComponent-BmmBE8nB.js} +14 -14
- package/chunk/{StepOverrideComponent-_2tBwss0.js.map → StepOverrideComponent-BmmBE8nB.js.map} +1 -1
- package/chunk/{StepSMSLoop-BVbQi9Eq.js → StepSMSLoop-CRd8TtzV.js} +11 -11
- package/chunk/{StepSMSLoop-BVbQi9Eq.js.map → StepSMSLoop-CRd8TtzV.js.map} +1 -1
- package/chunk/{StepSMSLoop-DJdI9NJ-.js → StepSMSLoop-CTF2WyJG.js} +11 -11
- package/chunk/{StepSMSLoop-DJdI9NJ-.js.map → StepSMSLoop-CTF2WyJG.js.map} +1 -1
- package/chunk/StepSSO-CVwwDxgB.js +8 -0
- package/chunk/StepSSO-DSR38vO8.js +12 -0
- package/chunk/{StepSocialSecurityNumber-CKW8pUck.js → StepSocialSecurityNumber-CkHNhkLX.js} +13 -13
- package/chunk/{StepSocialSecurityNumber-CKW8pUck.js.map → StepSocialSecurityNumber-CkHNhkLX.js.map} +1 -1
- package/chunk/{StepSocialSecurityNumber-CBmG_7kt.js → StepSocialSecurityNumber-tST0N2Ij.js} +13 -13
- package/chunk/{StepSocialSecurityNumber-CBmG_7kt.js.map → StepSocialSecurityNumber-tST0N2Ij.js.map} +1 -1
- package/chunk/StepStudentPersonalInfo-CuZt_5Qb.js +213 -0
- package/chunk/StepStudentPersonalInfo-CuZt_5Qb.js.map +1 -0
- package/chunk/StepStudentPersonalInfo-D8LOtrpG.js +209 -0
- package/chunk/StepStudentPersonalInfo-D8LOtrpG.js.map +1 -0
- package/chunk/{StepSuccess-lXDU9RzB.js → StepSuccess-7wdEnCFs.js} +15 -15
- package/chunk/{StepSuccess-lXDU9RzB.js.map → StepSuccess-7wdEnCFs.js.map} +1 -1
- package/chunk/{StepSuccess-B_b_cLvk.js → StepSuccess-CUOqyiUg.js} +15 -15
- package/chunk/{StepSuccess-B_b_cLvk.js.map → StepSuccess-CUOqyiUg.js.map} +1 -1
- package/chunk/StepTeacherPersonalInfo-DJrHR00w.js +137 -0
- package/chunk/StepTeacherPersonalInfo-DJrHR00w.js.map +1 -0
- package/chunk/StepTeacherPersonalInfo-f9rRcLw9.js +133 -0
- package/chunk/StepTeacherPersonalInfo-f9rRcLw9.js.map +1 -0
- package/chunk/StepThirdPartyLoop-BY7ytJrS.js +12 -0
- package/chunk/StepThirdPartyLoop-B__GCNlS.js +8 -0
- package/chunk/{TeacherSchoolComponent-DpNEEKfb.js → TeacherSchoolComponent-1DEfJKNl.js} +12 -12
- package/chunk/{TeacherSchoolComponent-DpNEEKfb.js.map → TeacherSchoolComponent-1DEfJKNl.js.map} +1 -1
- package/chunk/{TeacherSchoolComponent-BFiJ7Wq2.js → TeacherSchoolComponent-CLYNsumk.js} +12 -12
- package/chunk/{TeacherSchoolComponent-BFiJ7Wq2.js.map → TeacherSchoolComponent-CLYNsumk.js.map} +1 -1
- package/chunk/{TestingRouteOverrides-BEm8Sf8D.js → TestingRouteOverrides-CoyYU2dB.js} +6 -6
- package/chunk/{TestingRouteOverrides-BEm8Sf8D.js.map → TestingRouteOverrides-CoyYU2dB.js.map} +1 -1
- package/chunk/{TestingRouteOverrides-CY6cZruo.js → TestingRouteOverrides-DdBMBH84.js} +6 -6
- package/chunk/{TestingRouteOverrides-CY6cZruo.js.map → TestingRouteOverrides-DdBMBH84.js.map} +1 -1
- package/chunk/ThreatMetrix-D_TbL50B.js +4 -4
- package/chunk/{VerificationApiClient-BeOvbT_t.js → VerificationApiClient-BUZofFET.js} +7 -7
- package/chunk/{VerificationApiClient-BeOvbT_t.js.map → VerificationApiClient-BUZofFET.js.map} +1 -1
- package/chunk/{VerificationApiClient-BvR36fUk.js → VerificationApiClient-DxDGUQ-S.js} +7 -7
- package/chunk/{VerificationApiClient-BvR36fUk.js.map → VerificationApiClient-DxDGUQ-S.js.map} +1 -1
- package/chunk/{addEventListener-CjrfonA-.js → addEventListener-BVNWtC2P.js} +8 -8
- package/chunk/{addEventListener-DuM7oJdm.js.map → addEventListener-BVNWtC2P.js.map} +1 -1
- package/chunk/{addEventListener-DuM7oJdm.js → addEventListener-BcjpXDjJ.js} +8 -8
- package/chunk/{addEventListener-CjrfonA-.js.map → addEventListener-BcjpXDjJ.js.map} +1 -1
- package/chunk/ar-D5CO913q.js +4 -4
- package/chunk/bg-1mhA5kYF.js +4 -4
- package/chunk/bn-IN-CpDqyRb_.js +4 -4
- package/chunk/{button-DIPXKy0a.js → button-D5HIQ4Y0.js} +8 -8
- package/chunk/{button-DIPXKy0a.js.map → button-D5HIQ4Y0.js.map} +1 -1
- package/chunk/{button-BlkqJX_E.js → button-ac_Hqm_6.js} +11 -11
- package/chunk/{button-BlkqJX_E.js.map → button-ac_Hqm_6.js.map} +1 -1
- package/chunk/clsx-DC8twM4t.js +4 -4
- package/chunk/countryUtils-BA0alsCj.js +12 -0
- package/chunk/{countryUtils-DKwoRV2T.js.map → countryUtils-BA0alsCj.js.map} +1 -1
- package/chunk/{countryUtils-DKwoRV2T.js → countryUtils-DOhg01BA.js} +5 -5
- package/chunk/{countryUtils-SAP2nHeP.js.map → countryUtils-DOhg01BA.js.map} +1 -1
- package/chunk/cs-Chh7FAGt.js +4 -4
- package/chunk/da-DwrVoxto.js +4 -4
- package/chunk/de-IWGZLhgY.js +4 -4
- package/chunk/dist-In8P1UpN.js +4 -4
- package/chunk/el-DbDcvSPJ.js +4 -4
- package/chunk/{empties-D2KXGsVY.js → empties-BnfYnQnj.js} +8 -5
- package/chunk/empties-BnfYnQnj.js.map +1 -0
- package/chunk/{empties-CJE5It5a.js → empties-DIWFhdB0.js} +8 -5
- package/chunk/{empties-CJE5It5a.js.map → empties-DIWFhdB0.js.map} +1 -1
- package/chunk/en-GB-CNQ8Ww2j.js +4 -4
- package/chunk/es-ES-DWimqEZ_.js +4 -4
- package/chunk/es-qhC-seq5.js +4 -4
- package/chunk/et-yF9G-Mym.js +4 -4
- package/chunk/eventEmitter-CSG6jR7V.js +4 -4
- package/chunk/fa-BcdSf7og.js +4 -4
- package/chunk/fi-D-IP_KHm.js +4 -4
- package/chunk/fr-BmUuYxk0.js +4 -4
- package/chunk/fr-CA-DVQ4xmzZ.js +4 -4
- package/chunk/ga-DuZycND3.js +4 -4
- package/chunk/getInstallType-BRxisNNY.js +4 -4
- package/chunk/getInstallType-DlS_DNKt.js +4 -4
- package/chunk/hi-IN-l6Rn5Ewm.js +4 -4
- package/chunk/{hooks-Cjcd--GE.js → hooks-BtGKgRAK.js} +6 -6
- package/chunk/hooks-BtGKgRAK.js.map +1 -0
- package/chunk/{hooks-D72YoqAe.js → hooks-DKM9cJde.js} +6 -6
- package/chunk/hooks-DKM9cJde.js.map +1 -0
- package/chunk/hr-BtqyDzDB.js +4 -4
- package/chunk/hu-C6syKJfb.js +4 -4
- package/chunk/id-GgI-Z2a5.js +4 -4
- package/chunk/{index.es-C_UCMoRU.js → index.es-DpZtkqxf.js} +6 -6
- package/chunk/{index.es-C_UCMoRU.js.map → index.es-DpZtkqxf.js.map} +1 -1
- package/chunk/{index.es-0Ly0eUxm.js → index.es-FjuPwOz0.js} +6 -6
- package/chunk/{index.es-0Ly0eUxm.js.map → index.es-FjuPwOz0.js.map} +1 -1
- package/chunk/{input-Bnmror_i.js → input-BfKnTtbM.js} +8 -8
- package/chunk/{input-Bnmror_i.js.map → input-BfKnTtbM.js.map} +1 -1
- package/chunk/{input-CbFmDZR4.js → input-CwRvN2sJ.js} +8 -8
- package/chunk/{input-CbFmDZR4.js.map → input-CwRvN2sJ.js.map} +1 -1
- package/chunk/is-CvmKEON9.js +4 -4
- package/chunk/it-CnmveGgC.js +4 -4
- package/chunk/iw-DFUYHkxF.js +4 -4
- package/chunk/ja-CjVb2tWW.js +4 -4
- package/chunk/{jsx-runtime-B5jXYl8q.js → jsx-runtime-DDrPHZwN.js} +5 -5
- package/chunk/{jsx-runtime-B5jXYl8q.js.map → jsx-runtime-DDrPHZwN.js.map} +1 -1
- package/chunk/{jsx-runtime-BnRn7GM8.js → jsx-runtime-NC2eM5ec.js} +5 -5
- package/chunk/{jsx-runtime-BnRn7GM8.js.map → jsx-runtime-NC2eM5ec.js.map} +1 -1
- package/chunk/kk-Dvz4nK6K.js +4 -4
- package/chunk/ko-DzOqBMGC.js +4 -4
- package/chunk/lo-C2WPq55d.js +4 -4
- package/chunk/lt-BSDYvjTF.js +4 -4
- package/chunk/lv-CefDPT-M.js +4 -4
- package/chunk/mockProgramBranding-C9Ysu3Mp.js +4 -4
- package/chunk/mockProgramConfiguration-BNqSCrMG.js +4 -4
- package/chunk/mockProgramI18n-CgYx_1_a.js +4 -4
- package/chunk/mockProgramTheme-Cfk2dzF3.js +4 -4
- package/chunk/{mocks-BuI-FNT-.js → mocks-CHQ1TVI3.js} +5 -5
- package/chunk/{mocks-C6Bm8r6i.js.map → mocks-CHQ1TVI3.js.map} +1 -1
- package/chunk/{mocks-C6Bm8r6i.js → mocks-Dd0Dlwr1.js} +5 -5
- package/chunk/{mocks-BuI-FNT-.js.map → mocks-Dd0Dlwr1.js.map} +1 -1
- package/chunk/ms-BjestZxy.js +4 -4
- package/chunk/nl-B1FyUfCT.js +4 -4
- package/chunk/nl-BE-CbeAd3nq.js +4 -4
- package/chunk/no-Dr633Ddi.js +4 -4
- package/chunk/pl-UYTjMIq_.js +4 -4
- package/chunk/{programThemeGetters-CLeOiedB.js → programThemeGetters-BAbsTY-b.js} +6 -6
- package/chunk/{programThemeGetters-CLeOiedB.js.map → programThemeGetters-BAbsTY-b.js.map} +1 -1
- package/chunk/{programThemeGetters-TRIvr7Go.js → programThemeGetters-k8rZASZ-.js} +6 -6
- package/chunk/{programThemeGetters-TRIvr7Go.js.map → programThemeGetters-k8rZASZ-.js.map} +1 -1
- package/chunk/pt-BR-C8SYMT-J.js +4 -4
- package/chunk/pt-uH-M3GdN.js +4 -4
- package/chunk/refs-Mq0rtW9K.js +4 -4
- package/chunk/ro-CAOSXZ7h.js +4 -4
- package/chunk/ru-iwYoEydL.js +4 -4
- package/chunk/runtimeTypes-B2AGNJMT.js +4 -4
- package/chunk/sk-DYYNV3zw.js +4 -4
- package/chunk/sl-D_-eeM5N.js +4 -4
- package/chunk/sr-BTi9_anL.js +4 -4
- package/chunk/{stepComponentHelpers-CzsNPyXM.js → stepComponentHelpers-Db0mTMF5.js} +6 -6
- package/chunk/{stepComponentHelpers-CzsNPyXM.js.map → stepComponentHelpers-Db0mTMF5.js.map} +1 -1
- package/chunk/{stepComponentHelpers-IolnFznH.js → stepComponentHelpers-jZe9fteF.js} +6 -6
- package/chunk/{stepComponentHelpers-IolnFznH.js.map → stepComponentHelpers-jZe9fteF.js.map} +1 -1
- package/chunk/strings-DWLVdUcm.js +4 -4
- package/chunk/sv-DRwY4shG.js +4 -4
- package/chunk/sw-Bvj2mYmM.js +4 -4
- package/chunk/ta-CmtaYoNe.js +4 -4
- package/chunk/th-12r2yKkJ.js +4 -4
- package/chunk/tl-BGNfO7md.js +4 -4
- package/chunk/tr-DH2ZSJhs.js +4 -4
- package/chunk/uk-CELBZlTd.js +4 -4
- package/chunk/ur-MR8DTbmd.js +4 -4
- package/chunk/{useCollectFieldsEndpoint-olPOcYoz.js → useCollectFieldsEndpoint-BzHmfuvW.js} +9 -9
- package/chunk/{useCollectFieldsEndpoint-olPOcYoz.js.map → useCollectFieldsEndpoint-BzHmfuvW.js.map} +1 -1
- package/chunk/{useCollectFieldsEndpoint-CvBJD-m5.js → useCollectFieldsEndpoint-DS_VOcED.js} +9 -9
- package/chunk/{useCollectFieldsEndpoint-CvBJD-m5.js.map → useCollectFieldsEndpoint-DS_VOcED.js.map} +1 -1
- package/chunk/useFocusOnMount-CM4T5Z88.js +18 -0
- package/chunk/{useFocusOnMount-B4gVB2JN.js.map → useFocusOnMount-CM4T5Z88.js.map} +1 -1
- package/chunk/{useFocusOnMount-B4gVB2JN.js → useFocusOnMount-CfNgS3Ag.js} +6 -6
- package/chunk/{useFocusOnMount-CoKIEDuF.js.map → useFocusOnMount-CfNgS3Ag.js.map} +1 -1
- package/chunk/{useFooterShieldSrc-CmKqak9A.js → useFooterShieldSrc-BbUsX_E3.js} +13 -13
- package/chunk/{useFooterShieldSrc-CmKqak9A.js.map → useFooterShieldSrc-BbUsX_E3.js.map} +1 -1
- package/chunk/{useFooterShieldSrc-CWTHh0Mk.js → useFooterShieldSrc-Ch42sUV8.js} +13 -13
- package/chunk/{useFooterShieldSrc-CWTHh0Mk.js.map → useFooterShieldSrc-Ch42sUV8.js.map} +1 -1
- package/chunk/{useMetrics-DKU_qdJm.js → useMetrics-CsJd9Mos.js} +7 -7
- package/chunk/{useMetrics-DKU_qdJm.js.map → useMetrics-CsJd9Mos.js.map} +1 -1
- package/chunk/{useMetrics-CK1qxUD4.js → useMetrics-Oeia1mNS.js} +7 -7
- package/chunk/{useMetrics-CK1qxUD4.js.map → useMetrics-Oeia1mNS.js.map} +1 -1
- package/chunk/{useOnMount-B3CK3L_o.js → useOnMount-D-FexEcU.js} +6 -6
- package/chunk/{useOnMount-B3CK3L_o.js.map → useOnMount-D-FexEcU.js.map} +1 -1
- package/chunk/{useOnMount-DTplONXt.js → useOnMount-IlmAw-W-.js} +6 -6
- package/chunk/{useOnMount-DTplONXt.js.map → useOnMount-IlmAw-W-.js.map} +1 -1
- package/chunk/vi-DtZ-SqD5.js +4 -4
- package/chunk/zh-DjyVyYac.js +4 -4
- package/chunk/zh-HK-CN1HarHq.js +4 -4
- package/chunk/zu-DPhgIh1z.js +4 -4
- package/package.json +1 -1
- package/sheerid-install.css +4 -4
- package/sheerid-install.js +4 -4
- package/sheerid.css +5 -5
- package/sheerid.js +1479 -1348
- package/sheerid.js.map +1 -1
- package/chunk/CaptchaComponent-CELn5byp.js.map +0 -1
- package/chunk/CaptchaComponent-jgmYS8PD.js.map +0 -1
- package/chunk/LowRewardPoolNote-CAcUOjXU.js.map +0 -1
- package/chunk/LowRewardPoolNote-D53DGp7d.js.map +0 -1
- package/chunk/Message-BJpuZuCw.js.map +0 -1
- package/chunk/Message-CCPUNbvb.js.map +0 -1
- package/chunk/PersonalInfoStepSubmitButton-Bkfehzde.js +0 -142
- package/chunk/PersonalInfoStepSubmitButton-Bkfehzde.js.map +0 -1
- package/chunk/PersonalInfoStepSubmitButton-vKWA-7OM.js +0 -138
- package/chunk/PersonalInfoStepSubmitButton-vKWA-7OM.js.map +0 -1
- package/chunk/PersonalInfoStepWrapper-CO1Ai4CL.js +0 -53
- package/chunk/PersonalInfoStepWrapper-CO1Ai4CL.js.map +0 -1
- package/chunk/PersonalInfoStepWrapper-XIy5r6WD.js +0 -85
- package/chunk/PersonalInfoStepWrapper-XIy5r6WD.js.map +0 -1
- package/chunk/StepAgePersonalInfo-B_rJGRgX.js +0 -177
- package/chunk/StepAgePersonalInfo-B_rJGRgX.js.map +0 -1
- package/chunk/StepAgePersonalInfo-DJPM2PJz.js +0 -173
- package/chunk/StepAgePersonalInfo-DJPM2PJz.js.map +0 -1
- package/chunk/StepCollectIdentifier-D3Enfb3G.js +0 -62
- package/chunk/StepCollectIdentifier-D3Enfb3G.js.map +0 -1
- package/chunk/StepCollectIdentifier-DJsPPf_t.js +0 -66
- package/chunk/StepCollectIdentifier-DJsPPf_t.js.map +0 -1
- package/chunk/StepCollectMilitaryPersonalInfoComponent-CZaentAm.js +0 -250
- package/chunk/StepCollectMilitaryPersonalInfoComponent-CZaentAm.js.map +0 -1
- package/chunk/StepCollectMilitaryPersonalInfoComponent-Cd25YUFV.js +0 -246
- package/chunk/StepCollectMilitaryPersonalInfoComponent-Cd25YUFV.js.map +0 -1
- package/chunk/StepCollectPersonalInfo-BPw22iU2.js +0 -380
- package/chunk/StepCollectPersonalInfo-BPw22iU2.js.map +0 -1
- package/chunk/StepCollectPersonalInfo-PbZ_Lh5v.js +0 -384
- package/chunk/StepCollectPersonalInfo-PbZ_Lh5v.js.map +0 -1
- package/chunk/StepDocUpload-DAI4hd-K.js.map +0 -1
- package/chunk/StepDocUpload-DXj4mEM6.js.map +0 -1
- package/chunk/StepDriverLicensePersonalInfoComponent-CyWd-3C8.js +0 -144
- package/chunk/StepDriverLicensePersonalInfoComponent-CyWd-3C8.js.map +0 -1
- package/chunk/StepDriverLicensePersonalInfoComponent-DQzI18NJ.js +0 -148
- package/chunk/StepDriverLicensePersonalInfoComponent-DQzI18NJ.js.map +0 -1
- package/chunk/StepEmploymentPersonalInfo-BVeVxEtT.js +0 -222
- package/chunk/StepEmploymentPersonalInfo-BVeVxEtT.js.map +0 -1
- package/chunk/StepEmploymentPersonalInfo-DRdFErAM.js +0 -218
- package/chunk/StepEmploymentPersonalInfo-DRdFErAM.js.map +0 -1
- package/chunk/StepFirstResponderPersonalInfo-DYbPTeIq.js +0 -186
- package/chunk/StepFirstResponderPersonalInfo-DYbPTeIq.js.map +0 -1
- package/chunk/StepFirstResponderPersonalInfo-kH-D-gpm.js +0 -182
- package/chunk/StepFirstResponderPersonalInfo-kH-D-gpm.js.map +0 -1
- package/chunk/StepGeneralIdentityPersonalInfoComponent-BF7dYmjn.js +0 -177
- package/chunk/StepGeneralIdentityPersonalInfoComponent-BF7dYmjn.js.map +0 -1
- package/chunk/StepGeneralIdentityPersonalInfoComponent-DjEZH38x.js +0 -181
- package/chunk/StepGeneralIdentityPersonalInfoComponent-DjEZH38x.js.map +0 -1
- package/chunk/StepHybridIdentityPersonalInfoComponent-8Om7yEMT.js +0 -186
- package/chunk/StepHybridIdentityPersonalInfoComponent-8Om7yEMT.js.map +0 -1
- package/chunk/StepHybridIdentityPersonalInfoComponent-D9Je6yj-.js +0 -190
- package/chunk/StepHybridIdentityPersonalInfoComponent-D9Je6yj-.js.map +0 -1
- package/chunk/StepLicensedProfessionalPersonalInfo-AGQwXrgt.js +0 -182
- package/chunk/StepLicensedProfessionalPersonalInfo-AGQwXrgt.js.map +0 -1
- package/chunk/StepLicensedProfessionalPersonalInfo-ChdI7Jgm.js +0 -178
- package/chunk/StepLicensedProfessionalPersonalInfo-ChdI7Jgm.js.map +0 -1
- package/chunk/StepLowIncomePersonalInfo-Cl_eJwaC.js +0 -236
- package/chunk/StepLowIncomePersonalInfo-Cl_eJwaC.js.map +0 -1
- package/chunk/StepLowIncomePersonalInfo-DJjuE6iI.js +0 -232
- package/chunk/StepLowIncomePersonalInfo-DJjuE6iI.js.map +0 -1
- package/chunk/StepMedicalProfessionalPersonalInfo-CmAOUKJB.js +0 -209
- package/chunk/StepMedicalProfessionalPersonalInfo-CmAOUKJB.js.map +0 -1
- package/chunk/StepMedicalProfessionalPersonalInfo-snvlB1q5.js +0 -213
- package/chunk/StepMedicalProfessionalPersonalInfo-snvlB1q5.js.map +0 -1
- package/chunk/StepMemberPersonalInfo-CdX8LAGC.js +0 -160
- package/chunk/StepMemberPersonalInfo-CdX8LAGC.js.map +0 -1
- package/chunk/StepMemberPersonalInfo-PxKH7YN4.js +0 -156
- package/chunk/StepMemberPersonalInfo-PxKH7YN4.js.map +0 -1
- package/chunk/StepMoverPersonalInfo-MYGnyYc-.js +0 -147
- package/chunk/StepMoverPersonalInfo-MYGnyYc-.js.map +0 -1
- package/chunk/StepMoverPersonalInfo-u_-Eve-G.js +0 -143
- package/chunk/StepMoverPersonalInfo-u_-Eve-G.js.map +0 -1
- package/chunk/StepSSO-CybtMBjF.js +0 -12
- package/chunk/StepSSO-pglHGWRO.js +0 -8
- package/chunk/StepStudentPersonalInfo-Bb2UFiSf.js +0 -237
- package/chunk/StepStudentPersonalInfo-Bb2UFiSf.js.map +0 -1
- package/chunk/StepStudentPersonalInfo-BrV5nUQm.js +0 -233
- package/chunk/StepStudentPersonalInfo-BrV5nUQm.js.map +0 -1
- package/chunk/StepTeacherPersonalInfo-8xYbzOQu.js +0 -153
- package/chunk/StepTeacherPersonalInfo-8xYbzOQu.js.map +0 -1
- package/chunk/StepTeacherPersonalInfo-aiSuLSkE.js +0 -157
- package/chunk/StepTeacherPersonalInfo-aiSuLSkE.js.map +0 -1
- package/chunk/StepThirdPartyLoop-Bl9PW1-v.js +0 -8
- package/chunk/StepThirdPartyLoop-Cs_tIVeY.js +0 -12
- package/chunk/countryUtils-SAP2nHeP.js +0 -12
- package/chunk/empties-D2KXGsVY.js.map +0 -1
- package/chunk/hooks-Cjcd--GE.js.map +0 -1
- package/chunk/hooks-D72YoqAe.js.map +0 -1
- package/chunk/tslib.es6-BjMMQAso.js +0 -149
- package/chunk/tslib.es6-BjMMQAso.js.map +0 -1
- package/chunk/tslib.es6-DBUmCTli.js +0 -153
- package/chunk/tslib.es6-DBUmCTli.js.map +0 -1
- package/chunk/useFocusOnMount-CoKIEDuF.js +0 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputSelectComponent-xKOg0Mfy.js","names":["platform","popupOpen","pressed","CommonTriggerDataAttributes.popupOpen","CommonTriggerDataAttributes.pressed","CommonPopupDataAttributes.open","CommonPopupDataAttributes.closed","CommonPopupDataAttributes.anchorHidden","platform.os.android","platform.env.jsdom","getComputedStyle","getComputedStyle","useSyncExternalStore","useSyncExternalStoreWithSelector","platform.screenReader.voiceOver","platform.engine.webkit","ownerWindow","REASONS.focusOut","platform.engine.webkit","REASONS.triggerPress","outsidePress","REASONS.triggerPress","escapeKey","REASONS.escapeKey","platform.engine.webkit","getComputedStyle","REASONS.outsidePress","computePosition","flip","offset","shift","limitShift","size","offset","shift","flip","size","limitShift","useLayoutEffect","offset$1","shift$1","limitShift$1","flip$1","size$1","selectors","usePosition","platform.engine.webkit","REASONS.listNavigation","REASONS.focusOut","_formatErrorMessage","platform.os.ios","getComputedStyle","_formatErrorMessage","REASONS.inputClear","REASONS.inputChange","REASONS.itemPress","REASONS.none","REASONS.inputPress","REASONS.keyboard","REASONS.pointer","CommonTriggerDataAttributes.popupOpen","CommonTriggerDataAttributes.pressed","ComboboxInputDataAttributes.popupSide","ComboboxInputDataAttributes.listEmpty","_formatErrorMessage","REASONS.closePress","ComboboxInput","REASONS.none","REASONS.keyboard","REASONS.pointer","platform.os.android","REASONS.inputChange","REASONS.inputClear","platform.engine.gecko","REASONS.escapeKey","REASONS.inputPress","ownerWindow","platform.env.jsdom","ComboboxTrigger","REASONS.none","REASONS.cancelOpen","REASONS.listNavigation","ComboboxList","platform.os.ios","_formatErrorMessage","CommonPositionerCssVars.availableWidth","CommonPositionerCssVars.availableHeight","shift","floatingShift","ownerWindow","anchorWidth","anchorHeight","CommonPositionerCssVars.anchorWidth","CommonPositionerCssVars.anchorHeight","CommonPositionerCssVars.transformOrigin","ownerWindow","platform.engine.webkit","platform.os.ios","stateAttributesMapping","_formatErrorMessage","ComboboxItem","ComboboxChips","ComboboxEmpty","ComboboxClear","REASONS.keyboard","REASONS.pointer","REASONS.clearPress","ComboboxPrimitive.Root","ComboboxPrimitive.Trigger","ChevronDownIcon","ComboboxPrimitive.Clear","XIcon","ComboboxPrimitive.Input","ComboboxPrimitive.Portal","ComboboxPrimitive.Positioner","ComboboxPrimitive.Popup","ComboboxPrimitive.List","ComboboxPrimitive.Item","ComboboxPrimitive.ItemIndicator","CheckIcon","ComboboxPrimitive.Empty","ComboboxPrimitive.Chips","useState","useRef","_Fragment","__toESM","require_react","require_jsx_runtime","useMessage","require_with_selector","require_shim","require_react_dom","setRef","isTableElement","getAxisLength","isContainingBlock","isNode","isLastTraversableNode","evaluate","getPaddingObject","getOppositeAxis","floor","max","getSide","getAlignment","isWebKit","clamp","isOverflowElement","createCoords","getAlignmentAxis","getWindow","isHTMLElement","getOppositeAxisPlacements","getExpandedPlacements","getOppositePlacement","rectToClientRect","min","round","getFrameElement","getOverflowAncestors","getDocumentElement","getContainingBlock","useDirection","isTopLayer","isShadowRoot","getComputedStyle$1","LoadingSpinnerComponent","getSideAxis","usePortalContainer","getNodeName","isElement","getParentNode","getNodeScroll","getAlignmentSides","cva","EMPTY_OBJECT","useIsoLayoutEffect","mergeProps","formatErrorMessage","cn","isReactVersionAtLeast","useMergedRefs","useRefWithInit","useId","useRenderElement","pointer","clearPress","useStableCallback","focusOut","inputPress","itemPress","outsidePress","none","cancelOpen","NOOP","EMPTY_ARRAY","inputChange","listNavigation","createChangeEventDetails","closePress","keyboard","createGenericEventDetails","escapeKey","inputClear","useControlled","useBaseUiId","triggerPress","activeElement","useValueChanged","useFormContext","useRegisterFieldControl","DEFAULT_FIELD_STATE_ATTRIBUTES","useFieldRootContext","useTimeout","useLabelableId","FieldRootContext","contains","DEFAULT_FIELD_ROOT_CONTEXT","Timeout","getTarget","Input","useLabelableContext","fieldValidityMapping","ownerDocument","useButton","Button","createLucideIcon","useOpenChangeComplete","resolveRef","ChevronDown","useAnimationFrame","useValueAsRef","transitionStatusMapping","AnimationFrame","X","useTransitionStatus","addEventListener","import_react","import_shim","import_with_selector","visuallyHiddenBase","visuallyHidden","visuallyHiddenInput","__iconData","Check","readRawData","platform$1","lowerUserAgent","userAgent","lowerPlatform","ios","maxTouchPoints","ANDROID_STRING","android","mac","apple","webkit","gecko","voiceOver","jsdom","import_jsx_runtime","FOCUSABLE_ATTRIBUTE","TYPEABLE_SELECTOR","ARROW_LEFT","ARROW_RIGHT","ARROW_UP","ARROW_DOWN","import_react_dom","open","closed","anchorHidden","popupOpen$1","pressed$1","TRIGGER_HOOK","PRESSABLE_TRIGGER_HOOK","POPUP_OPEN_HOOK","POPUP_CLOSED_HOOK","ANCHOR_HIDDEN_HOOK","triggerOpenStateMapping","value","pressableTriggerOpenStateMapping","popupStateMapping","isEventTargetWithin","node","event","eventAgain","isRootElement","element","isTypeableElement","isInteractiveElement","isTypeableCombobox","getFloatingFocusElement","floatingElement","getNodeChildren","nodes","id","onlyOpenChildren","child","getNodeAncestors","allAncestors","currentParentId","currentNode","stopEvent","isReactEvent","isVirtualClick","isVirtualPointerEvent","isMouseLikePointerType","values","strict","pointerType","isClickLikeEvent","type","isDifferentGridRow","index","cols","prevRow","isIndexOutOfListBounds","list","getMinListIndex","findNonDisabledListIndex","listRef","getMaxListIndex","startingIndex","decrement","amount","isListIndexDisabled","disabledIndices","getGridNavigatedIndex","stop","nextIndex","prevIndex","verticalDirection","rows","rowIndexMap","hasRoleRow","visibleItemCount","currentRowEl","currentRowIndex","el","rowEl","idx","hasDomRows","inferredDomCols","row","rowLength","hasVirtualizedGaps","verticalCols","navigateVertically","currentRow","colInRow","step","direction","nextRow","i","loopFocus","onLoop","clampedCol","returnedItemIndex","targetRow","col","candidate","navigateVerticallyWithInferredRows","rowStep","lastRowStart","maxIndex","rowCount","rowStart","rowEnd","verticalCandidate","minIndex","maxCol","offset","orientation","rtl","lastRow","isElementVisible","isHiddenByStyles","styles","CANDIDATE_SELECTOR","getParentElement","assignedSlot","rootNode","getDetailsSummary","details","isWithinOpenDetailsSummary","summary","isFocusableCandidate","nodeName","isFocusableElement","current","isAncestor","isSlot","isVisibleInTabbableTree","getTabIndex","tabIndex","getNamedRadioInput","input","isTabbableRadio","checkedRadio","candidates","radio","getComposedChildren","container","assignedElements","appendCandidates","appendMatchingElements","selector","isTabbable","focusable","tabbable","getTabbableIn","len","active","dir","getNextTabbable","referenceElement","getPreviousTabbable","isOutsideEvent","containerElement","relatedTarget","disableFocusInside","enableFocusInside","elements","tabindex","useOnFirstRender","ref","fn","hooks","currentInstance","getInstance","register","hook","useStoreImplementation","useStoreFast","useStoreLegacy","useStore","store","a1","a2","a3","useStoreR19","getSelection","instance","didChange","stores","unsubscribes","onStoreChange","unsubscribe","state","Store","newState","currentTick","listener","key","changes","ReactStore","context","selectors","dependencies","statePart","isControlled","controlled","stableFunction","selectFn","prevValue","nextValue","nextState","oldValue","mergeCleanups","cleanups","cleanup","FocusGuard","role","setRole","restProps","props","createAttribute","name","rafId","enqueueFocus","options","exec","shouldFocus","sync","currentRafId","counters","markerName","uncontrolledElementsSets","markerCounterMap","lockCount","getUncontrolledElementsSet","controlAttribute","unwrapHost","correctElements","targets","parent","target","correctedTarget","x","buildKeepSet","keep","collectOutsideElements","outside","walk","keepElements","root","applyAttributeToOthers","inert","ariaHidden","counterMap","uncontrolledElementsSet","avoidElements","body","uncorrectedAvoidElements","markerTargets","mark","hiddenElements","markedElements","map","currentUncontrolledElementsSet","ariaLiveElements","controlElements","attr","alreadyHidden","counterValue","markerValue","markOthers","DISABLED_TRANSITIONS_STYLE","DROPDOWN_COLLISION_AVOIDANCE","ownerVisuallyHidden","PortalContext","usePortalContext","useFloatingPortalNode","containerProp","uniqueId","parentPortalNode","setContainerElement","portalNode","setPortalNode","setPortalNodeRef","containerRef","resolvedContainer","portalElement","componentProps","elementProps","portalSubtree","FloatingPortal","portalNodeId","forwardedRef","beforeOutsideRef","afterOutsideRef","beforeInsideRef","afterInsideRef","focusManagerState","setFocusManagerState","focusInsideDisabledRef","modal","shouldRenderGuards","onFocus","portalContextValue","portalOwnerRole","children","createEventEmitter","data","FloatingNodeContext","FloatingTreeContext","useFloatingParentNodeId","useFloatingTree","contextTree","externalTree","getEventType","win","lastInteractionType","LIST_LIMIT","previouslyFocusedElements","clearDisconnectedPreviouslyFocusedElements","entry","addPreviouslyFocusedElement","getPreviouslyFocusedElement","getFirstTabbableElement","handleTabIndex","floatingFocusElement","tabbableContent","dataTabIndex","FloatingFocusManager","domReference","floating","getNodeId","dataRef","ignoreInitialFocus","initialFocus","isUntrappedTypeableCombobox","initialFocusRef","returnFocusRef","returnFocus","openInteractionTypeRef","openInteractionType","openRef","tree","portalContext","preventReturnFocusRef","isPointerDownRef","pointerDownOutsideRef","lastFocusedTabbableRef","closeTypeRef","lastInteractionTypeRef","beforeGuardRef","afterGuardRef","mergedBeforeGuardRef","beforeContentFocusGuardRef","mergedAfterGuardRef","blurTimeout","pointerDownTimeout","restoreFocusFrame","isInsidePortal","getTabbableContent","getResolvedInsideElements","getInsideElements","disabled","onKeyDown","doc","clearPointerDownOutside","onPointerDown","insideElements","pointerTargetInside","closeOnFocusOut","handlePointerDown","handleFocusIn","handleFocusOutside","currentTarget","nodeId","triggers","isRelatedFocusGuard","previousFocusableElement","nextFocusableElement","movedToUnrelatedNode","trigger","restoreFocus","prevTabbable","nodeToFocus","markInsideReactTree","domReferenceElement","portalNodes","rootAncestorComboboxDomReference","ariaHiddenCleanup","markerCleanup","previouslyFocusedElement","initialFocusValueOrFn","resolvedInitialFocus","focusableElements","getDefaultFocusElement","elToFocus","hadFocusInside","currentActiveElement","elementFocusedBeforeOpen","preferPreviousFocus","onOpenChangeLocal","isPreventScrollSupported","getReturnElement","returnFocusValueOrFn","resolvedReturnFocusValue","closeType","referenceReturnElement","previousReturnElement","defaultReturnElement","activeEl","isFocusInsideFloatingTree","returnElement","tabbableReturnElement","hasExplicitReturnFocus","focusOptions","events","els","useClick","eventOption","pointerTypeRef","frame","touchOpenTimeout","reference","setOpenWithTouchDelay","reason","nativeEvent","nextOpen","touchOpenDelay","getNextOpen","openEvent","hasClickedOnInactiveTrigger","toggle","stickIfOpen","isClickLikeOpenEvent","ignoreMouse","openEventType","eventCurrentTarget","enabled","alwaysFalse","normalizeProp","normalizable","useDismiss","escapeKey$1","outsidePressProp","outsidePressFn","outsidePress$1","outsidePressEnabled","getOutsidePressEventProp","outsidePressEvent","escapeKeyBubbles","outsidePressBubbles","bubbles","pressStartedInsideRef","pressStartPreventedRef","suppressNextOutsideClickRef","sawPressWhileOpenRef","isComposingRef","currentPointerTypeRef","touchStateRef","cancelDismissOnEndTimeout","clearInsideReactTreeTimeout","clearInsideReactTree","hasBlockingChild","bubbleKey","isEventWithinOwnElements","closeOnReferencePress","referencePress","closeOnEscapeKeyDown","native","eventDetails","markPressStartedInsideReactTree","markInsidePressStartPrevented","handleOpenChange","compositionTimeout","preventedPressSuppressionTimeout","handleCompositionStart","handleCompositionEnd","suppressImmediateOutsideClickAfterPreventedStart","resetPressStartState","getOutsidePressEvent","computedType","outsidePressEventValue","resolved","shouldIgnoreEvent","computedOutsidePressEvent","isEventWithinFloatingTree","targetIsInsideChildren","closeOnPressOutside","inertSelector","targetRoot","markers","targetRootAncestor","nextParent","marker","lastTraversableNode","style","scrollRe","isScrollableX","isScrollableY","canScrollX","canScrollY","isRTL","pressedVerticalScrollbar","pressedHorizontalScrollbar","handleTouchStart","touch","addTargetEventListenerOnce","handleTouchStartCapture","closeOnPressOutsideCapture","targetEvent","handlePressEndCapture","pressStartedInsideDefaultPrevented","handleTouchMove","deltaX","deltaY","distance","handleTouchMoveCapture","handleTouchEnd","handleTouchEndCapture","computeCoordsFromPlacement","_ref","sideAxis","placement","alignmentAxis","alignLength","side","isVertical","commonX","commonY","commonAlign","coords","alignment","detectOverflow","paddingObject","padding","altBoundary","elementContext","clippingClientRect","platform","rect","rects","offsetParent","offsetScale","elementClientRect","MAX_RESET_COUNT","computePosition$1","config","platformWithDetectOverflow","statefulPlacement","resetCount","middlewareData","middleware","currentMiddleware","nextX","nextY","y","reset","flip$1","_middlewareData$arrow","checkMainAxis","checkCrossAxis","specifiedFallbackPlacements","detectOverflowOptions","initialSideAxis","initialPlacement","isBasePlacement","fallbackPlacements","flipAlignment","hasFallbackAxisSideDirection","fallbackAxisSideDirection","placements","overflow","overflows","overflowsData","sides","nextPlacement","d","resetPlacement","a","b","fallbackStrategy","currentSideAxis","acc","originSides","convertValueToCoords","mainAxisMulti","crossAxisMulti","rawValue","crossAxis","mainAxis","offset$1","diffCoords","shift$1","mainAxisCoord","crossAxisCoord","clampCoord","coord","axis","limitedCoords","limiter","limitShift$1","rawOffset","computedOffset","limitMin","limitMax","isOriginSide","size$1","isYAxis","heightSide","widthSide","maximumClippingHeight","height","maximumClippingWidth","width","overflowAvailableHeight","overflowAvailableWidth","shiftData","noShift","availableHeight","availableWidth","apply","nextDimensions","getCssDimensions","css","hasOffset","offsetWidth","offsetHeight","shouldFallback","unwrapElement","getScale","domElement","$","noOffsets","getVisualOffsets","shouldAddVisualOffsets","isFixed","floatingOffsetParent","getBoundingClientRect","includeScale","isFixedStrategy","clientRect","scale","visualOffsets","offsetWin","currentWin","currentIFrame","iframeScale","iframeRect","left","top","getWindowScrollBarX","leftScroll","getHTMLOffset","htmlRect","documentElement","scroll","convertOffsetParentRelativeRectToViewportRelativeRect","strategy","topLayer","offsets","isOffsetParentAnElement","offsetRect","htmlOffset","getClientRects","getDocumentRect","html","SCROLLBAR_MAX","getViewportRect","rootBoundary","isLayoutViewport","visualViewport","layoutRelativeClientCoords","bodyStyles","bodyMarginInline","reservedWidth","gutter","getInnerBoundingClientRect","getClientRectFromClippingAncestor","clippingAncestor","getClippingElementAncestors","cachedResult","cache","result","lastKeptComputedStyle","elementIsFixed","computedStyle","currentNodeIsContaining","lastPosition","ancestor","getClippingRect","clippingAncestors","boundary","firstRect","right","bottom","getDimensions","getRectRelativeToOffsetParent","isStaticPositioned","getTrueOffsetParent","polyfill","rawOffsetParent","getOffsetParent","svgOffsetParent","getElementRects","getOffsetParentFn","getDimensionsFn","floatingDimensions","rectsAreEqual","observeMove","io","timeoutId","_io","refresh","skip","threshold","elementRectForRootMargin","onMove","insetTop","insetRight","insetBottom","insetLeft","isFirstUpdate","handleObserve","ratio","entries","handleResize","ancestorResize","autoUpdate","referenceEl","ancestors","ancestorScroll","update","cleanupIo","layoutShift","reobserveFrame","resizeObserver","elementResize","firstEntry","_resizeObserver","animationFrame","frameId","prevRefRect","frameLoop","nextRefRect","_resizeObserver2","offset$2","shift$2","flip$2","size$2","limitShift$2","computePosition","mergedOptions","platformWithCache","deepEqual","length","keys","getDPR","roundByDPR","dpr","useLatestRef","useFloating","externalReference","externalFloating","setData","latestMiddleware","setLatestMiddleware","_reference","_setReference","_floating","_setFloating","setReference","referenceRef","setFloating","floatingRef","floatingEl","hasWhileElementsMounted","whileElementsMounted","whileElementsMountedRef","platformRef","fullData","isMountedRef","refs","floatingStyles","initialStyles","transform","deps","shift","limitShift","flip","size","selectors$1","FloatingRootStore","initialState","syncOnly","newOpen","FOCUSABLE_POPUP_PROPS","PopupTriggerMap","registered","predicate","useFloatingRootContext","floatingId","nested","valuesToSync","onOpenChange","useBaseUIFloating","useFloatingWithStore","positionReference","setPositionReferenceRaw","localDomReference","setLocalDomReference","localFloatingElement","setLocalFloatingElement","domReferenceRef","storeElements","position","localDomReferenceElement","syncedFloatingElement","setPositionReference","computedPositionReference","n","ESCAPE","isStationaryWebKitPointer","doSwitch","vertical","horizontal","isMainOrientationKey","isMainOrientationToEndKey","isCrossOrientationOpenKey","isCrossOrientationCloseKey","grid","useListNavigation","onNavigateProp","navigateGrid","isGrid","typeableComboboxReference","floatingFocusElementRef","parentId","focusItemOnOpenRef","focusItemOnOpen","indexRef","selectedIndex","keyRef","isPointerModalityRef","onNavigate","previousMountedRef","previousOpenRef","forceSyncFocusRef","forceScrollIntoViewRef","cancelQueuedFocusRef","disabledIndicesRef","latestOpenRef","selectedIndexRef","resetOnPointerLeaveRef","resetOnPointerLeave","focusFrame","waitForListPopulatedFrame","focusItem","runFocus","virtual","item","initialItem","forceScrollIntoView","callback","waitedItem","activeIndex","runs","waitForListPopulated","treeContainsActiveEl","hasActiveIndex","syncCurrentTarget","getParentOrientation","parentOrientation","getMinEnabledIndex","commonOnKeyDown","currentIndex","allowEscape","focusItemOnHover","floatingFocusEl","ariaActiveDescendantProp","openOnNavigationKeyDown","checkVirtualMouse","checkVirtualPointer","currentOpen","isArrowKey","isParentCrossOpenKey","isMainKey","isNavigationKey","openOnArrowKeyDown","isParentMainKey","useTypeahead","onMatchProp","timeout","stringRef","prevIndexRef","matchIndexRef","getElement","elementsRef","isItemAvailable","getMatchingIndex","normalizedStartIndex","startIndex","lowerString","string","listContent","onTyping","isNewSession","text","resetMs","onBlur","next","currentDomReferenceElement","currentFloatingElement","sharedProps","gridNavigation","ComboboxRootContext","ComboboxFloatingContext","ComboboxDerivedItemsContext","ComboboxHasItemsContext","ComboboxInputValueContext","useComboboxRootContext","useComboboxFloatingContext","useComboboxDerivedItemsContext","useComboboxInputValueContext","useComboboxHasItemsContext","areArraysEqual","array1","array2","itemComparer","defaultItemEquality","itemValue","selectedValue","compareItemEquality","comparer","isSelectedValueDirty","currentValue","initialValue","initialItemValue","selectedValueIncludes","selectedValues","findItemIndex","itemValues","createSelectionMatcher","v","findSelectionIndex","multiple","resolveSelectedIndex","registry","removeItem","serializeValue","isGroup","isGroupedItems","items","flattenLeafItems","group","hasNullItemLabel","arrayItems","stringifyAsLabel","itemToStringLabel","stringifyAsValue","itemToStringValue","selectionMode","selectedItem","getComboboxPopupId","rootId","createCollatorItemFilter","collatorFilter","query","stringifyLocale","locale","filterCache","getFilter","cacheKey","cachedFilter","collator","filter","itemString","itemToString","queryLength","useCoreFilter","useEnhancedClickHandler","lastClickInteractionTypeRef","handler","useOpenMethodTriggerProps","setOpenMethod","interactionType","onClick","useOpenInteractionType","openMethod","triggerProps","previousOpen","overflowY","allowOverflowIntent","NO_ACTIVE_VALUE","INITIAL_LAST_HIGHLIGHT","findCollectionItem","exactItem","valueToItem","isEqual","derivedValue","AriaCombobox","idProp","onOpenChangeCompleteProp","selectedValueProp","inputValueProp","openProp","onItemHighlightedProp","nameProp","disabledProp","inputRefProp","itemsProp","filteredItemsProp","filterProp","filterQueryProp","itemToStringLabelProp","inlineProp","fieldName","fieldDisabled","collection","itemToValue","storeItems","externalWindow","flat","isItemEqualToValue","externalItem","unresolvedValue","filterItemToString","stringifyValueLabel","queryChangedAfterOpen","setQueryChangedAfterOpen","closeQuery","setCloseQuery","previousCloseQueryRef","labelsRef","popupRef","inputRef","startDismissRef","endDismissRef","emptyRef","keyboardActiveRef","hadInputClearRef","chipsContainerRef","clearRef","selectionEventRef","lastHighlightRef","pendingQueryHighlightRef","valuesRef","pointerDownItemRef","single","hasInputValue","defaultInputValue","hasItems","hasFilteredItemsProp","autoHighlightMode","autoHighlight","setSelectedValueUnwrapped","defaultSelectedValue","initialDefaultInputValue","inputValue","setInputValueUnwrapped","setOpenUnwrapped","defaultOpen","isGrouped","selectedLabelString","shouldBypassFiltering","filterQuery","shouldIgnoreExternalFiltering","flatItems","filteredItems","groupedItems","resultingGroups","currentCount","limit","remainingLimit","itemsToTake","newGroup","limitedItems","flatFilteredValues","initialSelectedIndex","fieldRawValue","fieldStringValue","onItemHighlighted","onOpenChangeComplete","positionerElement","listElement","triggerElement","inputElement","inputGroupElement","inline","inputInsidePopup","inputOwnsFormValue","inputMatchesSelectedValue","triggerRef","getStringifiedValueForForm","forceMount","emitHighlight","setIndices","activeIndexOption","setInputValue","inputType","hasQuery","popup","handleInterruptedReopen","clearsPendingInput","isInputChange","setOpen","setTouched","setFocused","validationMode","valueToValidate","setSelectedValue","onSelectedValueChange","fillInputOnItemPress","handleSelection","targetEl","overrideEvent","href","currentSelectedValue","isCurrentlySelected","pendingHighlight","requestSubmit","formElement","validation","handleUnmount","setMounted","stringVal","resolvedPopupRef","closeQueryReleased","listIsNavigable","clearedBySelection","isMultiple","toggledIndex","candidateItems","storeActiveIndex","previouslyHighlightedItemValue","isSameItem","setFilled","handleQueryChanged","handleOpenChanged","syncedSelectedLabel","syncInputToSelectedLabel","handleSelectedValueChanged","clearErrors","setDirty","validityData","syncInputAfterItemsOrLabelChange","handleInputValueChanged","floatingRootContext","ariaHasPopup","expanded","ariaExpanded","isPlainInput","shouldTreatAsInput","shouldApplyAria","readOnly","autoComplete","click","openOnInputClick","dismiss","highlightItemOnHover","keepHighlight","transitionStatus","nextActiveIndex","inputProps","popupProps","listProps","itemProps","listNavigationItemProps","syncedValues","hiddenInputRef","itemsContextValue","serializedValue","hasMultipleSelection","hiddenInputName","hiddenInputs","currentSerializedValue","form","nextValueLower","findSerializedMatchIndex","handleChange","matchingIndex","renderedLabel","matchingValue","formAutoComplete","required","ComboboxRoot","other","defaultValue","onValueChange","resolveAriaLabelledBy","fieldLabelId","localLabelId","popupSide","listEmpty","triggerStateAttributesMapping","empty","ComboboxChipsContext","useComboboxChipsContext","ComboboxPositionerContext","useComboboxPositionerContext","optional","ComboboxInternalDismissButton","mergedRef","buttonRef","handleDismiss","dismissProps","getButtonProps","usePopupSide","mounted","useListEmpty","getChipNavigationKeys","getIndexAfterChipRemoval","chipCount","clickHighlightedItem","listItem","ComboboxInput$1","fieldState","comboboxChipsContext","hasPositionerParent","comboboxDisabled","autoHighlightEnabled","isInsidePopup","focusManagerModal","fieldStateForInput","composingValue","setComposingValue","lastActiveIndexRef","shouldRestoreActiveIndexRef","setInputElement","nextIsInsidePopup","validationProps","clearHighlight","markPointerActive","handleKeyDown","renderedChipsCount","previousChipKey","nextChipKey","highlightedChipIndex","autofillLikeInput","shouldOpenOnInput","maybeOpenOnInput","trimmed","nextVal","shouldMaintainHighlight","inputChangeDetails","clearDetails","scrollAmount","cursor","isClear","removalIndex","newValue","hadHighlightedChip","renderedInput","handleInputPress","targetElement","BOUNDARY_OFFSET","isMouseWithinBounds","bounds","getPseudoElementBounds","elementRect","beforeStyles","afterStyles","beforeWidth","beforeHeight","afterWidth","afterHeight","totalWidth","totalHeight","widthDiff","heightDiff","ComboboxTrigger$1","storedPopupId","comboboxLabelId","hasSelectedValue","focusTimeout","ariaLabelledBy","ariaControls","trackPointerType","triggerTypeaheadProps","nextSelectedValue","triggerClickProps","nativeButton","setTriggerElement","handleMouseUp","currentTriggerElement","mouseUpTarget","mouseEvent","positioner","GroupCollectionContext","useGroupCollectionContext","ComboboxCollection","groupContext","itemsToRender","CompositeListContext","useCompositeListContext","CompositeList","onMapChangeProp","onMapChange","setMapTick","listeners","createListeners","createMap","nextIndexRef","isDirtyRef","itemsRef","mutationObserverRef","scheduleMapUpdate","tick","registration","unregister","syncRefs","nextMap","observe","sortedNodes","mutationObserver","hasMovedNode","previousConnectedNode","sortByDocumentPosition","roots","getCommonAncestor","flush","automaticNodes","getCompositeListSnapshot","previousItems","changed","previousItem","subscribeMapChange","contextValue","reservedIndices","automaticItems","nextAutomaticIndex","firstNode","lastNode","ComboboxList$1","_ComboboxCollection","hasPositionerContext","virtualized","forceMounted","setPositionerElement","setListElement","resolvedChildren","LIVE_REGION_MARKER","findLastTextNode","walker","lastTextNode","textNode","useInitialLiveRegionTextMutation","rootRef","originalValue","markedValue","ComboboxPortalContext","useComboboxPortalContext","ComboboxPortal","portalProps","keepMounted","inertValue","baseArrow","arrowDimensions","minProp","maxProp","clientProp","endDiff","startDiff","arrowOffsetParent","clientSize","centerToReference","largestPossiblePadding","minPadding","maxPadding","center","shouldAddOffset","alignmentOffset","arrow","hide","DEFAULT_SIDES","anchorWidth","anchorHeight","transformOrigin","AVAILABLE_WIDTH_VAR","AVAILABLE_HEIGHT_VAR","getLogicalSide","isLogicalSideParam","sideParam","isRtl","renderedSide","getOffsetData","useAnchorPositioning","useAnchorPositioningWithHook","params","collisionPaddingParam","inlineMiddleware","shift$3","mountSide","setMountSide","collisionAvoidanceSide","collisionAvoidance","collisionAvoidanceAlign","collisionAvoidanceFallbackAxisSide","shiftCrossAxis","shiftRootBoundary","anchorFn","anchor","anchorFnCallback","anchorDep","anchorValueRef","mountedRef","align","collisionPadding","biasTop","biasBottom","biasLeft","biasRight","commonCollisionProps","collisionBoundary","arrowRef","sideOffsetRef","sideOffset","alignOffsetRef","alignOffset","sideOffsetDep","alignOffsetDep","alignAxis","shiftDisabled","crossAxisShiftEnabled","sticky","flipMiddleware","shiftMiddleware","limitData","arrowSize","offsetAmount","floatingStyle","anchorWidth$1","anchorHeight$1","arrowPadding","renderedPlacement","renderedAlign","arrowEl","sideOffsetValue","crossOrigin","sideOrigin","adaptiveOrigin","autoUpdateOptions","disableAnchorTracking","originalFloatingStyles","useFloatingHook","positionMethod","args","resolvedPosition","isPositioned","base","sideX","sideY","registeredPositionReferenceRef","anchorValue","resolvedAnchor","finalAnchor","isRef","logicalRenderedSide","lazyFlip","arrowStyles","arrowUncentered","param","InternalBackdrop","otherProps","clipPath","cutout","getDisabledMountTransitionStyles","usePositioner","originalHtmlStyles","originalBodyStyles","originalHtmlScrollBehavior","getViewportScroller","isPageScrollLocked","hasInsetScrollbars","supportsStableScrollbarGutter","scrollContainer","originalScrollContainerOverflowY","originalHtmlStyleGutter","before","after","preventScrollOverlayScrollbars","elementToLock","originalElementToLockStyles","preventScrollInsetScrollbars","scrollTop","scrollLeft","updateGutterOnly","resizeFrame","lockScroll","htmlStyles","scrollbarGutterValue","hasConstantOverflowY","hasConstantOverflowX","scrollbarWidth","scrollbarHeight","marginY","marginX","unsubscribeResize","SCROLL_LOCKER","observer","hasOverlayScrollbars","useScrollLock","VIEWPORT_WIDTH_TOLERANCE_PX","useAnchoredPopupScrollLock","touchOpenShouldLockScroll","setTouchOpenShouldLockScroll","touchOpen","viewportWidth","popupWidth","ComboboxPositioner","styleProp","positioning","stateAttributesMapping$1","ComboboxPopup","popupId","resolvedFinalFocus","finalFocus","useCompositeListItem","externalIndex","internalIndex","setInternalIndex","guess","newIndex","componentRef","previousNode","metadata","label","textRef","ComboboxItemContext","useComboboxItemContext","ComboboxRowContext","useComboboxRowContext","ComboboxItemInner","indexProp","isRow","rootDisabled","selectable","indexFromFilter","hasRegistered","highlighted","matchesSelectedValue","itemRef","selected","visibleValues","commitSelection","selectItem","defaultProps","pointerStartedOnItem","ComboboxItemVirtualizedIndex","ComboboxItem$1","ComboboxItemIndicator","Inner","indicatorRef","ComboboxChips$1","hasSelectionChips","setHighlightedChipIndex","chipsRef","ComboboxEmpty$1","childrenProp","stateAttributesMapping","ComboboxClear$1","visible","InputGroup","className","inputGroupAddonVariants","InputGroupAddon","inputGroupButtonVariants","InputGroupButton","InputGroupInput","Combobox","ComboboxLabelContext","ComboboxTrigger","ComboboxClear","clearLabel","ComboboxInput","showTrigger","triggerLabel","showClear","ComboboxContent","portalContainer","labelledBy","ComboboxList","ComboboxItem","ComboboxEmpty","ComboboxLoading","matchesQuery","lowerQuery","option","isSameChoice","useFormSelectChoice","msg","InputSelectComponent","isOpen","setIsOpen","highlightedChoiceRef","selectedChoice","fieldId","typedText","match","onChange","clearProps","isClearable","choice","inputId","suppressPlaceholder","sizeToText","partLabel","ariaDescribedBy","isRequired","isErrored","startAdornment","isLoading"],"sources":["../../../node_modules/@base-ui/utils/visuallyHidden.mjs","../../../node_modules/lucide-react/dist/esm/icons/check.mjs","../../../node_modules/@base-ui/utils/platform/shared.mjs","../../../node_modules/@base-ui/utils/platform/os.mjs","../../../node_modules/@base-ui/utils/platform/engine.mjs","../../../node_modules/@base-ui/utils/platform/screen-reader.mjs","../../../node_modules/@base-ui/utils/platform/env.mjs","../../../node_modules/@base-ui/react/floating-ui-react/utils/constants.mjs","../../../node_modules/@base-ui/react/utils/CommonPopupDataAttributes.mjs","../../../node_modules/@base-ui/react/utils/CommonTriggerDataAttributes.mjs","../../../node_modules/@base-ui/react/utils/popupStateMapping.mjs","../../../node_modules/@base-ui/react/floating-ui-react/utils/element.mjs","../../../node_modules/@base-ui/react/floating-ui-react/utils/nodes.mjs","../../../node_modules/@base-ui/react/floating-ui-react/utils/event.mjs","../../../node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs","../../../node_modules/@base-ui/react/floating-ui-react/utils/tabbable.mjs","../../../node_modules/@base-ui/utils/useOnFirstRender.mjs","../../../node_modules/@base-ui/utils/fastHooks.mjs","../../../node_modules/@base-ui/utils/store/useStore.mjs","../../../node_modules/@base-ui/utils/store/Store.mjs","../../../node_modules/@base-ui/utils/store/ReactStore.mjs","../../../node_modules/@base-ui/utils/mergeCleanups.mjs","../../../node_modules/@base-ui/react/utils/FocusGuard.mjs","../../../node_modules/@base-ui/react/floating-ui-react/utils/createAttribute.mjs","../../../node_modules/@base-ui/react/floating-ui-react/utils/enqueueFocus.mjs","../../../node_modules/@base-ui/react/floating-ui-react/utils/markOthers.mjs","../../../node_modules/@base-ui/react/internals/constants.mjs","../../../node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs","../../../node_modules/@base-ui/react/floating-ui-react/utils/createEventEmitter.mjs","../../../node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs","../../../node_modules/@base-ui/react/floating-ui-react/components/FloatingFocusManager.mjs","../../../node_modules/@base-ui/react/floating-ui-react/hooks/useClick.mjs","../../../node_modules/@base-ui/react/floating-ui-react/hooks/useDismiss.mjs","../../../node_modules/@base-ui/react/node_modules/@floating-ui/core/dist/floating-ui.core.mjs","../../../node_modules/@base-ui/react/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs","../../../node_modules/@base-ui/react/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs","../../../node_modules/@base-ui/react/floating-ui-react/components/FloatingRootStore.mjs","../../../node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs","../../../node_modules/@base-ui/react/utils/popups/popupTriggerMap.mjs","../../../node_modules/@base-ui/react/floating-ui-react/hooks/useFloatingRootContext.mjs","../../../node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs","../../../node_modules/@base-ui/react/floating-ui-react/hooks/useListNavigation.mjs","../../../node_modules/@base-ui/react/floating-ui-react/hooks/useTypeahead.mjs","../../../node_modules/@base-ui/react/floating-ui-react/hooks/gridNavigation.mjs","../../../node_modules/@base-ui/react/combobox/root/ComboboxRootContext.mjs","../../../node_modules/@base-ui/utils/areArraysEqual.mjs","../../../node_modules/@base-ui/react/internals/itemEquality.mjs","../../../node_modules/@base-ui/react/internals/serializeValue.mjs","../../../node_modules/@base-ui/react/internals/resolveValueLabel.mjs","../../../node_modules/@base-ui/react/combobox/store.mjs","../../../node_modules/@base-ui/react/combobox/root/utils/index.mjs","../../../node_modules/@base-ui/utils/stringifyLocale.mjs","../../../node_modules/@base-ui/react/internals/filter.mjs","../../../node_modules/@base-ui/react/combobox/root/utils/useFilter.mjs","../../../node_modules/@base-ui/utils/useEnhancedClickHandler.mjs","../../../node_modules/@base-ui/react/utils/useOpenInteractionType.mjs","../../../node_modules/@base-ui/react/utils/scrollable.mjs","../../../node_modules/@base-ui/react/combobox/root/utils/constants.mjs","../../../node_modules/@base-ui/react/combobox/items/itemCollection.mjs","../../../node_modules/@base-ui/react/combobox/root/AriaCombobox.mjs","../../../node_modules/@base-ui/react/combobox/root/ComboboxRoot.mjs","../../../node_modules/@base-ui/react/utils/resolveAriaLabelledBy.mjs","../../../node_modules/@base-ui/react/combobox/input/ComboboxInputDataAttributes.mjs","../../../node_modules/@base-ui/react/combobox/utils/stateAttributesMapping.mjs","../../../node_modules/@base-ui/react/combobox/chips/ComboboxChipsContext.mjs","../../../node_modules/@base-ui/react/combobox/positioner/ComboboxPositionerContext.mjs","../../../node_modules/@base-ui/react/combobox/utils/ComboboxInternalDismissButton.mjs","../../../node_modules/@base-ui/react/combobox/utils/parts.mjs","../../../node_modules/@base-ui/react/combobox/input/ComboboxInput.mjs","../../../node_modules/@base-ui/react/combobox/utils/handleInputPress.mjs","../../../node_modules/@base-ui/react/utils/getPseudoElementBounds.mjs","../../../node_modules/@base-ui/react/combobox/trigger/ComboboxTrigger.mjs","../../../node_modules/@base-ui/react/combobox/collection/GroupCollectionContext.mjs","../../../node_modules/@base-ui/react/combobox/collection/ComboboxCollection.mjs","../../../node_modules/@base-ui/react/internals/composite/list/CompositeListContext.mjs","../../../node_modules/@base-ui/react/internals/composite/list/CompositeList.mjs","../../../node_modules/@base-ui/react/combobox/list/ComboboxList.mjs","../../../node_modules/@base-ui/react/combobox/utils/useInitialLiveRegionTextMutation.mjs","../../../node_modules/@base-ui/react/combobox/portal/ComboboxPortalContext.mjs","../../../node_modules/@base-ui/react/combobox/portal/ComboboxPortal.mjs","../../../node_modules/@base-ui/utils/inertValue.mjs","../../../node_modules/@base-ui/react/floating-ui-react/middleware/arrow.mjs","../../../node_modules/@base-ui/react/utils/hideMiddleware.mjs","../../../node_modules/@base-ui/react/utils/adaptiveOriginConstants.mjs","../../../node_modules/@base-ui/react/utils/CommonPositionerCssVars.mjs","../../../node_modules/@base-ui/react/internals/useAnchorPositioning.mjs","../../../node_modules/@base-ui/react/utils/InternalBackdrop.mjs","../../../node_modules/@base-ui/react/internals/getDisabledMountTransitionStyles.mjs","../../../node_modules/@base-ui/react/utils/usePositioner.mjs","../../../node_modules/@base-ui/utils/useScrollLock.mjs","../../../node_modules/@base-ui/react/utils/useAnchoredPopupScrollLock.mjs","../../../node_modules/@base-ui/react/combobox/positioner/ComboboxPositioner.mjs","../../../node_modules/@base-ui/react/combobox/popup/ComboboxPopup.mjs","../../../node_modules/@base-ui/react/internals/composite/list/useCompositeListItem.mjs","../../../node_modules/@base-ui/react/combobox/item/ComboboxItemContext.mjs","../../../node_modules/@base-ui/react/combobox/row/ComboboxRowContext.mjs","../../../node_modules/@base-ui/react/combobox/item/ComboboxItem.mjs","../../../node_modules/@base-ui/react/combobox/item-indicator/ComboboxItemIndicator.mjs","../../../node_modules/@base-ui/react/combobox/chips/ComboboxChips.mjs","../../../node_modules/@base-ui/react/combobox/empty/ComboboxEmpty.mjs","../../../node_modules/@base-ui/react/combobox/clear/ComboboxClear.mjs","../../../packages/ui/src/components/input-group.tsx","../../../packages/ui/src/components/combobox.tsx","../../src/components/FormInputs/InputSelect/InputSelectComponent.tsx"],"sourcesContent":["const visuallyHiddenBase = {\n clipPath: 'inset(50%)',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n border: 0,\n padding: 0,\n width: 1,\n height: 1,\n margin: -1\n};\nexport const visuallyHidden = {\n ...visuallyHiddenBase,\n position: 'fixed',\n top: 0,\n left: 0\n};\nexport const visuallyHiddenInput = {\n ...visuallyHiddenBase,\n position: 'absolute'\n};","/**\n * @license lucide-react v1.61.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 __iconData = {\n name: \"check\",\n size: 24,\n node: [[\"path\", { d: \"M20 6 9 17l-5-5\", key: \"1gmf2c\" }]]\n};\n__iconData.node;\nconst Check = createLucideIcon(__iconData);\n\nexport { __iconData, Check as default };\n//# sourceMappingURL=check.mjs.map\n","/**\n * Reads `navigator.userAgent` / `navigator.platform` (legacy but universally\n * supported) into a normalized shape. In development, prefers the modern\n * `navigator.userAgentData` API on Chromium to avoid DevTools warnings about\n * the deprecated reads; that branch is dead-code-eliminated in production\n * builds to keep the bundle small.\n *\n * Returns empty/zero values when `navigator` is undefined (SSR), so every\n * derived flag safely evaluates to `false`.\n */\nfunction readRawData() {\n if (typeof navigator === 'undefined') {\n return {\n userAgent: '',\n platform: '',\n maxTouchPoints: 0\n };\n }\n if (process.env.NODE_ENV !== 'production') {\n const uaData = navigator.userAgentData;\n if (uaData && Array.isArray(uaData.brands)) {\n return {\n userAgent: uaData.brands.map(({\n brand,\n version\n }) => `${brand}/${version}`).join(' '),\n platform: uaData.platform ?? navigator.platform ?? '',\n maxTouchPoints: navigator.maxTouchPoints ?? 0\n };\n }\n }\n return {\n userAgent: navigator.userAgent,\n platform: navigator.platform ?? '',\n maxTouchPoints: navigator.maxTouchPoints ?? 0\n };\n}\nconst {\n userAgent,\n platform,\n maxTouchPoints\n} = readRawData();\nexport const lowerUserAgent = userAgent.toLowerCase();\nexport const lowerPlatform = platform.toLowerCase();\nexport { maxTouchPoints };","import { lowerUserAgent, lowerPlatform, maxTouchPoints } from \"./shared.mjs\";\n\n// iPadOS 13+ reports `MacIntel` for `navigator.platform`; disambiguated via\n// `maxTouchPoints` so iPad is classified as iOS, not macOS.\n// https://github.com/mui/base-ui/issues/1309\n/** iPhone, iPad (including iPadOS 13+ reporting as macOS), iPod. */\nexport const ios = /^i(os$|p)/.test(lowerPlatform) || lowerPlatform === 'macintel' && maxTouchPoints > 1;\n\n/** Android phones, tablets, and embedded Android browsers. */\nconst ANDROID_STRING = 'android';\nexport const android = lowerPlatform === ANDROID_STRING || lowerUserAgent.includes(ANDROID_STRING);\n\n/** macOS desktop. Excludes iPadOS, which reports as `MacIntel`. */\nexport const mac = !ios && lowerPlatform.startsWith('mac');\n\n/** Windows desktop. */\nexport const windows = lowerPlatform.startsWith('win');\n\n/** Linux desktop (including Chrome OS). */\nexport const linux = !android && /^(linux|chrome os)/.test(lowerPlatform);\n\n/** Any Apple OS (`mac || ios`). */\nexport const apple = mac || ios;","import { lowerUserAgent } from \"./shared.mjs\";\n\n// WebKit (Safari, all iOS browsers, GNOME Web). Distinguished from Blink by\n// the legacy `-webkit-backdrop-filter` name — Blink forked from WebKit in 2013\n// and only ships the unprefixed `backdrop-filter`.\n/** WebKit: Safari, all iOS browsers, GNOME Web. Excludes Blink. */\nexport const webkit = typeof CSS !== 'undefined' && !!CSS.supports?.('-webkit-backdrop-filter:none');\n\n// Anchored to `!webkit` so engines are mutually exclusive by construction.\n// Firefox-on-iOS uses WebKit (its UA marker is `FxiOS/`, not `Firefox/`); the\n// `!webkit` prefix also defends against future iOS-browser UA changes that\n// might inject `Firefox` into a WebKit-based UA.\n/** Gecko: Firefox. */\nexport const gecko = !webkit && lowerUserAgent.includes('firefox');\n\n// All Chromium-based browsers ship `Chrome/` or `Chromium/` in their UA — both\n// share the `chrom` prefix, so a single substring check covers Chrome, Edge,\n// Opera, Brave, etc. Chrome-on-iOS uses `CriOS/` and stays WebKit. The positive\n// UA check also makes this SSR-safe — an empty UA matches nothing.\n/** Blink: Chrome, Edge, Opera, Brave, and other Chromium-based browsers. */\nexport const blink = !webkit && lowerUserAgent.includes('chrom');","import { apple } from \"./os.mjs\";\n\n// Whether a screen reader is *actually* running cannot be detected. These flags\n// identify platforms where a specific screen reader could be active. VoiceOver\n// is the system screen reader on Apple platforms and works with every browser\n// there, so the flag is purely an OS check; engine-specific quirks (e.g. the\n// NSAccessibility virtual-cursor focus path) should be gated at the call site.\n/**\n * The user *may* be using VoiceOver — actual activation is not detectable.\n * True on any Apple platform (macOS, iOS, iPadOS).\n */\nexport const voiceOver = apple;","import { lowerUserAgent } from \"./shared.mjs\";\n\n/** Running in jsdom or HappyDOM (used by unit tests). */\nexport const jsdom = /jsdom|happydom/.test(lowerUserAgent);","export const FOCUSABLE_ATTRIBUTE = 'data-base-ui-focusable';\nexport const ACTIVE_KEY = 'active';\nexport const SELECTED_KEY = 'selected';\nexport const TYPEABLE_SELECTOR = \"input:not([type='hidden']):not([disabled]),\" + \"[contenteditable]:not([contenteditable='false']),textarea:not([disabled])\";\nexport const ARROW_LEFT = 'ArrowLeft';\nexport const ARROW_RIGHT = 'ArrowRight';\nexport const ARROW_UP = 'ArrowUp';\nexport const ARROW_DOWN = 'ArrowDown';","import * as TransitionStatusDataAttributes from \"../internals/TransitionStatusDataAttributes.mjs\";\n\n/**\n * Present when the popup is open.\n */\nexport const open = 'data-open';\n\n/**\n * Present when the popup is closed.\n */\nexport const closed = 'data-closed';\n\n/**\n * Present when the popup begins animating in.\n */\nexport const startingStyle = TransitionStatusDataAttributes.startingStyle;\n\n/**\n * Present when the popup is animating out.\n */\nexport const endingStyle = TransitionStatusDataAttributes.endingStyle;\n\n/**\n * Present when the anchor is hidden.\n */\nexport const anchorHidden = 'data-anchor-hidden';\n\n/**\n * Indicates which side the popup is positioned relative to the trigger.\n * @type { 'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start'}\n */\nexport const side = 'data-side';\n\n/**\n * Indicates how the popup is aligned relative to specified side.\n * @type {'start' | 'center' | 'end'}\n */\nexport const align = 'data-align';","/**\n * Present when the popup is open.\n */\nexport const popupOpen = 'data-popup-open';\n\n/**\n * Present when a pressable trigger is pressed.\n */\nexport const pressed = 'data-pressed';","import { transitionStatusMapping } from \"../internals/stateAttributesMapping.mjs\";\nimport * as CommonPopupDataAttributes from \"./CommonPopupDataAttributes.mjs\";\nimport * as CommonTriggerDataAttributes from \"./CommonTriggerDataAttributes.mjs\";\nexport { CommonPopupDataAttributes, CommonTriggerDataAttributes };\nconst TRIGGER_HOOK = {\n [CommonTriggerDataAttributes.popupOpen]: ''\n};\nconst PRESSABLE_TRIGGER_HOOK = {\n [CommonTriggerDataAttributes.popupOpen]: '',\n [CommonTriggerDataAttributes.pressed]: ''\n};\nconst POPUP_OPEN_HOOK = {\n [CommonPopupDataAttributes.open]: ''\n};\nconst POPUP_CLOSED_HOOK = {\n [CommonPopupDataAttributes.closed]: ''\n};\nconst ANCHOR_HIDDEN_HOOK = {\n [CommonPopupDataAttributes.anchorHidden]: ''\n};\nexport const triggerOpenStateMapping = {\n open(value) {\n if (value) {\n return TRIGGER_HOOK;\n }\n return null;\n }\n};\nexport const pressableTriggerOpenStateMapping = {\n open(value) {\n if (value) {\n return PRESSABLE_TRIGGER_HOOK;\n }\n return null;\n }\n};\nexport const popupStateMapping = {\n open(value) {\n if (value) {\n return POPUP_OPEN_HOOK;\n }\n return POPUP_CLOSED_HOOK;\n },\n anchorHidden(value) {\n if (value) {\n return ANCHOR_HIDDEN_HOOK;\n }\n return null;\n }\n};\nexport const popupTransitionStateMapping = {\n ...popupStateMapping,\n ...transitionStatusMapping\n};","import { isElement, isHTMLElement } from '@floating-ui/utils/dom';\nimport { platform } from '@base-ui/utils/platform';\nimport { activeElement, contains, getTarget } from '@base-ui/utils/shadowDom';\nimport { FOCUSABLE_ATTRIBUTE, TYPEABLE_SELECTOR } from \"./constants.mjs\";\nimport * as TooltipTriggerDataAttributes from \"../../tooltip/trigger/TooltipTriggerDataAttributes.mjs\";\nexport { activeElement, contains, getTarget };\nexport function isTargetInsideEnabledTrigger(target, triggerElements) {\n if (!isElement(target)) {\n return false;\n }\n const targetElement = target;\n if (triggerElements.hasElement(targetElement)) {\n return !targetElement.hasAttribute(TooltipTriggerDataAttributes.triggerDisabled);\n }\n for (const [, trigger] of triggerElements.entries()) {\n if (contains(trigger, targetElement)) {\n return !trigger.hasAttribute(TooltipTriggerDataAttributes.triggerDisabled);\n }\n }\n return false;\n}\nexport function isEventTargetWithin(event, node) {\n if (node == null) {\n return false;\n }\n if ('composedPath' in event) {\n return event.composedPath().includes(node);\n }\n\n // TS thinks `event` is of type never as it assumes all browsers support composedPath, but browsers without shadow dom don't\n const eventAgain = event;\n return eventAgain.target != null && node.contains(eventAgain.target);\n}\nexport function isRootElement(element) {\n return element.matches('html,body');\n}\nexport function isTypeableElement(element) {\n return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);\n}\nexport function isInteractiveElement(element) {\n return element?.closest(`button,a[href],[role=\"button\"],select,[tabindex]:not([tabindex=\"-1\"]),${TYPEABLE_SELECTOR}`) != null;\n}\nexport function isTypeableCombobox(element) {\n if (!element) {\n return false;\n }\n return element.getAttribute('role') === 'combobox' && isTypeableElement(element);\n}\nexport function matchesFocusVisible(element) {\n // We don't want to block focus from working with `visibleOnly`\n // (JSDOM doesn't match `:focus-visible` when the element has `:focus`)\n if (!element || platform.env.jsdom) {\n return true;\n }\n try {\n return element.matches(':focus-visible');\n } catch (_e) {\n return true;\n }\n}\nexport function getFloatingFocusElement(floatingElement) {\n if (!floatingElement) {\n return null;\n }\n // Try to find the element that has `{...getFloatingProps()}` spread on it.\n // This indicates the floating element is acting as a positioning wrapper, and\n // so focus should be managed on the child element with the event handlers and\n // aria props.\n return floatingElement.hasAttribute(FOCUSABLE_ATTRIBUTE) ? floatingElement : floatingElement.querySelector(`[${FOCUSABLE_ATTRIBUTE}]`) || floatingElement;\n}","/* eslint-disable @typescript-eslint/no-loop-func */\n\nexport function getNodeChildren(nodes, id, onlyOpenChildren = true) {\n const directChildren = nodes.filter(node => node.parentId === id);\n return directChildren.flatMap(child => [...(!onlyOpenChildren || child.context?.open ? [child] : []), ...getNodeChildren(nodes, child.id, onlyOpenChildren)]);\n}\nexport function getDeepestNode(nodes, id) {\n let deepestNodeId;\n let maxDepth = -1;\n function findDeepest(nodeId, depth) {\n if (depth > maxDepth) {\n deepestNodeId = nodeId;\n maxDepth = depth;\n }\n const children = getNodeChildren(nodes, nodeId);\n children.forEach(child => {\n findDeepest(child.id, depth + 1);\n });\n }\n findDeepest(id, 0);\n return nodes.find(node => node.id === deepestNodeId);\n}\nexport function getNodeAncestors(nodes, id) {\n let allAncestors = [];\n let currentParentId = nodes.find(node => node.id === id)?.parentId;\n while (currentParentId) {\n const currentNode = nodes.find(node => node.id === currentParentId);\n currentParentId = currentNode?.parentId;\n if (currentNode) {\n allAncestors = allAncestors.concat(currentNode);\n }\n }\n return allAncestors;\n}","import { platform } from '@base-ui/utils/platform';\nexport function stopEvent(event) {\n event.preventDefault();\n event.stopPropagation();\n}\nexport function isReactEvent(event) {\n return 'nativeEvent' in event;\n}\n\n// License: https://github.com/adobe/react-spectrum/blob/main/packages/@react-aria/utils/src/isVirtualEvent.ts\nexport function isVirtualClick(event) {\n if (event.pointerType === '' && event.isTrusted) {\n return true;\n }\n if (platform.os.android && event.pointerType) {\n return event.type === 'click' && event.buttons === 1;\n }\n return event.detail === 0 && !event.pointerType;\n}\nexport function isVirtualPointerEvent(event) {\n if (platform.env.jsdom) {\n return false;\n }\n return !platform.os.android && event.width === 0 && event.height === 0 || platform.os.android && event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'mouse' ||\n // iOS VoiceOver returns 0.333• for width/height.\n event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'touch';\n}\nexport function isMouseLikePointerType(pointerType, strict) {\n // On some Linux machines with Chromium, mouse inputs return a `pointerType`\n // of \"pen\": https://github.com/floating-ui/floating-ui/issues/2015\n const values = ['mouse', 'pen'];\n if (!strict) {\n values.push('', undefined);\n }\n return values.includes(pointerType);\n}\nexport function isClickLikeEvent(event) {\n const type = event.type;\n return type === 'click' || type === 'mousedown' || type === 'keydown' || type === 'keyup';\n}","import { floor } from '@floating-ui/utils';\nimport { getComputedStyle } from '@floating-ui/utils/dom';\nimport { stopEvent } from \"./event.mjs\";\nimport { ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP } from \"./constants.mjs\";\nexport function isDifferentGridRow(index, cols, prevRow) {\n return Math.floor(index / cols) !== prevRow;\n}\nexport function isIndexOutOfListBounds(list, index) {\n return index < 0 || index >= list.length;\n}\nexport function getMinListIndex(listRef, disabledIndices) {\n return findNonDisabledListIndex(listRef.current, {\n disabledIndices\n });\n}\nexport function getMaxListIndex(listRef, disabledIndices) {\n return findNonDisabledListIndex(listRef.current, {\n decrement: true,\n startingIndex: listRef.current.length,\n disabledIndices\n });\n}\nexport function findNonDisabledListIndex(list, {\n startingIndex = -1,\n decrement = false,\n disabledIndices,\n amount = 1\n} = {}) {\n let index = startingIndex;\n do {\n index += decrement ? -amount : amount;\n } while (index >= 0 && index <= list.length - 1 && isListIndexDisabled(list, index, disabledIndices));\n return index;\n}\nexport function getGridNavigatedIndex(list, {\n event,\n orientation,\n loopFocus,\n onLoop,\n rtl,\n cols,\n disabledIndices,\n minIndex,\n maxIndex,\n prevIndex,\n stopEvent: stop = false\n}) {\n let nextIndex = prevIndex;\n let verticalDirection;\n if (event.key === ARROW_UP) {\n verticalDirection = 'up';\n } else if (event.key === ARROW_DOWN) {\n verticalDirection = 'down';\n }\n if (verticalDirection) {\n // -------------------------------------------------------------------------\n // Detect row structure only when handling vertical navigation. This keeps\n // the non-vertical key paths free from row inference work.\n // -------------------------------------------------------------------------\n const rows = [];\n const rowIndexMap = [];\n let hasRoleRow = false;\n let visibleItemCount = 0;\n {\n let currentRowEl = null;\n let currentRowIndex = -1;\n list.forEach((el, idx) => {\n if (el == null) {\n return;\n }\n visibleItemCount += 1;\n const rowEl = el.closest('[role=\"row\"]');\n if (rowEl) {\n hasRoleRow = true;\n }\n if (rowEl !== currentRowEl || currentRowIndex === -1) {\n currentRowEl = rowEl;\n currentRowIndex += 1;\n rows[currentRowIndex] = [];\n }\n rows[currentRowIndex].push(idx);\n rowIndexMap[idx] = currentRowIndex;\n });\n }\n let hasDomRows = false;\n let inferredDomCols = 0;\n if (hasRoleRow) {\n for (const row of rows) {\n const rowLength = row.length;\n if (rowLength > inferredDomCols) {\n inferredDomCols = rowLength;\n }\n if (rowLength !== cols) {\n hasDomRows = true;\n }\n }\n }\n const hasVirtualizedGaps = hasDomRows && visibleItemCount < list.length;\n const verticalCols = inferredDomCols || cols;\n const navigateVertically = direction => {\n if (!hasDomRows || prevIndex === -1) {\n return undefined;\n }\n const currentRow = rowIndexMap[prevIndex];\n if (currentRow == null) {\n return undefined;\n }\n const colInRow = rows[currentRow].indexOf(prevIndex);\n const step = direction === 'up' ? -1 : 1;\n for (let nextRow = currentRow + step, i = 0; i < rows.length; i += 1, nextRow += step) {\n if (nextRow < 0 || nextRow >= rows.length) {\n if (!loopFocus || hasVirtualizedGaps) {\n return undefined;\n }\n nextRow = nextRow < 0 ? rows.length - 1 : 0;\n if (onLoop) {\n const clampedCol = Math.min(colInRow, rows[nextRow].length - 1);\n const targetItemIndex = rows[nextRow][clampedCol] ?? rows[nextRow][0];\n const returnedItemIndex = onLoop(event, prevIndex, targetItemIndex);\n nextRow = rowIndexMap[returnedItemIndex] ?? nextRow;\n }\n }\n const targetRow = rows[nextRow];\n for (let col = Math.min(colInRow, targetRow.length - 1); col >= 0; col -= 1) {\n const candidate = targetRow[col];\n if (!isListIndexDisabled(list, candidate, disabledIndices)) {\n return candidate;\n }\n }\n }\n return undefined;\n };\n const navigateVerticallyWithInferredRows = direction => {\n if (!hasVirtualizedGaps || prevIndex === -1) {\n return undefined;\n }\n const colInRow = prevIndex % verticalCols;\n const rowStep = direction === 'up' ? -verticalCols : verticalCols;\n const lastRowStart = maxIndex - maxIndex % verticalCols;\n const rowCount = floor(maxIndex / verticalCols) + 1;\n for (let rowStart = prevIndex - colInRow + rowStep, i = 0; i < rowCount; i += 1, rowStart += rowStep) {\n if (rowStart < 0 || rowStart > maxIndex) {\n if (!loopFocus) {\n return undefined;\n }\n rowStart = rowStart < 0 ? lastRowStart : 0;\n }\n const rowEnd = Math.min(rowStart + verticalCols - 1, maxIndex);\n for (let candidate = Math.min(rowStart + colInRow, rowEnd); candidate >= rowStart; candidate -= 1) {\n if (!isListIndexDisabled(list, candidate, disabledIndices)) {\n return candidate;\n }\n }\n }\n return undefined;\n };\n if (stop) {\n stopEvent(event);\n }\n const verticalCandidate = navigateVertically(verticalDirection) ?? navigateVerticallyWithInferredRows(verticalDirection);\n if (verticalCandidate !== undefined) {\n nextIndex = verticalCandidate;\n } else if (prevIndex === -1) {\n nextIndex = verticalDirection === 'up' ? maxIndex : minIndex;\n } else {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex,\n amount: verticalCols,\n decrement: verticalDirection === 'up',\n disabledIndices\n });\n if (loopFocus) {\n if (verticalDirection === 'up' && (prevIndex - verticalCols < minIndex || nextIndex < 0)) {\n const col = prevIndex % verticalCols;\n const maxCol = maxIndex % verticalCols;\n const offset = maxIndex - (maxCol - col);\n if (maxCol === col) {\n nextIndex = maxIndex;\n } else {\n nextIndex = maxCol > col ? offset : offset - verticalCols;\n }\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n if (verticalDirection === 'down' && prevIndex + verticalCols > maxIndex) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex % verticalCols - verticalCols,\n amount: verticalCols,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n }\n }\n if (isIndexOutOfListBounds(list, nextIndex)) {\n nextIndex = prevIndex;\n }\n }\n\n // Remains on the same row/column.\n if (orientation === 'both') {\n const prevRow = floor(prevIndex / cols);\n if (event.key === (rtl ? ARROW_LEFT : ARROW_RIGHT)) {\n if (stop) {\n stopEvent(event);\n }\n if (prevIndex % cols !== cols - 1) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex,\n disabledIndices\n });\n if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex - prevIndex % cols - 1,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n } else if (loopFocus) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex - prevIndex % cols - 1,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n if (isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = prevIndex;\n }\n }\n if (event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT)) {\n if (stop) {\n stopEvent(event);\n }\n if (prevIndex % cols !== 0) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex,\n decrement: true,\n disabledIndices\n });\n if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex + (cols - prevIndex % cols),\n decrement: true,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n } else if (loopFocus) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex + (cols - prevIndex % cols),\n decrement: true,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n if (isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = prevIndex;\n }\n }\n const lastRow = floor(maxIndex / cols) === prevRow;\n if (isIndexOutOfListBounds(list, nextIndex)) {\n if (loopFocus && lastRow) {\n nextIndex = event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT) ? maxIndex : findNonDisabledListIndex(list, {\n startingIndex: prevIndex - prevIndex % cols - 1,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n } else {\n nextIndex = prevIndex;\n }\n }\n }\n return nextIndex;\n}\n\n/** For each cell index, gets the item index that occupies that cell */\nexport function createGridCellMap(sizes, cols, dense) {\n const cellMap = [];\n let startIndex = 0;\n sizes.forEach(({\n width,\n height\n }, index) => {\n if (width > cols) {\n if (process.env.NODE_ENV !== 'production') {\n // TODO: fix mui/no-guarded-throw\n // eslint-disable-next-line mui/no-guarded-throw\n throw new Error(`[Floating UI]: Invalid grid - item width at index ${index} is greater than grid columns`);\n }\n }\n let itemPlaced = false;\n if (dense) {\n startIndex = 0;\n }\n while (!itemPlaced) {\n const targetCells = [];\n for (let i = 0; i < width; i += 1) {\n for (let j = 0; j < height; j += 1) {\n targetCells.push(startIndex + i + j * cols);\n }\n }\n if (startIndex % cols + width <= cols && targetCells.every(cell => cellMap[cell] == null)) {\n targetCells.forEach(cell => {\n cellMap[cell] = index;\n });\n itemPlaced = true;\n } else {\n startIndex += 1;\n }\n }\n });\n\n // convert into a non-sparse array\n return [...cellMap];\n}\n\n/** Gets cell index of an item's corner or -1 when index is -1. */\nexport function getGridCellIndexOfCorner(index, sizes, cellMap, cols, corner) {\n if (index === -1) {\n return -1;\n }\n const firstCellIndex = cellMap.indexOf(index);\n const sizeItem = sizes[index];\n switch (corner) {\n case 'tl':\n return firstCellIndex;\n case 'tr':\n if (!sizeItem) {\n return firstCellIndex;\n }\n return firstCellIndex + sizeItem.width - 1;\n case 'bl':\n if (!sizeItem) {\n return firstCellIndex;\n }\n return firstCellIndex + (sizeItem.height - 1) * cols;\n case 'br':\n return cellMap.lastIndexOf(index);\n default:\n return -1;\n }\n}\n\n/** Gets all cell indices that correspond to the specified indices */\nexport function getGridCellIndices(indices, cellMap) {\n return cellMap.flatMap((index, cellIndex) => indices.includes(index) ? [cellIndex] : []);\n}\nexport function isListIndexDisabled(list, index, disabledIndices) {\n const isExplicitlyDisabled = typeof disabledIndices === 'function' ? disabledIndices(index) : disabledIndices?.includes(index) ?? false;\n if (isExplicitlyDisabled) {\n return true;\n }\n const element = list[index];\n if (!element) {\n return false;\n }\n if (!isElementVisible(element)) {\n return true;\n }\n\n // A natively disabled element can never receive focus, so it must always be\n // skipped, even when `disabledIndices` marks it as enabled. Only\n // `aria-disabled` items can be focusable-while-disabled.\n if (element.matches(':disabled')) {\n return true;\n }\n return !disabledIndices && (element.hasAttribute('disabled') || element.getAttribute('aria-disabled') === 'true');\n}\nexport function isHiddenByStyles(styles) {\n return styles.visibility === 'hidden' || styles.visibility === 'collapse';\n}\nexport function isElementVisible(element, styles = element ? getComputedStyle(element) : null) {\n if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) {\n return false;\n }\n if (typeof element.checkVisibility === 'function') {\n return element.checkVisibility();\n }\n return styles.display !== 'none' && styles.display !== 'contents';\n}","import { getComputedStyle, getNodeName, isHTMLElement, isShadowRoot } from '@floating-ui/utils/dom';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { activeElement, contains } from \"./element.mjs\";\nimport { isElementVisible } from \"./composite.mjs\";\nconst CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable=\"false\"]),audio[controls],video[controls]';\nfunction getParentElement(element) {\n const assignedSlot = element.assignedSlot;\n if (assignedSlot) {\n return assignedSlot;\n }\n if (element.parentElement) {\n return element.parentElement;\n }\n const rootNode = element.getRootNode();\n return isShadowRoot(rootNode) ? rootNode.host : null;\n}\nfunction getDetailsSummary(details) {\n for (const child of Array.from(details.children)) {\n if (getNodeName(child) === 'summary') {\n return child;\n }\n }\n return null;\n}\nfunction isWithinOpenDetailsSummary(element, details) {\n const summary = getDetailsSummary(details);\n return !!summary && (element === summary || contains(summary, element));\n}\nfunction isFocusableCandidate(element) {\n const nodeName = element ? getNodeName(element) : '';\n return element != null && element.matches(CANDIDATE_SELECTOR) && (nodeName !== 'summary' || element.parentElement != null && getNodeName(element.parentElement) === 'details' && getDetailsSummary(element.parentElement) === element) && (nodeName !== 'details' || getDetailsSummary(element) == null) && (nodeName !== 'input' || element.type !== 'hidden');\n}\nfunction isFocusableElement(element) {\n if (!isFocusableCandidate(element) || !element.isConnected || element.matches(':disabled')) {\n return false;\n }\n for (let current = element; current; current = getParentElement(current)) {\n const isAncestor = current !== element;\n const isSlot = getNodeName(current) === 'slot';\n if (current.hasAttribute('inert')) {\n return false;\n }\n if (isAncestor && getNodeName(current) === 'details' && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute('hidden') || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) {\n return false;\n }\n }\n return true;\n}\nfunction isVisibleInTabbableTree(element, isAncestor) {\n const styles = getComputedStyle(element);\n if (!isAncestor) {\n return isElementVisible(element, styles);\n }\n return styles.display !== 'none';\n}\nfunction getTabIndex(element) {\n const tabIndex = element.tabIndex;\n if (tabIndex < 0) {\n const nodeName = getNodeName(element);\n if (nodeName === 'details' || nodeName === 'audio' || nodeName === 'video' || isHTMLElement(element) && element.isContentEditable) {\n return 0;\n }\n }\n return tabIndex;\n}\nfunction getNamedRadioInput(element) {\n if (getNodeName(element) !== 'input') {\n return null;\n }\n const input = element;\n return input.type === 'radio' && input.name !== '' ? input : null;\n}\nfunction isTabbableRadio(element, candidates) {\n const input = getNamedRadioInput(element);\n if (!input) {\n return true;\n }\n const checkedRadio = candidates.find(candidate => {\n const radio = getNamedRadioInput(candidate);\n return radio?.name === input.name && radio.form === input.form && radio.checked;\n });\n if (checkedRadio) {\n return checkedRadio === input;\n }\n return candidates.find(candidate => {\n const radio = getNamedRadioInput(candidate);\n return radio?.name === input.name && radio.form === input.form;\n }) === input;\n}\nfunction getComposedChildren(container) {\n if (isHTMLElement(container) && getNodeName(container) === 'slot') {\n const assignedElements = container.assignedElements({\n flatten: true\n });\n if (assignedElements.length > 0) {\n return assignedElements;\n }\n }\n if (isHTMLElement(container) && container.shadowRoot) {\n return Array.from(container.shadowRoot.children);\n }\n return Array.from(container.children);\n}\nfunction appendCandidates(container, list) {\n getComposedChildren(container).forEach(child => {\n if (isFocusableCandidate(child)) {\n list.push(child);\n }\n appendCandidates(child, list);\n });\n}\nfunction appendMatchingElements(container, selector, list) {\n getComposedChildren(container).forEach(child => {\n if (isHTMLElement(child) && child.matches(selector)) {\n list.push(child);\n }\n appendMatchingElements(child, selector, list);\n });\n}\nexport function isTabbable(element) {\n return isFocusableElement(element) && getTabIndex(element) >= 0;\n}\nexport function focusable(container) {\n const candidates = [];\n appendCandidates(container, candidates);\n return candidates.filter(isFocusableElement);\n}\nexport function tabbable(container) {\n const candidates = focusable(container);\n return candidates.filter(element => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates));\n}\nfunction getTabbableIn(container, dir) {\n const list = tabbable(container);\n const len = list.length;\n if (len === 0) {\n return undefined;\n }\n const active = activeElement(ownerDocument(container));\n const index = list.indexOf(active);\n // eslint-disable-next-line no-nested-ternary\n const nextIndex = index === -1 ? dir === 1 ? 0 : len - 1 : index + dir;\n return list[nextIndex];\n}\nexport function getNextTabbable(referenceElement) {\n return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement;\n}\nexport function getPreviousTabbable(referenceElement) {\n return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement;\n}\nfunction getTabbableNearElement(referenceElement, dir) {\n if (!referenceElement) {\n return null;\n }\n const list = tabbable(ownerDocument(referenceElement).body);\n const elementCount = list.length;\n if (elementCount === 0) {\n return null;\n }\n const index = list.indexOf(referenceElement);\n if (index === -1) {\n return null;\n }\n const nextIndex = (index + dir + elementCount) % elementCount;\n return list[nextIndex];\n}\nexport function getTabbableAfterElement(referenceElement) {\n return getTabbableNearElement(referenceElement, 1);\n}\nexport function getTabbableBeforeElement(referenceElement) {\n return getTabbableNearElement(referenceElement, -1);\n}\nexport function isOutsideEvent(event, container) {\n const containerElement = container || event.currentTarget;\n const relatedTarget = event.relatedTarget;\n return !relatedTarget || !contains(containerElement, relatedTarget);\n}\nexport function disableFocusInside(container) {\n const tabbableElements = tabbable(container);\n tabbableElements.forEach(element => {\n element.dataset.tabindex = element.getAttribute('tabindex') || '';\n element.setAttribute('tabindex', '-1');\n });\n}\nexport function enableFocusInside(container) {\n const elements = [];\n appendMatchingElements(container, '[data-tabindex]', elements);\n elements.forEach(element => {\n const tabindex = element.dataset.tabindex;\n delete element.dataset.tabindex;\n if (tabindex) {\n element.setAttribute('tabindex', tabindex);\n } else {\n element.removeAttribute('tabindex');\n }\n });\n}","'use client';\n\nimport * as React from 'react';\nexport function useOnFirstRender(fn) {\n const ref = React.useRef(true);\n if (ref.current) {\n ref.current = false;\n fn();\n }\n}","import * as React from 'react';\nimport { useRefWithInit } from \"./useRefWithInit.mjs\";\nconst hooks = [];\nlet currentInstance = undefined;\nexport function getInstance() {\n return currentInstance;\n}\nexport function setInstance(instance) {\n currentInstance = instance;\n}\nexport function register(hook) {\n hooks.push(hook);\n}\n\n/**\n * Wraps a component function to enable performance optimizations for internal hooks.\n *\n * **Performance Optimization:**\n * Components wrapped with `fastComponent` have access to a shared \"instance\" context that enables\n * specialized hook implementations to batch operations and reduce overhead. The wrapper creates a\n * stable instance object that persists across renders, sets it as the current context, calls\n * registered hooks before and after rendering, then clears the context. The primary benefit is\n * with `useStore`, where multiple store subscriptions within the same component are collapsed into\n * a single `useSyncExternalStore` subscription per store, significantly reducing re-render overhead.\n * This optimization is only active on React 19+; on earlier versions `useStore` falls back to a\n * separate subscription per call.\n *\n * **Requirements:**\n * - The component function should follow standard React component patterns\n * - `useStore` calls must keep a stable order and count across renders, as batched hooks are\n * matched by call index\n * - Do not rely on the instance context outside of specialized hooks\n *\n * @param fn - The component function to wrap\n * @returns A wrapped component with the same signature as the input function\n *\n * @example\n * ```tsx\n * // Wrapping a component to enable optimized useStore batching\n * export const TooltipRoot = fastComponent(function TooltipRoot(props) {\n * // These useStore calls share a single subscription\n * const open = useStore(store, (state) => state.open);\n * const disabled = useStore(store, (state) => state.disabled);\n * const value = useStore(store, (state) => state.value);\n * // ...\n * });\n * ```\n */\nexport function fastComponent(fn) {\n const FastComponent = (props, forwardedRef) => {\n const instance = useRefWithInit(createInstance).current;\n let result;\n try {\n currentInstance = instance;\n for (const hook of hooks) {\n hook.before(instance);\n }\n result = fn(props, forwardedRef);\n for (const hook of hooks) {\n hook.after(instance);\n }\n instance.didInitialize = true;\n } finally {\n currentInstance = undefined;\n }\n return result;\n };\n FastComponent.displayName = fn.displayName || fn.name;\n return FastComponent;\n}\n\n/**\n * Wraps a component function with ref forwarding to enable performance optimizations for internal hooks.\n *\n * This is a convenience wrapper that combines `fastComponent` with `React.forwardRef`, enabling\n * both performance optimizations and proper ref forwarding. See `fastComponent` for details on\n * the performance benefits.\n *\n * @param fn - The component function that accepts props and a forwarded ref\n * @returns A wrapped component with ref forwarding enabled\n *\n * @example\n * ```tsx\n * // Wrapping a component with ref forwarding and optimized hooks\n * export const TooltipTrigger = fastComponentRef(function TooltipTrigger(\n * props,\n * forwardedRef\n * ) {\n * const store = useContext(TooltipContext);\n * const open = useStore(store, (state) => state.open);\n * // ... component logic with ref\n * return <button ref={forwardedRef} {...props} />;\n * });\n * ```\n */\nexport function fastComponentRef(fn) {\n return /*#__PURE__*/React.forwardRef(fastComponent(fn));\n}\nfunction createInstance() {\n return {\n didInitialize: false\n };\n}","import * as React from 'react';\n/* We need to import the shim because React 17 does not support the `useSyncExternalStore` API.\n * More info: https://github.com/mui/mui-x/issues/18303#issuecomment-2958392341 */\nimport { useSyncExternalStore } from 'use-sync-external-store/shim';\nimport { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector';\nimport { isReactVersionAtLeast } from \"../reactVersion.mjs\";\nimport { register, getInstance } from \"../fastHooks.mjs\";\n/* Some tests fail in R18 with the raw useSyncExternalStore. It may be possible to make it work\n * but for now we only enable it for R19+. */\nconst canUseRawUseSyncExternalStore = isReactVersionAtLeast(19);\nconst useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy;\nexport function useStore(store, selector, a1, a2, a3) {\n return useStoreImplementation(store, selector, a1, a2, a3);\n}\nfunction useStoreR19(store, selector, a1, a2, a3) {\n const getSelection = React.useCallback(() => selector(store.getSnapshot(), a1, a2, a3), [store, selector, a1, a2, a3]);\n return useSyncExternalStore(store.subscribe, getSelection, getSelection);\n}\nregister({\n before(instance) {\n instance.syncIndex = 0;\n if (!instance.didInitialize) {\n instance.syncTick = 1;\n instance.syncHooks = [];\n instance.didChangeStore = true;\n instance.getSnapshot = () => {\n let didChange = false;\n for (let i = 0; i < instance.syncHooks.length; i += 1) {\n const hook = instance.syncHooks[i];\n const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3);\n if (!Object.is(hook.value, value)) {\n didChange = true;\n hook.value = value;\n }\n }\n if (didChange) {\n instance.syncTick += 1;\n }\n return instance.syncTick;\n };\n }\n },\n after(instance) {\n if (instance.syncHooks.length > 0) {\n if (instance.didChangeStore) {\n instance.didChangeStore = false;\n instance.subscribe = onStoreChange => {\n const stores = new Set();\n for (const hook of instance.syncHooks) {\n stores.add(hook.store);\n }\n const unsubscribes = [];\n for (const store of stores) {\n unsubscribes.push(store.subscribe(onStoreChange));\n }\n return () => {\n for (const unsubscribe of unsubscribes) {\n unsubscribe();\n }\n };\n };\n }\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useSyncExternalStore(instance.subscribe, instance.getSnapshot, instance.getSnapshot);\n }\n }\n});\nfunction useStoreFast(store, selector, a1, a2, a3) {\n const instance = getInstance();\n if (!instance) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useStoreR19(store, selector, a1, a2, a3);\n }\n const index = instance.syncIndex;\n instance.syncIndex += 1;\n let hook;\n if (!instance.didInitialize) {\n hook = {\n store,\n selector,\n a1,\n a2,\n a3,\n value: selector(store.getSnapshot(), a1, a2, a3)\n };\n instance.syncHooks.push(hook);\n } else {\n hook = instance.syncHooks[index];\n if (hook.store !== store || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) {\n if (hook.store !== store) {\n instance.didChangeStore = true;\n }\n hook.store = store;\n hook.selector = selector;\n hook.a1 = a1;\n hook.a2 = a2;\n hook.a3 = a3;\n hook.value = selector(store.getSnapshot(), a1, a2, a3);\n }\n }\n return hook.value;\n}\nfunction useStoreLegacy(store, selector, a1, a2, a3) {\n return useSyncExternalStoreWithSelector(store.subscribe, store.getSnapshot, store.getSnapshot, state => selector(state, a1, a2, a3));\n}","import { useStore } from \"./useStore.mjs\";\n/**\n * A data store implementation that allows subscribing to state changes and updating the state.\n * It uses an observer pattern to notify subscribers when the state changes.\n */\nexport class Store {\n /**\n * Creates a store with the given initial state, constructing the class it is called on.\n * Calling it on a generic base class (e.g. `ReactStore.create(...)`) constructs that\n * class but degrades the inferred instance type to `Store`; use `new` there instead.\n */\n static create(state) {\n return new this(state);\n }\n\n /**\n * The current state of the store.\n * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}.\n * To subscribe to state changes, use the {@link useState} method. The value returned by {@link useState} is updated after the component renders (similarly to React's useState).\n * The values can be used directly (to avoid subscribing to the store) in effects or event handlers.\n *\n * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification.\n */\n\n // Internal state to handle recursive `setState()` calls\n\n constructor(state) {\n this.state = state;\n this.listeners = new Set();\n this.updateTick = 0;\n }\n\n /**\n * Registers a listener that will be called whenever the store's state changes.\n *\n * @param fn The listener function to be called on state changes.\n * @returns A function to unsubscribe the listener.\n */\n subscribe = fn => {\n this.listeners.add(fn);\n return () => {\n this.listeners.delete(fn);\n };\n };\n\n /**\n * Returns the current state of the store.\n */\n getSnapshot = () => {\n return this.state;\n };\n\n /**\n * Updates the entire store's state and notifies all registered listeners.\n *\n * @param newState The new state to set for the store.\n */\n setState(newState) {\n if (this.state === newState) {\n return;\n }\n this.state = newState;\n this.updateTick += 1;\n const currentTick = this.updateTick;\n for (const listener of this.listeners) {\n if (currentTick !== this.updateTick) {\n // If the tick has changed, a recursive `setState` call has been made,\n // and it has already notified all listeners.\n return;\n }\n listener(newState);\n }\n }\n\n /**\n * Merges the provided changes into the current state and notifies listeners if there are changes.\n * Each value must match its state key. Pass an exact known subset rather than a broad\n * `Partial<State>`, which may contain `undefined` for required state fields.\n *\n * @param changes An object containing the changes to apply to the current state.\n */\n update(changes) {\n for (const key in changes) {\n if (!Object.is(this.state[key], changes[key])) {\n this.setState({\n ...this.state,\n ...changes\n });\n return;\n }\n }\n }\n\n /**\n * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed.\n *\n * @param key The key in the store's state to update.\n * @param value The new value to set for the specified key.\n */\n set(key, value) {\n if (!Object.is(this.state[key], value)) {\n this.setState({\n ...this.state,\n [key]: value\n });\n }\n }\n\n /**\n * Gives the state a new reference and updates all registered listeners.\n */\n notifyAll() {\n const newState = {\n ...this.state\n };\n this.setState(newState);\n }\n use(selector, a1, a2, a3) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useStore(this, selector, a1, a2, a3);\n }\n}","/* False positives - ESLint thinks we're calling a hook from a class component. */\n/* eslint-disable react-hooks/rules-of-hooks */\n'use client';\n\nimport * as React from 'react';\nimport { Store } from \"./Store.mjs\";\nimport { useStore } from \"./useStore.mjs\";\nimport { useStableCallback } from \"../useStableCallback.mjs\";\nimport { useIsoLayoutEffect } from \"../useIsoLayoutEffect.mjs\";\nimport { NOOP } from \"../empty.mjs\";\n\n/**\n * A Store that supports controlled state keys, non-reactive values and provides utility methods for React.\n */\nexport class ReactStore extends Store {\n /**\n * Creates a new ReactStore instance.\n *\n * @param state Initial state of the store.\n * @param context Non-reactive context values.\n * @param selectors Optional selectors for use with `useState`.\n */\n constructor(state, context = {}, selectors) {\n super(state);\n this.context = context;\n this.selectors = selectors;\n }\n\n /**\n * Non-reactive values such as refs, callbacks, etc.\n */\n\n /**\n * Synchronizes a single external value into the store.\n *\n * Note that the while the value in `state` is updated immediately, the value returned\n * by `useState` is updated before the next render (similarly to React's `useState`).\n */\n useSyncedValue(key, value) {\n React.useDebugValue(key);\n // eslint-disable-next-line consistent-this\n const store = this;\n useIsoLayoutEffect(() => {\n if (store.state[key] !== value) {\n store.set(key, value);\n }\n }, [store, key, value]);\n }\n\n /**\n * Synchronizes a single external value into the store and\n * cleans it up (sets to `undefined`) on unmount.\n *\n * Note that the while the value in `state` is updated immediately, the value returned\n * by `useState` is updated before the next render (similarly to React's `useState`).\n */\n useSyncedValueWithCleanup(key, value) {\n // eslint-disable-next-line consistent-this\n const store = this;\n useIsoLayoutEffect(() => {\n if (store.state[key] !== value) {\n store.set(key, value);\n }\n return () => {\n store.set(key, undefined);\n };\n }, [store, key, value]);\n }\n\n /**\n * Synchronizes multiple external values into the store.\n * Each value must match its state key. Pass an exact known subset rather than a broad\n * `Partial<State>`, which may contain `undefined` for required state fields.\n *\n * Note that the while the values in `state` are updated immediately, the values returned\n * by `useState` are updated before the next render (similarly to React's `useState`).\n *\n * @param statePart An exact subset of state fields to synchronize. Unknown keys are not accepted.\n */\n useSyncedValues(statePart) {\n // eslint-disable-next-line consistent-this\n const store = this;\n if (process.env.NODE_ENV !== 'production') {\n // Check that an object with the same shape is passed on every render\n React.useDebugValue(statePart, p => Object.keys(p));\n const keys = React.useRef(Object.keys(statePart)).current;\n const nextKeys = Object.keys(statePart);\n if (keys.length !== nextKeys.length || keys.some((key, index) => key !== nextKeys[index])) {\n console.error('ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.');\n }\n }\n const dependencies = Object.values(statePart);\n useIsoLayoutEffect(() => {\n store.update(statePart);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [store, ...dependencies]);\n }\n\n /**\n * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled`\n * is non-undefined, the store's state at `key` is updated to match `controlled`.\n */\n useControlledProp(key, controlled) {\n React.useDebugValue(key);\n // eslint-disable-next-line consistent-this\n const store = this;\n const isControlled = controlled !== undefined;\n useIsoLayoutEffect(() => {\n if (isControlled && !Object.is(store.state[key], controlled)) {\n // Set the internal state to match the controlled value.\n store.setState({\n ...store.state,\n [key]: controlled\n });\n }\n }, [store, key, controlled, isControlled]);\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line\n const cache = this.controlledValues ??= new Map();\n if (!cache.has(key)) {\n cache.set(key, isControlled);\n }\n const previouslyControlled = cache.get(key);\n if (previouslyControlled !== undefined && previouslyControlled !== isControlled) {\n console.error(`A component is changing the ${isControlled ? '' : 'un'}controlled state of ${key.toString()} to be ${isControlled ? 'un' : ''}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`);\n }\n }\n }\n\n /** Gets the current value from the store using a selector with the provided key.\n *\n * @param key Key of the selector to use.\n */\n\n select(key, a1, a2, a3) {\n const selector = this.selectors[key];\n return selector(this.state, a1, a2, a3);\n }\n\n /**\n * Returns a value from the store's state using a selector function.\n * Used to subscribe to specific parts of the state.\n * This methods causes a rerender whenever the selected state changes.\n *\n * @param key Key of the selector to use.\n */\n\n useState(key, a1, a2, a3) {\n React.useDebugValue(key);\n return useStore(this, this.selectors[key], a1, a2, a3);\n }\n\n /**\n * Wraps a function with `useStableCallback` to ensure it has a stable reference\n * and assigns it to the context.\n *\n * @param key Key of the event callback. Must be a function in the context.\n * @param fn Function to assign.\n */\n useContextCallback(key, fn) {\n React.useDebugValue(key);\n const stableFunction = useStableCallback(fn ?? NOOP);\n this.context[key] = stableFunction;\n }\n\n /**\n * Returns a stable setter function for a specific key in the store's state.\n * It's commonly used to pass as a ref callback to React elements.\n *\n * @param key Key of the state to set.\n */\n useStateSetter(key) {\n const ref = React.useRef(undefined);\n if (ref.current === undefined) {\n ref.current = value => {\n this.set(key, value);\n };\n }\n return ref.current;\n }\n\n /**\n * Observes changes derived from the store's selectors and calls the listener when the selected value changes.\n *\n * @param key Key of the selector to observe.\n * @param listener Listener function called when the selector result changes.\n */\n\n observe(selector, listener) {\n let selectFn;\n if (typeof selector === 'function') {\n selectFn = selector;\n } else {\n selectFn = this.selectors[selector];\n }\n let prevValue = selectFn(this.state);\n listener(prevValue, prevValue, this);\n return this.subscribe(nextState => {\n const nextValue = selectFn(nextState);\n if (!Object.is(prevValue, nextValue)) {\n const oldValue = prevValue;\n prevValue = nextValue;\n listener(nextValue, oldValue, this);\n }\n });\n }\n}","/**\n * Combines multiple cleanup functions into a single cleanup function.\n */\nexport function mergeCleanups(...cleanups) {\n return () => {\n for (let i = 0; i < cleanups.length; i += 1) {\n const cleanup = cleanups[i];\n if (cleanup) {\n cleanup();\n }\n }\n };\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { platform } from '@base-ui/utils/platform';\nimport { visuallyHidden } from '@base-ui/utils/visuallyHidden';\n\n/**\n * @internal\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const FocusGuard = /*#__PURE__*/React.forwardRef(function FocusGuard(props, ref) {\n const [role, setRole] = React.useState();\n useIsoLayoutEffect(() => {\n // Unlike NVDA and JAWS, VoiceOver's virtual cursor triggers `onFocus` as\n // it moves — but only on focusable/role-button elements through WebKit's\n // NSAccessibility path. Setting `role=\"button\"` lets the focus trap catch\n // the cursor.\n if (platform.screenReader.voiceOver && platform.engine.webkit) {\n setRole('button');\n }\n }, []);\n const restProps = {\n tabIndex: 0,\n // Role is only for VoiceOver\n role\n };\n return /*#__PURE__*/_jsx(\"span\", {\n ...props,\n ref: ref,\n style: visuallyHidden,\n \"aria-hidden\": role ? undefined : true,\n ...restProps,\n \"data-base-ui-focus-guard\": \"\"\n });\n});\nif (process.env.NODE_ENV !== \"production\") FocusGuard.displayName = \"FocusGuard\";","export function createAttribute(name) {\n return `data-base-ui-${name}`;\n}","import { NOOP } from '@base-ui/utils/empty';\nlet rafId = 0;\nexport function enqueueFocus(el, options = {}) {\n const {\n preventScroll = false,\n sync = false,\n shouldFocus\n } = options;\n cancelAnimationFrame(rafId);\n function exec() {\n if (shouldFocus && !shouldFocus()) {\n return;\n }\n el?.focus({\n preventScroll\n });\n }\n if (sync) {\n exec();\n return NOOP;\n }\n const currentRafId = requestAnimationFrame(exec);\n rafId = currentRafId;\n return () => {\n if (rafId === currentRafId) {\n cancelAnimationFrame(currentRafId);\n rafId = 0;\n }\n };\n}","// Modified to add conditional `aria-hidden` support:\n// https://github.com/theKashey/aria-hidden/blob/9220c8f4a4fd35f63bee5510a9f41a37264382d4/src/index.ts\nimport { getNodeName, isShadowRoot } from '@floating-ui/utils/dom';\nimport { ownerDocument } from '@base-ui/utils/owner';\nconst counters = {\n inert: new WeakMap(),\n 'aria-hidden': new WeakMap()\n};\nconst markerName = 'data-base-ui-inert';\nconst uncontrolledElementsSets = {\n inert: new WeakSet(),\n 'aria-hidden': new WeakSet()\n};\nlet markerCounterMap = new WeakMap();\nlet lockCount = 0;\nfunction getUncontrolledElementsSet(controlAttribute) {\n return uncontrolledElementsSets[controlAttribute];\n}\nfunction unwrapHost(node) {\n if (!node) {\n return null;\n }\n return isShadowRoot(node) ? node.host : unwrapHost(node.parentNode);\n}\nconst correctElements = (parent, targets) => targets.map(target => {\n if (parent.contains(target)) {\n return target;\n }\n const correctedTarget = unwrapHost(target);\n if (parent.contains(correctedTarget)) {\n return correctedTarget;\n }\n return null;\n}).filter(x => x != null);\nconst buildKeepSet = targets => {\n const keep = new Set();\n targets.forEach(target => {\n let node = target;\n while (node && !keep.has(node)) {\n keep.add(node);\n node = node.parentNode;\n }\n });\n return keep;\n};\nconst collectOutsideElements = (root, keepElements, stopElements) => {\n const outside = [];\n const walk = parent => {\n if (!parent || stopElements.has(parent)) {\n return;\n }\n Array.from(parent.children).forEach(node => {\n if (getNodeName(node) === 'script') {\n return;\n }\n if (keepElements.has(node)) {\n walk(node);\n } else {\n outside.push(node);\n }\n });\n };\n walk(root);\n return outside;\n};\nfunction applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden, inert, {\n mark = true\n}) {\n let controlAttribute = null;\n if (inert) {\n controlAttribute = 'inert';\n } else if (ariaHidden) {\n controlAttribute = 'aria-hidden';\n }\n let counterMap = null;\n let uncontrolledElementsSet = null;\n const avoidElements = correctElements(body, uncorrectedAvoidElements);\n const markerTargets = mark ? collectOutsideElements(body, buildKeepSet(avoidElements), new Set(avoidElements)) : [];\n const hiddenElements = [];\n const markedElements = [];\n if (controlAttribute) {\n const map = counters[controlAttribute];\n const currentUncontrolledElementsSet = getUncontrolledElementsSet(controlAttribute);\n uncontrolledElementsSet = currentUncontrolledElementsSet;\n counterMap = map;\n const ariaLiveElements = correctElements(body, Array.from(body.querySelectorAll('[aria-live]')));\n const controlElements = avoidElements.concat(ariaLiveElements);\n const controlTargets = collectOutsideElements(body, buildKeepSet(controlElements), new Set(controlElements));\n controlTargets.forEach(node => {\n const attr = node.getAttribute(controlAttribute);\n const alreadyHidden = attr !== null && attr !== 'false';\n const counterValue = (map.get(node) || 0) + 1;\n map.set(node, counterValue);\n hiddenElements.push(node);\n if (counterValue === 1 && alreadyHidden) {\n currentUncontrolledElementsSet.add(node);\n }\n if (!alreadyHidden) {\n node.setAttribute(controlAttribute, controlAttribute === 'inert' ? '' : 'true');\n }\n });\n }\n if (mark) {\n markerTargets.forEach(node => {\n const markerValue = (markerCounterMap.get(node) || 0) + 1;\n markerCounterMap.set(node, markerValue);\n markedElements.push(node);\n if (markerValue === 1) {\n node.setAttribute(markerName, '');\n }\n });\n }\n lockCount += 1;\n return () => {\n if (counterMap) {\n hiddenElements.forEach(element => {\n const currentCounterValue = counterMap.get(element) || 0;\n const counterValue = currentCounterValue - 1;\n counterMap.set(element, counterValue);\n if (!counterValue) {\n if (!uncontrolledElementsSet?.has(element) && controlAttribute) {\n element.removeAttribute(controlAttribute);\n }\n uncontrolledElementsSet?.delete(element);\n }\n });\n }\n if (mark) {\n markedElements.forEach(element => {\n const markerValue = (markerCounterMap.get(element) || 0) - 1;\n markerCounterMap.set(element, markerValue);\n if (!markerValue) {\n element.removeAttribute(markerName);\n }\n });\n }\n lockCount -= 1;\n if (!lockCount) {\n counters.inert = new WeakMap();\n counters['aria-hidden'] = new WeakMap();\n uncontrolledElementsSets.inert = new WeakSet();\n uncontrolledElementsSets['aria-hidden'] = new WeakSet();\n markerCounterMap = new WeakMap();\n }\n };\n}\nexport function markOthers(avoidElements, options = {}) {\n const {\n ariaHidden = false,\n inert = false,\n mark = true\n } = options;\n const body = ownerDocument(avoidElements[0]).body;\n return applyAttributeToOthers(avoidElements, body, ariaHidden, inert, {\n mark\n });\n}","export const TYPEAHEAD_RESET_MS = 500;\nexport const PATIENT_CLICK_THRESHOLD = 500;\nexport const DISABLED_TRANSITIONS_STYLE = {\n style: {\n transition: 'none'\n }\n};\nexport const CLICK_TRIGGER_IDENTIFIER = 'data-base-ui-click-trigger';\nexport const BASE_UI_SWIPE_IGNORE_ATTRIBUTE = 'data-base-ui-swipe-ignore';\nexport const LEGACY_SWIPE_IGNORE_ATTRIBUTE = 'data-swipe-ignore';\nexport const BASE_UI_SWIPE_IGNORE_SELECTOR = `[${BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`;\nexport const LEGACY_SWIPE_IGNORE_SELECTOR = `[${LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`;\n\n/**\n * Used for dropdowns that usually strictly prefer top/bottom placements and\n * use `var(--available-height)` to limit their height.\n */\nexport const DROPDOWN_COLLISION_AVOIDANCE = {\n fallbackAxisSide: 'none'\n};\n\n/**\n * Used by regular popups that usually aren't scrollable and are allowed to\n * freely flip to any axis of placement.\n */\nexport const POPUP_COLLISION_AVOIDANCE = {\n fallbackAxisSide: 'end'\n};\n\n/**\n * Special visually hidden styles for the aria-owns owner element to ensure owned element\n * accessibility in iOS/Safari/VoiceControl.\n * The owner element is an empty span, so most of the common visually hidden styles are not needed.\n * @see https://github.com/floating-ui/floating-ui/issues/3403\n */\nexport const ownerVisuallyHidden = {\n clipPath: 'inset(50%)',\n position: 'fixed',\n top: 0,\n left: 0\n};","'use client';\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { isNode } from '@floating-ui/utils/dom';\nimport { addEventListener } from '@base-ui/utils/addEventListener';\nimport { mergeCleanups } from '@base-ui/utils/mergeCleanups';\nimport { useId } from '@base-ui/utils/useId';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { FocusGuard } from \"../../utils/FocusGuard.mjs\";\nimport { enableFocusInside, disableFocusInside, getPreviousTabbable, getNextTabbable, isOutsideEvent } from \"../utils/tabbable.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { createAttribute } from \"../utils/createAttribute.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { ownerVisuallyHidden } from \"../../internals/constants.mjs\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst PortalContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") PortalContext.displayName = \"PortalContext\";\nexport const usePortalContext = () => React.useContext(PortalContext);\nconst attr = createAttribute('portal');\nexport function useFloatingPortalNode(props = {}) {\n const {\n ref,\n container: containerProp,\n componentProps = EMPTY_OBJECT,\n elementProps\n } = props;\n const uniqueId = useId();\n const portalContext = usePortalContext();\n const parentPortalNode = portalContext?.portalNode;\n const [containerElement, setContainerElement] = React.useState(null);\n const [portalNode, setPortalNode] = React.useState(null);\n const setPortalNodeRef = useStableCallback(node => {\n if (node !== null) {\n // the useIsoLayoutEffect below watching containerProp / parentPortalNode\n // sets setPortalNode(null) when the container becomes null or changes.\n // So even though the ref callback now ignores null, the portal node still gets cleared.\n setPortalNode(node);\n }\n });\n const containerRef = React.useRef(null);\n useIsoLayoutEffect(() => {\n // Wait for the container to be resolved if explicitly `null`.\n if (containerProp === null) {\n if (containerRef.current) {\n containerRef.current = null;\n setPortalNode(null);\n setContainerElement(null);\n }\n return;\n }\n const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body;\n if (resolvedContainer == null) {\n if (containerRef.current) {\n containerRef.current = null;\n setPortalNode(null);\n setContainerElement(null);\n }\n return;\n }\n if (containerRef.current !== resolvedContainer) {\n containerRef.current = resolvedContainer;\n setPortalNode(null);\n setContainerElement(resolvedContainer);\n }\n }, [containerProp, parentPortalNode]);\n const portalElement = useRenderElement('div', componentProps, {\n ref: [ref, setPortalNodeRef],\n props: [{\n id: uniqueId,\n [attr]: ''\n }, elementProps]\n });\n\n // This `createPortal` call injects `portalElement` into the `container`.\n // Another call inside `FloatingPortal`/`FloatingPortalLite` then injects the children into `portalElement`.\n const portalSubtree = containerElement && portalElement ? /*#__PURE__*/ReactDOM.createPortal(portalElement, containerElement) : null;\n return {\n node: portalNode,\n // `id` and `render` props can override or remove the generated ID. Use the exact\n // rendered value so `aria-owns` never points at an ID absent from the DOM.\n nodeId: /*#__PURE__*/React.isValidElement(portalElement) ? portalElement.props.id : undefined,\n subtree: portalSubtree\n };\n}\n\n/**\n * Portals the floating element into a given container element — by default,\n * outside of the app root and into the body.\n * This is necessary to ensure the floating element can appear outside any\n * potential parent containers that cause clipping (such as `overflow: hidden`),\n * while retaining its location in the React tree.\n * @see https://floating-ui.com/docs/FloatingPortal\n * @internal\n */\nexport const FloatingPortal = /*#__PURE__*/React.forwardRef(function FloatingPortal(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n children,\n container,\n portalOwnerRole,\n ...elementProps\n } = componentProps;\n const {\n node: portalNode,\n nodeId: portalNodeId,\n subtree: portalSubtree\n } = useFloatingPortalNode({\n container,\n ref: forwardedRef,\n componentProps,\n elementProps\n });\n const beforeOutsideRef = React.useRef(null);\n const afterOutsideRef = React.useRef(null);\n const beforeInsideRef = React.useRef(null);\n const afterInsideRef = React.useRef(null);\n const [focusManagerState, setFocusManagerState] = React.useState(null);\n const focusInsideDisabledRef = React.useRef(false);\n const modal = focusManagerState?.modal;\n const open = focusManagerState?.open;\n const shouldRenderGuards = !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode;\n\n // https://codesandbox.io/s/tabbable-portal-f4tng?file=/src/TabbablePortal.tsx\n React.useEffect(() => {\n if (!portalNode || modal) {\n return undefined;\n }\n\n // Make sure elements inside the portal element are tabbable only when the\n // portal has already been focused, either by tabbing into a focus trap\n // element outside or using the mouse.\n function onFocus(event) {\n if (portalNode && event.relatedTarget && isOutsideEvent(event)) {\n if (event.type === 'focusin') {\n if (focusInsideDisabledRef.current) {\n enableFocusInside(portalNode);\n focusInsideDisabledRef.current = false;\n }\n } else {\n disableFocusInside(portalNode);\n focusInsideDisabledRef.current = true;\n }\n }\n }\n\n // Listen to the event on the capture phase so they run before the focus\n // trap elements onFocus prop is called.\n return mergeCleanups(addEventListener(portalNode, 'focusin', onFocus, true), addEventListener(portalNode, 'focusout', onFocus, true));\n }, [portalNode, modal]);\n useIsoLayoutEffect(() => {\n if (!portalNode || open !== true || !focusInsideDisabledRef.current) {\n return;\n }\n\n // Restore tabbability before the focus manager's queued focus-on-open step runs.\n enableFocusInside(portalNode);\n focusInsideDisabledRef.current = false;\n }, [open, portalNode]);\n const portalContextValue = React.useMemo(() => ({\n beforeOutsideRef,\n afterOutsideRef,\n beforeInsideRef,\n afterInsideRef,\n portalNode,\n setFocusManagerState\n }), [portalNode]);\n return /*#__PURE__*/_jsxs(React.Fragment, {\n children: [portalSubtree, /*#__PURE__*/_jsxs(PortalContext.Provider, {\n value: portalContextValue,\n children: [shouldRenderGuards && portalNode && /*#__PURE__*/_jsx(FocusGuard, {\n \"data-type\": \"outside\",\n ref: beforeOutsideRef,\n onFocus: event => {\n if (isOutsideEvent(event, portalNode)) {\n beforeInsideRef.current?.focus();\n } else {\n const domReference = focusManagerState ? focusManagerState.domReference : null;\n const prevTabbable = getPreviousTabbable(domReference);\n prevTabbable?.focus();\n }\n }\n }), shouldRenderGuards && portalNode && /*#__PURE__*/_jsx(\"span\", {\n role: portalOwnerRole,\n \"aria-owns\": portalNodeId,\n style: ownerVisuallyHidden\n }), portalNode && /*#__PURE__*/ReactDOM.createPortal(children, portalNode), shouldRenderGuards && portalNode && /*#__PURE__*/_jsx(FocusGuard, {\n \"data-type\": \"outside\",\n ref: afterOutsideRef,\n onFocus: event => {\n if (isOutsideEvent(event, portalNode)) {\n afterInsideRef.current?.focus();\n } else {\n const domReference = focusManagerState ? focusManagerState.domReference : null;\n const nextTabbable = getNextTabbable(domReference);\n nextTabbable?.focus();\n if (focusManagerState?.closeOnFocusOut) {\n focusManagerState?.onOpenChange(false, createChangeEventDetails(REASONS.focusOut, event.nativeEvent));\n }\n }\n }\n })]\n })]\n });\n});\nif (process.env.NODE_ENV !== \"production\") FloatingPortal.displayName = \"FloatingPortal\";","export function createEventEmitter() {\n const map = new Map();\n return {\n emit(event, data) {\n map.get(event)?.forEach(listener => listener(data));\n },\n on(event, listener) {\n if (!map.has(event)) {\n map.set(event, new Set());\n }\n map.get(event).add(listener);\n },\n off(event, listener) {\n map.get(event)?.delete(listener);\n }\n };\n}","'use client';\n\nimport * as React from 'react';\nimport { useId } from '@base-ui/utils/useId';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { FloatingTreeStore } from \"./FloatingTreeStore.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst FloatingNodeContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") FloatingNodeContext.displayName = \"FloatingNodeContext\";\nconst FloatingTreeContext = /*#__PURE__*/React.createContext(null);\n\n/**\n * Returns the parent node id for nested floating elements, if available.\n * Returns `null` for top-level floating elements.\n */\nif (process.env.NODE_ENV !== \"production\") FloatingTreeContext.displayName = \"FloatingTreeContext\";\nexport const useFloatingParentNodeId = () => React.useContext(FloatingNodeContext)?.id || null;\n\n/**\n * Returns the nearest floating tree context, if available.\n */\nexport const useFloatingTree = externalTree => {\n const contextTree = React.useContext(FloatingTreeContext);\n return externalTree ?? contextTree;\n};\n\n/**\n * Registers a node into the `FloatingTree`, returning its id.\n * @see https://floating-ui.com/docs/FloatingTree\n */\nexport function useFloatingNodeId(externalTree) {\n const id = useId();\n const tree = useFloatingTree(externalTree);\n const parentId = useFloatingParentNodeId();\n useIsoLayoutEffect(() => {\n if (!id) {\n return undefined;\n }\n const node = {\n id,\n parentId\n };\n tree?.addNode(node);\n return () => {\n tree?.removeNode(node);\n };\n }, [tree, id, parentId]);\n return id;\n}\n/**\n * Provides parent node context for nested floating elements.\n * @see https://floating-ui.com/docs/FloatingTree\n * @internal\n */\nexport function FloatingNode(props) {\n const {\n children,\n id\n } = props;\n const parentId = useFloatingParentNodeId();\n return /*#__PURE__*/_jsx(FloatingNodeContext.Provider, {\n value: React.useMemo(() => ({\n id,\n parentId\n }), [id, parentId]),\n children: children\n });\n}\n/**\n * Provides context for nested floating elements when they are not children of\n * each other on the DOM.\n * This is not necessary in all cases, except when there must be explicit communication between parent and child floating elements. It is necessary for:\n * - The `bubbles` option in the `useDismiss()` Hook\n * - Nested virtual list navigation\n * - Nested floating elements that each open on hover\n * - Custom communication between parent and child floating elements\n * @see https://floating-ui.com/docs/FloatingTree\n * @internal\n */\nexport function FloatingTree(props) {\n const {\n children,\n externalTree\n } = props;\n const tree = useRefWithInit(() => externalTree ?? new FloatingTreeStore()).current;\n return /*#__PURE__*/_jsx(FloatingTreeContext.Provider, {\n value: tree,\n children: children\n });\n}","'use client';\n\nimport * as React from 'react';\nimport { getNodeName, isHTMLElement } from '@floating-ui/utils/dom';\nimport { addEventListener } from '@base-ui/utils/addEventListener';\nimport { mergeCleanups } from '@base-ui/utils/mergeCleanups';\nimport { useMergedRefs } from '@base-ui/utils/useMergedRefs';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useTimeout } from '@base-ui/utils/useTimeout';\nimport { platform } from '@base-ui/utils/platform';\nimport { useAnimationFrame } from '@base-ui/utils/useAnimationFrame';\nimport { ownerDocument, ownerWindow } from '@base-ui/utils/owner';\nimport { FocusGuard } from \"../../utils/FocusGuard.mjs\";\nimport { activeElement, contains, getTarget, isTypeableCombobox, getFloatingFocusElement, isTypeableElement } from \"../utils/element.mjs\";\nimport { isVirtualClick, isVirtualPointerEvent, stopEvent } from \"../utils/event.mjs\";\nimport { tabbable, focusable, isOutsideEvent, isTabbable, getNextTabbable, getPreviousTabbable } from \"../utils/tabbable.mjs\";\nimport { getNodeAncestors, getNodeChildren } from \"../utils/nodes.mjs\";\nimport { isElementVisible } from \"../utils/composite.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { createAttribute } from \"../utils/createAttribute.mjs\";\nimport { enqueueFocus } from \"../utils/enqueueFocus.mjs\";\nimport { markOthers } from \"../utils/markOthers.mjs\";\nimport { usePortalContext } from \"./FloatingPortal.mjs\";\nimport { useFloatingTree } from \"./FloatingTree.mjs\";\nimport { CLICK_TRIGGER_IDENTIFIER } from \"../../internals/constants.mjs\";\nimport { resolveRef } from \"../../utils/resolveRef.mjs\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction getEventType(event, lastInteractionType) {\n const win = ownerWindow(getTarget(event));\n if (event instanceof win.KeyboardEvent) {\n return 'keyboard';\n }\n if (event instanceof win.FocusEvent) {\n // Focus events can be caused by a preceding pointer interaction (e.g., focusout on outside press).\n // Prefer the last known pointer type if provided, else treat as keyboard.\n return lastInteractionType || 'keyboard';\n }\n if ('pointerType' in event) {\n return event.pointerType || 'keyboard';\n }\n if ('touches' in event) {\n return 'touch';\n }\n if (event instanceof win.MouseEvent) {\n // onClick events may not contain pointer events, and will fall through to here\n return lastInteractionType || (event.detail === 0 ? 'keyboard' : 'mouse');\n }\n return '';\n}\nconst LIST_LIMIT = 20;\nlet previouslyFocusedElements = [];\nfunction clearDisconnectedPreviouslyFocusedElements() {\n previouslyFocusedElements = previouslyFocusedElements.filter(entry => {\n return entry.deref()?.isConnected;\n });\n}\nfunction addPreviouslyFocusedElement(element) {\n clearDisconnectedPreviouslyFocusedElements();\n if (element && getNodeName(element) !== 'body') {\n previouslyFocusedElements.push(new WeakRef(element));\n if (previouslyFocusedElements.length > LIST_LIMIT) {\n previouslyFocusedElements = previouslyFocusedElements.slice(-LIST_LIMIT);\n }\n }\n}\nfunction getPreviouslyFocusedElement() {\n clearDisconnectedPreviouslyFocusedElements();\n return previouslyFocusedElements[previouslyFocusedElements.length - 1]?.deref();\n}\nfunction getFirstTabbableElement(container) {\n if (!container) {\n return null;\n }\n if (isTabbable(container)) {\n return container;\n }\n return tabbable(container)[0] || container;\n}\nfunction handleTabIndex(floatingFocusElement) {\n if (floatingFocusElement.hasAttribute('tabindex') && !floatingFocusElement.hasAttribute('data-tabindex')) {\n return;\n }\n if (!floatingFocusElement.getAttribute('role')?.includes('dialog')) {\n return;\n }\n const focusableElements = focusable(floatingFocusElement);\n const tabbableContent = focusableElements.filter(element => {\n const dataTabIndex = element.getAttribute('data-tabindex') || '';\n return isTabbable(element) || element.hasAttribute('data-tabindex') && !dataTabIndex.startsWith('-');\n });\n const tabIndex = floatingFocusElement.getAttribute('tabindex');\n if (tabbableContent.length === 0) {\n if (tabIndex !== '0') {\n floatingFocusElement.setAttribute('tabindex', '0');\n // Mark our own write so the externally-managed early-return above doesn't\n // mistake it for a user-authored `tabindex` and freeze management.\n floatingFocusElement.setAttribute('data-tabindex', '0');\n }\n } else if (tabIndex !== '-1' || floatingFocusElement.hasAttribute('data-tabindex') && floatingFocusElement.getAttribute('data-tabindex') !== '-1') {\n floatingFocusElement.setAttribute('tabindex', '-1');\n floatingFocusElement.setAttribute('data-tabindex', '-1');\n }\n}\n/**\n * Provides focus management for the floating element.\n * @see https://floating-ui.com/docs/FloatingFocusManager\n * @internal\n */\nexport function FloatingFocusManager(props) {\n const {\n context,\n children,\n disabled = false,\n initialFocus = true,\n returnFocus = true,\n restoreFocus = false,\n modal = true,\n closeOnFocusOut = true,\n openInteractionType = '',\n nextFocusableElement,\n previousFocusableElement,\n beforeContentFocusGuardRef,\n externalTree,\n getInsideElements\n } = props;\n const store = 'rootStore' in context ? context.rootStore : context;\n const open = store.useState('open');\n const domReference = store.useState('domReferenceElement');\n const floating = store.useState('floatingElement');\n const {\n events,\n dataRef\n } = store.context;\n const getNodeId = useStableCallback(() => dataRef.current.floatingContext?.nodeId);\n const ignoreInitialFocus = initialFocus === false;\n // A typeable combobox reference (e.g. input/textarea) with `initialFocus={false}`\n // has different focus semantics: focus is not trapped inside the floating element,\n // so in the modal case the guards are not rendered, but `aria-hidden` is still\n // applied to the outside nodes.\n const isUntrappedTypeableCombobox = isTypeableCombobox(domReference) && ignoreInitialFocus;\n const initialFocusRef = useValueAsRef(initialFocus);\n const returnFocusRef = useValueAsRef(returnFocus);\n const openInteractionTypeRef = useValueAsRef(openInteractionType);\n const openRef = useValueAsRef(open);\n const tree = useFloatingTree(externalTree);\n const portalContext = usePortalContext();\n const preventReturnFocusRef = React.useRef(false);\n const isPointerDownRef = React.useRef(false);\n const pointerDownOutsideRef = React.useRef(false);\n const lastFocusedTabbableRef = React.useRef(null);\n const closeTypeRef = React.useRef('');\n const lastInteractionTypeRef = React.useRef('');\n const beforeGuardRef = React.useRef(null);\n const afterGuardRef = React.useRef(null);\n const mergedBeforeGuardRef = useMergedRefs(beforeGuardRef, beforeContentFocusGuardRef, portalContext?.beforeInsideRef);\n const mergedAfterGuardRef = useMergedRefs(afterGuardRef, portalContext?.afterInsideRef);\n const blurTimeout = useTimeout();\n const pointerDownTimeout = useTimeout();\n const restoreFocusFrame = useAnimationFrame();\n const isInsidePortal = portalContext != null;\n const floatingFocusElement = getFloatingFocusElement(floating);\n const getTabbableContent = useStableCallback((container = floatingFocusElement) => {\n return container ? tabbable(container) : [];\n });\n const getResolvedInsideElements = useStableCallback(() => getInsideElements?.().filter(element => element != null) ?? []);\n\n // Prevent Tab from escaping the modal when there are no tabbable elements.\n React.useEffect(() => {\n if (disabled || !modal) {\n return undefined;\n }\n function onKeyDown(event) {\n if (event.key === 'Tab') {\n // The focus guards have nothing to focus, so we need to stop the event.\n if (contains(floatingFocusElement, activeElement(ownerDocument(floatingFocusElement))) && getTabbableContent().length === 0 && !isUntrappedTypeableCombobox) {\n stopEvent(event);\n }\n }\n }\n const doc = ownerDocument(floatingFocusElement);\n return addEventListener(doc, 'keydown', onKeyDown);\n }, [disabled, floatingFocusElement, modal, isUntrappedTypeableCombobox, getTabbableContent]);\n\n // Track pointer/keyboard interactions to disambiguate focus and outside presses.\n React.useEffect(() => {\n if (disabled || !open) {\n return undefined;\n }\n const doc = ownerDocument(floatingFocusElement);\n function clearPointerDownOutside() {\n pointerDownOutsideRef.current = false;\n }\n function onPointerDown(event) {\n const target = getTarget(event);\n const insideElements = getResolvedInsideElements();\n const pointerTargetInside = contains(floating, target) || contains(domReference, target) || contains(portalContext?.portalNode, target) || insideElements.some(element => element === target || contains(element, target));\n pointerDownOutsideRef.current = !pointerTargetInside;\n lastInteractionTypeRef.current = event.pointerType || 'keyboard';\n if (target?.closest(`[${CLICK_TRIGGER_IDENTIFIER}]`)) {\n isPointerDownRef.current = true;\n // Reset on the next tick so a single click on a click-trigger doesn't\n // permanently suppress focus-out closing for the lifetime of the instance.\n pointerDownTimeout.start(0, () => {\n isPointerDownRef.current = false;\n });\n }\n }\n function onKeyDown() {\n lastInteractionTypeRef.current = 'keyboard';\n }\n return mergeCleanups(addEventListener(doc, 'pointerdown', onPointerDown, true), addEventListener(doc, 'pointerup', clearPointerDownOutside, true), addEventListener(doc, 'pointercancel', clearPointerDownOutside, true), addEventListener(doc, 'keydown', onKeyDown, true),\n // Avoid a stale `true` leaking into the next open (e.g. keep-mounted popups)\n // if the popup dismissed between pointerdown and pointerup.\n clearPointerDownOutside);\n }, [disabled, floating, domReference, floatingFocusElement, open, portalContext, pointerDownTimeout, getResolvedInsideElements]);\n\n // Close on focus out and restore focus within the floating tree when needed.\n React.useEffect(() => {\n if (disabled || !closeOnFocusOut) {\n return undefined;\n }\n const doc = ownerDocument(floatingFocusElement);\n\n // In Safari, buttons lose focus when pressing them.\n function handlePointerDown() {\n isPointerDownRef.current = true;\n pointerDownTimeout.start(0, () => {\n isPointerDownRef.current = false;\n });\n }\n function handleFocusIn(event) {\n const target = getTarget(event);\n if (isTabbable(target)) {\n lastFocusedTabbableRef.current = target;\n }\n }\n function handleFocusOutside(event) {\n const relatedTarget = event.relatedTarget;\n const currentTarget = event.currentTarget;\n const target = getTarget(event);\n\n // When focus is lost to the body (e.g. on a backdrop press), record the element that\n // had focus so a confirmation dialog opened while the body is focused can return focus\n // to it. Scoped to `modal` to avoid non-modal popups polluting the shared stack.\n if (modal && relatedTarget == null && target != null && contains(floating, target)) {\n addPreviouslyFocusedElement(target);\n }\n queueMicrotask(() => {\n const nodeId = getNodeId();\n const triggers = store.context.triggerElements;\n const insideElements = getResolvedInsideElements();\n const isRelatedFocusGuard = relatedTarget?.hasAttribute(createAttribute('focus-guard')) && [beforeGuardRef.current, afterGuardRef.current, portalContext?.beforeInsideRef.current, portalContext?.afterInsideRef.current, portalContext?.beforeOutsideRef.current, portalContext?.afterOutsideRef.current, resolveRef(previousFocusableElement), resolveRef(nextFocusableElement)].includes(relatedTarget);\n const movedToUnrelatedNode = !(contains(domReference, relatedTarget) || contains(floating, relatedTarget) || contains(relatedTarget, floating) || contains(portalContext?.portalNode, relatedTarget) || insideElements.some(element => element === relatedTarget || contains(element, relatedTarget)) || triggers.hasMatchingElement(trigger => contains(trigger, relatedTarget)) || isRelatedFocusGuard || tree && (getNodeChildren(tree.nodesRef.current, nodeId).find(node => contains(node.context?.elements.floating, relatedTarget) || contains(node.context?.elements.domReference, relatedTarget)) || getNodeAncestors(tree.nodesRef.current, nodeId).find(node => [node.context?.elements.floating, getFloatingFocusElement(node.context?.elements.floating)].includes(relatedTarget) || node.context?.elements.domReference === relatedTarget)));\n if (currentTarget === domReference && floatingFocusElement) {\n handleTabIndex(floatingFocusElement);\n }\n\n // Restore focus to the previously focused tabbable element to prevent\n // focus from being lost outside the floating tree.\n if (restoreFocus && currentTarget !== domReference && !isElementVisible(target) && activeElement(doc) === doc.body) {\n // Let `FloatingPortal` effect knows that focus is still inside the\n // floating tree.\n if (isHTMLElement(floatingFocusElement)) {\n floatingFocusElement.focus();\n // If explicitly requested to restore focus to the popup container, do not search\n // for the next/previous tabbable element.\n if (restoreFocus === 'popup') {\n // If the focused element is removed on pointerdown, the browser\n // tries to move focus to it right after the `.focus()` call above,\n // but because it's removed in the same tick, focus is lost instead.\n // Re-focusing asynchronously (next frame) wins that race.\n restoreFocusFrame.request(() => {\n floatingFocusElement.focus();\n });\n return;\n }\n }\n const tabbableContent = getTabbableContent();\n const prevTabbable = lastFocusedTabbableRef.current;\n const nodeToFocus = (prevTabbable && tabbableContent.includes(prevTabbable) ? prevTabbable : null) || tabbableContent[tabbableContent.length - 1] || floatingFocusElement;\n if (isHTMLElement(nodeToFocus)) {\n nodeToFocus.focus();\n }\n }\n\n // https://github.com/floating-ui/floating-ui/issues/3060\n if (dataRef.current.insideReactTree) {\n dataRef.current.insideReactTree = false;\n return;\n }\n\n // Focus did not move inside the floating tree, and there are no tabbable\n // portal guards to handle closing.\n if ((isUntrappedTypeableCombobox ? true : !modal) && relatedTarget && movedToUnrelatedNode && !isPointerDownRef.current && (\n // Fix React 18 Strict Mode returnFocus due to double rendering.\n // For an \"untrapped\" typeable combobox (input role=combobox with\n // initialFocus=false), re-opening the popup and tabbing out should still close it even\n // when the previously focused element (e.g. the next tabbable outside the popup) is\n // focused again. Otherwise, the popup remains open on the second Tab sequence:\n // click input -> Tab (closes) -> click input -> Tab.\n // Allow closing when `isUntrappedTypeableCombobox` regardless of the previously focused element.\n isUntrappedTypeableCombobox || relatedTarget !== getPreviouslyFocusedElement())) {\n preventReturnFocusRef.current = true;\n store.setOpen(false, createChangeEventDetails(REASONS.focusOut, event));\n }\n });\n }\n function markInsideReactTree() {\n if (pointerDownOutsideRef.current) {\n return;\n }\n dataRef.current.insideReactTree = true;\n blurTimeout.start(0, () => {\n dataRef.current.insideReactTree = false;\n });\n }\n const domReferenceElement = isHTMLElement(domReference) ? domReference : null;\n if (!floating && !domReferenceElement) {\n return undefined;\n }\n return mergeCleanups(domReferenceElement && addEventListener(domReferenceElement, 'focusout', handleFocusOutside), domReferenceElement && addEventListener(domReferenceElement, 'pointerdown', handlePointerDown), floating && addEventListener(floating, 'focusin', handleFocusIn), floating && addEventListener(floating, 'focusout', handleFocusOutside), floating && portalContext && addEventListener(floating, 'focusout', markInsideReactTree, true));\n }, [disabled, domReference, floating, floatingFocusElement, modal, tree, portalContext, store, closeOnFocusOut, restoreFocus, getTabbableContent, isUntrappedTypeableCombobox, getNodeId, dataRef, blurTimeout, pointerDownTimeout, restoreFocusFrame, nextFocusableElement, previousFocusableElement, getResolvedInsideElements]);\n\n // Hide everything outside the floating tree from assistive tech while open.\n React.useEffect(() => {\n if (disabled || !floating || !open) {\n return undefined;\n }\n\n // Don't hide portals nested within the parent portal.\n const portalNodes = Array.from(portalContext?.portalNode?.querySelectorAll(`[${createAttribute('portal')}]`) || []);\n const ancestors = tree ? getNodeAncestors(tree.nodesRef.current, getNodeId()) : [];\n const rootAncestorComboboxDomReference = ancestors.find(node => isTypeableCombobox(node.context?.elements.domReference || null))?.context?.elements.domReference;\n const controlInsideElements = [floating, ...portalNodes, beforeGuardRef.current, afterGuardRef.current, portalContext?.beforeOutsideRef.current, portalContext?.afterOutsideRef.current, ...getResolvedInsideElements()];\n const insideElements = [...controlInsideElements, rootAncestorComboboxDomReference, resolveRef(previousFocusableElement), resolveRef(nextFocusableElement), isUntrappedTypeableCombobox ? domReference : null].filter(x => x != null);\n const ariaHiddenCleanup = markOthers(insideElements, {\n ariaHidden: modal || isUntrappedTypeableCombobox,\n mark: false\n });\n const markerInsideElements = [floating, ...portalNodes].filter(x => x != null);\n const markerCleanup = markOthers(markerInsideElements);\n return () => {\n markerCleanup();\n ariaHiddenCleanup();\n };\n }, [open, disabled, domReference, floating, modal, portalContext, isUntrappedTypeableCombobox, tree, getNodeId, nextFocusableElement, previousFocusableElement, getResolvedInsideElements]);\n\n // Focus the initial element when the floating element opens.\n useIsoLayoutEffect(() => {\n if (!open || disabled || !isHTMLElement(floatingFocusElement)) {\n return;\n }\n closeTypeRef.current = '';\n lastInteractionTypeRef.current = '';\n const doc = ownerDocument(floatingFocusElement);\n const previouslyFocusedElement = activeElement(doc);\n\n // Wait for any layout effect state setters to execute to set `tabIndex`.\n queueMicrotask(() => {\n const initialFocusValueOrFn = initialFocusRef.current;\n const resolvedInitialFocus = typeof initialFocusValueOrFn === 'function' ? initialFocusValueOrFn(openInteractionTypeRef.current || '') : initialFocusValueOrFn;\n\n // `null` should fallback to default behavior in case of an empty ref.\n if (resolvedInitialFocus === undefined || resolvedInitialFocus === false) {\n return;\n }\n const focusAlreadyInsideFloatingEl = contains(floatingFocusElement, previouslyFocusedElement);\n if (focusAlreadyInsideFloatingEl) {\n return;\n }\n let focusableElements = null;\n const getDefaultFocusElement = () => {\n if (focusableElements == null) {\n focusableElements = getTabbableContent(floatingFocusElement);\n }\n return focusableElements[0] || floatingFocusElement;\n };\n let elToFocus;\n if (resolvedInitialFocus === true || resolvedInitialFocus === null) {\n elToFocus = getDefaultFocusElement();\n } else {\n elToFocus = resolveRef(resolvedInitialFocus);\n }\n elToFocus = elToFocus || getDefaultFocusElement();\n const hadFocusInside = contains(floatingFocusElement, activeElement(doc));\n\n // enqueueFocus returns a rAF-cancel function; we intentionally don't cancel this focus.\n void enqueueFocus(elToFocus, {\n preventScroll: elToFocus === floatingFocusElement,\n shouldFocus() {\n // This focus is queued on the next animation frame. If the floating element has closed\n // before it runs — e.g. tabbing out of a kept-mounted popup — don't pull focus back\n // onto the initial element after it has legitimately moved elsewhere.\n if (!openRef.current) {\n return false;\n }\n if (hadFocusInside) {\n return true;\n }\n const currentActiveElement = activeElement(doc);\n const focusMovedInside = currentActiveElement !== elToFocus && contains(floatingFocusElement, currentActiveElement);\n return !focusMovedInside;\n }\n });\n });\n }, [disabled, open, floatingFocusElement, getTabbableContent, initialFocusRef, openInteractionTypeRef, openRef]);\n\n // Track return focus targets and restore focus on unmount/close.\n useIsoLayoutEffect(() => {\n if (disabled || !floatingFocusElement) {\n return undefined;\n }\n const doc = ownerDocument(floatingFocusElement);\n const elementFocusedBeforeOpen = activeElement(doc);\n // Only an explicit `null` interaction type represents a programmatic open.\n // `undefined` is normalized to `''` by the prop default, so it never reaches\n // here as nullish and is intentionally not treated as programmatic.\n const preferPreviousFocus = openInteractionTypeRef.current == null;\n addPreviouslyFocusedElement(elementFocusedBeforeOpen);\n function onOpenChangeLocal(details) {\n if (!details.open) {\n closeTypeRef.current = getEventType(details.nativeEvent, lastInteractionTypeRef.current);\n }\n if (details.reason === REASONS.triggerHover && details.nativeEvent.type === 'mouseleave') {\n preventReturnFocusRef.current = true;\n }\n if (details.reason !== REASONS.outsidePress) {\n return;\n }\n if (details.nested) {\n preventReturnFocusRef.current = false;\n } else if (isVirtualClick(details.nativeEvent) || isVirtualPointerEvent(details.nativeEvent)) {\n preventReturnFocusRef.current = false;\n } else {\n // On outside press, only return focus to the reference when the browser supports the\n // `focus({ preventScroll })` option; without it, restoring focus scrolls the page.\n // Chrome on Android and Samsung Internet still don't support `preventScroll`\n // (https://issues.chromium.org/issues/41453122), so the runtime check keeps return\n // focus disabled there to avoid the scroll jump.\n let isPreventScrollSupported = false;\n ownerDocument(floatingFocusElement).createElement('div').focus({\n get preventScroll() {\n isPreventScrollSupported = true;\n return false;\n }\n });\n if (isPreventScrollSupported) {\n preventReturnFocusRef.current = false;\n } else {\n preventReturnFocusRef.current = true;\n }\n }\n }\n events.on('openchange', onOpenChangeLocal);\n function getReturnElement(closeType) {\n const returnFocusValueOrFn = returnFocusRef.current;\n let resolvedReturnFocusValue = typeof returnFocusValueOrFn === 'function' ? returnFocusValueOrFn(closeType) : returnFocusValueOrFn;\n\n // `null` should fallback to default behavior in case of an empty ref.\n if (resolvedReturnFocusValue === undefined || resolvedReturnFocusValue === false) {\n return null;\n }\n if (resolvedReturnFocusValue === null) {\n resolvedReturnFocusValue = true;\n }\n const referenceReturnElement = domReference?.isConnected ? domReference : null;\n const previousReturnElement = elementFocusedBeforeOpen?.isConnected && getNodeName(elementFocusedBeforeOpen) !== 'body' ? elementFocusedBeforeOpen : null;\n let defaultReturnElement = preferPreviousFocus ? previousReturnElement || referenceReturnElement : referenceReturnElement || previousReturnElement;\n if (!defaultReturnElement) {\n defaultReturnElement = getPreviouslyFocusedElement() || null;\n }\n if (typeof resolvedReturnFocusValue === 'boolean') {\n return defaultReturnElement;\n }\n return resolveRef(resolvedReturnFocusValue) || defaultReturnElement || null;\n }\n return () => {\n events.off('openchange', onOpenChangeLocal);\n const activeEl = activeElement(doc);\n const insideElements = getResolvedInsideElements();\n const isFocusInsideFloatingTree = contains(floating, activeEl) || insideElements.some(element => element === activeEl || contains(element, activeEl)) || tree && getNodeChildren(tree.nodesRef.current, getNodeId(), false).some(node => contains(node.context?.elements.floating, activeEl));\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const returnFocusValueOrFn = returnFocusRef.current;\n const closeType = closeTypeRef.current;\n const returnElement = getReturnElement(closeType);\n queueMicrotask(() => {\n // `returnElement` if it is tabbable, otherwise its first tabbable child,\n // otherwise `returnElement` itself (which may not be tabbable at all).\n const tabbableReturnElement = getFirstTabbableElement(returnElement);\n const hasExplicitReturnFocus = typeof returnFocusValueOrFn !== 'boolean';\n if (returnFocusValueOrFn && !preventReturnFocusRef.current && isHTMLElement(tabbableReturnElement) && (\n // If the focus moved somewhere else after mount, avoid returning focus\n // since it likely entered a different element which should be\n // respected: https://github.com/floating-ui/floating-ui/issues/2607\n !hasExplicitReturnFocus && tabbableReturnElement !== activeEl && activeEl !== doc.body ? isFocusInsideFloatingTree : true)) {\n const focusOptions = {\n preventScroll: true\n };\n if (closeType === 'keyboard') {\n focusOptions.focusVisible = true;\n }\n tabbableReturnElement.focus(focusOptions);\n }\n preventReturnFocusRef.current = false;\n });\n };\n }, [disabled, floating, floatingFocusElement, returnFocusRef, openInteractionTypeRef, events, tree, domReference, getNodeId, getResolvedInsideElements]);\n\n // Safari may randomly scroll to the bottom of the page if an input inside a popup has focus\n // when the popup unmounts from the DOM.\n // By blurring it before the popup unmounts, we can prevent this behavior.\n useIsoLayoutEffect(() => {\n if (!platform.engine.webkit || open || !floating) {\n return;\n }\n const activeEl = activeElement(ownerDocument(floating));\n if (!isHTMLElement(activeEl) || !isTypeableElement(activeEl)) {\n return;\n }\n if (contains(floating, activeEl)) {\n activeEl.blur();\n }\n }, [open, floating]);\n\n // Synchronize the focus manager state (modal, closeOnFocusOut, open, etc.) to the\n // FloatingPortal context, which uses it to decide whether to render its own guards.\n useIsoLayoutEffect(() => {\n if (disabled || !portalContext) {\n return undefined;\n }\n portalContext.setFocusManagerState({\n modal,\n closeOnFocusOut,\n open,\n onOpenChange: store.setOpen,\n domReference\n });\n return () => {\n portalContext.setFocusManagerState(null);\n };\n }, [disabled, portalContext, modal, open, store, closeOnFocusOut, domReference]);\n\n // Keep the floating element tabIndex in sync and clear stale focus records.\n useIsoLayoutEffect(() => {\n if (disabled || !floatingFocusElement) {\n return undefined;\n }\n handleTabIndex(floatingFocusElement);\n return () => {\n queueMicrotask(clearDisconnectedPreviouslyFocusedElements);\n };\n }, [disabled, floatingFocusElement]);\n const shouldRenderGuards = !disabled && (modal ? !isUntrappedTypeableCombobox : true) && (isInsidePortal || modal);\n return /*#__PURE__*/_jsxs(React.Fragment, {\n children: [shouldRenderGuards && /*#__PURE__*/_jsx(FocusGuard, {\n \"data-type\": \"inside\",\n ref: mergedBeforeGuardRef,\n onFocus: event => {\n if (modal) {\n const els = getTabbableContent();\n // enqueueFocus returns a rAF-cancel function we don't need here.\n void enqueueFocus(els[els.length - 1]);\n } else if (portalContext?.portalNode) {\n preventReturnFocusRef.current = false;\n if (isOutsideEvent(event, portalContext.portalNode)) {\n const nextTabbable = getNextTabbable(domReference);\n nextTabbable?.focus();\n } else {\n resolveRef(previousFocusableElement ?? portalContext.beforeOutsideRef)?.focus();\n }\n }\n }\n }), children, shouldRenderGuards && /*#__PURE__*/_jsx(FocusGuard, {\n \"data-type\": \"inside\",\n ref: mergedAfterGuardRef,\n onFocus: event => {\n if (modal) {\n // enqueueFocus returns a rAF-cancel function we don't need here.\n void enqueueFocus(getTabbableContent()[0]);\n } else if (portalContext?.portalNode) {\n if (closeOnFocusOut) {\n preventReturnFocusRef.current = true;\n }\n if (isOutsideEvent(event, portalContext.portalNode)) {\n const prevTabbable = getPreviousTabbable(domReference);\n prevTabbable?.focus();\n } else {\n resolveRef(nextFocusableElement ?? portalContext.afterOutsideRef)?.focus();\n }\n }\n }\n })]\n });\n}","'use client';\n\nimport * as React from 'react';\nimport { useAnimationFrame } from '@base-ui/utils/useAnimationFrame';\nimport { useTimeout } from '@base-ui/utils/useTimeout';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { getTarget, isTypeableElement } from \"../utils/element.mjs\";\nimport { isMouseLikePointerType, isVirtualPointerEvent } from \"../utils/event.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\n/**\n * Opens or closes the floating element when clicking the reference element.\n * @see https://floating-ui.com/docs/useClick\n */\nexport function useClick(context, props = {}) {\n const {\n enabled = true,\n event: eventOption = 'click',\n toggle = true,\n ignoreMouse = false,\n stickIfOpen = true,\n touchOpenDelay = 0,\n reason = REASONS.triggerPress\n } = props;\n const store = 'rootStore' in context ? context.rootStore : context;\n const dataRef = store.context.dataRef;\n const pointerTypeRef = React.useRef(undefined);\n const frame = useAnimationFrame();\n const touchOpenTimeout = useTimeout();\n const reference = React.useMemo(() => {\n function setOpenWithTouchDelay(nextOpen, nativeEvent, target, pointerType) {\n const details = createChangeEventDetails(reason, nativeEvent, target);\n if (nextOpen && pointerType === 'touch' && touchOpenDelay > 0) {\n touchOpenTimeout.start(touchOpenDelay, () => {\n store.setOpen(true, details);\n });\n } else {\n store.setOpen(nextOpen, details);\n }\n }\n function getNextOpen(open, currentTarget, isClickLikeOpenEvent) {\n const openEvent = dataRef.current.openEvent;\n const hasClickedOnInactiveTrigger = store.select('domReferenceElement') !== currentTarget;\n if (open && hasClickedOnInactiveTrigger) {\n // Moving between triggers should always open the newly active one.\n return true;\n }\n if (!open) {\n // A closed popup should open on the next press.\n return true;\n }\n if (!toggle) {\n // Non-toggle mode never closes on a repeated trigger press.\n return true;\n }\n if (openEvent && stickIfOpen) {\n // Preserve hover/focus-opened popups until the matching click-like event closes them.\n return !isClickLikeOpenEvent(openEvent.type);\n }\n\n // Otherwise, a repeated click toggles the popup closed.\n return false;\n }\n return {\n onPointerDown(event) {\n // Screen reader activations (Android TalkBack, desktop screen readers) report a\n // mouse-like `pointerType`, but `ignoreMouse` must not drop them: hover logic cannot\n // open for a virtual press since there is no real pointer movement to wait for.\n // Virtual `touch` presses (iOS VoiceOver) keep their type so `touchOpenDelay` applies.\n pointerTypeRef.current = isMouseLikePointerType(event.pointerType, true) && isVirtualPointerEvent(event.nativeEvent) ? 'virtual' : event.pointerType;\n },\n onMouseDown(event) {\n const pointerType = pointerTypeRef.current;\n const nativeEvent = event.nativeEvent;\n const open = store.select('open');\n\n // Ignore all buttons except for the \"main\" button.\n // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button\n if (event.button !== 0 || eventOption === 'click' || isMouseLikePointerType(pointerType, true) && ignoreMouse) {\n return;\n }\n const nextOpen = getNextOpen(open, event.currentTarget, openEventType => openEventType === 'click' || openEventType === 'mousedown');\n\n // Animations sometimes won't run on a typeable element if using a rAF.\n // Focus is always set on these elements. For touch, we may delay opening.\n const target = getTarget(nativeEvent);\n if (isTypeableElement(target)) {\n setOpenWithTouchDelay(nextOpen, nativeEvent, target, pointerType);\n return;\n }\n\n // Capture the currentTarget before the rAF.\n // as React sets it to null after the event handler completes.\n const eventCurrentTarget = event.currentTarget;\n\n // Wait until focus is set on the element. This is an alternative to\n // `event.preventDefault()` to avoid :focus-visible from appearing when using a pointer.\n frame.request(() => {\n setOpenWithTouchDelay(nextOpen, nativeEvent, eventCurrentTarget, pointerType);\n });\n },\n onClick(event) {\n if (eventOption === 'mousedown-only') {\n return;\n }\n const pointerType = pointerTypeRef.current;\n if (eventOption === 'mousedown' && pointerType) {\n pointerTypeRef.current = undefined;\n return;\n }\n if (isMouseLikePointerType(pointerType, true) && ignoreMouse) {\n return;\n }\n const open = store.select('open');\n const nextOpen = getNextOpen(open, event.currentTarget, openEventType => openEventType === 'click' || openEventType === 'mousedown' || openEventType === 'keydown' || openEventType === 'keyup');\n setOpenWithTouchDelay(nextOpen, event.nativeEvent, event.currentTarget, pointerType);\n },\n onKeyDown() {\n pointerTypeRef.current = undefined;\n }\n };\n }, [dataRef, eventOption, ignoreMouse, reason, store, stickIfOpen, toggle, frame, touchOpenTimeout, touchOpenDelay]);\n return React.useMemo(() => enabled ? {\n reference\n } : EMPTY_OBJECT, [enabled, reference]);\n}","'use client';\n\n/* eslint-disable no-underscore-dangle */\nimport * as React from 'react';\nimport { addEventListener } from '@base-ui/utils/addEventListener';\nimport { mergeCleanups } from '@base-ui/utils/mergeCleanups';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { Timeout, useTimeout } from '@base-ui/utils/useTimeout';\nimport { getComputedStyle, getParentNode, isElement, isHTMLElement, isLastTraversableNode, isShadowRoot } from '@floating-ui/utils/dom';\nimport { platform } from '@base-ui/utils/platform';\nimport { useFloatingTree } from \"../components/FloatingTree.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { createAttribute } from \"../utils/createAttribute.mjs\";\nimport { contains, getTarget, isEventTargetWithin, isRootElement } from \"../utils/element.mjs\";\nimport { isReactEvent, isVirtualClick } from \"../utils/event.mjs\";\nimport { getNodeChildren } from \"../utils/nodes.mjs\";\nfunction alwaysFalse() {\n return false;\n}\nexport function normalizeProp(normalizable) {\n return {\n escapeKey: typeof normalizable === 'boolean' ? normalizable : normalizable?.escapeKey ?? false,\n outsidePress: typeof normalizable === 'boolean' ? normalizable : normalizable?.outsidePress ?? true\n };\n}\n/**\n * Closes the floating element when a dismissal is requested — by default, when\n * the user presses the `escape` key or outside of the floating element.\n * @see https://floating-ui.com/docs/useDismiss\n */\nexport function useDismiss(context, props = {}) {\n const {\n enabled = true,\n escapeKey = true,\n outsidePress: outsidePressProp = true,\n outsidePressEvent = 'sloppy',\n referencePress = alwaysFalse,\n bubbles,\n externalTree\n } = props;\n const store = 'rootStore' in context ? context.rootStore : context;\n const open = store.useState('open');\n const floatingElement = store.useState('floatingElement');\n const {\n dataRef,\n events\n } = store.context;\n const tree = useFloatingTree(externalTree);\n const outsidePressFn = useStableCallback(typeof outsidePressProp === 'function' ? outsidePressProp : () => false);\n const outsidePress = typeof outsidePressProp === 'function' ? outsidePressFn : outsidePressProp;\n const outsidePressEnabled = outsidePress !== false;\n const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent);\n const {\n escapeKey: escapeKeyBubbles,\n outsidePress: outsidePressBubbles\n } = normalizeProp(bubbles);\n const pressStartedInsideRef = React.useRef(false);\n const pressStartPreventedRef = React.useRef(false);\n // Ignore only the very next outside click after dragging from inside to outside.\n const suppressNextOutsideClickRef = React.useRef(false);\n // A click whose press began before the floating element opened is the tail of that\n // gesture (e.g. the drag-release that opened it), not a new outside press.\n const sawPressWhileOpenRef = React.useRef(false);\n const isComposingRef = React.useRef(false);\n const currentPointerTypeRef = React.useRef('');\n const touchStateRef = React.useRef(null);\n const cancelDismissOnEndTimeout = useTimeout();\n const clearInsideReactTreeTimeout = useTimeout();\n const clearInsideReactTree = useStableCallback(() => {\n clearInsideReactTreeTimeout.clear();\n dataRef.current.insideReactTree = false;\n });\n const hasBlockingChild = useStableCallback(bubbleKey => {\n const nodeId = dataRef.current.floatingContext?.nodeId;\n const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : [];\n return children.some(child => child.context?.open && !child.context.dataRef.current[bubbleKey]);\n });\n const isEventWithinOwnElements = useStableCallback(event => {\n return isEventTargetWithin(event, store.select('floatingElement')) || isEventTargetWithin(event, store.select('domReferenceElement'));\n });\n const closeOnReferencePress = useStableCallback(event => {\n if (!referencePress()) {\n return;\n }\n store.setOpen(false, createChangeEventDetails(REASONS.triggerPress, event.nativeEvent));\n });\n const closeOnEscapeKeyDown = useStableCallback(event => {\n if (!open || !enabled || !escapeKey || event.key !== 'Escape') {\n return;\n }\n\n // Wait until IME is settled. Pressing `Escape` while composing should\n // close the compose menu, but not the floating element.\n if (isComposingRef.current) {\n return;\n }\n if (!escapeKeyBubbles && hasBlockingChild('__escapeKeyBubbles')) {\n return;\n }\n const native = isReactEvent(event) ? event.nativeEvent : event;\n const eventDetails = createChangeEventDetails(REASONS.escapeKey, native);\n store.setOpen(false, eventDetails);\n if (!eventDetails.isCanceled) {\n event.preventDefault();\n }\n if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) {\n event.stopPropagation();\n }\n });\n const markInsideReactTree = useStableCallback(() => {\n dataRef.current.insideReactTree = true;\n clearInsideReactTreeTimeout.start(0, clearInsideReactTree);\n });\n const markPressStartedInsideReactTree = useStableCallback(event => {\n if (!open || !enabled || event.button !== 0) {\n return;\n }\n const target = getTarget(event.nativeEvent);\n\n // Only treat presses that start within the floating DOM subtree as inside.\n // This avoids suppressing parent dismissal when interacting with nested portals.\n if (!contains(store.select('floatingElement'), target)) {\n return;\n }\n if (!pressStartedInsideRef.current) {\n pressStartedInsideRef.current = true;\n pressStartPreventedRef.current = false;\n }\n });\n const markInsidePressStartPrevented = useStableCallback(event => {\n if (!open || !enabled) {\n return;\n }\n if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) {\n return;\n }\n if (pressStartedInsideRef.current) {\n pressStartPreventedRef.current = true;\n }\n });\n\n // A same-batch close+reopen never renders `open === false`, so only `openchange` can\n // observe that session boundary. The effect below covers controlled flips.\n React.useEffect(() => {\n function handleOpenChange(details) {\n // Only the closing half ends the session: `setOpen(true)` on an already-open\n // element (hovering an inactive trigger) must not drop a press mid-gesture.\n if (!details.open) {\n sawPressWhileOpenRef.current = false;\n }\n }\n events.on('openchange', handleOpenChange);\n return () => {\n events.off('openchange', handleOpenChange);\n };\n }, [events]);\n React.useEffect(() => {\n if (!open || !enabled) {\n // Reset in the effect body, not the cleanup, which also runs when a dependency\n // changes mid-gesture.\n if (!open) {\n sawPressWhileOpenRef.current = false;\n }\n return clearInsideReactTree;\n }\n dataRef.current.__escapeKeyBubbles = escapeKeyBubbles;\n dataRef.current.__outsidePressBubbles = outsidePressBubbles;\n const compositionTimeout = new Timeout();\n const preventedPressSuppressionTimeout = new Timeout();\n const doc = ownerDocument(floatingElement);\n function handleCompositionStart() {\n compositionTimeout.clear();\n isComposingRef.current = true;\n }\n function handleCompositionEnd() {\n // Safari fires `compositionend` before `keydown`, so we need to wait\n // until the next tick to set `isComposing` to `false`.\n // https://bugs.webkit.org/show_bug.cgi?id=165004\n compositionTimeout.start(\n // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.\n // Only apply to WebKit for the test to remain 0ms.\n platform.engine.webkit ? 5 : 0, () => {\n isComposingRef.current = false;\n });\n }\n function suppressImmediateOutsideClickAfterPreventedStart() {\n suppressNextOutsideClickRef.current = true;\n // Firefox can emit the synthetic outside click in a later task after\n // pointer lock exit, so microtask clearing is too early here.\n preventedPressSuppressionTimeout.start(0, () => {\n suppressNextOutsideClickRef.current = false;\n });\n }\n function resetPressStartState() {\n pressStartedInsideRef.current = false;\n pressStartPreventedRef.current = false;\n }\n function getOutsidePressEvent() {\n const type = currentPointerTypeRef.current;\n const computedType = type === 'pen' || !type ? 'mouse' : type;\n const outsidePressEventValue = getOutsidePressEventProp();\n const resolved = typeof outsidePressEventValue === 'function' ? outsidePressEventValue() : outsidePressEventValue;\n if (typeof resolved === 'string') {\n return resolved;\n }\n return resolved[computedType];\n }\n function shouldIgnoreEvent(event) {\n const computedOutsidePressEvent = getOutsidePressEvent();\n return computedOutsidePressEvent === 'intentional' && event.type !== 'click' || computedOutsidePressEvent === 'sloppy' && event.type === 'click';\n }\n function isEventWithinFloatingTree(event) {\n const nodeId = dataRef.current.floatingContext?.nodeId;\n const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some(node => isEventTargetWithin(event, node.context?.elements.floating));\n return isEventWithinOwnElements(event) || targetIsInsideChildren;\n }\n function closeOnPressOutside(event) {\n if (shouldIgnoreEvent(event)) {\n // A new press began outside the floating element and its trigger. Clear any\n // leftover drag-out suppression so this press's eventual click can dismiss.\n if (event.type !== 'click' && !isEventWithinOwnElements(event)) {\n preventedPressSuppressionTimeout.clear();\n suppressNextOutsideClickRef.current = false;\n }\n clearInsideReactTree();\n return;\n }\n if (dataRef.current.insideReactTree) {\n clearInsideReactTree();\n return;\n }\n const target = getTarget(event);\n const inertSelector = `[${createAttribute('inert')}]`;\n const targetRoot = isElement(target) ? target.getRootNode() : null;\n const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store.select('floatingElement'))).querySelectorAll(inertSelector));\n const triggers = store.context.triggerElements;\n\n // If another trigger is clicked, don't close the floating element.\n if (target && (triggers.hasElement(target) || triggers.hasMatchingElement(trigger => contains(trigger, target)))) {\n return;\n }\n let targetRootAncestor = isElement(target) ? target : null;\n while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) {\n const nextParent = getParentNode(targetRootAncestor);\n if (isLastTraversableNode(nextParent) || !isElement(nextParent)) {\n break;\n }\n targetRootAncestor = nextParent;\n }\n\n // Check if the click occurred on a third-party element injected after the\n // floating element rendered.\n if (markers.length && isElement(target) && !isRootElement(target) &&\n // Clicked on a direct ancestor (e.g. FloatingOverlay).\n !contains(target, store.select('floatingElement')) &&\n // If the target root element contains none of the markers, then the\n // element was injected after the floating element rendered.\n markers.every(marker => !contains(targetRootAncestor, marker))) {\n return;\n }\n\n // Check if the click occurred on the scrollbar\n // Skip for touch events: scrollbars don't receive touch events on most platforms\n if (isHTMLElement(target) && !('touches' in event)) {\n const lastTraversableNode = isLastTraversableNode(target);\n const style = getComputedStyle(target);\n const scrollRe = /auto|scroll/;\n const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX);\n const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY);\n const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth;\n const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight;\n const isRTL = style.direction === 'rtl';\n\n // Check click position relative to scrollbar.\n // In some browsers it is possible to change the <body> (or window)\n // scrollbar to the left side, but is very rare and is difficult to\n // check for. Plus, for modal dialogs with backdrops, it is more\n // important that the backdrop is checked but not so much the window.\n const pressedVerticalScrollbar = canScrollY && (isRTL ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth);\n const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight;\n if (pressedVerticalScrollbar || pressedHorizontalScrollbar) {\n return;\n }\n }\n if (isEventWithinFloatingTree(event)) {\n return;\n }\n\n // Only `click` events reach this point in intentional mode.\n if (getOutsidePressEvent() === 'intentional') {\n // Press-less clicks (keyboard, assistive technology, `element.click()`) report no\n // click count; `isVirtualClick` also catches the ones that do.\n if (event.detail !== 0 && !isVirtualClick(event) && !sawPressWhileOpenRef.current) {\n return;\n }\n\n // A press that starts inside and ends outside gets one suppressed\n // outside click. Run this after inside-target checks so inside clicks\n // don't consume the one-shot suppression.\n if (suppressNextOutsideClickRef.current) {\n preventedPressSuppressionTimeout.clear();\n suppressNextOutsideClickRef.current = false;\n return;\n }\n }\n if (typeof outsidePress === 'function' && !outsidePress(event)) {\n return;\n }\n if (hasBlockingChild('__outsidePressBubbles')) {\n return;\n }\n store.setOpen(false, createChangeEventDetails(REASONS.outsidePress, event));\n clearInsideReactTree();\n }\n function handlePointerDown(event) {\n if (getOutsidePressEvent() !== 'sloppy' || event.pointerType === 'touch' || !store.select('open') || !enabled || isEventWithinOwnElements(event)) {\n return;\n }\n closeOnPressOutside(event);\n }\n function handleTouchStart(event) {\n if (getOutsidePressEvent() !== 'sloppy' || !store.select('open') || !enabled || isEventWithinOwnElements(event)) {\n return;\n }\n const touch = event.touches[0];\n if (touch) {\n touchStateRef.current = {\n startTime: Date.now(),\n startX: touch.clientX,\n startY: touch.clientY,\n dismissOnTouchEnd: false,\n dismissOnMouseDown: true\n };\n cancelDismissOnEndTimeout.start(1000, () => {\n if (touchStateRef.current) {\n touchStateRef.current.dismissOnTouchEnd = false;\n touchStateRef.current.dismissOnMouseDown = false;\n }\n });\n }\n }\n function addTargetEventListenerOnce(event, listener) {\n const target = getTarget(event);\n if (!target) {\n return;\n }\n const unsubscribe = addEventListener(target, event.type, () => {\n listener(event);\n unsubscribe();\n });\n }\n function handleTouchStartCapture(event) {\n currentPointerTypeRef.current = 'touch';\n addTargetEventListenerOnce(event, handleTouchStart);\n }\n function closeOnPressOutsideCapture(event) {\n cancelDismissOnEndTimeout.clear();\n\n // Only `pointerdown` marks a press; `mousedown` is its compatibility event, and\n // counting it would misattribute a gesture that started before open.\n if (event.type === 'pointerdown') {\n // Only a primary press can produce a `click`.\n if (event.button === 0) {\n sawPressWhileOpenRef.current = true;\n }\n currentPointerTypeRef.current = event.pointerType;\n }\n if (event.type === 'mousedown' && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) {\n return;\n }\n addTargetEventListenerOnce(event, targetEvent => {\n if (targetEvent.type === 'pointerdown') {\n handlePointerDown(targetEvent);\n } else {\n closeOnPressOutside(targetEvent);\n }\n });\n }\n function handlePressEndCapture(event) {\n // A cancelled gesture produces no click. Not cleared on `pointerup`: the click\n // fires after it and must still find the press.\n if (event.type === 'pointercancel') {\n sawPressWhileOpenRef.current = false;\n }\n if (!pressStartedInsideRef.current) {\n return;\n }\n const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current;\n resetPressStartState();\n if (getOutsidePressEvent() !== 'intentional') {\n return;\n }\n if (event.type === 'pointercancel') {\n if (pressStartedInsideDefaultPrevented) {\n suppressImmediateOutsideClickAfterPreventedStart();\n }\n return;\n }\n if (isEventWithinFloatingTree(event)) {\n return;\n }\n\n // If pointerdown was prevented, no click may be generated for that\n // interaction. However, Firefox may still emit an immediate click after\n // pointerup (e.g. NumberField scrub with pointer lock), so suppress for\n // one tick to absorb that synthetic click only.\n if (pressStartedInsideDefaultPrevented) {\n suppressImmediateOutsideClickAfterPreventedStart();\n return;\n }\n\n // Avoid suppressing when outsidePress explicitly ignores this target.\n if (typeof outsidePress === 'function' && !outsidePress(event)) {\n return;\n }\n preventedPressSuppressionTimeout.clear();\n suppressNextOutsideClickRef.current = true;\n clearInsideReactTree();\n }\n function handleTouchMove(event) {\n if (getOutsidePressEvent() !== 'sloppy' || !touchStateRef.current || isEventWithinOwnElements(event)) {\n return;\n }\n const touch = event.touches[0];\n if (!touch) {\n return;\n }\n const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX);\n const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY);\n const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);\n if (distance > 5) {\n touchStateRef.current.dismissOnTouchEnd = true;\n }\n if (distance > 10) {\n closeOnPressOutside(event);\n cancelDismissOnEndTimeout.clear();\n touchStateRef.current = null;\n }\n }\n function handleTouchMoveCapture(event) {\n addTargetEventListenerOnce(event, handleTouchMove);\n }\n function handleTouchEnd(event) {\n if (getOutsidePressEvent() !== 'sloppy' || !touchStateRef.current || isEventWithinOwnElements(event)) {\n return;\n }\n if (touchStateRef.current.dismissOnTouchEnd) {\n closeOnPressOutside(event);\n }\n cancelDismissOnEndTimeout.clear();\n touchStateRef.current = null;\n }\n function handleTouchEndCapture(event) {\n addTargetEventListenerOnce(event, handleTouchEnd);\n }\n const unsubscribe = mergeCleanups(escapeKey && mergeCleanups(addEventListener(doc, 'keydown', closeOnEscapeKeyDown), addEventListener(doc, 'compositionstart', handleCompositionStart), addEventListener(doc, 'compositionend', handleCompositionEnd)), outsidePressEnabled && mergeCleanups(addEventListener(doc, 'click', closeOnPressOutsideCapture, true), addEventListener(doc, 'pointerdown', closeOnPressOutsideCapture, true), addEventListener(doc, 'pointerup', handlePressEndCapture, true), addEventListener(doc, 'pointercancel', handlePressEndCapture, true), addEventListener(doc, 'mousedown', closeOnPressOutsideCapture, true), addEventListener(doc, 'mouseup', handlePressEndCapture, true), addEventListener(doc, 'touchstart', handleTouchStartCapture, {\n capture: true,\n passive: true\n }), addEventListener(doc, 'touchmove', handleTouchMoveCapture, {\n capture: true,\n passive: true\n }), addEventListener(doc, 'touchend', handleTouchEndCapture, {\n capture: true,\n passive: true\n })));\n return () => {\n unsubscribe();\n compositionTimeout.clear();\n preventedPressSuppressionTimeout.clear();\n resetPressStartState();\n suppressNextOutsideClickRef.current = false;\n clearInsideReactTree();\n };\n }, [dataRef, floatingElement, escapeKey, outsidePressEnabled, outsidePress, open, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store, cancelDismissOnEndTimeout]);\n const reference = React.useMemo(() => ({\n onKeyDown: closeOnEscapeKeyDown,\n onPointerDown: closeOnReferencePress,\n onClick: closeOnReferencePress\n }), [closeOnEscapeKeyDown, closeOnReferencePress]);\n const floating = React.useMemo(() => ({\n onKeyDown: closeOnEscapeKeyDown,\n // `onMouseDown` may be blocked if `event.preventDefault()` is called in\n // `onPointerDown`, such as with <NumberField.ScrubArea>.\n // See https://github.com/mui/base-ui/pull/3379\n onPointerDown: markInsidePressStartPrevented,\n onMouseDown: markInsidePressStartPrevented,\n onClickCapture: markInsideReactTree,\n onMouseDownCapture(event) {\n markInsideReactTree();\n markPressStartedInsideReactTree(event);\n },\n onPointerDownCapture(event) {\n markInsideReactTree();\n markPressStartedInsideReactTree(event);\n },\n onMouseUpCapture: markInsideReactTree,\n onTouchEndCapture: markInsideReactTree,\n onTouchMoveCapture: markInsideReactTree\n }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]);\n return React.useMemo(() => enabled ? {\n reference,\n floating,\n trigger: reference\n } : {}, [enabled, reference, floating]);\n}","import { getSideAxis, getAlignmentAxis, getAxisLength, getSide, getAlignment, evaluate, getPaddingObject, rectToClientRect, min, clamp, placements, getAlignmentSides, getOppositeAlignmentPlacement, getOppositePlacement, getExpandedPlacements, getOppositeAxisPlacements, sides, max, getOppositeAxis } from '@floating-ui/utils';\nexport { rectToClientRect } from '@floating-ui/utils';\n\nfunction computeCoordsFromPlacement(_ref, placement, rtl) {\n let {\n reference,\n floating\n } = _ref;\n const sideAxis = getSideAxis(placement);\n const alignmentAxis = getAlignmentAxis(placement);\n const alignLength = getAxisLength(alignmentAxis);\n const side = getSide(placement);\n const isVertical = sideAxis === 'y';\n const commonX = reference.x + reference.width / 2 - floating.width / 2;\n const commonY = reference.y + reference.height / 2 - floating.height / 2;\n const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;\n let coords;\n switch (side) {\n case 'top':\n coords = {\n x: commonX,\n y: reference.y - floating.height\n };\n break;\n case 'bottom':\n coords = {\n x: commonX,\n y: reference.y + reference.height\n };\n break;\n case 'right':\n coords = {\n x: reference.x + reference.width,\n y: commonY\n };\n break;\n case 'left':\n coords = {\n x: reference.x - floating.width,\n y: commonY\n };\n break;\n default:\n coords = {\n x: reference.x,\n y: reference.y\n };\n }\n const alignment = getAlignment(placement);\n if (alignment) {\n coords[alignmentAxis] += commonAlign * (alignment === 'end' ? 1 : -1) * (rtl && isVertical ? -1 : 1);\n }\n return coords;\n}\n\n/**\n * Resolves with an object of overflow side offsets that determine how much the\n * element is overflowing a given clipping boundary on each side.\n * - positive = overflowing the boundary by that number of pixels\n * - negative = how many pixels left before it will overflow\n * - 0 = lies flush with the boundary\n * @see https://floating-ui.com/docs/detectOverflow\n */\nasync function detectOverflow(state, options) {\n var _await$platform$isEle;\n if (options === void 0) {\n options = {};\n }\n const {\n x,\n y,\n platform,\n rects,\n elements,\n strategy\n } = state;\n const {\n boundary = 'clippingAncestors',\n rootBoundary = 'viewport',\n elementContext = 'floating',\n altBoundary = false,\n padding = 0\n } = evaluate(options, state);\n const paddingObject = getPaddingObject(padding);\n const altContext = elementContext === 'floating' ? 'reference' : 'floating';\n const element = elements[altBoundary ? altContext : elementContext];\n const clippingClientRect = rectToClientRect(await platform.getClippingRect({\n element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),\n boundary,\n rootBoundary,\n strategy\n }));\n const rect = elementContext === 'floating' ? {\n x,\n y,\n width: rects.floating.width,\n height: rects.floating.height\n } : rects.reference;\n const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));\n const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) && (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {\n x: 1,\n y: 1\n };\n const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({\n elements,\n rect,\n offsetParent,\n strategy\n }) : rect);\n return {\n top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,\n bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,\n left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,\n right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x\n };\n}\n\n// Maximum number of resets that can occur before bailing to avoid infinite reset loops.\nconst MAX_RESET_COUNT = 50;\n\n/**\n * Computes the `x` and `y` coordinates that will place the floating element\n * next to a given reference element.\n *\n * This export does not have any `platform` interface logic. You will need to\n * write one for the platform you are using Floating UI with.\n */\nconst computePosition = async (reference, floating, config) => {\n const {\n placement = 'bottom',\n strategy = 'absolute',\n middleware = [],\n platform\n } = config;\n const platformWithDetectOverflow = platform.detectOverflow ? platform : {\n ...platform,\n detectOverflow\n };\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));\n let rects = await platform.getElementRects({\n reference,\n floating,\n strategy\n });\n let {\n x,\n y\n } = computeCoordsFromPlacement(rects, placement, rtl);\n let statefulPlacement = placement;\n let resetCount = 0;\n const middlewareData = {};\n for (let i = 0; i < middleware.length; i++) {\n const currentMiddleware = middleware[i];\n if (!currentMiddleware) {\n continue;\n }\n const {\n name,\n fn\n } = currentMiddleware;\n const {\n x: nextX,\n y: nextY,\n data,\n reset\n } = await fn({\n x,\n y,\n initialPlacement: placement,\n placement: statefulPlacement,\n strategy,\n middlewareData,\n rects,\n platform: platformWithDetectOverflow,\n elements: {\n reference,\n floating\n }\n });\n x = nextX != null ? nextX : x;\n y = nextY != null ? nextY : y;\n middlewareData[name] = {\n ...middlewareData[name],\n ...data\n };\n if (reset && resetCount < MAX_RESET_COUNT) {\n resetCount++;\n if (typeof reset === 'object') {\n if (reset.placement) {\n statefulPlacement = reset.placement;\n }\n if (reset.rects) {\n rects = reset.rects === true ? await platform.getElementRects({\n reference,\n floating,\n strategy\n }) : reset.rects;\n }\n ({\n x,\n y\n } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));\n }\n i = -1;\n }\n }\n return {\n x,\n y,\n placement: statefulPlacement,\n strategy,\n middlewareData\n };\n};\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = options => ({\n name: 'arrow',\n options,\n async fn(state) {\n const {\n x,\n y,\n placement,\n rects,\n platform,\n elements,\n middlewareData\n } = state;\n // Since `element` is required, we don't Partial<> the type.\n const {\n element,\n padding = 0\n } = evaluate(options, state) || {};\n if (element == null) {\n return {};\n }\n const paddingObject = getPaddingObject(padding);\n const coords = {\n x,\n y\n };\n const axis = getAlignmentAxis(placement);\n const length = getAxisLength(axis);\n const arrowDimensions = await platform.getDimensions(element);\n const isYAxis = axis === 'y';\n const minProp = isYAxis ? 'top' : 'left';\n const maxProp = isYAxis ? 'bottom' : 'right';\n const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';\n const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];\n const startDiff = coords[axis] - rects.reference[axis];\n const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));\n let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;\n\n // DOM platform can return `window` as the `offsetParent`.\n if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {\n clientSize = elements.floating[clientProp] || rects.floating[length];\n }\n const centerToReference = endDiff / 2 - startDiff / 2;\n\n // If the padding is large enough that it causes the arrow to no longer be\n // centered, modify the padding so that it is centered.\n const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;\n const minPadding = min(paddingObject[minProp], largestPossiblePadding);\n const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);\n\n // Make sure the arrow doesn't overflow the floating element if the center\n // point is outside the floating element's bounds.\n const max = clientSize - arrowDimensions[length] - maxPadding;\n const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;\n const offset = clamp(minPadding, center, max);\n\n // If the reference is small enough that the arrow's padding causes it to\n // to point to nothing for an aligned placement, adjust the offset of the\n // floating element itself. To ensure `shift()` continues to take action,\n // a single reset is performed when this is true.\n const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < minPadding ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;\n const alignmentOffset = shouldAddOffset ? center < minPadding ? center - minPadding : center - max : 0;\n return {\n [axis]: coords[axis] + alignmentOffset,\n data: {\n [axis]: offset,\n centerOffset: center - offset - alignmentOffset,\n ...(shouldAddOffset && {\n alignmentOffset\n })\n },\n reset: shouldAddOffset\n };\n }\n});\n\nfunction getPlacementList(alignment, autoAlignment, allowedPlacements) {\n const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);\n return allowedPlacementsSortedByAlignment.filter(placement => {\n if (alignment) {\n return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);\n }\n return true;\n });\n}\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'autoPlacement',\n options,\n async fn(state) {\n var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;\n const {\n rects,\n middlewareData,\n placement,\n platform,\n elements\n } = state;\n const {\n crossAxis = false,\n alignment,\n allowedPlacements = placements,\n autoAlignment = true,\n ...detectOverflowOptions\n } = evaluate(options, state);\n const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;\n const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;\n const currentPlacement = placements$1[currentIndex];\n if (currentPlacement == null) {\n return {};\n }\n\n // Make `computeCoords` start from the right place.\n if (placement !== currentPlacement) {\n return {\n reset: {\n placement: placements$1[0]\n }\n };\n }\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));\n const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];\n const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {\n placement: currentPlacement,\n overflows: currentOverflows\n }];\n const nextPlacement = placements$1[currentIndex + 1];\n\n // There are more placements to check.\n if (nextPlacement) {\n return {\n data: {\n index: currentIndex + 1,\n overflows: allOverflows\n },\n reset: {\n placement: nextPlacement\n }\n };\n }\n const placementsSortedByMostSpace = allOverflows.map(d => {\n const alignment = getAlignment(d.placement);\n return [d.placement, alignment && crossAxis ?\n // Check along the mainAxis and main crossAxis side.\n d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :\n // Check only the mainAxis.\n d.overflows[0], d.overflows];\n }).sort((a, b) => a[1] - b[1]);\n const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,\n // Aligned placements should not check their opposite crossAxis\n // side.\n getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));\n const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];\n if (resetPlacement !== placement) {\n return {\n data: {\n index: currentIndex + 1,\n overflows: allOverflows\n },\n reset: {\n placement: resetPlacement\n }\n };\n }\n return {};\n }\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'flip',\n options,\n async fn(state) {\n var _middlewareData$arrow, _middlewareData$flip;\n const {\n placement,\n middlewareData,\n rects,\n initialPlacement,\n platform,\n elements\n } = state;\n const {\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = true,\n fallbackPlacements: specifiedFallbackPlacements,\n fallbackStrategy = 'bestFit',\n fallbackAxisSideDirection = 'none',\n flipAlignment = true,\n ...detectOverflowOptions\n } = evaluate(options, state);\n\n // If a reset by the arrow was caused due to an alignment offset being\n // added, we should skip any logic now since `flip()` has already done its\n // work.\n // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643\n if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {\n return {};\n }\n const side = getSide(placement);\n const initialSideAxis = getSideAxis(initialPlacement);\n const isBasePlacement = getSide(initialPlacement) === initialPlacement;\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));\n const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));\n const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';\n if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {\n fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));\n }\n const placements = [initialPlacement, ...fallbackPlacements];\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const overflows = [];\n let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];\n if (checkMainAxis) {\n overflows.push(overflow[side]);\n }\n if (checkCrossAxis) {\n const sides = getAlignmentSides(placement, rects, rtl);\n overflows.push(overflow[sides[0]], overflow[sides[1]]);\n }\n overflowsData = [...overflowsData, {\n placement,\n overflows\n }];\n\n // One or more sides is overflowing.\n if (!overflows.every(side => side <= 0)) {\n var _middlewareData$flip2, _overflowsData$filter;\n const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;\n const nextPlacement = placements[nextIndex];\n if (nextPlacement) {\n const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;\n if (!ignoreCrossAxisOverflow ||\n // We leave the current main axis only if every placement on that axis\n // overflows the main axis.\n overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {\n // Try next placement and re-run the lifecycle.\n return {\n data: {\n index: nextIndex,\n overflows: overflowsData\n },\n reset: {\n placement: nextPlacement\n }\n };\n }\n }\n\n // First, find the candidates that fit on the mainAxis side of overflow,\n // then find the placement that fits the best on the main crossAxis side.\n let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;\n\n // Otherwise fallback.\n if (!resetPlacement) {\n switch (fallbackStrategy) {\n case 'bestFit':\n {\n var _overflowsData$filter2;\n const placement = (_overflowsData$filter2 = overflowsData.filter(d => {\n if (hasFallbackAxisSideDirection) {\n const currentSideAxis = getSideAxis(d.placement);\n return currentSideAxis === initialSideAxis ||\n // Create a bias to the `y` side axis due to horizontal\n // reading directions favoring greater width.\n currentSideAxis === 'y';\n }\n return true;\n }).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];\n if (placement) {\n resetPlacement = placement;\n }\n break;\n }\n case 'initialPlacement':\n resetPlacement = initialPlacement;\n break;\n }\n }\n if (placement !== resetPlacement) {\n return {\n reset: {\n placement: resetPlacement\n }\n };\n }\n }\n return {};\n }\n };\n};\n\nfunction getSideOffsets(overflow, rect) {\n return {\n top: overflow.top - rect.height,\n right: overflow.right - rect.width,\n bottom: overflow.bottom - rect.height,\n left: overflow.left - rect.width\n };\n}\nfunction isAnySideFullyClipped(overflow) {\n return sides.some(side => overflow[side] >= 0);\n}\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'hide',\n options,\n async fn(state) {\n const {\n rects,\n platform\n } = state;\n const {\n strategy = 'referenceHidden',\n ...detectOverflowOptions\n } = evaluate(options, state);\n switch (strategy) {\n case 'referenceHidden':\n {\n const overflow = await platform.detectOverflow(state, {\n ...detectOverflowOptions,\n elementContext: 'reference'\n });\n const offsets = getSideOffsets(overflow, rects.reference);\n return {\n data: {\n referenceHiddenOffsets: offsets,\n referenceHidden: isAnySideFullyClipped(offsets)\n }\n };\n }\n case 'escaped':\n {\n const overflow = await platform.detectOverflow(state, {\n ...detectOverflowOptions,\n altBoundary: true\n });\n const offsets = getSideOffsets(overflow, rects.floating);\n return {\n data: {\n escapedOffsets: offsets,\n escaped: isAnySideFullyClipped(offsets)\n }\n };\n }\n default:\n {\n return {};\n }\n }\n }\n };\n};\n\nfunction getBoundingRect(rects) {\n const minX = min(...rects.map(rect => rect.left));\n const minY = min(...rects.map(rect => rect.top));\n const maxX = max(...rects.map(rect => rect.right));\n const maxY = max(...rects.map(rect => rect.bottom));\n return {\n x: minX,\n y: minY,\n width: maxX - minX,\n height: maxY - minY\n };\n}\nfunction getRectsByLine(rects) {\n const sortedRects = rects.slice().sort((a, b) => a.y - b.y);\n const groups = [];\n let prevRect = null;\n for (let i = 0; i < sortedRects.length; i++) {\n const rect = sortedRects[i];\n if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {\n groups.push([rect]);\n } else {\n groups[groups.length - 1].push(rect);\n }\n prevRect = rect;\n }\n return groups.map(rect => rectToClientRect(getBoundingRect(rect)));\n}\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'inline',\n options,\n async fn(state) {\n const {\n placement,\n elements,\n rects,\n platform,\n strategy\n } = state;\n // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a\n // ClientRect's bounds, despite the event listener being triggered. A\n // padding of 2 seems to handle this issue.\n const {\n padding = 2,\n x,\n y\n } = evaluate(options, state);\n const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);\n\n // No rects (e.g. a hidden or detached reference, or a collapsed range) —\n // keep the existing reference rect rather than resetting to an invalid\n // one with non-finite values.\n if (!nativeClientRects.length) {\n return {};\n }\n const clientRects = getRectsByLine(nativeClientRects);\n const fallback = rectToClientRect(getBoundingRect(nativeClientRects));\n const paddingObject = getPaddingObject(padding);\n function getBoundingClientRect() {\n // There are two rects and they are disjoined.\n if (clientRects.length === 2 && (clientRects[0].left > clientRects[1].right || clientRects[1].left > clientRects[0].right) && x != null && y != null) {\n // Find the first rect in which the point is fully inside.\n return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;\n }\n\n // There are 2 or more connected rects.\n if (clientRects.length >= 2) {\n if (getSideAxis(placement) === 'y') {\n const firstRect = clientRects[0];\n const lastRect = clientRects[clientRects.length - 1];\n const isTop = getSide(placement) === 'top';\n const top = firstRect.top;\n const bottom = lastRect.bottom;\n const left = isTop ? firstRect.left : lastRect.left;\n const right = isTop ? firstRect.right : lastRect.right;\n return rectToClientRect({\n x: left,\n y: top,\n width: right - left,\n height: bottom - top\n });\n }\n const isLeftSide = getSide(placement) === 'left';\n const maxRight = max(...clientRects.map(rect => rect.right));\n const minLeft = min(...clientRects.map(rect => rect.left));\n const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);\n const top = measureRects[0].top;\n const bottom = measureRects[measureRects.length - 1].bottom;\n return rectToClientRect({\n x: minLeft,\n y: top,\n width: maxRight - minLeft,\n height: bottom - top\n });\n }\n return fallback;\n }\n const resetRects = await platform.getElementRects({\n reference: {\n getBoundingClientRect\n },\n floating: elements.floating,\n strategy\n });\n if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {\n return {\n reset: {\n rects: resetRects\n }\n };\n }\n return {};\n }\n };\n};\n\nconst originSides = /*#__PURE__*/new Set(['left', 'top']);\n\n// For type backwards-compatibility, the `OffsetOptions` type was also\n// Derivable.\n\nasync function convertValueToCoords(state, options) {\n const {\n placement,\n platform,\n elements\n } = state;\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));\n const side = getSide(placement);\n const alignment = getAlignment(placement);\n const isVertical = getSideAxis(placement) === 'y';\n const mainAxisMulti = originSides.has(side) ? -1 : 1;\n const crossAxisMulti = rtl && isVertical ? -1 : 1;\n const rawValue = evaluate(options, state);\n\n // eslint-disable-next-line prefer-const\n let {\n mainAxis,\n crossAxis,\n alignmentAxis\n } = typeof rawValue === 'number' ? {\n mainAxis: rawValue,\n crossAxis: 0,\n alignmentAxis: null\n } : {\n mainAxis: rawValue.mainAxis || 0,\n crossAxis: rawValue.crossAxis || 0,\n alignmentAxis: rawValue.alignmentAxis\n };\n if (alignment && typeof alignmentAxis === 'number') {\n crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;\n }\n return isVertical ? {\n x: crossAxis * crossAxisMulti,\n y: mainAxis * mainAxisMulti\n } : {\n x: mainAxis * mainAxisMulti,\n y: crossAxis * crossAxisMulti\n };\n}\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = function (options) {\n if (options === void 0) {\n options = 0;\n }\n return {\n name: 'offset',\n options,\n async fn(state) {\n var _middlewareData$offse, _middlewareData$arrow;\n const {\n x,\n y,\n placement,\n middlewareData\n } = state;\n const diffCoords = await convertValueToCoords(state, options);\n\n // If the placement is the same and the arrow caused an alignment offset\n // then we don't need to change the positioning coordinates.\n if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {\n return {};\n }\n return {\n x: x + diffCoords.x,\n y: y + diffCoords.y,\n data: {\n ...diffCoords,\n placement\n }\n };\n }\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'shift',\n options,\n async fn(state) {\n const {\n x,\n y,\n placement,\n platform\n } = state;\n const {\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = false,\n limiter = {\n fn: _ref => {\n let {\n x,\n y\n } = _ref;\n return {\n x,\n y\n };\n }\n },\n ...detectOverflowOptions\n } = evaluate(options, state);\n const coords = {\n x,\n y\n };\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const crossAxis = getSideAxis(placement);\n const mainAxis = getOppositeAxis(crossAxis);\n let mainAxisCoord = coords[mainAxis];\n let crossAxisCoord = coords[crossAxis];\n const clampCoord = (axis, coord) => clamp(coord + overflow[axis === 'y' ? 'top' : 'left'], coord, coord - overflow[axis === 'y' ? 'bottom' : 'right']);\n if (checkMainAxis) {\n mainAxisCoord = clampCoord(mainAxis, mainAxisCoord);\n }\n if (checkCrossAxis) {\n crossAxisCoord = clampCoord(crossAxis, crossAxisCoord);\n }\n const limitedCoords = limiter.fn({\n ...state,\n [mainAxis]: mainAxisCoord,\n [crossAxis]: crossAxisCoord\n });\n return {\n ...limitedCoords,\n data: {\n x: limitedCoords.x - x,\n y: limitedCoords.y - y,\n enabled: {\n [mainAxis]: checkMainAxis,\n [crossAxis]: checkCrossAxis\n }\n }\n };\n }\n };\n};\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n options,\n fn(state) {\n var _rawOffset$mainAxis, _rawOffset$crossAxis;\n const {\n x,\n y,\n placement,\n rects,\n middlewareData\n } = state;\n const {\n offset = 0,\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = true\n } = evaluate(options, state);\n const coords = {\n x,\n y\n };\n const crossAxis = getSideAxis(placement);\n const mainAxis = getOppositeAxis(crossAxis);\n let mainAxisCoord = coords[mainAxis];\n let crossAxisCoord = coords[crossAxis];\n const rawOffset = evaluate(offset, state);\n const computedOffset = typeof rawOffset === 'number' ? {\n mainAxis: rawOffset,\n crossAxis: 0\n } : {\n mainAxis: (_rawOffset$mainAxis = rawOffset.mainAxis) != null ? _rawOffset$mainAxis : 0,\n crossAxis: (_rawOffset$crossAxis = rawOffset.crossAxis) != null ? _rawOffset$crossAxis : 0\n };\n if (checkMainAxis) {\n const len = mainAxis === 'y' ? 'height' : 'width';\n const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;\n const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;\n if (mainAxisCoord < limitMin) {\n mainAxisCoord = limitMin;\n } else if (mainAxisCoord > limitMax) {\n mainAxisCoord = limitMax;\n }\n }\n if (checkCrossAxis) {\n var _middlewareData$offse, _middlewareData$offse2;\n const len = mainAxis === 'y' ? 'width' : 'height';\n const isOriginSide = originSides.has(getSide(placement));\n const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);\n const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);\n if (crossAxisCoord < limitMin) {\n crossAxisCoord = limitMin;\n } else if (crossAxisCoord > limitMax) {\n crossAxisCoord = limitMax;\n }\n }\n return {\n [mainAxis]: mainAxisCoord,\n [crossAxis]: crossAxisCoord\n };\n }\n };\n};\n\n// Method syntax keeps callback parameters bivariant, but expressing the\n// explicit `| undefined` required by `exactOptionalPropertyTypes` needs\n// property syntax, which is contravariant under `strictFunctionTypes`.\n// Extracting the function from a method position restores that bivariance so\n// consumers can still assign callbacks with narrower parameter types.\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'size',\n options,\n async fn(state) {\n const {\n placement,\n rects,\n platform,\n elements\n } = state;\n const {\n apply = () => {},\n ...detectOverflowOptions\n } = evaluate(options, state);\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const side = getSide(placement);\n const alignment = getAlignment(placement);\n const isYAxis = getSideAxis(placement) === 'y';\n const {\n width,\n height\n } = rects.floating;\n let heightSide;\n let widthSide;\n if (side === 'top' || side === 'bottom') {\n heightSide = side;\n widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';\n } else {\n widthSide = side;\n heightSide = alignment === 'end' ? 'top' : 'bottom';\n }\n const maximumClippingHeight = height - overflow.top - overflow.bottom;\n const maximumClippingWidth = width - overflow.left - overflow.right;\n const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);\n const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);\n const shiftData = state.middlewareData.shift;\n const noShift = !shiftData;\n let availableHeight = overflowAvailableHeight;\n let availableWidth = overflowAvailableWidth;\n if (shiftData != null && shiftData.enabled.x) {\n availableWidth = maximumClippingWidth;\n }\n if (shiftData != null && shiftData.enabled.y) {\n availableHeight = maximumClippingHeight;\n }\n if (noShift && !alignment) {\n if (isYAxis) {\n availableWidth = width - 2 * max(overflow.left, overflow.right);\n } else {\n availableHeight = height - 2 * max(overflow.top, overflow.bottom);\n }\n }\n await apply({\n ...state,\n availableWidth,\n availableHeight\n });\n const nextDimensions = await platform.getDimensions(elements.floating);\n if (width !== nextDimensions.width || height !== nextDimensions.height) {\n return {\n reset: {\n rects: true\n }\n };\n }\n return {};\n }\n };\n};\n\nexport { arrow, autoPlacement, computePosition, detectOverflow, flip, hide, inline, limitShift, offset, shift, size };\n","import { rectToClientRect, arrow as arrow$1, autoPlacement as autoPlacement$1, detectOverflow as detectOverflow$1, flip as flip$1, hide as hide$1, inline as inline$1, limitShift as limitShift$1, offset as offset$1, shift as shift$1, size as size$1, computePosition as computePosition$1 } from '@floating-ui/core';\nimport { round, createCoords, max, min, floor } from '@floating-ui/utils';\nimport { getComputedStyle as getComputedStyle$1, isHTMLElement, isElement, getWindow, isWebKit, getFrameElement, getNodeScroll, getDocumentElement, isTopLayer, getNodeName, isOverflowElement, getOverflowAncestors, getParentNode, isLastTraversableNode, isContainingBlock, isTableElement, getContainingBlock } from '@floating-ui/utils/dom';\nexport { getOverflowAncestors } from '@floating-ui/utils/dom';\n\nfunction getCssDimensions(element) {\n const css = getComputedStyle$1(element);\n // In testing environments, the `width` and `height` properties are empty\n // strings for SVG elements, returning NaN. Fallback to `0` in this case.\n let width = parseFloat(css.width) || 0;\n let height = parseFloat(css.height) || 0;\n const hasOffset = isHTMLElement(element);\n const offsetWidth = hasOffset ? element.offsetWidth : width;\n const offsetHeight = hasOffset ? element.offsetHeight : height;\n const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;\n if (shouldFallback) {\n width = offsetWidth;\n height = offsetHeight;\n }\n return {\n width,\n height,\n $: shouldFallback\n };\n}\n\nfunction unwrapElement(element) {\n return !isElement(element) ? element.contextElement : element;\n}\n\nfunction getScale(element) {\n const domElement = unwrapElement(element);\n if (!isHTMLElement(domElement)) {\n return createCoords(1);\n }\n const rect = domElement.getBoundingClientRect();\n const {\n width,\n height,\n $\n } = getCssDimensions(domElement);\n let x = ($ ? round(rect.width) : rect.width) / width;\n let y = ($ ? round(rect.height) : rect.height) / height;\n\n // 0, NaN, or Infinity should always fallback to 1.\n\n if (!x || !Number.isFinite(x)) {\n x = 1;\n }\n if (!y || !Number.isFinite(y)) {\n y = 1;\n }\n return {\n x,\n y\n };\n}\n\nconst noOffsets = /*#__PURE__*/createCoords(0);\nfunction getVisualOffsets(element) {\n const win = getWindow(element);\n if (!isWebKit() || !win.visualViewport) {\n return noOffsets;\n }\n return {\n x: win.visualViewport.offsetLeft,\n y: win.visualViewport.offsetTop\n };\n}\nfunction shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {\n if (isFixed === void 0) {\n isFixed = false;\n }\n return !!floatingOffsetParent && isFixed && floatingOffsetParent === getWindow(element);\n}\n\nfunction getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {\n if (includeScale === void 0) {\n includeScale = false;\n }\n if (isFixedStrategy === void 0) {\n isFixedStrategy = false;\n }\n const clientRect = element.getBoundingClientRect();\n const domElement = unwrapElement(element);\n let scale = createCoords(1);\n if (includeScale) {\n if (offsetParent) {\n if (isElement(offsetParent)) {\n scale = getScale(offsetParent);\n }\n } else {\n scale = getScale(element);\n }\n }\n const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);\n let x = (clientRect.left + visualOffsets.x) / scale.x;\n let y = (clientRect.top + visualOffsets.y) / scale.y;\n let width = clientRect.width / scale.x;\n let height = clientRect.height / scale.y;\n if (domElement && offsetParent) {\n const win = getWindow(domElement);\n const offsetWin = isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;\n let currentWin = win;\n let currentIFrame = getFrameElement(currentWin);\n while (currentIFrame && offsetWin !== currentWin) {\n const iframeScale = getScale(currentIFrame);\n const iframeRect = currentIFrame.getBoundingClientRect();\n const css = getComputedStyle$1(currentIFrame);\n const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;\n const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;\n x *= iframeScale.x;\n y *= iframeScale.y;\n width *= iframeScale.x;\n height *= iframeScale.y;\n x += left;\n y += top;\n currentWin = getWindow(currentIFrame);\n currentIFrame = getFrameElement(currentWin);\n }\n }\n return rectToClientRect({\n width,\n height,\n x,\n y\n });\n}\n\n// If <html> has a CSS width greater than the viewport, then this will be\n// incorrect for RTL.\nfunction getWindowScrollBarX(element, rect) {\n const leftScroll = getNodeScroll(element).scrollLeft;\n if (!rect) {\n return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;\n }\n return rect.left + leftScroll;\n}\n\nfunction getHTMLOffset(documentElement, scroll) {\n const htmlRect = documentElement.getBoundingClientRect();\n const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);\n const y = htmlRect.top + scroll.scrollTop;\n return {\n x,\n y\n };\n}\n\nfunction convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {\n let {\n elements,\n rect,\n offsetParent,\n strategy\n } = _ref;\n const isFixed = strategy === 'fixed';\n const documentElement = getDocumentElement(offsetParent);\n const topLayer = elements ? isTopLayer(elements.floating) : false;\n if (offsetParent === documentElement || topLayer && isFixed) {\n return rect;\n }\n let scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n let scale = createCoords(1);\n const offsets = createCoords(0);\n const isOffsetParentAnElement = isHTMLElement(offsetParent);\n if (isOffsetParentAnElement || !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n if (isOffsetParentAnElement) {\n const offsetRect = getBoundingClientRect(offsetParent);\n scale = getScale(offsetParent);\n offsets.x = offsetRect.x + offsetParent.clientLeft;\n offsets.y = offsetRect.y + offsetParent.clientTop;\n }\n }\n const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);\n return {\n width: rect.width * scale.x,\n height: rect.height * scale.y,\n x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,\n y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y\n };\n}\n\nfunction getClientRects(element) {\n return element.getClientRects ? Array.from(element.getClientRects()) : [];\n}\n\n// Gets the entire size of the scrollable document area, even extending outside\n// of the `<html>` and `<body>` rect bounds if horizontally scrollable.\nfunction getDocumentRect(html) {\n const scroll = getNodeScroll(html);\n const body = html.ownerDocument.body;\n const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);\n const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);\n let x = -scroll.scrollLeft + getWindowScrollBarX(html);\n const y = -scroll.scrollTop;\n if (getComputedStyle$1(body).direction === 'rtl') {\n x += max(html.clientWidth, body.clientWidth) - width;\n }\n return {\n width,\n height,\n x,\n y\n };\n}\n\n// Safety check: ensure the scrollbar space is reasonable in case this\n// calculation is affected by unusual styles.\n// Most scrollbars leave 15-18px of space.\nconst SCROLLBAR_MAX = 25;\nfunction getViewportRect(element, strategy, rootBoundary) {\n if (rootBoundary === void 0) {\n rootBoundary = 'viewport';\n }\n const isLayoutViewport = rootBoundary === 'layoutViewport';\n const win = getWindow(element);\n const html = getDocumentElement(element);\n const visualViewport = win.visualViewport;\n let width = html.clientWidth;\n let height = html.clientHeight;\n let x = 0;\n let y = 0;\n if (visualViewport) {\n // Client coordinates are relative to the layout viewport, except in\n // WebKit with an `absolute` strategy, where they are relative to the\n // visual viewport.\n const layoutRelativeClientCoords = !isWebKit() || strategy === 'fixed';\n if (isLayoutViewport) {\n if (!layoutRelativeClientCoords) {\n x = -visualViewport.offsetLeft;\n y = -visualViewport.offsetTop;\n }\n } else {\n width = visualViewport.width;\n height = visualViewport.height;\n if (layoutRelativeClientCoords) {\n x = visualViewport.offsetLeft;\n y = visualViewport.offsetTop;\n }\n }\n }\n const windowScrollbarX = getWindowScrollBarX(html);\n // `scrollbar-gutter: stable` on the <html> reserves gutter space that shrinks\n // the visual width but isn't reflected in `html.clientWidth`, so subtract it.\n // Only the inline-end (right) gutter can hold the scrollbar; `both-edges` also\n // reserves an empty inline-start gutter that clips nothing, so exclude just\n // the one scrollbar-side gutter — halve the measured (two-gutter) total. A\n // left-side scrollbar (`windowScrollbarX > 0`) is already handled by\n // `getHTMLOffset`/`visualViewport.width`; skip it here.\n if (windowScrollbarX <= 0) {\n const doc = html.ownerDocument;\n const body = doc.body;\n const bodyStyles = getComputedStyle(body);\n const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;\n const reservedWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);\n const gutter = getComputedStyle(html).scrollbarGutter === 'stable both-edges' ? reservedWidth / 2 : reservedWidth;\n if (gutter <= SCROLLBAR_MAX) {\n width -= gutter;\n }\n }\n return {\n width,\n height,\n x,\n y\n };\n}\n\n// Returns the inner client rect, subtracting scrollbars if present.\nfunction getInnerBoundingClientRect(element, strategy) {\n const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');\n const top = clientRect.top + element.clientTop;\n const left = clientRect.left + element.clientLeft;\n const scale = getScale(element);\n const width = element.clientWidth * scale.x;\n const height = element.clientHeight * scale.y;\n const x = left * scale.x;\n const y = top * scale.y;\n return {\n width,\n height,\n x,\n y\n };\n}\nfunction getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {\n let rect;\n if (clippingAncestor === 'viewport' || clippingAncestor === 'layoutViewport') {\n rect = getViewportRect(element, strategy, clippingAncestor);\n } else if (clippingAncestor === 'document') {\n rect = getDocumentRect(getDocumentElement(element));\n } else if (isElement(clippingAncestor)) {\n rect = getInnerBoundingClientRect(clippingAncestor, strategy);\n } else {\n const visualOffsets = getVisualOffsets(element);\n rect = {\n x: clippingAncestor.x - visualOffsets.x,\n y: clippingAncestor.y - visualOffsets.y,\n width: clippingAncestor.width,\n height: clippingAncestor.height\n };\n }\n return rectToClientRect(rect);\n}\n\n// A \"clipping ancestor\" is an `overflow` element with the characteristic of\n// clipping (or hiding) child elements. This returns all clipping ancestors\n// of the given element up the tree.\nfunction getClippingElementAncestors(element, cache) {\n const cachedResult = cache.get(element);\n if (cachedResult) {\n return cachedResult;\n }\n let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');\n let lastKeptComputedStyle = null;\n const elementIsFixed = getComputedStyle$1(element).position === 'fixed';\n let currentNode = elementIsFixed ? getParentNode(element) : element;\n\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {\n const computedStyle = getComputedStyle$1(currentNode);\n const currentNodeIsContaining = isContainingBlock(currentNode);\n // Position of the containing block chain below the current node. A fixed\n // element whose containing block hasn't been found yet is a fixed chain.\n const lastPosition = lastKeptComputedStyle ? lastKeptComputedStyle.position : elementIsFixed ? 'fixed' : '';\n\n // A non-containing ancestor does not clip the element when the chain\n // below it escapes it: a fixed chain escapes all ancestors up to the\n // next containing block, an absolute chain escapes static ancestors.\n const shouldDropCurrentNode = !currentNodeIsContaining && (lastPosition === 'fixed' || lastPosition === 'absolute' && computedStyle.position === 'static');\n if (shouldDropCurrentNode) {\n // Drop non-containing blocks.\n result = result.filter(ancestor => ancestor !== currentNode);\n } else {\n // The kept node carries the chain position for the next iteration.\n lastKeptComputedStyle = computedStyle;\n }\n currentNode = getParentNode(currentNode);\n }\n cache.set(element, result);\n return result;\n}\n\n// Gets the maximum area that the element is visible in due to any number of\n// clipping ancestors.\nfunction getClippingRect(_ref) {\n let {\n element,\n boundary,\n rootBoundary,\n strategy\n } = _ref;\n const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);\n const clippingAncestors = [...elementClippingAncestors, rootBoundary];\n const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);\n let top = firstRect.top;\n let right = firstRect.right;\n let bottom = firstRect.bottom;\n let left = firstRect.left;\n for (let i = 1; i < clippingAncestors.length; i++) {\n const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);\n top = max(rect.top, top);\n right = min(rect.right, right);\n bottom = min(rect.bottom, bottom);\n left = max(rect.left, left);\n }\n return {\n width: right - left,\n height: bottom - top,\n x: left,\n y: top\n };\n}\n\nfunction getDimensions(element) {\n const {\n width,\n height\n } = getCssDimensions(element);\n return {\n width,\n height\n };\n}\n\nfunction getRectRelativeToOffsetParent(element, offsetParent, strategy) {\n const isOffsetParentAnElement = isHTMLElement(offsetParent);\n const documentElement = getDocumentElement(offsetParent);\n const isFixed = strategy === 'fixed';\n const rect = getBoundingClientRect(element, true, isFixed, offsetParent);\n let scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n const offsets = createCoords(0);\n if (isOffsetParentAnElement || !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n if (isOffsetParentAnElement) {\n const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);\n offsets.x = offsetRect.x + offsetParent.clientLeft;\n offsets.y = offsetRect.y + offsetParent.clientTop;\n }\n }\n\n // If the <body> scrollbar appears on the left (e.g. RTL systems). Use\n // Firefox with layout.scrollbar.side = 3 in about:config to test this.\n if (!isOffsetParentAnElement && documentElement) {\n offsets.x = getWindowScrollBarX(documentElement);\n }\n const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);\n const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;\n const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;\n return {\n x,\n y,\n width: rect.width,\n height: rect.height\n };\n}\n\nfunction isStaticPositioned(element) {\n return getComputedStyle$1(element).position === 'static';\n}\n\nfunction getTrueOffsetParent(element, polyfill) {\n if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {\n return null;\n }\n if (polyfill) {\n return polyfill(element);\n }\n let rawOffsetParent = element.offsetParent;\n\n // Firefox returns the <html> element as the offsetParent if it's non-static,\n // while Chrome and Safari return the <body> element. The <body> element must\n // be used to perform the correct calculations even if the <html> element is\n // non-static.\n if (getDocumentElement(element) === rawOffsetParent) {\n rawOffsetParent = rawOffsetParent.ownerDocument.body;\n }\n return rawOffsetParent;\n}\n\n// Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\nfunction getOffsetParent(element, polyfill) {\n const win = getWindow(element);\n if (isTopLayer(element)) {\n return win;\n }\n if (!isHTMLElement(element)) {\n let svgOffsetParent = getParentNode(element);\n while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {\n if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {\n return svgOffsetParent;\n }\n svgOffsetParent = getParentNode(svgOffsetParent);\n }\n return win;\n }\n let offsetParent = getTrueOffsetParent(element, polyfill);\n while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {\n offsetParent = getTrueOffsetParent(offsetParent, polyfill);\n }\n if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {\n return win;\n }\n return offsetParent || getContainingBlock(element) || win;\n}\n\nconst getElementRects = async function (data) {\n const getOffsetParentFn = this.getOffsetParent || getOffsetParent;\n const getDimensionsFn = this.getDimensions;\n const floatingDimensions = await getDimensionsFn(data.floating);\n return {\n reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),\n floating: {\n x: 0,\n y: 0,\n width: floatingDimensions.width,\n height: floatingDimensions.height\n }\n };\n};\n\nfunction isRTL(element) {\n return getComputedStyle$1(element).direction === 'rtl';\n}\n\nconst platform = {\n convertOffsetParentRelativeRectToViewportRelativeRect,\n getDocumentElement,\n getClippingRect,\n getOffsetParent,\n getElementRects,\n getClientRects,\n getDimensions,\n getScale,\n isElement,\n isRTL\n};\n\nfunction rectsAreEqual(a, b) {\n return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;\n}\n\n// https://samthor.au/2021/observing-dom/\nfunction observeMove(element, onMove, ancestorResize) {\n let io = null;\n let timeoutId;\n const root = getDocumentElement(element);\n function cleanup() {\n var _io;\n clearTimeout(timeoutId);\n (_io = io) == null || _io.disconnect();\n io = null;\n }\n function refresh(skip, threshold) {\n if (skip === void 0) {\n skip = false;\n }\n if (threshold === void 0) {\n threshold = 1;\n }\n cleanup();\n const elementRectForRootMargin = element.getBoundingClientRect();\n const {\n left,\n top,\n width,\n height\n } = elementRectForRootMargin;\n if (!skip) {\n onMove();\n }\n if (!width || !height) {\n return;\n }\n const insetTop = floor(top);\n const insetRight = floor(root.clientWidth - (left + width));\n const insetBottom = floor(root.clientHeight - (top + height));\n const insetLeft = floor(left);\n const rootMargin = -insetTop + \"px \" + -insetRight + \"px \" + -insetBottom + \"px \" + -insetLeft + \"px\";\n const options = {\n rootMargin,\n threshold: max(0, min(1, threshold)) || 1\n };\n let isFirstUpdate = true;\n function handleObserve(entries) {\n const ratio = entries[0].intersectionRatio;\n\n // The entry is a snapshot, so the reference may have moved since the\n // intersection was computed (under performance constraints, or between\n // consecutive frames of a multi-frame layout shift). The reported ratio\n // and the observed area are stale in that case and cannot be trusted to\n // detect subsequent movement, so refresh regardless of the ratio.\n if (!rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {\n return refresh();\n }\n if (ratio !== threshold) {\n if (!isFirstUpdate) {\n return refresh();\n }\n if (!ratio) {\n // If the reference is clipped in place, the ratio is 0. Throttle\n // the refresh to prevent an infinite loop of updates.\n timeoutId = setTimeout(() => {\n refresh(false, 1e-7);\n }, 1000);\n } else {\n refresh(false, ratio);\n }\n }\n isFirstUpdate = false;\n }\n\n // Older browsers don't support a `document` as the root and will throw an\n // error.\n try {\n io = new IntersectionObserver(handleObserve, {\n ...options,\n // Handle <iframe>s\n root: root.ownerDocument\n });\n } catch (_e) {\n io = new IntersectionObserver(handleObserve, options);\n }\n io.observe(element);\n }\n const win = getWindow(element);\n // The window is a resize ancestor, so when `ancestorResize` is enabled its\n // listener already runs the update on resize. Here we only need to rebuild\n // the `IntersectionObserver` for the new root size, skipping a redundant\n // update. When `ancestorResize` is disabled, this becomes the sole update.\n const handleResize = () => refresh(ancestorResize);\n win.addEventListener('resize', handleResize);\n refresh(true);\n return () => {\n win.removeEventListener('resize', handleResize);\n cleanup();\n };\n}\n\n/**\n * Automatically updates the position of the floating element when necessary.\n * Should only be called when the floating element is mounted on the DOM or\n * visible on the screen.\n * @returns cleanup function that should be invoked when the floating element is\n * removed from the DOM or hidden from the screen.\n * @see https://floating-ui.com/docs/autoUpdate\n */\nfunction autoUpdate(reference, floating, update, options) {\n if (options === void 0) {\n options = {};\n }\n const {\n ancestorScroll = true,\n ancestorResize = true,\n elementResize = typeof ResizeObserver === 'function',\n layoutShift = typeof IntersectionObserver === 'function',\n animationFrame = false\n } = options;\n const referenceEl = unwrapElement(reference);\n const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];\n ancestors.forEach(ancestor => {\n ancestorScroll && ancestor.addEventListener('scroll', update);\n ancestorResize && ancestor.addEventListener('resize', update);\n });\n const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update, ancestorResize) : null;\n let reobserveFrame = -1;\n let resizeObserver = null;\n if (elementResize) {\n resizeObserver = new ResizeObserver(_ref => {\n let [firstEntry] = _ref;\n if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {\n // Prevent update loops when using the `size` middleware.\n // https://github.com/floating-ui/floating-ui/issues/1740\n resizeObserver.unobserve(floating);\n cancelAnimationFrame(reobserveFrame);\n reobserveFrame = requestAnimationFrame(() => {\n var _resizeObserver;\n (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);\n });\n }\n update();\n });\n if (referenceEl && !animationFrame) {\n resizeObserver.observe(referenceEl);\n }\n if (floating) {\n resizeObserver.observe(floating);\n }\n }\n let frameId;\n let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;\n if (animationFrame) {\n frameLoop();\n }\n function frameLoop() {\n const nextRefRect = getBoundingClientRect(reference);\n if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {\n update();\n }\n prevRefRect = nextRefRect;\n frameId = requestAnimationFrame(frameLoop);\n }\n update();\n return () => {\n var _resizeObserver2;\n ancestors.forEach(ancestor => {\n ancestorScroll && ancestor.removeEventListener('scroll', update);\n ancestorResize && ancestor.removeEventListener('resize', update);\n });\n cleanupIo == null || cleanupIo();\n (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();\n resizeObserver = null;\n if (animationFrame) {\n cancelAnimationFrame(frameId);\n }\n };\n}\n\n/**\n * Resolves with an object of overflow side offsets that determine how much the\n * element is overflowing a given clipping boundary on each side.\n * - positive = overflowing the boundary by that number of pixels\n * - negative = how many pixels left before it will overflow\n * - 0 = lies flush with the boundary\n * @see https://floating-ui.com/docs/detectOverflow\n */\nconst detectOverflow = detectOverflow$1;\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = offset$1;\n\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = autoPlacement$1;\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = shift$1;\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = flip$1;\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = size$1;\n\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = hide$1;\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = arrow$1;\n\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = inline$1;\n\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = limitShift$1;\n\n/**\n * Computes the `x` and `y` coordinates that will place the floating element\n * next to a given reference element.\n */\nconst computePosition = (reference, floating, options) => {\n // This caches the expensive `getClippingElementAncestors` function so that\n // multiple lifecycle resets re-use the same result. It only lives for a\n // single call. If other functions become expensive, we can add them as well.\n const cache = new Map();\n const mergedOptions = options != null ? options : {};\n const platformWithCache = {\n ...platform,\n ...mergedOptions.platform,\n _c: cache\n };\n return computePosition$1(reference, floating, {\n ...mergedOptions,\n platform: platformWithCache\n });\n};\n\nexport { arrow, autoPlacement, autoUpdate, computePosition, detectOverflow, flip, hide, inline, limitShift, offset, platform, shift, size };\n","import { computePosition, arrow as arrow$2, autoPlacement as autoPlacement$1, flip as flip$1, hide as hide$1, inline as inline$1, limitShift as limitShift$1, offset as offset$1, shift as shift$1, size as size$1 } from '@floating-ui/dom';\nexport { autoUpdate, computePosition, detectOverflow, getOverflowAncestors, platform } from '@floating-ui/dom';\nimport * as React from 'react';\nimport { useLayoutEffect } from 'react';\nimport * as ReactDOM from 'react-dom';\n\nvar isClient = typeof document !== 'undefined';\n\nvar noop = function noop() {};\nvar index = isClient ? useLayoutEffect : noop;\n\n// Fork of `fast-deep-equal` that only does the comparisons we need and compares\n// functions\nfunction deepEqual(a, b) {\n if (a === b) {\n return true;\n }\n if (typeof a !== typeof b) {\n return false;\n }\n if (typeof a === 'function' && a.toString() === b.toString()) {\n return true;\n }\n let length;\n let i;\n let keys;\n if (a && b && typeof a === 'object') {\n if (Array.isArray(a)) {\n length = a.length;\n if (length !== b.length) return false;\n for (i = length; i-- !== 0;) {\n if (!deepEqual(a[i], b[i])) {\n return false;\n }\n }\n return true;\n }\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) {\n return false;\n }\n for (i = length; i-- !== 0;) {\n if (!{}.hasOwnProperty.call(b, keys[i])) {\n return false;\n }\n }\n for (i = length; i-- !== 0;) {\n const key = keys[i];\n if (key === '_owner' && a.$$typeof) {\n continue;\n }\n if (!deepEqual(a[key], b[key])) {\n return false;\n }\n }\n return true;\n }\n return a !== a && b !== b;\n}\n\nfunction getDPR(element) {\n if (typeof window === 'undefined') {\n return 1;\n }\n const win = element.ownerDocument.defaultView || window;\n return win.devicePixelRatio || 1;\n}\n\nfunction roundByDPR(element, value) {\n const dpr = getDPR(element);\n return Math.round(value * dpr) / dpr;\n}\n\nfunction useLatestRef(value) {\n const ref = React.useRef(value);\n index(() => {\n ref.current = value;\n });\n return ref;\n}\n\n/**\n * Provides data to position a floating element.\n * @see https://floating-ui.com/docs/useFloating\n */\nfunction useFloating(options) {\n if (options === void 0) {\n options = {};\n }\n const {\n placement = 'bottom',\n strategy = 'absolute',\n middleware = [],\n platform,\n elements: {\n reference: externalReference,\n floating: externalFloating\n } = {},\n transform = true,\n whileElementsMounted,\n open\n } = options;\n const [data, setData] = React.useState({\n x: 0,\n y: 0,\n strategy,\n placement,\n middlewareData: {},\n isPositioned: false\n });\n const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);\n if (!deepEqual(latestMiddleware, middleware)) {\n setLatestMiddleware(middleware);\n }\n const [_reference, _setReference] = React.useState(null);\n const [_floating, _setFloating] = React.useState(null);\n const setReference = React.useCallback(node => {\n if (node !== referenceRef.current) {\n referenceRef.current = node;\n _setReference(node);\n }\n }, []);\n const setFloating = React.useCallback(node => {\n if (node !== floatingRef.current) {\n floatingRef.current = node;\n _setFloating(node);\n }\n }, []);\n const referenceEl = externalReference || _reference;\n const floatingEl = externalFloating || _floating;\n const referenceRef = React.useRef(null);\n const floatingRef = React.useRef(null);\n const dataRef = React.useRef(data);\n const hasWhileElementsMounted = whileElementsMounted != null;\n const whileElementsMountedRef = useLatestRef(whileElementsMounted);\n const platformRef = useLatestRef(platform);\n const openRef = useLatestRef(open);\n const update = React.useCallback(() => {\n if (!referenceRef.current || !floatingRef.current) {\n return;\n }\n const config = {\n placement,\n strategy,\n middleware: latestMiddleware\n };\n if (platformRef.current) {\n config.platform = platformRef.current;\n }\n computePosition(referenceRef.current, floatingRef.current, config).then(data => {\n const fullData = {\n ...data,\n // The floating element's position may be recomputed while it's closed\n // but still mounted (such as when transitioning out). To ensure\n // `isPositioned` will be `false` initially on the next open, avoid\n // setting it to `true` when `open === false` (must be specified).\n isPositioned: openRef.current !== false\n };\n if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {\n dataRef.current = fullData;\n ReactDOM.flushSync(() => {\n setData(fullData);\n });\n }\n });\n }, [latestMiddleware, placement, strategy, platformRef, openRef]);\n index(() => {\n if (open === false && dataRef.current.isPositioned) {\n dataRef.current.isPositioned = false;\n setData(data => ({\n ...data,\n isPositioned: false\n }));\n }\n }, [open]);\n const isMountedRef = React.useRef(false);\n index(() => {\n isMountedRef.current = true;\n return () => {\n isMountedRef.current = false;\n };\n }, []);\n index(() => {\n if (referenceEl) referenceRef.current = referenceEl;\n if (floatingEl) floatingRef.current = floatingEl;\n if (referenceEl && floatingEl) {\n if (whileElementsMountedRef.current) {\n return whileElementsMountedRef.current(referenceEl, floatingEl, update);\n }\n update();\n }\n }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);\n const refs = React.useMemo(() => ({\n reference: referenceRef,\n floating: floatingRef,\n setReference,\n setFloating\n }), [setReference, setFloating]);\n const elements = React.useMemo(() => ({\n reference: referenceEl,\n floating: floatingEl\n }), [referenceEl, floatingEl]);\n const floatingStyles = React.useMemo(() => {\n const initialStyles = {\n position: strategy,\n left: 0,\n top: 0\n };\n if (!elements.floating) {\n return initialStyles;\n }\n const x = roundByDPR(elements.floating, data.x);\n const y = roundByDPR(elements.floating, data.y);\n if (transform) {\n return {\n ...initialStyles,\n transform: \"translate(\" + x + \"px, \" + y + \"px)\",\n ...(getDPR(elements.floating) >= 1.5 && {\n willChange: 'transform'\n })\n };\n }\n return {\n position: strategy,\n left: x,\n top: y\n };\n }, [strategy, transform, elements.floating, data.x, data.y]);\n return React.useMemo(() => ({\n ...data,\n update,\n refs,\n elements,\n floatingStyles\n }), [data, update, refs, elements, floatingStyles]);\n}\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * This wraps the core `arrow` middleware to allow React refs as the element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow$1 = options => {\n function isRef(value) {\n return {}.hasOwnProperty.call(value, 'current');\n }\n return {\n name: 'arrow',\n options,\n fn(state) {\n const {\n element,\n padding\n } = typeof options === 'function' ? options(state) : options;\n if (element && isRef(element)) {\n if (element.current != null) {\n return arrow$2({\n element: element.current,\n padding\n }).fn(state);\n }\n return {};\n }\n if (element) {\n return arrow$2({\n element,\n padding\n }).fn(state);\n }\n return {};\n }\n };\n};\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = (options, deps) => {\n const result = offset$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = (options, deps) => {\n const result = shift$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = (options, deps) => {\n const result = limitShift$1(options);\n return {\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = (options, deps) => {\n const result = flip$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = (options, deps) => {\n const result = size$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = (options, deps) => {\n const result = autoPlacement$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = (options, deps) => {\n const result = hide$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = (options, deps) => {\n const result = inline$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * This wraps the core `arrow` middleware to allow React refs as the element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = (options, deps) => {\n const result = arrow$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\nexport { arrow, autoPlacement, flip, hide, inline, limitShift, offset, shift, size, useFloating };\n","import { ReactStore } from '@base-ui/utils/store';\nimport { createEventEmitter } from \"../utils/createEventEmitter.mjs\";\nimport { isClickLikeEvent } from \"../utils.mjs\";\nconst selectors = {\n open: state => state.open,\n transitionStatus: state => state.transitionStatus,\n domReferenceElement: state => state.domReferenceElement,\n referenceElement: state => state.positionReference ?? state.referenceElement,\n floatingElement: state => state.floatingElement,\n floatingId: state => state.floatingId\n};\nexport class FloatingRootStore extends ReactStore {\n constructor(options) {\n const {\n syncOnly,\n nested,\n onOpenChange,\n triggerElements,\n ...initialState\n } = options;\n super({\n ...initialState,\n positionReference: initialState.referenceElement,\n domReferenceElement: initialState.referenceElement\n }, {\n onOpenChange,\n dataRef: {\n current: {}\n },\n events: createEventEmitter(),\n nested,\n triggerElements\n }, selectors);\n this.syncOnly = syncOnly;\n }\n\n /**\n * Syncs the event used by hover logic to distinguish hover-open from click-like interaction.\n */\n syncOpenEvent = (newOpen, event) => {\n if (!newOpen || !this.state.open ||\n // Prevent a pending hover-open from overwriting a click-open event, while allowing\n // click events to upgrade a hover-open.\n event != null && isClickLikeEvent(event)) {\n this.context.dataRef.current.openEvent = newOpen ? event : undefined;\n }\n };\n\n /**\n * Runs the root-owned side effects for an open state change.\n */\n dispatchOpenChange = (newOpen, eventDetails) => {\n this.syncOpenEvent(newOpen, eventDetails.event);\n const details = {\n open: newOpen,\n reason: eventDetails.reason,\n nativeEvent: eventDetails.event,\n nested: this.context.nested,\n triggerElement: eventDetails.trigger\n };\n this.context.events.emit('openchange', details);\n };\n\n /**\n * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments.\n *\n * @param newOpen The new open state.\n * @param eventDetails Details about the event that triggered the open state change.\n */\n setOpen = (newOpen, eventDetails) => {\n if (this.syncOnly) {\n this.context.onOpenChange?.(newOpen, eventDetails);\n return;\n }\n this.dispatchOpenChange(newOpen, eventDetails);\n this.context.onOpenChange?.(newOpen, eventDetails);\n };\n}","'use client';\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { useId } from '@base-ui/utils/useId';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { FOCUSABLE_ATTRIBUTE } from \"../../floating-ui-react/utils/constants.mjs\";\nimport { useFloatingParentNodeId } from \"../../floating-ui-react/components/FloatingTree.mjs\";\nimport { useSyncedFloatingRootContext } from \"../../floating-ui-react/hooks/useSyncedFloatingRootContext.mjs\";\nimport { useTransitionStatus } from \"../../internals/useTransitionStatus.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nexport const FOCUSABLE_POPUP_PROPS = {\n tabIndex: -1,\n [FOCUSABLE_ATTRIBUTE]: ''\n};\n\n/**\n * Returns the default `initialFocus` resolver for a popup. When opened by touch it focuses the\n * popup element itself to prevent the virtual keyboard from opening (required for Android\n * specifically; iOS handles this automatically). Otherwise it falls back to the default behavior.\n */\nexport function createDefaultInitialFocus(popupRef) {\n return interactionType => interactionType === 'touch' ? popupRef.current : true;\n}\n\n/**\n * The subset of a popup handle that a Root needs to bind its store to. Both the real handle classes\n * and any test double satisfy it.\n */\n\n/**\n * Creates and owns a popup store on behalf of a Root part. The store is created exactly once, with\n * controlled props and root state synced separately after creation. Sets up the synced floating\n * root context and returns the store.\n *\n * @param createStore Factory that builds the store. Called exactly once, receiving the floating id\n * and whether the popup is nested inside another floating element, both resolved on the first render.\n * @param treatPopupAsFloatingElement Whether the popup element is passed to Floating UI as the\n * floating element instead of the default positioner.\n */\nexport function usePopupRootStore(createStore, treatPopupAsFloatingElement = false) {\n const floatingId = useId();\n const nested = useFloatingParentNodeId() != null;\n const store = useRefWithInit(() => createStore(floatingId, nested)).current;\n useSyncedFloatingRootContext({\n popupStore: store,\n treatPopupAsFloatingElement,\n floatingRootContext: store.state.floatingRootContext,\n floatingId,\n nested,\n onOpenChange: store.setOpen\n });\n return store;\n}\n\n/**\n * Attaches a Root's store to a handle for this component's committed lifetime. Popup Roots render\n * it before their interactions and user children so its layout effect runs before descendant layout\n * effects. This lets descendants call the handle during the Root's initial commit without attaching\n * during render, which would leak suspended or abandoned stores. Store subscribers are notified by\n * `attachStore` in this ordinary layout phase, where React permits synchronous updates.\n *\n * Popup Roots must render this component only when a handle is present so handle-less Roots avoid\n * mounting an extra fiber and layout effect.\n */\nexport function PopupHandleAttachment({\n handle,\n store\n}) {\n useIsoLayoutEffect(() => {\n return handle.attachStore(store);\n }, [handle, store]);\n return null;\n}\nfunction syncTriggerCount(store) {\n const triggerCount = store.context.triggerElements.size;\n if (store.select('open') && store.state.triggerCount !== triggerCount) {\n store.set('triggerCount', triggerCount);\n }\n}\n\n/**\n * Returns a stable callback ref that registers/unregisters the trigger element in the store.\n *\n * Stable so a downstream ref merger that retains the callback it was first given still reaches the\n * trigger's current store. The registration is tracked as a `(store, id, element)` triple, so\n * unregistering targets the store the element was actually registered in.\n *\n * Since the callback never changes, the caller must re-run it from a layout effect keyed on\n * `[store, id]` to migrate an already-registered element. That effect is also what registers the\n * element in the first place when `id` only resolves after the first commit (React 17's `useId`\n * fallback), because the register call made while the id is still `undefined` does nothing.\n *\n * @param id Id of the trigger.\n * @param store The Store instance where the trigger should be registered.\n */\nexport function useTriggerRegistration(id, store) {\n const registrationRef = React.useRef(null);\n return useStableCallback(element => {\n const registration = registrationRef.current;\n if (registration !== null) {\n if (registration.element === element && registration.store === store && registration.id === id) {\n // Already registered where it belongs, so the caller's migration effect is free on mount.\n return;\n }\n registrationRef.current = null;\n const registeredStore = registration.store;\n if (registeredStore.context.triggerElements.getById(registration.id) === registration.element) {\n registeredStore.context.triggerElements.delete(registration.id);\n syncTriggerCount(registeredStore);\n }\n }\n if (element !== null && id !== undefined) {\n registrationRef.current = {\n store,\n id,\n element\n };\n store.context.triggerElements.add(id, element);\n syncTriggerCount(store);\n }\n });\n}\nexport function createPopupOpenState(state, open, trigger, preventUnmountOnClose = false) {\n let preventUnmountingOnClose = state.preventUnmountingOnClose;\n if (open) {\n // Opening starts a new close cycle, so clear any previous request to keep the popup mounted.\n preventUnmountingOnClose = false;\n } else if (preventUnmountOnClose) {\n preventUnmountingOnClose = true;\n }\n const triggerId = trigger?.id ?? null;\n let activeTriggerId = state.activeTriggerId;\n let activeTriggerElement = state.activeTriggerElement;\n\n // If a popup is closing, the `trigger` may be undefined.\n // We want to keep the previous value so that exit animations are played and focus is returned correctly.\n if (triggerId || open) {\n activeTriggerId = triggerId;\n activeTriggerElement = trigger ?? null;\n }\n return {\n open,\n preventUnmountingOnClose,\n activeTriggerId,\n activeTriggerElement\n };\n}\nexport function attachPreventUnmountOnClose(eventDetails) {\n let preventUnmountOnClose = false;\n eventDetails.preventUnmountOnClose = () => {\n preventUnmountOnClose = true;\n };\n return () => preventUnmountOnClose;\n}\n\n/**\n * Runs the shared open-change sequence for a popup store: notifies `onOpenChange`,\n * honors cancellation, dispatches the floating root change, maps the reason to an\n * `instantType`, and commits the state update (synchronously for hover so\n * `getAnimations()` observes it). Stores supply their own differences via\n * `extraState` (e.g. the last change reason) and `onBeforeDispatch` (e.g. updating\n * inline-rect coordinates).\n */\nexport function applyPopupOpenChange(store, nextOpen, eventDetails, options = {}) {\n const reason = eventDetails.reason;\n const isHover = reason === REASONS.triggerHover;\n const isFocusOpen = nextOpen && reason === REASONS.triggerFocus;\n const isDismissClose = !nextOpen && (reason === REASONS.triggerPress || reason === REASONS.escapeKey);\n const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails);\n store.context.onOpenChange?.(nextOpen, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n options.onBeforeDispatch?.();\n store.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);\n const changeState = () => {\n const popupOpenState = createPopupOpenState(store.state, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose());\n const updatedState = {\n ...options.extraState,\n ...popupOpenState\n };\n if (isFocusOpen) {\n updatedState.instantType = 'focus';\n } else if (isDismissClose) {\n updatedState.instantType = 'dismiss';\n } else if (isHover) {\n updatedState.instantType = undefined;\n }\n store.update(updatedState);\n };\n if (isHover) {\n // Flush synchronously for hover so `node.getAnimations()` sees the new state.\n ReactDOM.flushSync(changeState);\n } else {\n changeState();\n }\n}\n\n/**\n * Sets up trigger data forwarding to the store.\n *\n * @param triggerId Id of the trigger.\n * @param triggerElementRef Ref for the trigger DOM element.\n * @param store The Store instance managing the popup state.\n * @param stateUpdates An object with state updates to apply when the trigger is active.\n */\nexport function useTriggerDataForwarding(triggerId, triggerElementRef, store, stateUpdates) {\n const isMountedByThisTrigger = store.useState('isMountedByTrigger', triggerId);\n const baseRegisterTrigger = useTriggerRegistration(triggerId, store);\n\n // Applies trigger-owned state (active-trigger ownership and payload) when the trigger registers.\n // Stable so payload/`stateUpdates` changes do not change the ref identity (which would needlessly\n // churn registration); it reads the latest closure values when invoked.\n const applyTriggerData = useStableCallback(element => {\n const open = store.select('open');\n const activeTriggerId = store.select('activeTriggerId');\n if (activeTriggerId === triggerId) {\n const changes = {\n activeTriggerElement: element,\n ...(open ? stateUpdates : null)\n };\n store.update(changes);\n return;\n }\n if (activeTriggerId == null && open) {\n // If a popup is already open, a detached trigger can mount before any active trigger\n // has been established. Claim the first registered trigger so trigger-owned focus\n // management and ARIA relationships work.\n const changes = {\n activeTriggerId: triggerId ?? null,\n activeTriggerElement: element,\n ...stateUpdates\n };\n store.update(changes);\n }\n });\n\n // Stable, so the merged ref on the rendered element keeps its identity for the trigger's whole\n // lifetime.\n const registerTrigger = useStableCallback(element => {\n baseRegisterTrigger(element);\n if (element) {\n applyTriggerData(element);\n }\n });\n\n // A stable ref does not re-fire on a store or id change, so migrate here instead: unregister from\n // the previous store, then register the element the trigger still renders into the current one.\n useIsoLayoutEffect(() => {\n registerTrigger(triggerElementRef.current);\n return () => registerTrigger(null);\n }, [registerTrigger, triggerElementRef, store, triggerId]);\n useIsoLayoutEffect(() => {\n if (isMountedByThisTrigger) {\n const changes = {\n activeTriggerElement: triggerElementRef.current,\n ...stateUpdates\n };\n store.update(changes);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isMountedByThisTrigger, store, triggerElementRef, ...Object.values(stateUpdates)]);\n return {\n registerTrigger,\n isMountedByThisTrigger\n };\n}\n/**\n * Keeps trigger registration state synchronized while the popup is open.\n *\n * When a popup opens without an explicit trigger id and exactly one trigger is registered, that\n * trigger is claimed as the active trigger. When the active trigger id is still registered but its\n * element changed, the active element is refreshed. When the active trigger id is missing from the\n * registry but the same element is still registered under a different id (e.g. the rendered trigger\n * carries its own DOM `id` that differs from Base UI's internal trigger id), the active id is\n * reassociated to the registered id instead of being treated as lost. When the active trigger\n * unregisters, the default path preserves existing ownership so non-closing popup families do not\n * silently claim a different trigger while staying open.\n *\n * If `closeOnActiveTriggerUnmount` is enabled, unregistering a previously resolved active trigger\n * requests a close after a microtask so a same-tick replacement trigger with the same id can\n * register first. An active trigger id that has not matched a registered trigger yet is treated as\n * pending and does not request a close.\n *\n * This should be called on the Root part.\n *\n * @param store The Store instance managing the popup state.\n * @param options Options for active trigger unmount behavior.\n */\nexport function useImplicitActiveTrigger(store, options = {}) {\n const {\n closeOnActiveTriggerUnmount = false\n } = options;\n // Distinguishes a trigger that unmounted from a new active trigger that has not hydrated yet.\n const resolvedActiveTriggerIdRef = React.useRef(null);\n const open = store.useState('open');\n const reactiveTriggerCount = store.useState('triggerCount');\n // Subscribe to the active trigger id so the reconciliation below reruns when ownership moves to\n // another trigger while the popup stays open (e.g. a focus/hover handoff between triggers).\n const activeTriggerId = store.useState('activeTriggerId');\n // Subscribe to the active trigger element so the reconciliation reruns when a pending active\n // trigger registers in a commit where the trigger count nets out unchanged (registration\n // forwards the element to the store when the registering trigger matches the active id).\n // Without this, the id would never be marked resolved and a later genuine unmount would be\n // misclassified as pending, disabling `closeOnActiveTriggerUnmount`.\n const reactiveActiveTriggerElement = store.useState('activeTriggerElement');\n useIsoLayoutEffect(() => {\n if (!open) {\n resolvedActiveTriggerIdRef.current = null;\n if (store.state.triggerCount !== 0) {\n store.set('triggerCount', 0);\n }\n return;\n }\n const triggerCount = store.context.triggerElements.size;\n const stateUpdates = {};\n if (store.state.triggerCount !== triggerCount) {\n stateUpdates.triggerCount = triggerCount;\n }\n const currentActiveTriggerId = store.select('activeTriggerId');\n let lostActiveTriggerId = null;\n if (currentActiveTriggerId) {\n const activeTriggerElement = store.context.triggerElements.getById(currentActiveTriggerId);\n if (!activeTriggerElement) {\n for (const [triggerId, triggerElement] of store.context.triggerElements.entries()) {\n if (triggerElement === store.state.activeTriggerElement) {\n stateUpdates.activeTriggerId = triggerId;\n stateUpdates.activeTriggerElement = triggerElement;\n resolvedActiveTriggerIdRef.current = triggerId;\n break;\n }\n }\n if (stateUpdates.activeTriggerId === undefined) {\n if (resolvedActiveTriggerIdRef.current === currentActiveTriggerId) {\n lostActiveTriggerId = currentActiveTriggerId;\n } else {\n resolvedActiveTriggerIdRef.current = null;\n }\n }\n } else {\n resolvedActiveTriggerIdRef.current = currentActiveTriggerId;\n if (activeTriggerElement !== store.state.activeTriggerElement) {\n stateUpdates.activeTriggerElement = activeTriggerElement;\n }\n }\n } else {\n resolvedActiveTriggerIdRef.current = null;\n }\n if (!lostActiveTriggerId && !currentActiveTriggerId && triggerCount === 1) {\n const iteratorResult = store.context.triggerElements.entries().next();\n if (!iteratorResult.done) {\n const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value;\n stateUpdates.activeTriggerId = implicitTriggerId;\n stateUpdates.activeTriggerElement = implicitTriggerElement;\n resolvedActiveTriggerIdRef.current = implicitTriggerId;\n }\n }\n if (stateUpdates.triggerCount !== undefined || stateUpdates.activeTriggerId !== undefined || stateUpdates.activeTriggerElement !== undefined) {\n store.update(stateUpdates);\n }\n if (lostActiveTriggerId) {\n if (closeOnActiveTriggerUnmount) {\n // Defer so a same-tick replacement trigger with the same id can register first.\n queueMicrotask(() => {\n if (store.select('open') && store.select('activeTriggerId') === lostActiveTriggerId && !store.context.triggerElements.getById(lostActiveTriggerId)) {\n const eventDetails = createChangeEventDetails(REASONS.none);\n store.setOpen(false, eventDetails);\n // If closing is canceled, keep the previous active trigger ownership for the\n // still-open popup instead of claiming another trigger implicitly.\n if (!eventDetails.isCanceled) {\n store.update({\n activeTriggerId: null,\n activeTriggerElement: null\n });\n }\n }\n });\n }\n }\n }, [open, store, reactiveTriggerCount, activeTriggerId, reactiveActiveTriggerElement, closeOnActiveTriggerUnmount]);\n}\n\n/**\n * Manages the mounted state of the popup.\n * Sets up the transition status listeners and handles unmounting when needed.\n * Updates the `mounted`, `transitionStatus`, and `preventUnmountingOnClose` states in the store.\n *\n * @param open Whether the popup is open.\n * @param store The Store instance managing the popup state.\n * @param onUnmount Optional callback to be called when the popup is unmounted.\n * @param animateInitialOpen Whether a popup that mounts already open should still play its enter\n * transition. Defaults to `false`, so content that was open on the first render (a `defaultOpen`\n * popup on page load, SSR'd markup) appears without animating. Opt in for popups whose subtree\n * only mounts in response to something the user did, such as a submenu inside a menu popup.\n *\n * @returns A function to forcibly unmount the popup.\n */\nexport function useOpenStateTransitions(open, store, onUnmount, animateInitialOpen) {\n const {\n mounted,\n setMounted,\n transitionStatus\n } = useTransitionStatus(open, false, false, animateInitialOpen);\n const preventUnmountingOnClose = store.useState('preventUnmountingOnClose');\n // Opening starts a new close cycle. Clear during render so the close-completion hook below\n // reads the synchronized value on the same pass.\n const syncedPreventUnmountingOnClose = open ? false : preventUnmountingOnClose;\n store.useSyncedValues({\n mounted,\n transitionStatus,\n preventUnmountingOnClose: syncedPreventUnmountingOnClose\n });\n const forceUnmount = useStableCallback(() => {\n setMounted(false);\n store.update({\n activeTriggerId: null,\n activeTriggerElement: null,\n mounted: false,\n preventUnmountingOnClose: false\n });\n onUnmount?.();\n store.context.onOpenChangeComplete?.(false);\n });\n useOpenChangeComplete({\n enabled: mounted && !open && !syncedPreventUnmountingOnClose,\n open,\n ref: store.context.popupRef,\n onComplete() {\n if (!open) {\n forceUnmount();\n }\n }\n });\n return {\n forceUnmount,\n transitionStatus\n };\n}\nexport function usePopupInteractionProps(store, statePart) {\n store.useSyncedValues(statePart);\n useIsoLayoutEffect(() => () => {\n store.update({\n activeTriggerProps: EMPTY_OBJECT,\n inactiveTriggerProps: EMPTY_OBJECT,\n popupProps: EMPTY_OBJECT\n });\n }, [store]);\n}\nexport function usePopupRootSync(store, open) {\n useIsoLayoutEffect(() => {\n if (!open && store.state.openMethod !== null) {\n store.set('openMethod', null);\n }\n }, [open, store]);\n useIsoLayoutEffect(() => () => {\n if (store.state.openMethod !== null) {\n store.set('openMethod', null);\n }\n }, [store]);\n}","/**\n * Development-only reverse index of element to registered id, keyed by the owning map.\n *\n * Registration would otherwise have to scan every entry to detect an element claimed by two ids,\n * making the mount of many triggers sharing one handle quadratic. Kept module-scoped, lazily\n * initialized, and read only from `process.env.NODE_ENV` guards so production builds drop it along\n * with the checks.\n */\nlet devElementIdsByMap;\nfunction getDevElementIds(map) {\n devElementIdsByMap ??= new WeakMap();\n let elementIds = devElementIdsByMap.get(map);\n if (!elementIds) {\n elementIds = new WeakMap();\n devElementIdsByMap.set(map, elementIds);\n }\n return elementIds;\n}\n\n/**\n * Data structure to keep track of popup trigger elements by their IDs.\n *\n * Element lookups iterate the id map rather than maintaining a parallel Set. Registration is O(1),\n * while `hasElement` and `hasMatchingElement` are linear in the number of triggers.\n */\nexport class PopupTriggerMap {\n constructor() {\n this.idMap = new Map();\n }\n\n /**\n * Adds a trigger element with the given ID.\n *\n * Note: The provided element is assumed to not be registered under multiple IDs.\n */\n add(id, element) {\n if (process.env.NODE_ENV !== 'production') {\n const elementIds = getDevElementIds(this);\n const existingId = elementIds.get(element);\n if (existingId !== undefined && existingId !== id) {\n // TODO: fix mui/no-guarded-throw\n // eslint-disable-next-line mui/no-guarded-throw\n throw new Error('Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.');\n }\n\n // Reusing an id for a different element evicts the previous one, so it must lose its claim\n // on the id or a later registration under a different id would be reported as a duplicate.\n const previousElement = this.idMap.get(id);\n if (previousElement !== undefined && previousElement !== element) {\n elementIds.delete(previousElement);\n }\n elementIds.set(element, id);\n }\n this.idMap.set(id, element);\n }\n\n /**\n * Removes the trigger element with the given ID.\n */\n delete(id) {\n if (process.env.NODE_ENV !== 'production') {\n const element = this.idMap.get(id);\n if (element !== undefined) {\n devElementIdsByMap?.get(this)?.delete(element);\n }\n }\n this.idMap.delete(id);\n }\n\n /**\n * Whether the given element is registered as a trigger.\n */\n hasElement(element) {\n for (const registered of this.idMap.values()) {\n if (registered === element) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Whether there is a registered trigger element matching the given predicate.\n */\n hasMatchingElement(predicate) {\n for (const element of this.idMap.values()) {\n if (predicate(element)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Returns the trigger element associated with the given ID, or undefined if no such element exists.\n */\n getById(id) {\n return this.idMap.get(id);\n }\n\n /**\n * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element].\n */\n entries() {\n return this.idMap.entries();\n }\n\n /**\n * Returns an iterable of all registered trigger elements.\n */\n elements() {\n return this.idMap.values();\n }\n\n /**\n * Returns the number of registered trigger elements.\n */\n get size() {\n return this.idMap.size;\n }\n}","'use client';\n\nimport { isElement } from '@floating-ui/utils/dom';\nimport { useId } from '@base-ui/utils/useId';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { PopupTriggerMap } from \"../../utils/popups/index.mjs\";\nimport { useFloatingParentNodeId } from \"../components/FloatingTree.mjs\";\nimport { FloatingRootStore } from \"../components/FloatingRootStore.mjs\";\nexport function useFloatingRootContext(options) {\n const {\n open = false,\n onOpenChange,\n elements = {}\n } = options;\n const floatingId = useId();\n const nested = useFloatingParentNodeId() != null;\n if (process.env.NODE_ENV !== 'production') {\n const optionDomReference = elements.reference;\n if (optionDomReference && !isElement(optionDomReference)) {\n console.error('Cannot pass a virtual element to the `elements.reference` option,', 'as it must be a real DOM element. Use `context.setPositionReference()`', 'instead.');\n }\n }\n const store = useRefWithInit(() => new FloatingRootStore({\n open,\n transitionStatus: undefined,\n onOpenChange,\n referenceElement: elements.reference ?? null,\n floatingElement: elements.floating ?? null,\n triggerElements: new PopupTriggerMap(),\n floatingId,\n syncOnly: false,\n nested\n })).current;\n useIsoLayoutEffect(() => {\n const valuesToSync = {\n open,\n floatingId\n };\n if (elements.reference !== undefined) {\n valuesToSync.referenceElement = elements.reference;\n valuesToSync.domReferenceElement = isElement(elements.reference) ? elements.reference : null;\n }\n if (elements.floating !== undefined) {\n valuesToSync.floatingElement = elements.floating;\n }\n store.update(valuesToSync);\n }, [open, floatingId, elements.reference, elements.floating, store]);\n store.context.onOpenChange = onOpenChange;\n store.context.nested = nested;\n return store;\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useFloating as usePosition } from '@floating-ui/react-dom';\nimport { isElement } from '@floating-ui/utils/dom';\nimport { useFloatingTree } from \"../components/FloatingTree.mjs\";\nimport { useFloatingRootContext } from \"./useFloatingRootContext.mjs\";\n\n/**\n * Provides data to position a floating element and context to add interactions.\n * @see https://floating-ui.com/docs/useFloating\n */\nexport function useFloating(options = {}) {\n const internalStore = useFloatingRootContext(options);\n const store = options.rootContext || internalStore;\n return useFloatingWithStore(options, store);\n}\n\n/**\n * Base UI's private `useFloating` path. The caller must supply the root store, so this skips the\n * internal root-context hook used by the public Floating UI-compatible API.\n */\nexport function useBaseUIFloating(options) {\n return useFloatingWithStore(options, options.rootContext);\n}\nfunction useFloatingWithStore(options, store) {\n const {\n nodeId,\n externalTree\n } = options;\n const referenceElement = store.useState('referenceElement');\n const floatingElement = store.useState('floatingElement');\n const domReferenceElement = store.useState('domReferenceElement');\n const open = store.useState('open');\n const floatingId = store.useState('floatingId');\n const [positionReference, setPositionReferenceRaw] = React.useState(null);\n const [localDomReference, setLocalDomReference] = React.useState(undefined);\n const [localFloatingElement, setLocalFloatingElement] = React.useState(undefined);\n const domReferenceRef = React.useRef(null);\n const tree = useFloatingTree(externalTree);\n const storeElements = React.useMemo(() => ({\n reference: referenceElement,\n floating: floatingElement,\n domReference: domReferenceElement\n }), [referenceElement, floatingElement, domReferenceElement]);\n const position = usePosition({\n ...options,\n elements: {\n ...storeElements,\n ...(positionReference && {\n reference: positionReference\n })\n }\n });\n const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null;\n const syncedFloatingElement = localFloatingElement === undefined ? store.state.floatingElement : localFloatingElement;\n store.useSyncedValue('referenceElement', localDomReference ?? null);\n store.useSyncedValue('domReferenceElement', localDomReference === undefined ? domReferenceElement : localDomReferenceElement);\n store.useSyncedValue('floatingElement', syncedFloatingElement);\n const setPositionReference = React.useCallback(node => {\n const computedPositionReference = isElement(node) ? {\n getBoundingClientRect: () => node.getBoundingClientRect(),\n getClientRects: () => node.getClientRects(),\n contextElement: node\n } : node;\n // Store the positionReference in state if the DOM reference is specified externally via the\n // `elements.reference` option. This ensures that it won't be overridden on future renders.\n setPositionReferenceRaw(computedPositionReference);\n position.refs.setReference(computedPositionReference);\n }, [position.refs]);\n const setReference = React.useCallback(node => {\n if (isElement(node) || node === null) {\n domReferenceRef.current = node;\n setLocalDomReference(node);\n }\n\n // Backwards-compatibility for passing a virtual element to `reference`\n // after it has set the DOM reference.\n if (isElement(position.refs.reference.current) || position.refs.reference.current === null ||\n // Don't allow setting virtual elements using the old technique back to\n // `null` to support `positionReference` + an unstable `reference`\n // callback ref.\n node !== null && !isElement(node)) {\n position.refs.setReference(node);\n }\n }, [position.refs, setLocalDomReference]);\n const setFloating = React.useCallback(node => {\n setLocalFloatingElement(node);\n position.refs.setFloating(node);\n }, [position.refs]);\n const refs = React.useMemo(() => ({\n ...position.refs,\n setReference,\n setFloating,\n setPositionReference,\n domReference: domReferenceRef\n }), [position.refs, setReference, setFloating, setPositionReference]);\n const elements = React.useMemo(() => ({\n ...position.elements,\n domReference: domReferenceElement\n }), [position.elements, domReferenceElement]);\n const context = React.useMemo(() => ({\n ...position,\n dataRef: store.context.dataRef,\n open,\n onOpenChange: store.setOpen,\n events: store.context.events,\n floatingId,\n refs,\n elements,\n nodeId,\n rootStore: store\n }), [position, refs, elements, nodeId, store, open, floatingId]);\n useIsoLayoutEffect(() => {\n if (domReferenceElement) {\n domReferenceRef.current = domReferenceElement;\n }\n }, [domReferenceElement]);\n useIsoLayoutEffect(() => {\n store.context.dataRef.current.floatingContext = context;\n const node = tree?.nodesRef.current.find(n => n.id === nodeId);\n if (node) {\n node.context = context;\n }\n });\n return React.useMemo(() => ({\n ...position,\n context,\n refs,\n elements,\n rootStore: store\n }), [position, refs, elements, context, store]);\n}","'use client';\n\nimport * as React from 'react';\nimport { useAnimationFrame } from '@base-ui/utils/useAnimationFrame';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { platform } from '@base-ui/utils/platform';\nimport { isHTMLElement } from '@floating-ui/utils/dom';\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useFloatingParentNodeId, useFloatingTree } from \"../components/FloatingTree.mjs\";\nimport { findNonDisabledListIndex, getMaxListIndex, getMinListIndex, isIndexOutOfListBounds } from \"../utils/composite.mjs\";\nimport { ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP } from \"../utils/constants.mjs\";\nimport { activeElement, contains, getFloatingFocusElement, getTarget, isTypeableCombobox } from \"../utils/element.mjs\";\nimport { enqueueFocus } from \"../utils/enqueueFocus.mjs\";\nimport { isVirtualClick, isVirtualPointerEvent, stopEvent } from \"../utils/event.mjs\";\nexport const ESCAPE = 'Escape';\n\n// WebKit fires zero-delta `mousemove`/`pointermove` events when the list scrolls\n// beneath a stationary pointer, moving the highlight during keyboard navigation.\n// https://github.com/mui/base-ui/issues/4002\nfunction isStationaryWebKitPointer(event) {\n return platform.engine.webkit && event.movementX === 0 && event.movementY === 0;\n}\nfunction doSwitch(orientation, vertical, horizontal) {\n switch (orientation) {\n case 'vertical':\n return vertical;\n case 'horizontal':\n return horizontal;\n default:\n return vertical || horizontal;\n }\n}\nfunction isMainOrientationKey(key, orientation) {\n const vertical = key === ARROW_UP || key === ARROW_DOWN;\n const horizontal = key === ARROW_LEFT || key === ARROW_RIGHT;\n return doSwitch(orientation, vertical, horizontal);\n}\nfunction isMainOrientationToEndKey(key, orientation, rtl) {\n const vertical = key === ARROW_DOWN;\n const horizontal = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT;\n return doSwitch(orientation, vertical, horizontal) || key === 'Enter' || key === ' ' || key === '';\n}\nfunction isCrossOrientationOpenKey(key, orientation, rtl) {\n const vertical = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT;\n const horizontal = key === ARROW_DOWN;\n return doSwitch(orientation, vertical, horizontal);\n}\nfunction isCrossOrientationCloseKey(key, orientation, rtl, grid) {\n const vertical = rtl ? key === ARROW_RIGHT : key === ARROW_LEFT;\n const horizontal = key === ARROW_UP;\n if (orientation === 'both' || orientation === 'horizontal' && grid) {\n return key === ESCAPE;\n }\n return doSwitch(orientation, vertical, horizontal);\n}\n/**\n * Adds arrow key-based navigation of a list of items, either using real DOM\n * focus or virtual focus.\n * @see https://floating-ui.com/docs/useListNavigation\n */\nexport function useListNavigation(context, props) {\n const {\n listRef,\n activeIndex,\n onNavigate: onNavigateProp = () => {},\n enabled = true,\n selectedIndex = null,\n allowEscape = false,\n loopFocus = false,\n nested = false,\n rtl = false,\n virtual = false,\n focusItemOnOpen = 'auto',\n focusItemOnHover = true,\n openOnArrowKeyDown = true,\n disabledIndices = undefined,\n orientation = 'vertical',\n parentOrientation,\n id,\n resetOnPointerLeave = true,\n externalTree,\n grid: navigateGrid\n } = props;\n const isGrid = navigateGrid != null;\n if (process.env.NODE_ENV !== 'production') {\n if (allowEscape) {\n if (!loopFocus) {\n console.warn('`useListNavigation` looping must be enabled to allow escaping.');\n }\n if (!virtual) {\n console.warn('`useListNavigation` must be virtual to allow escaping.');\n }\n }\n if (orientation === 'vertical' && isGrid) {\n console.warn('In grid list navigation mode, the `orientation` should', 'be either \"horizontal\" or \"both\".');\n }\n }\n const store = 'rootStore' in context ? context.rootStore : context;\n const open = store.useState('open');\n const floatingElement = store.useState('floatingElement');\n const domReferenceElement = store.useState('domReferenceElement');\n const dataRef = store.context.dataRef;\n const floatingFocusElement = getFloatingFocusElement(floatingElement);\n const typeableComboboxReference = isTypeableCombobox(domReferenceElement);\n const floatingFocusElementRef = useValueAsRef(floatingFocusElement);\n const parentId = useFloatingParentNodeId();\n const tree = useFloatingTree(externalTree);\n const focusItemOnOpenRef = React.useRef(focusItemOnOpen);\n const indexRef = React.useRef(selectedIndex ?? -1);\n const keyRef = React.useRef(null);\n const isPointerModalityRef = React.useRef(true);\n const onNavigate = useStableCallback(event => {\n onNavigateProp(indexRef.current === -1 ? null : indexRef.current, event);\n });\n const previousMountedRef = React.useRef(!!floatingElement);\n const previousOpenRef = React.useRef(open);\n const forceSyncFocusRef = React.useRef(false);\n const forceScrollIntoViewRef = React.useRef(false);\n const cancelQueuedFocusRef = React.useRef(null);\n const disabledIndicesRef = useValueAsRef(disabledIndices);\n const latestOpenRef = useValueAsRef(open);\n const selectedIndexRef = useValueAsRef(selectedIndex);\n const resetOnPointerLeaveRef = useValueAsRef(resetOnPointerLeave);\n const focusFrame = useAnimationFrame();\n const waitForListPopulatedFrame = useAnimationFrame();\n const focusItem = useStableCallback(() => {\n function runFocus(item) {\n if (virtual) {\n tree?.events.emit('virtualfocus', item);\n } else {\n cancelQueuedFocusRef.current = enqueueFocus(item, {\n sync: forceSyncFocusRef.current,\n preventScroll: true\n });\n }\n }\n const initialItem = listRef.current[indexRef.current];\n const forceScrollIntoView = forceScrollIntoViewRef.current;\n if (initialItem) {\n runFocus(initialItem);\n }\n const scheduler = forceSyncFocusRef.current ? callback => callback() : callback => focusFrame.request(callback);\n scheduler(() => {\n const waitedItem = listRef.current[indexRef.current] || initialItem;\n if (!waitedItem) {\n return;\n }\n if (!initialItem) {\n runFocus(waitedItem);\n }\n const shouldScrollIntoView =\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n item && (forceScrollIntoView || !isPointerModalityRef.current);\n if (shouldScrollIntoView) {\n // JSDOM doesn't support `.scrollIntoView()` but it's widely supported\n // by all browsers.\n waitedItem.scrollIntoView?.({\n block: 'nearest',\n inline: 'nearest'\n });\n }\n });\n });\n useIsoLayoutEffect(() => {\n dataRef.current.orientation = orientation;\n }, [dataRef, orientation]);\n\n // Sync `selectedIndex` to be the `activeIndex` upon opening the floating\n // element. Also, reset `activeIndex` upon closing the floating element.\n useIsoLayoutEffect(() => {\n if (!enabled) {\n return;\n }\n if (open && floatingElement) {\n indexRef.current = selectedIndex ?? -1;\n if (focusItemOnOpenRef.current && selectedIndex != null) {\n // Regardless of the pointer modality, we want to ensure the selected\n // item comes into view when the floating element is opened.\n forceScrollIntoViewRef.current = true;\n onNavigate();\n }\n } else if (previousMountedRef.current) {\n // Reset the active index when the list is no longer open and mounted (closing or\n // unmounting). `onNavigate` is a stable callback that always forwards to the latest\n // `onNavigate` prop.\n indexRef.current = -1;\n onNavigate();\n }\n }, [enabled, open, floatingElement, selectedIndex, onNavigate]);\n\n // Sync `activeIndex` to be the focused item while the floating element is\n // open.\n useIsoLayoutEffect(() => {\n if (!enabled) {\n return;\n }\n if (!open) {\n forceSyncFocusRef.current = false;\n return;\n }\n if (!floatingElement) {\n return;\n }\n if (activeIndex == null) {\n forceSyncFocusRef.current = false;\n if (selectedIndexRef.current != null) {\n return;\n }\n\n // Reset while the floating element was open (e.g. the list changed).\n if (previousMountedRef.current) {\n indexRef.current = -1;\n focusItem();\n }\n\n // Initial sync.\n if ((!previousOpenRef.current || !previousMountedRef.current) && focusItemOnOpenRef.current && (keyRef.current != null || focusItemOnOpenRef.current === true && keyRef.current == null)) {\n let runs = 0;\n const waitForListPopulated = () => {\n if (listRef.current[0] == null) {\n // Avoid letting the browser paint if possible on the first try,\n // otherwise use rAF. Don't try more than twice, since something\n // is wrong otherwise.\n if (runs < 2) {\n const scheduler = runs ? callback => waitForListPopulatedFrame.request(callback) : queueMicrotask;\n scheduler(waitForListPopulated);\n }\n runs += 1;\n } else {\n // Initially focus the first non-disabled item. `disabledIndices` is deliberately\n // omitted here so attribute-disabled items (`disabled`/`aria-disabled`) are skipped\n // on open even when the consumer passes an empty `disabledIndices` array. Passing it\n // would regress that behavior (see mui/base-ui#2604).\n indexRef.current = keyRef.current == null || isMainOrientationToEndKey(keyRef.current, orientation, rtl) || nested ? getMinListIndex(listRef) : getMaxListIndex(listRef);\n keyRef.current = null;\n onNavigate();\n }\n };\n waitForListPopulated();\n }\n } else if (!isIndexOutOfListBounds(listRef.current, activeIndex)) {\n indexRef.current = activeIndex;\n focusItem();\n forceScrollIntoViewRef.current = false;\n }\n }, [enabled, open, floatingElement, activeIndex, selectedIndexRef, nested, listRef, orientation, rtl, onNavigate, focusItem, waitForListPopulatedFrame]);\n\n // Ensure the parent floating element has focus when a nested child closes\n // to allow arrow key navigation to work after the pointer leaves the child.\n useIsoLayoutEffect(() => {\n if (!enabled || floatingElement || !tree || virtual || !previousMountedRef.current) {\n return;\n }\n const nodes = tree.nodesRef.current;\n const parent = nodes.find(node => node.id === parentId)?.context?.elements.floating;\n // `floatingElement` is null here (see the guard above), so resolve the owner document from an\n // in-DOM element for realm-safety (shadow DOM/iframes): the reference element, falling back to\n // the parent floating element when the reference is virtual (`domReferenceElement` is null).\n const activeEl = activeElement(ownerDocument(domReferenceElement ?? parent ?? null));\n const treeContainsActiveEl = nodes.some(node => node.context && contains(node.context.elements.floating, activeEl));\n if (parent && !treeContainsActiveEl && isPointerModalityRef.current) {\n parent.focus({\n preventScroll: true\n });\n }\n }, [enabled, floatingElement, domReferenceElement, tree, parentId, virtual]);\n useIsoLayoutEffect(() => {\n previousOpenRef.current = open;\n previousMountedRef.current = !!floatingElement;\n });\n useIsoLayoutEffect(() => {\n if (!open) {\n keyRef.current = null;\n focusItemOnOpenRef.current = focusItemOnOpen;\n }\n }, [open, focusItemOnOpen]);\n const hasActiveIndex = activeIndex != null;\n const syncCurrentTarget = useStableCallback(event => {\n if (!latestOpenRef.current) {\n return;\n }\n const index = listRef.current.indexOf(event.currentTarget);\n if (index !== -1 && (indexRef.current !== index || activeIndex !== index)) {\n indexRef.current = index;\n onNavigate(event);\n }\n });\n const getParentOrientation = useStableCallback(() => {\n return parentOrientation ?? tree?.nodesRef.current.find(node => node.id === parentId)?.context?.dataRef?.current.orientation;\n });\n const getMinEnabledIndex = useStableCallback(() => {\n return getMinListIndex(listRef, disabledIndicesRef.current);\n });\n const commonOnKeyDown = useStableCallback(event => {\n isPointerModalityRef.current = false;\n forceSyncFocusRef.current = true;\n\n // When composing a character, Chrome fires ArrowDown twice. Firefox/Safari\n // don't appear to suffer from this. `event.isComposing` is avoided due to\n // Safari not supporting it properly (although it's not needed in the first\n // place for Safari, just avoiding any possible issues).\n if (event.which === 229) {\n return;\n }\n\n // If the floating element is animating out, ignore navigation. Otherwise,\n // the `activeIndex` gets set to 0 despite not being open so the next time\n // the user ArrowDowns, the first item won't be focused.\n if (!latestOpenRef.current && event.currentTarget === floatingFocusElementRef.current) {\n return;\n }\n if (nested && isCrossOrientationCloseKey(event.key, orientation, rtl, isGrid)) {\n // If the nested list's close key is also the parent navigation key,\n // let the parent navigate. Otherwise, stop propagating the event.\n if (!isMainOrientationKey(event.key, getParentOrientation())) {\n stopEvent(event);\n }\n store.setOpen(false, createChangeEventDetails(REASONS.listNavigation, event.nativeEvent));\n if (isHTMLElement(domReferenceElement)) {\n if (virtual) {\n tree?.events.emit('virtualfocus', domReferenceElement);\n } else {\n domReferenceElement.focus();\n }\n }\n return;\n }\n const currentIndex = indexRef.current;\n const minIndex = getMinListIndex(listRef, disabledIndices);\n const maxIndex = getMaxListIndex(listRef, disabledIndices);\n if (!typeableComboboxReference) {\n if (event.key === 'Home') {\n stopEvent(event);\n indexRef.current = minIndex;\n onNavigate(event);\n }\n if (event.key === 'End') {\n stopEvent(event);\n indexRef.current = maxIndex;\n onNavigate(event);\n }\n }\n\n // Grid navigation is injected by grid-capable consumers so non-grid\n // consumers (menu, select) tree-shake the grid helpers out.\n if (navigateGrid != null) {\n const index = navigateGrid(event, indexRef.current, listRef, orientation, loopFocus, rtl, disabledIndices, minIndex, maxIndex);\n if (index != null) {\n indexRef.current = index;\n onNavigate(event);\n }\n if (orientation === 'both') {\n return;\n }\n }\n if (isMainOrientationKey(event.key, orientation)) {\n stopEvent(event);\n\n // Reset the index if no item is focused.\n if (open && !virtual && activeElement(event.currentTarget.ownerDocument) === event.currentTarget) {\n indexRef.current = isMainOrientationToEndKey(event.key, orientation, rtl) ? minIndex : maxIndex;\n onNavigate(event);\n return;\n }\n if (isMainOrientationToEndKey(event.key, orientation, rtl)) {\n if (loopFocus) {\n if (currentIndex >= maxIndex) {\n if (allowEscape && currentIndex !== listRef.current.length) {\n indexRef.current = -1;\n } else {\n // Give time for virtualizers to update the listRef.\n forceSyncFocusRef.current = false;\n indexRef.current = minIndex;\n }\n } else {\n indexRef.current = findNonDisabledListIndex(listRef.current, {\n startingIndex: currentIndex,\n disabledIndices\n });\n }\n } else {\n indexRef.current = Math.min(maxIndex, findNonDisabledListIndex(listRef.current, {\n startingIndex: currentIndex,\n disabledIndices\n }));\n }\n } else if (loopFocus) {\n if (currentIndex <= minIndex) {\n if (allowEscape && currentIndex !== -1) {\n indexRef.current = listRef.current.length;\n } else {\n // Give time for virtualizers to update the listRef.\n forceSyncFocusRef.current = false;\n indexRef.current = maxIndex;\n }\n } else {\n indexRef.current = findNonDisabledListIndex(listRef.current, {\n startingIndex: currentIndex,\n decrement: true,\n disabledIndices\n });\n }\n } else {\n indexRef.current = Math.max(minIndex, findNonDisabledListIndex(listRef.current, {\n startingIndex: currentIndex,\n decrement: true,\n disabledIndices\n }));\n }\n if (isIndexOutOfListBounds(listRef.current, indexRef.current)) {\n indexRef.current = -1;\n }\n onNavigate(event);\n }\n });\n const item = React.useMemo(() => {\n const itemProps = {\n onFocus(event) {\n forceSyncFocusRef.current = true;\n syncCurrentTarget(event);\n },\n onClick: ({\n currentTarget\n }) => currentTarget.focus({\n preventScroll: true\n }),\n // Safari\n onMouseMove(event) {\n if (isStationaryWebKitPointer(event)) {\n return;\n }\n forceSyncFocusRef.current = true;\n forceScrollIntoViewRef.current = false;\n if (focusItemOnHover) {\n syncCurrentTarget(event);\n }\n },\n onPointerLeave(event) {\n if (!latestOpenRef.current || !isPointerModalityRef.current || event.pointerType === 'touch') {\n return;\n }\n forceSyncFocusRef.current = true;\n const relatedTarget = event.relatedTarget;\n if (!focusItemOnHover || listRef.current.includes(relatedTarget)) {\n return;\n }\n if (!resetOnPointerLeaveRef.current) {\n return;\n }\n cancelQueuedFocusRef.current?.();\n cancelQueuedFocusRef.current = null;\n indexRef.current = -1;\n onNavigate(event);\n if (!virtual) {\n const floatingFocusEl = floatingFocusElementRef.current;\n const activeEl = activeElement(ownerDocument(floatingFocusEl));\n if (floatingFocusEl && contains(floatingFocusEl, activeEl)) {\n floatingFocusEl.focus({\n preventScroll: true\n });\n }\n }\n }\n };\n return itemProps;\n }, [syncCurrentTarget, latestOpenRef, floatingFocusElementRef, focusItemOnHover, listRef, onNavigate, resetOnPointerLeaveRef, virtual]);\n const ariaActiveDescendantProp = React.useMemo(() => {\n return virtual && open && hasActiveIndex && {\n 'aria-activedescendant': `${id}-${activeIndex}`\n };\n }, [virtual, open, hasActiveIndex, id, activeIndex]);\n const floating = React.useMemo(() => {\n return {\n ...(!typeableComboboxReference ? ariaActiveDescendantProp : {}),\n onKeyDown(event) {\n // Close submenu on Shift+Tab\n if (event.key === 'Tab' && event.shiftKey && open && !virtual) {\n // If the event originated from within a nested element (e.g., a Dialog opened from\n // within the menu), don't close the menu. The nested element has its own focus\n // management and should handle the Tab key.\n const target = getTarget(event.nativeEvent);\n if (target && !contains(floatingFocusElementRef.current, target)) {\n return;\n }\n stopEvent(event);\n store.setOpen(false, createChangeEventDetails(REASONS.focusOut, event.nativeEvent));\n if (isHTMLElement(domReferenceElement)) {\n domReferenceElement.focus();\n }\n return;\n }\n commonOnKeyDown(event);\n },\n onPointerMove(event) {\n if (isStationaryWebKitPointer(event)) {\n return;\n }\n isPointerModalityRef.current = true;\n }\n };\n }, [ariaActiveDescendantProp, commonOnKeyDown, floatingFocusElementRef, typeableComboboxReference, store, open, virtual, domReferenceElement]);\n const trigger = React.useMemo(() => {\n function openOnNavigationKeyDown(event) {\n store.setOpen(true, createChangeEventDetails(REASONS.listNavigation, event.nativeEvent, event.currentTarget));\n }\n function checkVirtualMouse(event) {\n if (focusItemOnOpen === 'auto' && isVirtualClick(event.nativeEvent)) {\n focusItemOnOpenRef.current = !virtual;\n }\n }\n function checkVirtualPointer(event) {\n // `pointerdown` fires first, reset the state then perform the checks.\n focusItemOnOpenRef.current = focusItemOnOpen;\n if (focusItemOnOpen === 'auto' && isVirtualPointerEvent(event.nativeEvent)) {\n focusItemOnOpenRef.current = true;\n }\n }\n return {\n onKeyDown(event) {\n // non-reactive open state (to prevent re-creation of the handler)\n const currentOpen = store.select('open');\n isPointerModalityRef.current = false;\n const isArrowKey = event.key.startsWith('Arrow');\n const isParentCrossOpenKey = isCrossOrientationOpenKey(event.key, getParentOrientation(), rtl);\n const isMainKey = isMainOrientationKey(event.key, orientation);\n const isNavigationKey = (nested ? isParentCrossOpenKey : isMainKey) || event.key === 'Enter' || event.key.trim() === '';\n if (virtual && currentOpen) {\n return commonOnKeyDown(event);\n }\n\n // If a floating element should not open on arrow key down, avoid\n // setting `activeIndex` while it's closed.\n if (!currentOpen && !openOnArrowKeyDown && isArrowKey) {\n return undefined;\n }\n if (isNavigationKey) {\n const isParentMainKey = isMainOrientationKey(event.key, getParentOrientation());\n keyRef.current = nested && isParentMainKey ? null : event.key;\n }\n if (nested) {\n if (isParentCrossOpenKey) {\n stopEvent(event);\n if (currentOpen) {\n indexRef.current = getMinEnabledIndex();\n onNavigate(event);\n } else {\n openOnNavigationKeyDown(event);\n }\n }\n return undefined;\n }\n if (isMainKey) {\n if (selectedIndexRef.current != null) {\n indexRef.current = selectedIndexRef.current;\n }\n stopEvent(event);\n if (!currentOpen && openOnArrowKeyDown) {\n openOnNavigationKeyDown(event);\n } else {\n commonOnKeyDown(event);\n }\n if (currentOpen) {\n onNavigate(event);\n }\n }\n return undefined;\n },\n onFocus(event) {\n if (store.select('open') && !virtual) {\n indexRef.current = -1;\n onNavigate(event);\n }\n },\n onPointerDown: checkVirtualPointer,\n onPointerEnter: checkVirtualPointer,\n onMouseDown: checkVirtualMouse,\n onClick: checkVirtualMouse\n };\n }, [commonOnKeyDown, focusItemOnOpen, getMinEnabledIndex, nested, onNavigate, store, openOnArrowKeyDown, orientation, getParentOrientation, rtl, selectedIndexRef, virtual]);\n const reference = React.useMemo(() => {\n return {\n ...ariaActiveDescendantProp,\n ...trigger\n };\n }, [ariaActiveDescendantProp, trigger]);\n return React.useMemo(() => enabled ? {\n reference,\n floating,\n item,\n trigger\n } : {}, [enabled, reference, floating, trigger, item]);\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useTimeout } from '@base-ui/utils/useTimeout';\nimport { EMPTY_ARRAY } from '@base-ui/utils/empty';\nimport { isElementVisible, isListIndexDisabled } from \"../utils/composite.mjs\";\nimport { contains } from \"../utils/element.mjs\";\nimport { stopEvent } from \"../utils/event.mjs\";\n/**\n * Provides a matching callback that can be used to focus an item as the user\n * types, often used in tandem with `useListNavigation()`.\n * @see https://floating-ui.com/docs/useTypeahead\n */\nexport function useTypeahead(context, props) {\n const {\n listRef,\n elementsRef,\n activeIndex,\n onMatch: onMatchProp,\n disabledIndices,\n onTyping,\n enabled = true,\n resetMs = 750,\n selectedIndex = null\n } = props;\n const store = 'rootStore' in context ? context.rootStore : context;\n const open = store.useState('open');\n const timeout = useTimeout();\n const stringRef = React.useRef('');\n const prevIndexRef = React.useRef(selectedIndex ?? activeIndex ?? -1);\n const matchIndexRef = React.useRef(null);\n const onKeyDown = useStableCallback(event => {\n function getElement(index) {\n return elementsRef?.current[index];\n }\n function isItemAvailable(index) {\n const element = getElement(index);\n if (element && !isElementVisible(element) || element?.matches(':disabled')) {\n return false;\n }\n // Visibility and native disabled state are handled above; pass an empty\n // element list so `isListIndexDisabled` resolves only the explicit\n // `disabledIndices` (array/predicate) and skips its own fallbacks.\n // Consumers that don't pass `disabledIndices` keep matching every visible\n // item except native disabled elements provided through `elementsRef`.\n return disabledIndices == null || !isListIndexDisabled(EMPTY_ARRAY, index, disabledIndices);\n }\n function getMatchingIndex(list, string, startIndex = 0) {\n if (list.length === 0) {\n return -1;\n }\n const normalizedStartIndex = (startIndex % list.length + list.length) % list.length;\n const lowerString = string.toLowerCase();\n for (let offset = 0; offset < list.length; offset += 1) {\n const index = (normalizedStartIndex + offset) % list.length;\n const text = list[index];\n if (!text?.toLowerCase().startsWith(lowerString) || !isItemAvailable(index)) {\n continue;\n }\n return index;\n }\n return -1;\n }\n const listContent = listRef.current;\n if (stringRef.current.length > 0 && event.key === ' ') {\n // Space should continue the in-progress typeahead session.\n stopEvent(event);\n onTyping?.(true);\n }\n if (stringRef.current.length > 0 && stringRef.current[0] !== ' ') {\n if (getMatchingIndex(listContent, stringRef.current) === -1 && event.key !== ' ') {\n onTyping?.(false);\n }\n }\n if (listContent == null ||\n // Character key.\n event.key.length !== 1 ||\n // Modifier key.\n event.ctrlKey || event.metaKey || event.altKey) {\n return;\n }\n if (open && event.key !== ' ') {\n stopEvent(event);\n onTyping?.(true);\n }\n\n // Capture whether this is a new typing session before mutating the string.\n const isNewSession = stringRef.current === '';\n if (isNewSession) {\n prevIndexRef.current = selectedIndex ?? activeIndex ?? -1;\n }\n\n // Bail out if the list contains a word like \"llama\" or \"aaron\". TODO:\n // allow it in this case, too. Unavailable items are skipped while matching, so\n // they must be ignored here as well — otherwise a hidden or disabled double-letter\n // label would block rapid cycling through the available items.\n const allowRapidSuccessionOfFirstLetter = listContent.every((text, index) => text && isItemAvailable(index) ? text[0]?.toLowerCase() !== text[1]?.toLowerCase() : true);\n\n // Allows the user to cycle through items that start with the same letter\n // in rapid succession.\n if (allowRapidSuccessionOfFirstLetter && stringRef.current === event.key) {\n stringRef.current = '';\n prevIndexRef.current = matchIndexRef.current;\n }\n stringRef.current += event.key;\n timeout.start(resetMs, () => {\n stringRef.current = '';\n prevIndexRef.current = matchIndexRef.current;\n onTyping?.(false);\n });\n\n // Compute the starting index for this search.\n // If this is a new typing session (string is empty), base it on the current\n // selection/active item; otherwise continue from the last matched index.\n const prevIndex = isNewSession ? selectedIndex ?? activeIndex ?? -1 : prevIndexRef.current;\n const startIndex = (prevIndex ?? 0) + 1;\n const index = getMatchingIndex(listContent, stringRef.current, startIndex);\n if (index !== -1) {\n onMatchProp?.(index);\n matchIndexRef.current = index;\n } else if (event.key !== ' ') {\n stringRef.current = '';\n onTyping?.(false);\n }\n });\n const onBlur = useStableCallback(event => {\n const next = event.relatedTarget;\n const currentDomReferenceElement = store.select('domReferenceElement');\n const currentFloatingElement = store.select('floatingElement');\n const withinComposite = contains(currentDomReferenceElement, next) || contains(currentFloatingElement, next);\n\n // Keep the session if focus moves within the composite (reference <-> floating).\n if (withinComposite) {\n return;\n }\n\n // End the current typing session when focus leaves the composite entirely.\n timeout.clear();\n stringRef.current = '';\n prevIndexRef.current = matchIndexRef.current;\n onTyping?.(false);\n });\n useIsoLayoutEffect(() => {\n if (!open && selectedIndex !== null) {\n return;\n }\n timeout.clear();\n matchIndexRef.current = null;\n if (stringRef.current !== '') {\n stringRef.current = '';\n }\n }, [open, selectedIndex, timeout]);\n const sharedProps = React.useMemo(() => ({\n onKeyDown,\n onBlur\n }), [onKeyDown, onBlur]);\n return React.useMemo(() => enabled ? {\n reference: sharedProps,\n floating: sharedProps\n } : {}, [enabled, sharedProps]);\n}","import { getGridNavigatedIndex, isIndexOutOfListBounds } from \"../utils/composite.mjs\";\n\n/**\n * Positional arguments are deliberate: property names of an options object\n * don't minify, and the signature is locked to the caller via `typeof` on the\n * `grid` option of `useListNavigation`.\n *\n * The injected grid navigator only ever operates on a uniform 1x1 grid (sizes are\n * always `1x1` and packing is never dense), so the cell-map machinery that supports\n * multi-cell items collapses to an identity transform over the item list. Calling\n * `getGridNavigatedIndex` directly keeps the cell-map helpers\n * (`createGridCellMap`/`getGridCellIndexOfCorner`/`getGridCellIndices`) out of\n * grid-combobox bundles.\n */\nexport function gridNavigation(event, prevIndex, listRef, orientation, loopFocus, rtl, disabledIndices, minIndex, maxIndex, cols = 2) {\n const nextIndex = getGridNavigatedIndex(listRef.current, {\n event,\n orientation,\n loopFocus,\n rtl,\n cols,\n disabledIndices,\n minIndex,\n maxIndex,\n // An out-of-range previous index falls back to the first enabled item.\n prevIndex: prevIndex > maxIndex ? minIndex : prevIndex,\n stopEvent: true\n });\n\n // `getGridNavigatedIndex` can return an out-of-bounds sentinel (e.g. `-1` when there is no\n // previous item to move from); surface that as `undefined` so the caller treats it as\n // \"no navigation\" rather than highlighting index `-1`.\n return isIndexOutOfListBounds(listRef.current, nextIndex) ? undefined : nextIndex;\n}","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const ComboboxRootContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") ComboboxRootContext.displayName = \"ComboboxRootContext\";\nexport const ComboboxFloatingContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") ComboboxFloatingContext.displayName = \"ComboboxFloatingContext\";\nexport const ComboboxDerivedItemsContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") ComboboxDerivedItemsContext.displayName = \"ComboboxDerivedItemsContext\";\nexport const ComboboxHasItemsContext = /*#__PURE__*/React.createContext(false);\n// `inputValue` can't be placed in the store.\n// https://github.com/mui/base-ui/issues/2703\nif (process.env.NODE_ENV !== \"production\") ComboboxHasItemsContext.displayName = \"ComboboxHasItemsContext\";\nexport const ComboboxInputValueContext = /*#__PURE__*/React.createContext('');\nif (process.env.NODE_ENV !== \"production\") ComboboxInputValueContext.displayName = \"ComboboxInputValueContext\";\nexport function useComboboxRootContext() {\n const context = React.useContext(ComboboxRootContext);\n if (!context) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: ComboboxRootContext is missing. Combobox parts must be placed within <Combobox.Root>.' : _formatErrorMessage(22));\n }\n return context;\n}\nexport function useComboboxFloatingContext() {\n const context = React.useContext(ComboboxFloatingContext);\n if (!context) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: ComboboxFloatingContext is missing. Combobox parts must be placed within <Combobox.Root>.' : _formatErrorMessage(23));\n }\n return context;\n}\nexport function useComboboxDerivedItemsContext() {\n const context = React.useContext(ComboboxDerivedItemsContext);\n if (!context) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: ComboboxItemsContext is missing. Combobox parts must be placed within <Combobox.Root>.' : _formatErrorMessage(24));\n }\n return context;\n}\nexport function useComboboxInputValueContext() {\n return React.useContext(ComboboxInputValueContext);\n}\nexport function useComboboxHasItemsContext() {\n return React.useContext(ComboboxHasItemsContext);\n}","// https://github.com/mui/mui-x/blob/master/packages/x-internals/src/fastArrayCompare/fastArrayCompare.ts\n\n/**\n * Compares two arrays element-wise.\n *\n * The default comparison is `Object.is`, so `NaN` equals `NaN` and `0` does not equal `-0`.\n */\nexport function areArraysEqual(array1, array2, itemComparer = Object.is) {\n const {\n length\n } = array1;\n if (length !== array2.length) {\n return false;\n }\n for (let i = 0; i < length; i += 1) {\n if (!itemComparer(array1[i], array2[i])) {\n return false;\n }\n }\n return true;\n}","import { areArraysEqual } from '@base-ui/utils/areArraysEqual';\n// Compared by identity in `findSelectionIndex`; don't wrap it.\nexport const defaultItemEquality = (itemValue, selectedValue) => Object.is(itemValue, selectedValue);\nexport function compareItemEquality(itemValue, selectedValue, comparer) {\n if (itemValue == null || selectedValue == null) {\n return Object.is(itemValue, selectedValue);\n }\n return comparer(itemValue, selectedValue);\n}\nexport function isSelectedValueDirty(currentValue, initialValue, comparer) {\n if (Array.isArray(currentValue) && Array.isArray(initialValue)) {\n return !areArraysEqual(currentValue, initialValue, (itemValue, initialItemValue) => compareItemEquality(itemValue, initialItemValue, comparer));\n }\n return currentValue !== initialValue;\n}\nexport function selectedValueIncludes(selectedValues, itemValue, comparer) {\n if (!selectedValues) {\n return false;\n }\n return selectedValues.some(selectedValue => {\n if (selectedValue === undefined) {\n return false;\n }\n return compareItemEquality(itemValue, selectedValue, comparer);\n });\n}\nexport function findItemIndex(itemValues, selectedValue, comparer) {\n if (!itemValues) {\n return -1;\n }\n return itemValues.findIndex(itemValue => {\n if (itemValue === undefined) {\n return false;\n }\n return compareItemEquality(itemValue, selectedValue, comparer);\n });\n}\n\n// The default comparer is `Object.is`, so the values can be indexed instead of rescanned\n// for every item. A custom comparer may match values that don't hash alike.\nfunction createSelectionMatcher(selectedValues, comparer) {\n if (comparer !== defaultItemEquality) {\n return itemValue => selectedValueIncludes(selectedValues, itemValue, comparer);\n }\n const index = new Set(selectedValues);\n index.delete(undefined);\n // `Set` treats +0 and -0 as equal; `Object.is` does not.\n return itemValue => index.has(itemValue) && (itemValue !== 0 || selectedValues.some(v => Object.is(itemValue, v)));\n}\nexport function findSelectionIndex(itemValues, selectedValue, comparer, multiple) {\n // Only treat the value as a list in multiple mode: an array can itself be a valid\n // single-select value.\n const index = multiple && Array.isArray(selectedValue) ?\n // Anchor to the first selected item in rendered order so the index does not depend\n // on the order in which the values were added to the array.\n itemValues.findIndex(createSelectionMatcher(selectedValue, comparer)) : findItemIndex(itemValues, selectedValue, comparer);\n return index === -1 ? null : index;\n}\n\n/** Resolves the first selected index as items register or change. */\nexport function resolveSelectedIndex(index, itemValue, registry, selectedValues, comparer, currentIndex) {\n if (selectedValueIncludes(selectedValues, itemValue, comparer)) {\n // A later item only takes over once the current anchor stops being selected.\n return currentIndex != null && index > currentIndex && selectedValueIncludes(selectedValues, registry[currentIndex], comparer) ? currentIndex : index;\n }\n // The holder re-elects the anchor once it stops being selected.\n return index === currentIndex ? findSelectionIndex(registry, selectedValues, comparer, true) : currentIndex;\n}\nexport function removeItem(selectedValues, itemValue, comparer) {\n return selectedValues.filter(selectedValue => !compareItemEquality(itemValue, selectedValue, comparer));\n}","export function serializeValue(value) {\n if (value == null) {\n return '';\n }\n if (typeof value === 'string') {\n return value;\n }\n try {\n return JSON.stringify(value);\n } catch {\n return String(value);\n }\n}","'use client';\n\nimport * as React from 'react';\nimport { serializeValue } from \"./serializeValue.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nfunction isGroup(item) {\n return typeof item === 'object' && item != null && Array.isArray(item.items);\n}\nexport function isGroupedItems(items) {\n // A group must carry an actual `items` array: key presence alone would misclassify an item\n // with an unrelated or optional `items` field.\n return isGroup(items?.[0]);\n}\nexport function flattenLeafItems(items) {\n return isGroupedItems(items) ? items.flatMap(group => group.items) : items;\n}\n\n/**\n * Checks if the items array contains an item with a null value that has a non-null label.\n */\nexport function hasNullItemLabel(items) {\n if (!Array.isArray(items)) {\n return items != null && 'null' in items;\n }\n const arrayItems = items;\n if (isGroupedItems(arrayItems)) {\n for (const group of arrayItems) {\n for (const item of group.items) {\n if (item && item.value == null && item.label != null) {\n return true;\n }\n }\n }\n return false;\n }\n for (const item of arrayItems) {\n if (item && item.value == null && item.label != null) {\n return true;\n }\n }\n return false;\n}\nexport function stringifyAsLabel(item, itemToStringLabel) {\n if (itemToStringLabel && item != null) {\n return itemToStringLabel(item) ?? '';\n }\n if (item && typeof item === 'object') {\n if ('label' in item && item.label != null) {\n return String(item.label);\n }\n if ('value' in item) {\n return String(item.value);\n }\n }\n return serializeValue(item);\n}\nexport function stringifyAsValue(item, itemToStringValue) {\n if (itemToStringValue && item != null) {\n return itemToStringValue(item) ?? '';\n }\n if (item && typeof item === 'object' && 'value' in item && 'label' in item) {\n return serializeValue(item.value);\n }\n return serializeValue(item);\n}\nexport function resolveSelectedLabel(value, items, itemToStringLabel) {\n function fallback() {\n return stringifyAsLabel(value, itemToStringLabel);\n }\n if (itemToStringLabel && value != null) {\n return itemToStringLabel(value);\n }\n\n // Custom object with explicit label takes precedence\n if (value && typeof value === 'object' && 'label' in value && value.label != null) {\n return value.label;\n }\n\n // Items provided as plain record map\n if (items && !Array.isArray(items)) {\n const label = Object.hasOwn(items, value) ? items[value] : undefined;\n return label ?? fallback();\n }\n\n // Items provided as array (flat or grouped)\n if (Array.isArray(items)) {\n const arrayItems = items;\n const flatItems = flattenLeafItems(arrayItems);\n if (value == null || typeof value !== 'object') {\n const match = flatItems.find(item => item.value === value);\n if (match && match.label != null) {\n return match.label;\n }\n return fallback();\n }\n\n // Object without explicit label: try matching by its `value` property\n if ('value' in value) {\n const match = flatItems.find(item => item && item.value === value.value);\n if (match && match.label != null) {\n return match.label;\n }\n }\n }\n return fallback();\n}\nexport function resolveMultipleLabels(values, items, itemToStringLabel) {\n return values.reduce((acc, value, index) => {\n if (index > 0) {\n acc.push(', ');\n }\n acc.push(/*#__PURE__*/_jsx(React.Fragment, {\n children: resolveSelectedLabel(value, items, itemToStringLabel)\n }, index));\n return acc;\n }, []);\n}","import { compareItemEquality } from \"../internals/itemEquality.mjs\";\nimport { hasNullItemLabel } from \"../internals/resolveValueLabel.mjs\";\n\n/**\n * Non-reactive values shared with the combobox parts. Nothing here is observable through\n * `selectors`, so writing to a ref never notifies subscribers.\n */\n\nexport const selectors = {\n id: state => state.id,\n labelId: state => state.labelId,\n items: state => state.items,\n selectedValue: state => state.selectedValue,\n hasSelectionChips: state => {\n const selectedValue = state.selectedValue;\n return Array.isArray(selectedValue) && selectedValue.length > 0;\n },\n hasSelectedValue: state => {\n const {\n selectedValue,\n selectionMode\n } = state;\n if (selectedValue == null) {\n return false;\n }\n if (selectionMode === 'multiple' && Array.isArray(selectedValue)) {\n return selectedValue.length > 0;\n }\n return true;\n },\n hasNullItemLabel: (state, enabled) => {\n return enabled ? hasNullItemLabel(state.items) : false;\n },\n open: state => state.open,\n mounted: state => state.mounted,\n forceMounted: state => state.forceMounted,\n inline: state => state.inline,\n activeIndex: state => state.activeIndex,\n selectedIndex: state => state.selectedIndex,\n isActive: (state, index) => state.activeIndex === index,\n isSelected: (state, itemValue) => {\n const comparer = state.isItemEqualToValue;\n const selectedValue = state.selectedValue;\n if (Array.isArray(selectedValue)) {\n return selectedValue.some(selectedItem => compareItemEquality(itemValue, selectedItem, comparer));\n }\n return compareItemEquality(itemValue, selectedValue, comparer);\n },\n transitionStatus: state => state.transitionStatus,\n popupProps: state => state.popupProps,\n listProps: state => state.listProps,\n inputProps: state => state.inputProps,\n triggerProps: state => state.triggerProps,\n itemProps: state => state.itemProps,\n positionerElement: state => state.positionerElement,\n listElement: state => state.listElement,\n popupId: state => state.popupId,\n triggerElement: state => state.triggerElement,\n inputElement: state => state.inputElement,\n inputGroupElement: state => state.inputGroupElement,\n popupSide: state => state.popupSide,\n openMethod: state => state.openMethod,\n inputInsidePopup: state => state.inputInsidePopup,\n inputOwnsFormValue: state => state.inputOwnsFormValue,\n selectionMode: state => state.selectionMode,\n name: state => state.name,\n form: state => state.form,\n disabled: state => state.disabled,\n readOnly: state => state.readOnly,\n required: state => state.required,\n grid: state => state.grid,\n virtualized: state => state.virtualized,\n itemToStringLabel: state => state.itemToStringLabel,\n isItemEqualToValue: state => state.isItemEqualToValue,\n modal: state => state.modal,\n autoHighlight: state => state.autoHighlight\n};","import { stringifyAsLabel } from \"../../../internals/resolveValueLabel.mjs\";\n/**\n * Derives the default id assigned to `Combobox.Popup` when the input is rendered inside it.\n * Shared by the popup (which applies it) and the trigger (which references it via `aria-controls`)\n * so the convention only lives in one place.\n */\nexport function getComboboxPopupId(rootId) {\n return rootId == null ? undefined : `${rootId}-popup`;\n}\n\n/**\n * Enhanced filter using Intl.Collator for more robust string matching.\n * Uses the provided `itemToStringLabel` function if available, otherwise falls back to:\n * • When `item` is an object with a `value` property, that property is used.\n * • When `item` is a primitive (e.g. `string`), it is used directly.\n */\nexport function createCollatorItemFilter(collatorFilter, itemToStringLabel) {\n return (item, query) => {\n if (item == null) {\n return false;\n }\n return collatorFilter.contains(item, query, itemToStringLabel);\n };\n}\n\n/**\n * Enhanced filter for single selection mode using Intl.Collator that shows all items\n * when query is empty or matches the current selection, making it easier to browse options.\n */\nexport function createSingleSelectionCollatorFilter(collatorFilter, itemToStringLabel, selectedValue) {\n return (item, query) => {\n if (item == null) {\n return false;\n }\n if (!query) {\n return true;\n }\n const selectedValueToString = itemToStringLabel?.selected ?? itemToStringLabel;\n const selectedString = selectedValue != null ? stringifyAsLabel(selectedValue, selectedValueToString) : '';\n\n // Handle case-insensitive matching consistently\n if (selectedString && collatorFilter.contains(selectedString, query) && selectedString.length === query.length) {\n return true;\n }\n return collatorFilter.contains(item, query, itemToStringLabel);\n };\n}","export function stringifyLocale(locale) {\n if (Array.isArray(locale)) {\n return locale.map(value => stringifyLocale(value)).join(',');\n }\n if (locale == null) {\n return '';\n }\n return String(locale);\n}","import { stringifyLocale } from '@base-ui/utils/stringifyLocale';\nimport { stringifyAsLabel } from \"./resolveValueLabel.mjs\";\nconst filterCache = new Map();\nexport function getFilter(options = {}) {\n const mergedOptions = {\n usage: 'search',\n sensitivity: 'base',\n ignorePunctuation: true,\n ...options\n };\n const cacheKey = `${stringifyLocale(options.locale)}|${JSON.stringify(mergedOptions)}`;\n const cachedFilter = filterCache.get(cacheKey);\n if (cachedFilter) {\n return cachedFilter;\n }\n const collator = new Intl.Collator(options.locale, mergedOptions);\n const filter = {\n contains(item, query, itemToString) {\n if (!query) {\n return true;\n }\n const itemString = stringifyAsLabel(item, itemToString);\n for (let i = 0; i <= itemString.length - query.length; i += 1) {\n if (collator.compare(itemString.slice(i, i + query.length), query) === 0) {\n return true;\n }\n }\n return false;\n },\n startsWith(item, query, itemToString) {\n if (!query) {\n return true;\n }\n const itemString = stringifyAsLabel(item, itemToString);\n return collator.compare(itemString.slice(0, query.length), query) === 0;\n },\n endsWith(item, query, itemToString) {\n if (!query) {\n return true;\n }\n const itemString = stringifyAsLabel(item, itemToString);\n const queryLength = query.length;\n return itemString.length >= queryLength && collator.compare(itemString.slice(itemString.length - queryLength), query) === 0;\n }\n };\n filterCache.set(cacheKey, filter);\n return filter;\n}","'use client';\n\nimport * as React from 'react';\nimport { createCollatorItemFilter, createSingleSelectionCollatorFilter } from \"./index.mjs\";\nimport { getFilter } from \"../../../internals/filter.mjs\";\n/**\n * Matches items against a query using `Intl.Collator` for robust string matching.\n */\nexport const useCoreFilter = getFilter;\n/**\n * Matches items against a query using `Intl.Collator` for robust string matching.\n */\nexport function useComboboxFilter(options = {}) {\n const {\n multiple = false,\n value,\n ...collatorOptions\n } = options;\n const coreFilter = getFilter(collatorOptions);\n const contains = React.useCallback((item, query, itemToString) => {\n if (multiple) {\n return createCollatorItemFilter(coreFilter, itemToString)(item, query);\n }\n return createSingleSelectionCollatorFilter(coreFilter, itemToString, value)(item, query);\n }, [coreFilter, value, multiple]);\n return React.useMemo(() => ({\n ...coreFilter,\n contains\n }), [contains, coreFilter]);\n}","'use client';\n\nimport * as React from 'react';\n/**\n * Provides a cross-browser way to determine the type of the pointer used to click.\n * Safari and Firefox do not provide the PointerEvent to the click handler (they use MouseEvent) yet.\n * Additionally, this implementation detects if the click was triggered by the keyboard.\n *\n * @param handler The function to be called when the button is clicked. The first parameter is the original event and the second parameter is the pointer type.\n */\nexport function useEnhancedClickHandler(handler) {\n const lastClickInteractionTypeRef = React.useRef('');\n const handlePointerDown = React.useCallback(event => {\n if (event.defaultPrevented) {\n return;\n }\n lastClickInteractionTypeRef.current = event.pointerType;\n handler(event, event.pointerType);\n }, [handler]);\n const handleClick = React.useCallback(event => {\n // event.detail has the number of clicks performed on the element. 0 means it was triggered by the keyboard.\n if (event.detail === 0) {\n handler(event, 'keyboard');\n return;\n }\n if ('pointerType' in event) {\n // Chrome and Edge correctly use PointerEvent\n handler(event, event.pointerType);\n } else {\n handler(event, lastClickInteractionTypeRef.current);\n }\n lastClickInteractionTypeRef.current = '';\n }, [handler]);\n return {\n onClick: handleClick,\n onPointerDown: handlePointerDown\n };\n}","'use client';\n\nimport * as React from 'react';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useEnhancedClickHandler } from '@base-ui/utils/useEnhancedClickHandler';\nimport { platform } from '@base-ui/utils/platform';\nimport { useValueChanged } from \"../internals/useValueChanged.mjs\";\nexport function useOpenMethodTriggerProps(open, setOpenMethod) {\n const handleTriggerClick = useStableCallback((_, interactionType) => {\n const isOpen = typeof open === 'function' ? open() : open;\n if (!isOpen) {\n setOpenMethod(interactionType || (\n // On iOS Safari, the hitslop around touch targets means tapping outside an element's\n // bounds does not fire `pointerdown` but does fire `mousedown`. The `interactionType`\n // will be \"\" in that case.\n platform.os.ios ? 'touch' : ''));\n }\n });\n const {\n onClick,\n onPointerDown\n } = useEnhancedClickHandler(handleTriggerClick);\n return React.useMemo(() => ({\n onClick,\n onPointerDown\n }), [onClick, onPointerDown]);\n}\n\n/**\n * Determines the interaction type (keyboard, mouse, touch, etc.) that opened the component.\n *\n * @param open The open state of the component.\n */\nexport function useOpenInteractionType(open) {\n const [openMethod, setOpenMethod] = React.useState(null);\n const triggerProps = useOpenMethodTriggerProps(open, setOpenMethod);\n useValueChanged(open, previousOpen => {\n if (previousOpen && !open) {\n setOpenMethod(null);\n }\n });\n return React.useMemo(() => ({\n openMethod,\n triggerProps\n }), [openMethod, triggerProps]);\n}","import { getComputedStyle, getParentNode, isHTMLElement, isLastTraversableNode } from '@floating-ui/utils/dom';\nexport function isScrollableY(element, allowOverflowIntent = false) {\n const {\n overflowY\n } = getComputedStyle(element);\n if (overflowY !== 'auto' && overflowY !== 'scroll') {\n return false;\n }\n // When `allowOverflowIntent` is true, a container that overflows only once extra space is\n // added (e.g. drawer keyboard scroll slack) still counts, as long as it has layout size on\n // the axis.\n return allowOverflowIntent ? element.clientHeight > 0 : element.scrollHeight > element.clientHeight;\n}\nexport function isScrollableX(element, allowOverflowIntent = false) {\n const {\n overflowX\n } = getComputedStyle(element);\n if (overflowX !== 'auto' && overflowX !== 'scroll') {\n return false;\n }\n return allowOverflowIntent ? element.clientWidth > 0 : element.scrollWidth > element.clientWidth;\n}\nexport function isScrollable(element, axis, allowOverflowIntent = false) {\n return axis === 'vertical' ? isScrollableY(element, allowOverflowIntent) : isScrollableX(element, allowOverflowIntent);\n}\nexport function hasScrollableAncestor(target, root, axes) {\n // `getParentNode` crosses shadow boundaries (and slots), so a target inside a shadow root\n // still walks up to scrollable ancestors in the light DOM.\n let node = target;\n while (isHTMLElement(node) && node !== root && !isLastTraversableNode(node)) {\n for (const axis of axes) {\n if (isScrollable(node, axis)) {\n return true;\n }\n }\n node = getParentNode(node);\n }\n return false;\n}\nexport function findScrollableTouchTarget(target, root, axis = 'vertical', allowOverflowIntent = false) {\n // `getParentNode` crosses shadow boundaries (and slots), so a target inside a shadow root\n // still reaches a scrollable ancestor in the light DOM.\n let node = isHTMLElement(target) ? target : null;\n while (isHTMLElement(node) && node !== root && !isLastTraversableNode(node)) {\n if (isScrollable(node, axis, allowOverflowIntent)) {\n return node;\n }\n node = getParentNode(node);\n }\n return isScrollable(root, axis, allowOverflowIntent) ? root : null;\n}","export const NO_ACTIVE_VALUE = Symbol('none');\nexport const INITIAL_LAST_HIGHLIGHT = {\n value: NO_ACTIVE_VALUE,\n index: -1\n};","import { compareItemEquality, defaultItemEquality } from \"../../internals/itemEquality.mjs\";\nexport function findCollectionItem(valueToItem, itemValue, isEqual) {\n const exactItem = valueToItem.get(itemValue);\n if (exactItem !== undefined || isEqual === defaultItemEquality) {\n return exactItem;\n }\n for (const [derivedValue, item] of valueToItem) {\n if (compareItemEquality(derivedValue, itemValue, isEqual)) {\n return item;\n }\n }\n return undefined;\n}\n\n/**\n * An opaque collection created by `createItems()`.\n *\n * It carries the source item and derived value types so the root can infer the list item and\n * selection value types.\n *\n * Pass it directly to the root's `items` prop; it has no public members.\n */\n\n/**\n * Internal shape of a collection. The extra members let the root project items to\n * their values and resolve a selected value back to its label while items are unmounted.\n */","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nimport { useControlled } from '@base-ui/utils/useControlled';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useOnFirstRender } from '@base-ui/utils/useOnFirstRender';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useMergedRefs } from '@base-ui/utils/useMergedRefs';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { visuallyHidden, visuallyHiddenInput } from '@base-ui/utils/visuallyHidden';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { ReactStore } from '@base-ui/utils/store';\nimport { EMPTY_ARRAY, EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { isHTMLElement } from '@floating-ui/utils/dom';\nimport { getOverflowAncestors, useDismiss, useFloatingRootContext, useListNavigation, useClick } from \"../../floating-ui-react/index.mjs\";\nimport { gridNavigation } from \"../../floating-ui-react/hooks/gridNavigation.mjs\";\nimport { contains, getTarget } from \"../../floating-ui-react/utils.mjs\";\nimport { createChangeEventDetails, createGenericEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { ComboboxFloatingContext, ComboboxDerivedItemsContext, ComboboxHasItemsContext, ComboboxRootContext, ComboboxInputValueContext } from \"./ComboboxRootContext.mjs\";\nimport { selectors } from \"../store.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { useFieldRootContext } from \"../../internals/field-root-context/FieldRootContext.mjs\";\nimport { useRegisterFieldControl } from \"../../internals/field-register-control/useRegisterFieldControl.mjs\";\nimport { useFormContext } from \"../../internals/form-context/FormContext.mjs\";\nimport { useLabelableId } from \"../../internals/labelable-provider/useLabelableId.mjs\";\nimport { createCollatorItemFilter } from \"./utils/index.mjs\";\nimport { useCoreFilter } from \"./utils/useFilter.mjs\";\nimport { useTransitionStatus } from \"../../internals/useTransitionStatus.mjs\";\nimport { useOpenInteractionType } from \"../../utils/useOpenInteractionType.mjs\";\nimport { isScrollableY } from \"../../utils/scrollable.mjs\";\nimport { useValueChanged } from \"../../internals/useValueChanged.mjs\";\nimport { NOOP } from \"../../internals/noop.mjs\";\nimport { FOCUSABLE_POPUP_PROPS } from \"../../utils/popups/index.mjs\";\nimport { mergeProps } from \"../../merge-props/index.mjs\";\nimport { stringifyAsLabel, stringifyAsValue, flattenLeafItems, isGroupedItems } from \"../../internals/resolveValueLabel.mjs\";\nimport { compareItemEquality, defaultItemEquality, findItemIndex, findSelectionIndex, isSelectedValueDirty, removeItem, selectedValueIncludes } from \"../../internals/itemEquality.mjs\";\nimport { INITIAL_LAST_HIGHLIGHT, NO_ACTIVE_VALUE } from \"./utils/constants.mjs\";\nimport { useDirection } from \"../../internals/direction-context/DirectionContext.mjs\";\nimport { findCollectionItem } from \"../items/itemCollection.mjs\";\n\n/**\n * @internal\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport function AriaCombobox(props) {\n const {\n id: idProp,\n onOpenChangeComplete: onOpenChangeCompleteProp,\n defaultSelectedValue = null,\n selectedValue: selectedValueProp,\n onSelectedValueChange,\n defaultInputValue,\n inputValue: inputValueProp,\n open: openProp,\n defaultOpen = false,\n selectionMode,\n onItemHighlighted: onItemHighlightedProp,\n name: nameProp,\n form,\n disabled: disabledProp = false,\n readOnly = false,\n required = false,\n inputRef: inputRefProp,\n grid = false,\n items: itemsProp,\n filteredItems: filteredItemsProp,\n filter: filterProp,\n filterQuery: filterQueryProp,\n openOnInputClick = true,\n autoHighlight = false,\n keepHighlight = false,\n highlightItemOnHover = true,\n loopFocus = true,\n itemToStringLabel: itemToStringLabelProp,\n itemToStringValue,\n isItemEqualToValue = defaultItemEquality,\n virtualized = false,\n inline: inlineProp = false,\n fillInputOnItemPress = true,\n modal = false,\n limit = -1,\n autoComplete = 'list',\n formAutoComplete,\n locale,\n submitOnItemClick = false\n } = props;\n const {\n clearErrors\n } = useFormContext();\n const {\n setDirty,\n validityData,\n setFilled,\n name: fieldName,\n disabled: fieldDisabled,\n setTouched,\n setFocused,\n validationMode,\n validation\n } = useFieldRootContext();\n const direction = useDirection();\n const id = useLabelableId({\n id: idProp\n });\n const collatorFilter = useCoreFilter({\n locale\n });\n\n // Plain items are arrays; normalized `createItems()` collections are objects.\n const collection = Array.isArray(itemsProp) ? null : itemsProp;\n if (collection && typeof collection.label !== 'function') {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: the `items` prop received an object that is not a collection, ' + 'so its items cannot be read. Pass an array of items, an array of groups with items, ' + 'or the result of `createItems()`. ' + 'See https://base-ui.com/react/components/combobox#createitems' : _formatErrorMessage(100));\n }\n const items = collection ? collection.data : itemsProp;\n const itemToValue = collection?.value;\n\n // A projected collection's items live in the source domain, not the selection-value domain the\n // store matches against, so they are withheld from the store.\n const storeItems = itemToValue ? undefined : items;\n\n // The externally filtered items projected to their selection values, with a lookup back to the\n // source items. Declared before `itemToStringLabel`, which resolves labels from it on the\n // first render (initial input value).\n const externalWindow = React.useMemo(() => {\n if (!filteredItemsProp || !itemToValue) {\n return undefined;\n }\n const flat = flattenLeafItems(filteredItemsProp);\n const values = flat.map(itemToValue);\n let valueToItem;\n return {\n values,\n findItem(itemValue, isEqual) {\n if (!valueToItem) {\n valueToItem = new Map();\n for (let i = 0; i < values.length; i += 1) {\n if (!valueToItem.has(values[i])) {\n valueToItem.set(values[i], flat[i]);\n }\n }\n }\n return findCollectionItem(valueToItem, itemValue, isEqual);\n }\n };\n }, [filteredItemsProp, itemToValue]);\n\n // Labels selection values from current props only: collection data first, then the current\n // external window, then the prop. Nothing from a past window is remembered — keeping a value\n // resolvable over time means keeping its item in the collection's data.\n const itemToStringLabel = React.useMemo(() => {\n if (!collection) {\n return itemToStringLabelProp;\n }\n return itemValue => {\n return collection.label(itemValue, isItemEqualToValue, unresolvedValue => {\n const externalItem = externalWindow?.findItem(unresolvedValue, isItemEqualToValue);\n if (externalItem != null) {\n return collection.itemLabel(externalItem);\n }\n return stringifyAsLabel(unresolvedValue, itemToStringLabelProp);\n });\n };\n }, [collection, itemToStringLabelProp, externalWindow, isItemEqualToValue]);\n const filterItemToString = React.useMemo(() => {\n if (!collection) {\n return itemToStringLabelProp;\n }\n return Object.assign(item => collection.itemLabel(item), {\n selected: value => stringifyAsLabel(value, itemToStringLabel)\n });\n }, [collection, itemToStringLabel, itemToStringLabelProp]);\n function stringifyValueLabel(item) {\n return stringifyAsLabel(item, itemToStringLabel);\n }\n const [queryChangedAfterOpen, setQueryChangedAfterOpen] = React.useState(false);\n const [closeQuery, setCloseQuery] = React.useState(null);\n const previousCloseQueryRef = React.useRef(closeQuery);\n const listRef = React.useRef([]);\n const labelsRef = React.useRef([]);\n const popupRef = React.useRef(null);\n const inputRef = React.useRef(null);\n const startDismissRef = React.useRef(null);\n const endDismissRef = React.useRef(null);\n const emptyRef = React.useRef(null);\n const keyboardActiveRef = React.useRef(true);\n const hadInputClearRef = React.useRef(false);\n const chipsContainerRef = React.useRef(null);\n const clearRef = React.useRef(null);\n const selectionEventRef = React.useRef(null);\n const lastHighlightRef = React.useRef(INITIAL_LAST_HIGHLIGHT);\n const pendingQueryHighlightRef = React.useRef(null);\n\n /**\n * Contains the currently visible list of item values post-filtering.\n */\n const valuesRef = React.useRef([]);\n /**\n * The item element that received the last `pointerdown`, used to detect whether a\n * `mouseup` on an item belongs to a drag-select gesture that started elsewhere.\n */\n const pointerDownItemRef = React.useRef(null);\n const disabled = fieldDisabled || disabledProp;\n const name = fieldName ?? nameProp;\n const multiple = selectionMode === 'multiple';\n const single = selectionMode === 'single';\n const hasInputValue = inputValueProp !== undefined || defaultInputValue !== undefined;\n const hasItems = items !== undefined;\n const hasFilteredItemsProp = filteredItemsProp !== undefined;\n let autoHighlightMode;\n if (autoHighlight === 'always') {\n autoHighlightMode = 'always';\n } else {\n autoHighlightMode = autoHighlight ? 'input-change' : false;\n }\n const [selectedValue, setSelectedValueUnwrapped] = useControlled({\n controlled: selectedValueProp,\n default: multiple ? defaultSelectedValue ?? EMPTY_ARRAY : defaultSelectedValue,\n name: 'Combobox',\n state: 'selectedValue'\n });\n const filter = React.useMemo(() => {\n if (filterProp === null) {\n return () => true;\n }\n if (filterProp !== undefined) {\n return filterProp;\n }\n // `shouldBypassFiltering` already empties the query whenever a single selection's label\n // matches it exactly, so the filter never needs a selection-aware variant here.\n return createCollatorItemFilter(collatorFilter, filterItemToString);\n }, [filterProp, collatorFilter, filterItemToString]);\n\n // If neither inputValue nor defaultInputValue are provided, derive it from the\n // selected value for single mode so the input reflects the selection on mount.\n const initialDefaultInputValue = useRefWithInit(() => {\n if (hasInputValue) {\n return defaultInputValue ?? '';\n }\n if (single) {\n return stringifyValueLabel(selectedValue);\n }\n return '';\n }).current;\n const [inputValue, setInputValueUnwrapped] = useControlled({\n controlled: inputValueProp,\n default: initialDefaultInputValue,\n name: 'Combobox',\n state: 'inputValue'\n });\n const [open, setOpenUnwrapped] = useControlled({\n controlled: openProp,\n default: defaultOpen,\n name: 'Combobox',\n state: 'open'\n });\n const isGrouped = isGroupedItems(items);\n const query = !open && closeQuery !== null ? closeQuery : String(inputValue).trim();\n const selectedLabelString = single ? stringifyValueLabel(selectedValue) : '';\n const shouldBypassFiltering = single && !queryChangedAfterOpen && query !== '' && selectedLabelString.length === query.length && collatorFilter.contains(selectedLabelString, query);\n const filterQuery = shouldBypassFiltering ? '' : filterQueryProp ?? query;\n const shouldIgnoreExternalFiltering = hasItems && hasFilteredItemsProp && shouldBypassFiltering && (!collection || collection.hasValue(selectedValue, isItemEqualToValue));\n const flatItems = React.useMemo(() => items ? flattenLeafItems(items) : EMPTY_ARRAY, [items]);\n const filteredItems = React.useMemo(() => {\n if (filteredItemsProp && !shouldIgnoreExternalFiltering) {\n return filteredItemsProp;\n }\n if (!items) {\n return EMPTY_ARRAY;\n }\n if (isGrouped) {\n const groupedItems = items;\n const resultingGroups = [];\n let currentCount = 0;\n for (const group of groupedItems) {\n if (limit > -1 && currentCount >= limit) {\n break;\n }\n const remainingLimit = limit > -1 ? limit - currentCount : Infinity;\n const itemsToTake = filterQuery === '' ? group.items.slice(0, remainingLimit) : [];\n if (filterQuery !== '') {\n for (const item of group.items) {\n if (itemsToTake.length >= remainingLimit) {\n break;\n }\n if (filter(item, filterQuery, filterItemToString)) {\n itemsToTake.push(item);\n }\n }\n }\n if (itemsToTake.length > 0) {\n const newGroup = {\n ...group,\n items: itemsToTake\n };\n resultingGroups.push(newGroup);\n currentCount += itemsToTake.length;\n }\n }\n return resultingGroups;\n }\n if (filterQuery === '') {\n return limit > -1 ? flatItems.slice(0, limit) :\n // The cast here is done as `flatItems` is readonly.\n // valuesRef.current, a mutable ref, can be set to `flatFilteredValues`, which may\n // reference this exact readonly value, creating a mutation risk.\n // However, <Combobox.Item> can never mutate this value as the mutating effect\n // bails early when `items` is provided, and this is only ever returned\n // when `items` is provided due to the early return at the top of this hook.\n flatItems;\n }\n const limitedItems = [];\n for (const item of flatItems) {\n if (limit > -1 && limitedItems.length >= limit) {\n break;\n }\n if (filter(item, filterQuery, filterItemToString)) {\n limitedItems.push(item);\n }\n }\n return limitedItems;\n }, [filteredItemsProp, shouldIgnoreExternalFiltering, items, isGrouped, filterQuery, limit, filter, filterItemToString, flatItems]);\n\n /**\n * The filtered items flattened across groups and projected to their selection values.\n */\n const flatFilteredValues = React.useMemo(() => {\n if (externalWindow && filteredItems === filteredItemsProp) {\n return externalWindow.values;\n }\n // Explicit type argument: inferring it from a union of both shapes resolves `Item` to\n // `Group<Item>`, which tsc rejects and tsgo does not.\n const flat = flattenLeafItems(filteredItems);\n return itemToValue ? flat.map(item => itemToValue(item)) : flat;\n }, [filteredItems, filteredItemsProp, externalWindow, itemToValue]);\n const store = useRefWithInit(() => {\n // An inline list open on the first render never gets a closed pass of the closed-state\n // sync effect below, and `items`-prop lists don't self-register their index the way\n // individually rendered `<Combobox.Item>`s do, so the selected item was never highlighted.\n // Seeding the index here lets list navigation highlight and scroll to the selection on\n // mount. Computed once by construction, so a selection or list that resolves after mount\n // doesn't move an existing highlight or scroll the list away.\n let initialSelectedIndex = null;\n if (inlineProp && open && hasItems && selectionMode !== 'none') {\n initialSelectedIndex = findSelectionIndex(flatFilteredValues, selectedValue, isItemEqualToValue, multiple);\n }\n return new ReactStore({\n id,\n labelId: undefined,\n selectedValue,\n open,\n items: storeItems,\n selectionMode,\n name,\n form,\n disabled,\n readOnly,\n required,\n grid,\n virtualized,\n openOnInputClick,\n itemToStringLabel,\n isItemEqualToValue,\n modal,\n autoHighlight: autoHighlightMode,\n submitOnItemClick,\n hasInputValue,\n mounted: false,\n forceMounted: false,\n transitionStatus: 'idle',\n inline: inlineProp,\n activeIndex: null,\n selectedIndex: initialSelectedIndex,\n popupProps: {},\n listProps: {},\n inputProps: {},\n triggerProps: {},\n itemProps: EMPTY_OBJECT,\n positionerElement: null,\n listElement: null,\n popupId: undefined,\n triggerElement: null,\n inputElement: null,\n inputGroupElement: null,\n popupSide: null,\n openMethod: null,\n inputInsidePopup: true,\n // Avoid duplicate names in the server HTML. Popup inputs aren't rendered\n // until after hydration, so the hidden input takes over then if needed.\n inputOwnsFormValue: selectionMode === 'none'\n }, {\n // Placeholder callbacks replaced on first render\n onOpenChangeComplete: NOOP,\n setOpen: NOOP,\n setInputValue: NOOP,\n setSelectedValue: NOOP,\n setIndices: NOOP,\n handleSelection: NOOP,\n forceMount: NOOP,\n requestSubmit: NOOP,\n listRef,\n labelsRef,\n popupRef,\n emptyRef,\n inputRef,\n startDismissRef,\n endDismissRef,\n keyboardActiveRef,\n chipsContainerRef,\n clearRef,\n valuesRef,\n pointerDownItemRef,\n selectionEventRef\n }, selectors);\n }).current;\n const fieldRawValue = selectionMode === 'none' ? inputValue : selectedValue;\n const fieldStringValue = React.useMemo(() => {\n if (selectionMode === 'none') {\n return fieldRawValue;\n }\n if (Array.isArray(selectedValue)) {\n return selectedValue.map(value => stringifyAsValue(value, itemToStringValue));\n }\n return stringifyAsValue(selectedValue, itemToStringValue);\n }, [fieldRawValue, itemToStringValue, selectionMode, selectedValue]);\n const onItemHighlighted = useStableCallback(onItemHighlightedProp);\n const onOpenChangeComplete = useStableCallback(onOpenChangeCompleteProp);\n const activeIndex = store.useState('activeIndex');\n const selectedIndex = store.useState('selectedIndex');\n const positionerElement = store.useState('positionerElement');\n const listElement = store.useState('listElement');\n const triggerElement = store.useState('triggerElement');\n const inputElement = store.useState('inputElement');\n const inputGroupElement = store.useState('inputGroupElement');\n const inline = store.useState('inline');\n const inputInsidePopup = store.useState('inputInsidePopup');\n const inputOwnsFormValue = store.useState('inputOwnsFormValue');\n const inputMatchesSelectedValue = single && !inputInsidePopup && inputValue === selectedLabelString;\n const triggerRef = useValueAsRef(triggerElement);\n const {\n mounted,\n setMounted,\n transitionStatus\n } = useTransitionStatus(open);\n const {\n openMethod,\n triggerProps\n } = useOpenInteractionType(open);\n const getStringifiedValueForForm = useStableCallback(() => fieldStringValue);\n useRegisterFieldControl(inputInsidePopup ? triggerRef : inputRef, id, fieldRawValue, getStringifiedValueForForm, !disabled, nameProp);\n const forceMount = useStableCallback(() => {\n if (items) {\n // Ensure typeahead works on a closed list.\n labelsRef.current = flatFilteredValues.map(stringifyValueLabel);\n } else {\n store.set('forceMounted', true);\n }\n });\n\n /**\n * Emits `onItemHighlighted` for the item at `index`, or clears the highlight when `index` is `-1`\n * (a no-op if nothing was highlighted). Keeps `lastHighlightRef` in sync with what was emitted.\n */\n const emitHighlight = useStableCallback((value, index, type) => {\n if (index === -1) {\n if (lastHighlightRef.current === INITIAL_LAST_HIGHLIGHT) {\n return;\n }\n lastHighlightRef.current = INITIAL_LAST_HIGHLIGHT;\n } else {\n lastHighlightRef.current = {\n value,\n index\n };\n }\n onItemHighlighted(value, createGenericEventDetails(type, undefined, {\n index\n }));\n });\n const setIndices = useStableCallback(options => {\n const update = {};\n if (options.activeIndex !== undefined) {\n update.activeIndex = options.activeIndex;\n }\n if (options.selectedIndex !== undefined) {\n update.selectedIndex = options.selectedIndex;\n }\n store.update(update);\n const activeIndexOption = options.activeIndex;\n if (activeIndexOption === undefined) {\n return;\n }\n const type = options.type || REASONS.none;\n if (activeIndexOption === null) {\n emitHighlight(undefined, -1, type);\n } else {\n emitHighlight(valuesRef.current[activeIndexOption], activeIndexOption, type);\n }\n });\n const setInputValue = useStableCallback((next, eventDetails) => {\n props.onInputValueChange?.(next, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n\n // A canceled selection clear must not suppress close-completion cleanup.\n hadInputClearRef.current = eventDetails.reason === REASONS.inputClear;\n\n // If user is typing, ensure we don't auto-highlight on open due to a race\n // with the post-open effect that sets this flag.\n if (eventDetails.reason === REASONS.inputChange) {\n // A controlled popup may ignore a close request. Resuming input proves the popup\n // is remaining open, so release the query captured for an exit animation.\n if (open && closeQuery !== null) {\n setCloseQuery(null);\n }\n const event = eventDetails.event;\n const inputType = event.inputType;\n // Treat composition commits as typed input; autofill may omit `inputType` or\n // report `insertReplacementText`.\n const isTypedInput = event.type === 'compositionend' || inputType != null && inputType !== '' && inputType !== 'insertReplacementText';\n if (isTypedInput) {\n const hasQuery = next.trim() !== '';\n if (hasQuery) {\n setQueryChangedAfterOpen(true);\n }\n // Defer index updates until after the filtered items have been derived to ensure\n // `onItemHighlighted` receives the latest item.\n pendingQueryHighlightRef.current = {\n hasQuery\n };\n\n // Virtualized lists own their scroller. Reset regular lists directly so a stale\n // composite registry cannot select a reordered item and scrolling cannot escape\n // the popup.\n const list = store.state.listElement;\n if (!store.state.virtualized && list) {\n const popup = popupRef.current;\n for (const ancestor of getOverflowAncestors(list.firstElementChild ?? list)) {\n if (!isHTMLElement(ancestor) || (popup ? !contains(popup, ancestor) : ancestor.getAttribute('role') === 'dialog')) {\n break;\n }\n if (isScrollableY(ancestor)) {\n ancestor.scrollTop = 0;\n break;\n }\n }\n }\n if (hasQuery && autoHighlightMode && store.state.activeIndex == null && (open || inline)) {\n store.set('activeIndex', 0);\n }\n }\n } else if (eventDetails.reason === REASONS.inputClear && next === '' && store.state.inputInsidePopup) {\n // A programmatic clear of an active query (e.g. after selecting an item with the\n // input inside the popup): restore the highlight to the selected item.\n pendingQueryHighlightRef.current = {\n hasQuery: false,\n selection: true\n };\n }\n setInputValueUnwrapped(next);\n });\n const handleInterruptedReopen = useStableCallback(isInputChange => {\n // Preserve values supplied with the reopen rather than owned by the interrupted close.\n const clearsPendingInput = !isInputChange && inputInsidePopup && !inline && inputValue !== '' && (String(inputValue).trim() === closeQuery || inputValue === selectedLabelString);\n\n // Keep the flag while a visible filter survives so the `items` sync cannot overwrite it.\n if (!isInputChange && (clearsPendingInput || inputValue === '' || inputMatchesSelectedValue)) {\n setQueryChangedAfterOpen(false);\n }\n setCloseQuery(null);\n if (clearsPendingInput) {\n // Cleanup clears omit the selection flag and reopening gesture.\n setInputValue('', createChangeEventDetails(REASONS.inputClear));\n }\n });\n const setOpen = useStableCallback((nextOpen, eventDetails) => {\n if (open === nextOpen) {\n return;\n }\n\n // If the `Empty` component is not used, the positioner or popup should be hidden\n // with CSS. In this case, allow the Escape key to bubble to close a parent popup\n // if there are no items to show.\n if (eventDetails.reason === REASONS.escapeKey && hasItems && flatFilteredValues.length === 0 && !emptyRef.current) {\n eventDetails.allowPropagation();\n }\n props.onOpenChange?.(nextOpen, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n if (nextOpen && closeQuery !== null) {\n // `ComboboxInput` calls `setInputValue` before `setOpen`, so on an input-change reopen\n // `inputValue` is still the pre-keystroke value and the typed filter always survives.\n handleInterruptedReopen(eventDetails.reason === REASONS.inputChange);\n }\n if (!nextOpen && queryChangedAfterOpen) {\n if (single) {\n if (!inline) {\n setCloseQuery(query);\n }\n // Avoid a flicker when closing the popup with an empty query.\n if (query === '') {\n setQueryChangedAfterOpen(false);\n }\n } else if (multiple) {\n if (!inline) {\n // Freeze the current query so filtering remains stable while exiting.\n setCloseQuery(query);\n }\n if (inputInsidePopup) {\n setIndices({\n activeIndex: null\n });\n }\n\n // Clear the input immediately on close while retaining filtering via closeQuery for exit animations\n // if the input is outside the popup. When the input is inside the popup, defer the clear until\n // unmount so the filtered list doesn't flash to unfiltered during the exit animation.\n if (!inputInsidePopup || inline) {\n setInputValue('', createChangeEventDetails(REASONS.inputClear, eventDetails.event, undefined, {\n isItemPress: eventDetails.reason === REASONS.itemPress\n }));\n }\n }\n }\n setOpenUnwrapped(nextOpen);\n if (!nextOpen && inputInsidePopup && (eventDetails.reason === REASONS.focusOut || eventDetails.reason === REASONS.outsidePress)) {\n setTouched(true);\n setFocused(false);\n if (validationMode === 'onBlur') {\n const valueToValidate = selectionMode === 'none' ? inputValue : selectedValue;\n validation.commit(valueToValidate);\n }\n }\n });\n const setSelectedValue = useStableCallback((nextValue, eventDetails) => {\n // Cast to `any` due to conditional value type (single vs. multiple).\n // The runtime implementation already ensures the correct value shape.\n onSelectedValueChange?.(nextValue, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n setSelectedValueUnwrapped(nextValue);\n const shouldFillInput = selectionMode === 'none' && popupRef.current && fillInputOnItemPress || single && !store.state.inputInsidePopup;\n if (shouldFillInput) {\n setInputValue(stringifyValueLabel(nextValue), createChangeEventDetails(eventDetails.reason, eventDetails.event));\n }\n });\n const handleSelection = useStableCallback((event, itemValue) => {\n const targetEl = getTarget(event);\n const overrideEvent = selectionEventRef.current ?? event;\n selectionEventRef.current = null;\n const eventDetails = createChangeEventDetails(REASONS.itemPress, overrideEvent);\n\n // Let the link handle the click.\n const href = targetEl?.closest('a')?.getAttribute('href');\n if (href) {\n if (href.startsWith('#')) {\n setOpen(false, eventDetails);\n }\n return;\n }\n if (multiple) {\n const currentSelectedValue = Array.isArray(selectedValue) ? selectedValue : [];\n const isCurrentlySelected = selectedValueIncludes(currentSelectedValue, itemValue, isItemEqualToValue);\n const nextValue = isCurrentlySelected ? removeItem(currentSelectedValue, itemValue, isItemEqualToValue) : [...currentSelectedValue, itemValue];\n setSelectedValue(nextValue, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n const wasFiltering = inputRef.current ? inputRef.current.value.trim() !== '' : false;\n if (!wasFiltering) {\n return;\n }\n if (store.state.inputInsidePopup) {\n setInputValue('', createChangeEventDetails(REASONS.inputClear, eventDetails.event, undefined, {\n isItemPress: true\n }));\n // A newly selected item stays highlighted through the clear; a deselection\n // falls back to the standard selection anchor.\n const pendingHighlight = pendingQueryHighlightRef.current;\n if (pendingHighlight && !isCurrentlySelected) {\n pendingHighlight.toggledValue = itemValue;\n }\n } else {\n setOpen(false, eventDetails);\n }\n } else {\n setSelectedValue(itemValue, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n setOpen(false, eventDetails);\n }\n });\n const requestSubmit = useStableCallback(() => {\n const formElement = validation.inputRef.current?.form ?? store.state.inputElement?.form;\n if (formElement && typeof formElement.requestSubmit === 'function') {\n formElement.requestSubmit();\n }\n });\n const handleUnmount = useStableCallback(() => {\n setMounted(false);\n onOpenChangeComplete?.(false);\n setQueryChangedAfterOpen(false);\n setCloseQuery(null);\n if (selectionMode === 'none') {\n setIndices({\n activeIndex: null,\n selectedIndex: null\n });\n } else {\n setIndices({\n activeIndex: null\n });\n }\n\n // Multiple selection mode:\n // If the user typed a filter and didn't select in multiple mode, clear the input\n // after close completes to avoid mid-exit flicker and start fresh on next open.\n if (multiple && inputRef.current && inputRef.current.value !== '' && !hadInputClearRef.current) {\n setInputValue('', createChangeEventDetails(REASONS.inputClear));\n }\n\n // Single selection mode:\n // - If input is rendered inside the popup, clear it so the next open is blank\n // - If input is outside the popup, sync it to the selected value\n if (single) {\n if (store.state.inputInsidePopup) {\n if (inputRef.current && inputRef.current.value !== '') {\n setInputValue('', createChangeEventDetails(REASONS.inputClear));\n }\n } else {\n const stringVal = stringifyValueLabel(selectedValue);\n if (inputRef.current && inputRef.current.value !== stringVal) {\n // If no selection was made, treat this as clearing the typed filter.\n const reason = stringVal === '' ? REASONS.inputClear : REASONS.none;\n setInputValue(stringVal, createChangeEventDetails(reason));\n }\n }\n }\n });\n\n // Support composing the Dialog component around an inline combobox.\n // `[role=\"dialog\"]` is more interoperable than using a context, e.g. it can work\n // with third-party modal libraries, though the limitation is that the closest\n // `role=dialog` part must be the animated element.\n const resolvedPopupRef = React.useMemo(() => {\n if (inline && positionerElement) {\n return {\n current: positionerElement.closest('[role=\"dialog\"]')\n };\n }\n return popupRef;\n }, [inline, positionerElement]);\n useOpenChangeComplete({\n enabled: !props.actionsRef,\n open,\n ref: resolvedPopupRef,\n onComplete() {\n if (!open) {\n handleUnmount();\n }\n }\n });\n React.useImperativeHandle(props.actionsRef, () => ({\n unmount: handleUnmount\n }), [handleUnmount]);\n useIsoLayoutEffect(function syncSelectedIndex() {\n const closeQueryReleased = previousCloseQueryRef.current !== null && closeQuery === null;\n previousCloseQueryRef.current = closeQuery;\n\n // Closing indexes against the frozen filtered list. Reopening releases that query, so its\n // rendered coordinates must be synchronized again even though the popup is already open.\n if (open && (!closeQueryReleased || !hasItems)) {\n return;\n }\n\n // State-driven (not tied to the internal event path) so controlled closes\n // also clear a pointerdown that never received a matching item mouseup.\n if (!open) {\n pointerDownItemRef.current = null;\n }\n if (selectionMode === 'none') {\n return;\n }\n\n // Without `items`, look the selection up in the live registry of mounted item\n // values (the list stays mounted while closed when closed-state features need\n // it — trigger interaction and rendered-label autofill force-mount it). Mounted\n // items re-assert the index themselves when their registration moves; when\n // nothing is mounted the lookup resolves to `null` and each item re-registers\n // the index on the next open.\n // Keep the selected index in the coordinates of the list that is actually rendered.\n const registry = hasItems ? flatFilteredValues : valuesRef.current;\n setIndices({\n selectedIndex: findSelectionIndex(registry, selectedValue, isItemEqualToValue, multiple)\n });\n }, [open, closeQuery, selectedValue, selectionMode, multiple, hasItems, flatFilteredValues, isItemEqualToValue, setIndices]);\n useIsoLayoutEffect(() => {\n if (items) {\n valuesRef.current = flatFilteredValues;\n listRef.current.length = flatFilteredValues.length;\n }\n }, [items, flatFilteredValues]);\n useIsoLayoutEffect(() => {\n const pendingHighlight = pendingQueryHighlightRef.current;\n if (pendingHighlight) {\n // A directly rendered list remains visible when the popup state is closed, while a\n // kept-mounted Positioner is hidden and should stay inert.\n const listIsNavigable = open || inline || store.state.positionerElement?.hidden === false;\n if (pendingHighlight.hasQuery) {\n if (autoHighlightMode && listIsNavigable) {\n store.set('activeIndex', 0);\n }\n pendingQueryHighlightRef.current = null;\n } else if (String(inputValue).trim() === '') {\n // Only handle the clear once it has committed (a controlled input may reject it),\n // so a restore cannot fire while a query is still active.\n pendingQueryHighlightRef.current = null;\n if (listIsNavigable) {\n const clearedBySelection = pendingHighlight.selection;\n if (autoHighlightMode === 'always' && !clearedBySelection && store.state.selectionMode === 'none') {\n // There is no selection to restore in Autocomplete. Keep the first-item reset\n // synchronous so list navigation sees it before a directly rendered list closes.\n store.set('activeIndex', 0);\n }\n\n // Items re-mounted by the clear publish their composite indices in a follow-up\n // commit, so the item registries are mid-update here. Defer past React's cascade.\n queueMicrotask(() => {\n if (!store.state.open && !store.state.inline || inputRef.current && inputRef.current.value.trim() !== '') {\n return;\n }\n\n // Return the highlight to the selected item, the same anchor the popup uses\n // when it first opens. Read the selection through the store so consumers can\n // pass an inline `isItemEqualToValue` or a fresh `selectedValue` array without\n // re-running this effect on every render.\n const currentSelectedValue = store.state.selectedValue;\n const isMultiple = store.state.selectionMode === 'multiple';\n const hasSelection = isMultiple && Array.isArray(currentSelectedValue) ? currentSelectedValue.length > 0 : store.state.selectionMode !== 'none' && currentSelectedValue != null;\n if (hasSelection) {\n const registry = hasItems || hasFilteredItemsProp ? flatFilteredValues : valuesRef.current;\n // A selection-driven clear keeps the just-selected item highlighted;\n // otherwise return to the open anchor. A selection that is no longer in\n // the list drops the highlight rather than leaving it on whichever item\n // now occupies that index.\n // `findItemIndex` resolves to -1 when no value was toggled.\n const toggledIndex = findItemIndex(registry, pendingHighlight.toggledValue, store.state.isItemEqualToValue);\n store.set('activeIndex', toggledIndex !== -1 ? toggledIndex : findSelectionIndex(registry, currentSelectedValue, store.state.isItemEqualToValue, isMultiple));\n } else if (clearedBySelection) {\n store.set('activeIndex', null);\n } else if (autoHighlightMode === 'always') {\n store.set('activeIndex', 0);\n }\n });\n }\n }\n }\n if (!open && !inline) {\n return;\n }\n const shouldUseFlatFilteredValues = hasItems || hasFilteredItemsProp;\n const candidateItems = shouldUseFlatFilteredValues ? flatFilteredValues : valuesRef.current;\n const storeActiveIndex = store.state.activeIndex;\n if (storeActiveIndex == null) {\n if (autoHighlightMode === 'always' && candidateItems.length > 0) {\n store.set('activeIndex', 0);\n return;\n }\n emitHighlight(undefined, -1, REASONS.none);\n return;\n }\n if (storeActiveIndex >= candidateItems.length) {\n emitHighlight(undefined, -1, REASONS.none);\n store.set('activeIndex', null);\n return;\n }\n const itemValue = candidateItems[storeActiveIndex];\n const previouslyHighlightedItemValue = lastHighlightRef.current.value;\n const isSameItem = previouslyHighlightedItemValue !== NO_ACTIVE_VALUE && compareItemEquality(itemValue, previouslyHighlightedItemValue, store.state.isItemEqualToValue);\n if (lastHighlightRef.current.index !== storeActiveIndex || !isSameItem) {\n emitHighlight(itemValue, storeActiveIndex, REASONS.none);\n }\n }, [activeIndex, autoHighlightMode, emitHighlight, hasFilteredItemsProp, hasItems, flatFilteredValues, inline, open, store,\n // Reruns the effect when the query changes without affecting the deps above, such as\n // clearing the input when no items are filtered out (individually rendered items).\n inputValue]);\n useIsoLayoutEffect(() => {\n if (selectionMode === 'none') {\n setFilled(String(inputValue) !== '');\n return;\n }\n setFilled(multiple ? Array.isArray(selectedValue) && selectedValue.length > 0 : selectedValue != null);\n }, [setFilled, selectionMode, inputValue, selectedValue, multiple]);\n\n // Ensures that the active index is not set to 0 when the list is empty.\n // This avoids needing to press ArrowDown twice under certain conditions.\n React.useEffect(() => {\n if (hasItems && autoHighlightMode && flatFilteredValues.length === 0) {\n setIndices({\n activeIndex: null\n });\n }\n }, [hasItems, autoHighlightMode, flatFilteredValues.length, setIndices]);\n function handleQueryChanged() {\n if (open && query !== '' && query !== String(initialDefaultInputValue) && !inputMatchesSelectedValue) {\n setQueryChangedAfterOpen(true);\n }\n }\n function handleOpenChanged() {\n // A controlled `open` prop can interrupt the close without calling `setOpen`.\n if (open && closeQuery !== null) {\n handleInterruptedReopen(false);\n }\n }\n\n // These sync triggers can run in the same commit while still seeing the pre-commit `inputValue`.\n // This render-scoped flag prevents duplicate callbacks and resets so canceled writes can retry.\n let syncedSelectedLabel = false;\n function syncInputToSelectedLabel() {\n if (!syncedSelectedLabel && inputValue !== selectedLabelString) {\n syncedSelectedLabel = true;\n setInputValue(selectedLabelString, createChangeEventDetails(REASONS.none));\n }\n }\n function handleSelectedValueChanged() {\n if (selectionMode === 'none') {\n return;\n }\n clearErrors(name);\n setDirty(isSelectedValueDirty(selectedValue, validityData.initialValue, isItemEqualToValue));\n validation.change(selectedValue);\n if (single && !hasInputValue && !inputInsidePopup) {\n syncInputToSelectedLabel();\n }\n }\n\n // The label catches accessor changes while the items identity restores the selected label after\n // a one-step input clear followed by a data reload. The shared sync prevents duplicate writes\n // when both change in the same commit.\n function syncInputAfterItemsOrLabelChange() {\n if (single && !hasInputValue && !inputInsidePopup && !queryChangedAfterOpen) {\n syncInputToSelectedLabel();\n }\n }\n function handleInputValueChanged() {\n if (selectionMode !== 'none') {\n return;\n }\n clearErrors(name);\n setDirty(inputValue !== validityData.initialValue);\n validation.change(inputValue);\n }\n useValueChanged(query, handleQueryChanged);\n useValueChanged(open, handleOpenChanged);\n useValueChanged(selectedValue, handleSelectedValueChanged);\n useValueChanged(selectedLabelString, syncInputAfterItemsOrLabelChange);\n useValueChanged(items, syncInputAfterItemsOrLabelChange);\n useValueChanged(inputValue, handleInputValueChanged);\n const floatingRootContext = useFloatingRootContext({\n open: inline ? true : open,\n onOpenChange: setOpen,\n elements: {\n reference: inputInsidePopup ? triggerElement : inputElement,\n floating: positionerElement\n }\n });\n const ariaHasPopup = grid ? 'grid' : 'listbox';\n // An inline list isn't gated on `open`: it renders for as long as it's in the tree, so the\n // combobox is permanently expanded even while the internal open state is `false`.\n const expanded = open || inline;\n const ariaExpanded = expanded ? 'true' : 'false';\n const role = React.useMemo(() => {\n const isPlainInput = inputElement?.tagName === 'INPUT';\n // During SSR and initial hydration, the input ref is not available yet.\n // Assume an input-like control so combobox ARIA attributes are present.\n const shouldTreatAsInput = inputElement == null || isPlainInput;\n // A non-input control only takes on combobox semantics while the list is exposed, which for\n // an inline list is the whole time.\n const shouldApplyAria = shouldTreatAsInput || expanded;\n const reference = shouldTreatAsInput ? {\n autoComplete: 'off',\n spellCheck: 'false',\n autoCorrect: 'off',\n autoCapitalize: 'none'\n } : {};\n if (shouldApplyAria) {\n reference.role = 'combobox';\n reference['aria-expanded'] = ariaExpanded;\n reference['aria-haspopup'] = ariaHasPopup;\n reference['aria-controls'] = expanded ? listElement?.id : undefined;\n // `readOnly` accepts no input, so no completion of any kind is offered.\n reference['aria-autocomplete'] = readOnly ? 'none' : autoComplete;\n }\n return {\n reference,\n floating: {\n role: 'presentation'\n }\n };\n }, [inputElement, expanded, ariaExpanded, ariaHasPopup, listElement?.id, autoComplete, readOnly]);\n\n // `readOnly` locks the value, not the interaction: the popup opens and can be browsed.\n // Value changes stay blocked in `ComboboxItem`, `ComboboxInput`'s keydown, `ComboboxTrigger`'s\n // typeahead, the clear/remove parts, and the hidden input's autofill handler.\n const click = useClick(floatingRootContext, {\n enabled: !disabled && openOnInputClick,\n event: 'mousedown-only',\n toggle: false,\n // Apply a small delay for touch to let mobile viewport/keyboard positioning settle.\n // This avoids top-bottom flip flickers if the preferred position is \"top\" when first tapping.\n touchOpenDelay: inputInsidePopup ? 0 : 100,\n reason: REASONS.inputPress\n });\n const dismiss = useDismiss(floatingRootContext, {\n enabled: !disabled && !inline,\n outsidePressEvent: {\n mouse: 'sloppy',\n // The visual viewport (affected by the mobile software keyboard) can be\n // somewhat small. The user may want to scroll the screen to see more of\n // the popup.\n touch: 'intentional'\n },\n // Without a popup, let the Escape key bubble the event up to other popups' handlers.\n bubbles: inline ? true : undefined,\n outsidePress(event) {\n const target = getTarget(event);\n return !contains(triggerElement, target) && !contains(clearRef.current, target) && !contains(chipsContainerRef.current, target) && !contains(inputGroupElement, target);\n }\n });\n const listNavigation = useListNavigation(floatingRootContext, {\n enabled: !disabled,\n id,\n listRef,\n activeIndex,\n selectedIndex,\n virtual: true,\n loopFocus,\n allowEscape: loopFocus && !autoHighlightMode,\n focusItemOnOpen: queryChangedAfterOpen || selectionMode === 'none' && !autoHighlightMode ? false : 'auto',\n focusItemOnHover: highlightItemOnHover,\n resetOnPointerLeave: !keepHighlight,\n orientation: grid ? 'horizontal' : undefined,\n rtl: direction === 'rtl',\n disabledIndices: EMPTY_ARRAY,\n grid: grid ? gridNavigation : undefined,\n onNavigate(nextActiveIndex, event) {\n // Retain the highlight only while actually transitioning out or closed.\n if (!event && !open || transitionStatus === 'ending') {\n return;\n }\n if (!event) {\n setIndices({\n activeIndex: nextActiveIndex\n });\n } else {\n setIndices({\n activeIndex: nextActiveIndex,\n type: keyboardActiveRef.current ? REASONS.keyboard : REASONS.pointer\n });\n }\n }\n });\n const inputProps = React.useMemo(() => mergeProps(listNavigation.reference, {\n onKeyDown(event) {\n // In grid mode the navigation hook treats ArrowLeft/ArrowRight as horizontal\n // grid movement. When the input has focus and no item is highlighted the user\n // is still editing the query, so let the input keep its native caret behavior.\n if (grid && store.state.activeIndex == null && (event.key === 'ArrowLeft' || event.key === 'ArrowRight')) {\n event.preventBaseUIHandler();\n }\n }\n }, dismiss.reference, click.reference, role.reference), [listNavigation.reference, dismiss.reference, click.reference, role.reference, grid, store]);\n const popupProps = React.useMemo(() => mergeProps(FOCUSABLE_POPUP_PROPS, dismiss.floating), [dismiss.floating]);\n const listProps = React.useMemo(() => mergeProps(listNavigation.floating, role.floating), [listNavigation.floating, role.floating]);\n const itemProps = React.useMemo(() => {\n const listNavigationItemProps = listNavigation.item;\n if (!listNavigationItemProps) {\n return EMPTY_OBJECT;\n }\n\n // Combobox keeps focus on the input; item focus would incorrectly sync\n // list navigation state from DOM focus.\n return {\n ...listNavigationItemProps,\n onFocus: undefined\n };\n }, [listNavigation.item]);\n store.useContextCallback('setOpen', setOpen);\n store.useContextCallback('setInputValue', setInputValue);\n store.useContextCallback('setSelectedValue', setSelectedValue);\n store.useContextCallback('setIndices', setIndices);\n store.useContextCallback('handleSelection', handleSelection);\n store.useContextCallback('forceMount', forceMount);\n store.useContextCallback('requestSubmit', requestSubmit);\n store.useContextCallback('onOpenChangeComplete', onOpenChangeCompleteProp);\n\n // The prop bags must be in the store before the parts render: they read them with `useStore`\n // during render, and a layout effect commits only after all children have rendered.\n useOnFirstRender(() => {\n store.update({\n inline: inlineProp,\n popupProps,\n listProps,\n inputProps,\n triggerProps,\n itemProps\n });\n });\n const syncedValues = {\n id,\n selectedValue,\n open,\n mounted,\n transitionStatus,\n items: storeItems,\n inline: inlineProp,\n popupProps,\n listProps,\n inputProps,\n triggerProps,\n itemProps,\n openMethod,\n selectionMode,\n name,\n form,\n disabled,\n readOnly,\n required,\n grid,\n virtualized,\n openOnInputClick,\n itemToStringLabel,\n modal,\n autoHighlight: autoHighlightMode,\n isItemEqualToValue,\n submitOnItemClick,\n hasInputValue\n };\n useIsoLayoutEffect(() => {\n // `inputOwnsFormValue` is derived here rather than during render because `ComboboxInput`\n // writes it from a ref callback earlier in the same commit, and it has to land in this same\n // `update` so subscribers never observe an intermediate snapshot. That is also why\n // `store.useSyncedValues` can't be used yet: it would need a second write. The dependencies\n // are derived from `syncedValues` so a newly synchronized field can't be forgotten here.\n store.update({\n ...syncedValues,\n inputOwnsFormValue: selectionMode === 'none' && (inlineProp || !store.state.inputInsidePopup)\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [store, ...Object.values(syncedValues)]);\n const hiddenInputRef = useMergedRefs(inputRefProp, validation.inputRef);\n const itemsContextValue = React.useMemo(() => ({\n query,\n hasItems,\n filteredItems,\n flatFilteredValues\n }), [query, hasItems, filteredItems, flatFilteredValues]);\n const serializedValue = React.useMemo(() => {\n if (Array.isArray(fieldRawValue)) {\n return '';\n }\n return stringifyAsValue(fieldRawValue, itemToStringValue);\n }, [fieldRawValue, itemToStringValue]);\n const hasMultipleSelection = multiple && Array.isArray(selectedValue) && selectedValue.length > 0;\n const hiddenInputName = multiple || selectionMode === 'none' && inputOwnsFormValue ? undefined : name;\n const hiddenInputs = React.useMemo(() => {\n if (!multiple || !Array.isArray(selectedValue) || !name) {\n return null;\n }\n return selectedValue.map(value => {\n const currentSerializedValue = stringifyAsValue(value, itemToStringValue);\n return /*#__PURE__*/_jsx(\"input\", {\n type: \"hidden\",\n form: form,\n name: name,\n value: currentSerializedValue,\n disabled: disabled\n }, currentSerializedValue);\n });\n }, [multiple, selectedValue, form, name, itemToStringValue, disabled]);\n const children = /*#__PURE__*/_jsxs(React.Fragment, {\n children: [props.children, /*#__PURE__*/_jsx(\"input\", {\n ...validation.getValidationProps(disabled, {\n // Move focus when the hidden input is focused.\n onFocus() {\n if (inputInsidePopup) {\n triggerElement?.focus();\n return;\n }\n (inputRef.current || triggerElement)?.focus();\n },\n // Handle browser autofill.\n onChange(event) {\n // Workaround for https://github.com/react/react/issues/9023\n if (event.nativeEvent.defaultPrevented || disabled || readOnly) {\n return;\n }\n const nextValue = event.currentTarget.value;\n const nextValueLower = nextValue.toLowerCase();\n const details = createChangeEventDetails(REASONS.none, event.nativeEvent);\n const findSerializedMatchIndex = () => valuesRef.current.findIndex(candidate => stringifyAsValue(candidate, itemToStringValue).toLowerCase() === nextValueLower || stringifyValueLabel(candidate).toLowerCase() === nextValueLower);\n function handleChange() {\n // Browser autofill only writes a single scalar value.\n if (multiple) {\n return;\n }\n if (selectionMode === 'none') {\n setInputValue(nextValue, details);\n return;\n }\n\n // Preserve the original serialized matching, then fall back to rendered text,\n // which browsers can autofill for primitive values like `value=\"US\">United States`.\n let matchingIndex = findSerializedMatchIndex();\n if (matchingIndex === -1) {\n matchingIndex = valuesRef.current.findIndex((_, index) => {\n const renderedLabel = labelsRef.current[index];\n return renderedLabel != null && renderedLabel.toLowerCase() === nextValueLower;\n });\n }\n const matchingValue = matchingIndex === -1 ? undefined : valuesRef.current[matchingIndex];\n if (matchingValue != null) {\n // `setSelectedValue` may be canceled by `onValueChange`; rely on\n // `useValueChanged` to mark the field dirty and run validation only\n // when the value actually changes.\n setSelectedValue?.(matchingValue, details);\n }\n }\n\n // Only single-selection autofill matches against the registered values/labels.\n // `multiple` ignores autofill and `none` just writes the input value, so avoid the\n // sticky `forceMounted` mount (which never resets) for those modes.\n if (single) {\n forceMount();\n if (items && findSerializedMatchIndex() === -1) {\n // `forceMount` only refreshes the derived labels for the `items` prop. When\n // serialized matching misses, also mount the list so rendered labels (which can\n // differ from the serialized values) are registered for autofill matching.\n store.set('forceMounted', true);\n }\n }\n queueMicrotask(handleChange);\n }\n }),\n id: id && hiddenInputName == null ? `${id}-hidden-input` : undefined,\n form: form,\n name: hiddenInputName,\n autoComplete: formAutoComplete,\n disabled: disabled,\n required: required && !hasMultipleSelection,\n readOnly: readOnly,\n value: serializedValue,\n ref: hiddenInputRef,\n style: hiddenInputName ? visuallyHiddenInput : visuallyHidden,\n tabIndex: -1,\n \"aria-hidden\": true,\n suppressHydrationWarning: true\n }), hiddenInputs]\n });\n return /*#__PURE__*/_jsx(ComboboxRootContext.Provider, {\n value: store,\n children: /*#__PURE__*/_jsx(ComboboxFloatingContext.Provider, {\n value: floatingRootContext,\n children: /*#__PURE__*/_jsx(ComboboxHasItemsContext.Provider, {\n value: hasItems,\n children: /*#__PURE__*/_jsx(ComboboxDerivedItemsContext.Provider, {\n value: itemsContextValue,\n children: /*#__PURE__*/_jsx(ComboboxInputValueContext.Provider, {\n value: inputValue,\n children: children\n })\n })\n })\n })\n });\n}","'use client';\n\nimport * as React from 'react';\nimport { AriaCombobox } from \"./AriaCombobox.mjs\";\n\n/**\n * Groups all parts of the combobox.\n * Doesn't render its own HTML element.\n *\n * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport function ComboboxRoot(props) {\n const {\n multiple = false,\n defaultValue,\n value,\n onValueChange,\n autoComplete,\n ...other\n } = props;\n return /*#__PURE__*/_jsx(AriaCombobox, {\n ...other,\n selectionMode: multiple ? 'multiple' : 'single',\n selectedValue: value,\n defaultSelectedValue: defaultValue,\n onSelectedValueChange: onValueChange,\n formAutoComplete: autoComplete\n });\n}","'use client';\n\nexport function getDefaultLabelId(id) {\n return id == null ? undefined : `${id}-label`;\n}\nexport function resolveAriaLabelledBy(fieldLabelId, localLabelId) {\n return fieldLabelId ?? localLabelId;\n}","import { CommonTriggerDataAttributes } from \"../../utils/popupStateMapping.mjs\";\n\n/**\n * Present when the corresponding popup is open.\n */\nexport const popupOpen = CommonTriggerDataAttributes.popupOpen;\n/**\n * Present when the input is pressed.\n */\nexport const pressed = CommonTriggerDataAttributes.pressed;\n/**\n * Present when the component is disabled.\n */\nexport const disabled = 'data-disabled';\n/**\n * Present when the component is readonly.\n */\nexport const readonly = 'data-readonly';\n/**\n * Indicates which side the corresponding popup is positioned relative to its anchor.\n * @type {'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start' | null}\n */\nexport const popupSide = 'data-popup-side';\n/**\n * Present when the component is required.\n */\nexport const required = 'data-required';\n/**\n * Present when the component is in a valid state (when wrapped in Field.Root).\n */\nexport const valid = 'data-valid';\n/**\n * Present when the component is in an invalid state (when wrapped in Field.Root).\n */\nexport const invalid = 'data-invalid';\n/**\n * Present when the component has been touched (when wrapped in Field.Root).\n */\nexport const touched = 'data-touched';\n/**\n * Present when the component's value has changed (when wrapped in Field.Root).\n */\nexport const dirty = 'data-dirty';\n/**\n * Present when the component has a value (when wrapped in Field.Root).\n */\nexport const filled = 'data-filled';\n/**\n * Present when the input is focused (when wrapped in Field.Root).\n */\nexport const focused = 'data-focused';\n/**\n * Present when the corresponding items list is empty.\n */\nexport const listEmpty = 'data-list-empty';","import { pressableTriggerOpenStateMapping } from \"../../utils/popupStateMapping.mjs\";\nimport { fieldValidityMapping } from \"../../internals/field-constants/constants.mjs\";\nimport * as ComboboxInputDataAttributes from \"../input/ComboboxInputDataAttributes.mjs\";\nexport const triggerStateAttributesMapping = {\n ...pressableTriggerOpenStateMapping,\n ...fieldValidityMapping,\n popupSide: side => side ? {\n [ComboboxInputDataAttributes.popupSide]: side\n } : null,\n listEmpty: empty => empty ? {\n [ComboboxInputDataAttributes.listEmpty]: ''\n } : null\n};","'use client';\n\nimport * as React from 'react';\nexport const ComboboxChipsContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") ComboboxChipsContext.displayName = \"ComboboxChipsContext\";\nexport function useComboboxChipsContext() {\n return React.useContext(ComboboxChipsContext);\n}","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const ComboboxPositionerContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") ComboboxPositionerContext.displayName = \"ComboboxPositionerContext\";\nexport function useComboboxPositionerContext(optional) {\n const context = React.useContext(ComboboxPositionerContext);\n if (context === undefined && !optional) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: <Combobox.Popup> and <Combobox.Arrow> must be used within the <Combobox.Positioner> component' : _formatErrorMessage(21));\n }\n return context;\n}","'use client';\n\nimport * as React from 'react';\nimport { useMergedRefs } from '@base-ui/utils/useMergedRefs';\nimport { visuallyHiddenInput } from '@base-ui/utils/visuallyHidden';\nimport { useButton } from \"../../internals/use-button/index.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useComboboxRootContext } from \"../root/ComboboxRootContext.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * @internal\n */\nexport const ComboboxInternalDismissButton = /*#__PURE__*/React.forwardRef(function ComboboxInternalDismissButton(_, forwardedRef) {\n const store = useComboboxRootContext();\n const {\n buttonRef,\n getButtonProps\n } = useButton({\n native: false\n });\n const mergedRef = useMergedRefs(forwardedRef, buttonRef);\n function handleDismiss(event) {\n store.context.setOpen(false, createChangeEventDetails(REASONS.closePress, event.nativeEvent, event.currentTarget));\n }\n const dismissProps = getButtonProps({\n onClick: handleDismiss\n });\n return /*#__PURE__*/_jsx(\"span\", {\n ref: mergedRef,\n ...dismissProps,\n \"aria-label\": \"Dismiss\",\n tabIndex: undefined,\n style: visuallyHiddenInput\n });\n});\nif (process.env.NODE_ENV !== \"production\") ComboboxInternalDismissButton.displayName = \"ComboboxInternalDismissButton\";","'use client';\n\nimport { useComboboxDerivedItemsContext } from \"../root/ComboboxRootContext.mjs\";\n/**\n * The popup side is only meaningful while the positioner is mounted, as the store retains the\n * last resolved side after the popup unmounts.\n */\nexport function usePopupSide(store) {\n const mounted = store.useState('mounted');\n const popupSide = store.useState('popupSide');\n const positionerElement = store.useState('positionerElement');\n return mounted && positionerElement ? popupSide : null;\n}\n\n/**\n * Whether the filtered list has no items to show.\n */\nexport function useListEmpty() {\n return useComboboxDerivedItemsContext().filteredItems.length === 0;\n}\n\n/**\n * The arrow keys that move the chip highlight backwards and forwards, in that order.\n */\nexport function getChipNavigationKeys(direction) {\n return direction === 'rtl' ? ['ArrowRight', 'ArrowLeft'] : ['ArrowLeft', 'ArrowRight'];\n}\n\n/**\n * Where the highlight lands once the chip at `index` is removed, or `undefined` for no highlight.\n */\nexport function getIndexAfterChipRemoval(index, chipCount) {\n const nextIndex = index >= chipCount - 1 ? chipCount - 2 : index;\n return nextIndex >= 0 ? nextIndex : undefined;\n}\n\n/**\n * Commits the highlighted item by clicking it, tagging the originating event so the item's\n * handler can attribute the selection to it.\n */\nexport function clickHighlightedItem(store, activeIndex, nativeEvent) {\n const listItem = store.context.listRef.current[activeIndex];\n if (listItem) {\n store.context.selectionEventRef.current = nativeEvent;\n listItem.click();\n store.context.selectionEventRef.current = null;\n }\n}","'use client';\n\nimport * as React from 'react';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { platform } from '@base-ui/utils/platform';\nimport { useBaseUiId } from \"../../internals/useBaseUiId.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useComboboxInputValueContext, useComboboxRootContext } from \"../root/ComboboxRootContext.mjs\";\nimport { triggerStateAttributesMapping } from \"../utils/stateAttributesMapping.mjs\";\nimport { DEFAULT_FIELD_ROOT_CONTEXT, FieldRootContext, useFieldRootContext } from \"../../internals/field-root-context/FieldRootContext.mjs\";\nimport { DEFAULT_FIELD_STATE_ATTRIBUTES } from \"../../internals/field-constants/constants.mjs\";\nimport { useLabelableContext } from \"../../internals/labelable-provider/LabelableContext.mjs\";\nimport { useComboboxChipsContext } from \"../chips/ComboboxChipsContext.mjs\";\nimport { stopEvent } from \"../../floating-ui-react/utils.mjs\";\nimport { useComboboxPositionerContext } from \"../positioner/ComboboxPositionerContext.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useDirection } from \"../../internals/direction-context/DirectionContext.mjs\";\nimport { ComboboxInternalDismissButton } from \"../utils/ComboboxInternalDismissButton.mjs\";\nimport { clickHighlightedItem, getChipNavigationKeys, getIndexAfterChipRemoval, useListEmpty, usePopupSide } from \"../utils/parts.mjs\";\n\n/**\n * A text input to search for items in the list.\n * Renders an `<input>` element.\n *\n * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const ComboboxInput = /*#__PURE__*/React.forwardRef(function ComboboxInput(componentProps, forwardedRef) {\n const {\n render,\n className,\n disabled: disabledProp = false,\n id: idProp,\n style,\n ...elementProps\n } = componentProps;\n const {\n state: fieldState,\n disabled: fieldDisabled,\n setTouched,\n setFocused,\n validationMode,\n validation\n } = useFieldRootContext();\n const {\n labelId: fieldLabelId\n } = useLabelableContext();\n const comboboxChipsContext = useComboboxChipsContext();\n const positioning = useComboboxPositionerContext(true);\n const hasPositionerParent = Boolean(positioning);\n const store = useComboboxRootContext();\n // `inputValue` can't be placed in the store.\n // https://github.com/mui/base-ui/issues/2703\n const inputValue = useComboboxInputValueContext();\n const direction = useDirection();\n const required = store.useState('required');\n const comboboxDisabled = store.useState('disabled');\n const readOnly = store.useState('readOnly');\n const name = store.useState('name');\n const form = store.useState('form');\n const selectionMode = store.useState('selectionMode');\n const autoHighlightMode = store.useState('autoHighlight');\n const inputProps = store.useState('inputProps');\n const triggerProps = store.useState('triggerProps');\n const open = store.useState('open');\n const mounted = store.useState('mounted');\n const selectedValue = store.useState('selectedValue');\n const rootId = store.useState('id');\n const inline = store.useState('inline');\n const modal = store.useState('modal');\n const autoHighlightEnabled = Boolean(autoHighlightMode);\n const popupSide = usePopupSide(store);\n const disabled = fieldDisabled || comboboxDisabled || disabledProp;\n const listEmpty = useListEmpty();\n const isInsidePopup = hasPositionerParent || inline;\n const focusManagerModal = !isInsidePopup || modal;\n const id = useBaseUiId(idProp ?? (!isInsidePopup ? rootId : undefined));\n const fieldStateForInput = hasPositionerParent ? DEFAULT_FIELD_STATE_ATTRIBUTES : fieldState;\n const [composingValue, setComposingValue] = React.useState(null);\n const isComposingRef = React.useRef(false);\n const lastActiveIndexRef = React.useRef(null);\n const shouldRestoreActiveIndexRef = React.useRef(false);\n const inputOwnsFormValue = selectionMode === 'none' && !hasPositionerParent;\n const setInputElement = useStableCallback(element => {\n const nextIsInsidePopup = hasPositionerParent || store.state.inline;\n if (nextIsInsidePopup && !store.state.hasInputValue) {\n store.context.setInputValue('', createChangeEventDetails(REASONS.none));\n }\n store.update({\n inputElement: element,\n inputInsidePopup: nextIsInsidePopup,\n inputOwnsFormValue\n });\n });\n const validationProps = hasPositionerParent ? elementProps : validation.getValidationProps(disabled, elementProps);\n function clearHighlight() {\n store.context.setIndices({\n activeIndex: null,\n selectedIndex: null,\n type: store.context.keyboardActiveRef.current ? REASONS.keyboard : REASONS.pointer\n });\n }\n function markPointerActive() {\n store.context.keyboardActiveRef.current = false;\n }\n const state = {\n ...fieldStateForInput,\n open,\n disabled,\n readOnly,\n popupSide,\n listEmpty\n };\n function handleKeyDown(event) {\n if (!comboboxChipsContext) {\n return undefined;\n }\n let nextIndex;\n const {\n highlightedChipIndex\n } = comboboxChipsContext;\n const renderedChipsCount = comboboxChipsContext.chipsRef.current.length;\n const [previousChipKey, nextChipKey] = getChipNavigationKeys(direction);\n if (highlightedChipIndex !== undefined) {\n if (event.key === previousChipKey) {\n event.preventDefault();\n if (highlightedChipIndex > 0) {\n nextIndex = highlightedChipIndex - 1;\n } else {\n nextIndex = undefined;\n }\n } else if (event.key === nextChipKey) {\n event.preventDefault();\n if (highlightedChipIndex < renderedChipsCount - 1) {\n nextIndex = highlightedChipIndex + 1;\n } else {\n nextIndex = undefined;\n }\n } else if (event.key === 'Backspace' || event.key === 'Delete') {\n event.preventDefault();\n // Move highlight appropriately after removal.\n nextIndex = getIndexAfterChipRemoval(highlightedChipIndex, selectedValue.length);\n clearHighlight();\n }\n return nextIndex;\n }\n\n // Handle navigation when no chip is highlighted\n if (event.key === previousChipKey && (event.currentTarget.selectionStart ?? 0) === 0 && selectedValue.length > 0) {\n event.preventDefault();\n nextIndex = renderedChipsCount > 0 ? renderedChipsCount - 1 : undefined;\n }\n return nextIndex;\n }\n const element = useRenderElement('input', componentProps, {\n state,\n ref: [forwardedRef, store.context.inputRef, setInputElement],\n props: [inputProps, triggerProps, {\n value: composingValue ?? inputValue,\n 'aria-readonly': readOnly || undefined,\n 'aria-required': required || undefined,\n 'aria-labelledby': fieldLabelId,\n disabled,\n readOnly,\n required: selectionMode === 'none' ? required : undefined,\n form,\n ...(inputOwnsFormValue && name && {\n name\n }),\n id,\n onFocus() {\n setFocused(true);\n if (!inline || !shouldRestoreActiveIndexRef.current) {\n return;\n }\n shouldRestoreActiveIndexRef.current = false;\n const nextActiveIndex = lastActiveIndexRef.current;\n if (nextActiveIndex == null ||\n // `valuesRef` can be sparse, so guard against restoring a removed slot.\n !Object.hasOwn(store.context.valuesRef.current, nextActiveIndex)) {\n return;\n }\n store.context.setIndices({\n activeIndex: nextActiveIndex\n });\n },\n onBlur() {\n setTouched(true);\n setFocused(false);\n const activeIndex = store.state.activeIndex;\n if (inline && activeIndex !== null && autoHighlightMode !== 'always') {\n lastActiveIndexRef.current = activeIndex;\n shouldRestoreActiveIndexRef.current = true;\n store.context.setIndices({\n activeIndex: null\n });\n }\n if (validationMode === 'onBlur') {\n const valueToValidate = selectionMode === 'none' ? inputValue : selectedValue;\n validation.commit(valueToValidate);\n }\n },\n onCompositionStart(event) {\n if (platform.os.android) {\n return;\n }\n isComposingRef.current = true;\n setComposingValue(event.currentTarget.value);\n },\n onCompositionEnd(event) {\n isComposingRef.current = false;\n const next = event.currentTarget.value;\n setComposingValue(null);\n store.context.setInputValue(next, createChangeEventDetails(REASONS.inputChange, event.nativeEvent));\n },\n onChange(event) {\n const nativeEvent = event.nativeEvent;\n // Autofill may not provide `inputType` (Chrome) or may report\n // `insertReplacementText` (Firefox).\n const inputType = nativeEvent.inputType;\n const autofillLikeInput = !inputType || inputType === 'insertReplacementText';\n // During composition the input is always considered typed into.\n const shouldOpenOnInput = isComposingRef.current || !autofillLikeInput;\n function maybeOpenOnInput(trimmed) {\n if (readOnly || disabled || !trimmed || !shouldOpenOnInput) {\n return;\n }\n store.context.setOpen(true, createChangeEventDetails(REASONS.inputChange, nativeEvent));\n // When autoHighlight is enabled, keep the highlight (will be set to 0 in root).\n if (!autoHighlightEnabled) {\n clearHighlight();\n }\n }\n\n // During IME composition, avoid propagating controlled updates to prevent\n // filtering the options prematurely so `Empty` won't show incorrectly.\n // We can't rely on this check for Android due to how it handles composition\n // events with some keyboards (e.g. Samsung keyboard with predictive text on\n // treats all text as always-composing).\n // https://github.com/mui/base-ui/issues/2942\n if (isComposingRef.current) {\n const nextVal = event.currentTarget.value;\n setComposingValue(nextVal);\n if (nextVal === '' && !store.state.openOnInputClick && !store.state.inputInsidePopup) {\n store.context.setOpen(false, createChangeEventDetails(REASONS.inputClear, nativeEvent));\n }\n const trimmed = nextVal.trim();\n const shouldMaintainHighlight = autoHighlightEnabled && trimmed !== '';\n maybeOpenOnInput(trimmed);\n if (open && store.state.activeIndex !== null && !shouldMaintainHighlight) {\n clearHighlight();\n }\n return;\n }\n const inputChangeDetails = createChangeEventDetails(REASONS.inputChange, nativeEvent);\n store.context.setInputValue(event.currentTarget.value, inputChangeDetails);\n if (inputChangeDetails.isCanceled) {\n return;\n }\n const empty = event.currentTarget.value === '';\n const clearDetails = createChangeEventDetails(REASONS.inputClear, nativeEvent);\n if (empty && !store.state.inputInsidePopup) {\n if (selectionMode === 'single') {\n store.context.setSelectedValue(null, clearDetails);\n }\n if (!store.state.openOnInputClick) {\n store.context.setOpen(false, clearDetails);\n }\n }\n maybeOpenOnInput(event.currentTarget.value.trim());\n\n // When the user types, ensure the list resets its highlight so that\n // virtual focus returns to the input (aria-activedescendant is\n // cleared).\n if (open && store.state.activeIndex !== null && !autoHighlightEnabled) {\n clearHighlight();\n }\n },\n onKeyDown(event) {\n if (event.ctrlKey || event.shiftKey || event.altKey || event.metaKey) {\n return;\n }\n\n // Tracked before the guards so `readOnly` browsing reports keyboard highlight reasons.\n store.context.keyboardActiveRef.current = true;\n if (disabled || readOnly) {\n // Browsing can highlight an item, and Enter there must not submit the form.\n if (readOnly && event.key === 'Enter' && open && store.state.activeIndex !== null) {\n stopEvent(event);\n }\n return;\n }\n const input = event.currentTarget;\n const scrollAmount = input.scrollWidth - input.clientWidth;\n const isRTL = direction === 'rtl';\n if (event.key === 'Home') {\n stopEvent(event);\n const cursor = platform.engine.gecko && isRTL ? input.value.length : 0;\n input.setSelectionRange(cursor, cursor);\n input.scrollLeft = 0;\n return;\n }\n if (event.key === 'End') {\n stopEvent(event);\n const cursor = platform.engine.gecko && isRTL ? 0 : input.value.length;\n input.setSelectionRange(cursor, cursor);\n input.scrollLeft = isRTL ? -scrollAmount : scrollAmount;\n return;\n }\n if (!mounted && event.key === 'Escape') {\n const isClear = selectionMode === 'multiple' && Array.isArray(selectedValue) ? selectedValue.length === 0 : selectedValue === null;\n const details = createChangeEventDetails(REASONS.escapeKey, event.nativeEvent);\n const value = selectionMode === 'multiple' ? [] : null;\n store.context.setInputValue('', details);\n store.context.setSelectedValue(value, details);\n if (!isClear && !store.state.inline && !details.isPropagationAllowed) {\n event.stopPropagation();\n }\n return;\n }\n\n // Handle deletion when no chip is highlighted and the input is empty.\n if (comboboxChipsContext && event.key === 'Backspace' && input.value === '' && comboboxChipsContext.highlightedChipIndex === undefined && Array.isArray(selectedValue) && selectedValue.length > 0) {\n const renderedChipsCount = comboboxChipsContext.chipsRef.current.length;\n const removalIndex = renderedChipsCount > 0 ? renderedChipsCount - 1 : selectedValue.length - 1;\n const newValue = selectedValue.filter((_, index) => index !== removalIndex);\n // If the removed item was also the active (highlighted) item, clear highlight\n clearHighlight();\n store.context.setSelectedValue(newValue, createChangeEventDetails(REASONS.none, event.nativeEvent));\n return;\n }\n const hadHighlightedChip = comboboxChipsContext?.highlightedChipIndex !== undefined;\n const nextIndex = handleKeyDown(event);\n comboboxChipsContext?.setHighlightedChipIndex(nextIndex);\n if (nextIndex !== undefined) {\n comboboxChipsContext?.chipsRef.current[nextIndex]?.focus();\n } else if (hadHighlightedChip) {\n store.context.inputRef.current?.focus();\n }\n\n // event.isComposing\n if (event.which === 229) {\n return;\n }\n if (event.key === 'Enter' && open) {\n const activeIndex = store.state.activeIndex;\n const nativeEvent = event.nativeEvent;\n if (activeIndex === null) {\n if (inline) {\n return;\n }\n\n // Allow form submission when no item is highlighted.\n store.context.setOpen(false, createChangeEventDetails(REASONS.none, nativeEvent));\n return;\n }\n stopEvent(event);\n clickHighlightedItem(store, activeIndex, nativeEvent);\n }\n },\n onPointerMove: markPointerActive,\n onPointerDown: markPointerActive\n }, validationProps],\n stateAttributesMapping: triggerStateAttributesMapping\n });\n const renderedInput = hasPositionerParent ? /*#__PURE__*/_jsx(FieldRootContext.Provider, {\n value: DEFAULT_FIELD_ROOT_CONTEXT,\n children: element\n }) : element;\n return /*#__PURE__*/_jsxs(React.Fragment, {\n children: [open && focusManagerModal && /*#__PURE__*/_jsx(ComboboxInternalDismissButton, {\n ref: store.context.startDismissRef\n }), renderedInput]\n });\n});\nif (process.env.NODE_ENV !== \"production\") ComboboxInput.displayName = \"ComboboxInput\";","import { isElement } from '@floating-ui/utils/dom';\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { getTarget, isInteractiveElement } from \"../../floating-ui-react/utils/element.mjs\";\nexport function handleInputPress(event, store, disabled, shouldIgnoreTarget) {\n if (event.baseUIHandlerPrevented) {\n return;\n }\n const target = getTarget(event.nativeEvent);\n const targetElement = isElement(target) ? target : null;\n if (targetElement !== event.currentTarget && (shouldIgnoreTarget?.(targetElement) || isInteractiveElement(targetElement))) {\n return;\n }\n event.preventDefault();\n if (disabled) {\n return;\n }\n store.context.inputRef.current?.focus();\n if (store.state.openOnInputClick) {\n store.context.setOpen(true, createChangeEventDetails(REASONS.inputPress, event.nativeEvent));\n }\n}","import { ownerWindow } from '@base-ui/utils/owner';\nimport { platform } from '@base-ui/utils/platform';\n// Tolerance around the element bounds so a fast click whose pointer drifts slightly\n// during press-release isn't mistaken for a drag-off-and-release cancellation.\n// Matches typical OS/browser drag-initiation thresholds.\nconst BOUNDARY_OFFSET = 5;\n\n/**\n * Determines if a mouse event occurred within the bounds of an element\n * (including its pseudo-elements), with a small tolerance for pointer drift.\n */\nexport function isMouseWithinBounds(event, element) {\n const bounds = getPseudoElementBounds(element);\n return event.clientX >= bounds.left - BOUNDARY_OFFSET && event.clientX <= bounds.right + BOUNDARY_OFFSET && event.clientY >= bounds.top - BOUNDARY_OFFSET && event.clientY <= bounds.bottom + BOUNDARY_OFFSET;\n}\nexport function getPseudoElementBounds(element) {\n const elementRect = element.getBoundingClientRect();\n const win = ownerWindow(element);\n\n // Avoid \"Not implemented: window.getComputedStyle(elt, pseudoElt)\" in jsdom.\n if (platform.env.jsdom) {\n return elementRect;\n }\n const beforeStyles = win.getComputedStyle(element, '::before');\n const afterStyles = win.getComputedStyle(element, '::after');\n const hasPseudoElements = beforeStyles.content !== 'none' || afterStyles.content !== 'none';\n if (!hasPseudoElements) {\n return elementRect;\n }\n\n // Get dimensions of pseudo-elements\n const beforeWidth = parseFloat(beforeStyles.width) || 0;\n const beforeHeight = parseFloat(beforeStyles.height) || 0;\n const afterWidth = parseFloat(afterStyles.width) || 0;\n const afterHeight = parseFloat(afterStyles.height) || 0;\n\n // Calculate max dimensions including pseudo-elements\n const totalWidth = Math.max(elementRect.width, beforeWidth, afterWidth);\n const totalHeight = Math.max(elementRect.height, beforeHeight, afterHeight);\n\n // Calculate the differences to extend the bounds\n const widthDiff = totalWidth - elementRect.width;\n const heightDiff = totalHeight - elementRect.height;\n return {\n left: elementRect.left - widthDiff / 2,\n right: elementRect.right + widthDiff / 2,\n top: elementRect.top - heightDiff / 2,\n bottom: elementRect.bottom + heightDiff / 2\n };\n}","'use client';\n\nimport * as React from 'react';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useTimeout } from '@base-ui/utils/useTimeout';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useButton } from \"../../internals/use-button/index.mjs\";\nimport { useComboboxFloatingContext, useComboboxInputValueContext, useComboboxRootContext } from \"../root/ComboboxRootContext.mjs\";\nimport { triggerStateAttributesMapping } from \"../utils/stateAttributesMapping.mjs\";\nimport { useFieldRootContext } from \"../../internals/field-root-context/FieldRootContext.mjs\";\nimport { useLabelableContext } from \"../../internals/labelable-provider/LabelableContext.mjs\";\nimport { stopEvent, contains, getTarget } from \"../../floating-ui-react/utils.mjs\";\nimport { isMouseWithinBounds } from \"../../utils/getPseudoElementBounds.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useClick, useTypeahead } from \"../../floating-ui-react/index.mjs\";\nimport { useLabelableId } from \"../../internals/labelable-provider/useLabelableId.mjs\";\nimport { resolveAriaLabelledBy } from \"../../utils/resolveAriaLabelledBy.mjs\";\nimport { getComboboxPopupId } from \"../root/utils/index.mjs\";\nimport { useListEmpty, usePopupSide } from \"../utils/parts.mjs\";\n\n/**\n * A button that opens the popup.\n * Renders a `<button>` element.\n *\n * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)\n */\nexport const ComboboxTrigger = /*#__PURE__*/React.forwardRef(function ComboboxTrigger(componentProps, forwardedRef) {\n const {\n render,\n className,\n nativeButton = true,\n disabled: disabledProp = false,\n id: idProp,\n style,\n ...elementProps\n } = componentProps;\n const {\n state: fieldState,\n disabled: fieldDisabled,\n setTouched,\n setFocused,\n validationMode,\n validation\n } = useFieldRootContext();\n const {\n labelId: fieldLabelId\n } = useLabelableContext();\n const store = useComboboxRootContext();\n const selectionMode = store.useState('selectionMode');\n const comboboxDisabled = store.useState('disabled');\n const readOnly = store.useState('readOnly');\n const required = store.useState('required');\n const positionerElement = store.useState('positionerElement');\n const listElement = store.useState('listElement');\n const storedPopupId = store.useState('popupId');\n const triggerProps = store.useState('triggerProps');\n const inputInsidePopup = store.useState('inputInsidePopup');\n const rootId = store.useState('id');\n const comboboxLabelId = store.useState('labelId');\n const open = store.useState('open');\n const selectedValue = store.useState('selectedValue');\n const activeIndex = store.useState('activeIndex');\n const selectedIndex = store.useState('selectedIndex');\n const hasSelectedValue = store.useState('hasSelectedValue');\n const floatingRootContext = useComboboxFloatingContext();\n const inputValue = useComboboxInputValueContext();\n const focusTimeout = useTimeout();\n const disabled = fieldDisabled || comboboxDisabled || disabledProp;\n const listEmpty = useListEmpty();\n const popupSide = usePopupSide(store);\n useLabelableId({\n id: inputInsidePopup ? idProp : undefined\n });\n const id = inputInsidePopup ? idProp ?? rootId : idProp;\n const ariaLabelledBy = resolveAriaLabelledBy(fieldLabelId, comboboxLabelId);\n let ariaControls;\n if (open && inputInsidePopup) {\n // Fall back to the default id while the popup registers its own (custom ids are stored once the\n // popup mounts), so `aria-controls` is set on the same commit `open` becomes `true`.\n ariaControls = storedPopupId ?? getComboboxPopupId(rootId);\n } else if (open) {\n ariaControls = listElement?.id;\n }\n const currentPointerTypeRef = React.useRef('');\n function trackPointerType(event) {\n currentPointerTypeRef.current = event.pointerType;\n }\n const {\n reference: triggerTypeaheadProps\n } = useTypeahead(floatingRootContext, {\n // Typeahead on a closed trigger commits a value rather than moving a highlight, so it stays\n // gated on `readOnly`.\n enabled: !open && !readOnly && !comboboxDisabled && selectionMode === 'single',\n listRef: store.context.labelsRef,\n activeIndex,\n selectedIndex,\n onMatch(index) {\n const nextSelectedValue = store.context.valuesRef.current[index];\n if (nextSelectedValue !== undefined) {\n store.context.setSelectedValue(nextSelectedValue, createChangeEventDetails(REASONS.none));\n }\n }\n });\n const {\n reference: triggerClickProps\n } = useClick(floatingRootContext, {\n enabled: !comboboxDisabled,\n event: 'mousedown'\n });\n const {\n buttonRef,\n getButtonProps\n } = useButton({\n native: nativeButton,\n disabled\n });\n const state = {\n ...fieldState,\n readOnly,\n open,\n disabled,\n popupSide,\n listEmpty,\n placeholder: selectionMode === 'none' ? false : !hasSelectedValue\n };\n const setTriggerElement = useStableCallback(element => {\n store.set('triggerElement', element);\n });\n const element = useRenderElement('button', componentProps, {\n ref: [forwardedRef, buttonRef, setTriggerElement],\n state,\n props: [triggerProps, triggerClickProps, triggerTypeaheadProps, {\n id,\n tabIndex: inputInsidePopup ? 0 : -1,\n role: inputInsidePopup ? 'combobox' : undefined,\n 'aria-expanded': open,\n 'aria-haspopup': inputInsidePopup ? 'dialog' : 'listbox',\n 'aria-controls': ariaControls,\n 'aria-required': inputInsidePopup ? required || undefined : undefined,\n // Only valid alongside the `combobox` role; without it the trigger is a plain button, and\n // the `Combobox.Input` outside the popup already carries `aria-readonly`.\n 'aria-readonly': inputInsidePopup ? readOnly || undefined : undefined,\n 'aria-labelledby': ariaLabelledBy,\n onPointerDown: trackPointerType,\n onPointerEnter: trackPointerType,\n onFocus() {\n setFocused(true);\n if (disabled) {\n return;\n }\n focusTimeout.start(0, store.context.forceMount);\n },\n onBlur(event) {\n // If focus is moving into the popup, don't count it as a blur.\n if (contains(positionerElement, event.relatedTarget)) {\n return;\n }\n setTouched(true);\n setFocused(false);\n if (validationMode === 'onBlur') {\n const valueToValidate = selectionMode === 'none' ? inputValue : selectedValue;\n validation.commit(valueToValidate);\n }\n },\n onMouseDown(event) {\n if (disabled) {\n return;\n }\n if (!inputInsidePopup) {\n floatingRootContext.set('domReferenceElement', event.currentTarget);\n }\n\n // Ensure items are registered for initial selection highlight.\n store.context.forceMount();\n if (currentPointerTypeRef.current !== 'touch') {\n store.context.inputRef.current?.focus();\n if (!inputInsidePopup) {\n event.preventDefault();\n }\n }\n if (open) {\n return;\n }\n const doc = ownerDocument(event.currentTarget);\n function handleMouseUp(mouseEvent) {\n const currentTriggerElement = store.state.triggerElement;\n if (!currentTriggerElement) {\n return;\n }\n const mouseUpTarget = getTarget(mouseEvent);\n const positioner = store.state.positionerElement;\n const list = store.state.listElement;\n if (contains(currentTriggerElement, mouseUpTarget) || contains(positioner, mouseUpTarget) || contains(list, mouseUpTarget)) {\n return;\n }\n if (isMouseWithinBounds(mouseEvent, currentTriggerElement)) {\n return;\n }\n store.context.setOpen(false, createChangeEventDetails(REASONS.cancelOpen, mouseEvent));\n }\n if (inputInsidePopup) {\n doc.addEventListener('mouseup', handleMouseUp, {\n once: true\n });\n }\n },\n onKeyDown(event) {\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n stopEvent(event);\n store.context.setOpen(true, createChangeEventDetails(REASONS.listNavigation, event.nativeEvent));\n store.context.inputRef.current?.focus();\n }\n }\n }, validation.getValidationProps(disabled, elementProps), getButtonProps],\n stateAttributesMapping: triggerStateAttributesMapping\n });\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") ComboboxTrigger.displayName = \"ComboboxTrigger\";","'use client';\n\nimport * as React from 'react';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst GroupCollectionContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") GroupCollectionContext.displayName = \"GroupCollectionContext\";\nexport function useGroupCollectionContext() {\n return React.useContext(GroupCollectionContext);\n}\nexport function GroupCollectionProvider(props) {\n const {\n children,\n items\n } = props;\n const contextValue = React.useMemo(() => ({\n items\n }), [items]);\n return /*#__PURE__*/_jsx(GroupCollectionContext.Provider, {\n value: contextValue,\n children: children\n });\n}","'use client';\n\nimport * as React from 'react';\nimport { useComboboxDerivedItemsContext } from \"../root/ComboboxRootContext.mjs\";\nimport { useGroupCollectionContext } from \"./GroupCollectionContext.mjs\";\n\n/**\n * Renders filtered list items.\n * Doesn't render its own HTML element.\n *\n * If rendering a flat list, pass a function child to the `List` component instead, which implicitly wraps it.\n *\n * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport function ComboboxCollection(props) {\n const {\n children\n } = props;\n const {\n filteredItems\n } = useComboboxDerivedItemsContext();\n const groupContext = useGroupCollectionContext();\n const itemsToRender = groupContext ? groupContext.items : filteredItems;\n return /*#__PURE__*/_jsx(React.Fragment, {\n children: itemsToRender.map(children)\n });\n}","'use client';\n\nimport * as React from 'react';\nexport const CompositeListContext = /*#__PURE__*/React.createContext({\n register: () => {},\n unregister: () => {},\n subscribeMapChange: () => () => {},\n nextIndexRef: {\n current: 0\n }\n});\nif (process.env.NODE_ENV !== \"production\") CompositeListContext.displayName = \"CompositeListContext\";\nexport function useCompositeListContext() {\n return React.useContext(CompositeListContext);\n}","/* eslint-disable no-bitwise */\n'use client';\n\nimport * as React from 'react';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { CompositeListContext } from \"./CompositeListContext.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * Provides context for a list of items in a composite component.\n */\nexport function CompositeList(props) {\n const {\n children,\n elementsRef,\n labelsRef,\n onMapChange: onMapChangeProp\n } = props;\n const onMapChange = useStableCallback(onMapChangeProp);\n const [, setMapTick] = React.useState(false);\n const listeners = useRefWithInit(createListeners).current;\n const map = useRefWithInit(createMap).current;\n const nextIndexRef = React.useRef(0);\n const isDirtyRef = React.useRef(true);\n const itemsRef = React.useRef(null);\n const mutationObserverRef = React.useRef(null);\n\n // Item effects can run without their parent rendering. Schedule one synchronous\n // parent update for the whole commit so refs are rebuilt before paint and while\n // the originating React event is still inside `act()` in tests.\n const scheduleMapUpdate = useStableCallback(() => {\n if (isDirtyRef.current) {\n return;\n }\n isDirtyRef.current = true;\n setMapTick(tick => !tick);\n });\n const register = useStableCallback((node, registration) => {\n map.set(node, registration);\n scheduleMapUpdate();\n });\n const unregister = useStableCallback(node => {\n map.delete(node);\n scheduleMapUpdate();\n });\n const syncRefs = useStableCallback(items => {\n const nextMap = new Map();\n elementsRef.current.length = 0;\n if (labelsRef) {\n labelsRef.current.length = 0;\n }\n items.forEach(item => {\n nextMap.set(item.element, {\n ...(item.registration.metadata ?? {}),\n index: item.index\n });\n elementsRef.current[item.index] = item.element;\n if (labelsRef) {\n labelsRef.current[item.index] = item.registration.label !== undefined ? item.registration.label : item.registration.textRef?.current?.textContent ?? item.element.textContent;\n }\n });\n nextIndexRef.current = elementsRef.current.length;\n return nextMap;\n });\n function observe(sortedNodes) {\n mutationObserverRef.current?.disconnect();\n mutationObserverRef.current = null;\n\n // A single item can't reorder.\n if (typeof MutationObserver !== 'function' || sortedNodes.length < 2) {\n return;\n }\n const mutationObserver = new MutationObserver(entries => {\n // Only verify the order after a move: a node that was removed and later\n // re-added within the same batch. Additions and removals alone can't\n // change the relative order of the remaining items, and items that mount\n // or unmount re-sort through `register`/`unregister`.\n if (!hasMovedNode(entries)) {\n return;\n }\n let previousConnectedNode = null;\n\n // If any connected node now appears before the previous connected node,\n // wrappers/items moved and the index map needs to be rebuilt.\n for (const node of sortedNodes) {\n if (!node.isConnected) {\n continue;\n }\n if (previousConnectedNode && sortByDocumentPosition(previousConnectedNode, node) > 0) {\n mutationObserver.disconnect();\n scheduleMapUpdate();\n return;\n }\n previousConnectedNode = node;\n }\n });\n mutationObserverRef.current = mutationObserver;\n\n // A reorder that changes item indexes must invert at least one adjacent pair\n // from the previous sorted order. Observing each pair's common parent catches\n // both direct item moves and ancestor wrapper moves at the boundary.\n const roots = new Set();\n for (let i = 1; i < sortedNodes.length; i += 1) {\n const root = getCommonAncestor(sortedNodes[i - 1], sortedNodes[i]);\n if (root) {\n roots.add(root);\n }\n }\n roots.forEach(root => mutationObserver.observe(root, {\n childList: true\n }));\n }\n const flush = useStableCallback(() => {\n const [items, automaticNodes] = getCompositeListSnapshot(map);\n const nextMap = syncRefs(items);\n const previousItems = itemsRef.current;\n const changed = !previousItems || previousItems.length !== items.length || items.some((item, index) => {\n const previousItem = previousItems[index];\n return item.index !== previousItem.index || item.element !== previousItem.element || item.registration.index !== previousItem.registration.index || item.registration.metadata !== previousItem.registration.metadata;\n });\n observe(automaticNodes);\n itemsRef.current = items;\n isDirtyRef.current = false;\n if (!changed) {\n return;\n }\n listeners.forEach(listener => listener(nextMap));\n onMapChange(nextMap);\n });\n useIsoLayoutEffect(() => {\n // Re-copy the last committed snapshot when the ref objects change or Strict Mode replays\n // effects without reattaching callback refs.\n if (!isDirtyRef.current && itemsRef.current) {\n syncRefs(itemsRef.current);\n }\n return () => {\n elementsRef.current = [];\n if (labelsRef) {\n labelsRef.current = [];\n }\n };\n }, [elementsRef, labelsRef, syncRefs]);\n useIsoLayoutEffect(() => {\n if (isDirtyRef.current) {\n flush();\n }\n });\n useIsoLayoutEffect(() => {\n return () => {\n mutationObserverRef.current?.disconnect();\n // React 18 Strict Mode replays effects without replaying callback refs.\n // Mark the retained map dirty so the replay rebuilds refs and observation.\n isDirtyRef.current = true;\n };\n }, []);\n const subscribeMapChange = useStableCallback(fn => {\n listeners.add(fn);\n return () => {\n listeners.delete(fn);\n };\n });\n const contextValue = React.useMemo(() => ({\n register,\n unregister,\n subscribeMapChange,\n nextIndexRef\n }), [register, unregister, subscribeMapChange, nextIndexRef]);\n return /*#__PURE__*/_jsx(CompositeListContext.Provider, {\n value: contextValue,\n children: children\n });\n}\nfunction createMap() {\n return new Map();\n}\nfunction createListeners() {\n return new Set();\n}\nfunction getCompositeListSnapshot(map) {\n const reservedIndices = new Set();\n const items = [];\n const automaticItems = [];\n map.forEach((registration, node) => {\n if (!node.isConnected) {\n return;\n }\n const index = registration.index;\n const item = {\n index: index ?? -1,\n element: node,\n registration\n };\n if (index === null) {\n automaticItems.push(item);\n } else if (index >= 0) {\n reservedIndices.add(index);\n items.push(item);\n }\n });\n let nextAutomaticIndex = 0;\n automaticItems.sort((a, b) => sortByDocumentPosition(a.element, b.element));\n automaticItems.forEach(item => {\n while (reservedIndices.has(nextAutomaticIndex)) {\n nextAutomaticIndex += 1;\n }\n item.index = nextAutomaticIndex;\n items.push(item);\n nextAutomaticIndex += 1;\n });\n if (reservedIndices.size > 0) {\n items.sort((a, b) => a.index - b.index);\n }\n return [items, automaticItems.map(item => item.element)];\n}\nfunction getCommonAncestor(firstNode, lastNode) {\n let ancestor = firstNode.parentElement;\n\n // The `parentElement` walk cannot cross shadow boundaries, so the native\n // `contains` is sufficient here.\n while (ancestor && !ancestor.contains(lastNode)) {\n ancestor = ancestor.parentElement;\n }\n return ancestor;\n}\nfunction hasMovedNode(entries) {\n for (const entry of entries) {\n for (let i = 0; i < entry.removedNodes.length; i += 1) {\n if (entry.removedNodes[i].isConnected) {\n return true;\n }\n }\n }\n return false;\n}\nfunction sortByDocumentPosition(a, b) {\n // `DOCUMENT_POSITION_CONTAINED_BY` is always reported alongside `FOLLOWING`, and `CONTAINS`\n // alongside `PRECEDING`, so testing `FOLLOWING` alone orders siblings and nested items alike.\n return a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;\n}","'use client';\n\nimport * as React from 'react';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useComboboxDerivedItemsContext, useComboboxFloatingContext, useComboboxRootContext } from \"../root/ComboboxRootContext.mjs\";\nimport { useComboboxPositionerContext } from \"../positioner/ComboboxPositionerContext.mjs\";\nimport { ComboboxCollection } from \"../collection/ComboboxCollection.mjs\";\nimport { CompositeList } from \"../../internals/composite/list/CompositeList.mjs\";\nimport { stopEvent } from \"../../floating-ui-react/utils.mjs\";\nimport { clickHighlightedItem } from \"../utils/parts.mjs\";\n\n/**\n * A list container for the items.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const ComboboxList = /*#__PURE__*/React.forwardRef(function ComboboxList(componentProps, forwardedRef) {\n var _ComboboxCollection;\n const {\n render,\n className,\n style,\n children,\n ...elementProps\n } = componentProps;\n const store = useComboboxRootContext();\n const floatingRootContext = useComboboxFloatingContext();\n const hasPositionerContext = Boolean(useComboboxPositionerContext(true));\n const {\n filteredItems,\n hasItems\n } = useComboboxDerivedItemsContext();\n const selectionMode = store.useState('selectionMode');\n const grid = store.useState('grid');\n const readOnly = store.useState('readOnly');\n const listProps = store.useState('listProps');\n const virtualized = store.useState('virtualized');\n const forceMounted = store.useState('forceMounted');\n const multiple = selectionMode === 'multiple';\n const empty = filteredItems.length === 0;\n const setPositionerElement = useStableCallback(element => {\n store.set('positionerElement', element);\n });\n const setListElement = useStableCallback(element => {\n store.set('listElement', element);\n });\n\n // Support \"closed template\" API: if children is a function, implicitly wrap it\n // with a Combobox.Collection that reads items from context/root.\n // Ensures this component's `listProps` subscription does not cause <Combobox.Item>\n // to re-render on every active index change.\n const resolvedChildren = React.useMemo(() => {\n if (typeof children === 'function') {\n return _ComboboxCollection || (_ComboboxCollection = /*#__PURE__*/_jsx(ComboboxCollection, {\n children: children\n }));\n }\n return children;\n }, [children]);\n const state = {\n empty\n };\n const floatingId = floatingRootContext.useState('floatingId');\n const element = useRenderElement('div', componentProps, {\n state,\n ref: [forwardedRef, setListElement, hasPositionerContext ? null : setPositionerElement],\n props: [listProps, {\n children: resolvedChildren,\n tabIndex: -1,\n id: floatingId,\n role: grid ? 'grid' : 'listbox',\n 'aria-multiselectable': multiple ? 'true' : undefined,\n // On a grid the attribute describes cell editability, not selection, so it's left to the\n // combobox element in that mode.\n 'aria-readonly': !grid && readOnly ? true : undefined,\n onKeyDown(event) {\n if (store.state.disabled || store.state.readOnly) {\n return;\n }\n if (event.key === 'Enter') {\n const activeIndex = store.state.activeIndex;\n if (activeIndex == null) {\n // Allow form submission when no item is highlighted.\n return;\n }\n stopEvent(event);\n clickHighlightedItem(store, activeIndex, event.nativeEvent);\n }\n },\n onKeyDownCapture() {\n store.context.keyboardActiveRef.current = true;\n },\n onPointerMoveCapture() {\n store.context.keyboardActiveRef.current = false;\n }\n }, elementProps]\n });\n if (virtualized) {\n return element;\n }\n\n // With the `items` prop, typeahead labels are derived from the items so they survive the list\n // unmounting (unmounting clears the registered labels). Rendered labels only need to be\n // registered when the list is force-mounted to match browser autofill against rendered text.\n const labelsRef = hasItems && !forceMounted ? undefined : store.context.labelsRef;\n return /*#__PURE__*/_jsx(CompositeList, {\n elementsRef: store.context.listRef,\n labelsRef: labelsRef,\n children: element\n });\n});\nif (process.env.NODE_ENV !== \"production\") ComboboxList.displayName = \"ComboboxList\";","'use client';\n\nimport * as React from 'react';\nimport { platform } from '@base-ui/utils/platform';\nimport { useTimeout } from '@base-ui/utils/useTimeout';\n\n// Word Joiner is invisible and zero-width, so it forces a text mutation without shifting layout.\nconst LIVE_REGION_MARKER = '\\u2060';\n// Safari VoiceOver needed roughly 200ms to reliably notice the initial polite live-region change.\nexport const INITIAL_LIVE_REGION_TEXT_MUTATION_RESET_DELAY = 200;\nfunction findLastTextNode(root) {\n const walker = root.ownerDocument.createTreeWalker(root, NodeFilter.SHOW_TEXT);\n let lastTextNode = null;\n while (walker.nextNode()) {\n const textNode = walker.currentNode;\n if (textNode.nodeValue !== '') {\n lastTextNode = textNode;\n }\n }\n return lastTextNode;\n}\nexport function useInitialLiveRegionTextMutation() {\n const timeout = useTimeout();\n const rootRef = React.useRef(null);\n\n // Only the initial mounted announcement needs the marker; later text updates announce naturally.\n React.useEffect(() => {\n if (platform.os.ios) {\n return undefined;\n }\n const root = rootRef.current;\n if (root == null) {\n return undefined;\n }\n const textNode = findLastTextNode(root);\n if (textNode == null) {\n return undefined;\n }\n const originalValue = textNode.data;\n const markedValue = `${originalValue}${LIVE_REGION_MARKER}`;\n textNode.nodeValue = markedValue;\n timeout.start(INITIAL_LIVE_REGION_TEXT_MUTATION_RESET_DELAY, () => {\n if (textNode.nodeValue === markedValue) {\n textNode.nodeValue = originalValue;\n }\n });\n return () => {\n timeout.clear();\n if (textNode.nodeValue === markedValue) {\n textNode.nodeValue = originalValue;\n }\n };\n }, [rootRef, timeout]);\n return rootRef;\n}","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const ComboboxPortalContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") ComboboxPortalContext.displayName = \"ComboboxPortalContext\";\nexport function useComboboxPortalContext() {\n const context = React.useContext(ComboboxPortalContext);\n if (context === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: <Combobox.Portal> is missing.' : _formatErrorMessage(20));\n }\n return context;\n}","'use client';\n\nimport * as React from 'react';\nimport { FloatingPortal } from \"../../floating-ui-react/index.mjs\";\nimport { useComboboxRootContext } from \"../root/ComboboxRootContext.mjs\";\nimport { ComboboxPortalContext } from \"./ComboboxPortalContext.mjs\";\n\n/**\n * A portal element that moves the popup to a different part of the DOM.\n * By default, the portal element is appended to `<body>`.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const ComboboxPortal = /*#__PURE__*/React.forwardRef(function ComboboxPortal(props, forwardedRef) {\n const {\n keepMounted = false,\n ...portalProps\n } = props;\n const store = useComboboxRootContext();\n const mounted = store.useState('mounted');\n const forceMounted = store.useState('forceMounted');\n const shouldRender = mounted || keepMounted || forceMounted;\n if (!shouldRender) {\n return null;\n }\n return /*#__PURE__*/_jsx(ComboboxPortalContext.Provider, {\n value: keepMounted,\n children: /*#__PURE__*/_jsx(FloatingPortal, {\n ref: forwardedRef,\n ...portalProps\n })\n });\n});\nif (process.env.NODE_ENV !== \"production\") ComboboxPortal.displayName = \"ComboboxPortal\";","import { isReactVersionAtLeast } from \"./reactVersion.mjs\";\nexport function inertValue(value) {\n if (isReactVersionAtLeast(19)) {\n return value;\n }\n // compatibility with React < 19\n return value ? 'true' : undefined;\n}","import { clamp, evaluate, getAlignment, getAlignmentAxis, getAxisLength, getPaddingObject } from '@floating-ui/utils';\n/**\n * Fork of the original `arrow` middleware from Floating UI that allows\n * configuring the offset parent.\n */\nexport const baseArrow = options => ({\n name: 'arrow',\n options,\n async fn(state) {\n const {\n x,\n y,\n placement,\n rects,\n platform,\n elements,\n middlewareData\n } = state;\n // Since `element` is required, we don't Partial<> the type.\n const {\n element,\n padding = 0,\n offsetParent = 'real'\n } = evaluate(options, state) || {};\n if (element == null) {\n return {};\n }\n const paddingObject = getPaddingObject(padding);\n const coords = {\n x,\n y\n };\n const axis = getAlignmentAxis(placement);\n const length = getAxisLength(axis);\n const arrowDimensions = await platform.getDimensions(element);\n const isYAxis = axis === 'y';\n const minProp = isYAxis ? 'top' : 'left';\n const maxProp = isYAxis ? 'bottom' : 'right';\n const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';\n const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];\n const startDiff = coords[axis] - rects.reference[axis];\n const arrowOffsetParent = offsetParent === 'real' ? await platform.getOffsetParent?.(element) : elements.floating;\n let clientSize = elements.floating[clientProp] || rects.floating[length];\n\n // DOM platform can return `window` as the `offsetParent`.\n if (!clientSize || !(await platform.isElement?.(arrowOffsetParent))) {\n clientSize = elements.floating[clientProp] || rects.floating[length];\n }\n const centerToReference = endDiff / 2 - startDiff / 2;\n\n // If the padding is large enough that it causes the arrow to no longer be\n // centered, modify the padding so that it is centered.\n const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;\n const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding);\n const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding);\n\n // Make sure the arrow doesn't overflow the floating element if the center\n // point is outside the floating element's bounds.\n const min = minPadding;\n const max = clientSize - arrowDimensions[length] - maxPadding;\n const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;\n const offset = clamp(min, center, max);\n\n // If the reference is small enough that the arrow's padding causes it to\n // to point to nothing for an aligned placement, adjust the offset of the\n // floating element itself. To ensure `shift()` continues to take action,\n // a single reset is performed when this is true.\n const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;\n // eslint-disable-next-line no-nested-ternary\n const alignmentOffset = shouldAddOffset ? center < min ? center - min : center - max : 0;\n return {\n [axis]: coords[axis] + alignmentOffset,\n data: {\n [axis]: offset,\n centerOffset: center - offset - alignmentOffset,\n ...(shouldAddOffset && {\n alignmentOffset\n })\n },\n reset: shouldAddOffset\n };\n }\n});\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * This wraps the core `arrow` middleware to allow React refs as the element.\n * @see https://floating-ui.com/docs/arrow\n */\nexport const arrow = (options, deps) => {\n const {\n name,\n fn\n } = baseArrow(options);\n return {\n name,\n fn,\n options: [options, deps]\n };\n};","export const hide = {\n name: 'hide',\n async fn(state) {\n const {\n width,\n height,\n x,\n y\n } = state.rects.reference;\n const anchorHidden = width === 0 && height === 0 && x === 0 && y === 0;\n // Mirrors Floating UI's `hide()` referenceHidden strategy. Floating UI injects\n // `detectOverflow` into the middleware platform before invoking middleware.\n const overflow = await state.platform.detectOverflow(state, {\n elementContext: 'reference'\n });\n const referenceHidden = overflow.top - height >= 0 || overflow.right - width >= 0 || overflow.bottom - height >= 0 || overflow.left - width >= 0;\n return {\n data: {\n referenceHidden: referenceHidden || anchorHidden\n }\n };\n }\n};","export const DEFAULT_SIDES = {\n sideX: 'left',\n sideY: 'top'\n};\n\n// Self-contained stand-in for Floating UI's `Middleware` type. Referencing the real type in\n// store state makes `tsc` declaration emit reference `Platform`/`detectOverflow` from\n// `@floating-ui/core` internals, which fails as non-portable (TS2883) in consuming builds.","/**\n * The available width between the trigger and the edge of the viewport.\n * @type {number}\n */\nexport const availableWidth = '--available-width';\n/**\n * The available height between the trigger and the edge of the viewport.\n * @type {number}\n */\nexport const availableHeight = '--available-height';\n/**\n * The anchor's width.\n * @type {number}\n */\nexport const anchorWidth = '--anchor-width';\n/**\n * The anchor's height.\n * @type {number}\n */\nexport const anchorHeight = '--anchor-height';\n/**\n * The coordinates that this element is anchored to. Used for animations and transitions.\n * @type {string}\n */\nexport const transformOrigin = '--transform-origin';\n/**\n * The width of the popup's positioner.\n * It is important to set `width` to this value when using CSS to animate size changes.\n * @type {number}\n */\nexport const positionerWidth = '--positioner-width';\n/**\n * The height of the popup's positioner.\n * It is important to set `height` to this value when using CSS to animate size changes.\n * @type {number}\n */\nexport const positionerHeight = '--positioner-height';","'use client';\n\nimport * as React from 'react';\nimport { getSide, getAlignment, getSideAxis } from '@floating-ui/utils';\nimport { ownerDocument, ownerWindow } from '@base-ui/utils/owner';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { autoUpdate, flip, limitShift, offset, shift as floatingShift, size } from \"../floating-ui-react/index.mjs\";\nimport { useBaseUIFloating } from \"../floating-ui-react/hooks/useFloating.mjs\";\nimport { useDirection } from \"./direction-context/DirectionContext.mjs\";\nimport { arrow } from \"../floating-ui-react/middleware/arrow.mjs\";\nimport { hide } from \"../utils/hideMiddleware.mjs\";\nimport { DEFAULT_SIDES } from \"../utils/adaptiveOriginConstants.mjs\";\nimport * as CommonPositionerCssVars from \"../utils/CommonPositionerCssVars.mjs\";\nconst AVAILABLE_WIDTH_VAR = CommonPositionerCssVars.availableWidth;\nconst AVAILABLE_HEIGHT_VAR = CommonPositionerCssVars.availableHeight;\nfunction getLogicalSide(sideParam, renderedSide, isRtl) {\n const isLogicalSideParam = sideParam === 'inline-start' || sideParam === 'inline-end';\n const logicalRight = isRtl ? 'inline-start' : 'inline-end';\n const logicalLeft = isRtl ? 'inline-end' : 'inline-start';\n return {\n top: 'top',\n right: isLogicalSideParam ? logicalRight : 'right',\n bottom: 'bottom',\n left: isLogicalSideParam ? logicalLeft : 'left'\n }[renderedSide];\n}\nfunction getOffsetData(state, sideParam, isRtl) {\n const {\n rects,\n placement\n } = state;\n const data = {\n side: getLogicalSide(sideParam, getSide(placement), isRtl),\n align: getAlignment(placement) || 'center',\n anchor: {\n width: rects.reference.width,\n height: rects.reference.height\n },\n positioner: {\n width: rects.floating.width,\n height: rects.floating.height\n }\n };\n return data;\n}\n/**\n * Provides standardized anchor positioning behavior for floating elements. Wraps Floating UI's\n * `useFloating` hook.\n */\nexport function useAnchorPositioning(params) {\n return useAnchorPositioningWithHook(params, useBaseUIFloating);\n}\nexport function useAnchorPositioningWithHook(params, useFloatingHook) {\n const {\n // Public parameters\n anchor,\n positionMethod = 'absolute',\n side: sideParam = 'bottom',\n sideOffset = 0,\n align = 'center',\n alignOffset = 0,\n collisionBoundary,\n collisionPadding: collisionPaddingParam = 5,\n sticky = false,\n arrowPadding = 5,\n disableAnchorTracking = false,\n inline: inlineMiddleware,\n // Private parameters\n keepMounted = false,\n floatingRootContext,\n mounted,\n collisionAvoidance,\n shift,\n nodeId,\n adaptiveOrigin,\n lazyFlip = false,\n externalTree\n } = params;\n const [mountSide, setMountSide] = React.useState(null);\n if (!mounted && mountSide !== null) {\n setMountSide(null);\n }\n const collisionAvoidanceSide = collisionAvoidance.side || 'flip';\n const collisionAvoidanceAlign = collisionAvoidance.align || 'flip';\n const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || 'end';\n const shiftCrossAxis = shift?.crossAxis ?? false;\n const shiftRootBoundary = shift?.rootBoundary;\n const anchorFn = typeof anchor === 'function' ? anchor : undefined;\n const anchorFnCallback = useStableCallback(anchorFn);\n const anchorDep = anchorFn ? anchorFnCallback : anchor;\n const anchorValueRef = useValueAsRef(anchor);\n const mountedRef = useValueAsRef(mounted);\n const direction = useDirection();\n const isRtl = direction === 'rtl';\n const side = mountSide || {\n top: 'top',\n right: 'right',\n bottom: 'bottom',\n left: 'left',\n 'inline-end': isRtl ? 'left' : 'right',\n 'inline-start': isRtl ? 'right' : 'left'\n }[sideParam];\n const placement = align === 'center' ? side : `${side}-${align}`;\n let collisionPadding = collisionPaddingParam;\n if (typeof collisionPadding === 'number') {\n collisionPadding = {\n top: collisionPadding,\n right: collisionPadding,\n bottom: collisionPadding,\n left: collisionPadding\n };\n } else if (collisionPadding) {\n collisionPadding = {\n top: collisionPadding.top || 0,\n right: collisionPadding.right || 0,\n bottom: collisionPadding.bottom || 0,\n left: collisionPadding.left || 0\n };\n }\n\n // Create a bias to the preferred side.\n // On iOS, when the mobile software keyboard opens, the input is exactly centered\n // in the viewport, but this can cause it to flip to the top undesirably.\n // The bias is only applied to `flip()` so it doesn't shift the resting position\n // computed by `shift()` and `size()` away from the requested `collisionPadding`.\n const bias = 1;\n const biasTop = sideParam === 'bottom' ? bias : 0;\n const biasBottom = sideParam === 'top' ? bias : 0;\n const biasLeft = sideParam === 'right' ? bias : 0;\n const biasRight = sideParam === 'left' ? bias : 0;\n const commonCollisionProps = {\n boundary: collisionBoundary === 'clipping-ancestors' ? 'clippingAncestors' : collisionBoundary,\n padding: collisionPadding\n };\n\n // Using a ref assumes that the arrow element is always present in the DOM for the lifetime of the\n // popup. If this assumption ends up being false, we can switch to state to manage the arrow's\n // presence.\n const arrowRef = React.useRef(null);\n\n // Keep these reactive if they're not functions\n const sideOffsetRef = useValueAsRef(sideOffset);\n const alignOffsetRef = useValueAsRef(alignOffset);\n const sideOffsetDep = typeof sideOffset !== 'function' ? sideOffset : 0;\n const alignOffsetDep = typeof alignOffset !== 'function' ? alignOffset : 0;\n const middleware = [];\n if (inlineMiddleware) {\n middleware.push(inlineMiddleware);\n }\n middleware.push(offset(state => {\n const data = getOffsetData(state, sideParam, isRtl);\n const sideAxis = typeof sideOffsetRef.current === 'function' ? sideOffsetRef.current(data) : sideOffsetRef.current;\n const alignAxis = typeof alignOffsetRef.current === 'function' ? alignOffsetRef.current(data) : alignOffsetRef.current;\n return {\n mainAxis: sideAxis,\n crossAxis: alignAxis,\n alignmentAxis: alignAxis\n };\n }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam]));\n const shiftDisabled = collisionAvoidanceAlign === 'none' && collisionAvoidanceSide !== 'shift';\n const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === 'shift');\n const flipMiddleware = collisionAvoidanceSide === 'none' ? null : flip({\n ...commonCollisionProps,\n // Ensure the popup flips if it's been limited by its --available-height and it resizes.\n // Since the size() padding is smaller than the flip() padding, flip() will take precedence.\n padding: {\n top: collisionPadding.top + bias + biasTop,\n right: collisionPadding.right + bias + biasRight,\n bottom: collisionPadding.bottom + bias + biasBottom,\n left: collisionPadding.left + bias + biasLeft\n },\n mainAxis: !shiftCrossAxis && collisionAvoidanceSide === 'flip',\n crossAxis: collisionAvoidanceAlign === 'flip' ? 'alignment' : false,\n fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide\n });\n const shiftMiddleware = shiftDisabled ? null : floatingShift({\n ...commonCollisionProps,\n // Use the Layout Viewport to avoid shifting around when pinch-zooming.\n rootBoundary: shiftRootBoundary,\n mainAxis: collisionAvoidanceAlign !== 'none',\n crossAxis: crossAxisShiftEnabled,\n limiter: sticky || shiftCrossAxis ? undefined : limitShift(limitData => {\n if (!arrowRef.current) {\n return {};\n }\n const {\n width,\n height\n } = arrowRef.current.getBoundingClientRect();\n const sideAxis = getSideAxis(getSide(limitData.placement));\n const arrowSize = sideAxis === 'y' ? width : height;\n const offsetAmount = sideAxis === 'y' ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom;\n return {\n offset: arrowSize / 2 + offsetAmount / 2\n };\n })\n }, [commonCollisionProps, sticky, shiftCrossAxis, shiftRootBoundary, collisionPadding, collisionAvoidanceAlign]);\n\n // https://floating-ui.com/docs/flip#combining-with-shift\n if (collisionAvoidanceSide === 'shift' || collisionAvoidanceAlign === 'shift' || align === 'center') {\n middleware.push(shiftMiddleware, flipMiddleware);\n } else {\n middleware.push(flipMiddleware, shiftMiddleware);\n }\n middleware.push(size({\n ...commonCollisionProps,\n apply({\n elements: {\n floating\n },\n availableWidth,\n availableHeight,\n rects\n }) {\n if (!mountedRef.current) {\n return;\n }\n const floatingStyle = floating.style;\n floatingStyle.setProperty(AVAILABLE_WIDTH_VAR, `${availableWidth}px`);\n floatingStyle.setProperty(AVAILABLE_HEIGHT_VAR, `${availableHeight}px`);\n\n // Snap anchor dimensions to device pixels to ensure the popup's visual width matches the anchor's one.\n const dpr = ownerWindow(floating).devicePixelRatio || 1;\n const {\n x,\n y,\n width,\n height\n } = rects.reference;\n const anchorWidth = (Math.round((x + width) * dpr) - Math.round(x * dpr)) / dpr;\n const anchorHeight = (Math.round((y + height) * dpr) - Math.round(y * dpr)) / dpr;\n floatingStyle.setProperty(CommonPositionerCssVars.anchorWidth, `${anchorWidth}px`);\n floatingStyle.setProperty(CommonPositionerCssVars.anchorHeight, `${anchorHeight}px`);\n }\n }), arrow(state => ({\n // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set,\n // we'll create a fake element.\n element: arrowRef.current || ownerDocument(state.elements.floating).createElement('div'),\n // No padding for the fake arrow: it would displace aligned popups on narrow anchors.\n padding: arrowRef.current ? arrowPadding : 0,\n offsetParent: 'floating'\n }), [arrowPadding]), {\n name: 'transformOrigin',\n fn(state) {\n const {\n elements: {\n floating\n },\n middlewareData,\n placement: renderedPlacement,\n platform,\n rects,\n y\n } = state;\n const renderedSide = getSide(renderedPlacement);\n const renderedAlign = getAlignment(renderedPlacement);\n const isVertical = getSideAxis(renderedSide) === 'y';\n const arrowEl = arrowRef.current;\n const sideOffsetValue = typeof sideOffset === 'function' ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset;\n\n // An aligned arrowless popup grows from its aligned edge, until a shift (beyond subpixel)\n // breaks its alignment with the anchor. Everything else grows from the arrow, real or fake.\n let crossOrigin;\n if (!arrowEl && renderedAlign && Math.abs(isVertical ? middlewareData.shift?.x || 0 : middlewareData.shift?.y || 0) <= 1) {\n // The platform direction, not `isRtl`: it must match what Floating UI placed with.\n crossOrigin = renderedAlign === 'start' === (isVertical && platform.isRTL?.(floating) === true) ? '100%' : '0%';\n } else {\n const arrowOffset = isVertical ? middlewareData.arrow?.x || 0 : middlewareData.arrow?.y || 0;\n const arrowSize = isVertical ? arrowEl?.clientWidth || 0 : arrowEl?.clientHeight || 0;\n crossOrigin = `${arrowOffset + arrowSize / 2}px`;\n }\n\n // Side axis: the anchor-facing edge, or the anchor's center when the popup overlaps it.\n let sideOrigin = renderedSide === 'top' || renderedSide === 'left' ? `calc(100% + ${sideOffsetValue}px)` : `${-sideOffsetValue}px`;\n if (crossAxisShiftEnabled && isVertical && Math.abs(middlewareData.shift?.y || 0) > sideOffsetValue) {\n sideOrigin = `${rects.reference.y + rects.reference.height / 2 - y}px`;\n }\n floating.style.setProperty(CommonPositionerCssVars.transformOrigin, isVertical ? `${crossOrigin} ${sideOrigin}` : `${sideOrigin} ${crossOrigin}`);\n return {};\n }\n }, hide, adaptiveOrigin);\n useIsoLayoutEffect(() => {\n // Ensure positioning doesn't run initially for `keepMounted` elements that\n // aren't initially open.\n if (!mounted && floatingRootContext) {\n floatingRootContext.update({\n referenceElement: null,\n floatingElement: null,\n domReferenceElement: null,\n positionReference: null\n });\n }\n }, [mounted, floatingRootContext]);\n const autoUpdateOptions = React.useMemo(() => ({\n ancestorScroll: !disableAnchorTracking,\n elementResize: !disableAnchorTracking && typeof ResizeObserver !== 'undefined',\n layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== 'undefined'\n }), [disableAnchorTracking]);\n const {\n refs,\n elements,\n x,\n y,\n middlewareData,\n update,\n placement: renderedPlacement,\n context,\n isPositioned,\n floatingStyles: originalFloatingStyles\n } = useFloatingHook({\n rootContext: floatingRootContext,\n open: keepMounted ? mounted : undefined,\n placement,\n middleware,\n strategy: positionMethod,\n whileElementsMounted: keepMounted ? undefined : (...args) => autoUpdate(...args, autoUpdateOptions),\n nodeId,\n externalTree\n });\n const {\n sideX,\n sideY\n } = middlewareData.adaptiveOrigin || DEFAULT_SIDES;\n\n // Default to `fixed` when not positioned to prevent `autoFocus` scroll jumps.\n // This ensures the popup is inside the viewport initially before it gets positioned.\n const resolvedPosition = isPositioned ? positionMethod : 'fixed';\n const floatingStyles = React.useMemo(() => {\n let base;\n if (!isPositioned) {\n // Until a position for the current open is computed, ignore any coordinates retained from a\n // previous open (or from a pass that measured the hidden popup as 0x0). Rendering the\n // full-size popup at such stale coordinates can overflow the layout viewport, which makes\n // mobile Chrome zoom the page out and reflow everything the popup is anchored to.\n base = {\n position: resolvedPosition,\n top: 0,\n left: 0\n };\n } else if (adaptiveOrigin) {\n base = {\n position: resolvedPosition,\n [sideX]: x,\n [sideY]: y\n };\n } else {\n base = {\n ...originalFloatingStyles,\n position: resolvedPosition\n };\n }\n\n // Seed the available size vars so consumer `max-height: min(x, var(--available-height))` rules\n // resolve to a valid length on the first positioning pass, before `size()` writes the real\n // values. Without a fallback the unresolved `var()` invalidates the whole declaration, so the\n // popup is measured unconstrained while `flip()` picks its side, against the full content\n // height rather than the capped one. Seeded unconditionally (not only while `!isPositioned`):\n // the keys must stay present with a constant value so React's per-property style diff never\n // rewrites them after mount, preserving the px values `size()` sets imperatively. Moving them\n // into the `!isPositioned` branch makes React remove them once positioned, wiping `size()`'s\n // values and leaving the popup unconstrained.\n base[AVAILABLE_WIDTH_VAR] = '100vw';\n base[AVAILABLE_HEIGHT_VAR] = '100vh';\n if (!isPositioned) {\n base.opacity = 0;\n }\n return base;\n }, [adaptiveOrigin, resolvedPosition, sideX, x, sideY, y, originalFloatingStyles, isPositioned]);\n const registeredPositionReferenceRef = React.useRef(null);\n useIsoLayoutEffect(() => {\n if (!mounted) {\n return;\n }\n const anchorValue = anchorValueRef.current;\n const resolvedAnchor = typeof anchorValue === 'function' ? anchorValue() : anchorValue;\n const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null;\n const finalAnchor = unwrappedElement || null;\n if (finalAnchor !== registeredPositionReferenceRef.current) {\n refs.setPositionReference(finalAnchor);\n registeredPositionReferenceRef.current = finalAnchor;\n }\n }, [mounted, refs, anchorDep, anchorValueRef]);\n React.useEffect(() => {\n if (!mounted) {\n return;\n }\n const anchorValue = anchorValueRef.current;\n\n // Refs from parent components are set after useLayoutEffect runs and are available in useEffect.\n // Therefore, if the anchor is a ref, we need to update the position reference in useEffect.\n if (typeof anchorValue === 'function') {\n return;\n }\n if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) {\n refs.setPositionReference(anchorValue.current);\n registeredPositionReferenceRef.current = anchorValue.current;\n }\n }, [mounted, refs, anchorDep, anchorValueRef]);\n React.useEffect(() => {\n if (keepMounted && mounted && elements.reference && elements.floating) {\n return autoUpdate(elements.reference, elements.floating, update, autoUpdateOptions);\n }\n return undefined;\n }, [keepMounted, mounted, elements, update, autoUpdateOptions]);\n const renderedSide = getSide(renderedPlacement);\n const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl);\n const renderedAlign = getAlignment(renderedPlacement) || 'center';\n const anchorHidden = Boolean(middlewareData.hide?.referenceHidden);\n\n // Locks the flip (makes it \"sticky\") so it doesn't prefer a given placement\n // and flips back lazily, not eagerly. Ideal for filtered lists that change\n // the size of the popup dynamically to avoid unwanted flipping when typing.\n useIsoLayoutEffect(() => {\n if (lazyFlip && mounted && isPositioned && renderedSide !== side) {\n setMountSide(renderedSide);\n }\n }, [lazyFlip, mounted, isPositioned, renderedSide, side]);\n const arrowStyles = React.useMemo(() => ({\n position: 'absolute',\n top: middlewareData.arrow?.y,\n left: middlewareData.arrow?.x\n }), [middlewareData.arrow]);\n const arrowUncentered = middlewareData.arrow?.centerOffset !== 0;\n return React.useMemo(() => ({\n positionerStyles: floatingStyles,\n arrowStyles,\n arrowRef,\n arrowUncentered,\n side: logicalRenderedSide,\n align: renderedAlign,\n physicalSide: renderedSide,\n anchorHidden,\n refs,\n context,\n isPositioned,\n update\n }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden, refs, context, isPositioned, update]);\n}\nfunction isRef(param) {\n return param != null && 'current' in param;\n}","import * as React from 'react';\n\n/**\n * @internal\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const InternalBackdrop = /*#__PURE__*/React.forwardRef(function InternalBackdrop(props, ref) {\n const {\n cutout,\n ...otherProps\n } = props;\n let clipPath;\n if (cutout) {\n const rect = cutout.getBoundingClientRect();\n clipPath = `polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${rect.left}px ${rect.top}px,${rect.left}px ${rect.bottom}px,${rect.right}px ${rect.bottom}px,${rect.right}px ${rect.top}px,${rect.left}px ${rect.top}px)`;\n }\n return /*#__PURE__*/_jsx(\"div\", {\n ref: ref,\n role: \"presentation\"\n // Ensures Floating UI's outside press detection runs, as it considers\n // it an element that existed when the popup rendered.\n ,\n \"data-base-ui-inert\": \"\",\n ...otherProps,\n style: {\n position: 'fixed',\n inset: 0,\n userSelect: 'none',\n WebkitUserSelect: 'none',\n clipPath\n }\n });\n});\nif (process.env.NODE_ENV !== \"production\") InternalBackdrop.displayName = \"InternalBackdrop\";","import { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { DISABLED_TRANSITIONS_STYLE } from \"./constants.mjs\";\nexport function getDisabledMountTransitionStyles(transitionStatus) {\n return transitionStatus === 'starting' ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT;\n}","'use client';\n\nimport { popupStateMapping } from \"./popupStateMapping.mjs\";\nimport { useRenderElement } from \"../internals/useRenderElement.mjs\";\nimport { getDisabledMountTransitionStyles } from \"../internals/getDisabledMountTransitionStyles.mjs\";\n/**\n * Renders the shared outer Positioner element used by popup components.\n * Applies the common role, hidden state, transition styles, state attributes, and optional inert styling.\n */\nexport function usePositioner(componentProps, state, {\n styles,\n transitionStatus,\n props,\n refs,\n hidden,\n inert = false\n}) {\n const style = {\n ...styles\n };\n if (inert) {\n style.pointerEvents = 'none';\n }\n return useRenderElement('div', componentProps, {\n state,\n ref: refs,\n props: [{\n role: 'presentation',\n hidden,\n style\n }, getDisabledMountTransitionStyles(transitionStatus), props],\n stateAttributesMapping: popupStateMapping\n });\n}","'use client';\n\nimport { isOverflowElement } from '@floating-ui/utils/dom';\nimport { addEventListener } from \"./addEventListener.mjs\";\nimport { platform } from \"./platform/index.mjs\";\nimport { ownerDocument, ownerWindow } from \"./owner.mjs\";\nimport { useIsoLayoutEffect } from \"./useIsoLayoutEffect.mjs\";\nimport { Timeout } from \"./useTimeout.mjs\";\nimport { AnimationFrame } from \"./useAnimationFrame.mjs\";\nlet originalHtmlStyles = {};\nlet originalBodyStyles = {};\nlet originalHtmlScrollBehavior = '';\n\n// The viewport's overflow comes from <html> when it establishes its own scroll container, and\n// propagates from <body> otherwise. An `overflow` style on the other element doesn't lock the page.\nfunction getViewportScroller(html, body) {\n return isOverflowElement(html) ? html : body;\n}\nfunction isPageScrollLocked(win, html, body) {\n return /hidden|clip/.test(win.getComputedStyle(getViewportScroller(html, body)).overflowY);\n}\nfunction hasInsetScrollbars(referenceElement) {\n if (typeof document === 'undefined') {\n return false;\n }\n const doc = ownerDocument(referenceElement);\n const win = ownerWindow(doc);\n return win.innerWidth - doc.documentElement.clientWidth > 0;\n}\nfunction supportsStableScrollbarGutter(referenceElement) {\n const supported = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('scrollbar-gutter', 'stable');\n if (!supported || typeof document === 'undefined') {\n return false;\n }\n const doc = ownerDocument(referenceElement);\n const html = doc.documentElement;\n const body = doc.body;\n const scrollContainer = getViewportScroller(html, body);\n const originalScrollContainerOverflowY = scrollContainer.style.overflowY;\n const originalHtmlStyleGutter = html.style.scrollbarGutter;\n html.style.scrollbarGutter = 'stable';\n scrollContainer.style.overflowY = 'scroll';\n const before = scrollContainer.offsetWidth;\n scrollContainer.style.overflowY = 'hidden';\n const after = scrollContainer.offsetWidth;\n scrollContainer.style.overflowY = originalScrollContainerOverflowY;\n html.style.scrollbarGutter = originalHtmlStyleGutter;\n return before === after;\n}\nfunction preventScrollOverlayScrollbars(referenceElement) {\n const doc = ownerDocument(referenceElement);\n const html = doc.documentElement;\n const body = doc.body;\n\n // If an `overflow` style is present on <html>, we need to lock it, because a lock on <body>\n // won't have any effect.\n // But if <body> has an `overflow` style (like `overflow-x: hidden`), we need to lock it\n // instead, as sticky elements shift otherwise.\n const elementToLock = getViewportScroller(html, body);\n const originalElementToLockStyles = {\n overflowY: elementToLock.style.overflowY,\n overflowX: elementToLock.style.overflowX\n };\n Object.assign(elementToLock.style, {\n overflowY: 'hidden',\n overflowX: 'hidden'\n });\n return () => {\n Object.assign(elementToLock.style, originalElementToLockStyles);\n };\n}\nfunction preventScrollInsetScrollbars(referenceElement) {\n const doc = ownerDocument(referenceElement);\n const html = doc.documentElement;\n const body = doc.body;\n const win = ownerWindow(html);\n let scrollTop = 0;\n let scrollLeft = 0;\n let updateGutterOnly = false;\n const resizeFrame = AnimationFrame.create();\n\n // Pinch-zoom in Safari causes a shift. Just don't lock scroll if there's any pinch-zoom.\n if (platform.engine.webkit && (win.visualViewport?.scale ?? 1) !== 1) {\n return () => {};\n }\n function lockScroll() {\n /* DOM reads: */\n\n const htmlStyles = win.getComputedStyle(html);\n const bodyStyles = win.getComputedStyle(body);\n const htmlScrollbarGutterValue = htmlStyles.scrollbarGutter || '';\n const hasBothEdges = htmlScrollbarGutterValue.includes('both-edges');\n const scrollbarGutterValue = hasBothEdges ? 'stable both-edges' : 'stable';\n scrollTop = html.scrollTop;\n scrollLeft = html.scrollLeft;\n originalHtmlStyles = {\n scrollbarGutter: html.style.scrollbarGutter,\n overflowY: html.style.overflowY,\n overflowX: html.style.overflowX\n };\n originalHtmlScrollBehavior = html.style.scrollBehavior;\n originalBodyStyles = {\n position: body.style.position,\n height: body.style.height,\n width: body.style.width,\n boxSizing: body.style.boxSizing,\n overflowY: body.style.overflowY,\n overflowX: body.style.overflowX,\n scrollBehavior: body.style.scrollBehavior\n };\n const isScrollableY = html.scrollHeight > html.clientHeight;\n const isScrollableX = html.scrollWidth > html.clientWidth;\n const hasConstantOverflowY = htmlStyles.overflowY === 'scroll' || bodyStyles.overflowY === 'scroll';\n const hasConstantOverflowX = htmlStyles.overflowX === 'scroll' || bodyStyles.overflowX === 'scroll';\n\n // Values can be negative in Firefox\n const scrollbarWidth = Math.max(0, win.innerWidth - body.clientWidth);\n const scrollbarHeight = Math.max(0, win.innerHeight - body.clientHeight);\n\n // Avoid shift due to the default <body> margin. This does cause elements to be clipped\n // with whitespace. Warn if <body> has margins?\n const marginY = parseFloat(bodyStyles.marginTop) + parseFloat(bodyStyles.marginBottom);\n const marginX = parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight);\n const elementToLock = getViewportScroller(html, body);\n updateGutterOnly = supportsStableScrollbarGutter(referenceElement);\n\n /*\n * DOM writes:\n * Do not read the DOM past this point!\n */\n\n if (updateGutterOnly) {\n html.style.scrollbarGutter = scrollbarGutterValue;\n elementToLock.style.overflowY = 'hidden';\n elementToLock.style.overflowX = 'hidden';\n return;\n }\n Object.assign(html.style, {\n scrollbarGutter: scrollbarGutterValue,\n overflowY: 'hidden',\n overflowX: 'hidden'\n });\n if (isScrollableY || hasConstantOverflowY) {\n html.style.overflowY = 'scroll';\n }\n if (isScrollableX || hasConstantOverflowX) {\n html.style.overflowX = 'scroll';\n }\n Object.assign(body.style, {\n position: 'relative',\n height: marginY || scrollbarHeight ? `calc(100dvh - ${marginY + scrollbarHeight}px)` : '100dvh',\n width: marginX || scrollbarWidth ? `calc(100vw - ${marginX + scrollbarWidth}px)` : '100vw',\n boxSizing: 'border-box',\n // Assign the longhands that `cleanup` restores, so nothing is left behind.\n overflowY: 'hidden',\n overflowX: 'hidden',\n scrollBehavior: 'unset'\n });\n body.scrollTop = scrollTop;\n body.scrollLeft = scrollLeft;\n html.setAttribute('data-base-ui-scroll-locked', '');\n html.style.scrollBehavior = 'unset';\n }\n function cleanup() {\n Object.assign(html.style, originalHtmlStyles);\n Object.assign(body.style, originalBodyStyles);\n if (!updateGutterOnly) {\n html.scrollTop = scrollTop;\n html.scrollLeft = scrollLeft;\n html.removeAttribute('data-base-ui-scroll-locked');\n html.style.scrollBehavior = originalHtmlScrollBehavior;\n }\n }\n function handleResize() {\n cleanup();\n resizeFrame.request(lockScroll);\n }\n lockScroll();\n const unsubscribeResize = addEventListener(win, 'resize', handleResize);\n return () => {\n resizeFrame.cancel();\n cleanup();\n // Sometimes this cleanup can run after test teardown because it is called\n // in a `setTimeout(fn, 0)`. Guard the returned cleanup to avoid calling\n // `removeEventListener` when it is no longer available in tests.\n if (typeof win.removeEventListener === 'function') {\n unsubscribeResize();\n }\n };\n}\nclass ScrollLocker {\n lockCount = 0;\n restore = null;\n timeoutLock = Timeout.create();\n timeoutUnlock = Timeout.create();\n acquire(referenceElement) {\n this.lockCount += 1;\n if (this.lockCount === 1 && this.restore === null) {\n this.timeoutLock.start(0, () => this.lock(referenceElement));\n }\n return this.release;\n }\n release = () => {\n this.lockCount -= 1;\n if (this.lockCount === 0 && this.restore) {\n this.timeoutUnlock.start(0, this.unlock);\n }\n };\n unlock = () => {\n if (this.lockCount === 0 && this.restore) {\n this.restore?.();\n this.restore = null;\n }\n };\n lock(referenceElement) {\n if (this.lockCount === 0 || this.restore !== null) {\n return;\n }\n const doc = ownerDocument(referenceElement);\n const html = doc.documentElement;\n const body = doc.body;\n const win = ownerWindow(html);\n\n // The page is already locked, either by the site author or by a non-Base UI overlay that\n // hasn't cleaned up yet. Leave it alone and wait for the lock to clear before taking over,\n // otherwise we'd snapshot the locked state and restore it after our own lock is released.\n if (isPageScrollLocked(win, html, body)) {\n const observer = new win.MutationObserver(() => {\n if (isPageScrollLocked(win, html, body)) {\n return;\n }\n observer.disconnect();\n this.restore = null;\n this.lock(referenceElement);\n });\n\n // Watch every attribute: locks are applied through inline styles, classes, or attributes\n // paired with a stylesheet (`data-scroll-locked` in react-remove-scroll, for example).\n const options = {\n attributes: true\n };\n observer.observe(html, options);\n observer.observe(body, options);\n this.restore = () => observer.disconnect();\n return;\n }\n const hasOverlayScrollbars = platform.os.ios || !hasInsetScrollbars(referenceElement);\n\n // On iOS, scroll locking does not work if the navbar is collapsed. Due to numerous\n // side effects and bugs that arise on iOS, it must be researched extensively before\n // being enabled to ensure it doesn't cause the following issues:\n // - Textboxes must scroll into view when focused, nor cause a glitchy scroll animation.\n // - The navbar must not force itself into view and cause layout shift.\n // - Scroll containers must not flicker upon closing a popup when it has an exit animation.\n this.restore = hasOverlayScrollbars ? preventScrollOverlayScrollbars(referenceElement) : preventScrollInsetScrollbars(referenceElement);\n }\n}\nconst SCROLL_LOCKER = new ScrollLocker();\n\n/**\n * Locks the scroll of the document when enabled.\n *\n * @param enabled - Whether to enable the scroll lock.\n * @param referenceElement - Element to use as a reference for lock calculations.\n */\nexport function useScrollLock(enabled = true, referenceElement = null) {\n useIsoLayoutEffect(() => {\n if (!enabled) {\n return undefined;\n }\n return SCROLL_LOCKER.acquire(referenceElement);\n }, [enabled, referenceElement]);\n}","'use client';\n\nimport * as React from 'react';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useScrollLock } from '@base-ui/utils/useScrollLock';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\n\n// Touch-opened popups normally avoid scroll locking so users can still swipe outside to dismiss.\n// This hook re-enables scroll lock only when the popup is effectively full-width.\n// Treat popups with up to 20px of total horizontal gutter as full-width so common ~10px side\n// padding still locks scroll, since that leaves too little outside space for a reliable swipe.\nconst VIEWPORT_WIDTH_TOLERANCE_PX = 20;\n\n/**\n * Manages scroll lock for anchored popups. For non-touch opens, scroll lock is applied when\n * enabled. For touch opens, scroll lock is applied only when the positioner width is effectively\n * viewport-sized.\n */\nexport function useAnchoredPopupScrollLock(enabled, touchOpen, positionerElement, referenceElement) {\n const [touchOpenShouldLockScroll, setTouchOpenShouldLockScroll] = React.useState(false);\n useIsoLayoutEffect(() => {\n if (!enabled || !touchOpen || positionerElement == null) {\n setTouchOpenShouldLockScroll(false);\n return;\n }\n const viewportWidth = ownerDocument(positionerElement).documentElement.clientWidth;\n const popupWidth = positionerElement.offsetWidth;\n setTouchOpenShouldLockScroll(viewportWidth > 0 && popupWidth > 0 && popupWidth >= viewportWidth - VIEWPORT_WIDTH_TOLERANCE_PX);\n }, [enabled, touchOpen, positionerElement]);\n useScrollLock(enabled && (!touchOpen || touchOpenShouldLockScroll), referenceElement);\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { inertValue } from '@base-ui/utils/inertValue';\nimport { useComboboxFloatingContext, useComboboxRootContext } from \"../root/ComboboxRootContext.mjs\";\nimport { ComboboxPositionerContext } from \"./ComboboxPositionerContext.mjs\";\nimport { useListEmpty } from \"../utils/parts.mjs\";\nimport { useAnchorPositioning } from \"../../internals/useAnchorPositioning.mjs\";\nimport { useComboboxPortalContext } from \"../portal/ComboboxPortalContext.mjs\";\nimport { DROPDOWN_COLLISION_AVOIDANCE } from \"../../internals/constants.mjs\";\nimport { InternalBackdrop } from \"../../utils/InternalBackdrop.mjs\";\nimport { usePositioner } from \"../../utils/usePositioner.mjs\";\nimport { useAnchoredPopupScrollLock } from \"../../utils/useAnchoredPopupScrollLock.mjs\";\n\n/**\n * Positions the popup against the trigger.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const ComboboxPositioner = /*#__PURE__*/React.forwardRef(function ComboboxPositioner(componentProps, forwardedRef) {\n const {\n render,\n className,\n anchor,\n // `useAnchorPositioning` applies the same defaults to the undefined values; the names\n // remain destructured to exclude the props from `elementProps`.\n positionMethod,\n side,\n align,\n sideOffset,\n alignOffset,\n collisionBoundary = 'clipping-ancestors',\n collisionPadding,\n arrowPadding,\n sticky,\n disableAnchorTracking = false,\n collisionAvoidance = DROPDOWN_COLLISION_AVOIDANCE,\n style: styleProp,\n ...elementProps\n } = componentProps;\n const store = useComboboxRootContext();\n const floatingRootContext = useComboboxFloatingContext();\n const keepMounted = useComboboxPortalContext();\n const modal = store.useState('modal');\n const open = store.useState('open');\n const mounted = store.useState('mounted');\n const openMethod = store.useState('openMethod');\n const positionerElement = store.useState('positionerElement');\n const triggerElement = store.useState('triggerElement');\n const inputElement = store.useState('inputElement');\n const inputGroupElement = store.useState('inputGroupElement');\n const inputInsidePopup = store.useState('inputInsidePopup');\n const transitionStatus = store.useState('transitionStatus');\n const empty = useListEmpty();\n const resolvedAnchor = anchor ?? (inputInsidePopup ? triggerElement : inputGroupElement ?? inputElement);\n const positioning = useAnchorPositioning({\n anchor: resolvedAnchor,\n floatingRootContext,\n positionMethod,\n mounted,\n side,\n sideOffset,\n align,\n alignOffset,\n arrowPadding,\n collisionBoundary,\n collisionPadding,\n sticky,\n disableAnchorTracking,\n keepMounted,\n collisionAvoidance,\n lazyFlip: true\n });\n useAnchoredPopupScrollLock(open && modal, openMethod === 'touch', positionerElement, triggerElement);\n const state = {\n open,\n side: positioning.side,\n align: positioning.align,\n anchorHidden: positioning.anchorHidden,\n empty\n };\n useIsoLayoutEffect(() => {\n store.set('popupSide', positioning.side);\n }, [store, positioning.side]);\n const setPositionerElement = useStableCallback(element => {\n store.set('positionerElement', element);\n });\n const element = usePositioner(componentProps, state, {\n styles: positioning.positionerStyles,\n transitionStatus,\n props: elementProps,\n refs: [forwardedRef, setPositionerElement],\n hidden: !mounted,\n inert: !open\n });\n return /*#__PURE__*/_jsxs(ComboboxPositionerContext.Provider, {\n value: positioning,\n children: [mounted && modal && /*#__PURE__*/_jsx(InternalBackdrop, {\n inert: inertValue(!open),\n cutout: inputGroupElement ?? inputElement ?? triggerElement\n }), element]\n });\n});\nif (process.env.NODE_ENV !== \"production\") ComboboxPositioner.displayName = \"ComboboxPositioner\";","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { FloatingFocusManager } from \"../../floating-ui-react/index.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useComboboxFloatingContext, useComboboxRootContext } from \"../root/ComboboxRootContext.mjs\";\nimport { popupStateMapping } from \"../../utils/popupStateMapping.mjs\";\nimport { useComboboxPositionerContext } from \"../positioner/ComboboxPositionerContext.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { transitionStatusMapping } from \"../../internals/stateAttributesMapping.mjs\";\nimport { contains, getTarget } from \"../../floating-ui-react/utils.mjs\";\nimport { getDisabledMountTransitionStyles } from \"../../internals/getDisabledMountTransitionStyles.mjs\";\nimport { ComboboxInternalDismissButton } from \"../utils/ComboboxInternalDismissButton.mjs\";\nimport { getComboboxPopupId } from \"../root/utils/index.mjs\";\nimport { useListEmpty } from \"../utils/parts.mjs\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst stateAttributesMapping = {\n ...popupStateMapping,\n ...transitionStatusMapping\n};\n\n/**\n * A container for the list.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)\n */\nexport const ComboboxPopup = /*#__PURE__*/React.forwardRef(function ComboboxPopup(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n initialFocus,\n finalFocus,\n ...elementProps\n } = componentProps;\n const store = useComboboxRootContext();\n const positioning = useComboboxPositionerContext();\n const floatingRootContext = useComboboxFloatingContext();\n const mounted = store.useState('mounted');\n const open = store.useState('open');\n const openMethod = store.useState('openMethod');\n const popupProps = store.useState('popupProps');\n const transitionStatus = store.useState('transitionStatus');\n const inputInsidePopup = store.useState('inputInsidePopup');\n const inputElement = store.useState('inputElement');\n const modal = store.useState('modal');\n const rootId = store.useState('id');\n const empty = useListEmpty();\n const popupId = elementProps.id ?? (inputInsidePopup ? getComboboxPopupId(rootId) : undefined);\n useIsoLayoutEffect(() => {\n // Prefer the rendered DOM id, which a `render` prop element or function may override.\n store.set('popupId', store.context.popupRef.current?.id || popupId);\n return () => {\n store.set('popupId', undefined);\n };\n }, [store, popupId]);\n useOpenChangeComplete({\n open,\n ref: store.context.popupRef,\n onComplete() {\n if (open) {\n store.context.onOpenChangeComplete(true);\n }\n }\n });\n const state = {\n open,\n side: positioning.side,\n align: positioning.align,\n anchorHidden: positioning.anchorHidden,\n transitionStatus,\n empty\n };\n const element = useRenderElement('div', componentProps, {\n state,\n ref: [forwardedRef, store.context.popupRef],\n props: [popupProps, {\n id: popupId,\n role: inputInsidePopup ? 'dialog' : 'presentation',\n onFocus(event) {\n const target = getTarget(event.nativeEvent);\n if (openMethod !== 'touch' && (contains(store.state.listElement, target) || target === event.currentTarget)) {\n store.context.inputRef.current?.focus();\n }\n }\n }, getDisabledMountTransitionStyles(transitionStatus), elementProps],\n stateAttributesMapping\n });\n\n // Default initial focus logic:\n // If opened by touch, focus the popup element to prevent the virtual keyboard from opening\n // (this is required for Android specifically as iOS handles this automatically).\n const computedDefaultInitialFocus = inputInsidePopup ? interactionType => interactionType === 'touch' ? store.context.popupRef.current : inputElement : false;\n const resolvedInitialFocus = initialFocus === undefined ? computedDefaultInitialFocus : initialFocus;\n let resolvedFinalFocus;\n if (finalFocus != null) {\n resolvedFinalFocus = finalFocus;\n } else {\n resolvedFinalFocus = inputInsidePopup ? undefined : false;\n }\n const focusManagerModal = !inputInsidePopup || modal;\n return /*#__PURE__*/_jsx(FloatingFocusManager, {\n context: floatingRootContext,\n disabled: !mounted,\n modal: focusManagerModal,\n openInteractionType: openMethod,\n initialFocus: resolvedInitialFocus,\n returnFocus: resolvedFinalFocus,\n getInsideElements: () => [store.context.startDismissRef.current, store.context.endDismissRef.current],\n children: /*#__PURE__*/_jsxs(React.Fragment, {\n children: [element, focusManagerModal && /*#__PURE__*/_jsx(ComboboxInternalDismissButton, {\n ref: store.context.endDismissRef\n })]\n })\n });\n});\nif (process.env.NODE_ENV !== \"production\") ComboboxPopup.displayName = \"ComboboxPopup\";","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useCompositeListContext } from \"./CompositeListContext.mjs\";\n/**\n * Used to register a list item and its index (DOM position) in the `CompositeList`.\n */\nexport function useCompositeListItem(params = {}) {\n const {\n guess,\n label,\n metadata,\n textRef,\n index: externalIndex\n } = params;\n const {\n register,\n unregister,\n subscribeMapChange,\n nextIndexRef\n } = useCompositeListContext();\n\n // Guess the index from the render order. This avoids a re-render after mount for\n // flat lists rendered in DOM order; when the guess is wrong (grouped or out-of-order\n // rendering), the commit flush corrects it before paint.\n const indexRef = React.useRef(-1);\n const [internalIndex, setInternalIndex] = React.useState(externalIndex == null && guess ? () => {\n if (indexRef.current === -1) {\n const newIndex = nextIndexRef.current;\n nextIndexRef.current += 1;\n indexRef.current = newIndex;\n }\n return indexRef.current;\n } : -1);\n const index = externalIndex ?? internalIndex;\n const componentRef = React.useRef(null);\n\n // Deliberately identity-sensitive: nested items sharing one DOM node rely on ref attachment\n // order to decide which registration wins, and republishing from an effect instead would let\n // an inner item's later update silently take ownership from the outer one.\n const ref = React.useCallback(node => {\n const previousNode = componentRef.current;\n if (previousNode) {\n unregister(previousNode);\n }\n componentRef.current = node;\n if (node) {\n register(node, {\n metadata: metadata ?? null,\n index: externalIndex ?? null,\n label,\n textRef\n });\n }\n }, [externalIndex, register, unregister, metadata, label, textRef]);\n useIsoLayoutEffect(() => {\n if (externalIndex != null) {\n return undefined;\n }\n return subscribeMapChange(map => {\n const i = componentRef.current ? map.get(componentRef.current)?.index : null;\n if (i != null) {\n setInternalIndex(i);\n }\n });\n }, [externalIndex, subscribeMapChange]);\n return {\n ref,\n index\n };\n}","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const ComboboxItemContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") ComboboxItemContext.displayName = \"ComboboxItemContext\";\nexport function useComboboxItemContext() {\n const context = React.useContext(ComboboxItemContext);\n if (!context) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: ComboboxItemContext is missing. ComboboxItem parts must be placed within <Combobox.Item>.' : _formatErrorMessage(19));\n }\n return context;\n}","'use client';\n\nimport * as React from 'react';\nexport const ComboboxRowContext = /*#__PURE__*/React.createContext(false);\nif (process.env.NODE_ENV !== \"production\") ComboboxRowContext.displayName = \"ComboboxRowContext\";\nexport function useComboboxRowContext() {\n return React.useContext(ComboboxRowContext);\n}","'use client';\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useComboboxRootContext, useComboboxHasItemsContext, useComboboxDerivedItemsContext } from \"../root/ComboboxRootContext.mjs\";\nimport { useCompositeListItem } from \"../../internals/composite/list/useCompositeListItem.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { ComboboxItemContext } from \"./ComboboxItemContext.mjs\";\nimport { useButton } from \"../../internals/use-button/index.mjs\";\nimport { useComboboxRowContext } from \"../row/ComboboxRowContext.mjs\";\nimport { compareItemEquality, findItemIndex, resolveSelectedIndex } from \"../../internals/itemEquality.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nfunction ComboboxItemInner(props) {\n const {\n componentProps,\n forwardedRef,\n virtualized,\n indexFromFilter\n } = props;\n const {\n render,\n className,\n style,\n value: itemValue = null,\n index: indexProp,\n disabled: disabledProp = false,\n nativeButton = false,\n ...elementProps\n } = componentProps;\n const textRef = React.useRef(null);\n const listItem = useCompositeListItem({\n guess: true,\n index: indexProp,\n textRef\n });\n const store = useComboboxRootContext();\n const isRow = useComboboxRowContext();\n const hasItems = useComboboxHasItemsContext();\n const selectionMode = store.useState('selectionMode');\n const rootDisabled = store.useState('disabled');\n const readOnly = store.useState('readOnly');\n const isItemEqualToValue = store.useState('isItemEqualToValue');\n const disabled = rootDisabled || disabledProp;\n const selectable = selectionMode !== 'none';\n const index = indexProp ?? indexFromFilter ?? listItem.index;\n const hasRegistered = index !== -1;\n const rootId = store.useState('id');\n const highlighted = store.useState('isActive', index);\n const matchesSelectedValue = store.useState('isSelected', itemValue);\n const itemProps = store.useState('itemProps');\n const itemRef = React.useRef(null);\n const id = rootId != null && hasRegistered ? `${rootId}-${index}` : undefined;\n const selected = matchesSelectedValue && selectable;\n useIsoLayoutEffect(() => {\n const shouldRun = hasRegistered && (virtualized || indexProp != null);\n if (!shouldRun) {\n return undefined;\n }\n const list = store.context.listRef.current;\n list[index] = itemRef.current;\n return () => {\n delete list[index];\n };\n }, [hasRegistered, virtualized, index, indexProp, store]);\n useIsoLayoutEffect(() => {\n if (!hasRegistered || hasItems) {\n return undefined;\n }\n const visibleValues = store.context.valuesRef.current;\n visibleValues[index] = itemValue;\n return () => {\n delete visibleValues[index];\n };\n }, [hasRegistered, hasItems, index, itemValue, store]);\n useIsoLayoutEffect(() => {\n if (!hasRegistered || hasItems) {\n return;\n }\n\n // Runs while closed as well (the list can stay mounted via `keepMounted` or a\n // force-mount) so the index tracks the item's composite position, keeping features\n // like closed-trigger typeahead in sync when the rendered order changes.\n const selectedValue = store.state.selectedValue;\n let nextIndex = store.state.selectedIndex;\n if (store.state.selectionMode === 'multiple' && Array.isArray(selectedValue)) {\n nextIndex = resolveSelectedIndex(index, itemValue, store.context.valuesRef.current, selectedValue, isItemEqualToValue, nextIndex);\n } else if (compareItemEquality(itemValue, selectedValue, isItemEqualToValue)) {\n nextIndex = index;\n }\n store.set('selectedIndex', nextIndex);\n }, [hasRegistered, hasItems, store, index, itemValue, isItemEqualToValue]);\n const {\n getButtonProps,\n buttonRef\n } = useButton({\n disabled,\n focusableWhenDisabled: true,\n native: nativeButton,\n composite: true\n });\n const state = {\n disabled,\n selected,\n highlighted\n };\n function commitSelection(nativeEvent) {\n function selectItem() {\n store.context.handleSelection(nativeEvent, itemValue);\n }\n if (store.state.submitOnItemClick) {\n ReactDOM.flushSync(selectItem);\n store.context.requestSubmit();\n } else {\n selectItem();\n }\n }\n const defaultProps = {\n id,\n role: isRow ? 'gridcell' : 'option',\n 'aria-selected': selectable ? selected : undefined,\n // Focusable items steal focus from the input upon mouseup.\n // Warn if the user renders a natively focusable element like `<button>`,\n // as it should be a `<div>` instead.\n tabIndex: undefined,\n onPointerDownCapture(event) {\n // The compat `mouseup` only fires for the primary pointer, so a non-primary\n // touch must not overwrite the shared ref — a mismatch would make the primary\n // pointer's release read as a drag-select and commit a second time after `click`.\n if (event.isPrimary) {\n store.context.pointerDownItemRef.current = event.currentTarget;\n }\n event.preventDefault();\n },\n onMouseDown(event) {\n // iOS Safari can emit a synthetic mousedown for touch taps without a preceding\n // pointerdown. Prevent default here too so tapping an item does not blur the input.\n event.preventDefault();\n },\n onClick(event) {\n if (disabled || readOnly) {\n return;\n }\n commitSelection(event.nativeEvent);\n },\n onMouseUp(event) {\n const pointerStartedOnItem = store.context.pointerDownItemRef.current === event.currentTarget;\n store.context.pointerDownItemRef.current = null;\n if (disabled || readOnly || event.button !== 0 || pointerStartedOnItem || !highlighted) {\n return;\n }\n commitSelection(event.nativeEvent);\n }\n };\n const element = useRenderElement('div', componentProps, {\n ref: [buttonRef, forwardedRef, listItem.ref, itemRef],\n state,\n props: [itemProps, defaultProps, elementProps, getButtonProps]\n });\n const contextValue = React.useMemo(() => ({\n selected,\n textRef\n }), [selected, textRef]);\n return /*#__PURE__*/_jsx(ComboboxItemContext.Provider, {\n value: contextValue,\n children: element\n });\n}\n\n/**\n * Resolves the index from the filtered items for the virtualized fallback (no `index` prop).\n * Isolated here so that this per-keystroke subscription to the derived-items context is only\n * paid by virtualized items. Those re-render on every input change anyway — the parent\n * virtualizer re-windows the list as the filtered set changes — so the extra subscription costs\n * them nothing, while it keeps every non-virtualized item off that context.\n */\nfunction ComboboxItemVirtualizedIndex(props) {\n const {\n componentProps,\n forwardedRef\n } = props;\n const store = useComboboxRootContext();\n const isItemEqualToValue = store.useState('isItemEqualToValue');\n const {\n flatFilteredValues\n } = useComboboxDerivedItemsContext();\n const lookupValue = componentProps.value ?? null;\n const indexFromFilter = findItemIndex(flatFilteredValues, lookupValue, isItemEqualToValue);\n\n // Only reached when `virtualized` is true (see the wrapper below).\n return /*#__PURE__*/_jsx(ComboboxItemInner, {\n componentProps: componentProps,\n forwardedRef: forwardedRef,\n virtualized: true,\n indexFromFilter: indexFromFilter\n });\n}\n\n/**\n * An individual item in the list.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)\n */\nexport const ComboboxItem = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRef(function ComboboxItem(componentProps, forwardedRef) {\n const store = useComboboxRootContext();\n const virtualized = store.useState('virtualized');\n\n // `virtualized` (and whether an item provides an explicit `index`) must be stable for an\n // item's lifetime: the two branches return different component types, so flipping it at\n // runtime remounts the item and resets its refs and effects.\n if (virtualized && componentProps.index == null) {\n return /*#__PURE__*/_jsx(ComboboxItemVirtualizedIndex, {\n componentProps: componentProps,\n forwardedRef: forwardedRef\n });\n }\n return /*#__PURE__*/_jsx(ComboboxItemInner, {\n componentProps: componentProps,\n forwardedRef: forwardedRef,\n virtualized: virtualized,\n indexFromFilter: undefined\n });\n}));\nif (process.env.NODE_ENV !== \"production\") ComboboxItem.displayName = \"ComboboxItem\";","'use client';\n\nimport * as React from 'react';\nimport { useComboboxItemContext } from \"../item/ComboboxItemContext.mjs\";\nimport { useTransitionStatus } from \"../../internals/useTransitionStatus.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { transitionStatusMapping } from \"../../internals/stateAttributesMapping.mjs\";\n\n/**\n * Indicates whether the item is selected.\n * Renders a `<span>` element.\n *\n * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const ComboboxItemIndicator = /*#__PURE__*/React.forwardRef(function ComboboxItemIndicator(componentProps, forwardedRef) {\n const {\n selected\n } = useComboboxItemContext();\n const shouldRender = componentProps.keepMounted || selected;\n if (!shouldRender) {\n return null;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return /*#__PURE__*/_jsx(Inner, {\n ...componentProps,\n ref: forwardedRef\n });\n});\n\n// Split the core implementation to avoid paying the hook costs unless the element needs to mount.\nif (process.env.NODE_ENV !== \"production\") ComboboxItemIndicator.displayName = \"ComboboxItemIndicator\";\nconst Inner = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRef((componentProps, forwardedRef) => {\n const {\n render,\n className,\n style,\n keepMounted,\n ...elementProps\n } = componentProps;\n const {\n selected\n } = useComboboxItemContext();\n const indicatorRef = React.useRef(null);\n const {\n transitionStatus,\n setMounted\n } = useTransitionStatus(selected);\n const state = {\n selected,\n transitionStatus\n };\n const element = useRenderElement('span', componentProps, {\n ref: [forwardedRef, indicatorRef],\n state,\n props: [{\n 'aria-hidden': true,\n children: '✔️'\n }, elementProps],\n stateAttributesMapping: transitionStatusMapping\n });\n useOpenChangeComplete({\n batch: true,\n enabled: !selected,\n open: selected,\n ref: indicatorRef,\n onComplete() {\n if (!selected) {\n setMounted(false);\n }\n }\n });\n return element;\n}));\nif (process.env.NODE_ENV !== \"production\") Inner.displayName = \"Inner\";","'use client';\n\nimport * as React from 'react';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { ComboboxChipsContext } from \"./ComboboxChipsContext.mjs\";\nimport { CompositeList } from \"../../internals/composite/list/CompositeList.mjs\";\nimport { useComboboxRootContext } from \"../root/ComboboxRootContext.mjs\";\nimport { handleInputPress } from \"../utils/handleInputPress.mjs\";\n\n/**\n * A container for the chips in a multiselectable input.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const ComboboxChips = /*#__PURE__*/React.forwardRef(function ComboboxChips(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const store = useComboboxRootContext();\n const open = store.useState('open');\n const hasSelectionChips = store.useState('hasSelectionChips');\n const [highlightedChipIndex, setHighlightedChipIndex] = React.useState(undefined);\n if (open && highlightedChipIndex !== undefined) {\n setHighlightedChipIndex(undefined);\n }\n const chipsRef = React.useRef([]);\n const element = useRenderElement('div', componentProps, {\n ref: [forwardedRef, store.context.chipsContainerRef],\n // NVDA enters browse mode instead of staying in focus mode when navigating with\n // arrow keys inside a container unless it has a toolbar role.\n props: [hasSelectionChips ? {\n role: 'toolbar'\n } : EMPTY_OBJECT, {\n onMouseDown(event) {\n handleInputPress(event, store, store.state.disabled);\n }\n }, elementProps]\n });\n const contextValue = React.useMemo(() => ({\n highlightedChipIndex,\n setHighlightedChipIndex,\n chipsRef\n }), [highlightedChipIndex, setHighlightedChipIndex, chipsRef]);\n return /*#__PURE__*/_jsx(ComboboxChipsContext.Provider, {\n value: contextValue,\n children: /*#__PURE__*/_jsx(CompositeList, {\n elementsRef: chipsRef,\n children: element\n })\n });\n});\nif (process.env.NODE_ENV !== \"production\") ComboboxChips.displayName = \"ComboboxChips\";","'use client';\n\nimport * as React from 'react';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useComboboxDerivedItemsContext, useComboboxRootContext } from \"../root/ComboboxRootContext.mjs\";\nimport { useInitialLiveRegionTextMutation } from \"../utils/useInitialLiveRegionTextMutation.mjs\";\n\n/**\n * Renders its children only when the list is empty.\n * Requires the `items` prop on the root component.\n * Announces changes politely to screen readers.\n * This component's root element must remain mounted in the DOM to announce\n * changes consistently across screen readers. Avoid hiding or removing the\n * component itself with `display: none`, `hidden`, `aria-hidden`, or conditional\n * rendering. Prefer updating or conditionally rendering its children instead.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)\n */\nexport const ComboboxEmpty = /*#__PURE__*/React.forwardRef(function ComboboxEmpty(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n children: childrenProp,\n ...elementProps\n } = componentProps;\n const {\n filteredItems\n } = useComboboxDerivedItemsContext();\n const store = useComboboxRootContext();\n const emptyRef = useInitialLiveRegionTextMutation();\n const children = filteredItems.length === 0 ? childrenProp : null;\n return useRenderElement('div', componentProps, {\n ref: [forwardedRef, store.context.emptyRef, emptyRef],\n props: [{\n children,\n role: 'status',\n 'aria-live': 'polite',\n 'aria-atomic': true\n }, elementProps]\n });\n});\nif (process.env.NODE_ENV !== \"production\") ComboboxEmpty.displayName = \"ComboboxEmpty\";","'use client';\n\nimport * as React from 'react';\nimport { useComboboxInputValueContext, useComboboxRootContext } from \"../root/ComboboxRootContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useButton } from \"../../internals/use-button/index.mjs\";\nimport { useFieldRootContext } from \"../../internals/field-root-context/FieldRootContext.mjs\";\nimport { useTransitionStatus } from \"../../internals/useTransitionStatus.mjs\";\nimport { transitionStatusMapping } from \"../../internals/stateAttributesMapping.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { triggerOpenStateMapping } from \"../../utils/popupStateMapping.mjs\";\nconst stateAttributesMapping = {\n ...transitionStatusMapping,\n ...triggerOpenStateMapping\n};\n\n/**\n * Clears the value when clicked.\n * Renders a `<button>` element.\n *\n * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)\n */\nexport const ComboboxClear = /*#__PURE__*/React.forwardRef(function ComboboxClear(componentProps, forwardedRef) {\n const {\n render,\n className,\n disabled: disabledProp = false,\n nativeButton = true,\n keepMounted = false,\n style,\n ...elementProps\n } = componentProps;\n const {\n disabled: fieldDisabled\n } = useFieldRootContext();\n const store = useComboboxRootContext();\n const selectionMode = store.useState('selectionMode');\n const comboboxDisabled = store.useState('disabled');\n const readOnly = store.useState('readOnly');\n const open = store.useState('open');\n const selectedValue = store.useState('selectedValue');\n const hasSelectionChips = store.useState('hasSelectionChips');\n const inputValue = useComboboxInputValueContext();\n let visible = false;\n if (selectionMode === 'none') {\n visible = inputValue !== '';\n } else if (selectionMode === 'single') {\n visible = selectedValue != null;\n } else {\n visible = hasSelectionChips;\n }\n const disabled = fieldDisabled || comboboxDisabled || disabledProp;\n const {\n buttonRef,\n getButtonProps\n } = useButton({\n native: nativeButton,\n disabled\n });\n const {\n mounted,\n transitionStatus,\n setMounted\n } = useTransitionStatus(visible);\n const state = {\n disabled,\n visible,\n open,\n transitionStatus\n };\n useOpenChangeComplete({\n open: visible,\n ref: store.context.clearRef,\n onComplete() {\n if (!visible) {\n setMounted(false);\n }\n }\n });\n const element = useRenderElement('button', componentProps, {\n state,\n ref: [forwardedRef, buttonRef, store.context.clearRef],\n props: [{\n tabIndex: -1,\n children: 'x',\n // Avoid stealing focus from the input.\n onMouseDown(event) {\n event.preventDefault();\n },\n onClick(event) {\n if (disabled || readOnly) {\n return;\n }\n const type = store.context.keyboardActiveRef.current ? REASONS.keyboard : REASONS.pointer;\n store.context.setInputValue('', createChangeEventDetails(REASONS.clearPress, event.nativeEvent));\n if (selectionMode !== 'none') {\n store.context.setSelectedValue(Array.isArray(selectedValue) ? [] : null, createChangeEventDetails(REASONS.clearPress, event.nativeEvent));\n // A distinct object shape: `Store.update` iterates own keys, so passing an explicit\n // `selectedIndex: undefined` would overwrite the state instead of leaving it alone.\n store.context.setIndices({\n activeIndex: null,\n selectedIndex: null,\n type\n });\n } else {\n store.context.setIndices({\n activeIndex: null,\n type\n });\n }\n store.context.inputRef.current?.focus();\n }\n }, elementProps, getButtonProps],\n stateAttributesMapping\n });\n const shouldRender = keepMounted || mounted;\n if (!shouldRender) {\n return null;\n }\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") ComboboxClear.displayName = \"ComboboxClear\";","import * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"#lib/utils\";\n\nimport { Button } from \"#components/button\";\nimport { Input } from \"#components/input\";\nimport { Textarea } from \"#components/textarea\";\n\nfunction InputGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"input-group\"\n role=\"group\"\n className={cn(\n \"group/input-group relative flex h-12 w-full min-w-0 items-center rounded-input border border-input bg-input-background transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5\",\n className,\n )}\n {...props}\n />\n );\n}\n\nconst inputGroupAddonVariants = cva(\n \"flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-sm [&>svg:not([class*='size-'])]:size-4\",\n {\n variants: {\n align: {\n \"inline-start\": \"order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]\",\n \"inline-end\": \"order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]\",\n \"block-start\":\n \"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2\",\n \"block-end\":\n \"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2\",\n },\n },\n defaultVariants: {\n align: \"inline-start\",\n },\n },\n);\n\nfunction InputGroupAddon({\n className,\n align = \"inline-start\",\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof inputGroupAddonVariants>) {\n return (\n <div\n role=\"group\"\n data-slot=\"input-group-addon\"\n data-align={align}\n className={cn(inputGroupAddonVariants({ align }), className)}\n onClick={(e) => {\n if ((e.target as HTMLElement).closest(\"button\")) {\n return;\n }\n e.currentTarget.parentElement?.querySelector(\"input\")?.focus();\n }}\n {...props}\n />\n );\n}\n\nconst inputGroupButtonVariants = cva(\"flex items-center gap-2 text-sm shadow-none\", {\n variants: {\n size: {\n xs: \"h-6 gap-1 rounded-sm px-1.5 [&>svg:not([class*='size-'])]:size-3.5\",\n sm: \"\",\n \"icon-xs\": \"size-6 rounded-sm p-0 has-[>svg]:p-0\",\n \"icon-sm\": \"size-8 p-0 has-[>svg]:p-0\",\n },\n },\n defaultVariants: {\n size: \"xs\",\n },\n});\n\n// React 18: forwardRef wrapper — remove when on React 19 (see docs/theming.md)\nconst InputGroupButton = React.forwardRef(function InputGroupButton(\n {\n className,\n type = \"button\",\n variant = \"ghost\",\n size = \"xs\",\n ...props\n }: Omit<React.ComponentProps<typeof Button>, \"size\" | \"type\"> &\n VariantProps<typeof inputGroupButtonVariants> & {\n type?: \"button\" | \"submit\" | \"reset\";\n },\n ref: React.Ref<any>,\n) {\n return (\n <Button\n type={type}\n data-size={size}\n variant={variant}\n className={cn(inputGroupButtonVariants({ size }), className)}\n ref={ref}\n {...props}\n />\n );\n});\n\nfunction InputGroupText({ className, ...props }: React.ComponentProps<\"span\">) {\n return (\n <span\n className={cn(\n \"flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n />\n );\n}\n\n// React 18: forwardRef wrapper — remove when on React 19 (see docs/theming.md)\nconst InputGroupInput = React.forwardRef(function InputGroupInput(\n { className, ...props }: React.ComponentProps<typeof Input>,\n ref: React.Ref<any>,\n) {\n return (\n <Input\n data-slot=\"input-group-control\"\n className={cn(\n \"h-full flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent\",\n className,\n )}\n ref={ref}\n {...props}\n />\n );\n});\n\nfunction InputGroupTextarea({ className, ...props }: React.ComponentProps<\"textarea\">) {\n return (\n <Textarea\n data-slot=\"input-group-control\"\n className={cn(\n \"flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupText,\n InputGroupInput,\n InputGroupTextarea,\n};\n","import { CheckIcon, ChevronDownIcon, XIcon } from \"lucide-react\";\nimport * as React from \"react\";\nimport { Combobox as ComboboxPrimitive } from \"@base-ui/react/combobox\";\n\nimport { cn } from \"#lib/utils\";\nimport { usePortalContainer } from \"#components/portal-root\";\n\nimport { Button } from \"#components/button\";\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput,\n} from \"#components/input-group\";\n\nconst Combobox = ComboboxPrimitive.Root;\n\n// The listbox (ComboboxList) sits inside ComboboxContent; this carries the field label's id\n// from the content down so the listbox gets an accessible name.\nconst ComboboxLabelContext = React.createContext<string | undefined>(undefined);\n\nfunction ComboboxValue({ ...props }: ComboboxPrimitive.Value.Props) {\n return <ComboboxPrimitive.Value data-slot=\"combobox-value\" {...props} />;\n}\n\n// React 18: forwardRef wrapper — remove when on React 19 (see docs/theming.md)\nconst ComboboxTrigger = React.forwardRef(function ComboboxTrigger(\n { className, children, ...props }: ComboboxPrimitive.Trigger.Props,\n ref: React.Ref<any>,\n) {\n return (\n <ComboboxPrimitive.Trigger\n data-slot=\"combobox-trigger\"\n className={cn(\"[&_svg:not([class*='size-'])]:size-4\", className)}\n ref={ref}\n {...props}\n >\n {children}\n <ChevronDownIcon className=\"pointer-events-none size-4 text-muted-foreground\" />\n </ComboboxPrimitive.Trigger>\n );\n});\n\nfunction ComboboxClear({\n className,\n clearLabel,\n ...props\n}: ComboboxPrimitive.Clear.Props & { clearLabel: string }) {\n return (\n <ComboboxPrimitive.Clear\n data-slot=\"combobox-clear\"\n render={<InputGroupButton variant=\"ghost\" size=\"icon-xs\" />}\n aria-label={clearLabel}\n // Base UI defaults Clear to tabIndex -1, which leaves keyboard users unable to reach it.\n tabIndex={0}\n // The button inherits the UA's near-black button text, unreadable on a dark input\n className={cn(\"text-muted-foreground\", className)}\n {...props}\n >\n <XIcon className=\"pointer-events-none\" />\n </ComboboxPrimitive.Clear>\n );\n}\n\n// The trigger and clear buttons are icon-only, so their labels are required whenever they render.\ntype ComboboxInputProps = ComboboxPrimitive.Input.Props & {\n /** Keeps the placeholder in the DOM but invisible, so CSS can reveal it. */\n hidePlaceholder?: boolean;\n} & ({ showTrigger?: true; triggerLabel: string } | { showTrigger: false; triggerLabel?: string }) &\n ({ showClear: true; clearLabel: string } | { showClear?: false; clearLabel?: string });\n\n// React 18: forwardRef wrapper — remove when on React 19 (see docs/theming.md)\n// The cast keeps forwardRef from flattening the union that requires triggerLabel / clearLabel.\nconst ComboboxInput = React.forwardRef(function ComboboxInput(\n {\n className,\n children,\n disabled = false,\n showTrigger = true,\n showClear = false,\n triggerLabel,\n clearLabel,\n hidePlaceholder,\n ...props\n }: ComboboxInputProps,\n ref: React.Ref<any>,\n) {\n return (\n <InputGroup\n // While the list is open Base UI hides everything outside the input and list from assistive\n // tech, except live regions; \"off\" (announces nothing) keeps the focusable trigger and clear\n // buttons from being hidden.\n aria-live=\"off\"\n className={cn(\"w-auto\", className)}\n >\n <ComboboxPrimitive.Input\n render={<InputGroupInput disabled={disabled} hidePlaceholder={hidePlaceholder} />}\n ref={ref}\n {...props}\n />\n <InputGroupAddon align=\"inline-end\">\n {showTrigger && (\n <InputGroupButton\n size=\"icon-xs\"\n variant=\"ghost\"\n render={<ComboboxTrigger />}\n aria-label={triggerLabel}\n data-slot=\"input-group-button\"\n className=\"group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent\"\n disabled={disabled}\n />\n )}\n {showClear && <ComboboxClear disabled={disabled} clearLabel={clearLabel as string} />}\n </InputGroupAddon>\n {children}\n </InputGroup>\n );\n}) as React.ForwardRefExoticComponent<ComboboxInputProps & React.RefAttributes<HTMLInputElement>>;\n\nfunction ComboboxContent({\n className,\n side = \"bottom\",\n sideOffset = 6,\n align = \"start\",\n alignOffset = 0,\n anchor,\n labelledBy,\n children,\n ...props\n}: ComboboxPrimitive.Popup.Props & {\n /** id of the field label; names the listbox. */\n labelledBy?: string;\n} & Pick<\n ComboboxPrimitive.Positioner.Props,\n \"side\" | \"align\" | \"sideOffset\" | \"alignOffset\" | \"anchor\"\n >) {\n const portalContainer = usePortalContainer();\n return (\n <ComboboxPrimitive.Portal container={portalContainer}>\n <ComboboxPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n anchor={anchor}\n className=\"isolate z-50\"\n >\n <ComboboxPrimitive.Popup\n data-slot=\"combobox-content\"\n data-chips={!!anchor}\n className={cn(\n \"cn-menu-target cn-menu-translucent group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95\",\n className,\n )}\n {...props}\n >\n <ComboboxLabelContext.Provider value={labelledBy}>\n {children}\n </ComboboxLabelContext.Provider>\n </ComboboxPrimitive.Popup>\n </ComboboxPrimitive.Positioner>\n </ComboboxPrimitive.Portal>\n );\n}\n\nfunction ComboboxList({ className, ...props }: ComboboxPrimitive.List.Props) {\n const labelledBy = React.useContext(ComboboxLabelContext);\n return (\n <ComboboxPrimitive.List\n data-slot=\"combobox-list\"\n aria-labelledby={labelledBy}\n className={cn(\n \"no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction ComboboxItem({ className, children, ...props }: ComboboxPrimitive.Item.Props) {\n return (\n <ComboboxPrimitive.Item\n data-slot=\"combobox-item\"\n className={cn(\n \"relative flex w-full cursor-default items-center gap-2 rounded-md py-2 pe-8 ps-2 text-(length:--input-text-size) outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n >\n {children}\n <ComboboxPrimitive.ItemIndicator\n render={\n <span className=\"pointer-events-none absolute end-2 flex size-4 items-center justify-center\" />\n }\n >\n <CheckIcon className=\"pointer-events-none\" />\n </ComboboxPrimitive.ItemIndicator>\n </ComboboxPrimitive.Item>\n );\n}\n\nfunction ComboboxGroup({ className, ...props }: ComboboxPrimitive.Group.Props) {\n return (\n <ComboboxPrimitive.Group data-slot=\"combobox-group\" className={cn(className)} {...props} />\n );\n}\n\nfunction ComboboxLabel({ className, ...props }: ComboboxPrimitive.GroupLabel.Props) {\n return (\n <ComboboxPrimitive.GroupLabel\n data-slot=\"combobox-label\"\n className={cn(\"px-2 py-1.5 text-xs text-muted-foreground\", className)}\n {...props}\n />\n );\n}\n\nfunction ComboboxCollection({ ...props }: ComboboxPrimitive.Collection.Props) {\n return <ComboboxPrimitive.Collection data-slot=\"combobox-collection\" {...props} />;\n}\n\nfunction ComboboxEmpty({ className, ...props }: ComboboxPrimitive.Empty.Props) {\n return (\n <ComboboxPrimitive.Empty\n data-slot=\"combobox-empty\"\n className={cn(\n \"hidden w-full justify-center py-2 text-center text-(length:--input-text-size) text-muted-foreground group-data-empty/combobox-content:flex\",\n className,\n )}\n {...props}\n />\n );\n}\n\n// Stands in for the list while options are still loading.\nfunction ComboboxLoading({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"combobox-loading\"\n className={cn(\"flex justify-center p-4\", className)}\n {...props}\n />\n );\n}\n\nfunction ComboboxSeparator({ className, ...props }: ComboboxPrimitive.Separator.Props) {\n return (\n <ComboboxPrimitive.Separator\n data-slot=\"combobox-separator\"\n className={cn(\"-mx-1 my-1 h-px bg-border\", className)}\n {...props}\n />\n );\n}\n\n// React 18: forwardRef wrapper — remove when on React 19 (see docs/theming.md)\nconst ComboboxChips = React.forwardRef(function ComboboxChips(\n {\n className,\n ...props\n }: React.ComponentPropsWithRef<typeof ComboboxPrimitive.Chips> & ComboboxPrimitive.Chips.Props,\n ref: React.Ref<any>,\n) {\n return (\n <ComboboxPrimitive.Chips\n ref={ref}\n data-slot=\"combobox-chips\"\n className={cn(\n \"flex min-h-8 flex-wrap items-center gap-1 rounded-lg border border-input bg-transparent bg-clip-padding px-2.5 py-1 text-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 has-data-[slot=combobox-chip]:px-1 dark:bg-input/30 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40\",\n className,\n )}\n {...props}\n />\n );\n});\n\nfunction ComboboxChip({\n className,\n children,\n showRemove = true,\n ...props\n}: ComboboxPrimitive.Chip.Props & {\n showRemove?: boolean;\n}) {\n return (\n <ComboboxPrimitive.Chip\n data-slot=\"combobox-chip\"\n className={cn(\n \"flex h-[calc(--spacing(5.25))] w-fit items-center justify-center gap-1 rounded-sm bg-muted px-1.5 text-xs font-medium whitespace-nowrap text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pe-0\",\n className,\n )}\n {...props}\n >\n {children}\n {showRemove && (\n <ComboboxPrimitive.ChipRemove\n render={<Button variant=\"ghost\" size=\"icon-xs\" />}\n className=\"-ms-1 opacity-50 hover:opacity-100\"\n data-slot=\"combobox-chip-remove\"\n >\n <XIcon className=\"pointer-events-none\" />\n </ComboboxPrimitive.ChipRemove>\n )}\n </ComboboxPrimitive.Chip>\n );\n}\n\nfunction ComboboxChipsInput({ className, ...props }: ComboboxPrimitive.Input.Props) {\n return (\n <ComboboxPrimitive.Input\n data-slot=\"combobox-chip-input\"\n className={cn(\"min-w-16 flex-1 outline-none\", className)}\n {...props}\n />\n );\n}\n\nfunction useComboboxAnchor() {\n return React.useRef<HTMLDivElement | null>(null);\n}\n\nexport {\n Combobox,\n ComboboxInput,\n ComboboxContent,\n ComboboxList,\n ComboboxItem,\n ComboboxGroup,\n ComboboxLabel,\n ComboboxCollection,\n ComboboxEmpty,\n ComboboxLoading,\n ComboboxSeparator,\n ComboboxChips,\n ComboboxChip,\n ComboboxChipsInput,\n ComboboxTrigger,\n ComboboxValue,\n useComboboxAnchor,\n};\n","import type React from \"react\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport {\n Combobox,\n ComboboxContent,\n ComboboxEmpty,\n ComboboxInput,\n ComboboxItem,\n ComboboxList,\n ComboboxLoading,\n} from \"@jslib/ui/components/combobox\";\nimport { InputGroupAddon } from \"@jslib/ui/components/input-group\";\n\nimport { useMessage } from \"@/components/Message\";\nimport { type MessageId } from \"@/lib/intl/types\";\nimport { LoadingSpinnerComponent } from \"@/components/LoadingSpinner/LoadingSpinnerComponent\";\n\nimport {\n type FormSelectChoice,\n type InputSelectOnKeyDown,\n type FieldId,\n type ExtendedFieldId,\n} from \"../../../lib/types/types\";\nimport { setRef } from \"../../../lib/refs/refs\";\n\nconst matchesQuery = (option: FormSelectChoice, query: string): boolean => {\n const lowerQuery = query.toLowerCase();\n return (\n !query ||\n option.label.toLowerCase().includes(lowerQuery) ||\n option.value.toString().toLowerCase().includes(lowerQuery)\n );\n};\n\nconst isSameChoice = (a: FormSelectChoice, b: FormSelectChoice): boolean => a.value === b.value;\n\nexport function useFormSelectChoice(options: MessageId[]): FormSelectChoice[] {\n const { msg } = useMessage();\n\n if (!options || !Array.isArray(options)) return [];\n\n return options.map((option) => {\n return {\n value: option,\n label: msg({ id: option }),\n };\n });\n}\n\nexport interface InputSelectProps {\n onChange: any;\n options: FormSelectChoice[];\n fieldId?: FieldId | ExtendedFieldId; // registers the input for focus handling; omit for non-form selects\n fieldLabelId?: string;\n partLabel?: string; // names one part of a compound field, read after the field label (e.g. \"Date of birth, month\")\n className?: string;\n disabled?: boolean;\n inputId?: string;\n isErrored?: boolean;\n onKeyDown?: InputSelectOnKeyDown;\n placeholder?: string;\n suppressPlaceholder?: boolean;\n value?: FormSelectChoice;\n autoFocus?: boolean;\n ariaDescribedBy?: string;\n isRequired?: boolean;\n isLoading?: boolean;\n autoComplete?: string;\n isClearable?: boolean; // shows a clear button while a value is selected\n startAdornment?: React.ReactNode; // e.g. an icon shown before the text\n sizeToText?: boolean; // input as wide as its text; list as wide as its options, at the control's left edge\n}\n\nexport const InputSelectComponent = ({\n className,\n inputId,\n disabled = false,\n fieldId,\n fieldLabelId,\n partLabel,\n isErrored = false,\n options,\n onKeyDown,\n onChange,\n placeholder = \"\",\n // Hides the placeholder text (the field label already says what to pick); birth date's month\n // shows it, since its label covers the whole date.\n suppressPlaceholder = true,\n value,\n autoFocus,\n ariaDescribedBy,\n isRequired,\n isLoading = false,\n autoComplete,\n isClearable = true,\n startAdornment,\n sizeToText = false,\n}: InputSelectProps) => {\n const { msg } = useMessage();\n const [isOpen, setIsOpen] = useState(false);\n const inputRef = useRef<HTMLInputElement>(null);\n const highlightedChoiceRef = useRef<FormSelectChoice | null>(null);\n const selectedChoice = value && value.value && value.label ? value : null;\n\n // NOTE: Dependency array omitted to account for use of resetRef(), as useEffect with dep arr\n // will only trigger on initial render leaving the refs empty, this replicates prior version\n // where ref callback would trigger with each re-render\n useEffect(() => {\n if (fieldId) setRef(fieldId, inputRef.current);\n });\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n // Tabbing away after typing picks the highlighted match (or the first one, if the highlight\n // hasn't caught up with fast typing), so typing \"Can\" then Tab selects Canada\n const typedText = event.currentTarget.value;\n if (event.key === \"Tab\" && typedText && typedText !== selectedChoice?.label) {\n const highlighted = highlightedChoiceRef.current;\n const match =\n highlighted && matchesQuery(highlighted, typedText)\n ? highlighted\n : options.find((option) => matchesQuery(option, typedText));\n if (match) onChange(match);\n }\n if (typeof onKeyDown === \"function\") {\n onKeyDown(event);\n }\n };\n\n const clearProps = isClearable\n ? { showClear: true as const, clearLabel: msg({ id: \"clearAndOpenMenu\" }) }\n : {};\n\n return (\n <Combobox\n items={options}\n value={selectedChoice}\n onValueChange={(choice: FormSelectChoice | null, { reason }) => {\n // Base UI drops the value when the text is emptied; only the clear button clears it here\n if (reason === \"input-clear\") return;\n onChange(choice);\n // The clear button stands in for the trigger while a value is set, so like the trigger it\n // also toggles the list\n if (reason === \"clear-press\") setIsOpen(!isOpen);\n }}\n onItemHighlighted={(choice: FormSelectChoice | undefined) => {\n highlightedChoiceRef.current = choice ?? null;\n }}\n filter={matchesQuery}\n isItemEqualToValue={isSameChoice}\n open={isOpen}\n onOpenChange={setIsOpen}\n autoHighlight\n disabled={disabled}\n name={inputId}\n autoComplete={autoComplete}\n >\n <ComboboxInput\n ref={inputRef}\n id={inputId}\n disabled={disabled}\n className={className}\n triggerLabel={msg({ id: \"openMenu\" })}\n {...clearProps}\n placeholder={placeholder}\n hidePlaceholder={suppressPlaceholder}\n // Styling sizes the input to its text with field-sizing; size is the fallback for browsers\n // without it, so whatever follows the text still sits beside it\n size={sizeToText && selectedChoice ? selectedChoice.label.length : undefined}\n // The input names itself (aria-label) after the field label, so the part reads as \"Label Part\"\n aria-label={partLabel}\n aria-labelledby={partLabel && fieldLabelId ? `${fieldLabelId} ${inputId}` : fieldLabelId}\n aria-describedby={ariaDescribedBy}\n aria-required={isRequired}\n aria-invalid={isErrored}\n // TODO resolve next line. Product needs this to autofocus, but linter says bad for accessibility\n // eslint-disable-next-line\n autoFocus={autoFocus}\n // Base UI opens on mousedown on the input; clicking the field's label only forwards a\n // click, so open on click too. Focus alone (Tab, focus returning after Escape) doesn't open.\n onClick={() => setIsOpen(true)}\n onKeyDown={handleKeyDown}\n >\n {startAdornment && <InputGroupAddon align=\"inline-start\">{startAdornment}</InputGroupAddon>}\n </ComboboxInput>\n\n {/* A text-sized input is too narrow to set the list's width, so the list sizes to its options\n and starts at the control's left edge (before any start adornment) */}\n <ComboboxContent\n labelledBy={fieldLabelId}\n anchor={\n sizeToText\n ? () => inputRef.current?.closest(\"[data-slot=input-group]\") ?? null\n : undefined\n }\n className={sizeToText ? \"w-max\" : undefined}\n >\n {isLoading ? (\n <ComboboxLoading>\n <LoadingSpinnerComponent />\n </ComboboxLoading>\n ) : (\n <>\n <ComboboxEmpty>{msg({ id: \"noOptions\" })}</ComboboxEmpty>\n <ComboboxList>\n {(option: FormSelectChoice) => (\n <ComboboxItem key={option.value} value={option}>\n {option.label}\n </ComboboxItem>\n )}\n </ComboboxList>\n </>\n )}\n </ComboboxContent>\n </Combobox>\n );\n};\n"],"ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100],"mappings":";;;;;;;;;;;;A,uDAAMgP,KAAqB;CACzB,UAAU;CACV,UAAU;CACV,YAAY;CACZ,QAAQ;CACR,SAAS;CACT,OAAO;CACP,QAAQ;CACR,QAAQ;AACV,GACaC,KAAiB;CAC5B,GAAGD;CACH,UAAU;CACV,KAAK;CACL,MAAM;AACR,GACaE,KAAsB;CACjC,GAAGF;CACH,UAAU;AACZ,GCVMG,KAAa;CACjB,MAAM;CACN,MAAM;CACN,MAAM,CAAC,CAAC,QAAQ;EAAE,GAAG;EAAmB,KAAK;CAAS,CAAC,CAAC;AAC1D;AACAA,GAAW;AACX,IAAMC,KAAQlB,GAAiBiB,EAAU;;;ACLzC,SAASE,KAAc;CAqBrB,OApBI,OAAO,YAAc,MAChB;EACL,WAAW;EACX,UAAU;EACV,gBAAgB;CAClB,IAeK;EACL,WAAW,UAAU;EACrB,UAAU,UAAU,YAAY;EAChC,gBAAgB,UAAU,kBAAkB;CAC9C;AACF;AACA,IAAM,EACJ,eACA,UAAAC,IACA,uBACED,GAAY,GACHE,KAAiBC,GAAU,YAAY,GACvCC,IAAgBzP,GAAS,YAAY,GCrCrC0P,KAAM,YAAY,KAAKD,CAAa,KAAKA,MAAkB,cAAcE,KAAiB,GAGjGC,KAAiB,WACVC,KAAUJ,MAAkBG,MAAkBL,GAAe,SAASK,EAAc,GAGpFE,KAAM,CAACJ,MAAOD,EAAc,WAAW,KAAK;AAGlCA,EAAc,WAAW,KAAK,GAGhC,C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AAD,EAAA,UACE,iBAAA,GAAA3iD,EAAA,IAAA,CAAC9F,IAAD,CAA0B,CAAA,EACX,CAAA,IAEjB,iBAAA,GAAA8F,EAAA,KAAA,CAAAxI,EAAAA,UAAA,EAAA,UAAA,CACE,iBAAA,GAAAwI,EAAA,IAAA,CAAC0iD,IAAD,EAAA,UAAgBO,EAAI,EAAE,IAAI,YAAY,CAAC,EAAiB,CAAA,GACxD,iBAAA,GAAAjjD,EAAA,IAAA,CAACwiD,IAAD,EAAA,WACI,MACA,iBAAA,GAAAxiD,EAAA,IAAA,CAACyiD,IAAD;IAAiC,OAAOK;IACrC,UAAAA,EAAO;GACI,GAFKA,EAAO,KAEZ,EAEJ,CAAA,CACd,EAAA,CAAA;EAEW,CAAA,CACT;;AAEd"}
|
|
1
|
+
{"version":3,"file":"InputSelectComponent-DYUtOb7C.js","names":["platform","popupOpen","pressed","CommonTriggerDataAttributes.popupOpen","CommonTriggerDataAttributes.pressed","CommonPopupDataAttributes.open","CommonPopupDataAttributes.closed","CommonPopupDataAttributes.anchorHidden","platform.os.android","platform.env.jsdom","getComputedStyle","getComputedStyle","useSyncExternalStore","useSyncExternalStoreWithSelector","platform.screenReader.voiceOver","platform.engine.webkit","ownerWindow","REASONS.focusOut","platform.engine.webkit","REASONS.triggerPress","outsidePress","REASONS.triggerPress","escapeKey","REASONS.escapeKey","platform.engine.webkit","getComputedStyle","REASONS.outsidePress","computePosition","flip","offset","shift","limitShift","size","offset","shift","flip","size","limitShift","useLayoutEffect","offset$1","shift$1","limitShift$1","flip$1","size$1","selectors","usePosition","platform.engine.webkit","REASONS.listNavigation","REASONS.focusOut","_formatErrorMessage","platform.os.ios","getComputedStyle","_formatErrorMessage","REASONS.inputClear","REASONS.inputChange","REASONS.itemPress","REASONS.none","REASONS.inputPress","REASONS.keyboard","REASONS.pointer","CommonTriggerDataAttributes.popupOpen","CommonTriggerDataAttributes.pressed","ComboboxInputDataAttributes.popupSide","ComboboxInputDataAttributes.listEmpty","_formatErrorMessage","REASONS.closePress","ComboboxInput","REASONS.none","REASONS.keyboard","REASONS.pointer","platform.os.android","REASONS.inputChange","REASONS.inputClear","platform.engine.gecko","REASONS.escapeKey","REASONS.inputPress","ownerWindow","platform.env.jsdom","ComboboxTrigger","REASONS.none","REASONS.cancelOpen","REASONS.listNavigation","ComboboxList","platform.os.ios","_formatErrorMessage","CommonPositionerCssVars.availableWidth","CommonPositionerCssVars.availableHeight","shift","floatingShift","ownerWindow","anchorWidth","anchorHeight","CommonPositionerCssVars.anchorWidth","CommonPositionerCssVars.anchorHeight","CommonPositionerCssVars.transformOrigin","ownerWindow","platform.engine.webkit","platform.os.ios","stateAttributesMapping","_formatErrorMessage","ComboboxItem","ComboboxChips","ComboboxEmpty","ComboboxClear","REASONS.keyboard","REASONS.pointer","REASONS.clearPress","ComboboxPrimitive.Root","ComboboxPrimitive.Trigger","ChevronDownIcon","ComboboxPrimitive.Clear","XIcon","ComboboxPrimitive.Input","ComboboxPrimitive.Portal","ComboboxPrimitive.Positioner","ComboboxPrimitive.Popup","ComboboxPrimitive.List","ComboboxPrimitive.Item","ComboboxPrimitive.ItemIndicator","CheckIcon","ComboboxPrimitive.Empty","ComboboxPrimitive.Chips","useState","useRef","_Fragment","__toESM","require_react","require_jsx_runtime","useMessage","require_with_selector","require_shim","require_react_dom","setRef","rectToClientRect","isNode","getAlignment","getOverflowAncestors","isElement","isContainingBlock","isWebKit","getOppositeAxis","getAlignmentSides","clamp","getPaddingObject","getOppositeAxisPlacements","createCoords","isShadowRoot","isTableElement","isHTMLElement","isTopLayer","min","evaluate","getNodeScroll","getWindow","getAxisLength","getAlignmentAxis","getExpandedPlacements","getSideAxis","getSide","max","getComputedStyle$1","LoadingSpinnerComponent","getFrameElement","round","isOverflowElement","isLastTraversableNode","getOppositePlacement","usePortalContainer","getContainingBlock","useDirection","getParentNode","getNodeName","getDocumentElement","floor","cva","EMPTY_OBJECT","useIsoLayoutEffect","mergeProps","formatErrorMessage","cn","isReactVersionAtLeast","useMergedRefs","useRefWithInit","useId","useRenderElement","pointer","clearPress","useStableCallback","focusOut","inputPress","itemPress","outsidePress","none","cancelOpen","NOOP","EMPTY_ARRAY","inputChange","listNavigation","createChangeEventDetails","closePress","keyboard","createGenericEventDetails","escapeKey","inputClear","useControlled","useBaseUiId","triggerPress","activeElement","useValueChanged","useFormContext","useRegisterFieldControl","DEFAULT_FIELD_STATE_ATTRIBUTES","useFieldRootContext","useTimeout","useLabelableId","FieldRootContext","contains","DEFAULT_FIELD_ROOT_CONTEXT","Timeout","getTarget","Input","useLabelableContext","fieldValidityMapping","ownerDocument","useButton","Button","createLucideIcon","useOpenChangeComplete","resolveRef","ChevronDown","useAnimationFrame","useValueAsRef","transitionStatusMapping","AnimationFrame","X","useTransitionStatus","addEventListener","import_react","import_shim","import_with_selector","visuallyHiddenBase","visuallyHidden","visuallyHiddenInput","__iconData","Check","readRawData","platform$1","lowerUserAgent","userAgent","lowerPlatform","ios","maxTouchPoints","ANDROID_STRING","android","mac","apple","webkit","gecko","voiceOver","jsdom","import_jsx_runtime","FOCUSABLE_ATTRIBUTE","TYPEABLE_SELECTOR","ARROW_LEFT","ARROW_RIGHT","ARROW_UP","ARROW_DOWN","import_react_dom","open","closed","anchorHidden","popupOpen$1","pressed$1","TRIGGER_HOOK","PRESSABLE_TRIGGER_HOOK","POPUP_OPEN_HOOK","POPUP_CLOSED_HOOK","ANCHOR_HIDDEN_HOOK","triggerOpenStateMapping","value","pressableTriggerOpenStateMapping","popupStateMapping","isEventTargetWithin","node","event","eventAgain","isRootElement","element","isTypeableElement","isInteractiveElement","isTypeableCombobox","getFloatingFocusElement","floatingElement","getNodeChildren","nodes","id","onlyOpenChildren","child","getNodeAncestors","allAncestors","currentParentId","currentNode","stopEvent","isReactEvent","isVirtualClick","isVirtualPointerEvent","isMouseLikePointerType","values","strict","pointerType","isClickLikeEvent","type","isDifferentGridRow","index","cols","prevRow","isIndexOutOfListBounds","list","getMinListIndex","findNonDisabledListIndex","listRef","getMaxListIndex","startingIndex","decrement","amount","isListIndexDisabled","disabledIndices","getGridNavigatedIndex","stop","nextIndex","prevIndex","verticalDirection","rows","rowIndexMap","hasRoleRow","visibleItemCount","currentRowEl","currentRowIndex","el","rowEl","idx","hasDomRows","inferredDomCols","row","rowLength","hasVirtualizedGaps","verticalCols","navigateVertically","currentRow","colInRow","step","direction","nextRow","i","loopFocus","onLoop","clampedCol","returnedItemIndex","targetRow","col","candidate","navigateVerticallyWithInferredRows","rowStep","lastRowStart","maxIndex","rowCount","rowStart","rowEnd","verticalCandidate","minIndex","maxCol","offset","orientation","rtl","lastRow","isElementVisible","isHiddenByStyles","styles","CANDIDATE_SELECTOR","getParentElement","assignedSlot","rootNode","getDetailsSummary","details","isWithinOpenDetailsSummary","summary","isFocusableCandidate","nodeName","isFocusableElement","current","isAncestor","isSlot","isVisibleInTabbableTree","getTabIndex","tabIndex","getNamedRadioInput","input","isTabbableRadio","checkedRadio","candidates","radio","getComposedChildren","container","assignedElements","appendCandidates","appendMatchingElements","selector","isTabbable","focusable","tabbable","getTabbableIn","len","active","dir","getNextTabbable","referenceElement","getPreviousTabbable","isOutsideEvent","containerElement","relatedTarget","disableFocusInside","enableFocusInside","elements","tabindex","useOnFirstRender","ref","fn","hooks","currentInstance","getInstance","register","hook","useStoreImplementation","useStoreFast","useStoreLegacy","useStore","store","a1","a2","a3","useStoreR19","getSelection","instance","didChange","stores","unsubscribes","onStoreChange","unsubscribe","state","Store","newState","currentTick","listener","key","changes","ReactStore","context","selectors","dependencies","statePart","isControlled","controlled","stableFunction","selectFn","prevValue","nextValue","nextState","oldValue","mergeCleanups","cleanups","cleanup","FocusGuard","role","setRole","restProps","props","createAttribute","name","rafId","enqueueFocus","options","exec","shouldFocus","sync","currentRafId","counters","markerName","uncontrolledElementsSets","markerCounterMap","lockCount","getUncontrolledElementsSet","controlAttribute","unwrapHost","correctElements","targets","parent","target","correctedTarget","x","buildKeepSet","keep","collectOutsideElements","outside","walk","keepElements","root","applyAttributeToOthers","inert","ariaHidden","counterMap","uncontrolledElementsSet","avoidElements","body","uncorrectedAvoidElements","markerTargets","mark","hiddenElements","markedElements","map","currentUncontrolledElementsSet","ariaLiveElements","controlElements","attr","alreadyHidden","counterValue","markerValue","markOthers","DISABLED_TRANSITIONS_STYLE","DROPDOWN_COLLISION_AVOIDANCE","ownerVisuallyHidden","PortalContext","usePortalContext","useFloatingPortalNode","containerProp","uniqueId","parentPortalNode","setContainerElement","portalNode","setPortalNode","setPortalNodeRef","containerRef","resolvedContainer","portalElement","componentProps","elementProps","portalSubtree","FloatingPortal","portalNodeId","forwardedRef","beforeOutsideRef","afterOutsideRef","beforeInsideRef","afterInsideRef","focusManagerState","setFocusManagerState","focusInsideDisabledRef","modal","shouldRenderGuards","onFocus","portalContextValue","portalOwnerRole","children","createEventEmitter","data","FloatingNodeContext","FloatingTreeContext","useFloatingParentNodeId","useFloatingTree","contextTree","externalTree","getEventType","win","lastInteractionType","LIST_LIMIT","previouslyFocusedElements","clearDisconnectedPreviouslyFocusedElements","entry","addPreviouslyFocusedElement","getPreviouslyFocusedElement","getFirstTabbableElement","handleTabIndex","floatingFocusElement","tabbableContent","dataTabIndex","FloatingFocusManager","domReference","floating","getNodeId","dataRef","ignoreInitialFocus","initialFocus","isUntrappedTypeableCombobox","initialFocusRef","returnFocusRef","returnFocus","openInteractionTypeRef","openInteractionType","openRef","tree","portalContext","preventReturnFocusRef","isPointerDownRef","pointerDownOutsideRef","lastFocusedTabbableRef","closeTypeRef","lastInteractionTypeRef","beforeGuardRef","afterGuardRef","mergedBeforeGuardRef","beforeContentFocusGuardRef","mergedAfterGuardRef","blurTimeout","pointerDownTimeout","restoreFocusFrame","isInsidePortal","getTabbableContent","getResolvedInsideElements","getInsideElements","disabled","onKeyDown","doc","clearPointerDownOutside","onPointerDown","insideElements","pointerTargetInside","closeOnFocusOut","handlePointerDown","handleFocusIn","handleFocusOutside","currentTarget","nodeId","triggers","isRelatedFocusGuard","previousFocusableElement","nextFocusableElement","movedToUnrelatedNode","trigger","restoreFocus","prevTabbable","nodeToFocus","markInsideReactTree","domReferenceElement","portalNodes","rootAncestorComboboxDomReference","ariaHiddenCleanup","markerCleanup","previouslyFocusedElement","initialFocusValueOrFn","resolvedInitialFocus","focusableElements","getDefaultFocusElement","elToFocus","hadFocusInside","currentActiveElement","elementFocusedBeforeOpen","preferPreviousFocus","onOpenChangeLocal","isPreventScrollSupported","getReturnElement","returnFocusValueOrFn","resolvedReturnFocusValue","closeType","referenceReturnElement","previousReturnElement","defaultReturnElement","activeEl","isFocusInsideFloatingTree","returnElement","tabbableReturnElement","hasExplicitReturnFocus","focusOptions","events","els","useClick","eventOption","pointerTypeRef","frame","touchOpenTimeout","reference","setOpenWithTouchDelay","reason","nativeEvent","nextOpen","touchOpenDelay","getNextOpen","openEvent","hasClickedOnInactiveTrigger","toggle","stickIfOpen","isClickLikeOpenEvent","ignoreMouse","openEventType","eventCurrentTarget","enabled","alwaysFalse","normalizeProp","normalizable","useDismiss","escapeKey$1","outsidePressProp","outsidePressFn","outsidePress$1","outsidePressEnabled","getOutsidePressEventProp","outsidePressEvent","escapeKeyBubbles","outsidePressBubbles","bubbles","pressStartedInsideRef","pressStartPreventedRef","suppressNextOutsideClickRef","sawPressWhileOpenRef","isComposingRef","currentPointerTypeRef","touchStateRef","cancelDismissOnEndTimeout","clearInsideReactTreeTimeout","clearInsideReactTree","hasBlockingChild","bubbleKey","isEventWithinOwnElements","closeOnReferencePress","referencePress","closeOnEscapeKeyDown","native","eventDetails","markPressStartedInsideReactTree","markInsidePressStartPrevented","handleOpenChange","compositionTimeout","preventedPressSuppressionTimeout","handleCompositionStart","handleCompositionEnd","suppressImmediateOutsideClickAfterPreventedStart","resetPressStartState","getOutsidePressEvent","computedType","outsidePressEventValue","resolved","shouldIgnoreEvent","computedOutsidePressEvent","isEventWithinFloatingTree","targetIsInsideChildren","closeOnPressOutside","inertSelector","targetRoot","markers","targetRootAncestor","nextParent","marker","lastTraversableNode","style","scrollRe","isScrollableX","isScrollableY","canScrollX","canScrollY","isRTL","pressedVerticalScrollbar","pressedHorizontalScrollbar","handleTouchStart","touch","addTargetEventListenerOnce","handleTouchStartCapture","closeOnPressOutsideCapture","targetEvent","handlePressEndCapture","pressStartedInsideDefaultPrevented","handleTouchMove","deltaX","deltaY","distance","handleTouchMoveCapture","handleTouchEnd","handleTouchEndCapture","computeCoordsFromPlacement","_ref","sideAxis","placement","alignmentAxis","alignLength","side","isVertical","commonX","commonY","commonAlign","coords","alignment","detectOverflow","paddingObject","padding","altBoundary","elementContext","clippingClientRect","platform","rect","rects","offsetParent","offsetScale","elementClientRect","MAX_RESET_COUNT","computePosition$1","config","platformWithDetectOverflow","statefulPlacement","resetCount","middlewareData","middleware","currentMiddleware","nextX","nextY","y","reset","flip$1","_middlewareData$arrow","checkMainAxis","checkCrossAxis","specifiedFallbackPlacements","detectOverflowOptions","initialSideAxis","initialPlacement","isBasePlacement","fallbackPlacements","flipAlignment","hasFallbackAxisSideDirection","fallbackAxisSideDirection","placements","overflow","overflows","overflowsData","sides","nextPlacement","d","resetPlacement","a","b","fallbackStrategy","currentSideAxis","acc","originSides","convertValueToCoords","mainAxisMulti","crossAxisMulti","rawValue","crossAxis","mainAxis","offset$1","diffCoords","shift$1","mainAxisCoord","crossAxisCoord","clampCoord","coord","axis","limitedCoords","limiter","limitShift$1","rawOffset","computedOffset","limitMin","limitMax","isOriginSide","size$1","isYAxis","heightSide","widthSide","maximumClippingHeight","height","maximumClippingWidth","width","overflowAvailableHeight","overflowAvailableWidth","shiftData","noShift","availableHeight","availableWidth","apply","nextDimensions","getCssDimensions","css","hasOffset","offsetWidth","offsetHeight","shouldFallback","unwrapElement","getScale","domElement","$","noOffsets","getVisualOffsets","shouldAddVisualOffsets","isFixed","floatingOffsetParent","getBoundingClientRect","includeScale","isFixedStrategy","clientRect","scale","visualOffsets","offsetWin","currentWin","currentIFrame","iframeScale","iframeRect","left","top","getWindowScrollBarX","leftScroll","getHTMLOffset","htmlRect","documentElement","scroll","convertOffsetParentRelativeRectToViewportRelativeRect","strategy","topLayer","offsets","isOffsetParentAnElement","offsetRect","htmlOffset","getClientRects","getDocumentRect","html","SCROLLBAR_MAX","getViewportRect","rootBoundary","isLayoutViewport","visualViewport","layoutRelativeClientCoords","bodyStyles","bodyMarginInline","reservedWidth","gutter","getInnerBoundingClientRect","getClientRectFromClippingAncestor","clippingAncestor","getClippingElementAncestors","cachedResult","cache","result","lastKeptComputedStyle","elementIsFixed","computedStyle","currentNodeIsContaining","lastPosition","ancestor","getClippingRect","clippingAncestors","boundary","firstRect","right","bottom","getDimensions","getRectRelativeToOffsetParent","isStaticPositioned","getTrueOffsetParent","polyfill","rawOffsetParent","getOffsetParent","svgOffsetParent","getElementRects","getOffsetParentFn","getDimensionsFn","floatingDimensions","rectsAreEqual","observeMove","io","timeoutId","_io","refresh","skip","threshold","elementRectForRootMargin","onMove","insetTop","insetRight","insetBottom","insetLeft","isFirstUpdate","handleObserve","ratio","entries","handleResize","ancestorResize","autoUpdate","referenceEl","ancestors","ancestorScroll","update","cleanupIo","layoutShift","reobserveFrame","resizeObserver","elementResize","firstEntry","_resizeObserver","animationFrame","frameId","prevRefRect","frameLoop","nextRefRect","_resizeObserver2","offset$2","shift$2","flip$2","size$2","limitShift$2","computePosition","mergedOptions","platformWithCache","deepEqual","length","keys","getDPR","roundByDPR","dpr","useLatestRef","useFloating","externalReference","externalFloating","setData","latestMiddleware","setLatestMiddleware","_reference","_setReference","_floating","_setFloating","setReference","referenceRef","setFloating","floatingRef","floatingEl","hasWhileElementsMounted","whileElementsMounted","whileElementsMountedRef","platformRef","fullData","isMountedRef","refs","floatingStyles","initialStyles","transform","deps","shift","limitShift","flip","size","selectors$1","FloatingRootStore","initialState","syncOnly","newOpen","FOCUSABLE_POPUP_PROPS","PopupTriggerMap","registered","predicate","useFloatingRootContext","floatingId","nested","valuesToSync","onOpenChange","useBaseUIFloating","useFloatingWithStore","positionReference","setPositionReferenceRaw","localDomReference","setLocalDomReference","localFloatingElement","setLocalFloatingElement","domReferenceRef","storeElements","position","localDomReferenceElement","syncedFloatingElement","setPositionReference","computedPositionReference","n","ESCAPE","isStationaryWebKitPointer","doSwitch","vertical","horizontal","isMainOrientationKey","isMainOrientationToEndKey","isCrossOrientationOpenKey","isCrossOrientationCloseKey","grid","useListNavigation","onNavigateProp","navigateGrid","isGrid","typeableComboboxReference","floatingFocusElementRef","parentId","focusItemOnOpenRef","focusItemOnOpen","indexRef","selectedIndex","keyRef","isPointerModalityRef","onNavigate","previousMountedRef","previousOpenRef","forceSyncFocusRef","forceScrollIntoViewRef","cancelQueuedFocusRef","disabledIndicesRef","latestOpenRef","selectedIndexRef","resetOnPointerLeaveRef","resetOnPointerLeave","focusFrame","waitForListPopulatedFrame","focusItem","runFocus","virtual","item","initialItem","forceScrollIntoView","callback","waitedItem","activeIndex","runs","waitForListPopulated","treeContainsActiveEl","hasActiveIndex","syncCurrentTarget","getParentOrientation","parentOrientation","getMinEnabledIndex","commonOnKeyDown","currentIndex","allowEscape","focusItemOnHover","floatingFocusEl","ariaActiveDescendantProp","openOnNavigationKeyDown","checkVirtualMouse","checkVirtualPointer","currentOpen","isArrowKey","isParentCrossOpenKey","isMainKey","isNavigationKey","openOnArrowKeyDown","isParentMainKey","useTypeahead","onMatchProp","timeout","stringRef","prevIndexRef","matchIndexRef","getElement","elementsRef","isItemAvailable","getMatchingIndex","normalizedStartIndex","startIndex","lowerString","string","listContent","onTyping","isNewSession","text","resetMs","onBlur","next","currentDomReferenceElement","currentFloatingElement","sharedProps","gridNavigation","ComboboxRootContext","ComboboxFloatingContext","ComboboxDerivedItemsContext","ComboboxHasItemsContext","ComboboxInputValueContext","useComboboxRootContext","useComboboxFloatingContext","useComboboxDerivedItemsContext","useComboboxInputValueContext","useComboboxHasItemsContext","areArraysEqual","array1","array2","itemComparer","defaultItemEquality","itemValue","selectedValue","compareItemEquality","comparer","isSelectedValueDirty","currentValue","initialValue","initialItemValue","selectedValueIncludes","selectedValues","findItemIndex","itemValues","createSelectionMatcher","v","findSelectionIndex","multiple","resolveSelectedIndex","registry","removeItem","serializeValue","isGroup","isGroupedItems","items","flattenLeafItems","group","hasNullItemLabel","arrayItems","stringifyAsLabel","itemToStringLabel","stringifyAsValue","itemToStringValue","selectionMode","selectedItem","getComboboxPopupId","rootId","createCollatorItemFilter","collatorFilter","query","stringifyLocale","locale","filterCache","getFilter","cacheKey","cachedFilter","collator","filter","itemString","itemToString","queryLength","useCoreFilter","useEnhancedClickHandler","lastClickInteractionTypeRef","handler","useOpenMethodTriggerProps","setOpenMethod","interactionType","onClick","useOpenInteractionType","openMethod","triggerProps","previousOpen","overflowY","allowOverflowIntent","NO_ACTIVE_VALUE","INITIAL_LAST_HIGHLIGHT","findCollectionItem","exactItem","valueToItem","isEqual","derivedValue","AriaCombobox","idProp","onOpenChangeCompleteProp","selectedValueProp","inputValueProp","openProp","onItemHighlightedProp","nameProp","disabledProp","inputRefProp","itemsProp","filteredItemsProp","filterProp","filterQueryProp","itemToStringLabelProp","inlineProp","fieldName","fieldDisabled","collection","itemToValue","storeItems","externalWindow","flat","isItemEqualToValue","externalItem","unresolvedValue","filterItemToString","stringifyValueLabel","queryChangedAfterOpen","setQueryChangedAfterOpen","closeQuery","setCloseQuery","previousCloseQueryRef","labelsRef","popupRef","inputRef","startDismissRef","endDismissRef","emptyRef","keyboardActiveRef","hadInputClearRef","chipsContainerRef","clearRef","selectionEventRef","lastHighlightRef","pendingQueryHighlightRef","valuesRef","pointerDownItemRef","single","hasInputValue","defaultInputValue","hasItems","hasFilteredItemsProp","autoHighlightMode","autoHighlight","setSelectedValueUnwrapped","defaultSelectedValue","initialDefaultInputValue","inputValue","setInputValueUnwrapped","setOpenUnwrapped","defaultOpen","isGrouped","selectedLabelString","shouldBypassFiltering","filterQuery","shouldIgnoreExternalFiltering","flatItems","filteredItems","groupedItems","resultingGroups","currentCount","limit","remainingLimit","itemsToTake","newGroup","limitedItems","flatFilteredValues","initialSelectedIndex","fieldRawValue","fieldStringValue","onItemHighlighted","onOpenChangeComplete","positionerElement","listElement","triggerElement","inputElement","inputGroupElement","inline","inputInsidePopup","inputOwnsFormValue","inputMatchesSelectedValue","triggerRef","getStringifiedValueForForm","forceMount","emitHighlight","setIndices","activeIndexOption","setInputValue","inputType","hasQuery","popup","handleInterruptedReopen","clearsPendingInput","isInputChange","setOpen","setTouched","setFocused","validationMode","valueToValidate","setSelectedValue","onSelectedValueChange","fillInputOnItemPress","handleSelection","targetEl","overrideEvent","href","currentSelectedValue","isCurrentlySelected","pendingHighlight","requestSubmit","formElement","validation","handleUnmount","setMounted","stringVal","resolvedPopupRef","closeQueryReleased","listIsNavigable","clearedBySelection","isMultiple","toggledIndex","candidateItems","storeActiveIndex","previouslyHighlightedItemValue","isSameItem","setFilled","handleQueryChanged","handleOpenChanged","syncedSelectedLabel","syncInputToSelectedLabel","handleSelectedValueChanged","clearErrors","setDirty","validityData","syncInputAfterItemsOrLabelChange","handleInputValueChanged","floatingRootContext","ariaHasPopup","expanded","ariaExpanded","isPlainInput","shouldTreatAsInput","shouldApplyAria","readOnly","autoComplete","click","openOnInputClick","dismiss","highlightItemOnHover","keepHighlight","transitionStatus","nextActiveIndex","inputProps","popupProps","listProps","itemProps","listNavigationItemProps","syncedValues","hiddenInputRef","itemsContextValue","serializedValue","hasMultipleSelection","hiddenInputName","hiddenInputs","currentSerializedValue","form","nextValueLower","findSerializedMatchIndex","handleChange","matchingIndex","renderedLabel","matchingValue","formAutoComplete","required","ComboboxRoot","other","defaultValue","onValueChange","resolveAriaLabelledBy","fieldLabelId","localLabelId","popupSide","listEmpty","triggerStateAttributesMapping","empty","ComboboxChipsContext","useComboboxChipsContext","ComboboxPositionerContext","useComboboxPositionerContext","optional","ComboboxInternalDismissButton","mergedRef","buttonRef","handleDismiss","dismissProps","getButtonProps","usePopupSide","mounted","useListEmpty","getChipNavigationKeys","getIndexAfterChipRemoval","chipCount","clickHighlightedItem","listItem","ComboboxInput$1","fieldState","comboboxChipsContext","hasPositionerParent","comboboxDisabled","autoHighlightEnabled","isInsidePopup","focusManagerModal","fieldStateForInput","composingValue","setComposingValue","lastActiveIndexRef","shouldRestoreActiveIndexRef","setInputElement","nextIsInsidePopup","validationProps","clearHighlight","markPointerActive","handleKeyDown","renderedChipsCount","previousChipKey","nextChipKey","highlightedChipIndex","autofillLikeInput","shouldOpenOnInput","maybeOpenOnInput","trimmed","nextVal","shouldMaintainHighlight","inputChangeDetails","clearDetails","scrollAmount","cursor","isClear","removalIndex","newValue","hadHighlightedChip","renderedInput","handleInputPress","targetElement","BOUNDARY_OFFSET","isMouseWithinBounds","bounds","getPseudoElementBounds","elementRect","beforeStyles","afterStyles","beforeWidth","beforeHeight","afterWidth","afterHeight","totalWidth","totalHeight","widthDiff","heightDiff","ComboboxTrigger$1","storedPopupId","comboboxLabelId","hasSelectedValue","focusTimeout","ariaLabelledBy","ariaControls","trackPointerType","triggerTypeaheadProps","nextSelectedValue","triggerClickProps","nativeButton","setTriggerElement","handleMouseUp","currentTriggerElement","mouseUpTarget","mouseEvent","positioner","GroupCollectionContext","useGroupCollectionContext","ComboboxCollection","groupContext","itemsToRender","CompositeListContext","useCompositeListContext","CompositeList","onMapChangeProp","onMapChange","setMapTick","listeners","createListeners","createMap","nextIndexRef","isDirtyRef","itemsRef","mutationObserverRef","scheduleMapUpdate","tick","registration","unregister","syncRefs","nextMap","observe","sortedNodes","mutationObserver","hasMovedNode","previousConnectedNode","sortByDocumentPosition","roots","getCommonAncestor","flush","automaticNodes","getCompositeListSnapshot","previousItems","changed","previousItem","subscribeMapChange","contextValue","reservedIndices","automaticItems","nextAutomaticIndex","firstNode","lastNode","ComboboxList$1","_ComboboxCollection","hasPositionerContext","virtualized","forceMounted","setPositionerElement","setListElement","resolvedChildren","LIVE_REGION_MARKER","findLastTextNode","walker","lastTextNode","textNode","useInitialLiveRegionTextMutation","rootRef","originalValue","markedValue","ComboboxPortalContext","useComboboxPortalContext","ComboboxPortal","portalProps","keepMounted","inertValue","baseArrow","arrowDimensions","minProp","maxProp","clientProp","endDiff","startDiff","arrowOffsetParent","clientSize","centerToReference","largestPossiblePadding","minPadding","maxPadding","center","shouldAddOffset","alignmentOffset","arrow","hide","DEFAULT_SIDES","anchorWidth","anchorHeight","transformOrigin","AVAILABLE_WIDTH_VAR","AVAILABLE_HEIGHT_VAR","getLogicalSide","isLogicalSideParam","sideParam","isRtl","renderedSide","getOffsetData","useAnchorPositioning","useAnchorPositioningWithHook","params","collisionPaddingParam","inlineMiddleware","shift$3","mountSide","setMountSide","collisionAvoidanceSide","collisionAvoidance","collisionAvoidanceAlign","collisionAvoidanceFallbackAxisSide","shiftCrossAxis","shiftRootBoundary","anchorFn","anchor","anchorFnCallback","anchorDep","anchorValueRef","mountedRef","align","collisionPadding","biasTop","biasBottom","biasLeft","biasRight","commonCollisionProps","collisionBoundary","arrowRef","sideOffsetRef","sideOffset","alignOffsetRef","alignOffset","sideOffsetDep","alignOffsetDep","alignAxis","shiftDisabled","crossAxisShiftEnabled","sticky","flipMiddleware","shiftMiddleware","limitData","arrowSize","offsetAmount","floatingStyle","anchorWidth$1","anchorHeight$1","arrowPadding","renderedPlacement","renderedAlign","arrowEl","sideOffsetValue","crossOrigin","sideOrigin","adaptiveOrigin","autoUpdateOptions","disableAnchorTracking","originalFloatingStyles","useFloatingHook","positionMethod","args","resolvedPosition","isPositioned","base","sideX","sideY","registeredPositionReferenceRef","anchorValue","resolvedAnchor","finalAnchor","isRef","logicalRenderedSide","lazyFlip","arrowStyles","arrowUncentered","param","InternalBackdrop","otherProps","clipPath","cutout","getDisabledMountTransitionStyles","usePositioner","originalHtmlStyles","originalBodyStyles","originalHtmlScrollBehavior","getViewportScroller","isPageScrollLocked","hasInsetScrollbars","supportsStableScrollbarGutter","scrollContainer","originalScrollContainerOverflowY","originalHtmlStyleGutter","before","after","preventScrollOverlayScrollbars","elementToLock","originalElementToLockStyles","preventScrollInsetScrollbars","scrollTop","scrollLeft","updateGutterOnly","resizeFrame","lockScroll","htmlStyles","scrollbarGutterValue","hasConstantOverflowY","hasConstantOverflowX","scrollbarWidth","scrollbarHeight","marginY","marginX","unsubscribeResize","SCROLL_LOCKER","observer","hasOverlayScrollbars","useScrollLock","VIEWPORT_WIDTH_TOLERANCE_PX","useAnchoredPopupScrollLock","touchOpenShouldLockScroll","setTouchOpenShouldLockScroll","touchOpen","viewportWidth","popupWidth","ComboboxPositioner","styleProp","positioning","stateAttributesMapping$1","ComboboxPopup","popupId","resolvedFinalFocus","finalFocus","useCompositeListItem","externalIndex","internalIndex","setInternalIndex","guess","newIndex","componentRef","previousNode","metadata","label","textRef","ComboboxItemContext","useComboboxItemContext","ComboboxRowContext","useComboboxRowContext","ComboboxItemInner","indexProp","isRow","rootDisabled","selectable","indexFromFilter","hasRegistered","highlighted","matchesSelectedValue","itemRef","selected","visibleValues","commitSelection","selectItem","defaultProps","pointerStartedOnItem","ComboboxItemVirtualizedIndex","ComboboxItem$1","ComboboxItemIndicator","Inner","indicatorRef","ComboboxChips$1","hasSelectionChips","setHighlightedChipIndex","chipsRef","ComboboxEmpty$1","childrenProp","stateAttributesMapping","ComboboxClear$1","visible","InputGroup","className","inputGroupAddonVariants","InputGroupAddon","inputGroupButtonVariants","InputGroupButton","InputGroupInput","Combobox","ComboboxLabelContext","ComboboxTrigger","ComboboxClear","clearLabel","ComboboxInput","showTrigger","triggerLabel","showClear","ComboboxContent","portalContainer","labelledBy","ComboboxList","ComboboxItem","ComboboxEmpty","ComboboxLoading","matchesQuery","lowerQuery","option","isSameChoice","useFormSelectChoice","msg","InputSelectComponent","isOpen","setIsOpen","highlightedChoiceRef","selectedChoice","fieldId","typedText","match","onChange","clearProps","isClearable","choice","inputId","suppressPlaceholder","sizeToText","partLabel","ariaDescribedBy","isRequired","isErrored","startAdornment","isLoading"],"sources":["../../../node_modules/@base-ui/utils/visuallyHidden.mjs","../../../node_modules/lucide-react/dist/esm/icons/check.mjs","../../../node_modules/@base-ui/utils/platform/shared.mjs","../../../node_modules/@base-ui/utils/platform/os.mjs","../../../node_modules/@base-ui/utils/platform/engine.mjs","../../../node_modules/@base-ui/utils/platform/screen-reader.mjs","../../../node_modules/@base-ui/utils/platform/env.mjs","../../../node_modules/@base-ui/react/floating-ui-react/utils/constants.mjs","../../../node_modules/@base-ui/react/utils/CommonPopupDataAttributes.mjs","../../../node_modules/@base-ui/react/utils/CommonTriggerDataAttributes.mjs","../../../node_modules/@base-ui/react/utils/popupStateMapping.mjs","../../../node_modules/@base-ui/react/floating-ui-react/utils/element.mjs","../../../node_modules/@base-ui/react/floating-ui-react/utils/nodes.mjs","../../../node_modules/@base-ui/react/floating-ui-react/utils/event.mjs","../../../node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs","../../../node_modules/@base-ui/react/floating-ui-react/utils/tabbable.mjs","../../../node_modules/@base-ui/utils/useOnFirstRender.mjs","../../../node_modules/@base-ui/utils/fastHooks.mjs","../../../node_modules/@base-ui/utils/store/useStore.mjs","../../../node_modules/@base-ui/utils/store/Store.mjs","../../../node_modules/@base-ui/utils/store/ReactStore.mjs","../../../node_modules/@base-ui/utils/mergeCleanups.mjs","../../../node_modules/@base-ui/react/utils/FocusGuard.mjs","../../../node_modules/@base-ui/react/floating-ui-react/utils/createAttribute.mjs","../../../node_modules/@base-ui/react/floating-ui-react/utils/enqueueFocus.mjs","../../../node_modules/@base-ui/react/floating-ui-react/utils/markOthers.mjs","../../../node_modules/@base-ui/react/internals/constants.mjs","../../../node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs","../../../node_modules/@base-ui/react/floating-ui-react/utils/createEventEmitter.mjs","../../../node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs","../../../node_modules/@base-ui/react/floating-ui-react/components/FloatingFocusManager.mjs","../../../node_modules/@base-ui/react/floating-ui-react/hooks/useClick.mjs","../../../node_modules/@base-ui/react/floating-ui-react/hooks/useDismiss.mjs","../../../node_modules/@base-ui/react/node_modules/@floating-ui/core/dist/floating-ui.core.mjs","../../../node_modules/@base-ui/react/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs","../../../node_modules/@base-ui/react/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs","../../../node_modules/@base-ui/react/floating-ui-react/components/FloatingRootStore.mjs","../../../node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs","../../../node_modules/@base-ui/react/utils/popups/popupTriggerMap.mjs","../../../node_modules/@base-ui/react/floating-ui-react/hooks/useFloatingRootContext.mjs","../../../node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs","../../../node_modules/@base-ui/react/floating-ui-react/hooks/useListNavigation.mjs","../../../node_modules/@base-ui/react/floating-ui-react/hooks/useTypeahead.mjs","../../../node_modules/@base-ui/react/floating-ui-react/hooks/gridNavigation.mjs","../../../node_modules/@base-ui/react/combobox/root/ComboboxRootContext.mjs","../../../node_modules/@base-ui/utils/areArraysEqual.mjs","../../../node_modules/@base-ui/react/internals/itemEquality.mjs","../../../node_modules/@base-ui/react/internals/serializeValue.mjs","../../../node_modules/@base-ui/react/internals/resolveValueLabel.mjs","../../../node_modules/@base-ui/react/combobox/store.mjs","../../../node_modules/@base-ui/react/combobox/root/utils/index.mjs","../../../node_modules/@base-ui/utils/stringifyLocale.mjs","../../../node_modules/@base-ui/react/internals/filter.mjs","../../../node_modules/@base-ui/react/combobox/root/utils/useFilter.mjs","../../../node_modules/@base-ui/utils/useEnhancedClickHandler.mjs","../../../node_modules/@base-ui/react/utils/useOpenInteractionType.mjs","../../../node_modules/@base-ui/react/utils/scrollable.mjs","../../../node_modules/@base-ui/react/combobox/root/utils/constants.mjs","../../../node_modules/@base-ui/react/combobox/items/itemCollection.mjs","../../../node_modules/@base-ui/react/combobox/root/AriaCombobox.mjs","../../../node_modules/@base-ui/react/combobox/root/ComboboxRoot.mjs","../../../node_modules/@base-ui/react/utils/resolveAriaLabelledBy.mjs","../../../node_modules/@base-ui/react/combobox/input/ComboboxInputDataAttributes.mjs","../../../node_modules/@base-ui/react/combobox/utils/stateAttributesMapping.mjs","../../../node_modules/@base-ui/react/combobox/chips/ComboboxChipsContext.mjs","../../../node_modules/@base-ui/react/combobox/positioner/ComboboxPositionerContext.mjs","../../../node_modules/@base-ui/react/combobox/utils/ComboboxInternalDismissButton.mjs","../../../node_modules/@base-ui/react/combobox/utils/parts.mjs","../../../node_modules/@base-ui/react/combobox/input/ComboboxInput.mjs","../../../node_modules/@base-ui/react/combobox/utils/handleInputPress.mjs","../../../node_modules/@base-ui/react/utils/getPseudoElementBounds.mjs","../../../node_modules/@base-ui/react/combobox/trigger/ComboboxTrigger.mjs","../../../node_modules/@base-ui/react/combobox/collection/GroupCollectionContext.mjs","../../../node_modules/@base-ui/react/combobox/collection/ComboboxCollection.mjs","../../../node_modules/@base-ui/react/internals/composite/list/CompositeListContext.mjs","../../../node_modules/@base-ui/react/internals/composite/list/CompositeList.mjs","../../../node_modules/@base-ui/react/combobox/list/ComboboxList.mjs","../../../node_modules/@base-ui/react/combobox/utils/useInitialLiveRegionTextMutation.mjs","../../../node_modules/@base-ui/react/combobox/portal/ComboboxPortalContext.mjs","../../../node_modules/@base-ui/react/combobox/portal/ComboboxPortal.mjs","../../../node_modules/@base-ui/utils/inertValue.mjs","../../../node_modules/@base-ui/react/floating-ui-react/middleware/arrow.mjs","../../../node_modules/@base-ui/react/utils/hideMiddleware.mjs","../../../node_modules/@base-ui/react/utils/adaptiveOriginConstants.mjs","../../../node_modules/@base-ui/react/utils/CommonPositionerCssVars.mjs","../../../node_modules/@base-ui/react/internals/useAnchorPositioning.mjs","../../../node_modules/@base-ui/react/utils/InternalBackdrop.mjs","../../../node_modules/@base-ui/react/internals/getDisabledMountTransitionStyles.mjs","../../../node_modules/@base-ui/react/utils/usePositioner.mjs","../../../node_modules/@base-ui/utils/useScrollLock.mjs","../../../node_modules/@base-ui/react/utils/useAnchoredPopupScrollLock.mjs","../../../node_modules/@base-ui/react/combobox/positioner/ComboboxPositioner.mjs","../../../node_modules/@base-ui/react/combobox/popup/ComboboxPopup.mjs","../../../node_modules/@base-ui/react/internals/composite/list/useCompositeListItem.mjs","../../../node_modules/@base-ui/react/combobox/item/ComboboxItemContext.mjs","../../../node_modules/@base-ui/react/combobox/row/ComboboxRowContext.mjs","../../../node_modules/@base-ui/react/combobox/item/ComboboxItem.mjs","../../../node_modules/@base-ui/react/combobox/item-indicator/ComboboxItemIndicator.mjs","../../../node_modules/@base-ui/react/combobox/chips/ComboboxChips.mjs","../../../node_modules/@base-ui/react/combobox/empty/ComboboxEmpty.mjs","../../../node_modules/@base-ui/react/combobox/clear/ComboboxClear.mjs","../../../packages/ui/src/components/input-group.tsx","../../../packages/ui/src/components/combobox.tsx","../../src/components/FormInputs/InputSelect/InputSelectComponent.tsx"],"sourcesContent":["const visuallyHiddenBase = {\n clipPath: 'inset(50%)',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n border: 0,\n padding: 0,\n width: 1,\n height: 1,\n margin: -1\n};\nexport const visuallyHidden = {\n ...visuallyHiddenBase,\n position: 'fixed',\n top: 0,\n left: 0\n};\nexport const visuallyHiddenInput = {\n ...visuallyHiddenBase,\n position: 'absolute'\n};","/**\n * @license lucide-react v1.61.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 __iconData = {\n name: \"check\",\n size: 24,\n node: [[\"path\", { d: \"M20 6 9 17l-5-5\", key: \"1gmf2c\" }]]\n};\n__iconData.node;\nconst Check = createLucideIcon(__iconData);\n\nexport { __iconData, Check as default };\n//# sourceMappingURL=check.mjs.map\n","/**\n * Reads `navigator.userAgent` / `navigator.platform` (legacy but universally\n * supported) into a normalized shape. In development, prefers the modern\n * `navigator.userAgentData` API on Chromium to avoid DevTools warnings about\n * the deprecated reads; that branch is dead-code-eliminated in production\n * builds to keep the bundle small.\n *\n * Returns empty/zero values when `navigator` is undefined (SSR), so every\n * derived flag safely evaluates to `false`.\n */\nfunction readRawData() {\n if (typeof navigator === 'undefined') {\n return {\n userAgent: '',\n platform: '',\n maxTouchPoints: 0\n };\n }\n if (process.env.NODE_ENV !== 'production') {\n const uaData = navigator.userAgentData;\n if (uaData && Array.isArray(uaData.brands)) {\n return {\n userAgent: uaData.brands.map(({\n brand,\n version\n }) => `${brand}/${version}`).join(' '),\n platform: uaData.platform ?? navigator.platform ?? '',\n maxTouchPoints: navigator.maxTouchPoints ?? 0\n };\n }\n }\n return {\n userAgent: navigator.userAgent,\n platform: navigator.platform ?? '',\n maxTouchPoints: navigator.maxTouchPoints ?? 0\n };\n}\nconst {\n userAgent,\n platform,\n maxTouchPoints\n} = readRawData();\nexport const lowerUserAgent = userAgent.toLowerCase();\nexport const lowerPlatform = platform.toLowerCase();\nexport { maxTouchPoints };","import { lowerUserAgent, lowerPlatform, maxTouchPoints } from \"./shared.mjs\";\n\n// iPadOS 13+ reports `MacIntel` for `navigator.platform`; disambiguated via\n// `maxTouchPoints` so iPad is classified as iOS, not macOS.\n// https://github.com/mui/base-ui/issues/1309\n/** iPhone, iPad (including iPadOS 13+ reporting as macOS), iPod. */\nexport const ios = /^i(os$|p)/.test(lowerPlatform) || lowerPlatform === 'macintel' && maxTouchPoints > 1;\n\n/** Android phones, tablets, and embedded Android browsers. */\nconst ANDROID_STRING = 'android';\nexport const android = lowerPlatform === ANDROID_STRING || lowerUserAgent.includes(ANDROID_STRING);\n\n/** macOS desktop. Excludes iPadOS, which reports as `MacIntel`. */\nexport const mac = !ios && lowerPlatform.startsWith('mac');\n\n/** Windows desktop. */\nexport const windows = lowerPlatform.startsWith('win');\n\n/** Linux desktop (including Chrome OS). */\nexport const linux = !android && /^(linux|chrome os)/.test(lowerPlatform);\n\n/** Any Apple OS (`mac || ios`). */\nexport const apple = mac || ios;","import { lowerUserAgent } from \"./shared.mjs\";\n\n// WebKit (Safari, all iOS browsers, GNOME Web). Distinguished from Blink by\n// the legacy `-webkit-backdrop-filter` name — Blink forked from WebKit in 2013\n// and only ships the unprefixed `backdrop-filter`.\n/** WebKit: Safari, all iOS browsers, GNOME Web. Excludes Blink. */\nexport const webkit = typeof CSS !== 'undefined' && !!CSS.supports?.('-webkit-backdrop-filter:none');\n\n// Anchored to `!webkit` so engines are mutually exclusive by construction.\n// Firefox-on-iOS uses WebKit (its UA marker is `FxiOS/`, not `Firefox/`); the\n// `!webkit` prefix also defends against future iOS-browser UA changes that\n// might inject `Firefox` into a WebKit-based UA.\n/** Gecko: Firefox. */\nexport const gecko = !webkit && lowerUserAgent.includes('firefox');\n\n// All Chromium-based browsers ship `Chrome/` or `Chromium/` in their UA — both\n// share the `chrom` prefix, so a single substring check covers Chrome, Edge,\n// Opera, Brave, etc. Chrome-on-iOS uses `CriOS/` and stays WebKit. The positive\n// UA check also makes this SSR-safe — an empty UA matches nothing.\n/** Blink: Chrome, Edge, Opera, Brave, and other Chromium-based browsers. */\nexport const blink = !webkit && lowerUserAgent.includes('chrom');","import { apple } from \"./os.mjs\";\n\n// Whether a screen reader is *actually* running cannot be detected. These flags\n// identify platforms where a specific screen reader could be active. VoiceOver\n// is the system screen reader on Apple platforms and works with every browser\n// there, so the flag is purely an OS check; engine-specific quirks (e.g. the\n// NSAccessibility virtual-cursor focus path) should be gated at the call site.\n/**\n * The user *may* be using VoiceOver — actual activation is not detectable.\n * True on any Apple platform (macOS, iOS, iPadOS).\n */\nexport const voiceOver = apple;","import { lowerUserAgent } from \"./shared.mjs\";\n\n/** Running in jsdom or HappyDOM (used by unit tests). */\nexport const jsdom = /jsdom|happydom/.test(lowerUserAgent);","export const FOCUSABLE_ATTRIBUTE = 'data-base-ui-focusable';\nexport const ACTIVE_KEY = 'active';\nexport const SELECTED_KEY = 'selected';\nexport const TYPEABLE_SELECTOR = \"input:not([type='hidden']):not([disabled]),\" + \"[contenteditable]:not([contenteditable='false']),textarea:not([disabled])\";\nexport const ARROW_LEFT = 'ArrowLeft';\nexport const ARROW_RIGHT = 'ArrowRight';\nexport const ARROW_UP = 'ArrowUp';\nexport const ARROW_DOWN = 'ArrowDown';","import * as TransitionStatusDataAttributes from \"../internals/TransitionStatusDataAttributes.mjs\";\n\n/**\n * Present when the popup is open.\n */\nexport const open = 'data-open';\n\n/**\n * Present when the popup is closed.\n */\nexport const closed = 'data-closed';\n\n/**\n * Present when the popup begins animating in.\n */\nexport const startingStyle = TransitionStatusDataAttributes.startingStyle;\n\n/**\n * Present when the popup is animating out.\n */\nexport const endingStyle = TransitionStatusDataAttributes.endingStyle;\n\n/**\n * Present when the anchor is hidden.\n */\nexport const anchorHidden = 'data-anchor-hidden';\n\n/**\n * Indicates which side the popup is positioned relative to the trigger.\n * @type { 'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start'}\n */\nexport const side = 'data-side';\n\n/**\n * Indicates how the popup is aligned relative to specified side.\n * @type {'start' | 'center' | 'end'}\n */\nexport const align = 'data-align';","/**\n * Present when the popup is open.\n */\nexport const popupOpen = 'data-popup-open';\n\n/**\n * Present when a pressable trigger is pressed.\n */\nexport const pressed = 'data-pressed';","import { transitionStatusMapping } from \"../internals/stateAttributesMapping.mjs\";\nimport * as CommonPopupDataAttributes from \"./CommonPopupDataAttributes.mjs\";\nimport * as CommonTriggerDataAttributes from \"./CommonTriggerDataAttributes.mjs\";\nexport { CommonPopupDataAttributes, CommonTriggerDataAttributes };\nconst TRIGGER_HOOK = {\n [CommonTriggerDataAttributes.popupOpen]: ''\n};\nconst PRESSABLE_TRIGGER_HOOK = {\n [CommonTriggerDataAttributes.popupOpen]: '',\n [CommonTriggerDataAttributes.pressed]: ''\n};\nconst POPUP_OPEN_HOOK = {\n [CommonPopupDataAttributes.open]: ''\n};\nconst POPUP_CLOSED_HOOK = {\n [CommonPopupDataAttributes.closed]: ''\n};\nconst ANCHOR_HIDDEN_HOOK = {\n [CommonPopupDataAttributes.anchorHidden]: ''\n};\nexport const triggerOpenStateMapping = {\n open(value) {\n if (value) {\n return TRIGGER_HOOK;\n }\n return null;\n }\n};\nexport const pressableTriggerOpenStateMapping = {\n open(value) {\n if (value) {\n return PRESSABLE_TRIGGER_HOOK;\n }\n return null;\n }\n};\nexport const popupStateMapping = {\n open(value) {\n if (value) {\n return POPUP_OPEN_HOOK;\n }\n return POPUP_CLOSED_HOOK;\n },\n anchorHidden(value) {\n if (value) {\n return ANCHOR_HIDDEN_HOOK;\n }\n return null;\n }\n};\nexport const popupTransitionStateMapping = {\n ...popupStateMapping,\n ...transitionStatusMapping\n};","import { isElement, isHTMLElement } from '@floating-ui/utils/dom';\nimport { platform } from '@base-ui/utils/platform';\nimport { activeElement, contains, getTarget } from '@base-ui/utils/shadowDom';\nimport { FOCUSABLE_ATTRIBUTE, TYPEABLE_SELECTOR } from \"./constants.mjs\";\nimport * as TooltipTriggerDataAttributes from \"../../tooltip/trigger/TooltipTriggerDataAttributes.mjs\";\nexport { activeElement, contains, getTarget };\nexport function isTargetInsideEnabledTrigger(target, triggerElements) {\n if (!isElement(target)) {\n return false;\n }\n const targetElement = target;\n if (triggerElements.hasElement(targetElement)) {\n return !targetElement.hasAttribute(TooltipTriggerDataAttributes.triggerDisabled);\n }\n for (const [, trigger] of triggerElements.entries()) {\n if (contains(trigger, targetElement)) {\n return !trigger.hasAttribute(TooltipTriggerDataAttributes.triggerDisabled);\n }\n }\n return false;\n}\nexport function isEventTargetWithin(event, node) {\n if (node == null) {\n return false;\n }\n if ('composedPath' in event) {\n return event.composedPath().includes(node);\n }\n\n // TS thinks `event` is of type never as it assumes all browsers support composedPath, but browsers without shadow dom don't\n const eventAgain = event;\n return eventAgain.target != null && node.contains(eventAgain.target);\n}\nexport function isRootElement(element) {\n return element.matches('html,body');\n}\nexport function isTypeableElement(element) {\n return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);\n}\nexport function isInteractiveElement(element) {\n return element?.closest(`button,a[href],[role=\"button\"],select,[tabindex]:not([tabindex=\"-1\"]),${TYPEABLE_SELECTOR}`) != null;\n}\nexport function isTypeableCombobox(element) {\n if (!element) {\n return false;\n }\n return element.getAttribute('role') === 'combobox' && isTypeableElement(element);\n}\nexport function matchesFocusVisible(element) {\n // We don't want to block focus from working with `visibleOnly`\n // (JSDOM doesn't match `:focus-visible` when the element has `:focus`)\n if (!element || platform.env.jsdom) {\n return true;\n }\n try {\n return element.matches(':focus-visible');\n } catch (_e) {\n return true;\n }\n}\nexport function getFloatingFocusElement(floatingElement) {\n if (!floatingElement) {\n return null;\n }\n // Try to find the element that has `{...getFloatingProps()}` spread on it.\n // This indicates the floating element is acting as a positioning wrapper, and\n // so focus should be managed on the child element with the event handlers and\n // aria props.\n return floatingElement.hasAttribute(FOCUSABLE_ATTRIBUTE) ? floatingElement : floatingElement.querySelector(`[${FOCUSABLE_ATTRIBUTE}]`) || floatingElement;\n}","/* eslint-disable @typescript-eslint/no-loop-func */\n\nexport function getNodeChildren(nodes, id, onlyOpenChildren = true) {\n const directChildren = nodes.filter(node => node.parentId === id);\n return directChildren.flatMap(child => [...(!onlyOpenChildren || child.context?.open ? [child] : []), ...getNodeChildren(nodes, child.id, onlyOpenChildren)]);\n}\nexport function getDeepestNode(nodes, id) {\n let deepestNodeId;\n let maxDepth = -1;\n function findDeepest(nodeId, depth) {\n if (depth > maxDepth) {\n deepestNodeId = nodeId;\n maxDepth = depth;\n }\n const children = getNodeChildren(nodes, nodeId);\n children.forEach(child => {\n findDeepest(child.id, depth + 1);\n });\n }\n findDeepest(id, 0);\n return nodes.find(node => node.id === deepestNodeId);\n}\nexport function getNodeAncestors(nodes, id) {\n let allAncestors = [];\n let currentParentId = nodes.find(node => node.id === id)?.parentId;\n while (currentParentId) {\n const currentNode = nodes.find(node => node.id === currentParentId);\n currentParentId = currentNode?.parentId;\n if (currentNode) {\n allAncestors = allAncestors.concat(currentNode);\n }\n }\n return allAncestors;\n}","import { platform } from '@base-ui/utils/platform';\nexport function stopEvent(event) {\n event.preventDefault();\n event.stopPropagation();\n}\nexport function isReactEvent(event) {\n return 'nativeEvent' in event;\n}\n\n// License: https://github.com/adobe/react-spectrum/blob/main/packages/@react-aria/utils/src/isVirtualEvent.ts\nexport function isVirtualClick(event) {\n if (event.pointerType === '' && event.isTrusted) {\n return true;\n }\n if (platform.os.android && event.pointerType) {\n return event.type === 'click' && event.buttons === 1;\n }\n return event.detail === 0 && !event.pointerType;\n}\nexport function isVirtualPointerEvent(event) {\n if (platform.env.jsdom) {\n return false;\n }\n return !platform.os.android && event.width === 0 && event.height === 0 || platform.os.android && event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'mouse' ||\n // iOS VoiceOver returns 0.333• for width/height.\n event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'touch';\n}\nexport function isMouseLikePointerType(pointerType, strict) {\n // On some Linux machines with Chromium, mouse inputs return a `pointerType`\n // of \"pen\": https://github.com/floating-ui/floating-ui/issues/2015\n const values = ['mouse', 'pen'];\n if (!strict) {\n values.push('', undefined);\n }\n return values.includes(pointerType);\n}\nexport function isClickLikeEvent(event) {\n const type = event.type;\n return type === 'click' || type === 'mousedown' || type === 'keydown' || type === 'keyup';\n}","import { floor } from '@floating-ui/utils';\nimport { getComputedStyle } from '@floating-ui/utils/dom';\nimport { stopEvent } from \"./event.mjs\";\nimport { ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP } from \"./constants.mjs\";\nexport function isDifferentGridRow(index, cols, prevRow) {\n return Math.floor(index / cols) !== prevRow;\n}\nexport function isIndexOutOfListBounds(list, index) {\n return index < 0 || index >= list.length;\n}\nexport function getMinListIndex(listRef, disabledIndices) {\n return findNonDisabledListIndex(listRef.current, {\n disabledIndices\n });\n}\nexport function getMaxListIndex(listRef, disabledIndices) {\n return findNonDisabledListIndex(listRef.current, {\n decrement: true,\n startingIndex: listRef.current.length,\n disabledIndices\n });\n}\nexport function findNonDisabledListIndex(list, {\n startingIndex = -1,\n decrement = false,\n disabledIndices,\n amount = 1\n} = {}) {\n let index = startingIndex;\n do {\n index += decrement ? -amount : amount;\n } while (index >= 0 && index <= list.length - 1 && isListIndexDisabled(list, index, disabledIndices));\n return index;\n}\nexport function getGridNavigatedIndex(list, {\n event,\n orientation,\n loopFocus,\n onLoop,\n rtl,\n cols,\n disabledIndices,\n minIndex,\n maxIndex,\n prevIndex,\n stopEvent: stop = false\n}) {\n let nextIndex = prevIndex;\n let verticalDirection;\n if (event.key === ARROW_UP) {\n verticalDirection = 'up';\n } else if (event.key === ARROW_DOWN) {\n verticalDirection = 'down';\n }\n if (verticalDirection) {\n // -------------------------------------------------------------------------\n // Detect row structure only when handling vertical navigation. This keeps\n // the non-vertical key paths free from row inference work.\n // -------------------------------------------------------------------------\n const rows = [];\n const rowIndexMap = [];\n let hasRoleRow = false;\n let visibleItemCount = 0;\n {\n let currentRowEl = null;\n let currentRowIndex = -1;\n list.forEach((el, idx) => {\n if (el == null) {\n return;\n }\n visibleItemCount += 1;\n const rowEl = el.closest('[role=\"row\"]');\n if (rowEl) {\n hasRoleRow = true;\n }\n if (rowEl !== currentRowEl || currentRowIndex === -1) {\n currentRowEl = rowEl;\n currentRowIndex += 1;\n rows[currentRowIndex] = [];\n }\n rows[currentRowIndex].push(idx);\n rowIndexMap[idx] = currentRowIndex;\n });\n }\n let hasDomRows = false;\n let inferredDomCols = 0;\n if (hasRoleRow) {\n for (const row of rows) {\n const rowLength = row.length;\n if (rowLength > inferredDomCols) {\n inferredDomCols = rowLength;\n }\n if (rowLength !== cols) {\n hasDomRows = true;\n }\n }\n }\n const hasVirtualizedGaps = hasDomRows && visibleItemCount < list.length;\n const verticalCols = inferredDomCols || cols;\n const navigateVertically = direction => {\n if (!hasDomRows || prevIndex === -1) {\n return undefined;\n }\n const currentRow = rowIndexMap[prevIndex];\n if (currentRow == null) {\n return undefined;\n }\n const colInRow = rows[currentRow].indexOf(prevIndex);\n const step = direction === 'up' ? -1 : 1;\n for (let nextRow = currentRow + step, i = 0; i < rows.length; i += 1, nextRow += step) {\n if (nextRow < 0 || nextRow >= rows.length) {\n if (!loopFocus || hasVirtualizedGaps) {\n return undefined;\n }\n nextRow = nextRow < 0 ? rows.length - 1 : 0;\n if (onLoop) {\n const clampedCol = Math.min(colInRow, rows[nextRow].length - 1);\n const targetItemIndex = rows[nextRow][clampedCol] ?? rows[nextRow][0];\n const returnedItemIndex = onLoop(event, prevIndex, targetItemIndex);\n nextRow = rowIndexMap[returnedItemIndex] ?? nextRow;\n }\n }\n const targetRow = rows[nextRow];\n for (let col = Math.min(colInRow, targetRow.length - 1); col >= 0; col -= 1) {\n const candidate = targetRow[col];\n if (!isListIndexDisabled(list, candidate, disabledIndices)) {\n return candidate;\n }\n }\n }\n return undefined;\n };\n const navigateVerticallyWithInferredRows = direction => {\n if (!hasVirtualizedGaps || prevIndex === -1) {\n return undefined;\n }\n const colInRow = prevIndex % verticalCols;\n const rowStep = direction === 'up' ? -verticalCols : verticalCols;\n const lastRowStart = maxIndex - maxIndex % verticalCols;\n const rowCount = floor(maxIndex / verticalCols) + 1;\n for (let rowStart = prevIndex - colInRow + rowStep, i = 0; i < rowCount; i += 1, rowStart += rowStep) {\n if (rowStart < 0 || rowStart > maxIndex) {\n if (!loopFocus) {\n return undefined;\n }\n rowStart = rowStart < 0 ? lastRowStart : 0;\n }\n const rowEnd = Math.min(rowStart + verticalCols - 1, maxIndex);\n for (let candidate = Math.min(rowStart + colInRow, rowEnd); candidate >= rowStart; candidate -= 1) {\n if (!isListIndexDisabled(list, candidate, disabledIndices)) {\n return candidate;\n }\n }\n }\n return undefined;\n };\n if (stop) {\n stopEvent(event);\n }\n const verticalCandidate = navigateVertically(verticalDirection) ?? navigateVerticallyWithInferredRows(verticalDirection);\n if (verticalCandidate !== undefined) {\n nextIndex = verticalCandidate;\n } else if (prevIndex === -1) {\n nextIndex = verticalDirection === 'up' ? maxIndex : minIndex;\n } else {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex,\n amount: verticalCols,\n decrement: verticalDirection === 'up',\n disabledIndices\n });\n if (loopFocus) {\n if (verticalDirection === 'up' && (prevIndex - verticalCols < minIndex || nextIndex < 0)) {\n const col = prevIndex % verticalCols;\n const maxCol = maxIndex % verticalCols;\n const offset = maxIndex - (maxCol - col);\n if (maxCol === col) {\n nextIndex = maxIndex;\n } else {\n nextIndex = maxCol > col ? offset : offset - verticalCols;\n }\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n if (verticalDirection === 'down' && prevIndex + verticalCols > maxIndex) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex % verticalCols - verticalCols,\n amount: verticalCols,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n }\n }\n if (isIndexOutOfListBounds(list, nextIndex)) {\n nextIndex = prevIndex;\n }\n }\n\n // Remains on the same row/column.\n if (orientation === 'both') {\n const prevRow = floor(prevIndex / cols);\n if (event.key === (rtl ? ARROW_LEFT : ARROW_RIGHT)) {\n if (stop) {\n stopEvent(event);\n }\n if (prevIndex % cols !== cols - 1) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex,\n disabledIndices\n });\n if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex - prevIndex % cols - 1,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n } else if (loopFocus) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex - prevIndex % cols - 1,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n if (isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = prevIndex;\n }\n }\n if (event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT)) {\n if (stop) {\n stopEvent(event);\n }\n if (prevIndex % cols !== 0) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex,\n decrement: true,\n disabledIndices\n });\n if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex + (cols - prevIndex % cols),\n decrement: true,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n } else if (loopFocus) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex + (cols - prevIndex % cols),\n decrement: true,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n if (isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = prevIndex;\n }\n }\n const lastRow = floor(maxIndex / cols) === prevRow;\n if (isIndexOutOfListBounds(list, nextIndex)) {\n if (loopFocus && lastRow) {\n nextIndex = event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT) ? maxIndex : findNonDisabledListIndex(list, {\n startingIndex: prevIndex - prevIndex % cols - 1,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n } else {\n nextIndex = prevIndex;\n }\n }\n }\n return nextIndex;\n}\n\n/** For each cell index, gets the item index that occupies that cell */\nexport function createGridCellMap(sizes, cols, dense) {\n const cellMap = [];\n let startIndex = 0;\n sizes.forEach(({\n width,\n height\n }, index) => {\n if (width > cols) {\n if (process.env.NODE_ENV !== 'production') {\n // TODO: fix mui/no-guarded-throw\n // eslint-disable-next-line mui/no-guarded-throw\n throw new Error(`[Floating UI]: Invalid grid - item width at index ${index} is greater than grid columns`);\n }\n }\n let itemPlaced = false;\n if (dense) {\n startIndex = 0;\n }\n while (!itemPlaced) {\n const targetCells = [];\n for (let i = 0; i < width; i += 1) {\n for (let j = 0; j < height; j += 1) {\n targetCells.push(startIndex + i + j * cols);\n }\n }\n if (startIndex % cols + width <= cols && targetCells.every(cell => cellMap[cell] == null)) {\n targetCells.forEach(cell => {\n cellMap[cell] = index;\n });\n itemPlaced = true;\n } else {\n startIndex += 1;\n }\n }\n });\n\n // convert into a non-sparse array\n return [...cellMap];\n}\n\n/** Gets cell index of an item's corner or -1 when index is -1. */\nexport function getGridCellIndexOfCorner(index, sizes, cellMap, cols, corner) {\n if (index === -1) {\n return -1;\n }\n const firstCellIndex = cellMap.indexOf(index);\n const sizeItem = sizes[index];\n switch (corner) {\n case 'tl':\n return firstCellIndex;\n case 'tr':\n if (!sizeItem) {\n return firstCellIndex;\n }\n return firstCellIndex + sizeItem.width - 1;\n case 'bl':\n if (!sizeItem) {\n return firstCellIndex;\n }\n return firstCellIndex + (sizeItem.height - 1) * cols;\n case 'br':\n return cellMap.lastIndexOf(index);\n default:\n return -1;\n }\n}\n\n/** Gets all cell indices that correspond to the specified indices */\nexport function getGridCellIndices(indices, cellMap) {\n return cellMap.flatMap((index, cellIndex) => indices.includes(index) ? [cellIndex] : []);\n}\nexport function isListIndexDisabled(list, index, disabledIndices) {\n const isExplicitlyDisabled = typeof disabledIndices === 'function' ? disabledIndices(index) : disabledIndices?.includes(index) ?? false;\n if (isExplicitlyDisabled) {\n return true;\n }\n const element = list[index];\n if (!element) {\n return false;\n }\n if (!isElementVisible(element)) {\n return true;\n }\n\n // A natively disabled element can never receive focus, so it must always be\n // skipped, even when `disabledIndices` marks it as enabled. Only\n // `aria-disabled` items can be focusable-while-disabled.\n if (element.matches(':disabled')) {\n return true;\n }\n return !disabledIndices && (element.hasAttribute('disabled') || element.getAttribute('aria-disabled') === 'true');\n}\nexport function isHiddenByStyles(styles) {\n return styles.visibility === 'hidden' || styles.visibility === 'collapse';\n}\nexport function isElementVisible(element, styles = element ? getComputedStyle(element) : null) {\n if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) {\n return false;\n }\n if (typeof element.checkVisibility === 'function') {\n return element.checkVisibility();\n }\n return styles.display !== 'none' && styles.display !== 'contents';\n}","import { getComputedStyle, getNodeName, isHTMLElement, isShadowRoot } from '@floating-ui/utils/dom';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { activeElement, contains } from \"./element.mjs\";\nimport { isElementVisible } from \"./composite.mjs\";\nconst CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable=\"false\"]),audio[controls],video[controls]';\nfunction getParentElement(element) {\n const assignedSlot = element.assignedSlot;\n if (assignedSlot) {\n return assignedSlot;\n }\n if (element.parentElement) {\n return element.parentElement;\n }\n const rootNode = element.getRootNode();\n return isShadowRoot(rootNode) ? rootNode.host : null;\n}\nfunction getDetailsSummary(details) {\n for (const child of Array.from(details.children)) {\n if (getNodeName(child) === 'summary') {\n return child;\n }\n }\n return null;\n}\nfunction isWithinOpenDetailsSummary(element, details) {\n const summary = getDetailsSummary(details);\n return !!summary && (element === summary || contains(summary, element));\n}\nfunction isFocusableCandidate(element) {\n const nodeName = element ? getNodeName(element) : '';\n return element != null && element.matches(CANDIDATE_SELECTOR) && (nodeName !== 'summary' || element.parentElement != null && getNodeName(element.parentElement) === 'details' && getDetailsSummary(element.parentElement) === element) && (nodeName !== 'details' || getDetailsSummary(element) == null) && (nodeName !== 'input' || element.type !== 'hidden');\n}\nfunction isFocusableElement(element) {\n if (!isFocusableCandidate(element) || !element.isConnected || element.matches(':disabled')) {\n return false;\n }\n for (let current = element; current; current = getParentElement(current)) {\n const isAncestor = current !== element;\n const isSlot = getNodeName(current) === 'slot';\n if (current.hasAttribute('inert')) {\n return false;\n }\n if (isAncestor && getNodeName(current) === 'details' && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute('hidden') || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) {\n return false;\n }\n }\n return true;\n}\nfunction isVisibleInTabbableTree(element, isAncestor) {\n const styles = getComputedStyle(element);\n if (!isAncestor) {\n return isElementVisible(element, styles);\n }\n return styles.display !== 'none';\n}\nfunction getTabIndex(element) {\n const tabIndex = element.tabIndex;\n if (tabIndex < 0) {\n const nodeName = getNodeName(element);\n if (nodeName === 'details' || nodeName === 'audio' || nodeName === 'video' || isHTMLElement(element) && element.isContentEditable) {\n return 0;\n }\n }\n return tabIndex;\n}\nfunction getNamedRadioInput(element) {\n if (getNodeName(element) !== 'input') {\n return null;\n }\n const input = element;\n return input.type === 'radio' && input.name !== '' ? input : null;\n}\nfunction isTabbableRadio(element, candidates) {\n const input = getNamedRadioInput(element);\n if (!input) {\n return true;\n }\n const checkedRadio = candidates.find(candidate => {\n const radio = getNamedRadioInput(candidate);\n return radio?.name === input.name && radio.form === input.form && radio.checked;\n });\n if (checkedRadio) {\n return checkedRadio === input;\n }\n return candidates.find(candidate => {\n const radio = getNamedRadioInput(candidate);\n return radio?.name === input.name && radio.form === input.form;\n }) === input;\n}\nfunction getComposedChildren(container) {\n if (isHTMLElement(container) && getNodeName(container) === 'slot') {\n const assignedElements = container.assignedElements({\n flatten: true\n });\n if (assignedElements.length > 0) {\n return assignedElements;\n }\n }\n if (isHTMLElement(container) && container.shadowRoot) {\n return Array.from(container.shadowRoot.children);\n }\n return Array.from(container.children);\n}\nfunction appendCandidates(container, list) {\n getComposedChildren(container).forEach(child => {\n if (isFocusableCandidate(child)) {\n list.push(child);\n }\n appendCandidates(child, list);\n });\n}\nfunction appendMatchingElements(container, selector, list) {\n getComposedChildren(container).forEach(child => {\n if (isHTMLElement(child) && child.matches(selector)) {\n list.push(child);\n }\n appendMatchingElements(child, selector, list);\n });\n}\nexport function isTabbable(element) {\n return isFocusableElement(element) && getTabIndex(element) >= 0;\n}\nexport function focusable(container) {\n const candidates = [];\n appendCandidates(container, candidates);\n return candidates.filter(isFocusableElement);\n}\nexport function tabbable(container) {\n const candidates = focusable(container);\n return candidates.filter(element => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates));\n}\nfunction getTabbableIn(container, dir) {\n const list = tabbable(container);\n const len = list.length;\n if (len === 0) {\n return undefined;\n }\n const active = activeElement(ownerDocument(container));\n const index = list.indexOf(active);\n // eslint-disable-next-line no-nested-ternary\n const nextIndex = index === -1 ? dir === 1 ? 0 : len - 1 : index + dir;\n return list[nextIndex];\n}\nexport function getNextTabbable(referenceElement) {\n return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement;\n}\nexport function getPreviousTabbable(referenceElement) {\n return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement;\n}\nfunction getTabbableNearElement(referenceElement, dir) {\n if (!referenceElement) {\n return null;\n }\n const list = tabbable(ownerDocument(referenceElement).body);\n const elementCount = list.length;\n if (elementCount === 0) {\n return null;\n }\n const index = list.indexOf(referenceElement);\n if (index === -1) {\n return null;\n }\n const nextIndex = (index + dir + elementCount) % elementCount;\n return list[nextIndex];\n}\nexport function getTabbableAfterElement(referenceElement) {\n return getTabbableNearElement(referenceElement, 1);\n}\nexport function getTabbableBeforeElement(referenceElement) {\n return getTabbableNearElement(referenceElement, -1);\n}\nexport function isOutsideEvent(event, container) {\n const containerElement = container || event.currentTarget;\n const relatedTarget = event.relatedTarget;\n return !relatedTarget || !contains(containerElement, relatedTarget);\n}\nexport function disableFocusInside(container) {\n const tabbableElements = tabbable(container);\n tabbableElements.forEach(element => {\n element.dataset.tabindex = element.getAttribute('tabindex') || '';\n element.setAttribute('tabindex', '-1');\n });\n}\nexport function enableFocusInside(container) {\n const elements = [];\n appendMatchingElements(container, '[data-tabindex]', elements);\n elements.forEach(element => {\n const tabindex = element.dataset.tabindex;\n delete element.dataset.tabindex;\n if (tabindex) {\n element.setAttribute('tabindex', tabindex);\n } else {\n element.removeAttribute('tabindex');\n }\n });\n}","'use client';\n\nimport * as React from 'react';\nexport function useOnFirstRender(fn) {\n const ref = React.useRef(true);\n if (ref.current) {\n ref.current = false;\n fn();\n }\n}","import * as React from 'react';\nimport { useRefWithInit } from \"./useRefWithInit.mjs\";\nconst hooks = [];\nlet currentInstance = undefined;\nexport function getInstance() {\n return currentInstance;\n}\nexport function setInstance(instance) {\n currentInstance = instance;\n}\nexport function register(hook) {\n hooks.push(hook);\n}\n\n/**\n * Wraps a component function to enable performance optimizations for internal hooks.\n *\n * **Performance Optimization:**\n * Components wrapped with `fastComponent` have access to a shared \"instance\" context that enables\n * specialized hook implementations to batch operations and reduce overhead. The wrapper creates a\n * stable instance object that persists across renders, sets it as the current context, calls\n * registered hooks before and after rendering, then clears the context. The primary benefit is\n * with `useStore`, where multiple store subscriptions within the same component are collapsed into\n * a single `useSyncExternalStore` subscription per store, significantly reducing re-render overhead.\n * This optimization is only active on React 19+; on earlier versions `useStore` falls back to a\n * separate subscription per call.\n *\n * **Requirements:**\n * - The component function should follow standard React component patterns\n * - `useStore` calls must keep a stable order and count across renders, as batched hooks are\n * matched by call index\n * - Do not rely on the instance context outside of specialized hooks\n *\n * @param fn - The component function to wrap\n * @returns A wrapped component with the same signature as the input function\n *\n * @example\n * ```tsx\n * // Wrapping a component to enable optimized useStore batching\n * export const TooltipRoot = fastComponent(function TooltipRoot(props) {\n * // These useStore calls share a single subscription\n * const open = useStore(store, (state) => state.open);\n * const disabled = useStore(store, (state) => state.disabled);\n * const value = useStore(store, (state) => state.value);\n * // ...\n * });\n * ```\n */\nexport function fastComponent(fn) {\n const FastComponent = (props, forwardedRef) => {\n const instance = useRefWithInit(createInstance).current;\n let result;\n try {\n currentInstance = instance;\n for (const hook of hooks) {\n hook.before(instance);\n }\n result = fn(props, forwardedRef);\n for (const hook of hooks) {\n hook.after(instance);\n }\n instance.didInitialize = true;\n } finally {\n currentInstance = undefined;\n }\n return result;\n };\n FastComponent.displayName = fn.displayName || fn.name;\n return FastComponent;\n}\n\n/**\n * Wraps a component function with ref forwarding to enable performance optimizations for internal hooks.\n *\n * This is a convenience wrapper that combines `fastComponent` with `React.forwardRef`, enabling\n * both performance optimizations and proper ref forwarding. See `fastComponent` for details on\n * the performance benefits.\n *\n * @param fn - The component function that accepts props and a forwarded ref\n * @returns A wrapped component with ref forwarding enabled\n *\n * @example\n * ```tsx\n * // Wrapping a component with ref forwarding and optimized hooks\n * export const TooltipTrigger = fastComponentRef(function TooltipTrigger(\n * props,\n * forwardedRef\n * ) {\n * const store = useContext(TooltipContext);\n * const open = useStore(store, (state) => state.open);\n * // ... component logic with ref\n * return <button ref={forwardedRef} {...props} />;\n * });\n * ```\n */\nexport function fastComponentRef(fn) {\n return /*#__PURE__*/React.forwardRef(fastComponent(fn));\n}\nfunction createInstance() {\n return {\n didInitialize: false\n };\n}","import * as React from 'react';\n/* We need to import the shim because React 17 does not support the `useSyncExternalStore` API.\n * More info: https://github.com/mui/mui-x/issues/18303#issuecomment-2958392341 */\nimport { useSyncExternalStore } from 'use-sync-external-store/shim';\nimport { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector';\nimport { isReactVersionAtLeast } from \"../reactVersion.mjs\";\nimport { register, getInstance } from \"../fastHooks.mjs\";\n/* Some tests fail in R18 with the raw useSyncExternalStore. It may be possible to make it work\n * but for now we only enable it for R19+. */\nconst canUseRawUseSyncExternalStore = isReactVersionAtLeast(19);\nconst useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy;\nexport function useStore(store, selector, a1, a2, a3) {\n return useStoreImplementation(store, selector, a1, a2, a3);\n}\nfunction useStoreR19(store, selector, a1, a2, a3) {\n const getSelection = React.useCallback(() => selector(store.getSnapshot(), a1, a2, a3), [store, selector, a1, a2, a3]);\n return useSyncExternalStore(store.subscribe, getSelection, getSelection);\n}\nregister({\n before(instance) {\n instance.syncIndex = 0;\n if (!instance.didInitialize) {\n instance.syncTick = 1;\n instance.syncHooks = [];\n instance.didChangeStore = true;\n instance.getSnapshot = () => {\n let didChange = false;\n for (let i = 0; i < instance.syncHooks.length; i += 1) {\n const hook = instance.syncHooks[i];\n const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3);\n if (!Object.is(hook.value, value)) {\n didChange = true;\n hook.value = value;\n }\n }\n if (didChange) {\n instance.syncTick += 1;\n }\n return instance.syncTick;\n };\n }\n },\n after(instance) {\n if (instance.syncHooks.length > 0) {\n if (instance.didChangeStore) {\n instance.didChangeStore = false;\n instance.subscribe = onStoreChange => {\n const stores = new Set();\n for (const hook of instance.syncHooks) {\n stores.add(hook.store);\n }\n const unsubscribes = [];\n for (const store of stores) {\n unsubscribes.push(store.subscribe(onStoreChange));\n }\n return () => {\n for (const unsubscribe of unsubscribes) {\n unsubscribe();\n }\n };\n };\n }\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useSyncExternalStore(instance.subscribe, instance.getSnapshot, instance.getSnapshot);\n }\n }\n});\nfunction useStoreFast(store, selector, a1, a2, a3) {\n const instance = getInstance();\n if (!instance) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useStoreR19(store, selector, a1, a2, a3);\n }\n const index = instance.syncIndex;\n instance.syncIndex += 1;\n let hook;\n if (!instance.didInitialize) {\n hook = {\n store,\n selector,\n a1,\n a2,\n a3,\n value: selector(store.getSnapshot(), a1, a2, a3)\n };\n instance.syncHooks.push(hook);\n } else {\n hook = instance.syncHooks[index];\n if (hook.store !== store || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) {\n if (hook.store !== store) {\n instance.didChangeStore = true;\n }\n hook.store = store;\n hook.selector = selector;\n hook.a1 = a1;\n hook.a2 = a2;\n hook.a3 = a3;\n hook.value = selector(store.getSnapshot(), a1, a2, a3);\n }\n }\n return hook.value;\n}\nfunction useStoreLegacy(store, selector, a1, a2, a3) {\n return useSyncExternalStoreWithSelector(store.subscribe, store.getSnapshot, store.getSnapshot, state => selector(state, a1, a2, a3));\n}","import { useStore } from \"./useStore.mjs\";\n/**\n * A data store implementation that allows subscribing to state changes and updating the state.\n * It uses an observer pattern to notify subscribers when the state changes.\n */\nexport class Store {\n /**\n * Creates a store with the given initial state, constructing the class it is called on.\n * Calling it on a generic base class (e.g. `ReactStore.create(...)`) constructs that\n * class but degrades the inferred instance type to `Store`; use `new` there instead.\n */\n static create(state) {\n return new this(state);\n }\n\n /**\n * The current state of the store.\n * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}.\n * To subscribe to state changes, use the {@link useState} method. The value returned by {@link useState} is updated after the component renders (similarly to React's useState).\n * The values can be used directly (to avoid subscribing to the store) in effects or event handlers.\n *\n * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification.\n */\n\n // Internal state to handle recursive `setState()` calls\n\n constructor(state) {\n this.state = state;\n this.listeners = new Set();\n this.updateTick = 0;\n }\n\n /**\n * Registers a listener that will be called whenever the store's state changes.\n *\n * @param fn The listener function to be called on state changes.\n * @returns A function to unsubscribe the listener.\n */\n subscribe = fn => {\n this.listeners.add(fn);\n return () => {\n this.listeners.delete(fn);\n };\n };\n\n /**\n * Returns the current state of the store.\n */\n getSnapshot = () => {\n return this.state;\n };\n\n /**\n * Updates the entire store's state and notifies all registered listeners.\n *\n * @param newState The new state to set for the store.\n */\n setState(newState) {\n if (this.state === newState) {\n return;\n }\n this.state = newState;\n this.updateTick += 1;\n const currentTick = this.updateTick;\n for (const listener of this.listeners) {\n if (currentTick !== this.updateTick) {\n // If the tick has changed, a recursive `setState` call has been made,\n // and it has already notified all listeners.\n return;\n }\n listener(newState);\n }\n }\n\n /**\n * Merges the provided changes into the current state and notifies listeners if there are changes.\n * Each value must match its state key. Pass an exact known subset rather than a broad\n * `Partial<State>`, which may contain `undefined` for required state fields.\n *\n * @param changes An object containing the changes to apply to the current state.\n */\n update(changes) {\n for (const key in changes) {\n if (!Object.is(this.state[key], changes[key])) {\n this.setState({\n ...this.state,\n ...changes\n });\n return;\n }\n }\n }\n\n /**\n * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed.\n *\n * @param key The key in the store's state to update.\n * @param value The new value to set for the specified key.\n */\n set(key, value) {\n if (!Object.is(this.state[key], value)) {\n this.setState({\n ...this.state,\n [key]: value\n });\n }\n }\n\n /**\n * Gives the state a new reference and updates all registered listeners.\n */\n notifyAll() {\n const newState = {\n ...this.state\n };\n this.setState(newState);\n }\n use(selector, a1, a2, a3) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useStore(this, selector, a1, a2, a3);\n }\n}","/* False positives - ESLint thinks we're calling a hook from a class component. */\n/* eslint-disable react-hooks/rules-of-hooks */\n'use client';\n\nimport * as React from 'react';\nimport { Store } from \"./Store.mjs\";\nimport { useStore } from \"./useStore.mjs\";\nimport { useStableCallback } from \"../useStableCallback.mjs\";\nimport { useIsoLayoutEffect } from \"../useIsoLayoutEffect.mjs\";\nimport { NOOP } from \"../empty.mjs\";\n\n/**\n * A Store that supports controlled state keys, non-reactive values and provides utility methods for React.\n */\nexport class ReactStore extends Store {\n /**\n * Creates a new ReactStore instance.\n *\n * @param state Initial state of the store.\n * @param context Non-reactive context values.\n * @param selectors Optional selectors for use with `useState`.\n */\n constructor(state, context = {}, selectors) {\n super(state);\n this.context = context;\n this.selectors = selectors;\n }\n\n /**\n * Non-reactive values such as refs, callbacks, etc.\n */\n\n /**\n * Synchronizes a single external value into the store.\n *\n * Note that the while the value in `state` is updated immediately, the value returned\n * by `useState` is updated before the next render (similarly to React's `useState`).\n */\n useSyncedValue(key, value) {\n React.useDebugValue(key);\n // eslint-disable-next-line consistent-this\n const store = this;\n useIsoLayoutEffect(() => {\n if (store.state[key] !== value) {\n store.set(key, value);\n }\n }, [store, key, value]);\n }\n\n /**\n * Synchronizes a single external value into the store and\n * cleans it up (sets to `undefined`) on unmount.\n *\n * Note that the while the value in `state` is updated immediately, the value returned\n * by `useState` is updated before the next render (similarly to React's `useState`).\n */\n useSyncedValueWithCleanup(key, value) {\n // eslint-disable-next-line consistent-this\n const store = this;\n useIsoLayoutEffect(() => {\n if (store.state[key] !== value) {\n store.set(key, value);\n }\n return () => {\n store.set(key, undefined);\n };\n }, [store, key, value]);\n }\n\n /**\n * Synchronizes multiple external values into the store.\n * Each value must match its state key. Pass an exact known subset rather than a broad\n * `Partial<State>`, which may contain `undefined` for required state fields.\n *\n * Note that the while the values in `state` are updated immediately, the values returned\n * by `useState` are updated before the next render (similarly to React's `useState`).\n *\n * @param statePart An exact subset of state fields to synchronize. Unknown keys are not accepted.\n */\n useSyncedValues(statePart) {\n // eslint-disable-next-line consistent-this\n const store = this;\n if (process.env.NODE_ENV !== 'production') {\n // Check that an object with the same shape is passed on every render\n React.useDebugValue(statePart, p => Object.keys(p));\n const keys = React.useRef(Object.keys(statePart)).current;\n const nextKeys = Object.keys(statePart);\n if (keys.length !== nextKeys.length || keys.some((key, index) => key !== nextKeys[index])) {\n console.error('ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.');\n }\n }\n const dependencies = Object.values(statePart);\n useIsoLayoutEffect(() => {\n store.update(statePart);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [store, ...dependencies]);\n }\n\n /**\n * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled`\n * is non-undefined, the store's state at `key` is updated to match `controlled`.\n */\n useControlledProp(key, controlled) {\n React.useDebugValue(key);\n // eslint-disable-next-line consistent-this\n const store = this;\n const isControlled = controlled !== undefined;\n useIsoLayoutEffect(() => {\n if (isControlled && !Object.is(store.state[key], controlled)) {\n // Set the internal state to match the controlled value.\n store.setState({\n ...store.state,\n [key]: controlled\n });\n }\n }, [store, key, controlled, isControlled]);\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line\n const cache = this.controlledValues ??= new Map();\n if (!cache.has(key)) {\n cache.set(key, isControlled);\n }\n const previouslyControlled = cache.get(key);\n if (previouslyControlled !== undefined && previouslyControlled !== isControlled) {\n console.error(`A component is changing the ${isControlled ? '' : 'un'}controlled state of ${key.toString()} to be ${isControlled ? 'un' : ''}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`);\n }\n }\n }\n\n /** Gets the current value from the store using a selector with the provided key.\n *\n * @param key Key of the selector to use.\n */\n\n select(key, a1, a2, a3) {\n const selector = this.selectors[key];\n return selector(this.state, a1, a2, a3);\n }\n\n /**\n * Returns a value from the store's state using a selector function.\n * Used to subscribe to specific parts of the state.\n * This methods causes a rerender whenever the selected state changes.\n *\n * @param key Key of the selector to use.\n */\n\n useState(key, a1, a2, a3) {\n React.useDebugValue(key);\n return useStore(this, this.selectors[key], a1, a2, a3);\n }\n\n /**\n * Wraps a function with `useStableCallback` to ensure it has a stable reference\n * and assigns it to the context.\n *\n * @param key Key of the event callback. Must be a function in the context.\n * @param fn Function to assign.\n */\n useContextCallback(key, fn) {\n React.useDebugValue(key);\n const stableFunction = useStableCallback(fn ?? NOOP);\n this.context[key] = stableFunction;\n }\n\n /**\n * Returns a stable setter function for a specific key in the store's state.\n * It's commonly used to pass as a ref callback to React elements.\n *\n * @param key Key of the state to set.\n */\n useStateSetter(key) {\n const ref = React.useRef(undefined);\n if (ref.current === undefined) {\n ref.current = value => {\n this.set(key, value);\n };\n }\n return ref.current;\n }\n\n /**\n * Observes changes derived from the store's selectors and calls the listener when the selected value changes.\n *\n * @param key Key of the selector to observe.\n * @param listener Listener function called when the selector result changes.\n */\n\n observe(selector, listener) {\n let selectFn;\n if (typeof selector === 'function') {\n selectFn = selector;\n } else {\n selectFn = this.selectors[selector];\n }\n let prevValue = selectFn(this.state);\n listener(prevValue, prevValue, this);\n return this.subscribe(nextState => {\n const nextValue = selectFn(nextState);\n if (!Object.is(prevValue, nextValue)) {\n const oldValue = prevValue;\n prevValue = nextValue;\n listener(nextValue, oldValue, this);\n }\n });\n }\n}","/**\n * Combines multiple cleanup functions into a single cleanup function.\n */\nexport function mergeCleanups(...cleanups) {\n return () => {\n for (let i = 0; i < cleanups.length; i += 1) {\n const cleanup = cleanups[i];\n if (cleanup) {\n cleanup();\n }\n }\n };\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { platform } from '@base-ui/utils/platform';\nimport { visuallyHidden } from '@base-ui/utils/visuallyHidden';\n\n/**\n * @internal\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const FocusGuard = /*#__PURE__*/React.forwardRef(function FocusGuard(props, ref) {\n const [role, setRole] = React.useState();\n useIsoLayoutEffect(() => {\n // Unlike NVDA and JAWS, VoiceOver's virtual cursor triggers `onFocus` as\n // it moves — but only on focusable/role-button elements through WebKit's\n // NSAccessibility path. Setting `role=\"button\"` lets the focus trap catch\n // the cursor.\n if (platform.screenReader.voiceOver && platform.engine.webkit) {\n setRole('button');\n }\n }, []);\n const restProps = {\n tabIndex: 0,\n // Role is only for VoiceOver\n role\n };\n return /*#__PURE__*/_jsx(\"span\", {\n ...props,\n ref: ref,\n style: visuallyHidden,\n \"aria-hidden\": role ? undefined : true,\n ...restProps,\n \"data-base-ui-focus-guard\": \"\"\n });\n});\nif (process.env.NODE_ENV !== \"production\") FocusGuard.displayName = \"FocusGuard\";","export function createAttribute(name) {\n return `data-base-ui-${name}`;\n}","import { NOOP } from '@base-ui/utils/empty';\nlet rafId = 0;\nexport function enqueueFocus(el, options = {}) {\n const {\n preventScroll = false,\n sync = false,\n shouldFocus\n } = options;\n cancelAnimationFrame(rafId);\n function exec() {\n if (shouldFocus && !shouldFocus()) {\n return;\n }\n el?.focus({\n preventScroll\n });\n }\n if (sync) {\n exec();\n return NOOP;\n }\n const currentRafId = requestAnimationFrame(exec);\n rafId = currentRafId;\n return () => {\n if (rafId === currentRafId) {\n cancelAnimationFrame(currentRafId);\n rafId = 0;\n }\n };\n}","// Modified to add conditional `aria-hidden` support:\n// https://github.com/theKashey/aria-hidden/blob/9220c8f4a4fd35f63bee5510a9f41a37264382d4/src/index.ts\nimport { getNodeName, isShadowRoot } from '@floating-ui/utils/dom';\nimport { ownerDocument } from '@base-ui/utils/owner';\nconst counters = {\n inert: new WeakMap(),\n 'aria-hidden': new WeakMap()\n};\nconst markerName = 'data-base-ui-inert';\nconst uncontrolledElementsSets = {\n inert: new WeakSet(),\n 'aria-hidden': new WeakSet()\n};\nlet markerCounterMap = new WeakMap();\nlet lockCount = 0;\nfunction getUncontrolledElementsSet(controlAttribute) {\n return uncontrolledElementsSets[controlAttribute];\n}\nfunction unwrapHost(node) {\n if (!node) {\n return null;\n }\n return isShadowRoot(node) ? node.host : unwrapHost(node.parentNode);\n}\nconst correctElements = (parent, targets) => targets.map(target => {\n if (parent.contains(target)) {\n return target;\n }\n const correctedTarget = unwrapHost(target);\n if (parent.contains(correctedTarget)) {\n return correctedTarget;\n }\n return null;\n}).filter(x => x != null);\nconst buildKeepSet = targets => {\n const keep = new Set();\n targets.forEach(target => {\n let node = target;\n while (node && !keep.has(node)) {\n keep.add(node);\n node = node.parentNode;\n }\n });\n return keep;\n};\nconst collectOutsideElements = (root, keepElements, stopElements) => {\n const outside = [];\n const walk = parent => {\n if (!parent || stopElements.has(parent)) {\n return;\n }\n Array.from(parent.children).forEach(node => {\n if (getNodeName(node) === 'script') {\n return;\n }\n if (keepElements.has(node)) {\n walk(node);\n } else {\n outside.push(node);\n }\n });\n };\n walk(root);\n return outside;\n};\nfunction applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden, inert, {\n mark = true\n}) {\n let controlAttribute = null;\n if (inert) {\n controlAttribute = 'inert';\n } else if (ariaHidden) {\n controlAttribute = 'aria-hidden';\n }\n let counterMap = null;\n let uncontrolledElementsSet = null;\n const avoidElements = correctElements(body, uncorrectedAvoidElements);\n const markerTargets = mark ? collectOutsideElements(body, buildKeepSet(avoidElements), new Set(avoidElements)) : [];\n const hiddenElements = [];\n const markedElements = [];\n if (controlAttribute) {\n const map = counters[controlAttribute];\n const currentUncontrolledElementsSet = getUncontrolledElementsSet(controlAttribute);\n uncontrolledElementsSet = currentUncontrolledElementsSet;\n counterMap = map;\n const ariaLiveElements = correctElements(body, Array.from(body.querySelectorAll('[aria-live]')));\n const controlElements = avoidElements.concat(ariaLiveElements);\n const controlTargets = collectOutsideElements(body, buildKeepSet(controlElements), new Set(controlElements));\n controlTargets.forEach(node => {\n const attr = node.getAttribute(controlAttribute);\n const alreadyHidden = attr !== null && attr !== 'false';\n const counterValue = (map.get(node) || 0) + 1;\n map.set(node, counterValue);\n hiddenElements.push(node);\n if (counterValue === 1 && alreadyHidden) {\n currentUncontrolledElementsSet.add(node);\n }\n if (!alreadyHidden) {\n node.setAttribute(controlAttribute, controlAttribute === 'inert' ? '' : 'true');\n }\n });\n }\n if (mark) {\n markerTargets.forEach(node => {\n const markerValue = (markerCounterMap.get(node) || 0) + 1;\n markerCounterMap.set(node, markerValue);\n markedElements.push(node);\n if (markerValue === 1) {\n node.setAttribute(markerName, '');\n }\n });\n }\n lockCount += 1;\n return () => {\n if (counterMap) {\n hiddenElements.forEach(element => {\n const currentCounterValue = counterMap.get(element) || 0;\n const counterValue = currentCounterValue - 1;\n counterMap.set(element, counterValue);\n if (!counterValue) {\n if (!uncontrolledElementsSet?.has(element) && controlAttribute) {\n element.removeAttribute(controlAttribute);\n }\n uncontrolledElementsSet?.delete(element);\n }\n });\n }\n if (mark) {\n markedElements.forEach(element => {\n const markerValue = (markerCounterMap.get(element) || 0) - 1;\n markerCounterMap.set(element, markerValue);\n if (!markerValue) {\n element.removeAttribute(markerName);\n }\n });\n }\n lockCount -= 1;\n if (!lockCount) {\n counters.inert = new WeakMap();\n counters['aria-hidden'] = new WeakMap();\n uncontrolledElementsSets.inert = new WeakSet();\n uncontrolledElementsSets['aria-hidden'] = new WeakSet();\n markerCounterMap = new WeakMap();\n }\n };\n}\nexport function markOthers(avoidElements, options = {}) {\n const {\n ariaHidden = false,\n inert = false,\n mark = true\n } = options;\n const body = ownerDocument(avoidElements[0]).body;\n return applyAttributeToOthers(avoidElements, body, ariaHidden, inert, {\n mark\n });\n}","export const TYPEAHEAD_RESET_MS = 500;\nexport const PATIENT_CLICK_THRESHOLD = 500;\nexport const DISABLED_TRANSITIONS_STYLE = {\n style: {\n transition: 'none'\n }\n};\nexport const CLICK_TRIGGER_IDENTIFIER = 'data-base-ui-click-trigger';\nexport const BASE_UI_SWIPE_IGNORE_ATTRIBUTE = 'data-base-ui-swipe-ignore';\nexport const LEGACY_SWIPE_IGNORE_ATTRIBUTE = 'data-swipe-ignore';\nexport const BASE_UI_SWIPE_IGNORE_SELECTOR = `[${BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`;\nexport const LEGACY_SWIPE_IGNORE_SELECTOR = `[${LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`;\n\n/**\n * Used for dropdowns that usually strictly prefer top/bottom placements and\n * use `var(--available-height)` to limit their height.\n */\nexport const DROPDOWN_COLLISION_AVOIDANCE = {\n fallbackAxisSide: 'none'\n};\n\n/**\n * Used by regular popups that usually aren't scrollable and are allowed to\n * freely flip to any axis of placement.\n */\nexport const POPUP_COLLISION_AVOIDANCE = {\n fallbackAxisSide: 'end'\n};\n\n/**\n * Special visually hidden styles for the aria-owns owner element to ensure owned element\n * accessibility in iOS/Safari/VoiceControl.\n * The owner element is an empty span, so most of the common visually hidden styles are not needed.\n * @see https://github.com/floating-ui/floating-ui/issues/3403\n */\nexport const ownerVisuallyHidden = {\n clipPath: 'inset(50%)',\n position: 'fixed',\n top: 0,\n left: 0\n};","'use client';\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { isNode } from '@floating-ui/utils/dom';\nimport { addEventListener } from '@base-ui/utils/addEventListener';\nimport { mergeCleanups } from '@base-ui/utils/mergeCleanups';\nimport { useId } from '@base-ui/utils/useId';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { FocusGuard } from \"../../utils/FocusGuard.mjs\";\nimport { enableFocusInside, disableFocusInside, getPreviousTabbable, getNextTabbable, isOutsideEvent } from \"../utils/tabbable.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { createAttribute } from \"../utils/createAttribute.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { ownerVisuallyHidden } from \"../../internals/constants.mjs\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst PortalContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") PortalContext.displayName = \"PortalContext\";\nexport const usePortalContext = () => React.useContext(PortalContext);\nconst attr = createAttribute('portal');\nexport function useFloatingPortalNode(props = {}) {\n const {\n ref,\n container: containerProp,\n componentProps = EMPTY_OBJECT,\n elementProps\n } = props;\n const uniqueId = useId();\n const portalContext = usePortalContext();\n const parentPortalNode = portalContext?.portalNode;\n const [containerElement, setContainerElement] = React.useState(null);\n const [portalNode, setPortalNode] = React.useState(null);\n const setPortalNodeRef = useStableCallback(node => {\n if (node !== null) {\n // the useIsoLayoutEffect below watching containerProp / parentPortalNode\n // sets setPortalNode(null) when the container becomes null or changes.\n // So even though the ref callback now ignores null, the portal node still gets cleared.\n setPortalNode(node);\n }\n });\n const containerRef = React.useRef(null);\n useIsoLayoutEffect(() => {\n // Wait for the container to be resolved if explicitly `null`.\n if (containerProp === null) {\n if (containerRef.current) {\n containerRef.current = null;\n setPortalNode(null);\n setContainerElement(null);\n }\n return;\n }\n const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body;\n if (resolvedContainer == null) {\n if (containerRef.current) {\n containerRef.current = null;\n setPortalNode(null);\n setContainerElement(null);\n }\n return;\n }\n if (containerRef.current !== resolvedContainer) {\n containerRef.current = resolvedContainer;\n setPortalNode(null);\n setContainerElement(resolvedContainer);\n }\n }, [containerProp, parentPortalNode]);\n const portalElement = useRenderElement('div', componentProps, {\n ref: [ref, setPortalNodeRef],\n props: [{\n id: uniqueId,\n [attr]: ''\n }, elementProps]\n });\n\n // This `createPortal` call injects `portalElement` into the `container`.\n // Another call inside `FloatingPortal`/`FloatingPortalLite` then injects the children into `portalElement`.\n const portalSubtree = containerElement && portalElement ? /*#__PURE__*/ReactDOM.createPortal(portalElement, containerElement) : null;\n return {\n node: portalNode,\n // `id` and `render` props can override or remove the generated ID. Use the exact\n // rendered value so `aria-owns` never points at an ID absent from the DOM.\n nodeId: /*#__PURE__*/React.isValidElement(portalElement) ? portalElement.props.id : undefined,\n subtree: portalSubtree\n };\n}\n\n/**\n * Portals the floating element into a given container element — by default,\n * outside of the app root and into the body.\n * This is necessary to ensure the floating element can appear outside any\n * potential parent containers that cause clipping (such as `overflow: hidden`),\n * while retaining its location in the React tree.\n * @see https://floating-ui.com/docs/FloatingPortal\n * @internal\n */\nexport const FloatingPortal = /*#__PURE__*/React.forwardRef(function FloatingPortal(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n children,\n container,\n portalOwnerRole,\n ...elementProps\n } = componentProps;\n const {\n node: portalNode,\n nodeId: portalNodeId,\n subtree: portalSubtree\n } = useFloatingPortalNode({\n container,\n ref: forwardedRef,\n componentProps,\n elementProps\n });\n const beforeOutsideRef = React.useRef(null);\n const afterOutsideRef = React.useRef(null);\n const beforeInsideRef = React.useRef(null);\n const afterInsideRef = React.useRef(null);\n const [focusManagerState, setFocusManagerState] = React.useState(null);\n const focusInsideDisabledRef = React.useRef(false);\n const modal = focusManagerState?.modal;\n const open = focusManagerState?.open;\n const shouldRenderGuards = !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode;\n\n // https://codesandbox.io/s/tabbable-portal-f4tng?file=/src/TabbablePortal.tsx\n React.useEffect(() => {\n if (!portalNode || modal) {\n return undefined;\n }\n\n // Make sure elements inside the portal element are tabbable only when the\n // portal has already been focused, either by tabbing into a focus trap\n // element outside or using the mouse.\n function onFocus(event) {\n if (portalNode && event.relatedTarget && isOutsideEvent(event)) {\n if (event.type === 'focusin') {\n if (focusInsideDisabledRef.current) {\n enableFocusInside(portalNode);\n focusInsideDisabledRef.current = false;\n }\n } else {\n disableFocusInside(portalNode);\n focusInsideDisabledRef.current = true;\n }\n }\n }\n\n // Listen to the event on the capture phase so they run before the focus\n // trap elements onFocus prop is called.\n return mergeCleanups(addEventListener(portalNode, 'focusin', onFocus, true), addEventListener(portalNode, 'focusout', onFocus, true));\n }, [portalNode, modal]);\n useIsoLayoutEffect(() => {\n if (!portalNode || open !== true || !focusInsideDisabledRef.current) {\n return;\n }\n\n // Restore tabbability before the focus manager's queued focus-on-open step runs.\n enableFocusInside(portalNode);\n focusInsideDisabledRef.current = false;\n }, [open, portalNode]);\n const portalContextValue = React.useMemo(() => ({\n beforeOutsideRef,\n afterOutsideRef,\n beforeInsideRef,\n afterInsideRef,\n portalNode,\n setFocusManagerState\n }), [portalNode]);\n return /*#__PURE__*/_jsxs(React.Fragment, {\n children: [portalSubtree, /*#__PURE__*/_jsxs(PortalContext.Provider, {\n value: portalContextValue,\n children: [shouldRenderGuards && portalNode && /*#__PURE__*/_jsx(FocusGuard, {\n \"data-type\": \"outside\",\n ref: beforeOutsideRef,\n onFocus: event => {\n if (isOutsideEvent(event, portalNode)) {\n beforeInsideRef.current?.focus();\n } else {\n const domReference = focusManagerState ? focusManagerState.domReference : null;\n const prevTabbable = getPreviousTabbable(domReference);\n prevTabbable?.focus();\n }\n }\n }), shouldRenderGuards && portalNode && /*#__PURE__*/_jsx(\"span\", {\n role: portalOwnerRole,\n \"aria-owns\": portalNodeId,\n style: ownerVisuallyHidden\n }), portalNode && /*#__PURE__*/ReactDOM.createPortal(children, portalNode), shouldRenderGuards && portalNode && /*#__PURE__*/_jsx(FocusGuard, {\n \"data-type\": \"outside\",\n ref: afterOutsideRef,\n onFocus: event => {\n if (isOutsideEvent(event, portalNode)) {\n afterInsideRef.current?.focus();\n } else {\n const domReference = focusManagerState ? focusManagerState.domReference : null;\n const nextTabbable = getNextTabbable(domReference);\n nextTabbable?.focus();\n if (focusManagerState?.closeOnFocusOut) {\n focusManagerState?.onOpenChange(false, createChangeEventDetails(REASONS.focusOut, event.nativeEvent));\n }\n }\n }\n })]\n })]\n });\n});\nif (process.env.NODE_ENV !== \"production\") FloatingPortal.displayName = \"FloatingPortal\";","export function createEventEmitter() {\n const map = new Map();\n return {\n emit(event, data) {\n map.get(event)?.forEach(listener => listener(data));\n },\n on(event, listener) {\n if (!map.has(event)) {\n map.set(event, new Set());\n }\n map.get(event).add(listener);\n },\n off(event, listener) {\n map.get(event)?.delete(listener);\n }\n };\n}","'use client';\n\nimport * as React from 'react';\nimport { useId } from '@base-ui/utils/useId';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { FloatingTreeStore } from \"./FloatingTreeStore.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst FloatingNodeContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") FloatingNodeContext.displayName = \"FloatingNodeContext\";\nconst FloatingTreeContext = /*#__PURE__*/React.createContext(null);\n\n/**\n * Returns the parent node id for nested floating elements, if available.\n * Returns `null` for top-level floating elements.\n */\nif (process.env.NODE_ENV !== \"production\") FloatingTreeContext.displayName = \"FloatingTreeContext\";\nexport const useFloatingParentNodeId = () => React.useContext(FloatingNodeContext)?.id || null;\n\n/**\n * Returns the nearest floating tree context, if available.\n */\nexport const useFloatingTree = externalTree => {\n const contextTree = React.useContext(FloatingTreeContext);\n return externalTree ?? contextTree;\n};\n\n/**\n * Registers a node into the `FloatingTree`, returning its id.\n * @see https://floating-ui.com/docs/FloatingTree\n */\nexport function useFloatingNodeId(externalTree) {\n const id = useId();\n const tree = useFloatingTree(externalTree);\n const parentId = useFloatingParentNodeId();\n useIsoLayoutEffect(() => {\n if (!id) {\n return undefined;\n }\n const node = {\n id,\n parentId\n };\n tree?.addNode(node);\n return () => {\n tree?.removeNode(node);\n };\n }, [tree, id, parentId]);\n return id;\n}\n/**\n * Provides parent node context for nested floating elements.\n * @see https://floating-ui.com/docs/FloatingTree\n * @internal\n */\nexport function FloatingNode(props) {\n const {\n children,\n id\n } = props;\n const parentId = useFloatingParentNodeId();\n return /*#__PURE__*/_jsx(FloatingNodeContext.Provider, {\n value: React.useMemo(() => ({\n id,\n parentId\n }), [id, parentId]),\n children: children\n });\n}\n/**\n * Provides context for nested floating elements when they are not children of\n * each other on the DOM.\n * This is not necessary in all cases, except when there must be explicit communication between parent and child floating elements. It is necessary for:\n * - The `bubbles` option in the `useDismiss()` Hook\n * - Nested virtual list navigation\n * - Nested floating elements that each open on hover\n * - Custom communication between parent and child floating elements\n * @see https://floating-ui.com/docs/FloatingTree\n * @internal\n */\nexport function FloatingTree(props) {\n const {\n children,\n externalTree\n } = props;\n const tree = useRefWithInit(() => externalTree ?? new FloatingTreeStore()).current;\n return /*#__PURE__*/_jsx(FloatingTreeContext.Provider, {\n value: tree,\n children: children\n });\n}","'use client';\n\nimport * as React from 'react';\nimport { getNodeName, isHTMLElement } from '@floating-ui/utils/dom';\nimport { addEventListener } from '@base-ui/utils/addEventListener';\nimport { mergeCleanups } from '@base-ui/utils/mergeCleanups';\nimport { useMergedRefs } from '@base-ui/utils/useMergedRefs';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useTimeout } from '@base-ui/utils/useTimeout';\nimport { platform } from '@base-ui/utils/platform';\nimport { useAnimationFrame } from '@base-ui/utils/useAnimationFrame';\nimport { ownerDocument, ownerWindow } from '@base-ui/utils/owner';\nimport { FocusGuard } from \"../../utils/FocusGuard.mjs\";\nimport { activeElement, contains, getTarget, isTypeableCombobox, getFloatingFocusElement, isTypeableElement } from \"../utils/element.mjs\";\nimport { isVirtualClick, isVirtualPointerEvent, stopEvent } from \"../utils/event.mjs\";\nimport { tabbable, focusable, isOutsideEvent, isTabbable, getNextTabbable, getPreviousTabbable } from \"../utils/tabbable.mjs\";\nimport { getNodeAncestors, getNodeChildren } from \"../utils/nodes.mjs\";\nimport { isElementVisible } from \"../utils/composite.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { createAttribute } from \"../utils/createAttribute.mjs\";\nimport { enqueueFocus } from \"../utils/enqueueFocus.mjs\";\nimport { markOthers } from \"../utils/markOthers.mjs\";\nimport { usePortalContext } from \"./FloatingPortal.mjs\";\nimport { useFloatingTree } from \"./FloatingTree.mjs\";\nimport { CLICK_TRIGGER_IDENTIFIER } from \"../../internals/constants.mjs\";\nimport { resolveRef } from \"../../utils/resolveRef.mjs\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction getEventType(event, lastInteractionType) {\n const win = ownerWindow(getTarget(event));\n if (event instanceof win.KeyboardEvent) {\n return 'keyboard';\n }\n if (event instanceof win.FocusEvent) {\n // Focus events can be caused by a preceding pointer interaction (e.g., focusout on outside press).\n // Prefer the last known pointer type if provided, else treat as keyboard.\n return lastInteractionType || 'keyboard';\n }\n if ('pointerType' in event) {\n return event.pointerType || 'keyboard';\n }\n if ('touches' in event) {\n return 'touch';\n }\n if (event instanceof win.MouseEvent) {\n // onClick events may not contain pointer events, and will fall through to here\n return lastInteractionType || (event.detail === 0 ? 'keyboard' : 'mouse');\n }\n return '';\n}\nconst LIST_LIMIT = 20;\nlet previouslyFocusedElements = [];\nfunction clearDisconnectedPreviouslyFocusedElements() {\n previouslyFocusedElements = previouslyFocusedElements.filter(entry => {\n return entry.deref()?.isConnected;\n });\n}\nfunction addPreviouslyFocusedElement(element) {\n clearDisconnectedPreviouslyFocusedElements();\n if (element && getNodeName(element) !== 'body') {\n previouslyFocusedElements.push(new WeakRef(element));\n if (previouslyFocusedElements.length > LIST_LIMIT) {\n previouslyFocusedElements = previouslyFocusedElements.slice(-LIST_LIMIT);\n }\n }\n}\nfunction getPreviouslyFocusedElement() {\n clearDisconnectedPreviouslyFocusedElements();\n return previouslyFocusedElements[previouslyFocusedElements.length - 1]?.deref();\n}\nfunction getFirstTabbableElement(container) {\n if (!container) {\n return null;\n }\n if (isTabbable(container)) {\n return container;\n }\n return tabbable(container)[0] || container;\n}\nfunction handleTabIndex(floatingFocusElement) {\n if (floatingFocusElement.hasAttribute('tabindex') && !floatingFocusElement.hasAttribute('data-tabindex')) {\n return;\n }\n if (!floatingFocusElement.getAttribute('role')?.includes('dialog')) {\n return;\n }\n const focusableElements = focusable(floatingFocusElement);\n const tabbableContent = focusableElements.filter(element => {\n const dataTabIndex = element.getAttribute('data-tabindex') || '';\n return isTabbable(element) || element.hasAttribute('data-tabindex') && !dataTabIndex.startsWith('-');\n });\n const tabIndex = floatingFocusElement.getAttribute('tabindex');\n if (tabbableContent.length === 0) {\n if (tabIndex !== '0') {\n floatingFocusElement.setAttribute('tabindex', '0');\n // Mark our own write so the externally-managed early-return above doesn't\n // mistake it for a user-authored `tabindex` and freeze management.\n floatingFocusElement.setAttribute('data-tabindex', '0');\n }\n } else if (tabIndex !== '-1' || floatingFocusElement.hasAttribute('data-tabindex') && floatingFocusElement.getAttribute('data-tabindex') !== '-1') {\n floatingFocusElement.setAttribute('tabindex', '-1');\n floatingFocusElement.setAttribute('data-tabindex', '-1');\n }\n}\n/**\n * Provides focus management for the floating element.\n * @see https://floating-ui.com/docs/FloatingFocusManager\n * @internal\n */\nexport function FloatingFocusManager(props) {\n const {\n context,\n children,\n disabled = false,\n initialFocus = true,\n returnFocus = true,\n restoreFocus = false,\n modal = true,\n closeOnFocusOut = true,\n openInteractionType = '',\n nextFocusableElement,\n previousFocusableElement,\n beforeContentFocusGuardRef,\n externalTree,\n getInsideElements\n } = props;\n const store = 'rootStore' in context ? context.rootStore : context;\n const open = store.useState('open');\n const domReference = store.useState('domReferenceElement');\n const floating = store.useState('floatingElement');\n const {\n events,\n dataRef\n } = store.context;\n const getNodeId = useStableCallback(() => dataRef.current.floatingContext?.nodeId);\n const ignoreInitialFocus = initialFocus === false;\n // A typeable combobox reference (e.g. input/textarea) with `initialFocus={false}`\n // has different focus semantics: focus is not trapped inside the floating element,\n // so in the modal case the guards are not rendered, but `aria-hidden` is still\n // applied to the outside nodes.\n const isUntrappedTypeableCombobox = isTypeableCombobox(domReference) && ignoreInitialFocus;\n const initialFocusRef = useValueAsRef(initialFocus);\n const returnFocusRef = useValueAsRef(returnFocus);\n const openInteractionTypeRef = useValueAsRef(openInteractionType);\n const openRef = useValueAsRef(open);\n const tree = useFloatingTree(externalTree);\n const portalContext = usePortalContext();\n const preventReturnFocusRef = React.useRef(false);\n const isPointerDownRef = React.useRef(false);\n const pointerDownOutsideRef = React.useRef(false);\n const lastFocusedTabbableRef = React.useRef(null);\n const closeTypeRef = React.useRef('');\n const lastInteractionTypeRef = React.useRef('');\n const beforeGuardRef = React.useRef(null);\n const afterGuardRef = React.useRef(null);\n const mergedBeforeGuardRef = useMergedRefs(beforeGuardRef, beforeContentFocusGuardRef, portalContext?.beforeInsideRef);\n const mergedAfterGuardRef = useMergedRefs(afterGuardRef, portalContext?.afterInsideRef);\n const blurTimeout = useTimeout();\n const pointerDownTimeout = useTimeout();\n const restoreFocusFrame = useAnimationFrame();\n const isInsidePortal = portalContext != null;\n const floatingFocusElement = getFloatingFocusElement(floating);\n const getTabbableContent = useStableCallback((container = floatingFocusElement) => {\n return container ? tabbable(container) : [];\n });\n const getResolvedInsideElements = useStableCallback(() => getInsideElements?.().filter(element => element != null) ?? []);\n\n // Prevent Tab from escaping the modal when there are no tabbable elements.\n React.useEffect(() => {\n if (disabled || !modal) {\n return undefined;\n }\n function onKeyDown(event) {\n if (event.key === 'Tab') {\n // The focus guards have nothing to focus, so we need to stop the event.\n if (contains(floatingFocusElement, activeElement(ownerDocument(floatingFocusElement))) && getTabbableContent().length === 0 && !isUntrappedTypeableCombobox) {\n stopEvent(event);\n }\n }\n }\n const doc = ownerDocument(floatingFocusElement);\n return addEventListener(doc, 'keydown', onKeyDown);\n }, [disabled, floatingFocusElement, modal, isUntrappedTypeableCombobox, getTabbableContent]);\n\n // Track pointer/keyboard interactions to disambiguate focus and outside presses.\n React.useEffect(() => {\n if (disabled || !open) {\n return undefined;\n }\n const doc = ownerDocument(floatingFocusElement);\n function clearPointerDownOutside() {\n pointerDownOutsideRef.current = false;\n }\n function onPointerDown(event) {\n const target = getTarget(event);\n const insideElements = getResolvedInsideElements();\n const pointerTargetInside = contains(floating, target) || contains(domReference, target) || contains(portalContext?.portalNode, target) || insideElements.some(element => element === target || contains(element, target));\n pointerDownOutsideRef.current = !pointerTargetInside;\n lastInteractionTypeRef.current = event.pointerType || 'keyboard';\n if (target?.closest(`[${CLICK_TRIGGER_IDENTIFIER}]`)) {\n isPointerDownRef.current = true;\n // Reset on the next tick so a single click on a click-trigger doesn't\n // permanently suppress focus-out closing for the lifetime of the instance.\n pointerDownTimeout.start(0, () => {\n isPointerDownRef.current = false;\n });\n }\n }\n function onKeyDown() {\n lastInteractionTypeRef.current = 'keyboard';\n }\n return mergeCleanups(addEventListener(doc, 'pointerdown', onPointerDown, true), addEventListener(doc, 'pointerup', clearPointerDownOutside, true), addEventListener(doc, 'pointercancel', clearPointerDownOutside, true), addEventListener(doc, 'keydown', onKeyDown, true),\n // Avoid a stale `true` leaking into the next open (e.g. keep-mounted popups)\n // if the popup dismissed between pointerdown and pointerup.\n clearPointerDownOutside);\n }, [disabled, floating, domReference, floatingFocusElement, open, portalContext, pointerDownTimeout, getResolvedInsideElements]);\n\n // Close on focus out and restore focus within the floating tree when needed.\n React.useEffect(() => {\n if (disabled || !closeOnFocusOut) {\n return undefined;\n }\n const doc = ownerDocument(floatingFocusElement);\n\n // In Safari, buttons lose focus when pressing them.\n function handlePointerDown() {\n isPointerDownRef.current = true;\n pointerDownTimeout.start(0, () => {\n isPointerDownRef.current = false;\n });\n }\n function handleFocusIn(event) {\n const target = getTarget(event);\n if (isTabbable(target)) {\n lastFocusedTabbableRef.current = target;\n }\n }\n function handleFocusOutside(event) {\n const relatedTarget = event.relatedTarget;\n const currentTarget = event.currentTarget;\n const target = getTarget(event);\n\n // When focus is lost to the body (e.g. on a backdrop press), record the element that\n // had focus so a confirmation dialog opened while the body is focused can return focus\n // to it. Scoped to `modal` to avoid non-modal popups polluting the shared stack.\n if (modal && relatedTarget == null && target != null && contains(floating, target)) {\n addPreviouslyFocusedElement(target);\n }\n queueMicrotask(() => {\n const nodeId = getNodeId();\n const triggers = store.context.triggerElements;\n const insideElements = getResolvedInsideElements();\n const isRelatedFocusGuard = relatedTarget?.hasAttribute(createAttribute('focus-guard')) && [beforeGuardRef.current, afterGuardRef.current, portalContext?.beforeInsideRef.current, portalContext?.afterInsideRef.current, portalContext?.beforeOutsideRef.current, portalContext?.afterOutsideRef.current, resolveRef(previousFocusableElement), resolveRef(nextFocusableElement)].includes(relatedTarget);\n const movedToUnrelatedNode = !(contains(domReference, relatedTarget) || contains(floating, relatedTarget) || contains(relatedTarget, floating) || contains(portalContext?.portalNode, relatedTarget) || insideElements.some(element => element === relatedTarget || contains(element, relatedTarget)) || triggers.hasMatchingElement(trigger => contains(trigger, relatedTarget)) || isRelatedFocusGuard || tree && (getNodeChildren(tree.nodesRef.current, nodeId).find(node => contains(node.context?.elements.floating, relatedTarget) || contains(node.context?.elements.domReference, relatedTarget)) || getNodeAncestors(tree.nodesRef.current, nodeId).find(node => [node.context?.elements.floating, getFloatingFocusElement(node.context?.elements.floating)].includes(relatedTarget) || node.context?.elements.domReference === relatedTarget)));\n if (currentTarget === domReference && floatingFocusElement) {\n handleTabIndex(floatingFocusElement);\n }\n\n // Restore focus to the previously focused tabbable element to prevent\n // focus from being lost outside the floating tree.\n if (restoreFocus && currentTarget !== domReference && !isElementVisible(target) && activeElement(doc) === doc.body) {\n // Let `FloatingPortal` effect knows that focus is still inside the\n // floating tree.\n if (isHTMLElement(floatingFocusElement)) {\n floatingFocusElement.focus();\n // If explicitly requested to restore focus to the popup container, do not search\n // for the next/previous tabbable element.\n if (restoreFocus === 'popup') {\n // If the focused element is removed on pointerdown, the browser\n // tries to move focus to it right after the `.focus()` call above,\n // but because it's removed in the same tick, focus is lost instead.\n // Re-focusing asynchronously (next frame) wins that race.\n restoreFocusFrame.request(() => {\n floatingFocusElement.focus();\n });\n return;\n }\n }\n const tabbableContent = getTabbableContent();\n const prevTabbable = lastFocusedTabbableRef.current;\n const nodeToFocus = (prevTabbable && tabbableContent.includes(prevTabbable) ? prevTabbable : null) || tabbableContent[tabbableContent.length - 1] || floatingFocusElement;\n if (isHTMLElement(nodeToFocus)) {\n nodeToFocus.focus();\n }\n }\n\n // https://github.com/floating-ui/floating-ui/issues/3060\n if (dataRef.current.insideReactTree) {\n dataRef.current.insideReactTree = false;\n return;\n }\n\n // Focus did not move inside the floating tree, and there are no tabbable\n // portal guards to handle closing.\n if ((isUntrappedTypeableCombobox ? true : !modal) && relatedTarget && movedToUnrelatedNode && !isPointerDownRef.current && (\n // Fix React 18 Strict Mode returnFocus due to double rendering.\n // For an \"untrapped\" typeable combobox (input role=combobox with\n // initialFocus=false), re-opening the popup and tabbing out should still close it even\n // when the previously focused element (e.g. the next tabbable outside the popup) is\n // focused again. Otherwise, the popup remains open on the second Tab sequence:\n // click input -> Tab (closes) -> click input -> Tab.\n // Allow closing when `isUntrappedTypeableCombobox` regardless of the previously focused element.\n isUntrappedTypeableCombobox || relatedTarget !== getPreviouslyFocusedElement())) {\n preventReturnFocusRef.current = true;\n store.setOpen(false, createChangeEventDetails(REASONS.focusOut, event));\n }\n });\n }\n function markInsideReactTree() {\n if (pointerDownOutsideRef.current) {\n return;\n }\n dataRef.current.insideReactTree = true;\n blurTimeout.start(0, () => {\n dataRef.current.insideReactTree = false;\n });\n }\n const domReferenceElement = isHTMLElement(domReference) ? domReference : null;\n if (!floating && !domReferenceElement) {\n return undefined;\n }\n return mergeCleanups(domReferenceElement && addEventListener(domReferenceElement, 'focusout', handleFocusOutside), domReferenceElement && addEventListener(domReferenceElement, 'pointerdown', handlePointerDown), floating && addEventListener(floating, 'focusin', handleFocusIn), floating && addEventListener(floating, 'focusout', handleFocusOutside), floating && portalContext && addEventListener(floating, 'focusout', markInsideReactTree, true));\n }, [disabled, domReference, floating, floatingFocusElement, modal, tree, portalContext, store, closeOnFocusOut, restoreFocus, getTabbableContent, isUntrappedTypeableCombobox, getNodeId, dataRef, blurTimeout, pointerDownTimeout, restoreFocusFrame, nextFocusableElement, previousFocusableElement, getResolvedInsideElements]);\n\n // Hide everything outside the floating tree from assistive tech while open.\n React.useEffect(() => {\n if (disabled || !floating || !open) {\n return undefined;\n }\n\n // Don't hide portals nested within the parent portal.\n const portalNodes = Array.from(portalContext?.portalNode?.querySelectorAll(`[${createAttribute('portal')}]`) || []);\n const ancestors = tree ? getNodeAncestors(tree.nodesRef.current, getNodeId()) : [];\n const rootAncestorComboboxDomReference = ancestors.find(node => isTypeableCombobox(node.context?.elements.domReference || null))?.context?.elements.domReference;\n const controlInsideElements = [floating, ...portalNodes, beforeGuardRef.current, afterGuardRef.current, portalContext?.beforeOutsideRef.current, portalContext?.afterOutsideRef.current, ...getResolvedInsideElements()];\n const insideElements = [...controlInsideElements, rootAncestorComboboxDomReference, resolveRef(previousFocusableElement), resolveRef(nextFocusableElement), isUntrappedTypeableCombobox ? domReference : null].filter(x => x != null);\n const ariaHiddenCleanup = markOthers(insideElements, {\n ariaHidden: modal || isUntrappedTypeableCombobox,\n mark: false\n });\n const markerInsideElements = [floating, ...portalNodes].filter(x => x != null);\n const markerCleanup = markOthers(markerInsideElements);\n return () => {\n markerCleanup();\n ariaHiddenCleanup();\n };\n }, [open, disabled, domReference, floating, modal, portalContext, isUntrappedTypeableCombobox, tree, getNodeId, nextFocusableElement, previousFocusableElement, getResolvedInsideElements]);\n\n // Focus the initial element when the floating element opens.\n useIsoLayoutEffect(() => {\n if (!open || disabled || !isHTMLElement(floatingFocusElement)) {\n return;\n }\n closeTypeRef.current = '';\n lastInteractionTypeRef.current = '';\n const doc = ownerDocument(floatingFocusElement);\n const previouslyFocusedElement = activeElement(doc);\n\n // Wait for any layout effect state setters to execute to set `tabIndex`.\n queueMicrotask(() => {\n const initialFocusValueOrFn = initialFocusRef.current;\n const resolvedInitialFocus = typeof initialFocusValueOrFn === 'function' ? initialFocusValueOrFn(openInteractionTypeRef.current || '') : initialFocusValueOrFn;\n\n // `null` should fallback to default behavior in case of an empty ref.\n if (resolvedInitialFocus === undefined || resolvedInitialFocus === false) {\n return;\n }\n const focusAlreadyInsideFloatingEl = contains(floatingFocusElement, previouslyFocusedElement);\n if (focusAlreadyInsideFloatingEl) {\n return;\n }\n let focusableElements = null;\n const getDefaultFocusElement = () => {\n if (focusableElements == null) {\n focusableElements = getTabbableContent(floatingFocusElement);\n }\n return focusableElements[0] || floatingFocusElement;\n };\n let elToFocus;\n if (resolvedInitialFocus === true || resolvedInitialFocus === null) {\n elToFocus = getDefaultFocusElement();\n } else {\n elToFocus = resolveRef(resolvedInitialFocus);\n }\n elToFocus = elToFocus || getDefaultFocusElement();\n const hadFocusInside = contains(floatingFocusElement, activeElement(doc));\n\n // enqueueFocus returns a rAF-cancel function; we intentionally don't cancel this focus.\n void enqueueFocus(elToFocus, {\n preventScroll: elToFocus === floatingFocusElement,\n shouldFocus() {\n // This focus is queued on the next animation frame. If the floating element has closed\n // before it runs — e.g. tabbing out of a kept-mounted popup — don't pull focus back\n // onto the initial element after it has legitimately moved elsewhere.\n if (!openRef.current) {\n return false;\n }\n if (hadFocusInside) {\n return true;\n }\n const currentActiveElement = activeElement(doc);\n const focusMovedInside = currentActiveElement !== elToFocus && contains(floatingFocusElement, currentActiveElement);\n return !focusMovedInside;\n }\n });\n });\n }, [disabled, open, floatingFocusElement, getTabbableContent, initialFocusRef, openInteractionTypeRef, openRef]);\n\n // Track return focus targets and restore focus on unmount/close.\n useIsoLayoutEffect(() => {\n if (disabled || !floatingFocusElement) {\n return undefined;\n }\n const doc = ownerDocument(floatingFocusElement);\n const elementFocusedBeforeOpen = activeElement(doc);\n // Only an explicit `null` interaction type represents a programmatic open.\n // `undefined` is normalized to `''` by the prop default, so it never reaches\n // here as nullish and is intentionally not treated as programmatic.\n const preferPreviousFocus = openInteractionTypeRef.current == null;\n addPreviouslyFocusedElement(elementFocusedBeforeOpen);\n function onOpenChangeLocal(details) {\n if (!details.open) {\n closeTypeRef.current = getEventType(details.nativeEvent, lastInteractionTypeRef.current);\n }\n if (details.reason === REASONS.triggerHover && details.nativeEvent.type === 'mouseleave') {\n preventReturnFocusRef.current = true;\n }\n if (details.reason !== REASONS.outsidePress) {\n return;\n }\n if (details.nested) {\n preventReturnFocusRef.current = false;\n } else if (isVirtualClick(details.nativeEvent) || isVirtualPointerEvent(details.nativeEvent)) {\n preventReturnFocusRef.current = false;\n } else {\n // On outside press, only return focus to the reference when the browser supports the\n // `focus({ preventScroll })` option; without it, restoring focus scrolls the page.\n // Chrome on Android and Samsung Internet still don't support `preventScroll`\n // (https://issues.chromium.org/issues/41453122), so the runtime check keeps return\n // focus disabled there to avoid the scroll jump.\n let isPreventScrollSupported = false;\n ownerDocument(floatingFocusElement).createElement('div').focus({\n get preventScroll() {\n isPreventScrollSupported = true;\n return false;\n }\n });\n if (isPreventScrollSupported) {\n preventReturnFocusRef.current = false;\n } else {\n preventReturnFocusRef.current = true;\n }\n }\n }\n events.on('openchange', onOpenChangeLocal);\n function getReturnElement(closeType) {\n const returnFocusValueOrFn = returnFocusRef.current;\n let resolvedReturnFocusValue = typeof returnFocusValueOrFn === 'function' ? returnFocusValueOrFn(closeType) : returnFocusValueOrFn;\n\n // `null` should fallback to default behavior in case of an empty ref.\n if (resolvedReturnFocusValue === undefined || resolvedReturnFocusValue === false) {\n return null;\n }\n if (resolvedReturnFocusValue === null) {\n resolvedReturnFocusValue = true;\n }\n const referenceReturnElement = domReference?.isConnected ? domReference : null;\n const previousReturnElement = elementFocusedBeforeOpen?.isConnected && getNodeName(elementFocusedBeforeOpen) !== 'body' ? elementFocusedBeforeOpen : null;\n let defaultReturnElement = preferPreviousFocus ? previousReturnElement || referenceReturnElement : referenceReturnElement || previousReturnElement;\n if (!defaultReturnElement) {\n defaultReturnElement = getPreviouslyFocusedElement() || null;\n }\n if (typeof resolvedReturnFocusValue === 'boolean') {\n return defaultReturnElement;\n }\n return resolveRef(resolvedReturnFocusValue) || defaultReturnElement || null;\n }\n return () => {\n events.off('openchange', onOpenChangeLocal);\n const activeEl = activeElement(doc);\n const insideElements = getResolvedInsideElements();\n const isFocusInsideFloatingTree = contains(floating, activeEl) || insideElements.some(element => element === activeEl || contains(element, activeEl)) || tree && getNodeChildren(tree.nodesRef.current, getNodeId(), false).some(node => contains(node.context?.elements.floating, activeEl));\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const returnFocusValueOrFn = returnFocusRef.current;\n const closeType = closeTypeRef.current;\n const returnElement = getReturnElement(closeType);\n queueMicrotask(() => {\n // `returnElement` if it is tabbable, otherwise its first tabbable child,\n // otherwise `returnElement` itself (which may not be tabbable at all).\n const tabbableReturnElement = getFirstTabbableElement(returnElement);\n const hasExplicitReturnFocus = typeof returnFocusValueOrFn !== 'boolean';\n if (returnFocusValueOrFn && !preventReturnFocusRef.current && isHTMLElement(tabbableReturnElement) && (\n // If the focus moved somewhere else after mount, avoid returning focus\n // since it likely entered a different element which should be\n // respected: https://github.com/floating-ui/floating-ui/issues/2607\n !hasExplicitReturnFocus && tabbableReturnElement !== activeEl && activeEl !== doc.body ? isFocusInsideFloatingTree : true)) {\n const focusOptions = {\n preventScroll: true\n };\n if (closeType === 'keyboard') {\n focusOptions.focusVisible = true;\n }\n tabbableReturnElement.focus(focusOptions);\n }\n preventReturnFocusRef.current = false;\n });\n };\n }, [disabled, floating, floatingFocusElement, returnFocusRef, openInteractionTypeRef, events, tree, domReference, getNodeId, getResolvedInsideElements]);\n\n // Safari may randomly scroll to the bottom of the page if an input inside a popup has focus\n // when the popup unmounts from the DOM.\n // By blurring it before the popup unmounts, we can prevent this behavior.\n useIsoLayoutEffect(() => {\n if (!platform.engine.webkit || open || !floating) {\n return;\n }\n const activeEl = activeElement(ownerDocument(floating));\n if (!isHTMLElement(activeEl) || !isTypeableElement(activeEl)) {\n return;\n }\n if (contains(floating, activeEl)) {\n activeEl.blur();\n }\n }, [open, floating]);\n\n // Synchronize the focus manager state (modal, closeOnFocusOut, open, etc.) to the\n // FloatingPortal context, which uses it to decide whether to render its own guards.\n useIsoLayoutEffect(() => {\n if (disabled || !portalContext) {\n return undefined;\n }\n portalContext.setFocusManagerState({\n modal,\n closeOnFocusOut,\n open,\n onOpenChange: store.setOpen,\n domReference\n });\n return () => {\n portalContext.setFocusManagerState(null);\n };\n }, [disabled, portalContext, modal, open, store, closeOnFocusOut, domReference]);\n\n // Keep the floating element tabIndex in sync and clear stale focus records.\n useIsoLayoutEffect(() => {\n if (disabled || !floatingFocusElement) {\n return undefined;\n }\n handleTabIndex(floatingFocusElement);\n return () => {\n queueMicrotask(clearDisconnectedPreviouslyFocusedElements);\n };\n }, [disabled, floatingFocusElement]);\n const shouldRenderGuards = !disabled && (modal ? !isUntrappedTypeableCombobox : true) && (isInsidePortal || modal);\n return /*#__PURE__*/_jsxs(React.Fragment, {\n children: [shouldRenderGuards && /*#__PURE__*/_jsx(FocusGuard, {\n \"data-type\": \"inside\",\n ref: mergedBeforeGuardRef,\n onFocus: event => {\n if (modal) {\n const els = getTabbableContent();\n // enqueueFocus returns a rAF-cancel function we don't need here.\n void enqueueFocus(els[els.length - 1]);\n } else if (portalContext?.portalNode) {\n preventReturnFocusRef.current = false;\n if (isOutsideEvent(event, portalContext.portalNode)) {\n const nextTabbable = getNextTabbable(domReference);\n nextTabbable?.focus();\n } else {\n resolveRef(previousFocusableElement ?? portalContext.beforeOutsideRef)?.focus();\n }\n }\n }\n }), children, shouldRenderGuards && /*#__PURE__*/_jsx(FocusGuard, {\n \"data-type\": \"inside\",\n ref: mergedAfterGuardRef,\n onFocus: event => {\n if (modal) {\n // enqueueFocus returns a rAF-cancel function we don't need here.\n void enqueueFocus(getTabbableContent()[0]);\n } else if (portalContext?.portalNode) {\n if (closeOnFocusOut) {\n preventReturnFocusRef.current = true;\n }\n if (isOutsideEvent(event, portalContext.portalNode)) {\n const prevTabbable = getPreviousTabbable(domReference);\n prevTabbable?.focus();\n } else {\n resolveRef(nextFocusableElement ?? portalContext.afterOutsideRef)?.focus();\n }\n }\n }\n })]\n });\n}","'use client';\n\nimport * as React from 'react';\nimport { useAnimationFrame } from '@base-ui/utils/useAnimationFrame';\nimport { useTimeout } from '@base-ui/utils/useTimeout';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { getTarget, isTypeableElement } from \"../utils/element.mjs\";\nimport { isMouseLikePointerType, isVirtualPointerEvent } from \"../utils/event.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\n/**\n * Opens or closes the floating element when clicking the reference element.\n * @see https://floating-ui.com/docs/useClick\n */\nexport function useClick(context, props = {}) {\n const {\n enabled = true,\n event: eventOption = 'click',\n toggle = true,\n ignoreMouse = false,\n stickIfOpen = true,\n touchOpenDelay = 0,\n reason = REASONS.triggerPress\n } = props;\n const store = 'rootStore' in context ? context.rootStore : context;\n const dataRef = store.context.dataRef;\n const pointerTypeRef = React.useRef(undefined);\n const frame = useAnimationFrame();\n const touchOpenTimeout = useTimeout();\n const reference = React.useMemo(() => {\n function setOpenWithTouchDelay(nextOpen, nativeEvent, target, pointerType) {\n const details = createChangeEventDetails(reason, nativeEvent, target);\n if (nextOpen && pointerType === 'touch' && touchOpenDelay > 0) {\n touchOpenTimeout.start(touchOpenDelay, () => {\n store.setOpen(true, details);\n });\n } else {\n store.setOpen(nextOpen, details);\n }\n }\n function getNextOpen(open, currentTarget, isClickLikeOpenEvent) {\n const openEvent = dataRef.current.openEvent;\n const hasClickedOnInactiveTrigger = store.select('domReferenceElement') !== currentTarget;\n if (open && hasClickedOnInactiveTrigger) {\n // Moving between triggers should always open the newly active one.\n return true;\n }\n if (!open) {\n // A closed popup should open on the next press.\n return true;\n }\n if (!toggle) {\n // Non-toggle mode never closes on a repeated trigger press.\n return true;\n }\n if (openEvent && stickIfOpen) {\n // Preserve hover/focus-opened popups until the matching click-like event closes them.\n return !isClickLikeOpenEvent(openEvent.type);\n }\n\n // Otherwise, a repeated click toggles the popup closed.\n return false;\n }\n return {\n onPointerDown(event) {\n // Screen reader activations (Android TalkBack, desktop screen readers) report a\n // mouse-like `pointerType`, but `ignoreMouse` must not drop them: hover logic cannot\n // open for a virtual press since there is no real pointer movement to wait for.\n // Virtual `touch` presses (iOS VoiceOver) keep their type so `touchOpenDelay` applies.\n pointerTypeRef.current = isMouseLikePointerType(event.pointerType, true) && isVirtualPointerEvent(event.nativeEvent) ? 'virtual' : event.pointerType;\n },\n onMouseDown(event) {\n const pointerType = pointerTypeRef.current;\n const nativeEvent = event.nativeEvent;\n const open = store.select('open');\n\n // Ignore all buttons except for the \"main\" button.\n // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button\n if (event.button !== 0 || eventOption === 'click' || isMouseLikePointerType(pointerType, true) && ignoreMouse) {\n return;\n }\n const nextOpen = getNextOpen(open, event.currentTarget, openEventType => openEventType === 'click' || openEventType === 'mousedown');\n\n // Animations sometimes won't run on a typeable element if using a rAF.\n // Focus is always set on these elements. For touch, we may delay opening.\n const target = getTarget(nativeEvent);\n if (isTypeableElement(target)) {\n setOpenWithTouchDelay(nextOpen, nativeEvent, target, pointerType);\n return;\n }\n\n // Capture the currentTarget before the rAF.\n // as React sets it to null after the event handler completes.\n const eventCurrentTarget = event.currentTarget;\n\n // Wait until focus is set on the element. This is an alternative to\n // `event.preventDefault()` to avoid :focus-visible from appearing when using a pointer.\n frame.request(() => {\n setOpenWithTouchDelay(nextOpen, nativeEvent, eventCurrentTarget, pointerType);\n });\n },\n onClick(event) {\n if (eventOption === 'mousedown-only') {\n return;\n }\n const pointerType = pointerTypeRef.current;\n if (eventOption === 'mousedown' && pointerType) {\n pointerTypeRef.current = undefined;\n return;\n }\n if (isMouseLikePointerType(pointerType, true) && ignoreMouse) {\n return;\n }\n const open = store.select('open');\n const nextOpen = getNextOpen(open, event.currentTarget, openEventType => openEventType === 'click' || openEventType === 'mousedown' || openEventType === 'keydown' || openEventType === 'keyup');\n setOpenWithTouchDelay(nextOpen, event.nativeEvent, event.currentTarget, pointerType);\n },\n onKeyDown() {\n pointerTypeRef.current = undefined;\n }\n };\n }, [dataRef, eventOption, ignoreMouse, reason, store, stickIfOpen, toggle, frame, touchOpenTimeout, touchOpenDelay]);\n return React.useMemo(() => enabled ? {\n reference\n } : EMPTY_OBJECT, [enabled, reference]);\n}","'use client';\n\n/* eslint-disable no-underscore-dangle */\nimport * as React from 'react';\nimport { addEventListener } from '@base-ui/utils/addEventListener';\nimport { mergeCleanups } from '@base-ui/utils/mergeCleanups';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { Timeout, useTimeout } from '@base-ui/utils/useTimeout';\nimport { getComputedStyle, getParentNode, isElement, isHTMLElement, isLastTraversableNode, isShadowRoot } from '@floating-ui/utils/dom';\nimport { platform } from '@base-ui/utils/platform';\nimport { useFloatingTree } from \"../components/FloatingTree.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { createAttribute } from \"../utils/createAttribute.mjs\";\nimport { contains, getTarget, isEventTargetWithin, isRootElement } from \"../utils/element.mjs\";\nimport { isReactEvent, isVirtualClick } from \"../utils/event.mjs\";\nimport { getNodeChildren } from \"../utils/nodes.mjs\";\nfunction alwaysFalse() {\n return false;\n}\nexport function normalizeProp(normalizable) {\n return {\n escapeKey: typeof normalizable === 'boolean' ? normalizable : normalizable?.escapeKey ?? false,\n outsidePress: typeof normalizable === 'boolean' ? normalizable : normalizable?.outsidePress ?? true\n };\n}\n/**\n * Closes the floating element when a dismissal is requested — by default, when\n * the user presses the `escape` key or outside of the floating element.\n * @see https://floating-ui.com/docs/useDismiss\n */\nexport function useDismiss(context, props = {}) {\n const {\n enabled = true,\n escapeKey = true,\n outsidePress: outsidePressProp = true,\n outsidePressEvent = 'sloppy',\n referencePress = alwaysFalse,\n bubbles,\n externalTree\n } = props;\n const store = 'rootStore' in context ? context.rootStore : context;\n const open = store.useState('open');\n const floatingElement = store.useState('floatingElement');\n const {\n dataRef,\n events\n } = store.context;\n const tree = useFloatingTree(externalTree);\n const outsidePressFn = useStableCallback(typeof outsidePressProp === 'function' ? outsidePressProp : () => false);\n const outsidePress = typeof outsidePressProp === 'function' ? outsidePressFn : outsidePressProp;\n const outsidePressEnabled = outsidePress !== false;\n const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent);\n const {\n escapeKey: escapeKeyBubbles,\n outsidePress: outsidePressBubbles\n } = normalizeProp(bubbles);\n const pressStartedInsideRef = React.useRef(false);\n const pressStartPreventedRef = React.useRef(false);\n // Ignore only the very next outside click after dragging from inside to outside.\n const suppressNextOutsideClickRef = React.useRef(false);\n // A click whose press began before the floating element opened is the tail of that\n // gesture (e.g. the drag-release that opened it), not a new outside press.\n const sawPressWhileOpenRef = React.useRef(false);\n const isComposingRef = React.useRef(false);\n const currentPointerTypeRef = React.useRef('');\n const touchStateRef = React.useRef(null);\n const cancelDismissOnEndTimeout = useTimeout();\n const clearInsideReactTreeTimeout = useTimeout();\n const clearInsideReactTree = useStableCallback(() => {\n clearInsideReactTreeTimeout.clear();\n dataRef.current.insideReactTree = false;\n });\n const hasBlockingChild = useStableCallback(bubbleKey => {\n const nodeId = dataRef.current.floatingContext?.nodeId;\n const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : [];\n return children.some(child => child.context?.open && !child.context.dataRef.current[bubbleKey]);\n });\n const isEventWithinOwnElements = useStableCallback(event => {\n return isEventTargetWithin(event, store.select('floatingElement')) || isEventTargetWithin(event, store.select('domReferenceElement'));\n });\n const closeOnReferencePress = useStableCallback(event => {\n if (!referencePress()) {\n return;\n }\n store.setOpen(false, createChangeEventDetails(REASONS.triggerPress, event.nativeEvent));\n });\n const closeOnEscapeKeyDown = useStableCallback(event => {\n if (!open || !enabled || !escapeKey || event.key !== 'Escape') {\n return;\n }\n\n // Wait until IME is settled. Pressing `Escape` while composing should\n // close the compose menu, but not the floating element.\n if (isComposingRef.current) {\n return;\n }\n if (!escapeKeyBubbles && hasBlockingChild('__escapeKeyBubbles')) {\n return;\n }\n const native = isReactEvent(event) ? event.nativeEvent : event;\n const eventDetails = createChangeEventDetails(REASONS.escapeKey, native);\n store.setOpen(false, eventDetails);\n if (!eventDetails.isCanceled) {\n event.preventDefault();\n }\n if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) {\n event.stopPropagation();\n }\n });\n const markInsideReactTree = useStableCallback(() => {\n dataRef.current.insideReactTree = true;\n clearInsideReactTreeTimeout.start(0, clearInsideReactTree);\n });\n const markPressStartedInsideReactTree = useStableCallback(event => {\n if (!open || !enabled || event.button !== 0) {\n return;\n }\n const target = getTarget(event.nativeEvent);\n\n // Only treat presses that start within the floating DOM subtree as inside.\n // This avoids suppressing parent dismissal when interacting with nested portals.\n if (!contains(store.select('floatingElement'), target)) {\n return;\n }\n if (!pressStartedInsideRef.current) {\n pressStartedInsideRef.current = true;\n pressStartPreventedRef.current = false;\n }\n });\n const markInsidePressStartPrevented = useStableCallback(event => {\n if (!open || !enabled) {\n return;\n }\n if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) {\n return;\n }\n if (pressStartedInsideRef.current) {\n pressStartPreventedRef.current = true;\n }\n });\n\n // A same-batch close+reopen never renders `open === false`, so only `openchange` can\n // observe that session boundary. The effect below covers controlled flips.\n React.useEffect(() => {\n function handleOpenChange(details) {\n // Only the closing half ends the session: `setOpen(true)` on an already-open\n // element (hovering an inactive trigger) must not drop a press mid-gesture.\n if (!details.open) {\n sawPressWhileOpenRef.current = false;\n }\n }\n events.on('openchange', handleOpenChange);\n return () => {\n events.off('openchange', handleOpenChange);\n };\n }, [events]);\n React.useEffect(() => {\n if (!open || !enabled) {\n // Reset in the effect body, not the cleanup, which also runs when a dependency\n // changes mid-gesture.\n if (!open) {\n sawPressWhileOpenRef.current = false;\n }\n return clearInsideReactTree;\n }\n dataRef.current.__escapeKeyBubbles = escapeKeyBubbles;\n dataRef.current.__outsidePressBubbles = outsidePressBubbles;\n const compositionTimeout = new Timeout();\n const preventedPressSuppressionTimeout = new Timeout();\n const doc = ownerDocument(floatingElement);\n function handleCompositionStart() {\n compositionTimeout.clear();\n isComposingRef.current = true;\n }\n function handleCompositionEnd() {\n // Safari fires `compositionend` before `keydown`, so we need to wait\n // until the next tick to set `isComposing` to `false`.\n // https://bugs.webkit.org/show_bug.cgi?id=165004\n compositionTimeout.start(\n // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.\n // Only apply to WebKit for the test to remain 0ms.\n platform.engine.webkit ? 5 : 0, () => {\n isComposingRef.current = false;\n });\n }\n function suppressImmediateOutsideClickAfterPreventedStart() {\n suppressNextOutsideClickRef.current = true;\n // Firefox can emit the synthetic outside click in a later task after\n // pointer lock exit, so microtask clearing is too early here.\n preventedPressSuppressionTimeout.start(0, () => {\n suppressNextOutsideClickRef.current = false;\n });\n }\n function resetPressStartState() {\n pressStartedInsideRef.current = false;\n pressStartPreventedRef.current = false;\n }\n function getOutsidePressEvent() {\n const type = currentPointerTypeRef.current;\n const computedType = type === 'pen' || !type ? 'mouse' : type;\n const outsidePressEventValue = getOutsidePressEventProp();\n const resolved = typeof outsidePressEventValue === 'function' ? outsidePressEventValue() : outsidePressEventValue;\n if (typeof resolved === 'string') {\n return resolved;\n }\n return resolved[computedType];\n }\n function shouldIgnoreEvent(event) {\n const computedOutsidePressEvent = getOutsidePressEvent();\n return computedOutsidePressEvent === 'intentional' && event.type !== 'click' || computedOutsidePressEvent === 'sloppy' && event.type === 'click';\n }\n function isEventWithinFloatingTree(event) {\n const nodeId = dataRef.current.floatingContext?.nodeId;\n const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some(node => isEventTargetWithin(event, node.context?.elements.floating));\n return isEventWithinOwnElements(event) || targetIsInsideChildren;\n }\n function closeOnPressOutside(event) {\n if (shouldIgnoreEvent(event)) {\n // A new press began outside the floating element and its trigger. Clear any\n // leftover drag-out suppression so this press's eventual click can dismiss.\n if (event.type !== 'click' && !isEventWithinOwnElements(event)) {\n preventedPressSuppressionTimeout.clear();\n suppressNextOutsideClickRef.current = false;\n }\n clearInsideReactTree();\n return;\n }\n if (dataRef.current.insideReactTree) {\n clearInsideReactTree();\n return;\n }\n const target = getTarget(event);\n const inertSelector = `[${createAttribute('inert')}]`;\n const targetRoot = isElement(target) ? target.getRootNode() : null;\n const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store.select('floatingElement'))).querySelectorAll(inertSelector));\n const triggers = store.context.triggerElements;\n\n // If another trigger is clicked, don't close the floating element.\n if (target && (triggers.hasElement(target) || triggers.hasMatchingElement(trigger => contains(trigger, target)))) {\n return;\n }\n let targetRootAncestor = isElement(target) ? target : null;\n while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) {\n const nextParent = getParentNode(targetRootAncestor);\n if (isLastTraversableNode(nextParent) || !isElement(nextParent)) {\n break;\n }\n targetRootAncestor = nextParent;\n }\n\n // Check if the click occurred on a third-party element injected after the\n // floating element rendered.\n if (markers.length && isElement(target) && !isRootElement(target) &&\n // Clicked on a direct ancestor (e.g. FloatingOverlay).\n !contains(target, store.select('floatingElement')) &&\n // If the target root element contains none of the markers, then the\n // element was injected after the floating element rendered.\n markers.every(marker => !contains(targetRootAncestor, marker))) {\n return;\n }\n\n // Check if the click occurred on the scrollbar\n // Skip for touch events: scrollbars don't receive touch events on most platforms\n if (isHTMLElement(target) && !('touches' in event)) {\n const lastTraversableNode = isLastTraversableNode(target);\n const style = getComputedStyle(target);\n const scrollRe = /auto|scroll/;\n const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX);\n const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY);\n const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth;\n const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight;\n const isRTL = style.direction === 'rtl';\n\n // Check click position relative to scrollbar.\n // In some browsers it is possible to change the <body> (or window)\n // scrollbar to the left side, but is very rare and is difficult to\n // check for. Plus, for modal dialogs with backdrops, it is more\n // important that the backdrop is checked but not so much the window.\n const pressedVerticalScrollbar = canScrollY && (isRTL ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth);\n const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight;\n if (pressedVerticalScrollbar || pressedHorizontalScrollbar) {\n return;\n }\n }\n if (isEventWithinFloatingTree(event)) {\n return;\n }\n\n // Only `click` events reach this point in intentional mode.\n if (getOutsidePressEvent() === 'intentional') {\n // Press-less clicks (keyboard, assistive technology, `element.click()`) report no\n // click count; `isVirtualClick` also catches the ones that do.\n if (event.detail !== 0 && !isVirtualClick(event) && !sawPressWhileOpenRef.current) {\n return;\n }\n\n // A press that starts inside and ends outside gets one suppressed\n // outside click. Run this after inside-target checks so inside clicks\n // don't consume the one-shot suppression.\n if (suppressNextOutsideClickRef.current) {\n preventedPressSuppressionTimeout.clear();\n suppressNextOutsideClickRef.current = false;\n return;\n }\n }\n if (typeof outsidePress === 'function' && !outsidePress(event)) {\n return;\n }\n if (hasBlockingChild('__outsidePressBubbles')) {\n return;\n }\n store.setOpen(false, createChangeEventDetails(REASONS.outsidePress, event));\n clearInsideReactTree();\n }\n function handlePointerDown(event) {\n if (getOutsidePressEvent() !== 'sloppy' || event.pointerType === 'touch' || !store.select('open') || !enabled || isEventWithinOwnElements(event)) {\n return;\n }\n closeOnPressOutside(event);\n }\n function handleTouchStart(event) {\n if (getOutsidePressEvent() !== 'sloppy' || !store.select('open') || !enabled || isEventWithinOwnElements(event)) {\n return;\n }\n const touch = event.touches[0];\n if (touch) {\n touchStateRef.current = {\n startTime: Date.now(),\n startX: touch.clientX,\n startY: touch.clientY,\n dismissOnTouchEnd: false,\n dismissOnMouseDown: true\n };\n cancelDismissOnEndTimeout.start(1000, () => {\n if (touchStateRef.current) {\n touchStateRef.current.dismissOnTouchEnd = false;\n touchStateRef.current.dismissOnMouseDown = false;\n }\n });\n }\n }\n function addTargetEventListenerOnce(event, listener) {\n const target = getTarget(event);\n if (!target) {\n return;\n }\n const unsubscribe = addEventListener(target, event.type, () => {\n listener(event);\n unsubscribe();\n });\n }\n function handleTouchStartCapture(event) {\n currentPointerTypeRef.current = 'touch';\n addTargetEventListenerOnce(event, handleTouchStart);\n }\n function closeOnPressOutsideCapture(event) {\n cancelDismissOnEndTimeout.clear();\n\n // Only `pointerdown` marks a press; `mousedown` is its compatibility event, and\n // counting it would misattribute a gesture that started before open.\n if (event.type === 'pointerdown') {\n // Only a primary press can produce a `click`.\n if (event.button === 0) {\n sawPressWhileOpenRef.current = true;\n }\n currentPointerTypeRef.current = event.pointerType;\n }\n if (event.type === 'mousedown' && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) {\n return;\n }\n addTargetEventListenerOnce(event, targetEvent => {\n if (targetEvent.type === 'pointerdown') {\n handlePointerDown(targetEvent);\n } else {\n closeOnPressOutside(targetEvent);\n }\n });\n }\n function handlePressEndCapture(event) {\n // A cancelled gesture produces no click. Not cleared on `pointerup`: the click\n // fires after it and must still find the press.\n if (event.type === 'pointercancel') {\n sawPressWhileOpenRef.current = false;\n }\n if (!pressStartedInsideRef.current) {\n return;\n }\n const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current;\n resetPressStartState();\n if (getOutsidePressEvent() !== 'intentional') {\n return;\n }\n if (event.type === 'pointercancel') {\n if (pressStartedInsideDefaultPrevented) {\n suppressImmediateOutsideClickAfterPreventedStart();\n }\n return;\n }\n if (isEventWithinFloatingTree(event)) {\n return;\n }\n\n // If pointerdown was prevented, no click may be generated for that\n // interaction. However, Firefox may still emit an immediate click after\n // pointerup (e.g. NumberField scrub with pointer lock), so suppress for\n // one tick to absorb that synthetic click only.\n if (pressStartedInsideDefaultPrevented) {\n suppressImmediateOutsideClickAfterPreventedStart();\n return;\n }\n\n // Avoid suppressing when outsidePress explicitly ignores this target.\n if (typeof outsidePress === 'function' && !outsidePress(event)) {\n return;\n }\n preventedPressSuppressionTimeout.clear();\n suppressNextOutsideClickRef.current = true;\n clearInsideReactTree();\n }\n function handleTouchMove(event) {\n if (getOutsidePressEvent() !== 'sloppy' || !touchStateRef.current || isEventWithinOwnElements(event)) {\n return;\n }\n const touch = event.touches[0];\n if (!touch) {\n return;\n }\n const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX);\n const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY);\n const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);\n if (distance > 5) {\n touchStateRef.current.dismissOnTouchEnd = true;\n }\n if (distance > 10) {\n closeOnPressOutside(event);\n cancelDismissOnEndTimeout.clear();\n touchStateRef.current = null;\n }\n }\n function handleTouchMoveCapture(event) {\n addTargetEventListenerOnce(event, handleTouchMove);\n }\n function handleTouchEnd(event) {\n if (getOutsidePressEvent() !== 'sloppy' || !touchStateRef.current || isEventWithinOwnElements(event)) {\n return;\n }\n if (touchStateRef.current.dismissOnTouchEnd) {\n closeOnPressOutside(event);\n }\n cancelDismissOnEndTimeout.clear();\n touchStateRef.current = null;\n }\n function handleTouchEndCapture(event) {\n addTargetEventListenerOnce(event, handleTouchEnd);\n }\n const unsubscribe = mergeCleanups(escapeKey && mergeCleanups(addEventListener(doc, 'keydown', closeOnEscapeKeyDown), addEventListener(doc, 'compositionstart', handleCompositionStart), addEventListener(doc, 'compositionend', handleCompositionEnd)), outsidePressEnabled && mergeCleanups(addEventListener(doc, 'click', closeOnPressOutsideCapture, true), addEventListener(doc, 'pointerdown', closeOnPressOutsideCapture, true), addEventListener(doc, 'pointerup', handlePressEndCapture, true), addEventListener(doc, 'pointercancel', handlePressEndCapture, true), addEventListener(doc, 'mousedown', closeOnPressOutsideCapture, true), addEventListener(doc, 'mouseup', handlePressEndCapture, true), addEventListener(doc, 'touchstart', handleTouchStartCapture, {\n capture: true,\n passive: true\n }), addEventListener(doc, 'touchmove', handleTouchMoveCapture, {\n capture: true,\n passive: true\n }), addEventListener(doc, 'touchend', handleTouchEndCapture, {\n capture: true,\n passive: true\n })));\n return () => {\n unsubscribe();\n compositionTimeout.clear();\n preventedPressSuppressionTimeout.clear();\n resetPressStartState();\n suppressNextOutsideClickRef.current = false;\n clearInsideReactTree();\n };\n }, [dataRef, floatingElement, escapeKey, outsidePressEnabled, outsidePress, open, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store, cancelDismissOnEndTimeout]);\n const reference = React.useMemo(() => ({\n onKeyDown: closeOnEscapeKeyDown,\n onPointerDown: closeOnReferencePress,\n onClick: closeOnReferencePress\n }), [closeOnEscapeKeyDown, closeOnReferencePress]);\n const floating = React.useMemo(() => ({\n onKeyDown: closeOnEscapeKeyDown,\n // `onMouseDown` may be blocked if `event.preventDefault()` is called in\n // `onPointerDown`, such as with <NumberField.ScrubArea>.\n // See https://github.com/mui/base-ui/pull/3379\n onPointerDown: markInsidePressStartPrevented,\n onMouseDown: markInsidePressStartPrevented,\n onClickCapture: markInsideReactTree,\n onMouseDownCapture(event) {\n markInsideReactTree();\n markPressStartedInsideReactTree(event);\n },\n onPointerDownCapture(event) {\n markInsideReactTree();\n markPressStartedInsideReactTree(event);\n },\n onMouseUpCapture: markInsideReactTree,\n onTouchEndCapture: markInsideReactTree,\n onTouchMoveCapture: markInsideReactTree\n }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]);\n return React.useMemo(() => enabled ? {\n reference,\n floating,\n trigger: reference\n } : {}, [enabled, reference, floating]);\n}","import { getSideAxis, getAlignmentAxis, getAxisLength, getSide, getAlignment, evaluate, getPaddingObject, rectToClientRect, min, clamp, placements, getAlignmentSides, getOppositeAlignmentPlacement, getOppositePlacement, getExpandedPlacements, getOppositeAxisPlacements, sides, max, getOppositeAxis } from '@floating-ui/utils';\nexport { rectToClientRect } from '@floating-ui/utils';\n\nfunction computeCoordsFromPlacement(_ref, placement, rtl) {\n let {\n reference,\n floating\n } = _ref;\n const sideAxis = getSideAxis(placement);\n const alignmentAxis = getAlignmentAxis(placement);\n const alignLength = getAxisLength(alignmentAxis);\n const side = getSide(placement);\n const isVertical = sideAxis === 'y';\n const commonX = reference.x + reference.width / 2 - floating.width / 2;\n const commonY = reference.y + reference.height / 2 - floating.height / 2;\n const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;\n let coords;\n switch (side) {\n case 'top':\n coords = {\n x: commonX,\n y: reference.y - floating.height\n };\n break;\n case 'bottom':\n coords = {\n x: commonX,\n y: reference.y + reference.height\n };\n break;\n case 'right':\n coords = {\n x: reference.x + reference.width,\n y: commonY\n };\n break;\n case 'left':\n coords = {\n x: reference.x - floating.width,\n y: commonY\n };\n break;\n default:\n coords = {\n x: reference.x,\n y: reference.y\n };\n }\n const alignment = getAlignment(placement);\n if (alignment) {\n coords[alignmentAxis] += commonAlign * (alignment === 'end' ? 1 : -1) * (rtl && isVertical ? -1 : 1);\n }\n return coords;\n}\n\n/**\n * Resolves with an object of overflow side offsets that determine how much the\n * element is overflowing a given clipping boundary on each side.\n * - positive = overflowing the boundary by that number of pixels\n * - negative = how many pixels left before it will overflow\n * - 0 = lies flush with the boundary\n * @see https://floating-ui.com/docs/detectOverflow\n */\nasync function detectOverflow(state, options) {\n var _await$platform$isEle;\n if (options === void 0) {\n options = {};\n }\n const {\n x,\n y,\n platform,\n rects,\n elements,\n strategy\n } = state;\n const {\n boundary = 'clippingAncestors',\n rootBoundary = 'viewport',\n elementContext = 'floating',\n altBoundary = false,\n padding = 0\n } = evaluate(options, state);\n const paddingObject = getPaddingObject(padding);\n const altContext = elementContext === 'floating' ? 'reference' : 'floating';\n const element = elements[altBoundary ? altContext : elementContext];\n const clippingClientRect = rectToClientRect(await platform.getClippingRect({\n element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),\n boundary,\n rootBoundary,\n strategy\n }));\n const rect = elementContext === 'floating' ? {\n x,\n y,\n width: rects.floating.width,\n height: rects.floating.height\n } : rects.reference;\n const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));\n const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) && (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {\n x: 1,\n y: 1\n };\n const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({\n elements,\n rect,\n offsetParent,\n strategy\n }) : rect);\n return {\n top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,\n bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,\n left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,\n right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x\n };\n}\n\n// Maximum number of resets that can occur before bailing to avoid infinite reset loops.\nconst MAX_RESET_COUNT = 50;\n\n/**\n * Computes the `x` and `y` coordinates that will place the floating element\n * next to a given reference element.\n *\n * This export does not have any `platform` interface logic. You will need to\n * write one for the platform you are using Floating UI with.\n */\nconst computePosition = async (reference, floating, config) => {\n const {\n placement = 'bottom',\n strategy = 'absolute',\n middleware = [],\n platform\n } = config;\n const platformWithDetectOverflow = platform.detectOverflow ? platform : {\n ...platform,\n detectOverflow\n };\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));\n let rects = await platform.getElementRects({\n reference,\n floating,\n strategy\n });\n let {\n x,\n y\n } = computeCoordsFromPlacement(rects, placement, rtl);\n let statefulPlacement = placement;\n let resetCount = 0;\n const middlewareData = {};\n for (let i = 0; i < middleware.length; i++) {\n const currentMiddleware = middleware[i];\n if (!currentMiddleware) {\n continue;\n }\n const {\n name,\n fn\n } = currentMiddleware;\n const {\n x: nextX,\n y: nextY,\n data,\n reset\n } = await fn({\n x,\n y,\n initialPlacement: placement,\n placement: statefulPlacement,\n strategy,\n middlewareData,\n rects,\n platform: platformWithDetectOverflow,\n elements: {\n reference,\n floating\n }\n });\n x = nextX != null ? nextX : x;\n y = nextY != null ? nextY : y;\n middlewareData[name] = {\n ...middlewareData[name],\n ...data\n };\n if (reset && resetCount < MAX_RESET_COUNT) {\n resetCount++;\n if (typeof reset === 'object') {\n if (reset.placement) {\n statefulPlacement = reset.placement;\n }\n if (reset.rects) {\n rects = reset.rects === true ? await platform.getElementRects({\n reference,\n floating,\n strategy\n }) : reset.rects;\n }\n ({\n x,\n y\n } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));\n }\n i = -1;\n }\n }\n return {\n x,\n y,\n placement: statefulPlacement,\n strategy,\n middlewareData\n };\n};\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = options => ({\n name: 'arrow',\n options,\n async fn(state) {\n const {\n x,\n y,\n placement,\n rects,\n platform,\n elements,\n middlewareData\n } = state;\n // Since `element` is required, we don't Partial<> the type.\n const {\n element,\n padding = 0\n } = evaluate(options, state) || {};\n if (element == null) {\n return {};\n }\n const paddingObject = getPaddingObject(padding);\n const coords = {\n x,\n y\n };\n const axis = getAlignmentAxis(placement);\n const length = getAxisLength(axis);\n const arrowDimensions = await platform.getDimensions(element);\n const isYAxis = axis === 'y';\n const minProp = isYAxis ? 'top' : 'left';\n const maxProp = isYAxis ? 'bottom' : 'right';\n const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';\n const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];\n const startDiff = coords[axis] - rects.reference[axis];\n const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));\n let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;\n\n // DOM platform can return `window` as the `offsetParent`.\n if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {\n clientSize = elements.floating[clientProp] || rects.floating[length];\n }\n const centerToReference = endDiff / 2 - startDiff / 2;\n\n // If the padding is large enough that it causes the arrow to no longer be\n // centered, modify the padding so that it is centered.\n const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;\n const minPadding = min(paddingObject[minProp], largestPossiblePadding);\n const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);\n\n // Make sure the arrow doesn't overflow the floating element if the center\n // point is outside the floating element's bounds.\n const max = clientSize - arrowDimensions[length] - maxPadding;\n const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;\n const offset = clamp(minPadding, center, max);\n\n // If the reference is small enough that the arrow's padding causes it to\n // to point to nothing for an aligned placement, adjust the offset of the\n // floating element itself. To ensure `shift()` continues to take action,\n // a single reset is performed when this is true.\n const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < minPadding ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;\n const alignmentOffset = shouldAddOffset ? center < minPadding ? center - minPadding : center - max : 0;\n return {\n [axis]: coords[axis] + alignmentOffset,\n data: {\n [axis]: offset,\n centerOffset: center - offset - alignmentOffset,\n ...(shouldAddOffset && {\n alignmentOffset\n })\n },\n reset: shouldAddOffset\n };\n }\n});\n\nfunction getPlacementList(alignment, autoAlignment, allowedPlacements) {\n const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);\n return allowedPlacementsSortedByAlignment.filter(placement => {\n if (alignment) {\n return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);\n }\n return true;\n });\n}\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'autoPlacement',\n options,\n async fn(state) {\n var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;\n const {\n rects,\n middlewareData,\n placement,\n platform,\n elements\n } = state;\n const {\n crossAxis = false,\n alignment,\n allowedPlacements = placements,\n autoAlignment = true,\n ...detectOverflowOptions\n } = evaluate(options, state);\n const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;\n const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;\n const currentPlacement = placements$1[currentIndex];\n if (currentPlacement == null) {\n return {};\n }\n\n // Make `computeCoords` start from the right place.\n if (placement !== currentPlacement) {\n return {\n reset: {\n placement: placements$1[0]\n }\n };\n }\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));\n const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];\n const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {\n placement: currentPlacement,\n overflows: currentOverflows\n }];\n const nextPlacement = placements$1[currentIndex + 1];\n\n // There are more placements to check.\n if (nextPlacement) {\n return {\n data: {\n index: currentIndex + 1,\n overflows: allOverflows\n },\n reset: {\n placement: nextPlacement\n }\n };\n }\n const placementsSortedByMostSpace = allOverflows.map(d => {\n const alignment = getAlignment(d.placement);\n return [d.placement, alignment && crossAxis ?\n // Check along the mainAxis and main crossAxis side.\n d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :\n // Check only the mainAxis.\n d.overflows[0], d.overflows];\n }).sort((a, b) => a[1] - b[1]);\n const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,\n // Aligned placements should not check their opposite crossAxis\n // side.\n getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));\n const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];\n if (resetPlacement !== placement) {\n return {\n data: {\n index: currentIndex + 1,\n overflows: allOverflows\n },\n reset: {\n placement: resetPlacement\n }\n };\n }\n return {};\n }\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'flip',\n options,\n async fn(state) {\n var _middlewareData$arrow, _middlewareData$flip;\n const {\n placement,\n middlewareData,\n rects,\n initialPlacement,\n platform,\n elements\n } = state;\n const {\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = true,\n fallbackPlacements: specifiedFallbackPlacements,\n fallbackStrategy = 'bestFit',\n fallbackAxisSideDirection = 'none',\n flipAlignment = true,\n ...detectOverflowOptions\n } = evaluate(options, state);\n\n // If a reset by the arrow was caused due to an alignment offset being\n // added, we should skip any logic now since `flip()` has already done its\n // work.\n // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643\n if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {\n return {};\n }\n const side = getSide(placement);\n const initialSideAxis = getSideAxis(initialPlacement);\n const isBasePlacement = getSide(initialPlacement) === initialPlacement;\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));\n const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));\n const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';\n if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {\n fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));\n }\n const placements = [initialPlacement, ...fallbackPlacements];\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const overflows = [];\n let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];\n if (checkMainAxis) {\n overflows.push(overflow[side]);\n }\n if (checkCrossAxis) {\n const sides = getAlignmentSides(placement, rects, rtl);\n overflows.push(overflow[sides[0]], overflow[sides[1]]);\n }\n overflowsData = [...overflowsData, {\n placement,\n overflows\n }];\n\n // One or more sides is overflowing.\n if (!overflows.every(side => side <= 0)) {\n var _middlewareData$flip2, _overflowsData$filter;\n const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;\n const nextPlacement = placements[nextIndex];\n if (nextPlacement) {\n const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;\n if (!ignoreCrossAxisOverflow ||\n // We leave the current main axis only if every placement on that axis\n // overflows the main axis.\n overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {\n // Try next placement and re-run the lifecycle.\n return {\n data: {\n index: nextIndex,\n overflows: overflowsData\n },\n reset: {\n placement: nextPlacement\n }\n };\n }\n }\n\n // First, find the candidates that fit on the mainAxis side of overflow,\n // then find the placement that fits the best on the main crossAxis side.\n let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;\n\n // Otherwise fallback.\n if (!resetPlacement) {\n switch (fallbackStrategy) {\n case 'bestFit':\n {\n var _overflowsData$filter2;\n const placement = (_overflowsData$filter2 = overflowsData.filter(d => {\n if (hasFallbackAxisSideDirection) {\n const currentSideAxis = getSideAxis(d.placement);\n return currentSideAxis === initialSideAxis ||\n // Create a bias to the `y` side axis due to horizontal\n // reading directions favoring greater width.\n currentSideAxis === 'y';\n }\n return true;\n }).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];\n if (placement) {\n resetPlacement = placement;\n }\n break;\n }\n case 'initialPlacement':\n resetPlacement = initialPlacement;\n break;\n }\n }\n if (placement !== resetPlacement) {\n return {\n reset: {\n placement: resetPlacement\n }\n };\n }\n }\n return {};\n }\n };\n};\n\nfunction getSideOffsets(overflow, rect) {\n return {\n top: overflow.top - rect.height,\n right: overflow.right - rect.width,\n bottom: overflow.bottom - rect.height,\n left: overflow.left - rect.width\n };\n}\nfunction isAnySideFullyClipped(overflow) {\n return sides.some(side => overflow[side] >= 0);\n}\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'hide',\n options,\n async fn(state) {\n const {\n rects,\n platform\n } = state;\n const {\n strategy = 'referenceHidden',\n ...detectOverflowOptions\n } = evaluate(options, state);\n switch (strategy) {\n case 'referenceHidden':\n {\n const overflow = await platform.detectOverflow(state, {\n ...detectOverflowOptions,\n elementContext: 'reference'\n });\n const offsets = getSideOffsets(overflow, rects.reference);\n return {\n data: {\n referenceHiddenOffsets: offsets,\n referenceHidden: isAnySideFullyClipped(offsets)\n }\n };\n }\n case 'escaped':\n {\n const overflow = await platform.detectOverflow(state, {\n ...detectOverflowOptions,\n altBoundary: true\n });\n const offsets = getSideOffsets(overflow, rects.floating);\n return {\n data: {\n escapedOffsets: offsets,\n escaped: isAnySideFullyClipped(offsets)\n }\n };\n }\n default:\n {\n return {};\n }\n }\n }\n };\n};\n\nfunction getBoundingRect(rects) {\n const minX = min(...rects.map(rect => rect.left));\n const minY = min(...rects.map(rect => rect.top));\n const maxX = max(...rects.map(rect => rect.right));\n const maxY = max(...rects.map(rect => rect.bottom));\n return {\n x: minX,\n y: minY,\n width: maxX - minX,\n height: maxY - minY\n };\n}\nfunction getRectsByLine(rects) {\n const sortedRects = rects.slice().sort((a, b) => a.y - b.y);\n const groups = [];\n let prevRect = null;\n for (let i = 0; i < sortedRects.length; i++) {\n const rect = sortedRects[i];\n if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {\n groups.push([rect]);\n } else {\n groups[groups.length - 1].push(rect);\n }\n prevRect = rect;\n }\n return groups.map(rect => rectToClientRect(getBoundingRect(rect)));\n}\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'inline',\n options,\n async fn(state) {\n const {\n placement,\n elements,\n rects,\n platform,\n strategy\n } = state;\n // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a\n // ClientRect's bounds, despite the event listener being triggered. A\n // padding of 2 seems to handle this issue.\n const {\n padding = 2,\n x,\n y\n } = evaluate(options, state);\n const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);\n\n // No rects (e.g. a hidden or detached reference, or a collapsed range) —\n // keep the existing reference rect rather than resetting to an invalid\n // one with non-finite values.\n if (!nativeClientRects.length) {\n return {};\n }\n const clientRects = getRectsByLine(nativeClientRects);\n const fallback = rectToClientRect(getBoundingRect(nativeClientRects));\n const paddingObject = getPaddingObject(padding);\n function getBoundingClientRect() {\n // There are two rects and they are disjoined.\n if (clientRects.length === 2 && (clientRects[0].left > clientRects[1].right || clientRects[1].left > clientRects[0].right) && x != null && y != null) {\n // Find the first rect in which the point is fully inside.\n return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;\n }\n\n // There are 2 or more connected rects.\n if (clientRects.length >= 2) {\n if (getSideAxis(placement) === 'y') {\n const firstRect = clientRects[0];\n const lastRect = clientRects[clientRects.length - 1];\n const isTop = getSide(placement) === 'top';\n const top = firstRect.top;\n const bottom = lastRect.bottom;\n const left = isTop ? firstRect.left : lastRect.left;\n const right = isTop ? firstRect.right : lastRect.right;\n return rectToClientRect({\n x: left,\n y: top,\n width: right - left,\n height: bottom - top\n });\n }\n const isLeftSide = getSide(placement) === 'left';\n const maxRight = max(...clientRects.map(rect => rect.right));\n const minLeft = min(...clientRects.map(rect => rect.left));\n const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);\n const top = measureRects[0].top;\n const bottom = measureRects[measureRects.length - 1].bottom;\n return rectToClientRect({\n x: minLeft,\n y: top,\n width: maxRight - minLeft,\n height: bottom - top\n });\n }\n return fallback;\n }\n const resetRects = await platform.getElementRects({\n reference: {\n getBoundingClientRect\n },\n floating: elements.floating,\n strategy\n });\n if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {\n return {\n reset: {\n rects: resetRects\n }\n };\n }\n return {};\n }\n };\n};\n\nconst originSides = /*#__PURE__*/new Set(['left', 'top']);\n\n// For type backwards-compatibility, the `OffsetOptions` type was also\n// Derivable.\n\nasync function convertValueToCoords(state, options) {\n const {\n placement,\n platform,\n elements\n } = state;\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));\n const side = getSide(placement);\n const alignment = getAlignment(placement);\n const isVertical = getSideAxis(placement) === 'y';\n const mainAxisMulti = originSides.has(side) ? -1 : 1;\n const crossAxisMulti = rtl && isVertical ? -1 : 1;\n const rawValue = evaluate(options, state);\n\n // eslint-disable-next-line prefer-const\n let {\n mainAxis,\n crossAxis,\n alignmentAxis\n } = typeof rawValue === 'number' ? {\n mainAxis: rawValue,\n crossAxis: 0,\n alignmentAxis: null\n } : {\n mainAxis: rawValue.mainAxis || 0,\n crossAxis: rawValue.crossAxis || 0,\n alignmentAxis: rawValue.alignmentAxis\n };\n if (alignment && typeof alignmentAxis === 'number') {\n crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;\n }\n return isVertical ? {\n x: crossAxis * crossAxisMulti,\n y: mainAxis * mainAxisMulti\n } : {\n x: mainAxis * mainAxisMulti,\n y: crossAxis * crossAxisMulti\n };\n}\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = function (options) {\n if (options === void 0) {\n options = 0;\n }\n return {\n name: 'offset',\n options,\n async fn(state) {\n var _middlewareData$offse, _middlewareData$arrow;\n const {\n x,\n y,\n placement,\n middlewareData\n } = state;\n const diffCoords = await convertValueToCoords(state, options);\n\n // If the placement is the same and the arrow caused an alignment offset\n // then we don't need to change the positioning coordinates.\n if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {\n return {};\n }\n return {\n x: x + diffCoords.x,\n y: y + diffCoords.y,\n data: {\n ...diffCoords,\n placement\n }\n };\n }\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'shift',\n options,\n async fn(state) {\n const {\n x,\n y,\n placement,\n platform\n } = state;\n const {\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = false,\n limiter = {\n fn: _ref => {\n let {\n x,\n y\n } = _ref;\n return {\n x,\n y\n };\n }\n },\n ...detectOverflowOptions\n } = evaluate(options, state);\n const coords = {\n x,\n y\n };\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const crossAxis = getSideAxis(placement);\n const mainAxis = getOppositeAxis(crossAxis);\n let mainAxisCoord = coords[mainAxis];\n let crossAxisCoord = coords[crossAxis];\n const clampCoord = (axis, coord) => clamp(coord + overflow[axis === 'y' ? 'top' : 'left'], coord, coord - overflow[axis === 'y' ? 'bottom' : 'right']);\n if (checkMainAxis) {\n mainAxisCoord = clampCoord(mainAxis, mainAxisCoord);\n }\n if (checkCrossAxis) {\n crossAxisCoord = clampCoord(crossAxis, crossAxisCoord);\n }\n const limitedCoords = limiter.fn({\n ...state,\n [mainAxis]: mainAxisCoord,\n [crossAxis]: crossAxisCoord\n });\n return {\n ...limitedCoords,\n data: {\n x: limitedCoords.x - x,\n y: limitedCoords.y - y,\n enabled: {\n [mainAxis]: checkMainAxis,\n [crossAxis]: checkCrossAxis\n }\n }\n };\n }\n };\n};\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n options,\n fn(state) {\n var _rawOffset$mainAxis, _rawOffset$crossAxis;\n const {\n x,\n y,\n placement,\n rects,\n middlewareData\n } = state;\n const {\n offset = 0,\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = true\n } = evaluate(options, state);\n const coords = {\n x,\n y\n };\n const crossAxis = getSideAxis(placement);\n const mainAxis = getOppositeAxis(crossAxis);\n let mainAxisCoord = coords[mainAxis];\n let crossAxisCoord = coords[crossAxis];\n const rawOffset = evaluate(offset, state);\n const computedOffset = typeof rawOffset === 'number' ? {\n mainAxis: rawOffset,\n crossAxis: 0\n } : {\n mainAxis: (_rawOffset$mainAxis = rawOffset.mainAxis) != null ? _rawOffset$mainAxis : 0,\n crossAxis: (_rawOffset$crossAxis = rawOffset.crossAxis) != null ? _rawOffset$crossAxis : 0\n };\n if (checkMainAxis) {\n const len = mainAxis === 'y' ? 'height' : 'width';\n const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;\n const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;\n if (mainAxisCoord < limitMin) {\n mainAxisCoord = limitMin;\n } else if (mainAxisCoord > limitMax) {\n mainAxisCoord = limitMax;\n }\n }\n if (checkCrossAxis) {\n var _middlewareData$offse, _middlewareData$offse2;\n const len = mainAxis === 'y' ? 'width' : 'height';\n const isOriginSide = originSides.has(getSide(placement));\n const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);\n const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);\n if (crossAxisCoord < limitMin) {\n crossAxisCoord = limitMin;\n } else if (crossAxisCoord > limitMax) {\n crossAxisCoord = limitMax;\n }\n }\n return {\n [mainAxis]: mainAxisCoord,\n [crossAxis]: crossAxisCoord\n };\n }\n };\n};\n\n// Method syntax keeps callback parameters bivariant, but expressing the\n// explicit `| undefined` required by `exactOptionalPropertyTypes` needs\n// property syntax, which is contravariant under `strictFunctionTypes`.\n// Extracting the function from a method position restores that bivariance so\n// consumers can still assign callbacks with narrower parameter types.\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'size',\n options,\n async fn(state) {\n const {\n placement,\n rects,\n platform,\n elements\n } = state;\n const {\n apply = () => {},\n ...detectOverflowOptions\n } = evaluate(options, state);\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const side = getSide(placement);\n const alignment = getAlignment(placement);\n const isYAxis = getSideAxis(placement) === 'y';\n const {\n width,\n height\n } = rects.floating;\n let heightSide;\n let widthSide;\n if (side === 'top' || side === 'bottom') {\n heightSide = side;\n widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';\n } else {\n widthSide = side;\n heightSide = alignment === 'end' ? 'top' : 'bottom';\n }\n const maximumClippingHeight = height - overflow.top - overflow.bottom;\n const maximumClippingWidth = width - overflow.left - overflow.right;\n const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);\n const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);\n const shiftData = state.middlewareData.shift;\n const noShift = !shiftData;\n let availableHeight = overflowAvailableHeight;\n let availableWidth = overflowAvailableWidth;\n if (shiftData != null && shiftData.enabled.x) {\n availableWidth = maximumClippingWidth;\n }\n if (shiftData != null && shiftData.enabled.y) {\n availableHeight = maximumClippingHeight;\n }\n if (noShift && !alignment) {\n if (isYAxis) {\n availableWidth = width - 2 * max(overflow.left, overflow.right);\n } else {\n availableHeight = height - 2 * max(overflow.top, overflow.bottom);\n }\n }\n await apply({\n ...state,\n availableWidth,\n availableHeight\n });\n const nextDimensions = await platform.getDimensions(elements.floating);\n if (width !== nextDimensions.width || height !== nextDimensions.height) {\n return {\n reset: {\n rects: true\n }\n };\n }\n return {};\n }\n };\n};\n\nexport { arrow, autoPlacement, computePosition, detectOverflow, flip, hide, inline, limitShift, offset, shift, size };\n","import { rectToClientRect, arrow as arrow$1, autoPlacement as autoPlacement$1, detectOverflow as detectOverflow$1, flip as flip$1, hide as hide$1, inline as inline$1, limitShift as limitShift$1, offset as offset$1, shift as shift$1, size as size$1, computePosition as computePosition$1 } from '@floating-ui/core';\nimport { round, createCoords, max, min, floor } from '@floating-ui/utils';\nimport { getComputedStyle as getComputedStyle$1, isHTMLElement, isElement, getWindow, isWebKit, getFrameElement, getNodeScroll, getDocumentElement, isTopLayer, getNodeName, isOverflowElement, getOverflowAncestors, getParentNode, isLastTraversableNode, isContainingBlock, isTableElement, getContainingBlock } from '@floating-ui/utils/dom';\nexport { getOverflowAncestors } from '@floating-ui/utils/dom';\n\nfunction getCssDimensions(element) {\n const css = getComputedStyle$1(element);\n // In testing environments, the `width` and `height` properties are empty\n // strings for SVG elements, returning NaN. Fallback to `0` in this case.\n let width = parseFloat(css.width) || 0;\n let height = parseFloat(css.height) || 0;\n const hasOffset = isHTMLElement(element);\n const offsetWidth = hasOffset ? element.offsetWidth : width;\n const offsetHeight = hasOffset ? element.offsetHeight : height;\n const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;\n if (shouldFallback) {\n width = offsetWidth;\n height = offsetHeight;\n }\n return {\n width,\n height,\n $: shouldFallback\n };\n}\n\nfunction unwrapElement(element) {\n return !isElement(element) ? element.contextElement : element;\n}\n\nfunction getScale(element) {\n const domElement = unwrapElement(element);\n if (!isHTMLElement(domElement)) {\n return createCoords(1);\n }\n const rect = domElement.getBoundingClientRect();\n const {\n width,\n height,\n $\n } = getCssDimensions(domElement);\n let x = ($ ? round(rect.width) : rect.width) / width;\n let y = ($ ? round(rect.height) : rect.height) / height;\n\n // 0, NaN, or Infinity should always fallback to 1.\n\n if (!x || !Number.isFinite(x)) {\n x = 1;\n }\n if (!y || !Number.isFinite(y)) {\n y = 1;\n }\n return {\n x,\n y\n };\n}\n\nconst noOffsets = /*#__PURE__*/createCoords(0);\nfunction getVisualOffsets(element) {\n const win = getWindow(element);\n if (!isWebKit() || !win.visualViewport) {\n return noOffsets;\n }\n return {\n x: win.visualViewport.offsetLeft,\n y: win.visualViewport.offsetTop\n };\n}\nfunction shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {\n if (isFixed === void 0) {\n isFixed = false;\n }\n return !!floatingOffsetParent && isFixed && floatingOffsetParent === getWindow(element);\n}\n\nfunction getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {\n if (includeScale === void 0) {\n includeScale = false;\n }\n if (isFixedStrategy === void 0) {\n isFixedStrategy = false;\n }\n const clientRect = element.getBoundingClientRect();\n const domElement = unwrapElement(element);\n let scale = createCoords(1);\n if (includeScale) {\n if (offsetParent) {\n if (isElement(offsetParent)) {\n scale = getScale(offsetParent);\n }\n } else {\n scale = getScale(element);\n }\n }\n const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);\n let x = (clientRect.left + visualOffsets.x) / scale.x;\n let y = (clientRect.top + visualOffsets.y) / scale.y;\n let width = clientRect.width / scale.x;\n let height = clientRect.height / scale.y;\n if (domElement && offsetParent) {\n const win = getWindow(domElement);\n const offsetWin = isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;\n let currentWin = win;\n let currentIFrame = getFrameElement(currentWin);\n while (currentIFrame && offsetWin !== currentWin) {\n const iframeScale = getScale(currentIFrame);\n const iframeRect = currentIFrame.getBoundingClientRect();\n const css = getComputedStyle$1(currentIFrame);\n const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;\n const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;\n x *= iframeScale.x;\n y *= iframeScale.y;\n width *= iframeScale.x;\n height *= iframeScale.y;\n x += left;\n y += top;\n currentWin = getWindow(currentIFrame);\n currentIFrame = getFrameElement(currentWin);\n }\n }\n return rectToClientRect({\n width,\n height,\n x,\n y\n });\n}\n\n// If <html> has a CSS width greater than the viewport, then this will be\n// incorrect for RTL.\nfunction getWindowScrollBarX(element, rect) {\n const leftScroll = getNodeScroll(element).scrollLeft;\n if (!rect) {\n return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;\n }\n return rect.left + leftScroll;\n}\n\nfunction getHTMLOffset(documentElement, scroll) {\n const htmlRect = documentElement.getBoundingClientRect();\n const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);\n const y = htmlRect.top + scroll.scrollTop;\n return {\n x,\n y\n };\n}\n\nfunction convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {\n let {\n elements,\n rect,\n offsetParent,\n strategy\n } = _ref;\n const isFixed = strategy === 'fixed';\n const documentElement = getDocumentElement(offsetParent);\n const topLayer = elements ? isTopLayer(elements.floating) : false;\n if (offsetParent === documentElement || topLayer && isFixed) {\n return rect;\n }\n let scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n let scale = createCoords(1);\n const offsets = createCoords(0);\n const isOffsetParentAnElement = isHTMLElement(offsetParent);\n if (isOffsetParentAnElement || !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n if (isOffsetParentAnElement) {\n const offsetRect = getBoundingClientRect(offsetParent);\n scale = getScale(offsetParent);\n offsets.x = offsetRect.x + offsetParent.clientLeft;\n offsets.y = offsetRect.y + offsetParent.clientTop;\n }\n }\n const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);\n return {\n width: rect.width * scale.x,\n height: rect.height * scale.y,\n x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,\n y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y\n };\n}\n\nfunction getClientRects(element) {\n return element.getClientRects ? Array.from(element.getClientRects()) : [];\n}\n\n// Gets the entire size of the scrollable document area, even extending outside\n// of the `<html>` and `<body>` rect bounds if horizontally scrollable.\nfunction getDocumentRect(html) {\n const scroll = getNodeScroll(html);\n const body = html.ownerDocument.body;\n const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);\n const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);\n let x = -scroll.scrollLeft + getWindowScrollBarX(html);\n const y = -scroll.scrollTop;\n if (getComputedStyle$1(body).direction === 'rtl') {\n x += max(html.clientWidth, body.clientWidth) - width;\n }\n return {\n width,\n height,\n x,\n y\n };\n}\n\n// Safety check: ensure the scrollbar space is reasonable in case this\n// calculation is affected by unusual styles.\n// Most scrollbars leave 15-18px of space.\nconst SCROLLBAR_MAX = 25;\nfunction getViewportRect(element, strategy, rootBoundary) {\n if (rootBoundary === void 0) {\n rootBoundary = 'viewport';\n }\n const isLayoutViewport = rootBoundary === 'layoutViewport';\n const win = getWindow(element);\n const html = getDocumentElement(element);\n const visualViewport = win.visualViewport;\n let width = html.clientWidth;\n let height = html.clientHeight;\n let x = 0;\n let y = 0;\n if (visualViewport) {\n // Client coordinates are relative to the layout viewport, except in\n // WebKit with an `absolute` strategy, where they are relative to the\n // visual viewport.\n const layoutRelativeClientCoords = !isWebKit() || strategy === 'fixed';\n if (isLayoutViewport) {\n if (!layoutRelativeClientCoords) {\n x = -visualViewport.offsetLeft;\n y = -visualViewport.offsetTop;\n }\n } else {\n width = visualViewport.width;\n height = visualViewport.height;\n if (layoutRelativeClientCoords) {\n x = visualViewport.offsetLeft;\n y = visualViewport.offsetTop;\n }\n }\n }\n const windowScrollbarX = getWindowScrollBarX(html);\n // `scrollbar-gutter: stable` on the <html> reserves gutter space that shrinks\n // the visual width but isn't reflected in `html.clientWidth`, so subtract it.\n // Only the inline-end (right) gutter can hold the scrollbar; `both-edges` also\n // reserves an empty inline-start gutter that clips nothing, so exclude just\n // the one scrollbar-side gutter — halve the measured (two-gutter) total. A\n // left-side scrollbar (`windowScrollbarX > 0`) is already handled by\n // `getHTMLOffset`/`visualViewport.width`; skip it here.\n if (windowScrollbarX <= 0) {\n const doc = html.ownerDocument;\n const body = doc.body;\n const bodyStyles = getComputedStyle(body);\n const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;\n const reservedWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);\n const gutter = getComputedStyle(html).scrollbarGutter === 'stable both-edges' ? reservedWidth / 2 : reservedWidth;\n if (gutter <= SCROLLBAR_MAX) {\n width -= gutter;\n }\n }\n return {\n width,\n height,\n x,\n y\n };\n}\n\n// Returns the inner client rect, subtracting scrollbars if present.\nfunction getInnerBoundingClientRect(element, strategy) {\n const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');\n const top = clientRect.top + element.clientTop;\n const left = clientRect.left + element.clientLeft;\n const scale = getScale(element);\n const width = element.clientWidth * scale.x;\n const height = element.clientHeight * scale.y;\n const x = left * scale.x;\n const y = top * scale.y;\n return {\n width,\n height,\n x,\n y\n };\n}\nfunction getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {\n let rect;\n if (clippingAncestor === 'viewport' || clippingAncestor === 'layoutViewport') {\n rect = getViewportRect(element, strategy, clippingAncestor);\n } else if (clippingAncestor === 'document') {\n rect = getDocumentRect(getDocumentElement(element));\n } else if (isElement(clippingAncestor)) {\n rect = getInnerBoundingClientRect(clippingAncestor, strategy);\n } else {\n const visualOffsets = getVisualOffsets(element);\n rect = {\n x: clippingAncestor.x - visualOffsets.x,\n y: clippingAncestor.y - visualOffsets.y,\n width: clippingAncestor.width,\n height: clippingAncestor.height\n };\n }\n return rectToClientRect(rect);\n}\n\n// A \"clipping ancestor\" is an `overflow` element with the characteristic of\n// clipping (or hiding) child elements. This returns all clipping ancestors\n// of the given element up the tree.\nfunction getClippingElementAncestors(element, cache) {\n const cachedResult = cache.get(element);\n if (cachedResult) {\n return cachedResult;\n }\n let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');\n let lastKeptComputedStyle = null;\n const elementIsFixed = getComputedStyle$1(element).position === 'fixed';\n let currentNode = elementIsFixed ? getParentNode(element) : element;\n\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {\n const computedStyle = getComputedStyle$1(currentNode);\n const currentNodeIsContaining = isContainingBlock(currentNode);\n // Position of the containing block chain below the current node. A fixed\n // element whose containing block hasn't been found yet is a fixed chain.\n const lastPosition = lastKeptComputedStyle ? lastKeptComputedStyle.position : elementIsFixed ? 'fixed' : '';\n\n // A non-containing ancestor does not clip the element when the chain\n // below it escapes it: a fixed chain escapes all ancestors up to the\n // next containing block, an absolute chain escapes static ancestors.\n const shouldDropCurrentNode = !currentNodeIsContaining && (lastPosition === 'fixed' || lastPosition === 'absolute' && computedStyle.position === 'static');\n if (shouldDropCurrentNode) {\n // Drop non-containing blocks.\n result = result.filter(ancestor => ancestor !== currentNode);\n } else {\n // The kept node carries the chain position for the next iteration.\n lastKeptComputedStyle = computedStyle;\n }\n currentNode = getParentNode(currentNode);\n }\n cache.set(element, result);\n return result;\n}\n\n// Gets the maximum area that the element is visible in due to any number of\n// clipping ancestors.\nfunction getClippingRect(_ref) {\n let {\n element,\n boundary,\n rootBoundary,\n strategy\n } = _ref;\n const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);\n const clippingAncestors = [...elementClippingAncestors, rootBoundary];\n const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);\n let top = firstRect.top;\n let right = firstRect.right;\n let bottom = firstRect.bottom;\n let left = firstRect.left;\n for (let i = 1; i < clippingAncestors.length; i++) {\n const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);\n top = max(rect.top, top);\n right = min(rect.right, right);\n bottom = min(rect.bottom, bottom);\n left = max(rect.left, left);\n }\n return {\n width: right - left,\n height: bottom - top,\n x: left,\n y: top\n };\n}\n\nfunction getDimensions(element) {\n const {\n width,\n height\n } = getCssDimensions(element);\n return {\n width,\n height\n };\n}\n\nfunction getRectRelativeToOffsetParent(element, offsetParent, strategy) {\n const isOffsetParentAnElement = isHTMLElement(offsetParent);\n const documentElement = getDocumentElement(offsetParent);\n const isFixed = strategy === 'fixed';\n const rect = getBoundingClientRect(element, true, isFixed, offsetParent);\n let scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n const offsets = createCoords(0);\n if (isOffsetParentAnElement || !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n if (isOffsetParentAnElement) {\n const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);\n offsets.x = offsetRect.x + offsetParent.clientLeft;\n offsets.y = offsetRect.y + offsetParent.clientTop;\n }\n }\n\n // If the <body> scrollbar appears on the left (e.g. RTL systems). Use\n // Firefox with layout.scrollbar.side = 3 in about:config to test this.\n if (!isOffsetParentAnElement && documentElement) {\n offsets.x = getWindowScrollBarX(documentElement);\n }\n const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);\n const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;\n const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;\n return {\n x,\n y,\n width: rect.width,\n height: rect.height\n };\n}\n\nfunction isStaticPositioned(element) {\n return getComputedStyle$1(element).position === 'static';\n}\n\nfunction getTrueOffsetParent(element, polyfill) {\n if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {\n return null;\n }\n if (polyfill) {\n return polyfill(element);\n }\n let rawOffsetParent = element.offsetParent;\n\n // Firefox returns the <html> element as the offsetParent if it's non-static,\n // while Chrome and Safari return the <body> element. The <body> element must\n // be used to perform the correct calculations even if the <html> element is\n // non-static.\n if (getDocumentElement(element) === rawOffsetParent) {\n rawOffsetParent = rawOffsetParent.ownerDocument.body;\n }\n return rawOffsetParent;\n}\n\n// Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\nfunction getOffsetParent(element, polyfill) {\n const win = getWindow(element);\n if (isTopLayer(element)) {\n return win;\n }\n if (!isHTMLElement(element)) {\n let svgOffsetParent = getParentNode(element);\n while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {\n if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {\n return svgOffsetParent;\n }\n svgOffsetParent = getParentNode(svgOffsetParent);\n }\n return win;\n }\n let offsetParent = getTrueOffsetParent(element, polyfill);\n while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {\n offsetParent = getTrueOffsetParent(offsetParent, polyfill);\n }\n if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {\n return win;\n }\n return offsetParent || getContainingBlock(element) || win;\n}\n\nconst getElementRects = async function (data) {\n const getOffsetParentFn = this.getOffsetParent || getOffsetParent;\n const getDimensionsFn = this.getDimensions;\n const floatingDimensions = await getDimensionsFn(data.floating);\n return {\n reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),\n floating: {\n x: 0,\n y: 0,\n width: floatingDimensions.width,\n height: floatingDimensions.height\n }\n };\n};\n\nfunction isRTL(element) {\n return getComputedStyle$1(element).direction === 'rtl';\n}\n\nconst platform = {\n convertOffsetParentRelativeRectToViewportRelativeRect,\n getDocumentElement,\n getClippingRect,\n getOffsetParent,\n getElementRects,\n getClientRects,\n getDimensions,\n getScale,\n isElement,\n isRTL\n};\n\nfunction rectsAreEqual(a, b) {\n return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;\n}\n\n// https://samthor.au/2021/observing-dom/\nfunction observeMove(element, onMove, ancestorResize) {\n let io = null;\n let timeoutId;\n const root = getDocumentElement(element);\n function cleanup() {\n var _io;\n clearTimeout(timeoutId);\n (_io = io) == null || _io.disconnect();\n io = null;\n }\n function refresh(skip, threshold) {\n if (skip === void 0) {\n skip = false;\n }\n if (threshold === void 0) {\n threshold = 1;\n }\n cleanup();\n const elementRectForRootMargin = element.getBoundingClientRect();\n const {\n left,\n top,\n width,\n height\n } = elementRectForRootMargin;\n if (!skip) {\n onMove();\n }\n if (!width || !height) {\n return;\n }\n const insetTop = floor(top);\n const insetRight = floor(root.clientWidth - (left + width));\n const insetBottom = floor(root.clientHeight - (top + height));\n const insetLeft = floor(left);\n const rootMargin = -insetTop + \"px \" + -insetRight + \"px \" + -insetBottom + \"px \" + -insetLeft + \"px\";\n const options = {\n rootMargin,\n threshold: max(0, min(1, threshold)) || 1\n };\n let isFirstUpdate = true;\n function handleObserve(entries) {\n const ratio = entries[0].intersectionRatio;\n\n // The entry is a snapshot, so the reference may have moved since the\n // intersection was computed (under performance constraints, or between\n // consecutive frames of a multi-frame layout shift). The reported ratio\n // and the observed area are stale in that case and cannot be trusted to\n // detect subsequent movement, so refresh regardless of the ratio.\n if (!rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {\n return refresh();\n }\n if (ratio !== threshold) {\n if (!isFirstUpdate) {\n return refresh();\n }\n if (!ratio) {\n // If the reference is clipped in place, the ratio is 0. Throttle\n // the refresh to prevent an infinite loop of updates.\n timeoutId = setTimeout(() => {\n refresh(false, 1e-7);\n }, 1000);\n } else {\n refresh(false, ratio);\n }\n }\n isFirstUpdate = false;\n }\n\n // Older browsers don't support a `document` as the root and will throw an\n // error.\n try {\n io = new IntersectionObserver(handleObserve, {\n ...options,\n // Handle <iframe>s\n root: root.ownerDocument\n });\n } catch (_e) {\n io = new IntersectionObserver(handleObserve, options);\n }\n io.observe(element);\n }\n const win = getWindow(element);\n // The window is a resize ancestor, so when `ancestorResize` is enabled its\n // listener already runs the update on resize. Here we only need to rebuild\n // the `IntersectionObserver` for the new root size, skipping a redundant\n // update. When `ancestorResize` is disabled, this becomes the sole update.\n const handleResize = () => refresh(ancestorResize);\n win.addEventListener('resize', handleResize);\n refresh(true);\n return () => {\n win.removeEventListener('resize', handleResize);\n cleanup();\n };\n}\n\n/**\n * Automatically updates the position of the floating element when necessary.\n * Should only be called when the floating element is mounted on the DOM or\n * visible on the screen.\n * @returns cleanup function that should be invoked when the floating element is\n * removed from the DOM or hidden from the screen.\n * @see https://floating-ui.com/docs/autoUpdate\n */\nfunction autoUpdate(reference, floating, update, options) {\n if (options === void 0) {\n options = {};\n }\n const {\n ancestorScroll = true,\n ancestorResize = true,\n elementResize = typeof ResizeObserver === 'function',\n layoutShift = typeof IntersectionObserver === 'function',\n animationFrame = false\n } = options;\n const referenceEl = unwrapElement(reference);\n const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];\n ancestors.forEach(ancestor => {\n ancestorScroll && ancestor.addEventListener('scroll', update);\n ancestorResize && ancestor.addEventListener('resize', update);\n });\n const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update, ancestorResize) : null;\n let reobserveFrame = -1;\n let resizeObserver = null;\n if (elementResize) {\n resizeObserver = new ResizeObserver(_ref => {\n let [firstEntry] = _ref;\n if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {\n // Prevent update loops when using the `size` middleware.\n // https://github.com/floating-ui/floating-ui/issues/1740\n resizeObserver.unobserve(floating);\n cancelAnimationFrame(reobserveFrame);\n reobserveFrame = requestAnimationFrame(() => {\n var _resizeObserver;\n (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);\n });\n }\n update();\n });\n if (referenceEl && !animationFrame) {\n resizeObserver.observe(referenceEl);\n }\n if (floating) {\n resizeObserver.observe(floating);\n }\n }\n let frameId;\n let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;\n if (animationFrame) {\n frameLoop();\n }\n function frameLoop() {\n const nextRefRect = getBoundingClientRect(reference);\n if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {\n update();\n }\n prevRefRect = nextRefRect;\n frameId = requestAnimationFrame(frameLoop);\n }\n update();\n return () => {\n var _resizeObserver2;\n ancestors.forEach(ancestor => {\n ancestorScroll && ancestor.removeEventListener('scroll', update);\n ancestorResize && ancestor.removeEventListener('resize', update);\n });\n cleanupIo == null || cleanupIo();\n (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();\n resizeObserver = null;\n if (animationFrame) {\n cancelAnimationFrame(frameId);\n }\n };\n}\n\n/**\n * Resolves with an object of overflow side offsets that determine how much the\n * element is overflowing a given clipping boundary on each side.\n * - positive = overflowing the boundary by that number of pixels\n * - negative = how many pixels left before it will overflow\n * - 0 = lies flush with the boundary\n * @see https://floating-ui.com/docs/detectOverflow\n */\nconst detectOverflow = detectOverflow$1;\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = offset$1;\n\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = autoPlacement$1;\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = shift$1;\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = flip$1;\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = size$1;\n\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = hide$1;\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = arrow$1;\n\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = inline$1;\n\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = limitShift$1;\n\n/**\n * Computes the `x` and `y` coordinates that will place the floating element\n * next to a given reference element.\n */\nconst computePosition = (reference, floating, options) => {\n // This caches the expensive `getClippingElementAncestors` function so that\n // multiple lifecycle resets re-use the same result. It only lives for a\n // single call. If other functions become expensive, we can add them as well.\n const cache = new Map();\n const mergedOptions = options != null ? options : {};\n const platformWithCache = {\n ...platform,\n ...mergedOptions.platform,\n _c: cache\n };\n return computePosition$1(reference, floating, {\n ...mergedOptions,\n platform: platformWithCache\n });\n};\n\nexport { arrow, autoPlacement, autoUpdate, computePosition, detectOverflow, flip, hide, inline, limitShift, offset, platform, shift, size };\n","import { computePosition, arrow as arrow$2, autoPlacement as autoPlacement$1, flip as flip$1, hide as hide$1, inline as inline$1, limitShift as limitShift$1, offset as offset$1, shift as shift$1, size as size$1 } from '@floating-ui/dom';\nexport { autoUpdate, computePosition, detectOverflow, getOverflowAncestors, platform } from '@floating-ui/dom';\nimport * as React from 'react';\nimport { useLayoutEffect } from 'react';\nimport * as ReactDOM from 'react-dom';\n\nvar isClient = typeof document !== 'undefined';\n\nvar noop = function noop() {};\nvar index = isClient ? useLayoutEffect : noop;\n\n// Fork of `fast-deep-equal` that only does the comparisons we need and compares\n// functions\nfunction deepEqual(a, b) {\n if (a === b) {\n return true;\n }\n if (typeof a !== typeof b) {\n return false;\n }\n if (typeof a === 'function' && a.toString() === b.toString()) {\n return true;\n }\n let length;\n let i;\n let keys;\n if (a && b && typeof a === 'object') {\n if (Array.isArray(a)) {\n length = a.length;\n if (length !== b.length) return false;\n for (i = length; i-- !== 0;) {\n if (!deepEqual(a[i], b[i])) {\n return false;\n }\n }\n return true;\n }\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) {\n return false;\n }\n for (i = length; i-- !== 0;) {\n if (!{}.hasOwnProperty.call(b, keys[i])) {\n return false;\n }\n }\n for (i = length; i-- !== 0;) {\n const key = keys[i];\n if (key === '_owner' && a.$$typeof) {\n continue;\n }\n if (!deepEqual(a[key], b[key])) {\n return false;\n }\n }\n return true;\n }\n return a !== a && b !== b;\n}\n\nfunction getDPR(element) {\n if (typeof window === 'undefined') {\n return 1;\n }\n const win = element.ownerDocument.defaultView || window;\n return win.devicePixelRatio || 1;\n}\n\nfunction roundByDPR(element, value) {\n const dpr = getDPR(element);\n return Math.round(value * dpr) / dpr;\n}\n\nfunction useLatestRef(value) {\n const ref = React.useRef(value);\n index(() => {\n ref.current = value;\n });\n return ref;\n}\n\n/**\n * Provides data to position a floating element.\n * @see https://floating-ui.com/docs/useFloating\n */\nfunction useFloating(options) {\n if (options === void 0) {\n options = {};\n }\n const {\n placement = 'bottom',\n strategy = 'absolute',\n middleware = [],\n platform,\n elements: {\n reference: externalReference,\n floating: externalFloating\n } = {},\n transform = true,\n whileElementsMounted,\n open\n } = options;\n const [data, setData] = React.useState({\n x: 0,\n y: 0,\n strategy,\n placement,\n middlewareData: {},\n isPositioned: false\n });\n const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);\n if (!deepEqual(latestMiddleware, middleware)) {\n setLatestMiddleware(middleware);\n }\n const [_reference, _setReference] = React.useState(null);\n const [_floating, _setFloating] = React.useState(null);\n const setReference = React.useCallback(node => {\n if (node !== referenceRef.current) {\n referenceRef.current = node;\n _setReference(node);\n }\n }, []);\n const setFloating = React.useCallback(node => {\n if (node !== floatingRef.current) {\n floatingRef.current = node;\n _setFloating(node);\n }\n }, []);\n const referenceEl = externalReference || _reference;\n const floatingEl = externalFloating || _floating;\n const referenceRef = React.useRef(null);\n const floatingRef = React.useRef(null);\n const dataRef = React.useRef(data);\n const hasWhileElementsMounted = whileElementsMounted != null;\n const whileElementsMountedRef = useLatestRef(whileElementsMounted);\n const platformRef = useLatestRef(platform);\n const openRef = useLatestRef(open);\n const update = React.useCallback(() => {\n if (!referenceRef.current || !floatingRef.current) {\n return;\n }\n const config = {\n placement,\n strategy,\n middleware: latestMiddleware\n };\n if (platformRef.current) {\n config.platform = platformRef.current;\n }\n computePosition(referenceRef.current, floatingRef.current, config).then(data => {\n const fullData = {\n ...data,\n // The floating element's position may be recomputed while it's closed\n // but still mounted (such as when transitioning out). To ensure\n // `isPositioned` will be `false` initially on the next open, avoid\n // setting it to `true` when `open === false` (must be specified).\n isPositioned: openRef.current !== false\n };\n if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {\n dataRef.current = fullData;\n ReactDOM.flushSync(() => {\n setData(fullData);\n });\n }\n });\n }, [latestMiddleware, placement, strategy, platformRef, openRef]);\n index(() => {\n if (open === false && dataRef.current.isPositioned) {\n dataRef.current.isPositioned = false;\n setData(data => ({\n ...data,\n isPositioned: false\n }));\n }\n }, [open]);\n const isMountedRef = React.useRef(false);\n index(() => {\n isMountedRef.current = true;\n return () => {\n isMountedRef.current = false;\n };\n }, []);\n index(() => {\n if (referenceEl) referenceRef.current = referenceEl;\n if (floatingEl) floatingRef.current = floatingEl;\n if (referenceEl && floatingEl) {\n if (whileElementsMountedRef.current) {\n return whileElementsMountedRef.current(referenceEl, floatingEl, update);\n }\n update();\n }\n }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);\n const refs = React.useMemo(() => ({\n reference: referenceRef,\n floating: floatingRef,\n setReference,\n setFloating\n }), [setReference, setFloating]);\n const elements = React.useMemo(() => ({\n reference: referenceEl,\n floating: floatingEl\n }), [referenceEl, floatingEl]);\n const floatingStyles = React.useMemo(() => {\n const initialStyles = {\n position: strategy,\n left: 0,\n top: 0\n };\n if (!elements.floating) {\n return initialStyles;\n }\n const x = roundByDPR(elements.floating, data.x);\n const y = roundByDPR(elements.floating, data.y);\n if (transform) {\n return {\n ...initialStyles,\n transform: \"translate(\" + x + \"px, \" + y + \"px)\",\n ...(getDPR(elements.floating) >= 1.5 && {\n willChange: 'transform'\n })\n };\n }\n return {\n position: strategy,\n left: x,\n top: y\n };\n }, [strategy, transform, elements.floating, data.x, data.y]);\n return React.useMemo(() => ({\n ...data,\n update,\n refs,\n elements,\n floatingStyles\n }), [data, update, refs, elements, floatingStyles]);\n}\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * This wraps the core `arrow` middleware to allow React refs as the element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow$1 = options => {\n function isRef(value) {\n return {}.hasOwnProperty.call(value, 'current');\n }\n return {\n name: 'arrow',\n options,\n fn(state) {\n const {\n element,\n padding\n } = typeof options === 'function' ? options(state) : options;\n if (element && isRef(element)) {\n if (element.current != null) {\n return arrow$2({\n element: element.current,\n padding\n }).fn(state);\n }\n return {};\n }\n if (element) {\n return arrow$2({\n element,\n padding\n }).fn(state);\n }\n return {};\n }\n };\n};\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = (options, deps) => {\n const result = offset$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = (options, deps) => {\n const result = shift$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = (options, deps) => {\n const result = limitShift$1(options);\n return {\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = (options, deps) => {\n const result = flip$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = (options, deps) => {\n const result = size$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = (options, deps) => {\n const result = autoPlacement$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = (options, deps) => {\n const result = hide$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = (options, deps) => {\n const result = inline$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * This wraps the core `arrow` middleware to allow React refs as the element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = (options, deps) => {\n const result = arrow$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\nexport { arrow, autoPlacement, flip, hide, inline, limitShift, offset, shift, size, useFloating };\n","import { ReactStore } from '@base-ui/utils/store';\nimport { createEventEmitter } from \"../utils/createEventEmitter.mjs\";\nimport { isClickLikeEvent } from \"../utils.mjs\";\nconst selectors = {\n open: state => state.open,\n transitionStatus: state => state.transitionStatus,\n domReferenceElement: state => state.domReferenceElement,\n referenceElement: state => state.positionReference ?? state.referenceElement,\n floatingElement: state => state.floatingElement,\n floatingId: state => state.floatingId\n};\nexport class FloatingRootStore extends ReactStore {\n constructor(options) {\n const {\n syncOnly,\n nested,\n onOpenChange,\n triggerElements,\n ...initialState\n } = options;\n super({\n ...initialState,\n positionReference: initialState.referenceElement,\n domReferenceElement: initialState.referenceElement\n }, {\n onOpenChange,\n dataRef: {\n current: {}\n },\n events: createEventEmitter(),\n nested,\n triggerElements\n }, selectors);\n this.syncOnly = syncOnly;\n }\n\n /**\n * Syncs the event used by hover logic to distinguish hover-open from click-like interaction.\n */\n syncOpenEvent = (newOpen, event) => {\n if (!newOpen || !this.state.open ||\n // Prevent a pending hover-open from overwriting a click-open event, while allowing\n // click events to upgrade a hover-open.\n event != null && isClickLikeEvent(event)) {\n this.context.dataRef.current.openEvent = newOpen ? event : undefined;\n }\n };\n\n /**\n * Runs the root-owned side effects for an open state change.\n */\n dispatchOpenChange = (newOpen, eventDetails) => {\n this.syncOpenEvent(newOpen, eventDetails.event);\n const details = {\n open: newOpen,\n reason: eventDetails.reason,\n nativeEvent: eventDetails.event,\n nested: this.context.nested,\n triggerElement: eventDetails.trigger\n };\n this.context.events.emit('openchange', details);\n };\n\n /**\n * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments.\n *\n * @param newOpen The new open state.\n * @param eventDetails Details about the event that triggered the open state change.\n */\n setOpen = (newOpen, eventDetails) => {\n if (this.syncOnly) {\n this.context.onOpenChange?.(newOpen, eventDetails);\n return;\n }\n this.dispatchOpenChange(newOpen, eventDetails);\n this.context.onOpenChange?.(newOpen, eventDetails);\n };\n}","'use client';\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { useId } from '@base-ui/utils/useId';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { FOCUSABLE_ATTRIBUTE } from \"../../floating-ui-react/utils/constants.mjs\";\nimport { useFloatingParentNodeId } from \"../../floating-ui-react/components/FloatingTree.mjs\";\nimport { useSyncedFloatingRootContext } from \"../../floating-ui-react/hooks/useSyncedFloatingRootContext.mjs\";\nimport { useTransitionStatus } from \"../../internals/useTransitionStatus.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nexport const FOCUSABLE_POPUP_PROPS = {\n tabIndex: -1,\n [FOCUSABLE_ATTRIBUTE]: ''\n};\n\n/**\n * Returns the default `initialFocus` resolver for a popup. When opened by touch it focuses the\n * popup element itself to prevent the virtual keyboard from opening (required for Android\n * specifically; iOS handles this automatically). Otherwise it falls back to the default behavior.\n */\nexport function createDefaultInitialFocus(popupRef) {\n return interactionType => interactionType === 'touch' ? popupRef.current : true;\n}\n\n/**\n * The subset of a popup handle that a Root needs to bind its store to. Both the real handle classes\n * and any test double satisfy it.\n */\n\n/**\n * Creates and owns a popup store on behalf of a Root part. The store is created exactly once, with\n * controlled props and root state synced separately after creation. Sets up the synced floating\n * root context and returns the store.\n *\n * @param createStore Factory that builds the store. Called exactly once, receiving the floating id\n * and whether the popup is nested inside another floating element, both resolved on the first render.\n * @param treatPopupAsFloatingElement Whether the popup element is passed to Floating UI as the\n * floating element instead of the default positioner.\n */\nexport function usePopupRootStore(createStore, treatPopupAsFloatingElement = false) {\n const floatingId = useId();\n const nested = useFloatingParentNodeId() != null;\n const store = useRefWithInit(() => createStore(floatingId, nested)).current;\n useSyncedFloatingRootContext({\n popupStore: store,\n treatPopupAsFloatingElement,\n floatingRootContext: store.state.floatingRootContext,\n floatingId,\n nested,\n onOpenChange: store.setOpen\n });\n return store;\n}\n\n/**\n * Attaches a Root's store to a handle for this component's committed lifetime. Popup Roots render\n * it before their interactions and user children so its layout effect runs before descendant layout\n * effects. This lets descendants call the handle during the Root's initial commit without attaching\n * during render, which would leak suspended or abandoned stores. Store subscribers are notified by\n * `attachStore` in this ordinary layout phase, where React permits synchronous updates.\n *\n * Popup Roots must render this component only when a handle is present so handle-less Roots avoid\n * mounting an extra fiber and layout effect.\n */\nexport function PopupHandleAttachment({\n handle,\n store\n}) {\n useIsoLayoutEffect(() => {\n return handle.attachStore(store);\n }, [handle, store]);\n return null;\n}\nfunction syncTriggerCount(store) {\n const triggerCount = store.context.triggerElements.size;\n if (store.select('open') && store.state.triggerCount !== triggerCount) {\n store.set('triggerCount', triggerCount);\n }\n}\n\n/**\n * Returns a stable callback ref that registers/unregisters the trigger element in the store.\n *\n * Stable so a downstream ref merger that retains the callback it was first given still reaches the\n * trigger's current store. The registration is tracked as a `(store, id, element)` triple, so\n * unregistering targets the store the element was actually registered in.\n *\n * Since the callback never changes, the caller must re-run it from a layout effect keyed on\n * `[store, id]` to migrate an already-registered element. That effect is also what registers the\n * element in the first place when `id` only resolves after the first commit (React 17's `useId`\n * fallback), because the register call made while the id is still `undefined` does nothing.\n *\n * @param id Id of the trigger.\n * @param store The Store instance where the trigger should be registered.\n */\nexport function useTriggerRegistration(id, store) {\n const registrationRef = React.useRef(null);\n return useStableCallback(element => {\n const registration = registrationRef.current;\n if (registration !== null) {\n if (registration.element === element && registration.store === store && registration.id === id) {\n // Already registered where it belongs, so the caller's migration effect is free on mount.\n return;\n }\n registrationRef.current = null;\n const registeredStore = registration.store;\n if (registeredStore.context.triggerElements.getById(registration.id) === registration.element) {\n registeredStore.context.triggerElements.delete(registration.id);\n syncTriggerCount(registeredStore);\n }\n }\n if (element !== null && id !== undefined) {\n registrationRef.current = {\n store,\n id,\n element\n };\n store.context.triggerElements.add(id, element);\n syncTriggerCount(store);\n }\n });\n}\nexport function createPopupOpenState(state, open, trigger, preventUnmountOnClose = false) {\n let preventUnmountingOnClose = state.preventUnmountingOnClose;\n if (open) {\n // Opening starts a new close cycle, so clear any previous request to keep the popup mounted.\n preventUnmountingOnClose = false;\n } else if (preventUnmountOnClose) {\n preventUnmountingOnClose = true;\n }\n const triggerId = trigger?.id ?? null;\n let activeTriggerId = state.activeTriggerId;\n let activeTriggerElement = state.activeTriggerElement;\n\n // If a popup is closing, the `trigger` may be undefined.\n // We want to keep the previous value so that exit animations are played and focus is returned correctly.\n if (triggerId || open) {\n activeTriggerId = triggerId;\n activeTriggerElement = trigger ?? null;\n }\n return {\n open,\n preventUnmountingOnClose,\n activeTriggerId,\n activeTriggerElement\n };\n}\nexport function attachPreventUnmountOnClose(eventDetails) {\n let preventUnmountOnClose = false;\n eventDetails.preventUnmountOnClose = () => {\n preventUnmountOnClose = true;\n };\n return () => preventUnmountOnClose;\n}\n\n/**\n * Runs the shared open-change sequence for a popup store: notifies `onOpenChange`,\n * honors cancellation, dispatches the floating root change, maps the reason to an\n * `instantType`, and commits the state update (synchronously for hover so\n * `getAnimations()` observes it). Stores supply their own differences via\n * `extraState` (e.g. the last change reason) and `onBeforeDispatch` (e.g. updating\n * inline-rect coordinates).\n */\nexport function applyPopupOpenChange(store, nextOpen, eventDetails, options = {}) {\n const reason = eventDetails.reason;\n const isHover = reason === REASONS.triggerHover;\n const isFocusOpen = nextOpen && reason === REASONS.triggerFocus;\n const isDismissClose = !nextOpen && (reason === REASONS.triggerPress || reason === REASONS.escapeKey);\n const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails);\n store.context.onOpenChange?.(nextOpen, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n options.onBeforeDispatch?.();\n store.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);\n const changeState = () => {\n const popupOpenState = createPopupOpenState(store.state, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose());\n const updatedState = {\n ...options.extraState,\n ...popupOpenState\n };\n if (isFocusOpen) {\n updatedState.instantType = 'focus';\n } else if (isDismissClose) {\n updatedState.instantType = 'dismiss';\n } else if (isHover) {\n updatedState.instantType = undefined;\n }\n store.update(updatedState);\n };\n if (isHover) {\n // Flush synchronously for hover so `node.getAnimations()` sees the new state.\n ReactDOM.flushSync(changeState);\n } else {\n changeState();\n }\n}\n\n/**\n * Sets up trigger data forwarding to the store.\n *\n * @param triggerId Id of the trigger.\n * @param triggerElementRef Ref for the trigger DOM element.\n * @param store The Store instance managing the popup state.\n * @param stateUpdates An object with state updates to apply when the trigger is active.\n */\nexport function useTriggerDataForwarding(triggerId, triggerElementRef, store, stateUpdates) {\n const isMountedByThisTrigger = store.useState('isMountedByTrigger', triggerId);\n const baseRegisterTrigger = useTriggerRegistration(triggerId, store);\n\n // Applies trigger-owned state (active-trigger ownership and payload) when the trigger registers.\n // Stable so payload/`stateUpdates` changes do not change the ref identity (which would needlessly\n // churn registration); it reads the latest closure values when invoked.\n const applyTriggerData = useStableCallback(element => {\n const open = store.select('open');\n const activeTriggerId = store.select('activeTriggerId');\n if (activeTriggerId === triggerId) {\n const changes = {\n activeTriggerElement: element,\n ...(open ? stateUpdates : null)\n };\n store.update(changes);\n return;\n }\n if (activeTriggerId == null && open) {\n // If a popup is already open, a detached trigger can mount before any active trigger\n // has been established. Claim the first registered trigger so trigger-owned focus\n // management and ARIA relationships work.\n const changes = {\n activeTriggerId: triggerId ?? null,\n activeTriggerElement: element,\n ...stateUpdates\n };\n store.update(changes);\n }\n });\n\n // Stable, so the merged ref on the rendered element keeps its identity for the trigger's whole\n // lifetime.\n const registerTrigger = useStableCallback(element => {\n baseRegisterTrigger(element);\n if (element) {\n applyTriggerData(element);\n }\n });\n\n // A stable ref does not re-fire on a store or id change, so migrate here instead: unregister from\n // the previous store, then register the element the trigger still renders into the current one.\n useIsoLayoutEffect(() => {\n registerTrigger(triggerElementRef.current);\n return () => registerTrigger(null);\n }, [registerTrigger, triggerElementRef, store, triggerId]);\n useIsoLayoutEffect(() => {\n if (isMountedByThisTrigger) {\n const changes = {\n activeTriggerElement: triggerElementRef.current,\n ...stateUpdates\n };\n store.update(changes);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isMountedByThisTrigger, store, triggerElementRef, ...Object.values(stateUpdates)]);\n return {\n registerTrigger,\n isMountedByThisTrigger\n };\n}\n/**\n * Keeps trigger registration state synchronized while the popup is open.\n *\n * When a popup opens without an explicit trigger id and exactly one trigger is registered, that\n * trigger is claimed as the active trigger. When the active trigger id is still registered but its\n * element changed, the active element is refreshed. When the active trigger id is missing from the\n * registry but the same element is still registered under a different id (e.g. the rendered trigger\n * carries its own DOM `id` that differs from Base UI's internal trigger id), the active id is\n * reassociated to the registered id instead of being treated as lost. When the active trigger\n * unregisters, the default path preserves existing ownership so non-closing popup families do not\n * silently claim a different trigger while staying open.\n *\n * If `closeOnActiveTriggerUnmount` is enabled, unregistering a previously resolved active trigger\n * requests a close after a microtask so a same-tick replacement trigger with the same id can\n * register first. An active trigger id that has not matched a registered trigger yet is treated as\n * pending and does not request a close.\n *\n * This should be called on the Root part.\n *\n * @param store The Store instance managing the popup state.\n * @param options Options for active trigger unmount behavior.\n */\nexport function useImplicitActiveTrigger(store, options = {}) {\n const {\n closeOnActiveTriggerUnmount = false\n } = options;\n // Distinguishes a trigger that unmounted from a new active trigger that has not hydrated yet.\n const resolvedActiveTriggerIdRef = React.useRef(null);\n const open = store.useState('open');\n const reactiveTriggerCount = store.useState('triggerCount');\n // Subscribe to the active trigger id so the reconciliation below reruns when ownership moves to\n // another trigger while the popup stays open (e.g. a focus/hover handoff between triggers).\n const activeTriggerId = store.useState('activeTriggerId');\n // Subscribe to the active trigger element so the reconciliation reruns when a pending active\n // trigger registers in a commit where the trigger count nets out unchanged (registration\n // forwards the element to the store when the registering trigger matches the active id).\n // Without this, the id would never be marked resolved and a later genuine unmount would be\n // misclassified as pending, disabling `closeOnActiveTriggerUnmount`.\n const reactiveActiveTriggerElement = store.useState('activeTriggerElement');\n useIsoLayoutEffect(() => {\n if (!open) {\n resolvedActiveTriggerIdRef.current = null;\n if (store.state.triggerCount !== 0) {\n store.set('triggerCount', 0);\n }\n return;\n }\n const triggerCount = store.context.triggerElements.size;\n const stateUpdates = {};\n if (store.state.triggerCount !== triggerCount) {\n stateUpdates.triggerCount = triggerCount;\n }\n const currentActiveTriggerId = store.select('activeTriggerId');\n let lostActiveTriggerId = null;\n if (currentActiveTriggerId) {\n const activeTriggerElement = store.context.triggerElements.getById(currentActiveTriggerId);\n if (!activeTriggerElement) {\n for (const [triggerId, triggerElement] of store.context.triggerElements.entries()) {\n if (triggerElement === store.state.activeTriggerElement) {\n stateUpdates.activeTriggerId = triggerId;\n stateUpdates.activeTriggerElement = triggerElement;\n resolvedActiveTriggerIdRef.current = triggerId;\n break;\n }\n }\n if (stateUpdates.activeTriggerId === undefined) {\n if (resolvedActiveTriggerIdRef.current === currentActiveTriggerId) {\n lostActiveTriggerId = currentActiveTriggerId;\n } else {\n resolvedActiveTriggerIdRef.current = null;\n }\n }\n } else {\n resolvedActiveTriggerIdRef.current = currentActiveTriggerId;\n if (activeTriggerElement !== store.state.activeTriggerElement) {\n stateUpdates.activeTriggerElement = activeTriggerElement;\n }\n }\n } else {\n resolvedActiveTriggerIdRef.current = null;\n }\n if (!lostActiveTriggerId && !currentActiveTriggerId && triggerCount === 1) {\n const iteratorResult = store.context.triggerElements.entries().next();\n if (!iteratorResult.done) {\n const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value;\n stateUpdates.activeTriggerId = implicitTriggerId;\n stateUpdates.activeTriggerElement = implicitTriggerElement;\n resolvedActiveTriggerIdRef.current = implicitTriggerId;\n }\n }\n if (stateUpdates.triggerCount !== undefined || stateUpdates.activeTriggerId !== undefined || stateUpdates.activeTriggerElement !== undefined) {\n store.update(stateUpdates);\n }\n if (lostActiveTriggerId) {\n if (closeOnActiveTriggerUnmount) {\n // Defer so a same-tick replacement trigger with the same id can register first.\n queueMicrotask(() => {\n if (store.select('open') && store.select('activeTriggerId') === lostActiveTriggerId && !store.context.triggerElements.getById(lostActiveTriggerId)) {\n const eventDetails = createChangeEventDetails(REASONS.none);\n store.setOpen(false, eventDetails);\n // If closing is canceled, keep the previous active trigger ownership for the\n // still-open popup instead of claiming another trigger implicitly.\n if (!eventDetails.isCanceled) {\n store.update({\n activeTriggerId: null,\n activeTriggerElement: null\n });\n }\n }\n });\n }\n }\n }, [open, store, reactiveTriggerCount, activeTriggerId, reactiveActiveTriggerElement, closeOnActiveTriggerUnmount]);\n}\n\n/**\n * Manages the mounted state of the popup.\n * Sets up the transition status listeners and handles unmounting when needed.\n * Updates the `mounted`, `transitionStatus`, and `preventUnmountingOnClose` states in the store.\n *\n * @param open Whether the popup is open.\n * @param store The Store instance managing the popup state.\n * @param onUnmount Optional callback to be called when the popup is unmounted.\n * @param animateInitialOpen Whether a popup that mounts already open should still play its enter\n * transition. Defaults to `false`, so content that was open on the first render (a `defaultOpen`\n * popup on page load, SSR'd markup) appears without animating. Opt in for popups whose subtree\n * only mounts in response to something the user did, such as a submenu inside a menu popup.\n *\n * @returns A function to forcibly unmount the popup.\n */\nexport function useOpenStateTransitions(open, store, onUnmount, animateInitialOpen) {\n const {\n mounted,\n setMounted,\n transitionStatus\n } = useTransitionStatus(open, false, false, animateInitialOpen);\n const preventUnmountingOnClose = store.useState('preventUnmountingOnClose');\n // Opening starts a new close cycle. Clear during render so the close-completion hook below\n // reads the synchronized value on the same pass.\n const syncedPreventUnmountingOnClose = open ? false : preventUnmountingOnClose;\n store.useSyncedValues({\n mounted,\n transitionStatus,\n preventUnmountingOnClose: syncedPreventUnmountingOnClose\n });\n const forceUnmount = useStableCallback(() => {\n setMounted(false);\n store.update({\n activeTriggerId: null,\n activeTriggerElement: null,\n mounted: false,\n preventUnmountingOnClose: false\n });\n onUnmount?.();\n store.context.onOpenChangeComplete?.(false);\n });\n useOpenChangeComplete({\n enabled: mounted && !open && !syncedPreventUnmountingOnClose,\n open,\n ref: store.context.popupRef,\n onComplete() {\n if (!open) {\n forceUnmount();\n }\n }\n });\n return {\n forceUnmount,\n transitionStatus\n };\n}\nexport function usePopupInteractionProps(store, statePart) {\n store.useSyncedValues(statePart);\n useIsoLayoutEffect(() => () => {\n store.update({\n activeTriggerProps: EMPTY_OBJECT,\n inactiveTriggerProps: EMPTY_OBJECT,\n popupProps: EMPTY_OBJECT\n });\n }, [store]);\n}\nexport function usePopupRootSync(store, open) {\n useIsoLayoutEffect(() => {\n if (!open && store.state.openMethod !== null) {\n store.set('openMethod', null);\n }\n }, [open, store]);\n useIsoLayoutEffect(() => () => {\n if (store.state.openMethod !== null) {\n store.set('openMethod', null);\n }\n }, [store]);\n}","/**\n * Development-only reverse index of element to registered id, keyed by the owning map.\n *\n * Registration would otherwise have to scan every entry to detect an element claimed by two ids,\n * making the mount of many triggers sharing one handle quadratic. Kept module-scoped, lazily\n * initialized, and read only from `process.env.NODE_ENV` guards so production builds drop it along\n * with the checks.\n */\nlet devElementIdsByMap;\nfunction getDevElementIds(map) {\n devElementIdsByMap ??= new WeakMap();\n let elementIds = devElementIdsByMap.get(map);\n if (!elementIds) {\n elementIds = new WeakMap();\n devElementIdsByMap.set(map, elementIds);\n }\n return elementIds;\n}\n\n/**\n * Data structure to keep track of popup trigger elements by their IDs.\n *\n * Element lookups iterate the id map rather than maintaining a parallel Set. Registration is O(1),\n * while `hasElement` and `hasMatchingElement` are linear in the number of triggers.\n */\nexport class PopupTriggerMap {\n constructor() {\n this.idMap = new Map();\n }\n\n /**\n * Adds a trigger element with the given ID.\n *\n * Note: The provided element is assumed to not be registered under multiple IDs.\n */\n add(id, element) {\n if (process.env.NODE_ENV !== 'production') {\n const elementIds = getDevElementIds(this);\n const existingId = elementIds.get(element);\n if (existingId !== undefined && existingId !== id) {\n // TODO: fix mui/no-guarded-throw\n // eslint-disable-next-line mui/no-guarded-throw\n throw new Error('Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.');\n }\n\n // Reusing an id for a different element evicts the previous one, so it must lose its claim\n // on the id or a later registration under a different id would be reported as a duplicate.\n const previousElement = this.idMap.get(id);\n if (previousElement !== undefined && previousElement !== element) {\n elementIds.delete(previousElement);\n }\n elementIds.set(element, id);\n }\n this.idMap.set(id, element);\n }\n\n /**\n * Removes the trigger element with the given ID.\n */\n delete(id) {\n if (process.env.NODE_ENV !== 'production') {\n const element = this.idMap.get(id);\n if (element !== undefined) {\n devElementIdsByMap?.get(this)?.delete(element);\n }\n }\n this.idMap.delete(id);\n }\n\n /**\n * Whether the given element is registered as a trigger.\n */\n hasElement(element) {\n for (const registered of this.idMap.values()) {\n if (registered === element) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Whether there is a registered trigger element matching the given predicate.\n */\n hasMatchingElement(predicate) {\n for (const element of this.idMap.values()) {\n if (predicate(element)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Returns the trigger element associated with the given ID, or undefined if no such element exists.\n */\n getById(id) {\n return this.idMap.get(id);\n }\n\n /**\n * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element].\n */\n entries() {\n return this.idMap.entries();\n }\n\n /**\n * Returns an iterable of all registered trigger elements.\n */\n elements() {\n return this.idMap.values();\n }\n\n /**\n * Returns the number of registered trigger elements.\n */\n get size() {\n return this.idMap.size;\n }\n}","'use client';\n\nimport { isElement } from '@floating-ui/utils/dom';\nimport { useId } from '@base-ui/utils/useId';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { PopupTriggerMap } from \"../../utils/popups/index.mjs\";\nimport { useFloatingParentNodeId } from \"../components/FloatingTree.mjs\";\nimport { FloatingRootStore } from \"../components/FloatingRootStore.mjs\";\nexport function useFloatingRootContext(options) {\n const {\n open = false,\n onOpenChange,\n elements = {}\n } = options;\n const floatingId = useId();\n const nested = useFloatingParentNodeId() != null;\n if (process.env.NODE_ENV !== 'production') {\n const optionDomReference = elements.reference;\n if (optionDomReference && !isElement(optionDomReference)) {\n console.error('Cannot pass a virtual element to the `elements.reference` option,', 'as it must be a real DOM element. Use `context.setPositionReference()`', 'instead.');\n }\n }\n const store = useRefWithInit(() => new FloatingRootStore({\n open,\n transitionStatus: undefined,\n onOpenChange,\n referenceElement: elements.reference ?? null,\n floatingElement: elements.floating ?? null,\n triggerElements: new PopupTriggerMap(),\n floatingId,\n syncOnly: false,\n nested\n })).current;\n useIsoLayoutEffect(() => {\n const valuesToSync = {\n open,\n floatingId\n };\n if (elements.reference !== undefined) {\n valuesToSync.referenceElement = elements.reference;\n valuesToSync.domReferenceElement = isElement(elements.reference) ? elements.reference : null;\n }\n if (elements.floating !== undefined) {\n valuesToSync.floatingElement = elements.floating;\n }\n store.update(valuesToSync);\n }, [open, floatingId, elements.reference, elements.floating, store]);\n store.context.onOpenChange = onOpenChange;\n store.context.nested = nested;\n return store;\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useFloating as usePosition } from '@floating-ui/react-dom';\nimport { isElement } from '@floating-ui/utils/dom';\nimport { useFloatingTree } from \"../components/FloatingTree.mjs\";\nimport { useFloatingRootContext } from \"./useFloatingRootContext.mjs\";\n\n/**\n * Provides data to position a floating element and context to add interactions.\n * @see https://floating-ui.com/docs/useFloating\n */\nexport function useFloating(options = {}) {\n const internalStore = useFloatingRootContext(options);\n const store = options.rootContext || internalStore;\n return useFloatingWithStore(options, store);\n}\n\n/**\n * Base UI's private `useFloating` path. The caller must supply the root store, so this skips the\n * internal root-context hook used by the public Floating UI-compatible API.\n */\nexport function useBaseUIFloating(options) {\n return useFloatingWithStore(options, options.rootContext);\n}\nfunction useFloatingWithStore(options, store) {\n const {\n nodeId,\n externalTree\n } = options;\n const referenceElement = store.useState('referenceElement');\n const floatingElement = store.useState('floatingElement');\n const domReferenceElement = store.useState('domReferenceElement');\n const open = store.useState('open');\n const floatingId = store.useState('floatingId');\n const [positionReference, setPositionReferenceRaw] = React.useState(null);\n const [localDomReference, setLocalDomReference] = React.useState(undefined);\n const [localFloatingElement, setLocalFloatingElement] = React.useState(undefined);\n const domReferenceRef = React.useRef(null);\n const tree = useFloatingTree(externalTree);\n const storeElements = React.useMemo(() => ({\n reference: referenceElement,\n floating: floatingElement,\n domReference: domReferenceElement\n }), [referenceElement, floatingElement, domReferenceElement]);\n const position = usePosition({\n ...options,\n elements: {\n ...storeElements,\n ...(positionReference && {\n reference: positionReference\n })\n }\n });\n const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null;\n const syncedFloatingElement = localFloatingElement === undefined ? store.state.floatingElement : localFloatingElement;\n store.useSyncedValue('referenceElement', localDomReference ?? null);\n store.useSyncedValue('domReferenceElement', localDomReference === undefined ? domReferenceElement : localDomReferenceElement);\n store.useSyncedValue('floatingElement', syncedFloatingElement);\n const setPositionReference = React.useCallback(node => {\n const computedPositionReference = isElement(node) ? {\n getBoundingClientRect: () => node.getBoundingClientRect(),\n getClientRects: () => node.getClientRects(),\n contextElement: node\n } : node;\n // Store the positionReference in state if the DOM reference is specified externally via the\n // `elements.reference` option. This ensures that it won't be overridden on future renders.\n setPositionReferenceRaw(computedPositionReference);\n position.refs.setReference(computedPositionReference);\n }, [position.refs]);\n const setReference = React.useCallback(node => {\n if (isElement(node) || node === null) {\n domReferenceRef.current = node;\n setLocalDomReference(node);\n }\n\n // Backwards-compatibility for passing a virtual element to `reference`\n // after it has set the DOM reference.\n if (isElement(position.refs.reference.current) || position.refs.reference.current === null ||\n // Don't allow setting virtual elements using the old technique back to\n // `null` to support `positionReference` + an unstable `reference`\n // callback ref.\n node !== null && !isElement(node)) {\n position.refs.setReference(node);\n }\n }, [position.refs, setLocalDomReference]);\n const setFloating = React.useCallback(node => {\n setLocalFloatingElement(node);\n position.refs.setFloating(node);\n }, [position.refs]);\n const refs = React.useMemo(() => ({\n ...position.refs,\n setReference,\n setFloating,\n setPositionReference,\n domReference: domReferenceRef\n }), [position.refs, setReference, setFloating, setPositionReference]);\n const elements = React.useMemo(() => ({\n ...position.elements,\n domReference: domReferenceElement\n }), [position.elements, domReferenceElement]);\n const context = React.useMemo(() => ({\n ...position,\n dataRef: store.context.dataRef,\n open,\n onOpenChange: store.setOpen,\n events: store.context.events,\n floatingId,\n refs,\n elements,\n nodeId,\n rootStore: store\n }), [position, refs, elements, nodeId, store, open, floatingId]);\n useIsoLayoutEffect(() => {\n if (domReferenceElement) {\n domReferenceRef.current = domReferenceElement;\n }\n }, [domReferenceElement]);\n useIsoLayoutEffect(() => {\n store.context.dataRef.current.floatingContext = context;\n const node = tree?.nodesRef.current.find(n => n.id === nodeId);\n if (node) {\n node.context = context;\n }\n });\n return React.useMemo(() => ({\n ...position,\n context,\n refs,\n elements,\n rootStore: store\n }), [position, refs, elements, context, store]);\n}","'use client';\n\nimport * as React from 'react';\nimport { useAnimationFrame } from '@base-ui/utils/useAnimationFrame';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { platform } from '@base-ui/utils/platform';\nimport { isHTMLElement } from '@floating-ui/utils/dom';\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useFloatingParentNodeId, useFloatingTree } from \"../components/FloatingTree.mjs\";\nimport { findNonDisabledListIndex, getMaxListIndex, getMinListIndex, isIndexOutOfListBounds } from \"../utils/composite.mjs\";\nimport { ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP } from \"../utils/constants.mjs\";\nimport { activeElement, contains, getFloatingFocusElement, getTarget, isTypeableCombobox } from \"../utils/element.mjs\";\nimport { enqueueFocus } from \"../utils/enqueueFocus.mjs\";\nimport { isVirtualClick, isVirtualPointerEvent, stopEvent } from \"../utils/event.mjs\";\nexport const ESCAPE = 'Escape';\n\n// WebKit fires zero-delta `mousemove`/`pointermove` events when the list scrolls\n// beneath a stationary pointer, moving the highlight during keyboard navigation.\n// https://github.com/mui/base-ui/issues/4002\nfunction isStationaryWebKitPointer(event) {\n return platform.engine.webkit && event.movementX === 0 && event.movementY === 0;\n}\nfunction doSwitch(orientation, vertical, horizontal) {\n switch (orientation) {\n case 'vertical':\n return vertical;\n case 'horizontal':\n return horizontal;\n default:\n return vertical || horizontal;\n }\n}\nfunction isMainOrientationKey(key, orientation) {\n const vertical = key === ARROW_UP || key === ARROW_DOWN;\n const horizontal = key === ARROW_LEFT || key === ARROW_RIGHT;\n return doSwitch(orientation, vertical, horizontal);\n}\nfunction isMainOrientationToEndKey(key, orientation, rtl) {\n const vertical = key === ARROW_DOWN;\n const horizontal = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT;\n return doSwitch(orientation, vertical, horizontal) || key === 'Enter' || key === ' ' || key === '';\n}\nfunction isCrossOrientationOpenKey(key, orientation, rtl) {\n const vertical = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT;\n const horizontal = key === ARROW_DOWN;\n return doSwitch(orientation, vertical, horizontal);\n}\nfunction isCrossOrientationCloseKey(key, orientation, rtl, grid) {\n const vertical = rtl ? key === ARROW_RIGHT : key === ARROW_LEFT;\n const horizontal = key === ARROW_UP;\n if (orientation === 'both' || orientation === 'horizontal' && grid) {\n return key === ESCAPE;\n }\n return doSwitch(orientation, vertical, horizontal);\n}\n/**\n * Adds arrow key-based navigation of a list of items, either using real DOM\n * focus or virtual focus.\n * @see https://floating-ui.com/docs/useListNavigation\n */\nexport function useListNavigation(context, props) {\n const {\n listRef,\n activeIndex,\n onNavigate: onNavigateProp = () => {},\n enabled = true,\n selectedIndex = null,\n allowEscape = false,\n loopFocus = false,\n nested = false,\n rtl = false,\n virtual = false,\n focusItemOnOpen = 'auto',\n focusItemOnHover = true,\n openOnArrowKeyDown = true,\n disabledIndices = undefined,\n orientation = 'vertical',\n parentOrientation,\n id,\n resetOnPointerLeave = true,\n externalTree,\n grid: navigateGrid\n } = props;\n const isGrid = navigateGrid != null;\n if (process.env.NODE_ENV !== 'production') {\n if (allowEscape) {\n if (!loopFocus) {\n console.warn('`useListNavigation` looping must be enabled to allow escaping.');\n }\n if (!virtual) {\n console.warn('`useListNavigation` must be virtual to allow escaping.');\n }\n }\n if (orientation === 'vertical' && isGrid) {\n console.warn('In grid list navigation mode, the `orientation` should', 'be either \"horizontal\" or \"both\".');\n }\n }\n const store = 'rootStore' in context ? context.rootStore : context;\n const open = store.useState('open');\n const floatingElement = store.useState('floatingElement');\n const domReferenceElement = store.useState('domReferenceElement');\n const dataRef = store.context.dataRef;\n const floatingFocusElement = getFloatingFocusElement(floatingElement);\n const typeableComboboxReference = isTypeableCombobox(domReferenceElement);\n const floatingFocusElementRef = useValueAsRef(floatingFocusElement);\n const parentId = useFloatingParentNodeId();\n const tree = useFloatingTree(externalTree);\n const focusItemOnOpenRef = React.useRef(focusItemOnOpen);\n const indexRef = React.useRef(selectedIndex ?? -1);\n const keyRef = React.useRef(null);\n const isPointerModalityRef = React.useRef(true);\n const onNavigate = useStableCallback(event => {\n onNavigateProp(indexRef.current === -1 ? null : indexRef.current, event);\n });\n const previousMountedRef = React.useRef(!!floatingElement);\n const previousOpenRef = React.useRef(open);\n const forceSyncFocusRef = React.useRef(false);\n const forceScrollIntoViewRef = React.useRef(false);\n const cancelQueuedFocusRef = React.useRef(null);\n const disabledIndicesRef = useValueAsRef(disabledIndices);\n const latestOpenRef = useValueAsRef(open);\n const selectedIndexRef = useValueAsRef(selectedIndex);\n const resetOnPointerLeaveRef = useValueAsRef(resetOnPointerLeave);\n const focusFrame = useAnimationFrame();\n const waitForListPopulatedFrame = useAnimationFrame();\n const focusItem = useStableCallback(() => {\n function runFocus(item) {\n if (virtual) {\n tree?.events.emit('virtualfocus', item);\n } else {\n cancelQueuedFocusRef.current = enqueueFocus(item, {\n sync: forceSyncFocusRef.current,\n preventScroll: true\n });\n }\n }\n const initialItem = listRef.current[indexRef.current];\n const forceScrollIntoView = forceScrollIntoViewRef.current;\n if (initialItem) {\n runFocus(initialItem);\n }\n const scheduler = forceSyncFocusRef.current ? callback => callback() : callback => focusFrame.request(callback);\n scheduler(() => {\n const waitedItem = listRef.current[indexRef.current] || initialItem;\n if (!waitedItem) {\n return;\n }\n if (!initialItem) {\n runFocus(waitedItem);\n }\n const shouldScrollIntoView =\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n item && (forceScrollIntoView || !isPointerModalityRef.current);\n if (shouldScrollIntoView) {\n // JSDOM doesn't support `.scrollIntoView()` but it's widely supported\n // by all browsers.\n waitedItem.scrollIntoView?.({\n block: 'nearest',\n inline: 'nearest'\n });\n }\n });\n });\n useIsoLayoutEffect(() => {\n dataRef.current.orientation = orientation;\n }, [dataRef, orientation]);\n\n // Sync `selectedIndex` to be the `activeIndex` upon opening the floating\n // element. Also, reset `activeIndex` upon closing the floating element.\n useIsoLayoutEffect(() => {\n if (!enabled) {\n return;\n }\n if (open && floatingElement) {\n indexRef.current = selectedIndex ?? -1;\n if (focusItemOnOpenRef.current && selectedIndex != null) {\n // Regardless of the pointer modality, we want to ensure the selected\n // item comes into view when the floating element is opened.\n forceScrollIntoViewRef.current = true;\n onNavigate();\n }\n } else if (previousMountedRef.current) {\n // Reset the active index when the list is no longer open and mounted (closing or\n // unmounting). `onNavigate` is a stable callback that always forwards to the latest\n // `onNavigate` prop.\n indexRef.current = -1;\n onNavigate();\n }\n }, [enabled, open, floatingElement, selectedIndex, onNavigate]);\n\n // Sync `activeIndex` to be the focused item while the floating element is\n // open.\n useIsoLayoutEffect(() => {\n if (!enabled) {\n return;\n }\n if (!open) {\n forceSyncFocusRef.current = false;\n return;\n }\n if (!floatingElement) {\n return;\n }\n if (activeIndex == null) {\n forceSyncFocusRef.current = false;\n if (selectedIndexRef.current != null) {\n return;\n }\n\n // Reset while the floating element was open (e.g. the list changed).\n if (previousMountedRef.current) {\n indexRef.current = -1;\n focusItem();\n }\n\n // Initial sync.\n if ((!previousOpenRef.current || !previousMountedRef.current) && focusItemOnOpenRef.current && (keyRef.current != null || focusItemOnOpenRef.current === true && keyRef.current == null)) {\n let runs = 0;\n const waitForListPopulated = () => {\n if (listRef.current[0] == null) {\n // Avoid letting the browser paint if possible on the first try,\n // otherwise use rAF. Don't try more than twice, since something\n // is wrong otherwise.\n if (runs < 2) {\n const scheduler = runs ? callback => waitForListPopulatedFrame.request(callback) : queueMicrotask;\n scheduler(waitForListPopulated);\n }\n runs += 1;\n } else {\n // Initially focus the first non-disabled item. `disabledIndices` is deliberately\n // omitted here so attribute-disabled items (`disabled`/`aria-disabled`) are skipped\n // on open even when the consumer passes an empty `disabledIndices` array. Passing it\n // would regress that behavior (see mui/base-ui#2604).\n indexRef.current = keyRef.current == null || isMainOrientationToEndKey(keyRef.current, orientation, rtl) || nested ? getMinListIndex(listRef) : getMaxListIndex(listRef);\n keyRef.current = null;\n onNavigate();\n }\n };\n waitForListPopulated();\n }\n } else if (!isIndexOutOfListBounds(listRef.current, activeIndex)) {\n indexRef.current = activeIndex;\n focusItem();\n forceScrollIntoViewRef.current = false;\n }\n }, [enabled, open, floatingElement, activeIndex, selectedIndexRef, nested, listRef, orientation, rtl, onNavigate, focusItem, waitForListPopulatedFrame]);\n\n // Ensure the parent floating element has focus when a nested child closes\n // to allow arrow key navigation to work after the pointer leaves the child.\n useIsoLayoutEffect(() => {\n if (!enabled || floatingElement || !tree || virtual || !previousMountedRef.current) {\n return;\n }\n const nodes = tree.nodesRef.current;\n const parent = nodes.find(node => node.id === parentId)?.context?.elements.floating;\n // `floatingElement` is null here (see the guard above), so resolve the owner document from an\n // in-DOM element for realm-safety (shadow DOM/iframes): the reference element, falling back to\n // the parent floating element when the reference is virtual (`domReferenceElement` is null).\n const activeEl = activeElement(ownerDocument(domReferenceElement ?? parent ?? null));\n const treeContainsActiveEl = nodes.some(node => node.context && contains(node.context.elements.floating, activeEl));\n if (parent && !treeContainsActiveEl && isPointerModalityRef.current) {\n parent.focus({\n preventScroll: true\n });\n }\n }, [enabled, floatingElement, domReferenceElement, tree, parentId, virtual]);\n useIsoLayoutEffect(() => {\n previousOpenRef.current = open;\n previousMountedRef.current = !!floatingElement;\n });\n useIsoLayoutEffect(() => {\n if (!open) {\n keyRef.current = null;\n focusItemOnOpenRef.current = focusItemOnOpen;\n }\n }, [open, focusItemOnOpen]);\n const hasActiveIndex = activeIndex != null;\n const syncCurrentTarget = useStableCallback(event => {\n if (!latestOpenRef.current) {\n return;\n }\n const index = listRef.current.indexOf(event.currentTarget);\n if (index !== -1 && (indexRef.current !== index || activeIndex !== index)) {\n indexRef.current = index;\n onNavigate(event);\n }\n });\n const getParentOrientation = useStableCallback(() => {\n return parentOrientation ?? tree?.nodesRef.current.find(node => node.id === parentId)?.context?.dataRef?.current.orientation;\n });\n const getMinEnabledIndex = useStableCallback(() => {\n return getMinListIndex(listRef, disabledIndicesRef.current);\n });\n const commonOnKeyDown = useStableCallback(event => {\n isPointerModalityRef.current = false;\n forceSyncFocusRef.current = true;\n\n // When composing a character, Chrome fires ArrowDown twice. Firefox/Safari\n // don't appear to suffer from this. `event.isComposing` is avoided due to\n // Safari not supporting it properly (although it's not needed in the first\n // place for Safari, just avoiding any possible issues).\n if (event.which === 229) {\n return;\n }\n\n // If the floating element is animating out, ignore navigation. Otherwise,\n // the `activeIndex` gets set to 0 despite not being open so the next time\n // the user ArrowDowns, the first item won't be focused.\n if (!latestOpenRef.current && event.currentTarget === floatingFocusElementRef.current) {\n return;\n }\n if (nested && isCrossOrientationCloseKey(event.key, orientation, rtl, isGrid)) {\n // If the nested list's close key is also the parent navigation key,\n // let the parent navigate. Otherwise, stop propagating the event.\n if (!isMainOrientationKey(event.key, getParentOrientation())) {\n stopEvent(event);\n }\n store.setOpen(false, createChangeEventDetails(REASONS.listNavigation, event.nativeEvent));\n if (isHTMLElement(domReferenceElement)) {\n if (virtual) {\n tree?.events.emit('virtualfocus', domReferenceElement);\n } else {\n domReferenceElement.focus();\n }\n }\n return;\n }\n const currentIndex = indexRef.current;\n const minIndex = getMinListIndex(listRef, disabledIndices);\n const maxIndex = getMaxListIndex(listRef, disabledIndices);\n if (!typeableComboboxReference) {\n if (event.key === 'Home') {\n stopEvent(event);\n indexRef.current = minIndex;\n onNavigate(event);\n }\n if (event.key === 'End') {\n stopEvent(event);\n indexRef.current = maxIndex;\n onNavigate(event);\n }\n }\n\n // Grid navigation is injected by grid-capable consumers so non-grid\n // consumers (menu, select) tree-shake the grid helpers out.\n if (navigateGrid != null) {\n const index = navigateGrid(event, indexRef.current, listRef, orientation, loopFocus, rtl, disabledIndices, minIndex, maxIndex);\n if (index != null) {\n indexRef.current = index;\n onNavigate(event);\n }\n if (orientation === 'both') {\n return;\n }\n }\n if (isMainOrientationKey(event.key, orientation)) {\n stopEvent(event);\n\n // Reset the index if no item is focused.\n if (open && !virtual && activeElement(event.currentTarget.ownerDocument) === event.currentTarget) {\n indexRef.current = isMainOrientationToEndKey(event.key, orientation, rtl) ? minIndex : maxIndex;\n onNavigate(event);\n return;\n }\n if (isMainOrientationToEndKey(event.key, orientation, rtl)) {\n if (loopFocus) {\n if (currentIndex >= maxIndex) {\n if (allowEscape && currentIndex !== listRef.current.length) {\n indexRef.current = -1;\n } else {\n // Give time for virtualizers to update the listRef.\n forceSyncFocusRef.current = false;\n indexRef.current = minIndex;\n }\n } else {\n indexRef.current = findNonDisabledListIndex(listRef.current, {\n startingIndex: currentIndex,\n disabledIndices\n });\n }\n } else {\n indexRef.current = Math.min(maxIndex, findNonDisabledListIndex(listRef.current, {\n startingIndex: currentIndex,\n disabledIndices\n }));\n }\n } else if (loopFocus) {\n if (currentIndex <= minIndex) {\n if (allowEscape && currentIndex !== -1) {\n indexRef.current = listRef.current.length;\n } else {\n // Give time for virtualizers to update the listRef.\n forceSyncFocusRef.current = false;\n indexRef.current = maxIndex;\n }\n } else {\n indexRef.current = findNonDisabledListIndex(listRef.current, {\n startingIndex: currentIndex,\n decrement: true,\n disabledIndices\n });\n }\n } else {\n indexRef.current = Math.max(minIndex, findNonDisabledListIndex(listRef.current, {\n startingIndex: currentIndex,\n decrement: true,\n disabledIndices\n }));\n }\n if (isIndexOutOfListBounds(listRef.current, indexRef.current)) {\n indexRef.current = -1;\n }\n onNavigate(event);\n }\n });\n const item = React.useMemo(() => {\n const itemProps = {\n onFocus(event) {\n forceSyncFocusRef.current = true;\n syncCurrentTarget(event);\n },\n onClick: ({\n currentTarget\n }) => currentTarget.focus({\n preventScroll: true\n }),\n // Safari\n onMouseMove(event) {\n if (isStationaryWebKitPointer(event)) {\n return;\n }\n forceSyncFocusRef.current = true;\n forceScrollIntoViewRef.current = false;\n if (focusItemOnHover) {\n syncCurrentTarget(event);\n }\n },\n onPointerLeave(event) {\n if (!latestOpenRef.current || !isPointerModalityRef.current || event.pointerType === 'touch') {\n return;\n }\n forceSyncFocusRef.current = true;\n const relatedTarget = event.relatedTarget;\n if (!focusItemOnHover || listRef.current.includes(relatedTarget)) {\n return;\n }\n if (!resetOnPointerLeaveRef.current) {\n return;\n }\n cancelQueuedFocusRef.current?.();\n cancelQueuedFocusRef.current = null;\n indexRef.current = -1;\n onNavigate(event);\n if (!virtual) {\n const floatingFocusEl = floatingFocusElementRef.current;\n const activeEl = activeElement(ownerDocument(floatingFocusEl));\n if (floatingFocusEl && contains(floatingFocusEl, activeEl)) {\n floatingFocusEl.focus({\n preventScroll: true\n });\n }\n }\n }\n };\n return itemProps;\n }, [syncCurrentTarget, latestOpenRef, floatingFocusElementRef, focusItemOnHover, listRef, onNavigate, resetOnPointerLeaveRef, virtual]);\n const ariaActiveDescendantProp = React.useMemo(() => {\n return virtual && open && hasActiveIndex && {\n 'aria-activedescendant': `${id}-${activeIndex}`\n };\n }, [virtual, open, hasActiveIndex, id, activeIndex]);\n const floating = React.useMemo(() => {\n return {\n ...(!typeableComboboxReference ? ariaActiveDescendantProp : {}),\n onKeyDown(event) {\n // Close submenu on Shift+Tab\n if (event.key === 'Tab' && event.shiftKey && open && !virtual) {\n // If the event originated from within a nested element (e.g., a Dialog opened from\n // within the menu), don't close the menu. The nested element has its own focus\n // management and should handle the Tab key.\n const target = getTarget(event.nativeEvent);\n if (target && !contains(floatingFocusElementRef.current, target)) {\n return;\n }\n stopEvent(event);\n store.setOpen(false, createChangeEventDetails(REASONS.focusOut, event.nativeEvent));\n if (isHTMLElement(domReferenceElement)) {\n domReferenceElement.focus();\n }\n return;\n }\n commonOnKeyDown(event);\n },\n onPointerMove(event) {\n if (isStationaryWebKitPointer(event)) {\n return;\n }\n isPointerModalityRef.current = true;\n }\n };\n }, [ariaActiveDescendantProp, commonOnKeyDown, floatingFocusElementRef, typeableComboboxReference, store, open, virtual, domReferenceElement]);\n const trigger = React.useMemo(() => {\n function openOnNavigationKeyDown(event) {\n store.setOpen(true, createChangeEventDetails(REASONS.listNavigation, event.nativeEvent, event.currentTarget));\n }\n function checkVirtualMouse(event) {\n if (focusItemOnOpen === 'auto' && isVirtualClick(event.nativeEvent)) {\n focusItemOnOpenRef.current = !virtual;\n }\n }\n function checkVirtualPointer(event) {\n // `pointerdown` fires first, reset the state then perform the checks.\n focusItemOnOpenRef.current = focusItemOnOpen;\n if (focusItemOnOpen === 'auto' && isVirtualPointerEvent(event.nativeEvent)) {\n focusItemOnOpenRef.current = true;\n }\n }\n return {\n onKeyDown(event) {\n // non-reactive open state (to prevent re-creation of the handler)\n const currentOpen = store.select('open');\n isPointerModalityRef.current = false;\n const isArrowKey = event.key.startsWith('Arrow');\n const isParentCrossOpenKey = isCrossOrientationOpenKey(event.key, getParentOrientation(), rtl);\n const isMainKey = isMainOrientationKey(event.key, orientation);\n const isNavigationKey = (nested ? isParentCrossOpenKey : isMainKey) || event.key === 'Enter' || event.key.trim() === '';\n if (virtual && currentOpen) {\n return commonOnKeyDown(event);\n }\n\n // If a floating element should not open on arrow key down, avoid\n // setting `activeIndex` while it's closed.\n if (!currentOpen && !openOnArrowKeyDown && isArrowKey) {\n return undefined;\n }\n if (isNavigationKey) {\n const isParentMainKey = isMainOrientationKey(event.key, getParentOrientation());\n keyRef.current = nested && isParentMainKey ? null : event.key;\n }\n if (nested) {\n if (isParentCrossOpenKey) {\n stopEvent(event);\n if (currentOpen) {\n indexRef.current = getMinEnabledIndex();\n onNavigate(event);\n } else {\n openOnNavigationKeyDown(event);\n }\n }\n return undefined;\n }\n if (isMainKey) {\n if (selectedIndexRef.current != null) {\n indexRef.current = selectedIndexRef.current;\n }\n stopEvent(event);\n if (!currentOpen && openOnArrowKeyDown) {\n openOnNavigationKeyDown(event);\n } else {\n commonOnKeyDown(event);\n }\n if (currentOpen) {\n onNavigate(event);\n }\n }\n return undefined;\n },\n onFocus(event) {\n if (store.select('open') && !virtual) {\n indexRef.current = -1;\n onNavigate(event);\n }\n },\n onPointerDown: checkVirtualPointer,\n onPointerEnter: checkVirtualPointer,\n onMouseDown: checkVirtualMouse,\n onClick: checkVirtualMouse\n };\n }, [commonOnKeyDown, focusItemOnOpen, getMinEnabledIndex, nested, onNavigate, store, openOnArrowKeyDown, orientation, getParentOrientation, rtl, selectedIndexRef, virtual]);\n const reference = React.useMemo(() => {\n return {\n ...ariaActiveDescendantProp,\n ...trigger\n };\n }, [ariaActiveDescendantProp, trigger]);\n return React.useMemo(() => enabled ? {\n reference,\n floating,\n item,\n trigger\n } : {}, [enabled, reference, floating, trigger, item]);\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useTimeout } from '@base-ui/utils/useTimeout';\nimport { EMPTY_ARRAY } from '@base-ui/utils/empty';\nimport { isElementVisible, isListIndexDisabled } from \"../utils/composite.mjs\";\nimport { contains } from \"../utils/element.mjs\";\nimport { stopEvent } from \"../utils/event.mjs\";\n/**\n * Provides a matching callback that can be used to focus an item as the user\n * types, often used in tandem with `useListNavigation()`.\n * @see https://floating-ui.com/docs/useTypeahead\n */\nexport function useTypeahead(context, props) {\n const {\n listRef,\n elementsRef,\n activeIndex,\n onMatch: onMatchProp,\n disabledIndices,\n onTyping,\n enabled = true,\n resetMs = 750,\n selectedIndex = null\n } = props;\n const store = 'rootStore' in context ? context.rootStore : context;\n const open = store.useState('open');\n const timeout = useTimeout();\n const stringRef = React.useRef('');\n const prevIndexRef = React.useRef(selectedIndex ?? activeIndex ?? -1);\n const matchIndexRef = React.useRef(null);\n const onKeyDown = useStableCallback(event => {\n function getElement(index) {\n return elementsRef?.current[index];\n }\n function isItemAvailable(index) {\n const element = getElement(index);\n if (element && !isElementVisible(element) || element?.matches(':disabled')) {\n return false;\n }\n // Visibility and native disabled state are handled above; pass an empty\n // element list so `isListIndexDisabled` resolves only the explicit\n // `disabledIndices` (array/predicate) and skips its own fallbacks.\n // Consumers that don't pass `disabledIndices` keep matching every visible\n // item except native disabled elements provided through `elementsRef`.\n return disabledIndices == null || !isListIndexDisabled(EMPTY_ARRAY, index, disabledIndices);\n }\n function getMatchingIndex(list, string, startIndex = 0) {\n if (list.length === 0) {\n return -1;\n }\n const normalizedStartIndex = (startIndex % list.length + list.length) % list.length;\n const lowerString = string.toLowerCase();\n for (let offset = 0; offset < list.length; offset += 1) {\n const index = (normalizedStartIndex + offset) % list.length;\n const text = list[index];\n if (!text?.toLowerCase().startsWith(lowerString) || !isItemAvailable(index)) {\n continue;\n }\n return index;\n }\n return -1;\n }\n const listContent = listRef.current;\n if (stringRef.current.length > 0 && event.key === ' ') {\n // Space should continue the in-progress typeahead session.\n stopEvent(event);\n onTyping?.(true);\n }\n if (stringRef.current.length > 0 && stringRef.current[0] !== ' ') {\n if (getMatchingIndex(listContent, stringRef.current) === -1 && event.key !== ' ') {\n onTyping?.(false);\n }\n }\n if (listContent == null ||\n // Character key.\n event.key.length !== 1 ||\n // Modifier key.\n event.ctrlKey || event.metaKey || event.altKey) {\n return;\n }\n if (open && event.key !== ' ') {\n stopEvent(event);\n onTyping?.(true);\n }\n\n // Capture whether this is a new typing session before mutating the string.\n const isNewSession = stringRef.current === '';\n if (isNewSession) {\n prevIndexRef.current = selectedIndex ?? activeIndex ?? -1;\n }\n\n // Bail out if the list contains a word like \"llama\" or \"aaron\". TODO:\n // allow it in this case, too. Unavailable items are skipped while matching, so\n // they must be ignored here as well — otherwise a hidden or disabled double-letter\n // label would block rapid cycling through the available items.\n const allowRapidSuccessionOfFirstLetter = listContent.every((text, index) => text && isItemAvailable(index) ? text[0]?.toLowerCase() !== text[1]?.toLowerCase() : true);\n\n // Allows the user to cycle through items that start with the same letter\n // in rapid succession.\n if (allowRapidSuccessionOfFirstLetter && stringRef.current === event.key) {\n stringRef.current = '';\n prevIndexRef.current = matchIndexRef.current;\n }\n stringRef.current += event.key;\n timeout.start(resetMs, () => {\n stringRef.current = '';\n prevIndexRef.current = matchIndexRef.current;\n onTyping?.(false);\n });\n\n // Compute the starting index for this search.\n // If this is a new typing session (string is empty), base it on the current\n // selection/active item; otherwise continue from the last matched index.\n const prevIndex = isNewSession ? selectedIndex ?? activeIndex ?? -1 : prevIndexRef.current;\n const startIndex = (prevIndex ?? 0) + 1;\n const index = getMatchingIndex(listContent, stringRef.current, startIndex);\n if (index !== -1) {\n onMatchProp?.(index);\n matchIndexRef.current = index;\n } else if (event.key !== ' ') {\n stringRef.current = '';\n onTyping?.(false);\n }\n });\n const onBlur = useStableCallback(event => {\n const next = event.relatedTarget;\n const currentDomReferenceElement = store.select('domReferenceElement');\n const currentFloatingElement = store.select('floatingElement');\n const withinComposite = contains(currentDomReferenceElement, next) || contains(currentFloatingElement, next);\n\n // Keep the session if focus moves within the composite (reference <-> floating).\n if (withinComposite) {\n return;\n }\n\n // End the current typing session when focus leaves the composite entirely.\n timeout.clear();\n stringRef.current = '';\n prevIndexRef.current = matchIndexRef.current;\n onTyping?.(false);\n });\n useIsoLayoutEffect(() => {\n if (!open && selectedIndex !== null) {\n return;\n }\n timeout.clear();\n matchIndexRef.current = null;\n if (stringRef.current !== '') {\n stringRef.current = '';\n }\n }, [open, selectedIndex, timeout]);\n const sharedProps = React.useMemo(() => ({\n onKeyDown,\n onBlur\n }), [onKeyDown, onBlur]);\n return React.useMemo(() => enabled ? {\n reference: sharedProps,\n floating: sharedProps\n } : {}, [enabled, sharedProps]);\n}","import { getGridNavigatedIndex, isIndexOutOfListBounds } from \"../utils/composite.mjs\";\n\n/**\n * Positional arguments are deliberate: property names of an options object\n * don't minify, and the signature is locked to the caller via `typeof` on the\n * `grid` option of `useListNavigation`.\n *\n * The injected grid navigator only ever operates on a uniform 1x1 grid (sizes are\n * always `1x1` and packing is never dense), so the cell-map machinery that supports\n * multi-cell items collapses to an identity transform over the item list. Calling\n * `getGridNavigatedIndex` directly keeps the cell-map helpers\n * (`createGridCellMap`/`getGridCellIndexOfCorner`/`getGridCellIndices`) out of\n * grid-combobox bundles.\n */\nexport function gridNavigation(event, prevIndex, listRef, orientation, loopFocus, rtl, disabledIndices, minIndex, maxIndex, cols = 2) {\n const nextIndex = getGridNavigatedIndex(listRef.current, {\n event,\n orientation,\n loopFocus,\n rtl,\n cols,\n disabledIndices,\n minIndex,\n maxIndex,\n // An out-of-range previous index falls back to the first enabled item.\n prevIndex: prevIndex > maxIndex ? minIndex : prevIndex,\n stopEvent: true\n });\n\n // `getGridNavigatedIndex` can return an out-of-bounds sentinel (e.g. `-1` when there is no\n // previous item to move from); surface that as `undefined` so the caller treats it as\n // \"no navigation\" rather than highlighting index `-1`.\n return isIndexOutOfListBounds(listRef.current, nextIndex) ? undefined : nextIndex;\n}","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const ComboboxRootContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") ComboboxRootContext.displayName = \"ComboboxRootContext\";\nexport const ComboboxFloatingContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") ComboboxFloatingContext.displayName = \"ComboboxFloatingContext\";\nexport const ComboboxDerivedItemsContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") ComboboxDerivedItemsContext.displayName = \"ComboboxDerivedItemsContext\";\nexport const ComboboxHasItemsContext = /*#__PURE__*/React.createContext(false);\n// `inputValue` can't be placed in the store.\n// https://github.com/mui/base-ui/issues/2703\nif (process.env.NODE_ENV !== \"production\") ComboboxHasItemsContext.displayName = \"ComboboxHasItemsContext\";\nexport const ComboboxInputValueContext = /*#__PURE__*/React.createContext('');\nif (process.env.NODE_ENV !== \"production\") ComboboxInputValueContext.displayName = \"ComboboxInputValueContext\";\nexport function useComboboxRootContext() {\n const context = React.useContext(ComboboxRootContext);\n if (!context) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: ComboboxRootContext is missing. Combobox parts must be placed within <Combobox.Root>.' : _formatErrorMessage(22));\n }\n return context;\n}\nexport function useComboboxFloatingContext() {\n const context = React.useContext(ComboboxFloatingContext);\n if (!context) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: ComboboxFloatingContext is missing. Combobox parts must be placed within <Combobox.Root>.' : _formatErrorMessage(23));\n }\n return context;\n}\nexport function useComboboxDerivedItemsContext() {\n const context = React.useContext(ComboboxDerivedItemsContext);\n if (!context) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: ComboboxItemsContext is missing. Combobox parts must be placed within <Combobox.Root>.' : _formatErrorMessage(24));\n }\n return context;\n}\nexport function useComboboxInputValueContext() {\n return React.useContext(ComboboxInputValueContext);\n}\nexport function useComboboxHasItemsContext() {\n return React.useContext(ComboboxHasItemsContext);\n}","// https://github.com/mui/mui-x/blob/master/packages/x-internals/src/fastArrayCompare/fastArrayCompare.ts\n\n/**\n * Compares two arrays element-wise.\n *\n * The default comparison is `Object.is`, so `NaN` equals `NaN` and `0` does not equal `-0`.\n */\nexport function areArraysEqual(array1, array2, itemComparer = Object.is) {\n const {\n length\n } = array1;\n if (length !== array2.length) {\n return false;\n }\n for (let i = 0; i < length; i += 1) {\n if (!itemComparer(array1[i], array2[i])) {\n return false;\n }\n }\n return true;\n}","import { areArraysEqual } from '@base-ui/utils/areArraysEqual';\n// Compared by identity in `findSelectionIndex`; don't wrap it.\nexport const defaultItemEquality = (itemValue, selectedValue) => Object.is(itemValue, selectedValue);\nexport function compareItemEquality(itemValue, selectedValue, comparer) {\n if (itemValue == null || selectedValue == null) {\n return Object.is(itemValue, selectedValue);\n }\n return comparer(itemValue, selectedValue);\n}\nexport function isSelectedValueDirty(currentValue, initialValue, comparer) {\n if (Array.isArray(currentValue) && Array.isArray(initialValue)) {\n return !areArraysEqual(currentValue, initialValue, (itemValue, initialItemValue) => compareItemEquality(itemValue, initialItemValue, comparer));\n }\n return currentValue !== initialValue;\n}\nexport function selectedValueIncludes(selectedValues, itemValue, comparer) {\n if (!selectedValues) {\n return false;\n }\n return selectedValues.some(selectedValue => {\n if (selectedValue === undefined) {\n return false;\n }\n return compareItemEquality(itemValue, selectedValue, comparer);\n });\n}\nexport function findItemIndex(itemValues, selectedValue, comparer) {\n if (!itemValues) {\n return -1;\n }\n return itemValues.findIndex(itemValue => {\n if (itemValue === undefined) {\n return false;\n }\n return compareItemEquality(itemValue, selectedValue, comparer);\n });\n}\n\n// The default comparer is `Object.is`, so the values can be indexed instead of rescanned\n// for every item. A custom comparer may match values that don't hash alike.\nfunction createSelectionMatcher(selectedValues, comparer) {\n if (comparer !== defaultItemEquality) {\n return itemValue => selectedValueIncludes(selectedValues, itemValue, comparer);\n }\n const index = new Set(selectedValues);\n index.delete(undefined);\n // `Set` treats +0 and -0 as equal; `Object.is` does not.\n return itemValue => index.has(itemValue) && (itemValue !== 0 || selectedValues.some(v => Object.is(itemValue, v)));\n}\nexport function findSelectionIndex(itemValues, selectedValue, comparer, multiple) {\n // Only treat the value as a list in multiple mode: an array can itself be a valid\n // single-select value.\n const index = multiple && Array.isArray(selectedValue) ?\n // Anchor to the first selected item in rendered order so the index does not depend\n // on the order in which the values were added to the array.\n itemValues.findIndex(createSelectionMatcher(selectedValue, comparer)) : findItemIndex(itemValues, selectedValue, comparer);\n return index === -1 ? null : index;\n}\n\n/** Resolves the first selected index as items register or change. */\nexport function resolveSelectedIndex(index, itemValue, registry, selectedValues, comparer, currentIndex) {\n if (selectedValueIncludes(selectedValues, itemValue, comparer)) {\n // A later item only takes over once the current anchor stops being selected.\n return currentIndex != null && index > currentIndex && selectedValueIncludes(selectedValues, registry[currentIndex], comparer) ? currentIndex : index;\n }\n // The holder re-elects the anchor once it stops being selected.\n return index === currentIndex ? findSelectionIndex(registry, selectedValues, comparer, true) : currentIndex;\n}\nexport function removeItem(selectedValues, itemValue, comparer) {\n return selectedValues.filter(selectedValue => !compareItemEquality(itemValue, selectedValue, comparer));\n}","export function serializeValue(value) {\n if (value == null) {\n return '';\n }\n if (typeof value === 'string') {\n return value;\n }\n try {\n return JSON.stringify(value);\n } catch {\n return String(value);\n }\n}","'use client';\n\nimport * as React from 'react';\nimport { serializeValue } from \"./serializeValue.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nfunction isGroup(item) {\n return typeof item === 'object' && item != null && Array.isArray(item.items);\n}\nexport function isGroupedItems(items) {\n // A group must carry an actual `items` array: key presence alone would misclassify an item\n // with an unrelated or optional `items` field.\n return isGroup(items?.[0]);\n}\nexport function flattenLeafItems(items) {\n return isGroupedItems(items) ? items.flatMap(group => group.items) : items;\n}\n\n/**\n * Checks if the items array contains an item with a null value that has a non-null label.\n */\nexport function hasNullItemLabel(items) {\n if (!Array.isArray(items)) {\n return items != null && 'null' in items;\n }\n const arrayItems = items;\n if (isGroupedItems(arrayItems)) {\n for (const group of arrayItems) {\n for (const item of group.items) {\n if (item && item.value == null && item.label != null) {\n return true;\n }\n }\n }\n return false;\n }\n for (const item of arrayItems) {\n if (item && item.value == null && item.label != null) {\n return true;\n }\n }\n return false;\n}\nexport function stringifyAsLabel(item, itemToStringLabel) {\n if (itemToStringLabel && item != null) {\n return itemToStringLabel(item) ?? '';\n }\n if (item && typeof item === 'object') {\n if ('label' in item && item.label != null) {\n return String(item.label);\n }\n if ('value' in item) {\n return String(item.value);\n }\n }\n return serializeValue(item);\n}\nexport function stringifyAsValue(item, itemToStringValue) {\n if (itemToStringValue && item != null) {\n return itemToStringValue(item) ?? '';\n }\n if (item && typeof item === 'object' && 'value' in item && 'label' in item) {\n return serializeValue(item.value);\n }\n return serializeValue(item);\n}\nexport function resolveSelectedLabel(value, items, itemToStringLabel) {\n function fallback() {\n return stringifyAsLabel(value, itemToStringLabel);\n }\n if (itemToStringLabel && value != null) {\n return itemToStringLabel(value);\n }\n\n // Custom object with explicit label takes precedence\n if (value && typeof value === 'object' && 'label' in value && value.label != null) {\n return value.label;\n }\n\n // Items provided as plain record map\n if (items && !Array.isArray(items)) {\n const label = Object.hasOwn(items, value) ? items[value] : undefined;\n return label ?? fallback();\n }\n\n // Items provided as array (flat or grouped)\n if (Array.isArray(items)) {\n const arrayItems = items;\n const flatItems = flattenLeafItems(arrayItems);\n if (value == null || typeof value !== 'object') {\n const match = flatItems.find(item => item.value === value);\n if (match && match.label != null) {\n return match.label;\n }\n return fallback();\n }\n\n // Object without explicit label: try matching by its `value` property\n if ('value' in value) {\n const match = flatItems.find(item => item && item.value === value.value);\n if (match && match.label != null) {\n return match.label;\n }\n }\n }\n return fallback();\n}\nexport function resolveMultipleLabels(values, items, itemToStringLabel) {\n return values.reduce((acc, value, index) => {\n if (index > 0) {\n acc.push(', ');\n }\n acc.push(/*#__PURE__*/_jsx(React.Fragment, {\n children: resolveSelectedLabel(value, items, itemToStringLabel)\n }, index));\n return acc;\n }, []);\n}","import { compareItemEquality } from \"../internals/itemEquality.mjs\";\nimport { hasNullItemLabel } from \"../internals/resolveValueLabel.mjs\";\n\n/**\n * Non-reactive values shared with the combobox parts. Nothing here is observable through\n * `selectors`, so writing to a ref never notifies subscribers.\n */\n\nexport const selectors = {\n id: state => state.id,\n labelId: state => state.labelId,\n items: state => state.items,\n selectedValue: state => state.selectedValue,\n hasSelectionChips: state => {\n const selectedValue = state.selectedValue;\n return Array.isArray(selectedValue) && selectedValue.length > 0;\n },\n hasSelectedValue: state => {\n const {\n selectedValue,\n selectionMode\n } = state;\n if (selectedValue == null) {\n return false;\n }\n if (selectionMode === 'multiple' && Array.isArray(selectedValue)) {\n return selectedValue.length > 0;\n }\n return true;\n },\n hasNullItemLabel: (state, enabled) => {\n return enabled ? hasNullItemLabel(state.items) : false;\n },\n open: state => state.open,\n mounted: state => state.mounted,\n forceMounted: state => state.forceMounted,\n inline: state => state.inline,\n activeIndex: state => state.activeIndex,\n selectedIndex: state => state.selectedIndex,\n isActive: (state, index) => state.activeIndex === index,\n isSelected: (state, itemValue) => {\n const comparer = state.isItemEqualToValue;\n const selectedValue = state.selectedValue;\n if (Array.isArray(selectedValue)) {\n return selectedValue.some(selectedItem => compareItemEquality(itemValue, selectedItem, comparer));\n }\n return compareItemEquality(itemValue, selectedValue, comparer);\n },\n transitionStatus: state => state.transitionStatus,\n popupProps: state => state.popupProps,\n listProps: state => state.listProps,\n inputProps: state => state.inputProps,\n triggerProps: state => state.triggerProps,\n itemProps: state => state.itemProps,\n positionerElement: state => state.positionerElement,\n listElement: state => state.listElement,\n popupId: state => state.popupId,\n triggerElement: state => state.triggerElement,\n inputElement: state => state.inputElement,\n inputGroupElement: state => state.inputGroupElement,\n popupSide: state => state.popupSide,\n openMethod: state => state.openMethod,\n inputInsidePopup: state => state.inputInsidePopup,\n inputOwnsFormValue: state => state.inputOwnsFormValue,\n selectionMode: state => state.selectionMode,\n name: state => state.name,\n form: state => state.form,\n disabled: state => state.disabled,\n readOnly: state => state.readOnly,\n required: state => state.required,\n grid: state => state.grid,\n virtualized: state => state.virtualized,\n itemToStringLabel: state => state.itemToStringLabel,\n isItemEqualToValue: state => state.isItemEqualToValue,\n modal: state => state.modal,\n autoHighlight: state => state.autoHighlight\n};","import { stringifyAsLabel } from \"../../../internals/resolveValueLabel.mjs\";\n/**\n * Derives the default id assigned to `Combobox.Popup` when the input is rendered inside it.\n * Shared by the popup (which applies it) and the trigger (which references it via `aria-controls`)\n * so the convention only lives in one place.\n */\nexport function getComboboxPopupId(rootId) {\n return rootId == null ? undefined : `${rootId}-popup`;\n}\n\n/**\n * Enhanced filter using Intl.Collator for more robust string matching.\n * Uses the provided `itemToStringLabel` function if available, otherwise falls back to:\n * • When `item` is an object with a `value` property, that property is used.\n * • When `item` is a primitive (e.g. `string`), it is used directly.\n */\nexport function createCollatorItemFilter(collatorFilter, itemToStringLabel) {\n return (item, query) => {\n if (item == null) {\n return false;\n }\n return collatorFilter.contains(item, query, itemToStringLabel);\n };\n}\n\n/**\n * Enhanced filter for single selection mode using Intl.Collator that shows all items\n * when query is empty or matches the current selection, making it easier to browse options.\n */\nexport function createSingleSelectionCollatorFilter(collatorFilter, itemToStringLabel, selectedValue) {\n return (item, query) => {\n if (item == null) {\n return false;\n }\n if (!query) {\n return true;\n }\n const selectedValueToString = itemToStringLabel?.selected ?? itemToStringLabel;\n const selectedString = selectedValue != null ? stringifyAsLabel(selectedValue, selectedValueToString) : '';\n\n // Handle case-insensitive matching consistently\n if (selectedString && collatorFilter.contains(selectedString, query) && selectedString.length === query.length) {\n return true;\n }\n return collatorFilter.contains(item, query, itemToStringLabel);\n };\n}","export function stringifyLocale(locale) {\n if (Array.isArray(locale)) {\n return locale.map(value => stringifyLocale(value)).join(',');\n }\n if (locale == null) {\n return '';\n }\n return String(locale);\n}","import { stringifyLocale } from '@base-ui/utils/stringifyLocale';\nimport { stringifyAsLabel } from \"./resolveValueLabel.mjs\";\nconst filterCache = new Map();\nexport function getFilter(options = {}) {\n const mergedOptions = {\n usage: 'search',\n sensitivity: 'base',\n ignorePunctuation: true,\n ...options\n };\n const cacheKey = `${stringifyLocale(options.locale)}|${JSON.stringify(mergedOptions)}`;\n const cachedFilter = filterCache.get(cacheKey);\n if (cachedFilter) {\n return cachedFilter;\n }\n const collator = new Intl.Collator(options.locale, mergedOptions);\n const filter = {\n contains(item, query, itemToString) {\n if (!query) {\n return true;\n }\n const itemString = stringifyAsLabel(item, itemToString);\n for (let i = 0; i <= itemString.length - query.length; i += 1) {\n if (collator.compare(itemString.slice(i, i + query.length), query) === 0) {\n return true;\n }\n }\n return false;\n },\n startsWith(item, query, itemToString) {\n if (!query) {\n return true;\n }\n const itemString = stringifyAsLabel(item, itemToString);\n return collator.compare(itemString.slice(0, query.length), query) === 0;\n },\n endsWith(item, query, itemToString) {\n if (!query) {\n return true;\n }\n const itemString = stringifyAsLabel(item, itemToString);\n const queryLength = query.length;\n return itemString.length >= queryLength && collator.compare(itemString.slice(itemString.length - queryLength), query) === 0;\n }\n };\n filterCache.set(cacheKey, filter);\n return filter;\n}","'use client';\n\nimport * as React from 'react';\nimport { createCollatorItemFilter, createSingleSelectionCollatorFilter } from \"./index.mjs\";\nimport { getFilter } from \"../../../internals/filter.mjs\";\n/**\n * Matches items against a query using `Intl.Collator` for robust string matching.\n */\nexport const useCoreFilter = getFilter;\n/**\n * Matches items against a query using `Intl.Collator` for robust string matching.\n */\nexport function useComboboxFilter(options = {}) {\n const {\n multiple = false,\n value,\n ...collatorOptions\n } = options;\n const coreFilter = getFilter(collatorOptions);\n const contains = React.useCallback((item, query, itemToString) => {\n if (multiple) {\n return createCollatorItemFilter(coreFilter, itemToString)(item, query);\n }\n return createSingleSelectionCollatorFilter(coreFilter, itemToString, value)(item, query);\n }, [coreFilter, value, multiple]);\n return React.useMemo(() => ({\n ...coreFilter,\n contains\n }), [contains, coreFilter]);\n}","'use client';\n\nimport * as React from 'react';\n/**\n * Provides a cross-browser way to determine the type of the pointer used to click.\n * Safari and Firefox do not provide the PointerEvent to the click handler (they use MouseEvent) yet.\n * Additionally, this implementation detects if the click was triggered by the keyboard.\n *\n * @param handler The function to be called when the button is clicked. The first parameter is the original event and the second parameter is the pointer type.\n */\nexport function useEnhancedClickHandler(handler) {\n const lastClickInteractionTypeRef = React.useRef('');\n const handlePointerDown = React.useCallback(event => {\n if (event.defaultPrevented) {\n return;\n }\n lastClickInteractionTypeRef.current = event.pointerType;\n handler(event, event.pointerType);\n }, [handler]);\n const handleClick = React.useCallback(event => {\n // event.detail has the number of clicks performed on the element. 0 means it was triggered by the keyboard.\n if (event.detail === 0) {\n handler(event, 'keyboard');\n return;\n }\n if ('pointerType' in event) {\n // Chrome and Edge correctly use PointerEvent\n handler(event, event.pointerType);\n } else {\n handler(event, lastClickInteractionTypeRef.current);\n }\n lastClickInteractionTypeRef.current = '';\n }, [handler]);\n return {\n onClick: handleClick,\n onPointerDown: handlePointerDown\n };\n}","'use client';\n\nimport * as React from 'react';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useEnhancedClickHandler } from '@base-ui/utils/useEnhancedClickHandler';\nimport { platform } from '@base-ui/utils/platform';\nimport { useValueChanged } from \"../internals/useValueChanged.mjs\";\nexport function useOpenMethodTriggerProps(open, setOpenMethod) {\n const handleTriggerClick = useStableCallback((_, interactionType) => {\n const isOpen = typeof open === 'function' ? open() : open;\n if (!isOpen) {\n setOpenMethod(interactionType || (\n // On iOS Safari, the hitslop around touch targets means tapping outside an element's\n // bounds does not fire `pointerdown` but does fire `mousedown`. The `interactionType`\n // will be \"\" in that case.\n platform.os.ios ? 'touch' : ''));\n }\n });\n const {\n onClick,\n onPointerDown\n } = useEnhancedClickHandler(handleTriggerClick);\n return React.useMemo(() => ({\n onClick,\n onPointerDown\n }), [onClick, onPointerDown]);\n}\n\n/**\n * Determines the interaction type (keyboard, mouse, touch, etc.) that opened the component.\n *\n * @param open The open state of the component.\n */\nexport function useOpenInteractionType(open) {\n const [openMethod, setOpenMethod] = React.useState(null);\n const triggerProps = useOpenMethodTriggerProps(open, setOpenMethod);\n useValueChanged(open, previousOpen => {\n if (previousOpen && !open) {\n setOpenMethod(null);\n }\n });\n return React.useMemo(() => ({\n openMethod,\n triggerProps\n }), [openMethod, triggerProps]);\n}","import { getComputedStyle, getParentNode, isHTMLElement, isLastTraversableNode } from '@floating-ui/utils/dom';\nexport function isScrollableY(element, allowOverflowIntent = false) {\n const {\n overflowY\n } = getComputedStyle(element);\n if (overflowY !== 'auto' && overflowY !== 'scroll') {\n return false;\n }\n // When `allowOverflowIntent` is true, a container that overflows only once extra space is\n // added (e.g. drawer keyboard scroll slack) still counts, as long as it has layout size on\n // the axis.\n return allowOverflowIntent ? element.clientHeight > 0 : element.scrollHeight > element.clientHeight;\n}\nexport function isScrollableX(element, allowOverflowIntent = false) {\n const {\n overflowX\n } = getComputedStyle(element);\n if (overflowX !== 'auto' && overflowX !== 'scroll') {\n return false;\n }\n return allowOverflowIntent ? element.clientWidth > 0 : element.scrollWidth > element.clientWidth;\n}\nexport function isScrollable(element, axis, allowOverflowIntent = false) {\n return axis === 'vertical' ? isScrollableY(element, allowOverflowIntent) : isScrollableX(element, allowOverflowIntent);\n}\nexport function hasScrollableAncestor(target, root, axes) {\n // `getParentNode` crosses shadow boundaries (and slots), so a target inside a shadow root\n // still walks up to scrollable ancestors in the light DOM.\n let node = target;\n while (isHTMLElement(node) && node !== root && !isLastTraversableNode(node)) {\n for (const axis of axes) {\n if (isScrollable(node, axis)) {\n return true;\n }\n }\n node = getParentNode(node);\n }\n return false;\n}\nexport function findScrollableTouchTarget(target, root, axis = 'vertical', allowOverflowIntent = false) {\n // `getParentNode` crosses shadow boundaries (and slots), so a target inside a shadow root\n // still reaches a scrollable ancestor in the light DOM.\n let node = isHTMLElement(target) ? target : null;\n while (isHTMLElement(node) && node !== root && !isLastTraversableNode(node)) {\n if (isScrollable(node, axis, allowOverflowIntent)) {\n return node;\n }\n node = getParentNode(node);\n }\n return isScrollable(root, axis, allowOverflowIntent) ? root : null;\n}","export const NO_ACTIVE_VALUE = Symbol('none');\nexport const INITIAL_LAST_HIGHLIGHT = {\n value: NO_ACTIVE_VALUE,\n index: -1\n};","import { compareItemEquality, defaultItemEquality } from \"../../internals/itemEquality.mjs\";\nexport function findCollectionItem(valueToItem, itemValue, isEqual) {\n const exactItem = valueToItem.get(itemValue);\n if (exactItem !== undefined || isEqual === defaultItemEquality) {\n return exactItem;\n }\n for (const [derivedValue, item] of valueToItem) {\n if (compareItemEquality(derivedValue, itemValue, isEqual)) {\n return item;\n }\n }\n return undefined;\n}\n\n/**\n * An opaque collection created by `createItems()`.\n *\n * It carries the source item and derived value types so the root can infer the list item and\n * selection value types.\n *\n * Pass it directly to the root's `items` prop; it has no public members.\n */\n\n/**\n * Internal shape of a collection. The extra members let the root project items to\n * their values and resolve a selected value back to its label while items are unmounted.\n */","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nimport { useControlled } from '@base-ui/utils/useControlled';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useOnFirstRender } from '@base-ui/utils/useOnFirstRender';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useMergedRefs } from '@base-ui/utils/useMergedRefs';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { visuallyHidden, visuallyHiddenInput } from '@base-ui/utils/visuallyHidden';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { ReactStore } from '@base-ui/utils/store';\nimport { EMPTY_ARRAY, EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { isHTMLElement } from '@floating-ui/utils/dom';\nimport { getOverflowAncestors, useDismiss, useFloatingRootContext, useListNavigation, useClick } from \"../../floating-ui-react/index.mjs\";\nimport { gridNavigation } from \"../../floating-ui-react/hooks/gridNavigation.mjs\";\nimport { contains, getTarget } from \"../../floating-ui-react/utils.mjs\";\nimport { createChangeEventDetails, createGenericEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { ComboboxFloatingContext, ComboboxDerivedItemsContext, ComboboxHasItemsContext, ComboboxRootContext, ComboboxInputValueContext } from \"./ComboboxRootContext.mjs\";\nimport { selectors } from \"../store.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { useFieldRootContext } from \"../../internals/field-root-context/FieldRootContext.mjs\";\nimport { useRegisterFieldControl } from \"../../internals/field-register-control/useRegisterFieldControl.mjs\";\nimport { useFormContext } from \"../../internals/form-context/FormContext.mjs\";\nimport { useLabelableId } from \"../../internals/labelable-provider/useLabelableId.mjs\";\nimport { createCollatorItemFilter } from \"./utils/index.mjs\";\nimport { useCoreFilter } from \"./utils/useFilter.mjs\";\nimport { useTransitionStatus } from \"../../internals/useTransitionStatus.mjs\";\nimport { useOpenInteractionType } from \"../../utils/useOpenInteractionType.mjs\";\nimport { isScrollableY } from \"../../utils/scrollable.mjs\";\nimport { useValueChanged } from \"../../internals/useValueChanged.mjs\";\nimport { NOOP } from \"../../internals/noop.mjs\";\nimport { FOCUSABLE_POPUP_PROPS } from \"../../utils/popups/index.mjs\";\nimport { mergeProps } from \"../../merge-props/index.mjs\";\nimport { stringifyAsLabel, stringifyAsValue, flattenLeafItems, isGroupedItems } from \"../../internals/resolveValueLabel.mjs\";\nimport { compareItemEquality, defaultItemEquality, findItemIndex, findSelectionIndex, isSelectedValueDirty, removeItem, selectedValueIncludes } from \"../../internals/itemEquality.mjs\";\nimport { INITIAL_LAST_HIGHLIGHT, NO_ACTIVE_VALUE } from \"./utils/constants.mjs\";\nimport { useDirection } from \"../../internals/direction-context/DirectionContext.mjs\";\nimport { findCollectionItem } from \"../items/itemCollection.mjs\";\n\n/**\n * @internal\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport function AriaCombobox(props) {\n const {\n id: idProp,\n onOpenChangeComplete: onOpenChangeCompleteProp,\n defaultSelectedValue = null,\n selectedValue: selectedValueProp,\n onSelectedValueChange,\n defaultInputValue,\n inputValue: inputValueProp,\n open: openProp,\n defaultOpen = false,\n selectionMode,\n onItemHighlighted: onItemHighlightedProp,\n name: nameProp,\n form,\n disabled: disabledProp = false,\n readOnly = false,\n required = false,\n inputRef: inputRefProp,\n grid = false,\n items: itemsProp,\n filteredItems: filteredItemsProp,\n filter: filterProp,\n filterQuery: filterQueryProp,\n openOnInputClick = true,\n autoHighlight = false,\n keepHighlight = false,\n highlightItemOnHover = true,\n loopFocus = true,\n itemToStringLabel: itemToStringLabelProp,\n itemToStringValue,\n isItemEqualToValue = defaultItemEquality,\n virtualized = false,\n inline: inlineProp = false,\n fillInputOnItemPress = true,\n modal = false,\n limit = -1,\n autoComplete = 'list',\n formAutoComplete,\n locale,\n submitOnItemClick = false\n } = props;\n const {\n clearErrors\n } = useFormContext();\n const {\n setDirty,\n validityData,\n setFilled,\n name: fieldName,\n disabled: fieldDisabled,\n setTouched,\n setFocused,\n validationMode,\n validation\n } = useFieldRootContext();\n const direction = useDirection();\n const id = useLabelableId({\n id: idProp\n });\n const collatorFilter = useCoreFilter({\n locale\n });\n\n // Plain items are arrays; normalized `createItems()` collections are objects.\n const collection = Array.isArray(itemsProp) ? null : itemsProp;\n if (collection && typeof collection.label !== 'function') {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: the `items` prop received an object that is not a collection, ' + 'so its items cannot be read. Pass an array of items, an array of groups with items, ' + 'or the result of `createItems()`. ' + 'See https://base-ui.com/react/components/combobox#createitems' : _formatErrorMessage(100));\n }\n const items = collection ? collection.data : itemsProp;\n const itemToValue = collection?.value;\n\n // A projected collection's items live in the source domain, not the selection-value domain the\n // store matches against, so they are withheld from the store.\n const storeItems = itemToValue ? undefined : items;\n\n // The externally filtered items projected to their selection values, with a lookup back to the\n // source items. Declared before `itemToStringLabel`, which resolves labels from it on the\n // first render (initial input value).\n const externalWindow = React.useMemo(() => {\n if (!filteredItemsProp || !itemToValue) {\n return undefined;\n }\n const flat = flattenLeafItems(filteredItemsProp);\n const values = flat.map(itemToValue);\n let valueToItem;\n return {\n values,\n findItem(itemValue, isEqual) {\n if (!valueToItem) {\n valueToItem = new Map();\n for (let i = 0; i < values.length; i += 1) {\n if (!valueToItem.has(values[i])) {\n valueToItem.set(values[i], flat[i]);\n }\n }\n }\n return findCollectionItem(valueToItem, itemValue, isEqual);\n }\n };\n }, [filteredItemsProp, itemToValue]);\n\n // Labels selection values from current props only: collection data first, then the current\n // external window, then the prop. Nothing from a past window is remembered — keeping a value\n // resolvable over time means keeping its item in the collection's data.\n const itemToStringLabel = React.useMemo(() => {\n if (!collection) {\n return itemToStringLabelProp;\n }\n return itemValue => {\n return collection.label(itemValue, isItemEqualToValue, unresolvedValue => {\n const externalItem = externalWindow?.findItem(unresolvedValue, isItemEqualToValue);\n if (externalItem != null) {\n return collection.itemLabel(externalItem);\n }\n return stringifyAsLabel(unresolvedValue, itemToStringLabelProp);\n });\n };\n }, [collection, itemToStringLabelProp, externalWindow, isItemEqualToValue]);\n const filterItemToString = React.useMemo(() => {\n if (!collection) {\n return itemToStringLabelProp;\n }\n return Object.assign(item => collection.itemLabel(item), {\n selected: value => stringifyAsLabel(value, itemToStringLabel)\n });\n }, [collection, itemToStringLabel, itemToStringLabelProp]);\n function stringifyValueLabel(item) {\n return stringifyAsLabel(item, itemToStringLabel);\n }\n const [queryChangedAfterOpen, setQueryChangedAfterOpen] = React.useState(false);\n const [closeQuery, setCloseQuery] = React.useState(null);\n const previousCloseQueryRef = React.useRef(closeQuery);\n const listRef = React.useRef([]);\n const labelsRef = React.useRef([]);\n const popupRef = React.useRef(null);\n const inputRef = React.useRef(null);\n const startDismissRef = React.useRef(null);\n const endDismissRef = React.useRef(null);\n const emptyRef = React.useRef(null);\n const keyboardActiveRef = React.useRef(true);\n const hadInputClearRef = React.useRef(false);\n const chipsContainerRef = React.useRef(null);\n const clearRef = React.useRef(null);\n const selectionEventRef = React.useRef(null);\n const lastHighlightRef = React.useRef(INITIAL_LAST_HIGHLIGHT);\n const pendingQueryHighlightRef = React.useRef(null);\n\n /**\n * Contains the currently visible list of item values post-filtering.\n */\n const valuesRef = React.useRef([]);\n /**\n * The item element that received the last `pointerdown`, used to detect whether a\n * `mouseup` on an item belongs to a drag-select gesture that started elsewhere.\n */\n const pointerDownItemRef = React.useRef(null);\n const disabled = fieldDisabled || disabledProp;\n const name = fieldName ?? nameProp;\n const multiple = selectionMode === 'multiple';\n const single = selectionMode === 'single';\n const hasInputValue = inputValueProp !== undefined || defaultInputValue !== undefined;\n const hasItems = items !== undefined;\n const hasFilteredItemsProp = filteredItemsProp !== undefined;\n let autoHighlightMode;\n if (autoHighlight === 'always') {\n autoHighlightMode = 'always';\n } else {\n autoHighlightMode = autoHighlight ? 'input-change' : false;\n }\n const [selectedValue, setSelectedValueUnwrapped] = useControlled({\n controlled: selectedValueProp,\n default: multiple ? defaultSelectedValue ?? EMPTY_ARRAY : defaultSelectedValue,\n name: 'Combobox',\n state: 'selectedValue'\n });\n const filter = React.useMemo(() => {\n if (filterProp === null) {\n return () => true;\n }\n if (filterProp !== undefined) {\n return filterProp;\n }\n // `shouldBypassFiltering` already empties the query whenever a single selection's label\n // matches it exactly, so the filter never needs a selection-aware variant here.\n return createCollatorItemFilter(collatorFilter, filterItemToString);\n }, [filterProp, collatorFilter, filterItemToString]);\n\n // If neither inputValue nor defaultInputValue are provided, derive it from the\n // selected value for single mode so the input reflects the selection on mount.\n const initialDefaultInputValue = useRefWithInit(() => {\n if (hasInputValue) {\n return defaultInputValue ?? '';\n }\n if (single) {\n return stringifyValueLabel(selectedValue);\n }\n return '';\n }).current;\n const [inputValue, setInputValueUnwrapped] = useControlled({\n controlled: inputValueProp,\n default: initialDefaultInputValue,\n name: 'Combobox',\n state: 'inputValue'\n });\n const [open, setOpenUnwrapped] = useControlled({\n controlled: openProp,\n default: defaultOpen,\n name: 'Combobox',\n state: 'open'\n });\n const isGrouped = isGroupedItems(items);\n const query = !open && closeQuery !== null ? closeQuery : String(inputValue).trim();\n const selectedLabelString = single ? stringifyValueLabel(selectedValue) : '';\n const shouldBypassFiltering = single && !queryChangedAfterOpen && query !== '' && selectedLabelString.length === query.length && collatorFilter.contains(selectedLabelString, query);\n const filterQuery = shouldBypassFiltering ? '' : filterQueryProp ?? query;\n const shouldIgnoreExternalFiltering = hasItems && hasFilteredItemsProp && shouldBypassFiltering && (!collection || collection.hasValue(selectedValue, isItemEqualToValue));\n const flatItems = React.useMemo(() => items ? flattenLeafItems(items) : EMPTY_ARRAY, [items]);\n const filteredItems = React.useMemo(() => {\n if (filteredItemsProp && !shouldIgnoreExternalFiltering) {\n return filteredItemsProp;\n }\n if (!items) {\n return EMPTY_ARRAY;\n }\n if (isGrouped) {\n const groupedItems = items;\n const resultingGroups = [];\n let currentCount = 0;\n for (const group of groupedItems) {\n if (limit > -1 && currentCount >= limit) {\n break;\n }\n const remainingLimit = limit > -1 ? limit - currentCount : Infinity;\n const itemsToTake = filterQuery === '' ? group.items.slice(0, remainingLimit) : [];\n if (filterQuery !== '') {\n for (const item of group.items) {\n if (itemsToTake.length >= remainingLimit) {\n break;\n }\n if (filter(item, filterQuery, filterItemToString)) {\n itemsToTake.push(item);\n }\n }\n }\n if (itemsToTake.length > 0) {\n const newGroup = {\n ...group,\n items: itemsToTake\n };\n resultingGroups.push(newGroup);\n currentCount += itemsToTake.length;\n }\n }\n return resultingGroups;\n }\n if (filterQuery === '') {\n return limit > -1 ? flatItems.slice(0, limit) :\n // The cast here is done as `flatItems` is readonly.\n // valuesRef.current, a mutable ref, can be set to `flatFilteredValues`, which may\n // reference this exact readonly value, creating a mutation risk.\n // However, <Combobox.Item> can never mutate this value as the mutating effect\n // bails early when `items` is provided, and this is only ever returned\n // when `items` is provided due to the early return at the top of this hook.\n flatItems;\n }\n const limitedItems = [];\n for (const item of flatItems) {\n if (limit > -1 && limitedItems.length >= limit) {\n break;\n }\n if (filter(item, filterQuery, filterItemToString)) {\n limitedItems.push(item);\n }\n }\n return limitedItems;\n }, [filteredItemsProp, shouldIgnoreExternalFiltering, items, isGrouped, filterQuery, limit, filter, filterItemToString, flatItems]);\n\n /**\n * The filtered items flattened across groups and projected to their selection values.\n */\n const flatFilteredValues = React.useMemo(() => {\n if (externalWindow && filteredItems === filteredItemsProp) {\n return externalWindow.values;\n }\n // Explicit type argument: inferring it from a union of both shapes resolves `Item` to\n // `Group<Item>`, which tsc rejects and tsgo does not.\n const flat = flattenLeafItems(filteredItems);\n return itemToValue ? flat.map(item => itemToValue(item)) : flat;\n }, [filteredItems, filteredItemsProp, externalWindow, itemToValue]);\n const store = useRefWithInit(() => {\n // An inline list open on the first render never gets a closed pass of the closed-state\n // sync effect below, and `items`-prop lists don't self-register their index the way\n // individually rendered `<Combobox.Item>`s do, so the selected item was never highlighted.\n // Seeding the index here lets list navigation highlight and scroll to the selection on\n // mount. Computed once by construction, so a selection or list that resolves after mount\n // doesn't move an existing highlight or scroll the list away.\n let initialSelectedIndex = null;\n if (inlineProp && open && hasItems && selectionMode !== 'none') {\n initialSelectedIndex = findSelectionIndex(flatFilteredValues, selectedValue, isItemEqualToValue, multiple);\n }\n return new ReactStore({\n id,\n labelId: undefined,\n selectedValue,\n open,\n items: storeItems,\n selectionMode,\n name,\n form,\n disabled,\n readOnly,\n required,\n grid,\n virtualized,\n openOnInputClick,\n itemToStringLabel,\n isItemEqualToValue,\n modal,\n autoHighlight: autoHighlightMode,\n submitOnItemClick,\n hasInputValue,\n mounted: false,\n forceMounted: false,\n transitionStatus: 'idle',\n inline: inlineProp,\n activeIndex: null,\n selectedIndex: initialSelectedIndex,\n popupProps: {},\n listProps: {},\n inputProps: {},\n triggerProps: {},\n itemProps: EMPTY_OBJECT,\n positionerElement: null,\n listElement: null,\n popupId: undefined,\n triggerElement: null,\n inputElement: null,\n inputGroupElement: null,\n popupSide: null,\n openMethod: null,\n inputInsidePopup: true,\n // Avoid duplicate names in the server HTML. Popup inputs aren't rendered\n // until after hydration, so the hidden input takes over then if needed.\n inputOwnsFormValue: selectionMode === 'none'\n }, {\n // Placeholder callbacks replaced on first render\n onOpenChangeComplete: NOOP,\n setOpen: NOOP,\n setInputValue: NOOP,\n setSelectedValue: NOOP,\n setIndices: NOOP,\n handleSelection: NOOP,\n forceMount: NOOP,\n requestSubmit: NOOP,\n listRef,\n labelsRef,\n popupRef,\n emptyRef,\n inputRef,\n startDismissRef,\n endDismissRef,\n keyboardActiveRef,\n chipsContainerRef,\n clearRef,\n valuesRef,\n pointerDownItemRef,\n selectionEventRef\n }, selectors);\n }).current;\n const fieldRawValue = selectionMode === 'none' ? inputValue : selectedValue;\n const fieldStringValue = React.useMemo(() => {\n if (selectionMode === 'none') {\n return fieldRawValue;\n }\n if (Array.isArray(selectedValue)) {\n return selectedValue.map(value => stringifyAsValue(value, itemToStringValue));\n }\n return stringifyAsValue(selectedValue, itemToStringValue);\n }, [fieldRawValue, itemToStringValue, selectionMode, selectedValue]);\n const onItemHighlighted = useStableCallback(onItemHighlightedProp);\n const onOpenChangeComplete = useStableCallback(onOpenChangeCompleteProp);\n const activeIndex = store.useState('activeIndex');\n const selectedIndex = store.useState('selectedIndex');\n const positionerElement = store.useState('positionerElement');\n const listElement = store.useState('listElement');\n const triggerElement = store.useState('triggerElement');\n const inputElement = store.useState('inputElement');\n const inputGroupElement = store.useState('inputGroupElement');\n const inline = store.useState('inline');\n const inputInsidePopup = store.useState('inputInsidePopup');\n const inputOwnsFormValue = store.useState('inputOwnsFormValue');\n const inputMatchesSelectedValue = single && !inputInsidePopup && inputValue === selectedLabelString;\n const triggerRef = useValueAsRef(triggerElement);\n const {\n mounted,\n setMounted,\n transitionStatus\n } = useTransitionStatus(open);\n const {\n openMethod,\n triggerProps\n } = useOpenInteractionType(open);\n const getStringifiedValueForForm = useStableCallback(() => fieldStringValue);\n useRegisterFieldControl(inputInsidePopup ? triggerRef : inputRef, id, fieldRawValue, getStringifiedValueForForm, !disabled, nameProp);\n const forceMount = useStableCallback(() => {\n if (items) {\n // Ensure typeahead works on a closed list.\n labelsRef.current = flatFilteredValues.map(stringifyValueLabel);\n } else {\n store.set('forceMounted', true);\n }\n });\n\n /**\n * Emits `onItemHighlighted` for the item at `index`, or clears the highlight when `index` is `-1`\n * (a no-op if nothing was highlighted). Keeps `lastHighlightRef` in sync with what was emitted.\n */\n const emitHighlight = useStableCallback((value, index, type) => {\n if (index === -1) {\n if (lastHighlightRef.current === INITIAL_LAST_HIGHLIGHT) {\n return;\n }\n lastHighlightRef.current = INITIAL_LAST_HIGHLIGHT;\n } else {\n lastHighlightRef.current = {\n value,\n index\n };\n }\n onItemHighlighted(value, createGenericEventDetails(type, undefined, {\n index\n }));\n });\n const setIndices = useStableCallback(options => {\n const update = {};\n if (options.activeIndex !== undefined) {\n update.activeIndex = options.activeIndex;\n }\n if (options.selectedIndex !== undefined) {\n update.selectedIndex = options.selectedIndex;\n }\n store.update(update);\n const activeIndexOption = options.activeIndex;\n if (activeIndexOption === undefined) {\n return;\n }\n const type = options.type || REASONS.none;\n if (activeIndexOption === null) {\n emitHighlight(undefined, -1, type);\n } else {\n emitHighlight(valuesRef.current[activeIndexOption], activeIndexOption, type);\n }\n });\n const setInputValue = useStableCallback((next, eventDetails) => {\n props.onInputValueChange?.(next, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n\n // A canceled selection clear must not suppress close-completion cleanup.\n hadInputClearRef.current = eventDetails.reason === REASONS.inputClear;\n\n // If user is typing, ensure we don't auto-highlight on open due to a race\n // with the post-open effect that sets this flag.\n if (eventDetails.reason === REASONS.inputChange) {\n // A controlled popup may ignore a close request. Resuming input proves the popup\n // is remaining open, so release the query captured for an exit animation.\n if (open && closeQuery !== null) {\n setCloseQuery(null);\n }\n const event = eventDetails.event;\n const inputType = event.inputType;\n // Treat composition commits as typed input; autofill may omit `inputType` or\n // report `insertReplacementText`.\n const isTypedInput = event.type === 'compositionend' || inputType != null && inputType !== '' && inputType !== 'insertReplacementText';\n if (isTypedInput) {\n const hasQuery = next.trim() !== '';\n if (hasQuery) {\n setQueryChangedAfterOpen(true);\n }\n // Defer index updates until after the filtered items have been derived to ensure\n // `onItemHighlighted` receives the latest item.\n pendingQueryHighlightRef.current = {\n hasQuery\n };\n\n // Virtualized lists own their scroller. Reset regular lists directly so a stale\n // composite registry cannot select a reordered item and scrolling cannot escape\n // the popup.\n const list = store.state.listElement;\n if (!store.state.virtualized && list) {\n const popup = popupRef.current;\n for (const ancestor of getOverflowAncestors(list.firstElementChild ?? list)) {\n if (!isHTMLElement(ancestor) || (popup ? !contains(popup, ancestor) : ancestor.getAttribute('role') === 'dialog')) {\n break;\n }\n if (isScrollableY(ancestor)) {\n ancestor.scrollTop = 0;\n break;\n }\n }\n }\n if (hasQuery && autoHighlightMode && store.state.activeIndex == null && (open || inline)) {\n store.set('activeIndex', 0);\n }\n }\n } else if (eventDetails.reason === REASONS.inputClear && next === '' && store.state.inputInsidePopup) {\n // A programmatic clear of an active query (e.g. after selecting an item with the\n // input inside the popup): restore the highlight to the selected item.\n pendingQueryHighlightRef.current = {\n hasQuery: false,\n selection: true\n };\n }\n setInputValueUnwrapped(next);\n });\n const handleInterruptedReopen = useStableCallback(isInputChange => {\n // Preserve values supplied with the reopen rather than owned by the interrupted close.\n const clearsPendingInput = !isInputChange && inputInsidePopup && !inline && inputValue !== '' && (String(inputValue).trim() === closeQuery || inputValue === selectedLabelString);\n\n // Keep the flag while a visible filter survives so the `items` sync cannot overwrite it.\n if (!isInputChange && (clearsPendingInput || inputValue === '' || inputMatchesSelectedValue)) {\n setQueryChangedAfterOpen(false);\n }\n setCloseQuery(null);\n if (clearsPendingInput) {\n // Cleanup clears omit the selection flag and reopening gesture.\n setInputValue('', createChangeEventDetails(REASONS.inputClear));\n }\n });\n const setOpen = useStableCallback((nextOpen, eventDetails) => {\n if (open === nextOpen) {\n return;\n }\n\n // If the `Empty` component is not used, the positioner or popup should be hidden\n // with CSS. In this case, allow the Escape key to bubble to close a parent popup\n // if there are no items to show.\n if (eventDetails.reason === REASONS.escapeKey && hasItems && flatFilteredValues.length === 0 && !emptyRef.current) {\n eventDetails.allowPropagation();\n }\n props.onOpenChange?.(nextOpen, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n if (nextOpen && closeQuery !== null) {\n // `ComboboxInput` calls `setInputValue` before `setOpen`, so on an input-change reopen\n // `inputValue` is still the pre-keystroke value and the typed filter always survives.\n handleInterruptedReopen(eventDetails.reason === REASONS.inputChange);\n }\n if (!nextOpen && queryChangedAfterOpen) {\n if (single) {\n if (!inline) {\n setCloseQuery(query);\n }\n // Avoid a flicker when closing the popup with an empty query.\n if (query === '') {\n setQueryChangedAfterOpen(false);\n }\n } else if (multiple) {\n if (!inline) {\n // Freeze the current query so filtering remains stable while exiting.\n setCloseQuery(query);\n }\n if (inputInsidePopup) {\n setIndices({\n activeIndex: null\n });\n }\n\n // Clear the input immediately on close while retaining filtering via closeQuery for exit animations\n // if the input is outside the popup. When the input is inside the popup, defer the clear until\n // unmount so the filtered list doesn't flash to unfiltered during the exit animation.\n if (!inputInsidePopup || inline) {\n setInputValue('', createChangeEventDetails(REASONS.inputClear, eventDetails.event, undefined, {\n isItemPress: eventDetails.reason === REASONS.itemPress\n }));\n }\n }\n }\n setOpenUnwrapped(nextOpen);\n if (!nextOpen && inputInsidePopup && (eventDetails.reason === REASONS.focusOut || eventDetails.reason === REASONS.outsidePress)) {\n setTouched(true);\n setFocused(false);\n if (validationMode === 'onBlur') {\n const valueToValidate = selectionMode === 'none' ? inputValue : selectedValue;\n validation.commit(valueToValidate);\n }\n }\n });\n const setSelectedValue = useStableCallback((nextValue, eventDetails) => {\n // Cast to `any` due to conditional value type (single vs. multiple).\n // The runtime implementation already ensures the correct value shape.\n onSelectedValueChange?.(nextValue, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n setSelectedValueUnwrapped(nextValue);\n const shouldFillInput = selectionMode === 'none' && popupRef.current && fillInputOnItemPress || single && !store.state.inputInsidePopup;\n if (shouldFillInput) {\n setInputValue(stringifyValueLabel(nextValue), createChangeEventDetails(eventDetails.reason, eventDetails.event));\n }\n });\n const handleSelection = useStableCallback((event, itemValue) => {\n const targetEl = getTarget(event);\n const overrideEvent = selectionEventRef.current ?? event;\n selectionEventRef.current = null;\n const eventDetails = createChangeEventDetails(REASONS.itemPress, overrideEvent);\n\n // Let the link handle the click.\n const href = targetEl?.closest('a')?.getAttribute('href');\n if (href) {\n if (href.startsWith('#')) {\n setOpen(false, eventDetails);\n }\n return;\n }\n if (multiple) {\n const currentSelectedValue = Array.isArray(selectedValue) ? selectedValue : [];\n const isCurrentlySelected = selectedValueIncludes(currentSelectedValue, itemValue, isItemEqualToValue);\n const nextValue = isCurrentlySelected ? removeItem(currentSelectedValue, itemValue, isItemEqualToValue) : [...currentSelectedValue, itemValue];\n setSelectedValue(nextValue, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n const wasFiltering = inputRef.current ? inputRef.current.value.trim() !== '' : false;\n if (!wasFiltering) {\n return;\n }\n if (store.state.inputInsidePopup) {\n setInputValue('', createChangeEventDetails(REASONS.inputClear, eventDetails.event, undefined, {\n isItemPress: true\n }));\n // A newly selected item stays highlighted through the clear; a deselection\n // falls back to the standard selection anchor.\n const pendingHighlight = pendingQueryHighlightRef.current;\n if (pendingHighlight && !isCurrentlySelected) {\n pendingHighlight.toggledValue = itemValue;\n }\n } else {\n setOpen(false, eventDetails);\n }\n } else {\n setSelectedValue(itemValue, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n setOpen(false, eventDetails);\n }\n });\n const requestSubmit = useStableCallback(() => {\n const formElement = validation.inputRef.current?.form ?? store.state.inputElement?.form;\n if (formElement && typeof formElement.requestSubmit === 'function') {\n formElement.requestSubmit();\n }\n });\n const handleUnmount = useStableCallback(() => {\n setMounted(false);\n onOpenChangeComplete?.(false);\n setQueryChangedAfterOpen(false);\n setCloseQuery(null);\n if (selectionMode === 'none') {\n setIndices({\n activeIndex: null,\n selectedIndex: null\n });\n } else {\n setIndices({\n activeIndex: null\n });\n }\n\n // Multiple selection mode:\n // If the user typed a filter and didn't select in multiple mode, clear the input\n // after close completes to avoid mid-exit flicker and start fresh on next open.\n if (multiple && inputRef.current && inputRef.current.value !== '' && !hadInputClearRef.current) {\n setInputValue('', createChangeEventDetails(REASONS.inputClear));\n }\n\n // Single selection mode:\n // - If input is rendered inside the popup, clear it so the next open is blank\n // - If input is outside the popup, sync it to the selected value\n if (single) {\n if (store.state.inputInsidePopup) {\n if (inputRef.current && inputRef.current.value !== '') {\n setInputValue('', createChangeEventDetails(REASONS.inputClear));\n }\n } else {\n const stringVal = stringifyValueLabel(selectedValue);\n if (inputRef.current && inputRef.current.value !== stringVal) {\n // If no selection was made, treat this as clearing the typed filter.\n const reason = stringVal === '' ? REASONS.inputClear : REASONS.none;\n setInputValue(stringVal, createChangeEventDetails(reason));\n }\n }\n }\n });\n\n // Support composing the Dialog component around an inline combobox.\n // `[role=\"dialog\"]` is more interoperable than using a context, e.g. it can work\n // with third-party modal libraries, though the limitation is that the closest\n // `role=dialog` part must be the animated element.\n const resolvedPopupRef = React.useMemo(() => {\n if (inline && positionerElement) {\n return {\n current: positionerElement.closest('[role=\"dialog\"]')\n };\n }\n return popupRef;\n }, [inline, positionerElement]);\n useOpenChangeComplete({\n enabled: !props.actionsRef,\n open,\n ref: resolvedPopupRef,\n onComplete() {\n if (!open) {\n handleUnmount();\n }\n }\n });\n React.useImperativeHandle(props.actionsRef, () => ({\n unmount: handleUnmount\n }), [handleUnmount]);\n useIsoLayoutEffect(function syncSelectedIndex() {\n const closeQueryReleased = previousCloseQueryRef.current !== null && closeQuery === null;\n previousCloseQueryRef.current = closeQuery;\n\n // Closing indexes against the frozen filtered list. Reopening releases that query, so its\n // rendered coordinates must be synchronized again even though the popup is already open.\n if (open && (!closeQueryReleased || !hasItems)) {\n return;\n }\n\n // State-driven (not tied to the internal event path) so controlled closes\n // also clear a pointerdown that never received a matching item mouseup.\n if (!open) {\n pointerDownItemRef.current = null;\n }\n if (selectionMode === 'none') {\n return;\n }\n\n // Without `items`, look the selection up in the live registry of mounted item\n // values (the list stays mounted while closed when closed-state features need\n // it — trigger interaction and rendered-label autofill force-mount it). Mounted\n // items re-assert the index themselves when their registration moves; when\n // nothing is mounted the lookup resolves to `null` and each item re-registers\n // the index on the next open.\n // Keep the selected index in the coordinates of the list that is actually rendered.\n const registry = hasItems ? flatFilteredValues : valuesRef.current;\n setIndices({\n selectedIndex: findSelectionIndex(registry, selectedValue, isItemEqualToValue, multiple)\n });\n }, [open, closeQuery, selectedValue, selectionMode, multiple, hasItems, flatFilteredValues, isItemEqualToValue, setIndices]);\n useIsoLayoutEffect(() => {\n if (items) {\n valuesRef.current = flatFilteredValues;\n listRef.current.length = flatFilteredValues.length;\n }\n }, [items, flatFilteredValues]);\n useIsoLayoutEffect(() => {\n const pendingHighlight = pendingQueryHighlightRef.current;\n if (pendingHighlight) {\n // A directly rendered list remains visible when the popup state is closed, while a\n // kept-mounted Positioner is hidden and should stay inert.\n const listIsNavigable = open || inline || store.state.positionerElement?.hidden === false;\n if (pendingHighlight.hasQuery) {\n if (autoHighlightMode && listIsNavigable) {\n store.set('activeIndex', 0);\n }\n pendingQueryHighlightRef.current = null;\n } else if (String(inputValue).trim() === '') {\n // Only handle the clear once it has committed (a controlled input may reject it),\n // so a restore cannot fire while a query is still active.\n pendingQueryHighlightRef.current = null;\n if (listIsNavigable) {\n const clearedBySelection = pendingHighlight.selection;\n if (autoHighlightMode === 'always' && !clearedBySelection && store.state.selectionMode === 'none') {\n // There is no selection to restore in Autocomplete. Keep the first-item reset\n // synchronous so list navigation sees it before a directly rendered list closes.\n store.set('activeIndex', 0);\n }\n\n // Items re-mounted by the clear publish their composite indices in a follow-up\n // commit, so the item registries are mid-update here. Defer past React's cascade.\n queueMicrotask(() => {\n if (!store.state.open && !store.state.inline || inputRef.current && inputRef.current.value.trim() !== '') {\n return;\n }\n\n // Return the highlight to the selected item, the same anchor the popup uses\n // when it first opens. Read the selection through the store so consumers can\n // pass an inline `isItemEqualToValue` or a fresh `selectedValue` array without\n // re-running this effect on every render.\n const currentSelectedValue = store.state.selectedValue;\n const isMultiple = store.state.selectionMode === 'multiple';\n const hasSelection = isMultiple && Array.isArray(currentSelectedValue) ? currentSelectedValue.length > 0 : store.state.selectionMode !== 'none' && currentSelectedValue != null;\n if (hasSelection) {\n const registry = hasItems || hasFilteredItemsProp ? flatFilteredValues : valuesRef.current;\n // A selection-driven clear keeps the just-selected item highlighted;\n // otherwise return to the open anchor. A selection that is no longer in\n // the list drops the highlight rather than leaving it on whichever item\n // now occupies that index.\n // `findItemIndex` resolves to -1 when no value was toggled.\n const toggledIndex = findItemIndex(registry, pendingHighlight.toggledValue, store.state.isItemEqualToValue);\n store.set('activeIndex', toggledIndex !== -1 ? toggledIndex : findSelectionIndex(registry, currentSelectedValue, store.state.isItemEqualToValue, isMultiple));\n } else if (clearedBySelection) {\n store.set('activeIndex', null);\n } else if (autoHighlightMode === 'always') {\n store.set('activeIndex', 0);\n }\n });\n }\n }\n }\n if (!open && !inline) {\n return;\n }\n const shouldUseFlatFilteredValues = hasItems || hasFilteredItemsProp;\n const candidateItems = shouldUseFlatFilteredValues ? flatFilteredValues : valuesRef.current;\n const storeActiveIndex = store.state.activeIndex;\n if (storeActiveIndex == null) {\n if (autoHighlightMode === 'always' && candidateItems.length > 0) {\n store.set('activeIndex', 0);\n return;\n }\n emitHighlight(undefined, -1, REASONS.none);\n return;\n }\n if (storeActiveIndex >= candidateItems.length) {\n emitHighlight(undefined, -1, REASONS.none);\n store.set('activeIndex', null);\n return;\n }\n const itemValue = candidateItems[storeActiveIndex];\n const previouslyHighlightedItemValue = lastHighlightRef.current.value;\n const isSameItem = previouslyHighlightedItemValue !== NO_ACTIVE_VALUE && compareItemEquality(itemValue, previouslyHighlightedItemValue, store.state.isItemEqualToValue);\n if (lastHighlightRef.current.index !== storeActiveIndex || !isSameItem) {\n emitHighlight(itemValue, storeActiveIndex, REASONS.none);\n }\n }, [activeIndex, autoHighlightMode, emitHighlight, hasFilteredItemsProp, hasItems, flatFilteredValues, inline, open, store,\n // Reruns the effect when the query changes without affecting the deps above, such as\n // clearing the input when no items are filtered out (individually rendered items).\n inputValue]);\n useIsoLayoutEffect(() => {\n if (selectionMode === 'none') {\n setFilled(String(inputValue) !== '');\n return;\n }\n setFilled(multiple ? Array.isArray(selectedValue) && selectedValue.length > 0 : selectedValue != null);\n }, [setFilled, selectionMode, inputValue, selectedValue, multiple]);\n\n // Ensures that the active index is not set to 0 when the list is empty.\n // This avoids needing to press ArrowDown twice under certain conditions.\n React.useEffect(() => {\n if (hasItems && autoHighlightMode && flatFilteredValues.length === 0) {\n setIndices({\n activeIndex: null\n });\n }\n }, [hasItems, autoHighlightMode, flatFilteredValues.length, setIndices]);\n function handleQueryChanged() {\n if (open && query !== '' && query !== String(initialDefaultInputValue) && !inputMatchesSelectedValue) {\n setQueryChangedAfterOpen(true);\n }\n }\n function handleOpenChanged() {\n // A controlled `open` prop can interrupt the close without calling `setOpen`.\n if (open && closeQuery !== null) {\n handleInterruptedReopen(false);\n }\n }\n\n // These sync triggers can run in the same commit while still seeing the pre-commit `inputValue`.\n // This render-scoped flag prevents duplicate callbacks and resets so canceled writes can retry.\n let syncedSelectedLabel = false;\n function syncInputToSelectedLabel() {\n if (!syncedSelectedLabel && inputValue !== selectedLabelString) {\n syncedSelectedLabel = true;\n setInputValue(selectedLabelString, createChangeEventDetails(REASONS.none));\n }\n }\n function handleSelectedValueChanged() {\n if (selectionMode === 'none') {\n return;\n }\n clearErrors(name);\n setDirty(isSelectedValueDirty(selectedValue, validityData.initialValue, isItemEqualToValue));\n validation.change(selectedValue);\n if (single && !hasInputValue && !inputInsidePopup) {\n syncInputToSelectedLabel();\n }\n }\n\n // The label catches accessor changes while the items identity restores the selected label after\n // a one-step input clear followed by a data reload. The shared sync prevents duplicate writes\n // when both change in the same commit.\n function syncInputAfterItemsOrLabelChange() {\n if (single && !hasInputValue && !inputInsidePopup && !queryChangedAfterOpen) {\n syncInputToSelectedLabel();\n }\n }\n function handleInputValueChanged() {\n if (selectionMode !== 'none') {\n return;\n }\n clearErrors(name);\n setDirty(inputValue !== validityData.initialValue);\n validation.change(inputValue);\n }\n useValueChanged(query, handleQueryChanged);\n useValueChanged(open, handleOpenChanged);\n useValueChanged(selectedValue, handleSelectedValueChanged);\n useValueChanged(selectedLabelString, syncInputAfterItemsOrLabelChange);\n useValueChanged(items, syncInputAfterItemsOrLabelChange);\n useValueChanged(inputValue, handleInputValueChanged);\n const floatingRootContext = useFloatingRootContext({\n open: inline ? true : open,\n onOpenChange: setOpen,\n elements: {\n reference: inputInsidePopup ? triggerElement : inputElement,\n floating: positionerElement\n }\n });\n const ariaHasPopup = grid ? 'grid' : 'listbox';\n // An inline list isn't gated on `open`: it renders for as long as it's in the tree, so the\n // combobox is permanently expanded even while the internal open state is `false`.\n const expanded = open || inline;\n const ariaExpanded = expanded ? 'true' : 'false';\n const role = React.useMemo(() => {\n const isPlainInput = inputElement?.tagName === 'INPUT';\n // During SSR and initial hydration, the input ref is not available yet.\n // Assume an input-like control so combobox ARIA attributes are present.\n const shouldTreatAsInput = inputElement == null || isPlainInput;\n // A non-input control only takes on combobox semantics while the list is exposed, which for\n // an inline list is the whole time.\n const shouldApplyAria = shouldTreatAsInput || expanded;\n const reference = shouldTreatAsInput ? {\n autoComplete: 'off',\n spellCheck: 'false',\n autoCorrect: 'off',\n autoCapitalize: 'none'\n } : {};\n if (shouldApplyAria) {\n reference.role = 'combobox';\n reference['aria-expanded'] = ariaExpanded;\n reference['aria-haspopup'] = ariaHasPopup;\n reference['aria-controls'] = expanded ? listElement?.id : undefined;\n // `readOnly` accepts no input, so no completion of any kind is offered.\n reference['aria-autocomplete'] = readOnly ? 'none' : autoComplete;\n }\n return {\n reference,\n floating: {\n role: 'presentation'\n }\n };\n }, [inputElement, expanded, ariaExpanded, ariaHasPopup, listElement?.id, autoComplete, readOnly]);\n\n // `readOnly` locks the value, not the interaction: the popup opens and can be browsed.\n // Value changes stay blocked in `ComboboxItem`, `ComboboxInput`'s keydown, `ComboboxTrigger`'s\n // typeahead, the clear/remove parts, and the hidden input's autofill handler.\n const click = useClick(floatingRootContext, {\n enabled: !disabled && openOnInputClick,\n event: 'mousedown-only',\n toggle: false,\n // Apply a small delay for touch to let mobile viewport/keyboard positioning settle.\n // This avoids top-bottom flip flickers if the preferred position is \"top\" when first tapping.\n touchOpenDelay: inputInsidePopup ? 0 : 100,\n reason: REASONS.inputPress\n });\n const dismiss = useDismiss(floatingRootContext, {\n enabled: !disabled && !inline,\n outsidePressEvent: {\n mouse: 'sloppy',\n // The visual viewport (affected by the mobile software keyboard) can be\n // somewhat small. The user may want to scroll the screen to see more of\n // the popup.\n touch: 'intentional'\n },\n // Without a popup, let the Escape key bubble the event up to other popups' handlers.\n bubbles: inline ? true : undefined,\n outsidePress(event) {\n const target = getTarget(event);\n return !contains(triggerElement, target) && !contains(clearRef.current, target) && !contains(chipsContainerRef.current, target) && !contains(inputGroupElement, target);\n }\n });\n const listNavigation = useListNavigation(floatingRootContext, {\n enabled: !disabled,\n id,\n listRef,\n activeIndex,\n selectedIndex,\n virtual: true,\n loopFocus,\n allowEscape: loopFocus && !autoHighlightMode,\n focusItemOnOpen: queryChangedAfterOpen || selectionMode === 'none' && !autoHighlightMode ? false : 'auto',\n focusItemOnHover: highlightItemOnHover,\n resetOnPointerLeave: !keepHighlight,\n orientation: grid ? 'horizontal' : undefined,\n rtl: direction === 'rtl',\n disabledIndices: EMPTY_ARRAY,\n grid: grid ? gridNavigation : undefined,\n onNavigate(nextActiveIndex, event) {\n // Retain the highlight only while actually transitioning out or closed.\n if (!event && !open || transitionStatus === 'ending') {\n return;\n }\n if (!event) {\n setIndices({\n activeIndex: nextActiveIndex\n });\n } else {\n setIndices({\n activeIndex: nextActiveIndex,\n type: keyboardActiveRef.current ? REASONS.keyboard : REASONS.pointer\n });\n }\n }\n });\n const inputProps = React.useMemo(() => mergeProps(listNavigation.reference, {\n onKeyDown(event) {\n // In grid mode the navigation hook treats ArrowLeft/ArrowRight as horizontal\n // grid movement. When the input has focus and no item is highlighted the user\n // is still editing the query, so let the input keep its native caret behavior.\n if (grid && store.state.activeIndex == null && (event.key === 'ArrowLeft' || event.key === 'ArrowRight')) {\n event.preventBaseUIHandler();\n }\n }\n }, dismiss.reference, click.reference, role.reference), [listNavigation.reference, dismiss.reference, click.reference, role.reference, grid, store]);\n const popupProps = React.useMemo(() => mergeProps(FOCUSABLE_POPUP_PROPS, dismiss.floating), [dismiss.floating]);\n const listProps = React.useMemo(() => mergeProps(listNavigation.floating, role.floating), [listNavigation.floating, role.floating]);\n const itemProps = React.useMemo(() => {\n const listNavigationItemProps = listNavigation.item;\n if (!listNavigationItemProps) {\n return EMPTY_OBJECT;\n }\n\n // Combobox keeps focus on the input; item focus would incorrectly sync\n // list navigation state from DOM focus.\n return {\n ...listNavigationItemProps,\n onFocus: undefined\n };\n }, [listNavigation.item]);\n store.useContextCallback('setOpen', setOpen);\n store.useContextCallback('setInputValue', setInputValue);\n store.useContextCallback('setSelectedValue', setSelectedValue);\n store.useContextCallback('setIndices', setIndices);\n store.useContextCallback('handleSelection', handleSelection);\n store.useContextCallback('forceMount', forceMount);\n store.useContextCallback('requestSubmit', requestSubmit);\n store.useContextCallback('onOpenChangeComplete', onOpenChangeCompleteProp);\n\n // The prop bags must be in the store before the parts render: they read them with `useStore`\n // during render, and a layout effect commits only after all children have rendered.\n useOnFirstRender(() => {\n store.update({\n inline: inlineProp,\n popupProps,\n listProps,\n inputProps,\n triggerProps,\n itemProps\n });\n });\n const syncedValues = {\n id,\n selectedValue,\n open,\n mounted,\n transitionStatus,\n items: storeItems,\n inline: inlineProp,\n popupProps,\n listProps,\n inputProps,\n triggerProps,\n itemProps,\n openMethod,\n selectionMode,\n name,\n form,\n disabled,\n readOnly,\n required,\n grid,\n virtualized,\n openOnInputClick,\n itemToStringLabel,\n modal,\n autoHighlight: autoHighlightMode,\n isItemEqualToValue,\n submitOnItemClick,\n hasInputValue\n };\n useIsoLayoutEffect(() => {\n // `inputOwnsFormValue` is derived here rather than during render because `ComboboxInput`\n // writes it from a ref callback earlier in the same commit, and it has to land in this same\n // `update` so subscribers never observe an intermediate snapshot. That is also why\n // `store.useSyncedValues` can't be used yet: it would need a second write. The dependencies\n // are derived from `syncedValues` so a newly synchronized field can't be forgotten here.\n store.update({\n ...syncedValues,\n inputOwnsFormValue: selectionMode === 'none' && (inlineProp || !store.state.inputInsidePopup)\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [store, ...Object.values(syncedValues)]);\n const hiddenInputRef = useMergedRefs(inputRefProp, validation.inputRef);\n const itemsContextValue = React.useMemo(() => ({\n query,\n hasItems,\n filteredItems,\n flatFilteredValues\n }), [query, hasItems, filteredItems, flatFilteredValues]);\n const serializedValue = React.useMemo(() => {\n if (Array.isArray(fieldRawValue)) {\n return '';\n }\n return stringifyAsValue(fieldRawValue, itemToStringValue);\n }, [fieldRawValue, itemToStringValue]);\n const hasMultipleSelection = multiple && Array.isArray(selectedValue) && selectedValue.length > 0;\n const hiddenInputName = multiple || selectionMode === 'none' && inputOwnsFormValue ? undefined : name;\n const hiddenInputs = React.useMemo(() => {\n if (!multiple || !Array.isArray(selectedValue) || !name) {\n return null;\n }\n return selectedValue.map(value => {\n const currentSerializedValue = stringifyAsValue(value, itemToStringValue);\n return /*#__PURE__*/_jsx(\"input\", {\n type: \"hidden\",\n form: form,\n name: name,\n value: currentSerializedValue,\n disabled: disabled\n }, currentSerializedValue);\n });\n }, [multiple, selectedValue, form, name, itemToStringValue, disabled]);\n const children = /*#__PURE__*/_jsxs(React.Fragment, {\n children: [props.children, /*#__PURE__*/_jsx(\"input\", {\n ...validation.getValidationProps(disabled, {\n // Move focus when the hidden input is focused.\n onFocus() {\n if (inputInsidePopup) {\n triggerElement?.focus();\n return;\n }\n (inputRef.current || triggerElement)?.focus();\n },\n // Handle browser autofill.\n onChange(event) {\n // Workaround for https://github.com/react/react/issues/9023\n if (event.nativeEvent.defaultPrevented || disabled || readOnly) {\n return;\n }\n const nextValue = event.currentTarget.value;\n const nextValueLower = nextValue.toLowerCase();\n const details = createChangeEventDetails(REASONS.none, event.nativeEvent);\n const findSerializedMatchIndex = () => valuesRef.current.findIndex(candidate => stringifyAsValue(candidate, itemToStringValue).toLowerCase() === nextValueLower || stringifyValueLabel(candidate).toLowerCase() === nextValueLower);\n function handleChange() {\n // Browser autofill only writes a single scalar value.\n if (multiple) {\n return;\n }\n if (selectionMode === 'none') {\n setInputValue(nextValue, details);\n return;\n }\n\n // Preserve the original serialized matching, then fall back to rendered text,\n // which browsers can autofill for primitive values like `value=\"US\">United States`.\n let matchingIndex = findSerializedMatchIndex();\n if (matchingIndex === -1) {\n matchingIndex = valuesRef.current.findIndex((_, index) => {\n const renderedLabel = labelsRef.current[index];\n return renderedLabel != null && renderedLabel.toLowerCase() === nextValueLower;\n });\n }\n const matchingValue = matchingIndex === -1 ? undefined : valuesRef.current[matchingIndex];\n if (matchingValue != null) {\n // `setSelectedValue` may be canceled by `onValueChange`; rely on\n // `useValueChanged` to mark the field dirty and run validation only\n // when the value actually changes.\n setSelectedValue?.(matchingValue, details);\n }\n }\n\n // Only single-selection autofill matches against the registered values/labels.\n // `multiple` ignores autofill and `none` just writes the input value, so avoid the\n // sticky `forceMounted` mount (which never resets) for those modes.\n if (single) {\n forceMount();\n if (items && findSerializedMatchIndex() === -1) {\n // `forceMount` only refreshes the derived labels for the `items` prop. When\n // serialized matching misses, also mount the list so rendered labels (which can\n // differ from the serialized values) are registered for autofill matching.\n store.set('forceMounted', true);\n }\n }\n queueMicrotask(handleChange);\n }\n }),\n id: id && hiddenInputName == null ? `${id}-hidden-input` : undefined,\n form: form,\n name: hiddenInputName,\n autoComplete: formAutoComplete,\n disabled: disabled,\n required: required && !hasMultipleSelection,\n readOnly: readOnly,\n value: serializedValue,\n ref: hiddenInputRef,\n style: hiddenInputName ? visuallyHiddenInput : visuallyHidden,\n tabIndex: -1,\n \"aria-hidden\": true,\n suppressHydrationWarning: true\n }), hiddenInputs]\n });\n return /*#__PURE__*/_jsx(ComboboxRootContext.Provider, {\n value: store,\n children: /*#__PURE__*/_jsx(ComboboxFloatingContext.Provider, {\n value: floatingRootContext,\n children: /*#__PURE__*/_jsx(ComboboxHasItemsContext.Provider, {\n value: hasItems,\n children: /*#__PURE__*/_jsx(ComboboxDerivedItemsContext.Provider, {\n value: itemsContextValue,\n children: /*#__PURE__*/_jsx(ComboboxInputValueContext.Provider, {\n value: inputValue,\n children: children\n })\n })\n })\n })\n });\n}","'use client';\n\nimport * as React from 'react';\nimport { AriaCombobox } from \"./AriaCombobox.mjs\";\n\n/**\n * Groups all parts of the combobox.\n * Doesn't render its own HTML element.\n *\n * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport function ComboboxRoot(props) {\n const {\n multiple = false,\n defaultValue,\n value,\n onValueChange,\n autoComplete,\n ...other\n } = props;\n return /*#__PURE__*/_jsx(AriaCombobox, {\n ...other,\n selectionMode: multiple ? 'multiple' : 'single',\n selectedValue: value,\n defaultSelectedValue: defaultValue,\n onSelectedValueChange: onValueChange,\n formAutoComplete: autoComplete\n });\n}","'use client';\n\nexport function getDefaultLabelId(id) {\n return id == null ? undefined : `${id}-label`;\n}\nexport function resolveAriaLabelledBy(fieldLabelId, localLabelId) {\n return fieldLabelId ?? localLabelId;\n}","import { CommonTriggerDataAttributes } from \"../../utils/popupStateMapping.mjs\";\n\n/**\n * Present when the corresponding popup is open.\n */\nexport const popupOpen = CommonTriggerDataAttributes.popupOpen;\n/**\n * Present when the input is pressed.\n */\nexport const pressed = CommonTriggerDataAttributes.pressed;\n/**\n * Present when the component is disabled.\n */\nexport const disabled = 'data-disabled';\n/**\n * Present when the component is readonly.\n */\nexport const readonly = 'data-readonly';\n/**\n * Indicates which side the corresponding popup is positioned relative to its anchor.\n * @type {'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start' | null}\n */\nexport const popupSide = 'data-popup-side';\n/**\n * Present when the component is required.\n */\nexport const required = 'data-required';\n/**\n * Present when the component is in a valid state (when wrapped in Field.Root).\n */\nexport const valid = 'data-valid';\n/**\n * Present when the component is in an invalid state (when wrapped in Field.Root).\n */\nexport const invalid = 'data-invalid';\n/**\n * Present when the component has been touched (when wrapped in Field.Root).\n */\nexport const touched = 'data-touched';\n/**\n * Present when the component's value has changed (when wrapped in Field.Root).\n */\nexport const dirty = 'data-dirty';\n/**\n * Present when the component has a value (when wrapped in Field.Root).\n */\nexport const filled = 'data-filled';\n/**\n * Present when the input is focused (when wrapped in Field.Root).\n */\nexport const focused = 'data-focused';\n/**\n * Present when the corresponding items list is empty.\n */\nexport const listEmpty = 'data-list-empty';","import { pressableTriggerOpenStateMapping } from \"../../utils/popupStateMapping.mjs\";\nimport { fieldValidityMapping } from \"../../internals/field-constants/constants.mjs\";\nimport * as ComboboxInputDataAttributes from \"../input/ComboboxInputDataAttributes.mjs\";\nexport const triggerStateAttributesMapping = {\n ...pressableTriggerOpenStateMapping,\n ...fieldValidityMapping,\n popupSide: side => side ? {\n [ComboboxInputDataAttributes.popupSide]: side\n } : null,\n listEmpty: empty => empty ? {\n [ComboboxInputDataAttributes.listEmpty]: ''\n } : null\n};","'use client';\n\nimport * as React from 'react';\nexport const ComboboxChipsContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") ComboboxChipsContext.displayName = \"ComboboxChipsContext\";\nexport function useComboboxChipsContext() {\n return React.useContext(ComboboxChipsContext);\n}","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const ComboboxPositionerContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") ComboboxPositionerContext.displayName = \"ComboboxPositionerContext\";\nexport function useComboboxPositionerContext(optional) {\n const context = React.useContext(ComboboxPositionerContext);\n if (context === undefined && !optional) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: <Combobox.Popup> and <Combobox.Arrow> must be used within the <Combobox.Positioner> component' : _formatErrorMessage(21));\n }\n return context;\n}","'use client';\n\nimport * as React from 'react';\nimport { useMergedRefs } from '@base-ui/utils/useMergedRefs';\nimport { visuallyHiddenInput } from '@base-ui/utils/visuallyHidden';\nimport { useButton } from \"../../internals/use-button/index.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useComboboxRootContext } from \"../root/ComboboxRootContext.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * @internal\n */\nexport const ComboboxInternalDismissButton = /*#__PURE__*/React.forwardRef(function ComboboxInternalDismissButton(_, forwardedRef) {\n const store = useComboboxRootContext();\n const {\n buttonRef,\n getButtonProps\n } = useButton({\n native: false\n });\n const mergedRef = useMergedRefs(forwardedRef, buttonRef);\n function handleDismiss(event) {\n store.context.setOpen(false, createChangeEventDetails(REASONS.closePress, event.nativeEvent, event.currentTarget));\n }\n const dismissProps = getButtonProps({\n onClick: handleDismiss\n });\n return /*#__PURE__*/_jsx(\"span\", {\n ref: mergedRef,\n ...dismissProps,\n \"aria-label\": \"Dismiss\",\n tabIndex: undefined,\n style: visuallyHiddenInput\n });\n});\nif (process.env.NODE_ENV !== \"production\") ComboboxInternalDismissButton.displayName = \"ComboboxInternalDismissButton\";","'use client';\n\nimport { useComboboxDerivedItemsContext } from \"../root/ComboboxRootContext.mjs\";\n/**\n * The popup side is only meaningful while the positioner is mounted, as the store retains the\n * last resolved side after the popup unmounts.\n */\nexport function usePopupSide(store) {\n const mounted = store.useState('mounted');\n const popupSide = store.useState('popupSide');\n const positionerElement = store.useState('positionerElement');\n return mounted && positionerElement ? popupSide : null;\n}\n\n/**\n * Whether the filtered list has no items to show.\n */\nexport function useListEmpty() {\n return useComboboxDerivedItemsContext().filteredItems.length === 0;\n}\n\n/**\n * The arrow keys that move the chip highlight backwards and forwards, in that order.\n */\nexport function getChipNavigationKeys(direction) {\n return direction === 'rtl' ? ['ArrowRight', 'ArrowLeft'] : ['ArrowLeft', 'ArrowRight'];\n}\n\n/**\n * Where the highlight lands once the chip at `index` is removed, or `undefined` for no highlight.\n */\nexport function getIndexAfterChipRemoval(index, chipCount) {\n const nextIndex = index >= chipCount - 1 ? chipCount - 2 : index;\n return nextIndex >= 0 ? nextIndex : undefined;\n}\n\n/**\n * Commits the highlighted item by clicking it, tagging the originating event so the item's\n * handler can attribute the selection to it.\n */\nexport function clickHighlightedItem(store, activeIndex, nativeEvent) {\n const listItem = store.context.listRef.current[activeIndex];\n if (listItem) {\n store.context.selectionEventRef.current = nativeEvent;\n listItem.click();\n store.context.selectionEventRef.current = null;\n }\n}","'use client';\n\nimport * as React from 'react';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { platform } from '@base-ui/utils/platform';\nimport { useBaseUiId } from \"../../internals/useBaseUiId.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useComboboxInputValueContext, useComboboxRootContext } from \"../root/ComboboxRootContext.mjs\";\nimport { triggerStateAttributesMapping } from \"../utils/stateAttributesMapping.mjs\";\nimport { DEFAULT_FIELD_ROOT_CONTEXT, FieldRootContext, useFieldRootContext } from \"../../internals/field-root-context/FieldRootContext.mjs\";\nimport { DEFAULT_FIELD_STATE_ATTRIBUTES } from \"../../internals/field-constants/constants.mjs\";\nimport { useLabelableContext } from \"../../internals/labelable-provider/LabelableContext.mjs\";\nimport { useComboboxChipsContext } from \"../chips/ComboboxChipsContext.mjs\";\nimport { stopEvent } from \"../../floating-ui-react/utils.mjs\";\nimport { useComboboxPositionerContext } from \"../positioner/ComboboxPositionerContext.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useDirection } from \"../../internals/direction-context/DirectionContext.mjs\";\nimport { ComboboxInternalDismissButton } from \"../utils/ComboboxInternalDismissButton.mjs\";\nimport { clickHighlightedItem, getChipNavigationKeys, getIndexAfterChipRemoval, useListEmpty, usePopupSide } from \"../utils/parts.mjs\";\n\n/**\n * A text input to search for items in the list.\n * Renders an `<input>` element.\n *\n * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const ComboboxInput = /*#__PURE__*/React.forwardRef(function ComboboxInput(componentProps, forwardedRef) {\n const {\n render,\n className,\n disabled: disabledProp = false,\n id: idProp,\n style,\n ...elementProps\n } = componentProps;\n const {\n state: fieldState,\n disabled: fieldDisabled,\n setTouched,\n setFocused,\n validationMode,\n validation\n } = useFieldRootContext();\n const {\n labelId: fieldLabelId\n } = useLabelableContext();\n const comboboxChipsContext = useComboboxChipsContext();\n const positioning = useComboboxPositionerContext(true);\n const hasPositionerParent = Boolean(positioning);\n const store = useComboboxRootContext();\n // `inputValue` can't be placed in the store.\n // https://github.com/mui/base-ui/issues/2703\n const inputValue = useComboboxInputValueContext();\n const direction = useDirection();\n const required = store.useState('required');\n const comboboxDisabled = store.useState('disabled');\n const readOnly = store.useState('readOnly');\n const name = store.useState('name');\n const form = store.useState('form');\n const selectionMode = store.useState('selectionMode');\n const autoHighlightMode = store.useState('autoHighlight');\n const inputProps = store.useState('inputProps');\n const triggerProps = store.useState('triggerProps');\n const open = store.useState('open');\n const mounted = store.useState('mounted');\n const selectedValue = store.useState('selectedValue');\n const rootId = store.useState('id');\n const inline = store.useState('inline');\n const modal = store.useState('modal');\n const autoHighlightEnabled = Boolean(autoHighlightMode);\n const popupSide = usePopupSide(store);\n const disabled = fieldDisabled || comboboxDisabled || disabledProp;\n const listEmpty = useListEmpty();\n const isInsidePopup = hasPositionerParent || inline;\n const focusManagerModal = !isInsidePopup || modal;\n const id = useBaseUiId(idProp ?? (!isInsidePopup ? rootId : undefined));\n const fieldStateForInput = hasPositionerParent ? DEFAULT_FIELD_STATE_ATTRIBUTES : fieldState;\n const [composingValue, setComposingValue] = React.useState(null);\n const isComposingRef = React.useRef(false);\n const lastActiveIndexRef = React.useRef(null);\n const shouldRestoreActiveIndexRef = React.useRef(false);\n const inputOwnsFormValue = selectionMode === 'none' && !hasPositionerParent;\n const setInputElement = useStableCallback(element => {\n const nextIsInsidePopup = hasPositionerParent || store.state.inline;\n if (nextIsInsidePopup && !store.state.hasInputValue) {\n store.context.setInputValue('', createChangeEventDetails(REASONS.none));\n }\n store.update({\n inputElement: element,\n inputInsidePopup: nextIsInsidePopup,\n inputOwnsFormValue\n });\n });\n const validationProps = hasPositionerParent ? elementProps : validation.getValidationProps(disabled, elementProps);\n function clearHighlight() {\n store.context.setIndices({\n activeIndex: null,\n selectedIndex: null,\n type: store.context.keyboardActiveRef.current ? REASONS.keyboard : REASONS.pointer\n });\n }\n function markPointerActive() {\n store.context.keyboardActiveRef.current = false;\n }\n const state = {\n ...fieldStateForInput,\n open,\n disabled,\n readOnly,\n popupSide,\n listEmpty\n };\n function handleKeyDown(event) {\n if (!comboboxChipsContext) {\n return undefined;\n }\n let nextIndex;\n const {\n highlightedChipIndex\n } = comboboxChipsContext;\n const renderedChipsCount = comboboxChipsContext.chipsRef.current.length;\n const [previousChipKey, nextChipKey] = getChipNavigationKeys(direction);\n if (highlightedChipIndex !== undefined) {\n if (event.key === previousChipKey) {\n event.preventDefault();\n if (highlightedChipIndex > 0) {\n nextIndex = highlightedChipIndex - 1;\n } else {\n nextIndex = undefined;\n }\n } else if (event.key === nextChipKey) {\n event.preventDefault();\n if (highlightedChipIndex < renderedChipsCount - 1) {\n nextIndex = highlightedChipIndex + 1;\n } else {\n nextIndex = undefined;\n }\n } else if (event.key === 'Backspace' || event.key === 'Delete') {\n event.preventDefault();\n // Move highlight appropriately after removal.\n nextIndex = getIndexAfterChipRemoval(highlightedChipIndex, selectedValue.length);\n clearHighlight();\n }\n return nextIndex;\n }\n\n // Handle navigation when no chip is highlighted\n if (event.key === previousChipKey && (event.currentTarget.selectionStart ?? 0) === 0 && selectedValue.length > 0) {\n event.preventDefault();\n nextIndex = renderedChipsCount > 0 ? renderedChipsCount - 1 : undefined;\n }\n return nextIndex;\n }\n const element = useRenderElement('input', componentProps, {\n state,\n ref: [forwardedRef, store.context.inputRef, setInputElement],\n props: [inputProps, triggerProps, {\n value: composingValue ?? inputValue,\n 'aria-readonly': readOnly || undefined,\n 'aria-required': required || undefined,\n 'aria-labelledby': fieldLabelId,\n disabled,\n readOnly,\n required: selectionMode === 'none' ? required : undefined,\n form,\n ...(inputOwnsFormValue && name && {\n name\n }),\n id,\n onFocus() {\n setFocused(true);\n if (!inline || !shouldRestoreActiveIndexRef.current) {\n return;\n }\n shouldRestoreActiveIndexRef.current = false;\n const nextActiveIndex = lastActiveIndexRef.current;\n if (nextActiveIndex == null ||\n // `valuesRef` can be sparse, so guard against restoring a removed slot.\n !Object.hasOwn(store.context.valuesRef.current, nextActiveIndex)) {\n return;\n }\n store.context.setIndices({\n activeIndex: nextActiveIndex\n });\n },\n onBlur() {\n setTouched(true);\n setFocused(false);\n const activeIndex = store.state.activeIndex;\n if (inline && activeIndex !== null && autoHighlightMode !== 'always') {\n lastActiveIndexRef.current = activeIndex;\n shouldRestoreActiveIndexRef.current = true;\n store.context.setIndices({\n activeIndex: null\n });\n }\n if (validationMode === 'onBlur') {\n const valueToValidate = selectionMode === 'none' ? inputValue : selectedValue;\n validation.commit(valueToValidate);\n }\n },\n onCompositionStart(event) {\n if (platform.os.android) {\n return;\n }\n isComposingRef.current = true;\n setComposingValue(event.currentTarget.value);\n },\n onCompositionEnd(event) {\n isComposingRef.current = false;\n const next = event.currentTarget.value;\n setComposingValue(null);\n store.context.setInputValue(next, createChangeEventDetails(REASONS.inputChange, event.nativeEvent));\n },\n onChange(event) {\n const nativeEvent = event.nativeEvent;\n // Autofill may not provide `inputType` (Chrome) or may report\n // `insertReplacementText` (Firefox).\n const inputType = nativeEvent.inputType;\n const autofillLikeInput = !inputType || inputType === 'insertReplacementText';\n // During composition the input is always considered typed into.\n const shouldOpenOnInput = isComposingRef.current || !autofillLikeInput;\n function maybeOpenOnInput(trimmed) {\n if (readOnly || disabled || !trimmed || !shouldOpenOnInput) {\n return;\n }\n store.context.setOpen(true, createChangeEventDetails(REASONS.inputChange, nativeEvent));\n // When autoHighlight is enabled, keep the highlight (will be set to 0 in root).\n if (!autoHighlightEnabled) {\n clearHighlight();\n }\n }\n\n // During IME composition, avoid propagating controlled updates to prevent\n // filtering the options prematurely so `Empty` won't show incorrectly.\n // We can't rely on this check for Android due to how it handles composition\n // events with some keyboards (e.g. Samsung keyboard with predictive text on\n // treats all text as always-composing).\n // https://github.com/mui/base-ui/issues/2942\n if (isComposingRef.current) {\n const nextVal = event.currentTarget.value;\n setComposingValue(nextVal);\n if (nextVal === '' && !store.state.openOnInputClick && !store.state.inputInsidePopup) {\n store.context.setOpen(false, createChangeEventDetails(REASONS.inputClear, nativeEvent));\n }\n const trimmed = nextVal.trim();\n const shouldMaintainHighlight = autoHighlightEnabled && trimmed !== '';\n maybeOpenOnInput(trimmed);\n if (open && store.state.activeIndex !== null && !shouldMaintainHighlight) {\n clearHighlight();\n }\n return;\n }\n const inputChangeDetails = createChangeEventDetails(REASONS.inputChange, nativeEvent);\n store.context.setInputValue(event.currentTarget.value, inputChangeDetails);\n if (inputChangeDetails.isCanceled) {\n return;\n }\n const empty = event.currentTarget.value === '';\n const clearDetails = createChangeEventDetails(REASONS.inputClear, nativeEvent);\n if (empty && !store.state.inputInsidePopup) {\n if (selectionMode === 'single') {\n store.context.setSelectedValue(null, clearDetails);\n }\n if (!store.state.openOnInputClick) {\n store.context.setOpen(false, clearDetails);\n }\n }\n maybeOpenOnInput(event.currentTarget.value.trim());\n\n // When the user types, ensure the list resets its highlight so that\n // virtual focus returns to the input (aria-activedescendant is\n // cleared).\n if (open && store.state.activeIndex !== null && !autoHighlightEnabled) {\n clearHighlight();\n }\n },\n onKeyDown(event) {\n if (event.ctrlKey || event.shiftKey || event.altKey || event.metaKey) {\n return;\n }\n\n // Tracked before the guards so `readOnly` browsing reports keyboard highlight reasons.\n store.context.keyboardActiveRef.current = true;\n if (disabled || readOnly) {\n // Browsing can highlight an item, and Enter there must not submit the form.\n if (readOnly && event.key === 'Enter' && open && store.state.activeIndex !== null) {\n stopEvent(event);\n }\n return;\n }\n const input = event.currentTarget;\n const scrollAmount = input.scrollWidth - input.clientWidth;\n const isRTL = direction === 'rtl';\n if (event.key === 'Home') {\n stopEvent(event);\n const cursor = platform.engine.gecko && isRTL ? input.value.length : 0;\n input.setSelectionRange(cursor, cursor);\n input.scrollLeft = 0;\n return;\n }\n if (event.key === 'End') {\n stopEvent(event);\n const cursor = platform.engine.gecko && isRTL ? 0 : input.value.length;\n input.setSelectionRange(cursor, cursor);\n input.scrollLeft = isRTL ? -scrollAmount : scrollAmount;\n return;\n }\n if (!mounted && event.key === 'Escape') {\n const isClear = selectionMode === 'multiple' && Array.isArray(selectedValue) ? selectedValue.length === 0 : selectedValue === null;\n const details = createChangeEventDetails(REASONS.escapeKey, event.nativeEvent);\n const value = selectionMode === 'multiple' ? [] : null;\n store.context.setInputValue('', details);\n store.context.setSelectedValue(value, details);\n if (!isClear && !store.state.inline && !details.isPropagationAllowed) {\n event.stopPropagation();\n }\n return;\n }\n\n // Handle deletion when no chip is highlighted and the input is empty.\n if (comboboxChipsContext && event.key === 'Backspace' && input.value === '' && comboboxChipsContext.highlightedChipIndex === undefined && Array.isArray(selectedValue) && selectedValue.length > 0) {\n const renderedChipsCount = comboboxChipsContext.chipsRef.current.length;\n const removalIndex = renderedChipsCount > 0 ? renderedChipsCount - 1 : selectedValue.length - 1;\n const newValue = selectedValue.filter((_, index) => index !== removalIndex);\n // If the removed item was also the active (highlighted) item, clear highlight\n clearHighlight();\n store.context.setSelectedValue(newValue, createChangeEventDetails(REASONS.none, event.nativeEvent));\n return;\n }\n const hadHighlightedChip = comboboxChipsContext?.highlightedChipIndex !== undefined;\n const nextIndex = handleKeyDown(event);\n comboboxChipsContext?.setHighlightedChipIndex(nextIndex);\n if (nextIndex !== undefined) {\n comboboxChipsContext?.chipsRef.current[nextIndex]?.focus();\n } else if (hadHighlightedChip) {\n store.context.inputRef.current?.focus();\n }\n\n // event.isComposing\n if (event.which === 229) {\n return;\n }\n if (event.key === 'Enter' && open) {\n const activeIndex = store.state.activeIndex;\n const nativeEvent = event.nativeEvent;\n if (activeIndex === null) {\n if (inline) {\n return;\n }\n\n // Allow form submission when no item is highlighted.\n store.context.setOpen(false, createChangeEventDetails(REASONS.none, nativeEvent));\n return;\n }\n stopEvent(event);\n clickHighlightedItem(store, activeIndex, nativeEvent);\n }\n },\n onPointerMove: markPointerActive,\n onPointerDown: markPointerActive\n }, validationProps],\n stateAttributesMapping: triggerStateAttributesMapping\n });\n const renderedInput = hasPositionerParent ? /*#__PURE__*/_jsx(FieldRootContext.Provider, {\n value: DEFAULT_FIELD_ROOT_CONTEXT,\n children: element\n }) : element;\n return /*#__PURE__*/_jsxs(React.Fragment, {\n children: [open && focusManagerModal && /*#__PURE__*/_jsx(ComboboxInternalDismissButton, {\n ref: store.context.startDismissRef\n }), renderedInput]\n });\n});\nif (process.env.NODE_ENV !== \"production\") ComboboxInput.displayName = \"ComboboxInput\";","import { isElement } from '@floating-ui/utils/dom';\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { getTarget, isInteractiveElement } from \"../../floating-ui-react/utils/element.mjs\";\nexport function handleInputPress(event, store, disabled, shouldIgnoreTarget) {\n if (event.baseUIHandlerPrevented) {\n return;\n }\n const target = getTarget(event.nativeEvent);\n const targetElement = isElement(target) ? target : null;\n if (targetElement !== event.currentTarget && (shouldIgnoreTarget?.(targetElement) || isInteractiveElement(targetElement))) {\n return;\n }\n event.preventDefault();\n if (disabled) {\n return;\n }\n store.context.inputRef.current?.focus();\n if (store.state.openOnInputClick) {\n store.context.setOpen(true, createChangeEventDetails(REASONS.inputPress, event.nativeEvent));\n }\n}","import { ownerWindow } from '@base-ui/utils/owner';\nimport { platform } from '@base-ui/utils/platform';\n// Tolerance around the element bounds so a fast click whose pointer drifts slightly\n// during press-release isn't mistaken for a drag-off-and-release cancellation.\n// Matches typical OS/browser drag-initiation thresholds.\nconst BOUNDARY_OFFSET = 5;\n\n/**\n * Determines if a mouse event occurred within the bounds of an element\n * (including its pseudo-elements), with a small tolerance for pointer drift.\n */\nexport function isMouseWithinBounds(event, element) {\n const bounds = getPseudoElementBounds(element);\n return event.clientX >= bounds.left - BOUNDARY_OFFSET && event.clientX <= bounds.right + BOUNDARY_OFFSET && event.clientY >= bounds.top - BOUNDARY_OFFSET && event.clientY <= bounds.bottom + BOUNDARY_OFFSET;\n}\nexport function getPseudoElementBounds(element) {\n const elementRect = element.getBoundingClientRect();\n const win = ownerWindow(element);\n\n // Avoid \"Not implemented: window.getComputedStyle(elt, pseudoElt)\" in jsdom.\n if (platform.env.jsdom) {\n return elementRect;\n }\n const beforeStyles = win.getComputedStyle(element, '::before');\n const afterStyles = win.getComputedStyle(element, '::after');\n const hasPseudoElements = beforeStyles.content !== 'none' || afterStyles.content !== 'none';\n if (!hasPseudoElements) {\n return elementRect;\n }\n\n // Get dimensions of pseudo-elements\n const beforeWidth = parseFloat(beforeStyles.width) || 0;\n const beforeHeight = parseFloat(beforeStyles.height) || 0;\n const afterWidth = parseFloat(afterStyles.width) || 0;\n const afterHeight = parseFloat(afterStyles.height) || 0;\n\n // Calculate max dimensions including pseudo-elements\n const totalWidth = Math.max(elementRect.width, beforeWidth, afterWidth);\n const totalHeight = Math.max(elementRect.height, beforeHeight, afterHeight);\n\n // Calculate the differences to extend the bounds\n const widthDiff = totalWidth - elementRect.width;\n const heightDiff = totalHeight - elementRect.height;\n return {\n left: elementRect.left - widthDiff / 2,\n right: elementRect.right + widthDiff / 2,\n top: elementRect.top - heightDiff / 2,\n bottom: elementRect.bottom + heightDiff / 2\n };\n}","'use client';\n\nimport * as React from 'react';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useTimeout } from '@base-ui/utils/useTimeout';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useButton } from \"../../internals/use-button/index.mjs\";\nimport { useComboboxFloatingContext, useComboboxInputValueContext, useComboboxRootContext } from \"../root/ComboboxRootContext.mjs\";\nimport { triggerStateAttributesMapping } from \"../utils/stateAttributesMapping.mjs\";\nimport { useFieldRootContext } from \"../../internals/field-root-context/FieldRootContext.mjs\";\nimport { useLabelableContext } from \"../../internals/labelable-provider/LabelableContext.mjs\";\nimport { stopEvent, contains, getTarget } from \"../../floating-ui-react/utils.mjs\";\nimport { isMouseWithinBounds } from \"../../utils/getPseudoElementBounds.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useClick, useTypeahead } from \"../../floating-ui-react/index.mjs\";\nimport { useLabelableId } from \"../../internals/labelable-provider/useLabelableId.mjs\";\nimport { resolveAriaLabelledBy } from \"../../utils/resolveAriaLabelledBy.mjs\";\nimport { getComboboxPopupId } from \"../root/utils/index.mjs\";\nimport { useListEmpty, usePopupSide } from \"../utils/parts.mjs\";\n\n/**\n * A button that opens the popup.\n * Renders a `<button>` element.\n *\n * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)\n */\nexport const ComboboxTrigger = /*#__PURE__*/React.forwardRef(function ComboboxTrigger(componentProps, forwardedRef) {\n const {\n render,\n className,\n nativeButton = true,\n disabled: disabledProp = false,\n id: idProp,\n style,\n ...elementProps\n } = componentProps;\n const {\n state: fieldState,\n disabled: fieldDisabled,\n setTouched,\n setFocused,\n validationMode,\n validation\n } = useFieldRootContext();\n const {\n labelId: fieldLabelId\n } = useLabelableContext();\n const store = useComboboxRootContext();\n const selectionMode = store.useState('selectionMode');\n const comboboxDisabled = store.useState('disabled');\n const readOnly = store.useState('readOnly');\n const required = store.useState('required');\n const positionerElement = store.useState('positionerElement');\n const listElement = store.useState('listElement');\n const storedPopupId = store.useState('popupId');\n const triggerProps = store.useState('triggerProps');\n const inputInsidePopup = store.useState('inputInsidePopup');\n const rootId = store.useState('id');\n const comboboxLabelId = store.useState('labelId');\n const open = store.useState('open');\n const selectedValue = store.useState('selectedValue');\n const activeIndex = store.useState('activeIndex');\n const selectedIndex = store.useState('selectedIndex');\n const hasSelectedValue = store.useState('hasSelectedValue');\n const floatingRootContext = useComboboxFloatingContext();\n const inputValue = useComboboxInputValueContext();\n const focusTimeout = useTimeout();\n const disabled = fieldDisabled || comboboxDisabled || disabledProp;\n const listEmpty = useListEmpty();\n const popupSide = usePopupSide(store);\n useLabelableId({\n id: inputInsidePopup ? idProp : undefined\n });\n const id = inputInsidePopup ? idProp ?? rootId : idProp;\n const ariaLabelledBy = resolveAriaLabelledBy(fieldLabelId, comboboxLabelId);\n let ariaControls;\n if (open && inputInsidePopup) {\n // Fall back to the default id while the popup registers its own (custom ids are stored once the\n // popup mounts), so `aria-controls` is set on the same commit `open` becomes `true`.\n ariaControls = storedPopupId ?? getComboboxPopupId(rootId);\n } else if (open) {\n ariaControls = listElement?.id;\n }\n const currentPointerTypeRef = React.useRef('');\n function trackPointerType(event) {\n currentPointerTypeRef.current = event.pointerType;\n }\n const {\n reference: triggerTypeaheadProps\n } = useTypeahead(floatingRootContext, {\n // Typeahead on a closed trigger commits a value rather than moving a highlight, so it stays\n // gated on `readOnly`.\n enabled: !open && !readOnly && !comboboxDisabled && selectionMode === 'single',\n listRef: store.context.labelsRef,\n activeIndex,\n selectedIndex,\n onMatch(index) {\n const nextSelectedValue = store.context.valuesRef.current[index];\n if (nextSelectedValue !== undefined) {\n store.context.setSelectedValue(nextSelectedValue, createChangeEventDetails(REASONS.none));\n }\n }\n });\n const {\n reference: triggerClickProps\n } = useClick(floatingRootContext, {\n enabled: !comboboxDisabled,\n event: 'mousedown'\n });\n const {\n buttonRef,\n getButtonProps\n } = useButton({\n native: nativeButton,\n disabled\n });\n const state = {\n ...fieldState,\n readOnly,\n open,\n disabled,\n popupSide,\n listEmpty,\n placeholder: selectionMode === 'none' ? false : !hasSelectedValue\n };\n const setTriggerElement = useStableCallback(element => {\n store.set('triggerElement', element);\n });\n const element = useRenderElement('button', componentProps, {\n ref: [forwardedRef, buttonRef, setTriggerElement],\n state,\n props: [triggerProps, triggerClickProps, triggerTypeaheadProps, {\n id,\n tabIndex: inputInsidePopup ? 0 : -1,\n role: inputInsidePopup ? 'combobox' : undefined,\n 'aria-expanded': open,\n 'aria-haspopup': inputInsidePopup ? 'dialog' : 'listbox',\n 'aria-controls': ariaControls,\n 'aria-required': inputInsidePopup ? required || undefined : undefined,\n // Only valid alongside the `combobox` role; without it the trigger is a plain button, and\n // the `Combobox.Input` outside the popup already carries `aria-readonly`.\n 'aria-readonly': inputInsidePopup ? readOnly || undefined : undefined,\n 'aria-labelledby': ariaLabelledBy,\n onPointerDown: trackPointerType,\n onPointerEnter: trackPointerType,\n onFocus() {\n setFocused(true);\n if (disabled) {\n return;\n }\n focusTimeout.start(0, store.context.forceMount);\n },\n onBlur(event) {\n // If focus is moving into the popup, don't count it as a blur.\n if (contains(positionerElement, event.relatedTarget)) {\n return;\n }\n setTouched(true);\n setFocused(false);\n if (validationMode === 'onBlur') {\n const valueToValidate = selectionMode === 'none' ? inputValue : selectedValue;\n validation.commit(valueToValidate);\n }\n },\n onMouseDown(event) {\n if (disabled) {\n return;\n }\n if (!inputInsidePopup) {\n floatingRootContext.set('domReferenceElement', event.currentTarget);\n }\n\n // Ensure items are registered for initial selection highlight.\n store.context.forceMount();\n if (currentPointerTypeRef.current !== 'touch') {\n store.context.inputRef.current?.focus();\n if (!inputInsidePopup) {\n event.preventDefault();\n }\n }\n if (open) {\n return;\n }\n const doc = ownerDocument(event.currentTarget);\n function handleMouseUp(mouseEvent) {\n const currentTriggerElement = store.state.triggerElement;\n if (!currentTriggerElement) {\n return;\n }\n const mouseUpTarget = getTarget(mouseEvent);\n const positioner = store.state.positionerElement;\n const list = store.state.listElement;\n if (contains(currentTriggerElement, mouseUpTarget) || contains(positioner, mouseUpTarget) || contains(list, mouseUpTarget)) {\n return;\n }\n if (isMouseWithinBounds(mouseEvent, currentTriggerElement)) {\n return;\n }\n store.context.setOpen(false, createChangeEventDetails(REASONS.cancelOpen, mouseEvent));\n }\n if (inputInsidePopup) {\n doc.addEventListener('mouseup', handleMouseUp, {\n once: true\n });\n }\n },\n onKeyDown(event) {\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n stopEvent(event);\n store.context.setOpen(true, createChangeEventDetails(REASONS.listNavigation, event.nativeEvent));\n store.context.inputRef.current?.focus();\n }\n }\n }, validation.getValidationProps(disabled, elementProps), getButtonProps],\n stateAttributesMapping: triggerStateAttributesMapping\n });\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") ComboboxTrigger.displayName = \"ComboboxTrigger\";","'use client';\n\nimport * as React from 'react';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst GroupCollectionContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") GroupCollectionContext.displayName = \"GroupCollectionContext\";\nexport function useGroupCollectionContext() {\n return React.useContext(GroupCollectionContext);\n}\nexport function GroupCollectionProvider(props) {\n const {\n children,\n items\n } = props;\n const contextValue = React.useMemo(() => ({\n items\n }), [items]);\n return /*#__PURE__*/_jsx(GroupCollectionContext.Provider, {\n value: contextValue,\n children: children\n });\n}","'use client';\n\nimport * as React from 'react';\nimport { useComboboxDerivedItemsContext } from \"../root/ComboboxRootContext.mjs\";\nimport { useGroupCollectionContext } from \"./GroupCollectionContext.mjs\";\n\n/**\n * Renders filtered list items.\n * Doesn't render its own HTML element.\n *\n * If rendering a flat list, pass a function child to the `List` component instead, which implicitly wraps it.\n *\n * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport function ComboboxCollection(props) {\n const {\n children\n } = props;\n const {\n filteredItems\n } = useComboboxDerivedItemsContext();\n const groupContext = useGroupCollectionContext();\n const itemsToRender = groupContext ? groupContext.items : filteredItems;\n return /*#__PURE__*/_jsx(React.Fragment, {\n children: itemsToRender.map(children)\n });\n}","'use client';\n\nimport * as React from 'react';\nexport const CompositeListContext = /*#__PURE__*/React.createContext({\n register: () => {},\n unregister: () => {},\n subscribeMapChange: () => () => {},\n nextIndexRef: {\n current: 0\n }\n});\nif (process.env.NODE_ENV !== \"production\") CompositeListContext.displayName = \"CompositeListContext\";\nexport function useCompositeListContext() {\n return React.useContext(CompositeListContext);\n}","/* eslint-disable no-bitwise */\n'use client';\n\nimport * as React from 'react';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { CompositeListContext } from \"./CompositeListContext.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * Provides context for a list of items in a composite component.\n */\nexport function CompositeList(props) {\n const {\n children,\n elementsRef,\n labelsRef,\n onMapChange: onMapChangeProp\n } = props;\n const onMapChange = useStableCallback(onMapChangeProp);\n const [, setMapTick] = React.useState(false);\n const listeners = useRefWithInit(createListeners).current;\n const map = useRefWithInit(createMap).current;\n const nextIndexRef = React.useRef(0);\n const isDirtyRef = React.useRef(true);\n const itemsRef = React.useRef(null);\n const mutationObserverRef = React.useRef(null);\n\n // Item effects can run without their parent rendering. Schedule one synchronous\n // parent update for the whole commit so refs are rebuilt before paint and while\n // the originating React event is still inside `act()` in tests.\n const scheduleMapUpdate = useStableCallback(() => {\n if (isDirtyRef.current) {\n return;\n }\n isDirtyRef.current = true;\n setMapTick(tick => !tick);\n });\n const register = useStableCallback((node, registration) => {\n map.set(node, registration);\n scheduleMapUpdate();\n });\n const unregister = useStableCallback(node => {\n map.delete(node);\n scheduleMapUpdate();\n });\n const syncRefs = useStableCallback(items => {\n const nextMap = new Map();\n elementsRef.current.length = 0;\n if (labelsRef) {\n labelsRef.current.length = 0;\n }\n items.forEach(item => {\n nextMap.set(item.element, {\n ...(item.registration.metadata ?? {}),\n index: item.index\n });\n elementsRef.current[item.index] = item.element;\n if (labelsRef) {\n labelsRef.current[item.index] = item.registration.label !== undefined ? item.registration.label : item.registration.textRef?.current?.textContent ?? item.element.textContent;\n }\n });\n nextIndexRef.current = elementsRef.current.length;\n return nextMap;\n });\n function observe(sortedNodes) {\n mutationObserverRef.current?.disconnect();\n mutationObserverRef.current = null;\n\n // A single item can't reorder.\n if (typeof MutationObserver !== 'function' || sortedNodes.length < 2) {\n return;\n }\n const mutationObserver = new MutationObserver(entries => {\n // Only verify the order after a move: a node that was removed and later\n // re-added within the same batch. Additions and removals alone can't\n // change the relative order of the remaining items, and items that mount\n // or unmount re-sort through `register`/`unregister`.\n if (!hasMovedNode(entries)) {\n return;\n }\n let previousConnectedNode = null;\n\n // If any connected node now appears before the previous connected node,\n // wrappers/items moved and the index map needs to be rebuilt.\n for (const node of sortedNodes) {\n if (!node.isConnected) {\n continue;\n }\n if (previousConnectedNode && sortByDocumentPosition(previousConnectedNode, node) > 0) {\n mutationObserver.disconnect();\n scheduleMapUpdate();\n return;\n }\n previousConnectedNode = node;\n }\n });\n mutationObserverRef.current = mutationObserver;\n\n // A reorder that changes item indexes must invert at least one adjacent pair\n // from the previous sorted order. Observing each pair's common parent catches\n // both direct item moves and ancestor wrapper moves at the boundary.\n const roots = new Set();\n for (let i = 1; i < sortedNodes.length; i += 1) {\n const root = getCommonAncestor(sortedNodes[i - 1], sortedNodes[i]);\n if (root) {\n roots.add(root);\n }\n }\n roots.forEach(root => mutationObserver.observe(root, {\n childList: true\n }));\n }\n const flush = useStableCallback(() => {\n const [items, automaticNodes] = getCompositeListSnapshot(map);\n const nextMap = syncRefs(items);\n const previousItems = itemsRef.current;\n const changed = !previousItems || previousItems.length !== items.length || items.some((item, index) => {\n const previousItem = previousItems[index];\n return item.index !== previousItem.index || item.element !== previousItem.element || item.registration.index !== previousItem.registration.index || item.registration.metadata !== previousItem.registration.metadata;\n });\n observe(automaticNodes);\n itemsRef.current = items;\n isDirtyRef.current = false;\n if (!changed) {\n return;\n }\n listeners.forEach(listener => listener(nextMap));\n onMapChange(nextMap);\n });\n useIsoLayoutEffect(() => {\n // Re-copy the last committed snapshot when the ref objects change or Strict Mode replays\n // effects without reattaching callback refs.\n if (!isDirtyRef.current && itemsRef.current) {\n syncRefs(itemsRef.current);\n }\n return () => {\n elementsRef.current = [];\n if (labelsRef) {\n labelsRef.current = [];\n }\n };\n }, [elementsRef, labelsRef, syncRefs]);\n useIsoLayoutEffect(() => {\n if (isDirtyRef.current) {\n flush();\n }\n });\n useIsoLayoutEffect(() => {\n return () => {\n mutationObserverRef.current?.disconnect();\n // React 18 Strict Mode replays effects without replaying callback refs.\n // Mark the retained map dirty so the replay rebuilds refs and observation.\n isDirtyRef.current = true;\n };\n }, []);\n const subscribeMapChange = useStableCallback(fn => {\n listeners.add(fn);\n return () => {\n listeners.delete(fn);\n };\n });\n const contextValue = React.useMemo(() => ({\n register,\n unregister,\n subscribeMapChange,\n nextIndexRef\n }), [register, unregister, subscribeMapChange, nextIndexRef]);\n return /*#__PURE__*/_jsx(CompositeListContext.Provider, {\n value: contextValue,\n children: children\n });\n}\nfunction createMap() {\n return new Map();\n}\nfunction createListeners() {\n return new Set();\n}\nfunction getCompositeListSnapshot(map) {\n const reservedIndices = new Set();\n const items = [];\n const automaticItems = [];\n map.forEach((registration, node) => {\n if (!node.isConnected) {\n return;\n }\n const index = registration.index;\n const item = {\n index: index ?? -1,\n element: node,\n registration\n };\n if (index === null) {\n automaticItems.push(item);\n } else if (index >= 0) {\n reservedIndices.add(index);\n items.push(item);\n }\n });\n let nextAutomaticIndex = 0;\n automaticItems.sort((a, b) => sortByDocumentPosition(a.element, b.element));\n automaticItems.forEach(item => {\n while (reservedIndices.has(nextAutomaticIndex)) {\n nextAutomaticIndex += 1;\n }\n item.index = nextAutomaticIndex;\n items.push(item);\n nextAutomaticIndex += 1;\n });\n if (reservedIndices.size > 0) {\n items.sort((a, b) => a.index - b.index);\n }\n return [items, automaticItems.map(item => item.element)];\n}\nfunction getCommonAncestor(firstNode, lastNode) {\n let ancestor = firstNode.parentElement;\n\n // The `parentElement` walk cannot cross shadow boundaries, so the native\n // `contains` is sufficient here.\n while (ancestor && !ancestor.contains(lastNode)) {\n ancestor = ancestor.parentElement;\n }\n return ancestor;\n}\nfunction hasMovedNode(entries) {\n for (const entry of entries) {\n for (let i = 0; i < entry.removedNodes.length; i += 1) {\n if (entry.removedNodes[i].isConnected) {\n return true;\n }\n }\n }\n return false;\n}\nfunction sortByDocumentPosition(a, b) {\n // `DOCUMENT_POSITION_CONTAINED_BY` is always reported alongside `FOLLOWING`, and `CONTAINS`\n // alongside `PRECEDING`, so testing `FOLLOWING` alone orders siblings and nested items alike.\n return a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;\n}","'use client';\n\nimport * as React from 'react';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useComboboxDerivedItemsContext, useComboboxFloatingContext, useComboboxRootContext } from \"../root/ComboboxRootContext.mjs\";\nimport { useComboboxPositionerContext } from \"../positioner/ComboboxPositionerContext.mjs\";\nimport { ComboboxCollection } from \"../collection/ComboboxCollection.mjs\";\nimport { CompositeList } from \"../../internals/composite/list/CompositeList.mjs\";\nimport { stopEvent } from \"../../floating-ui-react/utils.mjs\";\nimport { clickHighlightedItem } from \"../utils/parts.mjs\";\n\n/**\n * A list container for the items.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const ComboboxList = /*#__PURE__*/React.forwardRef(function ComboboxList(componentProps, forwardedRef) {\n var _ComboboxCollection;\n const {\n render,\n className,\n style,\n children,\n ...elementProps\n } = componentProps;\n const store = useComboboxRootContext();\n const floatingRootContext = useComboboxFloatingContext();\n const hasPositionerContext = Boolean(useComboboxPositionerContext(true));\n const {\n filteredItems,\n hasItems\n } = useComboboxDerivedItemsContext();\n const selectionMode = store.useState('selectionMode');\n const grid = store.useState('grid');\n const readOnly = store.useState('readOnly');\n const listProps = store.useState('listProps');\n const virtualized = store.useState('virtualized');\n const forceMounted = store.useState('forceMounted');\n const multiple = selectionMode === 'multiple';\n const empty = filteredItems.length === 0;\n const setPositionerElement = useStableCallback(element => {\n store.set('positionerElement', element);\n });\n const setListElement = useStableCallback(element => {\n store.set('listElement', element);\n });\n\n // Support \"closed template\" API: if children is a function, implicitly wrap it\n // with a Combobox.Collection that reads items from context/root.\n // Ensures this component's `listProps` subscription does not cause <Combobox.Item>\n // to re-render on every active index change.\n const resolvedChildren = React.useMemo(() => {\n if (typeof children === 'function') {\n return _ComboboxCollection || (_ComboboxCollection = /*#__PURE__*/_jsx(ComboboxCollection, {\n children: children\n }));\n }\n return children;\n }, [children]);\n const state = {\n empty\n };\n const floatingId = floatingRootContext.useState('floatingId');\n const element = useRenderElement('div', componentProps, {\n state,\n ref: [forwardedRef, setListElement, hasPositionerContext ? null : setPositionerElement],\n props: [listProps, {\n children: resolvedChildren,\n tabIndex: -1,\n id: floatingId,\n role: grid ? 'grid' : 'listbox',\n 'aria-multiselectable': multiple ? 'true' : undefined,\n // On a grid the attribute describes cell editability, not selection, so it's left to the\n // combobox element in that mode.\n 'aria-readonly': !grid && readOnly ? true : undefined,\n onKeyDown(event) {\n if (store.state.disabled || store.state.readOnly) {\n return;\n }\n if (event.key === 'Enter') {\n const activeIndex = store.state.activeIndex;\n if (activeIndex == null) {\n // Allow form submission when no item is highlighted.\n return;\n }\n stopEvent(event);\n clickHighlightedItem(store, activeIndex, event.nativeEvent);\n }\n },\n onKeyDownCapture() {\n store.context.keyboardActiveRef.current = true;\n },\n onPointerMoveCapture() {\n store.context.keyboardActiveRef.current = false;\n }\n }, elementProps]\n });\n if (virtualized) {\n return element;\n }\n\n // With the `items` prop, typeahead labels are derived from the items so they survive the list\n // unmounting (unmounting clears the registered labels). Rendered labels only need to be\n // registered when the list is force-mounted to match browser autofill against rendered text.\n const labelsRef = hasItems && !forceMounted ? undefined : store.context.labelsRef;\n return /*#__PURE__*/_jsx(CompositeList, {\n elementsRef: store.context.listRef,\n labelsRef: labelsRef,\n children: element\n });\n});\nif (process.env.NODE_ENV !== \"production\") ComboboxList.displayName = \"ComboboxList\";","'use client';\n\nimport * as React from 'react';\nimport { platform } from '@base-ui/utils/platform';\nimport { useTimeout } from '@base-ui/utils/useTimeout';\n\n// Word Joiner is invisible and zero-width, so it forces a text mutation without shifting layout.\nconst LIVE_REGION_MARKER = '\\u2060';\n// Safari VoiceOver needed roughly 200ms to reliably notice the initial polite live-region change.\nexport const INITIAL_LIVE_REGION_TEXT_MUTATION_RESET_DELAY = 200;\nfunction findLastTextNode(root) {\n const walker = root.ownerDocument.createTreeWalker(root, NodeFilter.SHOW_TEXT);\n let lastTextNode = null;\n while (walker.nextNode()) {\n const textNode = walker.currentNode;\n if (textNode.nodeValue !== '') {\n lastTextNode = textNode;\n }\n }\n return lastTextNode;\n}\nexport function useInitialLiveRegionTextMutation() {\n const timeout = useTimeout();\n const rootRef = React.useRef(null);\n\n // Only the initial mounted announcement needs the marker; later text updates announce naturally.\n React.useEffect(() => {\n if (platform.os.ios) {\n return undefined;\n }\n const root = rootRef.current;\n if (root == null) {\n return undefined;\n }\n const textNode = findLastTextNode(root);\n if (textNode == null) {\n return undefined;\n }\n const originalValue = textNode.data;\n const markedValue = `${originalValue}${LIVE_REGION_MARKER}`;\n textNode.nodeValue = markedValue;\n timeout.start(INITIAL_LIVE_REGION_TEXT_MUTATION_RESET_DELAY, () => {\n if (textNode.nodeValue === markedValue) {\n textNode.nodeValue = originalValue;\n }\n });\n return () => {\n timeout.clear();\n if (textNode.nodeValue === markedValue) {\n textNode.nodeValue = originalValue;\n }\n };\n }, [rootRef, timeout]);\n return rootRef;\n}","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const ComboboxPortalContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") ComboboxPortalContext.displayName = \"ComboboxPortalContext\";\nexport function useComboboxPortalContext() {\n const context = React.useContext(ComboboxPortalContext);\n if (context === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: <Combobox.Portal> is missing.' : _formatErrorMessage(20));\n }\n return context;\n}","'use client';\n\nimport * as React from 'react';\nimport { FloatingPortal } from \"../../floating-ui-react/index.mjs\";\nimport { useComboboxRootContext } from \"../root/ComboboxRootContext.mjs\";\nimport { ComboboxPortalContext } from \"./ComboboxPortalContext.mjs\";\n\n/**\n * A portal element that moves the popup to a different part of the DOM.\n * By default, the portal element is appended to `<body>`.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const ComboboxPortal = /*#__PURE__*/React.forwardRef(function ComboboxPortal(props, forwardedRef) {\n const {\n keepMounted = false,\n ...portalProps\n } = props;\n const store = useComboboxRootContext();\n const mounted = store.useState('mounted');\n const forceMounted = store.useState('forceMounted');\n const shouldRender = mounted || keepMounted || forceMounted;\n if (!shouldRender) {\n return null;\n }\n return /*#__PURE__*/_jsx(ComboboxPortalContext.Provider, {\n value: keepMounted,\n children: /*#__PURE__*/_jsx(FloatingPortal, {\n ref: forwardedRef,\n ...portalProps\n })\n });\n});\nif (process.env.NODE_ENV !== \"production\") ComboboxPortal.displayName = \"ComboboxPortal\";","import { isReactVersionAtLeast } from \"./reactVersion.mjs\";\nexport function inertValue(value) {\n if (isReactVersionAtLeast(19)) {\n return value;\n }\n // compatibility with React < 19\n return value ? 'true' : undefined;\n}","import { clamp, evaluate, getAlignment, getAlignmentAxis, getAxisLength, getPaddingObject } from '@floating-ui/utils';\n/**\n * Fork of the original `arrow` middleware from Floating UI that allows\n * configuring the offset parent.\n */\nexport const baseArrow = options => ({\n name: 'arrow',\n options,\n async fn(state) {\n const {\n x,\n y,\n placement,\n rects,\n platform,\n elements,\n middlewareData\n } = state;\n // Since `element` is required, we don't Partial<> the type.\n const {\n element,\n padding = 0,\n offsetParent = 'real'\n } = evaluate(options, state) || {};\n if (element == null) {\n return {};\n }\n const paddingObject = getPaddingObject(padding);\n const coords = {\n x,\n y\n };\n const axis = getAlignmentAxis(placement);\n const length = getAxisLength(axis);\n const arrowDimensions = await platform.getDimensions(element);\n const isYAxis = axis === 'y';\n const minProp = isYAxis ? 'top' : 'left';\n const maxProp = isYAxis ? 'bottom' : 'right';\n const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';\n const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];\n const startDiff = coords[axis] - rects.reference[axis];\n const arrowOffsetParent = offsetParent === 'real' ? await platform.getOffsetParent?.(element) : elements.floating;\n let clientSize = elements.floating[clientProp] || rects.floating[length];\n\n // DOM platform can return `window` as the `offsetParent`.\n if (!clientSize || !(await platform.isElement?.(arrowOffsetParent))) {\n clientSize = elements.floating[clientProp] || rects.floating[length];\n }\n const centerToReference = endDiff / 2 - startDiff / 2;\n\n // If the padding is large enough that it causes the arrow to no longer be\n // centered, modify the padding so that it is centered.\n const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;\n const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding);\n const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding);\n\n // Make sure the arrow doesn't overflow the floating element if the center\n // point is outside the floating element's bounds.\n const min = minPadding;\n const max = clientSize - arrowDimensions[length] - maxPadding;\n const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;\n const offset = clamp(min, center, max);\n\n // If the reference is small enough that the arrow's padding causes it to\n // to point to nothing for an aligned placement, adjust the offset of the\n // floating element itself. To ensure `shift()` continues to take action,\n // a single reset is performed when this is true.\n const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;\n // eslint-disable-next-line no-nested-ternary\n const alignmentOffset = shouldAddOffset ? center < min ? center - min : center - max : 0;\n return {\n [axis]: coords[axis] + alignmentOffset,\n data: {\n [axis]: offset,\n centerOffset: center - offset - alignmentOffset,\n ...(shouldAddOffset && {\n alignmentOffset\n })\n },\n reset: shouldAddOffset\n };\n }\n});\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * This wraps the core `arrow` middleware to allow React refs as the element.\n * @see https://floating-ui.com/docs/arrow\n */\nexport const arrow = (options, deps) => {\n const {\n name,\n fn\n } = baseArrow(options);\n return {\n name,\n fn,\n options: [options, deps]\n };\n};","export const hide = {\n name: 'hide',\n async fn(state) {\n const {\n width,\n height,\n x,\n y\n } = state.rects.reference;\n const anchorHidden = width === 0 && height === 0 && x === 0 && y === 0;\n // Mirrors Floating UI's `hide()` referenceHidden strategy. Floating UI injects\n // `detectOverflow` into the middleware platform before invoking middleware.\n const overflow = await state.platform.detectOverflow(state, {\n elementContext: 'reference'\n });\n const referenceHidden = overflow.top - height >= 0 || overflow.right - width >= 0 || overflow.bottom - height >= 0 || overflow.left - width >= 0;\n return {\n data: {\n referenceHidden: referenceHidden || anchorHidden\n }\n };\n }\n};","export const DEFAULT_SIDES = {\n sideX: 'left',\n sideY: 'top'\n};\n\n// Self-contained stand-in for Floating UI's `Middleware` type. Referencing the real type in\n// store state makes `tsc` declaration emit reference `Platform`/`detectOverflow` from\n// `@floating-ui/core` internals, which fails as non-portable (TS2883) in consuming builds.","/**\n * The available width between the trigger and the edge of the viewport.\n * @type {number}\n */\nexport const availableWidth = '--available-width';\n/**\n * The available height between the trigger and the edge of the viewport.\n * @type {number}\n */\nexport const availableHeight = '--available-height';\n/**\n * The anchor's width.\n * @type {number}\n */\nexport const anchorWidth = '--anchor-width';\n/**\n * The anchor's height.\n * @type {number}\n */\nexport const anchorHeight = '--anchor-height';\n/**\n * The coordinates that this element is anchored to. Used for animations and transitions.\n * @type {string}\n */\nexport const transformOrigin = '--transform-origin';\n/**\n * The width of the popup's positioner.\n * It is important to set `width` to this value when using CSS to animate size changes.\n * @type {number}\n */\nexport const positionerWidth = '--positioner-width';\n/**\n * The height of the popup's positioner.\n * It is important to set `height` to this value when using CSS to animate size changes.\n * @type {number}\n */\nexport const positionerHeight = '--positioner-height';","'use client';\n\nimport * as React from 'react';\nimport { getSide, getAlignment, getSideAxis } from '@floating-ui/utils';\nimport { ownerDocument, ownerWindow } from '@base-ui/utils/owner';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { autoUpdate, flip, limitShift, offset, shift as floatingShift, size } from \"../floating-ui-react/index.mjs\";\nimport { useBaseUIFloating } from \"../floating-ui-react/hooks/useFloating.mjs\";\nimport { useDirection } from \"./direction-context/DirectionContext.mjs\";\nimport { arrow } from \"../floating-ui-react/middleware/arrow.mjs\";\nimport { hide } from \"../utils/hideMiddleware.mjs\";\nimport { DEFAULT_SIDES } from \"../utils/adaptiveOriginConstants.mjs\";\nimport * as CommonPositionerCssVars from \"../utils/CommonPositionerCssVars.mjs\";\nconst AVAILABLE_WIDTH_VAR = CommonPositionerCssVars.availableWidth;\nconst AVAILABLE_HEIGHT_VAR = CommonPositionerCssVars.availableHeight;\nfunction getLogicalSide(sideParam, renderedSide, isRtl) {\n const isLogicalSideParam = sideParam === 'inline-start' || sideParam === 'inline-end';\n const logicalRight = isRtl ? 'inline-start' : 'inline-end';\n const logicalLeft = isRtl ? 'inline-end' : 'inline-start';\n return {\n top: 'top',\n right: isLogicalSideParam ? logicalRight : 'right',\n bottom: 'bottom',\n left: isLogicalSideParam ? logicalLeft : 'left'\n }[renderedSide];\n}\nfunction getOffsetData(state, sideParam, isRtl) {\n const {\n rects,\n placement\n } = state;\n const data = {\n side: getLogicalSide(sideParam, getSide(placement), isRtl),\n align: getAlignment(placement) || 'center',\n anchor: {\n width: rects.reference.width,\n height: rects.reference.height\n },\n positioner: {\n width: rects.floating.width,\n height: rects.floating.height\n }\n };\n return data;\n}\n/**\n * Provides standardized anchor positioning behavior for floating elements. Wraps Floating UI's\n * `useFloating` hook.\n */\nexport function useAnchorPositioning(params) {\n return useAnchorPositioningWithHook(params, useBaseUIFloating);\n}\nexport function useAnchorPositioningWithHook(params, useFloatingHook) {\n const {\n // Public parameters\n anchor,\n positionMethod = 'absolute',\n side: sideParam = 'bottom',\n sideOffset = 0,\n align = 'center',\n alignOffset = 0,\n collisionBoundary,\n collisionPadding: collisionPaddingParam = 5,\n sticky = false,\n arrowPadding = 5,\n disableAnchorTracking = false,\n inline: inlineMiddleware,\n // Private parameters\n keepMounted = false,\n floatingRootContext,\n mounted,\n collisionAvoidance,\n shift,\n nodeId,\n adaptiveOrigin,\n lazyFlip = false,\n externalTree\n } = params;\n const [mountSide, setMountSide] = React.useState(null);\n if (!mounted && mountSide !== null) {\n setMountSide(null);\n }\n const collisionAvoidanceSide = collisionAvoidance.side || 'flip';\n const collisionAvoidanceAlign = collisionAvoidance.align || 'flip';\n const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || 'end';\n const shiftCrossAxis = shift?.crossAxis ?? false;\n const shiftRootBoundary = shift?.rootBoundary;\n const anchorFn = typeof anchor === 'function' ? anchor : undefined;\n const anchorFnCallback = useStableCallback(anchorFn);\n const anchorDep = anchorFn ? anchorFnCallback : anchor;\n const anchorValueRef = useValueAsRef(anchor);\n const mountedRef = useValueAsRef(mounted);\n const direction = useDirection();\n const isRtl = direction === 'rtl';\n const side = mountSide || {\n top: 'top',\n right: 'right',\n bottom: 'bottom',\n left: 'left',\n 'inline-end': isRtl ? 'left' : 'right',\n 'inline-start': isRtl ? 'right' : 'left'\n }[sideParam];\n const placement = align === 'center' ? side : `${side}-${align}`;\n let collisionPadding = collisionPaddingParam;\n if (typeof collisionPadding === 'number') {\n collisionPadding = {\n top: collisionPadding,\n right: collisionPadding,\n bottom: collisionPadding,\n left: collisionPadding\n };\n } else if (collisionPadding) {\n collisionPadding = {\n top: collisionPadding.top || 0,\n right: collisionPadding.right || 0,\n bottom: collisionPadding.bottom || 0,\n left: collisionPadding.left || 0\n };\n }\n\n // Create a bias to the preferred side.\n // On iOS, when the mobile software keyboard opens, the input is exactly centered\n // in the viewport, but this can cause it to flip to the top undesirably.\n // The bias is only applied to `flip()` so it doesn't shift the resting position\n // computed by `shift()` and `size()` away from the requested `collisionPadding`.\n const bias = 1;\n const biasTop = sideParam === 'bottom' ? bias : 0;\n const biasBottom = sideParam === 'top' ? bias : 0;\n const biasLeft = sideParam === 'right' ? bias : 0;\n const biasRight = sideParam === 'left' ? bias : 0;\n const commonCollisionProps = {\n boundary: collisionBoundary === 'clipping-ancestors' ? 'clippingAncestors' : collisionBoundary,\n padding: collisionPadding\n };\n\n // Using a ref assumes that the arrow element is always present in the DOM for the lifetime of the\n // popup. If this assumption ends up being false, we can switch to state to manage the arrow's\n // presence.\n const arrowRef = React.useRef(null);\n\n // Keep these reactive if they're not functions\n const sideOffsetRef = useValueAsRef(sideOffset);\n const alignOffsetRef = useValueAsRef(alignOffset);\n const sideOffsetDep = typeof sideOffset !== 'function' ? sideOffset : 0;\n const alignOffsetDep = typeof alignOffset !== 'function' ? alignOffset : 0;\n const middleware = [];\n if (inlineMiddleware) {\n middleware.push(inlineMiddleware);\n }\n middleware.push(offset(state => {\n const data = getOffsetData(state, sideParam, isRtl);\n const sideAxis = typeof sideOffsetRef.current === 'function' ? sideOffsetRef.current(data) : sideOffsetRef.current;\n const alignAxis = typeof alignOffsetRef.current === 'function' ? alignOffsetRef.current(data) : alignOffsetRef.current;\n return {\n mainAxis: sideAxis,\n crossAxis: alignAxis,\n alignmentAxis: alignAxis\n };\n }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam]));\n const shiftDisabled = collisionAvoidanceAlign === 'none' && collisionAvoidanceSide !== 'shift';\n const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === 'shift');\n const flipMiddleware = collisionAvoidanceSide === 'none' ? null : flip({\n ...commonCollisionProps,\n // Ensure the popup flips if it's been limited by its --available-height and it resizes.\n // Since the size() padding is smaller than the flip() padding, flip() will take precedence.\n padding: {\n top: collisionPadding.top + bias + biasTop,\n right: collisionPadding.right + bias + biasRight,\n bottom: collisionPadding.bottom + bias + biasBottom,\n left: collisionPadding.left + bias + biasLeft\n },\n mainAxis: !shiftCrossAxis && collisionAvoidanceSide === 'flip',\n crossAxis: collisionAvoidanceAlign === 'flip' ? 'alignment' : false,\n fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide\n });\n const shiftMiddleware = shiftDisabled ? null : floatingShift({\n ...commonCollisionProps,\n // Use the Layout Viewport to avoid shifting around when pinch-zooming.\n rootBoundary: shiftRootBoundary,\n mainAxis: collisionAvoidanceAlign !== 'none',\n crossAxis: crossAxisShiftEnabled,\n limiter: sticky || shiftCrossAxis ? undefined : limitShift(limitData => {\n if (!arrowRef.current) {\n return {};\n }\n const {\n width,\n height\n } = arrowRef.current.getBoundingClientRect();\n const sideAxis = getSideAxis(getSide(limitData.placement));\n const arrowSize = sideAxis === 'y' ? width : height;\n const offsetAmount = sideAxis === 'y' ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom;\n return {\n offset: arrowSize / 2 + offsetAmount / 2\n };\n })\n }, [commonCollisionProps, sticky, shiftCrossAxis, shiftRootBoundary, collisionPadding, collisionAvoidanceAlign]);\n\n // https://floating-ui.com/docs/flip#combining-with-shift\n if (collisionAvoidanceSide === 'shift' || collisionAvoidanceAlign === 'shift' || align === 'center') {\n middleware.push(shiftMiddleware, flipMiddleware);\n } else {\n middleware.push(flipMiddleware, shiftMiddleware);\n }\n middleware.push(size({\n ...commonCollisionProps,\n apply({\n elements: {\n floating\n },\n availableWidth,\n availableHeight,\n rects\n }) {\n if (!mountedRef.current) {\n return;\n }\n const floatingStyle = floating.style;\n floatingStyle.setProperty(AVAILABLE_WIDTH_VAR, `${availableWidth}px`);\n floatingStyle.setProperty(AVAILABLE_HEIGHT_VAR, `${availableHeight}px`);\n\n // Snap anchor dimensions to device pixels to ensure the popup's visual width matches the anchor's one.\n const dpr = ownerWindow(floating).devicePixelRatio || 1;\n const {\n x,\n y,\n width,\n height\n } = rects.reference;\n const anchorWidth = (Math.round((x + width) * dpr) - Math.round(x * dpr)) / dpr;\n const anchorHeight = (Math.round((y + height) * dpr) - Math.round(y * dpr)) / dpr;\n floatingStyle.setProperty(CommonPositionerCssVars.anchorWidth, `${anchorWidth}px`);\n floatingStyle.setProperty(CommonPositionerCssVars.anchorHeight, `${anchorHeight}px`);\n }\n }), arrow(state => ({\n // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set,\n // we'll create a fake element.\n element: arrowRef.current || ownerDocument(state.elements.floating).createElement('div'),\n // No padding for the fake arrow: it would displace aligned popups on narrow anchors.\n padding: arrowRef.current ? arrowPadding : 0,\n offsetParent: 'floating'\n }), [arrowPadding]), {\n name: 'transformOrigin',\n fn(state) {\n const {\n elements: {\n floating\n },\n middlewareData,\n placement: renderedPlacement,\n platform,\n rects,\n y\n } = state;\n const renderedSide = getSide(renderedPlacement);\n const renderedAlign = getAlignment(renderedPlacement);\n const isVertical = getSideAxis(renderedSide) === 'y';\n const arrowEl = arrowRef.current;\n const sideOffsetValue = typeof sideOffset === 'function' ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset;\n\n // An aligned arrowless popup grows from its aligned edge, until a shift (beyond subpixel)\n // breaks its alignment with the anchor. Everything else grows from the arrow, real or fake.\n let crossOrigin;\n if (!arrowEl && renderedAlign && Math.abs(isVertical ? middlewareData.shift?.x || 0 : middlewareData.shift?.y || 0) <= 1) {\n // The platform direction, not `isRtl`: it must match what Floating UI placed with.\n crossOrigin = renderedAlign === 'start' === (isVertical && platform.isRTL?.(floating) === true) ? '100%' : '0%';\n } else {\n const arrowOffset = isVertical ? middlewareData.arrow?.x || 0 : middlewareData.arrow?.y || 0;\n const arrowSize = isVertical ? arrowEl?.clientWidth || 0 : arrowEl?.clientHeight || 0;\n crossOrigin = `${arrowOffset + arrowSize / 2}px`;\n }\n\n // Side axis: the anchor-facing edge, or the anchor's center when the popup overlaps it.\n let sideOrigin = renderedSide === 'top' || renderedSide === 'left' ? `calc(100% + ${sideOffsetValue}px)` : `${-sideOffsetValue}px`;\n if (crossAxisShiftEnabled && isVertical && Math.abs(middlewareData.shift?.y || 0) > sideOffsetValue) {\n sideOrigin = `${rects.reference.y + rects.reference.height / 2 - y}px`;\n }\n floating.style.setProperty(CommonPositionerCssVars.transformOrigin, isVertical ? `${crossOrigin} ${sideOrigin}` : `${sideOrigin} ${crossOrigin}`);\n return {};\n }\n }, hide, adaptiveOrigin);\n useIsoLayoutEffect(() => {\n // Ensure positioning doesn't run initially for `keepMounted` elements that\n // aren't initially open.\n if (!mounted && floatingRootContext) {\n floatingRootContext.update({\n referenceElement: null,\n floatingElement: null,\n domReferenceElement: null,\n positionReference: null\n });\n }\n }, [mounted, floatingRootContext]);\n const autoUpdateOptions = React.useMemo(() => ({\n ancestorScroll: !disableAnchorTracking,\n elementResize: !disableAnchorTracking && typeof ResizeObserver !== 'undefined',\n layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== 'undefined'\n }), [disableAnchorTracking]);\n const {\n refs,\n elements,\n x,\n y,\n middlewareData,\n update,\n placement: renderedPlacement,\n context,\n isPositioned,\n floatingStyles: originalFloatingStyles\n } = useFloatingHook({\n rootContext: floatingRootContext,\n open: keepMounted ? mounted : undefined,\n placement,\n middleware,\n strategy: positionMethod,\n whileElementsMounted: keepMounted ? undefined : (...args) => autoUpdate(...args, autoUpdateOptions),\n nodeId,\n externalTree\n });\n const {\n sideX,\n sideY\n } = middlewareData.adaptiveOrigin || DEFAULT_SIDES;\n\n // Default to `fixed` when not positioned to prevent `autoFocus` scroll jumps.\n // This ensures the popup is inside the viewport initially before it gets positioned.\n const resolvedPosition = isPositioned ? positionMethod : 'fixed';\n const floatingStyles = React.useMemo(() => {\n let base;\n if (!isPositioned) {\n // Until a position for the current open is computed, ignore any coordinates retained from a\n // previous open (or from a pass that measured the hidden popup as 0x0). Rendering the\n // full-size popup at such stale coordinates can overflow the layout viewport, which makes\n // mobile Chrome zoom the page out and reflow everything the popup is anchored to.\n base = {\n position: resolvedPosition,\n top: 0,\n left: 0\n };\n } else if (adaptiveOrigin) {\n base = {\n position: resolvedPosition,\n [sideX]: x,\n [sideY]: y\n };\n } else {\n base = {\n ...originalFloatingStyles,\n position: resolvedPosition\n };\n }\n\n // Seed the available size vars so consumer `max-height: min(x, var(--available-height))` rules\n // resolve to a valid length on the first positioning pass, before `size()` writes the real\n // values. Without a fallback the unresolved `var()` invalidates the whole declaration, so the\n // popup is measured unconstrained while `flip()` picks its side, against the full content\n // height rather than the capped one. Seeded unconditionally (not only while `!isPositioned`):\n // the keys must stay present with a constant value so React's per-property style diff never\n // rewrites them after mount, preserving the px values `size()` sets imperatively. Moving them\n // into the `!isPositioned` branch makes React remove them once positioned, wiping `size()`'s\n // values and leaving the popup unconstrained.\n base[AVAILABLE_WIDTH_VAR] = '100vw';\n base[AVAILABLE_HEIGHT_VAR] = '100vh';\n if (!isPositioned) {\n base.opacity = 0;\n }\n return base;\n }, [adaptiveOrigin, resolvedPosition, sideX, x, sideY, y, originalFloatingStyles, isPositioned]);\n const registeredPositionReferenceRef = React.useRef(null);\n useIsoLayoutEffect(() => {\n if (!mounted) {\n return;\n }\n const anchorValue = anchorValueRef.current;\n const resolvedAnchor = typeof anchorValue === 'function' ? anchorValue() : anchorValue;\n const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null;\n const finalAnchor = unwrappedElement || null;\n if (finalAnchor !== registeredPositionReferenceRef.current) {\n refs.setPositionReference(finalAnchor);\n registeredPositionReferenceRef.current = finalAnchor;\n }\n }, [mounted, refs, anchorDep, anchorValueRef]);\n React.useEffect(() => {\n if (!mounted) {\n return;\n }\n const anchorValue = anchorValueRef.current;\n\n // Refs from parent components are set after useLayoutEffect runs and are available in useEffect.\n // Therefore, if the anchor is a ref, we need to update the position reference in useEffect.\n if (typeof anchorValue === 'function') {\n return;\n }\n if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) {\n refs.setPositionReference(anchorValue.current);\n registeredPositionReferenceRef.current = anchorValue.current;\n }\n }, [mounted, refs, anchorDep, anchorValueRef]);\n React.useEffect(() => {\n if (keepMounted && mounted && elements.reference && elements.floating) {\n return autoUpdate(elements.reference, elements.floating, update, autoUpdateOptions);\n }\n return undefined;\n }, [keepMounted, mounted, elements, update, autoUpdateOptions]);\n const renderedSide = getSide(renderedPlacement);\n const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl);\n const renderedAlign = getAlignment(renderedPlacement) || 'center';\n const anchorHidden = Boolean(middlewareData.hide?.referenceHidden);\n\n // Locks the flip (makes it \"sticky\") so it doesn't prefer a given placement\n // and flips back lazily, not eagerly. Ideal for filtered lists that change\n // the size of the popup dynamically to avoid unwanted flipping when typing.\n useIsoLayoutEffect(() => {\n if (lazyFlip && mounted && isPositioned && renderedSide !== side) {\n setMountSide(renderedSide);\n }\n }, [lazyFlip, mounted, isPositioned, renderedSide, side]);\n const arrowStyles = React.useMemo(() => ({\n position: 'absolute',\n top: middlewareData.arrow?.y,\n left: middlewareData.arrow?.x\n }), [middlewareData.arrow]);\n const arrowUncentered = middlewareData.arrow?.centerOffset !== 0;\n return React.useMemo(() => ({\n positionerStyles: floatingStyles,\n arrowStyles,\n arrowRef,\n arrowUncentered,\n side: logicalRenderedSide,\n align: renderedAlign,\n physicalSide: renderedSide,\n anchorHidden,\n refs,\n context,\n isPositioned,\n update\n }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden, refs, context, isPositioned, update]);\n}\nfunction isRef(param) {\n return param != null && 'current' in param;\n}","import * as React from 'react';\n\n/**\n * @internal\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const InternalBackdrop = /*#__PURE__*/React.forwardRef(function InternalBackdrop(props, ref) {\n const {\n cutout,\n ...otherProps\n } = props;\n let clipPath;\n if (cutout) {\n const rect = cutout.getBoundingClientRect();\n clipPath = `polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${rect.left}px ${rect.top}px,${rect.left}px ${rect.bottom}px,${rect.right}px ${rect.bottom}px,${rect.right}px ${rect.top}px,${rect.left}px ${rect.top}px)`;\n }\n return /*#__PURE__*/_jsx(\"div\", {\n ref: ref,\n role: \"presentation\"\n // Ensures Floating UI's outside press detection runs, as it considers\n // it an element that existed when the popup rendered.\n ,\n \"data-base-ui-inert\": \"\",\n ...otherProps,\n style: {\n position: 'fixed',\n inset: 0,\n userSelect: 'none',\n WebkitUserSelect: 'none',\n clipPath\n }\n });\n});\nif (process.env.NODE_ENV !== \"production\") InternalBackdrop.displayName = \"InternalBackdrop\";","import { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { DISABLED_TRANSITIONS_STYLE } from \"./constants.mjs\";\nexport function getDisabledMountTransitionStyles(transitionStatus) {\n return transitionStatus === 'starting' ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT;\n}","'use client';\n\nimport { popupStateMapping } from \"./popupStateMapping.mjs\";\nimport { useRenderElement } from \"../internals/useRenderElement.mjs\";\nimport { getDisabledMountTransitionStyles } from \"../internals/getDisabledMountTransitionStyles.mjs\";\n/**\n * Renders the shared outer Positioner element used by popup components.\n * Applies the common role, hidden state, transition styles, state attributes, and optional inert styling.\n */\nexport function usePositioner(componentProps, state, {\n styles,\n transitionStatus,\n props,\n refs,\n hidden,\n inert = false\n}) {\n const style = {\n ...styles\n };\n if (inert) {\n style.pointerEvents = 'none';\n }\n return useRenderElement('div', componentProps, {\n state,\n ref: refs,\n props: [{\n role: 'presentation',\n hidden,\n style\n }, getDisabledMountTransitionStyles(transitionStatus), props],\n stateAttributesMapping: popupStateMapping\n });\n}","'use client';\n\nimport { isOverflowElement } from '@floating-ui/utils/dom';\nimport { addEventListener } from \"./addEventListener.mjs\";\nimport { platform } from \"./platform/index.mjs\";\nimport { ownerDocument, ownerWindow } from \"./owner.mjs\";\nimport { useIsoLayoutEffect } from \"./useIsoLayoutEffect.mjs\";\nimport { Timeout } from \"./useTimeout.mjs\";\nimport { AnimationFrame } from \"./useAnimationFrame.mjs\";\nlet originalHtmlStyles = {};\nlet originalBodyStyles = {};\nlet originalHtmlScrollBehavior = '';\n\n// The viewport's overflow comes from <html> when it establishes its own scroll container, and\n// propagates from <body> otherwise. An `overflow` style on the other element doesn't lock the page.\nfunction getViewportScroller(html, body) {\n return isOverflowElement(html) ? html : body;\n}\nfunction isPageScrollLocked(win, html, body) {\n return /hidden|clip/.test(win.getComputedStyle(getViewportScroller(html, body)).overflowY);\n}\nfunction hasInsetScrollbars(referenceElement) {\n if (typeof document === 'undefined') {\n return false;\n }\n const doc = ownerDocument(referenceElement);\n const win = ownerWindow(doc);\n return win.innerWidth - doc.documentElement.clientWidth > 0;\n}\nfunction supportsStableScrollbarGutter(referenceElement) {\n const supported = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('scrollbar-gutter', 'stable');\n if (!supported || typeof document === 'undefined') {\n return false;\n }\n const doc = ownerDocument(referenceElement);\n const html = doc.documentElement;\n const body = doc.body;\n const scrollContainer = getViewportScroller(html, body);\n const originalScrollContainerOverflowY = scrollContainer.style.overflowY;\n const originalHtmlStyleGutter = html.style.scrollbarGutter;\n html.style.scrollbarGutter = 'stable';\n scrollContainer.style.overflowY = 'scroll';\n const before = scrollContainer.offsetWidth;\n scrollContainer.style.overflowY = 'hidden';\n const after = scrollContainer.offsetWidth;\n scrollContainer.style.overflowY = originalScrollContainerOverflowY;\n html.style.scrollbarGutter = originalHtmlStyleGutter;\n return before === after;\n}\nfunction preventScrollOverlayScrollbars(referenceElement) {\n const doc = ownerDocument(referenceElement);\n const html = doc.documentElement;\n const body = doc.body;\n\n // If an `overflow` style is present on <html>, we need to lock it, because a lock on <body>\n // won't have any effect.\n // But if <body> has an `overflow` style (like `overflow-x: hidden`), we need to lock it\n // instead, as sticky elements shift otherwise.\n const elementToLock = getViewportScroller(html, body);\n const originalElementToLockStyles = {\n overflowY: elementToLock.style.overflowY,\n overflowX: elementToLock.style.overflowX\n };\n Object.assign(elementToLock.style, {\n overflowY: 'hidden',\n overflowX: 'hidden'\n });\n return () => {\n Object.assign(elementToLock.style, originalElementToLockStyles);\n };\n}\nfunction preventScrollInsetScrollbars(referenceElement) {\n const doc = ownerDocument(referenceElement);\n const html = doc.documentElement;\n const body = doc.body;\n const win = ownerWindow(html);\n let scrollTop = 0;\n let scrollLeft = 0;\n let updateGutterOnly = false;\n const resizeFrame = AnimationFrame.create();\n\n // Pinch-zoom in Safari causes a shift. Just don't lock scroll if there's any pinch-zoom.\n if (platform.engine.webkit && (win.visualViewport?.scale ?? 1) !== 1) {\n return () => {};\n }\n function lockScroll() {\n /* DOM reads: */\n\n const htmlStyles = win.getComputedStyle(html);\n const bodyStyles = win.getComputedStyle(body);\n const htmlScrollbarGutterValue = htmlStyles.scrollbarGutter || '';\n const hasBothEdges = htmlScrollbarGutterValue.includes('both-edges');\n const scrollbarGutterValue = hasBothEdges ? 'stable both-edges' : 'stable';\n scrollTop = html.scrollTop;\n scrollLeft = html.scrollLeft;\n originalHtmlStyles = {\n scrollbarGutter: html.style.scrollbarGutter,\n overflowY: html.style.overflowY,\n overflowX: html.style.overflowX\n };\n originalHtmlScrollBehavior = html.style.scrollBehavior;\n originalBodyStyles = {\n position: body.style.position,\n height: body.style.height,\n width: body.style.width,\n boxSizing: body.style.boxSizing,\n overflowY: body.style.overflowY,\n overflowX: body.style.overflowX,\n scrollBehavior: body.style.scrollBehavior\n };\n const isScrollableY = html.scrollHeight > html.clientHeight;\n const isScrollableX = html.scrollWidth > html.clientWidth;\n const hasConstantOverflowY = htmlStyles.overflowY === 'scroll' || bodyStyles.overflowY === 'scroll';\n const hasConstantOverflowX = htmlStyles.overflowX === 'scroll' || bodyStyles.overflowX === 'scroll';\n\n // Values can be negative in Firefox\n const scrollbarWidth = Math.max(0, win.innerWidth - body.clientWidth);\n const scrollbarHeight = Math.max(0, win.innerHeight - body.clientHeight);\n\n // Avoid shift due to the default <body> margin. This does cause elements to be clipped\n // with whitespace. Warn if <body> has margins?\n const marginY = parseFloat(bodyStyles.marginTop) + parseFloat(bodyStyles.marginBottom);\n const marginX = parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight);\n const elementToLock = getViewportScroller(html, body);\n updateGutterOnly = supportsStableScrollbarGutter(referenceElement);\n\n /*\n * DOM writes:\n * Do not read the DOM past this point!\n */\n\n if (updateGutterOnly) {\n html.style.scrollbarGutter = scrollbarGutterValue;\n elementToLock.style.overflowY = 'hidden';\n elementToLock.style.overflowX = 'hidden';\n return;\n }\n Object.assign(html.style, {\n scrollbarGutter: scrollbarGutterValue,\n overflowY: 'hidden',\n overflowX: 'hidden'\n });\n if (isScrollableY || hasConstantOverflowY) {\n html.style.overflowY = 'scroll';\n }\n if (isScrollableX || hasConstantOverflowX) {\n html.style.overflowX = 'scroll';\n }\n Object.assign(body.style, {\n position: 'relative',\n height: marginY || scrollbarHeight ? `calc(100dvh - ${marginY + scrollbarHeight}px)` : '100dvh',\n width: marginX || scrollbarWidth ? `calc(100vw - ${marginX + scrollbarWidth}px)` : '100vw',\n boxSizing: 'border-box',\n // Assign the longhands that `cleanup` restores, so nothing is left behind.\n overflowY: 'hidden',\n overflowX: 'hidden',\n scrollBehavior: 'unset'\n });\n body.scrollTop = scrollTop;\n body.scrollLeft = scrollLeft;\n html.setAttribute('data-base-ui-scroll-locked', '');\n html.style.scrollBehavior = 'unset';\n }\n function cleanup() {\n Object.assign(html.style, originalHtmlStyles);\n Object.assign(body.style, originalBodyStyles);\n if (!updateGutterOnly) {\n html.scrollTop = scrollTop;\n html.scrollLeft = scrollLeft;\n html.removeAttribute('data-base-ui-scroll-locked');\n html.style.scrollBehavior = originalHtmlScrollBehavior;\n }\n }\n function handleResize() {\n cleanup();\n resizeFrame.request(lockScroll);\n }\n lockScroll();\n const unsubscribeResize = addEventListener(win, 'resize', handleResize);\n return () => {\n resizeFrame.cancel();\n cleanup();\n // Sometimes this cleanup can run after test teardown because it is called\n // in a `setTimeout(fn, 0)`. Guard the returned cleanup to avoid calling\n // `removeEventListener` when it is no longer available in tests.\n if (typeof win.removeEventListener === 'function') {\n unsubscribeResize();\n }\n };\n}\nclass ScrollLocker {\n lockCount = 0;\n restore = null;\n timeoutLock = Timeout.create();\n timeoutUnlock = Timeout.create();\n acquire(referenceElement) {\n this.lockCount += 1;\n if (this.lockCount === 1 && this.restore === null) {\n this.timeoutLock.start(0, () => this.lock(referenceElement));\n }\n return this.release;\n }\n release = () => {\n this.lockCount -= 1;\n if (this.lockCount === 0 && this.restore) {\n this.timeoutUnlock.start(0, this.unlock);\n }\n };\n unlock = () => {\n if (this.lockCount === 0 && this.restore) {\n this.restore?.();\n this.restore = null;\n }\n };\n lock(referenceElement) {\n if (this.lockCount === 0 || this.restore !== null) {\n return;\n }\n const doc = ownerDocument(referenceElement);\n const html = doc.documentElement;\n const body = doc.body;\n const win = ownerWindow(html);\n\n // The page is already locked, either by the site author or by a non-Base UI overlay that\n // hasn't cleaned up yet. Leave it alone and wait for the lock to clear before taking over,\n // otherwise we'd snapshot the locked state and restore it after our own lock is released.\n if (isPageScrollLocked(win, html, body)) {\n const observer = new win.MutationObserver(() => {\n if (isPageScrollLocked(win, html, body)) {\n return;\n }\n observer.disconnect();\n this.restore = null;\n this.lock(referenceElement);\n });\n\n // Watch every attribute: locks are applied through inline styles, classes, or attributes\n // paired with a stylesheet (`data-scroll-locked` in react-remove-scroll, for example).\n const options = {\n attributes: true\n };\n observer.observe(html, options);\n observer.observe(body, options);\n this.restore = () => observer.disconnect();\n return;\n }\n const hasOverlayScrollbars = platform.os.ios || !hasInsetScrollbars(referenceElement);\n\n // On iOS, scroll locking does not work if the navbar is collapsed. Due to numerous\n // side effects and bugs that arise on iOS, it must be researched extensively before\n // being enabled to ensure it doesn't cause the following issues:\n // - Textboxes must scroll into view when focused, nor cause a glitchy scroll animation.\n // - The navbar must not force itself into view and cause layout shift.\n // - Scroll containers must not flicker upon closing a popup when it has an exit animation.\n this.restore = hasOverlayScrollbars ? preventScrollOverlayScrollbars(referenceElement) : preventScrollInsetScrollbars(referenceElement);\n }\n}\nconst SCROLL_LOCKER = new ScrollLocker();\n\n/**\n * Locks the scroll of the document when enabled.\n *\n * @param enabled - Whether to enable the scroll lock.\n * @param referenceElement - Element to use as a reference for lock calculations.\n */\nexport function useScrollLock(enabled = true, referenceElement = null) {\n useIsoLayoutEffect(() => {\n if (!enabled) {\n return undefined;\n }\n return SCROLL_LOCKER.acquire(referenceElement);\n }, [enabled, referenceElement]);\n}","'use client';\n\nimport * as React from 'react';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useScrollLock } from '@base-ui/utils/useScrollLock';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\n\n// Touch-opened popups normally avoid scroll locking so users can still swipe outside to dismiss.\n// This hook re-enables scroll lock only when the popup is effectively full-width.\n// Treat popups with up to 20px of total horizontal gutter as full-width so common ~10px side\n// padding still locks scroll, since that leaves too little outside space for a reliable swipe.\nconst VIEWPORT_WIDTH_TOLERANCE_PX = 20;\n\n/**\n * Manages scroll lock for anchored popups. For non-touch opens, scroll lock is applied when\n * enabled. For touch opens, scroll lock is applied only when the positioner width is effectively\n * viewport-sized.\n */\nexport function useAnchoredPopupScrollLock(enabled, touchOpen, positionerElement, referenceElement) {\n const [touchOpenShouldLockScroll, setTouchOpenShouldLockScroll] = React.useState(false);\n useIsoLayoutEffect(() => {\n if (!enabled || !touchOpen || positionerElement == null) {\n setTouchOpenShouldLockScroll(false);\n return;\n }\n const viewportWidth = ownerDocument(positionerElement).documentElement.clientWidth;\n const popupWidth = positionerElement.offsetWidth;\n setTouchOpenShouldLockScroll(viewportWidth > 0 && popupWidth > 0 && popupWidth >= viewportWidth - VIEWPORT_WIDTH_TOLERANCE_PX);\n }, [enabled, touchOpen, positionerElement]);\n useScrollLock(enabled && (!touchOpen || touchOpenShouldLockScroll), referenceElement);\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { inertValue } from '@base-ui/utils/inertValue';\nimport { useComboboxFloatingContext, useComboboxRootContext } from \"../root/ComboboxRootContext.mjs\";\nimport { ComboboxPositionerContext } from \"./ComboboxPositionerContext.mjs\";\nimport { useListEmpty } from \"../utils/parts.mjs\";\nimport { useAnchorPositioning } from \"../../internals/useAnchorPositioning.mjs\";\nimport { useComboboxPortalContext } from \"../portal/ComboboxPortalContext.mjs\";\nimport { DROPDOWN_COLLISION_AVOIDANCE } from \"../../internals/constants.mjs\";\nimport { InternalBackdrop } from \"../../utils/InternalBackdrop.mjs\";\nimport { usePositioner } from \"../../utils/usePositioner.mjs\";\nimport { useAnchoredPopupScrollLock } from \"../../utils/useAnchoredPopupScrollLock.mjs\";\n\n/**\n * Positions the popup against the trigger.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const ComboboxPositioner = /*#__PURE__*/React.forwardRef(function ComboboxPositioner(componentProps, forwardedRef) {\n const {\n render,\n className,\n anchor,\n // `useAnchorPositioning` applies the same defaults to the undefined values; the names\n // remain destructured to exclude the props from `elementProps`.\n positionMethod,\n side,\n align,\n sideOffset,\n alignOffset,\n collisionBoundary = 'clipping-ancestors',\n collisionPadding,\n arrowPadding,\n sticky,\n disableAnchorTracking = false,\n collisionAvoidance = DROPDOWN_COLLISION_AVOIDANCE,\n style: styleProp,\n ...elementProps\n } = componentProps;\n const store = useComboboxRootContext();\n const floatingRootContext = useComboboxFloatingContext();\n const keepMounted = useComboboxPortalContext();\n const modal = store.useState('modal');\n const open = store.useState('open');\n const mounted = store.useState('mounted');\n const openMethod = store.useState('openMethod');\n const positionerElement = store.useState('positionerElement');\n const triggerElement = store.useState('triggerElement');\n const inputElement = store.useState('inputElement');\n const inputGroupElement = store.useState('inputGroupElement');\n const inputInsidePopup = store.useState('inputInsidePopup');\n const transitionStatus = store.useState('transitionStatus');\n const empty = useListEmpty();\n const resolvedAnchor = anchor ?? (inputInsidePopup ? triggerElement : inputGroupElement ?? inputElement);\n const positioning = useAnchorPositioning({\n anchor: resolvedAnchor,\n floatingRootContext,\n positionMethod,\n mounted,\n side,\n sideOffset,\n align,\n alignOffset,\n arrowPadding,\n collisionBoundary,\n collisionPadding,\n sticky,\n disableAnchorTracking,\n keepMounted,\n collisionAvoidance,\n lazyFlip: true\n });\n useAnchoredPopupScrollLock(open && modal, openMethod === 'touch', positionerElement, triggerElement);\n const state = {\n open,\n side: positioning.side,\n align: positioning.align,\n anchorHidden: positioning.anchorHidden,\n empty\n };\n useIsoLayoutEffect(() => {\n store.set('popupSide', positioning.side);\n }, [store, positioning.side]);\n const setPositionerElement = useStableCallback(element => {\n store.set('positionerElement', element);\n });\n const element = usePositioner(componentProps, state, {\n styles: positioning.positionerStyles,\n transitionStatus,\n props: elementProps,\n refs: [forwardedRef, setPositionerElement],\n hidden: !mounted,\n inert: !open\n });\n return /*#__PURE__*/_jsxs(ComboboxPositionerContext.Provider, {\n value: positioning,\n children: [mounted && modal && /*#__PURE__*/_jsx(InternalBackdrop, {\n inert: inertValue(!open),\n cutout: inputGroupElement ?? inputElement ?? triggerElement\n }), element]\n });\n});\nif (process.env.NODE_ENV !== \"production\") ComboboxPositioner.displayName = \"ComboboxPositioner\";","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { FloatingFocusManager } from \"../../floating-ui-react/index.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useComboboxFloatingContext, useComboboxRootContext } from \"../root/ComboboxRootContext.mjs\";\nimport { popupStateMapping } from \"../../utils/popupStateMapping.mjs\";\nimport { useComboboxPositionerContext } from \"../positioner/ComboboxPositionerContext.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { transitionStatusMapping } from \"../../internals/stateAttributesMapping.mjs\";\nimport { contains, getTarget } from \"../../floating-ui-react/utils.mjs\";\nimport { getDisabledMountTransitionStyles } from \"../../internals/getDisabledMountTransitionStyles.mjs\";\nimport { ComboboxInternalDismissButton } from \"../utils/ComboboxInternalDismissButton.mjs\";\nimport { getComboboxPopupId } from \"../root/utils/index.mjs\";\nimport { useListEmpty } from \"../utils/parts.mjs\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst stateAttributesMapping = {\n ...popupStateMapping,\n ...transitionStatusMapping\n};\n\n/**\n * A container for the list.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)\n */\nexport const ComboboxPopup = /*#__PURE__*/React.forwardRef(function ComboboxPopup(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n initialFocus,\n finalFocus,\n ...elementProps\n } = componentProps;\n const store = useComboboxRootContext();\n const positioning = useComboboxPositionerContext();\n const floatingRootContext = useComboboxFloatingContext();\n const mounted = store.useState('mounted');\n const open = store.useState('open');\n const openMethod = store.useState('openMethod');\n const popupProps = store.useState('popupProps');\n const transitionStatus = store.useState('transitionStatus');\n const inputInsidePopup = store.useState('inputInsidePopup');\n const inputElement = store.useState('inputElement');\n const modal = store.useState('modal');\n const rootId = store.useState('id');\n const empty = useListEmpty();\n const popupId = elementProps.id ?? (inputInsidePopup ? getComboboxPopupId(rootId) : undefined);\n useIsoLayoutEffect(() => {\n // Prefer the rendered DOM id, which a `render` prop element or function may override.\n store.set('popupId', store.context.popupRef.current?.id || popupId);\n return () => {\n store.set('popupId', undefined);\n };\n }, [store, popupId]);\n useOpenChangeComplete({\n open,\n ref: store.context.popupRef,\n onComplete() {\n if (open) {\n store.context.onOpenChangeComplete(true);\n }\n }\n });\n const state = {\n open,\n side: positioning.side,\n align: positioning.align,\n anchorHidden: positioning.anchorHidden,\n transitionStatus,\n empty\n };\n const element = useRenderElement('div', componentProps, {\n state,\n ref: [forwardedRef, store.context.popupRef],\n props: [popupProps, {\n id: popupId,\n role: inputInsidePopup ? 'dialog' : 'presentation',\n onFocus(event) {\n const target = getTarget(event.nativeEvent);\n if (openMethod !== 'touch' && (contains(store.state.listElement, target) || target === event.currentTarget)) {\n store.context.inputRef.current?.focus();\n }\n }\n }, getDisabledMountTransitionStyles(transitionStatus), elementProps],\n stateAttributesMapping\n });\n\n // Default initial focus logic:\n // If opened by touch, focus the popup element to prevent the virtual keyboard from opening\n // (this is required for Android specifically as iOS handles this automatically).\n const computedDefaultInitialFocus = inputInsidePopup ? interactionType => interactionType === 'touch' ? store.context.popupRef.current : inputElement : false;\n const resolvedInitialFocus = initialFocus === undefined ? computedDefaultInitialFocus : initialFocus;\n let resolvedFinalFocus;\n if (finalFocus != null) {\n resolvedFinalFocus = finalFocus;\n } else {\n resolvedFinalFocus = inputInsidePopup ? undefined : false;\n }\n const focusManagerModal = !inputInsidePopup || modal;\n return /*#__PURE__*/_jsx(FloatingFocusManager, {\n context: floatingRootContext,\n disabled: !mounted,\n modal: focusManagerModal,\n openInteractionType: openMethod,\n initialFocus: resolvedInitialFocus,\n returnFocus: resolvedFinalFocus,\n getInsideElements: () => [store.context.startDismissRef.current, store.context.endDismissRef.current],\n children: /*#__PURE__*/_jsxs(React.Fragment, {\n children: [element, focusManagerModal && /*#__PURE__*/_jsx(ComboboxInternalDismissButton, {\n ref: store.context.endDismissRef\n })]\n })\n });\n});\nif (process.env.NODE_ENV !== \"production\") ComboboxPopup.displayName = \"ComboboxPopup\";","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useCompositeListContext } from \"./CompositeListContext.mjs\";\n/**\n * Used to register a list item and its index (DOM position) in the `CompositeList`.\n */\nexport function useCompositeListItem(params = {}) {\n const {\n guess,\n label,\n metadata,\n textRef,\n index: externalIndex\n } = params;\n const {\n register,\n unregister,\n subscribeMapChange,\n nextIndexRef\n } = useCompositeListContext();\n\n // Guess the index from the render order. This avoids a re-render after mount for\n // flat lists rendered in DOM order; when the guess is wrong (grouped or out-of-order\n // rendering), the commit flush corrects it before paint.\n const indexRef = React.useRef(-1);\n const [internalIndex, setInternalIndex] = React.useState(externalIndex == null && guess ? () => {\n if (indexRef.current === -1) {\n const newIndex = nextIndexRef.current;\n nextIndexRef.current += 1;\n indexRef.current = newIndex;\n }\n return indexRef.current;\n } : -1);\n const index = externalIndex ?? internalIndex;\n const componentRef = React.useRef(null);\n\n // Deliberately identity-sensitive: nested items sharing one DOM node rely on ref attachment\n // order to decide which registration wins, and republishing from an effect instead would let\n // an inner item's later update silently take ownership from the outer one.\n const ref = React.useCallback(node => {\n const previousNode = componentRef.current;\n if (previousNode) {\n unregister(previousNode);\n }\n componentRef.current = node;\n if (node) {\n register(node, {\n metadata: metadata ?? null,\n index: externalIndex ?? null,\n label,\n textRef\n });\n }\n }, [externalIndex, register, unregister, metadata, label, textRef]);\n useIsoLayoutEffect(() => {\n if (externalIndex != null) {\n return undefined;\n }\n return subscribeMapChange(map => {\n const i = componentRef.current ? map.get(componentRef.current)?.index : null;\n if (i != null) {\n setInternalIndex(i);\n }\n });\n }, [externalIndex, subscribeMapChange]);\n return {\n ref,\n index\n };\n}","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const ComboboxItemContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") ComboboxItemContext.displayName = \"ComboboxItemContext\";\nexport function useComboboxItemContext() {\n const context = React.useContext(ComboboxItemContext);\n if (!context) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: ComboboxItemContext is missing. ComboboxItem parts must be placed within <Combobox.Item>.' : _formatErrorMessage(19));\n }\n return context;\n}","'use client';\n\nimport * as React from 'react';\nexport const ComboboxRowContext = /*#__PURE__*/React.createContext(false);\nif (process.env.NODE_ENV !== \"production\") ComboboxRowContext.displayName = \"ComboboxRowContext\";\nexport function useComboboxRowContext() {\n return React.useContext(ComboboxRowContext);\n}","'use client';\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useComboboxRootContext, useComboboxHasItemsContext, useComboboxDerivedItemsContext } from \"../root/ComboboxRootContext.mjs\";\nimport { useCompositeListItem } from \"../../internals/composite/list/useCompositeListItem.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { ComboboxItemContext } from \"./ComboboxItemContext.mjs\";\nimport { useButton } from \"../../internals/use-button/index.mjs\";\nimport { useComboboxRowContext } from \"../row/ComboboxRowContext.mjs\";\nimport { compareItemEquality, findItemIndex, resolveSelectedIndex } from \"../../internals/itemEquality.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nfunction ComboboxItemInner(props) {\n const {\n componentProps,\n forwardedRef,\n virtualized,\n indexFromFilter\n } = props;\n const {\n render,\n className,\n style,\n value: itemValue = null,\n index: indexProp,\n disabled: disabledProp = false,\n nativeButton = false,\n ...elementProps\n } = componentProps;\n const textRef = React.useRef(null);\n const listItem = useCompositeListItem({\n guess: true,\n index: indexProp,\n textRef\n });\n const store = useComboboxRootContext();\n const isRow = useComboboxRowContext();\n const hasItems = useComboboxHasItemsContext();\n const selectionMode = store.useState('selectionMode');\n const rootDisabled = store.useState('disabled');\n const readOnly = store.useState('readOnly');\n const isItemEqualToValue = store.useState('isItemEqualToValue');\n const disabled = rootDisabled || disabledProp;\n const selectable = selectionMode !== 'none';\n const index = indexProp ?? indexFromFilter ?? listItem.index;\n const hasRegistered = index !== -1;\n const rootId = store.useState('id');\n const highlighted = store.useState('isActive', index);\n const matchesSelectedValue = store.useState('isSelected', itemValue);\n const itemProps = store.useState('itemProps');\n const itemRef = React.useRef(null);\n const id = rootId != null && hasRegistered ? `${rootId}-${index}` : undefined;\n const selected = matchesSelectedValue && selectable;\n useIsoLayoutEffect(() => {\n const shouldRun = hasRegistered && (virtualized || indexProp != null);\n if (!shouldRun) {\n return undefined;\n }\n const list = store.context.listRef.current;\n list[index] = itemRef.current;\n return () => {\n delete list[index];\n };\n }, [hasRegistered, virtualized, index, indexProp, store]);\n useIsoLayoutEffect(() => {\n if (!hasRegistered || hasItems) {\n return undefined;\n }\n const visibleValues = store.context.valuesRef.current;\n visibleValues[index] = itemValue;\n return () => {\n delete visibleValues[index];\n };\n }, [hasRegistered, hasItems, index, itemValue, store]);\n useIsoLayoutEffect(() => {\n if (!hasRegistered || hasItems) {\n return;\n }\n\n // Runs while closed as well (the list can stay mounted via `keepMounted` or a\n // force-mount) so the index tracks the item's composite position, keeping features\n // like closed-trigger typeahead in sync when the rendered order changes.\n const selectedValue = store.state.selectedValue;\n let nextIndex = store.state.selectedIndex;\n if (store.state.selectionMode === 'multiple' && Array.isArray(selectedValue)) {\n nextIndex = resolveSelectedIndex(index, itemValue, store.context.valuesRef.current, selectedValue, isItemEqualToValue, nextIndex);\n } else if (compareItemEquality(itemValue, selectedValue, isItemEqualToValue)) {\n nextIndex = index;\n }\n store.set('selectedIndex', nextIndex);\n }, [hasRegistered, hasItems, store, index, itemValue, isItemEqualToValue]);\n const {\n getButtonProps,\n buttonRef\n } = useButton({\n disabled,\n focusableWhenDisabled: true,\n native: nativeButton,\n composite: true\n });\n const state = {\n disabled,\n selected,\n highlighted\n };\n function commitSelection(nativeEvent) {\n function selectItem() {\n store.context.handleSelection(nativeEvent, itemValue);\n }\n if (store.state.submitOnItemClick) {\n ReactDOM.flushSync(selectItem);\n store.context.requestSubmit();\n } else {\n selectItem();\n }\n }\n const defaultProps = {\n id,\n role: isRow ? 'gridcell' : 'option',\n 'aria-selected': selectable ? selected : undefined,\n // Focusable items steal focus from the input upon mouseup.\n // Warn if the user renders a natively focusable element like `<button>`,\n // as it should be a `<div>` instead.\n tabIndex: undefined,\n onPointerDownCapture(event) {\n // The compat `mouseup` only fires for the primary pointer, so a non-primary\n // touch must not overwrite the shared ref — a mismatch would make the primary\n // pointer's release read as a drag-select and commit a second time after `click`.\n if (event.isPrimary) {\n store.context.pointerDownItemRef.current = event.currentTarget;\n }\n event.preventDefault();\n },\n onMouseDown(event) {\n // iOS Safari can emit a synthetic mousedown for touch taps without a preceding\n // pointerdown. Prevent default here too so tapping an item does not blur the input.\n event.preventDefault();\n },\n onClick(event) {\n if (disabled || readOnly) {\n return;\n }\n commitSelection(event.nativeEvent);\n },\n onMouseUp(event) {\n const pointerStartedOnItem = store.context.pointerDownItemRef.current === event.currentTarget;\n store.context.pointerDownItemRef.current = null;\n if (disabled || readOnly || event.button !== 0 || pointerStartedOnItem || !highlighted) {\n return;\n }\n commitSelection(event.nativeEvent);\n }\n };\n const element = useRenderElement('div', componentProps, {\n ref: [buttonRef, forwardedRef, listItem.ref, itemRef],\n state,\n props: [itemProps, defaultProps, elementProps, getButtonProps]\n });\n const contextValue = React.useMemo(() => ({\n selected,\n textRef\n }), [selected, textRef]);\n return /*#__PURE__*/_jsx(ComboboxItemContext.Provider, {\n value: contextValue,\n children: element\n });\n}\n\n/**\n * Resolves the index from the filtered items for the virtualized fallback (no `index` prop).\n * Isolated here so that this per-keystroke subscription to the derived-items context is only\n * paid by virtualized items. Those re-render on every input change anyway — the parent\n * virtualizer re-windows the list as the filtered set changes — so the extra subscription costs\n * them nothing, while it keeps every non-virtualized item off that context.\n */\nfunction ComboboxItemVirtualizedIndex(props) {\n const {\n componentProps,\n forwardedRef\n } = props;\n const store = useComboboxRootContext();\n const isItemEqualToValue = store.useState('isItemEqualToValue');\n const {\n flatFilteredValues\n } = useComboboxDerivedItemsContext();\n const lookupValue = componentProps.value ?? null;\n const indexFromFilter = findItemIndex(flatFilteredValues, lookupValue, isItemEqualToValue);\n\n // Only reached when `virtualized` is true (see the wrapper below).\n return /*#__PURE__*/_jsx(ComboboxItemInner, {\n componentProps: componentProps,\n forwardedRef: forwardedRef,\n virtualized: true,\n indexFromFilter: indexFromFilter\n });\n}\n\n/**\n * An individual item in the list.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)\n */\nexport const ComboboxItem = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRef(function ComboboxItem(componentProps, forwardedRef) {\n const store = useComboboxRootContext();\n const virtualized = store.useState('virtualized');\n\n // `virtualized` (and whether an item provides an explicit `index`) must be stable for an\n // item's lifetime: the two branches return different component types, so flipping it at\n // runtime remounts the item and resets its refs and effects.\n if (virtualized && componentProps.index == null) {\n return /*#__PURE__*/_jsx(ComboboxItemVirtualizedIndex, {\n componentProps: componentProps,\n forwardedRef: forwardedRef\n });\n }\n return /*#__PURE__*/_jsx(ComboboxItemInner, {\n componentProps: componentProps,\n forwardedRef: forwardedRef,\n virtualized: virtualized,\n indexFromFilter: undefined\n });\n}));\nif (process.env.NODE_ENV !== \"production\") ComboboxItem.displayName = \"ComboboxItem\";","'use client';\n\nimport * as React from 'react';\nimport { useComboboxItemContext } from \"../item/ComboboxItemContext.mjs\";\nimport { useTransitionStatus } from \"../../internals/useTransitionStatus.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { transitionStatusMapping } from \"../../internals/stateAttributesMapping.mjs\";\n\n/**\n * Indicates whether the item is selected.\n * Renders a `<span>` element.\n *\n * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const ComboboxItemIndicator = /*#__PURE__*/React.forwardRef(function ComboboxItemIndicator(componentProps, forwardedRef) {\n const {\n selected\n } = useComboboxItemContext();\n const shouldRender = componentProps.keepMounted || selected;\n if (!shouldRender) {\n return null;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return /*#__PURE__*/_jsx(Inner, {\n ...componentProps,\n ref: forwardedRef\n });\n});\n\n// Split the core implementation to avoid paying the hook costs unless the element needs to mount.\nif (process.env.NODE_ENV !== \"production\") ComboboxItemIndicator.displayName = \"ComboboxItemIndicator\";\nconst Inner = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRef((componentProps, forwardedRef) => {\n const {\n render,\n className,\n style,\n keepMounted,\n ...elementProps\n } = componentProps;\n const {\n selected\n } = useComboboxItemContext();\n const indicatorRef = React.useRef(null);\n const {\n transitionStatus,\n setMounted\n } = useTransitionStatus(selected);\n const state = {\n selected,\n transitionStatus\n };\n const element = useRenderElement('span', componentProps, {\n ref: [forwardedRef, indicatorRef],\n state,\n props: [{\n 'aria-hidden': true,\n children: '✔️'\n }, elementProps],\n stateAttributesMapping: transitionStatusMapping\n });\n useOpenChangeComplete({\n batch: true,\n enabled: !selected,\n open: selected,\n ref: indicatorRef,\n onComplete() {\n if (!selected) {\n setMounted(false);\n }\n }\n });\n return element;\n}));\nif (process.env.NODE_ENV !== \"production\") Inner.displayName = \"Inner\";","'use client';\n\nimport * as React from 'react';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { ComboboxChipsContext } from \"./ComboboxChipsContext.mjs\";\nimport { CompositeList } from \"../../internals/composite/list/CompositeList.mjs\";\nimport { useComboboxRootContext } from \"../root/ComboboxRootContext.mjs\";\nimport { handleInputPress } from \"../utils/handleInputPress.mjs\";\n\n/**\n * A container for the chips in a multiselectable input.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const ComboboxChips = /*#__PURE__*/React.forwardRef(function ComboboxChips(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const store = useComboboxRootContext();\n const open = store.useState('open');\n const hasSelectionChips = store.useState('hasSelectionChips');\n const [highlightedChipIndex, setHighlightedChipIndex] = React.useState(undefined);\n if (open && highlightedChipIndex !== undefined) {\n setHighlightedChipIndex(undefined);\n }\n const chipsRef = React.useRef([]);\n const element = useRenderElement('div', componentProps, {\n ref: [forwardedRef, store.context.chipsContainerRef],\n // NVDA enters browse mode instead of staying in focus mode when navigating with\n // arrow keys inside a container unless it has a toolbar role.\n props: [hasSelectionChips ? {\n role: 'toolbar'\n } : EMPTY_OBJECT, {\n onMouseDown(event) {\n handleInputPress(event, store, store.state.disabled);\n }\n }, elementProps]\n });\n const contextValue = React.useMemo(() => ({\n highlightedChipIndex,\n setHighlightedChipIndex,\n chipsRef\n }), [highlightedChipIndex, setHighlightedChipIndex, chipsRef]);\n return /*#__PURE__*/_jsx(ComboboxChipsContext.Provider, {\n value: contextValue,\n children: /*#__PURE__*/_jsx(CompositeList, {\n elementsRef: chipsRef,\n children: element\n })\n });\n});\nif (process.env.NODE_ENV !== \"production\") ComboboxChips.displayName = \"ComboboxChips\";","'use client';\n\nimport * as React from 'react';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useComboboxDerivedItemsContext, useComboboxRootContext } from \"../root/ComboboxRootContext.mjs\";\nimport { useInitialLiveRegionTextMutation } from \"../utils/useInitialLiveRegionTextMutation.mjs\";\n\n/**\n * Renders its children only when the list is empty.\n * Requires the `items` prop on the root component.\n * Announces changes politely to screen readers.\n * This component's root element must remain mounted in the DOM to announce\n * changes consistently across screen readers. Avoid hiding or removing the\n * component itself with `display: none`, `hidden`, `aria-hidden`, or conditional\n * rendering. Prefer updating or conditionally rendering its children instead.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)\n */\nexport const ComboboxEmpty = /*#__PURE__*/React.forwardRef(function ComboboxEmpty(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n children: childrenProp,\n ...elementProps\n } = componentProps;\n const {\n filteredItems\n } = useComboboxDerivedItemsContext();\n const store = useComboboxRootContext();\n const emptyRef = useInitialLiveRegionTextMutation();\n const children = filteredItems.length === 0 ? childrenProp : null;\n return useRenderElement('div', componentProps, {\n ref: [forwardedRef, store.context.emptyRef, emptyRef],\n props: [{\n children,\n role: 'status',\n 'aria-live': 'polite',\n 'aria-atomic': true\n }, elementProps]\n });\n});\nif (process.env.NODE_ENV !== \"production\") ComboboxEmpty.displayName = \"ComboboxEmpty\";","'use client';\n\nimport * as React from 'react';\nimport { useComboboxInputValueContext, useComboboxRootContext } from \"../root/ComboboxRootContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useButton } from \"../../internals/use-button/index.mjs\";\nimport { useFieldRootContext } from \"../../internals/field-root-context/FieldRootContext.mjs\";\nimport { useTransitionStatus } from \"../../internals/useTransitionStatus.mjs\";\nimport { transitionStatusMapping } from \"../../internals/stateAttributesMapping.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { triggerOpenStateMapping } from \"../../utils/popupStateMapping.mjs\";\nconst stateAttributesMapping = {\n ...transitionStatusMapping,\n ...triggerOpenStateMapping\n};\n\n/**\n * Clears the value when clicked.\n * Renders a `<button>` element.\n *\n * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)\n */\nexport const ComboboxClear = /*#__PURE__*/React.forwardRef(function ComboboxClear(componentProps, forwardedRef) {\n const {\n render,\n className,\n disabled: disabledProp = false,\n nativeButton = true,\n keepMounted = false,\n style,\n ...elementProps\n } = componentProps;\n const {\n disabled: fieldDisabled\n } = useFieldRootContext();\n const store = useComboboxRootContext();\n const selectionMode = store.useState('selectionMode');\n const comboboxDisabled = store.useState('disabled');\n const readOnly = store.useState('readOnly');\n const open = store.useState('open');\n const selectedValue = store.useState('selectedValue');\n const hasSelectionChips = store.useState('hasSelectionChips');\n const inputValue = useComboboxInputValueContext();\n let visible = false;\n if (selectionMode === 'none') {\n visible = inputValue !== '';\n } else if (selectionMode === 'single') {\n visible = selectedValue != null;\n } else {\n visible = hasSelectionChips;\n }\n const disabled = fieldDisabled || comboboxDisabled || disabledProp;\n const {\n buttonRef,\n getButtonProps\n } = useButton({\n native: nativeButton,\n disabled\n });\n const {\n mounted,\n transitionStatus,\n setMounted\n } = useTransitionStatus(visible);\n const state = {\n disabled,\n visible,\n open,\n transitionStatus\n };\n useOpenChangeComplete({\n open: visible,\n ref: store.context.clearRef,\n onComplete() {\n if (!visible) {\n setMounted(false);\n }\n }\n });\n const element = useRenderElement('button', componentProps, {\n state,\n ref: [forwardedRef, buttonRef, store.context.clearRef],\n props: [{\n tabIndex: -1,\n children: 'x',\n // Avoid stealing focus from the input.\n onMouseDown(event) {\n event.preventDefault();\n },\n onClick(event) {\n if (disabled || readOnly) {\n return;\n }\n const type = store.context.keyboardActiveRef.current ? REASONS.keyboard : REASONS.pointer;\n store.context.setInputValue('', createChangeEventDetails(REASONS.clearPress, event.nativeEvent));\n if (selectionMode !== 'none') {\n store.context.setSelectedValue(Array.isArray(selectedValue) ? [] : null, createChangeEventDetails(REASONS.clearPress, event.nativeEvent));\n // A distinct object shape: `Store.update` iterates own keys, so passing an explicit\n // `selectedIndex: undefined` would overwrite the state instead of leaving it alone.\n store.context.setIndices({\n activeIndex: null,\n selectedIndex: null,\n type\n });\n } else {\n store.context.setIndices({\n activeIndex: null,\n type\n });\n }\n store.context.inputRef.current?.focus();\n }\n }, elementProps, getButtonProps],\n stateAttributesMapping\n });\n const shouldRender = keepMounted || mounted;\n if (!shouldRender) {\n return null;\n }\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") ComboboxClear.displayName = \"ComboboxClear\";","import * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"#lib/utils\";\n\nimport { Button } from \"#components/button\";\nimport { Input } from \"#components/input\";\nimport { Textarea } from \"#components/textarea\";\n\nfunction InputGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"input-group\"\n role=\"group\"\n className={cn(\n \"group/input-group relative flex h-12 w-full min-w-0 items-center rounded-input border border-input bg-input-background transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5\",\n className,\n )}\n {...props}\n />\n );\n}\n\nconst inputGroupAddonVariants = cva(\n \"flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-sm [&>svg:not([class*='size-'])]:size-4\",\n {\n variants: {\n align: {\n \"inline-start\": \"order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]\",\n \"inline-end\": \"order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]\",\n \"block-start\":\n \"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2\",\n \"block-end\":\n \"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2\",\n },\n },\n defaultVariants: {\n align: \"inline-start\",\n },\n },\n);\n\nfunction InputGroupAddon({\n className,\n align = \"inline-start\",\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof inputGroupAddonVariants>) {\n return (\n <div\n role=\"group\"\n data-slot=\"input-group-addon\"\n data-align={align}\n className={cn(inputGroupAddonVariants({ align }), className)}\n onClick={(e) => {\n if ((e.target as HTMLElement).closest(\"button\")) {\n return;\n }\n e.currentTarget.parentElement?.querySelector(\"input\")?.focus();\n }}\n {...props}\n />\n );\n}\n\nconst inputGroupButtonVariants = cva(\"flex items-center gap-2 text-sm shadow-none\", {\n variants: {\n size: {\n xs: \"h-6 gap-1 rounded-sm px-1.5 [&>svg:not([class*='size-'])]:size-3.5\",\n sm: \"\",\n \"icon-xs\": \"size-6 rounded-sm p-0 has-[>svg]:p-0\",\n \"icon-sm\": \"size-8 p-0 has-[>svg]:p-0\",\n },\n },\n defaultVariants: {\n size: \"xs\",\n },\n});\n\n// React 18: forwardRef wrapper — remove when on React 19 (see docs/theming.md)\nconst InputGroupButton = React.forwardRef(function InputGroupButton(\n {\n className,\n type = \"button\",\n variant = \"ghost\",\n size = \"xs\",\n ...props\n }: Omit<React.ComponentProps<typeof Button>, \"size\" | \"type\"> &\n VariantProps<typeof inputGroupButtonVariants> & {\n type?: \"button\" | \"submit\" | \"reset\";\n },\n ref: React.Ref<any>,\n) {\n return (\n <Button\n type={type}\n data-size={size}\n variant={variant}\n className={cn(inputGroupButtonVariants({ size }), className)}\n ref={ref}\n {...props}\n />\n );\n});\n\nfunction InputGroupText({ className, ...props }: React.ComponentProps<\"span\">) {\n return (\n <span\n className={cn(\n \"flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n />\n );\n}\n\n// React 18: forwardRef wrapper — remove when on React 19 (see docs/theming.md)\nconst InputGroupInput = React.forwardRef(function InputGroupInput(\n { className, ...props }: React.ComponentProps<typeof Input>,\n ref: React.Ref<any>,\n) {\n return (\n <Input\n data-slot=\"input-group-control\"\n className={cn(\n \"h-full flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent\",\n className,\n )}\n ref={ref}\n {...props}\n />\n );\n});\n\nfunction InputGroupTextarea({ className, ...props }: React.ComponentProps<\"textarea\">) {\n return (\n <Textarea\n data-slot=\"input-group-control\"\n className={cn(\n \"flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupText,\n InputGroupInput,\n InputGroupTextarea,\n};\n","import { CheckIcon, ChevronDownIcon, XIcon } from \"lucide-react\";\nimport * as React from \"react\";\nimport { Combobox as ComboboxPrimitive } from \"@base-ui/react/combobox\";\n\nimport { cn } from \"#lib/utils\";\nimport { usePortalContainer } from \"#components/portal-root\";\n\nimport { Button } from \"#components/button\";\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput,\n} from \"#components/input-group\";\n\nconst Combobox = ComboboxPrimitive.Root;\n\n// The listbox (ComboboxList) sits inside ComboboxContent; this carries the field label's id\n// from the content down so the listbox gets an accessible name.\nconst ComboboxLabelContext = React.createContext<string | undefined>(undefined);\n\nfunction ComboboxValue({ ...props }: ComboboxPrimitive.Value.Props) {\n return <ComboboxPrimitive.Value data-slot=\"combobox-value\" {...props} />;\n}\n\n// React 18: forwardRef wrapper — remove when on React 19 (see docs/theming.md)\nconst ComboboxTrigger = React.forwardRef(function ComboboxTrigger(\n { className, children, ...props }: ComboboxPrimitive.Trigger.Props,\n ref: React.Ref<any>,\n) {\n return (\n <ComboboxPrimitive.Trigger\n data-slot=\"combobox-trigger\"\n className={cn(\"[&_svg:not([class*='size-'])]:size-4\", className)}\n ref={ref}\n {...props}\n >\n {children}\n <ChevronDownIcon className=\"pointer-events-none size-4 text-muted-foreground\" />\n </ComboboxPrimitive.Trigger>\n );\n});\n\nfunction ComboboxClear({\n className,\n clearLabel,\n ...props\n}: ComboboxPrimitive.Clear.Props & { clearLabel: string }) {\n return (\n <ComboboxPrimitive.Clear\n data-slot=\"combobox-clear\"\n render={<InputGroupButton variant=\"ghost\" size=\"icon-xs\" />}\n aria-label={clearLabel}\n // Base UI defaults Clear to tabIndex -1, which leaves keyboard users unable to reach it.\n tabIndex={0}\n // The button inherits the UA's near-black button text, unreadable on a dark input\n className={cn(\"text-muted-foreground\", className)}\n {...props}\n >\n <XIcon className=\"pointer-events-none\" />\n </ComboboxPrimitive.Clear>\n );\n}\n\n// The trigger and clear buttons are icon-only, so their labels are required whenever they render.\ntype ComboboxInputProps = ComboboxPrimitive.Input.Props & {\n /** Keeps the placeholder in the DOM but invisible, so CSS can reveal it. */\n hidePlaceholder?: boolean;\n} & ({ showTrigger?: true; triggerLabel: string } | { showTrigger: false; triggerLabel?: string }) &\n ({ showClear: true; clearLabel: string } | { showClear?: false; clearLabel?: string });\n\n// React 18: forwardRef wrapper — remove when on React 19 (see docs/theming.md)\n// The cast keeps forwardRef from flattening the union that requires triggerLabel / clearLabel.\nconst ComboboxInput = React.forwardRef(function ComboboxInput(\n {\n className,\n children,\n disabled = false,\n showTrigger = true,\n showClear = false,\n triggerLabel,\n clearLabel,\n hidePlaceholder,\n ...props\n }: ComboboxInputProps,\n ref: React.Ref<any>,\n) {\n return (\n <InputGroup\n // While the list is open Base UI hides everything outside the input and list from assistive\n // tech, except live regions; \"off\" (announces nothing) keeps the focusable trigger and clear\n // buttons from being hidden.\n aria-live=\"off\"\n className={cn(\"w-auto\", className)}\n >\n <ComboboxPrimitive.Input\n render={<InputGroupInput disabled={disabled} hidePlaceholder={hidePlaceholder} />}\n ref={ref}\n {...props}\n />\n <InputGroupAddon align=\"inline-end\">\n {showTrigger && (\n <InputGroupButton\n size=\"icon-xs\"\n variant=\"ghost\"\n render={<ComboboxTrigger />}\n aria-label={triggerLabel}\n data-slot=\"input-group-button\"\n className=\"group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent\"\n disabled={disabled}\n />\n )}\n {showClear && <ComboboxClear disabled={disabled} clearLabel={clearLabel as string} />}\n </InputGroupAddon>\n {children}\n </InputGroup>\n );\n}) as React.ForwardRefExoticComponent<ComboboxInputProps & React.RefAttributes<HTMLInputElement>>;\n\nfunction ComboboxContent({\n className,\n side = \"bottom\",\n sideOffset = 6,\n align = \"start\",\n alignOffset = 0,\n anchor,\n labelledBy,\n children,\n ...props\n}: ComboboxPrimitive.Popup.Props & {\n /** id of the field label; names the listbox. */\n labelledBy?: string;\n} & Pick<\n ComboboxPrimitive.Positioner.Props,\n \"side\" | \"align\" | \"sideOffset\" | \"alignOffset\" | \"anchor\"\n >) {\n const portalContainer = usePortalContainer();\n return (\n <ComboboxPrimitive.Portal container={portalContainer}>\n <ComboboxPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n anchor={anchor}\n className=\"isolate z-50\"\n >\n <ComboboxPrimitive.Popup\n data-slot=\"combobox-content\"\n data-chips={!!anchor}\n className={cn(\n \"cn-menu-target cn-menu-translucent group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95\",\n className,\n )}\n {...props}\n >\n <ComboboxLabelContext.Provider value={labelledBy}>\n {children}\n </ComboboxLabelContext.Provider>\n </ComboboxPrimitive.Popup>\n </ComboboxPrimitive.Positioner>\n </ComboboxPrimitive.Portal>\n );\n}\n\nfunction ComboboxList({ className, ...props }: ComboboxPrimitive.List.Props) {\n const labelledBy = React.useContext(ComboboxLabelContext);\n return (\n <ComboboxPrimitive.List\n data-slot=\"combobox-list\"\n aria-labelledby={labelledBy}\n className={cn(\n \"no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction ComboboxItem({ className, children, ...props }: ComboboxPrimitive.Item.Props) {\n return (\n <ComboboxPrimitive.Item\n data-slot=\"combobox-item\"\n className={cn(\n \"relative flex w-full cursor-default items-center gap-2 rounded-md py-2 pe-8 ps-2 text-(length:--input-text-size) outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n >\n {children}\n <ComboboxPrimitive.ItemIndicator\n render={\n <span className=\"pointer-events-none absolute end-2 flex size-4 items-center justify-center\" />\n }\n >\n <CheckIcon className=\"pointer-events-none\" />\n </ComboboxPrimitive.ItemIndicator>\n </ComboboxPrimitive.Item>\n );\n}\n\nfunction ComboboxGroup({ className, ...props }: ComboboxPrimitive.Group.Props) {\n return (\n <ComboboxPrimitive.Group data-slot=\"combobox-group\" className={cn(className)} {...props} />\n );\n}\n\nfunction ComboboxLabel({ className, ...props }: ComboboxPrimitive.GroupLabel.Props) {\n return (\n <ComboboxPrimitive.GroupLabel\n data-slot=\"combobox-label\"\n className={cn(\"px-2 py-1.5 text-xs text-muted-foreground\", className)}\n {...props}\n />\n );\n}\n\nfunction ComboboxCollection({ ...props }: ComboboxPrimitive.Collection.Props) {\n return <ComboboxPrimitive.Collection data-slot=\"combobox-collection\" {...props} />;\n}\n\nfunction ComboboxEmpty({ className, ...props }: ComboboxPrimitive.Empty.Props) {\n return (\n <ComboboxPrimitive.Empty\n data-slot=\"combobox-empty\"\n className={cn(\n \"hidden w-full justify-center py-2 text-center text-(length:--input-text-size) text-muted-foreground group-data-empty/combobox-content:flex\",\n className,\n )}\n {...props}\n />\n );\n}\n\n// Stands in for the list while options are still loading.\nfunction ComboboxLoading({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"combobox-loading\"\n className={cn(\"flex justify-center p-4\", className)}\n {...props}\n />\n );\n}\n\nfunction ComboboxSeparator({ className, ...props }: ComboboxPrimitive.Separator.Props) {\n return (\n <ComboboxPrimitive.Separator\n data-slot=\"combobox-separator\"\n className={cn(\"-mx-1 my-1 h-px bg-border\", className)}\n {...props}\n />\n );\n}\n\n// React 18: forwardRef wrapper — remove when on React 19 (see docs/theming.md)\nconst ComboboxChips = React.forwardRef(function ComboboxChips(\n {\n className,\n ...props\n }: React.ComponentPropsWithRef<typeof ComboboxPrimitive.Chips> & ComboboxPrimitive.Chips.Props,\n ref: React.Ref<any>,\n) {\n return (\n <ComboboxPrimitive.Chips\n ref={ref}\n data-slot=\"combobox-chips\"\n className={cn(\n \"flex min-h-8 flex-wrap items-center gap-1 rounded-lg border border-input bg-transparent bg-clip-padding px-2.5 py-1 text-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 has-data-[slot=combobox-chip]:px-1 dark:bg-input/30 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40\",\n className,\n )}\n {...props}\n />\n );\n});\n\nfunction ComboboxChip({\n className,\n children,\n showRemove = true,\n ...props\n}: ComboboxPrimitive.Chip.Props & {\n showRemove?: boolean;\n}) {\n return (\n <ComboboxPrimitive.Chip\n data-slot=\"combobox-chip\"\n className={cn(\n \"flex h-[calc(--spacing(5.25))] w-fit items-center justify-center gap-1 rounded-sm bg-muted px-1.5 text-xs font-medium whitespace-nowrap text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pe-0\",\n className,\n )}\n {...props}\n >\n {children}\n {showRemove && (\n <ComboboxPrimitive.ChipRemove\n render={<Button variant=\"ghost\" size=\"icon-xs\" />}\n className=\"-ms-1 opacity-50 hover:opacity-100\"\n data-slot=\"combobox-chip-remove\"\n >\n <XIcon className=\"pointer-events-none\" />\n </ComboboxPrimitive.ChipRemove>\n )}\n </ComboboxPrimitive.Chip>\n );\n}\n\nfunction ComboboxChipsInput({ className, ...props }: ComboboxPrimitive.Input.Props) {\n return (\n <ComboboxPrimitive.Input\n data-slot=\"combobox-chip-input\"\n className={cn(\"min-w-16 flex-1 outline-none\", className)}\n {...props}\n />\n );\n}\n\nfunction useComboboxAnchor() {\n return React.useRef<HTMLDivElement | null>(null);\n}\n\nexport {\n Combobox,\n ComboboxInput,\n ComboboxContent,\n ComboboxList,\n ComboboxItem,\n ComboboxGroup,\n ComboboxLabel,\n ComboboxCollection,\n ComboboxEmpty,\n ComboboxLoading,\n ComboboxSeparator,\n ComboboxChips,\n ComboboxChip,\n ComboboxChipsInput,\n ComboboxTrigger,\n ComboboxValue,\n useComboboxAnchor,\n};\n","import type React from \"react\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport {\n Combobox,\n ComboboxContent,\n ComboboxEmpty,\n ComboboxInput,\n ComboboxItem,\n ComboboxList,\n ComboboxLoading,\n} from \"@jslib/ui/components/combobox\";\nimport { InputGroupAddon } from \"@jslib/ui/components/input-group\";\n\nimport { useMessage } from \"@/components/Message\";\nimport { type MessageId } from \"@/lib/intl/types\";\nimport { LoadingSpinnerComponent } from \"@/components/LoadingSpinner/LoadingSpinnerComponent\";\n\nimport {\n type FormSelectChoice,\n type InputSelectOnKeyDown,\n type FieldId,\n type ExtendedFieldId,\n} from \"../../../lib/types/types\";\nimport { setRef } from \"../../../lib/refs/refs\";\n\nconst matchesQuery = (option: FormSelectChoice, query: string): boolean => {\n const lowerQuery = query.toLowerCase();\n return (\n !query ||\n option.label.toLowerCase().includes(lowerQuery) ||\n option.value.toString().toLowerCase().includes(lowerQuery)\n );\n};\n\nconst isSameChoice = (a: FormSelectChoice, b: FormSelectChoice): boolean => a.value === b.value;\n\nexport function useFormSelectChoice(options: MessageId[]): FormSelectChoice[] {\n const { msg } = useMessage();\n\n if (!options || !Array.isArray(options)) return [];\n\n return options.map((option) => {\n return {\n value: option,\n label: msg({ id: option }),\n };\n });\n}\n\nexport interface InputSelectProps {\n onChange: any;\n options: FormSelectChoice[];\n fieldId?: FieldId | ExtendedFieldId; // registers the input for focus handling; omit for non-form selects\n fieldLabelId?: string;\n partLabel?: string; // names one part of a compound field, read after the field label (e.g. \"Date of birth, month\")\n className?: string;\n disabled?: boolean;\n inputId?: string;\n isErrored?: boolean;\n onKeyDown?: InputSelectOnKeyDown;\n placeholder?: string;\n suppressPlaceholder?: boolean;\n value?: FormSelectChoice;\n autoFocus?: boolean;\n ariaDescribedBy?: string;\n isRequired?: boolean;\n isLoading?: boolean;\n autoComplete?: string;\n isClearable?: boolean; // shows a clear button while a value is selected\n startAdornment?: React.ReactNode; // e.g. an icon shown before the text\n sizeToText?: boolean; // input as wide as its text; list as wide as its options, at the control's left edge\n}\n\nexport const InputSelectComponent = ({\n className,\n inputId,\n disabled = false,\n fieldId,\n fieldLabelId,\n partLabel,\n isErrored = false,\n options,\n onKeyDown,\n onChange,\n placeholder = \"\",\n // Hides the placeholder text (the field label already says what to pick); birth date's month\n // shows it, since its label covers the whole date.\n suppressPlaceholder = true,\n value,\n autoFocus,\n ariaDescribedBy,\n isRequired,\n isLoading = false,\n autoComplete,\n isClearable = true,\n startAdornment,\n sizeToText = false,\n}: InputSelectProps) => {\n const { msg } = useMessage();\n const [isOpen, setIsOpen] = useState(false);\n const inputRef = useRef<HTMLInputElement>(null);\n const highlightedChoiceRef = useRef<FormSelectChoice | null>(null);\n const selectedChoice = value && value.value && value.label ? value : null;\n\n // NOTE: Dependency array omitted to account for use of resetRef(), as useEffect with dep arr\n // will only trigger on initial render leaving the refs empty, this replicates prior version\n // where ref callback would trigger with each re-render\n useEffect(() => {\n if (fieldId) setRef(fieldId, inputRef.current);\n });\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n // Tabbing away after typing picks the highlighted match (or the first one, if the highlight\n // hasn't caught up with fast typing), so typing \"Can\" then Tab selects Canada\n const typedText = event.currentTarget.value;\n if (event.key === \"Tab\" && typedText && typedText !== selectedChoice?.label) {\n const highlighted = highlightedChoiceRef.current;\n const match =\n highlighted && matchesQuery(highlighted, typedText)\n ? highlighted\n : options.find((option) => matchesQuery(option, typedText));\n if (match) onChange(match);\n }\n if (typeof onKeyDown === \"function\") {\n onKeyDown(event);\n }\n };\n\n const clearProps = isClearable\n ? { showClear: true as const, clearLabel: msg({ id: \"clearAndOpenMenu\" }) }\n : {};\n\n return (\n <Combobox\n items={options}\n value={selectedChoice}\n onValueChange={(choice: FormSelectChoice | null, { reason }) => {\n // Base UI drops the value when the text is emptied; only the clear button clears it here\n if (reason === \"input-clear\") return;\n onChange(choice);\n // The clear button stands in for the trigger while a value is set, so like the trigger it\n // also toggles the list\n if (reason === \"clear-press\") setIsOpen(!isOpen);\n }}\n onItemHighlighted={(choice: FormSelectChoice | undefined) => {\n highlightedChoiceRef.current = choice ?? null;\n }}\n filter={matchesQuery}\n isItemEqualToValue={isSameChoice}\n open={isOpen}\n onOpenChange={setIsOpen}\n autoHighlight\n disabled={disabled}\n name={inputId}\n autoComplete={autoComplete}\n >\n <ComboboxInput\n ref={inputRef}\n id={inputId}\n disabled={disabled}\n className={className}\n triggerLabel={msg({ id: \"openMenu\" })}\n {...clearProps}\n placeholder={placeholder}\n hidePlaceholder={suppressPlaceholder}\n // Styling sizes the input to its text with field-sizing; size is the fallback for browsers\n // without it, so whatever follows the text still sits beside it\n size={sizeToText && selectedChoice ? selectedChoice.label.length : undefined}\n // The input names itself (aria-label) after the field label, so the part reads as \"Label Part\"\n aria-label={partLabel}\n aria-labelledby={partLabel && fieldLabelId ? `${fieldLabelId} ${inputId}` : fieldLabelId}\n aria-describedby={ariaDescribedBy}\n aria-required={isRequired}\n aria-invalid={isErrored}\n // TODO resolve next line. Product needs this to autofocus, but linter says bad for accessibility\n // eslint-disable-next-line\n autoFocus={autoFocus}\n // Base UI opens on mousedown on the input; clicking the field's label only forwards a\n // click, so open on click too. Focus alone (Tab, focus returning after Escape) doesn't open.\n onClick={() => setIsOpen(true)}\n onKeyDown={handleKeyDown}\n >\n {startAdornment && <InputGroupAddon align=\"inline-start\">{startAdornment}</InputGroupAddon>}\n </ComboboxInput>\n\n {/* A text-sized input is too narrow to set the list's width, so the list sizes to its options\n and starts at the control's left edge (before any start adornment) */}\n <ComboboxContent\n labelledBy={fieldLabelId}\n anchor={\n sizeToText\n ? () => inputRef.current?.closest(\"[data-slot=input-group]\") ?? null\n : undefined\n }\n className={sizeToText ? \"w-max\" : undefined}\n >\n {isLoading ? (\n <ComboboxLoading>\n <LoadingSpinnerComponent />\n </ComboboxLoading>\n ) : (\n <>\n <ComboboxEmpty>{msg({ id: \"noOptions\" })}</ComboboxEmpty>\n <ComboboxList>\n {(option: FormSelectChoice) => (\n <ComboboxItem key={option.value} value={option}>\n {option.label}\n </ComboboxItem>\n )}\n </ComboboxList>\n </>\n )}\n </ComboboxContent>\n </Combobox>\n );\n};\n"],"ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100],"mappings":";;;;;;;;;;;;A,uDAAMgP,KAAqB;CACzB,UAAU;CACV,UAAU;CACV,YAAY;CACZ,QAAQ;CACR,SAAS;CACT,OAAO;CACP,QAAQ;CACR,QAAQ;AACV,GACaC,KAAiB;CAC5B,GAAGD;CACH,UAAU;CACV,KAAK;CACL,MAAM;AACR,GACaE,KAAsB;CACjC,GAAGF;CACH,UAAU;AACZ,GCVMG,KAAa;CACjB,MAAM;CACN,MAAM;CACN,MAAM,CAAC,CAAC,QAAQ;EAAE,GAAG;EAAmB,KAAK;CAAS,CAAC,CAAC;AAC1D;AACAA,GAAW;AACX,IAAMC,KAAQlB,GAAiBiB,EAAU;;;ACLzC,SAASE,KAAc;CAqBrB,OApBI,OAAO,YAAc,MAChB;EACL,WAAW;EACX,UAAU;EACV,gBAAgB;CAClB,IAeK;EACL,WAAW,UAAU;EACrB,UAAU,UAAU,YAAY;EAChC,gBAAgB,UAAU,kBAAkB;CAC9C;AACF;AACA,IAAM,EACJ,eACA,UAAAC,IACA,uBACED,GAAY,GACHE,KAAiBC,GAAU,YAAY,GACvCC,IAAgBzP,GAAS,YAAY,GCrCrC0P,KAAM,YAAY,KAAKD,CAAa,KAAKA,MAAkB,cAAcE,KAAiB,GAGjGC,KAAiB,WACVC,KAAUJ,MAAkBG,MAAkBL,GAAe,SAASK,EAAc,GAGpFE,KAAM,CAACJ,MAAOD,EAAc,WAAW,KAAK;AAGlCA,EAAc,WAAW,KAAK,GAGhC,CAACI,MAAW,qBA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