{"version":3,"file":"static/chunks/5106.11271c5b50104b59.js","mappings":"iLAAA,sHAAwH,+DAA+D,+BAA+B,gDAAgD,WAAW,8DAA8D,IAAI,gDAAgD,SAAS,cAAa,IAAK,0EAAwE,GAAK,SAAS,yGAAyG,sBAAsB,6CAA6C,cAAc,gBAAgB,yCAAyC,IAAI,sEAAsE,qCAAqC,2CAA+C,mEAAmE,KAAK,WAAW,EAAE,iBAAiB,UAAU,MAAM,2FAA2F,yOAAyO,+CAA+C,oHAAoH,YAAY,WAAW,KAAK,YAAY,+CAA+C,2BAA2B,yEAA4E,8YAA8Y,sMAAsM,KAAK,iLAAiL,IAAI,yBAAyB,GAAG,mHAAmH,QAAQ,kBAAkB,EAAE,UAA+B,WCUxnF,IAaA,cA+BA,kBAEA,OADA,qDAEA,CAUA,gBACA,MACA,aACA,GACA,eAEA,CACA,aACA,0CAAwE,IAAa,IACrF,kBAEA,IACA,wBACA,OACA,iBACA,CAAK,GACL,CAEA,OADA,WACA,CACA,CASA,aACA,0CAAwE,IAAe,IACvF,kBAEA,mBACA,kDAA+F,IAAe,IAC9G,oBAEA,0BAIA,OAHA,GACA,8BAEA,kGACK,CACL,CACA,CACA,aACA,0CAAyE,IAAe,IACxF,kBAEA,mBACA,sBACA,qBACA,KACQ,GACR,aAEA,CAAK,CACL,CACA,CAkHA,gBACA,2CAEA,OADA,UAeA,MAfA,EAeA,CAfA,UACA,CACA,CAAG,GAAI,CACP,CAkDA,sBAIA,GAHA,YACA,OAEA,MACA,UAEA,UACA,iCACA,eAEA,SACA,KACA,QACI,KACJ,UAEA,0BACA,OACA,UAEA,CACA,CAYA,sBACA,WACA,mCACA,SAEA,OACA,eAAoC,IAAmB,IACvD,kCACA,QAEA,MAEA,cAAqC,KAAa,IAClD,kCACA,gBAIA,EACA,mCAEA,EACA,CAYA,oBAIA,OAHA,YACA,OAEA,mBACA,wDACA,CAAG,CACH,CAoBA,oBACA,mBACA,CAAC,MAoBD,cACA,YACA,aAEA,qDACA,IAGA,2BACA,yCACA,gCACA,qCACA,iDACA,uBACA,WACA,qBACA,aACA,cACA,kBACA,YACA,oBACA,WACA,CAAG,EACH,uBAjBA,CAmBA,CAgjCA,kEACA,GACA,oBACA,UACA,kBACA,aACA,EAsDA,sBAnpCA,IACA,EADA,EAopCA,IAnpCA,IADA,EAopCA,GAlpCA,IAGA,gBACA,KA+oCA,CAAC,MAGD,+FAAkK,iBAAe,CAAG,WAAS,CAwC7L,cACA,8CACA,CACA,cACA,MAAY,YAAM,IAOlB,OADA,YACA,CACA,CA0DA,OACA,aA7EA,YACA,qBACA,EA4EA,aAxIA,cACA,kBAwIA,wBA/HA,YACA,qBACA,iBACA,sCACA,EA4HA,eAxnDA,cACA,GAQA,CALuB,IACvB,WACA,gBACA,sBACA,CAAG,EACH,oBACA,WACA,QACA,SACA,cACA,cACA,CAAG,CACH,EAymDA,YACA,8BAAqC,MACrC,EACA,kBACA,YACA,MAEA,+BACA,WACA,EAEA,KAEA,kBACA,YACA,MAEA,WACA,cACA,SAEA,+BACA,WACA,EAEA,QACA,CAaA,kBACA,cACA,4BACA,4BACA,iBACA,4BACA,aACA,GAIA,kBACA,EAEA,WACA,EAEA,EACA,aAEA,MACA,GAEA,gBACA,CAsHA,kBACA,uBACA,qBACA,UACA,gBACA,EAAW,OAA6B,MAEtC,eAAS,YACX,GAGA,aACA,SAA4B,OAAQ,EACpC,mBACA,qBACA,qBACO,IACP,CAAK,YAEL,CAAG,GACH,CAqDA,kBAEA,YACA,OAEA,IAJA,EAIA,4CACA,MAAS,OAAQ,EACjB,UACA,mBACA,CAAG,IAAkB,OAAQ,EAC7B,wBACA,qBACA,wCACA,CAAG,KACH,qCACA,CAAG,EACH,CAEA,kBACA,IAEA,EAFA,SACA,UAEA,UACA,qBACA,GACA,wCAEA,KACA,uBACA,GACA,mBACA,EACA,KACA,0BACA,0BACA,GACA,iBACA,qCACA,EACA,KACA,yBACA,GACA,UACA,yBACA,EACA,KACA,0BACA,GACA,SACA,EACA,KACA,oCACA,GACA,qCAEA,KACA,8BACA,GACA,yBAEA,KACA,sBACA,GACA,yCACA,qBACA,iCACA,4BACA,EACA,KACA,SACA,yDACA,CACA,MAAS,OAAQ,GAAG,KACpB,CAoBA,IACW,KAAe,YACR,QAAc,CACN,QAAc,CACX,QAAc,CACrB,UAAgB,CACT,UAAgB,CAChB,UAAgB,CACjC,QAAc,CACP,QAAc,CACd,QAAc,CACf,OAAa,CACN,OAAa,CACb,OAAa,CAC9B,UAAgB,CACX,UAAgB,CACjB,UAAgB,CACb,QAAc,CACT,UAAgB,CAClB,QAAc,CACN,QAAc,CACV,QAAc,CACzB,QAAc,CACb,QAAc,CACjB,SAAe,EAChC,iBAA0B,QAAc,CACxC,oBAA6B,QAAc,CAC3C,SAAkB,SAAe,EACjC,eAA4B,QAAc,CAC1C,cAA2B,OAAa,CACxC,KAAkB,OAAa,CACtB,CACT,CAAK,EAuBL,MAAqB,QAAQ,CAAC,QAAQ,GAAG,KAAqB,qBAb9D,YACA,8DACA,EAGA,EAGA,MACA,kJAEA,GALA,4BAHA,EASA,CAC8D,CAA4C,EAiC1G,iBACA,eACA,kBAzB0F,EA0B1F,6BAzBgH,EA0BhH,2BAzB4G,EA0B5G,6BAzB+G,EA0B/G,0BAzByG,EA0BzG,wBAzBqG,EA0BrG,uBAzBmG,EA0BnG,yBAzBuG,EA0BvG,+BAzBoH,EA0BpH,0BAzB0G,EA0B1G,4BAzB8G,GA0B9G,iBAzBsF,GA0BtF,eAzBqF,GA0BrF,cAzBmF,GA0BnF,UAzB0E,GA0B1E,mBAzB6F,GA0B7F,iBAzByF,GA0BzF,kBAzB2F,GA0B3F,4BAzBgH,GA0BhH,mBAzB6F,GA0B7F,sBAzBoG,GA0BpG,cAzBkF,EA0BlF,CAAC,EAGD,gBAEA,IADA,EAIA,EAHA,SACA,UACA,WAEA,UACA,KA3C0E,GA4C1E,GACA,qBACA,yCACA,+BAEA,KACA,MA7D+G,EA+D/G,YACA,oBAEA,WAvJA,GAGA,QAFA,uFACA,kBACA,IAAwB,WAAsB,KAE9C,sCACA,OACA,eACA,kCACA,WACA,gDACA,QAEA,CACA,CACA,QACA,EAuIA,CACA,YACA,iBAHA,6EAIA,cACA,4BACA,4CACS,EACT,GACA,aACA,mBACA,SACA,EAEA,KACA,MAlFgH,EAqFhH,GACA,iBAFA,8GAGA,SACA,EAEA,KACA,MA1F4G,EA4F5G,EADA,YACA,2BAGA,CACA,iBAFA,qFAGA,SACA,EAEA,KAEA,MAjGuG,EAkGvG,KAjGoH,EAkGpH,6BACA,KACA,MAvGqG,EAwGrG,GACA,iEACA,SACA,EACA,KACA,MA5GmG,EA6GnG,GACA,iFACA,SACA,EACA,KACA,MA/G0G,EAgH1G,GACA,mFACA,EACA,KACA,MAnH8G,GAoH9G,GACA,kFACA,EACA,KACA,MA9HyG,EA+HzG,GACA,UACA,mBACA,EACA,KACA,MA7HsF,GA8HtF,EAAgB,OAAQ,EACxB,UACA,mBACA,CAAO,8DACP,yCACO,EACP,KACA,MA7H6F,GA8H7F,GACA,6BAEA,KACA,SACA,eACA,CACA,MAAS,OAAQ,GAAG,KACpB,CAGA,2DACA,4DACA,+EAEA,cACA,YACA,OAIA,IAviBA,EACA,EACA,EACA,EACA,EA1CA,MAxCA,MACA,EACA,EACA,EASA,EACA,EACA,EACA,EACA,EAKA,EAoBA,EACA,EACA,EA1GA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EAqTA,EACA,EACA,GACA,GACA,GACA,GACA,GAEA,GAxIA,YACA,GAufA,GAAc,OAAQ,GAAG,MACzB,YACA,qBACA,kBACA,mBACA,8BACA,2BAGA,IAtlBA,EAslBA,EAtlBA,GAuCA,IADA,EA+iBA,GA9iBA,gBACA,gBACA,0BACA,oBACA,CACA,gDACA,SACA,eACA,YACA,GAhDA,EAslBA,GAplBA,GADA,GAzCA,EAyCA,EAzCA,EAyCA,EAzCA,EAyCA,EAxCA,EAAqB,YAAM,GAC3B,EAAkB,YAAM,GACxB,EAAwB,iBAAW,eACnC,YAEA,QADA,eACA,GAIA,OAHA,uBAAoD,OAAQ,GAAG,IAC/D,SACA,CAAK,EAEL,CAAG,MAEH,GADA,EAAoB,gBAAU,MAC9B,IACA,OACA,OACA,EAA0B,iBAAW,aACrC,SAAoB,OAAQ,EAC5B,gBACK,IACL,CAAG,MACH,YACE,eAAS,YACX,oCAjJA,EACA,EACA,EACA,EAHA,EAkJA,qBAjJA,EAiJA,EAjJA,MACA,EAgJA,EAhJA,KACA,KACA,uCAaA,EACA,EACA,EAFA,EAiIA,EAjIA,MACA,EAgIA,EAhIA,KAEA,EADA,SAdA,GAcA,SACA,aAfA,EAeA,IAfA,EAeA,KAfA,EAeA,EACA,KAAmB,OAAQ,EAC3B,MACA,CAAK,CA2HL,IA5IA,aACA,MA2IA,CA3IA,IAEA,CAAG,EACH,wCACA,gBAAwB,OAAQ,EAChC,MACA,CAAK,IAsIL,CACA,WACA,CAAG,UACH,OAcA,IACA,OACA,YAmlBA,SACA,SACA,aACA,uBACA,mBACA,iBAGA,GAAwB,YAAM,OAC9B,GAAgB,YAAM,OACtB,GAAiB,YAAM,GAAG,EAE1B,GAAwB,YAAM,OAE9B,IA1sBA,YADA,GADA,EA4sBA,IA3sBA,IACA,aAp6CA,YAo6CA,EACA,YACA,WACA,cACA,mBACA,YACsB,YAAM,EAC5B,sBACA,oBACA,yBACA,mBACA,CAAK,CACL,qCACA,qBACA,CAAG,EACH,SA6rBA,GAA+B,YAAM,GACrC,GAA0B,YAAM,KAEhC,MACA,SACA,QACA,CAAG,EAGH,GAA6B,iBAAW,aACxC,mCACG,OAIH,mBAA4F,OAAQ,EACpG,0BACA,+BACA,SACA,eACA,eACA,CAAG,MAEH,UAAgE,OAAQ,EACxE,0BACA,+BACA,SACA,eACA,eACA,CAAG,MAEH,QAhbA,GADA,EAibA,CACA,uBACA,oBACA,UACA,YACA,kBACA,uBACA,CAAG,EAvbH,iBACA,YACA,cACA,0BACA,iBACA,oBAEA,GAAwB,YAAM,KAE9B,cACA,4CAGA,gBACA,cAEA,aAGA,CAAG,MACH,IAsaE,eAAS,YAUX,OARA,yBACA,GACA,KAzNoG,GA0NpG,aACA,CAAO,CACP,CAAK,MAGL,WACA,mBACA,CACA,CAAG,KAGD,eAAS,YACX,IAGA,cACA,CAAG,UAEH,WAIE,eAAS,YACX,YAGA,sBACA,CAAG,EAEH,QA7lBA,GA6lBA,GA7lBA,GA6lBA,QA7lBA,GA6lBA,GA7lBA,GA6lBA,WACA,IACA,KAlQsF,EAmQtF,CAAK,CACL,CAAG,CAhmBH,GAAiC,YAAM,EACvC,eACA,cACA,CAAG,EACD,eAAS,YACX,gDAMA,iBACA,yBACA,EACA,cACA,0BACA,mCACA,gBACA,CAAO,OACP,IAEA,EACA,aACA,yBACA,EACA,aACA,yBACA,EACA,eACA,0DACA,iBACO,UACP,IAEA,EAQA,OAPA,mCACA,iCACA,oCACA,mCACA,kCAGA,WACA,sCACA,oCACA,uCACA,sCACA,oCACA,EAEA,CAAG,UACH,IA8iBA,GAxiBA,EA0iBE,eAAS,YAEX,OADA,cACA,WACA,aACA,CACA,CAAG,KAED,eAAS,YACX,IACA,eAEA,CAAG,OAGH,OAAoC,aAAO,YAC3C,OACA,sBACA,mBACA,IACA,KApSgH,EAqShH,wBACA,gBACS,CACT,CAAO,CACP,oBACA,mBACA,IACA,KA3S4G,EA4S5G,wBACA,gBACS,CACT,CAAO,CACP,iBACA,mBACA,IACA,KAhTqG,EAiTrG,uBACA,CAAS,CACT,CAAO,CACP,gBACA,mBACA,IACA,KAtTmG,EAuTnG,uBACA,CAAS,CACT,CAAO,CACP,kBACA,yBACA,IACA,KA/TyG,CAgUzG,CAAW,CAEX,CAAO,CACP,kBACA,mBACA,IACA,6BAnUuG,EAPb,CA2U1F,CAAS,CACT,CAAO,CACP,mBACA,0BACA,mBACA,IACA,KAxU0G,EAyU1G,uBACA,CAAW,EAEX,CAAO,CACP,qBACA,0BACA,mBACA,IACA,KAhV8G,GAiV9G,uBACA,CAAW,EAEX,CAAO,CACP,gBACA,mBACA,uBACA,cACA,IACA,KApW0F,CAqW1F,CAAW,EACX,MACA,CACA,aACA,IACA,KAvW+G,EAwW/G,QACA,uBACA,CAAW,EAEX,IACA,KAxWoH,CAyWpH,CAAW,CAEX,CACA,CACA,CAAG,aAGH,GAAmB,iBAAW,YAC9B,IACA,KA3W6F,EA4W7F,CAAK,CACL,CAAG,OACH,GAAkB,iBAAW,YAC7B,IACA,KA9W2F,EA+W3F,CAAK,CACL,CAAG,OACH,GAAiB,iBAAW,YAC5B,IACA,KApXyF,EAqXzF,CAAK,CACL,CAAG,OACH,GAA4B,iBAAW,aACvC,IACA,KAvXgH,GAwXhH,kBACA,CAAK,CACL,CAAG,OACH,GAAmB,iBAAW,aAC9B,IACA,KA5X6F,GA6X7F,cACA,CAAK,CACL,CAAG,OACH,GAAc,iBAAW,YACzB,IACA,KAhYkF,EAiYlF,CAAK,CACL,CAAG,OACH,GAAsB,iBAAW,aACjC,IACA,KAtYoG,GAuYpG,YACA,CAAK,CACL,CAAG,OAEH,GAAsB,iBAAW,aACjC,MAAW,OAAQ,EACnB,cACA,yBACA,CAAK,GACL,CAAG,OACH,GAAqB,iBAAW,eAEhC,IADA,EACA,gBAAqC,EACrC,iBACA,WACA,oBACA,aACA,SACA,YACA,EAAa,OAA6B,MAE1C,EADA,eAAuC,GACvC,iBAQA,OADA,kBANA,cAMA,MACW,OAAQ,QAAgB,oBACnC,YACA,CAAK,kHARL,WACA,IACA,KAxaqF,EAyarF,CAAO,CACP,GAIK,KACL,CAAG,aA4GH,OAEA,qBA7G6B,iBAAW,eAExC,IADA,EACA,gBAAuC,EACvC,WACA,YACA,UACA,kBACA,WACA,qBACA,QACA,EAAa,OAA6B,MAE1C,EADA,eAAuC,GACvC,iBAEA,mBAyBA,EAAsB,OAAQ,QAAgB,oBAC9C,YACA,CAAK,sUArBL,WACA,mCACA,IACA,KAxcsF,EAyctF,CAAS,CAET,GAeK,MASL,OARA,aAGA,cA9BA,WACA,IACA,KA7c0F,CA8c1F,CAAO,CACP,GA2BA,gBAnBA,YACA,IApwEA,EACA,EACA,EAkwEA,GAnwEA,GADA,EAowEA,GAnwEA,IAGA,CAFA,cAEA,kCACA,UAEA,EA8vEA,UACA,SAn8BA,KAAc,EAAE,QAo8BR,IACR,IACA,KA1d+G,EA2d/G,MACA,uBACA,CAAS,CAET,IAWA,0BApCA,cAoCA,MACA,CACA,CAAG,yBA2DH,iBACA,gBACA,aA5DqB,iBAAW,aAEhC,IADA,EACA,gBAAuC,EACvC,SACA,UACA,gBACA,YACA,UACA,eAEA,QACA,aACA,EAAa,OAA6B,MAC1C,aACA,UAEA,WA3/BA,SACA,QACA,eACA,cACA,eAEA,OACA,GACA,EAAI,IACJ,4BACA,IAEA,aA++BA,MADA,MACA,oDACA,OACA,OAkBA,EAAoB,OAAQ,MAC5B,WACA,cACA,4BACA,kBACA,EAAK,CAhCL,mBAgCK,iBACL,GACA,+BAEA,CAAK,QAQL,OAPA,GAGA,eAnBA,WACA,IACA,KAlgB0E,GAmgB1E,OACA,CAAO,CACP,EAcA,EAGA,kBAjCA,WACA,yBAGA,cACA,IACA,KA5fmF,GA6fnF,QACA,UACA,CAAO,EACP,GAwBA,CACA,CAAG,mBAQH,cACA,YACA,aACA,uBACA,cACA,SACA,iBAEA,oBACA,UACA,gBACA,aACA,CACA,CA5ZA,qBAsbA,qBACA,eACA,sBA1BkG,EA2BlG,oBA1B8F,EA2B9F,mBA1B2F,EA2B3F,iBA1BuF,EA2BvF,gBA1BqF,EA2BrF,mBA1B4F,EA2B5F,qBA1BgG,EA2BhG,kBA1ByF,EA2BzF,YA1B4E,EA2B5E,UA1BwE,EA2BxE,WA1B0E,GA2B1E,eA1BmF,GA2BnF,cA1BiF,GA2BjF,UA1BwE,GA2BxE,kBA1BwF,GA2BxF,mBA1B2F,GA2B3F,iBA1BuF,GA2BvF,kBA1ByF,GA2BzF,4BA1B8G,GA2B9G,mBA1B2F,GA2B3F,sBA1BkG,GA2BlG,cA1BkF,GA2BlF,kCA1B2H,EA2B3H,CAAC,CAcQ,UAAe,YACR,QAAc,CACP,QAAc,CACb,QAAc,CACX,QAAc,CACrB,UAAgB,CACT,UAAgB,CAChB,UAAgB,CACjC,QAAc,CACP,QAAc,CACd,QAAc,CACf,OAAa,CACN,OAAa,CACb,OAAa,CACtB,UAAgB,CACT,UAAgB,CAChB,UAAgB,CAC/B,UAAgB,CACX,UAAgB,CACjB,UAAgB,CACb,QAAc,CAChB,UAAgB,CACT,UAAgB,CAClB,QAAc,CACN,QAAc,CACV,QAAc,CACzB,QAAc,CACb,QAAc,CACV,QAAc,CACrB,SAAe,EAC9B,iBAAsB,QAAc,CACpC,oBAAyB,QAAc,CACvC,SAAc,SAAe,EAC7B,eAAsB,QAAc,CACpC,cAAqB,OAAa,CAClC,KAAY,OAAa,CACpB,CACL,CAAG,EA8CkB,OAAQ,GAAG,IAChC,kCACA,YACA,CAAG,CACH,qBAjnFA,YACA,eACA,gBACA,+BACA,EAGA,EAGA,MACA,mHAEA,GALA,4BAHA,EASA,CAomFA,CAAC,EA4hBD,OACA,eACA,iBAiFiB,UAAe,CACR,SAAe,CACf,SAAe,CACvB,QAAc,CACL,QAAc,CACvB,QAAc,CACf,UAAgB,CACT,UAAgB,CAChB,UAAgB,CACf,QAAc,CACZ,QAAc,CAClB,UAAgB,CACZ,UAAgB,CAC1B,SAAe,EAC9B,iBAAsB,QAAc,CACpC,oBAAyB,QAAc,CACvC,SAAc,SAAe,EAC7B,eAAsB,QAAc,CACpC,cAAqB,OAAa,CAClC,KAAY,OAAa,CACpB,CACL,CAAG,EAGH,eACA,eACA,0CCx4Ga,oGACb,0CAA2C,iBAAiB,mBAAqB,kBAAoB,oBAAsB,uBAAyB,oBAAsB,oBAAsB,mBAAqB,uBAAyB,oBAAsB,yBAA2B,gBAAkB,gBAAkB,iBAAmB,wBAA0B,uBAAyB,4BAA8B,wDCNra,QAA4D,+BCM9D,MAA2B,EAAQ,KAA4B,EAE/D,UAFkC,GAElC,CACA,cACA,sBAEA,qBACA,wBACA,UAIA,YACA,kLAKA,OADA,6BACA,EACA,CAEA,aACA,QACA,CAHA,eAMA,OACA,QACA,SACA,OACA,OACA,SACA,SACA,SACA,SAEA,MACA,UACA,UACA,cACA,aACA,OACA,WACA,QACA,YACA,QACA,QAEA,iBACA,mBACA,EAIA,OAFA,cAEA,CACA,mBC/CA,UAAmB,EAAQ,KAA4B,YAA7B,gBCN1B,UAFA","sources":["webpack://_N_E/../../node_modules/compute-scroll-into-view/dist/index.js","webpack://_N_E/../../node_modules/downshift/dist/downshift.esm.js","webpack://_N_E/../../node_modules/downshift/node_modules/react-is/cjs/react-is.production.min.js","webpack://_N_E/../../node_modules/downshift/node_modules/react-is/index.js","webpack://_N_E/../../node_modules/prop-types/factoryWithThrowingShims.js","webpack://_N_E/../../node_modules/prop-types/index.js","webpack://_N_E/../../node_modules/prop-types/lib/ReactPropTypesSecret.js"],"sourcesContent":["let e=e=>\"object\"==typeof e&&null!=e&&1===e.nodeType,t=(e,t)=>(!t||\"hidden\"!==e)&&(\"visible\"!==e&&\"clip\"!==e),n=(e,n)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){let l=getComputedStyle(e,null);return t(l.overflowY,n)||t(l.overflowX,n)||(e=>{let t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}})(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)})(e)}return!1},l=(e,t,n,l,i,o,r,d)=>o<e&&r>t||o>e&&r<t?0:o<=e&&d<=n||r>=t&&d>=n?o-e-l:r>t&&d<n||o<e&&d>n?r-t+i:0,i=e=>{let t=e.parentElement;return null==t?e.getRootNode().host||null:t};var o=(t,o)=>{var r,d,h,f,u,s;if(\"undefined\"==typeof document)return[];let{scrollMode:a,block:c,inline:g,boundary:m,skipOverflowHiddenElements:p}=o,w=\"function\"==typeof m?m:e=>e!==m;if(!e(t))throw new TypeError(\"Invalid target\");let W=document.scrollingElement||document.documentElement,H=[],b=t;for(;e(b)&&w(b);){if(b=i(b),b===W){H.push(b);break}null!=b&&b===document.body&&n(b)&&!n(document.documentElement)||null!=b&&n(b,p)&&H.push(b)}let v=null!=(d=null==(r=window.visualViewport)?void 0:r.width)?d:innerWidth,y=null!=(f=null==(h=window.visualViewport)?void 0:h.height)?f:innerHeight,E=null!=(u=window.scrollX)?u:pageXOffset,M=null!=(s=window.scrollY)?s:pageYOffset,{height:x,width:I,top:C,right:R,bottom:T,left:V}=t.getBoundingClientRect(),k=\"start\"===c||\"nearest\"===c?C:\"end\"===c?T:C+x/2,B=\"center\"===g?V+I/2:\"end\"===g?R:V,D=[];for(let e=0;e<H.length;e++){let t=H[e],{height:n,width:i,top:o,right:r,bottom:d,left:h}=t.getBoundingClientRect();if(\"if-needed\"===a&&C>=0&&V>=0&&T<=y&&R<=v&&C>=o&&T<=d&&V>=h&&R<=r)return D;let f=getComputedStyle(t),u=parseInt(f.borderLeftWidth,10),s=parseInt(f.borderTopWidth,10),m=parseInt(f.borderRightWidth,10),p=parseInt(f.borderBottomWidth,10),w=0,b=0,O=\"offsetWidth\"in t?t.offsetWidth-t.clientWidth-u-m:0,X=\"offsetHeight\"in t?t.offsetHeight-t.clientHeight-s-p:0,Y=\"offsetWidth\"in t?0===t.offsetWidth?0:i/t.offsetWidth:0,L=\"offsetHeight\"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(W===t)w=\"start\"===c?k:\"end\"===c?k-y:\"nearest\"===c?l(M,M+y,y,s,p,M+k,M+k+x,x):k-y/2,b=\"start\"===g?B:\"center\"===g?B-v/2:\"end\"===g?B-v:l(E,E+v,v,u,m,E+B,E+B+I,I),w=Math.max(0,w+M),b=Math.max(0,b+E);else{w=\"start\"===c?k-o-s:\"end\"===c?k-d+p+X:\"nearest\"===c?l(o,d,n,s,p+X,k,k+x,x):k-(o+n/2)+X/2,b=\"start\"===g?B-h-u:\"center\"===g?B-(h+i/2)+O/2:\"end\"===g?B-r+m+O:l(h,r,i,u,m+O,B,B+I,I);let{scrollLeft:e,scrollTop:f}=t;w=Math.max(0,Math.min(f+w/L,t.scrollHeight-n/L+X)),b=Math.max(0,Math.min(e+b/Y,t.scrollWidth-i/Y+O)),k+=f-w,B+=e-b}D.push({el:t,top:w,left:b})}return D};export{o as default};//# sourceMappingURL=index.js.map\n","import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/esm/objectWithoutPropertiesLoose';\nimport _extends from '@babel/runtime/helpers/esm/extends';\nimport _assertThisInitialized from '@babel/runtime/helpers/esm/assertThisInitialized';\nimport _inheritsLoose from '@babel/runtime/helpers/esm/inheritsLoose';\nimport PropTypes from 'prop-types';\nimport { cloneElement, Component, useRef, useEffect, useCallback, useLayoutEffect, useReducer, useMemo } from 'react';\nimport { isForwardRef } from 'react-is';\nimport compute from 'compute-scroll-into-view';\nimport { __assign } from 'tslib';\n\nvar idCounter = 0;\n\n/**\n * Accepts a parameter and returns it if it's a function\n * or a noop function if it's not. This allows us to\n * accept a callback, but not worry about it if it's not\n * passed.\n * @param {Function} cb the callback\n * @return {Function} a function\n */\nfunction cbToCb(cb) {\n  return typeof cb === 'function' ? cb : noop;\n}\nfunction noop() {}\n\n/**\n * Scroll node into view if necessary\n * @param {HTMLElement} node the element that should scroll into view\n * @param {HTMLElement} menuNode the menu element of the component\n */\nfunction scrollIntoView(node, menuNode) {\n  if (!node) {\n    return;\n  }\n  var actions = compute(node, {\n    boundary: menuNode,\n    block: 'nearest',\n    scrollMode: 'if-needed'\n  });\n  actions.forEach(function (_ref) {\n    var el = _ref.el,\n      top = _ref.top,\n      left = _ref.left;\n    el.scrollTop = top;\n    el.scrollLeft = left;\n  });\n}\n\n/**\n * @param {HTMLElement} parent the parent node\n * @param {HTMLElement} child the child node\n * @param {Window} environment The window context where downshift renders.\n * @return {Boolean} whether the parent is the child or the child is in the parent\n */\nfunction isOrContainsNode(parent, child, environment) {\n  var result = parent === child || child instanceof environment.Node && parent.contains && parent.contains(child);\n  return result;\n}\n\n/**\n * Simple debounce implementation. Will call the given\n * function once after the time given has passed since\n * it was last called.\n * @param {Function} fn the function to call after the time\n * @param {Number} time the time to wait\n * @return {Function} the debounced function\n */\nfunction debounce(fn, time) {\n  var timeoutId;\n  function cancel() {\n    if (timeoutId) {\n      clearTimeout(timeoutId);\n    }\n  }\n  function wrapper() {\n    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n      args[_key] = arguments[_key];\n    }\n    cancel();\n    timeoutId = setTimeout(function () {\n      timeoutId = null;\n      fn.apply(void 0, args);\n    }, time);\n  }\n  wrapper.cancel = cancel;\n  return wrapper;\n}\n\n/**\n * This is intended to be used to compose event handlers.\n * They are executed in order until one of them sets\n * `event.preventDownshiftDefault = true`.\n * @param {...Function} fns the event handler functions\n * @return {Function} the event handler to add to an element\n */\nfunction callAllEventHandlers() {\n  for (var _len2 = arguments.length, fns = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n    fns[_key2] = arguments[_key2];\n  }\n  return function (event) {\n    for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {\n      args[_key3 - 1] = arguments[_key3];\n    }\n    return fns.some(function (fn) {\n      if (fn) {\n        fn.apply(void 0, [event].concat(args));\n      }\n      return event.preventDownshiftDefault || event.hasOwnProperty('nativeEvent') && event.nativeEvent.preventDownshiftDefault;\n    });\n  };\n}\nfunction handleRefs() {\n  for (var _len4 = arguments.length, refs = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n    refs[_key4] = arguments[_key4];\n  }\n  return function (node) {\n    refs.forEach(function (ref) {\n      if (typeof ref === 'function') {\n        ref(node);\n      } else if (ref) {\n        ref.current = node;\n      }\n    });\n  };\n}\n\n/**\n * This generates a unique ID for an instance of Downshift\n * @return {String} the unique ID\n */\nfunction generateId() {\n  return String(idCounter++);\n}\n\n/**\n * Resets idCounter to 0. Used for SSR.\n */\nfunction resetIdCounter() {\n  idCounter = 0;\n}\n\n/**\n * Default implementation for status message. Only added when menu is open.\n * Will specify if there are results in the list, and if so, how many,\n * and what keys are relevant.\n *\n * @param {Object} param the downshift state and other relevant properties\n * @return {String} the a11y status message\n */\nfunction getA11yStatusMessage$1(_ref2) {\n  var isOpen = _ref2.isOpen,\n    resultCount = _ref2.resultCount,\n    previousResultCount = _ref2.previousResultCount;\n  if (!isOpen) {\n    return '';\n  }\n  if (!resultCount) {\n    return 'No results are available.';\n  }\n  if (resultCount !== previousResultCount) {\n    return resultCount + \" result\" + (resultCount === 1 ? ' is' : 's are') + \" available, use up and down arrow keys to navigate. Press Enter key to select.\";\n  }\n  return '';\n}\n\n/**\n * Takes an argument and if it's an array, returns the first item in the array\n * otherwise returns the argument\n * @param {*} arg the maybe-array\n * @param {*} defaultValue the value if arg is falsey not defined\n * @return {*} the arg or it's first item\n */\nfunction unwrapArray(arg, defaultValue) {\n  arg = Array.isArray(arg) ? /* istanbul ignore next (preact) */arg[0] : arg;\n  if (!arg && defaultValue) {\n    return defaultValue;\n  } else {\n    return arg;\n  }\n}\n\n/**\n * @param {Object} element (P)react element\n * @return {Boolean} whether it's a DOM element\n */\nfunction isDOMElement(element) {\n\n  // then we assume this is react\n  return typeof element.type === 'string';\n}\n\n/**\n * @param {Object} element (P)react element\n * @return {Object} the props\n */\nfunction getElementProps(element) {\n  return element.props;\n}\n\n/**\n * Throws a helpful error message for required properties. Useful\n * to be used as a default in destructuring or object params.\n * @param {String} fnName the function name\n * @param {String} propName the prop name\n */\nfunction requiredProp(fnName, propName) {\n  // eslint-disable-next-line no-console\n  console.error(\"The property \\\"\" + propName + \"\\\" is required in \\\"\" + fnName + \"\\\"\");\n}\nvar stateKeys = ['highlightedIndex', 'inputValue', 'isOpen', 'selectedItem', 'type'];\n/**\n * @param {Object} state the state object\n * @return {Object} state that is relevant to downshift\n */\nfunction pickState(state) {\n  if (state === void 0) {\n    state = {};\n  }\n  var result = {};\n  stateKeys.forEach(function (k) {\n    if (state.hasOwnProperty(k)) {\n      result[k] = state[k];\n    }\n  });\n  return result;\n}\n\n/**\n * This will perform a shallow merge of the given state object\n * with the state coming from props\n * (for the controlled component scenario)\n * This is used in state updater functions so they're referencing\n * the right state regardless of where it comes from.\n *\n * @param {Object} state The state of the component/hook.\n * @param {Object} props The props that may contain controlled values.\n * @returns {Object} The merged controlled state.\n */\nfunction getState(state, props) {\n  return Object.keys(state).reduce(function (prevState, key) {\n    prevState[key] = isControlledProp(props, key) ? props[key] : state[key];\n    return prevState;\n  }, {});\n}\n\n/**\n * This determines whether a prop is a \"controlled prop\" meaning it is\n * state which is controlled by the outside of this component rather\n * than within this component.\n *\n * @param {Object} props The props that may contain controlled values.\n * @param {String} key the key to check\n * @return {Boolean} whether it is a controlled controlled prop\n */\nfunction isControlledProp(props, key) {\n  return props[key] !== undefined;\n}\n\n/**\n * Normalizes the 'key' property of a KeyboardEvent in IE/Edge\n * @param {Object} event a keyboardEvent object\n * @return {String} keyboard key\n */\nfunction normalizeArrowKey(event) {\n  var key = event.key,\n    keyCode = event.keyCode;\n  /* istanbul ignore next (ie) */\n  if (keyCode >= 37 && keyCode <= 40 && key.indexOf('Arrow') !== 0) {\n    return \"Arrow\" + key;\n  }\n  return key;\n}\n\n/**\n * Simple check if the value passed is object literal\n * @param {*} obj any things\n * @return {Boolean} whether it's object literal\n */\nfunction isPlainObject(obj) {\n  return Object.prototype.toString.call(obj) === '[object Object]';\n}\n\n/**\n * Returns the new index in the list, in a circular way. If next value is out of bonds from the total,\n * it will wrap to either 0 or itemCount - 1.\n *\n * @param {number} moveAmount Number of positions to move. Negative to move backwards, positive forwards.\n * @param {number} baseIndex The initial position to move from.\n * @param {number} itemCount The total number of items.\n * @param {Function} getItemNodeFromIndex Used to check if item is disabled.\n * @param {boolean} circular Specify if navigation is circular. Default is true.\n * @returns {number} The new index after the move.\n */\nfunction getNextWrappingIndex(moveAmount, baseIndex, itemCount, getItemNodeFromIndex, circular) {\n  if (circular === void 0) {\n    circular = true;\n  }\n  if (itemCount === 0) {\n    return -1;\n  }\n  var itemsLastIndex = itemCount - 1;\n  if (typeof baseIndex !== 'number' || baseIndex < 0 || baseIndex >= itemCount) {\n    baseIndex = moveAmount > 0 ? -1 : itemsLastIndex + 1;\n  }\n  var newIndex = baseIndex + moveAmount;\n  if (newIndex < 0) {\n    newIndex = circular ? itemsLastIndex : 0;\n  } else if (newIndex > itemsLastIndex) {\n    newIndex = circular ? 0 : itemsLastIndex;\n  }\n  var nonDisabledNewIndex = getNextNonDisabledIndex(moveAmount, newIndex, itemCount, getItemNodeFromIndex, circular);\n  if (nonDisabledNewIndex === -1) {\n    return baseIndex >= itemCount ? -1 : baseIndex;\n  }\n  return nonDisabledNewIndex;\n}\n\n/**\n * Returns the next index in the list of an item that is not disabled.\n *\n * @param {number} moveAmount Number of positions to move. Negative to move backwards, positive forwards.\n * @param {number} baseIndex The initial position to move from.\n * @param {number} itemCount The total number of items.\n * @param {Function} getItemNodeFromIndex Used to check if item is disabled.\n * @param {boolean} circular Specify if navigation is circular. Default is true.\n * @returns {number} The new index. Returns baseIndex if item is not disabled. Returns next non-disabled item otherwise. If no non-disabled found it will return -1.\n */\nfunction getNextNonDisabledIndex(moveAmount, baseIndex, itemCount, getItemNodeFromIndex, circular) {\n  var currentElementNode = getItemNodeFromIndex(baseIndex);\n  if (!currentElementNode || !currentElementNode.hasAttribute('disabled')) {\n    return baseIndex;\n  }\n  if (moveAmount > 0) {\n    for (var index = baseIndex + 1; index < itemCount; index++) {\n      if (!getItemNodeFromIndex(index).hasAttribute('disabled')) {\n        return index;\n      }\n    }\n  } else {\n    for (var _index = baseIndex - 1; _index >= 0; _index--) {\n      if (!getItemNodeFromIndex(_index).hasAttribute('disabled')) {\n        return _index;\n      }\n    }\n  }\n  if (circular) {\n    return moveAmount > 0 ? getNextNonDisabledIndex(1, 0, itemCount, getItemNodeFromIndex, false) : getNextNonDisabledIndex(-1, itemCount - 1, itemCount, getItemNodeFromIndex, false);\n  }\n  return -1;\n}\n\n/**\n * Checks if event target is within the downshift elements.\n *\n * @param {EventTarget} target Target to check.\n * @param {HTMLElement[]} downshiftElements The elements that form downshift (list, toggle button etc).\n * @param {Window} environment The window context where downshift renders.\n * @param {boolean} checkActiveElement Whether to also check activeElement.\n *\n * @returns {boolean} Whether or not the target is within downshift elements.\n */\nfunction targetWithinDownshift(target, downshiftElements, environment, checkActiveElement) {\n  if (checkActiveElement === void 0) {\n    checkActiveElement = true;\n  }\n  return downshiftElements.some(function (contextNode) {\n    return contextNode && (isOrContainsNode(contextNode, target, environment) || checkActiveElement && isOrContainsNode(contextNode, environment.document.activeElement, environment));\n  });\n}\n\n// eslint-disable-next-line import/no-mutable-exports\nvar validateControlledUnchanged = noop;\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n  validateControlledUnchanged = function validateControlledUnchanged(state, prevProps, nextProps) {\n    var warningDescription = \"This prop should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled Downshift element for the lifetime of the component. More info: https://github.com/downshift-js/downshift#control-props\";\n    Object.keys(state).forEach(function (propKey) {\n      if (prevProps[propKey] !== undefined && nextProps[propKey] === undefined) {\n        // eslint-disable-next-line no-console\n        console.error(\"downshift: A component has changed the controlled prop \\\"\" + propKey + \"\\\" to be uncontrolled. \" + warningDescription);\n      } else if (prevProps[propKey] === undefined && nextProps[propKey] !== undefined) {\n        // eslint-disable-next-line no-console\n        console.error(\"downshift: A component has changed the uncontrolled prop \\\"\" + propKey + \"\\\" to be controlled. \" + warningDescription);\n      }\n    });\n  };\n}\n\nvar cleanupStatus = debounce(function (documentProp) {\n  getStatusDiv(documentProp).textContent = '';\n}, 500);\n\n/**\n * @param {String} status the status message\n * @param {Object} documentProp document passed by the user.\n */\nfunction setStatus(status, documentProp) {\n  var div = getStatusDiv(documentProp);\n  if (!status) {\n    return;\n  }\n  div.textContent = status;\n  cleanupStatus(documentProp);\n}\n\n/**\n * Get the status node or create it if it does not already exist.\n * @param {Object} documentProp document passed by the user.\n * @return {HTMLElement} the status node.\n */\nfunction getStatusDiv(documentProp) {\n  if (documentProp === void 0) {\n    documentProp = document;\n  }\n  var statusDiv = documentProp.getElementById('a11y-status-message');\n  if (statusDiv) {\n    return statusDiv;\n  }\n  statusDiv = documentProp.createElement('div');\n  statusDiv.setAttribute('id', 'a11y-status-message');\n  statusDiv.setAttribute('role', 'status');\n  statusDiv.setAttribute('aria-live', 'polite');\n  statusDiv.setAttribute('aria-relevant', 'additions text');\n  Object.assign(statusDiv.style, {\n    border: '0',\n    clip: 'rect(0 0 0 0)',\n    height: '1px',\n    margin: '-1px',\n    overflow: 'hidden',\n    padding: '0',\n    position: 'absolute',\n    width: '1px'\n  });\n  documentProp.body.appendChild(statusDiv);\n  return statusDiv;\n}\n\nvar unknown = process.env.NODE_ENV !== \"production\" ? '__autocomplete_unknown__' : 0;\nvar mouseUp = process.env.NODE_ENV !== \"production\" ? '__autocomplete_mouseup__' : 1;\nvar itemMouseEnter = process.env.NODE_ENV !== \"production\" ? '__autocomplete_item_mouseenter__' : 2;\nvar keyDownArrowUp = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_arrow_up__' : 3;\nvar keyDownArrowDown = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_arrow_down__' : 4;\nvar keyDownEscape = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_escape__' : 5;\nvar keyDownEnter = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_enter__' : 6;\nvar keyDownHome = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_home__' : 7;\nvar keyDownEnd = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_end__' : 8;\nvar clickItem = process.env.NODE_ENV !== \"production\" ? '__autocomplete_click_item__' : 9;\nvar blurInput = process.env.NODE_ENV !== \"production\" ? '__autocomplete_blur_input__' : 10;\nvar changeInput = process.env.NODE_ENV !== \"production\" ? '__autocomplete_change_input__' : 11;\nvar keyDownSpaceButton = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_space_button__' : 12;\nvar clickButton = process.env.NODE_ENV !== \"production\" ? '__autocomplete_click_button__' : 13;\nvar blurButton = process.env.NODE_ENV !== \"production\" ? '__autocomplete_blur_button__' : 14;\nvar controlledPropUpdatedSelectedItem = process.env.NODE_ENV !== \"production\" ? '__autocomplete_controlled_prop_updated_selected_item__' : 15;\nvar touchEnd = process.env.NODE_ENV !== \"production\" ? '__autocomplete_touchend__' : 16;\n\nvar stateChangeTypes$3 = /*#__PURE__*/Object.freeze({\n  __proto__: null,\n  unknown: unknown,\n  mouseUp: mouseUp,\n  itemMouseEnter: itemMouseEnter,\n  keyDownArrowUp: keyDownArrowUp,\n  keyDownArrowDown: keyDownArrowDown,\n  keyDownEscape: keyDownEscape,\n  keyDownEnter: keyDownEnter,\n  keyDownHome: keyDownHome,\n  keyDownEnd: keyDownEnd,\n  clickItem: clickItem,\n  blurInput: blurInput,\n  changeInput: changeInput,\n  keyDownSpaceButton: keyDownSpaceButton,\n  clickButton: clickButton,\n  blurButton: blurButton,\n  controlledPropUpdatedSelectedItem: controlledPropUpdatedSelectedItem,\n  touchEnd: touchEnd\n});\n\nvar _excluded$4 = [\"refKey\", \"ref\"],\n  _excluded2$3 = [\"onClick\", \"onPress\", \"onKeyDown\", \"onKeyUp\", \"onBlur\"],\n  _excluded3$2 = [\"onKeyDown\", \"onBlur\", \"onChange\", \"onInput\", \"onChangeText\"],\n  _excluded4$1 = [\"refKey\", \"ref\"],\n  _excluded5 = [\"onMouseMove\", \"onMouseDown\", \"onClick\", \"onPress\", \"index\", \"item\"];\nvar Downshift = /*#__PURE__*/function () {\n  var Downshift = /*#__PURE__*/function (_Component) {\n    _inheritsLoose(Downshift, _Component);\n    function Downshift(_props) {\n      var _this;\n      _this = _Component.call(this, _props) || this;\n      // fancy destructuring + defaults + aliases\n      // this basically says each value of state should either be set to\n      // the initial value or the default value if the initial value is not provided\n      _this.id = _this.props.id || \"downshift-\" + generateId();\n      _this.menuId = _this.props.menuId || _this.id + \"-menu\";\n      _this.labelId = _this.props.labelId || _this.id + \"-label\";\n      _this.inputId = _this.props.inputId || _this.id + \"-input\";\n      _this.getItemId = _this.props.getItemId || function (index) {\n        return _this.id + \"-item-\" + index;\n      };\n      _this.input = null;\n      _this.items = [];\n      // itemCount can be changed asynchronously\n      // from within downshift (so it can't come from a prop)\n      // this is why we store it as an instance and use\n      // getItemCount rather than just use items.length\n      // (to support windowing + async)\n      _this.itemCount = null;\n      _this.previousResultCount = 0;\n      _this.timeoutIds = [];\n      /**\n       * @param {Function} fn the function to call after the time\n       * @param {Number} time the time to wait\n       */\n      _this.internalSetTimeout = function (fn, time) {\n        var id = setTimeout(function () {\n          _this.timeoutIds = _this.timeoutIds.filter(function (i) {\n            return i !== id;\n          });\n          fn();\n        }, time);\n        _this.timeoutIds.push(id);\n      };\n      _this.setItemCount = function (count) {\n        _this.itemCount = count;\n      };\n      _this.unsetItemCount = function () {\n        _this.itemCount = null;\n      };\n      _this.setHighlightedIndex = function (highlightedIndex, otherStateToSet) {\n        if (highlightedIndex === void 0) {\n          highlightedIndex = _this.props.defaultHighlightedIndex;\n        }\n        if (otherStateToSet === void 0) {\n          otherStateToSet = {};\n        }\n        otherStateToSet = pickState(otherStateToSet);\n        _this.internalSetState(_extends({\n          highlightedIndex: highlightedIndex\n        }, otherStateToSet));\n      };\n      _this.clearSelection = function (cb) {\n        _this.internalSetState({\n          selectedItem: null,\n          inputValue: '',\n          highlightedIndex: _this.props.defaultHighlightedIndex,\n          isOpen: _this.props.defaultIsOpen\n        }, cb);\n      };\n      _this.selectItem = function (item, otherStateToSet, cb) {\n        otherStateToSet = pickState(otherStateToSet);\n        _this.internalSetState(_extends({\n          isOpen: _this.props.defaultIsOpen,\n          highlightedIndex: _this.props.defaultHighlightedIndex,\n          selectedItem: item,\n          inputValue: _this.props.itemToString(item)\n        }, otherStateToSet), cb);\n      };\n      _this.selectItemAtIndex = function (itemIndex, otherStateToSet, cb) {\n        var item = _this.items[itemIndex];\n        if (item == null) {\n          return;\n        }\n        _this.selectItem(item, otherStateToSet, cb);\n      };\n      _this.selectHighlightedItem = function (otherStateToSet, cb) {\n        return _this.selectItemAtIndex(_this.getState().highlightedIndex, otherStateToSet, cb);\n      };\n      // any piece of our state can live in two places:\n      // 1. Uncontrolled: it's internal (this.state)\n      //    We will call this.setState to update that state\n      // 2. Controlled: it's external (this.props)\n      //    We will call this.props.onStateChange to update that state\n      //\n      // In addition, we'll call this.props.onChange if the\n      // selectedItem is changed.\n      _this.internalSetState = function (stateToSet, cb) {\n        var isItemSelected, onChangeArg;\n        var onStateChangeArg = {};\n        var isStateToSetFunction = typeof stateToSet === 'function';\n\n        // we want to call `onInputValueChange` before the `setState` call\n        // so someone controlling the `inputValue` state gets notified of\n        // the input change as soon as possible. This avoids issues with\n        // preserving the cursor position.\n        // See https://github.com/downshift-js/downshift/issues/217 for more info.\n        if (!isStateToSetFunction && stateToSet.hasOwnProperty('inputValue')) {\n          _this.props.onInputValueChange(stateToSet.inputValue, _extends({}, _this.getStateAndHelpers(), stateToSet));\n        }\n        return _this.setState(function (state) {\n          state = _this.getState(state);\n          var newStateToSet = isStateToSetFunction ? stateToSet(state) : stateToSet;\n\n          // Your own function that could modify the state that will be set.\n          newStateToSet = _this.props.stateReducer(state, newStateToSet);\n\n          // checks if an item is selected, regardless of if it's different from\n          // what was selected before\n          // used to determine if onSelect and onChange callbacks should be called\n          isItemSelected = newStateToSet.hasOwnProperty('selectedItem');\n          // this keeps track of the object we want to call with setState\n          var nextState = {};\n          // we need to call on change if the outside world is controlling any of our state\n          // and we're trying to update that state. OR if the selection has changed and we're\n          // trying to update the selection\n          if (isItemSelected && newStateToSet.selectedItem !== state.selectedItem) {\n            onChangeArg = newStateToSet.selectedItem;\n          }\n          newStateToSet.type = newStateToSet.type || unknown;\n          Object.keys(newStateToSet).forEach(function (key) {\n            // onStateChangeArg should only have the state that is\n            // actually changing\n            if (state[key] !== newStateToSet[key]) {\n              onStateChangeArg[key] = newStateToSet[key];\n            }\n            // the type is useful for the onStateChangeArg\n            // but we don't actually want to set it in internal state.\n            // this is an undocumented feature for now... Not all internalSetState\n            // calls support it and I'm not certain we want them to yet.\n            // But it enables users controlling the isOpen state to know when\n            // the isOpen state changes due to mouseup events which is quite handy.\n            if (key === 'type') {\n              return;\n            }\n            newStateToSet[key];\n            // if it's coming from props, then we don't care to set it internally\n            if (!isControlledProp(_this.props, key)) {\n              nextState[key] = newStateToSet[key];\n            }\n          });\n\n          // if stateToSet is a function, then we weren't able to call onInputValueChange\n          // earlier, so we'll call it now that we know what the inputValue state will be.\n          if (isStateToSetFunction && newStateToSet.hasOwnProperty('inputValue')) {\n            _this.props.onInputValueChange(newStateToSet.inputValue, _extends({}, _this.getStateAndHelpers(), newStateToSet));\n          }\n          return nextState;\n        }, function () {\n          // call the provided callback if it's a function\n          cbToCb(cb)();\n\n          // only call the onStateChange and onChange callbacks if\n          // we have relevant information to pass them.\n          var hasMoreStateThanType = Object.keys(onStateChangeArg).length > 1;\n          if (hasMoreStateThanType) {\n            _this.props.onStateChange(onStateChangeArg, _this.getStateAndHelpers());\n          }\n          if (isItemSelected) {\n            _this.props.onSelect(stateToSet.selectedItem, _this.getStateAndHelpers());\n          }\n          if (onChangeArg !== undefined) {\n            _this.props.onChange(onChangeArg, _this.getStateAndHelpers());\n          }\n          // this is currently undocumented and therefore subject to change\n          // We'll try to not break it, but just be warned.\n          _this.props.onUserAction(onStateChangeArg, _this.getStateAndHelpers());\n        });\n      };\n      //////////////////////////// ROOT\n      _this.rootRef = function (node) {\n        return _this._rootNode = node;\n      };\n      _this.getRootProps = function (_temp, _temp2) {\n        var _extends2;\n        var _ref = _temp === void 0 ? {} : _temp,\n          _ref$refKey = _ref.refKey,\n          refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey,\n          ref = _ref.ref,\n          rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);\n        var _ref2 = _temp2 === void 0 ? {} : _temp2,\n          _ref2$suppressRefErro = _ref2.suppressRefError,\n          suppressRefError = _ref2$suppressRefErro === void 0 ? false : _ref2$suppressRefErro;\n        // this is used in the render to know whether the user has called getRootProps.\n        // It uses that to know whether to apply the props automatically\n        _this.getRootProps.called = true;\n        _this.getRootProps.refKey = refKey;\n        _this.getRootProps.suppressRefError = suppressRefError;\n        var _this$getState = _this.getState(),\n          isOpen = _this$getState.isOpen;\n        return _extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, _this.rootRef), _extends2.role = 'combobox', _extends2['aria-expanded'] = isOpen, _extends2['aria-haspopup'] = 'listbox', _extends2['aria-owns'] = isOpen ? _this.menuId : null, _extends2['aria-labelledby'] = _this.labelId, _extends2), rest);\n      };\n      //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ROOT\n      _this.keyDownHandlers = {\n        ArrowDown: function ArrowDown(event) {\n          var _this2 = this;\n          event.preventDefault();\n          if (this.getState().isOpen) {\n            var amount = event.shiftKey ? 5 : 1;\n            this.moveHighlightedIndex(amount, {\n              type: keyDownArrowDown\n            });\n          } else {\n            this.internalSetState({\n              isOpen: true,\n              type: keyDownArrowDown\n            }, function () {\n              var itemCount = _this2.getItemCount();\n              if (itemCount > 0) {\n                var _this2$getState = _this2.getState(),\n                  highlightedIndex = _this2$getState.highlightedIndex;\n                var nextHighlightedIndex = getNextWrappingIndex(1, highlightedIndex, itemCount, function (index) {\n                  return _this2.getItemNodeFromIndex(index);\n                });\n                _this2.setHighlightedIndex(nextHighlightedIndex, {\n                  type: keyDownArrowDown\n                });\n              }\n            });\n          }\n        },\n        ArrowUp: function ArrowUp(event) {\n          var _this3 = this;\n          event.preventDefault();\n          if (this.getState().isOpen) {\n            var amount = event.shiftKey ? -5 : -1;\n            this.moveHighlightedIndex(amount, {\n              type: keyDownArrowUp\n            });\n          } else {\n            this.internalSetState({\n              isOpen: true,\n              type: keyDownArrowUp\n            }, function () {\n              var itemCount = _this3.getItemCount();\n              if (itemCount > 0) {\n                var _this3$getState = _this3.getState(),\n                  highlightedIndex = _this3$getState.highlightedIndex;\n                var nextHighlightedIndex = getNextWrappingIndex(-1, highlightedIndex, itemCount, function (index) {\n                  return _this3.getItemNodeFromIndex(index);\n                });\n                _this3.setHighlightedIndex(nextHighlightedIndex, {\n                  type: keyDownArrowUp\n                });\n              }\n            });\n          }\n        },\n        Enter: function Enter(event) {\n          if (event.which === 229) {\n            return;\n          }\n          var _this$getState2 = this.getState(),\n            isOpen = _this$getState2.isOpen,\n            highlightedIndex = _this$getState2.highlightedIndex;\n          if (isOpen && highlightedIndex != null) {\n            event.preventDefault();\n            var item = this.items[highlightedIndex];\n            var itemNode = this.getItemNodeFromIndex(highlightedIndex);\n            if (item == null || itemNode && itemNode.hasAttribute('disabled')) {\n              return;\n            }\n            this.selectHighlightedItem({\n              type: keyDownEnter\n            });\n          }\n        },\n        Escape: function Escape(event) {\n          event.preventDefault();\n          this.reset(_extends({\n            type: keyDownEscape\n          }, !this.state.isOpen && {\n            selectedItem: null,\n            inputValue: ''\n          }));\n        }\n      };\n      //////////////////////////// BUTTON\n      _this.buttonKeyDownHandlers = _extends({}, _this.keyDownHandlers, {\n        ' ': function _(event) {\n          event.preventDefault();\n          this.toggleMenu({\n            type: keyDownSpaceButton\n          });\n        }\n      });\n      _this.inputKeyDownHandlers = _extends({}, _this.keyDownHandlers, {\n        Home: function Home(event) {\n          var _this4 = this;\n          var _this$getState3 = this.getState(),\n            isOpen = _this$getState3.isOpen;\n          if (!isOpen) {\n            return;\n          }\n          event.preventDefault();\n          var itemCount = this.getItemCount();\n          if (itemCount <= 0 || !isOpen) {\n            return;\n          }\n\n          // get next non-disabled starting downwards from 0 if that's disabled.\n          var newHighlightedIndex = getNextNonDisabledIndex(1, 0, itemCount, function (index) {\n            return _this4.getItemNodeFromIndex(index);\n          }, false);\n          this.setHighlightedIndex(newHighlightedIndex, {\n            type: keyDownHome\n          });\n        },\n        End: function End(event) {\n          var _this5 = this;\n          var _this$getState4 = this.getState(),\n            isOpen = _this$getState4.isOpen;\n          if (!isOpen) {\n            return;\n          }\n          event.preventDefault();\n          var itemCount = this.getItemCount();\n          if (itemCount <= 0 || !isOpen) {\n            return;\n          }\n\n          // get next non-disabled starting upwards from last index if that's disabled.\n          var newHighlightedIndex = getNextNonDisabledIndex(-1, itemCount - 1, itemCount, function (index) {\n            return _this5.getItemNodeFromIndex(index);\n          }, false);\n          this.setHighlightedIndex(newHighlightedIndex, {\n            type: keyDownEnd\n          });\n        }\n      });\n      _this.getToggleButtonProps = function (_temp3) {\n        var _ref3 = _temp3 === void 0 ? {} : _temp3,\n          onClick = _ref3.onClick;\n          _ref3.onPress;\n          var onKeyDown = _ref3.onKeyDown,\n          onKeyUp = _ref3.onKeyUp,\n          onBlur = _ref3.onBlur,\n          rest = _objectWithoutPropertiesLoose(_ref3, _excluded2$3);\n        var _this$getState5 = _this.getState(),\n          isOpen = _this$getState5.isOpen;\n        var enabledEventHandlers = {\n          onClick: callAllEventHandlers(onClick, _this.buttonHandleClick),\n          onKeyDown: callAllEventHandlers(onKeyDown, _this.buttonHandleKeyDown),\n          onKeyUp: callAllEventHandlers(onKeyUp, _this.buttonHandleKeyUp),\n          onBlur: callAllEventHandlers(onBlur, _this.buttonHandleBlur)\n        };\n        var eventHandlers = rest.disabled ? {} : enabledEventHandlers;\n        return _extends({\n          type: 'button',\n          role: 'button',\n          'aria-label': isOpen ? 'close menu' : 'open menu',\n          'aria-haspopup': true,\n          'data-toggle': true\n        }, eventHandlers, rest);\n      };\n      _this.buttonHandleKeyUp = function (event) {\n        // Prevent click event from emitting in Firefox\n        event.preventDefault();\n      };\n      _this.buttonHandleKeyDown = function (event) {\n        var key = normalizeArrowKey(event);\n        if (_this.buttonKeyDownHandlers[key]) {\n          _this.buttonKeyDownHandlers[key].call(_assertThisInitialized(_this), event);\n        }\n      };\n      _this.buttonHandleClick = function (event) {\n        event.preventDefault();\n        // handle odd case for Safari and Firefox which\n        // don't give the button the focus properly.\n        /* istanbul ignore if (can't reasonably test this) */\n        if (_this.props.environment.document.activeElement === _this.props.environment.document.body) {\n          event.target.focus();\n        }\n        // to simplify testing components that use downshift, we'll not wrap this in a setTimeout\n        // if the NODE_ENV is test. With the proper build system, this should be dead code eliminated\n        // when building for production and should therefore have no impact on production code.\n        if (process.env.NODE_ENV === 'test') {\n          _this.toggleMenu({\n            type: clickButton\n          });\n        } else {\n          // Ensure that toggle of menu occurs after the potential blur event in iOS\n          _this.internalSetTimeout(function () {\n            return _this.toggleMenu({\n              type: clickButton\n            });\n          });\n        }\n      };\n      _this.buttonHandleBlur = function (event) {\n        var blurTarget = event.target; // Save blur target for comparison with activeElement later\n        // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not body element\n        _this.internalSetTimeout(function () {\n          if (!_this.isMouseDown && (_this.props.environment.document.activeElement == null || _this.props.environment.document.activeElement.id !== _this.inputId) && _this.props.environment.document.activeElement !== blurTarget // Do nothing if we refocus the same element again (to solve issue in Safari on iOS)\n          ) {\n            _this.reset({\n              type: blurButton\n            });\n          }\n        });\n      };\n      //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ BUTTON\n      /////////////////////////////// LABEL\n      _this.getLabelProps = function (props) {\n        return _extends({\n          htmlFor: _this.inputId,\n          id: _this.labelId\n        }, props);\n      };\n      //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ LABEL\n      /////////////////////////////// INPUT\n      _this.getInputProps = function (_temp4) {\n        var _ref4 = _temp4 === void 0 ? {} : _temp4,\n          onKeyDown = _ref4.onKeyDown,\n          onBlur = _ref4.onBlur,\n          onChange = _ref4.onChange,\n          onInput = _ref4.onInput;\n          _ref4.onChangeText;\n          var rest = _objectWithoutPropertiesLoose(_ref4, _excluded3$2);\n        var onChangeKey;\n        var eventHandlers = {};\n\n        /* istanbul ignore next (preact) */\n        {\n          onChangeKey = 'onChange';\n        }\n        var _this$getState6 = _this.getState(),\n          inputValue = _this$getState6.inputValue,\n          isOpen = _this$getState6.isOpen,\n          highlightedIndex = _this$getState6.highlightedIndex;\n        if (!rest.disabled) {\n          var _eventHandlers;\n          eventHandlers = (_eventHandlers = {}, _eventHandlers[onChangeKey] = callAllEventHandlers(onChange, onInput, _this.inputHandleChange), _eventHandlers.onKeyDown = callAllEventHandlers(onKeyDown, _this.inputHandleKeyDown), _eventHandlers.onBlur = callAllEventHandlers(onBlur, _this.inputHandleBlur), _eventHandlers);\n        }\n        return _extends({\n          'aria-autocomplete': 'list',\n          'aria-activedescendant': isOpen && typeof highlightedIndex === 'number' && highlightedIndex >= 0 ? _this.getItemId(highlightedIndex) : null,\n          'aria-controls': isOpen ? _this.menuId : null,\n          'aria-labelledby': rest && rest['aria-label'] ? undefined : _this.labelId,\n          // https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion\n          // revert back since autocomplete=\"nope\" is ignored on latest Chrome and Opera\n          autoComplete: 'off',\n          value: inputValue,\n          id: _this.inputId\n        }, eventHandlers, rest);\n      };\n      _this.inputHandleKeyDown = function (event) {\n        var key = normalizeArrowKey(event);\n        if (key && _this.inputKeyDownHandlers[key]) {\n          _this.inputKeyDownHandlers[key].call(_assertThisInitialized(_this), event);\n        }\n      };\n      _this.inputHandleChange = function (event) {\n        _this.internalSetState({\n          type: changeInput,\n          isOpen: true,\n          inputValue: event.target.value,\n          highlightedIndex: _this.props.defaultHighlightedIndex\n        });\n      };\n      _this.inputHandleBlur = function () {\n        // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not the body element\n        _this.internalSetTimeout(function () {\n          var downshiftButtonIsActive = _this.props.environment.document && !!_this.props.environment.document.activeElement && !!_this.props.environment.document.activeElement.dataset && _this.props.environment.document.activeElement.dataset.toggle && _this._rootNode && _this._rootNode.contains(_this.props.environment.document.activeElement);\n          if (!_this.isMouseDown && !downshiftButtonIsActive) {\n            _this.reset({\n              type: blurInput\n            });\n          }\n        });\n      };\n      //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ INPUT\n      /////////////////////////////// MENU\n      _this.menuRef = function (node) {\n        _this._menuNode = node;\n      };\n      _this.getMenuProps = function (_temp5, _temp6) {\n        var _extends3;\n        var _ref5 = _temp5 === void 0 ? {} : _temp5,\n          _ref5$refKey = _ref5.refKey,\n          refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,\n          ref = _ref5.ref,\n          props = _objectWithoutPropertiesLoose(_ref5, _excluded4$1);\n        var _ref6 = _temp6 === void 0 ? {} : _temp6,\n          _ref6$suppressRefErro = _ref6.suppressRefError,\n          suppressRefError = _ref6$suppressRefErro === void 0 ? false : _ref6$suppressRefErro;\n        _this.getMenuProps.called = true;\n        _this.getMenuProps.refKey = refKey;\n        _this.getMenuProps.suppressRefError = suppressRefError;\n        return _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, _this.menuRef), _extends3.role = 'listbox', _extends3['aria-labelledby'] = props && props['aria-label'] ? null : _this.labelId, _extends3.id = _this.menuId, _extends3), props);\n      };\n      //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ MENU\n      /////////////////////////////// ITEM\n      _this.getItemProps = function (_temp7) {\n        var _enabledEventHandlers;\n        var _ref7 = _temp7 === void 0 ? {} : _temp7,\n          onMouseMove = _ref7.onMouseMove,\n          onMouseDown = _ref7.onMouseDown,\n          onClick = _ref7.onClick;\n          _ref7.onPress;\n          var index = _ref7.index,\n          _ref7$item = _ref7.item,\n          item = _ref7$item === void 0 ? process.env.NODE_ENV === 'production' ? /* istanbul ignore next */undefined : requiredProp('getItemProps', 'item') : _ref7$item,\n          rest = _objectWithoutPropertiesLoose(_ref7, _excluded5);\n        if (index === undefined) {\n          _this.items.push(item);\n          index = _this.items.indexOf(item);\n        } else {\n          _this.items[index] = item;\n        }\n        var onSelectKey = 'onClick';\n        var customClickHandler = onClick;\n        var enabledEventHandlers = (_enabledEventHandlers = {\n          // onMouseMove is used over onMouseEnter here. onMouseMove\n          // is only triggered on actual mouse movement while onMouseEnter\n          // can fire on DOM changes, interrupting keyboard navigation\n          onMouseMove: callAllEventHandlers(onMouseMove, function () {\n            if (index === _this.getState().highlightedIndex) {\n              return;\n            }\n            _this.setHighlightedIndex(index, {\n              type: itemMouseEnter\n            });\n\n            // We never want to manually scroll when changing state based\n            // on `onMouseMove` because we will be moving the element out\n            // from under the user which is currently scrolling/moving the\n            // cursor\n            _this.avoidScrolling = true;\n            _this.internalSetTimeout(function () {\n              return _this.avoidScrolling = false;\n            }, 250);\n          }),\n          onMouseDown: callAllEventHandlers(onMouseDown, function (event) {\n            // This prevents the activeElement from being changed\n            // to the item so it can remain with the current activeElement\n            // which is a more common use case.\n            event.preventDefault();\n          })\n        }, _enabledEventHandlers[onSelectKey] = callAllEventHandlers(customClickHandler, function () {\n          _this.selectItemAtIndex(index, {\n            type: clickItem\n          });\n        }), _enabledEventHandlers);\n\n        // Passing down the onMouseDown handler to prevent redirect\n        // of the activeElement if clicking on disabled items\n        var eventHandlers = rest.disabled ? {\n          onMouseDown: enabledEventHandlers.onMouseDown\n        } : enabledEventHandlers;\n        return _extends({\n          id: _this.getItemId(index),\n          role: 'option',\n          'aria-selected': _this.getState().highlightedIndex === index\n        }, eventHandlers, rest);\n      };\n      //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ITEM\n      _this.clearItems = function () {\n        _this.items = [];\n      };\n      _this.reset = function (otherStateToSet, cb) {\n        if (otherStateToSet === void 0) {\n          otherStateToSet = {};\n        }\n        otherStateToSet = pickState(otherStateToSet);\n        _this.internalSetState(function (_ref8) {\n          var selectedItem = _ref8.selectedItem;\n          return _extends({\n            isOpen: _this.props.defaultIsOpen,\n            highlightedIndex: _this.props.defaultHighlightedIndex,\n            inputValue: _this.props.itemToString(selectedItem)\n          }, otherStateToSet);\n        }, cb);\n      };\n      _this.toggleMenu = function (otherStateToSet, cb) {\n        if (otherStateToSet === void 0) {\n          otherStateToSet = {};\n        }\n        otherStateToSet = pickState(otherStateToSet);\n        _this.internalSetState(function (_ref9) {\n          var isOpen = _ref9.isOpen;\n          return _extends({\n            isOpen: !isOpen\n          }, isOpen && {\n            highlightedIndex: _this.props.defaultHighlightedIndex\n          }, otherStateToSet);\n        }, function () {\n          var _this$getState7 = _this.getState(),\n            isOpen = _this$getState7.isOpen,\n            highlightedIndex = _this$getState7.highlightedIndex;\n          if (isOpen) {\n            if (_this.getItemCount() > 0 && typeof highlightedIndex === 'number') {\n              _this.setHighlightedIndex(highlightedIndex, otherStateToSet);\n            }\n          }\n          cbToCb(cb)();\n        });\n      };\n      _this.openMenu = function (cb) {\n        _this.internalSetState({\n          isOpen: true\n        }, cb);\n      };\n      _this.closeMenu = function (cb) {\n        _this.internalSetState({\n          isOpen: false\n        }, cb);\n      };\n      _this.updateStatus = debounce(function () {\n        var state = _this.getState();\n        var item = _this.items[state.highlightedIndex];\n        var resultCount = _this.getItemCount();\n        var status = _this.props.getA11yStatusMessage(_extends({\n          itemToString: _this.props.itemToString,\n          previousResultCount: _this.previousResultCount,\n          resultCount: resultCount,\n          highlightedItem: item\n        }, state));\n        _this.previousResultCount = resultCount;\n        setStatus(status, _this.props.environment.document);\n      }, 200);\n      var _this$props = _this.props,\n        defaultHighlightedIndex = _this$props.defaultHighlightedIndex,\n        _this$props$initialHi = _this$props.initialHighlightedIndex,\n        _highlightedIndex = _this$props$initialHi === void 0 ? defaultHighlightedIndex : _this$props$initialHi,\n        defaultIsOpen = _this$props.defaultIsOpen,\n        _this$props$initialIs = _this$props.initialIsOpen,\n        _isOpen = _this$props$initialIs === void 0 ? defaultIsOpen : _this$props$initialIs,\n        _this$props$initialIn = _this$props.initialInputValue,\n        _inputValue = _this$props$initialIn === void 0 ? '' : _this$props$initialIn,\n        _this$props$initialSe = _this$props.initialSelectedItem,\n        _selectedItem = _this$props$initialSe === void 0 ? null : _this$props$initialSe;\n      var _state = _this.getState({\n        highlightedIndex: _highlightedIndex,\n        isOpen: _isOpen,\n        inputValue: _inputValue,\n        selectedItem: _selectedItem\n      });\n      if (_state.selectedItem != null && _this.props.initialInputValue === undefined) {\n        _state.inputValue = _this.props.itemToString(_state.selectedItem);\n      }\n      _this.state = _state;\n      return _this;\n    }\n    var _proto = Downshift.prototype;\n    /**\n     * Clear all running timeouts\n     */\n    _proto.internalClearTimeouts = function internalClearTimeouts() {\n      this.timeoutIds.forEach(function (id) {\n        clearTimeout(id);\n      });\n      this.timeoutIds = [];\n    }\n\n    /**\n     * Gets the state based on internal state or props\n     * If a state value is passed via props, then that\n     * is the value given, otherwise it's retrieved from\n     * stateToMerge\n     *\n     * @param {Object} stateToMerge defaults to this.state\n     * @return {Object} the state\n     */;\n    _proto.getState = function getState$1(stateToMerge) {\n      if (stateToMerge === void 0) {\n        stateToMerge = this.state;\n      }\n      return getState(stateToMerge, this.props);\n    };\n    _proto.getItemCount = function getItemCount() {\n      // things read better this way. They're in priority order:\n      // 1. `this.itemCount`\n      // 2. `this.props.itemCount`\n      // 3. `this.items.length`\n      var itemCount = this.items.length;\n      if (this.itemCount != null) {\n        itemCount = this.itemCount;\n      } else if (this.props.itemCount !== undefined) {\n        itemCount = this.props.itemCount;\n      }\n      return itemCount;\n    };\n    _proto.getItemNodeFromIndex = function getItemNodeFromIndex(index) {\n      return this.props.environment.document.getElementById(this.getItemId(index));\n    };\n    _proto.scrollHighlightedItemIntoView = function scrollHighlightedItemIntoView() {\n      /* istanbul ignore else (react-native) */\n      {\n        var node = this.getItemNodeFromIndex(this.getState().highlightedIndex);\n        this.props.scrollIntoView(node, this._menuNode);\n      }\n    };\n    _proto.moveHighlightedIndex = function moveHighlightedIndex(amount, otherStateToSet) {\n      var _this6 = this;\n      var itemCount = this.getItemCount();\n      var _this$getState8 = this.getState(),\n        highlightedIndex = _this$getState8.highlightedIndex;\n      if (itemCount > 0) {\n        var nextHighlightedIndex = getNextWrappingIndex(amount, highlightedIndex, itemCount, function (index) {\n          return _this6.getItemNodeFromIndex(index);\n        });\n        this.setHighlightedIndex(nextHighlightedIndex, otherStateToSet);\n      }\n    };\n    _proto.getStateAndHelpers = function getStateAndHelpers() {\n      var _this$getState9 = this.getState(),\n        highlightedIndex = _this$getState9.highlightedIndex,\n        inputValue = _this$getState9.inputValue,\n        selectedItem = _this$getState9.selectedItem,\n        isOpen = _this$getState9.isOpen;\n      var itemToString = this.props.itemToString;\n      var id = this.id;\n      var getRootProps = this.getRootProps,\n        getToggleButtonProps = this.getToggleButtonProps,\n        getLabelProps = this.getLabelProps,\n        getMenuProps = this.getMenuProps,\n        getInputProps = this.getInputProps,\n        getItemProps = this.getItemProps,\n        openMenu = this.openMenu,\n        closeMenu = this.closeMenu,\n        toggleMenu = this.toggleMenu,\n        selectItem = this.selectItem,\n        selectItemAtIndex = this.selectItemAtIndex,\n        selectHighlightedItem = this.selectHighlightedItem,\n        setHighlightedIndex = this.setHighlightedIndex,\n        clearSelection = this.clearSelection,\n        clearItems = this.clearItems,\n        reset = this.reset,\n        setItemCount = this.setItemCount,\n        unsetItemCount = this.unsetItemCount,\n        setState = this.internalSetState;\n      return {\n        // prop getters\n        getRootProps: getRootProps,\n        getToggleButtonProps: getToggleButtonProps,\n        getLabelProps: getLabelProps,\n        getMenuProps: getMenuProps,\n        getInputProps: getInputProps,\n        getItemProps: getItemProps,\n        // actions\n        reset: reset,\n        openMenu: openMenu,\n        closeMenu: closeMenu,\n        toggleMenu: toggleMenu,\n        selectItem: selectItem,\n        selectItemAtIndex: selectItemAtIndex,\n        selectHighlightedItem: selectHighlightedItem,\n        setHighlightedIndex: setHighlightedIndex,\n        clearSelection: clearSelection,\n        clearItems: clearItems,\n        setItemCount: setItemCount,\n        unsetItemCount: unsetItemCount,\n        setState: setState,\n        // props\n        itemToString: itemToString,\n        // derived\n        id: id,\n        // state\n        highlightedIndex: highlightedIndex,\n        inputValue: inputValue,\n        isOpen: isOpen,\n        selectedItem: selectedItem\n      };\n    };\n    _proto.componentDidMount = function componentDidMount() {\n      var _this7 = this;\n      /* istanbul ignore if (react-native) */\n      if (process.env.NODE_ENV !== 'production' && !false && this.getMenuProps.called && !this.getMenuProps.suppressRefError) {\n        validateGetMenuPropsCalledCorrectly(this._menuNode, this.getMenuProps);\n      }\n\n      /* istanbul ignore if (react-native) */\n      {\n        // this.isMouseDown helps us track whether the mouse is currently held down.\n        // This is useful when the user clicks on an item in the list, but holds the mouse\n        // down long enough for the list to disappear (because the blur event fires on the input)\n        // this.isMouseDown is used in the blur handler on the input to determine whether the blur event should\n        // trigger hiding the menu.\n        var onMouseDown = function onMouseDown() {\n          _this7.isMouseDown = true;\n        };\n        var onMouseUp = function onMouseUp(event) {\n          _this7.isMouseDown = false;\n          // if the target element or the activeElement is within a downshift node\n          // then we don't want to reset downshift\n          var contextWithinDownshift = targetWithinDownshift(event.target, [_this7._rootNode, _this7._menuNode], _this7.props.environment);\n          if (!contextWithinDownshift && _this7.getState().isOpen) {\n            _this7.reset({\n              type: mouseUp\n            }, function () {\n              return _this7.props.onOuterClick(_this7.getStateAndHelpers());\n            });\n          }\n        };\n        // Touching an element in iOS gives focus and hover states, but touching out of\n        // the element will remove hover, and persist the focus state, resulting in the\n        // blur event not being triggered.\n        // this.isTouchMove helps us track whether the user is tapping or swiping on a touch screen.\n        // If the user taps outside of Downshift, the component should be reset,\n        // but not if the user is swiping\n        var onTouchStart = function onTouchStart() {\n          _this7.isTouchMove = false;\n        };\n        var onTouchMove = function onTouchMove() {\n          _this7.isTouchMove = true;\n        };\n        var onTouchEnd = function onTouchEnd(event) {\n          var contextWithinDownshift = targetWithinDownshift(event.target, [_this7._rootNode, _this7._menuNode], _this7.props.environment, false);\n          if (!_this7.isTouchMove && !contextWithinDownshift && _this7.getState().isOpen) {\n            _this7.reset({\n              type: touchEnd\n            }, function () {\n              return _this7.props.onOuterClick(_this7.getStateAndHelpers());\n            });\n          }\n        };\n        var environment = this.props.environment;\n        environment.addEventListener('mousedown', onMouseDown);\n        environment.addEventListener('mouseup', onMouseUp);\n        environment.addEventListener('touchstart', onTouchStart);\n        environment.addEventListener('touchmove', onTouchMove);\n        environment.addEventListener('touchend', onTouchEnd);\n        this.cleanup = function () {\n          _this7.internalClearTimeouts();\n          _this7.updateStatus.cancel();\n          environment.removeEventListener('mousedown', onMouseDown);\n          environment.removeEventListener('mouseup', onMouseUp);\n          environment.removeEventListener('touchstart', onTouchStart);\n          environment.removeEventListener('touchmove', onTouchMove);\n          environment.removeEventListener('touchend', onTouchEnd);\n        };\n      }\n    };\n    _proto.shouldScroll = function shouldScroll(prevState, prevProps) {\n      var _ref10 = this.props.highlightedIndex === undefined ? this.getState() : this.props,\n        currentHighlightedIndex = _ref10.highlightedIndex;\n      var _ref11 = prevProps.highlightedIndex === undefined ? prevState : prevProps,\n        prevHighlightedIndex = _ref11.highlightedIndex;\n      var scrollWhenOpen = currentHighlightedIndex && this.getState().isOpen && !prevState.isOpen;\n      var scrollWhenNavigating = currentHighlightedIndex !== prevHighlightedIndex;\n      return scrollWhenOpen || scrollWhenNavigating;\n    };\n    _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {\n      if (process.env.NODE_ENV !== 'production') {\n        validateControlledUnchanged(this.state, prevProps, this.props);\n        /* istanbul ignore if (react-native) */\n        if (this.getMenuProps.called && !this.getMenuProps.suppressRefError) {\n          validateGetMenuPropsCalledCorrectly(this._menuNode, this.getMenuProps);\n        }\n      }\n      if (isControlledProp(this.props, 'selectedItem') && this.props.selectedItemChanged(prevProps.selectedItem, this.props.selectedItem)) {\n        this.internalSetState({\n          type: controlledPropUpdatedSelectedItem,\n          inputValue: this.props.itemToString(this.props.selectedItem)\n        });\n      }\n      if (!this.avoidScrolling && this.shouldScroll(prevState, prevProps)) {\n        this.scrollHighlightedItemIntoView();\n      }\n\n      /* istanbul ignore else (react-native) */\n      {\n        this.updateStatus();\n      }\n    };\n    _proto.componentWillUnmount = function componentWillUnmount() {\n      this.cleanup(); // avoids memory leak\n    };\n    _proto.render = function render() {\n      var children = unwrapArray(this.props.children, noop);\n      // because the items are rerendered every time we call the children\n      // we clear this out each render and it will be populated again as\n      // getItemProps is called.\n      this.clearItems();\n      // we reset this so we know whether the user calls getRootProps during\n      // this render. If they do then we don't need to do anything,\n      // if they don't then we need to clone the element they return and\n      // apply the props for them.\n      this.getRootProps.called = false;\n      this.getRootProps.refKey = undefined;\n      this.getRootProps.suppressRefError = undefined;\n      // we do something similar for getMenuProps\n      this.getMenuProps.called = false;\n      this.getMenuProps.refKey = undefined;\n      this.getMenuProps.suppressRefError = undefined;\n      // we do something similar for getLabelProps\n      this.getLabelProps.called = false;\n      // and something similar for getInputProps\n      this.getInputProps.called = false;\n      var element = unwrapArray(children(this.getStateAndHelpers()));\n      if (!element) {\n        return null;\n      }\n      if (this.getRootProps.called || this.props.suppressRefError) {\n        if (process.env.NODE_ENV !== 'production' && !this.getRootProps.suppressRefError && !this.props.suppressRefError) {\n          validateGetRootPropsCalledCorrectly(element, this.getRootProps);\n        }\n        return element;\n      } else if (isDOMElement(element)) {\n        // they didn't apply the root props, but we can clone\n        // this and apply the props ourselves\n        return /*#__PURE__*/cloneElement(element, this.getRootProps(getElementProps(element)));\n      }\n\n      /* istanbul ignore else */\n      if (process.env.NODE_ENV !== 'production') {\n        // they didn't apply the root props, but they need to\n        // otherwise we can't query around the autocomplete\n\n        throw new Error('downshift: If you return a non-DOM element, you must apply the getRootProps function');\n      }\n\n      /* istanbul ignore next */\n      return undefined;\n    };\n    return Downshift;\n  }(Component);\n  Downshift.defaultProps = {\n    defaultHighlightedIndex: null,\n    defaultIsOpen: false,\n    getA11yStatusMessage: getA11yStatusMessage$1,\n    itemToString: function itemToString(i) {\n      if (i == null) {\n        return '';\n      }\n      if (process.env.NODE_ENV !== 'production' && isPlainObject(i) && !i.hasOwnProperty('toString')) {\n        // eslint-disable-next-line no-console\n        console.warn('downshift: An object was passed to the default implementation of `itemToString`. You should probably provide your own `itemToString` implementation. Please refer to the `itemToString` API documentation.', 'The object that was passed:', i);\n      }\n      return String(i);\n    },\n    onStateChange: noop,\n    onInputValueChange: noop,\n    onUserAction: noop,\n    onChange: noop,\n    onSelect: noop,\n    onOuterClick: noop,\n    selectedItemChanged: function selectedItemChanged(prevItem, item) {\n      return prevItem !== item;\n    },\n    environment: /* istanbul ignore next (ssr) */\n    typeof window === 'undefined' ? {} : window,\n    stateReducer: function stateReducer(state, stateToSet) {\n      return stateToSet;\n    },\n    suppressRefError: false,\n    scrollIntoView: scrollIntoView\n  };\n  Downshift.stateChangeTypes = stateChangeTypes$3;\n  return Downshift;\n}();\nprocess.env.NODE_ENV !== \"production\" ? Downshift.propTypes = {\n  children: PropTypes.func,\n  defaultHighlightedIndex: PropTypes.number,\n  defaultIsOpen: PropTypes.bool,\n  initialHighlightedIndex: PropTypes.number,\n  initialSelectedItem: PropTypes.any,\n  initialInputValue: PropTypes.string,\n  initialIsOpen: PropTypes.bool,\n  getA11yStatusMessage: PropTypes.func,\n  itemToString: PropTypes.func,\n  onChange: PropTypes.func,\n  onSelect: PropTypes.func,\n  onStateChange: PropTypes.func,\n  onInputValueChange: PropTypes.func,\n  onUserAction: PropTypes.func,\n  onOuterClick: PropTypes.func,\n  selectedItemChanged: PropTypes.func,\n  stateReducer: PropTypes.func,\n  itemCount: PropTypes.number,\n  id: PropTypes.string,\n  environment: PropTypes.shape({\n    addEventListener: PropTypes.func,\n    removeEventListener: PropTypes.func,\n    document: PropTypes.shape({\n      getElementById: PropTypes.func,\n      activeElement: PropTypes.any,\n      body: PropTypes.any\n    })\n  }),\n  suppressRefError: PropTypes.bool,\n  scrollIntoView: PropTypes.func,\n  // things we keep in state for uncontrolled components\n  // but can accept as props for controlled components\n  /* eslint-disable react/no-unused-prop-types */\n  selectedItem: PropTypes.any,\n  isOpen: PropTypes.bool,\n  inputValue: PropTypes.string,\n  highlightedIndex: PropTypes.number,\n  labelId: PropTypes.string,\n  inputId: PropTypes.string,\n  menuId: PropTypes.string,\n  getItemId: PropTypes.func\n  /* eslint-enable react/no-unused-prop-types */\n} : void 0;\nvar Downshift$1 = Downshift;\nfunction validateGetMenuPropsCalledCorrectly(node, _ref12) {\n  var refKey = _ref12.refKey;\n  if (!node) {\n    // eslint-disable-next-line no-console\n    console.error(\"downshift: The ref prop \\\"\" + refKey + \"\\\" from getMenuProps was not applied correctly on your menu element.\");\n  }\n}\nfunction validateGetRootPropsCalledCorrectly(element, _ref13) {\n  var refKey = _ref13.refKey;\n  var refKeySpecified = refKey !== 'ref';\n  var isComposite = !isDOMElement(element);\n  if (isComposite && !refKeySpecified && !isForwardRef(element)) {\n    // eslint-disable-next-line no-console\n    console.error('downshift: You returned a non-DOM element. You must specify a refKey in getRootProps');\n  } else if (!isComposite && refKeySpecified) {\n    // eslint-disable-next-line no-console\n    console.error(\"downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified \\\"\" + refKey + \"\\\"\");\n  }\n  if (!isForwardRef(element) && !getElementProps(element)[refKey]) {\n    // eslint-disable-next-line no-console\n    console.error(\"downshift: You must apply the ref prop \\\"\" + refKey + \"\\\" from getRootProps onto your root element.\");\n  }\n}\n\nvar _excluded$3 = [\"isInitialMount\", \"highlightedIndex\", \"items\", \"environment\"];\nvar dropdownDefaultStateValues = {\n  highlightedIndex: -1,\n  isOpen: false,\n  selectedItem: null,\n  inputValue: ''\n};\nfunction callOnChangeProps(action, state, newState) {\n  var props = action.props,\n    type = action.type;\n  var changes = {};\n  Object.keys(state).forEach(function (key) {\n    invokeOnChangeHandler(key, action, state, newState);\n    if (newState[key] !== state[key]) {\n      changes[key] = newState[key];\n    }\n  });\n  if (props.onStateChange && Object.keys(changes).length) {\n    props.onStateChange(_extends({\n      type: type\n    }, changes));\n  }\n}\nfunction invokeOnChangeHandler(key, action, state, newState) {\n  var props = action.props,\n    type = action.type;\n  var handler = \"on\" + capitalizeString(key) + \"Change\";\n  if (props[handler] && newState[key] !== undefined && newState[key] !== state[key]) {\n    props[handler](_extends({\n      type: type\n    }, newState));\n  }\n}\n\n/**\n * Default state reducer that returns the changes.\n *\n * @param {Object} s state.\n * @param {Object} a action with changes.\n * @returns {Object} changes.\n */\nfunction stateReducer(s, a) {\n  return a.changes;\n}\n\n/**\n * Returns a message to be added to aria-live region when item is selected.\n *\n * @param {Object} selectionParameters Parameters required to build the message.\n * @returns {string} The a11y message.\n */\nfunction getA11ySelectionMessage(selectionParameters) {\n  var selectedItem = selectionParameters.selectedItem,\n    itemToStringLocal = selectionParameters.itemToString;\n  return selectedItem ? itemToStringLocal(selectedItem) + \" has been selected.\" : '';\n}\n\n/**\n * Debounced call for updating the a11y message.\n */\nvar updateA11yStatus = debounce(function (getA11yMessage, document) {\n  setStatus(getA11yMessage(), document);\n}, 200);\n\n// istanbul ignore next\nvar useIsomorphicLayoutEffect = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined' ? useLayoutEffect : useEffect;\nfunction useElementIds(_ref) {\n  var _ref$id = _ref.id,\n    id = _ref$id === void 0 ? \"downshift-\" + generateId() : _ref$id,\n    labelId = _ref.labelId,\n    menuId = _ref.menuId,\n    getItemId = _ref.getItemId,\n    toggleButtonId = _ref.toggleButtonId,\n    inputId = _ref.inputId;\n  var elementIdsRef = useRef({\n    labelId: labelId || id + \"-label\",\n    menuId: menuId || id + \"-menu\",\n    getItemId: getItemId || function (index) {\n      return id + \"-item-\" + index;\n    },\n    toggleButtonId: toggleButtonId || id + \"-toggle-button\",\n    inputId: inputId || id + \"-input\"\n  });\n  return elementIdsRef.current;\n}\nfunction getItemAndIndex(itemProp, indexProp, items, errorMessage) {\n  var item, index;\n  if (itemProp === undefined) {\n    if (indexProp === undefined) {\n      throw new Error(errorMessage);\n    }\n    item = items[indexProp];\n    index = indexProp;\n  } else {\n    index = indexProp === undefined ? items.indexOf(itemProp) : indexProp;\n    item = itemProp;\n  }\n  return [item, index];\n}\nfunction itemToString(item) {\n  return item ? String(item) : '';\n}\nfunction isAcceptedCharacterKey(key) {\n  return /^\\S{1}$/.test(key);\n}\nfunction capitalizeString(string) {\n  return \"\" + string.slice(0, 1).toUpperCase() + string.slice(1);\n}\nfunction useLatestRef(val) {\n  var ref = useRef(val);\n  // technically this is not \"concurrent mode safe\" because we're manipulating\n  // the value during render (so it's not idempotent). However, the places this\n  // hook is used is to support memoizing callbacks which will be called\n  // *during* render, so we need the latest values *during* render.\n  // If not for this, then we'd probably want to use useLayoutEffect instead.\n  ref.current = val;\n  return ref;\n}\n\n/**\n * Computes the controlled state using a the previous state, props,\n * two reducers, one from downshift and an optional one from the user.\n * Also calls the onChange handlers for state values that have changed.\n *\n * @param {Function} reducer Reducer function from downshift.\n * @param {Object} initialState Initial state of the hook.\n * @param {Object} props The hook props.\n * @returns {Array} An array with the state and an action dispatcher.\n */\nfunction useEnhancedReducer(reducer, initialState, props) {\n  var prevStateRef = useRef();\n  var actionRef = useRef();\n  var enhancedReducer = useCallback(function (state, action) {\n    actionRef.current = action;\n    state = getState(state, action.props);\n    var changes = reducer(state, action);\n    var newState = action.props.stateReducer(state, _extends({}, action, {\n      changes: changes\n    }));\n    return newState;\n  }, [reducer]);\n  var _useReducer = useReducer(enhancedReducer, initialState),\n    state = _useReducer[0],\n    dispatch = _useReducer[1];\n  var propsRef = useLatestRef(props);\n  var dispatchWithProps = useCallback(function (action) {\n    return dispatch(_extends({\n      props: propsRef.current\n    }, action));\n  }, [propsRef]);\n  var action = actionRef.current;\n  useEffect(function () {\n    if (action && prevStateRef.current && prevStateRef.current !== state) {\n      callOnChangeProps(action, getState(prevStateRef.current, action.props), state);\n    }\n    prevStateRef.current = state;\n  }, [state, props, action]);\n  return [state, dispatchWithProps];\n}\n\n/**\n * Wraps the useEnhancedReducer and applies the controlled prop values before\n * returning the new state.\n *\n * @param {Function} reducer Reducer function from downshift.\n * @param {Object} initialState Initial state of the hook.\n * @param {Object} props The hook props.\n * @returns {Array} An array with the state and an action dispatcher.\n */\nfunction useControlledReducer$1(reducer, initialState, props) {\n  var _useEnhancedReducer = useEnhancedReducer(reducer, initialState, props),\n    state = _useEnhancedReducer[0],\n    dispatch = _useEnhancedReducer[1];\n  return [getState(state, props), dispatch];\n}\nvar defaultProps$3 = {\n  itemToString: itemToString,\n  stateReducer: stateReducer,\n  getA11ySelectionMessage: getA11ySelectionMessage,\n  scrollIntoView: scrollIntoView,\n  environment: /* istanbul ignore next (ssr) */\n  typeof window === 'undefined' ? {} : window\n};\nfunction getDefaultValue$1(props, propKey, defaultStateValues) {\n  if (defaultStateValues === void 0) {\n    defaultStateValues = dropdownDefaultStateValues;\n  }\n  var defaultValue = props[\"default\" + capitalizeString(propKey)];\n  if (defaultValue !== undefined) {\n    return defaultValue;\n  }\n  return defaultStateValues[propKey];\n}\nfunction getInitialValue$1(props, propKey, defaultStateValues) {\n  if (defaultStateValues === void 0) {\n    defaultStateValues = dropdownDefaultStateValues;\n  }\n  var value = props[propKey];\n  if (value !== undefined) {\n    return value;\n  }\n  var initialValue = props[\"initial\" + capitalizeString(propKey)];\n  if (initialValue !== undefined) {\n    return initialValue;\n  }\n  return getDefaultValue$1(props, propKey, defaultStateValues);\n}\nfunction getInitialState$2(props) {\n  var selectedItem = getInitialValue$1(props, 'selectedItem');\n  var isOpen = getInitialValue$1(props, 'isOpen');\n  var highlightedIndex = getInitialValue$1(props, 'highlightedIndex');\n  var inputValue = getInitialValue$1(props, 'inputValue');\n  return {\n    highlightedIndex: highlightedIndex < 0 && selectedItem && isOpen ? props.items.indexOf(selectedItem) : highlightedIndex,\n    isOpen: isOpen,\n    selectedItem: selectedItem,\n    inputValue: inputValue\n  };\n}\nfunction getHighlightedIndexOnOpen(props, state, offset) {\n  var items = props.items,\n    initialHighlightedIndex = props.initialHighlightedIndex,\n    defaultHighlightedIndex = props.defaultHighlightedIndex;\n  var selectedItem = state.selectedItem,\n    highlightedIndex = state.highlightedIndex;\n  if (items.length === 0) {\n    return -1;\n  }\n\n  // initialHighlightedIndex will give value to highlightedIndex on initial state only.\n  if (initialHighlightedIndex !== undefined && highlightedIndex === initialHighlightedIndex) {\n    return initialHighlightedIndex;\n  }\n  if (defaultHighlightedIndex !== undefined) {\n    return defaultHighlightedIndex;\n  }\n  if (selectedItem) {\n    return items.indexOf(selectedItem);\n  }\n  if (offset === 0) {\n    return -1;\n  }\n  return offset < 0 ? items.length - 1 : 0;\n}\n\n/**\n * Reuse the movement tracking of mouse and touch events.\n *\n * @param {boolean} isOpen Whether the dropdown is open or not.\n * @param {Array<Object>} downshiftElementRefs Downshift element refs to track movement (toggleButton, menu etc.)\n * @param {Object} environment Environment where component/hook exists.\n * @param {Function} handleBlur Handler on blur from mouse or touch.\n * @returns {Object} Ref containing whether mouseDown or touchMove event is happening\n */\nfunction useMouseAndTouchTracker(isOpen, downshiftElementRefs, environment, handleBlur) {\n  var mouseAndTouchTrackersRef = useRef({\n    isMouseDown: false,\n    isTouchMove: false\n  });\n  useEffect(function () {\n    if ((environment == null ? void 0 : environment.addEventListener) == null) {\n      return;\n    }\n\n    // The same strategy for checking if a click occurred inside or outside downshift\n    // as in downshift.js.\n    var onMouseDown = function onMouseDown() {\n      mouseAndTouchTrackersRef.current.isMouseDown = true;\n    };\n    var onMouseUp = function onMouseUp(event) {\n      mouseAndTouchTrackersRef.current.isMouseDown = false;\n      if (isOpen && !targetWithinDownshift(event.target, downshiftElementRefs.map(function (ref) {\n        return ref.current;\n      }), environment)) {\n        handleBlur();\n      }\n    };\n    var onTouchStart = function onTouchStart() {\n      mouseAndTouchTrackersRef.current.isTouchMove = false;\n    };\n    var onTouchMove = function onTouchMove() {\n      mouseAndTouchTrackersRef.current.isTouchMove = true;\n    };\n    var onTouchEnd = function onTouchEnd(event) {\n      if (isOpen && !mouseAndTouchTrackersRef.current.isTouchMove && !targetWithinDownshift(event.target, downshiftElementRefs.map(function (ref) {\n        return ref.current;\n      }), environment, false)) {\n        handleBlur();\n      }\n    };\n    environment.addEventListener('mousedown', onMouseDown);\n    environment.addEventListener('mouseup', onMouseUp);\n    environment.addEventListener('touchstart', onTouchStart);\n    environment.addEventListener('touchmove', onTouchMove);\n    environment.addEventListener('touchend', onTouchEnd);\n\n    // eslint-disable-next-line consistent-return\n    return function cleanup() {\n      environment.removeEventListener('mousedown', onMouseDown);\n      environment.removeEventListener('mouseup', onMouseUp);\n      environment.removeEventListener('touchstart', onTouchStart);\n      environment.removeEventListener('touchmove', onTouchMove);\n      environment.removeEventListener('touchend', onTouchEnd);\n    };\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [isOpen, environment]);\n  return mouseAndTouchTrackersRef;\n}\n\n/* istanbul ignore next */\n// eslint-disable-next-line import/no-mutable-exports\nvar useGetterPropsCalledChecker = function useGetterPropsCalledChecker() {\n  return noop;\n};\n/**\n * Custom hook that checks if getter props are called correctly.\n *\n * @param  {...any} propKeys Getter prop names to be handled.\n * @returns {Function} Setter function called inside getter props to set call information.\n */\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n  useGetterPropsCalledChecker = function useGetterPropsCalledChecker() {\n    var isInitialMountRef = useRef(true);\n    for (var _len = arguments.length, propKeys = new Array(_len), _key = 0; _key < _len; _key++) {\n      propKeys[_key] = arguments[_key];\n    }\n    var getterPropsCalledRef = useRef(propKeys.reduce(function (acc, propKey) {\n      acc[propKey] = {};\n      return acc;\n    }, {}));\n    useEffect(function () {\n      Object.keys(getterPropsCalledRef.current).forEach(function (propKey) {\n        var propCallInfo = getterPropsCalledRef.current[propKey];\n        if (isInitialMountRef.current) {\n          if (!Object.keys(propCallInfo).length) {\n            // eslint-disable-next-line no-console\n            console.error(\"downshift: You forgot to call the \" + propKey + \" getter function on your component / element.\");\n            return;\n          }\n        }\n        var suppressRefError = propCallInfo.suppressRefError,\n          refKey = propCallInfo.refKey,\n          elementRef = propCallInfo.elementRef;\n        if ((!elementRef || !elementRef.current) && !suppressRefError) {\n          // eslint-disable-next-line no-console\n          console.error(\"downshift: The ref prop \\\"\" + refKey + \"\\\" from \" + propKey + \" was not applied correctly on your element.\");\n        }\n      });\n      isInitialMountRef.current = false;\n    });\n    var setGetterPropCallInfo = useCallback(function (propKey, suppressRefError, refKey, elementRef) {\n      getterPropsCalledRef.current[propKey] = {\n        suppressRefError: suppressRefError,\n        refKey: refKey,\n        elementRef: elementRef\n      };\n    }, []);\n    return setGetterPropCallInfo;\n  };\n}\nfunction useA11yMessageSetter(getA11yMessage, dependencyArray, _ref2) {\n  var isInitialMount = _ref2.isInitialMount,\n    highlightedIndex = _ref2.highlightedIndex,\n    items = _ref2.items,\n    environment = _ref2.environment,\n    rest = _objectWithoutPropertiesLoose(_ref2, _excluded$3);\n  // Sets a11y status message on changes in state.\n  useEffect(function () {\n    if (isInitialMount || false) {\n      return;\n    }\n    updateA11yStatus(function () {\n      return getA11yMessage(_extends({\n        highlightedIndex: highlightedIndex,\n        highlightedItem: items[highlightedIndex],\n        resultCount: items.length\n      }, rest));\n    }, environment.document);\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, dependencyArray);\n}\nfunction useScrollIntoView(_ref3) {\n  var highlightedIndex = _ref3.highlightedIndex,\n    isOpen = _ref3.isOpen,\n    itemRefs = _ref3.itemRefs,\n    getItemNodeFromIndex = _ref3.getItemNodeFromIndex,\n    menuElement = _ref3.menuElement,\n    scrollIntoViewProp = _ref3.scrollIntoView;\n  // used not to scroll on highlight by mouse.\n  var shouldScrollRef = useRef(true);\n  // Scroll on highlighted item if change comes from keyboard.\n  useIsomorphicLayoutEffect(function () {\n    if (highlightedIndex < 0 || !isOpen || !Object.keys(itemRefs.current).length) {\n      return;\n    }\n    if (shouldScrollRef.current === false) {\n      shouldScrollRef.current = true;\n    } else {\n      scrollIntoViewProp(getItemNodeFromIndex(highlightedIndex), menuElement);\n    }\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [highlightedIndex]);\n  return shouldScrollRef;\n}\n\n// eslint-disable-next-line import/no-mutable-exports\nvar useControlPropsValidator = noop;\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n  useControlPropsValidator = function useControlPropsValidator(_ref4) {\n    var isInitialMount = _ref4.isInitialMount,\n      props = _ref4.props,\n      state = _ref4.state;\n    // used for checking when props are moving from controlled to uncontrolled.\n    var prevPropsRef = useRef(props);\n    useEffect(function () {\n      if (isInitialMount) {\n        return;\n      }\n      validateControlledUnchanged(state, prevPropsRef.current, props);\n      prevPropsRef.current = props;\n    }, [state, props, isInitialMount]);\n  };\n}\n\n/**\n * Handles selection on Enter / Alt + ArrowUp. Closes the menu and resets the highlighted index, unless there is a highlighted.\n * In that case, selects the item and resets to defaults for open state and highlighted idex.\n * @param {Object} props The useCombobox props.\n * @param {number} highlightedIndex The index from the state.\n * @param {boolean} inputValue Also return the input value for state.\n * @returns The changes for the state.\n */\nfunction getChangesOnSelection(props, highlightedIndex, inputValue) {\n  var _props$items;\n  if (inputValue === void 0) {\n    inputValue = true;\n  }\n  var shouldSelect = ((_props$items = props.items) == null ? void 0 : _props$items.length) && highlightedIndex >= 0;\n  return _extends({\n    isOpen: false,\n    highlightedIndex: -1\n  }, shouldSelect && _extends({\n    selectedItem: props.items[highlightedIndex],\n    isOpen: getDefaultValue$1(props, 'isOpen'),\n    highlightedIndex: getDefaultValue$1(props, 'highlightedIndex')\n  }, inputValue && {\n    inputValue: props.itemToString(props.items[highlightedIndex])\n  }));\n}\n\nfunction downshiftCommonReducer(state, action, stateChangeTypes) {\n  var type = action.type,\n    props = action.props;\n  var changes;\n  switch (type) {\n    case stateChangeTypes.ItemMouseMove:\n      changes = {\n        highlightedIndex: action.disabled ? -1 : action.index\n      };\n      break;\n    case stateChangeTypes.MenuMouseLeave:\n      changes = {\n        highlightedIndex: -1\n      };\n      break;\n    case stateChangeTypes.ToggleButtonClick:\n    case stateChangeTypes.FunctionToggleMenu:\n      changes = {\n        isOpen: !state.isOpen,\n        highlightedIndex: state.isOpen ? -1 : getHighlightedIndexOnOpen(props, state, 0)\n      };\n      break;\n    case stateChangeTypes.FunctionOpenMenu:\n      changes = {\n        isOpen: true,\n        highlightedIndex: getHighlightedIndexOnOpen(props, state, 0)\n      };\n      break;\n    case stateChangeTypes.FunctionCloseMenu:\n      changes = {\n        isOpen: false\n      };\n      break;\n    case stateChangeTypes.FunctionSetHighlightedIndex:\n      changes = {\n        highlightedIndex: action.highlightedIndex\n      };\n      break;\n    case stateChangeTypes.FunctionSetInputValue:\n      changes = {\n        inputValue: action.inputValue\n      };\n      break;\n    case stateChangeTypes.FunctionReset:\n      changes = {\n        highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),\n        isOpen: getDefaultValue$1(props, 'isOpen'),\n        selectedItem: getDefaultValue$1(props, 'selectedItem'),\n        inputValue: getDefaultValue$1(props, 'inputValue')\n      };\n      break;\n    default:\n      throw new Error('Reducer called without proper action type.');\n  }\n  return _extends({}, state, changes);\n}\n/* eslint-enable complexity */\n\nfunction getItemIndexByCharacterKey(_a) {\n    var keysSoFar = _a.keysSoFar, highlightedIndex = _a.highlightedIndex, items = _a.items, itemToString = _a.itemToString, getItemNodeFromIndex = _a.getItemNodeFromIndex;\n    var lowerCasedKeysSoFar = keysSoFar.toLowerCase();\n    for (var index = 0; index < items.length; index++) {\n        // if we already have a search query in progress, we also consider the current highlighted item.\n        var offsetIndex = (index + highlightedIndex + (keysSoFar.length < 2 ? 1 : 0)) % items.length;\n        var item = items[offsetIndex];\n        if (item !== undefined &&\n            itemToString(item).toLowerCase().startsWith(lowerCasedKeysSoFar)) {\n            var element = getItemNodeFromIndex(offsetIndex);\n            if (!(element === null || element === void 0 ? void 0 : element.hasAttribute('disabled'))) {\n                return offsetIndex;\n            }\n        }\n    }\n    return highlightedIndex;\n}\nvar propTypes$2 = {\n    items: PropTypes.array.isRequired,\n    itemToString: PropTypes.func,\n    getA11yStatusMessage: PropTypes.func,\n    getA11ySelectionMessage: PropTypes.func,\n    highlightedIndex: PropTypes.number,\n    defaultHighlightedIndex: PropTypes.number,\n    initialHighlightedIndex: PropTypes.number,\n    isOpen: PropTypes.bool,\n    defaultIsOpen: PropTypes.bool,\n    initialIsOpen: PropTypes.bool,\n    selectedItem: PropTypes.any,\n    initialSelectedItem: PropTypes.any,\n    defaultSelectedItem: PropTypes.any,\n    id: PropTypes.string,\n    labelId: PropTypes.string,\n    menuId: PropTypes.string,\n    getItemId: PropTypes.func,\n    toggleButtonId: PropTypes.string,\n    stateReducer: PropTypes.func,\n    onSelectedItemChange: PropTypes.func,\n    onHighlightedIndexChange: PropTypes.func,\n    onStateChange: PropTypes.func,\n    onIsOpenChange: PropTypes.func,\n    environment: PropTypes.shape({\n        addEventListener: PropTypes.func,\n        removeEventListener: PropTypes.func,\n        document: PropTypes.shape({\n            getElementById: PropTypes.func,\n            activeElement: PropTypes.any,\n            body: PropTypes.any\n        })\n    })\n};\n/**\n * Default implementation for status message. Only added when menu is open.\n * Will specift if there are results in the list, and if so, how many,\n * and what keys are relevant.\n *\n * @param {Object} param the downshift state and other relevant properties\n * @return {String} the a11y status message\n */\nfunction getA11yStatusMessage(_a) {\n    var isOpen = _a.isOpen, resultCount = _a.resultCount, previousResultCount = _a.previousResultCount;\n    if (!isOpen) {\n        return '';\n    }\n    if (!resultCount) {\n        return 'No results are available.';\n    }\n    if (resultCount !== previousResultCount) {\n        return \"\".concat(resultCount, \" result\").concat(resultCount === 1 ? ' is' : 's are', \" available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select.\");\n    }\n    return '';\n}\nvar defaultProps$2 = __assign(__assign({}, defaultProps$3), { getA11yStatusMessage: getA11yStatusMessage });\n// eslint-disable-next-line import/no-mutable-exports\nvar validatePropTypes$2 = noop;\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n    validatePropTypes$2 = function (options, caller) {\n        PropTypes.checkPropTypes(propTypes$2, options, 'prop', caller.name);\n    };\n}\n\nvar ToggleButtonClick$1 = process.env.NODE_ENV !== \"production\" ? '__togglebutton_click__' : 0;\nvar ToggleButtonKeyDownArrowDown = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_arrow_down__' : 1;\nvar ToggleButtonKeyDownArrowUp = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_arrow_up__' : 2;\nvar ToggleButtonKeyDownCharacter = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_character__' : 3;\nvar ToggleButtonKeyDownEscape = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_escape__' : 4;\nvar ToggleButtonKeyDownHome = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_home__' : 5;\nvar ToggleButtonKeyDownEnd = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_end__' : 6;\nvar ToggleButtonKeyDownEnter = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_enter__' : 7;\nvar ToggleButtonKeyDownSpaceButton = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_space_button__' : 8;\nvar ToggleButtonKeyDownPageUp = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_page_up__' : 9;\nvar ToggleButtonKeyDownPageDown = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_page_down__' : 10;\nvar ToggleButtonBlur = process.env.NODE_ENV !== \"production\" ? '__togglebutton_blur__' : 11;\nvar MenuMouseLeave$1 = process.env.NODE_ENV !== \"production\" ? '__menu_mouse_leave__' : 12;\nvar ItemMouseMove$1 = process.env.NODE_ENV !== \"production\" ? '__item_mouse_move__' : 13;\nvar ItemClick$1 = process.env.NODE_ENV !== \"production\" ? '__item_click__' : 14;\nvar FunctionToggleMenu$1 = process.env.NODE_ENV !== \"production\" ? '__function_toggle_menu__' : 15;\nvar FunctionOpenMenu$1 = process.env.NODE_ENV !== \"production\" ? '__function_open_menu__' : 16;\nvar FunctionCloseMenu$1 = process.env.NODE_ENV !== \"production\" ? '__function_close_menu__' : 17;\nvar FunctionSetHighlightedIndex$1 = process.env.NODE_ENV !== \"production\" ? '__function_set_highlighted_index__' : 18;\nvar FunctionSelectItem$1 = process.env.NODE_ENV !== \"production\" ? '__function_select_item__' : 19;\nvar FunctionSetInputValue$1 = process.env.NODE_ENV !== \"production\" ? '__function_set_input_value__' : 20;\nvar FunctionReset$2 = process.env.NODE_ENV !== \"production\" ? '__function_reset__' : 21;\n\nvar stateChangeTypes$2 = /*#__PURE__*/Object.freeze({\n  __proto__: null,\n  ToggleButtonClick: ToggleButtonClick$1,\n  ToggleButtonKeyDownArrowDown: ToggleButtonKeyDownArrowDown,\n  ToggleButtonKeyDownArrowUp: ToggleButtonKeyDownArrowUp,\n  ToggleButtonKeyDownCharacter: ToggleButtonKeyDownCharacter,\n  ToggleButtonKeyDownEscape: ToggleButtonKeyDownEscape,\n  ToggleButtonKeyDownHome: ToggleButtonKeyDownHome,\n  ToggleButtonKeyDownEnd: ToggleButtonKeyDownEnd,\n  ToggleButtonKeyDownEnter: ToggleButtonKeyDownEnter,\n  ToggleButtonKeyDownSpaceButton: ToggleButtonKeyDownSpaceButton,\n  ToggleButtonKeyDownPageUp: ToggleButtonKeyDownPageUp,\n  ToggleButtonKeyDownPageDown: ToggleButtonKeyDownPageDown,\n  ToggleButtonBlur: ToggleButtonBlur,\n  MenuMouseLeave: MenuMouseLeave$1,\n  ItemMouseMove: ItemMouseMove$1,\n  ItemClick: ItemClick$1,\n  FunctionToggleMenu: FunctionToggleMenu$1,\n  FunctionOpenMenu: FunctionOpenMenu$1,\n  FunctionCloseMenu: FunctionCloseMenu$1,\n  FunctionSetHighlightedIndex: FunctionSetHighlightedIndex$1,\n  FunctionSelectItem: FunctionSelectItem$1,\n  FunctionSetInputValue: FunctionSetInputValue$1,\n  FunctionReset: FunctionReset$2\n});\n\n/* eslint-disable complexity */\nfunction downshiftSelectReducer(state, action) {\n  var _props$items;\n  var type = action.type,\n    props = action.props,\n    altKey = action.altKey;\n  var changes;\n  switch (type) {\n    case ItemClick$1:\n      changes = {\n        isOpen: getDefaultValue$1(props, 'isOpen'),\n        highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),\n        selectedItem: props.items[action.index]\n      };\n      break;\n    case ToggleButtonKeyDownCharacter:\n      {\n        var lowercasedKey = action.key;\n        var inputValue = \"\" + state.inputValue + lowercasedKey;\n        var prevHighlightedIndex = !state.isOpen && state.selectedItem ? props.items.indexOf(state.selectedItem) : state.highlightedIndex;\n        var highlightedIndex = getItemIndexByCharacterKey({\n          keysSoFar: inputValue,\n          highlightedIndex: prevHighlightedIndex,\n          items: props.items,\n          itemToString: props.itemToString,\n          getItemNodeFromIndex: action.getItemNodeFromIndex\n        });\n        changes = {\n          inputValue: inputValue,\n          highlightedIndex: highlightedIndex,\n          isOpen: true\n        };\n      }\n      break;\n    case ToggleButtonKeyDownArrowDown:\n      {\n        var _highlightedIndex = state.isOpen ? getNextWrappingIndex(1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, false) : altKey && state.selectedItem == null ? -1 : getHighlightedIndexOnOpen(props, state, 1);\n        changes = {\n          highlightedIndex: _highlightedIndex,\n          isOpen: true\n        };\n      }\n      break;\n    case ToggleButtonKeyDownArrowUp:\n      if (state.isOpen && altKey) {\n        changes = getChangesOnSelection(props, state.highlightedIndex, false);\n      } else {\n        var _highlightedIndex2 = state.isOpen ? getNextWrappingIndex(-1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, false) : getHighlightedIndexOnOpen(props, state, -1);\n        changes = {\n          highlightedIndex: _highlightedIndex2,\n          isOpen: true\n        };\n      }\n      break;\n    // only triggered when menu is open.\n    case ToggleButtonKeyDownEnter:\n    case ToggleButtonKeyDownSpaceButton:\n      changes = getChangesOnSelection(props, state.highlightedIndex, false);\n      break;\n    case ToggleButtonKeyDownHome:\n      changes = {\n        highlightedIndex: getNextNonDisabledIndex(1, 0, props.items.length, action.getItemNodeFromIndex, false),\n        isOpen: true\n      };\n      break;\n    case ToggleButtonKeyDownEnd:\n      changes = {\n        highlightedIndex: getNextNonDisabledIndex(-1, props.items.length - 1, props.items.length, action.getItemNodeFromIndex, false),\n        isOpen: true\n      };\n      break;\n    case ToggleButtonKeyDownPageUp:\n      changes = {\n        highlightedIndex: getNextWrappingIndex(-10, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, false)\n      };\n      break;\n    case ToggleButtonKeyDownPageDown:\n      changes = {\n        highlightedIndex: getNextWrappingIndex(10, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, false)\n      };\n      break;\n    case ToggleButtonKeyDownEscape:\n      changes = {\n        isOpen: false,\n        highlightedIndex: -1\n      };\n      break;\n    case ToggleButtonBlur:\n      changes = _extends({\n        isOpen: false,\n        highlightedIndex: -1\n      }, state.highlightedIndex >= 0 && ((_props$items = props.items) == null ? void 0 : _props$items.length) && {\n        selectedItem: props.items[state.highlightedIndex]\n      });\n      break;\n    case FunctionSelectItem$1:\n      changes = {\n        selectedItem: action.selectedItem\n      };\n      break;\n    default:\n      return downshiftCommonReducer(state, action, stateChangeTypes$2);\n  }\n  return _extends({}, state, changes);\n}\n/* eslint-enable complexity */\n\nvar _excluded$2 = [\"onMouseLeave\", \"refKey\", \"onKeyDown\", \"onBlur\", \"ref\"],\n  _excluded2$2 = [\"onBlur\", \"onClick\", \"onPress\", \"onKeyDown\", \"refKey\", \"ref\"],\n  _excluded3$1 = [\"item\", \"index\", \"onMouseMove\", \"onClick\", \"onPress\", \"refKey\", \"ref\", \"disabled\"];\nuseSelect.stateChangeTypes = stateChangeTypes$2;\nfunction useSelect(userProps) {\n  if (userProps === void 0) {\n    userProps = {};\n  }\n  validatePropTypes$2(userProps, useSelect);\n  // Props defaults and destructuring.\n  var props = _extends({}, defaultProps$2, userProps);\n  var items = props.items,\n    scrollIntoView = props.scrollIntoView,\n    environment = props.environment,\n    itemToString = props.itemToString,\n    getA11ySelectionMessage = props.getA11ySelectionMessage,\n    getA11yStatusMessage = props.getA11yStatusMessage;\n  // Initial state depending on controlled props.\n  var initialState = getInitialState$2(props);\n  var _useControlledReducer = useControlledReducer$1(downshiftSelectReducer, initialState, props),\n    state = _useControlledReducer[0],\n    dispatch = _useControlledReducer[1];\n  var isOpen = state.isOpen,\n    highlightedIndex = state.highlightedIndex,\n    selectedItem = state.selectedItem,\n    inputValue = state.inputValue;\n\n  // Element efs.\n  var toggleButtonRef = useRef(null);\n  var menuRef = useRef(null);\n  var itemRefs = useRef({});\n  // used to keep the inputValue clearTimeout object between renders.\n  var clearTimeoutRef = useRef(null);\n  // prevent id re-generation between renders.\n  var elementIds = useElementIds(props);\n  // used to keep track of how many items we had on previous cycle.\n  var previousResultCountRef = useRef();\n  var isInitialMountRef = useRef(true);\n  // utility callback to get item element.\n  var latest = useLatestRef({\n    state: state,\n    props: props\n  });\n\n  // Some utils.\n  var getItemNodeFromIndex = useCallback(function (index) {\n    return itemRefs.current[elementIds.getItemId(index)];\n  }, [elementIds]);\n\n  // Effects.\n  // Sets a11y status message on changes in state.\n  useA11yMessageSetter(getA11yStatusMessage, [isOpen, highlightedIndex, inputValue, items], _extends({\n    isInitialMount: isInitialMountRef.current,\n    previousResultCount: previousResultCountRef.current,\n    items: items,\n    environment: environment,\n    itemToString: itemToString\n  }, state));\n  // Sets a11y status message on changes in selectedItem.\n  useA11yMessageSetter(getA11ySelectionMessage, [selectedItem], _extends({\n    isInitialMount: isInitialMountRef.current,\n    previousResultCount: previousResultCountRef.current,\n    items: items,\n    environment: environment,\n    itemToString: itemToString\n  }, state));\n  // Scroll on highlighted item if change comes from keyboard.\n  var shouldScrollRef = useScrollIntoView({\n    menuElement: menuRef.current,\n    highlightedIndex: highlightedIndex,\n    isOpen: isOpen,\n    itemRefs: itemRefs,\n    scrollIntoView: scrollIntoView,\n    getItemNodeFromIndex: getItemNodeFromIndex\n  });\n\n  // Sets cleanup for the keysSoFar callback, debounded after 500ms.\n  useEffect(function () {\n    // init the clean function here as we need access to dispatch.\n    clearTimeoutRef.current = debounce(function (outerDispatch) {\n      outerDispatch({\n        type: FunctionSetInputValue$1,\n        inputValue: ''\n      });\n    }, 500);\n\n    // Cancel any pending debounced calls on mount\n    return function () {\n      clearTimeoutRef.current.cancel();\n    };\n  }, []);\n\n  // Invokes the keysSoFar callback set up above.\n  useEffect(function () {\n    if (!inputValue) {\n      return;\n    }\n    clearTimeoutRef.current(dispatch);\n  }, [dispatch, inputValue]);\n  useControlPropsValidator({\n    isInitialMount: isInitialMountRef.current,\n    props: props,\n    state: state\n  });\n  useEffect(function () {\n    if (isInitialMountRef.current) {\n      return;\n    }\n    previousResultCountRef.current = items.length;\n  });\n  // Add mouse/touch events to document.\n  var mouseAndTouchTrackersRef = useMouseAndTouchTracker(isOpen, [menuRef, toggleButtonRef], environment, function () {\n    dispatch({\n      type: ToggleButtonBlur\n    });\n  });\n  var setGetterPropCallInfo = useGetterPropsCalledChecker('getMenuProps', 'getToggleButtonProps');\n  // Make initial ref false.\n  useEffect(function () {\n    isInitialMountRef.current = false;\n    return function () {\n      isInitialMountRef.current = true;\n    };\n  }, []);\n  // Reset itemRefs on close.\n  useEffect(function () {\n    if (!isOpen) {\n      itemRefs.current = {};\n    }\n  }, [isOpen]);\n\n  // Event handler functions.\n  var toggleButtonKeyDownHandlers = useMemo(function () {\n    return {\n      ArrowDown: function ArrowDown(event) {\n        event.preventDefault();\n        dispatch({\n          type: ToggleButtonKeyDownArrowDown,\n          getItemNodeFromIndex: getItemNodeFromIndex,\n          altKey: event.altKey\n        });\n      },\n      ArrowUp: function ArrowUp(event) {\n        event.preventDefault();\n        dispatch({\n          type: ToggleButtonKeyDownArrowUp,\n          getItemNodeFromIndex: getItemNodeFromIndex,\n          altKey: event.altKey\n        });\n      },\n      Home: function Home(event) {\n        event.preventDefault();\n        dispatch({\n          type: ToggleButtonKeyDownHome,\n          getItemNodeFromIndex: getItemNodeFromIndex\n        });\n      },\n      End: function End(event) {\n        event.preventDefault();\n        dispatch({\n          type: ToggleButtonKeyDownEnd,\n          getItemNodeFromIndex: getItemNodeFromIndex\n        });\n      },\n      Escape: function Escape() {\n        if (latest.current.state.isOpen) {\n          dispatch({\n            type: ToggleButtonKeyDownEscape\n          });\n        }\n      },\n      Enter: function Enter(event) {\n        event.preventDefault();\n        dispatch({\n          type: latest.current.state.isOpen ? ToggleButtonKeyDownEnter : ToggleButtonClick$1\n        });\n      },\n      PageUp: function PageUp(event) {\n        if (latest.current.state.isOpen) {\n          event.preventDefault();\n          dispatch({\n            type: ToggleButtonKeyDownPageUp,\n            getItemNodeFromIndex: getItemNodeFromIndex\n          });\n        }\n      },\n      PageDown: function PageDown(event) {\n        if (latest.current.state.isOpen) {\n          event.preventDefault();\n          dispatch({\n            type: ToggleButtonKeyDownPageDown,\n            getItemNodeFromIndex: getItemNodeFromIndex\n          });\n        }\n      },\n      ' ': function _(event) {\n        event.preventDefault();\n        var currentState = latest.current.state;\n        if (!currentState.isOpen) {\n          dispatch({\n            type: ToggleButtonClick$1\n          });\n          return;\n        }\n        if (currentState.inputValue) {\n          dispatch({\n            type: ToggleButtonKeyDownCharacter,\n            key: ' ',\n            getItemNodeFromIndex: getItemNodeFromIndex\n          });\n        } else {\n          dispatch({\n            type: ToggleButtonKeyDownSpaceButton\n          });\n        }\n      }\n    };\n  }, [dispatch, getItemNodeFromIndex, latest]);\n\n  // Action functions.\n  var toggleMenu = useCallback(function () {\n    dispatch({\n      type: FunctionToggleMenu$1\n    });\n  }, [dispatch]);\n  var closeMenu = useCallback(function () {\n    dispatch({\n      type: FunctionCloseMenu$1\n    });\n  }, [dispatch]);\n  var openMenu = useCallback(function () {\n    dispatch({\n      type: FunctionOpenMenu$1\n    });\n  }, [dispatch]);\n  var setHighlightedIndex = useCallback(function (newHighlightedIndex) {\n    dispatch({\n      type: FunctionSetHighlightedIndex$1,\n      highlightedIndex: newHighlightedIndex\n    });\n  }, [dispatch]);\n  var selectItem = useCallback(function (newSelectedItem) {\n    dispatch({\n      type: FunctionSelectItem$1,\n      selectedItem: newSelectedItem\n    });\n  }, [dispatch]);\n  var reset = useCallback(function () {\n    dispatch({\n      type: FunctionReset$2\n    });\n  }, [dispatch]);\n  var setInputValue = useCallback(function (newInputValue) {\n    dispatch({\n      type: FunctionSetInputValue$1,\n      inputValue: newInputValue\n    });\n  }, [dispatch]);\n  // Getter functions.\n  var getLabelProps = useCallback(function (labelProps) {\n    return _extends({\n      id: elementIds.labelId,\n      htmlFor: elementIds.toggleButtonId\n    }, labelProps);\n  }, [elementIds]);\n  var getMenuProps = useCallback(function (_temp, _temp2) {\n    var _extends2;\n    var _ref = _temp === void 0 ? {} : _temp,\n      onMouseLeave = _ref.onMouseLeave,\n      _ref$refKey = _ref.refKey,\n      refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey;\n      _ref.onKeyDown;\n      _ref.onBlur;\n      var ref = _ref.ref,\n      rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);\n    var _ref2 = _temp2 === void 0 ? {} : _temp2,\n      _ref2$suppressRefErro = _ref2.suppressRefError,\n      suppressRefError = _ref2$suppressRefErro === void 0 ? false : _ref2$suppressRefErro;\n    var menuHandleMouseLeave = function menuHandleMouseLeave() {\n      dispatch({\n        type: MenuMouseLeave$1\n      });\n    };\n    setGetterPropCallInfo('getMenuProps', suppressRefError, refKey, menuRef);\n    return _extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, function (menuNode) {\n      menuRef.current = menuNode;\n    }), _extends2.id = elementIds.menuId, _extends2.role = 'listbox', _extends2['aria-labelledby'] = rest && rest['aria-label'] ? undefined : \"\" + elementIds.labelId, _extends2.onMouseLeave = callAllEventHandlers(onMouseLeave, menuHandleMouseLeave), _extends2), rest);\n  }, [dispatch, setGetterPropCallInfo, elementIds]);\n  var getToggleButtonProps = useCallback(function (_temp3, _temp4) {\n    var _extends3;\n    var _ref3 = _temp3 === void 0 ? {} : _temp3,\n      onBlur = _ref3.onBlur,\n      onClick = _ref3.onClick;\n      _ref3.onPress;\n      var onKeyDown = _ref3.onKeyDown,\n      _ref3$refKey = _ref3.refKey,\n      refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,\n      ref = _ref3.ref,\n      rest = _objectWithoutPropertiesLoose(_ref3, _excluded2$2);\n    var _ref4 = _temp4 === void 0 ? {} : _temp4,\n      _ref4$suppressRefErro = _ref4.suppressRefError,\n      suppressRefError = _ref4$suppressRefErro === void 0 ? false : _ref4$suppressRefErro;\n    var latestState = latest.current.state;\n    var toggleButtonHandleClick = function toggleButtonHandleClick() {\n      dispatch({\n        type: ToggleButtonClick$1\n      });\n    };\n    var toggleButtonHandleBlur = function toggleButtonHandleBlur() {\n      if (latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) {\n        dispatch({\n          type: ToggleButtonBlur\n        });\n      }\n    };\n    var toggleButtonHandleKeyDown = function toggleButtonHandleKeyDown(event) {\n      var key = normalizeArrowKey(event);\n      if (key && toggleButtonKeyDownHandlers[key]) {\n        toggleButtonKeyDownHandlers[key](event);\n      } else if (isAcceptedCharacterKey(key)) {\n        dispatch({\n          type: ToggleButtonKeyDownCharacter,\n          key: key,\n          getItemNodeFromIndex: getItemNodeFromIndex\n        });\n      }\n    };\n    var toggleProps = _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function (toggleButtonNode) {\n      toggleButtonRef.current = toggleButtonNode;\n    }), _extends3['aria-activedescendant'] = latestState.isOpen && latestState.highlightedIndex > -1 ? elementIds.getItemId(latestState.highlightedIndex) : '', _extends3['aria-controls'] = elementIds.menuId, _extends3['aria-expanded'] = latest.current.state.isOpen, _extends3['aria-haspopup'] = 'listbox', _extends3['aria-labelledby'] = rest && rest['aria-label'] ? undefined : \"\" + elementIds.labelId, _extends3.id = elementIds.toggleButtonId, _extends3.role = 'combobox', _extends3.tabIndex = 0, _extends3.onBlur = callAllEventHandlers(onBlur, toggleButtonHandleBlur), _extends3), rest);\n    if (!rest.disabled) {\n      /* istanbul ignore if (react-native) */\n      {\n        toggleProps.onClick = callAllEventHandlers(onClick, toggleButtonHandleClick);\n        toggleProps.onKeyDown = callAllEventHandlers(onKeyDown, toggleButtonHandleKeyDown);\n      }\n    }\n    setGetterPropCallInfo('getToggleButtonProps', suppressRefError, refKey, toggleButtonRef);\n    return toggleProps;\n  }, [latest, elementIds, setGetterPropCallInfo, dispatch, mouseAndTouchTrackersRef, toggleButtonKeyDownHandlers, getItemNodeFromIndex]);\n  var getItemProps = useCallback(function (_temp5) {\n    var _extends4;\n    var _ref5 = _temp5 === void 0 ? {} : _temp5,\n      itemProp = _ref5.item,\n      indexProp = _ref5.index,\n      onMouseMove = _ref5.onMouseMove,\n      onClick = _ref5.onClick;\n      _ref5.onPress;\n      var _ref5$refKey = _ref5.refKey,\n      refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,\n      ref = _ref5.ref,\n      disabled = _ref5.disabled,\n      rest = _objectWithoutPropertiesLoose(_ref5, _excluded3$1);\n    var _latest$current = latest.current,\n      latestState = _latest$current.state,\n      latestProps = _latest$current.props;\n    var _getItemAndIndex = getItemAndIndex(itemProp, indexProp, latestProps.items, 'Pass either item or index to getItemProps!'),\n      item = _getItemAndIndex[0],\n      index = _getItemAndIndex[1];\n    var itemHandleMouseMove = function itemHandleMouseMove() {\n      if (index === latestState.highlightedIndex) {\n        return;\n      }\n      shouldScrollRef.current = false;\n      dispatch({\n        type: ItemMouseMove$1,\n        index: index,\n        disabled: disabled\n      });\n    };\n    var itemHandleClick = function itemHandleClick() {\n      dispatch({\n        type: ItemClick$1,\n        index: index\n      });\n    };\n    var itemProps = _extends((_extends4 = {\n      disabled: disabled,\n      role: 'option',\n      'aria-selected': \"\" + (item === selectedItem),\n      id: elementIds.getItemId(index)\n    }, _extends4[refKey] = handleRefs(ref, function (itemNode) {\n      if (itemNode) {\n        itemRefs.current[elementIds.getItemId(index)] = itemNode;\n      }\n    }), _extends4), rest);\n    if (!disabled) {\n      /* istanbul ignore next (react-native) */\n      {\n        itemProps.onClick = callAllEventHandlers(onClick, itemHandleClick);\n      }\n    }\n    itemProps.onMouseMove = callAllEventHandlers(onMouseMove, itemHandleMouseMove);\n    return itemProps;\n  }, [latest, selectedItem, elementIds, shouldScrollRef, dispatch]);\n  return {\n    // prop getters.\n    getToggleButtonProps: getToggleButtonProps,\n    getLabelProps: getLabelProps,\n    getMenuProps: getMenuProps,\n    getItemProps: getItemProps,\n    // actions.\n    toggleMenu: toggleMenu,\n    openMenu: openMenu,\n    closeMenu: closeMenu,\n    setHighlightedIndex: setHighlightedIndex,\n    selectItem: selectItem,\n    reset: reset,\n    setInputValue: setInputValue,\n    // state.\n    highlightedIndex: highlightedIndex,\n    isOpen: isOpen,\n    selectedItem: selectedItem,\n    inputValue: inputValue\n  };\n}\n\nvar InputKeyDownArrowDown = process.env.NODE_ENV !== \"production\" ? '__input_keydown_arrow_down__' : 0;\nvar InputKeyDownArrowUp = process.env.NODE_ENV !== \"production\" ? '__input_keydown_arrow_up__' : 1;\nvar InputKeyDownEscape = process.env.NODE_ENV !== \"production\" ? '__input_keydown_escape__' : 2;\nvar InputKeyDownHome = process.env.NODE_ENV !== \"production\" ? '__input_keydown_home__' : 3;\nvar InputKeyDownEnd = process.env.NODE_ENV !== \"production\" ? '__input_keydown_end__' : 4;\nvar InputKeyDownPageUp = process.env.NODE_ENV !== \"production\" ? '__input_keydown_page_up__' : 5;\nvar InputKeyDownPageDown = process.env.NODE_ENV !== \"production\" ? '__input_keydown_page_down__' : 6;\nvar InputKeyDownEnter = process.env.NODE_ENV !== \"production\" ? '__input_keydown_enter__' : 7;\nvar InputChange = process.env.NODE_ENV !== \"production\" ? '__input_change__' : 8;\nvar InputBlur = process.env.NODE_ENV !== \"production\" ? '__input_blur__' : 9;\nvar InputFocus = process.env.NODE_ENV !== \"production\" ? '__input_focus__' : 10;\nvar MenuMouseLeave = process.env.NODE_ENV !== \"production\" ? '__menu_mouse_leave__' : 11;\nvar ItemMouseMove = process.env.NODE_ENV !== \"production\" ? '__item_mouse_move__' : 12;\nvar ItemClick = process.env.NODE_ENV !== \"production\" ? '__item_click__' : 13;\nvar ToggleButtonClick = process.env.NODE_ENV !== \"production\" ? '__togglebutton_click__' : 14;\nvar FunctionToggleMenu = process.env.NODE_ENV !== \"production\" ? '__function_toggle_menu__' : 15;\nvar FunctionOpenMenu = process.env.NODE_ENV !== \"production\" ? '__function_open_menu__' : 16;\nvar FunctionCloseMenu = process.env.NODE_ENV !== \"production\" ? '__function_close_menu__' : 17;\nvar FunctionSetHighlightedIndex = process.env.NODE_ENV !== \"production\" ? '__function_set_highlighted_index__' : 18;\nvar FunctionSelectItem = process.env.NODE_ENV !== \"production\" ? '__function_select_item__' : 19;\nvar FunctionSetInputValue = process.env.NODE_ENV !== \"production\" ? '__function_set_input_value__' : 20;\nvar FunctionReset$1 = process.env.NODE_ENV !== \"production\" ? '__function_reset__' : 21;\nvar ControlledPropUpdatedSelectedItem = process.env.NODE_ENV !== \"production\" ? '__controlled_prop_updated_selected_item__' : 22;\n\nvar stateChangeTypes$1 = /*#__PURE__*/Object.freeze({\n  __proto__: null,\n  InputKeyDownArrowDown: InputKeyDownArrowDown,\n  InputKeyDownArrowUp: InputKeyDownArrowUp,\n  InputKeyDownEscape: InputKeyDownEscape,\n  InputKeyDownHome: InputKeyDownHome,\n  InputKeyDownEnd: InputKeyDownEnd,\n  InputKeyDownPageUp: InputKeyDownPageUp,\n  InputKeyDownPageDown: InputKeyDownPageDown,\n  InputKeyDownEnter: InputKeyDownEnter,\n  InputChange: InputChange,\n  InputBlur: InputBlur,\n  InputFocus: InputFocus,\n  MenuMouseLeave: MenuMouseLeave,\n  ItemMouseMove: ItemMouseMove,\n  ItemClick: ItemClick,\n  ToggleButtonClick: ToggleButtonClick,\n  FunctionToggleMenu: FunctionToggleMenu,\n  FunctionOpenMenu: FunctionOpenMenu,\n  FunctionCloseMenu: FunctionCloseMenu,\n  FunctionSetHighlightedIndex: FunctionSetHighlightedIndex,\n  FunctionSelectItem: FunctionSelectItem,\n  FunctionSetInputValue: FunctionSetInputValue,\n  FunctionReset: FunctionReset$1,\n  ControlledPropUpdatedSelectedItem: ControlledPropUpdatedSelectedItem\n});\n\nfunction getInitialState$1(props) {\n  var initialState = getInitialState$2(props);\n  var selectedItem = initialState.selectedItem;\n  var inputValue = initialState.inputValue;\n  if (inputValue === '' && selectedItem && props.defaultInputValue === undefined && props.initialInputValue === undefined && props.inputValue === undefined) {\n    inputValue = props.itemToString(selectedItem);\n  }\n  return _extends({}, initialState, {\n    inputValue: inputValue\n  });\n}\nvar propTypes$1 = {\n  items: PropTypes.array.isRequired,\n  itemToString: PropTypes.func,\n  selectedItemChanged: PropTypes.func,\n  getA11yStatusMessage: PropTypes.func,\n  getA11ySelectionMessage: PropTypes.func,\n  highlightedIndex: PropTypes.number,\n  defaultHighlightedIndex: PropTypes.number,\n  initialHighlightedIndex: PropTypes.number,\n  isOpen: PropTypes.bool,\n  defaultIsOpen: PropTypes.bool,\n  initialIsOpen: PropTypes.bool,\n  selectedItem: PropTypes.any,\n  initialSelectedItem: PropTypes.any,\n  defaultSelectedItem: PropTypes.any,\n  inputValue: PropTypes.string,\n  defaultInputValue: PropTypes.string,\n  initialInputValue: PropTypes.string,\n  id: PropTypes.string,\n  labelId: PropTypes.string,\n  menuId: PropTypes.string,\n  getItemId: PropTypes.func,\n  inputId: PropTypes.string,\n  toggleButtonId: PropTypes.string,\n  stateReducer: PropTypes.func,\n  onSelectedItemChange: PropTypes.func,\n  onHighlightedIndexChange: PropTypes.func,\n  onStateChange: PropTypes.func,\n  onIsOpenChange: PropTypes.func,\n  onInputValueChange: PropTypes.func,\n  environment: PropTypes.shape({\n    addEventListener: PropTypes.func,\n    removeEventListener: PropTypes.func,\n    document: PropTypes.shape({\n      getElementById: PropTypes.func,\n      activeElement: PropTypes.any,\n      body: PropTypes.any\n    })\n  })\n};\n\n/**\n * The useCombobox version of useControlledReducer, which also\n * checks if the controlled prop selectedItem changed between\n * renders. If so, it will also update inputValue with its\n * string equivalent. It uses the common useEnhancedReducer to\n * compute the rest of the state.\n *\n * @param {Function} reducer Reducer function from downshift.\n * @param {Object} initialState Initial state of the hook.\n * @param {Object} props The hook props.\n * @returns {Array} An array with the state and an action dispatcher.\n */\nfunction useControlledReducer(reducer, initialState, props) {\n  var previousSelectedItemRef = useRef();\n  var _useEnhancedReducer = useEnhancedReducer(reducer, initialState, props),\n    state = _useEnhancedReducer[0],\n    dispatch = _useEnhancedReducer[1];\n\n  // ToDo: if needed, make same approach as selectedItemChanged from Downshift.\n  useEffect(function () {\n    if (!isControlledProp(props, 'selectedItem')) {\n      return;\n    }\n    if (props.selectedItemChanged(previousSelectedItemRef.current, props.selectedItem)) {\n      dispatch({\n        type: ControlledPropUpdatedSelectedItem,\n        inputValue: props.itemToString(props.selectedItem)\n      });\n    }\n    previousSelectedItemRef.current = state.selectedItem === previousSelectedItemRef.current ? props.selectedItem : state.selectedItem;\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [state.selectedItem, props.selectedItem]);\n  return [getState(state, props), dispatch];\n}\n\n// eslint-disable-next-line import/no-mutable-exports\nvar validatePropTypes$1 = noop;\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n  validatePropTypes$1 = function validatePropTypes(options, caller) {\n    PropTypes.checkPropTypes(propTypes$1, options, 'prop', caller.name);\n  };\n}\nvar defaultProps$1 = _extends({}, defaultProps$3, {\n  selectedItemChanged: function selectedItemChanged(prevItem, item) {\n    return prevItem !== item;\n  },\n  getA11yStatusMessage: getA11yStatusMessage$1\n});\n\n/* eslint-disable complexity */\nfunction downshiftUseComboboxReducer(state, action) {\n  var _props$items;\n  var type = action.type,\n    props = action.props,\n    altKey = action.altKey;\n  var changes;\n  switch (type) {\n    case ItemClick:\n      changes = {\n        isOpen: getDefaultValue$1(props, 'isOpen'),\n        highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),\n        selectedItem: props.items[action.index],\n        inputValue: props.itemToString(props.items[action.index])\n      };\n      break;\n    case InputKeyDownArrowDown:\n      if (state.isOpen) {\n        changes = {\n          highlightedIndex: getNextWrappingIndex(1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, true)\n        };\n      } else {\n        changes = {\n          highlightedIndex: altKey && state.selectedItem == null ? -1 : getHighlightedIndexOnOpen(props, state, 1, action.getItemNodeFromIndex),\n          isOpen: props.items.length >= 0\n        };\n      }\n      break;\n    case InputKeyDownArrowUp:\n      if (state.isOpen) {\n        if (altKey) {\n          changes = getChangesOnSelection(props, state.highlightedIndex);\n        } else {\n          changes = {\n            highlightedIndex: getNextWrappingIndex(-1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, true)\n          };\n        }\n      } else {\n        changes = {\n          highlightedIndex: getHighlightedIndexOnOpen(props, state, -1, action.getItemNodeFromIndex),\n          isOpen: props.items.length >= 0\n        };\n      }\n      break;\n    case InputKeyDownEnter:\n      changes = getChangesOnSelection(props, state.highlightedIndex);\n      break;\n    case InputKeyDownEscape:\n      changes = _extends({\n        isOpen: false,\n        highlightedIndex: -1\n      }, !state.isOpen && {\n        selectedItem: null,\n        inputValue: ''\n      });\n      break;\n    case InputKeyDownPageUp:\n      changes = {\n        highlightedIndex: getNextWrappingIndex(-10, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, false)\n      };\n      break;\n    case InputKeyDownPageDown:\n      changes = {\n        highlightedIndex: getNextWrappingIndex(10, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, false)\n      };\n      break;\n    case InputKeyDownHome:\n      changes = {\n        highlightedIndex: getNextNonDisabledIndex(1, 0, props.items.length, action.getItemNodeFromIndex, false)\n      };\n      break;\n    case InputKeyDownEnd:\n      changes = {\n        highlightedIndex: getNextNonDisabledIndex(-1, props.items.length - 1, props.items.length, action.getItemNodeFromIndex, false)\n      };\n      break;\n    case InputBlur:\n      changes = _extends({\n        isOpen: false,\n        highlightedIndex: -1\n      }, state.highlightedIndex >= 0 && ((_props$items = props.items) == null ? void 0 : _props$items.length) && action.selectItem && {\n        selectedItem: props.items[state.highlightedIndex],\n        inputValue: props.itemToString(props.items[state.highlightedIndex])\n      });\n      break;\n    case InputChange:\n      changes = {\n        isOpen: true,\n        highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),\n        inputValue: action.inputValue\n      };\n      break;\n    case InputFocus:\n      changes = {\n        isOpen: true,\n        highlightedIndex: getHighlightedIndexOnOpen(props, state, 0)\n      };\n      break;\n    case FunctionSelectItem:\n      changes = {\n        selectedItem: action.selectedItem,\n        inputValue: props.itemToString(action.selectedItem)\n      };\n      break;\n    case ControlledPropUpdatedSelectedItem:\n      changes = {\n        inputValue: action.inputValue\n      };\n      break;\n    default:\n      return downshiftCommonReducer(state, action, stateChangeTypes$1);\n  }\n  return _extends({}, state, changes);\n}\n/* eslint-enable complexity */\n\nvar _excluded$1 = [\"onMouseLeave\", \"refKey\", \"ref\"],\n  _excluded2$1 = [\"item\", \"index\", \"refKey\", \"ref\", \"onMouseMove\", \"onMouseDown\", \"onClick\", \"onPress\", \"disabled\"],\n  _excluded3 = [\"onClick\", \"onPress\", \"refKey\", \"ref\"],\n  _excluded4 = [\"onKeyDown\", \"onChange\", \"onInput\", \"onFocus\", \"onBlur\", \"onChangeText\", \"refKey\", \"ref\"];\nuseCombobox.stateChangeTypes = stateChangeTypes$1;\nfunction useCombobox(userProps) {\n  if (userProps === void 0) {\n    userProps = {};\n  }\n  validatePropTypes$1(userProps, useCombobox);\n  // Props defaults and destructuring.\n  var props = _extends({}, defaultProps$1, userProps);\n  var initialIsOpen = props.initialIsOpen,\n    defaultIsOpen = props.defaultIsOpen,\n    items = props.items,\n    scrollIntoView = props.scrollIntoView,\n    environment = props.environment,\n    getA11yStatusMessage = props.getA11yStatusMessage,\n    getA11ySelectionMessage = props.getA11ySelectionMessage,\n    itemToString = props.itemToString;\n  // Initial state depending on controlled props.\n  var initialState = getInitialState$1(props);\n  var _useControlledReducer = useControlledReducer(downshiftUseComboboxReducer, initialState, props),\n    state = _useControlledReducer[0],\n    dispatch = _useControlledReducer[1];\n  var isOpen = state.isOpen,\n    highlightedIndex = state.highlightedIndex,\n    selectedItem = state.selectedItem,\n    inputValue = state.inputValue;\n\n  // Element refs.\n  var menuRef = useRef(null);\n  var itemRefs = useRef({});\n  var inputRef = useRef(null);\n  var toggleButtonRef = useRef(null);\n  var isInitialMountRef = useRef(true);\n  // prevent id re-generation between renders.\n  var elementIds = useElementIds(props);\n  // used to keep track of how many items we had on previous cycle.\n  var previousResultCountRef = useRef();\n  // utility callback to get item element.\n  var latest = useLatestRef({\n    state: state,\n    props: props\n  });\n  var getItemNodeFromIndex = useCallback(function (index) {\n    return itemRefs.current[elementIds.getItemId(index)];\n  }, [elementIds]);\n\n  // Effects.\n  // Sets a11y status message on changes in state.\n  useA11yMessageSetter(getA11yStatusMessage, [isOpen, highlightedIndex, inputValue, items], _extends({\n    isInitialMount: isInitialMountRef.current,\n    previousResultCount: previousResultCountRef.current,\n    items: items,\n    environment: environment,\n    itemToString: itemToString\n  }, state));\n  // Sets a11y status message on changes in selectedItem.\n  useA11yMessageSetter(getA11ySelectionMessage, [selectedItem], _extends({\n    isInitialMount: isInitialMountRef.current,\n    previousResultCount: previousResultCountRef.current,\n    items: items,\n    environment: environment,\n    itemToString: itemToString\n  }, state));\n  // Scroll on highlighted item if change comes from keyboard.\n  var shouldScrollRef = useScrollIntoView({\n    menuElement: menuRef.current,\n    highlightedIndex: highlightedIndex,\n    isOpen: isOpen,\n    itemRefs: itemRefs,\n    scrollIntoView: scrollIntoView,\n    getItemNodeFromIndex: getItemNodeFromIndex\n  });\n  useControlPropsValidator({\n    isInitialMount: isInitialMountRef.current,\n    props: props,\n    state: state\n  });\n  // Focus the input on first render if required.\n  useEffect(function () {\n    var focusOnOpen = initialIsOpen || defaultIsOpen || isOpen;\n    if (focusOnOpen && inputRef.current) {\n      inputRef.current.focus();\n    }\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, []);\n  useEffect(function () {\n    if (isInitialMountRef.current) {\n      return;\n    }\n    previousResultCountRef.current = items.length;\n  });\n  // Add mouse/touch events to document.\n  var mouseAndTouchTrackersRef = useMouseAndTouchTracker(isOpen, [inputRef, menuRef, toggleButtonRef], environment, function () {\n    dispatch({\n      type: InputBlur,\n      selectItem: false\n    });\n  });\n  var setGetterPropCallInfo = useGetterPropsCalledChecker('getInputProps', 'getMenuProps');\n  // Make initial ref false.\n  useEffect(function () {\n    isInitialMountRef.current = false;\n    return function () {\n      isInitialMountRef.current = true;\n    };\n  }, []);\n  // Reset itemRefs on close.\n  useEffect(function () {\n    var _environment$document;\n    if (!isOpen) {\n      itemRefs.current = {};\n    } else if (((_environment$document = environment.document) == null ? void 0 : _environment$document.activeElement) !== inputRef.current) {\n      var _inputRef$current;\n      inputRef == null || (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();\n    }\n  }, [isOpen, environment]);\n\n  /* Event handler functions */\n  var inputKeyDownHandlers = useMemo(function () {\n    return {\n      ArrowDown: function ArrowDown(event) {\n        event.preventDefault();\n        dispatch({\n          type: InputKeyDownArrowDown,\n          altKey: event.altKey,\n          getItemNodeFromIndex: getItemNodeFromIndex\n        });\n      },\n      ArrowUp: function ArrowUp(event) {\n        event.preventDefault();\n        dispatch({\n          type: InputKeyDownArrowUp,\n          altKey: event.altKey,\n          getItemNodeFromIndex: getItemNodeFromIndex\n        });\n      },\n      Home: function Home(event) {\n        if (!latest.current.state.isOpen) {\n          return;\n        }\n        event.preventDefault();\n        dispatch({\n          type: InputKeyDownHome,\n          getItemNodeFromIndex: getItemNodeFromIndex\n        });\n      },\n      End: function End(event) {\n        if (!latest.current.state.isOpen) {\n          return;\n        }\n        event.preventDefault();\n        dispatch({\n          type: InputKeyDownEnd,\n          getItemNodeFromIndex: getItemNodeFromIndex\n        });\n      },\n      Escape: function Escape(event) {\n        var latestState = latest.current.state;\n        if (latestState.isOpen || latestState.inputValue || latestState.selectedItem || latestState.highlightedIndex > -1) {\n          event.preventDefault();\n          dispatch({\n            type: InputKeyDownEscape\n          });\n        }\n      },\n      Enter: function Enter(event) {\n        var latestState = latest.current.state;\n        // if closed or no highlighted index, do nothing.\n        if (!latestState.isOpen || event.which === 229 // if IME composing, wait for next Enter keydown event.\n        ) {\n          return;\n        }\n        event.preventDefault();\n        dispatch({\n          type: InputKeyDownEnter,\n          getItemNodeFromIndex: getItemNodeFromIndex\n        });\n      },\n      PageUp: function PageUp(event) {\n        if (latest.current.state.isOpen) {\n          event.preventDefault();\n          dispatch({\n            type: InputKeyDownPageUp,\n            getItemNodeFromIndex: getItemNodeFromIndex\n          });\n        }\n      },\n      PageDown: function PageDown(event) {\n        if (latest.current.state.isOpen) {\n          event.preventDefault();\n          dispatch({\n            type: InputKeyDownPageDown,\n            getItemNodeFromIndex: getItemNodeFromIndex\n          });\n        }\n      }\n    };\n  }, [dispatch, latest, getItemNodeFromIndex]);\n\n  // Getter props.\n  var getLabelProps = useCallback(function (labelProps) {\n    return _extends({\n      id: elementIds.labelId,\n      htmlFor: elementIds.inputId\n    }, labelProps);\n  }, [elementIds]);\n  var getMenuProps = useCallback(function (_temp, _temp2) {\n    var _extends2;\n    var _ref = _temp === void 0 ? {} : _temp,\n      onMouseLeave = _ref.onMouseLeave,\n      _ref$refKey = _ref.refKey,\n      refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey,\n      ref = _ref.ref,\n      rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);\n    var _ref2 = _temp2 === void 0 ? {} : _temp2,\n      _ref2$suppressRefErro = _ref2.suppressRefError,\n      suppressRefError = _ref2$suppressRefErro === void 0 ? false : _ref2$suppressRefErro;\n    setGetterPropCallInfo('getMenuProps', suppressRefError, refKey, menuRef);\n    return _extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, function (menuNode) {\n      menuRef.current = menuNode;\n    }), _extends2.id = elementIds.menuId, _extends2.role = 'listbox', _extends2['aria-labelledby'] = rest && rest['aria-label'] ? undefined : \"\" + elementIds.labelId, _extends2.onMouseLeave = callAllEventHandlers(onMouseLeave, function () {\n      dispatch({\n        type: MenuMouseLeave\n      });\n    }), _extends2), rest);\n  }, [dispatch, setGetterPropCallInfo, elementIds]);\n  var getItemProps = useCallback(function (_temp3) {\n    var _extends3, _ref4;\n    var _ref3 = _temp3 === void 0 ? {} : _temp3,\n      itemProp = _ref3.item,\n      indexProp = _ref3.index,\n      _ref3$refKey = _ref3.refKey,\n      refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,\n      ref = _ref3.ref,\n      onMouseMove = _ref3.onMouseMove,\n      onMouseDown = _ref3.onMouseDown,\n      onClick = _ref3.onClick;\n      _ref3.onPress;\n      var disabled = _ref3.disabled,\n      rest = _objectWithoutPropertiesLoose(_ref3, _excluded2$1);\n    var _latest$current = latest.current,\n      latestProps = _latest$current.props,\n      latestState = _latest$current.state;\n    var _getItemAndIndex = getItemAndIndex(itemProp, indexProp, latestProps.items, 'Pass either item or index to getItemProps!'),\n      index = _getItemAndIndex[1];\n    var onSelectKey = 'onClick';\n    var customClickHandler = onClick;\n    var itemHandleMouseMove = function itemHandleMouseMove() {\n      if (index === latestState.highlightedIndex) {\n        return;\n      }\n      shouldScrollRef.current = false;\n      dispatch({\n        type: ItemMouseMove,\n        index: index,\n        disabled: disabled\n      });\n    };\n    var itemHandleClick = function itemHandleClick() {\n      dispatch({\n        type: ItemClick,\n        index: index\n      });\n    };\n    var itemHandleMouseDown = function itemHandleMouseDown(e) {\n      return e.preventDefault();\n    };\n    return _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function (itemNode) {\n      if (itemNode) {\n        itemRefs.current[elementIds.getItemId(index)] = itemNode;\n      }\n    }), _extends3.disabled = disabled, _extends3.role = 'option', _extends3['aria-selected'] = \"\" + (index === latestState.highlightedIndex), _extends3.id = elementIds.getItemId(index), _extends3), !disabled && (_ref4 = {}, _ref4[onSelectKey] = callAllEventHandlers(customClickHandler, itemHandleClick), _ref4), {\n      onMouseMove: callAllEventHandlers(onMouseMove, itemHandleMouseMove),\n      onMouseDown: callAllEventHandlers(onMouseDown, itemHandleMouseDown)\n    }, rest);\n  }, [dispatch, latest, shouldScrollRef, elementIds]);\n  var getToggleButtonProps = useCallback(function (_temp4) {\n    var _extends4;\n    var _ref5 = _temp4 === void 0 ? {} : _temp4,\n      onClick = _ref5.onClick;\n      _ref5.onPress;\n      var _ref5$refKey = _ref5.refKey,\n      refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,\n      ref = _ref5.ref,\n      rest = _objectWithoutPropertiesLoose(_ref5, _excluded3);\n    var latestState = latest.current.state;\n    var toggleButtonHandleClick = function toggleButtonHandleClick() {\n      dispatch({\n        type: ToggleButtonClick\n      });\n    };\n    return _extends((_extends4 = {}, _extends4[refKey] = handleRefs(ref, function (toggleButtonNode) {\n      toggleButtonRef.current = toggleButtonNode;\n    }), _extends4['aria-controls'] = elementIds.menuId, _extends4['aria-expanded'] = latestState.isOpen, _extends4.id = elementIds.toggleButtonId, _extends4.tabIndex = -1, _extends4), !rest.disabled && _extends({}, {\n      onClick: callAllEventHandlers(onClick, toggleButtonHandleClick)\n    }), rest);\n  }, [dispatch, latest, elementIds]);\n  var getInputProps = useCallback(function (_temp5, _temp6) {\n    var _extends5;\n    var _ref6 = _temp5 === void 0 ? {} : _temp5,\n      onKeyDown = _ref6.onKeyDown,\n      onChange = _ref6.onChange,\n      onInput = _ref6.onInput,\n      onFocus = _ref6.onFocus,\n      onBlur = _ref6.onBlur;\n      _ref6.onChangeText;\n      var _ref6$refKey = _ref6.refKey,\n      refKey = _ref6$refKey === void 0 ? 'ref' : _ref6$refKey,\n      ref = _ref6.ref,\n      rest = _objectWithoutPropertiesLoose(_ref6, _excluded4);\n    var _ref7 = _temp6 === void 0 ? {} : _temp6,\n      _ref7$suppressRefErro = _ref7.suppressRefError,\n      suppressRefError = _ref7$suppressRefErro === void 0 ? false : _ref7$suppressRefErro;\n    setGetterPropCallInfo('getInputProps', suppressRefError, refKey, inputRef);\n    var latestState = latest.current.state;\n    var inputHandleKeyDown = function inputHandleKeyDown(event) {\n      var key = normalizeArrowKey(event);\n      if (key && inputKeyDownHandlers[key]) {\n        inputKeyDownHandlers[key](event);\n      }\n    };\n    var inputHandleChange = function inputHandleChange(event) {\n      dispatch({\n        type: InputChange,\n        inputValue: event.target.value\n      });\n    };\n    var inputHandleBlur = function inputHandleBlur(event) {\n      /* istanbul ignore else */\n      if (latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) {\n        var isBlurByTabChange = event.relatedTarget === null && environment.document.activeElement !== environment.document.body;\n        dispatch({\n          type: InputBlur,\n          selectItem: !isBlurByTabChange\n        });\n      }\n    };\n    var inputHandleFocus = function inputHandleFocus() {\n      if (!latestState.isOpen) {\n        dispatch({\n          type: InputFocus\n        });\n      }\n    };\n\n    /* istanbul ignore next (preact) */\n    var onChangeKey = 'onChange';\n    var eventHandlers = {};\n    if (!rest.disabled) {\n      var _eventHandlers;\n      eventHandlers = (_eventHandlers = {}, _eventHandlers[onChangeKey] = callAllEventHandlers(onChange, onInput, inputHandleChange), _eventHandlers.onKeyDown = callAllEventHandlers(onKeyDown, inputHandleKeyDown), _eventHandlers.onBlur = callAllEventHandlers(onBlur, inputHandleBlur), _eventHandlers.onFocus = callAllEventHandlers(onFocus, inputHandleFocus), _eventHandlers);\n    }\n    return _extends((_extends5 = {}, _extends5[refKey] = handleRefs(ref, function (inputNode) {\n      inputRef.current = inputNode;\n    }), _extends5['aria-activedescendant'] = latestState.isOpen && latestState.highlightedIndex > -1 ? elementIds.getItemId(latestState.highlightedIndex) : '', _extends5['aria-autocomplete'] = 'list', _extends5['aria-controls'] = elementIds.menuId, _extends5['aria-expanded'] = latestState.isOpen, _extends5['aria-labelledby'] = rest && rest['aria-label'] ? undefined : \"\" + elementIds.labelId, _extends5.autoComplete = 'off', _extends5.id = elementIds.inputId, _extends5.role = 'combobox', _extends5.value = latestState.inputValue, _extends5), eventHandlers, rest);\n  }, [setGetterPropCallInfo, latest, elementIds, inputKeyDownHandlers, dispatch, mouseAndTouchTrackersRef, environment]);\n\n  // returns\n  var toggleMenu = useCallback(function () {\n    dispatch({\n      type: FunctionToggleMenu\n    });\n  }, [dispatch]);\n  var closeMenu = useCallback(function () {\n    dispatch({\n      type: FunctionCloseMenu\n    });\n  }, [dispatch]);\n  var openMenu = useCallback(function () {\n    dispatch({\n      type: FunctionOpenMenu\n    });\n  }, [dispatch]);\n  var setHighlightedIndex = useCallback(function (newHighlightedIndex) {\n    dispatch({\n      type: FunctionSetHighlightedIndex,\n      highlightedIndex: newHighlightedIndex\n    });\n  }, [dispatch]);\n  var selectItem = useCallback(function (newSelectedItem) {\n    dispatch({\n      type: FunctionSelectItem,\n      selectedItem: newSelectedItem\n    });\n  }, [dispatch]);\n  var setInputValue = useCallback(function (newInputValue) {\n    dispatch({\n      type: FunctionSetInputValue,\n      inputValue: newInputValue\n    });\n  }, [dispatch]);\n  var reset = useCallback(function () {\n    dispatch({\n      type: FunctionReset$1\n    });\n  }, [dispatch]);\n  return {\n    // prop getters.\n    getItemProps: getItemProps,\n    getLabelProps: getLabelProps,\n    getMenuProps: getMenuProps,\n    getInputProps: getInputProps,\n    getToggleButtonProps: getToggleButtonProps,\n    // actions.\n    toggleMenu: toggleMenu,\n    openMenu: openMenu,\n    closeMenu: closeMenu,\n    setHighlightedIndex: setHighlightedIndex,\n    setInputValue: setInputValue,\n    selectItem: selectItem,\n    reset: reset,\n    // state.\n    highlightedIndex: highlightedIndex,\n    isOpen: isOpen,\n    selectedItem: selectedItem,\n    inputValue: inputValue\n  };\n}\n\nvar defaultStateValues = {\n  activeIndex: -1,\n  selectedItems: []\n};\n\n/**\n * Returns the initial value for a state key in the following order:\n * 1. controlled prop, 2. initial prop, 3. default prop, 4. default\n * value from Downshift.\n *\n * @param {Object} props Props passed to the hook.\n * @param {string} propKey Props key to generate the value for.\n * @returns {any} The initial value for that prop.\n */\nfunction getInitialValue(props, propKey) {\n  return getInitialValue$1(props, propKey, defaultStateValues);\n}\n\n/**\n * Returns the default value for a state key in the following order:\n * 1. controlled prop, 2. default prop, 3. default value from Downshift.\n *\n * @param {Object} props Props passed to the hook.\n * @param {string} propKey Props key to generate the value for.\n * @returns {any} The initial value for that prop.\n */\nfunction getDefaultValue(props, propKey) {\n  return getDefaultValue$1(props, propKey, defaultStateValues);\n}\n\n/**\n * Gets the initial state based on the provided props. It uses initial, default\n * and controlled props related to state in order to compute the initial value.\n *\n * @param {Object} props Props passed to the hook.\n * @returns {Object} The initial state.\n */\nfunction getInitialState(props) {\n  var activeIndex = getInitialValue(props, 'activeIndex');\n  var selectedItems = getInitialValue(props, 'selectedItems');\n  return {\n    activeIndex: activeIndex,\n    selectedItems: selectedItems\n  };\n}\n\n/**\n * Returns true if dropdown keydown operation is permitted. Should not be\n * allowed on keydown with modifier keys (ctrl, alt, shift, meta), on\n * input element with text content that is either highlighted or selection\n * cursor is not at the starting position.\n *\n * @param {KeyboardEvent} event The event from keydown.\n * @returns {boolean} Whether the operation is allowed.\n */\nfunction isKeyDownOperationPermitted(event) {\n  if (event.shiftKey || event.metaKey || event.ctrlKey || event.altKey) {\n    return false;\n  }\n  var element = event.target;\n  if (element instanceof HTMLInputElement &&\n  // if element is a text input\n  element.value !== '' && (\n  // and we have text in it\n  // and cursor is either not at the start or is currently highlighting text.\n  element.selectionStart !== 0 || element.selectionEnd !== 0)) {\n    return false;\n  }\n  return true;\n}\n\n/**\n * Returns a message to be added to aria-live region when item is removed.\n *\n * @param {Object} selectionParameters Parameters required to build the message.\n * @returns {string} The a11y message.\n */\nfunction getA11yRemovalMessage(selectionParameters) {\n  var removedSelectedItem = selectionParameters.removedSelectedItem,\n    itemToStringLocal = selectionParameters.itemToString;\n  return itemToStringLocal(removedSelectedItem) + \" has been removed.\";\n}\nvar propTypes = {\n  selectedItems: PropTypes.array,\n  initialSelectedItems: PropTypes.array,\n  defaultSelectedItems: PropTypes.array,\n  itemToString: PropTypes.func,\n  getA11yRemovalMessage: PropTypes.func,\n  stateReducer: PropTypes.func,\n  activeIndex: PropTypes.number,\n  initialActiveIndex: PropTypes.number,\n  defaultActiveIndex: PropTypes.number,\n  onActiveIndexChange: PropTypes.func,\n  onSelectedItemsChange: PropTypes.func,\n  keyNavigationNext: PropTypes.string,\n  keyNavigationPrevious: PropTypes.string,\n  environment: PropTypes.shape({\n    addEventListener: PropTypes.func,\n    removeEventListener: PropTypes.func,\n    document: PropTypes.shape({\n      getElementById: PropTypes.func,\n      activeElement: PropTypes.any,\n      body: PropTypes.any\n    })\n  })\n};\nvar defaultProps = {\n  itemToString: defaultProps$3.itemToString,\n  stateReducer: defaultProps$3.stateReducer,\n  environment: defaultProps$3.environment,\n  getA11yRemovalMessage: getA11yRemovalMessage,\n  keyNavigationNext: 'ArrowRight',\n  keyNavigationPrevious: 'ArrowLeft'\n};\n\n// eslint-disable-next-line import/no-mutable-exports\nvar validatePropTypes = noop;\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n  validatePropTypes = function validatePropTypes(options, caller) {\n    PropTypes.checkPropTypes(propTypes, options, 'prop', caller.name);\n  };\n}\n\nvar SelectedItemClick = process.env.NODE_ENV !== \"production\" ? '__selected_item_click__' : 0;\nvar SelectedItemKeyDownDelete = process.env.NODE_ENV !== \"production\" ? '__selected_item_keydown_delete__' : 1;\nvar SelectedItemKeyDownBackspace = process.env.NODE_ENV !== \"production\" ? '__selected_item_keydown_backspace__' : 2;\nvar SelectedItemKeyDownNavigationNext = process.env.NODE_ENV !== \"production\" ? '__selected_item_keydown_navigation_next__' : 3;\nvar SelectedItemKeyDownNavigationPrevious = process.env.NODE_ENV !== \"production\" ? '__selected_item_keydown_navigation_previous__' : 4;\nvar DropdownKeyDownNavigationPrevious = process.env.NODE_ENV !== \"production\" ? '__dropdown_keydown_navigation_previous__' : 5;\nvar DropdownKeyDownBackspace = process.env.NODE_ENV !== \"production\" ? '__dropdown_keydown_backspace__' : 6;\nvar DropdownClick = process.env.NODE_ENV !== \"production\" ? '__dropdown_click__' : 7;\nvar FunctionAddSelectedItem = process.env.NODE_ENV !== \"production\" ? '__function_add_selected_item__' : 8;\nvar FunctionRemoveSelectedItem = process.env.NODE_ENV !== \"production\" ? '__function_remove_selected_item__' : 9;\nvar FunctionSetSelectedItems = process.env.NODE_ENV !== \"production\" ? '__function_set_selected_items__' : 10;\nvar FunctionSetActiveIndex = process.env.NODE_ENV !== \"production\" ? '__function_set_active_index__' : 11;\nvar FunctionReset = process.env.NODE_ENV !== \"production\" ? '__function_reset__' : 12;\n\nvar stateChangeTypes = /*#__PURE__*/Object.freeze({\n  __proto__: null,\n  SelectedItemClick: SelectedItemClick,\n  SelectedItemKeyDownDelete: SelectedItemKeyDownDelete,\n  SelectedItemKeyDownBackspace: SelectedItemKeyDownBackspace,\n  SelectedItemKeyDownNavigationNext: SelectedItemKeyDownNavigationNext,\n  SelectedItemKeyDownNavigationPrevious: SelectedItemKeyDownNavigationPrevious,\n  DropdownKeyDownNavigationPrevious: DropdownKeyDownNavigationPrevious,\n  DropdownKeyDownBackspace: DropdownKeyDownBackspace,\n  DropdownClick: DropdownClick,\n  FunctionAddSelectedItem: FunctionAddSelectedItem,\n  FunctionRemoveSelectedItem: FunctionRemoveSelectedItem,\n  FunctionSetSelectedItems: FunctionSetSelectedItems,\n  FunctionSetActiveIndex: FunctionSetActiveIndex,\n  FunctionReset: FunctionReset\n});\n\n/* eslint-disable complexity */\nfunction downshiftMultipleSelectionReducer(state, action) {\n  var type = action.type,\n    index = action.index,\n    props = action.props,\n    selectedItem = action.selectedItem;\n  var activeIndex = state.activeIndex,\n    selectedItems = state.selectedItems;\n  var changes;\n  switch (type) {\n    case SelectedItemClick:\n      changes = {\n        activeIndex: index\n      };\n      break;\n    case SelectedItemKeyDownNavigationPrevious:\n      changes = {\n        activeIndex: activeIndex - 1 < 0 ? 0 : activeIndex - 1\n      };\n      break;\n    case SelectedItemKeyDownNavigationNext:\n      changes = {\n        activeIndex: activeIndex + 1 >= selectedItems.length ? -1 : activeIndex + 1\n      };\n      break;\n    case SelectedItemKeyDownBackspace:\n    case SelectedItemKeyDownDelete:\n      {\n        if (activeIndex < 0) {\n          break;\n        }\n        var newActiveIndex = activeIndex;\n        if (selectedItems.length === 1) {\n          newActiveIndex = -1;\n        } else if (activeIndex === selectedItems.length - 1) {\n          newActiveIndex = selectedItems.length - 2;\n        }\n        changes = _extends({\n          selectedItems: [].concat(selectedItems.slice(0, activeIndex), selectedItems.slice(activeIndex + 1))\n        }, {\n          activeIndex: newActiveIndex\n        });\n        break;\n      }\n    case DropdownKeyDownNavigationPrevious:\n      changes = {\n        activeIndex: selectedItems.length - 1\n      };\n      break;\n    case DropdownKeyDownBackspace:\n      changes = {\n        selectedItems: selectedItems.slice(0, selectedItems.length - 1)\n      };\n      break;\n    case FunctionAddSelectedItem:\n      changes = {\n        selectedItems: [].concat(selectedItems, [selectedItem])\n      };\n      break;\n    case DropdownClick:\n      changes = {\n        activeIndex: -1\n      };\n      break;\n    case FunctionRemoveSelectedItem:\n      {\n        var _newActiveIndex = activeIndex;\n        var selectedItemIndex = selectedItems.indexOf(selectedItem);\n        if (selectedItemIndex < 0) {\n          break;\n        }\n        if (selectedItems.length === 1) {\n          _newActiveIndex = -1;\n        } else if (selectedItemIndex === selectedItems.length - 1) {\n          _newActiveIndex = selectedItems.length - 2;\n        }\n        changes = {\n          selectedItems: [].concat(selectedItems.slice(0, selectedItemIndex), selectedItems.slice(selectedItemIndex + 1)),\n          activeIndex: _newActiveIndex\n        };\n        break;\n      }\n    case FunctionSetSelectedItems:\n      {\n        var newSelectedItems = action.selectedItems;\n        changes = {\n          selectedItems: newSelectedItems\n        };\n        break;\n      }\n    case FunctionSetActiveIndex:\n      {\n        var _newActiveIndex2 = action.activeIndex;\n        changes = {\n          activeIndex: _newActiveIndex2\n        };\n        break;\n      }\n    case FunctionReset:\n      changes = {\n        activeIndex: getDefaultValue(props, 'activeIndex'),\n        selectedItems: getDefaultValue(props, 'selectedItems')\n      };\n      break;\n    default:\n      throw new Error('Reducer called without proper action type.');\n  }\n  return _extends({}, state, changes);\n}\n\nvar _excluded = [\"refKey\", \"ref\", \"onClick\", \"onKeyDown\", \"selectedItem\", \"index\"],\n  _excluded2 = [\"refKey\", \"ref\", \"onKeyDown\", \"onClick\", \"preventKeyAction\"];\nuseMultipleSelection.stateChangeTypes = stateChangeTypes;\nfunction useMultipleSelection(userProps) {\n  if (userProps === void 0) {\n    userProps = {};\n  }\n  validatePropTypes(userProps, useMultipleSelection);\n  // Props defaults and destructuring.\n  var props = _extends({}, defaultProps, userProps);\n  var getA11yRemovalMessage = props.getA11yRemovalMessage,\n    itemToString = props.itemToString,\n    environment = props.environment,\n    keyNavigationNext = props.keyNavigationNext,\n    keyNavigationPrevious = props.keyNavigationPrevious;\n\n  // Reducer init.\n  var _useControlledReducer = useControlledReducer$1(downshiftMultipleSelectionReducer, getInitialState(props), props),\n    state = _useControlledReducer[0],\n    dispatch = _useControlledReducer[1];\n  var activeIndex = state.activeIndex,\n    selectedItems = state.selectedItems;\n\n  // Refs.\n  var isInitialMountRef = useRef(true);\n  var dropdownRef = useRef(null);\n  var previousSelectedItemsRef = useRef(selectedItems);\n  var selectedItemRefs = useRef();\n  selectedItemRefs.current = [];\n  var latest = useLatestRef({\n    state: state,\n    props: props\n  });\n\n  // Effects.\n  /* Sets a11y status message on changes in selectedItem. */\n  useEffect(function () {\n    if (isInitialMountRef.current || false) {\n      return;\n    }\n    if (selectedItems.length < previousSelectedItemsRef.current.length) {\n      var removedSelectedItem = previousSelectedItemsRef.current.find(function (item) {\n        return selectedItems.indexOf(item) < 0;\n      });\n      setStatus(getA11yRemovalMessage({\n        itemToString: itemToString,\n        resultCount: selectedItems.length,\n        removedSelectedItem: removedSelectedItem,\n        activeIndex: activeIndex,\n        activeSelectedItem: selectedItems[activeIndex]\n      }), environment.document);\n    }\n    previousSelectedItemsRef.current = selectedItems;\n\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [selectedItems.length]);\n  // Sets focus on active item.\n  useEffect(function () {\n    if (isInitialMountRef.current) {\n      return;\n    }\n    if (activeIndex === -1 && dropdownRef.current) {\n      dropdownRef.current.focus();\n    } else if (selectedItemRefs.current[activeIndex]) {\n      selectedItemRefs.current[activeIndex].focus();\n    }\n  }, [activeIndex]);\n  useControlPropsValidator({\n    isInitialMount: isInitialMountRef.current,\n    props: props,\n    state: state\n  });\n  var setGetterPropCallInfo = useGetterPropsCalledChecker('getDropdownProps');\n  // Make initial ref false.\n  useEffect(function () {\n    isInitialMountRef.current = false;\n    return function () {\n      isInitialMountRef.current = true;\n    };\n  }, []);\n\n  // Event handler functions.\n  var selectedItemKeyDownHandlers = useMemo(function () {\n    var _ref;\n    return _ref = {}, _ref[keyNavigationPrevious] = function () {\n      dispatch({\n        type: SelectedItemKeyDownNavigationPrevious\n      });\n    }, _ref[keyNavigationNext] = function () {\n      dispatch({\n        type: SelectedItemKeyDownNavigationNext\n      });\n    }, _ref.Delete = function Delete() {\n      dispatch({\n        type: SelectedItemKeyDownDelete\n      });\n    }, _ref.Backspace = function Backspace() {\n      dispatch({\n        type: SelectedItemKeyDownBackspace\n      });\n    }, _ref;\n  }, [dispatch, keyNavigationNext, keyNavigationPrevious]);\n  var dropdownKeyDownHandlers = useMemo(function () {\n    var _ref2;\n    return _ref2 = {}, _ref2[keyNavigationPrevious] = function (event) {\n      if (isKeyDownOperationPermitted(event)) {\n        dispatch({\n          type: DropdownKeyDownNavigationPrevious\n        });\n      }\n    }, _ref2.Backspace = function Backspace(event) {\n      if (isKeyDownOperationPermitted(event)) {\n        dispatch({\n          type: DropdownKeyDownBackspace\n        });\n      }\n    }, _ref2;\n  }, [dispatch, keyNavigationPrevious]);\n\n  // Getter props.\n  var getSelectedItemProps = useCallback(function (_temp) {\n    var _extends2;\n    var _ref3 = _temp === void 0 ? {} : _temp,\n      _ref3$refKey = _ref3.refKey,\n      refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,\n      ref = _ref3.ref,\n      onClick = _ref3.onClick,\n      onKeyDown = _ref3.onKeyDown,\n      selectedItemProp = _ref3.selectedItem,\n      indexProp = _ref3.index,\n      rest = _objectWithoutPropertiesLoose(_ref3, _excluded);\n    var latestState = latest.current.state;\n    var _getItemAndIndex = getItemAndIndex(selectedItemProp, indexProp, latestState.selectedItems, 'Pass either item or index to getSelectedItemProps!'),\n      index = _getItemAndIndex[1];\n    var isFocusable = index > -1 && index === latestState.activeIndex;\n    var selectedItemHandleClick = function selectedItemHandleClick() {\n      dispatch({\n        type: SelectedItemClick,\n        index: index\n      });\n    };\n    var selectedItemHandleKeyDown = function selectedItemHandleKeyDown(event) {\n      var key = normalizeArrowKey(event);\n      if (key && selectedItemKeyDownHandlers[key]) {\n        selectedItemKeyDownHandlers[key](event);\n      }\n    };\n    return _extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, function (selectedItemNode) {\n      if (selectedItemNode) {\n        selectedItemRefs.current.push(selectedItemNode);\n      }\n    }), _extends2.tabIndex = isFocusable ? 0 : -1, _extends2.onClick = callAllEventHandlers(onClick, selectedItemHandleClick), _extends2.onKeyDown = callAllEventHandlers(onKeyDown, selectedItemHandleKeyDown), _extends2), rest);\n  }, [dispatch, latest, selectedItemKeyDownHandlers]);\n  var getDropdownProps = useCallback(function (_temp2, _temp3) {\n    var _extends3;\n    var _ref4 = _temp2 === void 0 ? {} : _temp2,\n      _ref4$refKey = _ref4.refKey,\n      refKey = _ref4$refKey === void 0 ? 'ref' : _ref4$refKey,\n      ref = _ref4.ref,\n      onKeyDown = _ref4.onKeyDown,\n      onClick = _ref4.onClick,\n      _ref4$preventKeyActio = _ref4.preventKeyAction,\n      preventKeyAction = _ref4$preventKeyActio === void 0 ? false : _ref4$preventKeyActio,\n      rest = _objectWithoutPropertiesLoose(_ref4, _excluded2);\n    var _ref5 = _temp3 === void 0 ? {} : _temp3,\n      _ref5$suppressRefErro = _ref5.suppressRefError,\n      suppressRefError = _ref5$suppressRefErro === void 0 ? false : _ref5$suppressRefErro;\n    setGetterPropCallInfo('getDropdownProps', suppressRefError, refKey, dropdownRef);\n    var dropdownHandleKeyDown = function dropdownHandleKeyDown(event) {\n      var key = normalizeArrowKey(event);\n      if (key && dropdownKeyDownHandlers[key]) {\n        dropdownKeyDownHandlers[key](event);\n      }\n    };\n    var dropdownHandleClick = function dropdownHandleClick() {\n      dispatch({\n        type: DropdownClick\n      });\n    };\n    return _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function (dropdownNode) {\n      if (dropdownNode) {\n        dropdownRef.current = dropdownNode;\n      }\n    }), _extends3), !preventKeyAction && {\n      onKeyDown: callAllEventHandlers(onKeyDown, dropdownHandleKeyDown),\n      onClick: callAllEventHandlers(onClick, dropdownHandleClick)\n    }, rest);\n  }, [dispatch, dropdownKeyDownHandlers, setGetterPropCallInfo]);\n\n  // returns\n  var addSelectedItem = useCallback(function (selectedItem) {\n    dispatch({\n      type: FunctionAddSelectedItem,\n      selectedItem: selectedItem\n    });\n  }, [dispatch]);\n  var removeSelectedItem = useCallback(function (selectedItem) {\n    dispatch({\n      type: FunctionRemoveSelectedItem,\n      selectedItem: selectedItem\n    });\n  }, [dispatch]);\n  var setSelectedItems = useCallback(function (newSelectedItems) {\n    dispatch({\n      type: FunctionSetSelectedItems,\n      selectedItems: newSelectedItems\n    });\n  }, [dispatch]);\n  var setActiveIndex = useCallback(function (newActiveIndex) {\n    dispatch({\n      type: FunctionSetActiveIndex,\n      activeIndex: newActiveIndex\n    });\n  }, [dispatch]);\n  var reset = useCallback(function () {\n    dispatch({\n      type: FunctionReset\n    });\n  }, [dispatch]);\n  return {\n    getSelectedItemProps: getSelectedItemProps,\n    getDropdownProps: getDropdownProps,\n    addSelectedItem: addSelectedItem,\n    removeSelectedItem: removeSelectedItem,\n    setSelectedItems: setSelectedItems,\n    setActiveIndex: setActiveIndex,\n    reset: reset,\n    selectedItems: selectedItems,\n    activeIndex: activeIndex\n  };\n}\n\nexport { Downshift$1 as default, resetIdCounter, useCombobox, useMultipleSelection, useSelect };\n","/** @license React v17.0.2\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var b=60103,c=60106,d=60107,e=60108,f=60114,g=60109,h=60110,k=60112,l=60113,m=60120,n=60115,p=60116,q=60121,r=60122,u=60117,v=60129,w=60131;\nif(\"function\"===typeof Symbol&&Symbol.for){var x=Symbol.for;b=x(\"react.element\");c=x(\"react.portal\");d=x(\"react.fragment\");e=x(\"react.strict_mode\");f=x(\"react.profiler\");g=x(\"react.provider\");h=x(\"react.context\");k=x(\"react.forward_ref\");l=x(\"react.suspense\");m=x(\"react.suspense_list\");n=x(\"react.memo\");p=x(\"react.lazy\");q=x(\"react.block\");r=x(\"react.server.block\");u=x(\"react.fundamental\");v=x(\"react.debug_trace_mode\");w=x(\"react.legacy_hidden\")}\nfunction y(a){if(\"object\"===typeof a&&null!==a){var t=a.$$typeof;switch(t){case b:switch(a=a.type,a){case d:case f:case e:case l:case m:return a;default:switch(a=a&&a.$$typeof,a){case h:case k:case p:case n:case g:return a;default:return t}}case c:return t}}}var z=g,A=b,B=k,C=d,D=p,E=n,F=c,G=f,H=e,I=l;exports.ContextConsumer=h;exports.ContextProvider=z;exports.Element=A;exports.ForwardRef=B;exports.Fragment=C;exports.Lazy=D;exports.Memo=E;exports.Portal=F;exports.Profiler=G;exports.StrictMode=H;\nexports.Suspense=I;exports.isAsyncMode=function(){return!1};exports.isConcurrentMode=function(){return!1};exports.isContextConsumer=function(a){return y(a)===h};exports.isContextProvider=function(a){return y(a)===g};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===b};exports.isForwardRef=function(a){return y(a)===k};exports.isFragment=function(a){return y(a)===d};exports.isLazy=function(a){return y(a)===p};exports.isMemo=function(a){return y(a)===n};\nexports.isPortal=function(a){return y(a)===c};exports.isProfiler=function(a){return y(a)===f};exports.isStrictMode=function(a){return y(a)===e};exports.isSuspense=function(a){return y(a)===l};exports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===d||a===f||a===v||a===e||a===l||a===m||a===w||\"object\"===typeof a&&null!==a&&(a.$$typeof===p||a.$$typeof===n||a.$$typeof===g||a.$$typeof===h||a.$$typeof===k||a.$$typeof===u||a.$$typeof===q||a[0]===r)?!0:!1};\nexports.typeOf=y;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n  module.exports = require('./cjs/react-is.production.min.js');\n} else {\n  module.exports = require('./cjs/react-is.development.js');\n}\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\n\nfunction emptyFunction() {}\nfunction emptyFunctionWithReset() {}\nemptyFunctionWithReset.resetWarningCache = emptyFunction;\n\nmodule.exports = function() {\n  function shim(props, propName, componentName, location, propFullName, secret) {\n    if (secret === ReactPropTypesSecret) {\n      // It is still safe when called from React.\n      return;\n    }\n    var err = new Error(\n      'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n      'Use PropTypes.checkPropTypes() to call them. ' +\n      'Read more at http://fb.me/use-check-prop-types'\n    );\n    err.name = 'Invariant Violation';\n    throw err;\n  };\n  shim.isRequired = shim;\n  function getShim() {\n    return shim;\n  };\n  // Important!\n  // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.\n  var ReactPropTypes = {\n    array: shim,\n    bigint: shim,\n    bool: shim,\n    func: shim,\n    number: shim,\n    object: shim,\n    string: shim,\n    symbol: shim,\n\n    any: shim,\n    arrayOf: getShim,\n    element: shim,\n    elementType: shim,\n    instanceOf: getShim,\n    node: shim,\n    objectOf: getShim,\n    oneOf: getShim,\n    oneOfType: getShim,\n    shape: getShim,\n    exact: getShim,\n\n    checkPropTypes: emptyFunctionWithReset,\n    resetWarningCache: emptyFunction\n  };\n\n  ReactPropTypes.PropTypes = ReactPropTypes;\n\n  return ReactPropTypes;\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nif (process.env.NODE_ENV !== 'production') {\n  var ReactIs = require('react-is');\n\n  // By explicitly using `prop-types` you are opting into new development behavior.\n  // http://fb.me/prop-types-in-prod\n  var throwOnDirectAccess = true;\n  module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);\n} else {\n  // By explicitly using `prop-types` you are opting into new production behavior.\n  // http://fb.me/prop-types-in-prod\n  module.exports = require('./factoryWithThrowingShims')();\n}\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n"],"names":[],"sourceRoot":"","ignoreList":[0,1,2,3,4,5,6]}