1import{ah as Oe,U as e,Z as x,a3 as F,a2 as z,aV as Ee,a4 as Ae,bn as Ie,aq as ne,ar as ie,as as Ce,at as oe,au as ce,bs as Me,a1 as A,aU as le,am as Ue,an as Be,ao as Ge,ap as He,b4 as We,b5 as Ve,b6 as Ne,b7 as ye,b8 as qe,b9 as je,bt as Ye,aL as Je,ax as L,az as Xe,ag as W,aA as Ze,aB as Qe,aC as Ke}from"./index-CEuwz0Wd.js";import{C as V,a as q,b as Y,c as J}from"./card-Bc2R86-J.js";import{S as me}from"./slider-BtB75PLY.js";import{U as ea}from"./upload-CZCioDYH.js";import{E as be}from"./jspdf.es.min-liOjn0rt.js";import ve from"./html2canvas.esm-CBrSDip1.js";import{C as aa}from"./circle-alert-CnfJD0u-.js";import{D as sa}from"./download-BvfRgxoZ.js";import{P as ta}from"./printer-B2KHAkVA.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const la=Oe("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),ra=({courseName:h,tournamentName:u,groupName:N,player1Name:j,player2Name:p,startingTime:b,startingTee:v,topLeftLogo:y,topRightLogo:a,topLeftLogoSize:r,topRightLogoSize:s,watermarkLogo:i,watermarkSize:g,fonts:n,fontSizes:l,fontColors:o,hiddenElements:d,getFontFamily:m})=>e.jsxs(e.Fragment,{children:[i&&e.jsx("div",{className:"watermark-logo",style:{maxWidth:`${g}px`,maxHeight:`${g}px`},children:e.jsx("img",{src:i,alt:"Watermark",className:"max-w-full max-h-full object-contain"})}),e.jsxs("div",{className:"relative mb-4 h-16",children:[y&&e.jsx("div",{className:"absolute top-0 left-0 flex items-center justify-center",style:{width:`${r}px`,height:`${r}px`},children:e.jsx("img",{src:y,alt:"Course Logo",className:"max-w-full max-h-full object-contain"})}),a&&e.jsx("div",{className:"absolute top-0 right-0 flex items-center justify-center",style:{width:`${s}px`,height:`${s}px`},children:e.jsx("img",{src:a,alt:"Tournament Logo",className:"max-w-full max-h-full object-contain"})}),e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center px-4",children:[!d.courseName&&e.jsx("h2",{className:"font-bold leading-tight text-center",style:{fontSize:`${l.courseName}px`,fontFamily:m(n.courseName),color:`hsl(${o.courseName})`},children:h}),!d.tournamentName&&e.jsx("h3",{className:"font-semibold text-center",style:{fontSize:`${l.tournamentName}px`,fontFamily:m(n.tournamentName),color:`hsl(${o.tournamentName})`},children:u}),!d.groupName&&e.jsx("p",{className:"text-center",style:{fontSize:`${l.groupName}px`,fontFamily:m(n.groupName),color:`hsl(${o.groupName})`},children:N})]})]}),!d.playerNames&&e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center z-10 relative -mt-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"font-bold mb-2",style:{fontSize:`${l.playerNames}px`,fontFamily:m(n.playerNames),color:`hsl(${o.playerNames})`},children:j}),p&&e.jsx("h1",{className:"font-bold",style:{fontSize:`${l.playerNames}px`,fontFamily:m(n.playerNames),color:`hsl(${o.playerNames})`},children:p})]})}),e.jsxs("div",{className:"flex justify-between items-end",children:[e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-sm font-semibold",style:{color:"hsl(0 0% 50%)"},children:"Starting Time"}),e.jsx("p",{className:"text-3xl font-bold text-foreground",children:b})]}),e.jsx("div",{className:"flex items-center justify-center",children:e.jsx("img",{src:"/lovable-uploads/91e89d91-7967-491f-a3a5-064a6de76701.png",alt:"TournEvents Logo",className:"h-10 object-contain"})}),e.jsxs("div",{className:"text-right flex items-center gap-3",children:[e.jsx("p",{className:"text-sm font-semibold",style:{color:"hsl(0 0% 50%)"},children:"Starting Tee:"}),e.jsx("span",{className:"text-4xl font-bold text-foreground",children:v})]})]})]}),na=({courseName:h,tournamentName:u,groupName:N,player1Name:j,player2Name:p,startingTime:b,startingTee:v,topLeftLogo:y,topRightLogo:a,topLeftLogoSize:r,topRightLogoSize:s,watermarkLogo:i,watermarkSize:g,fonts:n,fontSizes:l,fontColors:o,hiddenElements:d,getFontFamily:m})=>e.jsxs(e.Fragment,{children:[i&&e.jsx("div",{className:"watermark-logo",style:{maxWidth:`${g}px`,maxHeight:`${g}px`},children:e.jsx("img",{src:i,alt:"Watermark",className:"max-w-full max-h-full object-contain"})}),y&&e.jsx("div",{className:"absolute top-4 left-4 z-20",style:{width:`${r}px`,height:`${r}px`},children:e.jsx("img",{src:y,alt:"Course Logo",className:"max-w-full max-h-full object-contain"})}),a&&e.jsx("div",{className:"absolute top-4 right-4 z-20",style:{width:`${s}px`,height:`${s}px`},children:e.jsx("img",{src:a,alt:"Tournament Logo",className:"max-w-full max-h-full object-contain"})}),e.jsx("div",{className:"bg-muted/30 border-b border-border p-3 mb-4",style:{height:"80px"},children:e.jsx("div",{className:"flex justify-center items-center h-full",children:e.jsxs("div",{className:"text-center",children:[!d.courseName&&e.jsx("h2",{className:"font-bold",style:{fontSize:`${l.courseName}px`,fontFamily:m(n.courseName),color:`hsl(${o.courseName})`},children:h}),!d.tournamentName&&e.jsx("p",{className:"text-sm",style:{fontSize:`${l.tournamentName*.8}px`,fontFamily:m(n.tournamentName),color:`hsl(${o.tournamentName})`},children:u})]})})}),e.jsxs("div",{className:"flex-1 flex flex-col justify-center z-10 relative",children:[!d.groupName&&e.jsx("div",{className:"text-center mb-6",children:e.jsx("p",{className:"font-medium",style:{fontSize:`${l.groupName}px`,fontFamily:m(n.groupName),color:`hsl(${o.groupName})`},children:N})}),!d.playerNames&&e.jsxs("div",{className:"space-y-3 mb-6",children:[e.jsx("div",{className:"bg-white border border-border rounded p-3 text-center",children:e.jsx("h1",{className:"font-bold",style:{fontSize:`${l.playerNames}px`,fontFamily:m(n.playerNames),color:`hsl(${o.playerNames})`},children:j})}),p&&e.jsx("div",{className:"bg-white border border-border rounded p-3 text-center",children:e.jsx("h1",{className:"font-bold",style:{fontSize:`${l.playerNames}px`,fontFamily:m(n.playerNames),color:`hsl(${o.playerNames})`},children:p})})]})]}),e.jsxs("div",{className:"bg-muted/30 border-t border-border p-3 flex justify-between items-center",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-xs font-medium",style:{color:"hsl(0 0% 50%)"},children:"Time"}),e.jsx("p",{className:"text-3xl font-bold text-foreground",children:b})]}),e.jsx("div",{className:"flex items-center justify-center",children:e.jsx("img",{src:"/lovable-uploads/91e89d91-7967-491f-a3a5-064a6de76701.png",alt:"TournEvents Logo",className:"h-10 object-contain"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-xs font-medium",style:{color:"hsl(0 0% 50%)"},children:"Tee"}),e.jsx("span",{className:"text-4xl font-bold text-foreground",children:v})]})]})]}),ia=({courseName:h,tournamentName:u,groupName:N,player1Name:j,player2Name:p,startingTime:b,startingTee:v,topLeftLogo:y,topRightLogo:a,topLeftLogoSize:r,topRightLogoSize:s,watermarkLogo:i,watermarkSize:g,fonts:n,fontSizes:l,fontColors:o,hiddenElements:d,getFontFamily:m})=>e.jsxs(e.Fragment,{children:[i&&e.jsx("div",{className:"watermark-logo",style:{maxWidth:`${g}px`,maxHeight:`${g}px`},children:e.jsx("img",{src:i,alt:"Watermark",className:"max-w-full max-h-full object-contain"})}),e.jsxs("div",{className:"flex justify-between items-center mb-3",children:[y&&e.jsx("div",{className:"flex items-center justify-center",style:{width:`${r}px`,height:`${r}px`},children:e.jsx("img",{src:y,alt:"Course Logo",className:"max-w-full max-h-full object-contain"})}),e.jsxs("div",{className:"flex-1 text-center px-2",children:[!d.courseName&&e.jsx("h2",{className:"font-bold leading-tight",style:{fontSize:`${l.courseName*.9}px`,fontFamily:m(n.courseName),color:`hsl(${o.courseName})`},children:h}),!d.tournamentName&&e.jsx("p",{className:"text-xs leading-tight",style:{fontSize:`${l.tournamentName*.8}px`,fontFamily:m(n.tournamentName),color:`hsl(${o.tournamentName})`},children:u})]}),a&&e.jsx("div",{className:"flex items-center justify-center",style:{width:`${s}px`,height:`${s}px`},children:e.jsx("img",{src:a,alt:"Tournament Logo",className:"max-w-full max-h-full object-contain"})})]}),!d.groupName&&e.jsx("div",{className:"text-center mb-4",children:e.jsx("p",{className:"font-medium",style:{fontSize:`${l.groupName}px`,fontFamily:m(n.groupName),color:`hsl(${o.groupName})`},children:N})}),!d.playerNames&&e.jsx("div",{className:"flex-1 flex items-center justify-center z-10 relative",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4 w-full",children:[e.jsx("div",{className:"text-center border-r border-border pr-4",children:e.jsx("h1",{className:"font-bold",style:{fontSize:`${l.playerNames
6*.9}px`,fontFamily:m(n.playerNames),color:`hsl(${o.playerNames})`},children:j})}),e.jsx("div",{className:"text-center pl-4",children:e.jsx("h1",{className:"font-bold",style:{fontSize:`${l.playerNames*.9}px`,fontFamily:m(n.playerNames),color:`hsl(${o.playerNames})`},children:p})})]})}),e.jsxs("div",{className:"grid grid-cols-3 gap-4 items-center border-t border-border pt-3",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-xs font-medium",style:{color:"hsl(0 0% 50%)"},children:"Time"}),e.jsx("p",{className:"text-3xl font-bold text-foreground",children:b})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-xs font-medium",style:{color:"hsl(0 0% 50%)"},children:"Tee"}),e.jsx("span",{className:"text-4xl font-bold text-foreground",children:v})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("img",{src:"/lovable-uploads/91e89d91-7967-491f-a3a5-064a6de76701.png",alt:"TournEvents Logo",className:"h-9 object-contain"})})]})]}),oa=({courseName:h,tournamentName:u,groupName:N,player1Name:j,player2Name:p,startingTime:b,startingTee:v,topLeftLogo:y,topRightLogo:a,topLeftLogoSize:r,topRightLogoSize:s,watermarkLogo:i,watermarkSize:g,fonts:n,fontSizes:l,fontColors:o,hiddenElements:d,getFontFamily:m})=>e.jsxs(e.Fragment,{children:[i&&e.jsx("div",{className:"watermark-logo",style:{maxWidth:`${g}px`,maxHeight:`${g}px`},children:e.jsx("img",{src:i,alt:"Watermark",className:"max-w-full max-h-full object-contain"})}),y&&e.jsx("div",{className:"absolute top-4 left-4 z-20",style:{width:`${r}px`,height:`${r}px`},children:e.jsx("img",{src:y,alt:"Course Logo",className:"max-w-full max-h-full object-contain"})}),a&&e.jsx("div",{className:"absolute top-4 right-4 z-20",style:{width:`${s}px`,height:`${s}px`},children:e.jsx("img",{src:a,alt:"Tournament Logo",className:"max-w-full max-h-full object-contain"})}),e.jsx("div",{className:"border-b-2 border-border pb-2 mb-3",style:{minHeight:"60px"},children:e.jsx("div",{className:"flex justify-center items-center h-full pt-1",children:e.jsxs("div",{className:"text-center",children:[!d.courseName&&e.jsx("h2",{className:"font-bold tracking-wide",style:{fontSize:`${l.courseName}px`,fontFamily:m(n.courseName),color:`hsl(${o.courseName})`},children:h.toUpperCase()}),!d.tournamentName&&e.jsx("h3",{className:"font-semibold tracking-wide",style:{fontSize:`${l.tournamentName}px`,fontFamily:m(n.tournamentName),color:`hsl(${o.tournamentName})`},children:u.toUpperCase()}),!d.groupName&&e.jsx("div",{className:"border-t border-border mt-2 pt-2",children:e.jsx("p",{className:"font-medium tracking-wider",style:{fontSize:`${l.groupName}px`,fontFamily:m(n.groupName),color:`hsl(${o.groupName})`},children:N.toUpperCase()})})]})})}),!d.playerNames&&e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center z-10 relative",children:e.jsxs("div",{className:"text-center border-2 border-border bg-white/95 p-6 w-full",children:[e.jsx("p",{className:"text-sm font-medium mb-3 tracking-widest",style:{color:"hsl(0 0% 50%)"},children:"PLAYERS"}),e.jsx("h1",{className:"font-bold mb-3 tracking-wide",style:{fontSize:`${l.playerNames}px`,fontFamily:m(n.playerNames),color:`hsl(${o.playerNames})`},children:j.toUpperCase()}),p&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t border-border my-3"}),e.jsx("h1",{className:"font-bold tracking-wide",style:{fontSize:`${l.playerNames}px`,fontFamily:m(n.playerNames),color:`hsl(${o.playerNames})`},children:p.toUpperCase()})]})]})}),e.jsx("div",{className:"border-t-2 border-border pt-3 mt-4",children:e.jsxs("div",{className:"grid grid-cols-3 gap-4 text-center",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium tracking-widest mb-1",style:{color:"hsl(0 0% 50%)"},children:"STARTING TIME"}),e.jsx("p",{className:"text-3xl font-bold text-foreground",children:b})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium tracking-widest mb-3",style:{color:"hsl(0 0% 50%)"},children:"STARTING TEE"}),e.jsx("span",{className:"text-4xl font-bold text-foreground",children:v})]}),e.jsx("div",{className:"flex justify-end items-center",children:e.jsx("img",{src:"/lovable-uploads/91e89d91-7967-491f-a3a5-064a6de76701.png",alt:"TournEvents Logo",className:"h-9 object-contain"})})]})})]}),de=h=>({arial:"Arial, sans-serif",helvetica:"Helvetica, Arial, sans-serif",times:"Times New Roman, serif",georgia:"Georgia, serif",verdana:"Verdana, sans-serif",calibri:"Calibri, sans-serif","open-sans":"Open Sans, sans-serif",roboto:"Roboto, sans-serif",lato:"Lato, sans-serif",montserrat:"Montserrat, sans-serif"})[h]||"Arial, sans-serif",we=({courseName:h,tournamentName:u,groupName:N,player1Name:j,player2Name:p,startingTime:b,startingTee:v,topLeftLogo:y,topRightLogo:a,topLeftLogoSize:r=64,topRightLogoSize:s=64,watermarkLogo:i,watermarkSize:g=200,fonts:n={courseName:"arial",tournamentName:"arial",groupName:"arial",playerNames:"arial"},fontSizes:l={courseName:20,tournamentName:18,groupName:16,playerNames:40},fontColors:o={courseName:"0 0% 0%",tournamentName:"0 0% 25%",groupName:"0 0% 25%",playerNames:"0 0% 0%"},hiddenElements:d={courseName:!1,tournamentName:!1,groupName:!1,playerNames:!1},layout:m="traditional"})=>{const P={courseName:h,tournamentName:u,groupName:N,player1Name:j,player2Name:p,startingTime:b,startingTee:v,topLeftLogo:y,topRightLogo:a,topLeftLogoSize:r,topRightLogoSize:s,watermarkLogo:i,watermarkSize:g,fonts:n,fontSizes:l,fontColors:o,hiddenElements:d,getFontFamily:de}
6,X=()=>{switch(m){case"modern":return e.jsx(na,{...P});case"compact":return e.jsx(ia,{...P});case"classic":return e.jsx(oa,{...P});default:return e.jsx(ra,{...P})}};return e.jsx("div",{className:"cart-sign force-light bg-white p-4 relative flex flex-col border-2 border-border",style:{height:"5in"},children:X()})},re=({label:h,onLogoChange:u,currentLogo:N,logoSize:j=64,onLogoSizeChange:p,showSizeSlider:b=!1})=>{const v=x.useRef(null),[y,a]=x.useState(!1),r=s=>{if(s&&s.type.startsWith("image/")){const i=new FileReader;i.onload=g=>{var n;return u((n=g.target)==null?void 0:n.result)},i.readAsDataURL(s)}};return e.jsxs("div",{className:"space-y-2",children:[e.jsx(F,{className:"text-sm font-medium",children:h}),N?e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-20 h-20 border-2 border-border rounded-lg overflow-hidden bg-background",children:e.jsx("img",{src:N,alt:h,className:"w-full h-full object-contain"})}),e.jsx(z,{variant:"destructive",size:"sm",className:"absolute -top-2 -right-2 h-6 w-6 p-0",onClick:()=>{u(null),v.current&&(v.current.value="")},children:e.jsx(Ee,{className:"h-3 w-3"})})]}):e.jsxs("div",{className:`w-20 h-20 border-2 border-dashed rounded-lg flex flex-col items-center justify-center cursor-pointer transition-colors ${y?"border-primary bg-primary/10":"border-border hover:border-primary"}`,onDrop:s=>{var g;s.preventDefault(),a(!1);const i=(g=s.dataTransfer.files)==null?void 0:g[0];i&&r(i)},onDragOver:s=>{s.preventDefault(),a(!0)},onDragLeave:()=>a(!1),onClick:()=>{var s;return(s=v.current)==null?void 0:s.click()},children:[e.jsx(ea,{className:"h-4 w-4 text-muted-foreground mb-1"}),e.jsx("span",{className:"text-xs text-muted-foreground text-center",children:"Upload"})]}),b&&N&&p&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs(F,{className:"text-xs",children:["Size: ",j,"px"]}),e.jsx(me,{value:[j],onValueChange:s=>p(s[0]),min:32,max:128,step:4,className:"w-full"})]}),e.jsx(Ae,{ref:v,type:"file",accept:"image/*",onChange:s=>{var g;const i=(g=s.target.files)==null?void 0:g[0];i&&r(i)},className:"hidden"})]})},ca=[{value:"arial",label:"Arial"},{value:"helvetica",label:"Helvetica"},{value:"times",label:"Times New Roman"},{value:"georgia",label:"Georgia"},{value:"verdana",label:"Verdana"},{value:"calibri",label:"Calibri"},{value:"open-sans",label:"Open Sans"},{value:"roboto",label:"Roboto"},{value:"lato",label:"Lato"},{value:"montserrat",label:"Montserrat"}],ke=[{value:"0 0% 0%",label:"Black",preview:"#000000"},{value:"0 0% 25%",label:"Dark Gray",preview:"#404040"},{value:"0 0% 50%",label:"Gray",preview:"#808080"},{value:"220 14% 32%",label:"Navy",preview:"#384B5C"},{value:"221 83% 53%",label:"Blue",preview:"#3B82F6"},{value:"142 76% 36%",label:"Green",preview:"#16A34A"},{value:"0 84% 60%",label:"Red",preview:"#EF4444"},{value:"25 95% 53%",label:"Orange",preview:"#F97316"},{value:"271 81% 56%",label:"Purple",preview:"#A855F7"},{value:"345 83% 47%",label:"Maroon",preview:"#BE185D"},{value:"47 96% 53%",label:"Yellow",preview:"#EAB308"},{value:"0 0% 100%",label:"White",preview:"#FFFFFF"}],da=[{key:"courseName",label:"Course Name",minSize:12,maxSize:32},{key:"tournamentName",label:"Tournament Name",minSize:10,maxSize:28},{key:"groupName",label:"Group Name",minSize:8,maxSize:24},{key:"playerNames",label:"Player Names",minSize:16,maxSize:48}],ma=({fonts:h,fontSizes:u,fontColors:N,hiddenElements:j,onFontChange:p,onFontSizeChange:b,onFontColorChange:v,onToggleHidden:y})=>e.jsx("div",{className:"space-y-6",children:da.map(a=>{var r;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(F,{className:"text-sm font-medium",children:a.label}),e.jsx(z,{variant:"ghost",size:"sm",onClick:()=>y(a.key),className:"h-8 w-8 p-0",children:j[a.key]?e.jsx(la,{className:"h-4 w-4"}):e.jsx(Ie,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(F,{className:"text-xs text-muted-foreground",children:"Font"}),e.jsxs(ne,{value:h[a.key],onValueChange:s=>p(a.key,s),children:[e.jsx(ie,{style:{fontFamily:de(h[a.key])},children:e.jsx(Ce,{})}),e.jsx(oe,{children:ca.map(s=>e.jsx(ce,{value:s.value,style:{fontFamily:de(s.value)},children:s.label},s.value))})]})]}),e.jsxs("div",{children:[e.jsx(F,{className:"text-xs text-muted-foreground",children:"Color"}),e.jsxs(ne,{value:N[a.key],onValueChange:s=>v(a.key,s),children:[e.jsx(ie,{children:e.jsx("div",{className:"w-6 h-6 rounded border border-border mx-auto",style:{backgroundColor:(r=ke.find(s=>
6s.value===N[a.key]))==null?void 0:r.preview}})}),e.jsx(oe,{children:ke.map(s=>e.jsx(ce,{value:s.value,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded border border-border",style:{backgroundColor:s.preview}}),e.jsx("span",{children:s.label})]})},s.value))})]})]})]}),e.jsxs("div",{children:[e.jsxs(F,{className:"text-xs text-muted-foreground",children:["Size: ",u[a.key],"px"]}),e.jsx(me,{value:[u[a.key]],onValueChange:s=>b(a.key,s[0]),min:a.minSize,max:a.maxSize,step:1,className:"w-full"})]})]},a.key)})}),Te=[{section:"Page Layout",items:[{key:"cs:layout:header",label:"Cart Signs Header (title + description)"},{key:"cs:layout:action_bar",label:"Action Bar (page nav / save / export)"},{key:"cs:layout:settings_panel",label:"Settings Panel"},{key:"cs:layout:preview_area",label:"Preview Area"},{key:"cs:layout:page_pagination",label:"Page Pagination Controls"}]},{section:"Layout & Sizing",items:[{key:"cs:layout:option_select",label:"Layout Option Selector (signs per page)"},{key:"cs:layout:orientation",label:"Page Orientation"},{key:"cs:layout:sign_size",label:"Sign Size"},{key:"cs:layout:cut_lines",label:"Cut Line Overlay"}]},{section:"Logo Settings",items:[{key:"cs:logo:upload",label:"Logo Upload"},{key:"cs:logo:drag_drop",label:"Logo Drag & Drop"},{key:"cs:logo:remove",label:"Logo Remove"},{key:"cs:logo:scale",label:"Logo Scale Selector"},{key:"cs:logo:position",label:"Logo Position"}]},{section:"Design Settings",items:[{key:"cs:design:colors",label:"Color Palette Settings"},{key:"cs:design:fonts",label:"Font Settings"},{key:"cs:design:tournament_name",label:"Tournament Name Display"},{key:"cs:design:date_display",label:"Date Display"},{key:"cs:design:course_name_display",label:"Course Name Display"},{key:"cs:design:background",label:"Background / Watermark"}]},{section:"Pairings & Players",items:[{key:"cs:pairings:player_names",label:"Player Names Per Sign"},{key:"cs:pairings:group_number",label:"Group Number Display"},{key:"cs:pairings:tee_assignment",label:"Tee Assignment Display"},{key:"cs:pairings:start_time",label:"Start Time Display"}]},{section:"Output Actions",items:[{key:"cs:output:save_design",label:"Save Design (persistence)"},{key:"cs:output:print",label:"Print Cart Signs"},{key:"cs:output:download_pdf",label:"Download PDF"},{key:"cs:output:export_progress",label:"Export Progress Indicator"}]},{section:"Behavior & Logic",items:[{key:"cs:logic:design_persistence",label:"Design State Persistence"},{key:"cs:logic:image_to_dataurl",label:"Uploaded Image â DataURL Conversion"},{key:"cs:logic:html2canvas_render",label:"html2canvas Page Rendering"},{key:"cs:logic:pdf_generation",label:"PDF Generation Pipeline"},{key:"cs:logic:print_preview",label:"Print Preview Generation"},{key:"cs:logic:toast_feedback",label:"Toast Feedback (success/error)"}]},{section:"Data Sources",items:[{key:"cs:data:tournament_select",label:"tournaments Table Read"},{key:"cs:data:groups_select",label:"tournament_groups Table Read"},{key:"cs:data:cartsign_design_select",label:"Cart Sign Design Read"},{key:"cs:data:cartsign_design_save",label:"Cart Sign Design Save"}]}],Se=Te.flatMap(h=>h.items.map(u=>u.key)),xa=()=>{const h=Me(),[u,N]=x.useState(!1),[j,p]=x.useState({}),b=x.useCallback(async()=>{const{data:a}=await A.from("locked_items").select("item_key,is_locked").like("item_key","cs:%"),r={};(a||[]).forEach(s=>{r[s.item_key]=!!s.is_locked}),p(r)},[]);x.useEffect(()=>{b()},[b]),x.useEffect(()=>{u&&b()},[u,b]);const v=async(a,r)=>{p(i=>({...i,[a]:r}));const{error:s}=await A.from("locked_items").upsert({item_key:a,is_locked:r},{onConflict:"item_key"});s?(L.error("Failed to update locked status"),p(i=>({...i,[a]:!r}))):L.success(r?"Locked":"Unlocked")};if(!h)return null;const y=Se.length>0&&Se.every(a=>j[a]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed right-0 top-1/2 -translate-y-1/2 z-50",children:e.jsx(z,{variant:"ghost",size:"sm",title:"Locked Items",onClick:()=>N(!0),className:`h-10 w-10 p-0 ${y?"bg-green-600 text-white hover:bg-green-700":"bg-destructive text-destructive-foreground hover:bg-[#000000] hover:text-white"} rounded-l-lg rounded-r-none shadow-lg`,children:e.jsx(le,{className:"h-5 w-5"})})}),e.jsx(Ue,{open:u,onOpenChange:N,children:e.jsxs(Be,{className:"max-w-2xl max-h-[85vh] overflow-hidden flex flex-col",children:[e.jsx(Ge,{children:e.jsxs(He,{className:"font-heading flex items-center gap-2",children:[e.jsx(le,{className:"h-4 w-4"})," Locked Items â Cart Signs"]})}),e.jsx("div",{className:"overflow-y-auto -mx-6 px-6",children:e.jsx("div",{className:"space-y-6",children:Te.map(a=>e.jsxs("div",{children:[e.jsx("h4",{className:"font-heading text-sm font-semibold mb-2",children:a.section}),e.jsxs(We,{children:[e.jsx(Ve,{children:e.jsxs(Ne,{children:[e.jsx(ye,{className:"font-body",children:"Feature"}),e.jsx(ye,{className:"font-body w-24 text-center",children:"Locked"})]})}),e.jsx(qe,{children:a.items.map(r=>e.jsxs(Ne,{children:[e.jsx(je,{className:"font-body",children:e.jsxs("span",{className:"inline-flex items-center gap-2",children:[r.label,j[r.key]&&e.jsx(le,{className:"h-3.5 w-3.5 text-green-600",strokeWidth:2.5})]})}),e.jsx(je,{className:"text-center",children:e.jsx(Ye,{checked:!!j[r.ke
6y],onCheckedChange:s=>v(r.key,!!s)})})]},r.key))})]})]},a.section))})}),e.jsx(Je,{children:e.jsx(z,{variant:"outline",onClick:()=>N(!1),children:"Close"})})]})})]})},ua=[{value:"traditional",label:"Traditional",description:"Classic tournament style"},{value:"modern",label:"Modern",description:"Clean and minimalist"},{value:"compact",label:"Compact",description:"Side-by-side players"},{value:"classic",label:"Classic",description:"Formal presentation"}],wa=()=>{const{courseId:h,tournamentId:u}=Xe(),[N,j]=x.useState(""),[p,b]=x.useState(""),[v,y]=x.useState(""),[a,r]=x.useState([]),[s,i]=x.useState(!0),[g,n]=x.useState("traditional"),[l,o]=x.useState({topLeft:null,topRight:null,watermark:null}),[d,m]=x.useState({topLeft:64,topRight:64}),[P,X]=x.useState(200),[Z,$e]=x.useState({courseName:"arial",tournamentName:"arial",groupName:"arial",playerNames:"arial"}),[Q,Le]=x.useState({courseName:20,tournamentName:18,groupName:16,playerNames:40}),[K,_e]=x.useState({courseName:"0 0% 0%",tournamentName:"0 0% 25%",groupName:"0 0% 25%",playerNames:"0 0% 0%"}),[ee,Pe]=x.useState({courseName:!1,tournamentName:!1,groupName:!1,playerNames:!1}),[I,M]=x.useState(0),[R,U]=x.useState(!1),[xe,B]=x.useState(0),[G,De]=x.useState("layout"),ae=x.useRef(null);x.useEffect(()=>{(async()=>{var c;if(!(!u||!h)){i(!0);try{const[f,_,w]=await Promise.all([A.from("tournaments").select("name, start_time, course_id").eq("id",u).maybeSingle(),A.from("courses").select("name").eq("id",h).maybeSingle(),A.from("tournament_groups").select("group_name, players_data, sort_order, starting_tee, start_time").eq("tournament_id",u).order("sort_order",{ascending:!0})]),T=((c=f.data)==null?void 0:c.start_time)||"";if(f.data&&(b(f.data.name||""),y(T)),_.data&&j(_.data.name||""),w.data){const D=[];for(let k=0;k<w.data.length;k++){const C=w.data[k],O=(C.players_data||[]).filter(Boolean).map($=>{if(!$)return"TBD";const ge=$.first_name||$.firstName||"",fe=$.last_name||$.lastName||"";return ge||fe?`${ge} ${fe}`.trim():$.name||"TBD"}),te=Math.floor(k/2)+1,Fe=k%2===0?"A":"B",pe=C.starting_tee||`${te}${Fe}`,he=C.start_time||T;if(O.length===0)D.push({groupName:C.group_name||`Group ${C.sort_order+1}`,player1Name:"TBD",player2Name:"",startingTee:pe,startTime:he});else for(let $=0;$<O.length;$+=2)D.push({groupName:C.group_name||`Group ${C.sort_order+1}`,player1Name:O[$],player2Name:O[$+1]||"",startingTee:pe,startTime:he})}r(D)}}catch(f){console.error("Error fetching cart sign data:",f),L.error("Failed to load tournament data")}finally{i(!1)}}})()},[u,h]);const se=t=>{if(!t)return"TBD";if(/am|pm/i.test(t))return t;try{const[c,f]=t.split(":"),_=parseInt(c,10),w=_>=12?"PM":"AM";return`${_%12||12}:${f} ${w}`}catch{return t}},E=Math.ceil(a.length/2),ue=I*2,S=a.slice(ue,ue+2),ze=x.useCallback(async()=>{if(a.length===0){L.error("No cart signs to export");return}U(!0),B(0),L.info("Generating PDF... this may take a moment.");try{const t=new be({orientation:"portrait",unit:"in",format:[8.5,11],compress:!0}),c=Math.ceil(a.length/2),f=document.createElement("div");f.style.position="fixed",f.style.top="-9999px",f.style.left="-9999px",f.style.width="8.5in",f.style.zIndex="-1",document.body.appendChild(f);for(let w=0;w<c;w++){const T=w*2,D=a.slice(T,T+2),k=document.createElement("div");k.style.width="8.5in",k.style.minHeight="11in",k.style.padding="0.25in",k.style.backgroundColor="#ffffff",k.style.display="flex",k.style.flexDirection="column",k.style.justifyContent="space-between",k.id=`cart-sign-page-${w}`,f.innerHTML="",f.appendChild(k),M(w),await new Promise(te=>setTimeout(te,600));const C=ae.current;if(!C)continue;C.style.border="none";const H=await ve(C,{scale:2,useCORS:!0,allowTaint:!1,backgroundColor:"#ffffff",foreignObjectRendering:!1});C.style.border="",B(Math.round((w+1)/c*100));const O=H.toDataURL("image/jpeg",.92);w>0&&t.addPage(),t.addImage(O,"JPEG",0,0,8.5,11)}document.body.removeChild(f);const _=new Date().toISOString().split("T")[0];t.save(`cart-signs-${p.replace(/\s+/g,"-").toLowerCase()}-${_}.pdf`),L.success("PDF downloaded successfully!")}catch(t){console.error("Error generating PDF:",t),L.error("Failed to generate PDF. Please try again.")}finally{U(!1)}},[a,p]),Re=x.useCallback(async()=>
6{if(a.length===0){L.error("No cart signs to print");return}U(!0),B(0),L.info("Preparing print...");try{const t=new be({orientation:"portrait",unit:"in",format:[8.5,11],compress:!0}),c=Math.ceil(a.length/2);for(let T=0;T<c;T++){M(T),await new Promise(H=>setTimeout(H,600));const D=ae.current;if(!D)continue;D.style.border="none";const k=await ve(D,{scale:2,useCORS:!0,allowTaint:!1,backgroundColor:"#ffffff",foreignObjectRendering:!1});D.style.border="",B(Math.round((T+1)/c*100));const C=k.toDataURL("image/jpeg",.92);T>0&&t.addPage(),t.addImage(C,"JPEG",0,0,8.5,11)}const f=t.output("blob"),_=URL.createObjectURL(f),w=window.open(_);w&&(w.onload=()=>{w.print(),setTimeout(()=>URL.revokeObjectURL(_),1e3)}),L.success("Print window opened!")}catch(t){console.error("Error printing:",t),L.error("Failed to prepare print.")}finally{U(!1)}},[a]);return s?e.jsxs("div",{className:"flex items-center justify-center py-20",children:[e.jsx(W,{size:"lg"}),e.jsx("span",{className:"ml-3 text-muted-foreground font-body",children:"Loading cart sign data..."})]}):a.length===0?e.jsx("div",{className:"bg-card border border-border rounded-xl p-8",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[e.jsx(aa,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-semibold font-heading mb-2",children:"No Groups Found"}),e.jsx("p",{className:"text-muted-foreground font-body max-w-md",children:"Cart signs are generated from tournament groups and players. Please add groups with players in the Player Management section first."})]})}):e.jsxs("div",{className:"space-y-6",children:[e.jsx(xa,{}),e.jsxs("div",{className:"flex items-center justify-between max-w-[1100px] mx-auto",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{variant:"outline",size:"sm",disabled:I===0||R,onClick:()=>M(t=>t-1),children:e.jsx(Ze,{className:"h-4 w-4"})}),e.jsxs("span",{className:"text-sm font-body text-muted-foreground",children:["Page ",I+1," of ",E]}),e.jsx(z,{variant:"outline",size:"sm",disabled:I>=E-1||R,onClick:()=>M(t=>t+1),children:e.jsx(Qe,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"text-sm font-body text-muted-foreground",children:[a.length," cart sign",a.length!==1?"s":""," across ",E," page",E!==1?"s":""]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(z,{variant:"outline",size:"sm",onClick:ze,disabled:R,className:"font-body",children:[R?e.jsx(W,{size:"sm",className:"mr-1"}):e.jsx(sa,{className:"h-4 w-4 mr-1"}),"Download PDF"]}),e.jsxs(z,{size:"sm",onClick:Re,disabled:R,className:"font-body",children:[R?e.jsx(W,{size:"sm",className:"mr-1"}):e.jsx(ta,{className:"h-4 w-4 mr-1"}),"Print Signs"]})]})]}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 justify-center",children:[e.jsxs("div",{className:"space-y-4 order-2 lg:order-1 w-[260px] shrink-0",children:[e.jsx("div",{className:"flex flex-wrap gap-2",children:[{id:"layout",label:"Layout"},{id:"logos",label:"Logos"},{id:"fonts",label:"Fonts"}].map(t=>e.jsx("button",{onClick:()=>De(t.id),className:`px-3 py-1.5 text-sm font-body rounded-md transition-colors ${G===t.id?"bg-primary text-primary-foreground":"bg-muted text-foreground hover:bg-muted/80"}`,children:t.label},t.id))}),G==="layout"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(V,{children:[e.jsx(q,{className:"pb-3",children:e.jsx(Y,{className:"text-sm",children:"Layout Style"})}),e.jsx(J,{children:e.jsxs(ne,{value:g,onValueChange:n,children:[e.jsx(ie,{children:e.jsx(Ce,{})}),e.jsx(oe,{children:ua.map(t=>e.jsx(ce,{value:t.value,children:e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:t.label}),e.jsx("div",{className:"text-xs text-muted-foreground",children:t.description})]})},t.value))})]})})]}),e.jsxs(V,{children:[e.jsx(q,{className:"pb-3",children:e.jsx(Y,{className:"text-sm",children:"Summary"})}),e.jsxs(J,{className:"text-xs space-y-1 text-muted-foreground font-body",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-foreground",children:"Course:"})," ",N]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-foreground",children:"Tourn
6ament:"})," ",p]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-foreground",children:"Start Time:"})," ",se(v)]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-foreground",children:"Total Signs:"})," ",a.length]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-foreground",children:"Pages:"})," ",E]})]})]})]}),G==="logos"&&e.jsx("div",{className:"space-y-4",children:e.jsxs(V,{children:[e.jsx(q,{className:"pb-3",children:e.jsxs(Y,{className:"text-sm flex items-center gap-2",children:[e.jsx(Ke,{className:"h-4 w-4"}),"Logo Settings"]})}),e.jsxs(J,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(re,{label:"Top Left",onLogoChange:t=>o(c=>({...c,topLeft:t})),currentLogo:l.topLeft||void 0,logoSize:d.topLeft,onLogoSizeChange:t=>m(c=>({...c,topLeft:t})),showSizeSlider:!0}),e.jsx(re,{label:"Top Right",onLogoChange:t=>o(c=>({...c,topRight:t})),currentLogo:l.topRight||void 0,logoSize:d.topRight,onLogoSizeChange:t=>m(c=>({...c,topRight:t})),showSizeSlider:!0})]}),e.jsxs("div",{children:[e.jsx(re,{label:"Watermark",onLogoChange:t=>o(c=>({...c,watermark:t})),currentLogo:l.watermark||void 0}),l.watermark&&e.jsxs("div",{className:"mt-2 space-y-1",children:[e.jsxs(F,{className:"text-xs",children:["Size: ",P,"px"]}),e.jsx(me,{value:[P],onValueChange:t=>X(t[0]),min:50,max:400,step:10,className:"w-full"})]})]})]})]})}),G==="fonts"&&e.jsx("div",{className:"space-y-4",children:e.jsxs(V,{children:[e.jsx(q,{className:"pb-3",children:e.jsx(Y,{className:"text-sm",children:"Font Settings"})}),e.jsx(J,{children:e.jsx(ma,{fonts:Z,fontSizes:Q,fontColors:K,hiddenElements:ee,onFontChange:(t,c)=>$e(f=>({...f,[t]:c})),onFontSizeChange:(t,c)=>Le(f=>({...f,[t]:c})),onFontColorChange:(t,c)=>_e(f=>({...f,[t]:c})),onToggleHidden:t=>Pe(c=>({...c,[t]:!c[t]}))})})]})})]}),e.jsxs("div",{className:"order-1 lg:order-2 min-w-0 relative",style:{maxWidth:"8.5in"},children:[R&&e.jsx("div",{className:"absolute inset-0 bg-background/90 flex items-start justify-center z-50 rounded-lg pt-[20%]",children:e.jsxs("div",{className:"text-center w-48",children:[e.jsx(W,{size:"lg",className:"mb-2"}),e.jsxs("p",{className:"text-sm font-body mb-3",children:["Generating PDF... ",xe,"%"]}),e.jsx("div",{className:"w-full h-2 bg-muted rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary rounded-full transition-all duration-300",style:{width:`${xe}%`}})})]})}),e.jsx("div",{className:"overflow-auto",children:e.jsx("div",{ref:ae,className:"bg-white mx-auto","data-
6preview-border":"true",style:{width:"8.5in",minHeight:"11in",padding:"0.25in"},children:e.jsxs("div",{className:"h-full flex flex-col justify-between",style:{minHeight:"10.5in"},children:[S[0]&&e.jsx(we,{courseName:N,tournamentName:p,groupName:S[0].groupName,player1Name:S[0].player1Name,player2Name:S[0].player2Name,startingTime:se(S[0].startTime),startingTee:S[0].startingTee,topLeftLogo:l.topLeft||void 0,topRightLogo:l.topRight||void 0,topLeftLogoSize:d.topLeft,topRightLogoSize:d.topRight,watermarkLogo:l.watermark||void 0,watermarkSize:P,fonts:Z,fontSizes:Q,fontColors:K,hiddenElements:ee,layout:g}),S.length===2&&e.jsx("div",{className:"flex items-center justify-center py-4",children:e.jsx("div",{className:"w-full border-t-2 border-dashed",style:{borderColor:"#9ca3af"}})}),S[1]&&e.jsx(we,{courseName:N,tournamentName:p,groupName:S[1].groupName,player1Name:S[1].player1Name,player2Name:S[1].player2Name,startingTime:se(S[1].startTime),startingTee:S[1].startingTee,topLeftLogo:l.topLeft||void 0,topRightLogo:l.topRight||void 0,topLeftLogoSize:d.topLeft,topRightLogoSize:d.topRight,watermarkLogo:l.watermark||void 0,watermarkSize:P,fonts:Z,fontSizes:Q,fontColors:K,hiddenElements:ee,layout:g}),S.length===1&&e.jsx("div",{className:"flex-1"})]})})})]})]})]})};export{wa as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.