PageSourceSearch

https://folien-fx.de/_next/static/chunks/app/admin/(dashboard)/kunden/page-6f5602537aeaef1e.js

js folien-fx.de collected 2026-10-09 23:33:07 UTC 75,391 bytes, 13 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5682],{5785:(e,t,s)=>{"use strict";s.d(t,{oR:()=>a.oR});var a=s(66609)},40980:(e,t,s)=>{"use strict";s.d(t,{cn:()=>l,iM:()=>i,nk:()=>n});var a=s(29722),r=s(622);function l(...e){return(0,r.QP)((0,a.$)(e))}let i=(e,t)=>`
2<svg width="${e}" height="${t}" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3  <defs>
4    <linearGradient id="g">
5      <stop stop-color="#333" offset="20%" />
6      <stop stop-color="#222" offset="50%" />
7      <stop stop-color="#333" offset="70%" />
8    </linearGradient>
9  </defs>
10  <rect width="${e}" height="${t}" fill="#333" />
11  <rect id="r" width="${e}" height="${t}" fill="url(#g)" />
12  <animate xlink:href="#r" attributeName="x" from="-${e}" to="${e}" dur="1s" repeatCount="indefinite"  />
13</svg>`,n=e=>window.btoa(e)},47398:(e,t,s)=>{"use strict";s.d(t,{CustomerListAdmin:()=>eW});var a=s(95155),r=s(12115),l=s(73321),i=s(86901),n=s(6296),o=s(58411),d=s(51914),c=s(7810),x=s(57684),h=s(44478),u=s(44071),m=s(85118),p=s(92289),b=s(57420),g=s(21362),f=s(41641),v=s(89823),j=s(68459),w=s(33210),N=s(80642),k=s(52922),y=s(5785),A=s(64848),S=s(9339);let z=(0,S.createServerReference)("4066bd9e5d384467dec701720b0813890e8854516a",S.callServer,void 0,S.findSourceMapURL,"getCustomers"),C=(0,S.createServerReference)("40ca5fee7bb92b48301a696baed50534f771f486af",S.callServer,void 0,S.findSourceMapURL,"getCustomerById"),$=(0,S.createServerReference)("408a29027a3a56639487f4e88e123d98fdc51fd319",S.callServer,void 0,S.findSourceMapURL,"deleteCustomer"),K=(0,S.createServerReference)("40f8bac39d9964c1c089baefc6b7e6570e08d4a17b",S.callServer,void 0,S.findSourceMapURL,"deleteCustomersBulk"),E=(0,S.createServerReference)("0017d881d1853d11c9dac9713140da49b5281aa344",S.callServer,void 0,S.findSourceMapURL,"findDuplicateCustomers"),T=(0,S.createServerReference)("60c98d6cf8e297fd4ee174024fc65dcc526407e8e9",S.callServer,void 0,S.findSourceMapURL,"mergeCustomers"),R=["all","users","active","heavy","none"],_=["all","linked","unlinked","twofa"],D=["all","with","without","repeat"],M=["all","7","30","90","365"],L=["name","newest","oldest","lastVisit","bookings","studio","studioRecent"],P={search:"",studio:"all",portal:"all",bookings:"all",period:"all",source:"",tag:"",sort:"name"},I={all:"Alle",users:"Mit Entw\xfcrfen",active:"Aktiv 30 T.",heavy:"Vielnutzer 3+",none:"Ohne Entw\xfcrfe"},B={all:"Portal: alle",linked:"Portal verbunden",unlinked:"Ohne Portalzugang",twofa:"Mit 2FA"},U={all:"Buchungen: alle",with:"Mit Buchung",without:"Ohne Buchung",repeat:"Stammkunden (2+)"},G={all:"Zeitraum: alle",7:"Angelegt: 7 Tage",30:"Angelegt: 30 Tage",90:"Angelegt: 90 Tage",365:"Angelegt: 12 Monate"},F={name:"Name A–Z",newest:"Neueste zuerst",oldest:"\xc4lteste zuerst",lastVisit:"Letzte Buchung",bookings:"Meiste Buchungen",studio:"Meiste KI-Entw\xfcrfe",studioRecent:"Zuletzt im KI Studio"},O=["walk-in","online","empfehlung","sonstiges"],V={"walk-in":"Walk-in",online:"Online",empfehlung:"Empfehlung",sonstiges:"Sonstiges"};function W(e,t,s){return e.includes(t)?t:s}var Z=s(55941),H=s(49387),Q=s(36786),q=s(67899),J=s(96035),X=s(30814),Y=s(78697),ee=s(42869),et=s(56204),es=s(24538),ea=s(52530),er=s(48368),el=s(84980),ei=s(17243),en=s(16913),eo=s(22164),ed=s(50538),ec=s(41585);let ex=(0,S.createServerReference)("40d91b16cb27751db1b0f72404d8b21da55924b394",S.callServer,void 0,S.findSourceMapURL,"getCustomerBookings"),eh=(0,S.createServerReference)("4052788bf45a1ac8eec2c2457873cae8e5c107121d",S.callServer,void 0,S.findSourceMapURL,"getCustomerStudioActivity"),eu=(0,S.createServerReference)("405901aed471a3c101be7447f8633cca1bf60ab0bb",S.callServer,void 0,S.findSourceMapURL,"getCustomerHistory"),em=(0,S.createServerReference)("602656c592ce9fb6afe8a3a75dae41a99c039baba3",S.callServer,void 0,S.findSourceMapURL,"updateCustomer"),ep=(0,S.createServerReference)("40f17b60ae02f191f7cc5350665a6cc1d2f8625cc0",S.callServer,void 0,S.findSourceMapURL,"createCustomer");var eb=s(40980);let eg=[{value:"walk-in",label:"Walk-in"},{value:"online",label:"Online"},{value:"empfehlung",label:"Empfehlung"},{value:"sonstiges",label:"Sonstiges"}
13],ef={pending:"bg-amber-500/15 text-amber-400 border-amber-500/20",confirmed:"bg-emerald-500/15 text-emerald-400 border-emerald-500/20",cancelled:"bg-red-500/15 text-red-400 border-red-500/20",completed:"bg-violet-500/15 text-violet-400 border-violet-500/20"},ev={pending:"Ausstehend",confirmed:"Best\xe4tigt",cancelled:"Abgesagt",completed:"Abgeschlossen"};function ej(e){return new Date(e).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})}function ew(e){let t=new Date(e);return{date:t.toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"}),time:t.toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"}),full:t.toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})}}let eN={"customer.created":{icon:x.A,color:"text-emerald-400",bg:"bg-emerald-600/15",border:"border-emerald-500/20"},"customer.updated":{icon:H.A,color:"text-amber-400",bg:"bg-amber-600/15",border:"border-amber-500/20"},"booking.created":{icon:Q.A,color:"text-violet-400",bg:"bg-violet-600/15",border:"border-violet-500/20"},"booking.updated":{icon:H.A,color:"text-violet-300",bg:"bg-violet-500/15",border:"border-violet-400/20"},"booking.deleted":{icon:j.A,color:"text-red-400",bg:"bg-red-600/15",border:"border-red-500/20"},"booking.bulk_deleted":{icon:j.A,color:"text-red-300",bg:"bg-red-500/15",border:"border-red-400/20"},"order.created":{icon:q.A,color:"text-cyan-400",bg:"bg-cyan-600/15",border:"border-cyan-500/20"},"inquiry.created":{icon:J.A,color:"text-pink-400",bg:"bg-pink-600/15",border:"border-pink-500/20"},"inquiry.replied":{icon:X.A,color:"text-pink-300",bg:"bg-pink-500/15",border:"border-pink-400/20"},"ai.generation.completed":{icon:i.A,color:"text-violet-300",bg:"bg-violet-600/15",border:"border-violet-500/25"},"ai.generation.failed":{icon:i.A,color:"text-red-300",bg:"bg-red-600/15",border:"border-red-500/20"},"ai.generation.processing":{icon:i.A,color:"text-amber-300",bg:"bg-amber-600/15",border:"border-amber-500/20"}},ek={completed:{label:"Fertig",className:"border-emerald-500/20 bg-emerald-500/10 text-emerald-300"},failed:{label:"Fehlgeschlagen",className:"border-red-500/20 bg-red-500/10 text-red-300"},processing:{label:"In Arbeit",className:"border-amber-500/20 bg-amber-500/10 text-amber-300"}};function ey({customer:e,isOpen:t,onClose:s,onSave:l,onDelete:o}){let d=!!e,[c,x]=(0,r.useState)(""),[u,f]=(0,r.useState)(""),[v,A]=(0,r.useState)(""),[S,z]=(0,r.useState)(""),[C,K]=(0,r.useState)(""),[E,T]=(0,r.useState)(""),[R,_]=(0,r.useState)(""),[D,M]=(0,r.useState)([]),[L,P]=(0,r.useState)(""),[I,B]=(0,r.useState)("walk-in"),[U,G]=(0,r.useState)(""),[F,O]=(0,r.useState)(""),[V,W]=(0,r.useState)("kontakt"),[Z,H]=(0,r.useState)(!1),[Q,q]=(0,r.useState)(!1),[J,X]=(0,r.useState)(!1),[eA,eS]=(0,r.useState)(!1),[ez,eC]=(0,r.useState)([]),[e$,eK]=(0,r.useState)(!1),[eE,eT]=(0,r.useState)([]),[eR,e_]=(0,r.useState)(!1),[eD,eM]=(0,r.useState)(null),[eL,eP]=(0,r.useState)(!1),[eI,eB]=(0,r.useState)(!1),eU=(0,r.useRef)(null);(0,r.useEffect)(()=>{t&&(e?(x(e.firstName),f(e.lastName??""),A(e.phone??""),z(e.email??""),K(e.address?.street??""),T(e.address?.city??""),_(e.address?.zip??""),M(e.tags??[]),B(e.source??"walk-in"),G(e.notes??""),O(e.photoUrl??"")):(x(""),f(""),A(""),z(""),K(""),T(""),_(""),M([]),B("walk-in"),G(""),O("")),W("kontakt"),X(!1),eC([]),eT([]),eM(null))},[t,e]),(0,r.useEffect)(()=>{"buchungen"===V&&d&&e?._id&&(eK(!0),ex(e._id).then(e=>eC(e)).catch(()=>y.oR.error("Buchungen konnten nicht geladen werden")).finally(()=>eK(!1)))},[V,d,e?._id]),(0,r.useEffect)(()=>{"studio"===V&&d&&e?._id&&!eD&&(eP(!0),eh(e._id).then(eM).catch(()=>y.oR.error("KI-Studio-Verlauf konnte nicht geladen werden")).finally(()=>eP(!1)))},[V,d,e?._id,eD]),(0,r.useEffect)(()=>{"historie"===V&&d&&e?._id&&(e_(!0),eu(e._id).then(e=>eT(e)).catch(()=>y.oR.error("Historie konnte nicht geladen werden")).finally(()=>e_(!1)))},[V,d,e?._id]);let eG=(0,r.useCallback)(async e=>{eS(!0);try{let t=new FormData;t.append("file",e);let s=await fetch("/api/upload",{method:"POST",body:t});if(!s.ok)throw Error("Upload fehlgeschlagen");let a=await s.json();if(!a.url)throw Error("Keine URL erhalten");O(a.url),y.oR.success("Foto hochgeladen")}catch{y.oR.error("Foto-Upload fehlgeschlagen")}finally{eS(!1)}},[]),eF=async()=>
13{if(!c.trim())return void y.oR.error("Vorname ist erforderlich");if(!u.trim())return void y.oR.error("Nachname ist erforderlich");H(!0);try{let t,a={firstName:c.trim(),lastName:u.trim(),phone:v.trim()||void 0,email:S.trim()||void 0,address:{street:C.trim()||void 0,city:E.trim()||void 0,zip:R.trim()||void 0},tags:D,source:I,notes:U.trim()||void 0,photoUrl:F||void 0};t=d&&e?._id?await em(e._id,a):await ep(a),y.oR.success(d?"Kunde aktualisiert":"Kunde erstellt"),l(t),s()}catch(t){let e=t instanceof Error&&t.message?t.message:"Speichern fehlgeschlagen";y.oR.error(e)}finally{H(!1)}},eO=async()=>{if(e?._id){q(!0);try{await $(e._id),y.oR.success("Kunde gel\xf6scht"),o?.(e._id),s()}catch{y.oR.error("L\xf6schen fehlgeschlagen")}finally{q(!1),X(!1)}}},eV=async()=>{if(!e?._id||!S.trim())return y.oR.error("Bitte zuerst eine E-Mail-Adresse speichern.");eB(!0);try{let t=await fetch(`/api/admin/customers/${e._id}/invite`,{method:"POST"}),s=await t.json();if(!t.ok)throw Error(s.error||"Einladung konnte nicht versendet werden.");y.oR.success("Kundenkonto-Einladung versendet")}catch(e){y.oR.error(e instanceof Error?e.message:"Einladung konnte nicht versendet werden.")}finally{eB(!1)}},eW=c&&u?`${c[0]}${u[0]}`.toUpperCase():c?c[0].toUpperCase():"?";return(0,a.jsx)(N.N,{children:t&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"fixed inset-0 bg-black/70 backdrop-blur-sm z-[500] animate-in fade-in duration-200",onClick:s},"backdrop"),(0,a.jsxs)(k.P.aside,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:30,stiffness:280},className:"fixed right-0 top-0 bottom-0 z-[501] w-full sm:w-[680px] flex flex-col bg-[#0a0a0f] border-l border-white/8 shadow-[-8px_0_40px_rgba(0,0,0,0.6)]",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-6 py-5 border-b border-white/8 shrink-0",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h2",{className:"truncate text-lg font-black text-white tracking-tight",children:d&&e?`${c} ${u}`.trim():"Neuer Kunde"}),e?.portalEnabledAt&&(0,a.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-lg border border-emerald-500/20 bg-emerald-500/10 px-2 py-1 text-[10px] font-black text-emerald-300",children:[(0,a.jsx)(h.A,{size:11})," Portal aktiv"]})]}),d&&e&&(0,a.jsxs)("p",{className:"text-xs text-neutral-500 mt-0.5",children:["Kundenakte seit ",ej(e.createdAt)]})]}),(0,a.jsx)("button",{onClick:s,className:"w-9 h-9 rounded-xl bg-white/5 hover:bg-white/10 flex items-center justify-center text-neutral-400 hover:text-white transition-all",children:(0,a.jsx)(w.A,{size:17})})]}),d&&(0,a.jsx)("div",{className:"flex items-center gap-1 overflow-x-auto px-4 py-3 sm:px-6 border-b border-white/5 shrink-0",children:["kontakt","buchungen","studio","historie"].map(t=>(0,a.jsxs)("button",{onClick:()=>W(t),className:(0,eb.cn)("min-h-10 whitespace-nowrap px-3 py-2 rounded-lg text-[11px] font-black uppercase tracking-wider transition-all sm:px-4",V===t?"bg-violet-600 text-white shadow-lg shadow-violet-600/25":"text-neutral-500 hover:text-white hover:bg-white/5"),children:["kontakt"===t&&"Kontakt","buchungen"===t&&"Buchungen","studio"===t&&`KI-Studio${e?.aiGenerationsCount?` (${e.aiGenerationsCount})`:""}`,"historie"===t&&"Historie"]},t))}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,a.jsx)("div",{children:"kontakt"===V?(0,a.jsxs)("div",{className:"px-6 py-6 space-y-6 animate-in fade-in slide-in-from-bottom-2 duration-150",children:[(0,a.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,a.jsxs)("div",{className:"relative group",children:[(0,a.jsx)("div",{className:"w-[120px] h-[120px] rounded-full overflow-hidden bg-gradient-to-br from-violet-600/30 to-violet-900/30 border-2 border-violet-500/20 flex items-center justify-center shadow-xl shadow-violet-600/10",children:F?(0,a.jsx)("img",{src:F,alt:"Kundenfoto",className:"w-full h-full object-cover"}):(0,a.jsx)("span",{className:"text-3xl font-black text-violet-300 select-none",children:eW})}),(0,a.jsx)("button",{type:"button",onClick:()=>eU.current?.click(),disabled:eA,className:"absolute inset-0 rounded-full flex items-center justify-center bg-black/60 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:eA?(0,a.jsx)(n.A,{size:24,className:"text-white animate-spin"}):(0,a.jsx)(Y.A,{size:24,className:"text-white"})}),(0,a.jsx)("input",{ref:eU,type:"file",accept:"image/*",className:"hidden",onChange:e=>{let t=e.target.files?.[0];t&&eG(t)}})]}),(0,a.jsx)("p",{className:"text-xs text-neutral-600",children:"Foto klicken zum Hochladen"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsxs)("label",{className:"text-xs font-bold text-neutral-500 uppercase tracking-widest",children:["Vorname ",(0,a.jsx)("span",{className:"text-red-400",children:"*"})]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(ee.A,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-neutral-600 pointer-events-none"}),(0,a.jsx)("input",{type:"text",value:c,onChange:e=>x(e.target.value),placeholder:"Max",className:"w-full bg-white/5 border border-white/8 rounded-xl pl-9 pr-3 py-2.5 min-h-[44px] text-white text-base md:text-sm placeholder:text-neutral-600 focus:border-violet-500/50 focus:outline-none focus:bg-white/8 transition-all"})]})]}),(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsxs)("label",{className:"text-xs font-bold text-neutral-500 uppercase tracking-widest",children:["Nachname ",(0,a.jsx)("span",{className:"text-red-400",children:"*"})]}),(0,a.jsx)("input",{type:"text",value:u,onChange:e=>f(e.target.value),placeholder:"Mustermann",className:"w-full bg-white/5 border border-white/8 rounded-xl px-3 py-2.5 min-h-[44px] text-white text-base md:text-sm placeholder:text-neutral-600 focus:border-violet-500/50 focus:outline-none focus:bg-white/8 transition-all"})]})]}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("h3",{className:"text-[10px] font-black text-neutral-600 uppercase tracking-widest border-l-2 border-violet-600 pl-2",children:"Kontaktdaten"}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(m.A,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-neutral-600 pointer-events-none"}
13),(0,a.jsx)("input",{type:"tel",value:v,onChange:e=>A(e.target.value),placeholder:"Telefon",className:"w-full bg-white/5 border border-white/8 rounded-xl pl-9 pr-3 py-2.5 min-h-[44px] text-white text-base md:text-sm placeholder:text-neutral-600 focus:border-violet-500/50 focus:outline-none focus:bg-white/8 transition-all"})]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(p.A,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-neutral-600 pointer-events-none"}),(0,a.jsx)("input",{type:"email",value:S,onChange:e=>z(e.target.value),placeholder:"E-Mail",className:"w-full bg-white/5 border border-white/8 rounded-xl pl-9 pr-3 py-2.5 min-h-[44px] text-white text-base md:text-sm placeholder:text-neutral-600 focus:border-violet-500/50 focus:outline-none focus:bg-white/8 transition-all"})]})]}),d&&(0,a.jsx)("div",{className:"rounded-2xl border border-violet-500/15 bg-gradient-to-br from-violet-500/[.09] to-white/[.025] p-4",children:(0,a.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex min-w-0 items-start gap-3",children:[(0,a.jsx)("div",{className:"grid size-10 shrink-0 place-items-center rounded-xl border border-violet-500/20 bg-violet-500/10 text-violet-300",children:(0,a.jsx)(h.A,{size:18})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-bold text-white",children:"Kundenportal verbunden"}),(0,a.jsx)("p",{className:"mt-1 text-xs leading-5 text-neutral-400",children:e?.portalEnabledAt?`Aktiv${e.totpEnabled?" \xb7 mit 2FA":""}. Profilbild und Kontaktdaten verwenden dieselbe Kundenakte.`:"Nach der Einladung werden Profilbild, Kontaktdaten, Buchungen und KI-Entw\xfcrfe direkt dieser Kundenakte zugeordnet."})]})]}),(0,a.jsxs)("button",{type:"button",onClick:eV,disabled:eI||!S.trim(),className:"inline-flex min-h-10 shrink-0 items-center gap-2 rounded-xl border border-violet-400/20 bg-violet-500/10 px-3 text-xs font-black text-violet-200 transition hover:bg-violet-500/20 disabled:opacity-40",children:[eI?(0,a.jsx)(n.A,{size:14,className:"animate-spin"}):(0,a.jsx)(et.A,{size:14}),e?.portalEnabledAt?"Login-Link":"Einladen"]})]})})]}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("h3",{className:"text-[10px] font-black text-neutral-600 uppercase tracking-widest border-l-2 border-violet-600 pl-2",children:"Adresse"}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(es.A,{size:14,className:"absolute left-3 top-3 text-neutral-600 pointer-events-none"}),(0,a.jsx)("input",{type:"text",value:C,onChange:e=>K(e.target.value),placeholder:"Stra\xdfe & Hausnummer",className:"w-full bg-white/5 border border-white/8 rounded-xl pl-9 pr-3 py-2.5 min-h-[44px] text-white text-base md:text-sm placeholder:text-neutral-600 focus:border-violet-500/50 focus:outline-none focus:bg-white/8 transition-all"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,a.jsx)("input",{type:"text",value:R,onChange:e=>_(e.target.value),placeholder:"PLZ",className:"w-full bg-white/5 border border-white/8 rounded-xl px-3 py-2.5 min-h-[44px] text-white text-base md:text-sm placeholder:text-neutral-600 focus:border-violet-500/50 focus:outline-none focus:bg-white/8 transition-all"}),(0,a.jsx)("input",{type:"text",value:E,onChange:e=>T(e.target.value),placeholder:"Stadt",className:"w-full bg-white/5 border border-white/8 rounded-xl px-3 py-2.5 min-h-[44px] text-white text-base md:text-sm placeholder:text-neutral-600 focus:border-violet-500/50 focus:outline-none focus:bg-white/8 transition-all"})]})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("h3",{className:"text-[10px] font-black text-neutral-600 uppercase tracking-widest border-l-2 border-violet-600 pl-2",children:"Tags"}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 p-3 bg-white/5 border border-white/8 rounded-xl min-h-[44px]",children:[D.map(e=>(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 bg-violet-600/20 border border-violet-500/30 text-violet-300 rounded-lg text-xs font-bold",children:[(0,a.jsx)(ea.A,{size:10}),e,(0,a.jsx)("button",{type:"button",onClick:()=>{M(D.filter(t=>t!==e))},className:"text-violet-400 hover:text-white ml-0.5 transition-colors",children:(0,a.jsx)(w.A,{size:11})})]},e)),(0,a.jsx)("input",{type:"text",value:L,onChange:e=>P(e.target.value),onKeyDown:e=>{if(("Enter"===e.key||","===e.key)&&L.trim()){e.preventDefault();let t=L.trim().replace(/,$/,"");t&&!D.includes(t)&&M([...D,t]),P("")}},placeholder:0===D.length?"Tag tippen + Enter":"+ Tag",className:"flex-1 min-w-[120px] bg-transparent text-white text-base md:text-xs placeholder:text-neutral-600 outline-none"})]})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("label",{className:"text-[10px] font-black text-neutral-600 uppercase tracking-widest border-l-2 border-violet-600 pl-2 block",children:"Herkunft"}),(0,a.jsx)("select",{value:I,onChange:e=>B(e.target.value),className:"w-full bg-white/5 border border-white/8 rounded-xl px-3 py-2.5 min-h-[44px] text-white text-base md:text-sm focus:border-violet-500/50 focus:outline-none focus:bg-white/8 transition-all appearance-none",children:eg.map(e=>(0,a.jsx)("option",{value:e.value,className:"bg-[#0a0a0f]",children:e.label},e.value))})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("label",{className:"text-[10px] font-black text-neutral-600 uppercase tracking-widest border-l-2 border-violet-600 pl-2 block",children:"Notizen"}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(er.A,{size:14,className:"absolute left-3 top-3 text-neutral-600 pointer-events-none"}),(0,a.jsx)("textarea",{value:U,onChange:e=>G(e.target.value),placeholder:"Interne Notizen...",rows:3,className:"w-full bg-white/5 border border-white/8 rounded-xl pl-9 pr-3 py-2.5 min-h-[44px] text-white text-base md:text-sm placeholder:text-neutral-600 focus:border-violet-500/50 focus:outline-none focus:bg-white/8 transition-all resize-none"})]})]})]},"kontakt"):"buchungen"===V?(0,a.jsx)("div",{className:"px-6 py-6 animate-in fade-in slide-in-from-bottom-2 duration-150",children:e$?(0,a.jsx)("div",{className:"flex items-center justify-center py-16",children:(0,a.jsx)(n.A,{size:28,className:"text-violet-400 animate-spin"})}):0===ez.length?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 gap-3 text-center",children:[(0,a.jsx)("div",{className:"w-14 h-14 roun
13ded-2xl bg-white/5 flex items-center justify-center",children:(0,a.jsx)(b.A,{size:24,className:"text-neutral-600"})}),(0,a.jsx)("p",{className:"text-neutral-500 text-sm font-medium",children:"Noch keine Buchungen"}),(0,a.jsx)("p",{className:"text-neutral-700 text-xs max-w-[200px]",children:"Buchungen erscheinen hier, sobald sie angelegt wurden."})]}):(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("p",{className:"text-xs text-neutral-600 pb-1",children:[ez.length," Buchung",1!==ez.length?"en":""]}),ez.map(e=>{var t;let s,r;return(0,a.jsxs)("div",{className:"group flex items-center gap-4 p-4 bg-white/[0.03] border border-white/8 rounded-2xl hover:border-violet-500/20 hover:bg-white/[0.06] transition-all",children:[(0,a.jsx)("div",{className:"w-10 h-10 rounded-xl bg-violet-600/15 flex items-center justify-center shrink-0",children:(0,a.jsx)(b.A,{size:18,className:"text-violet-400"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-bold text-white truncate",children:e.service}),(0,a.jsxs)("div",{className:"flex items-center gap-3 mt-1",children:[(0,a.jsxs)("span",{className:"text-xs text-neutral-500 flex items-center gap-1",children:[(0,a.jsx)(b.A,{size:10}),ej(e.date),e.timeSlot&&` \xb7 ${e.timeSlot}`]}),(0,a.jsxs)("span",{className:"text-xs text-neutral-600 flex items-center gap-1",children:[(0,a.jsx)(el.A,{size:10}),(s=Math.floor((t=e.duration)/60),r=t%60,0===s?`${r} Min.`:0===r?`${s} Std.`:`${s} Std. ${r} Min.`)]})]}),e.staffMemberName&&(0,a.jsx)("p",{className:"text-xs text-neutral-600 mt-0.5",children:e.staffMemberName})]}),(0,a.jsxs)("div",{className:"shrink-0 flex flex-col items-end gap-2",children:[(0,a.jsx)("span",{className:(0,eb.cn)("text-[10px] font-black uppercase tracking-widest px-2.5 py-1 rounded-lg border",ef[e.status]??ef.pending),children:ev[e.status]??e.status}),(0,a.jsx)(g.A,{size:14,className:"text-neutral-700 group-hover:text-neutral-500 transition-colors"})]})]},e._id)})]})},"buchungen"):"studio"===V?(0,a.jsx)("div",{className:"px-4 py-6 animate-in fade-in slide-in-from-bottom-2 duration-150 sm:px-6",children:eL?(0,a.jsxs)("div",{className:"space-y-4","aria-label":"KI-Studio-Verlauf wird geladen",children:[(0,a.jsx)("div",{className:"grid grid-cols-3 gap-3",children:[0,1,2].map(e=>(0,a.jsx)("div",{className:"h-20 animate-pulse rounded-2xl bg-white/5"},e))}),[0,1].map(e=>(0,a.jsx)("div",{className:"h-64 animate-pulse rounded-2xl bg-white/5"},e))]}):eD&&0!==eD.generations.length?(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-xl font-black tracking-tight text-white",children:"KI-Studio-Akte"}),(0,a.jsx)("p",{className:"mt-1 text-xs leading-5 text-neutral-500",children:"Originalfotos, Ergebnisse und Konfigurationen aus dem Kundenportal."})]}),(0,a.jsxs)("span",{className:"inline-flex min-h-9 items-center gap-1.5 rounded-xl border border-emerald-500/20 bg-emerald-500/10 px-3 text-[10px] font-black text-emerald-300",children:[(0,a.jsx)(h.A,{size:12})," Per Kunden-ID"]})]}),(0,a.jsxs)("div",{className:"mt-5 grid grid-cols-3 gap-2 sm:gap-3",children:[(0,a.jsxs)("div",{className:"rounded-2xl border border-white/8 bg-white/[.025] p-3 sm:p-4",children:[(0,a.jsx)(i.A,{size:16,className:"text-violet-300"}),(0,a.jsx)("strong",{className:"mt-3 block text-xl font-black tabular-nums text-white",children:eD.stats.total}),(0,a.jsx)("span",{className:"text-[10px] font-bold text-neutral-500 sm:text-xs",children:"Entw\xfcrfe"})]}),(0,a.jsxs)("div",{className:"rounded-2xl border border-white/8 bg-white/[.025] p-3 sm:p-4",children:[(0,a.jsx)(ei.A,{size:16,className:"text-emerald-300"}),(0,a.jsx)("strong",{className:"mt-3 block text-xl font-black tabular-nums text-white",children:eD.stats.completed}),(0,a.jsx)("span",{className:"text-[10px] font-bold text-neutral-500 sm:text-xs",children:"Ergebnisse"})]}),(0,a.jsxs)("div",{className:"rounded-2xl border border-white/8 bg-white/[.025] p-3 sm:p-4",children:[(0,a.jsx)(en.A,{size:16,className:"text-amber-300"}),(0,a.jsx)("strong",{className:"mt-3 block text-xl font-black tabular-nums text-white",children:eD.stats.availableCredits}),(0,a.jsx)("span",{className:"text-[10px] font-bold text-neutral-500 sm:text-xs",children:"Credits"})]})]})]}),(0,a.jsx)("div",{className:"space-y-4",children:eD.generations.map(e=>{let t=ek[e.status],s=function(e){if(e)return e<6e4?`${Math.round(e/1e3)} Sek.`:`${Math.round(e/6e4)} Min.`}(e.durationMs);return(0,a.jsxs)("article",{className:"overflow-hidden rounded-2xl border border-white/8 bg-white/[.025]",children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-px bg-white/8",children:[(0,a.jsxs)("div",{className:"relative aspect-[4/3] overflow-hidden bg-[#060609]",children:[e.sourceImageUrl?(0,a.jsx)("img",{src:e.sourceImageUrl,alt:"Vom Kunden hochgeladenes Fahrzeug",className:"h-full w-full object-cover"}):(0,a.jsx)("div",{className:"grid h-full place-items-center text-neutral-700",children:(0,a.jsx)(ei.A,{size:22})}),(0,a.jsx)("span",{className:"absolute bottom-2 left-2 rounded-md bg-black/75 px-2 py-1 text-[9px] font-black text-neutral-300 backdrop-blur",children:"Original"})]}),(0,a.jsxs)("div",{className:"relative aspect-[4/3] overflow-hidden bg-[#060609]",children:[e.outputImageUrl?(0,a.jsx)("img",{src:e.outputImageUrl,alt:"Ergebnis des KI-Folierungsentwurfs",className:"h-full w-full object-cover"}):(0,a.jsx)("div",{className:"grid h-full place-items-center text-neutral-700",children:"processing"===e.status?(0,a.jsx)(n.A,{size:22,className:"animate-spin"}):(0,a.jsx)(ei.A,{size:22})}),(0,a.jsx)("span",{className:"absolute bottom-2 left-2 rounded-md bg-black/75 px-2 py-1 text-[9px] font-black text-neutral-300 backdrop-blur",children:"KI-Ergebnis"})]})]}),(0,a.jsxs)("div",{className:"p-4 sm:p-5",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"truncate text-sm font-black text-white",children:e.vehicleLabel||"Folierungsentwurf"}),(0,a.jsxs)("p",{className:"mt-1 text-xs text-neutral-600",children:[ew(e.createdAt).full,s?` \xb7 ${s}`:""]})]}),(0,a.jsx)("span",{className:(0,eb.cn)("shrink-0 rounded-lg border px-2.5 py-1 text-[10px] font-black",t.className),children:t.label})]}),(0,a.jsx)("p",{className:"mt-3 line-clamp-3 text-xs leading-5 text-neutral-400",children:e.summary||e.prompt}),e.details.length>0&&(0,a.jsx)("div",{className:"mt-4 grid grid-cols-2 gap-2 sm:grid-cols-3",children:e.details.slice(0,9).map(t=>(0,a.jsxs)("div",{className:"rounded-xl bg-black/20 px-3 py-2",children:[(0,a.jsx)("p",{className:"text-[9px] font-bold uppercase tracking-wider text-neutral-600",children:t.label}),(0,a.jsx)("p",{className:"mt-0.5 truncate text-xs font-semibold text-neutral-300",title:t.value,children:t.value})]},`${e.id}-${t.label}`))}),e.error&&(0,a.jsx)("p",{className:"mt-4 rounded-xl border border-red-500/15 bg-red-500/[.07] px-3 py-2 text-xs leading-5 text-red-200",children:e.error}),(e.outputImageUrl||e.sourceImageUrl)&&(0,a.jsxs)("a",{href:e.outputImageUrl||e.sourceImageUrl,target:"_blank",rel:"noreferrer",className:"mt-4 inline-flex min-h-10 items-center gap-2 rounded-xl border border-white/10 px-3 text-xs font-black text-neutral-300 transition hover:border-violet-400/30 hover:text-white",children:["Bild \xf6ffnen ",(0,a.jsx)(eo.A,{size:13})]})]})]},e.id)})})]}):(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[(0,a.jsx)("div",{className:"grid size-16 place-items-center rounded-2xl border border-violet-500/15 bg-violet-500/[.07] text-violet-300",children:(0,a.jsx)(i.A,{size:26})}),(0,a.jsx)("p",{className:"mt-4 text-sm font-bold text-neutral-300",children:"Noch keine KI-Entw\xfcrfe"}),(0,a.jsx)("p",{className:"mt-2 max-w-xs text-xs leading-5 text-neutral-600",children:"Sobald der Kunde im K
13I-Studio eine Vorschau erstellt, erscheint sie automatisch in dieser Kundenakte."})]})},"studio"):(0,a.jsx)("div",{className:"px-6 py-6 animate-in fade-in slide-in-from-bottom-2 duration-150",children:eR?(0,a.jsx)("div",{className:"flex items-center justify-center py-16",children:(0,a.jsx)(n.A,{size:28,className:"text-violet-400 animate-spin"})}):0===eE.length?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 gap-3 text-center",children:[(0,a.jsx)("div",{className:"w-14 h-14 rounded-2xl bg-white/5 flex items-center justify-center",children:(0,a.jsx)(ed.A,{size:24,className:"text-neutral-600"})}),(0,a.jsx)("p",{className:"text-neutral-500 text-sm font-medium",children:"Noch keine Historie"}),(0,a.jsx)("p",{className:"text-neutral-700 text-xs max-w-[240px]",children:"Ab jetzt werden Termin-Anlagen, \xc4nderungen und L\xf6schungen hier nachweisbar protokolliert."})]}):(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("p",{className:"text-xs text-neutral-600 pb-1",children:[eE.length," Ereignis",1!==eE.length?"se":""]}),eE.map(e=>{let t=eN[e.type]??eN["booking.updated"],s=t.icon,r=ew(e.timestamp);return(0,a.jsx)("div",{className:(0,eb.cn)("p-4 bg-white/[0.03] border rounded-2xl transition-all hover:bg-white/[0.06]",t.border),children:(0,a.jsxs)("div",{className:"flex items-start gap-4",children:[(0,a.jsx)("div",{className:(0,eb.cn)("w-10 h-10 rounded-xl flex items-center justify-center shrink-0",t.bg),children:(0,a.jsx)(s,{size:18,className:t.color})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-bold text-white",children:e.title}),e.subtitle&&(0,a.jsx)("p",{className:"text-xs text-neutral-500 mt-1",children:e.subt
13itle})]}),(0,a.jsx)("span",{className:"text-[10px] font-black uppercase tracking-widest text-neutral-600 whitespace-nowrap",children:r.full})]}),e.actor&&(0,a.jsxs)("p",{className:"text-xs text-neutral-600 mt-2",children:["Nachweis: ",(0,a.jsx)("span",{className:"text-neutral-400",children:e.actor})]}),e.meta&&Object.keys(e.meta).length>0&&(0,a.jsx)("div",{className:"mt-3 grid grid-cols-1 sm:grid-cols-2 gap-2",children:Object.entries(e.meta).filter(([,e])=>void 0!==e&&""!==e).map(([e,t])=>(0,a.jsxs)("div",{className:"rounded-lg bg-black/20 border border-white/5 px-3 py-2",children:[(0,a.jsx)("p",{className:"text-[9px] font-black uppercase tracking-widest text-neutral-700",children:e}),(0,a.jsx)("p",{className:"text-xs text-neutral-300 mt-0.5 truncate",children:String(t)})]},e))}),e.link&&(0,a.jsxs)("a",{href:e.link,target:e.link.startsWith("http")?"_blank":void 0,rel:e.link.startsWith("http")?"noreferrer":void 0,className:"inline-flex items-center gap-1.5 mt-3 text-[10px] font-black uppercase tracking-widest text-violet-400 hover:text-violet-300",children:["\xd6ffnen ",(0,a.jsx)(eo.A,{size:11})]})]})]})},e.id)})]})},"historie")})}),(0,a.jsxs)("div",{className:"shrink-0 px-6 py-5 border-t border-white/8 bg-gradient-to-t from-[#070709] to-transparent",children:[(0,a.jsx)(N.N,{children:J&&(0,a.jsx)(k.P.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"overflow-hidden",children:(0,a.jsxs)("div",{className:"flex items-start gap-3 p-4 mb-4 bg-red-500/10 border border-red-500/20 rounded-xl",children:[(0,a.jsx)(ec.A,{size:16,className:"text-red-400 shrink-0 mt-0.5"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"text-sm font-bold text-white",children:"Wirklich l\xf6schen?"}),(0,a.jsx)("p",{className:"text-xs text-neutral-400 mt-0.5",children:"Dieser Kunde wird dauerhaft entfernt."})]}),(0,a.jsxs)("div",{className:"flex gap-2 shrink-0",children:[(0,a.jsx)("button",{onClick:()=>X(!1),className:"px-3 py-1.5 rounded-lg bg-white/5 hover:bg-white/10 text-xs font-bold text-neutral-400 transition-all",children:"Nein"}),(0,a.jsxs)("button",{onClick:eO,disabled:Q,className:"px-3 py-1.5 rounded-lg bg-red-500 hover:bg-red-400 disabled:opacity-50 text-xs font-black text-white flex items-center gap-1.5 transition-all",children:[Q?(0,a.jsx)(n.A,{size:13,className:"animate-spin"}):(0,a.jsx)(j.A,{size:13}),"L\xf6schen"]})]})]})})}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[d&&!J&&(0,a.jsxs)("button",{onClick:()=>X(!0),disabled:Z||Q,className:"flex items-center gap-1.5 px-4 py-3 rounded-xl bg-red-500/10 border border-red-500/20 hover:bg-red-500/20 hover:border-red-500/40 text-red-400 text-xs font-black uppercase tracking-widest transition-all disabled:opacity-40",children:[(0,a.jsx)(j.A,{size:14}),"L\xf6schen"]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 ml-auto",children:[(0,a.jsx)("button",{onClick:s,disabled:Z||Q,className:"px-5 py-3 rounded-xl bg-white/5 border border-white/8 hover:bg-white/10 text-neutral-400 hover:text-white text-xs font-black uppercase tracking-widest transition-all disabled:opacity-40",children:"Abbrechen"}),(0,a.jsxs)("button",{onClick:eF,disabled:Z||Q,className:"flex items-center gap-2 px-6 py-3 rounded-xl bg-violet-600 hover:bg-violet-500 disabled:opacity-50 text-white text-xs font-black uppercase tracking-widest shadow-lg shadow-violet-600/25 hover:shadow-violet-600/40 transition-all",children:[Z&&(0,a.jsx)(n.A,{size:14,className:"animate-spin"}),"Speichern"]})]})]})]})]},"drawer")]})})}var eA=s(61878),eS=s(91231),ez=s(99276),eC=s(64479),e$=s(9199);let eK="min-h-[40px] rounded-xl border border-white/10 bg-neutral-950/80 px-3 pr-8 text-xs font-bold text-neutral-300 outline-none transition-colors hover:border-white/20 focus:border-violet-500/60 focus:text-white";function eE({filters:e,searchDraft:t,onSearchDraftChange:s,onChange:r,onReset:l,availableTags:n,compact:o,onCompactChange:d,resultCount:c,grandTotal:x}){let h=["studio","portal","bookings","period","source","tag"].filter(t=>e[t]&&e[t]!==P[t]).length,u=h>0||e.search.length>0;return(0,a.jsxs)("section",{"aria-label":"Kunden filtern",className:"sticky top-0 z-30 -mx-4 space-y-3 border-b border-white/5 bg-[#0a0a0f]/95 px-4 py-3 backdrop-blur-xl md:static md:mx-0 md:z-auto md:space-y-4 md:rounded-3xl md:border md:border-white/5 md:bg-neutral-900/40 md:px-5 md:py-5",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-center",children:[(0,a.jsxs)("div",{className:"group relative flex min-h-[44px] flex-1 items-center rounded-2xl border border-white/5 bg-neutral-950/70 focus-within:border-violet-500/50",children:[(0,a.jsx)(eA.A,{className:"ml-4 flex-shrink-0 text-neutral-500",size:18,"aria-hidden":!0}),(0,a.jsx)("input",{type:"search",placeholder:"Name, E-Mail, Telefon oder Notiz suchen…",value:t,onChange:e=>s(e.target.value),"aria-label":"Kunden durchsuchen",className:"min-h-[44px] w-full border-none bg-transparent px-4 py-3 text-sm font-medium text-white outline-none placeholder:text-neutral-600"}),t&&(0,a.jsx)("button",{type:"button",onClick:()=>s(""),className:"mr-3 min-h-[40px] flex-shrink-0 px-2 text-[11px] font-black uppercase tracking-widest text-neutral-500 transition-colors hover:text-white",children:"L\xf6schen"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("label",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"sr-only",children:"Sortierung"}),(0,a.jsx)("select",{value:e.sort,onChange:e=>r("sort",e.target.value),className:eK,children:L.map(e=>(0,a.jsx)("option",{value:e,children:F[e]},e))})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>d(!o),"aria-pressed":o,title:o?"Zur normalen Ansicht wechseln":"Kompakte Ansicht: mehr Kunden pro Bildschirm",className:`flex min-h-[40px] items-center gap-2 rounded-xl border px-3 text-[11px] font-black uppercase tracking-widest transition-all active:scale-95 ${o?"border-violet-500/40 bg-violet-600/15 text-violet-300":"border-white/10 bg-white/5 text-neutral-400 hover:border-white/20 hover:text-white"}`,children:[o?(0,a.jsx)(eS.A,{size:14,"aria-hidden":!0}):(0,a.jsx)(ez.A,{size:14,"aria-hidden":!0}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Kompakt"})]})]})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("span",{className:"mr-1 hidden items-center gap-1.5 text-[10px] font-black uppercase tracking-[0.16em] text-neutral-500 sm:flex",children:[(0,a.jsx)(i.A,{size:12,className:"text-violet-400","aria-hidden":!0}),"KI Studio"]}),R.map(t=>{let s=e.studio===t;return(0,a.jsx)("button",{type:"button",onClick:()=>r("studio",t),"aria-pressed":s,className:`min-h-[36px] rounded-full border px-3.5 text-[11px] font-black uppercase tracking-widest transition-all active:scale-95 ${s?"border-violet-500 bg-violet-600 text-white shadow-lg shadow-violet-900/25":"border-white/10 bg-white/[0.03] text-neutral-400 hover:border-violet-500/30 hover:text-white"}`,children:I[t]},t)}
13)]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)(eC.A,{size:13,className:"hidden text-neutral-600 sm:block","aria-hidden":!0}),(0,a.jsxs)("label",{children:[(0,a.jsx)("span",{className:"sr-only",children:"Portalzugang"}),(0,a.jsx)("select",{value:e.portal,onChange:e=>r("portal",e.target.value),className:eK,children:_.map(e=>(0,a.jsx)("option",{value:e,children:B[e]},e))})]}),(0,a.jsxs)("label",{children:[(0,a.jsx)("span",{className:"sr-only",children:"Buchungen"}),(0,a.jsx)("select",{value:e.bookings,onChange:e=>r("bookings",e.target.value),className:eK,children:D.map(e=>(0,a.jsx)("option",{value:e,children:U[e]},e))})]}),(0,a.jsxs)("label",{children:[(0,a.jsx)("span",{className:"sr-only",children:"Angelegt im Zeitraum"}),(0,a.jsx)("select",{value:e.period,onChange:e=>r("period",e.target.value),className:eK,children:M.map(e=>(0,a.jsx)("option",{value:e,children:G[e]},e))})]}),(0,a.jsxs)("label",{children:[(0,a.jsx)("span",{className:"sr-only",children:"Quelle"}),(0,a.jsxs)("select",{value:e.source,onChange:e=>r("source",e.target.value),className:eK,children:[(0,a.jsx)("option",{value:"",children:"Quelle: alle"}),O.map(e=>(0,a.jsx)("option",{value:e,children:V[e]},e))]})]}),n.length>0&&(0,a.jsxs)("label",{children:[(0,a.jsx)("span",{className:"sr-only",children:"Tag"}),(0,a.jsxs)("select",{value:e.tag,onChange:e=>r("tag",e.target.value),className:eK,children:[(0,a.jsx)("option",{value:"",children:"Tag: alle"}),n.map(e=>(0,a.jsx)("option",{value:e,children:e},e))]})]}),(0,a.jsxs)("span",{className:"ml-auto flex items-center gap-3",children:[(0,a.jsxs)("span",{className:"text-[11px] font-bold uppercase tracking-widest text-neutral-500",children:[(0,a.jsx)("span",{className:"text-white",children:c}),c!==x&&(0,a.jsxs)(a.Fragment,{children:[" von ",x]})," Kunden"]}),u&&(0,a.jsxs)("button",{type:"button",onClick:l,className:"flex min-h-[36px] items-center gap-1.5 rounded-xl border border-white/10 bg-white/5 px-3 text-[10px] font-black uppercase tracking-widest text-neutral-400 transition-all hover:border-red-500/30 hover:text-white active:scale-95",children:[(0,a.jsx)(e$.A,{size:12,"aria-hidden":!0}),"Zur\xfccksetzen",h>0&&(0,a.jsx)("span",{className:"ml-0.5 rounded-md bg-violet-600/30 px-1.5 text-violet-200",children:h})]})]})]})]})}var eT=s(94514);let eR={email:"Gleiche E-Mail",phone:"Gleiche Telefonnummer",name:"Gleicher Name"},e_={email:"bg-red-500/15 border-red-500/30 text-red-300",phone:"bg-amber-500/15 border-amber-500/30 text-amber-300",name:"bg-violet-500/15 border-violet-500/30 text-violet-300"};function eD({open:e,loading:t,groups:s,primaryByGroup:r,onPrimaryChange:l,onMerge:i,mergingKey:d,onClose:c}){return(0,a.jsx)(N.N,{initial:!1,children:e&&(0,a.jsx)(k.P.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2},className:"overflow-hidden",children:(0,a.jsxs)("div",{className:"bg-violet-600/[0.04] border border-violet-500/15 rounded-3xl p-5 md:p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,a.jsx)("div",{className:"w-8 h-8 rounded-xl bg-violet-600/20 border border-violet-500/30 flex items-center justify-center",children:(0,a.jsx)(o.A,{size:14,className:"text-violet-400"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-black text-white uppercase tracking-widest",children:"Duplikate erkannt"}),(0,a.jsx)("p",{className:"text-[11px] text-neutral-500 mt-0.5",children:"W\xe4hle den Prim\xe4r-Kunden pro Gruppe — andere werden gemergt und Termine umgeh\xe4ngt."})]})]}),(0,a.jsx)("button",{onClick:c,className:"p-2 rounded-lg text-neutral-500 hover:text-white hover:bg-white/5 transition-all",title:"Schlie\xdfen",children:(0,a.jsx)(w.A,{size:16})})]}),t?(0,a.jsxs)("div",{className:"flex items-center justify-center py-10",children:[(0,a.jsx)(n.A,{size:20,className:"animate-spin text-violet-400"}),(0,a.jsx)("span",{className:"ml-3 text-xs text-neutral-400 font-bold uppercase tracking-widest",children:"Suche l\xe4uft…"})]}):0===s.length?(0,a.jsx)("div",{className:"flex items-center justify-center py-8 px-4 text-center",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"w-12 h-12 mx-auto rounded-2xl bg-emerald-600/15 border border-emerald-500/20 flex items-center justify-center mb-3",children:(0,a.jsx)(eT.A,{size:20,className:"text-emerald-400",strokeWidth:2.5})}),(0,a.jsx)("p",{className:"text-sm font-bold text-emerald-300",children:"Keine Duplikate"}),(0,a.jsx)("p",{className:"text-[11px] text-neutral-500 mt-1",children:"Datenbank ist sauber."})]})}):(0,a.jsx)("div",{className:"space-y-3",children:s.map(e=>{let t=r[e.key]??e.customers[0]?._id,s=d===e.key;return(0,a.jsxs)("div",{className:"bg-neutral-900/50 border border-white/5 rounded-2xl p-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 mb-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`text-[10px] font-black uppercase tracking-widest border rounded-md px-2 py-0.5 ${e_[e.reason]}`,children:eR[e.reason]}),(0,a.jsx)("span",{className:"text-[11px] text-neutral-500 font-mono truncate max-w-[200px]",children:e.key}),(0,a.jsxs)("span",{className:"text-[11px] text-neutral-500 font-bold",children:["\xb7 ",e.customers.length," Treffer"]})]}),(0,a.jsxs)("button",{onClick:()=>i(e),disabled:s||!t,className:"flex items-center gap-1.5 px-3 py-1.5 bg-vi
13olet-600 hover:bg-violet-500 disabled:opacity-50 disabled:cursor-not-allowed text-white rounded-lg font-black uppercase tracking-widest text-[10px] transition-all active:scale-95",children:[s?(0,a.jsx)(n.A,{size:11,className:"animate-spin"}):(0,a.jsx)(o.A,{size:11,strokeWidth:3}),"Zusammenf\xfchren"]})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-2",children:e.customers.map(s=>{var r;let i,n=s._id===t;return(0,a.jsxs)("label",{className:`flex items-start gap-2.5 p-3 rounded-xl cursor-pointer transition-all border ${n?"bg-violet-600/15 border-violet-500/40 ring-1 ring-violet-500/40":"bg-white/[0.02] border-white/5 hover:border-white/15"}`,children:[(0,a.jsx)("input",{type:"radio",name:`primary-${e.key}`,checked:n,onChange:()=>l(e.key,s._id),className:"mt-1 accent-violet-500 flex-shrink-0"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:`text-sm font-bold truncate ${n?"text-violet-200":"text-white"}`,children:(i=(s.lastName??"").trim())?`${s.firstName} ${i}`:(s.firstName??"").trim()}),n&&(0,a.jsx)("span",{className:"text-[9px] font-black text-violet-300 bg-violet-600/30 px-1.5 py-0.5 rounded uppercase tracking-widest flex-shrink-0",children:"Prim\xe4r"})]}),s.email&&(0,a.jsxs)("div",{className:"text-[11px] text-neutral-400 truncate flex items-center gap-1 mt-0.5",children:[(0,a.jsx)(p.A,{size:9}),s.email]}),s.phone&&(0,a.jsxs)("div",{className:"text-[11px] text-neutral-400 truncate flex items-center gap-1 mt-0.5",children:[(0,a.jsx)(m.A,{size:9}),s.phone]}),(0,a.jsxs)("div",{className:"text-[10px] text-neutral-500 mt-1 flex items-center gap-2",children:[(0,a.jsxs)("span",{children:["\uD83D\uDCC5 ",s.bookingsCount??0]}),(0,a.jsxs)("span",{children:["\xb7 erstellt ",(r=s.createdAt)?new Date(r).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"}):"—"]})]})]})]},s._id)})})]},e.key)})})]})})})}let eM="ffx:customers:compact",eL=["bg-violet-600","bg-fuchsia-600","bg-indigo-600","bg-cyan-700","bg-emerald-700","bg-amber-700","bg-rose-700","bg-sky-700"];function eP(e){let t=(e.lastName??"").trim();return t?`${e.firstName} ${t}`:(e.firstName??"").trim()}function eI(e){return e?new Date(e).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"}):"—"}function eB(e){if(!e)return"—";let t=new Date(e).getTime();if(Number.isNaN(t))return"—";let s=Math.floor((Date.now()-t)/864e5);return s<=0?"heute":1===s?"gestern":s<30?`vor ${s} T.`:s<365?`vor ${Math.floor(s/30)} Mon.`:`vor ${Math.floor(s/365)} J.`}function eU({customer:e,compact:t=!1}){var s,r;let l,i,n=t?"w-8 h-8":"w-11 h-11";if(e.photoUrl)return(0,a.jsx)("img",{src:e.photoUrl,alt:eP(e),className:`${n} rounded-full object-cover flex-shrink-0 border border-white/10`});let o=function(e){let t=0;for(let s=0;s<e.length;s++)t=e.charCodeAt(s)+((t<<5)-t);return eL[Math.abs(t)%eL.length]}(`${e.firstName}${e.lastName??""}`);return(0,a.jsx)("div",{className:`${n} ${o} rounded-full flex items-center justify-center flex-shrink-0 font-black text-white ${t?"text-[10px]":"text-sm"} shadow-lg`,children:(s=e.firstName,r=e.lastName,l=(s??"").charAt(0),i=(r??"").charAt(0),`${l}${i}`.toUpperCase()||"?")})}function eG({customer:e,compact:t}){let s=e.aiGenerationsCount??0;if(0===s)return(0,a.jsx)("span",{className:"text-xs text-neutral-700",children:"—"});let r=function(e){if(!e)return!1;let t=new Date(e).getTime();return!Number.isNaN(t)&&Date.now()-t<=2592e6}(e.lastAiGenerationAt);return(0,a.jsxs)("span",{className:`inline-flex items-center gap-1.5 rounded-lg border px-2 py-1 text-[10px] font-black ${r?"border-violet-500/40 bg-violet-500/15 text-violet-200":"border-violet-500/15 bg-violet-500/[0.07] text-violet-400/80"}`,title:`${s} KI-Entw\xfcrfe \xb7 zuletzt ${eB(e.lastAiGenerationAt)}`,children:[(0,a.jsx)(i.A,{size:11,"aria-hidden":!0}),s,!t&&(0,a.jsx)("span",{className:"font-bold text-neutral-400",children:eB(e.lastAiGenerationAt)})]})}function eF(){return(0,a.jsx)("tr",{className:"border-b border-white/5",children:[32,48,140,100,180,110,70,80,40,64].map((e,t)=>(0,a.jsx)("td",{className:"px-4 py-4",children:(0,a.jsx)("div",{className:"h-4 bg-white/5 rounded-lg animate-pulse",style:{width:e}})},`${e}-${t}`))})}function eO({icon:e,label:t,value:s,hint:r,highlight:l,compact:i,onClick:n,active:o}){let d=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:`${i?"w-8 h-8":"w-10 h-10"} rounded-xl flex items-center justify-center flex-shrink-0 ${l?"bg-violet-600/20 text-violet-400":"bg-white/5 text-neutral-400"}`,children:e}),(0,a.jsxs)("div",{className:"min-w-0 text-left",children:[(0,a.jsx)("p",{className:"whitespace-nowrap text-[9px] font-bold uppercase tracking-[0.16em] text-neutral-500",children:t}),(0,a.jsx)("p",{className:`${i?"text-xl":"text-2xl"} font-black ${l?"text-violet-400":"text-white"}`,children:s}),r&&!i&&(0,a.jsx)("p",{className:"mt-0.5 truncate text-[10px] font-bold text-neutral-500",children:r})]})]}),c=`flex items-center gap-3 rounded-2xl border transition-all ${i?"px-4 py-3":"px-5 py-5"} ${l?"bg-violet-600/10 border-violet-500/20":"bg-white/[0.02] border-white/5"} ${o?"ring-1 ring-violet-500/50":""}`;return n?(0,a.jsx)("button",{type:"button",onClick:n,"aria-pressed":o,className:`${c} text-left hover:border-violet-500/40 active:scale-[0.99]`,children:d}):(0,a.jsx)("div",{className:c,children:d})}let eV={total:0,grandTotal:0,portalTotal:0,newThisMonthTotal:0,studioCustomerTotal:0,studioGenerationTotal:0,studioActiveTotal:0,availableTags:[],truncated:!1,pages:1};function eW(){let e=(0,l.useSearchParams)(),t=(0,l.useRouter)(),s=(0,l.usePathname)(),S=e.get("id"),I=(0,r.useMemo)(()=>{var t;let s;return{search:"string"==typeof(s={search:(t=e).get("search")??t.get("name")??"",studio:t.get("studio")??void 0,portal:t.get("portal")??void 0,bookings:t.get("bookings")??void 0,period:t.get("period")??void 0,source:t.get("source")??void 0,tag:t.get("tag")??void 0,sort:t.get("sort")??void 0}??{}).search?s.search.trim().slice(0,120):"",studio:W(R,s.studio,"all"),portal:W(_,s.portal,"all"),bookings:W(D,s.bookings,"all"),period:W(M,s.period,"all"),source:W([...O,""],s.source,""),tag:"string"==typeof s.tag?s.tag.trim().slice(0,60):"",sort:W(L,s.sort,"name")}},[]),[B,U]=(0,r.useState)([]),[G,F]=(0,r.useState)(eV),[V,H]=(0,r.useState)(1),[Q,q]=(0,r.useState)(I),[J,X]=(0,r.useState)(I.search),[Y,ee]=(0,r.useState)(!1),[et,es]=(0,r.useState)(!0),[ea,er]=(0,r.useTransition)(),{total:el,grandTotal:ei,pages:en,availableTags:eo,truncated:ed}=G,[ec,ex]=(0,r.useState)(!1),[eh,eu]=(0,r.useState)(null),[em,ep]=(0,r.useState)(new Set),[eb,eg]=(0,r.useState)(!1),[ef,ev]=(0,r.useState)(!1),[ej,ew]=(0,r.useState)(!1),[eN,ek]=(0,r.useState)([]),[eA,eS]=(0,r.useState)({}),[ez,eC]=(0,r.useState)(null),e$=(0,r.useRef)(null);(0,r.useEffect)(()=>{try{ee("1"===window.localStorage.getItem(eM))}catch{}},[]);let eK=(0,r.useCallback)(e=>{ee(e);try{window.localStorage.setItem(eM,e?"1":"0")}catch{}},[]);(0,r.useEffect)(()=>(e$.current&&clearTimeout(e$.current),e$.current=setTimeout(()=>{q(e=>e.search===J?e:{...e,search:J}),H(1)},350),()=>{e$.current&&clearTimeout(e$.current)}),[J]),(0,r.useEffect)(()=>{let e,a=(e=new URLSearchParams,Object.keys(P).forEach(t=>{let s=Q[t];s&&s!==P[t]&&e.set(t,String(s))}),e);S&&a.set("id",S);let r=a.toString(),l=r?`${s}?${r}`:s;`${window.location.pathname}${window.location.search}`!==l&&t.replace(l,{scroll:!1})},[Q,S,s,t]);let eT=(0,r.useCallback)((e,t)=>{q(s=>s[e]===t?s:{...s,[e]:t}),H(1)},[]),eR=(0,r.useCallback)(()=>{q(P),X(""),H(1)},[]),e_=(0,r.useCallback)(async()=>{es(!0);try{let e=await z({...Q,page:V,limit:20});U(e.customers),F({total:e.total,grandTotal:e.grandTotal,portalTotal:e.portalTotal,newThisMonthTotal:e.newThisMonthTotal,studioCustomerTotal:e.studioCustomerTotal,studioGenerationTotal:e.studioGenerationTotal,studioActiveTotal:e.studioActiveTotal,availableTags:e.availableTags,truncated:e.truncated,pages:Math.max(1,e.pages)})}catch{y.oR.error("Kunden konnten nicht geladen werden.")}finally{es(!1)}},[V,Q]);(0,r.useEffect)(()=>{e_()},[e_]),(0,r.useEffect)(()=>
13{if(!S)return;let e=!0;return(async()=>{try{let t=await C(S);t&&e&&(eu(t),ex(!0))}catch(e){console.error("[CustomerListAdmin] Failed to auto-open customer by id:",e)}})(),()=>{e=!1}},[S]);let eL=()=>{eu(null),ex(!0)},eW=e=>{eu(e),ex(!0)},eZ=async(e,t)=>{if(e.stopPropagation(),await (0,A.Q)(`${eP(t)} l\xf6schen?`,"Der Kunde wird unwiderruflich aus der Datenbank entfernt."))try{await $(t._id),y.oR.success("Kunde gel\xf6scht"),er(()=>{e_()})}catch{y.oR.error("Fehler beim L\xf6schen")}},eH=(0,r.useCallback)(e=>{ep(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),eQ=(0,r.useCallback)(()=>{ep(e=>{if(B.every(t=>e.has(t._id))){let t=new Set(e);for(let e of B)t.delete(e._id);return t}let t=new Set(e);for(let e of B)t.add(e._id);return t})},[B]),eq=(0,r.useCallback)(()=>ep(new Set),[]),eJ=B.length>0&&B.every(e=>em.has(e._id)),eX=!eJ&&B.some(e=>em.has(e._id)),eY=(0,r.useCallback)(async()=>{let e=Array.from(em);if(0!==e.length&&await (0,A.Q)(`${e.length} ${(e.length,"Kunden")} l\xf6schen?`,"Diese Aktion kann nicht r\xfcckg\xe4ngig gemacht werden. Die zugeordneten Termine bleiben erhalten (mit Snapshot), verlieren aber die Verkn\xfcpfung.")){eg(!0);try{let t=await K(e);t.ok?(y.oR.success(`${t.deletedCount} ${1===t.deletedCount?"Kunde":"Kunden"} gel\xf6scht`),eq(),er(()=>e_())):y.oR.error(t.error??"Bulk-L\xf6schen fehlgeschlagen")}catch(e){y.oR.error(e?.message??"Bulk-L\xf6schen fehlgeschlagen")}finally{eg(!1)}}},[em,e_,eq]),e0=(0,r.useCallback)(async()=>{ew(!0),ev(!0);try{let e=await E();ek(e.groups);let t={};for(let s of e.groups){let e=[...s.customers].sort((e,t)=>{let s=e.bookingsCount??0,a=t.bookingsCount??0;if(s!==a)return a-s;let r=new Date(e.createdAt).getTime(),l=new Date(t.createdAt).getTime();return r-l});e[0]&&(t[s.key]=e[0]._id)}eS(t),0===e.groups.length?y.oR.success("Keine Duplikate gefunden. Datenbank ist sauber \uD83C\uDF89"):y.oR.info(`${e.groups.length} ${1===e.groups.length?"Duplikat-Gruppe":"Duplikat-Gruppen"} gefunden (${e.total} Datens\xe4tze).`)}catch(e){y.oR.error(e?.message??"Duplikat-Suche fehlgeschlagen")}finally{ew(!1)}},[]),e1=(0,r.useCallback)(async e=>{let t=eA[e.key];if(!t)return void y.oR.error("Bitte einen Prim\xe4r-Kunden ausw\xe4hlen.");let s=e.customers.map(e=>e._id).filter(e=>e!==t);if(0===s.length)return void y.oR.error("Keine weiteren Kunden zum Zusammenf\xfchren.");if(await (0,A.Q)(`${s.length+1} Kunden zusammenf\xfchren?`,`Der gew\xe4hlte Prim\xe4r-Kunde beh\xe4lt alle Daten. Die ${s.length} anderen Datens\xe4tze werden gel\xf6scht und deren Termine auf den Prim\xe4r-Kunden umgeh\xe4ngt.`)){eC(e.key);try{let a=await T(t,s);a.ok?(y.oR.success(`Zusammengef\xfchrt: ${a.mergedCount} Datens\xe4tze + ${a.reassignedBookings??0} Termine umgeh\xe4ngt`),ek(t=>t.filter(t=>t.key!==e.key)),er(()=>e_())):y.oR.error(a.error??"Merge fehlgeschlagen")}catch(e){y.oR.error(e?.message??"Merge fehlgeschlagen")}finally{eC(null)}}},[eA,e_]),e5=Y?"py-2.5":"py-4",e2="text-[10px] font-black text-neutral-500 uppercase tracking-widest",e4=Y?"py-2":"py-3.5",e3=en<=5?Array.from({length:en},(e,t)=>t+1):V<=3?[1,2,3,4,5]:V>=en-2?[en-4,en-3,en-2,en-1,en]:[V-2,V-1,V,V+1,V+2];return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Z.w,{title:"Kundendatenbank",description:"Kundenkontakte, Portalzug\xe4nge, Buchungen und KI-Entw\xfcrfe in einer Akte.",action:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("button",{onClick:e0,disabled:ej,className:"flex items-center gap-2 px-4 py-2.5 bg-white/5 hover:bg-white/10 border border-white/10 hover:border-violet-500/40 text-neutral-300 hover:text-white rounded-xl font-black uppercase tracking-widest text-xs transition-all active:scale-95 disabled:opacity-50",title:"Datenbank nach Duplikaten durchsuchen und intelligent zusammenf\xfchren",children:[ej?(0,a.jsx)(n.A,{size:14,className:"animate-spin"}):(0,a.jsx)(o.A,{size:14,strokeWidth:2.5}),"Duplikate"]}),(0,a.jsxs)("button",{onClick:eL,className:"group relative flex items-center gap-2 px-5 py-2.5 bg-violet-600 hover:bg-violet-500 text-white rounded-xl font-black uppercase tracking-widest text-xs transition-all shadow-lg shadow-violet-900/25 active:scale-95 overflow-hidden",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-gradient-to-r from-white/0 via-white/10 to-white/0 -translate-x-full group-hover:translate-x-full transition-transform duration-700"}),(0,a.jsx)(d.A,{size:16,strokeWidth:3}),"Neuer Kunde"]})]})}),(0,a.jsxs)("div",{className:"space-y-8 pb-32 max-w-[1600px] mx-auto",children:[(0,a.jsxs)("div",{className:`grid grid-cols-2 xl:grid-cols-5 ${Y?"gap-3":"gap-4"}`,children:[(0,a.jsx)(eO,{icon:(0,a.jsx)(c.A,{size:Y?16:20}),label:"Kunden gesamt",value:G.grandTotal,compact:Y}),(0,a.jsx)(eO,{icon:(0,a.jsx)(x.A,{size:Y?16:20}),label:"Neu diesen Monat",value:G.newThisMonthTotal,compact:Y}),(0,a.jsx)(eO,{icon:(0,a.jsx)(h.A,{size:Y?16:20}),label:"Portal verbunden",value:G.portalTotal,compact:Y,highlight:!0,active:"linked"===Q.portal,onClick:()=>eT("portal","linked"===Q.portal?"all":"linked")}),(0,a.jsx)(eO,{icon:(0,a.jsx)(i.A,{size:Y?16:20}),label:"Nutzen das KI Studio",value:G.studioCustomerTotal,hint:`${G.studioGenerationTotal} Entw\xfcrfe insgesamt`,compact:Y,active:"users"===Q.studio,onClick:()=>eT("studio","users"===Q.studio?"all":"users")}),(0,a.jsx)(eO,{icon:(0,a.jsx)(u.A,{size:Y?16:20}),label:"KI aktiv (30 Tage)",value:G.studioActiveTotal,hint:"Zuletzt etwas gerechnet",compact:Y,active:"active"===Q.studio,onClick:()=>eT("studio","active"===Q.studio?"all":"active")})]}),(0,a.jsx)(eD,{open:ef,loading:ej,groups:eN,primaryByGroup:eA,onPrimaryChange:(e,t)=>
13eS(s=>({...s,[e]:t})),onMerge:e1,mergingKey:ez,onClose:()=>ev(!1)}),(0,a.jsx)(eE,{filters:Q,searchDraft:J,onSearchDraftChange:X,onChange:eT,onReset:eR,availableTags:eo,compact:Y,onCompactChange:eK,resultCount:el,grandTotal:ei}),ed&&(0,a.jsx)("p",{className:"rounded-2xl border border-amber-500/20 bg-amber-500/[0.06] px-4 py-3 text-[11px] font-bold text-amber-300",children:"Sehr gro\xdfer Datenbestand: Diese Sortierung wertet die ersten 4.000 Treffer aus. Suche oder weitere Filter grenzen das Ergebnis exakt ein."}),(0,a.jsxs)("div",{className:`md:hidden ${Y?"space-y-2":"space-y-3"}`,children:[et?Array.from({length:6}).map((e,t)=>(0,a.jsx)("div",{className:`${Y?"h-[60px]":"h-[88px]"} rounded-2xl bg-neutral-900/40 border border-white/5 animate-pulse`},`m-skel-${t}`)):0===B.length?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-20 px-6 text-center bg-neutral-900/40 border border-white/5 rounded-3xl",children:[(0,a.jsx)("div",{className:"w-20 h-20 bg-white/[0.03] rounded-3xl flex items-center justify-center mb-6 border border-white/5",children:(0,a.jsx)(c.A,{size:36,className:"text-neutral-700"})}),(0,a.jsx)("p",{className:"text-neutral-500 font-black uppercase tracking-widest text-sm mb-2",children:Q.search?"Keine Kunden gefunden":"Noch keine Kunden angelegt."}),!Q.search&&(0,a.jsxs)("button",{onClick:eL,className:"mt-6 flex items-center gap-2 px-6 py-3 bg-violet-600 hover:bg-violet-500 text-white rounded-xl font-black uppercase tracking-widest text-xs transition-all active:scale-95 min-h-[44px]",children:[(0,a.jsx)(d.A,{size:14,strokeWidth:3}),"Ersten Kunden anlegen"]})]}):B.map(e=>(0,a.jsxs)("div",{className:`flex items-center bg-neutral-900/40 border rounded-2xl transition-all ${Y?"gap-2.5 p-2.5 min-h-[52px]":"gap-3 p-4 min-h-[64px]"}
13 ${em.has(e._id)?"border-violet-500/40 bg-violet-600/[0.06]":"border-white/5"}`,children:[(0,a.jsx)("label",{onClick:e=>e.stopPropagation(),className:"-my-2 -ml-2 flex size-11 shrink-0 cursor-pointer items-center justify-center rounded-lg active:bg-white/[0.06] lg:m-0 lg:size-5 lg:active:bg-transparent",children:(0,a.jsx)("input",{type:"checkbox",checked:em.has(e._id),onChange:()=>eH(e._id),className:"w-5 h-5 accent-violet-500 cursor-pointer flex-shrink-0","aria-label":`${eP(e)} ausw\xe4hlen`})}),(0,a.jsxs)("button",{onClick:()=>eW(e),className:"flex-1 text-left flex items-center gap-3 active:scale-[0.98] transition-transform",children:[(0,a.jsx)(eU,{customer:e,compact:Y}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)("div",{className:"font-bold text-white truncate text-sm",children:eP(e)}),(0,a.jsxs)("span",{className:"flex flex-shrink-0 items-center gap-1.5",children:[Y&&(e.aiGenerationsCount??0)>0&&(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-md border border-violet-500/25 bg-violet-500/10 px-1.5 py-0.5 text-[10px] font-black text-violet-300",children:[(0,a.jsx)(i.A,{size:9,"aria-hidden":!0})," ",e.aiGenerationsCount]}),(0,a.jsx)("span",{className:`inline-flex items-center justify-center min-w-[2rem] px-2 py-0.5 rounded-lg text-[11px] font-black ${e.bookingsCount>1?"bg-violet-600/20 text-violet-400 border border-violet-500/20":"bg-white/5 text-neutral-500 border border-white/5"}`,children:e.bookingsCount})]})]}),(0,a.jsxs)("div",{className:`mt-1 flex flex-col gap-0.5 text-xs text-neutral-500 ${Y?"hidden":""}`,children:[e.phone&&(0,a.jsxs)("span",{className:"flex items-center gap-1.5 truncate",children:[(0,a.jsx)(m.A,{size:11,className:"text-neutral-600 flex-shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:e.phone})]}),e.email&&(0,a.jsxs)("span",{className:"flex items-center gap-1.5 truncate",children:[(0,a.jsx)(p.A,{size:11,className:"text-neutral-600 flex-shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:e.email})]}),e.lastVisit&&(0,a.jsxs)("span",{className:"flex items-center gap-1.5 text-neutral-600",children:[(0,a.jsx)(b.A,{size:11,className:"flex-shrink-0"}),(0,a.jsxs)("span",{className:"truncate",children:["Zuletzt: ",eI(e.lastVisit)]})]}),(e.portalEnabledAt||(e.aiGenerationsCount??0)>0)&&(0,a.jsxs)("span",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[e.portalEnabledAt&&(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-md border border-emerald-500/20 bg-emerald-500/10 px-1.5 py-0.5 text-[10px] font-bold text-emerald-300",children:[(0,a.jsx)(h.A,{size:10})," Portal"]}),(e.aiGenerationsCount??0)>0&&(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-md border border-violet-500/20 bg-violet-500/10 px-1.5 py-0.5 text-[10px] font-bold text-violet-300",children:[(0,a.jsx)(i.A,{size:10})," ",e.aiGenerationsCount," KI",(0,a.jsxs)("span",{className:"text-neutral-400",children:["\xb7 ",eB(e.lastAiGenerationAt)]})]})]})]})]}),(0,a.jsx)(g.A,{size:16,className:"text-neutral-700 flex-shrink-0"})]})]},`m-${e._id}`)),!et&&en>1&&(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 px-2 pt-3",children:[(0,a.jsx)("button",{onClick:()=>H(e=>Math.max(1,e-1)),disabled:V<=1||ea,className:"min-h-[44px] min-w-[44px] flex items-center justify-center rounded-xl bg-white/5 border border-white/5 text-neutral-400 hover:text-white hover:bg-white/10 disabled:opacity-30 disabled:cursor-not-allowed transition-all",children:(0,a.jsx)(f.A,{size:18})}),(0,a.jsxs)("span",{className:"text-[11px] text-neutral-500 font-bold uppercase tracking-widest text-center flex-1",children:["Seite ",(0,a.jsx)("span",{className:"text-white",children:V})," / ",(0,a.jsx)("span",{className:"text-white",children:en}),(0,a.jsxs)("span",{className:"block text-neutral-600 text-[10px] mt-0.5",children:[el," Kunden"]})]}),(0,a.jsx)("button",{onClick:()=>H(e=>Math.min(en,e+1)),disabled:V>=en||ea,className:"min-h-[44px] min-w-[44px] flex items-center justify-center rounded-xl bg-white/5 border border-white/5 text-neutral-400 hover:text-white hover:bg-white/10 disabled:opacity-30 disabled:cursor-not-allowed transition-all",children:(0,a.jsx)(g.A,{size:18})})]})]}),(0,a.jsxs)("div",{className:"hidden md:block bg-neutral-900/40 border border-white/5 rounded-3xl overflow-hidden backdrop-blur-xl",children:[(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b border-white/5 bg-white/[0.02]",children:[(0,a.jsx)("th",{className:`w-10 px-3 ${e5}`,children:(0,a.jsx)("input",{type:"checkbox",checked:eJ,ref:e=>{e&&(e.indeterminate=eX)},onChange:eQ,className:"w-4 h-4 accent-violet-500 cursor-pointer","aria-label":"Alle auf dieser Seite ausw\xe4hlen",title:eJ?"Auswahl auf dieser Seite aufheben":"Alle auf dieser Seite ausw\xe4hlen"})}),(0,a.jsx)("th",{className:`w-14 px-4 ${e5}`}),(0,a.jsx)("th",{className:`text-left px-4 ${e5} ${e2}`,children:"Name"}),(0,a.jsx)("th",{className:`text-left px-4 ${e5} ${e2} hidden 2xl:table-cell`,children:"Telefon"}),(0,a.jsx)("th",{className:`text-left px-4 ${e5} ${e2} hidden lg:table-cell`,children:"E-Mail"}),(0,a.jsx)("th",{className:`text-left px-4 ${e5} ${e2} hidden 2xl:table-cell`,children:"Letzte Buchung"}),(0,a.jsx)("th",{className:`text-left px-4 ${e5} ${e2}`,children:"Portal"}),(0,a.jsx)("th",{className:`text-left px-4 ${e5} ${e2}`,children:"KI Studio"}),(0,a.jsx)("th",{className:`text-left px-4 ${e5} ${e2}`,children:"Buchungen"}),(0,a.jsx)("th",{className:`text-right px-4 ${e5} ${e2}`,children:"Aktionen"})]})}),(0,a.jsx)("tbody",{children:et?Array.from({length:8}).map((e,t)=>(0,a.jsx)(eF,{},`skeleton-${t}`)):0===B.length?(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:10,children:(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-32 px-8 text-center",children:[(0,a.jsx)("div",{className:"w-20 h-20 bg-white/[0.03] rounded-3xl flex items-center justify-center mb-6 border border-white/5",children:(0,a.jsx)(c.A,{size:36,className:"text-neutral-700"})}),(0,a.jsx)("p",{className:"text-neutral-500 font-black uppercase tracking-widest text-sm mb-2",children:Q.search?"Keine Kunden gefunden":"Noch keine Kunden angelegt."}),!Q.search&&(0,a.jsxs)("button",{onClick:eL,className:"mt-6 flex items-center gap-2 px-6 py-3 bg-violet-600 hover:bg-violet-500 text-white rounded-xl font-black uppercase tracking-widest text-xs transition-all active:scale-95",children:[(0,a.jsx)(d.A,{size:14,strokeWidth:3}),"Ersten Kunden anlegen"]})]})})}):(0,a.jsx)(N.N,{mode:"popLayout",children:B.map((e,t)=>(0,a.jsxs)(k.P.tr,{initial:{opacity:0,y:6}
13,animate:{opacity:1,y:0},exit:{opacity:0},transition:{delay:.025*t,duration:.2},onClick:()=>eW(e),className:`border-b border-white/[0.04] hover:bg-white/[0.03] cursor-pointer transition-colors group ${em.has(e._id)?"bg-violet-600/[0.06]":""}`,children:[(0,a.jsx)("td",{className:`px-3 ${e4}`,children:(0,a.jsx)("input",{type:"checkbox",checked:em.has(e._id),onClick:e=>e.stopPropagation(),onChange:()=>eH(e._id),className:"w-4 h-4 accent-violet-500 cursor-pointer","aria-label":`${eP(e)} ausw\xe4hlen`})}),(0,a.jsx)("td",{className:`px-4 ${e4}`,children:(0,a.jsx)(eU,{customer:e,compact:Y})}),(0,a.jsxs)("td",{className:`px-4 ${e4}`,children:[(0,a.jsx)("div",{className:"font-bold text-white group-hover:text-violet-300 transition-colors",children:eP(e)}),!Y&&e.tags?.length>0&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:e.tags.slice(0,2).map(e=>(0,a.jsx)("span",{className:"text-[9px] font-black text-neutral-500 bg-white/5 px-2 py-0.5 rounded-md uppercase tracking-widest border border-white/5",children:e},e))})]}),(0,a.jsx)("td",{className:`px-4 ${e4} hidden 2xl:table-cell`,children:e.phone?(0,a.jsxs)("div",{className:"flex items-center gap-2 text-neutral-300",children:[(0,a.jsx)(m.A,{size:12,className:"text-neutral-600 flex-shrink-0"}),(0,a.jsx)("span",{children:e.phone})]}):(0,a.jsx)("span",{className:"text-neutral-700",children:"—"})}),(0,a.jsx)("td",{className:`px-4 ${e4} hidden lg:table-cell`,children:e.email?(0,a.jsxs)("div",{className:"flex items-center gap-2 text-neutral-300",children:[(0,a.jsx)(p.A,{size:12,className:"text-neutral-600 flex-shrink-0"}),(0,a.jsx)("span",{className:"truncate max-w-[200px]",children:e.email})]}):(0,a.jsx)("span",{className:"text-neutral-700",children:"—"})}),(0,a.jsx)("td",{className:`px-4 ${e4} hidden 2xl:table-cell`,children:(0,a.jsxs)("div",{className:"flex items-center gap-2 text-neutral-400",children:[(0,a.jsx)(b.A,{size:12,className:"text-neutral-600 flex-shrink-0"}),(0,a.jsx)("span",{children:eI(e.lastVisit)})]})}),(0,a.jsx)("td",{className:`px-4 ${e4}`,children:e.portalEnabledAt?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-lg border border-emerald-500/20 bg-emerald-500/10 px-2 py-1 text-[10px] font-black text-emerald-300",children:[(0,a.jsx)(h.A,{size:11,"aria-hidden":!0}),Y?"":"Portal"]}):(0,a.jsx)("span",{className:"text-xs text-neutral-700",children:"—"})}),(0,a.jsx)("td",{className:`px-4 ${e4}`,children:(0,a.jsx)(eG,{customer:e,compact:Y})}),(0,a.jsx)("td",{className:`px-4 ${e4}`,children:(0,a.jsx)("span",{className:`inline-flex items-center justify-center min-w-[2rem] px-2.5 py-1 rounded-lg text-xs font-black ${e.bookingsCount>1?"bg-violet-600/20 text-violet-400 border border-violet-500/20":"bg-white/5 text-neutral-500 border border-white/5"}`,children:e.bookingsCount})}),(0,a.jsx)("td",{className:`px-4 ${e4} text-right`,children:(0,a.jsxs)("div",{className:"flex items-center justify-end gap-2 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,a.jsx)("button",{onClick:t=>{t.stopPropagation(),eu(e),ex(!0)},className:"p-2 bg-white/5 hover:bg-violet-600 text-neutral-400 hover:text-white rounded-xl border border-white/5 transition-all",title:"Bearbeiten",children:(0,a.jsx)(v.A,{size:14})}),(0,a.jsx)("button",{onClick:t=>eZ(t,e),className:"p-2 bg-red-500/10 hover:bg-red-600 text-red-500 hover:text-white rounded-xl border border-red-500/10 transition-all",title:"L\xf6schen",children:(0,a.jsx)(j.A,{size:14})})]})})]},e._id))})})]})}),!et&&en>1&&(0,a.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-t border-white/5 bg-white/[0.01]",children:[(0,a.jsxs)("span",{className:"text-[11px] text-neutral-500 font-bold uppercase tracking-widest",children:["Seite"," ",(0,a.jsx)("span",{className:"text-white",children:V})," von"," ",(0,a.jsx)("span",{className:"text-white",children:en}),(0,a.jsxs)("span",{className:"ml-3 text-neutral-600",children:["(",el," Kunden)"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("button",{onClick:()=>H(e=>Math.max(1,e-1)),disabled:V<=1||ea,className:"p-2 rounded-xl bg-white/5 border border-white/5 text-neutral-400 hover:text-white hover:bg-white/10 disabled:opacity-30 disabled:cursor-not-allowed transition-all",children:(0,a.jsx)(f.A,{size:16})}),e3.map(e=>(0,a.jsx)("button",{onClick:()=>H(e),disabled:ea,className:`min-w-[2rem] h-8 px-2 rounded-xl text-xs font-black transition-all border ${e===V?"bg-vi
13olet-600 border-violet-500 text-white shadow-lg shadow-violet-900/20":"bg-white/5 border-white/5 text-neutral-400 hover:text-white hover:bg-white/10"}`,children:e},e)),(0,a.jsx)("button",{onClick:()=>H(e=>Math.min(en,e+1)),disabled:V>=en||ea,className:"p-2 rounded-xl bg-white/5 border border-white/5 text-neutral-400 hover:text-white hover:bg-white/10 disabled:opacity-30 disabled:cursor-not-allowed transition-all",children:(0,a.jsx)(g.A,{size:16})})]})]}),ea&&(0,a.jsxs)("div",{className:"flex items-center justify-center py-4 border-t border-white/5",children:[(0,a.jsx)(n.A,{size:16,className:"animate-spin text-violet-400 mr-2"}),(0,a.jsx)("span",{className:"text-xs text-neutral-500 font-bold uppercase tracking-widest",children:"Laden..."})]})]})]}),(0,a.jsx)(N.N,{children:em.size>0&&(0,a.jsx)(k.P.div,{initial:{y:80,opacity:0},animate:{y:0,opacity:1},exit:{y:80,opacity:0},transition:{type:"spring",damping:22,stiffness:280},className:"fixed bottom-4 left-1/2 -translate-x-1/2 z-50 max-w-[calc(100vw-2rem)] w-auto",children:(0,a.jsxs)("div",{className:"flex items-center gap-3 bg-neutral-900/95 backdrop-blur-xl border border-violet-500/30 rounded-2xl shadow-[0_20px_60px_-15px_rgba(124,58,237,0.45)] px-4 py-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5 pr-3 border-r border-white/10",children:[(0,a.jsx)("div",{className:"w-8 h-8 rounded-xl bg-violet-600/25 border border-violet-500/40 flex items-center justify-center text-violet-300 font-black text-xs",children:em.size}),(0,a.jsxs)("span",{className:"text-xs font-bold text-neutral-300 uppercase tracking-widest whitespace-nowrap",children:[1===em.size?"Kunde":"Kunden"," ausgew\xe4hlt"]})]}),(0,a.jsxs)("button",{onClick:eq,className:"flex items-center gap-1.5 px-3 py-2 text-xs font-bold text-neutral-400 hover:text-white hover:bg-white/5 rounded-lg uppercase tracking-widest transition-all",title:"Auswahl aufheben",children:[(0,a.jsx)(w.A,{size:13,strokeWidth:2.5}),"Aufheben"]}),(0,a.jsxs)("button",{onClick:eY,disabled:eb,className:"flex items-center gap-1.5 px-4 py-2 text-xs font-black uppercase tracking-widest bg-red-600/15 hover:bg-red-600 text-red-300 hover:text-white rounded-lg border border-red-500/30 hover:border-red-500 transition-all active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed",children:[eb?(0,a.jsx)(n.A,{size:13,className:"animate-spin"}):(0,a.jsx)(j.A,{size:13,strokeWidth:2.5}),"L\xf6schen"]})]})})}),(0,a.jsx)(ey,{isOpen:ec,customer:eh,onClose:()=>ex(!1),onSave:e=>{ex(!1),er(()=>{e_()})},onDelete:e=>{ex(!1),er(()=>{e_()})}})]})}},55941:(e,t,s)=>{"use strict";s.d(t,{w:()=>n});var a=s(95155),r=s(47650),l=s(12115);let i=()=>()=>{};function n({title:e,description:t,action:s}){let o=(0,l.useSyncExternalStore)(i,()=>!0,()=>!1),d=(0,a.jsxs)("div",{className:"flex items-center gap-3 min-w-0 pr-4",children:[(0,a.jsx)("div",{className:"h-4 w-1 shrink-0 rounded-full bg-gradient-to-b from-violet-500 to-fuchsia-500 shadow-[0_0_8px_rgba(139,92,246,0.8)]"}),(0,a.jsxs)("div",{className:"flex flex-col min-w-0",children:[(0,a.jsx)("h1",{className:"truncate text-sm sm:text-base font-black uppercase tracking-tight text-white",children:e}),t&&(0,a.jsx)("p",{className:"hidden truncate text-[11px] font-semibold text-neutral-400 lg:block",children:t})]})]}),c=s?(0,a.jsx)("div",{className:"adm-fade pr-2",children:s}):null;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"mb-6 px-1 sm:hidden",children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,a.jsx)("div",{className:"h-1 w-6 rounded-full bg-gradient-to-r from-violet-600 to-fuchsia-500 shadow-[0_0_8px_rgba(139,92,246,0.8)]"}),(0,a.jsx)("span",{className:"text-[9px] font-black uppercase tracking-[0.25em] text-violet-400",children:"Verwaltung"})]}),(0,a.jsx)("h1",{className:"text-2xl font-black uppercase tracking-tight text-white",children:e}),t&&(0,a.jsx)("p",{className:"mt-1 text-xs text-neutral-400 font-medium",children:t})]}),o&&document.getElementById("admin-page-title-portal")&&(0,r.createPortal)(d,document.getElementById("admin-page-title-portal")),o&&s&&document.getElementById("admin-
13page-action-portal")&&(0,r.createPortal)(c,document.getElementById("admin-page-action-portal"))]})}},64848:(e,t,s)=>{"use strict";s.d(t,{Q:()=>r});var a=s(5785);function r(e,t,s="Jetzt l\xf6schen"){return new Promise(r=>{let l=a.oR.warning(e,{description:t,action:{label:s,onClick:()=>{a.oR.dismiss(l),r(!0)}},cancel:{label:"Abbrechen",onClick:()=>{a.oR.dismiss(l),r(!1)}},duration:1/0,onDismiss:()=>r(!1),style:{background:"rgba(23, 23, 23, 0.95)",border:"1px solid rgba(139, 92, 246, 0.2)",backdropFilter:"blur(16px)",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 30px rgba(139, 92, 246, 0.08)"},className:"min-w-[400px]"})})}},84258:(e,t,s)=>{Promise.resolve().then(s.bind(s,47398))}},e=>{e.O(0,[2922,8409,6609,7199,5308,8441,8928,7358],()=>e(e.s=84258)),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.