1import{Y as V,q as e}from"./index-uG2Fj7kK.js";import{f as x,a as F,L as D}from"./vendor-router-DVyPNBIY.js";import{u as X}from"./useAdmin-BlWL5DCO.js";import{I}from"./ImageUploader-Dq3SP9VZ.js";import{L as n}from"./LocalizedField-rfIQx9Vn.js";import{l as Z,c as ee,a as te,D as G,s as se}from"./cardContent-ySxlyGPv.js";import"./vendor-firebase-core-Bd75sj-9.js";import"./vendor-fbauth-BULzZRav.js";import"./vendor-firestore-Dlk5HrwC.js";import"./vendor-fbstorage-Bs-_WSY5.js";import"./vendor-functions-NO_0zc2o.js";function he(){var L,E,P,S,R,_,w,A,B;const{ready:u,user:i,isAdmin:j}=X(),{i18n:d}=V(),[l,b]=x.useState({}),[H,T]=x.useState(!1),[W,J]=x.useState(!1),[k,U]=x.useState(!1),[v,y]=x.useState(null);if(x.useEffect(()=>{j&&Z().then(t=>{var s,a,o,f;if(t)b(t);else{const K=(a=(s=d.getResourceBundle)==null?void 0:s.call(d,"ko","translation"))==null?void 0:a.card,Q=(f=(o=d.getResourceBundle)==null?void 0:o.call(d,"vi","translation"))==null?void 0:f.card;b(ee(K,Q)),J(!0)}T(!0)})},[j]),!u)return e.jsx("div",{className:"p-6 text-center text-sm text-gray-500",children:"ë¡ë© ì¤â¦"});if(!i)return e.jsx(F,{to:"/login",replace:!0});if(!j)return e.jsx(F,{to:"/admin",replace:!0});const r=t=>b(s=>({...s,...t})),c=(t,s)=>b(a=>({...a,[t]:{...a[t]??{},...s}})),p=(L=l.benefits)!=null&&L.length?l.benefits:te.map(t=>({icon:t})),C=(t,s)=>{const a=p.map((o,f)=>f===t?{...o,...s}:o);r({benefits:a})},Y=()=>r({benefits:[...p,{icon:"â¢"}]}),$=t=>r({benefits:p.filter((s,a)=>a!==t)}),h=l.eligibility??[],q=(t,s)=>r({eligibility:h.map((a,o)=>o===t?s:a)}),z=()=>r({eligibility:[...h,{ko:""}]}),M=t=>r({eligibility:h.filter((s,a)=>a!==t)});async function O(){U(!0),y(null);try{await se(l,i==null?void 0:i.uid),y("â ì ì¥ëììµëë¤.")}catch(t){y(t instanceof Error?t.message:"ì ì¥ ì¤í¨")}U(!1)}return e.jsxs("div",{className:"max-w-3xl mx-auto p-4 md:p-6 space-y-6",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(D,{to:"/admin",className:"text-sm text-gray-400 hover:text-gray-600",children:"â ê´ë¦¬ì"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-extrabold",children:"ð³ ë³µì§ì¹´ë"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"ì¹´ë íì´ì§(/card)ì ì´ë¯¸ì§Â·ì ì²ë§í¬Â·ìì´ì½Â·ë¬¸êµ¬ë¥¼ í¸ì§í©ëë¤. ë¹ìëë©´ 기존 기본ê°ì¼ë¡ íìë©ëë¤."}),W&&e.jsx("p",{className:"text-xs text-brand-700 bg-ctt-green/10 rounded-lg px-3 py-2 mt-2",children:"â¹ íì¬ ì¹´ëì íìëë ë´ì©ì ì
ë ¥ì¹¸ì ì±ìëììµëë¤. ìì í ì ì¥íë©´ ë°ìë©ëë¤."})]}),!H&&e.jsx("p",{className:"text-sm text-gray-400",children:"ë¶ë¬ì¤ë ì¤â¦"}),e.jsxs(m,{title:"ìë¨",children:[e.jsx(n,{label:"íê·¸ë¼ì¸ (ì íì¹´ë à ìºë)",value:l.tagline,onChange:t=>r({tagline:t})}),e.jsx(n,{label:"ì 목 (ìºë ì ì© ë³µì§ì¹´ë)",value:l.title,onChange:t=>r({title:t})}),e.jsx(n,{label:"ë¶ì (í ì¤ ì¤ëª
)",value:l.subtitle,onChange:t=>r({subtitle:t})})]}),e.jsxs(m,{title:"ì ì©ì¹´ë",children:[e.jsx(n,{label:"ì 목",value:(E=l.credit)==null?void 0:E.title,onChange:t=>c("credit",{title:t})}),e.jsx(n,{label:"ë¶ì ",value:(P=l.credit)==null?void 0:P.subtitle,onChange:t=>c("credit",{subtitle:t})}),e.jsx(g,{label:"ì ì² ë§í¬ URL",children:e.jsx("input",{className:N,placeholder:G.credit,value:((S=l.credit)==null?void 0:S.applyUrl)??"",onChange:t=>c("credit",{applyUrl:t.target.value})})}),e.jsx(g,{label:"ì¹´ë ì´ë¯¸ì§ (ê¶ì¥ ì¸ë¡í ì¹´ë)",children:e.jsx(I,{value:(R=l.credit)==null?void 0:R.imageUrl,onChange:t=>c("credit",{imageUrl:t}),folder:"card",aspect:"3/2",hint:"JPG / PNG / WebP · ë¹ì°ë©´ 기본 ì´ë¯¸ì§"})})]}),e.jsxs(m,{title:"ì²´í¬ì¹´ë",children:[e.jsx(n,{label:"ì 목",value:(_=l.check)==null?void 0:_.title,onChange:t=>c("check",{title:t})}),e.jsx(n,{label:"ë¶ì ",value:(w=l.check)==null?void 0:w.subtitle,onChange:t=>c("check",{subtitle:t})}),e.jsx(g,{label:"ì ì² ë§í¬ URL",children:e.jsx("input",{className:N,placeholder:G.check,value:((A=l.check)==null?void 0:A.applyUrl)??"",onChange:t=>c("check",{applyUrl:t.target.value})})}),e.jsx(g,{label:"ì¹´ë ì´ë¯¸ì§",children:e.jsx(I,{value:(B=l.check)==null?void 0:B.imageUrl,onChange:t=>c("check",{imageUrl:t}),folder:"card",aspect:"3/2",hint:"JPG / PNG / WebP · ë¹ì°ë©´ 기본 ì´ë¯¸ì§"})})]}),e.jsxs(m,{title:"주ì íí",children:[e.jsx(n,{label:"ì¹ì
ì 목
1(주ì íí)",value:l.benefitsHeading,onChange:t=>r({benefitsHeading:t})}),p.map((t,s)=>e.jsxs("div",{className:"rounded-lg border border-gray-100 p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs font-bold text-gray-500",children:["íí ",s+1]}),e.jsx("button",{type:"button",onClick:()=>$(s),className:"text-xs text-rose-500 hover:underline",children:"ìì "})]}),e.jsx(g,{label:"ìì´ì½ (ì´ëª¨ì§ ëë ì´ë¯¸ì§ URL)",children:e.jsx("input",{className:N,value:t.icon??"",placeholder:"â³",onChange:a=>C(s,{icon:a.target.value})})}),e.jsx(n,{label:"ì 목",value:t.title,onChange:a=>C(s,{title:a})}),e.jsx(n,{label:"ì¤ëª
",value:t.desc,onChange:a=>C(s,{desc:a})})]},s)),e.jsx("button",{type:"button",onClick:Y,className:"text-sm font-semibold text-ctt-green hover:underline",children:"+ íí ì¶ê°"})]}),e.jsxs(m,{title:"ë°ê¸ ì격",children:[e.jsx(n,{label:"ì¹ì
ì 목 (ë°ê¸ ì격)",value:l.eligibilityHeading,onChange:t=>r({eligibilityHeading:t})}),h.length===0&&e.jsx("p",{className:"text-xs text-gray-400",children:"ë¹ì°ë©´ 기본 ì격 ë¬¸êµ¬ê° íìë©ëë¤."}),h.map((t,s)=>e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"flex-1",children:e.jsx(n,{label:`ì격 ${s+1}`,value:t,onChange:a=>q(s,a)})}),e.jsx("button",{type:"button",onClick:()=>M(s),className:"mt-6 text-xs text-rose-500 hover:underline shrink-0",children:"ìì "})]},s)),e.jsx("button",{type:"button",onClick:z,className:"text-sm font-semibold text-ctt-green hover:underline",children:"+ ì격 ì¶ê°"}),e.jsx(n,{label:"íë¨ ìë´ (â» ìì¸í ì½ê´â¦)",value:l.eligibilityNote,onChange:t=>r({eligibilityNote:t})})]}),e.jsxs(m,{title:"íë¨ ìë´(ë³µì§ëª° ë§í¬)",children:[e.jsx(n,{label:"ì 목",value:l.afterCard,onChange:t=>r({afterCard:t})}),e.jsx(n,{label:"ì¤ëª
",value:l.afterCardDesc,onChange:t=>r({afterCardDesc:t})})]}),e.jsxs("div",{className:"sticky bottom-0 bg-white/90 backdrop-blur border-t border-gray-100 py-3 flex items-center gap-3",children:[e.jsx("button",{onClick:O,disabled:k,className:"px-5 py-2 rounded-lg bg-ctt-green text-white font-bold text-sm disabled:opacity-50",children:k?"ì ì¥ ì¤â¦":"ì ì¥"}),v&&e.jsx("span",{className:`text-sm ${v.startsWith("â")?"text-ctt-green":"text-rose-500"}`,children:v}),e.jsx(D,{to:"/card",target:"_blank",className:"ml-auto text-sm text-brand-700 hover:underline",children:"ì¹´ë íì´ì§ 미리보기 â"})]})]})}const N="mt-1 w-full border border-gray-300 rounded-md px-3 py-2 text-sm focus:outline-none focus:border-ctt-green focus:ring-2 focus:ring-ctt-green/20";function m({title:u,children:i}){return e.jsxs("section",{className:"rounded-xl border border-gray-200 p-4 space-y-3",children:[e.jsx("h2",{className:"font-extrabold text-sm text-gray-700",children:u}),i]})}function g({label:u,children:i}){return e.jsxs("label",{className:"block text-sm",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-600",children:u}),i]})}export{he 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.