1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/qrcode-DlE0z9wJ.js","assets/react-BiZinmjb.js"])))=>i.map(i=>d[i]); 2import{u as C,_ as D,j as e,h as I,d as h}from"./index-Dxxy_gQF.js";import{h as S,b as m,L as y}from"./react-BiZinmjb.js";import{e as w,d as g,q as M,p as B,w as R,n as P}from"./firebase-CPtPfoqG.js";import{L as u}from"./Layout-D7z_LzwI.js";const E={"event-1":{id:"event-1",name:"ãªã¼ããã³ã°ã»ã¬ã¢ãã¼",description:"ã¤ãã³ãéå§ã®ã»ã¬ã¢ãã¼",points:50,qrCode:"OPEN2024",entryKey:"OPEN-01",expiresAt:null,isActive:!0,createdBy:"admin",createdAt:new Date,updatedAt:new Date},"event-2":{id:"event-2",name:"ã¯ã¼ã¯ã·ã§ããA",description:"ããã°ã©ãã³ã°ã®åºç¤ãå¦ã¶",points:30,qrCode:"WSPA2024",entryKey:"WSP-A1",expiresAt:new Date(Date.now()+1e3*60*60*24),isActive:!0,createdBy:"admin",createdAt:new Date,updatedAt:new Date},"event-3":{id:"event-3",name:"ã¯ã¼ã¯ã·ã§ããB",description:"AIã使ã£ããã³ãºãªã³",points:70,qrCode:"WSPB2024",entryKey:"WSP-B1",expiresAt:null,isActive:!1,createdBy:"admin",createdAt:new Date,updatedAt:new Date}};function K(){const{id:l}=S(),[i,x]=m.useState(null),[v,N]=m.useState(null),[A,f]=m.useState(!0),p=m.useRef(null),{isDemoMode:b}=C();m.useEffect(()=>{let o=!0;return D(()=>import("./qrcode-DlE0z9wJ.js").then(s=>s.a),__vite__mapDeps([0,1])).then(s=>{o&&N(()=>s.QRCodeSVG)}),()=>{o=!1}},[]),m.useEffect(()=>{(async()=>{if(l){if(b){const s=E[l];s&&x(s),f(!1);return}try{const s=w(h,"eventsPublic",l),t=await g(s);if(t.exists()){const a=t.data(),r=M(B(h,"eventSecrets"),R("eventId","==",l)),n=await P(r);let d="",c="";if(!n.empty){const j=n.docs[0].data();d=j.qrCode,c=j.entryKey}x({id:t.id,name:a.name,description:a.description,points:a.points,isActive:a.isActive,startsAt:a.startsAt?.toDate(),endsAt:a.endsAt?.toDate(),createdAt:a.createdAt?.toDate(),updatedAt:a.updatedAt?.toDate(),qrCode:d,entryKey:c})}else{const a=w(h,"events",l),r=await g(a);if(r.exists()){const n=r.data();x({id:r.id,name:n.name,description:n.description,points:n.points,qrCode:n.qrCode,entryKey:n.entryKey,expiresAt:n.expiresAt?.toDate()||null,isActive:n.isActive,createdBy:n.createdBy,createdAt:n.createdAt?.toDate(),updatedAt:n.updatedAt?.toDate()})}}}catch(s){console.error("Failed to fetch event:",s)}finally{f(!1)}}})()},[l,b]);const k=()=>{window.print()},L=()=>
2{if(!p.current)return;const o=p.current.querySelector("svg");if(!o)return;const s=document.createElement("canvas"),t=s.getContext("2d");if(!t)return;s.width=600,s.height=800,t.fillStyle="#ffffff",t.fillRect(0,0,s.width,s.height),t.fillStyle="#1f2937",t.font="bold 32px system-ui, sans-serif",t.textAlign="center",t.fillText(i?.name||"",s.width/2,60),t.fillStyle="#4f46e5",t.font="bold 24px system-ui, sans-serif",t.fillText(`${i?.points||0} ãã¤ã³ã`,s.width/2,100);const a=new XMLSerializer().serializeToString(o),r=new Blob([a],{type:"image/svg+xml;charset=utf-8"}),n=URL.createObjectURL(r),d=new Image;d.onload=()=>{t.drawImage(d,(s.width-300)/2,140,300,300),t.fillStyle="#6b7280",t.font="18px system-ui, sans-serif",t.fillText("ã¾ãã¯ããã¼ãå ¥å",s.width/2,500),t.fillStyle="#4f46e5",t.font="bold 48px monospace",t.fillText(i?.entryKey||"",s.width/2,560),i?.description&&(t.fillStyle="#9ca3af",t.font="16px system-ui, sans-serif",t.fillText(i.description.substring(0,40),s.width/2,620));const c=document.createElement("a");c.download=`qr-${i?.entryKey||"event"}.png`,c.href=s.toDataURL("image/png"),c.click(),URL.revokeObjectURL(n)},d.src=n};return A?e.jsx(u,{children:e.jsx("div",{className:"max-w-2xl mx-auto flex justify-center py-12",children:e.jsx("div",{className:"w-10 h-10 border-2 border-primary-200 border-t-primary-600 rounded-full animate-spin"})})}):i?e.jsxs(u,{children:[e.jsxs("div",{className:"max-w-2xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("h1",{className:"text-headline text-neutral-900 mb-1",children:"QR Code"}),e.jsx("p",{className:"text-body text-neutral-500",children:"åå è ã«è¦ããQRã³ã¼ã"})]}),e.jsxs("div",{ref:p,className:"card-elevated overflow-hidden print-area",children:[e.jsxs("div",{className:"gradient-primary p-6 text-white text-center relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC4xIj48Y2lyY2xlIGN4PSIzMCIgY3k9IjMwIiByPSIyIi8+PC9nPjwvZz48L3N2Zz4=')] opacity-50"}),e.jsxs("div",{className:"relative z-10",children:[e.jsx("h2",{className:"text-headline mb-2",children:i.name}),e.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 bg-white/20 rounded-full",children:[e.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 6v12m-3-2.818l.879.659c1.171.879 3.07.879 4.242 0 1.172-.879 1.172-2.303 0-3.182C13.536 12.219 12.768 12 12 12c-.725 0-1.45-.22-2.003-.659-1.106-.879-1.106-2.303 0-3.182s2.9-.879 4.006 0l.415.33M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),e.jsxs("span",{className:"text-title",children:[i.points," ãã¤ã³ã"]})]})]})]}),e.jsxs("div",{className:"p-8 bg-white",children:[e.jsx("div",{className:"flex justify-center mb-6",children:e.jsx("div",{className:"p-4 bg-white rounded-2xl shadow-soft border border-neutral-100",children:v?e.jsx(v,{value:I(i.qrCode),size:220,level:"H",includeMargin:!1,style:{display:"block"}}):e.jsx("div",{className:"w-[220px] h-[220px] bg-neutral-50 rounded-xl animate-pulse"})})}),e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 mb-3",children:[e.jsx("div",{className:"h-px w-8 bg-neutral-200"}),e.jsx("span",{className:"text-caption text-neutral-400",children:"ã¾ãã¯ããã¼ãå ¥å"}),e.jsx("div",{className:"h-px w-8 bg-neutral-200"})]}),e.jsx("div",{className:"inline-block px-6 py-3 bg-neutral-50 rounded-xl border-2 border-dashed border-neutral-200",children:e.jsx("p",{className:"text-3xl font-mono font-bold tracking-[0.2em] text-primary-600",children:i.entryKey})})]}),i.description&&e.jsx("p",{className:"text-center text-caption text-neutral-400 mt-6 max-w-sm mx-auto",children:i.description})]}),e.jsx("div",{className:"px-8 py-4 bg-neutral-50 border-t border-neutral-100 text-center",children:e.jsx("p",{className:"text-caption text-neutral-500",children:"QRã³ã¼ããã¹ãã£ã³ãããããã¼ãå ¥åãã¦ãã¤ã³ããç²å¾ãã¦ãã ãã"})})]}),!i.isActive&&e.jsxs("div",{className:"mt-4 p-4 bg-amber-50 border border-amber-100 rounded-xl flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-amber-100 flex items-center justify-center flex-shrink-0",children:e.jsx("svg",{className:"w-5 h-5 text-amber-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})})}),e.jsx("p",{className:"text-caption text-amber-700",children:"ãã®ã¤ãã³ãã¯ç¾å¨ç¡å¹ã§ããæå¹åããã¾ã§ãã¤ã³ãã¯ç²å¾ã§ãã¾ããã"})]}),e.jsxs("div",{className:"flex gap-4 mt-6 no-print",children:[e.jsxs("button",{onClick:k,className:"btn btn-primary flex-1",children:[e.jsx("svg",{className:"w-5 h-5 mr-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M6.72 13.829c-.24.03-.48.062-.72.096m.72-.096a42.415 42.415 0 0110.56 0m-10.56 0L6.34 18m10.94-4.171c.24.03.48.062.72.096m-.72-.096L17.66 18m0 0l.229 2.523a1.125 1.125 0 01-1.12 1.227H7.231c-.662 0-1.18-.568-1.12-1.227L6.34 18m11.318 0h1.091A2.25 2.25 0 0021 15.75V9.456c0-1.081-.768-2.015-1.837-2.175a48.055 48.055 0 00-1.913-.247M6.34 18H5.25A2.25 2.25 0 013 15.75V9.456c0-1.081.768-2.015 1.837-2.175a48.041 48.041 0 011.913-.247m10.5 0a48.536 48.536 0 00-10.5 0m10.5 0V3.375c0-.621-.504-1.125-1.125-1.125h-8.25c-.621 0-1.125.504-1.125 1.125v3.659M18 10.5h.008v.008H18V10.5zm-3 0h.008v.008H15V10.5z"})}),"å°å·ãã"]}),e.jsxs("button",{onClick:L,className:"btn btn-ghost flex-1",children:[e.jsx("svg",{className:"w-5 h-5 mr-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),"ç»åãä¿å"]})]}),e.jsxs(y,{to:"/admin/events",className:"inline-flex items-center gap-2 mt-8 text-caption text-neutral-500 hover:text-primary-600 transition-colors no-print",children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 19l-7-7m0 0l7-7m-7 7h18"})}),"ã¤ãã³ãä¸è¦§ã¸æ»ã"]})]}),e.jsx("style",{children:` 3 @media print { 4 body * { 5 visibility: hidden; 6 } 7 .print-area, .print-area * { 8 visibility: visible; 9 } 10 .print-area { 11 position: absolute; 12 left: 50%; 13 top: 0; 14 transform: translateX(-50%); 15 width: 100%; 16 max-width: 400px; 17 box-shadow: none !important; 18 } 19 .no-print { 20 display: none !important; 21 } 22 header, nav { 23 display: none !important; 24 } 25 } 26 `})]}):e.jsx(u,{children:e.jsx("div",{className:"max-w-2xl mx-auto",children:e.jsxs("div",{className:"card-static p-12 text-center",children:[e.jsx("div",{className:"w-16 h-16 rounded-2xl bg-neutral-100 flex items-center justify-center mx-auto mb-4",children:e.jsx("svg",{className:"w-8 h-8 text-neutral-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 9v3.75m9-.75
26a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"})})}),e.jsx("p",{className:"text-body text-neutral-600 mb-2",children:"ã¤ãã³ããè¦ã¤ããã¾ãã"}),e.jsx(y,{to:"/admin/events",className:"text-caption text-primary-600 hover:underline",children:"ã¤ãã³ãä¸è¦§ã¸æ»ã"})]})})})}export{K as EventQRPage};
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.