1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2804],{96461:function(e,r,t){"use strict";var s=t(59499),a=t(94024),n=t(11163),l=t(67294),i=t(9473),o=t(85893);function c(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,s)}return t}r.Z=function(e){function r(r){var t,d=(0,i.I0)(),u=(0,n.useRouter)(),x=!!(null!==(t=JSON.parse(localStorage.getItem("sessionActive")||"{}"))&&void 0!==t&&t.token);return(0,l.useEffect)(function(){x||(d((0,a.setUserConnected)(null)),d((0,a.setIsSidebar)(!1)),u.push("/login?redirect=".concat(btoa(window.location.href))))},[]),(0,o.jsx)(e,function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?c(Object(t),!0).forEach(function(r){(0,s.Z)(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):c(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}({},r))}return e.getInitialProps&&(r.getInitialProps=e.getInitialProps),r}},33898:function(e,r,t){"use strict";t.d(r,{_:function(){return l}});var s=t(91281),a=t(67294),n=t(85893);function l(e){var r=e.title,t=e.desc,l=e.children,i=(0,a.useState)(!1),o=i[0],c=i[1],d=(0,a.useCallback)(function(){c(!0)},[]);return o?null:(0,n.jsxs)("div",{id:"alert-div",className:"flex items-start p-5 mb-6 rounded-2xl bg-secondaryColor/10 border border-secondaryColor/20",role:"alert",children:[(0,n.jsx)("div",{className:"flex items-start mr-4 flex-shrink-0",children:(0,n.jsx)("div",{className:"w-12 h-12 bg-grayColor5/50 rounded-lg flex items-center justify-center",children:(0,n.jsx)(s.szr,{className:"h-8 w-8 text-grayColor1","aria-hidden":"true"})})}),(0,n.jsxs)("div",{className:"flex-1",children:[(0,n.jsx)("h1",{className:"font-delightBlack text-titre-4-mobile lg:text-titre-4 text-grayColor1 mb-2",children:r}),t&&(0,n.jsx)("p",{className:"font-delight text-texte-1 text-grayColor1",children:t}),l&&(0,n.jsx)("div",{className:"font-delight text-base text-grayColor1 mt-2",children:l})]}),(0,n.jsxs)("button",{type:"button",className:"ml-4 -mt-1 text-grayColor1 hover:text-gray-900 hover:bg-grayColor5/50 rounded-lg p-2 transition-all",onClick:d,"aria-label":"Close",children:[(0,n.jsx)("span",{className:"sr-only",children:"Close"}),(0,n.jsx)(s.nZc,{className:"h-5 w-5","aria-hidden":"true"})]})]})}},6208:function(e,r,t){"use strict";t.r(r),t.d(r,{default:function(){return A}});var s=t(50029),a=t(64687),n=t.n(a),l=t(28837),i=t(96461),o=t(85893);function c(e){var r=e.categories,t=e.onEdit,s=e.onDelete,a=function(e){var r;return(0,o.jsxs)("tr",{className:"hover:bg-gray-50",children:[(0,o.jsx)("td",{className:"px-4 py-3",children:(0,o.jsx)("span",{className:"font-delightSemibold text-gray-900",children:e.code})}),(0,o.jsx)("td",{className:"px-4 py-3 text-gray-700",children:e.label}),(0,o.jsx)("td",{className:"px-4 py-3 text-center",children:(0,o.jsxs)("span",{className:"text-sm text-gray-600",children:[e.birthYearMin," - ",e.birthYearMax]})}),(0,o.jsx)("td",{className:"px-4 py-3 text-center",children:(0,o.jsx)("span",{className:"text-xs text-gray-500 bg-gray-100 px-2 py-1 rounded",children:(null===(r=e.federationSlug)||void 0===r?void 0:r.toUpperCase())||"Manuel"})}),(0,o.jsx)("td",{className:"px-4 py-3 text-right",children:(0,o.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,o.jsx)("button",{type:"button",onClick:function(){return t(e)},className:"p-1.5 text-gray-500 hover:text-blue-600 hover:bg-blue-50 rounded transition-colors",title:"Modifier",children:(0,o.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})})}),(0,o.jsx)("button",{type:"button",onClick:function(){return s(e)},className:"p-1.5 text-gray-500 hover:text-red-600 hover:bg-red-50 rounded transition-colors",title:"Supprimer",children:(0,o.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})})]},e.uuid)},n=function(e,r,t){return 0===r.length?null:(0,o.jsxs)("div",{className:"mb-6",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,o.jsx)("span",{className:"w-3 h-3 rounded-full ".concat(t)}),(0,o.jsxs)("h3",{className:"text-lg font-delightSemibold text-gray-800",children:[e," (",r.length,")"]})]}),(0,o.jsx)("div",{className:"overflow-x-auto rounded-lg border border-gray-200",children:(0,o.jsxs)("table",{className:"min-w-full divide-y divide-gray-200",children:[(0,o.jsx)("thead",{className:"bg-gray-50",children:(0,o.jsxs)("tr",{children:[(0,o.jsx)("th",{className:"px-4 py-3 text-left text-xs font-delightSemibold text-gray-500 uppercase tracking-wider",children:"Code"}),(0,o.jsx)("th",{className:"px-4 py-3 text-left text-xs font-delightSemibold text-gray-500 uppercase tracking-wider",children:"Libell\xe9"}),(0,o.jsx)("th",{className:"px-4 py-3 text-center text-xs font-delightSemibold text-gray-500 uppercase tracking-wider",children:"Ann\xe9es de naissance"}),(0,o.jsx)("th",{className:"px-4 py-3 text-center text-xs font-delightSemibold text-gray-500 uppercase tracking-wider",children:"Source"}),(0,o.jsx)("th",{className:"px-4 py-3 text-right text-xs font-delightSemibold text-gray-500 uppercase tracking-wider",children:"Actions"})]})}),(0,o.jsx)("tbody",{className:"bg-grayColor5 divide-y divide-gray-200",children:r.map(a)})]})})]})};return(0,o.jsxs)("div",{className:"mt-4",children:[n("Cat\xe9gories Hommes",r.male,"bg-blue-500"),n("Cat\xe9gories Femmes",r.female,"bg-pink-500"),n("Cat\xe9gories Mixtes",r.mixed,"bg-purple-500")]})}var d=t(38520),u=t(67294),x=function(e){var r=e.federations,t=e.calculationMethods,s=e.isLoading,a=e.hasExistingCategories,n=e.onClose,l=e.onGenerate,i=(0,u.useState)(""),c=i[0],x=i[1],m=(0,u.useState)(!0),g=m[0],h=m[1],p=(0,u.useState)("birth_year"),b=p[0],f=p[1],j=(0,u.useState)(!1),v=j[0],y=j[1],N=r.find(function(e){return e.slug===c}),w=c&&(!a||v)&&!s;return(0,o.jsx)(d.u,{onClose:n,title:"G\xe9n\xe9rer les cat\xe9gories",className:"w-full max-w-lg mx-4",footer:(0,o.jsxs)("div",{className:"flex justify-end gap-3 p-4",children:[(0,o.jsx)("button",{onClick:n,disabled:s,className:"px-4 py-2 text-gray-700 bg-gray-100 hover:bg-gray-200 rounded-lg font-delightSemibold transition-colors disabled:opacity-50",children:"Annuler"}),(0,o.jsx)("button",{onClick:function(){w&&l(c,g,b)},disabled:!w,className:"px-4 py-2 bg-yellow-500 hover:bg-yellow-600 text-white rounded-lg font-delightSemibold transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:s?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"G\xe9n\xe9ration..."]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"G\xe9n\xe9rer les cat\xe9gories"]})})]}),children:(0,o.jsxs)("div",{className:"p-6",children:[a&&(0,o.jsx)("div",{className:"mb-6 p-4 bg-amber-50 border border-amber-200 rounded-lg",children:(0,o.jsxs)("div",{className:"flex items-start gap-3",children:[(0,o.jsx)("svg",{className:"w-5 h-5 text-amber-500 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),(0,o.jsxs)("div",{children:[(0,o.jsx)("h4",{className:"font-delightSemibold text-amber-800",children:"Attention"}),(0,o.jsx)("p",{className:"text-sm text-amber-700 mt-1",children:"Des cat\xe9gories existent d\xe9j\xe0. La g\xe9n\xe9ration va supprimer toutes les cat\xe9gories existantes et r\xe9initialiser les cat\xe9gories des participants."}
1),(0,o.jsxs)("label",{className:"flex items-center gap-2 mt-3 cursor-pointer",children:[(0,o.jsx)("input",{type:"checkbox",checked:v,onChange:function(e){return y(e.target.checked)},className:"w-4 h-4 text-amber-600 border-gray-300 rounded focus:ring-amber-500"}),(0,o.jsx)("span",{className:"text-sm text-amber-800",children:"Je comprends et je confirme vouloir remplacer les cat\xe9gories"})]})]})]})}),(0,o.jsxs)("div",{className:"mb-6",children:[(0,o.jsx)("label",{className:"block text-sm font-delightSemibold text-gray-700 mb-2",children:"S\xe9lectionnez une f\xe9d\xe9ration"}),(0,o.jsx)("div",{className:"grid gap-3",children:r.map(function(e){return(0,o.jsxs)("label",{className:"flex items-start gap-3 p-4 border rounded-lg cursor-pointer transition-colors ".concat(c===e.slug?"border-yellow-500 bg-yellow-50":"border-gray-200 hover:border-gray-300 hover:bg-gray-50"),children:[(0,o.jsx)("input",{type:"radio",name:"federation",value:e.slug,checked:c===e.slug,onChange:function(e){return x(e.target.value)},className:"mt-1 w-4 h-4 text-yellow-500 border-gray-300 focus:ring-yellow-500"}),(0,o.jsxs)("div",{className:"flex-1",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[(0,o.jsx)("span",{className:"font-delightSemibold text-gray-900",children:e.name}),(0,o.jsxs)("span",{className:"text-xs text-gray-500 bg-gray-100 px-2 py-0.5 rounded",children:["Saison : ",e.seasonStart]})]}),(0,o.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:e.title}),(0,o.jsx)("p",{className:"text-xs text-gray-400 mt-1",children:e.description})]})]},e.slug)})})]}),(0,o.jsxs)("div",{className:"mb-6",children:[(0,o.jsx)("label",{className:"block text-sm font-delightSemibold text-gray-700 mb-2",children:"M\xe9thode de calcul de la cat\xe9gorie"}),(0,o.jsx)("div",{className:"grid gap-2",children:t.map(function(e){return(0,o.jsxs)("label",{className:"flex items-start gap-3 p-3 border rounded-lg cursor-pointer transition-colors ".concat(b===e.value?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-gray-300 hover:bg-gray-50"),children:[(0,o.jsx)("input",{type:"radio",name:"calculationMethod",value:e.value,checked:b===e.value,onChange:function(e){return f(e.target.value)},className:"mt-0.5 w-4 h-4 text-blue-500 border-gray-300 focus:ring-blue-500"}),(0,o.jsxs)("div",{className:"flex-1",children:[(0,o.jsx)("span",{className:"text-sm font-delightSemibold text-gray-900",children:e.label}),(0,o.jsx)("p",{className:"text-xs text-gray-500 mt-0.5",children:e.description})]})]},e.value)})})]}),(0,o.jsxs)("div",{className:"mb-6",children:[(0,o.jsx)("label",{className:"block text-sm font-delightSemibold text-gray-700 mb-2",children:"Options"}),(0,o.jsxs)("label",{className:"flex items-center gap-3 p-3 border border-gray-200 rounded-lg cursor-pointer hover:bg-gray-50",children:[(0,o.jsx)("input",{type:"checkbox",checked:g,onChange:function(e){return h(e.target.checked)},className:"w-4 h-4 text-yellow-500 border-gray-300 rounded focus:ring-yellow-500"}),(0,o.jsxs)("div",{children:[(0,o.jsx)("span",{className:"text-sm font-delightSemibold text-gray-900",children:"S\xe9parer par genre"}),(0,o.jsx)("p",{className:"text-xs text-gray-500",children:"Cr\xe9e une cat\xe9gorie pour les hommes et une pour les femmes (ex: Benjamin H, Benjamin F)"})]})]})]}),N&&(0,o.jsx)("div",{className:"mb-6 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:(0,o.jsxs)("p",{className:"text-sm text-blue-800",children:[(0,o.jsx)("strong",{children:N.name})," :"," ",N.description]})})]})})},m=t(59499);function g(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,s)}return t}function h(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?g(Object(t),!0).forEach(function(r){(0,m.Z)(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):g(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function p(e){var r,t,s=e.category,a=e.isLoading,n=e.onClose,l=e.onSave,i=!!s,c=(0,u.useState)({code:"",label:"",gender:"M",birthYearMin:new Date().getFullYear()-30,birthYearMax:new Date().getFullYear()-20,sortOrder:0,ageMin:null,ageMax:null}),x=c[0],g=c[1],p=(0,u.useState)(!1),b=p[0],f=p[1],j=(0,u.useState)({}),v=j[0],y=j[1];(0,u.useEffect)(function(){if(s){var e,r;f(null!==s.ageMin&&null!==s.ageMax),g({code:s.code,label:s.label,gender:s.gender,birthYearMin:s.birthYearMin,birthYearMax:s.birthYearMax,sortOrder:s.sortOrder,ageMin:null!==(e=s.ageMin)&&void 0!==e?e:null,ageMax:null!==(r=s.ageMax)&&void 0!==r?r:null})}},[s]);var N=function(e){var r=e.target,t=r.name,s=r.value;g(function(e){return h(h({},e),{},(0,m.Z)({},t,"birthYearMin"===t||"birthYearMax"===t||"sortOrder"===t||"ageMin"===t||"ageMax"===t?""===s?null:parseInt(s)||0:s))}),v[t]&&y(function(e){return h(h({},e),{},(0,m.Z)({},t,""))})},w=function(e){f(e),e||g(function(e){return h(h({},e),{},{ageMin:null,ageMax:null})})},k=function(){var e={};
1return x.code.trim()?x.code.length>20&&(e.code="Le code ne peut pas d\xe9passer 20 caract\xe8res"):e.code="Le code est obligatoire",x.label.trim()?x.label.length>100&&(e.label="Le libell\xe9 ne peut pas d\xe9passer 100 caract\xe8res"):e.label="Le libell\xe9 est obligatoire",(x.birthYearMin<1900||x.birthYearMin>2100)&&(e.birthYearMin="L'ann\xe9e doit \xeatre entre 1900 et 2100"),(x.birthYearMax<1900||x.birthYearMax>2100)&&(e.birthYearMax="L'ann\xe9e doit \xeatre entre 1900 et 2100"),x.birthYearMin>x.birthYearMax&&(e.birthYearMin="L'ann\xe9e min doit \xeatre inf\xe9rieure ou \xe9gale \xe0 l'ann\xe9e max"),b&&((null===x.ageMin||x.ageMin<0)&&(e.ageMin="L'\xe2ge minimum est obligatoire"),(null===x.ageMax||x.ageMax<0)&&(e.ageMax="L'\xe2ge maximum est obligatoire"),null!==x.ageMin&&null!==x.ageMax&&x.ageMin>x.ageMax&&(e.ageMin="L'\xe2ge min doit \xeatre inf\xe9rieur ou \xe9gal \xe0 l'\xe2ge max")),y(e),0===Object.keys(e).length};return(0,o.jsx)(d.u,{onClose:n,title:i?"Modifier la cat\xe9gorie":"Cr\xe9er une cat\xe9gorie",className:"w-full max-w-lg mx-4",footer:(0,o.jsxs)("div",{className:"flex justify-end gap-3 p-4",children:[(0,o.jsx)("button",{type:"button",onClick:n,disabled:a,className:"px-4 py-2 text-gray-700 bg-gray-100 hover:bg-gray-200 rounded-lg font-delightSemibold transition-colors disabled:opacity-50",children:"Annuler"}),(0,o.jsx)("button",{type:"submit",form:"modal-category-form",disabled:a,className:"px-4 py-2 bg-yellow-500 hover:bg-yellow-600 text-white rounded-lg font-delightSemibold transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:a?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Enregistrement..."]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),i?"Modifier":"Cr\xe9er"]})})]}),children:(0,o.jsxs)("form",{onSubmit:function(e){e.preventDefault(),k()&&l(h(h({},x),{},{ageMin:b?x.ageMin:null,ageMax:b?x.ageMax:null}))},id:"modal-category-form",className:"p-6",children:[(0,o.jsxs)("div",{className:"mb-4",children:[(0,o.jsxs)("label",{htmlFor:"code",className:"block text-sm font-delightSemibold text-gray-700 mb-1",children:["Code ",(0,o.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,o.jsx)("input",{type:"text",id:"code",name:"code",value:x.code,onChange:N,placeholder:"Ex: BE, MI, CA, SE, M1...",className:"w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-yellow-500 focus:border-yellow-500 ".concat(v.code?"border-red-500":"border-gray-300")}),v.code&&(0,o.jsx)("p",{className:"mt-1 text-sm text-red-500",children:v.code})]}),(0,o.jsxs)("div",{className:"mb-4",children:[(0,o.jsxs)("label",{htmlFor:"label",className:"block text-sm font-delightSemibold text-gray-700 mb-1",children:["Libell\xe9 ",(0,o.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,o.jsx)("input",{type:"text",id:"label",name:"label",value:x.label,onChange:N,placeholder:"Ex: Benjamin, Minime, Cadet, Senior...",className:"w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-yellow-500 focus:border-yellow-500 ".concat(v.label?"border-red-500":"border-gray-300")}),v.label&&(0,o.jsx)("p",{className:"mt-1 text-sm text-red-500",children:v.label})]}),(0,o.jsxs)("div",{className:"mb-4",children:[(0,o.jsxs)("label",{htmlFor:"gender",className:"block text-sm font-delightSemibold text-gray-700 mb-1",children:["Genre ",(0,o.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,o.jsxs)("select",{id:"gender",name:"gender",value:x.gender,onChange:N,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-yellow-500 focus:border-yellow-500",children:[(0,o.jsx)("option",{value:"M",children:"Homme"}),(0,o.jsx)("option",{value:"F",children:"Femme"}),(0,o.jsx)("option",{value:"X",children:"Mixte"})]})]}),(0,o.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,o.jsxs)("div",{children:[(0,o.jsxs)("label",{htmlFor:"birthYearMin",className:"block text-sm font-delightSemibold text-gray-700 mb-1",children:["Ann\xe9e min ",(0,o.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,o.jsx)("input",{type:"number",id:"birthYearMin",name:"birthYearMin",value:x.birthYearMin,onChange:N,min:1900,max:2100,className:"w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-yellow-500 focus:border-yellow-500 ".concat(v.birthYearMin?"border-red-500":"border-gray-300")}),v.birthYearMin&&(0,o.jsx)("p",{className:"mt-1 text-sm text-red-500",children:v.birthYearMin}),(0,o.jsx)("p",{className:"mt-1 text-xs text-gray-500",children:"Plus vieux"})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)("label",{htmlFor:"birthYearMax",className:"block text-sm font-delightSemibold text-gray-700 mb-1",children:["Ann\xe9e max ",(0,o.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,o.jsx)("input",{type:"number",id:"birthYearMax",name:"birthYearMax",value:x.birthYearMax,onChange:N,min:1900,max:2100,className:"w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-yellow-500 focus:border-yellow-500 ".concat(v.birthYearMax?"border-red-500":"border-gray-300")}),v.birthYearMax&&(0,o.jsx)("p",{className:"mt-1 text-sm text-red-500",children:v.birthYearMax}),(0,o.jsx)("p",{className:"mt-1 text-xs text-gray-500",children:"Plus jeune"})]})]}),(0,o.jsx)("div",{className:"mb-4",children:(0,o.jsxs)("label",{className:"flex items-center gap-3 p-3 border border-gray-200 rounded-lg cursor-pointer hover:bg-gray-50",children:[(0,o.jsx)("input",{type:"checkbox",checked:b,onChange:function(e){return w(e.target.checked)},className:"w-4 h-4 text-blue-500 border-gray-300 rounded focus:ring-blue-500"}),(0,o.jsxs)("div",{children:[(0,o.jsx)("span",{className:"text-sm font-delightSemibold text-gray-900",children:"Calcul par \xe2ge au jour de la course"}),(0,o.jsx)("p",{className:"text-xs text-blue-600 mt-1",children:"Ce mode est activ\xe9 pour cette \xe9dition. Les champs ci-dessous sont obligatoires."})]})]})}),b&&(0,o.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4 p-4 bg-blue-50 rounded-lg border border-blue-200",children:[(0,o.jsxs)("div",{children:[(0,o.jsxs)("label",{htmlFor:"ageMin",className:"block text-sm font-delightSemibold text-gray-700 mb-1",children:["\xc2ge minimum ",(0,o.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,o.jsx)("input",{type:"number",id:"ageMin",name:"ageMin",value:null!==(r=x.ageMin)&&void 0!==r?r:"",onChange:N,min:0,max:120,placeholder:"Ex: 12",className:"w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ".concat(v.ageMin?"border-red-500":"border-gray-300")}),v.ageMin&&(0,o.jsx)("p",{className:"mt-1 text-sm text-red-500",children:v.ageMin})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)("label",{htmlFor:"ageMax",className:"block text-sm font-delightSemibold text-gray-700 mb-1",children:["\xc2ge maximum ",(0,o.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,o.jsx)("input",{type:"number",id:"ageMax",name:"ageMax",value:null!==(t=x.ageMax)&&void 0!==t?t:"",onChange:N,min:0,max:120,placeholder:"Ex: 13",className:"w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ".concat(v.ageMax?"border-red-500":"border-gray-300")}),v.ageMax&&(0,o.jsx)("p",{className:"mt-1 text-sm text-red-500",children:v.ageMax})]}),(0,o.jsx)("div",{className:"col-span-2 text-xs text-blue-700",children:'Ces \xe2ges seront utilis\xe9s si vous recalculez les participants avec l\'option "\xe2ge au jour de la course"'})]}),(0,o.jsxs)("div",{className:"mb-6",children:[(0,o.jsx)("label",{htmlFor:"sortOrder",className:"block text-sm font-delightSemibold text-gray-700 mb-1",children:"Ordre d'affichage"}),(0,o.jsx)("input",{type:"number",id:"sortOrder",name:"sortOrder",value:x.sortOrder,onChange:N,min:0,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-yellow-500 focus:border-yellow-500"}),(0,o.jsx)("p",{className:"mt-1 text-xs text-gray-500",children:"Les cat\xe9gories sont tri\xe9es par ordre croissant"})]}),(0,o.jsxs)("div",{className:"mb-6 p-3 bg-gray-50 rounded-lg text-sm text-gray-600",children:[(0,o.jsxs)("p",{children:[(0,o.jsx)("strong",{children:"Exemple :"}),' Pour une cat\xe9gorie "Benjamin" comprenant les personnes n\xe9es entre 2012 et 2013 :']}),(0,o.jsxs)("ul",{className:"list-disc list-inside mt-1 text-xs",children:[(0,o.jsx)("li",{children:"Ann\xe9e min : 2012 (les plus vieux)"}),(0,o.jsx)("li",{children:"Ann\xe9e max : 2013 (les plus jeunes)"}),b&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("li",{children:"\xc2ge min : 12 ans"}),(0,o.jsx)("li",{children:"\xc2ge max : 13 ans"})]})]})]})]})})}var b=function(e){var r=e.category,t=e.isLoading,s=e.onClose,a=e.onDelete;return(0,o.jsx)(d.u,{onClose:s,title:"Supprimer la cat\xe9gorie",className:"w-full max-w-md mx-4",footer:(0,o.jsxs)("div",{className:"flex justify-end gap-3 p-4",children:[(0,o.jsx)("button",{onClick:s,disabled:t,className:"px-4 py-2 text-gray-700 bg-gray-100 hover:bg-gray-200 rounded-lg font-delightSemibold transition-colors disabled:opacity-50",children:"Annuler"}),(0,o.jsx)("button",{onClick:a,disabled:t,className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg font-delightSemibold transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:t?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Suppression..."]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),"Supprimer"]})})]}),children:(0,o.jsx)("div",{className:"p-6",children:(0,o.jsxs)("div",{className:"flex items-start gap-4 mb-6",children:[(0,o.jsx)("div",{className:"flex-shrink-0 w-12 h-12 rounded-full bg-red-100 flex items-center justify-center",children:(0,o.jsx)("svg",{className:"w-6 h-6 text-red-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})}),(0,o.jsxs)("div",{children:[(0,o.jsx)("h3",{className:"text-lg font-delightSemibold text-gray-900",children:"\xcates-vous s\xfbr de vouloir supprimer cette cat\xe9gorie ?"}),(0,o.jsxs)("div",{className:"mt-3 p-3 bg-gray-50 rounded-lg",children:[(0,o.jsxs)("p",{className:"text-sm text-gray-600",children:[(0,o.jsx)("span",{className:"font-delightSemibold",children:r.code})," -"," ",r.label]}),(0,o.jsxs)("p",{className:"text-xs text-gray-500 mt-1",children:[r.genderLabel," ⢠Ann\xe9es ",r.birthYearMin," -"," ",r.birthYearMax]})]}),(0,o.jsx)("p",{className:"text-sm text-gray-500 mt-3",children:"Les participants actuellement dans cette cat\xe9gorie seront d\xe9sassign\xe9s. Cette action est irr\xe9versible."})]})]})})})},f=function(e){var r,t=e.isLoading,a=e.defaultUseAgeAtEvent,l=e.onClose,i=e.onRecalculate,c=(0,u.useState)(null),x=c[0],m=c[1],g=(0,u.useState)(void 0!==a&&a),h=g[0],p=g[1],b=(r=(0,s.Z)(n().mark(function e(){var r;return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i(h);case 2:(r=e.sent)&&m(r);case 4:case"end":return e.stop()}},e)})),function(){return r.apply(this,arguments)});return(0,o.jsx)(d.u,{onClose:l,title:"Recalculer les cat\xe9gories",className:"w-full max-w-md mx-4",footer:x?(0,o.jsx)("div",{className:"flex justify-end p-4",children:(0,o.jsx)("button",{onClick:l,className:"px-4 py-2 bg-gray-800 hover:bg-gray-900 text-white rounded-lg font-delightSemibold transition-colors",children:"Fermer"})}):(0,o.jsxs)("div",{className:"flex justify-end gap-3 p-4",children:[(0,o.jsx)("button",{onClick:l,disabled:t,className:"px-4 py-2 text-gray-700 bg-gray-100 hover:bg-gray-200 rounded-lg font-delightSemibold transition-colors disabled:opacity-50",children:"Annuler"}),(0,o.jsx)("button",{onClick:b,disabled:t,className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg font-delightSemibold transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:t?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Recalcul en cours..."]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Lancer le recalcul"]})})]}),children:(0,o.jsx)("div",{className:"p-6",children:x?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"text-center mb-6",children:[(0,o.jsx)("div",{className:"w-16 h-16 rounded-full bg-green-100 flex items-center justify-center mx-auto mb-4",children:(0,o.jsx)("svg",{className:"w-8 h-8 text-green-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),(0,o.jsx)("h3",{className:"text-lg font-delightSemibold text-gray-900",children:"Recalcul termin\xe9 !"}),(0,o.jsxs)("p",{className:"text-sm text-gray-500 mt-1",children:["M\xe9thode :"," ",x.useAgeAtEvent?"\xe2ge au jour de la course":"ann\xe9e de naissance"]})]}),(0,o.jsxs)("div",{className:"grid grid-cols-3 gap-4 mb-6",children:[(0,o.jsxs)("div",{className:"text-center p-4 bg-gray-50 rounded-lg",children:[(0,o.jsx)("div",{className:"text-2xl font-delightBold text-gray-900",children:x.stats.total}),(0,o.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:"Participants analys\xe9s"})]}),(0,o.jsxs)("div",{className:"text-center p-4 bg-green-50 rounded-lg",children:[(0,o.jsx)("div",{className:"text-2xl font-delightBold text-green-600",children:x.stats.assigned}),(0,o.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:"Assign\xe9s"})]}),(0,o.jsxs)("div",{className:"text-center p-4 bg-amber-50 rounded-lg",children:[(0,o.jsx)("div",{className:"text-2xl font-delightBold text-amber-600",children:x.stats.notFound}),(0,o.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:"Non assign\xe9s"})]})]}),x.stats.notFound>0&&(0,o.jsxs)("div",{className:"mb-6 p-4 bg-amber-50 border border-amber-200 rounded-lg text-sm text-amber-800",children:[(0,o.jsxs)("strong",{children:[x.stats.notFound," participant(s)"]})," ","n'ont pas pu \xeatre assign\xe9s \xe0 une cat\xe9gorie. V\xe9rifiez que leur
1s donn\xe9es correspondent aux cat\xe9gories configur\xe9es."]})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"flex items-start gap-4 mb-6",children:[(0,o.jsx)("div",{className:"flex-shrink-0 w-12 h-12 rounded-full bg-blue-100 flex items-center justify-center",children:(0,o.jsx)("svg",{className:"w-6 h-6 text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 7h6m0 10v-3m-3 3h.01M9 17h.01M9 14h.01M12 14h.01M15 11h.01M12 11h.01M9 11h.01M7 21h10a2 2 0 002-2V5a2 2 0 00-2-2H7a2 2 0 00-2 2v14a2 2 0 002 2z"})})}),(0,o.jsxs)("div",{children:[(0,o.jsx)("h3",{className:"text-lg font-delightSemibold text-gray-900",children:"Recalculer les cat\xe9gories de tous les participants"}),(0,o.jsx)("p",{className:"text-sm text-gray-500 mt-2",children:"Cette action va analyser chaque participant et lui assigner automatiquement la cat\xe9gorie correspondante."})]})]}),(0,o.jsxs)("div",{className:"mb-6",children:[(0,o.jsx)("label",{className:"block text-sm font-delightSemibold text-gray-700 mb-2",children:"M\xe9thode de calcul"}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsxs)("label",{className:"flex items-start gap-3 p-3 border rounded-lg cursor-pointer transition-colors ".concat(h?"border-gray-200 hover:border-gray-300 hover:bg-gray-50":"border-blue-500 bg-blue-50"),children:[(0,o.jsx)("input",{type:"radio",name:"calculationMethod",checked:!h,onChange:function(){return p(!1)},className:"mt-0.5 w-4 h-4 text-blue-500 border-gray-300 focus:ring-blue-500"}),(0,o.jsxs)("div",{className:"flex-1",children:[(0,o.jsx)("span",{className:"text-sm font-delightSemibold text-gray-900",children:"Par ann\xe9e de naissance"}),(0,o.jsx)("p",{className:"text-xs text-gray-500 mt-0.5",children:"La cat\xe9gorie est d\xe9termin\xe9e par l'ann\xe9e de naissance (m\xe9thode FFA standard)"})]})]}),(0,o.jsxs)("label",{className:"flex items-start gap-3 p-3 border rounded-lg cursor-pointer transition-colors ".concat(h?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-gray-300 hover:bg-gray-50"),children:[(0,o.jsx)("input",{type:"radio",name:"calculationMethod",checked:h,onChange:function(){return p(!0)},className:"mt-0.5 w-4 h-4 text-blue-500 border-gray-300 focus:ring-blue-500"}),(0,o.jsxs)("div",{className:"flex-1",children:[(0,o.jsx)("span",{className:"text-sm font-delightSemibold text-gray-900",children:"Par \xe2ge au jour de la course"}),(0,o.jsx)("p",{className:"text-xs text-gray-500 mt-0.5",children:"La cat\xe9gorie est d\xe9termin\xe9e par l'\xe2ge exact le jour de l'\xe9v\xe9nement"})]})]})]})]}),(0,o.jsx)("div",{className:"mb-6 p-4 bg-amber-50 border border-amber-200 rounded-lg",children:(0,o.jsxs)("div",{className:"flex items-start gap-2",children:[(0,o.jsx)("svg",{className:"w-5 h-5 text-amber-500 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,o.jsxs)("div",{className:"text-sm text-amber-800",children:[(0,o.jsx)("p",{className:"font-delightSemibold",children:"Note importante"}),(0,o.jsx)("p",{className:"mt-1",children:"Les participants dont les donn\xe9es ne correspondent \xe0 aucune cat\xe9gorie ne seront pas assign\xe9s. Vous pourrez les g\xe9rer manuellement par la suite."})]})]})})]})})})};function j(e){var r=e.isLoading,t=e.totalCategories,s=e.onClose,a=e.onDelete,n=(0,u.useState)(""),l=n[0],i=n[1],c="SUPPRIMER"===l&&!r;return(0,o.jsx)(d.u,{onClose:s,title:"Supprimer toutes les cat\xe9gories",className:"w-full max-w-md mx-4",footer:(0,o.jsxs)("div",{className:"flex justify-end gap-3 p-4",children:[(0,o.jsx)("button",{type:"button",onClick:s,disabled:r,className:"px-4 py-2 text-gray-700 bg-gray-100 hover:bg-gray-200 rounded-lg font-delightSemibold transition-colors disabled:opacity-50",children:"Annuler"}),(0,o.jsx)("button",{type:"button",onClick:a,disabled:!c,className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg font-delightSemibold transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:r?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Suppression..."]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),"Supprimer tout"]})})]}),children:(0,o.jsxs)("div",{className:"p-6",children:[(0,o.jsxs)("div",{className:"flex items-start gap-4 mb-6",children:[(0,o.jsx)("div",{className:"flex-shrink-0 w-12 h-12 rounded-full bg-red-100 flex items-center justify-center",children:(0,o.jsx)("svg",{className:"w-6 h-6 text-red-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),(0,o.jsxs)("div",{children:[(0,o.jsx)("h3",{className:"text-lg font-delightSemibold text-gray-900",children:"\xcates-vous s\xfbr de vouloir supprimer toutes les cat\xe9gories ?"}),(0,o.jsxs)("p",{className:"text-sm text-gray-500 mt-2",children:["Cette action va supprimer les"," ",(0,o.jsxs)("span",{className:"font-delightSemibold text-red-600",children:[t," cat\xe9gories"]})," ","configur\xe9es et d\xe9sassigner tous les participants."]})]})]}),(0,o.jsx)("div",{className:"mb-6 p-4 bg-red-50 border border-red-200 rounded-lg",children:(0,o.jsxs)("div",{className:"flex items-start gap-2",children:[(0,o.jsx)("svg",{className:"w-5 h-5 text-red-500 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),(0,o.jsxs)("div",{className:"text-sm text-red-800",children:[(0,o.jsx)("p",{className:"font-delightSemibold",children:"Cette action est irr\xe9versible !"}),(0,o.jsx)("p",{className:"mt-1",children:"Toutes les cat\xe9gories seront supprim\xe9es et devront \xeatre recr\xe9\xe9es. Les participants perdront leur assignation de cat\xe9gorie."})]})]})}),(0,o.jsxs)("div",{className:"mb-6",children:[(0,o.jsxs)("label",{htmlFor:"confirmText",className:"block text-sm font-delightSemibold text-gray-700 mb-2",children:["Pour confirmer, tapez"," ",(0,o.jsx)("span",{className:"font-mono bg-gray-100 px-1 rounded",children:"SUPPRIMER"})," ","ci-dessous :"]}
1),(0,o.jsx)("input",{type:"text",id:"confirmText",value:l,onChange:function(e){return i(e.target.value)},placeholder:"SUPPRIMER",className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-red-500 focus:border-red-500"})]})]})})}var v=t(33898),y=t(197),N=t(27829),w=t(86026),k=t(94024),M=t(64712),C=function(){var e,r,t,a,l,i,o=(0,y.a)().refreshToken,c=(0,k.useOrgaStates)().selectedEdition,d=(0,u.useState)(!1),x=d[0],m=d[1],g=(0,u.useState)({male:[],female:[],mixed:[]}),h=g[0],p=g[1],b=(0,u.useState)([]),f=b[0],j=b[1],v=(0,u.useState)([]),C=v[0],S=v[1],L=(0,u.useState)({calculationMethod:"birth_year",useAgeAtEvent:!1}),A=L[0],E=L[1],O=(0,w.u)("POST","application/json",void 0,o).mutateAsync,F=(0,w.u)("PATCH","application/merge-patch+json",void 0,o).mutateAsync,P=(0,w.u)("DELETE","application/json",void 0,o).mutateAsync,Y=(0,u.useCallback)((0,s.Z)(n().mark(function e(){var r;return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,N.r)({endpoint:"/api/categories/federations",apiOptions:{},refreshToken:o});case 3:return j((r=e.sent).data.federations||[]),S(r.data.calculationMethods||[]),e.abrupt("return",r.data);case 9:return e.prev=9,e.t0=e.catch(0),console.error("Erreur lors de la r\xe9cup\xe9ration des f\xe9d\xe9rations:",e.t0),M.Am.error("Erreur lors de la r\xe9cup\xe9ration des f\xe9d\xe9rations"),e.abrupt("return",{federations:[],calculationMethods:[]});case 14:case"end":return e.stop()}},e,null,[[0,9]])})),[o]),B=(0,u.useCallback)((0,s.Z)(n().mark(function e(){var r;return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=c&&c.uuid){e.next=2;break}return e.abrupt("return");case 2:return m(!0),e.prev=3,e.next=6,(0,N.r)({endpoint:"/api/editions/".concat(c.uuid,"/categories/grouped"),apiOptions:{},refreshToken:o});case 6:return p({male:(r=e.sent).data.male||[],female:r.data.female||[],mixed:r.data.mixed||[]}),e.abrupt("return",r.data);case 11:e.prev=11,e.t0=e.catch(3),console.error("Erreur lors de la r\xe9cup\xe9ration des cat\xe9gories:",e.t0),p({male:[],female:[],mixed:[]});case 15:return e.prev=15,m(!1),e.finish(15);case 18:case"end":return e.stop()}},e,null,[[3,11,15,18]])})),[null==c?void 0:c.uuid,o]),D=(0,u.useCallback)((0,s.Z)(n().mark(function e(){var r;return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=c&&c.uuid){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,e.next=5,(0,N.r)({endpoint:"/api/editions/".concat(c.uuid,"/categories/settings"),apiOptions:{},refreshToken:o});case 5:return E({calculationMethod:(r=e.sent).data.calculationMethod||"birth_year",useAgeAtEvent:r.data.useAgeAtEvent||!1}),e.abrupt("return",r.data);case 10:e.prev=10,e.t0=e.catch(2),console.error("Erreur lors de la r\xe9cup\xe9ration des param\xe8tres:",e.t0),E({calculationMethod:"birth_year",useAgeAtEvent:!1});case 14:case"end":return e.stop()}},e,null,[[2,10]])})),[null==c?void 0:c.uuid,o]),Z=(0,u.useCallback)((e=(0,s.Z)(n().mark(function e(r){var t;return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=c&&c.uuid){e.next=2;break}return e.abrupt("return",!1);case 2:return m(!0),e.prev=3,e.next=6,F({url:"/api/editions/".concat(c.uuid,"/categories/settings"),variables:{calculationMethod:r}});case 6:return E({calculationMethod:(t=e.sent).calculationMethod,useAgeAtEvent:t.useAgeAtEvent}),M.Am.success("Param\xe8tres mis \xe0 jour"),e.abrupt("return",!0);case 12:return e.prev=12,e.t0=e.catch(3),console.error("Erreur lors de la mise \xe0 jour des param\xe8tres:",e.t0),M.Am.error("Erreur lors de la mise \xe0 jour des param\xe8tres"),e.abrupt("return",!1);case 17:return e.prev=17,m(!1),e.finish(17);case 20:case"end":return e.stop()}},e,null,[[3,12,17,20]])})),function(r){return e.apply(this,arguments)}),[null==c?void 0:c.uuid,F]),H=(0,u.useCallback)((r=(0,s.Z)(n().mark(function e(r){var t,s,a,l=arguments;return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=!(l.length>1)||void 0===l[1]||l[1],s=l.length>2&&void 0!==l[2]&&l[2],null!=c&&c.uuid){e.next=4;break}return e.abrupt("return",null);case 4:return e.prev=4,e.next=7,(0,N.r)({endpoint:"/api/editions/".concat(c.uuid,"/categories/preview/").concat(r),apiOptions:{},dynamicParams:{separateGenders:t.toString(),useAgeAtEvent:s.toString()},refreshToken:o});case 7:return a=e.sent,e.abrupt("return",a.data);case 11:return e.prev=11,e.t0=e.catch(4),console.error("Erreur lors de la pr\xe9visualisation:",e.t0),M.Am.error("Erreur lors de la pr\xe9visualisation des cat\xe9gories"),e.abrupt("return",null);case 16:case"end":return e.stop()}},e,null,[[4,11]])})),function(e){return r.apply(this,arguments)}),[null==c?void 0:c.uuid,o]),z=(0,u.useCallback)((t=(0,s.Z)(n().mark(function e(r){var t,s,a,l=arguments;return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=!(l.length>1)||void 0===l[1]||l[1],s=l.length>2&&void 0!==l[2]?l[2]:"birth_year",null!=c&&c.uuid){e.next=4;break}return e.abrupt("return",null);case 4:return m(!0),e.prev=5,e.next=8,O({url:"/api/editions/".concat(c.uuid,"/categories/generate/").concat(r),variables:{separateGenders:t,calculationMethod:s}});case 8:return a=e.sent,M.Am.success(a.message||"Cat\xe9gories g\xe9n\xe9r\xe9es avec succ\xe8s"),e.next=12,B();case 12:return e.abrupt("return",a);case 15:return e.prev=15,e.t0=e.catch(5),console.error("Erreur lors de la g\xe9n\xe9ration:",e.t0),M.Am.error("Erreur lors de la g\xe9n\xe9ration des cat\xe9gories"),e.abrupt("return",null);case 20:return e.prev=20,m(!1),e.finish(20);case 23:case"end":return e.stop()}},e,null,[[5,15,20,23]])})),function(e){return t.apply(this,arguments)}),[null==c?void 0:c.uuid,O,B]),_=(0,u.useCallback)((0,s.Z)(n().mark(function e(){var r,t,s,a=arguments;return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=a.length>0&&void 0!==a[0]&&a[0],null!=c&&c.uuid){e.next=3;break}return e.abrupt("return",null);case 3:return m(!0),e.prev=4,e.next=7,O({url:"/api/editions/".concat(c.uuid,"/categories/recalculate"),variables:{useAgeAtEvent:r}});case 7:return s=(t=e.sent).stats,M.Am.success("Recalcul termin\xe9 : ".concat(s.assigned,"/").concat(s.total," participants assign\xe9s")),e.abrupt("return",t);case 13:return e.prev=13,e.t0=e.catch(4),console.error("Erreur lors du recalcul:",e.t0),M.Am.error("Erreur lors du recalcul des cat\xe9gories"),e.abrupt("return",null);case 18:return e.prev=18,m(!1),e.finish(18);case 21:case"end":return e.stop()}},e,null,[[4,13,18,21]])})),[null==c?void 0:c.uuid,O]),R=(0,u.useCallback)((0,s.Z)(n().mark(function e(){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=c&&c.uuid){e.next=2;break}return e.abrupt("return",!1);case 2:return m(!0),e.prev=3,e.next=6,P({url:"/api/editions/".concat(c.uuid,"/categories"),variables:{}});case 6:return M.Am.success("Toutes les cat\xe9gories ont \xe9t\xe9 supprim\xe9es"),p({male:[],female:[],mixed:[]}),e.abrupt("return",!0);case 11:return e.prev=11,e.t0=e.catch(3),console.error("Erreur lors de la suppression:",e.t0),M.Am.error("Erreur lors de la suppression des cat\xe9gories"),e.abrupt("return",!1);case 16:return e.prev=16,m(!1),e.finish(16);case 19:case"end":return e.stop()}},e,null,[[3,11,16,19]])})),[null==c?void 0:c.uuid,P]),W=(0,u.useCallback)((a=(0,s.Z)(n().mark(function e(r){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=c&&c.uuid){e.next=2;break}return e.abrupt("return",!1);case 2:return m(!0),e.prev=3,e.next=6,O({url:"/api/editions/".concat(c.uuid,"/categories"),variables:r});case 6:return M.Am.success("Cat\xe9gorie cr\xe9\xe9e avec succ\xe8s"),e.next=9,B();case 9:return e.abrupt("return",!0);case 12:return e.prev=12,e.t0=e.catch(3),console.error("Erreur lors de la cr\xe9ation:",e.t0),M.Am.error("Erreur lors de la cr\xe9ation de la cat\xe9gorie"),e.abrupt("return",!1);case 17:return e.prev=17,m(!1),e.finish(17);case 20:case"end":return e.stop()}},e,null,[[3,12,17,20]])})),function(e){return a.apply(this,arguments)}),[null==c?void 0:c.uuid,O,B]),T=(0,u.useCallback)((l=(0,s.Z)(n().mark(function e(r,t){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return m(!0),e.prev=1,e.next=4,F({url:"/api/categories/".concat(r),variables:t});case 4:return M.Am.success("Cat\xe9gorie mise \xe0 jour avec succ\xe8s"),e.next=7,B();case 7:return e.abrupt("return",!0);case 10:return e.prev=10,e.t0=e.catch(1),console.error("Erreur lors de la mise \xe0 jour:",e.t0),M.Am.error("Erreur lors de la mise \xe0 jour de la cat\xe9gorie"),e.abrupt("return",!1);case 15:return e.prev=15,m(!1),e.finish(15);case 18:case"end":return e.stop()}}
1,e,null,[[1,10,15,18]])})),function(e,r){return l.apply(this,arguments)}),[F,B]),I=(0,u.useCallback)((i=(0,s.Z)(n().mark(function e(r){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return m(!0),e.prev=1,e.next=4,P({url:"/api/categories/".concat(r),variables:{}});case 4:return M.Am.success("Cat\xe9gorie supprim\xe9e avec succ\xe8s"),e.next=7,B();case 7:return e.abrupt("return",!0);case 10:return e.prev=10,e.t0=e.catch(1),console.error("Erreur lors de la suppression:",e.t0),M.Am.error("Erreur lors de la suppression de la cat\xe9gorie"),e.abrupt("return",!1);case 15:return e.prev=15,m(!1),e.finish(15);case 18:case"end":return e.stop()}},e,null,[[1,10,15,18]])})),function(e){return i.apply(this,arguments)}),[P,B]),G=h.male.length+h.female.length+h.mixed.length;return{isLoading:x,categories:h,federations:f,calculationMethods:C,settings:A,totalCategories:G,hasCategories:G>0,fetchSupportedFederations:Y,fetchCategoriesGrouped:B,fetchCategorySettings:D,updateCategorySettings:Z,previewCategories:H,generateCategories:z,recalculateParticipantsCategories:_,deleteAllCategories:R,createCategory:W,updateCategory:T,deleteCategory:I}},S=t(50306),L=t(9473),A=(0,i.Z)(function(){var e,r,t,a,i,d=(0,L.I0)(),m=(0,k.useOrgaStates)().selectedEdition,g=C(),h=g.isLoading,y=g.categories,N=g.federations,w=g.calculationMethods,M=g.settings,A=g.totalCategories,E=g.hasCategories,O=g.fetchSupportedFederations,F=g.fetchCategoriesGrouped,P=g.fetchCategorySettings,Y=g.generateCategories,B=g.recalculateParticipantsCategories,D=g.deleteAllCategories,Z=g.createCategory,H=g.updateCategory,z=g.deleteCategory,_=(0,u.useState)(!1),R=_[0],W=_[1],T=(0,u.useState)(!1),I=T[0],G=T[1],V=(0,u.useState)(!1),U=V[0],q=V[1],J=(0,u.useState)(!1),X=J[0],$=J[1],K=(0,u.useState)(!1),Q=K[0],ee=K[1],er=(0,u.useState)(null),et=er[0],es=er[1];(0,u.useEffect)(function(){d((0,k.setAreaActiv)(S.$J.ORGADASHBOARDEDITION)),O(),F(),P()},[null==m?void 0:m.uuid]);var ea=function(){es(null),G(!0)},en=(e=(0,s.Z)(n().mark(function e(r,t,s){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Y(r,t,s);case 2:e.sent&&W(!1);case 4:case"end":return e.stop()}},e)})),function(r,t,s){return e.apply(this,arguments)}),el=(r=(0,s.Z)(n().mark(function e(r){var t;return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=!1,!et){e.next=7;break}return e.next=4,H(et.uuid,r);case 4:t=e.sent,e.next=10;break;case 7:return e.next=9,Z(r);case 9:t=e.sent;case 10:t&&(G(!1),es(null));case 11:case"end":return e.stop()}},e)})),function(e){return r.apply(this,arguments)}),ei=(t=(0,s.Z)(n().mark(function e(){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!et){e.next=5;break}return e.next=3,z(et.uuid);case 3:e.sent&&(q(!1),es(null));case 5:case"end":return e.stop()}},e)})),function(){return t.apply(this,arguments)}),eo=(a=(0,s.Z)(n().mark(function e(r){var t;return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,B(r);case 2:return t=e.sent,e.abrupt("return",t);case 4:case"end":return e.stop()}},e)})),function(e){return a.apply(this,arguments)}),ec=(i=(0,s.Z)(n().mark(function e(){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,D();case 2:e.sent&&ee(!1);case 4:case"end":return e.stop()}},e)})),function(){return i.apply(this,arguments)});return(0,o.jsxs)("div",{className:"px-4 sm:px-10",children:[(0,o.jsx)(v._,{title:"Gestion des cat\xe9gories",children:(0,o.jsx)("div",{children:"Configurez les cat\xe9gories d'\xe2ge pour votre \xe9v\xe9nement. Les cat\xe9gories permettent de classer automatiquement les participants selon leur ann\xe9e de naissance et leur sexe."})}),(0,o.jsx)(l.bZj,{className:"bg-blue-50 mb-4",children:(0,o.jsxs)("div",{className:"text-sm",children:[(0,o.jsx)("strong",{children:"\uD83D\uDCA1 Astuce :"})," Vous pouvez g\xe9n\xe9rer automatiquement les cat\xe9gories selon une f\xe9d\xe9ration (FFA, FFTRI, FFC) ou les cr\xe9er manuellement. ",(0,o.jsx)("br",{}),"La m\xe9thode de calcul (ann\xe9e de naissance ou \xe2ge au jour de la course) se configure pour chaque \xe9preuve dans \xab \xc9preuves et tarifs \xbb."]})}),(0,o.jsxs)("div",{className:"flex flex-wrap gap-3 mb-6",children:[(0,o.jsxs)("button",{type:"button",onClick:function(){W(!0)},disabled:h,className:"px-4 py-2 bg-yellow-500 hover:bg-yellow-600 text-white rounded-lg font-delightSemibold transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[(0,o.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"G\xe9n\xe9rer depuis une f\xe9d\xe9ration"]}),E&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("button",{type:"button",onClick:function(){return $(!0)},disabled:h,className:"px-4 py-2 bg-blue-500 hover:bg-blue-600 text-white rounded-lg font-delightSemibold transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[(0,o.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 7h6m0 10v-3m-3 3h.01M9 17h.01M9 14h.01M12 14h.01M15 11h.01M12 11h.01M9 11h.01M7 21h10a2 2 0 002-2V5a2 2 0 00-2-2H7a2 2 0 00-2 2v14a2 2 0 002 2z"})}),"Recalculer les participants"]}),(0,o.jsxs)("button",{type:"button",onClick:function(){return ee(!0)},disabled:h,className:"px-4 py-2 bg-red-500 hover:bg-red-600 text-white rounded-lg font-delightSemibold transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[(0,o.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),"Supprimer toutes les cat\xe9gories"]})]})]}),E&&(0,o.jsx)("div",{className:"bg-gray-50 rounded-lg p-4 mb-6",children:(0,o.jsxs)("div",{className:"flex flex-wrap gap-6",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[(0,o.jsx)("span",{className:"text-2xl font-delightBold text-gray-800",children:A}),(0,o.jsxs)("span",{className:"text-gray-600",children:["cat\xe9gorie",A>1?"s":""," configur\xe9e",A>1?"s":""]})]}),(0,o.jsxs)("div",{className:"flex items-center gap-4 text-sm",children:[(0,o.jsxs)("span",{className:"flex items-center gap-1",children:[(0,o.jsx)("span",{className:"w-3 h-3 bg-blue-500 rounded-full"}),y.male.length," Hommes"]}),(0,o.jsxs)("span",{className:"flex items-center gap-1",children:[(0,o.jsx)("span",{className:"w-3 h-3 bg-pink-500 rounded-full"}),y.female.length," Femmes"]}),y.mixed.length>0&&(0,o.jsxs)("span",{className:"flex items-center gap-1",children:[(0,o.jsx)("span",{className:"w-3 h-3 bg-purple-500 rounded-full"}),y.mixed.length," Mixte"]})]})]})}),(0,o.jsx)(l.izJ,{text:"Ajouter une cat\xe9gorie",onClick:ea}),h?(0,o.jsxs)("div",{className:"flex justify-center items-center py-12",children:[(0,o.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-yellow-500"}),(0,o.jsx)("span",{className:"ml-3 text-gray-600",children:"Chargement..."})]}):E?(0,o.jsx)(c,{categories:y,onEdit:function(e){es(e),G(!0)},onDelete:function(e){es(e),q(!0)}}):(0,o.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg",children:[(0,o.jsx)("svg",{className:"mx-auto h-12 w-12 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})}),(0,o.jsx)("h3",{className:"mt-4 text-lg font-delightSemibold text-gray-900",children:"Aucune cat\xe9gorie configur\xe9e"}),(0,o.jsx)("p",{className:"mt-2 text-sm text-gray-500",children:"Commencez par g\xe9n\xe9rer les cat\xe9gories depuis une f\xe9d\xe9ration ou cr\xe9ez les manuellement."})]}),(0,o.jsx)(l.izJ,{text:"Ajouter une cat\xe9gorie",onClick:ea}),R&&(0,o.jsx)(x,{federations:N,calculationMethods:w,isLoading:h,hasExistingCategories:E,onClose:function(){return W(!1)},onGenerate:en}),I&&(0,o.jsx)(p,{category:et,isLoading:h,onClose:function(){G(!1),es(null)},onSave:el}),U&&et&&(0,o.jsx)(b,{category:et,isLoading:h,onClose:function(){q(!1),es(null)},onDelete:ei}),X&&(0,o.jsx)(f,{isLoading:h,defaultUseAgeAtEvent:M.useAgeAtEvent,onClose:function(){return $(!1)},onRecalculate:eo}),Q&&(0,o.jsx)(j,{isLoading:h,totalCategories:A,onClose:function(){return ee(!1)},onDelete:ec})]})})},51016:function(e,r,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/orga/dashboard-edition/advanced-settings/categories",function(){return t(6208)}])}},function(e){e.O(0,[2888,9774,179],function(){return e(e.s=51016)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.