PageSourceSearch

https://fcuitikon.ch/assets/admin.saisonplanung-CCs05tBn.js

js fcuitikon.ch collected 2026-10-09 22:02:05 UTC 77,660 bytes, 5 lines download raw bytes

1import{r as o,a6 as L,aa as $e,a as ve,b as ye,s as Kt,j as r,o as nn}from"./index-DpVPZOzj.js";import{u as be}from"./useServerFn-rDM4dV-8.js";import{t as q}from"./index-Dn-7dvcG.js";import{r as we}from"./auth-middleware-D-iKNvb8.js";import{C as Nt}from"./chevron-left-YfFAadT1.js";import{C as jt}from"./chevron-right-HhHNhMRr.js";const it=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ae(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Ct(e){return"nodeType"in e}function Y(e){var t,n;return e?Ae(e)?e:Ct(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function St(e){const{Document:t}=Y(e);return e instanceof t}function Xe(e){return Ae(e)?!1:e instanceof Y(e).HTMLElement}function rn(e){return e instanceof Y(e).SVGElement}function Re(e){return e?Ae(e)?e.document:Ct(e)?St(e)?e:Xe(e)||rn(e)?e.ownerDocument:document:document:document}const ae=it?o.useLayoutEffect:o.useEffect;function at(e){const t=o.useRef(e);return ae(()=>{t.current=e}),o.useCallback(function(){for(var n=arguments.length,s=new Array(n),i=0;i<n;i++)s[i]=arguments[i];return t.current==null?void 0:t.current(...s)},[])}function Mn(){const e=o.useRef(null),t=o.useCallback((s,i)=>{e.current=setInterval(s,i)},[]),n=o.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ke(e,t){t===void 0&&(t=[e]);const n=o.useRef(e);return ae(()=>{n.current!==e&&(n.current=e)},t),n}function Je(e,t){const n=o.useRef();return o.useMemo(()=>{const s=e(n.current);return n.current=s,s},[...t])}function Qe(e){const t=at(e),n=o.useRef(null),s=o.useCallback(i=>{i!==n.current&&t?.(i,n.current),n.current=i},[]);return[n,s]}function et(e){const t=o.useRef();return o.useEffect(()=>{t.current=e},[e]),t.current}let mt={};function ot(e,t){return o.useMemo(()=>{if(t)return t;const n=mt[e]==null?0:mt[e]+1;return mt[e]=n,e+"-"+n},[e,t])}function sn(e){return function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return s.reduce((a,d)=>{const l=Object.entries(d);for(const[f,u]of l){const c=a[f];c!=null&&(a[f]=c+e*u)}return a},{...t})}}const De=sn(1),tt=sn(-1);function Tn(e){return"clientX"in e&&"clientY"in e}function Dt(e){if(!e)return!1;const{KeyboardEvent:t}=Y(e.target);return t&&e instanceof t}function On(e){if(!e)return!1;const{TouchEvent:t}=Y(e.target);return t&&e instanceof t}function nt(e){if(On(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Tn(e)?{x:e.clientX,y:e.clientY}:null}const Ye=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Ye.Translate.toString(e),Ye.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:s}=e;return t+" "+n+"ms "+s}}}),Yt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function _n(e){return e.matches(Yt)?e:e.querySelector(Yt)}const zn={display:"none"};function Ln(e){let{id:t,value:n}=e;return L.createElement("div",{id:t,style:zn},n)}function Pn(e){let{id:t,announcement:n,ariaLiveType:s="assertive"}=e;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return L.createElement("div",{id:t,style:i,role:"status","aria-live":s,"aria-atomic":!0},n)}function $n(){const[e,t]=o.useState("");return{announce:o.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const an=o.createContext(null);function In(e){const t=o.useContext(an);o.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Bn(){const[e]=o.useState(()=>new Set),t=o.useCallback(s=>(e.add(s),()=>e.delete(s)),[e]);return[o.useCallback(s=>{let{type:i,event:a}=s;e.forEach(d=>{var l;return(l=d[i])==null?void 0:l.call(d,a)})},[e]),t]}const Fn={draggable:`
2    To pick up a draggable item, press the space bar.
3    While dragging, use the arrow keys to move the item.
4    Press space again to drop the item in its new position, or press escape to cancel.
5  `},Kn={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Yn(e){let{announcements:t=Kn,container:n,hiddenTextDescribedById:s,screenReaderInstructions:i=Fn}=e;const{announce:a,announcement:d}=$n(),l=ot("DndLiveRegion"),[f,u]=o.useState(!1);if(o.useEffect(()=>{u(!0)},[]),In(o.useMemo(()=>({onDragStart(h){let{active:x}=h;a(t.onDragStart({active:x}))},onDragMove(h){let{active:x,over:p}=h;t.onDragMove&&a(t.onDragMove({active:x,over:p}))},onDragOver(h){let{active:x,over:p}=h;a(t.onDragOver({active:x,over:p}))},onDragEnd(h){let{active:x,over:p}=h;a(t.onDragEnd({active:x,over:p}))},onDragCancel(h){let{active:x,over:p}=h;
5a(t.onDragCancel({active:x,over:p}))}}),[a,t])),!f)return null;const c=L.createElement(L.Fragment,null,L.createElement(Ln,{id:s,value:i.draggable}),L.createElement(Pn,{id:l,announcement:d}));return n?$e.createPortal(c,n):c}var P;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(P||(P={}));function rt(){}function Wn(e,t){return o.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Xn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return o.useMemo(()=>[...t].filter(s=>s!=null),[...t])}const te=Object.freeze({x:0,y:0});function Jn(e,t){const n=nt(e);if(!n)return"0 0";const s={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return s.x+"% "+s.y+"%"}function Vn(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return s-n}function Un(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Hn(e,t){const n=Math.max(t.top,e.top),s=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),d=i-s,l=a-n;if(s<i&&n<a){const f=t.width*t.height,u=e.width*e.height,c=d*l,h=c/(f+u-c);return Number(h.toFixed(4))}return 0}const Zn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const i=[];for(const a of s){const{id:d}=a,l=n.get(d);if(l){const f=Hn(l,t);f>0&&i.push({id:d,data:{droppableContainer:a,value:f}})}}return i.sort(Vn)};function Gn(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function on(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:te}function qn(e){return function(n){for(var s=arguments.length,i=new Array(s>1?s-1:0),a=1;a<s;a++)i[a-1]=arguments[a];return i.reduce((d,l)=>({...d,top:d.top+e*l.y,bottom:d.bottom+e*l.y,left:d.left+e*l.x,right:d.right+e*l.x}),{...n})}}const Qn=qn(1);function ln(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function er(e,t,n){const s=ln(t);if(!s)return e;const{scaleX:i,scaleY:a,x:d,y:l}=s,f=e.left-d-(1-i)*parseFloat(n),u=e.top-l-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),c=i?e.width/i:e.width,h=a?e.height/a:e.height;return{width:c,height:h,top:u,right:f+c,bottom:u+h,left:f}}const tr={ignoreTransform:!1};function Ve(e,t){t===void 0&&(t=tr);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:c}=Y(e).getComputedStyle(e);u&&(n=er(n,u,c))}const{top:s,left:i,width:a,height:d,bottom:l,right:f}=n;return{top:s,left:i,width:a,height:d,bottom:l,right:f}}function Wt(e){return Ve(e,{ignoreTransform:!0})}function nr(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function rr(e,t){return t===void 0&&(t=Y(e).getComputedStyle(e)),t.position==="fixed"}function sr(e,t){t===void 0&&(t=Y(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const a=t[i];return typeof a=="string"?n.test(a):!1})}function Et(e,t){const n=[];function s(i){if(t!=null&&n.length>=t||!i)return n;if(St(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Xe(i)||rn(i)||n.includes(i))return n;const a=Y(e).getComputedStyle(i);return i!==e&&sr(i,a)&&n.push(i),rr(i,a)?n:s(i.parentNode)}return e?s(e):n}function cn(e){const[t]=Et(e,1);return t??null}function pt(e){return!it||!e?null:Ae(e)?e:Ct(e)?St(e)||e===Re(e).scrollingElement?window:Xe(e)?e:null:null}function dn(e){return Ae(e)?e.scrollX:e.scrollLeft}function un(e){return Ae(e)?e.scrollY:e.scrollTop}
5function vt(e){return{x:dn(e),y:un(e)}}var I;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(I||(I={}));function fn(e){return!it||!e?!1:e===document.scrollingElement}function hn(e){const t={x:0,y:0},n=fn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},s={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,d=e.scrollTop>=s.y,l=e.scrollLeft>=s.x;return{isTop:i,isLeft:a,isBottom:d,isRight:l,maxScroll:s,minScroll:t}}const ir={x:.2,y:.2};function ar(e,t,n,s,i){let{top:a,left:d,right:l,bottom:f}=n;s===void 0&&(s=10),i===void 0&&(i=ir);const{isTop:u,isBottom:c,isLeft:h,isRight:x}=hn(e),p={x:0,y:0},D={x:0,y:0},v={height:t.height*i.y,width:t.width*i.x};return!u&&a<=t.top+v.height?(p.y=I.Backward,D.y=s*Math.abs((t.top+v.height-a)/v.height)):!c&&f>=t.bottom-v.height&&(p.y=I.Forward,D.y=s*Math.abs((t.bottom-v.height-f)/v.height)),!x&&l>=t.right-v.width?(p.x=I.Forward,D.x=s*Math.abs((t.right-v.width-l)/v.width)):!h&&d<=t.left+v.width&&(p.x=I.Backward,D.x=s*Math.abs((t.left+v.width-d)/v.width)),{direction:p,speed:D}}function or(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:d}=window;return{top:0,left:0,right:a,bottom:d,width:a,height:d}}const{top:t,left:n,right:s,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:s,bottom:i,width:e.clientWidth,height:e.clientHeight}}function mn(e){return e.reduce((t,n)=>De(t,vt(n)),te)}function lr(e){return e.reduce((t,n)=>t+dn(n),0)}function cr(e){return e.reduce((t,n)=>t+un(n),0)}function pn(e,t){if(t===void 0&&(t=Ve),!e)return;const{top:n,left:s,bottom:i,right:a}=t(e);cn(e)&&(i<=0||a<=0||n>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const dr=[["x",["left","right"],lr],["y",["top","bottom"],cr]];class At{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const s=Et(n),i=mn(s);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,d,l]of dr)for(const f of d)Object.defineProperty(this,f,{get:()=>{const u=l(s),c=i[a]-u;return this.rect[f]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ie{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...n)})},this.target=t}add(t,n,s){var i;(i=this.target)==null||i.addEventListener(t,n,s),this.listeners.push([t,n,s])}}function ur(e){const{EventTarget:t}=Y(e);return e instanceof t?e:Re(e)}function gt(e,t){const n=Math.abs(e.x),s=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+s**2)>t:"x"in t&&"y"in t?n>t.x&&s>t.y:"x"in t?n>t.x:"y"in t?s>t.y:!1}var Q;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Q||(Q={}));function Xt(e){e.preventDefault()}function fr(e){e.stopPropagation()}var M;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(M||(M={}));const gn={start:[M.Space,M.Enter],cancel:[M.Esc],end:[M.Space,M.Enter,M.Tab]},hr=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case M.Right:return{...n,x:n.x+25};case M.Left:return{...n,x:n.x-25};case M.Down:return{...n,y:n.y+25};case M.Up:return{...n,y:n.y-25}}};class xn{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Ie(Re(n)),this.windowListeners=new Ie(Y(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Q.Resize,this.handleCancel),this.windowListeners.add(Q.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Q.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,s=t.node.current;s&&pn(s),n(te)}handleKeyDown(t){if(Dt(t)){const{active:n,context:s,options:i}
5=this.props,{keyboardCodes:a=gn,coordinateGetter:d=hr,scrollBehavior:l="smooth"}=i,{code:f}=t;if(a.end.includes(f)){this.handleEnd(t);return}if(a.cancel.includes(f)){this.handleCancel(t);return}const{collisionRect:u}=s.current,c=u?{x:u.left,y:u.top}:te;this.referenceCoordinates||(this.referenceCoordinates=c);const h=d(t,{active:n,context:s.current,currentCoordinates:c});if(h){const x=tt(h,c),p={x:0,y:0},{scrollableAncestors:D}=s.current;for(const v of D){const b=t.code,{isTop:k,isRight:E,isLeft:y,isBottom:C,maxScroll:w,minScroll:S}=hn(v),N=or(v),j={x:Math.min(b===M.Right?N.right-N.width/2:N.right,Math.max(b===M.Right?N.left:N.left+N.width/2,h.x)),y:Math.min(b===M.Down?N.bottom-N.height/2:N.bottom,Math.max(b===M.Down?N.top:N.top+N.height/2,h.y))},R=b===M.Right&&!E||b===M.Left&&!y,T=b===M.Down&&!C||b===M.Up&&!k;if(R&&j.x!==h.x){const O=v.scrollLeft+x.x,W=b===M.Right&&O<=w.x||b===M.Left&&O>=S.x;if(W&&!x.y){v.scrollTo({left:O,behavior:l});return}W?p.x=v.scrollLeft-O:p.x=b===M.Right?v.scrollLeft-w.x:v.scrollLeft-S.x,p.x&&v.scrollBy({left:-p.x,behavior:l});break}else if(T&&j.y!==h.y){const O=v.scrollTop+x.y,W=b===M.Down&&O<=w.y||b===M.Up&&O>=S.y;if(W&&!x.x){v.scrollTo({top:O,behavior:l});return}W?p.y=v.scrollTop-O:p.y=b===M.Down?v.scrollTop-w.y:v.scrollTop-S.y,p.y&&v.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(t,De(tt(h,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:s}=this.props;t.preventDefault(),s(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}xn.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:s=gn,onActivation:i}=t,{active:a}=n;const{code:d}=e.nativeEvent;if(s.start.includes(d)){const l=a.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function Jt(e){return!!(e&&"distance"in e)}function Vt(e){return!!(e&&"delay"in e)}class Rt{constructor(t,n,s){var i;s===void 0&&(s=ur(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:a}=t,{target:d}=a;this.props=t,this.events=n,this.document=Re(d),this.documentListeners=new Ie(this.document),this.listeners=new Ie(s),this.windowListeners=new Ie(Y(d)),this.initialCoordinates=(i=nt(a))!=null?i:te,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:s}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Q.Resize,this.handleCancel),this.windowListeners.add(Q.DragStart,Xt),this.windowListeners.add(Q.VisibilityChange,this.handleCancel),this.windowListeners.add(Q.ContextMenu,Xt),this.documentListeners.add(Q.Keydown,this.handleKeydown),n){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Vt(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Jt(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:s,onPending:i}=this.props;i(s,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Q.Click,fr,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Q.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:s,initialCoordinates:i,props:a}=this,{onMove:d,options:{activationConstraint:l}}=a;if(!i)return;const f=(n=nt(t))!=null?n:te,u=tt(i,f);if(!s&&l){if(Jt(l)){if(l.tolerance!=null&&gt(u,l.tolerance))return this.handleCancel();if(gt(u,l.distance))return this.handleStart()}if(Vt(l)&&gt(u,l.tolerance))return this.handleCancel();this.handlePending(l,u);return}t.cancelable&&t.preventDefault(),d(f)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===M.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const mr={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Mt extends Rt{constructor(t){const{event:n}=t,s=Re(n.target);super(t,mr,s)}}Mt.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return!n.isPrimary||n.button!==0?!1:(s?.({event:n}),!0)}}];const pr={move:{name:"mousemove"},end:{name:"mouseup"}};var yt;(function(e){e[e.RightClick=2]="RightClick"})(yt||(yt={}));class gr extends Rt{constructor(t){super(t,pr,Re(t.event.target))}}gr.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return n.button===yt.RightClick?!1:(s?.({event:n}),!0)}}];const xt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class xr extends Rt{constructor(t){super(t,xt)}static setup(){return window.addEventListener(xt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(xt.move.name,t)};function t(){}}}xr.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;const{touches:i}=n;return i.length>1?!1:(s?.({event:n}),!0)}}];var Be;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Be||(Be={}));var st;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="Rever
5sedTreeOrder"})(st||(st={}));function br(e){let{acceleration:t,activator:n=Be.Pointer,canScroll:s,draggingRect:i,enabled:a,interval:d=5,order:l=st.TreeOrder,pointerCoordinates:f,scrollableAncestors:u,scrollableAncestorRects:c,delta:h,threshold:x}=e;const p=yr({delta:h,disabled:!a}),[D,v]=Mn(),b=o.useRef({x:0,y:0}),k=o.useRef({x:0,y:0}),E=o.useMemo(()=>{switch(n){case Be.Pointer:return f?{top:f.y,bottom:f.y,left:f.x,right:f.x}:null;case Be.DraggableRect:return i}},[n,i,f]),y=o.useRef(null),C=o.useCallback(()=>{const S=y.current;if(!S)return;const N=b.current.x*k.current.x,j=b.current.y*k.current.y;S.scrollBy(N,j)},[]),w=o.useMemo(()=>l===st.TreeOrder?[...u].reverse():u,[l,u]);o.useEffect(()=>{if(!a||!u.length||!E){v();return}for(const S of w){if(s?.(S)===!1)continue;const N=u.indexOf(S),j=c[N];if(!j)continue;const{direction:R,speed:T}=ar(S,j,E,t,x);for(const O of["x","y"])p[O][R[O]]||(T[O]=0,R[O]=0);if(T.x>0||T.y>0){v(),y.current=S,D(C,d),b.current=T,k.current=R;return}}b.current={x:0,y:0},k.current={x:0,y:0},v()},[t,C,s,v,a,d,JSON.stringify(E),JSON.stringify(p),D,u,w,c,JSON.stringify(x)])}const vr={x:{[I.Backward]:!1,[I.Forward]:!1},y:{[I.Backward]:!1,[I.Forward]:!1}};function yr(e){let{delta:t,disabled:n}=e;const s=et(t);return Je(i=>{if(n||!s||!i)return vr;const a={x:Math.sign(t.x-s.x),y:Math.sign(t.y-s.y)};return{x:{[I.Backward]:i.x[I.Backward]||a.x===-1,[I.Forward]:i.x[I.Forward]||a.x===1},y:{[I.Backward]:i.y[I.Backward]||a.y===-1,[I.Forward]:i.y[I.Forward]||a.y===1}}},[n,t,s])}function wr(e,t){const n=t!=null?e.get(t):void 0,s=n?n.node.current:null;return Je(i=>{var a;return t==null?null:(a=s??i)!=null?a:null},[s,t])}function kr(e,t){return o.useMemo(()=>e.reduce((n,s)=>{const{sensor:i}=s,a=i.activators.map(d=>({eventName:d.eventName,handler:t(d.handler,s)}));return[...n,...a]},[]),[e,t])}var We;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(We||(We={}));var wt;(function(e){e.Optimized="optimized"})(wt||(wt={}));const Ut=new Map;function Nr(e,t){let{dragging:n,dependencies:s,config:i}=t;const[a,d]=o.useState(null),{frequency:l,measure:f,strategy:u}=i,c=o.useRef(e),h=b(),x=Ke(h),p=o.useCallback(function(k){k===void 0&&(k=[]),!x.current&&d(E=>E===null?k:E.concat(k.filter(y=>!E.includes(y))))},[x]),D=o.useRef(null),v=Je(k=>{if(h&&!n)return Ut;if(!k||k===Ut||c.current!==e||a!=null){const E=new Map;for(let y of e){if(!y)continue;if(a&&a.length>0&&!a.includes(y.id)&&y.rect.current){E.set(y.id,y.rect.current);continue}const C=y.node.current,w=C?new At(f(C),C):null;y.rect.current=w,w&&E.set(y.id,w)}return E}return k},[e,a,n,h,f]);return o.useEffect(()=>{c.current=e},[e]),o.useEffect(()=>{h||p()},[n,h]),o.useEffect(()=>{a&&a.length>0&&d(null)},[JSON.stringify(a)]),o.useEffect(()=>{h||typeof l!="number"||D.current!==null||(D.current=setTimeout(()=>{p(),D.current=null},l))},[l,h,p,...s]),{droppableRects:v,measureDroppableContainers:p,measuringScheduled:a!=null};function b(){switch(u){case We.Always:return!1;case We.BeforeDragging:return n;default:return!n}}}function Tt(e,t){return Je(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function jr(e,t){return Tt(e,t)}function Cr(e){let{callback:t,disabled:n}=e;const s=at(t),i=o.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(s)},[s,n]);return o.useEffect(()=>()=>i?.disconnect(),[i]),i}function lt(e){let{callback:t,disabled:n}=e;const s=at(t),i=o.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(s)},[n]);return o.useEffect(()=>()=>i?.disconnect(),[i]),i}function Sr(e){return new At(Ve(e),e)}function Ht(e,t,n){t===void 0&&(t=Sr);const[s,i]=o.useState(null);function a(){i(f=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=f??n)!=null?u:null}const c=t(e);return JSON.stringify(f)===JSON.stringify(c)?f:c})}const d=Cr({callback(f){if(e)for(const u of f){const{type:c,target:h}=u;if(c==="childList"&&h instanceof HTMLElement&&h.contains(e)){a();break}}}}),l=lt({callback:a});return ae(()=>{a(),e?(l?.observe(e),d?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),d?.disconnect())},[e]),s}function Dr(e){const t=Tt(e);return on(e,t)}const Zt=[];function Er(e){const t=o.useRef(e),n=Je(s=>e?s&&s!==Zt&&e&&t.current&&e.parentNode===t.current.parentNode?s:Et(e):Zt,[e]);return o.useEffect(()=>{t.current=e},[e]),n}function Ar(e){const[t,n]=o.useState(null),s=o.useRef(e),i=o.useCallback(a=>{const d=pt(a.target);d&&n(l=>l?(l.set(d,vt(d)),new Map(l)):null)},[]);return o.useEffect(()=>{const a=s.current;if(e!==a){d(a);const l=e.map(f=>
5{const u=pt(f);return u?(u.addEventListener("scroll",i,{passive:!0}),[u,vt(u)]):null}).filter(f=>f!=null);n(l.length?new Map(l):null),s.current=e}return()=>{d(e),d(a)};function d(l){l.forEach(f=>{const u=pt(f);u?.removeEventListener("scroll",i)})}},[i,e]),o.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,d)=>De(a,d),te):mn(e):te,[e,t])}function Gt(e,t){t===void 0&&(t=[]);const n=o.useRef(null);return o.useEffect(()=>{n.current=null},t),o.useEffect(()=>{const s=e!==te;s&&!n.current&&(n.current=e),!s&&n.current&&(n.current=null)},[e]),n.current?tt(e,n.current):te}function Rr(e){o.useEffect(()=>{if(!it)return;const t=e.map(n=>{let{sensor:s}=n;return s.setup==null?void 0:s.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function Mr(e,t){return o.useMemo(()=>e.reduce((n,s)=>{let{eventName:i,handler:a}=s;return n[i]=d=>{a(d,t)},n},{}),[e,t])}function bn(e){return o.useMemo(()=>e?nr(e):null,[e])}const qt=[];function Tr(e,t){t===void 0&&(t=Ve);const[n]=e,s=bn(n?Y(n):null),[i,a]=o.useState(qt);function d(){a(()=>e.length?e.map(f=>fn(f)?s:new At(t(f),f)):qt)}const l=lt({callback:d});return ae(()=>{l?.disconnect(),d(),e.forEach(f=>l?.observe(f))},[e]),i}function vn(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Xe(t)?t:e}function Or(e){let{measure:t}=e;const[n,s]=o.useState(null),i=o.useCallback(u=>{for(const{target:c}of u)if(Xe(c)){s(h=>{const x=t(c);return h?{...h,width:x.width,height:x.height}:x});break}},[t]),a=lt({callback:i}),d=o.useCallback(u=>{const c=vn(u);a?.disconnect(),c&&a?.observe(c),s(c?t(c):null)},[t,a]),[l,f]=Qe(d);return o.useMemo(()=>({nodeRef:l,rect:n,setRef:f}),[n,l,f])}const _r=[{sensor:Mt,options:{}},{sensor:xn,options:{}}],zr={current:{}},qe={draggable:{measure:Wt},droppable:{measure:Wt,strategy:We.WhileDragging,frequency:wt.Optimized},dragOverlay:{measure:Ve}};class Fe extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,s;return(n=(s=this.get(t))==null?void 0:s.node.current)!=null?n:void 0}}const Lr={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Fe,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:rt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:qe,measureDroppableContainers:rt,windowRect:null,measuringScheduled:!1},yn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:rt,draggableNodes:new Map,over:null,measureDroppableContainers:rt},Ue=o.createContext(yn),wn=o.createContext(Lr);function Pr(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Fe}}}function $r(e,t){switch(t.type){case P.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case P.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case P.DragEnd:case P.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case P.RegisterDroppable:{const{element:n}=t,{id:s}=n,i=new Fe(e.droppable.containers);return i.set(s,n),{...e,droppable:{...e.droppable,containers:i}}}case P.SetDroppableDisabled:{const{id:n,key:s,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||s!==a.key)return e;const d=new Fe(e.droppable.containers);return d.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:d}}}case P.UnregisterDroppable:{const{id:n,key:s}=t,i=e.droppable.containers.get(n);if(!i||s!==i.key)return e;const a=new Fe(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Ir(e){let{disabled:t}=e;const{active:n,activatorEvent:s,draggableNodes:i}=o.useContext(Ue),a=et(s),d=et(n?.id);return o.useEffect(()=>{if(!t&&!s&&a&&d!=null){if(!Dt(a)||document.activeElement===a.target)return;const l=i.get(d);if(!l)return;const{activatorNode:f,node:u}=l;if(!f.current&&!u.current)return;requestAnimationFrame(()=>{for(const c of[f.current,u.current]){if(!c)continue;const h=_n(c);if(h){h.focus();break}}})}},[s,t,i,d,a]),null}function kn(e,t){let{transform:n,...s}=t;return e!=null&&e.length?e.reduce((i,a)=>a({transform:i,...s}),n):n}function Br(e){return o.useMemo(()=>({draggable:{...qe.draggable,...e?.draggable},droppable:{...qe.droppable,...e?.droppable},dragOverlay:{...qe.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Fr(e){let{activeNode:t,measure:n,initialRect:s,config:i=!0}=e;const a=o.useRef(!1),{x:d,y:l}=typeof i=="boolean"?{x:i,y:i}:i;ae(()=>{if(!d&&!l||!t){a.current=!1;return}if(a.current||!s)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const c=n(u),h=on(c,s);if(d||(h.x=0),l||(h.y=0),a.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const x=cn(u);x&&x.scrollBy({top:h.y,left:h.x})}},[t,d,l,s,n])}const ct=o.createContext({...te,scaleX:1,scaleY:1}
5);var he;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(he||(he={}));const Kr=o.memo(function(t){var n,s,i,a;let{id:d,accessibility:l,autoScroll:f=!0,children:u,sensors:c=_r,collisionDetection:h=Zn,measuring:x,modifiers:p,...D}=t;const v=o.useReducer($r,void 0,Pr),[b,k]=v,[E,y]=Bn(),[C,w]=o.useState(he.Uninitialized),S=C===he.Initialized,{draggable:{active:N,nodes:j,translate:R},droppable:{containers:T}}=b,O=N!=null?j.get(N):null,W=o.useRef({initial:null,translated:null}),F=o.useMemo(()=>{var K;return N!=null?{id:N,data:(K=O?.data)!=null?K:zr,rect:W}:null},[N,O]),X=o.useRef(null),[ke,me]=o.useState(null),[m,z]=o.useState(null),g=Ke(D,Object.values(D)),A=ot("DndDescribedBy",d),_=o.useMemo(()=>T.getEnabled(),[T]),J=Br(x),{droppableRects:se,measureDroppableContainers:V,measuringScheduled:Me}=Nr(_,{dragging:S,dependencies:[R.x,R.y],config:J.droppable}),$=wr(j,N),oe=o.useMemo(()=>m?nt(m):null,[m]),pe=Rn(),Te=jr($,J.draggable.measure);Fr({activeNode:N!=null?j.get(N):null,config:pe.layoutShiftCompensation,initialRect:Te,measure:J.draggable.measure});const ee=Ht($,J.draggable.measure,Te),dt=Ht($?$.parentElement:null),ge=o.useRef({activatorEvent:null,active:null,activeNode:$,collisionRect:null,collisions:null,droppableRects:se,draggableNodes:j,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ot=T.getNodeFor((n=ge.current.over)==null?void 0:n.id),xe=Or({measure:J.dragOverlay.measure}),He=(s=xe.nodeRef.current)!=null?s:$,Ne=S?(i=xe.rect)!=null?i:ee:null,_t=!!(xe.nodeRef.current&&xe.rect),zt=Dr(_t?null:ee),ut=bn(He?Y(He):null),le=Er(S?Ot??$:null),Ze=Tr(le),Ge=kn(p,{transform:{x:R.x-zt.x,y:R.y-zt.y,scaleX:1,scaleY:1},activatorEvent:m,active:F,activeNodeRect:ee,containerNodeRect:dt,draggingNodeRect:Ne,over:ge.current.over,overlayNodeRect:xe.rect,scrollableAncestors:le,scrollableAncestorRects:Ze,windowRect:ut}),Lt=oe?De(oe,R):null,Pt=Ar(le),Nn=Gt(Pt),jn=Gt(Pt,[ee]),je=De(Ge,Nn),Ce=Ne?Qn(Ne,Ge):null,Oe=F&&Ce?h({active:F,collisionRect:Ce,droppableRects:se,droppableContainers:_,pointerCoordinates:Lt}):null,$t=Un(Oe,"id"),[ce,It]=o.useState(null),Cn=_t?Ge:De(Ge,jn),Sn=Gn(Cn,(a=ce?.rect)!=null?a:null,ee),ft=o.useRef(null),Bt=o.useCallback((K,U)=>{let{sensor:H,options:de}=U;if(X.current==null)return;const G=j.get(X.current);if(!G)return;const Z=K.nativeEvent,ne=new H({active:X.current,activeNode:G,event:Z,options:de,context:ge,onAbort(B){if(!j.get(B))return;const{onDragAbort:re}=g.current,ie={id:B};re?.(ie),E({type:"onDragAbort",event:ie})},onPending(B,ue,re,ie){if(!j.get(B))return;const{onDragPending:ze}=g.current,fe={id:B,constraint:ue,initialCoordinates:re,offset:ie};ze?.(fe),E({type:"onDragPending",event:fe})},onStart(B){const ue=X.current;if(ue==null)return;const re=j.get(ue);if(!re)return;const{onDragStart:ie}=g.current,_e={activatorEvent:Z,active:{id:ue,data:re.data,rect:W}};$e.unstable_batchedUpdates(()=>{ie?.(_e),w(he.Initializing),k({type:P.DragStart,initialCoordinates:B,active:ue}),E({type:"onDragStart",event:_e}),me(ft.current),z(Z)})},onMove(B){k({type:P.DragMove,coordinates:B})},onEnd:Se(P.DragEnd),onCancel:Se(P.DragCancel)});ft.current=ne;function Se(B){return async function(){const{active:re,collisions:ie,over:_e,scrollAdjustedTranslate:ze}=ge.current;let fe=null;if(re&&ze){const{cancelDrop:Le}=g.current;fe={activatorEvent:Z,active:re,collisions:ie,delta:ze,over:_e},B===P.DragEnd&&typeof Le=="function"&&await Promise.resolve(Le(fe))&&(B=P.DragCancel)}X.current=null,$e.unstable_batchedUpdates(()=>{k({type:B}),w(he.Uninitialized),It(null),me(null),z(null),ft.current=null;const Le=B===P.DragEnd?"onDragEnd":"onDragCancel";if(fe){const ht=g.current[Le];ht?.(fe),E({type:Le,event:fe})}})}}},[j]),Dn=o.useCallback((K,U)=>(H,de)=>{const G=H.nativeEvent,Z=j.get(de);if(X.current!==null||!Z||G.dndKit||G.defaultPrevented)return;const ne={active:Z};K(H,U.options,ne)===!0&&(G.dndKit={capturedBy:U.sensor},X.current=de,Bt(H,U))},[j,Bt]),Ft=kr(c,Dn);Rr(c),ae(()=>{ee&&C===he.Initializing&&w(he.Initialized)},[ee,C]),o.useEffect(()=>{const{onDragMove:K}=g.current,{active:U,activatorEvent:H,collisions:de,over:G}=ge.current;if(!U||!H)return;const Z={active:U,activatorEvent:H,collisions:de,delta:{x:je.x,y:je.y},over:G};$e.unstable_batchedUpdates(()=>{K?.(Z),E({type:"onDragMove",event:Z})})},[je.x,je.y]),o.useEffect(()=>{const{active:K,activatorEvent:U,collisions:H,droppableContainers:de,scrollAdjustedTranslate:G}=ge.current;if(!K||X.current==null||!U||!G)return;const{onDragOver:Z}=g.current,ne=de.get($t),Se=ne&&ne.rect.current?{id:ne.id,rect:ne.rect.current,data:ne.data,disabled:ne.disabled}:null,B={active:K,activatorEvent:U,collisions:H,delta:{x:G.x,y:G.y},over:Se};$e.unstable_batchedUpdates(()=>{It(Se),Z?.(B),E({type:"onDragOver",event:B})})},[$t]),ae(()=>{ge.current={activatorEvent:m,active:F,activeNode:$,collisionRect:Ce,collisions:Oe,droppableRects:se,draggableNodes:j,draggingNode:He,draggingNodeRect:Ne,droppableContainers:T,over:ce,scrollableAncestors:le,scrollAdjustedTranslate:je},W.current={initial:Ne,translated:Ce}},[F,$,Oe,Ce,j,He,Ne,se,T,ce,le,je]),br({...pe,delta:R,draggingRect:Ce,pointerCoordinates:Lt,scrollableAncestors:le,scrollableAncestorRects:Ze});const En=o.useMemo(()=>({active:F,activeNode:$,activeNodeRect:ee,activatorEvent:m,collisions:Oe,containerNodeRect:dt,dragOverlay:xe,draggableNodes:j,droppableContainers:T,droppableRects:se,over:ce,measureDroppableContainers:V,scrollableAncestors:le,scrollableAncestorRects:Ze,measuringConfiguration:J,measuringScheduled:Me,windowRect:ut}),[F,$,ee,m,Oe,dt,xe,j,T,se,ce,V,le,Ze,J,Me,ut]),An=o.useMemo(()=>({activatorEvent:m,activators:Ft,active:F,activeNodeRect:ee,ariaDescribedById:{draggable:A},dispatch:k,draggableNodes:j,over:ce,measureDroppableContainers:V}),[m,Ft,F,ee,k,A,j,ce,V]);return L.createElement(an.Provider,{value:y},L.createElement(Ue.Provider,{value:An},L.createElement(wn.Provider,{value:En},L.createElement(ct.Provider,{value:Sn},u)),L.createElement(Ir,{disabled:l?.restoreFocus===!1})),L.createElement(Yn,{...l,hiddenTextDescribedById:A}));function Rn(){const K=ke?.autoScrollEnabled===!1,U=typeof f=="object"?f.enabled===!1:f===!1,H=S&&!K&&!U;return typeof f=="object"?{...f,enabled:H}:{enabled:H}}}),Yr=o.createContext(null),Qt="button",Wr="Draggable";function Xr(e){let{id:t,data:n,disabled:s=!1,attributes:i}=e;const a=ot(Wr),{activators:d,activatorEvent:l,active:f,activeNodeRect:u,ariaDescribedById:c,draggableNodes:h,over:x}=o.useContext(Ue),{role:p=Qt,roleDescription:D="draggable",tabIndex:v=0}=i??{},b=f?.id===t,k=o.useContext(b?ct:Yr),[E,y]=Qe(),[C,w]=Qe(),S=Mr(d,t),N=Ke(n);ae(()=>(h.set(t,{id:t,key:a,node:E,activatorNode:C,data:N}),()=>{const R=h.get(t);R&&R.key===a&&h.delete(t)}),[h,t]);const j=o.useMemo(()=>({role:p,tabIndex:v,"aria-disabled":s,"aria-pressed":b&&p===Qt?!0:void 0,"aria-roledescription":D,"aria-describedby":c.draggable}),[s,p,v,b,D,c.draggable]);return{active:f,activatorEvent:l,activeNodeRect:u,attributes:j,isDragging:b,listeners:s?void 0:S,node:E,over:x,setNodeRef:y,setActivatorNodeRef:w,transform:k}}function Jr(){return o.useContext(wn)}const Vr="Droppable",Ur={timeout:25};function Hr(e){let{data:t,disabled:n=!1,id:s,resizeObserverConfig:i}=e;const a=ot(Vr),{active:d,dispatch:l,over:f,measureDroppableContainers:u}=o.useContext(Ue),c=o.useRef({disabled:n}),h=o.useRef(!1),x=o.useRef(null),p=o.useRef(null),{disabled:D,updateMeasurementsFor:v,timeout:b}={...Ur,...i},k=Ke(v??s),E=o.useCallback(()=>
5{if(!h.current){h.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{u(Array.isArray(k.current)?k.current:[k.current]),p.current=null},b)},[b]),y=lt({callback:E,disabled:D||!d}),C=o.useCallback((j,R)=>{y&&(R&&(y.unobserve(R),h.current=!1),j&&y.observe(j))},[y]),[w,S]=Qe(C),N=Ke(t);return o.useEffect(()=>{!y||!w.current||(y.disconnect(),h.current=!1,y.observe(w.current))},[w,y]),o.useEffect(()=>(l({type:P.RegisterDroppable,element:{id:s,key:a,disabled:n,node:w,rect:x,data:N}}),()=>l({type:P.UnregisterDroppable,key:a,id:s})),[s]),o.useEffect(()=>{n!==c.current.disabled&&(l({type:P.SetDroppableDisabled,id:s,key:a,disabled:n}),c.current.disabled=n)},[s,a,n,l]),{active:d,rect:x,isOver:f?.id===s,node:w,over:f,setNodeRef:S}}function Zr(e){let{animation:t,children:n}=e;const[s,i]=o.useState(null),[a,d]=o.useState(null),l=et(n);return!n&&!s&&l&&i(l),ae(()=>{if(!a)return;const f=s?.key,u=s?.props.id;if(f==null||u==null){i(null);return}Promise.resolve(t(u,a)).then(()=>{i(null)})},[t,s,a]),L.createElement(L.Fragment,null,n,s?o.cloneElement(s,{ref:d}):null)}const Gr={x:0,y:0,scaleX:1,scaleY:1};function qr(e){let{children:t}=e;return L.createElement(Ue.Provider,{value:yn},L.createElement(ct.Provider,{value:Gr},t))}const Qr={position:"fixed",touchAction:"none"},es=e=>Dt(e)?"transform 250ms ease":void 0,ts=o.forwardRef((e,t)=>{let{as:n,activatorEvent:s,adjustScale:i,children:a,className:d,rect:l,style:f,transform:u,transition:c=es}=e;if(!l)return null;const h=i?u:{...u,scaleX:1,scaleY:1},x={...Qr,width:l.width,height:l.height,top:l.top,left:l.left,transform:Ye.Transform.toString(h),transformOrigin:i&&s?Jn(s,l):void 0,transition:typeof c=="function"?c(s):c,...f};return L.createElement(n,{className:d,style:x,ref:t},a)}),ns=e=>t=>{let{active:n,dragOverlay:s}=t;const i={},{styles:a,className:d}=e;if(a!=null&&a.active)for(const[l,f]of Object.entries(a.active))f!==void 0&&(i[l]=n.node.style.getPropertyValue(l),n.node.style.setProperty(l,f));if(a!=null&&a.dragOverlay)for(const[l,f]of Object.entries(a.dragOverlay))f!==void 0&&s.node.style.setProperty(l,f);return d!=null&&d.active&&n.node.classList.add(d.active),d!=null&&d.dragOverlay&&s.node.classList.add(d.dragOverlay),function(){for(const[f,u]of Object.entries(i))n.node.style.setProperty(f,u);d!=null&&d.active&&n.node.classList.remove(d.active)}},rs=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Ye.Transform.toString(t)},{transform:Ye.Transform.toString(n)}]},ss={duration:250,easing:"ease",keyframes:rs,sideEffects:ns({styles:{active:{opacity:"0"}}})};function is(e){let{config:t,draggableNodes:n,droppableContainers:s,measuringConfiguration:i}=e;return at((a,d)=>{if(t===null)return;const l=n.get(a);if(!l)return;const f=l.node.current;if(!f)return;const u=vn(d);if(!u)return;const{transform:c}=Y(d).getComputedStyle(d),h=ln(c);if(!h)return;const x=typeof t=="function"?t:as(t);return pn(f,i.draggable.measure),x({active:{id:a,data:l.data,node:f,rect:i.draggable.measure(f)},draggableNodes:n,dragOverlay:{node:d,rect:i.dragOverlay.measure(u)},droppableContainers:s,measuringConfiguration:i,transform:h})})}function as(e){const{duration:t,easing:n,sideEffects:s,keyframes:i}={...ss,...e};return a=>{let{active:d,dragOverlay:l,transform:f,...u}=a;if(!t)return;const c={x:l.rect.left-d.rect.left,y:l.rect.top-d.rect.top},h={scaleX:f.scaleX!==1?d.rect.width*f.scaleX/l.rect.width:1,scaleY:f.scaleY!==1?d.rect.height*f.scaleY/l.rect.height:1},x={x:f.x-c.x,y:f.y-c.y,...h},p=i({...u,active:d,dragOverlay:l,transform:{initial:f,final:x}}),[D]=p,v=p[p.length-1];if(JSON.stringify(D)===JSON.stringify(v))return;const b=s?.({active:d,dragOverlay:l,...u}),k=l.node.animate(p,{duration:t,easing:n,fill:"forwards"});return new Promise(E=>{k.onfinish=()=>{b?.(),E()}})}}let en=0;function os(e){return o.useMemo(()=>{if(e!=null)return en++,en},[e])}const ls=L.memo(e=>
5{let{adjustScale:t=!1,children:n,dropAnimation:s,style:i,transition:a,modifiers:d,wrapperElement:l="div",className:f,zIndex:u=999}=e;const{activatorEvent:c,active:h,activeNodeRect:x,containerNodeRect:p,draggableNodes:D,droppableContainers:v,dragOverlay:b,over:k,measuringConfiguration:E,scrollableAncestors:y,scrollableAncestorRects:C,windowRect:w}=Jr(),S=o.useContext(ct),N=os(h?.id),j=kn(d,{activatorEvent:c,active:h,activeNodeRect:x,containerNodeRect:p,draggingNodeRect:b.rect,over:k,overlayNodeRect:b.rect,scrollableAncestors:y,scrollableAncestorRects:C,transform:S,windowRect:w}),R=Tt(x),T=is({config:s,draggableNodes:D,droppableContainers:v,measuringConfiguration:E}),O=R?b.setRef:void 0;return L.createElement(qr,null,L.createElement(Zr,{animation:T},h&&N?L.createElement(ts,{key:N,id:h.id,ref:O,as:l,activatorEvent:c,adjustScale:t,className:f,transition:a,rect:R,style:{zIndex:u,...i},transform:j},n):null))}),cs=ve({method:"POST"}).middleware([we]).handler(ye("4fae14020c51a5d529f745b57d75a34494f3b7bc6f3cc3fe7b473fadce1dc796")),ds=ve({method:"POST"}).middleware([we]).handler(ye("a544aad155ccbebe1b0725f14da943e2f056312b7fd2114a42b837fdcddc7d43")),us=ve({method:"POST"}).middleware([we]).handler(ye("c5fd548d25bd9fbf2308ae9398730d3d2ee72583f0d9733481a5d2451ed20578")),fs=ve({method:"POST"}).middleware([we]).handler(ye("140ab195e8545ad77c796cbd854f7654224b31861db4511ef5e180b871b69e2f")),hs=ve({method:"POST"}).middleware([we]).handler(ye("45505697666c7c78d46d7d11741bc528d92ccd8a8597ade1f6accb427572bf89")),ms=ve({method:"POST"}).middleware([we]).handler(ye("f98a3eac92c7b32851fb366aee017d690ee342b6dc133687496d2d037b7bc2b8")),ps=ve({method:"POST"}).middleware([we]).handler(ye("1f537b701fea6bd65f28a3bb3dc5c53b8cc3c30ad2559d70ec3fcddd38a756e6")),Ee=[{code:"G",label:"G-Junioren",minAge:0,maxAge:6},{code:"F",label:"F-Junioren",minAge:7,maxAge:8},{code:"E",label:"E-Junioren",minAge:9,maxAge:10},{code:"D",label:"D-Junioren",minAge:11,maxAge:13},{code:"C",label:"C-Junioren",minAge:14,maxAge:15},{code:"B",label:"B-Junioren",minAge:16,maxAge:17},{code:"A",label:"A-Junioren",minAge:18,maxAge:20},{code:"Aktive",label:"Aktive / Senioren",minAge:21,maxAge:999}];function gs(e,t){if(!e)return null;const n=new Date(e).getFullYear();if(Number.isNaN(n))return null;const s=t-n;return Ee.find(a=>s>=a.minAge&&s<=a.maxAge)?.code??null}function kt(e){if(!e)return null;const t=e.toLowerCase();return t.startsWith("g-")?"G":t.startsWith("f")?"F":t.startsWith("e")?"E":t.startsWith("d")?"D":t.startsWith("c")?"C":t.startsWith("b")?"B":t.startsWith("a-jun")?"A":"Aktive"}function Rs(){const e=new Date().getFullYear(),[t,n]=o.useState(e+1),[s,i]=o.useState([]),[a,d]=o.useState([]),[l,f]=o.useState(new Set),[u,c]=o.useState("mapping"),[h,x]=o.useState(!0),[p,D]=o.useState(new Set);o.useEffect(()=>{(async()=>{const[y,C]=await Promise.all([Kt.from("players").select("id, first_name, last_name, birth_date, team_id, email, parent_email1, parent_email2").order("last_name"),Kt.from("teams").select("id, name, group_name, sort_order").order("sort_order")]);i(y.data??[]),d(C.data??[]),x(!1)})()},[]);const v=o.useMemo(()=>new Map(a.map(y=>[y.id,y])),[a]),b=o.useMemo(()=>s.map(y=>{const C=y.team_id?v.get(y.team_id):void 0,w=kt(C?.name),S=gs(y.birth_date,t),N=!!w&&!!S&&w!==S;let j="unknown";return S?w===S?j="stays":S==="Aktive"&&w!=="Aktive"?j="moves_out":j="moves_up":j="unknown",{player:y,team:C,currentCat:w,nextCat:S,changed:N,birthYear:y.birth_date?new Date(y.birth_date).getFullYear():null,status:j}}),[s,v,t]),k=o.useMemo(()=>{const y=new Map;return Ee.forEach(C=>y.set(C.code,{incoming:0,staying:0,outgoing:0,total:0})),b.forEach(C=>{if(C.nextCat){const w=y.get(C.nextCat);w.total+=1,C.currentCat===C.nextCat?w.staying+=1:w.incoming+=1}if(C.currentCat&&C.currentCat!==C.nextCat){const w=y.get(C.currentCat);w&&(w.outgoing+=1)}}),y},[b]),E=y=>{f(C=>{const w=new Set(C);return w.has(y)?w.delete(y):w.add(y),w})};return h?r.jsx("p",{className:"text-sm text-fcu-ink/60",children:"Lädt…"}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-display text-xl text-fcu-ink",children:"Saisonplanung & Altersklassen-Übertritt"}),r.jsx("p",{className:"text-sm text-fcu-ink/60",children:"Berechnet automatisch die SFV-Alterskategorie pro Spieler:in für die kommende Saison."})]}),r.jsxs("label",{className:"flex items-center gap-2 text-sm",children:["Saisonstart (Jahr):",r.jsx("input",{type:"number",value:t,onChange:y=>n(parseInt(y.target.value||"0",10)),className:"w-24 rounded-md border border-fcu-ink/20 px-2 py-1"}),r.jsxs("span",{className:"text-fcu-ink/60",children:["→ Saison ",t,"/",(t+1).toString().slice(2)]})]})]}),r.jsx("div",{className:"flex gap-2 border-b border-fcu-ink/10",children:[{id:"mapping",label:"Jahrgangs-Mapping"},{id:"simulation",label:"Übertritts-Simulation"},{id:"roster",label:"Roster-Building"},{id:"mail",label:"Kommunikation"}].map(y=>r.jsx("button",{onClick:()=>
5c(y.id),className:`px-3 py-2 text-sm ${u===y.id?"border-b-2 border-fcu-red font-medium text-fcu-ink":"text-fcu-ink/60"}`,children:y.label},y.id))}),u==="mapping"&&r.jsx(xs,{rows:b,selected:l,toggle:E}),u==="simulation"&&r.jsx(bs,{rows:b,simulationByCat:k,expanded:p,setExpanded:D}),u==="roster"&&r.jsx(vs,{rows:b,teams:a,seasonStartYear:t}),u==="mail"&&r.jsx(Ns,{rows:b,seasonStartYear:t})]})}function xs({rows:e,selected:t,toggle:n}){const[s,i]=o.useState(1),[a,d]=o.useState(30);o.useEffect(()=>{i(1)},[e.length,a]);const l=a==="all"?1:Math.max(1,Math.ceil(e.length/a)),f=Math.min(s,l),u=a==="all"?e:e.slice((f-1)*a,f*a);return r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"overflow-x-auto rounded-md border border-fcu-ink/10",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{className:"bg-fcu-ink/5 text-left text-xs uppercase tracking-wide text-fcu-ink/60",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-3 py-2"}),r.jsx("th",{className:"px-3 py-2",children:"Name"}),r.jsx("th",{className:"px-3 py-2",children:"Jahrgang"}),r.jsx("th",{className:"px-3 py-2",children:"Aktuelles Team"}),r.jsx("th",{className:"px-3 py-2",children:"Aktuelle Kat."}),r.jsx("th",{className:"px-3 py-2",children:"Nächste Kat."}),r.jsx("th",{className:"px-3 py-2",children:"Übertritt"})]})}),r.jsxs("tbody",{children:[u.map(c=>r.jsxs("tr",{className:`border-t border-fcu-ink/10 ${c.changed?"bg-amber-50":""}`,children:[r.jsx("td",{className:"px-3 py-2",children:r.jsx("input",{type:"checkbox",checked:t.has(c.player.id),onChange:()=>n(c.player.id)})}),r.jsxs("td",{className:"px-3 py-2",children:[c.player.first_name," ",c.player.last_name]}),r.jsx("td",{className:"px-3 py-2",children:c.birthYear??"—"}),r.jsx("td",{className:"px-3 py-2",children:c.team?.name??"—"}),r.jsx("td",{className:"px-3 py-2",children:c.currentCat??"—"}),r.jsx("td",{className:"px-3 py-2 font-medium",children:c.nextCat??"—"}),r.jsx("td",{className:"px-3 py-2",children:c.changed?r.jsxs("span",{className:"rounded-full bg-fcu-red/10 px-2 py-0.5 text-xs text-fcu-red",children:[c.currentCat," → ",c.nextCat]}):r.jsx("span",{className:"text-fcu-ink/40",children:"bleibt"})})]},c.player.id)),u.length===0&&r.jsx("tr",{children:r.jsx("td",{colSpan:7,className:"px-3 py-6 text-center text-fcu-ink/60",children:"Keine Spielerdaten vorhanden."})})]})]})}),r.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border border-fcu-ink/15 bg-white p-3 sm:flex-row sm:items-center sm:justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs text-fcu-ink/70",children:[r.jsx("span",{children:a==="all"?`${e.length} Einträge`:`${(f-1)*a+1}–${Math.min(f*a,e.length)} von ${e.length}`}),r.jsxs("select",{value:a,onChange:c=>d(c.target.value==="all"?"all":Number(c.target.value)),className:"rounded-md border border-fcu-ink/20 bg-white px-2 py-1 text-xs focus:border-fcu-red focus:outline-none",children:[r.jsx("option",{value:30,children:"30 pro Seite"}),r.jsx("option",{value:100,children:"100 pro Seite"}),r.jsx("option",{value:"all",children:"Alle anzeigen"})]})]}),a!=="all"&&l>1&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{onClick:()=>i(c=>Math.max(1,c-1)),disabled:f<=1,className:"inline-flex items-center rounded-md border border-fcu-ink/20 px-2 py-1 text-xs text-fcu-ink/70 hover:bg-fcu-ink/5 disabled:opacity-40 disabled:cursor-not-allowed",children:r.jsx(Nt,{className:"h-3.5 w-3.5"})}),Array.from({length:l},(c,h)=>h+1).map(c=>r.jsx("button",{onClick:()=>i(c),className:`min-w-[28px] rounded-md px-2 py-1 text-xs font-semibold ${c===f?"bg-fcu-ink text-white":"border border-fcu-ink/20 text-fcu-ink/70 hover:bg-fcu-ink/5"}`,children:c},c)),r.jsx("button",{onClick:()=>i(c=>Math.min(l,c+1)),disabled:f>=l,className:"inline-flex items-center rounded-md border border-fcu-ink/20 px-2 py-1 text-xs text-fcu-ink/70 hover:bg-fcu-ink/5 disabled:opacity-40 disabled:cursor-not-allowed",children:r.jsx(jt,{className:"h-3.5 w-3.5"})})]})]})]})}function bs({rows:e,simulationByCat:t,expanded:n,setExpanded:s}){return r.jsx("div",{className:"space-y-3",children:Ee.map(i=>{const a=t.get(i.code),d=n.has(i.code),l=e.filter(c=>c.nextCat===i.code&&c.currentCat===i.code),f=e.filter(c=>c.nextCat===i.code&&c.currentCat!==i.code),u=e.filter(c=>c.currentCat===i.code&&c.nextCat!==i.code);return r.jsxs("div",{className:"rounded-md border border-fcu-ink/10",children:[r.jsxs("button",{type:"button",onClick:()=>s(c=>{const h=new Set(c);
5return h.has(i.code)?h.delete(i.code):h.add(i.code),h}),className:"flex w-full items-center justify-between gap-4 px-4 py-3 text-left hover:bg-fcu-ink/5",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"text-fcu-ink/40",children:d?"▾":"▸"}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-display text-lg text-fcu-ink",children:i.label}),r.jsxs("p",{className:"text-xs text-fcu-ink/50",children:["Alter ",i.minAge,"–",i.maxAge===999?"+":i.maxAge]})]})]}),r.jsxs("div",{className:"flex items-center gap-6 text-xs",children:[r.jsxs("div",{className:"text-right",children:[r.jsx("div",{className:"text-fcu-ink/50",children:"Bleibt"}),r.jsx("div",{className:"font-medium",children:a.staying})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{className:"text-emerald-700/70",children:"Zugang"}),r.jsxs("div",{className:"font-medium text-emerald-700",children:["+",a.incoming]})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{className:"text-fcu-red/70",children:"Abgang"}),r.jsxs("div",{className:"font-medium text-fcu-red",children:["−",a.outgoing]})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{className:"text-fcu-ink/50",children:"Total"}),r.jsx("div",{className:"text-xl font-bold text-fcu-red",children:a.total})]})]})]}),d&&r.jsxs("div",{className:"grid gap-4 border-t border-fcu-ink/10 px-4 py-3 md:grid-cols-3",children:[r.jsx(bt,{title:"Bleibt",tone:"ink",list:l,mode:"stay"}),r.jsx(bt,{title:"Zugang",tone:"emerald",list:f,mode:"in"}),r.jsx(bt,{title:"Abgang",tone:"red",list:u,mode:"out"})]})]},i.code)})})}function bt({title:e,tone:t,list:n,mode:s}){const i=t==="emerald"?"text-emerald-700":t==="red"?"text-fcu-red":"text-fcu-ink";return r.jsxs("div",{children:[r.jsxs("h4",{className:`mb-1 text-xs font-medium uppercase tracking-wide ${i}`,children:[e," (",n.length,")"]}),n.length===0?r.jsx("p",{className:"text-xs text-fcu-ink/40",children:"—"}):r.jsx("ul",{className:"space-y-1 text-sm",children:n.map(a=>r.jsxs("li",{className:"flex items-baseline justify-between gap-2",children:[r.jsxs("span",{children:[a.player.first_name," ",a.player.last_name," ",r.jsxs("span",{className:"text-fcu-ink/40",children:["(Jg. ",a.birthYear??"?",")"]})]}),s==="in"&&a.currentCat&&r.jsxs("span",{className:"text-xs text-fcu-ink/50",children:["aus ",a.currentCat]}),s==="out"&&a.nextCat&&r.jsxs("span",{className:"text-xs text-fcu-ink/50",children:["→ ",a.nextCat]})]},a.player.id))})]})}function vs({rows:e,teams:t,seasonStartYear:n}){const[s,i]=o.useState(new Map),[a,d]=o.useState(!1),[l,f]=o.useState(""),[u,c]=o.useState(!1),h=be(cs),x=be(ds),p=be(us),D=be(fs),v=be(hs),[b,k]=o.useState(!1),[E,y]=o.useState(1),[C,w]=o.useState(""),S=nn();o.useEffect(()=>{(async()=>{d(!1);try{const g=await h({data:{seasonStartYear:n}}),A=new Map;(g.rows??[]).forEach(_=>A.set(_.player_id,_.proposed_team_id)),i(A)}catch(g){q.error(g?.message??"Konnte Draft nicht laden")}d(!0)})()},[n,h]);const N=Xn(Wn(Mt,{activationConstraint:{distance:5}})),[j,R]=o.useState(null),T=j?e.find(g=>g.player.id===j)??null:null,O=o.useMemo(()=>new Map(e.map(g=>[g.player.id,g])),[e]),W=o.useMemo(()=>{const g=new Map;return Ee.forEach(A=>g.set(A.code,[])),t.forEach(A=>{const _=kt(A.name)??"Aktive";g.get(_).push(A)}),g},[t]),F=o.useMemo(()=>{const g=new Map;return g.set("__unassigned",[]),t.forEach(A=>g.set(A.id,[])),e.forEach(A=>{const _=s.get(A.player.id);_&&g.has(_)?g.get(_).push(A):g.get("__unassigned").push(A)}),g},[e,t,s]);async function X(g){R(null);const A=g.active.id,_=g.over?.id;if(!_)return;const J=_==="__unassigned"?null:_,se=s.get(A)??null;if(J===se)return;const V=O.get(A),Me=J?t.find(oe=>oe.id===J):null,$=Me?kt(Me.name):null;$&&V?.nextCat&&$!==V.nextCat&&$!=="Aktive"&&q.warning(`Achtung: ${V.player.first_name} ${V.player.last_name} (Jg. ${V.birthYear??"?"}, Kat. ${V.nextCat}) wird in ${$} eingeteilt.`),i(oe=>{const pe=new Map(oe);return pe.set(A,J),pe});try{await p({data:{seasonStartYear:n,playerId:A,proposedTeamId:J,note:$&&V?.nextCat&&$!==V.nextCat?"Altersausnahme":null}})}catch(oe){q.error(oe?.message??"Speichern fehlgeschlagen"),i(pe=>{const Te=new Map(pe);return Te.set(A,se),Te})}}
5async function ke(){if(!(s.size>0&&!await S({title:"Draft überschreiben?",description:"Der bestehende Vorschlag wird durch eine neue Generierung ersetzt.",confirmText:"Überschreiben"}))){c(!0);try{await x({data:{seasonStartYear:n,overwrite:!0}});const g=await h({data:{seasonStartYear:n}}),A=new Map;(g.rows??[]).forEach(_=>A.set(_.player_id,_.proposed_team_id)),i(A),q.success("Vorschlag generiert")}catch(g){q.error(g?.message??"Fehler")}c(!1)}}async function me(){c(!0);try{const g=await D({data:{seasonStartYear:n}});q.success(`${g.updated} Spieler aktualisiert. Seite neu laden für Aktualisierung.`),k(!1),y(1),w("")}catch(g){q.error(g?.message??"Commit fehlgeschlagen")}c(!1)}async function m(){if(await S({title:"Draft zurücksetzen?",description:`Alle ${s.size} vorgeschlagenen Zuweisungen werden gelöscht. Die aktuellen Team-Zuweisungen der Spieler bleiben unverändert.`,confirmText:"Zurücksetzen"})){c(!0);try{const g=await v({data:{seasonStartYear:n}});i(new Map),q.success(`Draft zurückgesetzt (${g.deleted} Einträge gelöscht)`)}catch(g){q.error(g?.message??"Reset fehlgeschlagen")}c(!1)}}if(!a)return r.jsx("p",{className:"text-sm text-fcu-ink/60",children:"Draft wird geladen…"});const z=g=>!l||`${g.player.first_name} ${g.player.last_name}`.toLowerCase().includes(l.toLowerCase());return r.jsxs("div",{className:"space-y-4",children:[r.jsx(ws,{rows:e,teams:t}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("button",{onClick:ke,disabled:u,className:"rounded-md bg-fcu-ink px-3 py-1.5 text-sm text-white hover:bg-fcu-ink/90 disabled:opacity-50",children:"Vorschlag generieren"}),r.jsx("button",{onClick:m,disabled:u||s.size===0,className:"rounded-md border border-fcu-ink/30 px-3 py-1.5 text-sm text-fcu-ink hover:bg-fcu-ink/5 disabled:opacity-50",children:"Draft zurücksetzen"}),r.jsx("button",{onClick:()=>{y(1),w(""),k(!0)},disabled:u||s.size===0,className:"rounded-md bg-fcu-red px-3 py-1.5 text-sm text-white hover:bg-fcu-red/90 disabled:opacity-50",children:"Draft auf Spieler übernehmen"}),r.jsx("input",{value:l,onChange:g=>f(g.target.value),placeholder:"Spieler suchen…",className:"ml-auto rounded-md border border-fcu-ink/20 px-2 py-1 text-sm"})]}),r.jsxs(Kr,{sensors:N,onDragStart:g=>R(g.active.id),onDragCancel:()=>R(null),onDragEnd:X,children:[r.jsxs("div",{className:"space-y-6",children:[r.jsx(tn,{id:"__unassigned",title:"Ohne Zuweisung",subtitle:`${F.get("__unassigned")?.length??0} Spieler`,players:(F.get("__unassigned")??[]).filter(z)}),Ee.map(g=>{const A=W.get(g.code)??[];return A.length===0?null:r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"font-display text-sm uppercase tracking-wide text-fcu-ink/60",children:g.label}),r.jsx("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3",children:A.map(_=>r.jsx(tn,{id:_.id,title:_.name,subtitle:`${F.get(_.id)?.length??0} Spieler`,players:(F.get(_.id)??[]).filter(z)},_.id))})]},g.code)})]}),r.jsx(ls,{dropAnimation:null,children:T?r.jsxs("div",{className:"flex items-center justify-between gap-2 rounded border-2 border-fcu-red bg-white px-2 py-1.5 text-xs shadow-lg ring-2 ring-fcu-red/30 cursor-grabbing",children:[r.jsxs("span",{className:"truncate font-medium",children:[T.player.first_name," ",T.player.last_name]}),r.jsxs("span",{className:"shrink-0 rounded-full bg-fcu-red/10 px-1.5 text-[10px] text-fcu-red",children:[T.nextCat??"?"," · ",T.birthYear??"?"]})]}):null})]}),b&&r.jsx(ys,{step:E,setStep:y,confirmText:C,setConfirmText:w,busy:u,rows:e,teams:t,draft:s,onCancel:()=>{k(!1),y(1),w("")},onConfirm:me})]})}function ys({step:e,setStep:t,confirmText:n,setConfirmText:s,busy:i,rows:a,teams:d,draft:l,onCancel:f,onConfirm:u}){const c=o.useMemo(()=>{let h=0,x=0,p=0,D=0;return a.forEach(v=>{if(!l.has(v.player.id))return;const b=l.get(v.player.id)??null,k=v.player.team_id??null;b===k?D+=1:!k&&b?x+=1:k&&!b?p+=1:h+=1}),{moves:h,newAssign:x,unassign:p,unchanged:D,total:l.size}},[a,l,d]);return r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:f,children:r.jsx("div",{className:"max-h-[90vh] w-full max-w-lg overflow-auto rounded-lg bg-white p-5 shadow-xl",onClick:h=>h.stopPropagation(),children:e===1?r.jsxs(r.Fragment,{children:[r.jsx("h3",{className:"font-display text-lg text-fcu-ink",children:"Draft auf Spieler übernehmen?"}),r.jsxs("p",{className:"mt-1 text-sm text-fcu-ink/70",children:["Diese Aktion schreibt die Team-Zuweisungen aus dem Draft direkt in die Spielerdaten (",r.jsx("code",{children:"players.team_id"}),")."]}),r.jsxs("div",{className:"mt-3 rounded-md border border-fcu-red/30 bg-fcu-red/5 p-3 text-sm text-fcu-ink",children:[r.jsx("p",{className:"font-medium text-fcu-red",children:"⚠ Achtung — kann nicht automatisch rückgängig gemacht werden."}),r.jsx("p",{className:"mt-1 text-fcu-ink/70",children:"Die bisherigen Team-Zuweisungen werden überschrieben. Eine Wiederherstellung ist nur manuell möglich."})]}),r.jsxs("div",{className:"mt-4 space-y-1 rounded-md border border-fcu-ink/10 bg-fcu-ink/[0.03] p-3 text-sm",children:[r.jsx("div",{className:"font-medium text-fcu-ink",children:"Auswirkung"}),r.jsx(Pe,{label:"Draft-Einträge gesamt",value:c.total}),r.jsx(Pe,{label:"Team-Wechsel (Spieler bekommt neues Team)",value:c.moves,tone:"warn"}),r.jsx(Pe,{label:"Neuzuweisungen (vorher ohne Team)",value:c.newAssign,tone:"ok"}),r.jsx(Pe,{label:"Aus Team entfernt (Draft = Ohne Zuweisung)",value:c.unassign,tone:"warn"}),r.jsx(Pe,{label:"Unverändert",value:c.unchanged})]}),r.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[r.jsx("button",{onClick:f,className:"rounded-md border border-fcu-ink/20 px-3 py-1.5 text-sm",children:"Abbrechen"}),r.jsx("button",{onClick:()=>t(2),className:"rounded-md bg-fcu-red px-3 py-1.5 text-sm text-white",children:"Weiter"})]})]}):r.jsxs(r.Fragment,{children:[r.jsx("h3",{className:"font-display text-lg text-fcu-ink",children:"Letzte Bestätigung"}),r.jsxs("p",{className:"mt-1 text-sm text-fcu-ink/70",children:["Zur Sicherheit: Gib ",r.jsx("span",{className:"font-mono font-semibold text-fcu-red",children:"ÜBERNEHMEN"})," ein, um die Änderung an"," ",r.jsx("span",{className:"font-semibold",children:c.total})," Spielern zu bestätigen."]}),r.jsx("input",{autoFocus:!0,value:n,onChange:h=>s(h.target.value),placeholder:"ÜBERNEHMEN",className:"mt-3 w-full rounded-md border border-fcu-ink/30 px-3 py-2 text-sm font-mono"}),r.jsxs("div",{className:"mt-5 flex justify-between gap-2",children:[r.jsx("button",{onClick:()=>t(1),className:"rounded-md border border-fcu-ink/20 px-3 py-1.5 text-sm",disabled:i,children:"Zurück"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:f,className:"rounded-md border border-fcu-ink/20 px-3 py-1.5 text-sm",disabled:i,children:"Abbrechen"}),r.jsx("button",{onClick:u,disabled:i||n.trim()!=="ÜBERNEHMEN",className:"rounded-md bg-fcu-red px-3 py-1.5 text-sm text-white disabled:opacity-50",children:i?"Übernehme…":"Endgültig übernehmen"})]})]})]})})})}function Pe({label:e,value:t,tone:n}){const s=n==="warn"?"text-fcu-red":n==="ok"?"text-emerald-600":"text-fcu-ink";return r.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[r.jsx("span",{className:"text-fcu-ink/70",children:e}),r.jsx("span",{className:`font-semibold tabular-nums ${s}`,children:t})]})}function ws({rows:e,teams:t}){const n=o.useMemo(()=>{const u=new Map;t.forEach(p=>u.set(p.id,[]));const c=[];e.forEach(p=>{p.player.team_id&&u.has(p.player.team_id)?u.get(p.player.team_id).push(p):c.push(p)});const h=[];return["Aktive","Junioren","Kids"].forEach(p=>{const D=t.filter(v=>v.group_name===p).map(v=>({team:v,players:(u.get(v.id)??[]).slice().sort((b,k)=>`${b.player.last_name} ${b.player.first_name}`.localeCompare(`${k.player.last_name} ${k.player.first_name}`))}));D.length>0&&h.push({group:p,teams:D})}),{sections:h,unassigned:c,total:e.length}}
5,[e,t]),[s,i]=o.useState(new Set),[a,d]=o.useState(!1),l=u=>i(c=>{const h=new Set(c);return h.has(u)?h.delete(u):h.add(u),h}),f=()=>{if(a)i(new Set),d(!1);else{const u=new Set;n.sections.forEach(c=>c.teams.forEach(h=>u.add(h.team.id))),i(u),d(!0)}};return r.jsxs("div",{className:"rounded-lg border border-fcu-ink/10 bg-fcu-ink/[0.03] p-4",children:[r.jsxs("div",{className:"mb-3 flex items-baseline justify-between",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-display text-sm uppercase tracking-wide text-fcu-ink/70",children:"Aktuelle Saison – Team-Verteilung"}),r.jsx("p",{className:"text-xs text-fcu-ink/50",children:"Stand laut Spielerliste. Klick auf ein Team um die Spieler zu sehen."})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsxs("div",{className:"text-right text-xs text-fcu-ink/60",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-semibold text-fcu-ink",children:n.total})," Spieler total"]}),n.unassigned.length>0&&r.jsxs("div",{className:"text-fcu-red",children:[n.unassigned.length," ohne Team"]})]}),r.jsx("button",{type:"button",onClick:f,className:"rounded-md border border-fcu-ink/20 bg-white px-2 py-1 text-xs text-fcu-ink/70 hover:bg-fcu-ink/5",children:a?"Alle einklappen":"Alle ausklappen"})]})]}),r.jsxs("div",{className:"space-y-3",children:[n.sections.map(u=>r.jsxs("div",{children:[r.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wider text-fcu-ink/40",children:u.group}),r.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3 lg:grid-cols-4",children:u.teams.map(({team:c,players:h})=>{const x=s.has(c.id);return r.jsxs("div",{className:"rounded-md border border-fcu-ink/10 bg-white",children:[r.jsxs("button",{type:"button",onClick:()=>l(c.id),className:"flex w-full items-baseline justify-between gap-2 px-3 py-2 text-left hover:bg-fcu-ink/5",children:[r.jsxs("span",{className:"flex items-center gap-1.5 truncate text-sm text-fcu-ink",children:[r.jsx("span",{className:"text-fcu-ink/40",children:x?"▾":"▸"}),r.jsx("span",{className:"truncate",children:c.name})]}),r.jsx("span",{className:`ml-2 shrink-0 rounded-full px-2 py-0.5 text-xs font-semibold tabular-nums ${h.length===0?"bg-fcu-ink/10 text-fcu-ink/50":"bg-fcu-red/10 text-fcu-red"}`,children:h.length})]}),x&&r.jsxs("ul",{className:"border-t border-fcu-ink/10 px-3 py-2 text-xs text-fcu-ink/80 space-y-0.5 max-h-64 overflow-y-auto",children:[h.length===0&&r.jsx("li",{className:"text-fcu-ink/40",children:"— keine Spieler —"}),h.map(p=>r.jsxs("li",{className:"flex items-baseline justify-between gap-2",children:[r.jsxs("span",{className:"truncate",children:[p.player.first_name," ",p.player.last_name]}),r.jsx("span",{className:"shrink-0 text-fcu-ink/40",children:p.birthYear??"—"})]},p.player.id))]})]},c.id)})})]},u.group)),n.unassigned.length>0&&r.jsxs("div",{children:[r.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wider text-fcu-red",children:"Ohne Team"}),r.jsxs("details",{className:"rounded-md border border-fcu-red/30 bg-white",children:[r.jsxs("summary",{className:"cursor-pointer px-3 py-2 text-sm text-fcu-ink",children:[n.unassigned.length," Spieler ohne Team-Zuteilung"]}),r.jsx("ul",{className:"border-t border-fcu-ink/10 px-3 py-2 text-xs text-fcu-ink/80 space-y-0.5 max-h-64 overflow-y-auto",children:n.unassigned.slice().sort((u,c)=>`${u.player.last_name} ${u.player.first_name}`.localeCompare(`${c.player.last_name} ${c.player.first_name}`)).map(u=>r.jsxs("li",{className:"flex items-baseline justify-between gap-2",children:[r.jsxs("span",{className:"truncate",children:[u.player.first_name," ",u.player.last_name]}),r.jsx("span",{className:"shrink-0 text-fcu-ink/40",children:u.birthYear??"—"})]},u.player.id))})]})]})]})]})}function tn({id:e,title:t,subtitle:n,players:s}){const{setNodeRef:i,isOver:a}=Hr({id:e}),[d,l]=o.useState(1),f=20,u=Math.max(1,Math.ceil(s.length/f)),c=Math.min(d,u),h=s.slice((c-1)*f,c*f);return r.jsxs("div",{ref:i,className:`rounded-md border ${a?"border-fcu-red bg-fcu-red/5":"border-fcu-ink/10 bg-white"} p-3 min-h-[120px]`,children:[r.jsxs("div",{className:"mb-2 flex items-baseline justify-between",children:[r.jsx("h4",{className:"text-sm font-medium text-fcu-ink",children:t}),r.jsx("span",{className:"text-xs text-fcu-ink/50",children:n})]}),r.jsxs("div",{className:"space-y-1.5",children:[h.map(x=>r.jsx(ks,{row:x},x.player.id)),s.length===0&&r.jsx("p",{className:"text-xs text-fcu-ink/30",children:"— leer —"})]}),u>1&&r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-1 border-t border-fcu-ink/10 pt-2",children:[r.jsxs("span",{className:"text-[10px] text-fcu-ink/50",children:[c," / ",u]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{onClick:()=>l(x=>Math.max(1,x-1)),disabled:c<=1,className:"rounded border border-fcu-ink/20 px-1 py-0.5 text-[10px] text-fcu-ink/70 hover:bg-fcu-ink/5 disabled:opacity-40 disabled:cursor-not-allowed",children:r.jsx(Nt,{className:"h-3 w-3"})}),Array.from({length:u},(x,p)=>p+1).map(x=>r.jsx("button",{onClick:()=>l(x),className:`min-w-[20px] rounded px-1 py-0.5 text-[10px] font-semibold ${x===c?"bg-fcu-ink text-white":"border border-fcu-ink/20 text-fcu-ink/70 hover:bg-fcu-ink/5"}`,children:x},x)),r.jsx("button",{onClick:()=>l(x=>Math.min(u,x+1)),disabled:c>=u,className:"rounded border border-fcu-ink/20 px-1 py-0.5 text-[10px] text-fcu-ink/70 hover:bg-fcu-ink/5 disabled:opacity-40 disabled:cursor-not-allowed",children:r.jsx(jt,{className:"h-3 w-3"})})]})]})]})}function ks({row:e}){const{attributes:t,listeners:n,setNodeRef:s,isDragging:i}=Xr({id:e.player.id});return r.jsxs("div",{ref:s,...n,...t,className:`flex cursor-grab items-center justify-between gap-2 rounded border border-fcu-ink/10 bg-white px-2 py-1.5 text-xs shadow-sm ${i?"opacity-30 ring-2 ring-fcu-red border-dashed":"hover:border-fcu-red/40 hover:shadow"}`,children:[r.jsxs("span",{className:"truncate",children:[e.player.first_name," ",e.player.last_name]}),r.jsxs("span",{className:"shrink-0 rounded-full bg-fcu-ink/5 px-1.5 text-[10px] text-fcu-ink/60",children:[e.nextCat??"?"," · ",e.birthYear??"?"]})]})}function Ns({rows:e,seasonStartYear:t}){const[n,s]=o.useState(new Set(["stays","moves_up","moves_out","unknown"])),[i,a]=o.use
5State(new Set),[d,l]=o.useState(new Set),[f,u]=o.useState(!1),[c,h]=o.useState(null),[x,p]=o.useState("player"),[D,v]=o.useState(1),[b,k]=o.useState(30),E=be(ps),y=be(ms),C=nn(),w=o.useMemo(()=>e.filter(m=>!(!n.has(m.status)||i.size>0&&(!m.nextCat||!i.has(m.nextCat)))),[e,n,i]);o.useEffect(()=>{v(1)},[w.length,b]);const S=b==="all"?1:Math.max(1,Math.ceil(w.length/b)),N=Math.min(D,S),j=b==="all"?w:w.slice((N-1)*b,N*b),R=o.useMemo(()=>{const m=new Set;return w.forEach(z=>{d.has(z.player.id)&&[z.player.email,z.player.parent_email1,z.player.parent_email2].filter(g=>!!g).forEach(g=>m.add(g.toLowerCase()))}),m.size},[w,d]),T=m=>s(z=>{const g=new Set(z);return g.has(m)?g.delete(m):g.add(m),g}),O=m=>a(z=>{const g=new Set(z);return g.has(m)?g.delete(m):g.add(m),g}),W=()=>l(new Set(w.map(m=>m.player.id))),F=()=>l(new Set);async function X(m,z){try{const g=await y({data:{playerId:m,seasonStartYear:t,recipientType:z}});h({subject:g.subject,html:g.html}),p(z)}catch(g){q.error(g?.message??"Vorschau fehlgeschlagen")}}async function ke(){if(d.size!==0&&await C({title:"Mails versenden?",description:`${d.size} Spieler:innen ausgewählt · ${R} E-Mail-Adressen werden angeschrieben.`,confirmText:"Versenden",destructive:!1})){u(!0);try{const m=await E({data:{playerIds:Array.from(d),seasonStartYear:t}});q.success(`${m.enqueued} Mails eingereiht${m.skipped.length?` · ${m.skipped.length} übersprungen`:""}.`),m.skipped.length&&console.warn("Skipped:",m.skipped)}catch(m){q.error(m?.message??"Versand fehlgeschlagen")}u(!1)}}const me={stays:"Bleibt im Team",moves_up:"Wechselt Kategorie",moves_out:"Zu Aktiven",unknown:"Unklar"};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"rounded-md border border-fcu-ink/10 p-4 space-y-3",children:[r.jsxs("div",{children:[r.jsx("p",{className:"mb-1 text-xs font-medium uppercase tracking-wide text-fcu-ink/60",children:"Status"}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:["stays","moves_up","moves_out","unknown"].map(m=>r.jsx("button",{onClick:()=>T(m),className:`rounded-full border px-3 py-1 text-xs ${n.has(m)?"border-fcu-red bg-fcu-red text-white":"border-fcu-ink/20 text-fcu-ink/70"}`,children:me[m]},m))})]}),r.jsxs("div",{children:[r.jsx("p",{className:"mb-1 text-xs font-medium uppercase tracking-wide text-fcu-ink/60",children:"Nächste Kategorie"}),r.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[Ee.map(m=>r.jsx("button",{onClick:()=>O(m.code),className:`rounded-full border px-3 py-1 text-xs ${i.has(m.code)?"border-fcu-ink bg-fcu-ink text-white":"border-fcu-ink/20 text-fcu-ink/70"}`,children:m.code},m.code)),i.size>0&&r.jsx("button",{onClick:()=>a(new Set),className:"rounded-full border border-fcu-ink/20 px-3 py-1 text-xs text-fcu-ink/60",children:"Alle"})]})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[r.jsxs("span",{className:"text-fcu-ink/60",children:[w.length," sichtbar · ",d.size," ausgewählt · ",R," Adressen"]}),r.jsx("button",{onClick:W,className:"ml-auto rounded-md border border-fcu-ink/20 px-2 py-1 text-xs",children:"Alle sichtbaren wählen"}),r.jsx("button",{onClick:F,className:"rounded-md border border-fcu-ink/20 px-2 py-1 text-xs",children:"Auswahl löschen"}),r.jsxs("button",{onClick:ke,disabled:f||d.size===0,className:"rounded-md bg-fcu-red px-3 py-1.5 text-sm font-medium text-white hover:bg-fcu-red/90 disabled:opacity-50",children:["An ",R," Empfänger·innen senden"]})]}),r.jsx("div",{className:"overflow-x-auto rounded-md border border-fcu-ink/10",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{className:"bg-fcu-ink/5 text-left text-xs uppercase tracking-wide text-fcu-ink/60",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-3 py-2"}),r.jsx("th",{className:"px-3 py-2",children:"Name"}),r.jsx("th",{className:"px-3 py-2",children:"Jg."}),r.jsx("th",{className:"px-3 py-2",children:"Aktuell"}),r.jsx("th",{className:"px-3 py-2",children:"Status"}),r.jsx("th",{className:"px-3 py-2",children:"Adressen"}),r.jsx("th",{className:"px-3 py-2",children:"Vorschau"})]})}),r.jsxs("tbody",{children:[j.map(m=>{const z=[m.player.email,m.player.parent_email1,m.player.parent_email2].filter(g=>!!g);return r.jsxs("tr",{className:"border-t border-fcu-ink/10",children:[r.jsx("td",{className:"px-3 py-2",children:r.jsx("input",{type:"checkbox",checked:d.has(m.player.id),onChange:()=>l(g=>{const A=new Set(g);return A.has(m.player.id)?A.delete(m.player.id):A.add(m.player.id),A})})}),r.jsxs("td",{className:"px-3 py-2",children:[m.player.first_name," ",m.player.last_name]}),r.jsx("td",{className:"px-3 py-2",children:m.birthYear??"—"}),r.jsx("td",{className:"px-3 py-2",children:m.team?.name??"—"}),r.jsx("td",{className:"px-3 py-2",children:r.jsxs("span",{className:`rounded-full px-2 py-0.5 text-xs ${m.status==="stays"?"bg-fcu-ink/10 text-fcu-ink":m.status==="moves_up"?"bg-amber-100 text-amber-800":m.status==="moves_out"?"bg-fcu-red/10 text-fcu-red":"bg-fcu-ink/5 text-fcu-ink/50"}`,children:[me[m.status],m.status==="moves_up"&&m.nextCat?` (${m.currentCat}→${m.nextCat})`:""]})}),r.jsx("td",{className:"px-3 py-2 text-xs text-fcu-ink/60",children:z.length===0?"—":`${z.length} Adr.`}),r.jsxs("td",{className:"px-3 py-2",children:[r.jsx("button",{onClick:()=>X(m.player.id,"player"),className:"text-xs text-fcu-red underline",children:"Spieler"}),r.jsx("span",{className:"px-1 text-fcu-ink/30",children:"/"}),r.jsx("button",{onClick:()=>X(m.player.id,"parent"),className:"text-xs text-fcu-red underline",children:"Eltern"})]})]},m.player.id)}),j.length===0&&r.jsx("tr",{children:r.jsx("td",{colSpan:7,className:"px-3 py-6 text-center text-fcu-ink/60",children:"Keine Spieler·innen mit diesen Filtern."})})]})]})}),r.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border border-fcu-ink/15 bg-white p-3 sm:flex-row sm:items-center sm:justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs text-fcu-ink/70",children:[r.jsx("span",{children:b==="all"?`${w.length} Einträge`:`${(N-1)*b+1}–${Math.min(N*b,w.length)} von ${w.length}`}),r.jsxs("select",{value:b,onChange:m=>k(m.target.value==="all"?"all":Number(m.target.value)),className:"rounded-md border border-fcu-ink/20 bg-white px-2 py-1 text-xs focus:border-fcu-red focus:outline-none",children:[r.jsx("option",{value:30,children:"30 pro Seite"}),r.jsx("option",{value:100,children:"100 pro Seite"}),r.jsx("option",{value:"all",children:"Alle anzeigen"})]})]}),b!=="all"&&S>1&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{onClick:()=>v(m=>Math.max(1,m-1)),disabled:N<=1,className:"inline-flex items-center rounded-md border border-fcu-ink/20 px-2 py-1 text-xs text-fcu-ink/70 hover:bg-fcu-ink/5 disabled:opacity-40 disabled:cursor-not-allowed",children:r.jsx(Nt,{className:"h-3.5 w-3.5"})}),Array.from({length:S},(m,z)=>z+1).map(m=>r.jsx("button",{onClick:()=>v(m),className:`min-w-[28px] rounded-md px-2 py-1 text-xs font-semibold ${m===N?"bg-fcu-ink text-white":"border border-fcu-ink/20 text-fcu-ink/70 hover:bg-fcu-ink/5"}`,children:m},m)),r.jsx("button",{onClick:()=>v(m=>Math.min(S,m+1)),disabled:N>=S,className:"inline-flex items-center rounded-md border border-fcu-ink/20 px-2 py-1 text-xs text-fcu-ink/70 hover:bg-fcu-ink/5 disabled:opacity-40 disabled:cursor-not-allowed",children:r.jsx(jt,{className:"h-3.5 w-3.5"})})]})]}),r.jsx("p",{className:"text-xs text-fcu-ink/50",children:"Mails werden in de
5n nächsten Minuten via Lovable App-Email Queue verschickt. Status im Backend einsehbar."}),c&&r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:()=>h(null),children:r.jsxs("div",{className:"max-h-[90vh] w-full max-w-2xl overflow-hidden rounded-lg bg-white shadow-2xl",onClick:m=>m.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[r.jsxs("div",{children:[r.jsxs("p",{className:"text-xs uppercase tracking-wide text-fcu-ink/50",children:["Vorschau · ",x==="player"?"Spieler·in":"Eltern"]}),r.jsx("p",{className:"text-sm font-medium",children:c.subject})]}),r.jsx("button",{onClick:()=>h(null),className:"text-fcu-ink/50 hover:text-fcu-ink",children:"✕"})]}),r.jsx("iframe",{title:"preview",srcDoc:c.html,className:"h-[70vh] w-full",sandbox:""})]})})]})}export{Rs as component};

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.