1import{d as H,c as n,l as t,t as o,aB as Le,g as U,j as a,y as Q,z as ve,h as _,q as J,v as ie,e,ah as Ie,R as Z,F as O,r as j,f as T,al as Te,B as D,Q as me,k as F,i as te,aq as je,aK as gt,w as Ue,p as xe,W as de,o as Ve,ak as Ae,_ as _t,L as Je,M as ft,C as Ke,n as Se,a as ht,bW as xt,b as vt,a3 as yt}from"./CiKtckVa.js";import{_ as He}from"./kvmZES3e.js";import{_ as ee}from"./5DDz-OcZ.js";import{V as ue}from"./DjYJYkEl.js";import{V as We}from"./8jDGFeVN.js";import{u as bt}from"./Drx3cB6G.js";import{V as oe}from"./CgrWSzAG.js";import{_ as Ee}from"./B_iF5i9d.js";import{_ as Me}from"./BL6TO4cz.js";import{_ as kt}from"./BV5HPj4d.js";import{P as $t}from"./DTBhDwS9.js";import{_ as Ne,u as wt}from"./BxSq2Kqv.js";import"./yw1ultGR.js";import"./D0FtttWC.js";import"./CPiWm1qT.js";const Ct={class:"bg-white rounded-lg shadow-sm overflow-hidden"},Vt={key:0,class:"px-4 py-3 border-b border-gray-100 flex items-center gap-2 flex-wrap"},St={class:"flex-1 min-w-0 text-sm font-semibold text-navy-500"},le=H({__name:"SettingsCard",props:{title:{}},setup(r){return(l,c)=>(a(),n("section",Ct,[r.title?(a(),n("header",Vt,[t("h2",St,o(r.title),1),Le(l.$slots,"badge")])):U("",!0),Le(l.$slots,"default")]))}}),Et={class:"flex flex-col gap-3"},Dt={key:0,class:"divide-y divide-gray-100"},Ft={key:1,class:"flex-1 min-w-0 text-sm text-navy-500 truncate"},Ut={class:"flex gap-1 flex-shrink-0"},Tt=["disabled","title","onClick"],Lt=["title"],Ot=["title","onClick"],Bt=["title","onClick"],It={key:1,class:"px-4 py-5 text-sm text-gray-400"},Mt={class:"px-4 py-3 border-t border-gray-100 flex items-center gap-2"},qt={class:"flex items-start gap-2 px-1 text-xs text-gray-400 leading-relaxed"},Pt=H({__name:"SettingsBoats",props:{items:{}},emits:["changed"],setup(r,{emit:l}){const c=l,{t:i}=Q(),s=ve(),S=D(""),g=D(""),u=D(""),p=D(!1),m=Ie({open:!1,state:"idle",error:"",token:"",name:""});async function k(h,b,P){p.value=!0;try{return await Z(h,{method:b,data:P??{}}),c("changed"),!0}catch{return s.add({title:i("common.error"),description:i("calendar_settings.boats.error"),icon:"heroicons:exclamation-triangle",color:"red"}),!1}finally{p.value=!1}}async function f(){const h=S.value.trim();h&&await k("/api/calendar/settings/boats","POST",{name:h})&&(S.value="",s.add({title:i("calendar_settings.boats.created"),icon:"heroicons:check-circle",color:"green"}))}function C(h){g.value=h.token,u.value=h.name}async function M(h){const b=u.value.trim();if(!b||b===h.name){g.value="";return}await k(`/api/calendar/settings/boats/${h.token}`,"PUT",{name:b})&&(g.value="",s.add({title:i("calendar_settings.boats.renamed"),icon:"heroicons:check-circle",color:"green"}))}function y(h){Object.assign(m,{open:!0,state:"idle",error:"",token:h.token,name:h.name})}async function $(){m.state="loading";try{await Z(`/api/calendar/settings/boats/${m.token}`,{method:"DELETE",data:{}}),c("changed"),m.state="success"}catch{m.state="error",m.error=i("calendar_settings.boats.error")}}return(h,b)=>{const P=ie;return a(),n("div",Et,[_(le,null,{default:J(()=>[r.items.length?(a(),n("ul",Dt,[(a(!0),n(O,null,j(r.items,E=>(a(),n("li",{key:E.token,class:"group flex items-center gap-3 px-4 py-3 hover:bg-offwhite"},[_(P,{name:"heroicons:lifebuoy",class:"w-4 h-4 text-gray-300 flex-shrink-0"}),g.value===E.token?(a(),T(ue,{key:0,modelValue:u.value,"onUpdate:modelValue":b[0]||(b[0]=B=>u.value=B),"max-length":80,class:"flex-1 min-w-0",vertical:"","hide-icon":"",onKeyup:[Te(B=>M(E),["enter"]),b[1]||(b[1]=Te(B=>g.value="",["escape"]))]},null,8,["modelValue","onKeyup"])):(a(),n("span",Ft,o(E.name),1)),t("span",Ut,[g.value===E.token?(a(),n(O,{key:0},[t("button",{type:"button",class:"act",disabled:!u.value.trim(),title:e(i)("common.save"),onClick:B=>M(E)},[_(P,{name:"heroicons:check",class:"w-4 h-4"})],8,Tt),t("button",{type:"button",class:"act",title:e(i)("common.cancel"),onClick:b[2]||(b[2]=B=>g.value="")},[_(P,{name:"heroicons:x-mark",class:"w-4 h-4"})],8,Lt)],64)):(a(),n(O,{key:1},[t("button",{type:"button",class:"act lg:opacity-0 lg:group-hover:opacity-100",title:e(i)("common.edit"),onClick:B=>C(E)},[_(P,{name:"heroicons:pencil",class:"w-4 h-4"})],8,Ot),t("button",{type:"button",class:"act danger lg:opacity-0 lg:group-hover:opacity-100",title:e(i)("common.delete"),onClick:B=>y(E)},[_(P,{name:"heroicons:trash",class:"w-4 h-4"})],8,Bt)],64))])]))),128))])):(a(),n("p",It,o(e(i)("calendar_settings.boats.empty")),1)),t("div",Mt,[_(ue,{modelValue:S.value,"onUpdate:modelValue":b[3]||(b[3]=E=>S.value=E),"max-length":80,placeholder:e(i)("calendar_settings.boats.placeholder"),class:"flex-1 min-w-0",vertical:"","hide-icon":"",onKeyup:Te(f,["enter"])},null,8,["modelValue","placeholder"]),_(ee,{text:e(i)("common.add"),icon:"heroicons:plus","icon-position":"left",color:"primary",size:"sm",loading:p.value,disabled:!S.value.trim(),onClick:f},null,8,["text","loading","disabled"])])]),_:1}),t("p",qt,[_(P,{name:"heroicons:information-circle",class:"w-4 h-4 flex-shrink-0 mt-px text-gray-300"}),t("span",null,o(e(i)("calendar_settings.boats.help")),1)]),_(He,{modelValue:m.open,"onUpdate:modelValue":b[4]||(b[4]=E=>m.open=E),state:m.state,"error-message":m.error,type:"danger",title:e(i)("calendar_settings.boats.delete_title"),message:e(i)("calendar_settings.boats.delete_message",{name:m.name}),"confirm-text":e(i)("common.delete"),"success-title":e(i)("calendar_settings.boats.deleted"),"error-title":e(i)("calendar_settings.boats.delete_error"),onConfirm:$},null,8,["modelValue","state","error-message","title","message","confirm-text","success-title","error-title"])])}}}),Ye=me(Pt,[["__scopeId","data-v-5186c5e5"]]),Rt={class:"px-4 py-3"},Nt={key:0,class:"text-xs text-gray-400 leading-relaxed mb-3"},zt={class:"flex items-center gap-2 mb-3"},jt={class:"grid gap-x-4 gap-y-0.5",style:{"grid-template-columns":"repeat(auto-fill, minmax(220px, 1fr))"}},At={key:1,class:"mt-3 text-xs text-gray-400"},Jt=H({__name:"SettingsCheckGrid",props:{draft:{},field:{},entries:{},intro:{},empty:{},query:{}},setup(r){const l=p=>p.toLowerCase().normalize("NFD").replace(/[Ì-ͯ]/g,""),c=r;function i(p){const m=l(c.query?.trim()??"");return!!m&&l(p).includes(m)}const{t:s}=Q(),S=F(()=>c.draft[c.field]??[]);function g(p,m){c.draft[c.field]=m?[...S.value,p]:S.value.filter(k=>k!==p)}function u(p){c.draft[c.field]=p?c.entries.map(m=>m.id):[]}return(p,m)=>(a(),n("div",Rt,[r.intro?(a(),n("p",Nt,o(r.intro),1)):U("",!0),t("div",zt,[t("button",{type:"button",class:"link",onClick:m[0]||(m[0]=k=>u(!0))},o(e(s)("calendar_settings.select_all")),1),m[2]||(m[2]=t("span",{class:"text-gray-200"},"·",-1)),t("button",{type:"button",class:"link",onClick:m[1]||(m[1]=k=>u(!1))},o(e(s)("calendar_settings.select_none")),1)]),t("div",jt,[(a(!0),n(O,null,j(r.entries,k=>(a(),T(We,{key:k.id,"model-value":S.value.includes(k.id),description:k.name,class:te(["py-1.5 rounded-md transition-colors",i(k.name)?"bg-yellow-50 ring-1 ring-yellow-200":""]),"onUpdate:modelValue":f=>g(k.id,f)},null,8,["model-value","description","class","onUpdate:modelValue"]))),128))]),!S.value.length&&r.empty?(a(),n("p",At,o(r.empty),1)):U("",!0)]))}}),Ge=me(Jt,[["__scopeId","data-v-62b3065f"]]),K=r=>({field:r,type:"switch"}),ge=[{id:"display",group:"settings",icon:"heroicons:calendar-days",bg
1:"#DBEAFE",fg:"#1D4ED8",keys:["calendar_view_mode"],cards:[{key:"main",rows:[{field:"calendar_view_mode",type:"select",options:["calendar_all_event","calendar_popup_with_scroll"]}]}]},{id:"event",group:"settings",icon:"heroicons:document-text",bg:"#DCFCE7",fg:"#16A34A",keys:["hide_tariff","hide_registration_disallow","structure","show_material_not_payed","copy_name_from_domain"],cards:[{key:"main",rows:["hide_tariff","hide_registration_disallow","structure","show_material_not_payed","copy_name_from_domain"].map(K)}]},{id:"people",group:"settings",icon:"heroicons:eye",bg:"#E0E7FF",fg:"#4F46E5",premium:!0,keys:["registered_details"]},{id:"signup",group:"settings",icon:"heroicons:user-plus",bg:"#FEF3C7",fg:"#B45309",premium:!0,keys:["role_suggestion_multiple","disabled_default_role","default_role_name","enabled_require_role","autoremove_unregister_role","autoregister_role","disallow_registration_medical_examination","disallow_registration_licence","disallow_payment_waitinglist","notification_autocheck","free_visibility_autocheck","free_registration_autocheck","show_tariff_plan","unpayed_free_visibility","hide_responsibles","show_responsibles_separately","show_licence","reset_status_responsibles","autocancel_partially_paid_cart"],cards:[{key:"roles",rows:[{field:"default_role_name",type:"text"},K("role_suggestion_multiple"),K("disabled_default_role"),K("enabled_require_role"),K("autoremove_unregister_role"),K("autoregister_role")]},{key:"blocking",rows:[K("disallow_registration_medical_examination"),K("disallow_registration_licence")]},{key:"payment",rows:[K("disallow_payment_waitinglist"),K("autocancel_partially_paid_cart")]},{key:"prechecked",rows:[K("notification_autocheck"),K("free_visibility_autocheck"),K("free_registration_autocheck")]},{key:"visibility",rows:[K("show_tariff_plan"),K("unpayed_free_visibility"),K("hide_responsibles"),K("show_responsibles_separately"),K("show_licence"),K("reset_status_responsibles")]}]},{id:"talk",group:"settings",icon:"heroicons:chat-bubble-left-right",bg:"#FCE7F3",fg:"#BE185D",premium:!0,keys:["groupDiscussionFrom","groupDiscussionUntil"]},{id:"export",group:"settings",icon:"heroicons:arrow-down-tray",bg:"#CCFBF1",fg:"#0F766E",keys:["export_fields","show_export_unregister"]},{id:"rights",group:"settings",icon:"heroicons:shield-check",bg:"#FEE2E2",fg:"#B91C1C",premium:!0,keys:["role_responsibles"]},{id:"mail",group:"settings",icon:"heroicons:envelope",bg:"#F1F5F9",fg:"#475569"},{id:"stats",group:"settings",icon:"heroicons:chart-bar",bg:"#EDE9FE",fg:"#6D28D9",premium:!0},{id:"domains",group:"lists",icon:"heroicons:swatch",bg:"#F3E8FF",fg:"#7C3AED",referential:"domains"},{id:"cats",group:"lists",icon:"heroicons:tag",bg:"#FFEDD5",fg:"#C2410C",referential:"activities"},{id:"types",group:"lists",icon:"heroicons:map-pin",bg:"#ECFEFF",fg:"#0E7490",referential:"types"},{id:"roles",group:"lists",icon:"heroicons:user-group",bg:"#EFF6FF",fg:"#1D4ED8",referential:"responsibilities"},{id:"limits",group:"lists",icon:"heroicons:funnel",bg:"#F5F5F4",fg:"#57534E",premium:!0},{id:"boats",group:"lists",icon:"heroicons:lifebuoy",bg:"#F0FDF4",fg:"#15803D"}],Xe={domains:"domains",activities:"activities",types:"types",responsibilities:"responsibilities"};function Kt(r){return ge.find(l=>l.id===r)??null}const he={display:["calendar_view_mode"],event:["hide_tariff","hide_registration_disallow","structure","show_material_not_payed","copy_name_from_domain"],registered:["registered_details"],registrations:["role_suggestion_multiple","disabled_default_role","default_role_name","enabled_require_role","autoremove_unregister_role","autoregister_role","default_roles_selected","disallow_registration_medical_examination","disallow_registration_licence","disallow_payment_waitinglist","autocancel_partially_paid_cart","notification_autocheck","free_visibility_autocheck","free_registration_autocheck","show_tariff_plan","unpayed_free_visibility","hide_responsibles","show_responsibles_separately","show_licence","reset_status_responsibles"],discussion:["groupDiscussionFrom","groupDiscussionUntil"],export:["export_fields","show_export_unregister"],rights:["role_responsibles"]},Ht=[...he.registered,...he.registrations,...he.discussion,"show_export_unregister"],De=[{field:"photo",everyone:!0},{field:"firstname",everyone:!0},{field:"lastname",everyone:!0},{field:"honorability",everyone:!0},{field:"people",everyone:!0},{field:"status",everyone:!0},{field:"capacities",everyone:!0},{field:"prepa",everyone:!0},{field:"comment",everyone:!0},{field:"medical_examination",everyone:!0},{field:"medical_examination_file",everyone:!1},{field:"payment",everyone:!1},{field:"forms",everyone:!1}],Oe=["all","registered","admin"],ze=De.flatMap(r=>Oe.filter(l=>l==="admin"||r.everyone).map(l=>`${r.field}_${l}`));function Wt(r,l){return r===l?!0:typeof r=="object"&&typeof l=="object"&&r!==null&&l!==null?JSON.stringify(r)===JSON.stringify(l):!1}function Yt(){const r=je(),{settings:l}=gt(r),{hasPermission:c}=bt(),i=Ie({}),s=D(!1),S=F(()=>c("is_premium")),g=F(()=>c("calendar_edit")),u=F(()=>Object.values(he).flat());function p($){if($)for(const h of u.value){const b=$[h];i[h]=b!==null&&typeof b=="object"?JSON.parse(JSON.stringify(b)):b}}Ue(l,$=>p($),{immediate:!0});const m=F(()=>u.value.filter($=>
1!Wt(i[$],l.value?.[$]))),k=F(()=>m.value.length>0);function f($){return[...he[$]]}function C($){return!S.value&&Ht.includes($)}function M($){const h=$?f($):u.value,b=l.value;for(const P of h){const E=b?.[P];i[P]=E!==null&&typeof E=="object"?JSON.parse(JSON.stringify(E)):E}}async function y($){const h=$?f($):u.value,b={};for(const P of m.value)h.includes(P)&&!C(P)&&(b[P]=i[P]);if(Object.keys(b).length===0)return[];s.value=!0;try{const P=await Z("/api/calendar/settings",{method:"PUT",data:b});return await r.refreshSettings(),P?.applied??Object.keys(b)}finally{s.value=!1}}return{draft:i,settings:l,dirtyKeys:m,isDirty:k,saving:s,isPremium:S,canEdit:g,isLocked:C,sectionKeys:f,reset:M,save:y}}const Gt={key:0,class:"bg-yellow-100 text-navy-500 rounded-sm px-0.5"},Qe=H({__name:"SettingsMark",props:{text:{},query:{}},setup(r){const l=r,c=s=>s.toLowerCase().normalize("NFD").replace(/[Ì-ͯ]/g,""),i=F(()=>{const s=c(l.query?.trim()??"");if(!s)return[{text:l.text,hit:!1}];const S=c(l.text),g=[];let u=0;for(;;){const p=S.indexOf(s,u);if(p<0)break;p>u&&g.push({text:l.text.slice(u,p),hit:!1}),g.push({text:l.text.slice(p,p+s.length),hit:!0}),u=p+s.length}return g.length?(u<l.text.length&&g.push({text:l.text.slice(u),hit:!1}),g):[{text:l.text,hit:!1}]});return(s,S)=>(a(),n("span",null,[(a(!0),n(O,null,j(e(i),(g,u)=>(a(),n(O,{key:u},[g.hit?(a(),n("mark",Gt,o(g.text),1)):(a(),n(O,{key:1},[xe(o(g.text),1)],64))],64))),128))]))}}),Xt={class:"flex-1 min-w-0"},Qt={class:"block text-sm text-navy-500 leading-snug"},Zt={key:0,class:"block text-xs text-gray-400 leading-snug mt-0.5"},es={class:"flex-shrink-0"},Be=H({__name:"SettingsRow",props:{label:{},help:{},locked:{type:Boolean},query:{}},setup(r){return(l,c)=>(a(),n("div",{class:te(["flex items-start gap-4 px-4 py-3",{"opacity-55":r.locked}])},[t("span",Xt,[t("span",Qt,[_(Qe,{text:r.label,query:r.query},null,8,["text","query"])]),r.help?(a(),n("span",Zt,o(r.help),1)):U("",!0)]),t("span",es,[Le(l.$slots,"default")])],2))}}),ts={class:"grid gap-3.5",style:{"grid-template-columns":"repeat(auto-fit, minmax(320px, 1fr))"}},ss={key:0,class:"text-[10px] font-semibold px-2 py-0.5 rounded-full bg-green-100 text-green-800"},as={class:"divide-y divide-gray-100"},ls=["innerHTML"],ns={class:"px-4 py-4 text-xs text-gray-400 leading-relaxed"},Ze=H({__name:"SettingsDiscussion",props:{draft:{},locked:{type:Boolean}},setup(r){const l=r,c=(()=>{const f=[];for(let C=-1;C>=-120;C--)f.push(C);for(let C=-135;C>=-730;C-=15)f.push(C);return f})(),i=(()=>{const f=[0];for(let C=-60;C<=60;C++)C!==0&&f.push(C);return f})(),{t:s}=Q(),S=F({get:()=>Number(l.draft.groupDiscussionFrom??0),set:f=>{l.draft.groupDiscussionFrom=String(f)}}),g=F({get:()=>Number(l.draft.groupDiscussionUntil??0),set:f=>{l.draft.groupDiscussionUntil=String(f)}}),u=F(()=>{const f=s("calendar_settings.talk.days",{n:Math.abs(S.value)},Math.abs(S.value));if(g.value===0)return s("calendar_settings.talk.sentence_same_day",{opens:`<b>${f}</b>`});const C=s("calendar_settings.talk.days",{n:Math.abs(g.value)},Math.abs(g.value)),M=g.value>0?"calendar_settings.talk.sentence_after":"calendar_settings.talk.sentence_before";return s(M,{opens:`<b>${f}</b>`,closes:`<b>${C}</b>`})}),p=F(()=>c.map(f=>({label:k(f),value:f}))),m=F(()=>i.map(f=>({label:k(f,!0),value:f})));function k(f,C=!1){return f===0?C?s("calendar_settings.talk.same_day"):"J0":`J${f>0?"+":""}${f}`}return(f,C)=>(a(),n("div",ts,[_(le,{title:e(s)("calendar_settings.talk.window")},{badge:J(()=>[r.locked?(a(),n("span",ss,o("VPDIVE+"))):U("",!0)]),default:J(()=>[t("div",as,[_(Be,{label:e(s)("calendar_settings.talk.from"),help:e(s)("calendar_settings.talk.from_help"),locked:r.locked},{default:J(()=>[_(oe,{"model-value":S.value,options:p.value,disabled:r.locked,class:"w-32",vertical:"",teleport:"","onUpdate:modelValue":C[0]||(C[0]=M=>S.value=Number(M))},null,8,["model-value","options","disabled"])]),_:1},8,["label","help","locked"]),_(Be,{label:e(s)("calendar_settings.talk.until"),help:e(s)("calendar_settings.talk.until_help"),locked:r.locked},{default:J(()=>[_(oe,{"model-value":g.value,options:m.value,disabled:r.locked,class:"w-32",vertical:"",teleport:"","onUpdate:modelValue":C[1]||(C[1]=M=>g.value=Number(M))}
1,null,8,["model-value","options","disabled"])]),_:1},8,["label","help","locked"])]),t("p",{class:"mx-4 my-4 px-3 py-2.5 rounded-lg bg-blue-50 text-blue-700 text-xs leading-relaxed",innerHTML:u.value},null,8,ls)]),_:1},8,["title"]),_(le,{title:e(s)("calendar_settings.about")},{default:J(()=>[t("p",ns,o(e(s)("calendar_settings.talk.help")),1)]),_:1},8,["title"])]))}}),os={class:"px-4 py-4"},is={class:"overflow-x-auto -mx-4 px-4"},rs={class:"w-full sm:min-w-[460px] border-collapse"},cs={class:"text-left pb-2 text-xs font-medium text-gray-400"},ds=["disabled","onClick"],us={class:"divide-y divide-gray-100"},ms={class:"py-2.5 pr-2 sm:pr-3 text-sm text-navy-500 leading-snug"},ps={key:0,class:"flex justify-center"},gs={key:1,class:"text-gray-200"},_s={class:"mt-3 text-xs text-gray-400 leading-relaxed"},et=H({__name:"SettingsMatrix",props:{draft:{},locked:{type:Boolean},query:{}},setup(r){const l=r,{t:c}=Q();function i(){return l.draft.registered_details??{}}function s(u,p){return!!i()[`${u}_${p}`]}function S(u,p,m){l.draft.registered_details={...i(),[`${u}_${p}`]:m}}function g(u){const p=De.filter(f=>u==="admin"||f.everyone),m=p.every(f=>s(f.field,u)),k={...i()};for(const f of p)k[`${f.field}_${u}`]=!m;l.draft.registered_details=k}return(u,p)=>(a(),n("div",os,[t("div",is,[t("table",rs,[t("thead",null,[t("tr",null,[t("th",cs,o(e(c)("calendar_settings.people.field")),1),(a(!0),n(O,null,j(e(Oe),m=>(a(),n("th",{key:m,class:"pb-2 w-[54px] sm:w-24"},[t("button",{type:"button",class:"text-[10px] sm:text-xs font-medium leading-tight text-gray-400 hover:text-primary transition-colors disabled:hover:text-gray-400",disabled:r.locked,onClick:k=>g(m)},o(e(c)(`calendar_settings.people.col_${m}`)),9,ds)]))),128))])]),t("tbody",us,[(a(!0),n(O,null,j(e(De),m=>(a(),n("tr",{key:m.field},[t("td",ms,[_(Qe,{text:e(c)(`calendar_settings.people.${m.field}`),query:r.query},null,8,["text","query"])]),(a(!0),n(O,null,j(e(Oe),k=>(a(),n("td",{key:k,class:"py-2.5 text-center"},[k==="admin"||m.everyone?(a(),n("div",ps,[_(Ee,{"model-value":s(m.field,k),disabled:r.locked,"onUpdate:modelValue":f=>S(m.field,k,f)},null,8,["model-value","disabled","onUpdate:modelValue"])])):(a(),n("span",gs,"â"))]))),128))]))),128))])])]),t("p",_s,o(e(c)("calendar_settings.people.help")),1)]))}}),fs={class:"flex flex-col gap-7"},hs={class:"flex flex-col gap-2.5"},xs={class:"px-0.5 text-[11px] font-bold uppercase tracking-wide text-gray-300"},vs={class:"bg-white rounded-lg shadow-sm"},ys={class:"px-4 pt-4 pb-3.5 flex flex-col gap-3.5"},bs={class:"flex flex-wrap gap-1.5"},ks=["onClick"],$s={class:"grid gap-3",style:{"grid-template-columns":"repeat(auto-fit, minmax(230px, 340px))"}},ws={class:"px-4 py-3.5 border-t border-gray-100 flex flex-wrap items-center gap-x-4 gap-y-3"},Cs={class:"flex-1 min-w-0 flex flex-col gap-0.5"},Vs={class:"text-sm font-semibold text-navy-500 tabular-nums"},Ss={class:"text-xs text-gray-400"},Es={class:"flex flex-col gap-2.5"},Ds={class:"px-0.5 text-[11px] font-bold uppercase tracking-wide text-gray-300"},Fs={class:"grid gap-3.5",style:{"grid-template-columns":"repeat(auto-fit, minmax(280px, 1fr))"}},Us={class:"bg-white rounded-lg shadow-sm p-4 flex items-start gap-3"},Ts={class:"w-9 h-9 shrink-0 grid place-items-center rounded-lg bg-offwhite text-navy-500"},Ls={class:"flex-1 min-w-0 flex flex-col gap-1"},Os={class:"text-sm font-semibold text-navy-500"},Bs={class:"text-xs text-gray-400 leading-relaxed"},Is={class:"text-xs text-gray-300"},Ms={class:"bg-white rounded-lg shadow-sm p-4 flex items-start gap-3"},qs={class:"w-9 h-9 shrink-0 grid place-items-center rounded-lg bg-offwhite text-navy-500"},Ps={class:"flex-1 min-w-0 flex flex-col gap-1"},Rs={class:"text-sm font-semibold text-navy-500"},Ns={class:"text-xs text-gray-400 leading-relaxed"},tt=H({__name:"SettingsStatsExport",props:{catalog:{},locked:{type:Boolean}},setup(r){const l=r,c={bg:"#EDE9FE",fg:"#6D28D9"},{t:i,locale:s}=Q(),S=ve(),g=D(""),u=D(""),p=D(null),m=D(!1),k=D(!1),f=l.catalog.activity_range?.first??"2000-01-01",C=l.catalog.activity_range?.last??"2100-12-31",M=new Date().getFullYear(),y=F(()=>l.catalog.season_start??0),$=F(()=>y.value>=1&&y.value<=12),h=F(()=>$.value?new Date(2e3,y.value-1,1).toLocaleDateString(s.value,{month:"long"}):i("calendar_settings.stats.season_civil")),b=F(()=>!g.value&&!u.value?i("calendar_settings.stats.count_all"):!g.value||!u.value?i("calendar_settings.stats.count_unknown"):i("calendar_settings.stats.between",{from:W
1(g.value),to:W(u.value)}));function P(q,A=y.value){const N=new Date,L=N.getMonth()+1>=A?N.getFullYear()+q:N.getFullYear()-1+q;return{from:ne(new Date(L,A-1,1)),to:ne(new Date(L+1,A-1,0))}}const E=F(()=>[...$.value?[{key:"season",...P(0)},{key:"last_season",...P(-1)}]:[],{key:"year",from:`${M}-01-01`,to:`${M}-12-31`},{key:"last_year",from:`${M-1}-01-01`,to:`${M-1}-12-31`},{key:"twelve",from:ne(new Date(Date.now()-365*864e5)),to:ne(new Date)},{key:"all",from:f,to:C}]),B=F(()=>{if(!$.value)return i("calendar_settings.stats.season_hint_civil");const{from:q,to:A}=P(0);return i("calendar_settings.stats.season_hint",{from:W(q),to:W(A)})});function W(q){return new Date(`${q}T00:00:00`).toLocaleDateString(s.value,{day:"numeric",month:"long",year:"numeric"})}const re=F(()=>E.value.find(q=>q.from===g.value&&q.to===u.value)?.key);function ne(q){return`${q.getFullYear()}-${String(q.getMonth()+1).padStart(2,"0")}-${String(q.getDate()).padStart(2,"0")}`}function pe(q){g.value=q.from,u.value=q.to}let X=0;Ue([g,u],async()=>{if(!g.value&&!u.value){p.value=null;return}const q=++X;m.value=!0;try{const A=u.value||C,N=new Date(`${A}T00:00:00`);N.setDate(N.getDate()+1);const L=await Z(`/api/calendar/events_refresh/${g.value||f}/${ne(N)}/0`);if(q!==X)return;const v=L?.data??L;p.value=Array.isArray(v)?v.length:null}catch{q===X&&(p.value=null)}finally{q===X&&(m.value=!1)}},{immediate:!1});async function se(){k.value=!0;try{const q=new URLSearchParams;g.value&&q.set("fromDate",g.value),u.value&&q.set("toDate",u.value);const A=await Z(`/api/calendar/settings/export?${q}`,{responseType:"blob"}),N=URL.createObjectURL(A),L=document.createElement("a");L.href=N,L.download=ae(),L.click(),URL.revokeObjectURL(N)}catch{S.add({title:i("common.error"),description:i("calendar_settings.stats.download_error"),icon:"heroicons:exclamation-triangle",color:"red"})}finally{k.value=!1}}function ae(){return`activites${g.value&&u.value?`_${g.value}_${u.value}`:""}.xlsx`}return(q,A)=>{const N=ie;return a(),n("div",fs,[t("section",hs,[t("p",xs,o(e(i)("calendar_settings.stats.period")),1),t("div",vs,[t("div",ys,[t("div",bs,[(a(!0),n(O,null,j(E.value,L=>(a(),n("button",{key:L.key,type:"button",class:te(["rounded-full px-3 py-1 text-xs font-medium transition-colors",re.value===L.key?"bg-navy-500 text-white":"bg-offwhite text-gray-500 hover:bg-gray-100"]),onClick:v=>pe(L)},o(e(i)(`calendar_settings.stats.preset_${L.key}`)),11,ks))),128))]),t("div",$s,[_(ue,{modelValue:g.value,"onUpdate:modelValue":A[0]||(A[0]=L=>g.value=L),type:"date",label:e(i)("calendar_settings.stats.from")},null,8,["modelValue","label"]),_(ue,{modelValue:u.value,"onUpdate:modelValue":A[1]||(A[1]=L=>u.value=L),type:"date",label:e(i)("calendar_settings.stats.to")},null,8,["modelValue","label"])])]),t("div",ws,[t("span",{class:"w-9 h-9 shrink-0 grid place-items-center rounded-lg",style:de({backgroundColor:c.bg,color:c.fg})},[_(N,{name:m.value?"heroicons:arrow-path":"heroicons:chart-bar",class:te(["w-5 h-5",{"animate-spin":m.value}])},null,8,["name","class"])],4),t("span",Cs,[t("b",Vs,[m.value?(a(),n(O,{key:0},[xe(o(e(i)("calendar_settings.stats.counting_short")),1)],64)):(a(),n(O,{key:1},[xe(o(e(i)("calendar_settings.stats.activities",{n:p.value??0},p.value??0)),1)],64))]),t("span",Ss,o(b.value),1)]),_(ee,{text:e(i)("calendar_settings.stats.download"),icon:"heroicons:arrow-down-tray","icon-position":"left",color:"success",size:"sm",class:"shrink-0 w-full sm:w-auto",loading:k.value,disabled:r.locked||k.value||p.value===0,onClick:se},null,8,["text","loading","disabled"])])])]),t("section",Es,[t("p",Ds,o(e(i)("calendar_settings.about")),1),t("div",Fs,[t("div",Us,[t("span",Ts,[_(N,{name:"heroicons:calendar-days",class:"w-5 h-5"})]),t("span",Ls,[t("b",Os,o(e(i)("calendar_settings.stats.season"))+" · "+o(h.value),1),t("span",Bs,o(B.value),1),t("span",Is,o(e(i)("calendar_settings.stats.season_where")),1)])]),t("div",Ms,[t("span",qs,[_(N,{name:"heroicons:table-cells",class:"w-5 h-5"})]),t("span",Ps,[t("b",Rs,o(e(i)("calendar_settings.stats.file")),1),t("span",Ns,o(e(i)("calendar_settings.stats.why")),1)])])])])])}}}),zs={key:0,class:"text-[10px] font-semibold px-2 py-0.5 rounded-full bg-green-100 text-green-800"},js={class:"divide-y divide-gray-100"},Fe=H({__name:"SettingsToggleList",props:{section:{},rows:{},draft:{},title:{},locked:{type:Boolean},query:{}},setup(r){const l=r,{t:c,te:i}=Q();
1function s(g){return(g.options??[]).map(u=>({label:c(`calendar_settings.display.${u}`),value:u}))}function S(g){const u=`calendar_settings.${l.section}.${g}_help`;return i(u)?c(u):void 0}return(g,u)=>(a(),T(le,{title:r.title},{badge:J(()=>[r.locked?(a(),n("span",zs,o("VPDIVE+"))):U("",!0)]),default:J(()=>[t("div",js,[(a(!0),n(O,null,j(r.rows,p=>(a(),T(Be,{key:p.field,label:e(c)(`calendar_settings.${r.section}.${p.field}`),help:S(p.field),locked:r.locked,query:r.query},{default:J(()=>[p.type==="switch"?(a(),T(Ee,{key:0,"model-value":!!r.draft[p.field],disabled:r.locked,"onUpdate:modelValue":m=>r.draft[p.field]=m},null,8,["model-value","disabled","onUpdate:modelValue"])):p.type==="select"?(a(),T(oe,{key:1,"model-value":String(r.draft[p.field]??""),options:s(p),disabled:r.locked,class:"w-[240px]",vertical:"",teleport:"","onUpdate:modelValue":m=>r.draft[p.field]=m||null},null,8,["model-value","options","disabled","onUpdate:modelValue"])):(a(),T(ue,{key:2,"model-value":String(r.draft[p.field]??""),"max-length":60,placeholder:"Plongeur",disabled:r.locked,class:"w-44",vertical:"","hide-icon":"","onUpdate:modelValue":m=>r.draft[p.field]=m||null},null,8,["model-value","disabled","onUpdate:modelValue"]))]),_:2},1032,["label","help","locked","query"]))),128))])]),_:1},8,["title"]))}}),As={class:"grid gap-3.5 items-start",style:{"grid-template-columns":"repeat(auto-fit, minmax(320px, 1fr))"}},Js={class:"p-4 flex flex-col gap-2.5"},Ks=["aria-checked","onClick"],Hs={class:"flex items-center gap-2.5"},Ws={key:0,class:"w-2 h-2 rounded-full bg-primary"},Ys={class:"text-sm font-semibold text-navy-500"},Gs={class:"block mt-2 pl-6.5 text-xs text-gray-500 leading-relaxed"},Xs={class:"flex flex-col gap-1 mt-2.5 pl-6.5"},Qs={class:"flex items-start gap-1.5 text-xs text-green-700"},Zs={class:"flex items-start gap-1.5 text-xs text-gray-400"},ea={key:0,class:"px-3 py-2.5 rounded-lg bg-blue-50 text-blue-700 text-xs leading-relaxed"},ta={class:"px-4 py-4 text-xs text-gray-400 leading-relaxed"},sa=H({__name:"SettingsViewMode",props:{draft:{}},setup(r){const l=r,c=["calendar_all_event","calendar_popup_with_scroll"],{t:i}=Q(),s=F({get:()=>l.draft.calendar_view_mode??"",set:S=>{l.draft.calendar_view_mode=S||null}});return(S,g)=>{const u=ie;return a(),n("div",As,[_(le,{title:e(i)("calendar_settings.display.calendar_view_mode")},{default:J(()=>[t("div",Js,[(a(),n(O,null,j(c,p=>t("button",{key:p,type:"button",class:te(["text-left rounded-lg border p-3.5 transition-colors",s.value===p?"border-primary bg-blue-50/60":"border-gray-100 hover:bg-offwhite"]),role:"radio","aria-checked":s.value===p,onClick:m=>s.value=p},[t("span",Hs,[t("span",{class:te(["w-4 h-4 rounded-full border-2 flex-shrink-0 grid place-items-center",s.value===p?"border-primary":"border-gray-200"])},[s.value===p?(a(),n("span",Ws)):U("",!0)],2),t("b",Ys,o(e(i)(`calendar_settings.display.${p}`)),1)]),t("span",Gs,o(e(i)(`calendar_settings.display.${p}_what`)),1),t("span",Xs,[t("span",Qs,[_(u,{name:"heroicons:plus-circle",class:"w-3.5 h-3.5 mt-px flex-shrink-0"}),xe(" "+o(e(i)(`calendar_settings.display.${p}_pro`)),1)]),t("span",Zs,[_(u,{name:"heroicons:minus-circle",class:"w-3.5 h-3.5 mt-px flex-shrink-0"}),xe(" "+o(e(i)(`calendar_settings.display.${p}_con`)),1)])])],10,Ks)),64)),s.value?U("",!0):(a(),n("p",ea,o(e(i)("calendar_settings.display.unset_help")),1))])]),_:1},8,["title"]),_(le,{title:e(i)("calendar_settings.about")},{default:J(()=>[t("p",ta,o(e(i)("calendar_settings.display.scope")),1)]),_:1},8,["title"])])}}}),st=me(sa,[["__scopeId","data-v-666fd9cc"]]),aa={class:"flex flex-col gap-4"},la=["onClick"],na={class:"flex-1 min-w-0 truncate"},oa={key:0,class:"text-[9px] font-bold px-1.5 py-0.5 rounded-full bg-green-100 text-green-800 flex-shrink-0"},ia={key:1,class:"text-[11px] font-semibold tabular-nums text-gray-300"},ra={class:"flex-1 min-w-0 flex flex-col gap-3.5"},ca={key:0,class:"bg-white rounded-lg shadow-sm px-4 py-3.5 sm:px-5 sm:py-4"},da={class:"text-base font-semibold text-navy-500"},ua={class:"text-xs text-gray-400 mt-0.5 mb-3 sm:mb-3.5"},ma={class:"grid gap-2.5",style:{"grid-template-columns":"repeat(auto-fill, minmax(160px, 1fr))"}},pa={class:"flex-1 min-w-0 flex flex-col gap-0.5 sm:w-full sm:items-center sm:gap-2"},ga={class:"text-xs font-semibold text-navy-500 leading-tight"},_a={class:"flex items-center gap-2 sm:flex-col"},fa={class:"text-[11px] text-gray-400 tabular-nums"},ha={key:0,class:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full bg-green-100 text-green-800"},xa={key:0,class:"flex flex-col gap-0.5 w-full pt-2 mt-1 border-t border-gray-50"},va={key:0,class:"text-[11px] text-gray-300"},ya=["id"],ba=["onClick"],ka={class:"flex-1 min-w-0"},$a={class:"flex items-center gap-2"},wa={class:"text-base font-semibold text-navy-500"},Ca={key:0,class:"text-[10px] font-semibold px-2 py-0.5 rounded-full bg-green-100 text-green-800"},Va={class:"block text-xs text-gray-400 mt-0.5"},Sa={class:"px-4 pb-4 sm:px-5 sm:pb-5"},Ea={key:6,class:"flex flex-col gap-3.5"},Da={key:1,class:"bg-white rounded-lg shadow-sm px-4 py-8 text-center text-sm text-gray-400"},Fa={class:"flex flex-col -mx-2"},Ua=["onClick"],Ta={class:"flex-1 min-w-0 truncate"},La={key:0,class:"text-[9px] font-bold px-1.5 py-0.5 rounded-full bg-green-100 text-green-800 flex-shrink-0"},Oa={key:1,class:"text-[11px] font-semibold tabular-nums text-gray-300"},Ba={key:0,class:"px-2.5 pt-3 pb-1 text-[11px] font-bold uppercase tracking-wide text-gray-300"},Ia={class:"flex-1 min-w-0 truncate"},Ma={key:0,class:"text-[9px] font-bold px-1.5 py-0.5 rounded-full bg-green-100 text-green-800 flex-shrink-0"},qa={key:1,class:"text-[11px] font-semibold tabular-nums text-gray-300"},Pa=H({__name:"SettingsDashboard",props:{draft:{},catalog:{},premium:{type:Boolean},search:{},editableOnly:{type:Boolean},sommaire:{type:Boolean}},emits:["refresh","counts","update:sommaire"],setup(r,{emit:l}){const c=r,i=l,{t:s,te:S}=Q(),g=D(null),u=D("auto"),p=D("1rem");function m(){const d=g.value?.getBoundingClientRect();if(!d||!window.matchMedia("(min-width: 1024px)").matches)return;const w=document.querySelector(".chrome")?.getBoundingClientRect(),R=w?Math.round(w.bottom)+20:20;u.value=`${Math.round(d.left)}px`,p.value=`${Math.max(R,Math.round(d.top))}px`}const k=D(!1);let f=null;function C(d){k.value=d.matches}Ve(()=>{m(),window.addEventListener("resize",m),window.addEventListener("scroll",m,{passive:!0}),f=window.matchMedia("(max-width: 767px)"),C(f),f.addEventListener("change",C)}),Ae(()=>{window.removeEventListener("resize",m),window.removeEventListener("scroll",m),f?.removeEventListener("change",C)});const M=F(()=>c.search??""),y=F(()=>!!c.editableOnly),$=D({}),h=d=>d.toLowerCase().normalize("NFD").replace(/[Ì-ͯ]/g,""),b=["display","event","people","signup","talk","export","rights","stats","boats"],P=F(()=>b.map(d=>ge.find(w=>
1w.id===d)).filter(Boolean)),E=F(()=>ge.filter(d=>!b.includes(d.id)));function B(d){return d==="export"?c.catalog.export_fields:c.catalog.responsible_rights}function W(d){return(d.cards??[]).flatMap(w=>w.rows)}function re(d){const w=c.draft[d.field];return d.type==="switch"?!!w:!!(w??"")}function ne(d,w){const R=`calendar_settings.${d.id}.${w.field}_help`;return`${s(`calendar_settings.${d.id}.${w.field}`)} ${S(R)?s(R):""}`}function pe(d){return d.id==="export"?c.catalog.export_fields.map(w=>w.name):d.id==="rights"?c.catalog.responsible_rights.map(w=>w.name):d.id==="people"?De.map(w=>s(`calendar_settings.people.${w.field}`)):d.id==="boats"?(c.catalog.boats??[]).map(w=>w.name):d.referential?c.catalog[d.referential].map(w=>w.name):W(d).map(w=>ne(d,w))}function X(d){const w=h(M.value.trim());return w?pe(d).filter(R=>h(R).includes(w)):[]}function se(d){return W(d).length||pe(d).length}function ae(d){if(d.id==="people"){const R=c.draft.registered_details??{};return`${ze.filter(ce=>R[ce]).length} / ${ze.length} ${s("calendar_settings.dash.visible")}`}if(d.id==="export"||d.id==="rights"){const R=d.id==="export"?"export_fields":"role_responsibles";return`${(c.draft[R]??[]).length} / ${B(d.id).length} ${s(`calendar_settings.dash.${d.id}`)}`}if(d.id==="display"){const R=c.draft.calendar_view_mode;return s(R?`calendar_settings.display.${R}`:"calendar_settings.display.unset")}if(d.id==="talk"){const R=Number(c.draft.groupDiscussionUntil);return`J${c.draft.groupDiscussionFrom} â J${R>0?"+":""}${R}`}if(d.id==="boats")return`${c.catalog.boats?.length??0} ${s("calendar_settings.dash.boats")}`;if(d.id==="stats")return s("calendar_settings.dash.stats");const w=W(d).filter(R=>R.type==="switch");return`${w.filter(re).length} / ${w.length} ${s("calendar_settings.dash.enabled")}`}function q(d){if(d.referential){const w=c.catalog[d.referential];return`${w.filter(R=>R.active).length} / ${w.length}`}return d.id==="limits"?String(c.catalog.limitations?.length??0):s("calendar_settings.dash.template")}function A(d){return y.value&&d.premium&&!c.premium?!1:!M.value.trim()||X(d).length>0}const N=F(()=>P.value.filter(A).map(d=>({id:d.id,title:s(`calendar_settings.sections.${d.id}.title`),summary:ae(d),premium:!!d.premium,locked:!!d.premium&&!c.premium,cards:d.cards??[]}))),L=F(()=>E.value.filter(d=>!y.value||!d.premium||c.premium)),v=F(()=>[...P.value.filter(A).map(d=>({id:d.id,icon:d.icon,label:s(`calendar_settings.sections.${d.id}.title`),count:se(d),dim:!!d.premium&&!c.premium}))]),ye=F(()=>ge.reduce((d,w)=>d+se(w),0)),be=F(()=>N.value.map(d=>ge.find(w=>w.id===d.id)).reduce((d,w)=>d+Math.max(1,X(w).length),0)+L.value.reduce((d,w)=>d+X(w).length,0)),ke=F(()=>ge.filter(d=>!d.premium||c.premium).length);Ue([be,ye,ke],([d,w,R])=>i("counts",{shown:d,total:w,editable:R}),{immediate:!0});function _e(d){return M.value.trim()?!0:$.value[d]??!k.value}function $e(d){$.value[d]=!_e(d)}function fe(){i("update:sommaire",!1)}function we(d){$.value[d]=!0,fe(),Ke(()=>document.getElementById(`sec-${d}`)?.scrollIntoView({behavior:"smooth",block:"start"}))}return(d,w)=>{const R=ie,ce=_t;return a(),n("div",aa,[t("div",{ref_key:"columns",ref:g,class:"flex gap-5 items-start"},[w[2]||(w[2]=t("div",{class:"hidden lg:block w-56 flex-shrink-0","aria-hidden":"true"},null,-1)),t("aside",{class:"rail hidden lg:flex w-56 flex-col gap-0.5 bg-white rounded-lg shadow-sm p-2 max-h-[calc(100vh-2rem)] overflow-y-auto",style:de({left:e(u),top:e(p)})},[(a(!0),n(O,null,j(e(v),x=>(a(),n("button",{key:x.id,type:"button",class:"flex items-center gap-2.5 px-2.5 py-2 rounded-md text-sm text-left text-gray-400 hover:bg-offwhite hover:text-navy-500 transition-colors",onClick:Y=>we(x.id)},[_(R,{name:x.icon,class:"w-4 h-4 flex-shrink-0"},null,8,["name"]),t("span",na,o(x.label),1),x.dim?(a(),n("span",oa,o("VPDIVE+"))):(a(),n("span",ia,o(x.count),1))],8,la))),128))],4),t("div",ra,[e(L).length?(a(),n("section",ca,[t("p",da,o(e(s)("calendar_settings.search.elsewhere")),1),t("p",ua,o(e(s)("calendar_settings.search.elsewhere_desc")),1),t("div",ma,[(a(!0),n(O,null,j(e(L),x=>(a(),T(ce,{key:x.id,to:`/app/calendar/settings/${x.id}`,class:"flex items-center gap-3 px-3 py-2.5 rounded-lg border border-gray-50 hover:border-primary transition-colors sm:flex-col sm:justify-center sm:gap-2 sm:py-4 sm:text-center"},{default:J(()=>[t("span",{class:"w-9 h-9 flex-shrink-0 rounded-lg grid place-items-center",style:de({backgroundColor:x.bg,color:x.fg})},[_(R,{name:x.icon,class:"w-5 h-5"},null,8,["name"])],4),t("span",pa,[t("span",ga,o(e(s)(`calendar_settings.sections.${x.id}.title`)),1),t("span",_a,[t("span",fa,o(q(x)),1),x.premium&&!r.premium?(a(),n("span",ha,o("VPDIVE+"))):U("",!0)]),X(x).length?(a(),n("span",xa,[(a(!0),n(O,null,j(X(x).slice(0,3),Y=>(a(),n("span",{key:Y,class:"text-[11px] text-gray-400 truncate"},o(Y),1))),128)),X(x).length>3?(a(),n("span",va,o(e(s)("calendar_settings.search.more",{n:X(x).length-3})),1)):U("",!0)])):U("",!0)]),_(R,{name:"heroicons:chevron-right",class:"w-4 h-4 text-gray-200 flex-shrink-0 sm:hidden"})]),_:2},1032,["to"]))),128))])])):U("",!0),(a(!0),n(O,null,j(e(N),x=>(a(),n("section",{id:`sec-${x.id}`,key:x.id,class:"bg-white rounded-lg shadow-sm ancre"},[t("button",{type:"button",class:"w-full flex items-start gap-3 text-left px-4 py-3.5 sm:px-5 sm:py-4",onClick:Y=>$e(x.id)},[t("span",ka,[t("span",$a,[t("span",wa,o(x.title),1),x.premium&&!r.premium?(a(),n("span",Ca,o("VPDIVE+"))):U("",!0)]),t("span",Va,o(x.summary),1)]),_(R,{name:"heroicons:chevron-down",class:te(["w-5 h-5 text-gray-300 flex-shrink-0 transition-transform mt-0.5",_e(x.id)?"rotate-180":""])},null,8,["class"])],8,ba),Je(t("div",Sa,[x.id==="display"?(a(),T(st,{key:0,draft:r.draft},null,8,["draft"])):x.id==="people"?(a(),T(et,{key:1,draft:r.draft,locked:x.locked,query:e(M)}
1,null,8,["draft","locked","query"])):x.id==="talk"?(a(),T(Ze,{key:2,draft:r.draft,locked:x.locked},null,8,["draft","locked"])):x.id==="stats"?(a(),T(tt,{key:3,catalog:r.catalog,locked:x.locked},null,8,["catalog","locked"])):x.id==="boats"?(a(),T(Ye,{key:4,items:r.catalog.boats,onChanged:w[0]||(w[0]=Y=>i("refresh"))},null,8,["items"])):x.id==="export"||x.id==="rights"?(a(),n(O,{key:5},[_(Ge,{draft:r.draft,field:x.id==="export"?"export_fields":"role_responsibles",entries:B(x.id),query:e(M),intro:e(s)(`calendar_settings.${x.id}.intro`),empty:x.id==="rights"?e(s)("calendar_settings.rights.empty"):void 0},null,8,["draft","field","entries","query","intro","empty"]),x.id==="export"?(a(),T(Fe,{key:0,class:"mt-3.5",section:"export",rows:[{field:"show_export_unregister",type:"switch"}],draft:r.draft},null,8,["draft"])):U("",!0)],64)):(a(),n("div",Ea,[(a(!0),n(O,null,j(x.cards,Y=>(a(),T(Fe,{key:Y.key,section:x.id,rows:Y.rows,draft:r.draft,locked:x.locked,query:e(M),title:x.cards.length>1?e(s)(`calendar_settings.${x.id}.${Y.key}`):void 0},null,8,["section","rows","draft","locked","query","title"]))),128))]))],512),[[ft,_e(x.id)]])],8,ya))),128)),!e(N).length&&!e(L).length?(a(),n("p",Da,o(e(s)("calendar_settings.search.empty",{q:e(M)})),1)):U("",!0)])],512),_(Me,{"model-value":!!r.sommaire,size:"md",title:e(s)("calendar_settings.sommaire"),"onUpdate:modelValue":w[1]||(w[1]=x=>i("update:sommaire",x)),onClose:fe},{default:J(()=>[t("div",Fa,[(a(!0),n(O,null,j(e(v),x=>(a(),n("button",{key:x.id,type:"button",class:"w-full flex items-center gap-2.5 px-2.5 py-2.5 rounded-md text-sm text-left text-gray-500 hover:bg-offwhite",onClick:Y=>we(x.id)},[_(R,{name:x.icon,class:"w-4 h-4 flex-shrink-0 text-gray-300"},null,8,["name"]),t("span",Ta,o(x.label),1),x.dim?(a(),n("span",La,o("VPDIVE+"))):(a(),n("span",Oa,o(x.count),1))],8,Ua))),128)),e(L).length?(a(),n("p",Ba,o(e(s)("calendar_settings.search.elsewhere")),1)):U("",!0),(a(!0),n(O,null,j(e(L),x=>(a(),T(ce,{key:x.id,to:`/app/calendar/settings/${x.id}`,class:"w-full flex items-center gap-2.5 px-2.5 py-2.5 rounded-md text-sm text-gray-500 hover:bg-offwhite",onClick:fe},{default:J(()=>[_(R,{name:x.icon,class:"w-4 h-4 flex-shrink-0 text-gray-300"},null,8,["name"]),t("span",Ia,o(e(s)(`calendar_settings.sections.${x.id}.title`)),1),x.premium&&!r.premium?(a(),n("span",Ma,o("VPDIVE+"))):(a(),n("span",qa,o(q(x)),1))]),_:2},1032,["to"]))),128))])]),_:1},8,["model-value","title"])])}}}),Ra=me(Pa,[["__scopeId","data-v-892fe9c3"]]),Na={class:"flex flex-col gap-4"},za={class:"text-xs text-gray-400 leading-relaxed"},ja={class:"px-3 py-2.5 rounded-lg bg-orange-50 text-orange-700 text-xs leading-relaxed"},Aa={key:0,class:"flex gap-1 p-1 rounded-lg bg-gray-50"},Ja=["onClick"],Ka={key:1,class:"flex flex-col gap-1.5"},Ha={class:"text-xs font-semibold text-gray-400"},Wa={key:3,class:"px-3 py-2.5 rounded-lg bg-gray-50 text-xs text-gray-400 leading-relaxed"},Ya={class:"flex gap-2 justify-end"},Ga=H({__name:"SettingsLimitationForm",props:{catalog:{},item:{}},emits:["close","saved"],setup(r,{emit:l}){const c=r,i=l,{t:s}=Q(),S=ve(),g=D(!1),u=D(c.item?.user_id?String(c.item.user_id):null),p=D(c.item?.location_id??null),m=D(c.item?.scope??"user"),k=D([...c.item?.domain_ids??[]]),f=D([...c.item?.activity_ids??[]]),C=D([...c.item?.type_ids??[]]),M=F(()=>s(c.item?"calendar_settings.limits.edit":"calendar_settings.limits.new")),y=F(()=>!k.value.length&&!f.value.length&&!C.value.length),$=F(()=>!!(m.value==="user"?u.value:p.value)&&!y.value);function h(P){return c.catalog[P].filter(E=>E.active).map(E=>({label:E.name,value:E.id}))}async function b(){g.value=!0;try{await Z(c.item?`/api/calendar/limitations/${c.item.token}`:"/api/calendar/limitations",{method:c.item?"PUT":"POST",data:{type:m.value,...m.value==="user"?{user:[u.value]}:{location:[p.value]},calendar_domain:k.value,calendar_activity:f.value,calendar_type:C.value}}),i("saved")}catch{S.add({title:s("common.error"),description:s("calendar_settings.limits.error"),icon:"heroicons:exclamation-triangle",color:"red"})}finally{g.value=!1}}return(P,E)=>(a(),T(Me,{"model-value":!0,size:"lg",title:M.value,"onUpdate:modelValue":E[6]||(E[6]=B=>i("close")),onClose:E[7]||(E[7]=B=>i("close"))},{footer:J(()=>[t("div",Ya,[_(ee,{text:e(s)("common.cancel"),color:"secondary",size:"sm",disabled:g.value,onClick:E[5]||(E[5]=B=>i("close"))},null,8,["text","disabled"]),_(ee,{text:e(s)("common.save"),color:"primary",size:"sm",loading:g.value,disabled:!$.value,onClick:b},null,8,["text","loading","disabled"])])]),default:J(()=>[t("div",Na,[t("p",za,o(e(s)("calendar_settings.limits.help")),1),t("p",ja,o(e(s)("calendar_settings.limits.whitelist")),1),r.catalog.is_organ?(a(),n("div",Aa,[(a(),n(O,null,j(["user","location"],B=>t("button",{key:B,type:"button",class:te(["flex-1 py-1.5 px-2 rounded-md text-sm font-medium transition-colors",m.value===B?"bg-white text-navy-500 shadow-sm font-semibold":"text-gray-500 hover:text-gray-700"]),onClick:W=>m.value=B},o(e(s)(`calendar_settings.limits.${B}`)),11,Ja)),64))])):U("",!0),m.value==="user"?(a(),n("div",Ka,[t("span",Ha,o(e(s)("calendar_settings.limits.member")),1),_(kt,{modelValue:u.value,"onUpdate:modelValue":E[0]||(E[0]=B=>u.value=B),"initial-name":r.item?.scope==="user"?r.item?.target:void 0,placeholder:e(s)("calendar_settings.limits.member_placeholder")},null,8,["modelValue","initial-name","placeholder"])])):(a(),T(oe,{key:2,modelValue:p.value,"onUpdate:modelValue":E[1]||(E[1]=B=>
1p.value=B),options:r.catalog.locations.map(B=>({label:B.name,value:B.id})),label:e(s)("calendar_settings.limits.location"),placeholder:e(s)("calendar_settings.limits.location_placeholder"),"can-search":"",clearable:"",vertical:""},null,8,["modelValue","options","label","placeholder"])),_(oe,{modelValue:k.value,"onUpdate:modelValue":E[2]||(E[2]=B=>k.value=B),options:h("domains"),label:e(s)("calendar_settings.sections.domains.title"),placeholder:e(s)("calendar_settings.limits.none"),multiple:"","can-search":"",clearable:"",vertical:""},null,8,["modelValue","options","label","placeholder"]),_(oe,{modelValue:f.value,"onUpdate:modelValue":E[3]||(E[3]=B=>f.value=B),options:h("activities"),label:e(s)("calendar_settings.sections.cats.title"),placeholder:e(s)("calendar_settings.limits.none"),multiple:"","can-search":"",clearable:"",vertical:""},null,8,["modelValue","options","label","placeholder"]),_(oe,{modelValue:C.value,"onUpdate:modelValue":E[4]||(E[4]=B=>C.value=B),options:h("types"),label:e(s)("calendar_settings.sections.types.title"),placeholder:e(s)("calendar_settings.limits.none"),multiple:"","can-search":"",clearable:"",vertical:""},null,8,["modelValue","options","label","placeholder"]),y.value?(a(),n("p",Wa,o(e(s)("calendar_settings.limits.pick_one")),1)):U("",!0)])]),_:1},8,["title"]))}}),Xa={class:"px-4 py-3.5 text-xs text-gray-400 leading-relaxed border-b border-gray-100"},Qa={key:0,class:"overflow-x-auto"},Za={class:"w-full border-collapse"},el={class:"bg-gray-50"},tl={class:"th w-[120px]"},sl={class:"th"},al={class:"th"},ll={class:"th"},nl={class:"th"},ol={class:"td text-xs text-gray-400"},il={class:"td text-sm text-navy-500 font-medium"},rl={class:"td text-xs text-gray-400"},cl={class:"td text-xs text-gray-400"},dl={class:"td text-xs text-gray-400"},ul={class:"td text-right"},ml={class:"flex gap-1 justify-end lg:opacity-0 lg:group-hover:opacity-100 transition-opacity"},pl=["title","onClick"],gl=["title","onClick"],_l={key:1,class:"py-14 text-center"},fl={class:"mt-2.5 text-sm text-gray-400"},hl={class:"mt-1 text-xs text-gray-300"},xl=H({__name:"SettingsLimitations",props:{items:{}},emits:["remove","edit"],setup(r,{emit:l}){const c=l,{t:i}=Q();return(s,S)=>{const g=ie;return a(),T(le,null,{default:J(()=>[t("p",Xa,o(e(i)("calendar_settings.limits.help")),1),r.items.length?(a(),n("div",Qa,[t("table",Za,[t("thead",null,[t("tr",el,[t("th",tl,o(e(i)("calendar_settings.limits.scope")),1),t("th",sl,o(e(i)("calendar_settings.limits.target")),1),t("th",al,o(e(i)("calendar_settings.sections.domains.title")),1),t("th",ll,o(e(i)("calendar_settings.sections.cats.title")),1),t("th",nl,o(e(i)("calendar_settings.sections.types.title")),1),S[0]||(S[0]=t("th",{class:"th w-[100px]"},null,-1))])]),t("tbody",null,[(a(!0),n(O,null,j(r.items,u=>(a(),n("tr",{key:u.token,class:"group border-b border-gray-100 last:border-0 hover:bg-offwhite"},[t("td",ol,o(e(i)(`calendar_settings.limits.${u.scope}`)),1),t("td",il,o(u.target),1),t("td",rl,o(u.domains.join(" · ")||"â"),1),t("td",cl,o(u.activities.join(" · ")||"â"),1),t("td",dl,o(u.types.join(" · ")||"â"),1),t("td",ul,[t("span",ml,[t("button",{type:"button",class:"w-7 h-7 grid place-items-center rounded-md text-gray-400 hover:bg-gray-100 hover:text-navy-500",title:e(i)("common.edit"),onClick:p=>c("edit",u)},[_(g,{name:"heroicons:pencil",class:"w-4 h-4"})],8,pl),t("button",{type:"button",class:"w-7 h-7 grid place-items-center rounded-md text-gray-400 hover:bg-red-50 hover:text-red-700",title:e(i)("common.delete"),onClick:p=>c("remove",u.token)},[_(g,{name:"heroicons:trash",class:"w-4 h-4"})],8,gl)])])]))),128))])])])):(a(),n("div",_l,[_(g,{name:"heroicons:funnel",class:"w-9 h-9 mx-auto text-gray-200"}),t("p",fl,o(e(i)("calendar_settings.limits.empty")),1),t("p",hl,o(e(i)("calendar_settings.limits.empty_help")),1)]))]),_:1})}}}),vl=me(xl,[["__scopeId","data-v-45c71e81"]]),yl={class:"mb-3.5 bg-white rounded-lg shadow-sm border border-green-100 px-4 py-3.5 flex items-center gap-3.5 flex-wrap"},bl={class:"w-9 h-9 rounded-lg bg-green-100 grid place-items-center flex-shrink-0"},kl={class:"flex-1 min-w-[220px]"},$l={class:"block text-sm font-semibold text-navy-500"},wl={class:"block text-xs text-gray-400 mt-0.5"},Cl=H({__name:"SettingsLocked",props:{description:{}},setup(r){const{t:l}=Q(),c=D(!1);return(i,s)=>{const S=ie;return a(),n("div",yl,[t("span",bl,[_(S,{name:"heroicons:sparkles",class:"w-5 h-5 text-green-800"})]),t("span",kl,[t("span",$l,o(e(l)("calendar_settings.locked.title")),1),t("span",wl,o(r.description),1)]),_(ee,{text:e(l)("calendar_settings.locked.discover"),icon:"heroicons:sparkles","icon-position":"left",color:"primary",size:"sm",onClick:s[0]||(s[0]=g=>c.value=!0)},null,8,["text"]),_($t,{modelValue:c.value,"onUpdate:modelValue":s[1]||(s[1]=g=>c.value=g),title:e(l)("calendar_settings.locked.modal_title"),description:r.description,onUpgrade:s[2]||(s[2]=g=>("navigateTo"in i?i.navigateTo:e(Se))("/app/membership"))},null,8,["modelValue","title","description"])])}}}),Vl={class:"grid gap-3.5 items-start",style:{"grid-template-columns":"repeat(auto-fit, minmax(320px, 1fr))"}},Sl={class:"px-4 py-4 flex flex-col gap-3"},El={class:"text-xs text-gray-400 leading-relaxed"},Dl={class:"px-3 py-2.5 rounded-lg bg-green-100 text-green-800 text-xs leading-relaxed"},Fl={class:"px-4 py-4 text-xs text-gray-400 leading-relaxed"},Ul=H({__name:"SettingsMail",setup(r){const{t:l}=Q();return(c,i)=>(a(),n("div",Vl,[_(le,{title:e(l)("calendar_settings.sections.mail.title")},{default:J(()=>[t("div",Sl,[t("p",El,o(e(l)("calendar_settings.mail.help")),1),t("p",Dl,o(e(l)("calendar_settings.mail.separate")),1),_(ee,{text:e(l)("calendar_settings.mail.open"),icon:"heroicons:arrow-top-right-on-square","icon-position":"left",color:"secondary",size:"sm",class:"self
1-start",onClick:i[0]||(i[0]=s=>("navigateTo"in c?c.navigateTo:e(Se))("/app/admin/vpdive?route=/f/newsletter/guest_confirmation"))},null,8,["text"])])]),_:1},8,["title"]),_(le,{title:e(l)("calendar_settings.about")},{default:J(()=>[t("p",Fl,o(e(l)("calendar_settings.mail.why")),1)]),_:1},8,["title"])]))}}),Tl={class:"flex flex-col gap-4"},Ll={class:"-mt-2 text-xs text-gray-400 leading-relaxed"},Ol={class:"grid grid-cols-2 gap-3"},Bl={class:"flex flex-col gap-1.5"},Il={class:"text-xs font-semibold text-gray-400"},Ml={class:"flex flex-col gap-1.5"},ql={class:"text-xs text-gray-400 leading-relaxed"},Pl={class:"flex gap-2 justify-end"},Rl=H({__name:"SettingsSheet",props:{kind:{},item:{}},emits:["close","saved"],setup(r,{emit:l}){const c=r,i=l,{t:s}=Q(),S=ve(),g=D(!1),u=D(c.item?.name??""),p=D(c.item?.background_color??"#2EC07E"),m=D(c.item?.font_color??"#FFFFFF"),k=D(!!c.item?.medical_extension),f=D([]),C=D([]),M=F(()=>s(c.item?"calendar_settings.sheet.edit":"calendar_settings.sheet.create"));Ve(async()=>{if(c.kind==="responsibilities")try{const $=await Z("/api/calendar/capacities",{method:"GET"});C.value=($?.data?.capacities??[]).map(h=>({label:h.name,value:h.id??h.name,disabled:h.disabled===!0})),f.value=C.value.filter(h=>!h.disabled&&(c.item?.capacities??[]).includes(String(h.label))).map(h=>h.value)}catch{C.value=[]}});async function y(){const $=Xe[c.kind];if(!$){S.add({title:s("calendar_settings.table.no_api"),icon:"heroicons:exclamation-triangle",color:"orange"});return}const h={name:u.value.trim()};c.kind==="domains"&&(h.backgroundColor=p.value,h.fontColor=m.value,h.medicalExaminationExtension=k.value),c.kind==="responsibilities"&&(h.capacities=f.value),g.value=!0;try{await Z(c.item?`/api/calendar/${$}/${c.item.token}`:`/api/calendar/${$}`,{method:c.item?"PUT":"POST",data:h}),i("saved")}catch{S.add({title:s("common.error"),description:s("calendar_settings.table.error"),icon:"heroicons:exclamation-triangle",color:"red"})}finally{g.value=!1}}return($,h)=>(a(),T(Me,{"model-value":!0,size:"md",title:M.value,"onUpdate:modelValue":h[6]||(h[6]=b=>i("close")),onClose:h[7]||(h[7]=b=>i("close"))},{footer:J(()=>[t("div",Pl,[_(ee,{text:e(s)("common.cancel"),color:"secondary",size:"sm",disabled:g.value,onClick:h[5]||(h[5]=b=>i("close"))},null,8,["text","disabled"]),_(ee,{text:e(s)("common.save"),color:"primary",size:"sm",loading:g.value,disabled:!u.value.trim(),onClick:y},null,8,["text","loading","disabled"])])]),default:J(()=>[t("div",Tl,[_(ue,{modelValue:u.value,"onUpdate:modelValue":h[0]||(h[0]=b=>u.value=b),label:e(s)("calendar_settings.table.name"),placeholder:e(s)("calendar_settings.table.name"),"max-length":80,vertical:"",required:""},null,8,["modelValue","label","placeholder"]),r.kind==="responsibilities"?(a(),n(O,{key:0},[_(oe,{modelValue:f.value,"onUpdate:modelValue":h[1]||(h[1]=b=>f.value=b),options:C.value,label:e(s)("calendar_settings.sheet.capacities"),placeholder:e(s)("calendar_settings.sheet.capacities_placeholder"),multiple:"","can-search":"",clearable:"",vertical:""},null,8,["modelValue","options","label","placeholder"]),t("p",Ll,o(e(s)("calendar_settings.sheet.capacities_help")),1)],64)):r.kind==="domains"?(a(),n(O,{key:1},[t("div",Ol,[_(Ne,{modelValue:p.value,"onUpdate:modelValue":h[2]||(h[2]=b=>p.value=b),label:e(s)("calendar_settings.sheet.background"),class:"min-w-0"},null,8,["modelValue","label"]),_(Ne,{modelValue:m.value,"onUpdate:modelValue":h[3]||(h[3]=b=>m.value=b),label:e(s)("calendar_settings.sheet.foreground"),class:"min-w-0"},null,8,["modelValue","label"])]),t("div",Bl,[t("span",Il,o(e(s)("calendar_settings.sheet.preview")),1),t("span",{class:"inline-grid place-items-center min-w-[130px] h-8 px-3 rounded-md text-xs font-bold border border-black/5 self-start",style:de({backgroundColor:p.value,color:m.value})},o(u.value||e(s)("calendar_settings.sheet.sample")),5)]),t("div",Ml,[_(We,{modelValue:k.value,"onUpdate:modelValue":h[4]||(h[4]=b=>k.value=b),variant:"switch",label:e(s)("calendar_settings.sheet.extension")},null,8,["modelValue","label"]),t("p",ql,o(e(s)("calendar_settings.sheet.extension_help")),1)])],64)):U("",!0)])]),_:1},8,["title"]))}}),Nl={class:"px-4 py-3 flex items-center gap-3 flex-wrap border-b border-gray-100"},zl={class:"inline-flex bg-gray-50 border border-gray-100 rounded-lg p-0.5"},jl=["onClick"],Al={class:"text-[11px] font-semibold px-2 py-1 rounded-full bg-gray-50 text-gray-400 tabular-nums"},Jl={key:0,class:"overflow-x-auto"},Kl={class:"w-full border-collapse"},Hl={class:"bg-gray-50"},Wl={class:"th text-center w-[132px]"},Yl={key:0,class:"th w-[86px]"},Gl={class:"th"},Xl={key:1,class:"th"},Ql={class:"th text-center w-[70px]"},Zl={class:"th text-center w-[80px]"},en={class:"th text-center w-[80px]"},tn={class:"th text-center w-[96px]"},sn={class:"th"},an={class:"td text-center"},ln={key:0,class:"td"},nn={class:"td"},on={key:0,class:"ml-2 text-[10px] font-semibold px-1.5 py-0.5 rounded-full bg-blue-50 text-blue-700"},rn={key:1,class:"ml-2 text-[10px] font-medium px-1.5 py-0.5 rounded-full bg-gray-100 text-gray-400"},cn={key:1,class:"td text-xs text-gray-400"},dn={class:"td text-center"},un=["value","aria-label","onChange"],mn={key:1,class:"text-xs text-gray-400 tabular-nums"}
1,pn={key:1,class:"text-xs text-gray-400"},gn=["title"],_n={class:"td"},fn={class:"flex gap-1 justify-end lg:opacity-0 lg:group-hover:opacity-100 lg:focus-within:opacity-100 transition-opacity"},hn=["title","onClick"],xn=["title","onClick"],vn=["title","onClick"],yn={key:2,class:"text-[11px] text-gray-300 self-center pr-1"},bn={key:1,class:"py-14 text-center text-sm text-gray-400"},kn=H({__name:"SettingsTable",props:{items:{},kind:{},withDefault:{type:Boolean},busy:{}},emits:["toggle","default","edit","remove","flag","order"],setup(r,{emit:l}){const c=r,i=l,{t:s}=Q(),S=D(""),g=D(!1),u=F(()=>c.kind==="domains"),p=F(()=>c.kind==="responsibilities"),m=F(()=>c.items.filter(f=>g.value&&!f.active?!1:f.name.toLowerCase().includes(S.value.trim().toLowerCase())));function k(f){return f.pool_only?s("calendar_settings.table.extension_pool"):f.medical_extension?s("common.yes"):s("common.no")}return(f,C)=>{const M=ie;return a(),T(le,null,{default:J(()=>[t("div",Nl,[_(ue,{modelValue:S.value,"onUpdate:modelValue":C[0]||(C[0]=y=>S.value=y),type:"search",placeholder:e(s)("calendar_settings.search_placeholder"),class:"flex-1 min-w-[220px]",vertical:"","hide-icon":""},null,8,["modelValue","placeholder"]),t("span",zl,[(a(),n(O,null,j([!1,!0],y=>t("button",{key:String(y),type:"button",class:te(["text-xs font-semibold px-3 py-1.5 rounded-md transition-colors",g.value===y?"bg-white text-navy-500 shadow-sm":"text-gray-400"]),onClick:$=>g.value=y},o(y?e(s)("calendar_settings.table.offered_only"):e(s)("calendar_settings.table.all")),11,jl)),64))]),t("span",Al,o(e(s)("calendar_settings.table.count",{n:m.value.length,total:r.items.length})),1)]),m.value.length?(a(),n("div",Jl,[t("table",Kl,[t("thead",null,[t("tr",Hl,[t("th",Wl,o(e(s)("calendar_settings.table.offered")),1),u.value?(a(),n("th",Yl,o(e(s)("calendar_settings.table.color")),1)):U("",!0),t("th",Gl,o(e(s)("calendar_settings.table.name")),1),u.value?(a(),n("th",Xl,o(e(s)("calendar_settings.table.extension")),1)):U("",!0),p.value?(a(),n(O,{key:2},[t("th",Ql,o(e(s)("calendar_settings.table.order")),1),t("th",Zl,o(e(s)("calendar_settings.table.admin")),1),t("th",en,o(e(s)("calendar_settings.table.detail")),1),t("th",tn,o(e(s)("calendar_settings.table.team")),1),t("th",sn,o(e(s)("calendar_settings.table.capacities")),1)],64)):U("",!0),C[1]||(C[1]=t("th",{class:"th w-[128px]"},null,-1))])]),t("tbody",null,[(a(!0),n(O,null,j(m.value,y=>(a(),n("tr",{key:y.token,class:"group border-b border-gray-100 last:border-0 hover:bg-offwhite"},[t("td",an,[_(Ee,{"model-value":y.active,disabled:r.busy===y.token,"onUpdate:modelValue":$=>i("toggle",y)},null,8,["model-value","disabled","onUpdate:modelValue"])]),u.value?(a(),n("td",ln,[t("span",{class:"inline-grid place-items-center min-w-[46px] h-6 rounded-md text-[11px] font-bold border border-black/5",style:de({backgroundColor:y.background_color,color:y.font_color})},"Aa",4)])):U("",!0),t("td",nn,[t("span",{class:te(["text-sm",y.active?"text-navy-500 font-medium":"text-gray-400"])},o(y.name),3),y.is_default?(a(),n("span",on,o(e(s)("calendar_settings.table.default")),1)):U("",!0),y.editable?U("",!0):(a(),n("span",rn,o(e(s)("calendar_settings.table.shared")),1))]),u.value?(a(),n("td",cn,o(k(y)),1)):U("",!0),p.value?(a(),n(O,{key:2},[t("td",dn,[y.editable?(a(),n("input",{key:0,value:y.order??"",type:"text",inputmode:"numeric",class:"w-12 text-center text-sm bg-gray-50 border border-gray-100 rounded-md px-1 py-1 tabular-nums focus:outline-none focus:border-primary focus:bg-white","aria-label":e(s)("calendar_settings.table.order"),onChange:$=>i("order",y,$.target.value)},null,40,un)):(a(),n("span",mn,o(y.order||"â"),1))]),(a(),n(O,null,j(["is_admin","show_on_detail","team_lead"],$=>t("td",{key:$,class:"td text-center"},[y.editable?(a(),T(Ee,{key:0,"model-value":!!y[$],disabled:r.busy===y.token,"onUpdate:modelValue":h=>i("flag",y,$)},null,8,["model-value","disabled","onUpdate:modelValue"])):(a(),n("span",pn,o(y[$]?e(s)("common.yes"):e(s)("common.no")),1))])),64)),t("td",{class:"td text-xs text-gray-400 max-w-[240px] truncate",title:y.capacities?.join(" · ")},o(y.capacities?.length?y.capacities.join(" · "):"â"),9,gn)],64)):U("",!0),t("td",_n,[t("span",fn,[r.withDefault&&!y.is_default?(a(),n("button",{key:0,t
1ype:"button",class:"act",title:e(s)("calendar_settings.table.set_default"),onClick:$=>i("default",y)},[_(M,{name:"heroicons:check",class:"w-4 h-4"})],8,hn)):U("",!0),y.editable?(a(),n(O,{key:1},[t("button",{type:"button",class:"act",title:e(s)("common.edit"),onClick:$=>i("edit",y)},[_(M,{name:"heroicons:pencil",class:"w-4 h-4"})],8,xn),t("button",{type:"button",class:"act danger",title:e(s)("common.delete"),onClick:$=>i("remove",y)},[_(M,{name:"heroicons:trash",class:"w-4 h-4"})],8,vn)],64)):(a(),n("span",yn,o(e(s)("calendar_settings.table.locked")),1))])])]))),128))])])])):(a(),n("p",bn,o(e(s)("calendar_settings.table.no_result")),1))]),_:1})}}}),$n=me(kn,[["__scopeId","data-v-453a1ac1"]]),wn={class:"flex flex-col gap-2.5 mb-3 sm:flex-row sm:items-start sm:justify-between sm:gap-4"},Cn={class:"min-w-0"},Vn={key:0,class:"flex items-center gap-1.5 text-xs text-gray-400 mb-1"},Sn={class:"text-xl sm:text-2xl font-bold text-navy-500 truncate"},En={class:"text-xs sm:text-sm text-gray-400 mt-0.5"},Dn={class:"flex items-center gap-2 flex-shrink-0"},Fn={key:0,class:"chrome-search flex items-center gap-2"},Un=["aria-label"],Tn={class:"flex-1 min-w-0 flex items-center gap-2 sm:gap-3 bg-white rounded-lg shadow-sm px-3 sm:px-4 py-2.5"},Ln=["placeholder"],On={class:"text-xs text-gray-300 tabular-nums flex-shrink-0"},Bn=["title","aria-label"],In={class:"hidden sm:inline"},Mn={class:"sm:hidden tabular-nums"},qn={key:0,class:"bg-white rounded-lg shadow-sm py-16 text-center px-6"},Pn={class:"mt-3 text-sm text-gray-500"},Rn={key:1,class:"grid gap-3.5",style:{"grid-template-columns":"repeat(auto-fill, minmax(280px, 1fr))"}},Nn={key:0,class:"mt-3.5"},zn={key:10,class:"grid gap-3.5 items-start",style:{"grid-template-columns":"repeat(auto-fit, minmax(320px, 1fr))"}},jn={key:11,class:"mt-3.5 px-3.5 py-2.5 rounded-lg bg-gray-50 text-xs text-gray-400 leading-relaxed"},An={key:4,class:"savebar z-20 px-4 sm:px-6 py-3 bg-white border-t border-gray-100 flex items-center justify-between gap-3 flex-wrap"},Jn={class:"text-xs text-gray-400 min-w-0"},Kn={class:"flex gap-2 flex-shrink-0 ml-auto"},Hn=H({__name:"[[section]]",setup(r){const{t:l,te:c}=Q(),i=ht(),s=ve(),S=je(),g=D(""),u=D(!1),p=D(!1),m=D({shown:0,total:0,editable:0}),k=D(null),f=D("auto"),C=D("auto"),M=D("0px"),y=D("0px");function $(){const V=k.value?.parentElement;if(!V||!k.value)return;if(!window.matchMedia("(min-width: 768px)").matches){const mt=k.value.querySelector(".chrome-search"),Re=k.value.closest("main"),pt=Re?parseFloat(getComputedStyle(Re).paddingTop):0;f.value="auto",C.value="auto",M.value="0px",y.value="auto",document.documentElement.style.setProperty("--settings-chrome",`${pt+(mt?.offsetHeight??0)+10}px`);return}const I=V.getBoundingClientRect(),G=getComputedStyle(V),z=parseFloat(G.paddingLeft)+parseFloat(G.paddingRight),dt=parseFloat(G.paddingTop),ut=Math.round(k.value.offsetHeight)+20-dt,qe=k.value.closest(".main-content"),Pe=qe?parseFloat(getComputedStyle(qe).paddingTop):0;y.value=`${Pe}px`,f.value=`${Math.round(I.left+parseFloat(G.paddingLeft))}px`,C.value=`${Math.round(I.width-z)}px`,M.value=`${ut}px`,document.documentElement.style.setProperty("--settings-chrome",`${Pe+Math.round(k.value.offsetHeight)+12}px`)}Ve(()=>{$(),window.addEventListener("resize",$)}),Ae(()=>window.removeEventListener("resize",$)),Ue([g,u,()=>m.value.total],()=>Ke($));const h=wt(),{draft:b,dirtyKeys:P,isDirty:E,saving:B,isPremium:W,canEdit:re,reset:ne,save:pe}=Yt(),X=D(!0),se=D(""),ae=D(null),q=D(!1),A=D(null),N=Ie({open:!1,state:"idle",error:"",item:null}),L=D({export_fields:[],responsible_rights:[],is_premium:!1,is_organ:!1,domains:[],activities:[],types:[],responsibilities:[],boats:[],limitations:[],locations:[],activity_range:{first:null,last:null},season_start:null}),v=F(()=>Kt(String(i.params.section??""))),ye=F(()=>{const V=i.query.from;return typeof V=="string"&&V.startsWith("/app/")?V:null}),be=F(()=>ye.value?l("calendar_settings.back_to_activity"):l("calendar_settings.title"));function ke(){Se(ye.value??"/app/calendar/settings")}xt(V=>{V.path.startsWith("/app/calendar/settings")||h.origin&&V.fullPath===h.origin||h.clear()});const _e=F(()=>!!v.value?.referential),$e=F(()=>{const V=`calendar_settings.sections.${v.value?.id}.hint`;return v.value&&c(V)?l(V):""});vt({title:()=>v.value?l(`calendar_settings.sections.${v.value.id}.title`):l("calendar_settings.title")}),Ve(async()=>{try{await S.fetchSettings(),re.value&&(L.value=await Z("/api/calendar/settings/catalog",{method:"GET"}))}catch{s.add({title:l("calendar_settings.load_error"),icon:"heroicons:exclamation-triangle",color:"red"})}finally{X.value=!1}});function fe(){A.value=null,q.value=!0}function we(V){A.value=V,q.value=!0}function d(){q.value=!1,A.value=null}async function w(){d(),await Y(),s.add({title:l("calendar_settings.limits.created"),icon:"heroicons:check-circle",color:"green"})}async function R(V){try{await Z(`/api/calendar/limitations/${V}`,{method:"DELETE",data:{}}),await Y(),s.add({title:l("calendar_settings.limits.deleted"),icon:"heroicons:check-circle",color:"green"})}catch{s.add({title:l("common.error"),description:l("calendar_settings.limits.error"),icon:"heroicons:exclamation-triangle",color:"red"})}}async function ce(){try{const V=await pe();s.add({title:l("calendar_settings.saved",{n:V.length},V.length),icon:"heroicons:check-circle",color:"green"})}catch{s.add({title:l("common.error"),description:l("calendar_settings.save_error"),icon:"heroicons:exclamation-triangle",color:"red"})}}function x(V){v.value?.referential&&(ae.value={kind:v.value.referential,item:V})}async function Y(){L.value=await Z("/api/calendar/settings/catalog",{method:"GET"})}async function at(){ae.value=null,await Y(),s.add({title:l("calendar_settings.table.saved"),icon:"heroicons:check-circle",color:"green"})}async function Ce(V,I,G="POST"){const z=Xe[v.value?.referential??""];if(!z)return s.add({title:l("calendar_settings.table.no_api"),icon:"heroicons:exclamation-triangle",color:"orange"}),!1;se.value=V.token;try{return await Z(`/api/calendar/${z}/${V.token}${I}`,{method:G,data:{}}),!0}catch{return s.add({title:l("common.error"),description:l("calendar_settings.table.error"),icon:"heroicons:exclamation-triangle",color:"red"}),!1}finally{se.value=""}}async function lt(V,I){await Ce(V,`/flag/${I}`)&&(V[I]=!V[I])}async function nt(V,I){const G=I.trim();if(G!==(V.order??"")){if(!/^\d*$/.test(G)){s.add({title:l("calendar_settings.table.order_numeric"),icon:"heroicons:exclamation-triangle",color:"orange"});return}se.value=V.token;try{await Z(`/api/calendar/responsibilities/${V.token}/order`,{method:"POST",data:{order:G}}),V.order=G,s.add({title:l("calendar_settings.table.saved"),icon:"heroicons:check-circle",color:"green"})}catch{s.add({title:l("common.error"),description:l("calendar_settings.table.error"),icon:"heroicons:exclamation-triangle",color:"red"})}finally{se.value=""}}}async function ot(V){await Ce(V,"/status")&&(V.active=!V.active)}async function it(V){if(await Ce(V,"/default")&&v.value?.referential)for(const I of L.value[v.value.referential])I.is_default=I.token===V.token}function rt(V){Object.assign(N,{open:!0,state:"idle",error:"",item:V})}async function ct(){const V=N.item;V&&(N.state="loading",await Ce(V,"","DELETE")?(await Y(),N.state="success"):(N.state="error",N.error=l("calendar_settings.table.error")))}return(V,I)=>{const G=ie;return a(),n("div",{class:te(["w-full max-w-[1400px] mx-auto px-4 sm:px-6 py-5 sm:py-
17",e(E)?"pb-32 md:pb-24":"pb-24 md:pb-7"])},[t("div",{ref_key:"band",ref:k,class:"chrome",style:de({top:y.value,left:f.value,width:C.value})},[t("div",wn,[t("div",Cn,[v.value?(a(),n("nav",Vn,[t("button",{type:"button",class:"hover:text-primary",onClick:ke},o(be.value),1),_(G,{name:"heroicons:chevron-right",class:"w-3 h-3 text-gray-200"}),t("span",null,o(e(l)(`calendar_settings.sections.${v.value.id}.title`)),1)])):U("",!0),t("h1",Sn,o(v.value?e(l)(`calendar_settings.sections.${v.value.id}.title`):e(l)("calendar_settings.title")),1),t("p",En,o(v.value?e(l)(`calendar_settings.sections.${v.value.id}.desc`):e(l)("calendar_settings.subtitle")),1)]),t("div",Dn,[v.value?U("",!0):(a(),T(ee,{key:0,text:e(l)("calendar_settings.back_to_calendar"),icon:"heroicons:calendar-days","icon-position":"left",color:"secondary",variant:"outlined",size:"sm",onClick:I[0]||(I[0]=z=>("navigateTo"in V?V.navigateTo:e(Se))("/app/activities"))},null,8,["text"])),v.value?(a(),T(ee,{key:1,text:be.value,icon:"heroicons:arrow-left","icon-position":"left",color:"secondary",size:"sm",onClick:ke},null,8,["text"])):U("",!0),_e.value||v.value?.id==="limits"?(a(),T(ee,{key:2,text:e(l)("common.add"),icon:"heroicons:plus","icon-position":"left",color:"primary",size:"sm",onClick:I[1]||(I[1]=z=>v.value?.id==="limits"?fe():x(null))},null,8,["text"])):U("",!0)])]),!v.value&&e(re)?(a(),n("div",Fn,[t("button",{type:"button",class:"lg:hidden w-10 h-10 flex-shrink-0 grid place-items-center bg-white rounded-lg shadow-sm text-gray-400 hover:text-navy-500 transition-colors","aria-label":e(l)("calendar_settings.sommaire"),onClick:I[2]||(I[2]=z=>p.value=!0)},[_(G,{name:"heroicons:bars-3",class:"w-5 h-5"})],8,Un),t("div",Tn,[_(G,{name:"heroicons:magnifying-glass",class:"w-5 h-5 text-gray-300 flex-shrink-0"}),Je(t("input",{"onUpdate:modelValue":I[3]||(I[3]=z=>g.value=z),type:"search",placeholder:e(l)("calendar_settings.search.placeholder"),class:"flex-1 min-w-0 bg-transparent outline-none text-sm text-navy-500 placeholder:text-gray-300"},null,8,Ln),[[yt,g.value]]),t("span",On,o(g.value?`${m.value.shown} / ${m.value.total}`:m.value.total),1),I[10]||(I[10]=t("span",{class:"w-px h-6 bg-gray-50 flex-shrink-0"},null,-1)),t("button",{type:"button",class:te(["flex items-center gap-1 text-xs font-medium px-2.5 sm:px-3 py-1.5 rounded-full transition-colors flex-shrink-0",u.value?"bg-primary text-white":"bg-gray-50 text-gray-400 hover:text-navy-500"]),title:e(l)("calendar_settings.search.only_editable_help"),"aria-label":e(l)("calendar_settings.search.only_editable",{n:m.value.editable}),onClick:I[4]||(I[4]=z=>u.value=!u.value)},[_(G,{name:"heroicons:funnel",class:"w-3.5 h-3.5 sm:hidden"}),t("span",In,o(e(l)("calendar_settings.search.only_editable",{n:m.value.editable})),1),t("span",Mn,o(m.value.editable),1)],10,Bn)])])):U("",!0)],4),t("div",{style:de({height:M.value})},null,4),e(re)?X.value?(a(),n("div",Rn,[(a(),n(O,null,j(8,z=>t("div",{key:z,class:"bg-white rounded-lg shadow-sm p-4 h-28 animate-pulse"})),64))])):v.value?(a(),n(O,{key:3},[v.value.premium&&!e(W)?(a(),T(Cl,{key:0,description:e(l)(`calendar_settings.sections.${v.value.id}.locked`)},null,8,["description"])):U("",!0),v.value.id==="display"?(a(),T(st,{key:1,draft:e(b)},null,8,["draft"])):v.value.id==="people"?(a(),T(et,{key:2,draft:e(b),locked:v.value.premium&&!e(W)},null,8,["draft","locked"])):v.value.id==="talk"?(a(),T(Ze,{key:3,draft:e(b),locked:v.value.premium&&!e(W)},null,8,["draft","locked"])):v.value.id==="mail"?(a(),T(Ul,{key:4})):v.value.id==="stats"?(a(),T(tt,{key:5,catalog:L.value,locked:v.value.premium&&!e(W)},null,8,["catalog","locked"])):v.value.id==="limits"?(a(),T(vl,{key:6,items:L.value.limitations,onRemove:R,onEdit:we},null,8,["items"])):v.value.id==="boats"?(a(),T(Ye,{key:7,items:L.value.boats,onChanged:Y},null,8,["items"])):v.value.id==="export"||v.value.id==="rights"?(a(),n(O,{key:8},[_(Ge,{draft:e(b),field:v.value.id==="export"?"export_fields":"role_responsibles",entries:v.value.id==="export"?L.value.export_fields:L.value.responsible_rights,intro:e(l)(`calendar_settings.${v.value.id}.intro`),empty:v.value.id==="rights"?e(l)("calendar_settings.rights.empty"):void 0},null,8,["draft","field","entries","intro","empty"]),v.value.id==="export"?(a(),n("div",Nn,[_(Fe,{section:"export",draft:e(b),locked:!e(W),title:e(l)("calendar_settings.export.unregistered"),rows:[{field:"show_export_unregister",type:"switch"}]},null,8,["draft","locked","title"])])):U("",!0)],64)):v.value.referential?(a(),T($n,{key:9,items:L.value[v.value.referential],kind:v.value.referential,"with-default":v.value.referential!=="responsibilities",busy:se.value,onToggle:ot,onDefault:it,onEdit:x,onRemove:rt,onFlag:lt,onOrder:nt},null,8,["items","kind","with-default","busy"])):(a(),n("div",zn,[(a(!0),n(O,null,j(v.value.cards??[],z=>(a(),T(Fe,{key:z.key,section:v.value.id,rows:z.rows,draft:e(b),locked:v.value.premium&&!e(W),title:(v.value.cards??[]).length>1?e(l)(`calendar_settings.${v.value.id}.${z.key}`):void 0},null,8,["section","rows","draft","locked","title"]))),128))])),$e.value?(a(),n("p",jn,o($e.value),1)):U("",!0)],64)):(a(),T(Ra,{key:2,sommaire:p.value,"onUpdate:sommaire":I[5]||(I[5]=z=>p.value=z),draft:e(b),catalog:L.value,premium:e(W),search:g.value,"editable-only":u.value,onRefresh:Y,onCounts:I[6]||(I[6]=z=>m.value=z)},null,8,["sommaire","draft","catalog","premium","search","editable-only"])):(a(),n("div",qn,[_(G,{name:"heroicons:lock-closed",class:"w-10 h-10 mx-auto text-gray-300"}
1),t("p",Pn,o(e(l)("calendar_settings.denied")),1)])),e(E)?(a(),n("div",An,[t("span",Jn,o(e(l)("calendar_settings.unsaved",{n:e(P).length},e(P).length)),1),t("span",Kn,[_(ee,{text:e(l)("common.cancel"),color:"secondary",size:"sm",disabled:e(B),onClick:I[7]||(I[7]=z=>e(ne)())},null,8,["text","disabled"]),_(ee,{text:e(l)("common.save"),icon:"heroicons:check","icon-position":"left",color:"primary",size:"sm",loading:e(B),onClick:ce},null,8,["text","loading"])])])):U("",!0),_(He,{modelValue:N.open,"onUpdate:modelValue":I[8]||(I[8]=z=>N.open=z),state:N.state,"error-message":N.error,type:"danger",title:e(l)("calendar_settings.table.delete_title"),message:e(l)("calendar_settings.table.confirm_delete",{name:N.item?.name??""}),"confirm-text":e(l)("common.delete"),"success-title":e(l)("calendar_settings.table.deleted"),"error-title":e(l)("calendar_settings.table.delete_error"),onConfirm:ct},null,8,["modelValue","state","error-message","title","message","confirm-text","success-title","error-title"]),q.value?(a(),T(Ga,{key:5,catalog:L.value,item:A.value,onClose:d,onSaved:w},null,8,["catalog","item"])):U("",!0),ae.value?(a(),T(Rl,{key:6,item:ae.value.item,kind:ae.value.kind,onClose:I[9]||(I[9]=z=>ae.value=null),onSaved:at},null,8,["item","kind"])):U("",!0)],2)}}}),co=me(Hn,[["__scopeId","data-v-0fff499c"]]);export{co as default};
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.