(self.webpackChunkclubspark_global_admin=self.webpackChunkclubspark_global_admin||[]).push([[4578],{53570:function(e,t,n){"use strict";var o=n(87462),a=n(45987),l=n(67294),r=n(2585),i=n(73288),s=l.forwardRef((function(e,t){var n=e.classes,i=e.className,s=e.row,c=void 0!==s&&s,u=(0,a.Z)(e,["classes","className","row"]);return l.createElement("div",(0,o.Z)({className:(0,r.default)(n.root,i,c&&n.row),ref:t},u))}));t.Z=(0,i.Z)({root:{display:"flex",flexDirection:"column",flexWrap:"wrap"},row:{flexDirection:"row"}},{name:"MuiFormGroup"})(s)},52116:function(e,t,n){"use strict";n.d(t,{Gm:function(){return g},Ho:function(){return p},fM:function(){return m},lk:function(){return v},lv:function(){return b},n0:function(){return f},wK:function(){return h}});var o,a,l,r,i,s,c,u=n(81880),d=n(46307);const m=(0,d.ZP)(o||(o=(0,u.Z)(["\n  query GetEvents($id: UUID!) {\n    tournament(id: $id) {\n      id\n      sanctionStatus\n      name\n      tags\n      visibilityMask\n      tournamentFee\n      finalisedAndCharged\n      isPublished\n      isCancelled\n      tournamentFeePayment {\n        status\n        tournamentFee\n        latestChargeTimestamp\n        paymentMethod {\n          id\n        }\n      }\n      organisation {\n        id\n        name\n        urlSegment\n        hierarchy\n      }\n      director {\n        id\n        firstName\n        lastName\n      }\n      lastSanctionStatusChange(sanctionStatus: SUBMITTED) {\n        createdAt\n        createdByFirstName\n        createdByLastName\n      }\n      primaryLocation {\n        id\n        name\n      }\n      timings {\n        startDate\n        endDate\n        timeZone\n      }\n      websiteContent {\n        logoPath\n      }\n      level {\n        id\n        name\n      }\n      events {\n        id\n        sanctionStatus\n        level {\n          id\n          name\n          shortName\n          category\n        }\n        formatConfiguration {\n          ballColour\n          drawSize\n          eventFormat\n          scoreFormat\n        }\n        division {\n          ageCategory {\n            maximumAge\n            minimumAge\n            type\n          }\n          gender\n          eventType\n          familyType\n          ratingCategory {\n            ratingCategoryType\n            ratingType\n            value\n            minimumValue\n            maximumValue\n          }\n          wheelchairRating\n          ballColour\n        }\n        timings {\n          startDate\n          endDate\n          timeZone\n          lengthInDays\n          hasNonConsecutiveDays\n        }\n        teamEventConfiguration {\n          eventFormat\n          maximumTeams\n        }\n        pricing {\n          entryFee {\n            amount\n            currency\n          }\n        }\n        surface\n      }\n      featureSettings {\n        enabled\n        featureId\n        overridable\n      }\n    }\n  }\n"]))),f=(0,d.ZP)(a||(a=(0,u.Z)(["\n  query GetEventsOverview($id: UUID!) {\n    tournament(id: $id) {\n      events {\n        level {\n          category\n        }\n        division {\n          ageCategory {\n            maximumAge\n            minimumAge\n            type\n          }\n          gender\n          eventType\n          familyType\n          ratingCategory {\n            ratingCategoryType\n            ratingType\n            value\n            minimumValue\n            maximumValue\n          }\n          wheelchairRating\n          ballColour\n        }\n      }\n    }\n  }\n"]))),p=(0,d.ZP)(l||(l=(0,u.Z)(["\n  mutation UpdateSanction(\n    $id: UUID!\n    $approved: [EventApproved!]!\n    $declined: [EventDeclined!]!\n    $message: String\n    $orgId: UUID!\n    $processPayment: Boolean\n  ) {\n    updateTournamentSanctionStatus(\n      tournamentId: $id\n      sanctioningOrganisationId: $orgId\n      approved: $approved\n      declined: $declined\n      message: $message\n      processPayment: $processPayment\n    ) {\n      id\n      sanctionStatus\n      isPublished\n      events {\n        id\n        sanctionStatus\n      }\n      tournamentFeePayment {\n        status\n        latestChargeTimestamp\n      }\n    }\n  }\n"]))),g=(0,d.ZP)(r||(r=(0,u.Z)(["\n  mutation ResetSanctionStatus($tournamentId: UUID!, $orgId: UUID!, $message: String) {\n    resetTournamentSanctionStatus(\n      tournamentId: $tournamentId\n      sanctioningOrganisationId: $orgId\n      message: $message\n    ) {\n      id\n      sanctionStatus\n    }\n  }\n"]))),v=(0,d.ZP)(i||(i=(0,u.Z)(["\n  mutation AddTagToTournament($tournamentId: UUID!, $tag: String!) {\n    addTagToTournament(tournamentId: $tournamentId, tag: $tag) {\n      id\n      tags\n    }\n  }\n"]))),h=(0,d.ZP)(s||(s=(0,u.Z)(["\n  mutation DeleteTournamentTag($tournamentId: UUID!, $tag: String!) {\n    deleteTagFromTournament(tournamentId: $tournamentId, tag: $tag) {\n      id\n      tags\n    }\n  }\n"]))),b=(0,d.ZP)(c||(c=(0,u.Z)(["\n  mutation SetTournamentFeature($tournamentId: UUID!, $featureId: String!, $enabled: Boolean!) {\n    setTournamentFeatureSettings(\n      enabled: $enabled\n      tournamentId: $tournamentId\n      featureId: $featureId\n    ) {\n      enabled\n      featureId\n      overridable\n    }\n  }\n"])))},12781:function(e,t,n){"use strict";n.d(t,{Z:function(){return he}});var o={};n.r(o),n.d(o,{body:function(){return l},bodyBase:function(){return r},bodyLarge:function(){return i},bodyLargeBold:function(){return s},bodyRegular:function(){return c},bodyRegularBold:function(){return u},bodySmall:function(){return d},bodySmallBold:function(){return m},borderTop:function(){return f},breakWordContainer:function(){return p},buttonIconBase:function(){return g},clickLink:function(){return v},close:function(){return h},downloadBody:function(){return b},downloadClose:function(){return y},downloadFloating:function(){return E},downloadMessage:function(){return C},downloadedBody:function(){return w},downloadedClose:function(){return D},downloadedFloating:function(){return I},downloadedMessage:function(){return A},dropdownBase:function(){return T},dropdownSelectBase:function(){return k},flexCol:function(){return L},floating:function(){return S},formErrorMessage:function(){return N},h3:function(){return R},h4:function(){return x},hoverLink:function(){return F},hoverRow:function(){return M},icon:function(){return Z},lgSize:function(){return _},membershipContainer:function(){return $},membershipHeader:function(){return O},membershipHeading:function(){return P},membershipLabel:function(){return W},message:function(){return B},moreFiltersBorderClass:function(){return U},neutralBody:function(){return j},neutralClose:function(){return G},neutralFloating:function(){return V},neutralMessage:function(){return H},pageBg:function(){return z},pointer:function(){return Y},primaryBorder:function(){return K},shadowBoxLight:function(){return q},siteFont:function(){return X},slideDownAndFade:function(){return J},slideLeftAndFade:function(){return Q},slideRightAndFade:function(){return ee},slideUpAndFade:function(){return te},smSize:function(){return ne},statusDecoration:function(){return oe},successBody:function(){return ae},successClose:function(){return le},successFloating:function(){return re},successMessage:function(){return ie},textInput:function(){return se},textInverted:function(){return ce},textMediumDark:function(){return ue},tooltipFont:function(){return de},unstyledButton:function(){return me}});var a=n(67294),l="floating-notification-module--body--tYlE5",r="floating-notification-module--body-base--E7jXS floating-notification-module--site-font--CLsMw",i="floating-notification-module--body-large--ozvRE floating-notification-module--body-base--E7jXS floating-notification-module--site-font--CLsMw",s="floating-notification-module--body-large-bold---j63u floating-notification-module--body-base--E7jXS floating-notification-module--site-font--CLsMw",c="floating-notification-module--body-regular--xxCBK floating-notification-module--body-base--E7jXS floating-notification-module--site-font--CLsMw",u="floating-notification-module--body-regular-bold--bysHo floating-notification-module--body-base--E7jXS floating-notification-module--site-font--CLsMw",d="floating-notification-module--body-small--c5LF4 floating-notification-module--body-base--E7jXS floating-notification-module--site-font--CLsMw",m="floating-notification-module--body-small-bold---IOXL floating-notification-module--body-base--E7jXS floating-notification-module--site-font--CLsMw",f="floating-notification-module--border-top--CpX-U",p="floating-notification-module--break-word-container--Fdxig",g="floating-notification-module--button-icon-base--l5DEg",v="floating-notification-module--click-link--0swU1",h="floating-notification-module--close--Dz3FG",b="floating-notification-module--download-body--rHJlk floating-notification-module--body--tYlE5",y="floating-notification-module--download-close---ooU0 floating-notification-module--close--Dz3FG",E="floating-notification-module--download-floating--nEBT6 floating-notification-module--floating--F3el0",C="floating-notification-module--download-message--sS-GH floating-notification-module--success-message--IXaYN floating-notification-module--message--WFDLI",w="floating-notification-module--downloaded-body--eylrz floating-notification-module--body--tYlE5",D="floating-notification-module--downloaded-close--CWCWc floating-notification-module--success-close--e2hjc floating-notification-module--close--Dz3FG",I="floating-notification-module--downloaded-floating--qmm5N floating-notification-module--download-floating--nEBT6 floating-notification-module--floating--F3el0",A="floating-notification-module--downloaded-message--I4t8m floating-notification-module--success-message--IXaYN floating-notification-module--message--WFDLI",T="floating-notification-module--dropdown-base--S2RS6",k="floating-notification-module--dropdown-select-base--3dwbw floating-notification-module--text-input--sOpRN",L="floating-notification-module--flex-col--pYwGH",S="floating-notification-module--floating--F3el0",N="floating-notification-module--form-error-message--L8C6R",R="floating-notification-module--h3--5nQyo",x="floating-notification-module--h4--KwcSz",F="floating-notification-module--hover-link--glyHY",M="floating-notification-module--hover-row--iTptu",Z="floating-notification-module--icon--4sGoy",_="floating-notification-module--lg-size--jJNi8",$="floating-notification-module--membership-container--AuS8n floating-notification-module--flex-col--pYwGH floating-notification-module--primary-border--OxUYa",O="floating-notification-module--membership-header--RmxI-",P="floating-notification-module--membership-heading--4y4K+",W="floating-notification-module--membership-label--q0vdb",B="floating-notification-module--message--WFDLI",U="floating-notification-module--more-filters-border-class--67KrU",j="floating-notification-module--neutral-body--gs+a4 floating-notification-module--body--tYlE5",G="floating-notification-module--neutral-close--r3HTN floating-notification-module--close--Dz3FG",V="floating-notification-module--neutral-floating--xBI3h floating-notification-module--floating--F3el0",H="floating-notification-module--neutral-message--xCnk5 floating-notification-module--message--WFDLI",z="floating-notification-module--page-bg--TeSdk",Y="floating-notification-module--pointer--TI2Em",K="floating-notification-module--primary-border--OxUYa",q="floating-notification-module--shadow-box-light--EAFhc",X="floating-notification-module--site-font--CLsMw",J="floating-notification-module--slideDownAndFade--OKbkO",Q="floating-notification-module--slideLeftAndFade--wRpdu",ee="floating-notification-module--slideRightAndFade--oiLRT",te="floating-notification-module--slideUpAndFade--JisI0",ne="floating-notification-module--sm-size--xq2WK",oe="floating-notification-module--status-decoration--VisOz",ae="floating-notification-module--success-body--JGfER floating-notification-module--body--tYlE5",le="floating-notification-module--success-close--e2hjc floating-notification-module--close--Dz3FG",re="floating-notification-module--success-floating--xeSYJ floating-notification-module--floating--F3el0",ie="floating-notification-module--success-message--IXaYN floating-notification-module--message--WFDLI",se="floating-notification-module--text-input--sOpRN",ce="floating-notification-module--text-inverted--SXz8Q",ue="floating-notification-module--text-medium-dark--2AoYd",de="floating-notification-module--tooltipFont--NVmAI",me="floating-notification-module--unstyled-button--rShji",fe=n(55971),pe=n(39937),ge=n(69931),ve=n.n(ge);var he=e=>{let{message:t,onClose:n,icon:l,actionButton:r,variant:i="neutral",hideCloseButton:s,size:c="lg"}=e;return a.createElement("aside",{className:ve()(o[i+"Floating"],{[o[c+"Size"]]:c})},!s&&a.createElement("button",{className:o[i+"Close"],onClick:n},a.createElement(fe.aHS,null)),a.createElement("p",{className:o[i+"Body"]},l&&a.createElement(pe.Z,l),a.createElement("span",{className:o[i+"Message"]},t),r))}},48585:function(e,t,n){"use strict";n.d(t,{Z:function(){return m},C:function(){return f}});var o=n(67294),a=n(32766),l=n(28900),r=n(53919),i=n(90697),s=n(57254),c=n(74405),u=n(76879),d=n(51252);let m=function(e){return e.DIVIDE_100="DIVIDE_100",e.TO_DATE_TIME="TO_DATE_TIME",e.ARRAY_JOIN="ARRAY_JOIN",e.ARRAY_FILTER="ARRAY_FILTER",e.FORMAT_UTC_DATE="FORMAT_UTC_DATE",e.ARRAY_FIELD_SELECT="ARRAY_FIELD_SELECT",e.CONVERT_TO_TIMEZONE="CONVERT_TO_TIMEZONE",e}({});var f=e=>{let{generateButtonTitle:t,reportQuery:n,reportQueryEndpoint:m,outputFormat:f="CSV",buttonProps:p={},paginator:g,onReportUploadStateChange:v,reportUploadState:h,reportQueryVariables:b,csvTransforms:y,csvFormatOptions:E,filename:C}=e;const{0:w,1:D}=(0,o.useState)("none"),I=null!=h?h:w,A=(0,o.useMemo)((()=>{try{if(b)return JSON.stringify(b)}catch{return}}),[b]),[T,{data:k}]=(0,r.D)(s.C,{client:c.$y,variables:{query:n,endpoint:m,paginator:g,outputFormat:f,queryVariablesJSON:A,csvTransforms:y,csvFormatOptions:E}}),L=(0,d.u1)(),S=(0,o.useMemo)((()=>{var e,t;const n=C?"&originalname="+C+"."+f.toLowerCase():"",o=(0,u.S)().GATEWAY_BASE_URL;let a=null!==(e=null==k||null===(t=k.addReport)||void 0===t?void 0:t.url)&&void 0!==e?e:"";return o.endsWith("?")&&(a=a.replace(/^\/+/,"")),""+o+a+"?providerId="+L+n}),[k,C,f]),N=(0,o.useCallback)((e=>{null==v||v(e,"downloadable"===e?{downloadUrl:S}:void 0),D(e)}),[D,v,S]),[R,x]=(0,i.t)(s.D,{client:c.$y,pollInterval:2e3}),F=(0,o.useCallback)((async()=>{N("processing");try{var e,t;const n=null===(e=(await T()).data)||void 0===e||null===(t=e.addReport)||void 0===t?void 0:t.id;n?R({variables:{reportId:n}}):N("none")}catch{N("none")}}),[T,R,N]);(0,o.useEffect)((()=>{var e,t,n,o,a;const l=null===(e=x.data)||void 0===e||null===(t=e.reportMetadata)||void 0===t||null===(n=t.status)||void 0===n?void 0:n.state,r=null===(o=x.data)||void 0===o||null===(a=o.reportMetadata)||void 0===a?void 0:a.uploaded;var i;(r||"ERROR"===l||"COMPLETE"===l)&&(null==x||null===(i=x.stopPolling)||void 0===i||i.call(x),N(r?"downloadable":"none"))}),[x,N]);const{t:M}=(0,l.$)();return"downloadable"===I?o.createElement("a",{download:!0,href:S,className:"generate-report-module--export-link--IjRMN"},M("download report",{type:f})):o.createElement(a.Z,Object.assign({},p,{loading:"processing"===I,onClick:F}),null!=t?t:M("generate report",{type:f}))}},61680:function(e,t,n){"use strict";n.d(t,{p:function(){return l}});var o,a=n(81880);const l=(0,n(46307).ZP)(o||(o=(0,a.Z)(["\n  query GetLevels {\n    levels {\n      id\n      category\n      name\n      orderIndex\n      sanctionType\n    }\n  }\n"])))},36884:function(e,t,n){"use strict";n.d(t,{Z:function(){return N}});var o=n(85935),a=n(87462),l=n(29439),r=n(45987),i=n(67294),s=n(53570),c=n(40395),u=n(12760);var d=i.createContext(),m=n(38249),f=i.forwardRef((function(e,t){var n=e.actions,o=e.children,f=e.name,p=e.value,g=e.onChange,v=(0,r.Z)(e,["actions","children","name","value","onChange"]),h=i.useRef(null),b=(0,u.Z)({controlled:p,default:e.defaultValue,name:"RadioGroup"}),y=(0,l.Z)(b,2),E=y[0],C=y[1];i.useImperativeHandle(n,(function(){return{focus:function(){var e=h.current.querySelector("input:not(:disabled):checked");e||(e=h.current.querySelector("input:not(:disabled)")),e&&e.focus()}}}),[]);var w=(0,c.Z)(t,h),D=(0,m.Z)(f);return i.createElement(d.Provider,{value:{name:D,onChange:function(e){C(e.target.value),g&&g(e,e.target.value)},value:E}},i.createElement(s.Z,(0,a.Z)({role:"radiogroup",ref:w},v),o))})),p=n(45685),g=n(2585),v=n(31614),h=n(57053),b=(0,h.Z)(i.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"RadioButtonUnchecked"),y=(0,h.Z)(i.createElement("path",{d:"M8.465 8.465C9.37 7.56 10.62 7 12 7C14.76 7 17 9.24 17 12C17 13.38 16.44 14.63 15.535 15.535C14.63 16.44 13.38 17 12 17C9.24 17 7 14.76 7 12C7 10.62 7.56 9.37 8.465 8.465Z"}),"RadioButtonChecked"),E=n(73288);var C=(0,E.Z)((function(e){return{root:{position:"relative",display:"flex","&$checked $layer":{transform:"scale(1)",transition:e.transitions.create("transform",{easing:e.transitions.easing.easeOut,duration:e.transitions.duration.shortest})}},layer:{left:0,position:"absolute",transform:"scale(0)",transition:e.transitions.create("transform",{easing:e.transitions.easing.easeIn,duration:e.transitions.duration.shortest})},checked:{}}}),{name:"PrivateRadioButtonIcon"})((function(e){var t=e.checked,n=e.classes,o=e.fontSize;return i.createElement("div",{className:(0,g.default)(n.root,t&&n.checked)},i.createElement(b,{fontSize:o}),i.createElement(y,{fontSize:o,className:n.layer}))})),w=n(21010),D=n(47969),I=n(59349);var A=i.createElement(C,{checked:!0}),T=i.createElement(C,null),k=i.forwardRef((function(e,t){var n=e.checked,o=e.classes,l=e.color,s=void 0===l?"secondary":l,c=e.name,u=e.onChange,m=e.size,f=void 0===m?"medium":m,p=(0,r.Z)(e,["checked","classes","color","name","onChange","size"]),h=i.useContext(d),b=n,y=(0,I.Z)(u,h&&h.onChange),E=c;return h&&(void 0===b&&(b=h.value===e.value),void 0===E&&(E=h.name)),i.createElement(v.Z,(0,a.Z)({color:s,type:"radio",icon:i.cloneElement(T,{fontSize:"small"===f?"small":"medium"}),checkedIcon:i.cloneElement(A,{fontSize:"small"===f?"small":"medium"}),classes:{root:(0,g.default)(o.root,o["color".concat((0,D.Z)(s))]),checked:o.checked,disabled:o.disabled},name:E,checked:b,onChange:y,ref:t},p))})),L=(0,E.Z)((function(e){return{root:{color:e.palette.text.secondary},checked:{},disabled:{},colorPrimary:{"&$checked":{color:e.palette.primary.main,"&:hover":{backgroundColor:(0,w.Fq)(e.palette.primary.main,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}}},"&$disabled":{color:e.palette.action.disabled}},colorSecondary:{"&$checked":{color:e.palette.secondary.main,"&:hover":{backgroundColor:(0,w.Fq)(e.palette.secondary.main,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}}},"&$disabled":{color:e.palette.action.disabled}}}}),{name:"MuiRadio"})(k),S="radio-button-group-module--radio-button--MejfG";var N=e=>{let{options:t,value:n,label:a,isRow:l,handleChange:r,field:s,...c}=e;return i.createElement(o.Z,{component:"fieldset"},i.createElement(f,Object.assign({"aria-label":n,value:n,onChange:r,row:l},s,c),t.map((e=>i.createElement(p.Z,{key:e.value,value:e.value,label:e.label,classes:{label:"radio-button-group-module--typography--zCe9W radio-button-group-module--site-font--soyKH"},control:i.createElement(L,{color:"default",classes:{root:S,checked:"radio-button-group-module--checked--IPsDU",colorSecondary:S},disableRipple:!0,className:S})})))))}},79072:function(e,t,n){"use strict";var o=n(67294),a=n(28900),l=n(12582);t.Z=e=>{let{status:t,cancelled:n}=e;const{t:r}=(0,a.$)();let i="warning",s="pending";return"APPROVED"===t?(i="success",s="approved"):"DECLINED"===t&&(i="error",s="declined"),o.createElement(o.Fragment,null,o.createElement(l.Z,{variety:i},r(s)),n&&o.createElement(l.Z,{variety:"error"},r("canceled")))}},9561:function(e,t,n){"use strict";n.d(t,{B_:function(){return U},Lt:function(){return G},Tg:function(){return j},WD:function(){return V}});var o=n(67294),a=n(35417),l=n(28900),r=n(78133);const{BOYS:i,GIRLS:s,MIXED:c,COED:u}=a.Gender,{ARTIFICIAL:d,CLAY:m,GREEN_CLAY:f,RED_CLAY:p,GRASS:g,HARD:v}=a.Surface,{NTRP:h,WTN:b}=a.RatingType,{SINGLES:y,DOUBLES:E,TEAM:C}=a.EventType,{COMBINED:w,INDIVIDUAL:D}=a.AgeCategoryType,{GRANDFATHER_GRANDSON:I,HUSBAND_WIFE:A,SAME_GENDER_FEMALE:T,MOTHER_DAUGHTER:k,SAME_GENDER_MALE:L,FATHER_DAUGHTER:S,FATHER_SON:N,MOTHER_SON:R}=a.FamilyType,x=(e,t)=>{let{division:{gender:n,ageCategory:o,eventType:l,ratingCategory:r,familyType:i,wheelchairRating:s,ballColour:c},level:{category:u}}=e;if(i)return((e,t,n,o)=>{let a="";if(t.type===D&&t.minimumAge){let n={};e===N?n={parent:"father",child:"son"}:e===S?n={parent:"father",child:"daughter"}:e===R?n={parent:"mother",child:"son"}:e===k&&(n={parent:"mother",child:"daughter"}),a+=o("aged parent child division",{...n,minAge:t.minimumAge})}else e===I&&(a+=o("grandfather grandson")),e===A&&(a+=o("husband wife")),e===T&&(a+=o("same gender female")),e===k&&(a+=o("mother")+" - "+o("daughter")),e===L&&(a+=o("same gender male")),e===S&&(a+=o("father")+" - "+o("daughter")),e===N&&(a+=o("father")+" - "+o("son")),e===R&&(a+=o("mother")+" - "+o("son"));t.type===w&&(a+=" (Combined "+t.minimumAge+")");const l=F(n,o);return l&&(a+=" - "+l),a})(i,o,c,t);{const e=M(s,t),i=t(Z(n,u)),d=$(o,t,s),m=t(_(l)).toLowerCase(),f=((e,t)=>{if(e){let n="";return e.ratingType===h&&(n=t("ntrp")),e.ratingType===b&&(n=t("wtn")),e.ratingCategoryType===a.kJ.COMBINED&&(n+=" "+t("combo")),n+=" "+(null!==e.value?e.value.toFixed(1):t("open")),n}})(r,t),p=F(c,t);if(O(r,o))return i+" "+m+" "+P(r,o);let g=i+" "+e+" "+d+" "+m;return f&&(g=f+" "+g),p&&(g+=" - "+p),g}},F=(e,t)=>e===a.BallColour.ORANGE?t("orange"):e===a.BallColour.GREEN?t("green"):e===a.BallColour.RED?t("red"):"",M=(e,t)=>e===a.xf.A?t("wheelchair a"):e===a.xf.B?t("wheelchair b"):e===a.xf.C?t("wheelchair c"):e===a.xf.D?t("wheelchair d"):e===a.xf.Q?t("wheelchair q"):"",Z=(e,t)=>{const n=t===a.WD.JUNIOR;if([a.WD.WTN_PLAY,a.WD.PICKLE_BALL].includes(t)){if(e===i)return"male";if(e===s)return"female"}return e===i?n?"boys":"mens":e===s?n?"girls":"womens":e===u?"coed":e===c?"mixed":e},_=e=>e===E?"doubles":e===y?"singles":e===C?"team":e,$=(e,t,n)=>{const o=n===a.xf.A||n===a.xf.B||n===a.xf.C||n===a.xf.D;if(!e||!e.maximumAge&&!e.minimumAge)return o?"":t("open");const{maximumAge:l,minimumAge:r}=e;let i="";return l&&(i+=t("under age",{age:l})),r&&l&&(i+=", "),r&&(i+=t("over age",{age:r})),i},O=(e,t)=>{const{minimumValue:n=null,maximumValue:o=null}=null!=e?e:{},{maximumAge:a=null,minimumAge:l=null}=null!=t?t:{};return null!==n&&null!==o||null!==a&&null!==l},P=(e,t)=>{const n=W(e),o=B(t);return""+n+(n&&o?", ":"")+o},W=e=>{if(!e)return"";const t=e,n=e.ratingType;return(n===a.RatingType.NTRP?"NTRP":n===a.RatingType.WTN?"WTN":"")+" "+t.minimumValue+" - "+t.maximumValue},B=e=>e&&null!==e.maximumAge&&null!==e.minimumAge?"age "+e.minimumAge+" - "+e.maximumAge:"",U=e=>{let{event:t}=e;const{t:n}=(0,l.$)();return o.createElement(o.Fragment,null,x(t,n))},j=e=>{let{event:t}=e;const{t:n}=(0,l.$)();return o.createElement(o.Fragment,null,t.surface?""+n((e=>e===d?"artificial":e===m?"clay":e===g?"grass":e===f?"green clay":e===v?"hard":e===p?"red clay":e)(t.surface)):n("n/a"))},G=e=>{var t,n,r;let{event:i}=e;const{t:s}=(0,l.$)();return o.createElement(o.Fragment,null,s((c=(null==i||null===(t=i.division)||void 0===t?void 0:t.eventType)===a.EventType.TEAM?null==i||null===(n=i.teamEventConfiguration)||void 0===n?void 0:n.eventFormat:null==i||null===(r=i.formatConfiguration)||void 0===r?void 0:r.eventFormat)?"draw type "+c.toLowerCase():"n/a"));var c},V=e=>{let{category:t}=e;const{t:n}=(0,l.$)();return o.createElement(r.BG,null,n((i=t)===a.WD.ADULT?"adult":i===a.WD.JUNIOR?"junior":i===a.WD.WHEELCHAIR?"wheelchair":i===a.WD.WTN_PLAY?"wtn play":i===a.WD.PICKLE_BALL?"pickleball":"n/a"));var i}},78133:function(e,t,n){"use strict";n.d(t,{z:function(){return d},BG:function(){return f},VW:function(){return u},nK:function(){return m}});var o={};n.r(o),n.d(o,{el:function(){return l},Ig:function(){return r},jq:function(){return i}});var a=n(67294),l="util-components-module--align-number--XTQFM",r="util-components-module--capitalise--d1UcV",i="util-components-module--no-wrap--vr9Hk",s=n(69931),c=n.n(s);const u=e=>{let{children:t,className:n}=e;return a.createElement("span",{className:c()(i,n)},t)},d=e=>{let{val:t}=e;return a.createElement("span",{className:l},t)},m=e=>{let{children:t}=e;return a.createElement("div",{className:o.pageMax},t)},f=e=>{let{children:t}=e;return a.createElement("span",{className:r},t)}},25933:function(e,t,n){"use strict";var o=n(93433),a=n(67294),l=n(35417);const{BOYS:r,GIRLS:i,MIXED:s,COED:c}=l.Gender,{SINGLES:u,DOUBLES:d,TEAM:m}=l.EventType,{GRANDFATHER_GRANDSON:f,HUSBAND_WIFE:p,SAME_GENDER_FEMALE:g,MOTHER_DAUGHTER:v,SAME_GENDER_MALE:h,FATHER_DAUGHTER:b,FATHER_SON:y,MOTHER_SON:E}=l.FamilyType;let C=function(){function e(e,t){this.genderWeights=[r,i,s,c],this.eventTypeWeights=[u,d,m],this.familyTypeWeights=[null,y,b,E,v,p,f,g,h],this.events=[e,t]}var t=e.prototype;return t.compare=function(e){const{weights:t,getField:n}=this.getWeights(e),[o,a]=this.events.map((e=>t.findIndex((t=>t===n(e)))));return o>a?1:-1},t.getWeights=function(e){return"gender"===e?{weights:this.genderWeights,getField:this.getGender}:"eventType"===e?{weights:this.eventTypeWeights,getField:this.getEventType}:{weights:this.familyTypeWeights,getField:this.getFamilyType}},t.getGender=function(e){return e.division.gender},t.getEventType=function(e){return e.division.eventType},t.getFamilyType=function(e){return e.division.familyType},e}();t.Z=e=>(0,a.useMemo)((()=>{var t;if(null!=e&&null!==(t=e.tournament)&&void 0!==t&&t.events)return(0,o.Z)(e.tournament.events).sort(((e,t)=>{const n=new C(e,t),[o,a]=[e,t].map((e=>{var t,n,o;return{minAge:null===(t=e.division.ageCategory)||void 0===t?void 0:t.minimumAge,maxAge:null===(n=e.division.ageCategory)||void 0===n?void 0:n.maximumAge,gender:e.division.gender,rating:null===(o=e.division.ratingCategory)||void 0===o?void 0:o.value,eventType:e.division.eventType,familyType:e.division.familyType}}));if(o.familyType!==a.familyType)return n.compare("familyType");if(o.rating!==a.rating&&(void 0===o.rating||void 0===a.rating))return void 0===o.rating?-1:1;if(o.gender!==a.gender)return n.compare("gender");if(o.minAge!==a.minAge){if(o.minAge&&a.minAge)return o.minAge>a.minAge?1:-1;if(o.maxAge&&a.maxAge)return o.maxAge>a.maxAge?1:-1;if(o.minAge||a.minAge)return a.minAge?-1:1;if(o.maxAge||o.maxAge)return a.maxAge?-1:1}else{if(o.eventType!==a.eventType)return n.compare("eventType");var l,r;if(o.rating!==a.rating)return(null!==(l=o.rating)&&void 0!==l?l:0)>(null!==(r=a.rating)&&void 0!==r?r:0)?1:-1}return 0}))}),[e])},96605:function(e,t,n){"use strict";n.d(t,{NA:function(){return m},_Q:function(){return d}});var o=n(93433),a=n(67294),l=n(56145),r=n(70951),i=n(28900),s=n(51252),c=n(74405),u=n(80702);const d=(e,t)=>{const{t:n}=(0,i.$)(),d=(0,r.zF)(),{isNational:g}=(0,r.HW)(),v=(0,s.u1)(),{0:h,1:b}=(0,a.useState)(null),{0:y,1:E}=(0,a.useState)(null),{0:C,1:w}=(0,a.useState)(null),{0:D,1:I}=(0,a.useState)(null),{0:A,1:T}=(0,a.useState)(null),k=(0,s.Vu)(),L=async()=>k||(0,l.HG)(),{0:S,1:N}=(0,a.useState)(null),{0:R,1:x}=(0,a.useState)(!1);return(0,a.useEffect)((()=>{(async()=>{x(!0);try{var a,l;const r=await L();r&&(0,s.b0)(r,c.xH),T(r);const i=null==r||null===(a=r.filter((e=>e.GroupID===u.e)))||void 0===a?void 0:a.sort(((e,t)=>{var n;return null===(n=e.Name)||void 0===n?void 0:n.localeCompare(t.Name)})),h=null==r||null===(l=r.filter((e=>e.GroupID!==u.e)))||void 0===l?void 0:l.sort(((e,t)=>{var n;return null===(n=e.Name)||void 0===n?void 0:n.localeCompare(t.Name)}));if(i&&!t){const e=m(i);if(d||g)w([f(n)].concat(e));else{const e=null==h?void 0:h.find((e=>e.ID===v)),t=null==i?void 0:i.find((t=>t.ID===(null==e?void 0:e.GroupID)||t.ID===v)),n=t?m([t]):[];w(n)}}if(h&&e&&!t){const t=h.filter((t=>(null==t?void 0:t.GroupID)===("object"==typeof e?null==e?void 0:e.value:e))),o=m(t);I([p(n)].concat(o))}if(t){const e=null==h?void 0:h.find((e=>(null==e?void 0:e.ID)===t)),a=null==i?void 0:i.find((t=>(null==t?void 0:t.ID)===(null==e?void 0:e.GroupID))),l=null==h?void 0:h.filter((e=>(null==e?void 0:e.GroupID)===(null==a?void 0:a.ID)));w(m([a])),I([p(n)].concat((0,o.Z)(m(l))))}b(i),E(h),x(!1)}catch(S){N(S)}})()}),[e,d,g,v,t]),{sectionOptions:C,districtOptions:D,sections:h,districts:y,loading:R,error:S,venues:A}},m=e=>null==e?void 0:e.map((e=>({value:e.ID,label:e.Name}))),f=e=>({label:e("section all"),value:""}),p=e=>({label:e("district all"),value:""})},31001:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return Oa}});var o={};n.r(o),n.d(o,{d1:function(){return Ta},Fh:function(){return ka},d$:function(){return La}});var a,l=n(67294),r=n(13756),i=n(79338),s=n(93433),c=n(18446),u=n.n(c),d=n(48683),m=n(12582),f=n(24363),p=n(35356),g=n(28900),v=n(57311),h=n(78133),b=n(79072),y=n(25444),E=n(81880),C=n(46307);const w=(0,C.ZP)(a||(a=(0,E.Z)(["\n  query GetTournaments(\n    $groupBy: GroupingType!\n    $startDateFrom: String!\n    $startDateTo: String!\n    $orgId: UUID\n    $filters: [PropertyFilterInput!]\n  ) {\n    paginatedTournamentGroups(\n      paginationOptions: { limit: 53, offset: 0, filters: $filters }\n      filter: {\n        ignoreEmptyGroups: true\n        startDateFrom: $startDateFrom\n        startDateTo: $startDateTo\n        groupBy: $groupBy\n        organisationId: $orgId\n      }\n    ) {\n      totalItems\n      items {\n        groupNumber\n        groupingType\n        startDate\n        endDate\n        tournaments {\n          id\n          identificationCode\n          name\n          eventCount\n          sanctionStatus\n          timings {\n            startDate\n            endDate\n            timeZone\n          }\n          director {\n            id\n            firstName\n            lastName\n          }\n          primaryLocation {\n            id\n            name\n            county\n          }\n          level {\n            id\n            shortName\n            category\n          }\n          organisation {\n            id\n            name\n            hierarchy\n            parent {\n              id\n              name\n              parent {\n                id\n                name\n              }\n            }\n          }\n          websiteContent {\n            logoPath\n          }\n          isPublished\n          isCancelled\n        }\n      }\n    }\n  }\n"])));var D=n(35417),I=n(79201),A=n.n(I),T=n(48110),k=n(13800),L=n(39949),S=(n(49824),n(23105)),N=n(76911),R=n(95341),x=n(56145);function F(){const{0:e,1:t}=(0,l.useState)(!1),{0:n,1:o}=(0,l.useState)(void 0);(0,l.useEffect)((()=>{(async()=>{t(!0);const e=await(0,x.vi)(),n=await(0,x.l8)();o({venues:e,facilities:n}),t(!1)})()}),[]);const a=(0,l.useMemo)((()=>function(e){const{venues:t=[],facilities:n=[]}=e||{},o=t.map((e=>({label:e.Name,value:e.ID,type:"venue"}))),a=n.map((e=>({label:e.Name,value:e.ID,type:"facility"})));return[].concat((0,s.Z)(o),(0,s.Z)(a))}(n)),[n]);return(0,l.useMemo)((()=>({loading:e,data:n,options:a})),[e,n,a])}var M="dropdown-custom-module--date--WSTSa",Z="dropdown-custom-module--error--zvbK8",_=n(58966),$=n(32766),O=n(69931),P=n.n(O);var W=e=>{let{children:t,label:o,width:a,minWidth:r,isOpen:i,onToggleDropdown:s,icon:c,iconPosition:u,grayedLabel:d,type:m="input",buttonIconName:f}=e;const p=(0,l.createRef)(),{t:v}=(0,g.$)();(0,l.useEffect)((()=>{const e=e=>{p.current&&!p.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}}),[p]);const h=e=>{e.stopPropagation(),s(!i)};return l.createElement("div",{ref:p,className:P()({"dropdown-custom-module--container--oKLB1":"input"===m}),style:{width:null!=a?a:260},tabIndex:0,onKeyDown:e=>{switch(e.key){case" ":case"SpaceBar":case"Enter":s(!0)}}},l.createElement("div",{className:P()({"dropdown-custom-module--inputStyle--0CqA8":"input"===m,"dropdown-custom-module--buttonStyle--NrzN2":"button"===m})},"button"===m&&l.createElement($.Z,{level:"tertiary",onClick:h,icon:f},o),"input"===m&&l.createElement("div",{className:P()("dropdown-custom-module--label--E6NqK",{"dropdown-custom-module--labelFlex--BJDkv":"right"===u,"dropdown-custom-module--grayedOut--bWGLV":i&&d}),onClick:h},c&&"left"===u&&l.createElement("img",{className:"dropdown-custom-module--icon--j+5aE",src:n(57872)("./"+c+".png").default,alt:"Calendar"}),o,c&&"right"===u&&l.createElement("img",{className:"dropdown-custom-module--iconRight--zqtvH",src:n(57872)("./"+c+".png").default,alt:"Calendar"})),l.createElement("div",{className:P()("dropdown-custom-module--content--1jPG6",{"dropdown-custom-module--show--Mu57c":i}),style:{minWidth:r},onClick:e=>e.stopPropagation()},t)))},B=n(76879);var U=e=>{let{from:t,to:n,setFilters:o,initFilter:a}=e;const{0:r,1:i}=(0,l.useState)(!1),{0:s,1:c}=(0,l.useState)(t),{0:u,1:d}=(0,l.useState)(n),{0:m,1:f}=(0,l.useState)({from:!1,to:!1,range:!1}),{t:p}=(0,g.$)(),v=(0,l.useRef)(),h=(0,l.useRef)(),b=(0,l.useMemo)(B.Z,[]);(0,l.useEffect)((()=>{c(t),d(n),f({from:!1,to:!1,range:!1})}),[t,n,r]);const y=(0,l.useMemo)((()=>{const e=A()(t).local(),o=A()(n).local();return e.isValid()&&o.isValid()?e.isSame(o,"month")?p("date same month",{from:e,to:o}):e.isSame(o,"year")?""+p("date same year",{from:e,to:o}):""+p("date diff year",{from:e,to:o}):p("please select valid date")}),[t,n,p]),E=(0,l.useMemo)((()=>!(A()(s).isSame(a.from,"day")&&A()(u).isSame(a.to,"day"))),[s,u,a]),C=e=>{i(e)},w=(e,t)=>{if("from"===t){var n,o;const t=A()(e),a=A()(u);c(e),t.isAfter(a)&&d(null),null==h||null===(n=h.current)||void 0===n||null===(o=n.input)||void 0===o||o.focus(),f({...m,from:!1,range:!1})}else{const t=A()(e),n=A()(s);var a,l;if(d(e),t.isBefore(n))c(null),null==v||null===(a=v.current)||void 0===a||null===(l=a.input)||void 0===l||l.focus();f({...m,to:!1,range:!1})}};return l.createElement(W,{label:y,isOpen:r,icon:"calendar-icon",iconPosition:"left",onToggleDropdown:C,grayedLabel:!0},l.createElement("div",{className:"dropdown-custom-module--dateContainer--XUILe"},l.createElement("div",{className:P()(M,{[Z]:m.from||m.range})},l.createElement("label",null,p("from")),l.createElement(_.Z,{ref:v,selected:s,testId:"from-date-select",placeholderText:"Enter date",popperClassName:"red-text",onChangeRaw:e=>e.preventDefault(),onChange:e=>w(e,"from"),openToDate:!s&&u?u:void 0,customDateFormat:b.datePickerDateFormat})),l.createElement("div",{className:P()(M,{[Z]:m.to||m.range})},l.createElement("div",null,l.createElement("label",null,p("to")),l.createElement(_.Z,{ref:h,testId:"to-date-select",selected:u,onChangeRaw:e=>e.preventDefault(),placeholderText:"Enter date",onChange:e=>w(e,"to"),openToDate:!u&&s?s:void 0,customDateFormat:b.datePickerDateFormat})))),(m.from||m.to)&&l.createElement("p",{className:"dropdown-custom-module--selectDate--7dDbi"},p("please select date")),m.range&&l.createElement("p",{className:"dropdown-custom-module--dateDifference--+p69L"},p("date difference")),l.createElement("p",{className:P()("dropdown-custom-module--resetDates--cRBrE",{"dropdown-custom-module--active--5x1AF":E}),onClick:()=>{E&&(f({from:!1,to:!1,range:!1}),c(a.from),d(a.to))}},p("reset dates")),l.createElement($.Z,{onClick:()=>{if(s&&u){if(A()(u).diff(A()(s),"years",!0)>1)return f({...m,range:!0});f({from:!1,to:!1,range:!1}),o({from:s,to:u}),C(!1)}else f({...m,from:!s,to:!u})}},p("apply")))},j=n(36884);var G=e=>{let{label:t,options:n,onChange:o,isOpen:a,toggleDropdown:r,value:i}=e;return l.createElement(W,{label:t,width:100,icon:"down-icon",iconPosition:"right",isOpen:a,onToggleDropdown:r},l.createElement(j.Z,{options:n,value:i,"data-test-id":"circuit-select",handleChange:o}))};var V=e=>{let{category:t,setFilters:n}=e;const{0:o,1:a}=(0,l.useState)(!1),{t:r}=(0,g.$)(),i=(0,l.useCallback)((e=>{const t=e.target.value;n({category:t!==N.k?t:void 0,levelId:void 0}),s(!1)}),[n]),s=e=>{a(e)},c=(0,l.useMemo)((()=>[{label:r("any"),value:N.k},{label:r("junior"),value:D.WD.JUNIOR},{label:r("adult"),value:D.WD.ADULT},{label:r("wheelchair"),value:D.WD.WHEELCHAIR},{label:r("wtn play"),value:D.WD.WTN_PLAY},{label:r("pickleball"),value:D.WD.PICKLE_BALL}]),[r]);return l.createElement(G,{label:r("circuit"),onChange:i,isOpen:o,options:c,toggleDropdown:s,value:null!=t?t:N.k})},H=n(87749);var z=e=>{let{selected:t,loadingLevels:n,setFilters:o,levelsOptions:a}=e;const{0:r,1:i}=(0,l.useState)(!1),{0:c,1:u}=(0,l.useState)([]),{t:d}=(0,g.$)();(0,l.useEffect)((()=>{t.length&&u(t===N.k?[t]:t)}),[t]);const m=(0,l.useMemo)((()=>!n&&1===a.length&&a[0].value===N.k),[n,a]);return l.createElement(W,{label:d(n?"loading levels":"level"),width:100,icon:"down-icon",iconPosition:"right",isOpen:r,onToggleDropdown:e=>{i(e)},minWidth:200},m&&l.createElement("div",{className:"dropdown-level-module--noOptions--EMqkX"},d("empty levels")),!m&&(null==a?void 0:a.map((e=>{let{label:t,value:n}=e;return l.createElement("div",{key:n},l.createElement(H.XZ,{disabled:n===N.k&&c.includes(n),key:n,label:t,checked:c.includes(n),onChecked:e=>((e,t)=>{if(e&&t===N.k)return u([t]),void o({levelId:void 0});let n;e?(n=[].concat((0,s.Z)(c.filter((e=>e!==N.k))),[t]),u(n)):(n=(0,s.Z)(c),n.splice(n.indexOf(t),1),u(n.length?n:[N.k])),o({levelId:n.length?n:void 0})})(e,n)}))}))))},Y=n(85893),K=n(84777),q=n(20358),X=n(29385),J=n(15361);var Q=n(41928),ee=n(91341),te=n(87235),ne=n(22073),oe=n(44440),ae=n(38499);const le="Collapsible",[re,ie]=(0,q.b)(le),[se,ce]=re(le),ue=(0,l.forwardRef)(((e,t)=>{const{__scopeCollapsible:n,open:o,defaultOpen:a,disabled:r,onOpenChange:i,...s}=e,[c=!1,u]=(0,ee.T)({prop:o,defaultProp:a,onChange:i});return(0,l.createElement)(se,{scope:n,disabled:r,contentId:(0,ae.M)(),open:c,onOpenToggle:(0,l.useCallback)((()=>u((e=>!e))),[u])},(0,l.createElement)(te.W.div,(0,K.Z)({"data-state":ge(c),"data-disabled":r?"":void 0},s,{ref:t})))})),de=(0,l.forwardRef)(((e,t)=>{const{__scopeCollapsible:n,...o}=e,a=ce("CollapsibleTrigger",n);return(0,l.createElement)(te.W.button,(0,K.Z)({type:"button","aria-controls":a.contentId,"aria-expanded":a.open||!1,"data-state":ge(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled},o,{ref:t,onClick:(0,Q.M)(e.onClick,a.onOpenToggle)}))})),me="CollapsibleContent",fe=(0,l.forwardRef)(((e,t)=>{const{forceMount:n,...o}=e,a=ce(me,e.__scopeCollapsible);return(0,l.createElement)(oe.z,{present:n||a.open},(e=>{let{present:n}=e;return(0,l.createElement)(pe,(0,K.Z)({},o,{ref:t,present:n}))}))})),pe=(0,l.forwardRef)(((e,t)=>{const{__scopeCollapsible:n,present:o,children:a,...r}=e,i=ce(me,n),[s,c]=(0,l.useState)(o),u=(0,l.useRef)(null),d=(0,X.e)(t,u),m=(0,l.useRef)(0),f=m.current,p=(0,l.useRef)(0),g=p.current,v=i.open||s,h=(0,l.useRef)(v),b=(0,l.useRef)();return(0,l.useEffect)((()=>{const e=requestAnimationFrame((()=>h.current=!1));return()=>cancelAnimationFrame(e)}),[]),(0,ne.b)((()=>{const e=u.current;if(e){b.current=b.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";const t=e.getBoundingClientRect();m.current=t.height,p.current=t.width,h.current||(e.style.transitionDuration=b.current.transitionDuration,e.style.animationName=b.current.animationName),c(o)}}),[i.open,o]),(0,l.createElement)(te.W.div,(0,K.Z)({"data-state":ge(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!v},r,{ref:d,style:{"--radix-collapsible-content-height":f?"".concat(f,"px"):void 0,"--radix-collapsible-content-width":g?"".concat(g,"px"):void 0,...e.style}}),v&&a)}));function ge(e){return e?"open":"closed"}const ve=ue,he=de,be=fe,ye=(0,l.createContext)(void 0);function Ee(e){const t=(0,l.useContext)(ye);return e||t||"ltr"}const Ce="Accordion",we=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[De,Ie,Ae]=function(e){const t=e+"CollectionProvider",[n,o]=(0,q.b)(t),[a,r]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=e+"CollectionSlot",s=l.forwardRef(((e,t)=>{const{scope:n,children:o}=e,a=r(i,n),s=(0,X.e)(t,a.collectionRef);return l.createElement(J.g,{ref:s},o)})),c=e+"CollectionItemSlot",u="data-radix-collection-item",d=l.forwardRef(((e,t)=>{const{scope:n,children:o,...a}=e,i=l.useRef(null),s=(0,X.e)(t,i),d=r(c,n);return l.useEffect((()=>(d.itemMap.set(i,{ref:i,...a}),()=>{d.itemMap.delete(i)}))),l.createElement(J.g,{[u]:"",ref:s},o)}));return[{Provider:e=>{const{scope:t,children:n}=e,o=l.useRef(null),r=l.useRef(new Map).current;return l.createElement(a,{scope:t,itemMap:r,collectionRef:o},n)},Slot:s,ItemSlot:d},function(t){const n=r(e+"CollectionConsumer",t);return l.useCallback((()=>{const e=n.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll("[".concat(u,"]")));return Array.from(n.itemMap.values()).sort(((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current)))}),[n.collectionRef,n.itemMap])},o]}(Ce),[Te,ke]=(0,q.b)(Ce,[Ae,ie]),Le=ie(),Se=l.forwardRef(((e,t)=>{const{type:n,...o}=e,a=o,r=o;return l.createElement(De.Provider,{scope:e.__scopeAccordion},"multiple"===n?l.createElement(Ze,(0,K.Z)({},r,{ref:t})):l.createElement(Me,(0,K.Z)({},a,{ref:t})))}));Se.propTypes={type(e){const t=e.value||e.defaultValue;return e.type&&!["single","multiple"].includes(e.type)?new Error("Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`."):"multiple"===e.type&&"string"==typeof t?new Error("Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`."):"single"===e.type&&Array.isArray(t)?new Error("Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`."):null}};const[Ne,Re]=Te(Ce),[xe,Fe]=Te(Ce,{collapsible:!1}),Me=l.forwardRef(((e,t)=>{const{value:n,defaultValue:o,onValueChange:a=(()=>{}),collapsible:r=!1,...i}=e,[s,c]=(0,ee.T)({prop:n,defaultProp:o,onChange:a});return l.createElement(Ne,{scope:e.__scopeAccordion,value:s?[s]:[],onItemOpen:c,onItemClose:l.useCallback((()=>r&&c("")),[r,c])},l.createElement(xe,{scope:e.__scopeAccordion,collapsible:r},l.createElement(Oe,(0,K.Z)({},i,{ref:t}))))})),Ze=l.forwardRef(((e,t)=>{const{value:n,defaultValue:o,onValueChange:a=(()=>{}),...r}=e,[i=[],s]=(0,ee.T)({prop:n,defaultProp:o,onChange:a}),c=l.useCallback((e=>s((function(){return[...arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e]}))),[s]),u=l.useCallback((e=>s((function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter((t=>t!==e))}))),[s]);return l.createElement(Ne,{scope:e.__scopeAccordion,value:i,onItemOpen:c,onItemClose:u},l.createElement(xe,{scope:e.__scopeAccordion,collapsible:!0},l.createElement(Oe,(0,K.Z)({},r,{ref:t}))))})),[_e,$e]=Te(Ce),Oe=l.forwardRef(((e,t)=>{const{__scopeAccordion:n,disabled:o,dir:a,orientation:r="vertical",...i}=e,s=l.useRef(null),c=(0,X.e)(s,t),u=Ie(n),d="ltr"===Ee(a),m=(0,Q.M)(e.onKeyDown,(e=>{var t;if(!we.includes(e.key))return;const n=e.target,o=u().filter((e=>{var t;return!(null!==(t=e.ref.current)&&void 0!==t&&t.disabled)})),a=o.findIndex((e=>e.ref.current===n)),l=o.length;if(-1===a)return;e.preventDefault();let i=a;const s=l-1,c=()=>{i=a+1,i>s&&(i=0)},m=()=>{i=a-1,i<0&&(i=s)};switch(e.key){case"Home":i=0;break;case"End":i=s;break;case"ArrowRight":"horizontal"===r&&(d?c():m());break;case"ArrowDown":"vertical"===r&&c();break;case"ArrowLeft":"horizontal"===r&&(d?m():c());break;case"ArrowUp":"vertical"===r&&m()}null===(t=o[i%l].ref.current)||void 0===t||t.focus()}));return l.createElement(_e,{scope:n,disabled:o,direction:a,orientation:r},l.createElement(De.Slot,{scope:n},l.createElement(te.W.div,(0,K.Z)({},i,{"data-orientation":r,ref:c,onKeyDown:o?void 0:m}))))})),Pe="AccordionItem",[We,Be]=Te(Pe),Ue=l.forwardRef(((e,t)=>{const{__scopeAccordion:n,value:o,...a}=e,r=$e(Pe,n),i=Re(Pe,n),s=Le(n),c=(0,ae.M)(),u=o&&i.value.includes(o)||!1,d=r.disabled||e.disabled;return l.createElement(We,{scope:n,open:u,disabled:d,triggerId:c},l.createElement(ve,(0,K.Z)({"data-orientation":r.orientation,"data-state":u?"open":"closed"},s,a,{ref:t,disabled:d,open:u,onOpenChange:e=>{e?i.onItemOpen(o):i.onItemClose(o)}})))})),je=l.forwardRef(((e,t)=>{const{__scopeAccordion:n,...o}=e,a=$e(Ce,n),r=Be("AccordionHeader",n);return l.createElement(te.W.h3,(0,K.Z)({"data-orientation":a.orientation,"data-state":ze(r.open),"data-disabled":r.disabled?"":void 0},o,{ref:t}))})),Ge="AccordionTrigger",Ve=l.forwardRef(((e,t)=>{const{__scopeAccordion:n,...o}=e,a=$e(Ce,n),r=Be(Ge,n),i=Fe(Ge,n),s=Le(n);return l.createElement(De.ItemSlot,{scope:n},l.createElement(he,(0,K.Z)({"aria-disabled":r.open&&!i.collapsible||void 0,"data-orientation":a.orientation,id:r.triggerId},s,o,{ref:t})))})),He=l.forwardRef(((e,t)=>{const{__scopeAccordion:n,...o}=e,a=$e(Ce,n),r=Be("AccordionContent",n),i=Le(n);return l.createElement(be,(0,K.Z)({role:"region","aria-labelledby":r.triggerId,"data-orientation":a.orientation},i,o,{ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}}))}));function ze(e){return e?"open":"closed"}const Ye=Se,Ke=Ue,qe=je,Xe=Ve,Je=He;var Qe=n(48986),et=n(3486),tt=n(48822),nt=n(40949);const ot="focusScope.autoFocusOnMount",at="focusScope.autoFocusOnUnmount",lt={bubbles:!1,cancelable:!0},rt=(0,l.forwardRef)(((e,t)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:a,onUnmountAutoFocus:r,...i}=e,[s,c]=(0,l.useState)(null),u=(0,nt.W)(a),d=(0,nt.W)(r),m=(0,l.useRef)(null),f=(0,X.e)(t,(e=>c(e))),p=(0,l.useRef)({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;(0,l.useEffect)((()=>{if(o){let e=function(e){if(p.paused||!s)return;const t=e.target;s.contains(t)?m.current=t:ut(m.current,{select:!0})},t=function(e){p.paused||!s||s.contains(e.relatedTarget)||ut(m.current,{select:!0})};return document.addEventListener("focusin",e),document.addEventListener("focusout",t),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t)}}}),[o,s,p.paused]),(0,l.useEffect)((()=>{if(s){dt.add(p);const e=document.activeElement;if(!s.contains(e)){const t=new CustomEvent(ot,lt);s.addEventListener(ot,u),s.dispatchEvent(t),t.defaultPrevented||(function(e){let{select:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=document.activeElement;for(const o of e)if(ut(o,{select:t}),document.activeElement!==n)return}(function(e){return e.filter((e=>"A"!==e.tagName))}(it(s)),{select:!0}),document.activeElement===e&&ut(s))}return()=>{s.removeEventListener(ot,u),setTimeout((()=>{const t=new CustomEvent(at,lt);s.addEventListener(at,d),s.dispatchEvent(t),t.defaultPrevented||ut(null!=e?e:document.body,{select:!0}),s.removeEventListener(at,d),dt.remove(p)}),0)}}}),[s,u,d,p]);const g=(0,l.useCallback)((e=>{if(!n&&!o||p.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,a=document.activeElement;if(t&&a){const t=e.currentTarget,[o,l]=function(e){const t=it(e),n=st(t,e),o=st(t.reverse(),e);return[n,o]}(t);o&&l?e.shiftKey||a!==l?e.shiftKey&&a===o&&(e.preventDefault(),n&&ut(l,{select:!0})):(e.preventDefault(),n&&ut(o,{select:!0})):a===t&&e.preventDefault()}}),[n,o,p.paused]);return(0,l.createElement)(te.W.div,(0,K.Z)({tabIndex:-1},i,{ref:f,onKeyDown:g}))}));function it(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function st(e,t){for(const n of e)if(!ct(n,{upTo:t}))return n}function ct(e,t){let{upTo:n}=t;if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==n&&e===n)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function ut(e){let{select:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}const dt=function(){let e=[];return{add(t){const n=e[0];t!==n&&(null==n||n.pause()),e=mt(e,t),e.unshift(t)},remove(t){var n;e=mt(e,t),null===(n=e[0])||void 0===n||n.resume()}}}();function mt(e,t){const n=[...e],o=n.indexOf(t);return-1!==o&&n.splice(o,1),n}var ft=n(51634),pt=n(47053),gt=n(3941),vt=n(23331);const ht="Dialog",[bt,yt]=(0,q.b)(ht),[Et,Ct]=bt(ht),wt="DialogPortal",[Dt,It]=bt(wt,{forceMount:void 0}),At="DialogOverlay",Tt=(0,l.forwardRef)(((e,t)=>{const n=It(At,e.__scopeDialog),{forceMount:o=n.forceMount,...a}=e,r=Ct(At,e.__scopeDialog);return r.modal?(0,l.createElement)(oe.z,{present:o||r.open},(0,l.createElement)(kt,(0,K.Z)({},a,{ref:t}))):null})),kt=(0,l.forwardRef)(((e,t)=>{const{__scopeDialog:n,...o}=e,a=Ct(At,n);return(0,l.createElement)(gt.Z,{as:J.g,allowPinchZoom:!0,shards:[a.contentRef]},(0,l.createElement)(te.W.div,(0,K.Z)({"data-state":Zt(a.open)},o,{ref:t,style:{pointerEvents:"auto",...o.style}})))})),Lt="DialogContent",St=(0,l.forwardRef)(((e,t)=>{const n=It(Lt,e.__scopeDialog),{forceMount:o=n.forceMount,...a}=e,r=Ct(Lt,e.__scopeDialog);return(0,l.createElement)(oe.z,{present:o||r.open},r.modal?(0,l.createElement)(Nt,(0,K.Z)({},a,{ref:t})):(0,l.createElement)(Rt,(0,K.Z)({},a,{ref:t})))})),Nt=(0,l.forwardRef)(((e,t)=>{const n=Ct(Lt,e.__scopeDialog),o=(0,l.useRef)(null),a=(0,X.e)(t,n.contentRef,o);return(0,l.useEffect)((()=>{const e=o.current;if(e)return(0,vt.R)(e)}),[]),(0,l.createElement)(xt,(0,K.Z)({},e,{ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,Q.M)(e.onCloseAutoFocus,(e=>{var t;e.preventDefault(),null===(t=n.triggerRef.current)||void 0===t||t.focus()})),onPointerDownOutside:(0,Q.M)(e.onPointerDownOutside,(e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()})),onFocusOutside:(0,Q.M)(e.onFocusOutside,(e=>e.preventDefault()))}))})),Rt=(0,l.forwardRef)(((e,t)=>{const n=Ct(Lt,e.__scopeDialog),o=(0,l.useRef)(!1);return(0,l.createElement)(xt,(0,K.Z)({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{var a,l;(null===(a=e.onCloseAutoFocus)||void 0===a||a.call(e,t),t.defaultPrevented)||(o.current||null===(l=n.triggerRef.current)||void 0===l||l.focus(),t.preventDefault());o.current=!1},onInteractOutside:t=>{var a,l;null===(a=e.onInteractOutside)||void 0===a||a.call(e,t),t.defaultPrevented||(o.current=!0);const r=t.target;(null===(l=n.triggerRef.current)||void 0===l?void 0:l.contains(r))&&t.preventDefault()}}))})),xt=(0,l.forwardRef)(((e,t)=>{const{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:a,onCloseAutoFocus:r,...i}=e,s=Ct(Lt,n),c=(0,l.useRef)(null),u=(0,X.e)(t,c);return(0,pt.E)(),(0,l.createElement)(l.Fragment,null,(0,l.createElement)(rt,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:a,onUnmountAutoFocus:r},(0,l.createElement)(tt.XB,(0,K.Z)({role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":Zt(s.open)},i,{ref:u,onDismiss:()=>s.onOpenChange(!1)}))),!1)})),Ft="DialogTitle",Mt=(0,l.forwardRef)(((e,t)=>{const{__scopeDialog:n,...o}=e,a=Ct("DialogClose",n);return(0,l.createElement)(te.W.button,(0,K.Z)({type:"button"},o,{ref:t,onClick:(0,Q.M)(e.onClick,(()=>a.onOpenChange(!1)))}))}));function Zt(e){return e?"open":"closed"}const[_t,$t]=(0,q.k)("DialogTitleWarning",{contentName:Lt,titleName:Ft,docsSlug:"dialog"}),Ot=e=>{const{__scopeDialog:t,children:n,open:o,defaultOpen:a,onOpenChange:r,modal:i=!0}=e,s=(0,l.useRef)(null),c=(0,l.useRef)(null),[u=!1,d]=(0,ee.T)({prop:o,defaultProp:a,onChange:r});return(0,l.createElement)(Et,{scope:t,triggerRef:s,contentRef:c,contentId:(0,ae.M)(),titleId:(0,ae.M)(),descriptionId:(0,ae.M)(),open:u,onOpenChange:d,onOpenToggle:(0,l.useCallback)((()=>d((e=>!e))),[d]),modal:i},n)},Pt=e=>{const{__scopeDialog:t,forceMount:n,children:o,container:a}=e,r=Ct(wt,t);return(0,l.createElement)(Dt,{scope:t,forceMount:n},l.Children.map(o,(e=>(0,l.createElement)(oe.z,{present:n||r.open},(0,l.createElement)(ft.h,{asChild:!0,container:a},e)))))},Wt=Tt,Bt=St,Ut=Mt;var jt=n(92914),Gt=n(82581),Vt=n(39673);const Ht=(0,Vt.F4)({"0%":{opacity:.5},"100%":{opacity:0}}),zt={show:(0,Vt.F4)({"0%":{opacity:0,transform:"translateX(50%)"},"100%":{opacity:1,transform:"translateX(0)"}}),hide:(0,Vt.F4)({"0%":{opacity:0,transform:"translateX(0)"},"100%":{opacity:1,transform:"translateX(100%)"}})},Yt={show:(0,Vt.F4)({"0%":{opacity:0,transform:"translateX(-50%)"},"100%":{opacity:1,transform:"translateX(0)"}}),hide:(0,Vt.F4)({"0%":{opacity:0,transform:"translateX(0)"},"100%":{opacity:1,transform:"translateX(-100%)"}})},Kt={show:(0,Vt.F4)({"0%":{opacity:0,transform:"translateY(100%)"},"100%":{opacity:1,transform:"translateY(0)"}}),hide:(0,Vt.F4)({"0%":{opacity:0,transform:"translateY(0)"},"100%":{opacity:1,transform:"translateY(100%)"}})},qt={show:(0,Vt.F4)({"0%":{opacity:0,transform:"translateY(-100%)"},"100%":{opacity:1,transform:"translateY(0)"}}),hide:(0,Vt.F4)({"0%":{opacity:0,transform:"translateY(0)"},"100%":{opacity:1,transform:"translateY(-100%)"}})},Xt={root:void 0,portal:void 0,overlay:(0,Vt.iv)({backgroundColor:"$dialogOverlay",opacity:.5,position:"fixed",inset:0,"@media (prefers-reduced-motion: no-preference)":{'&[data-state="closed"]':{animation:"".concat(Ht," $$delayAnimation cubic-bezier(0.16, 1, 0.3, 1)")}}}),content:(0,Vt.iv)({fontFamily:"$default",backgroundColor:"white",position:"fixed",top:0,height:"100vh","&:focus":{outline:"none"},variants:{fullWidth:{true:{width:"100%"}},placement:{left:{left:0,"@media (prefers-reduced-motion: no-preference)":{'&[data-state="open"]':{animation:"".concat(Yt.show," $$delayAnimation cubic-bezier(0.16, 1, 0.3, 1)")},'&[data-state="closed"]':{animation:"".concat(Yt.hide," $$delayAnimation cubic-bezier(0.16, 1, 0.3, 1)")}}},right:{right:0,"@media (prefers-reduced-motion: no-preference)":{'&[data-state="open"]':{animation:"".concat(zt.show," $$delayAnimation cubic-bezier(0.16, 1, 0.3, 1)")},'&[data-state="closed"]':{animation:"".concat(zt.hide," $$delayAnimation cubic-bezier(0.16, 1, 0.3, 1)")}}},bottom:{bottom:0,"@media (prefers-reduced-motion: no-preference)":{'&[data-state="open"]':{animation:"".concat(Kt.show," $$delayAnimation cubic-bezier(0.16, 1, 0.3, 1)")},'&[data-state="closed"]':{animation:"".concat(Kt.hide," $$delayAnimation cubic-bezier(0.16, 1, 0.3, 1)")}}},top:{top:0,"@media (prefers-reduced-motion: no-preference)":{'&[data-state="open"]':{animation:"".concat(qt.show," $$delayAnimation cubic-bezier(0.16, 1, 0.3, 1)")},'&[data-state="closed"]':{animation:"".concat(qt.hide," $$delayAnimation cubic-bezier(0.16, 1, 0.3, 1)")}}}}},["@media not all and ".concat(Vt.vc.media.sm)]:{width:"100%"}}),closeButton:(0,Vt.iv)({height:"2rem",background:"transparent",border:"none",position:"absolute",top:"1rem",right:"1rem"}),footerContainer:(0,Vt.iv)({position:"fixed",boxSizing:"border-box",background:"$genericWhite",width:"inherit",bottom:0})},Jt=e=>{const[t,n]=(0,jt.a6)(e,Xt,"root"),{open:o,onOpenChange:a,placement:r="right",delayAnimation:i=500,children:s,header:c,footer:u,withCloseButton:d=!1,fullWidth:m=!1,autoClose:f=!0,...p}=n;return(0,Y.jsx)(Ot,{open:o,onOpenChange:a,...t.root,...p,children:(0,Y.jsxs)(Pt,{...t.portal,children:[(0,Y.jsx)(Wt,{...t.overlay({css:{$$delayAnimation:"".concat(i+100,"ms")}})}),(0,Y.jsxs)(Bt,{...t.content({placement:r,fullWidth:m,css:{$$delayAnimation:"".concat(i,"ms")}}),...!!f&&{onEscapeKeyDown:()=>null==a?void 0:a(!1),onInteractOutside:()=>null==a?void 0:a(!1),onPointerDownOutside:()=>null==a?void 0:a(!1)},children:[c,s,l.isValidElement(u)&&(0,Y.jsx)("div",{...t.footerContainer(),children:u}),d&&(0,Y.jsx)(Ut,{type:"button",onClick:()=>null==a?void 0:a(!1),...t.closeButton(),children:(0,Y.jsx)(Gt.Z,{})})]})]})})};Jt.classes=Xt;const Qt=l.memo(Jt),en=(0,Vt.iv)({display:"flex",flexDirection:"column",width:"400px",overflow:"auto"}),tn=(0,Vt.iv)({display:"flex",alignItems:"center",padding:"1.25rem",fontFamily:"$default",fontSize:"$large",fontWeight:"$bold",lineHeight:1.4,color:"$lightBg100Main",background:"$secondary100main"}),nn=(0,Vt.iv)({marginLeft:"auto",width:"1rem",height:"1rem",padding:0,background:"transparent",border:"none",cursor:"pointer",color:"$genericWhite"}),on=(0,Vt.iv)({display:"flex",flexDirection:"column",padding:"0.75rem"}),an=(0,Vt.iv)({display:"flex",justifyContent:"space-between",marginTop:"auto",padding:"1rem 1.25rem",borderTop:"solid 1.5px $coreGreys10"}),ln=l.memo((e=>{let{size:t="16px",fill:n="#707485",...o}=e;return(0,Y.jsx)("svg",{fill:n,height:t,viewBox:"0 0 16 16",width:t,xmlns:"http://www.w3.org/2000/svg",...o,children:(0,Y.jsx)("path",{d:"M2.667 2.667 14 14M14 2.667 2.666 14",stroke:n,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",strokeWidth:"1.5"})})})),rn=l.memo((e=>{let{open:t=!1,onOpenChange:n,title:o,clearBtnText:a="Clear all filters",applyBtnText:r="Apply filters",disableClearBtn:i=!1,closeLabel:s="close drawer",placement:c="right",fullWidth:u=!1,onCloseClick:d,onClearBtnClick:m,onApplyBtnClick:f,children:p,className:g,styles:v,classNames:h,props:b}=e;const[y,E]=(0,l.useState)(),C=(0,l.useCallback)((e=>{m(e),E("")}),[m]),w=(0,l.useCallback)((e=>{f(e),E("")}),[f]),D=(0,l.useCallback)((e=>{null==d||d(e),E("")}),[d]);return(0,Y.jsx)(Qt,{className:(0,Qe.Z)(g),classNames:{content:en()},footer:(0,Y.jsxs)("section",{className:an(),children:[(0,Y.jsx)(et.ZP,{isDisabled:i,size:"normal",variant:"tertiaryTransparent",onClick:C,children:a}),(0,Y.jsx)(et.ZP,{size:"normal",onClick:w,children:r})]}),fullWidth:u,header:(0,Y.jsxs)("div",{className:(0,Qe.Z)(tn((null==v?void 0:v.title)&&{css:null==v?void 0:v.title}),null==h?void 0:h.title),...null==b?void 0:b.title,children:[o,(0,Y.jsx)("button",{"aria-label":s,className:(0,Qe.Z)(nn((null==v?void 0:v.close)&&{css:null==v?void 0:v.close}),null==h?void 0:h.close),type:"button",onClick:D,...null==b?void 0:b.close,children:(0,Y.jsx)(ln,{fill:"currentColor"})})]}),open:t,placement:c,onOpenChange:n,...null==b?void 0:b.root,children:(0,Y.jsx)(Ye,{collapsible:!0,className:(0,Qe.Z)(on((null==v?void 0:v.container)&&{css:null==v?void 0:v.container}),null==h?void 0:h.container),type:"single",value:y,onValueChange:E,children:p})})}));var sn=n(50833),cn=n(27506),un=n(56638);const dn=(0,l.createContext)(void 0);function mn(e){const t=(0,l.useContext)(dn);return e||t||"ltr"}const fn="rovingFocusGroup.onEntryFocus",pn={bubbles:!1,cancelable:!0},gn="RovingFocusGroup",[vn,hn,bn]=function(e){const t=e+"CollectionProvider",[n,o]=(0,q.b)(t),[a,r]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=e+"CollectionSlot",s=l.forwardRef(((e,t)=>{const{scope:n,children:o}=e,a=r(i,n),s=(0,X.e)(t,a.collectionRef);return l.createElement(J.g,{ref:s},o)})),c=e+"CollectionItemSlot",u="data-radix-collection-item",d=l.forwardRef(((e,t)=>{const{scope:n,children:o,...a}=e,i=l.useRef(null),s=(0,X.e)(t,i),d=r(c,n);return l.useEffect((()=>(d.itemMap.set(i,{ref:i,...a}),()=>{d.itemMap.delete(i)}))),l.createElement(J.g,{[u]:"",ref:s},o)}));return[{Provider:e=>{const{scope:t,children:n}=e,o=l.useRef(null),r=l.useRef(new Map).current;return l.createElement(a,{scope:t,itemMap:r,collectionRef:o},n)},Slot:s,ItemSlot:d},function(t){const n=r(e+"CollectionConsumer",t);return l.useCallback((()=>{const e=n.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll("[".concat(u,"]")));return Array.from(n.itemMap.values()).sort(((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current)))}),[n.collectionRef,n.itemMap])},o]}(gn),[yn,En]=(0,q.b)(gn,[bn]),[Cn,wn]=yn(gn),Dn=(0,l.forwardRef)(((e,t)=>(0,l.createElement)(vn.Provider,{scope:e.__scopeRovingFocusGroup},(0,l.createElement)(vn.Slot,{scope:e.__scopeRovingFocusGroup},(0,l.createElement)(In,(0,K.Z)({},e,{ref:t})))))),In=(0,l.forwardRef)(((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:a=!1,dir:r,currentTabStopId:i,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:u,...d}=e,m=(0,l.useRef)(null),f=(0,X.e)(t,m),p=mn(r),[g=null,v]=(0,ee.T)({prop:i,defaultProp:s,onChange:c}),[h,b]=(0,l.useState)(!1),y=(0,nt.W)(u),E=hn(n),C=(0,l.useRef)(!1),[w,D]=(0,l.useState)(0);return(0,l.useEffect)((()=>{const e=m.current;if(e)return e.addEventListener(fn,y),()=>e.removeEventListener(fn,y)}),[y]),(0,l.createElement)(Cn,{scope:n,orientation:o,dir:p,loop:a,currentTabStopId:g,onItemFocus:(0,l.useCallback)((e=>v(e)),[v]),onItemShiftTab:(0,l.useCallback)((()=>b(!0)),[]),onFocusableItemAdd:(0,l.useCallback)((()=>D((e=>e+1))),[]),onFocusableItemRemove:(0,l.useCallback)((()=>D((e=>e-1))),[])},(0,l.createElement)(te.W.div,(0,K.Z)({tabIndex:h||0===w?-1:0,"data-orientation":o},d,{ref:f,style:{outline:"none",...e.style},onMouseDown:(0,Q.M)(e.onMouseDown,(()=>{C.current=!0})),onFocus:(0,Q.M)(e.onFocus,(e=>{const t=!C.current;if(e.target===e.currentTarget&&t&&!h){const t=new CustomEvent(fn,pn);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=E().filter((e=>e.focusable));kn([e.find((e=>e.active)),e.find((e=>e.id===g)),...e].filter(Boolean).map((e=>e.ref.current)))}}C.current=!1})),onBlur:(0,Q.M)(e.onBlur,(()=>b(!1)))})))})),An=(0,l.forwardRef)(((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:a=!1,tabStopId:r,...i}=e,s=(0,ae.M)(),c=r||s,u=wn("RovingFocusGroupItem",n),d=u.currentTabStopId===c,m=hn(n),{onFocusableItemAdd:f,onFocusableItemRemove:p}=u;return(0,l.useEffect)((()=>{if(o)return f(),()=>p()}),[o,f,p]),(0,l.createElement)(vn.ItemSlot,{scope:n,id:c,focusable:o,active:a},(0,l.createElement)(te.W.span,(0,K.Z)({tabIndex:d?0:-1,"data-orientation":u.orientation},i,{ref:t,onMouseDown:(0,Q.M)(e.onMouseDown,(e=>{o?u.onItemFocus(c):e.preventDefault()})),onFocus:(0,Q.M)(e.onFocus,(()=>u.onItemFocus(c))),onKeyDown:(0,Q.M)(e.onKeyDown,(e=>{if("Tab"===e.key&&e.shiftKey)return void u.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,n){const o=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,n);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(o)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(o)))return Tn[o]}(e,u.orientation,u.dir);if(void 0!==t){e.preventDefault();let n=m().filter((e=>e.focusable)).map((e=>e.ref.current));if("last"===t)n.reverse();else if("prev"===t||"next"===t){"prev"===t&&n.reverse();const o=n.indexOf(e.currentTarget);n=u.loop?function(e,t){return e.map(((n,o)=>e[(t+o)%e.length]))}(n,o+1):n.slice(o+1)}setTimeout((()=>kn(n)))}}))})))})),Tn={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function kn(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}const Ln=Dn,Sn=An;var Nn=n(17861);const Rn="Radio",[xn,Fn]=(0,q.b)(Rn),[Mn,Zn]=xn(Rn),_n=(0,l.forwardRef)(((e,t)=>{const{__scopeRadio:n,name:o,checked:a=!1,required:r,disabled:i,value:s="on",onCheck:c,...u}=e,[d,m]=(0,l.useState)(null),f=(0,X.e)(t,(e=>m(e))),p=(0,l.useRef)(!1),g=!d||!!d.closest("form");return(0,l.createElement)(Mn,{scope:n,checked:a,disabled:i},(0,l.createElement)(te.W.button,(0,K.Z)({type:"button",role:"radio","aria-checked":a,"data-state":Pn(a),"data-disabled":i?"":void 0,disabled:i,value:s},u,{ref:f,onClick:(0,Q.M)(e.onClick,(e=>{a||null==c||c(),g&&(p.current=e.isPropagationStopped(),p.current||e.stopPropagation())}))})),g&&(0,l.createElement)(On,{control:d,bubbles:!p.current,name:o,value:s,checked:a,required:r,disabled:i,style:{transform:"translateX(-100%)"}}))})),$n=(0,l.forwardRef)(((e,t)=>{const{__scopeRadio:n,forceMount:o,...a}=e,r=Zn("RadioIndicator",n);return(0,l.createElement)(oe.z,{present:o||r.checked},(0,l.createElement)(te.W.span,(0,K.Z)({"data-state":Pn(r.checked),"data-disabled":r.disabled?"":void 0},a,{ref:t})))})),On=e=>{const{control:t,checked:n,bubbles:o=!0,...a}=e,r=(0,l.useRef)(null),i=function(e){const t=(0,l.useRef)({value:e,previous:e});return(0,l.useMemo)((()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous)),[e])}(n),s=(0,Nn.t)(t);return(0,l.useEffect)((()=>{const e=r.current,t=window.HTMLInputElement.prototype,a=Object.getOwnPropertyDescriptor(t,"checked").set;if(i!==n&&a){const t=new Event("click",{bubbles:o});a.call(e,n),e.dispatchEvent(t)}}),[i,n,o]),(0,l.createElement)("input",(0,K.Z)({type:"radio","aria-hidden":!0,defaultChecked:n},a,{tabIndex:-1,ref:r,style:{...e.style,...s,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function Pn(e){return e?"checked":"unchecked"}const Wn=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Bn="RadioGroup",[Un,jn]=(0,q.b)(Bn,[En,Fn]),Gn=En(),Vn=Fn(),[Hn,zn]=Un(Bn),Yn=(0,l.forwardRef)(((e,t)=>{const{__scopeRadioGroup:n,name:o,defaultValue:a,value:r,required:i=!1,disabled:s=!1,orientation:c,dir:u,loop:d=!0,onValueChange:m,...f}=e,p=Gn(n),g=mn(u),[v,h]=(0,ee.T)({prop:r,defaultProp:a,onChange:m});return(0,l.createElement)(Hn,{scope:n,name:o,required:i,disabled:s,value:v,onValueChange:h},(0,l.createElement)(Ln,(0,K.Z)({asChild:!0},p,{orientation:c,dir:g,loop:d}),(0,l.createElement)(te.W.div,(0,K.Z)({role:"radiogroup","aria-required":i,"aria-orientation":c,"data-disabled":s?"":void 0,dir:g},f,{ref:t}))))})),Kn=(0,l.forwardRef)(((e,t)=>{const{__scopeRadioGroup:n,disabled:o,...a}=e,r=zn("RadioGroupItem",n),i=r.disabled||o,s=Gn(n),c=Vn(n),u=(0,l.useRef)(null),d=(0,X.e)(t,u),m=r.value===a.value,f=(0,l.useRef)(!1);return(0,l.useEffect)((()=>{const e=e=>{Wn.includes(e.key)&&(f.current=!0)},t=()=>f.current=!1;return document.addEventListener("keydown",e),document.addEventListener("keyup",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("keyup",t)}}),[]),(0,l.createElement)(Sn,(0,K.Z)({asChild:!0},s,{focusable:!i,active:m}),(0,l.createElement)(_n,(0,K.Z)({disabled:i,required:r.required,checked:m},c,a,{name:r.name,ref:d,onCheck:()=>r.onValueChange(a.value),onKeyDown:(0,Q.M)((e=>{"Enter"===e.key&&e.preventDefault()})),onFocus:(0,Q.M)(a.onFocus,(()=>{var e;f.current&&(null===(e=u.current)||void 0===e||e.click())}))})))})),qn=(0,l.forwardRef)(((e,t)=>{const{__scopeRadioGroup:n,...o}=e,a=Vn(n);return(0,l.createElement)($n,(0,K.Z)({},a,o,{ref:t}))})),Xn=Yn,Jn=Kn,Qn=qn;var eo=n(35682);const to=(0,Vt.iv)({display:"flex",alignItems:"center",marginBottom:"0.625rem"}),no=(0,Vt.iv)({["& .".concat(to,":last-child")]:{marginBottom:"0"}}),oo={itemContainer:to,item:(0,Vt.iv)({all:"unset",cursor:"pointer",background:"$genericWhite",border:"1px solid $coreGreys50",width:"1.125rem",height:"1.125rem",borderRadius:"100%",'&[data-state="checked"]':{background:"$primary100main",borderColor:"$primary100main"},"&:disabled":{background:"$coreGreys20",borderColor:"$coreGreys20"}}),indicator:(0,Vt.iv)({flexCenter:!0,width:"100%",height:"100%",position:"relative","&::after":{content:"",display:"block",width:"0.375rem",height:"0.375rem",border:"1px solid $genericWhite",borderRadius:"50%",backgroundColor:"$genericWhite"}}),label:(0,Vt.iv)({color:"$coreGreys100main",userSelect:"none",paddingInlineStart:"0.6875rem",marginLeft:0,marginRight:0,cursor:"pointer",variants:{disabled:{true:{color:"$coreGreys50"}}}})},ao={root:no},lo=e=>l.Children.map(e,(e=>{if(l.isValidElement(e))return e})),ro=(0,un.G)(((e,t)=>{const[n,o]=(0,jt.a6)(e,oo,"item"),{label:a,...r}=o;return(0,Y.jsxs)("div",{...n.itemContainer(),children:[(0,Y.jsx)(Jn,{ref:t,...n.item(),...r,id:r.value,children:(0,Y.jsx)(Qn,{...n.indicator()})}),(0,l.isValidElement)(a)?a:(0,Y.jsx)(eo.ZP,{asChild:!0,fontSize:"large",fontWeight:"$regular",children:(0,Y.jsx)("label",{...n.label({disabled:r.disabled}),htmlFor:r.value,children:a})})]})})),io=(0,un.G)(((e,t)=>{const[n,o]=(0,jt.a6)(e,ao,"root"),{name:a,required:l,label:r,defaultValue:i,onValueChange:s,children:c,...u}=o;return(0,Y.jsx)(Xn,{ref:t,"aria-label":r,defaultValue:i,name:a,required:l,onValueChange:s,...null==n?void 0:n.root(),...u,children:lo(c)})})),so=l.memo(io),co=l.memo(ro),uo=(0,Vt.iv)({margin:0}),mo=(0,Vt.iv)({marginLeft:"0.1875rem",width:"1.25rem",height:"1.25rem",background:"transparent",border:"none",borderRadius:"0.375rem",padding:0,cursor:"pointer",flexCenter:!0,"&:hover":{backgroundColor:"$darkBg10"},variants:{expand:{false:{marginLeft:"0.4375rem"}}}}),fo=(0,Vt.iv)({variants:{range:{true:{"&::after":{paddingRight:"0.3125rem",content:","}}}}}),po=(0,Vt.iv)({"&::after":{marginRight:"0.25rem",content:":"}}),go=(0,Vt.iv)({margin:0,fontSize:"$small"}),vo=(0,Vt.iv)({marginLeft:"0.4375rem",background:"transparent",border:"none",padding:0,cursor:"pointer",color:"$coreGreys100main",fontSize:"$small",fontFamily:"$default",lineHeight:"$7"}),ho=(0,Vt.iv)({display:"flex",flexDirection:"row",alignItems:"center",textDecoration:"none",borderRadius:"0.25rem",backgroundColor:"$coreGreys10",color:"$coreGreys100main",variants:{event:{true:{"&:hover":{["& .".concat(fo," .").concat(uo,", & .").concat(vo,", & .").concat(po," .").concat(uo)]:{textDecoration:"underline"}}}},position:{true:{padding:"0.25rem 0.375rem 0.25rem 0.6875rem"},false:{padding:"0.25rem 0.6875rem"}}}}),bo=l.memo((e=>{let{asChild:t=!1,isLink:n=!1,title:o,tabIndex:a=0,data:r=[],displayedNumber:i=1,isForceExpand:s=!1,isCloseIcon:c=!0,closeLabel:u="close",href:d="#",onCloseClick:m,className:f,classNames:p,styles:g,props:v}=e;(e=>{if(e<=0)throw Error("Invalid displayedNumber. Please double-check!")})(i);const h=t?J.g:n?"a":"div",b=(0,l.useRef)(),[y,E]=(0,l.useState)(!1),C=(0,l.useCallback)((e=>r.length>i?e?r:r.slice(0,i):r),[r,i]),[w,D]=(0,l.useState)(C(!1)),I=(0,l.useMemo)((()=>i<r.length&&!y),[r.length,i,y]),A=(0,l.useCallback)((e=>{e.preventDefault(),E(!0),D(C(!0))}),[C]),T=(0,l.useCallback)((e=>{e.preventDefault(),null==m||m(e)}),[m]);return(0,l.useEffect)((()=>{D(C(!I)),r!==b.current&&!s&&E(!1),b.current=r}),[C,r,I,s]),(0,Y.jsxs)(h,{className:(0,Qe.Z)(ho({event:n,position:c,css:null==g?void 0:g.root}),f),href:d,rel:"noopener noreferrer",tabIndex:a,target:"_blank",...null==v?void 0:v.root,children:[o&&(0,Y.jsx)(eo.ZP,{className:(0,Qe.Z)(po((null==g?void 0:g.title)&&{css:null==g?void 0:g.title}),null==p?void 0:p.title),fontSize:"small",fontWeight:"semiBold",...null==v?void 0:v.title,children:(0,Y.jsx)("span",{className:uo(),children:o})}),(0,Y.jsx)("span",{className:(0,Qe.Z)(go((null==g?void 0:g.mainContent)&&{css:null==g?void 0:g.mainContent}),null==p?void 0:p.mainContent),tabIndex:a,...null==v?void 0:v.mainContent,children:w.map(((e,t)=>(0,Y.jsx)(eo.ZP,{className:(0,Qe.Z)(fo({range:t!==w.length-1,css:null==g?void 0:g.data}),null==p?void 0:p.data),fontSize:"small",fontWeight:"regular",...null==v?void 0:v.data,children:(0,Y.jsx)("span",{className:uo(),children:e})},t)))}),I&&(0,Y.jsx)("button",{className:(0,Qe.Z)(vo((null==g?void 0:g.expand)&&{css:null==g?void 0:g.expand}),null==p?void 0:p.expand),tabIndex:a,type:"button",onClick:A,...null==v?void 0:v.expand,children:(0,Y.jsxs)(eo.ZP,{fontSize:"small",fontWeight:"$regular",children:["...+",r.length-i]})}),c&&(0,Y.jsx)("button",{"aria-label":u,className:(0,Qe.Z)(mo({expand:!y,css:null==g?void 0:g.close}),null==p?void 0:p.close),tabIndex:a,type:"button",onClick:T,...null==v?void 0:v.close,children:(0,Y.jsx)(ln,{size:"12.5px"})})]})}));var yo=n(65581);const Eo=l.memo((e=>{let{size:t="12px",fill:n="none",...o}=e;return(0,Y.jsx)("svg",{width:t,height:t,viewBox:"0 0 12 12",fill:n,xmlns:"http://www.w3.org/2000/svg",...o,children:(0,Y.jsx)("path",{d:"m1 3 5 5.5L11 3",stroke:"#707485",strokeWidth:"1.5",strokeMiterlimit:"10",strokeLinecap:"round",strokeLinejoin:"round"})})})),Co=(0,Vt.iv)({minWidth:"22.25rem",color:"$coreGreys100main"}),wo=(0,Vt.iv)({margin:0}),Do=(0,Vt.iv)({width:"100%",display:"inline-grid",gridTemplateColumns:"1fr auto",padding:"0.75rem 1.25rem 0.875rem",borderRadius:"0.25rem",boxSizing:"border-box","&:hover, &:focus":{background:"$coreGreys5",cursor:"pointer"}}),Io=(0,Vt.iv)({width:"100%",height:"1.875rem",display:"inline-flex",alignItems:"center"}),Ao=(0,Vt.iv)({marginLeft:"0.1875rem"}),To=(0,Vt.iv)({width:"15.625rem",color:"$genericWhite"}),ko=(0,Vt.iv)({alignSelf:"center",[".".concat(Do,"[data-state=open] &")]:{transform:"rotate(180deg)"}}),Lo=(0,Vt.iv)({width:"fit-content",boxSizing:"border-box",marginBottom:"0.125rem"}),So=(0,Vt.F4)({from:{height:0},to:{height:"var(--radix-accordion-content-height)"}}),No=(0,Vt.F4)({from:{height:"var(--radix-accordion-content-height)"},to:{height:0}}),Ro=(0,Vt.iv)({padding:"0.25rem 1.25rem 1rem",overflow:"hidden",'&[data-state="open"]':{animation:"".concat(So," $$delayAnimation cubic-bezier(0.87, 0, 0.13, 1)")},'&[data-state="closed"]':{animation:"".concat(No," $$delayAnimation cubic-bezier(0.87, 0, 0.13, 1)")}}),xo=(0,Vt.iv)({color:"$coreGreys70"}),Fo=l.memo((e=>{let{label:t,filterValue:n,infoTooltipText:o,emptyText:a,options:r,clearValue:i,values:s,multiple:c=!1,isFilterItem:u=!0,displayedNumberTagFilter:d=3,onChange:m,delayAnimation:f=100,EmptyComponent:p,InfoTooltipComponent:g,className:v,styles:h,classNames:b,props:y}=e;(0,jt.Qj)(r,"value");const E=(0,l.useCallback)((e=>{i&&e.includes(i)&&!s.includes(i)||0===(null==e?void 0:e.length)?null==m||m([i]):null==m||m([...e].filter((e=>e!==i)))}),[i,m,s]),C=(0,l.useMemo)((()=>{var e;const n=null==(e=null==r?void 0:r.filter((e=>s.includes(e.value))))?void 0:e.map((e=>e.label));return(0,Y.jsx)(qe,{className:wo(),children:(0,Y.jsx)(Xe,{asChild:!0,children:(0,Y.jsxs)("section",{className:(0,Qe.Z)(Do((null==h?void 0:h.trigger)&&{css:h.trigger}),null==b?void 0:b.trigger),...null==y?void 0:y.trigger,children:[(0,Y.jsx)(eo.ZP,{asChild:!0,fontSize:"large",fontWeight:"$semiBold",children:(0,Y.jsxs)("span",{className:(0,Qe.Z)(Io((null==h?void 0:h.label)&&{css:h.label}),null==b?void 0:b.label),...null==y?void 0:y.label,children:[t,(g||o)&&(0,Y.jsx)(yo.Z,{align:"start",classNames:{trigger:(0,Qe.Z)(Ao((null==h?void 0:h.tooltip)&&{css:h.tooltip}),null==b?void 0:b.tooltip),content:To()},...null==y?void 0:y.tooltip,children:g||o})]})}),(0,Y.jsx)("span",{className:(0,Qe.Z)(ko((null==h?void 0:h.arrow)&&{css:h.arrow}),null==b?void 0:b.arrow),...null==y?void 0:y.arrow,children:(0,Y.jsx)(Eo,{})}),(null==r?void 0:r.length)>0&&(null==s?void 0:s.length)>0&&!(i&&s.includes(i))&&(0,Y.jsx)(bo,{className:(0,Qe.Z)(Lo((null==h?void 0:h.tag)&&{css:h.tag}),null==b?void 0:b.tag),data:n,displayedNumber:d,isCloseIcon:!1,title:"",...null==y?void 0:y.tag})]})})})}),[g,null==b?void 0:b.arrow,null==b?void 0:b.label,null==b?void 0:b.tag,null==b?void 0:b.tooltip,null==b?void 0:b.trigger,i,d,o,t,r,null==y?void 0:y.arrow,null==y?void 0:y.label,null==y?void 0:y.tag,null==y?void 0:y.tooltip,null==y?void 0:y.trigger,null==h?void 0:h.arrow,null==h?void 0:h.label,null==h?void 0:h.tag,null==h?void 0:h.tooltip,null==h?void 0:h.trigger,s]),w=(0,l.useMemo)((()=>(0,Y.jsx)(Je,{className:(0,Qe.Z)(Ro({css:{$$delayAnimation:"".concat(f,"ms"),...null==h?void 0:h.content}}),null==b?void 0:b.content),...null==y?void 0:y.content,children:(null==r?void 0:r.length)>0?c?(0,Y.jsx)(cn.Z,{values:s,onValueChange:E,children:null==r?void 0:r.map((e=>(0,Y.jsx)(sn.Z,{label:null==e?void 0:e.label,value:null==e?void 0:e.value},null==e?void 0:e.value)))}):(0,Y.jsx)(so,{defaultValue:null==s?void 0:s[0],label:t,onValueChange:E,children:null==r?void 0:r.map((e=>(0,Y.jsx)(co,{label:null==e?void 0:e.label,value:null==e?void 0:e.value},null==e?void 0:e.value)))}):(0,Y.jsx)(eo.ZP,{className:(0,Qe.Z)(xo((null==h?void 0:h.emptyInfo)&&{css:h.emptyInfo}),null==b?void 0:b.emptyInfo),fontSize:"large",fontWeight:"$default",...!!p&&{asChild:!0},...null==y?void 0:y.emptyInfo,children:p||a})})),[p,null==b?void 0:b.content,null==b?void 0:b.emptyInfo,f,a,E,t,c,r,null==y?void 0:y.content,null==y?void 0:y.emptyInfo,null==h?void 0:h.content,null==h?void 0:h.emptyInfo,s]),D=(0,l.useMemo)((()=>(0,Y.jsxs)(Ke,{className:(0,Qe.Z)(Co((null==h?void 0:h.root)&&{css:h.root}),null==b?void 0:b.root,v),value:n,...null==y?void 0:y.root,children:[C,w]})),[v,null==b?void 0:b.root,w,C,n,null==y?void 0:y.root,null==h?void 0:h.root]);return u?D:(0,Y.jsx)(Ye,{collapsible:!0,type:"single",children:D})}));var Mo="shared-module--more-filters-border-class--6wC-M",Zo=n(90219);var _o=e=>{let{setSelectedLevels:t,levelData:n,selectedLevels:o,selectedCircuit:a}=e;const{t:r}=(0,g.$)(),i=(0,l.useMemo)((()=>{const e=n;return e?[{label:r("any"),value:N.k}].concat((0,s.Z)(e.filter((e=>e.sanctionType!==D.SanctionType.NONE&&e.category===a)).sort(((e,t)=>e.orderIndex-t.orderIndex)).map((e=>({label:e.name,value:e.id}))))):[{label:r("loading levels"),value:"loading"}]}),[n,a,r]),c=(0,l.useMemo)((()=>1===i.length&&i[0].value===N.k),[i]);return l.createElement(Fo,{EmptyComponent:l.createElement("p",null,r("empty levels")),InfoTooltipComponent:l.createElement(Zo.Z,{text:r("levels tooltip")}),filterValue:"level",clearValue:N.k,className:Mo,label:r("level"),multiple:!0,onChange:e=>{t(e)},options:c?[]:i,values:o})};var $o=e=>{let{onChange:t,selectedCircuit:n}=e;const{t:o}=(0,g.$)();return l.createElement(Fo,{clearValue:N.k,filterValue:"circuit",label:o("circuit"),className:Mo,onChange:e=>{const n=e.reduce(((e,t)=>e+t),"");t(n!==N.k?n:void 0)},options:[{label:o("any"),value:N.k},{label:o("junior"),value:D.WD.JUNIOR},{label:o("adult"),value:D.WD.ADULT},{label:o("wheelchair"),value:D.WD.WHEELCHAIR},{label:o("wtn play"),value:D.WD.WTN_PLAY},{label:o("pickleball"),value:D.WD.PICKLE_BALL}],values:[null!=n?n:N.k]})};var Oo=e=>{let{selected:t,onChange:n}=e;const{t:o}=(0,g.$)();return l.createElement(Fo,{clearValue:N.k,filterValue:"status",label:o("status"),className:Mo,onChange:e=>{const t=e.reduce(((e,t)=>e+t),"");n(t)},options:[{label:o("any"),value:N.k},{label:o("pending"),value:D.H2.SUBMITTED},{label:o("approved"),value:D.H2.APPROVED},{label:o("declined"),value:D.H2.DECLINED}],values:[t]})},Po=n(70951),Wo=n(96605);var Bo=e=>{let{selectedSection:t,selectedDistrict:n,setSelectedSection:o,setSelectedDistrict:a}=e;const{t:r}=(0,g.$)(),{isSection:i,isDistrict:c}=(0,Po.HW)(),{sections:u,sectionOptions:d,districtOptions:m}=(0,Wo._Q)(t),f=(0,l.useMemo)((()=>{if(!u)return[{label:r("section all"),value:Qo.ALL}];const e=[{label:r("section all"),value:Qo.ALL}].concat((0,s.Z)((0,Wo.NA)(u)));return i||c?e:null==d?void 0:d.map((e=>""===e.value?{...e,value:Qo.ALL}:e))}),[u,i,c,d,r]),p=(0,l.useMemo)((()=>null==m?void 0:m.map((e=>""===e.value?{...e,value:Qo.ALL}:e))),[m]),v=(0,l.useMemo)((()=>1===(null==p?void 0:p.length)&&p[0].value===Qo.ALL),[p]);return l.createElement(l.Fragment,null,l.createElement(Fo,{clearValue:Qo.ALL,filterValue:"section",label:r("section"),className:Mo,onChange:e=>{const t=e.reduce(((e,t)=>e+t),"");o(t)},options:f||[{label:r("section all"),value:Qo.ALL}],values:[t]}),l.createElement(Fo,{EmptyComponent:l.createElement("p",null,r("district empty")),InfoTooltipComponent:l.createElement(Zo.Z,{text:r("district tooltip")}),clearValue:Qo.ALL,filterValue:"district",label:r("district"),className:Mo,onChange:e=>{const t=e.reduce(((e,t)=>e+t),"");a(t)},options:v?[]:p,values:[n]}))};var Uo=e=>{let{selected:t,onChange:n}=e;const{t:o}=(0,g.$)();return l.createElement(Fo,{clearValue:Jo.ALL,filterValue:"events",label:o("events"),className:Mo,onChange:e=>{const t=e.reduce(((e,t)=>e+t),"");n(t)},options:[{label:o("all events"),value:Jo.ALL},{label:o("team events only"),value:Jo.TEAM}],values:[t]})};var jo=e=>{let{isOpen:t,setIsOpen:n,setFilters:o,initialFilter:a,category:r,selectedLevel:i,status_all:s,levelData:c,status:u,section:d,district:m,events:f}=e;const{0:p,1:v}=(0,l.useState)(),{0:h,1:b}=(0,l.useState)([N.k]),{0:y,1:E}=(0,l.useState)(D.H2.SUBMITTED),{0:C,1:w}=(0,l.useState)(),{0:I,1:A}=(0,l.useState)(),{0:T,1:k}=(0,l.useState)(),{t:L}=(0,g.$)(),S=(0,l.useCallback)((()=>{v(r),b(i),E(u),w(d),A(m),k(f||Jo.ALL)}),[r,i,u,d,m,f]);(0,l.useEffect)((()=>{S()}),[S]);const R=(0,l.useCallback)((e=>{v(e),b([N.k])}),[]),x=(0,l.useCallback)((e=>{w(e),A(Qo.ALL)}),[]),F=(0,l.useCallback)((()=>{o({category:p,levelId:h.includes(N.k)?void 0:h,sanctionStatus:y===N.k?s:[y],section:C,district:I,events:T===Jo.ALL?void 0:T}),n(!1)}),[o,p,h,y,C,I,T]);return l.createElement(rn,{fullWidth:!1,applyBtnText:L("apply filters"),open:t,title:L("more filters"),onCloseClick:()=>{n(!1)},clearBtnText:L("clear all filters"),onApplyBtnClick:F,onClearBtnClick:()=>{o({...a,levelId:void 0,events:void 0})}},l.createElement($o,{onChange:R,selectedCircuit:p}),l.createElement(_o,{levelData:c,setSelectedLevels:b,selectedLevels:h,selectedCircuit:p}),l.createElement(Oo,{selected:y,onChange:E}),l.createElement(Uo,{onChange:k,selected:T}),l.createElement(Bo,{selectedSection:C,setSelectedSection:x,selectedDistrict:I,setSelectedDistrict:A}))};var Go=e=>{let{handleClick:t,data:n,handleClose:o,title:a}=e;return l.createElement("div",{className:"filter-tag-module--hoverComponent--n1XET",onClick:t},l.createElement(bo,{data:n,displayedNumber:3,title:a,onCloseClick:e=>(e=>{e.stopPropagation(),o()})(e)}))};var Vo=e=>{let{category:t,setFilters:n,selectedLevels:o,levelsOptions:a,selectedStatus:r,status_all:i,section:s,district:c,events:d,initFilter:m,from:f,to:p}=e;const{t:v}=(0,g.$)(),h=(0,l.useMemo)((()=>{const e=[];return o!==N.k&&a.forEach((t=>{o.includes(t.value)&&e.push(t.label)})),e}),[o,a]),b=(0,l.useMemo)((()=>r===D.H2.SUBMITTED?"PENDING":r),[r]),{sections:y,districts:E}=(0,Wo._Q)(s),C=(0,l.useMemo)((()=>{var e;return null==y||null===(e=y.find((e=>e.ID===s)))||void 0===e?void 0:e.Name}),[y,s]),w=(0,l.useMemo)((()=>{var e;return null==E||null===(e=E.find((e=>e.ID===c)))||void 0===e?void 0:e.Name}),[E,c]),I=(0,l.useMemo)((()=>{const e={[D.WD.WTN_PLAY]:"wtn play",[D.WD.ADULT]:"adult",[D.WD.JUNIOR]:"junior",[D.WD.WHEELCHAIR]:"wheelchair",[D.WD.PICKLE_BALL]:"pickleball"};return[v(e[t]).toUpperCase()]}),[t,v]),A=(0,l.useMemo)((()=>{const e={from:f,to:p,sanctionStatus:[r],category:t,section:s,district:c};return o.length&&o!==N.k&&(e.levels=o),s&&s!==Qo.ALL&&(e.section=s),c&&c!==Qo.ALL&&(e.district=c),d&&d!==Jo.ALL&&(e.events=d),u()(m,e)}),[m,f,p,r,t,s,c,o,d]);return l.createElement(l.Fragment,null,t&&l.createElement(Go,{title:v("circuit"),data:I,handleClose:()=>n({category:void 0,levelId:void 0})}),o!==N.k&&l.createElement(Go,{title:v("level"),data:h,handleClose:()=>n({levelId:void 0})}),r!==N.k&&l.createElement(Go,{title:v("status"),data:[b],handleClose:()=>n({sanctionStatus:i})}),s&&s!==Qo.ALL&&l.createElement(Go,{title:v("section"),data:[C],handleClose:()=>n({section:Qo.ALL,district:Qo.ALL})}),c&&c!==Qo.ALL&&l.createElement(Go,{title:v("district"),data:[w],handleClose:()=>n({district:Qo.ALL})}),d&&d!==Jo.ALL&&l.createElement(Go,{title:v("events"),data:d===Jo.TEAM?[v("team events only")]:[],handleClose:()=>n({events:void 0})}),!A&&l.createElement("a",{href:"#",className:"filter-tag-module--clearFiltersLink--bPZwt",onClick:e=>{e.preventDefault(),n({...m,levelId:void 0,events:void 0})}},v("reset filters")))},Ho=n(61680),zo=n(74405);var Yo=e=>{let{setFilters:t,selected:n,status_all:o}=e;const{0:a,1:r}=(0,l.useState)(!1),{t:i}=(0,g.$)(),s=(0,l.useCallback)((e=>{const n=e.target.value;let a;a=n===N.k?o:[n],t({sanctionStatus:a}),c(!1)}),[t]),c=e=>{r(e)},u=(0,l.useMemo)((()=>[{label:i("any"),value:N.k},{label:i("pending"),value:D.H2.SUBMITTED},{label:i("approved"),value:D.H2.APPROVED},{label:i("declined"),value:D.H2.DECLINED}]),[i]);return l.createElement(G,{label:i("status"),onChange:s,isOpen:a,options:u,toggleDropdown:c,value:n})},Ko=n(51252);const qo=()=>{const e=(0,Ko.u1)(),{sections:t,districts:n}=(0,Wo._Q)(),{level:o}=(0,Po.HW)(),a=(0,l.useMemo)((()=>{if(e&&void 0!==o)return function(e,t){switch(t){case Po.d6.NATIONAL:case Po.d6.SECTION:return Qo.ALL;case Po.d6.DISTRICT:return e}}(e,o)}),[e,o]),r=(0,l.useMemo)((()=>{if(t&&n&&e&&void 0!==o)return function(e,t,n,o){switch(o){case Po.d6.NATIONAL:return Qo.ALL;case Po.d6.SECTION:return n;case Po.d6.DISTRICT:{const o=null==t?void 0:t.find((e=>e.ID===n)),a=null==e?void 0:e.find((e=>e.ID===(null==o?void 0:o.GroupID)));return null==a?void 0:a.ID}}}(t,n,e,o)}),[e,o,t,n]);return(0,l.useMemo)((()=>{if(r&&a)return{defaultSection:r,defaultDistrict:a}}),[r,a])},Xo=[D.H2.APPROVED,D.H2.DECLINED,D.H2.SUBMITTED];let Jo=function(e){return e.ALL="all",e.TEAM="team",e}({}),Qo=function(e){return e.ALL="all",e}({});function ea(e,t){return e.find((e=>e.value===t))}const ta=(0,k.D)();const na=e=>e.map((e=>e.replace(/(0+-*)+/,"z"))),oa=e=>e.map((e=>{const[t,n]=e.split("z");return t+"00000000-0000-0000-0000-000000000000".slice(t.length).slice(0,-n.length)+n}));var aa=e=>{let{onFilterChange:t,initFilter:n}=e;const{0:o,1:a}=(0,l.useState)(!1),{t:r}=(0,g.$)(),i=(0,l.useCallback)((e=>e.toUpperCase()),[]),c=(0,l.useCallback)((e=>e.toLowerCase()),[]),{options:u,loading:d}=F(),{0:m,1:p}=(0,l.useState)(""),v=(0,l.useCallback)((function(e,t){var n;return void 0===t&&(t=[]),e.length<3?[]:null===(n=t)||void 0===n?void 0:n.filter((t=>t.label.toLowerCase().includes(e.toLowerCase())))}),[]),h=(0,l.useMemo)((()=>v(m,u)),[m,v,u]),b=(0,l.useMemo)((()=>[{filterKey:"section",paramName:"section",toUrlParam:c,toValue:c},{filterKey:"district",paramName:"district",toUrlParam:c,toValue:c},{filterKey:"search",paramName:"search",toUrlParam:c,toValue:c},{filterKey:"events",paramName:"events",toUrlParam:c,toValue:c},{filterKey:"from",paramType:S.F.DATE},{filterKey:"to",paramType:S.F.DATE},{filterKey:"category",toUrlParam:c,toValue:i},{filterKey:"levelId",paramName:"level",paramType:S.F.ARRAY,toUrlParam:na,toValue:oa},{filterKey:"sanctionStatus",paramName:"status",toUrlParam:e=>e===Xo?"any":e[0]!==D.H2.SUBMITTED?e[0].toLowerCase():void 0,toValue:e=>"any"===e?Xo:[e.toUpperCase()]}]),[]),[{to:y,from:E,category:C,sanctionStatus:w,levelId:I,section:A,district:k,search:x,events:M},Z]=(0,S.Z)({initialFilter:n,onChange:t,urlParams:b}),{data:_,loading:O}=(0,f.a)(Ho.p,{client:zo.xH}),P=(0,l.useMemo)((()=>{const e=null==_?void 0:_.levels;return e?[{label:r("any"),value:N.k}].concat((0,s.Z)(e.filter((e=>e.sanctionType!==D.SanctionType.NONE&&e.category===C)).sort(((e,t)=>e.orderIndex-t.orderIndex)).map((e=>({label:e.name,value:e.id}))))):[{label:r("loading levels"),value:"loading"}]}),[_,C,r]),W=qo();return(0,l.useEffect)((()=>{if(W){const{defaultDistrict:e,defaultSection:t}=W;Z({section:t,district:e})}}),[W]),l.createElement(l.Fragment,null,l.createElement(R.Z,null,l.createElement(R.w,null,l.createElement("div",{style:{width:250}},l.createElement(L.ZP,{loading:d,value:ea(u,x)||void 0,inputValue:m,options:h,getOptionLabel:e=>(null==e?void 0:e.label)||"",onInputChange:(e,t)=>{p(t)},onChange:(e,t)=>{Z("string"==typeof t?{search:t}:{search:(null==t?void 0:t.value)||""})},filterOptions:(e,t)=>{const n=ta(e,t),{inputValue:o}=t,a=e.some((e=>o===e.label));const l=(r=o)&&/^[0-9-]+$/.test(r);var r;return""!==o&&!a&&l&&n.push({value:o,label:o}),n},selectOnFocus:!0,clearOnBlur:!0,noOptionsText:(null==m?void 0:m.length)<3?r("enter at least 3 characters"):r("no options"),renderInput:e=>l.createElement(T.Z,Object.assign({},e,{variant:"outlined",fullWidth:!0,InputLabelProps:{shrink:!0},className:"tournament-filters-module--text-field-root--hjCYE",InputProps:{...e.InputProps,classes:{notchedOutline:"tournament-filters-module--notched-outline--GK0M-"}}})),classes:{root:"tournament-filters-module--root--o5Lhy",inputRoot:"tournament-filters-module--input-root--v0qUu",input:"tournament-filters-module--input--YMsKN",inputFocused:"tournament-filters-module--focused--ebczT",popupIndicator:"tournament-filters-module--icon--RyrF7"}}))),l.createElement(U,{from:E,setFilters:Z,to:y,initFilter:n}),l.createElement(V,{setFilters:Z,category:C}),l.createElement(z,{selected:null!=I?I:N.k,setFilters:Z,levelsOptions:P,loadingLevels:O}),l.createElement(Yo,{setFilters:Z,selected:w===Xo?N.k:w[0],status_all:Xo}),l.createElement(jo,{isOpen:o,setIsOpen:a,setFilters:Z,initialFilter:n,category:C,selectedLevel:null!=I?I:[N.k],levelData:null==_?void 0:_.levels,status:w===Xo?N.k:w[0],status_all:Xo,section:A,district:k,events:M}),l.createElement(R.w,null,l.createElement($.Z,{level:"tertiary",onClick:()=>a(!0)},r("more filters")))),l.createElement(Vo,{category:C,setFilters:Z,selectedLevels:null!=I?I:N.k,selectedStatus:w===Xo?N.k:w[0],status_all:Xo,levelsOptions:P,section:A,district:k,events:M,from:E,to:y,initFilter:n}))},la=n(58639),ra=n(35514),ia=n(9561),sa=n(51428),ca=n(98814),ua=n(39937);var da,ma=n(13574),fa=n(48585),pa=n(97114),ga=n(12781);const va=(0,C.ZP)(da||(da=(0,E.Z)(["\n  query DownloadPaginatedTournaments(\n    $limit: Int!\n    $skip: Int!\n    $filters: [PropertyFilterInput!]!\n    $sorts: [PropertySortInput!]\n    $tournamentFilter: TournamentFilterInput\n  ) {\n    paginatedTournaments(\n      tournamentFilter: $tournamentFilter\n      paginationOptions: { offset: $skip, limit: $limit, filters: $filters, sorts: $sorts }\n    ) {\n      items {\n        identificationCode\n        name\n        primaryLocation {\n          address1\n        }\n        timings {\n          startDate\n          endDate\n        }\n        organisation {\n          parent {\n            name\n            parent {\n              name\n            }\n          }\n        }\n        director {\n          firstName\n          lastName\n        }\n        level {\n          name\n          category\n        }\n        sanctionStatus\n        isPublished\n      }\n    }\n  }\n"])));var ha=n(14906);const ba=e=>[{key:"identificationCode",label:e("tournament id")},{key:"name",label:e("name")},{key:"primaryLocation.address1",label:e("location")},{key:"timings.startDate",label:e("start date")},{key:"timings.endDate",label:e("end date")},{key:"organisation.parent.parent.name",label:e("section")},{key:"organisation.parent.name",label:e("district")},{key:"director.firstName",label:e("tournament director"),transforms:[{operation:fa.Z.ARRAY_FIELD_SELECT,parameters:[{key:"fieldPath",value:"director.firstName"}]},{operation:fa.Z.ARRAY_FIELD_SELECT,parameters:[{key:"fieldPath",value:"director.lastName"}]},{operation:fa.Z.ARRAY_JOIN,parameters:[{key:"delimiter",value:" "}]}]},{key:"level.name",label:e("level")},{key:"level.category",label:e("circuit"),valueMap:[{in:D.WD.ADULT,out:e("adult")},{in:D.WD.JUNIOR,out:e("junior")},{in:D.WD.WHEELCHAIR,out:e("wheelchair")},{in:D.WD.WTN_PLAY,out:e("wtn play")}]},{key:"sanctionStatus",label:e("status"),valueMap:[{in:D.H2.SUBMITTED,out:e("submitted")},{in:D.H2.DECLINED,out:e("declined")},{in:D.H2.APPROVED,out:e("approved")}]},{key:"isPublished",label:e("published status"),valueMap:[{in:"TRUE",out:e("published")},{in:"FALSE",out:e("not published")}]}];function ya(e){let{variables:t}=e;const{t:n}=(0,g.$)(),{0:o,1:a}=(0,l.useState)(!1),{0:r,1:i}=(0,l.useState)("none"),{0:s,1:c}=(0,l.useState)(!1),u=(0,l.useCallback)((e=>{"processing"===e&&c(!1),i(e)}),[i,c]),d=(0,l.useMemo)((()=>{const{orgId:e,...n}=t;return{...n,...e&&{tournamentFilter:{sanctioningOrganisationId:e}}}}),[t]);return l.createElement(ha.Z,{container:!0,justifyContent:"flex-end"},l.createElement(ma.Z,{paginator:{rootFieldPath:"paginatedTournaments.items"},reportUploadState:r,onReportUploadStateChange:u,generateButtonTitle:n("download csv"),downloadable:o,setDownloadable:a,reportQuery:(0,pa.S)(va),reportQueryEndpoint:(0,B.S)().TOURNAMENTS_GQL_URL,filename:"tournaments",reportQueryVariables:d,csvTransforms:ba(n)}),"processing"===r&&!s&&l.createElement(ga.Z,{message:n("preparing download"),onClose:()=>c(!0),variant:"download",hideCloseButton:!0}),"downloadable"===r&&!s&&l.createElement(ga.Z,{icon:{name:"md-tick-circle",className:"tournaments-download-csv-module--tick--gP6FF"},message:n("report downloaded"),variant:"downloaded",onClose:()=>c(!0)}))}var Ea=n(19997);var Ca=e=>{let{onGroupByChange:t,value:n}=e;const{t:o}=(0,g.$)();return l.createElement("div",null,l.createElement(Ea.Z,{selected:n,options:[{label:o("week"),value:D._j.WEEK},{label:o("month"),value:D._j.MONTH},{label:o("ungrouped"),value:D._j.ALL}],onSelect:e=>t(e.value)}))},wa=n(1602);var Da=e=>{let{columns:t,setCols:n}=e;const{0:o,1:a}=(0,l.useState)(!1),{t:r}=(0,g.$)();return l.createElement("div",{style:{margin:"0 10px"}},l.createElement(W,{type:"button",buttonIconName:"sm-columns",label:r("columns"),isOpen:o,icon:"calendar-icon",iconPosition:"left",onToggleDropdown:e=>{a(e)},grayedLabel:!0,width:"auto"},null==t?void 0:t.map((e=>{let{title:o,key:a,columnToggle:r}=e;return l.createElement("div",{key:a},l.createElement(H.XZ,{key:a,label:o,checked:null==r?void 0:r.checked,onChecked:e=>((e,o)=>{const a=t.map((t=>t.key===e?{...t,columnToggle:{...t.columnToggle,checked:o}}:t));n(a)})(a,e)}))}))))},Ia=n(19029),Aa=n(34733),Ta="tournament-events-modal-module--body--gcskN",ka="tournament-events-modal-module--eventsCount--Sq9bU",La="tournament-events-modal-module--modalTitle--cqTWX",Sa=n(52116),Na=n(25933);var Ra=e=>{let{show:t,tournament:n,closeEventsModal:a}=e;const{t:r}=(0,g.$)(),{loading:i,data:s}=(0,f.a)(Sa.n0,{client:zo.xH,variables:{id:null==n?void 0:n.id}}),c=(0,Na.Z)(s),u=(0,l.useMemo)((()=>{const e=[{key:"event",title:r("event"),getValue:e=>l.createElement(ia.B_,{event:e})},{key:"players",title:r("players"),getValue:e=>{var t;return null==e||null===(t=e.formatConfiguration)||void 0===t?void 0:t.drawSize}}];return e}),[r]);return l.createElement(Aa.u_,{show:t,sectionClassname:o.section},l.createElement("h3",{className:La},null==n?void 0:n.name),l.createElement("p",{className:ka},null==n?void 0:n.eventCount," ",n&&(null==n?void 0:n.eventCount)>1?r("events"):r("event")),i&&l.createElement(p.Z,null),!i&&c&&l.createElement("div",{className:Ta},l.createElement(v.Z,{columns:u,data:c})),l.createElement(Aa.$_,null,l.createElement($.Z,{level:"tertiary",onClick:a},r("close"))))};function xa(e){let{section:t,district:n,orgId:o,orgHierarchy:a}=e;const[l]=a||[];return n&&n!==Qo.ALL?{orgId:n}:t&&t!==Qo.ALL?{orgId:t}:t===Qo.ALL?{orgId:l}:o?{orgId:o}:{}}const Fa="tournament_table";function Ma(e){let{hasInputFilter:t}=e;const{t:n}=(0,g.$)();return t?l.createElement(ca.Z,{title:n("no tournaments search title"),subtitle:n("no tournaments search description"),icon:"xl-tournament"}):l.createElement(ca.Z,{title:n("no tournaments title"),subtitle:n("no tournaments subtitle"),icon:"xl-tournament"})}const Za=e=>{let{tournaments:t,cols:n}=e;const{0:o,1:a}=(0,l.useState)([]),{t:r}=(0,g.$)();(0,l.useEffect)((()=>{const e=t.map((e=>{var t,n,o,a,l,i,s,c,u;return{...e,startDate:e.timings.startDate,endDate:e.timings.endDate,section:null!==(t=null===(n=e.organisation)||void 0===n||null===(o=n.parent)||void 0===o||null===(a=o.parent)||void 0===a?void 0:a.name)&&void 0!==t?t:r("n/a"),district:null!==(l=null===(i=e.organisation)||void 0===i||null===(s=i.parent)||void 0===s?void 0:s.name)&&void 0!==l?l:r("n/a"),directorName:e.director&&e.director.firstName+" "+e.director.lastName,levelName:(null===(c=e.level)||void 0===c?void 0:c.shortName)||r("n/a"),category:null===(u=e.level)||void 0===u?void 0:u.category}}));a(e)}),[t]);const i=(0,l.useCallback)((e=>{let t=(0,s.Z)(o);e.sorting&&(t=(0,wa.cX)(t,e.sorting.orderBy,e.sorting.order)),u()(o,t)||a(t)}),[o]);return l.createElement(v.Z,{fixedWidth:!0,columns:n,data:o,onRowClick:e=>(0,y.c4)("/tournaments/"+e.id),spacing:{margins:{lg:"bottom"}},controls:{sortDisabled:!1,onControlChange:i,paginaitonDisabled:!0}})},_a=e=>{var t,n;let{tournament:o}=e;const{isDistrict:a}=(0,Po.HW)();return l.createElement("div",{className:"tournaments-module--name-and-location--GEvsl"},null!==(t=o.websiteContent)&&void 0!==t&&t.logoPath?l.createElement("img",{src:o.websiteContent.logoPath,className:"tournaments-module--tournament-logo--EgZga tournaments-module--tournament-logo-base--sHNJf"}):l.createElement("div",{className:"tournaments-module--tournament-logo-placeholder--aUeGY tournaments-module--tournament-logo-base--sHNJf"}),l.createElement("div",null,l.createElement("div",{className:"tournaments-module--name--Rb63B"},o.name),l.createElement("div",{className:"tournaments-module--location--igIDe"},null===(n=o.organisation)||void 0===n?void 0:n.name),!a&&l.createElement("div",{className:"tournaments-module--id--hE2k0"},o.identificationCode)))};var $a=()=>{const e=(0,Ko.u1)(),t=(0,Po.FP)(),{data:n}=F(),{facilities:o,venues:a}=n||{},{0:r,1:i}=(0,l.useState)(D._j.WEEK),{0:s,1:c}=(0,l.useState)(!1),{0:u,1:y}=(0,l.useState)(),E=(0,l.useMemo)((()=>(0,Ia.R5)(Fa)),[]),C=(0,l.useMemo)((()=>({from:A()().toDate(),to:A()().add(3,"months").toDate(),sanctionStatus:[D.H2.SUBMITTED],category:D.WD.JUNIOR,section:Qo.ALL,district:Qo.ALL})),[]),{0:I,1:T}=(0,l.useState)(C),k=((e,t)=>{const{0:n,1:o}=(0,l.useState)(e);return(0,l.useEffect)((()=>{const n=setTimeout((()=>{o(e)}),t);return()=>{clearTimeout(n)}}),[e,t]),n})(I.search,500),L=(0,l.useMemo)((()=>({...I,search:k})),[I,k]),S=(0,l.useMemo)((()=>{const{to:n,from:l,sanctionStatus:i,levelId:s,category:c,section:u,district:d,search:m,events:f,...p}=L,g=function(e){const[t,n]=(null==e?void 0:e.split("-"))||[];return 2===(null==t?void 0:t.length)&&5===(null==n?void 0:n.length)}(m),v=[];i.includes("ANY")||v.push({property:"sanctionStatus",operator:D.EF.IN,values:i}),s&&v.push({property:"restrictedToLevelId",operator:D.EF.IN,values:s}),g&&v.push({property:"identificationCode",operator:D.EF.EQUALS,values:[m]});const h=null==o?void 0:o.find((e=>e.ID===m)),b=null==a?void 0:a.find((e=>e.ID===m));m&&b&&!g&&v.push({property:"organisationId",operator:D.EF.EQUALS,values:[m]}),m&&h&&!g&&v.push({property:"primaryLocationId",operator:D.EF.EQUALS,values:[m]}),f&&f===Jo.TEAM&&v.push({property:"hasTeamEvents",operator:D.EF.EQUALS,values:["true"]}),c&&"ANY"!==c&&v.push({property:"levelCategories",operator:D.EF.ANY,values:[c]});return{...p,startDateTo:(0,sa.l)(n),startDateFrom:(0,sa.l)(l),groupBy:r,...xa({section:u,district:d,orgId:e,orgHierarchy:t}),filters:v}}),[L,e,a,o,t,r]),{loading:N,error:R,data:x}=(0,f.a)(w,{client:zo.xH,variables:S,fetchPolicy:"no-cache"}),{t:M}=(0,g.$)(),Z=(0,l.useMemo)((()=>null==x?void 0:x.paginatedTournamentGroups.items.map((e=>({...e,tournaments:e.tournaments.filter((e=>e.sanctionStatus))}))).filter((e=>!!e.tournaments.length))),[x]),_=(0,l.useMemo)((()=>{var e,t,n,o,a,i,s,c,u,d;return[{key:"name",title:M("tournament"),getValue:e=>l.createElement(_a,{tournament:e}),widthClassName:"tournaments-module--name-and-location-width--SVY7I",sort:r===D._j.ALL,columnToggle:{checked:null===(e=null==E?void 0:E.name)||void 0===e||e}},{key:"startDate",title:M("dates"),getValue:e=>l.createElement(h.VW,null,M("tournament dates",{start:A()(e.startDate),end:A()(e.endDate)})),widthClassName:"tournaments-module--dates-column--Z7RTa",sort:r===D._j.ALL,columnToggle:{checked:null===(t=null==E?void 0:E.startDate)||void 0===t||t}},{key:"section",title:M("section"),getValue:e=>e.section,sort:r===D._j.ALL,columnToggle:{checked:null===(n=null==E?void 0:E.section)||void 0===n||n}},{key:"district",title:M("district"),getValue:e=>e.district,sort:r===D._j.ALL,columnToggle:{checked:null===(o=null==E?void 0:E.district)||void 0===o||o}},{key:"directorName",title:M("tournament director"),getValue:e=>e.directorName,sort:r===D._j.ALL,columnToggle:{checked:null===(a=null==E?void 0:E.directorName)||void 0===a||a}},{key:"eventCount",title:M("events"),getValue:e=>l.createElement("a",{href:"#",className:"tournaments-module--eventsLink--LyTrG",onClick:t=>$(t,e)},e.eventCount+" "+(e.eventCount>1?M("events"):M("event"))),widthClassName:"tournaments-module--events-width--mWChH tournaments-module--small-col-base--rDAUB",sort:r===D._j.ALL,columnToggle:{checked:null===(i=null==E?void 0:E.eventCount)||void 0===i||i}},{key:"levelName",title:M("level"),getValue:e=>l.createElement(h.z,{val:e.levelName}),widthClassName:"tournaments-module--level-width--+x7v2 tournaments-module--small-col-base--rDAUB",sort:r===D._j.ALL,columnToggle:{checked:null===(s=null==E?void 0:E.levelName)||void 0===s||s}},{key:"category",title:M("circuit"),getValue:e=>l.createElement(ia.WD,{category:e.category}),sort:r===D._j.ALL,columnToggle:{checked:null===(c=null==E?void 0:E.category)||void 0===c||c}},{key:"sanctionStatus",title:M("status"),getValue:e=>l.createElement(b.Z,{status:e.sanctionStatus,cancelled:e.isCancelled}),sort:r===D._j.ALL,columnToggle:{checked:null===(u=null==E?void 0:E.sanctionStatus)||void 0===u||u}},{key:"isPublished",title:M("published"),getValue:e=>e.isPublished?l.createElement(ua.Z,{name:"md-tick-circle"}):"—",sort:r===D._j.ALL,columnToggle:{checked:null===(d=null==E?void 0:E.isPublished)||void 0===d||d}}]}),[M,r]),$=(e,t)=>{e.preventDefault(),e.stopPropagation(),y(t),c((e=>!e))},{colsToggle:O,setColsToggle:P}=(0,v.S)(_,Fa);return l.createElement(h.nK,null,l.createElement(la.Z,{title:M("tournament list")}),l.createElement(d.Z,null,l.createElement("section",null,l.createElement(aa,{onFilterChange:T,initFilter:C}))),l.createElement(d.Z,null,l.createElement("div",{className:"tournaments-module--actionsWrapper--g5Cgn"},l.createElement(Ca,{onGroupByChange:i,value:r}),l.createElement("div",{className:"tournaments-module--buttonsContainer--fw9i7"},l.createElement(Da,{columns:O,setCols:P}),l.createElement(ya,{variables:S}))),N&&l.createElement(p.Z,null),l.createElement(ra.Z,{error:null==R?void 0:R.message}),!N&&!R&&Z&&(Z.length?Z.map((e=>l.createElement(l.Fragment,{key:e.startDate},l.createElement(d.Z.Title,null,r!==D._j.ALL&&l.createElement(m.Z,null,(r===D._j.WEEK?M("week abrv"):M("month abrv"))+" "+e.groupNumber),l.createElement("span",{className:"tournaments-module--title-date--dE+he"},M("title dates",{dates:{start:A()(e.startDate),end:A()(e.endDate)}}))),l.createElement(Za,{tournaments:e.tournaments,cols:O})))):l.createElement(Ma,{hasInputFilter:Boolean(L.search)})),l.createElement(Ra,{show:s,tournament:u,closeEventsModal:()=>{y(void 0),c(!1)}})))};var Oa=()=>((0,Po.qE)(),l.createElement(r.Z,null,l.createElement(i.Z,{title:"Tournaments"}),l.createElement($a,null)))},76911:function(e,t,n){"use strict";n.d(t,{k:function(){return o}});const o="filter_off"},51428:function(e,t,n){"use strict";n.d(t,{l:function(){return l}});var o=n(79201),a=n.n(o);const l=e=>a()(e).format("YYYY-MM-DD")},57872:function(e,t,n){var o={"./calendar-icon.png":58357,"./confidence-high.png":15629,"./confidence-low.png":54138,"./confidence-mid.png":87808,"./cs-favicon.png":47647,"./cs-logo-footer.png":70254,"./down-icon.png":55924,"./gatsby-astronaut.png":31094,"./gatsby-icon.png":56581,"./ita-logo-small.png":24191,"./logo.png":29677,"./lta-logo-white-small.png":16779,"./lta-logo-white.png":96013,"./lta-logo.png":76815,"./no-image.png":55114,"./search-icon.png":75586,"./usta-favicon.png":32206,"./usta-favicon_alt.png":72093};function a(e){var t=l(e);return n(t)}function l(e){if(!n.o(o,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return o[e]}a.keys=function(){return Object.keys(o)},a.resolve=l,e.exports=a,a.id=57872}}]);
//# sourceMappingURL=component---src-pages-tournaments-index-tsx-f8db0277d27a48c6bf76.js.map