"use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[7898],{7898:(n,e,t)=>{t.d(e,{P:()=>P});var o,r,i,c,a,s,u,l,d,h,g,m,f,p,b,v,y,w=t(30514),x=t(67294),z=t(71893),k=z.ZP.div(r||(r=(0,w.cy)(["\n position: relative;\n ","\n"],["\n position: relative;\n ","\n"])),(function(n){return n.disabled&&(0,z.iv)(o||(o=(0,w.cy)(["\n cursor: not-allowed;\n "],["\n cursor: not-allowed;\n "])))})),I=z.ZP.span(h||(h=(0,w.cy)(["\n background: ",";\n border: 1px solid\n ",";\n border-radius: 4px;\n min-height: ",";\n display: block;\n font-size: ",";\n line-height: ",";\n color: ",";\n font-weight: 400;\n padding: 0.75rem "," 0.625rem\n ",";\n text-align: ",";\n width: 100%;\n position: relative;\n cursor: pointer;\n transition: border 0.3s, color 0.3s, box-shadow 0.3s;\n text-decoration: ",";\n\n &::before {\n content: '';\n width: 0.75rem;\n height: 0.375rem;\n position: absolute;\n top: 50%;\n margin-top: -2px;\n right: ",";\n background: url(",")\n no-repeat center center;\n transition: transform 0.3s;\n }\n &:hover {\n border-color: ",";\n }\n\n ","\n\n ","\n\n ","\n \n ","\n \n ","\n \n ","\n\n ","\n"],["\n background: ",";\n border: 1px solid\n ",";\n border-radius: 4px;\n min-height: ",";\n display: block;\n font-size: ",";\n line-height: ",";\n color: ",";\n font-weight: 400;\n padding: 0.75rem "," 0.625rem\n ",";\n text-align: ",";\n width: 100%;\n position: relative;\n cursor: pointer;\n transition: border 0.3s, color 0.3s, box-shadow 0.3s;\n text-decoration: ",";\n\n &::before {\n content: '';\n width: 0.75rem;\n height: 0.375rem;\n position: absolute;\n top: 50%;\n margin-top: -2px;\n right: ",";\n background: url(",")\n no-repeat center center;\n transition: transform 0.3s;\n }\n &:hover {\n border-color: ",";\n }\n\n ","\n\n ","\n\n ","\n \n ","\n \n ","\n \n ","\n\n ","\n"])),(function(n){return n.theme.colors.white}),(function(n){return n.ghost?"transparent":n.theme.colors.environment.percent20}),(function(n){return n.theme.spacing.spacing06}),(function(n){return n.theme.typography.header.h4.size}),(function(n){return n.theme.typography.header.h4.lineHeight}),(function(n){return n.theme.colors.environment.percent40}),(function(n){return n.theme.spacing.spacing05}),(function(n){return n.theme.spacing.spacing02}),(function(n){return n.right?"right":"left"}),(function(n){return n.underline?"underline":"none"}),(function(n){return n.theme.spacing.spacing02}),(function(n){return n.disabled?n.small?"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogICAgPHBhdGggZD0iTTAgMGw1IDUgNS01eiIgZmlsbD0iIzczNzM3MyIvPgo8L3N2Zz4K":"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogICAgPHBhdGggZD0iTTAgMGw2IDYgNi02eiIgZmlsbD0iIzczNzM3MyIvPgo8L3N2Zz4K":n.small?"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogICAgPHBhdGggZD0iTTAgMGw1IDUgNS01eiIgZmlsbD0iIzMzMzMzMyIvPgo8L3N2Zz4K":"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogICAgPHBhdGggZD0iTTAgMGw2IDYgNi02eiIgZmlsbD0iIzMzMzMzMyIvPgo8L3N2Zz4K"}),(function(n){return n.ghost?"transparent":n.theme.colors.black}),(function(n){return n.isActive&&(0,z.iv)(i||(i=(0,w.cy)(["\n border-color: ",";\n &::before {\n transform: rotate(-180deg);\n }\n "],["\n border-color: ",";\n &::before {\n transform: rotate(-180deg);\n }\n "])),n.ghost?"transparent":n.theme.colors.black)}),(function(n){return n.small&&(0,z.iv)(c||(c=(0,w.cy)(["\n font-size: ",";\n line-height: ",";\n min-height: ",";\n "],["\n font-size: ",";\n line-height: ",";\n min-height: ",";\n "])),n.theme.typography.body2Regular.size,n.theme.typography.body2Regular.lineHeight,(function(n){return n.theme.spacing.spacing05}))}),(function(n){return n.isTouched&&(0,z.iv)(a||(a=(0,w.cy)(["\n color: ",";\n "],["\n color: ",";\n "])),n.theme.colors.black)}),(function(n){return"success"===n.status&&(0,z.iv)(s||(s=(0,w.cy)(["\n &,\n &:hover:not(:focus) {\n border-color: ",";\n }\n &:focus {\n & + button {\n display: none;\n }\n }\n "],["\n &,\n &:hover:not(:focus) {\n border-color: ",";\n }\n &:focus {\n & + button {\n display: none;\n }\n }\n "])),n.theme.colors.success.main)}),(function(n){return"error"===n.status&&(0,z.iv)(u||(u=(0,w.cy)(["\n &,\n &:hover:not(:focus) {\n border-color: ",";\n }\n &:focus {\n & + button {\n display: none;\n }\n }\n "],["\n &,\n &:hover:not(:focus) {\n border-color: ",";\n }\n &:focus {\n & + button {\n display: none;\n }\n }\n "])),n.theme.colors.danger.main)}),(function(n){return n.disabled&&(0,z.iv)(l||(l=(0,w.cy)(["\n pointer-events: none;\n background: ",";\n "],["\n pointer-events: none;\n background: ",";\n "])),(function(n){return n.theme.colors.environment.percent05}))}),(function(n){return n.ghost&&(0,z.iv)(d||(d=(0,w.cy)(["\n :focus {\n box-shadow: none;\n }\n "],["\n :focus {\n box-shadow: none;\n }\n "])))})),C=z.ZP.div(g||(g=(0,w.cy)(["\n padding-bottom: 1rem;\n position: absolute;\n top: ",";\n width: 100%;\n z-index: ",";\n"],["\n padding-bottom: 1rem;\n position: absolute;\n top: ",";\n width: 100%;\n z-index: ",";\n"])),(function(n){return n.ghost?"115%":"100%"}),(function(n){return n.theme.layout.zIndex.dropdown})),M=z.ZP.div(f||(f=(0,w.cy)(["\n visibility: hidden;\n opacity: 0;\n background: ",";\n border-radius: 4px;\n max-height: 0;\n overflow: hidden;\n z-index: ",";\n transition: all 0.2s;\n\n ","\n"],["\n visibility: hidden;\n opacity: 0;\n background: ",";\n border-radius: 4px;\n max-height: 0;\n overflow: hidden;\n z-index: ",";\n transition: all 0.2s;\n\n ","\n"])),(function(n){return n.theme.colors.white}),(function(n){return n.theme.layout.zIndex.dropdown}),(function(n){return n.isActive&&(0,z.iv)(m||(m=(0,w.cy)(["\n visibility: visible;\n opacity: 1;\n max-height: 12.5rem;\n box-shadow: 0 "," 0.625rem 0\n ",";\n "],["\n visibility: visible;\n opacity: 1;\n max-height: 12.5rem;\n box-shadow: 0 "," 0.625rem 0\n ",";\n "])),n.ghost?"0.2rem":"0.5rem",(function(n){return n.theme.colors.environment.percent20}))})),A=z.ZP.div(p||(p=(0,w.cy)(["\n max-height: 12.5rem;\n overflow: auto;\n scroll-behavior: smooth;\n"],["\n max-height: 12.5rem;\n overflow: auto;\n scroll-behavior: smooth;\n"]))),S=z.ZP.ul(b||(b=(0,w.cy)(["\n margin: 0;\n padding: 0;\n"],["\n margin: 0;\n padding: 0;\n"]))),D=z.ZP.li(v||(v=(0,w.cy)(["\n display: block;\n width: 100%;\n padding: 0.875rem ",";\n cursor: pointer;\n font-size: ",";\n color: ",";\n font-weight: 400;\n transition: background 0.3s;\n margin: 0;\n\n &:hover {\n background: ",";\n }\n\n ","\n\n ","\n\n ","\n"],["\n display: block;\n width: 100%;\n padding: 0.875rem ",";\n cursor: pointer;\n font-size: ",";\n color: ",";\n font-weight: 400;\n transition: background 0.3s;\n margin: 0;\n\n &:hover {\n background: ",";\n }\n\n ","\n\n ","\n\n ","\n"])),(function(n){return n.theme.spacing.spacing02}),(function(n){return n.theme.typography.header.h4.size}),(function(n){return n.theme.colors.black}),(function(n){return n.theme.colors.environment.percent05}),(function(n){var e=n.isSelected,t=n.theme;return e&&"\n background: ".concat(t.colors.environment.percent05,";\n ")}),(function(n){var e=n.small,t=n.theme;return e&&"\n font-size: ".concat(t.typography.body2Regular.size,";\n line-height: ").concat(t.typography.body2Regular.lineHeight,";\n padding: 0.625rem ").concat(t.spacing.spacing02,";\n ")}),(function(n){var e=n.disabled,t=n.theme;return e&&"\n color: ".concat(t.colors.environment.percent40,";\n background: ").concat(t.colors.environment.percent05,";\n cursor: not-allowed;\n ")})),E=z.ZP.select(y||(y=(0,w.cy)(["\n display: none;\n"],["\n display: none;\n"]))),P=function(n){var e=n.autoFocus,t=n.defaultValue,o=n.disabled,r=n.handleBlur,i=n.handleChange,c=n.label,a=n.onSubmitForm,s=n.options,u=n.placeholder,l=n.selectId,d=n.setLabelFloating,h=n.small,g=n.status,m=n.value,f=n.ghost,p=n.underline,b=n.smallSelectTextOnly,v=n.right,y=(0,w._T)(n,["autoFocus","defaultValue","disabled","handleBlur","handleChange","label","onSubmitForm","options","placeholder","selectId","setLabelFloating","small","status","value","ghost","underline","smallSelectTextOnly","right"]),z=(0,x.useMemo)((function(){return s?s.find((function(n){return n.id===t})):void 0}),[t,s]),P=(0,x.useRef)(null),Z=(0,x.useRef)(null),T=(0,x.useRef)(null),L=(0,x.useRef)(null),H=(0,x.useState)(!!t),N=H[0],B=H[1],_=(0,x.useState)(!1),R=_[0],F=_[1],O=(0,x.useState)(!1),G=O[0],K=O[1],U=(0,x.useState)(z),W=U[0],j=U[1],V=(0,x.useState)(""),Y=V[0],q=V[1],J=(0,x.useState)(""),Q=J[0],X=J[1],$=(0,x.useState)(void 0),nn=$[0],en=$[1],tn=(0,x.useCallback)((function(n){return function(n){var e=n.disabled,t=n.handleBlur,o=n.handleChange,r=n.isActive,i=n.onSubmitForm,c=n.options,a=n.searchStr,s=n.selectedOption,u=n.setIsActive,l=n.setIsFocused,d=n.setIsTouched,h=n.setSearchStr,g=n.setSelectedOption,m=n.setTimer,f=n.timer;return function(n){if(!e){var p=c.findIndex((function(n){return n.id===(null===s||void 0===s?void 0:s.id)}));switch(n.key){case"Enter":if(r){u(!1);break}i&&i();break;case" ":u((function(n){return!n}));break;case"Escape":u(!1);break;case"ArrowDown":if(r){if(p0&&(b=c[p-1],d(!0),g({name:b.name,id:b.id,optionContent:b.optionContent}),o&&o(b.id)):u(!0);break;case"Tab":u(!1),l(!1),t&&t();break;default:if(/./.test(n.key)){var v=n.key.replace("Shift",""),y=(a+v).toLowerCase();h(y);var w=y.length&&c.find((function(n){return n.name.toLowerCase().startsWith(y)}));w&&(g({name:w.name,id:w.id,optionContent:w.optionContent}),o&&o(w.id)),f&&clearTimeout(f);var x=setTimeout((function(){h(""),m(void 0)}),1e3);m(x)}}}}}({disabled:o,handleBlur:r,handleChange:i,isActive:R,onSubmitForm:a,options:s,searchStr:Q,selectedOption:W,setIsActive:F,setIsFocused:K,setIsTouched:B,setSearchStr:X,setSelectedOption:j,setTimer:en,timer:nn})(n)}),[o,R,s,Q,W,nn]);(0,x.useEffect)((function(){var n=s&&s.find((function(n){return n.id===m}));m&&n&&(j({name:n.name,id:m}),B(!0))}),[m,s]);var on=(0,x.useCallback)((function(n){P.current&&n.target&&!P.current.contains(n.target)&&(F(!1),Z.current&&n.target&&!Z.current.contains(n.target)&&(K(!1),G&&r&&r()))}),[Z.current,P.current,r,G]),rn=(0,x.useCallback)((function(n,e,t){L.current&&L.current.focus(),F(!1),B(!0),j({name:e,id:n,optionContent:t}),i&&i(n)}),[i,L]);return(0,x.useEffect)((function(){j(z)}),[t]),(0,x.useEffect)((function(){e&&L.current&&L.current.focus()}),[e]),(0,x.useEffect)((function(){d&&d((G||!!W||!!u||!!t)&&!(o&&!W))}),[t,o,G,u,W]),(0,x.useEffect)((function(){return window.addEventListener("click",on),function(){window.removeEventListener("click",on)}}),[on]),(0,x.useEffect)((function(){q(W?W.name:o?c:G?u:null!==c&&void 0!==c?c:u)}),[o,G,c,u,W]),(0,x.useEffect)((function(){if(R){var n=s.findIndex((function(n){return n.id===(null===W||void 0===W?void 0:W.id)})),e=n>0?(n-1)*(h?40:48):0;T.current&&(T.current.scrollTop=e)}}),[R,W]),(0,x.useEffect)((function(){!g&&j(z)}),[g]),x.createElement(k,(0,w.pi)({ref:P,disabled:o},y),x.createElement(I,{"data-testid":"select-input",disabled:o,status:g,small:h||b,isActive:R,isTouched:N,onClick:function(){F((function(n){return!n})),K(!0)},onFocus:function(){K(!0)},onKeyDown:tn,ref:L,tabIndex:0,ghost:f,underline:p,right:v},Y),x.createElement(C,{ghost:f},x.createElement(M,{isActive:R,ghost:f,ref:Z,"data-testid":"select-dropdown"},x.createElement(A,{ref:T},x.createElement(S,null,s&&s.length>0&&s.map((function(n){var e=n.id,t=n.name,o=n.optionContent,r=n.disabled;return x.createElement(D,{small:h,key:e,isSelected:e===(null===W||void 0===W?void 0:W.id),onClick:function(){return!r&&rn(e,t,o)},disabled:r},o||t)})))))),x.createElement(E,{defaultValue:null===W||void 0===W?void 0:W.id,id:l},s&&s.length>0&&s.map((function(n){return x.createElement("option",{key:n.id,value:n.id},n.name)}))))}}}]); //# sourceMappingURL=7898.js.map