1import{j as a}from"./vendor-ui.BwPBmVwt.js";import{R as $,r as ue,u as Vs,f as Fs,j as As,k as ks}from"./vendor-react.kR8tqwKZ.js";import{u as Ss}from"./useTabParam.0zzDdGkW.js";import{X as Ds,s as ge}from"./index.86ltQqcV.js";import{S as de,b as De,s as Es}from"./sabangnetCodes.Q8xOIagc.js";import{d as ee}from"./vendor-utils.D2q0l15H.js";import{I as Cs}from"./image.BwtHwp2A.js";import{U as Is}from"./upload.C9RE_zBD.js";import{u as Ps}from"./AdminPageTitleContext.2Lb5yhG1.js";import{A as Ts}from"./arrow-left.COB2K-vb.js";import{S as Os}from"./save.DyDnqxYS.js";import{L as Ls}from"./loader-circle.PPp0m7l9.js";import{S as Us}from"./send.Dvs3mqUG.js";import"./vendor-three.C5-HLXBy.js";var ve=e=>e.type==="checkbox",ne=e=>e instanceof Date,G=e=>e==null;const os=e=>typeof e=="object";var O=e=>!G(e)&&!Array.isArray(e)&&os(e)&&!ne(e),Rs=e=>O(e)&&e.target?ve(e.target)?e.target.checked:e.target.value:e,Ms=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,qs=(e,t)=>e.has(Ms(t)),Bs=e=>{const t=e.constructor&&e.constructor.prototype;return O(t)&&t.hasOwnProperty("isPrototypeOf")},Pe=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function U(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(Pe&&(e instanceof Blob||t))return e;const s=Array.isArray(e);if(!s&&!(O(e)&&Bs(e)))return e;const l=s?[]:Object.create(Object.getPrototypeOf(e));for(const d in e)Object.prototype.hasOwnProperty.call(e,d)&&(l[d]=U(e[d]));return l}var Ne=e=>/^\w*$/.test(e),D=e=>e===void 0,Te=e=>Array.isArray(e)?e.filter(Boolean):[],Oe=e=>Te(e.replace(/["|']|\]/g,"").split(/\.|\[/)),h=(e,t,s)=>{if(!t||!O(e))return s;const l=(Ne(t)?[t]:Oe(t)).reduce((d,n)=>G(d)?d:d[n],e);return D(l)||l===e?D(e[t])?s:e[t]:l},se=e=>typeof e=="boolean",Q=e=>typeof e=="function",S=(e,t,s)=>{let l=-1;const d=Ne(t)?[t]:Oe(t),n=d.length,u=n-1;for(;++l<n;){const g=d[l];let R=s;if(l!==u){const M=e[g];R=O(M)||Array.isArray(M)?M:isNaN(+d[l+1])?{}:[]}if(g==="__proto__"||g==="constructor"||g==="prototype")return;e[g]=R,e=e[g]}};const Xe={BLUR:"blur",FOCUS_OUT:"focusout"},Z={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},re={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Ws=$.createContext(null);Ws.displayName="HookFormControlContext";var $s=(e,t,s,l=!0)=>{const d={defaultValues:t._defaultValues};for(const n in e)Object.defineProperty(d,n,{get:()=>{const u=n;return t._proxyFormState[u]!==Z.all&&(t._proxyFormState[u]=!l||Z.all),e[u]}});return d};const Hs=typeof window<"u"?$.useLayoutEffect:$.useEffect;var z=e=>typeof e=="string",Gs=(e,t,s,l,d)=>z(e)?(l&&t.watch.add(e),h(s,e,d)):Array.isArray(e)?e.map(n=>(l&&t.watch.add(n),h(s,n))):(l&&(t.watchAll=!0),s),Ce=e=>G(e)||!os(e);function ae(e,t,s=new WeakSet){if(Ce(e)||Ce(t))return Object.is(e,t);if(ne(e)&&ne(t))return Object.is(e.getTime(),t.getTime());const l=Object.keys(e),d=Object.keys(t);if(l.length!==d.length)return!1;if(s.has(e)||s.has(t))return!0;s.add(e),s.add(t);for(const n of l){const u=e[n];if(!d.includes(n))return!1;if(n!=="ref"){const g=t[n];if(ne(u)&&ne(g)||O(u)&&O(g)||Array.isArray(u)&&Array.isArray(g)?!ae(u,g,s):!Object.is(u,g))return!1}}return!0}const Js=$.createContext(null);Js.displayName="HookFormContext";var zs=(e,t,s,l,d)=>t?{...s[e],types:{...s[e]&&s[e].types?s[e].types:{},[l]:d||!0}}:{},be=e=>Array.isArray(e)?e:[e],Ye=()=>{let e=[];return{get observers(){return e},next:d=>{for(const n of e)n.next&&n.next(d)},subscribe:d=>(e.push(d),{unsubscribe:()=>{e=e.filter(n=>n!==d)}}),unsubscribe:()=>{e=[]}}};function ds(e,t){const s={};for(const l in e)if(e.hasOwnProperty(l)){const d=e[l],n=t[l];if(d&&O(d)&&n){const u=ds(d,n);O(u)&&(s[l]=u)}else e[l]&&(s[l]=n)}return s}var H=e=>O(e)&&!Object.keys(e).length,Le=e=>e.type==="file",je=e=>{if(!Pe)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},cs=e=>e.type==="select-multiple",Ue=e=>e.type==="radio",Ks=e=>Ue(e)||ve(e),Ee=e=>je(e)&&e.isConnected;function Xs(e,t){const s=t.slice(0,-1).length;let l=0;for(;l<s;
1)e=D(e)?l++:e[t[l++]];return e}function Ys(e){for(const t in e)if(e.hasOwnProperty(t)&&!D(e[t]))return!1;return!0}function T(e,t){const s=Array.isArray(t)?t:Ne(t)?[t]:Oe(t),l=s.length===1?e:Xs(e,s),d=s.length-1,n=s[d];return l&&delete l[n],d!==0&&(O(l)&&H(l)||Array.isArray(l)&&Ys(l))&&T(e,s.slice(0,-1)),e}var Qs=e=>{for(const t in e)if(Q(e[t]))return!0;return!1};function us(e){return Array.isArray(e)||O(e)&&!Qs(e)}function Ie(e,t={}){for(const s in e){const l=e[s];us(l)?(t[s]=Array.isArray(l)?[]:{},Ie(l,t[s])):D(l)||(t[s]=!0)}return t}function fe(e,t,s){s||(s=Ie(t));for(const l in e){const d=e[l];if(us(d))D(t)||Ce(s[l])?s[l]=Ie(d,Array.isArray(d)?[]:{}):fe(d,G(t)?{}:t[l],s[l]);else{const n=t[l];s[l]=!ae(d,n)}}return s}const Qe={value:!1,isValid:!1},Ze={value:!0,isValid:!0};var fs=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(s=>s&&s.checked&&!s.disabled).map(s=>s.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!D(e[0].attributes.value)?D(e[0].value)||e[0].value===""?Ze:{value:e[0].value,isValid:!0}:Ze:Qe}return Qe},gs=(e,{valueAsNumber:t,valueAsDate:s,setValueAs:l})=>D(e)?e:t?e===""?NaN:e&&+e:s&&z(e)?new Date(e):l?l(e):e;const es={isValid:!1,value:null};var ms=e=>Array.isArray(e)?e.reduce((t,s)=>s&&s.checked&&!s.disabled?{isValid:!0,value:s.value}:t,es):es;function ss(e){const t=e.ref;return Le(t)?t.files:Ue(t)?ms(e.refs).value:cs(t)?[...t.selectedOptions].map(({value:s})=>s):ve(t)?fs(e.refs).value:gs(D(t.value)?e.ref.value:t.value,e)}var Zs=(e,t,s,l)=>{const d={};for(const n of e){const u=h(t,n);u&&S(d,n,u._f)}return{criteriaMode:s,names:[...e],fields:d,shouldUseNativeValidation:l}},we=e=>e instanceof RegExp,ye=e=>D(e)?e:we(e)?e.source:O(e)?we(e.value)?e.value.source:e.value:e,rs=e=>({isOnSubmit:!e||e===Z.onSubmit,isOnBlur:e===Z.onBlur,isOnChange:e===Z.onChange,isOnAll:e===Z.all,isOnTouch:e===Z.onTouched});const ts="AsyncFunction";var er=e=>!!e&&!!e.validate&&!!(Q(e.validate)&&e.validate.constructor.name===ts||O(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===ts)),sr=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),as=(e,t,s)=>!s&&(t.watchAll||t.watch.has(e)||[...t.watch].some(l=>e.startsWith(l)&&/^\.\w+/.test(e.slice(l.length))));const pe=(e,t,s,l)=>{for(const d of s||Object.keys(e)){const n=h(e,d);if(n){const{_f:u,...g}=n;if(u){if(u.refs&&u.refs[0]&&t(u.refs[0],d)&&!l)return!0;if(u.ref&&t(u.ref,u.name)&&!l)return!0;if(pe(g,t))break}else if(O(g)&&pe(g,t))break}}};function is(e,t,s){const l=h(e,s);if(l||Ne(s))return{error:l,name:s};const d=s.split(".");for(;d.length;){const n=d.join("."),u=h(t,n),g=h(e,n);if(u&&!Array.isArray(u)&&s!==n)return{name:s};if(g&&g.type)return{name:n,error:g};if(g&&g.root&&g.root.type)return{name:`${n}.root`,error:g.root};d.pop()}return{name:s}}var rr=(e,t,s,l)=>{s(e);const{name:d,...n}=e;return H(n)||Object.keys(n).length>=Object.keys(t).length||Object.keys(n).find(u=>t[u]===(!l||Z.all))},tr=(e,t,s)=>!e||!t||e===t||be(e).some(l=>l&&(s?l===t:l.startsWith(t)||t.startsWith(l))),ar=(e,t,s,l,d)=>d.isOnAll?!1:!s&&d.isOnTouch?!(t||e):(s?l.isOnBlur:d.isOnBlur)?!e:(s?l.isOnChange:d.isOnChange)?e:!0,ir=(e,t)=>!Te(h(e,t)).length&&T(e,t),lr=(e,t,s)=>{const l=be(h(e,s));return S(l,"root",t[s]),S(e,s,l),e};function ls(e,t,s="validate"){if(z(e)||Array.isArray(e)&&e.every(z)||se(e)&&!e)return{type:s,message:z(e)?e:"",ref:t}}var ce=e=>O(e)&&!we(e)?e:{value:e,message:""},ns=async(e,t,s,l,d,n)=>{const{ref:u,refs:g,required:R,maxLength:M,minLength:F,min:v,max:j,pattern:y,validate:E,name:C,valueAsNumber:I,mount:q}=e._f,_=h(s,C);if(!q||t.has(C))return{};const X=g?g[0]:u,k=p=>{d&&X.reportValidity&&(X.setCustomValidity(se(p)?"":p||""),X.reportValidity())},A={},P=Ue(u),b=ve(u),ie=P||b,oe=(I||Le(u))&&D(u.value)&&D(_)||je(u)&&u.value===""||_===""||Array.isArray(_)&&!_.length,K=zs.bind(null,C,l,A),_e=(p,w,L,B=re.maxLength,Y=re.minLength)=>{const J=p?w:L;A[C]={type:p?B:Y,message:J,ref:u,...K(p?B:Y,J)}};if(n?!Array.isArray(_)||!_.length:R&&(!ie&&(oe||G(_))||se(_)&&!_||b&&!fs(g).isValid||P&&!ms(g).isValid)){const{value:p,message:w}=z(R)?{value:!!R,message:R}:ce(R);if(p&&(A[C]={type:re.required,message:w,ref:X,...K(re.required,w)},!l))return k(w),A}if(!oe&&(!G(v)||!G(j))){let p,w;const L=ce(j),B=ce(v);if(!G(_)&&!isNaN(_)){const Y=u.valueAsNumber||_&&+_;G(L.value)||(p=Y>L.value),G(B.value)||(w=Y<B.value)}else{const Y=u.valueAsDate||new Date(_),J=xe=>new Date(new Date().toDateString()+" "+xe),me=u.type=="time",he=u.type=="week";z(L.value)&&_&&(p=me?J(_)>J(L.value):he?_>L.value:Y>new Date(L.value)),z(B.value)&&_&&(w=me?J(_)<J(B.value):he?_<B.value:Y<new Date(B.value))}if((p||w)&&(_e(!!p,L.message,B.message,re.max,re.min),!l))return k(A[C].message),A}if((M||F)&&!oe&&(z(_)||n&&Array.isArray(_))){const p=ce(M),w=ce(F),L=!G(p.value)&&_.length>+p.value,B=!G(w.value)&&_.length<+w.value;if((L||B)&&(_e(L,p.message,w.message),!l))return k(A[C].message),A}if(y&&!oe&&z(_)){const{value:p,message:w}=ce(y);if(we(p)&&!_.match(p)&&(A[C]={type:re.pattern,message:w,ref:u,...K(re.pattern,w)},!l))return k(w),A}if(E){if(Q(E)){const p=await E(_,s),w=ls(p,X);if(w&&(A[C]={...w,...K(re.validate,w.message)},!l))return k(w.message),A}else if(O(E)){let p={};for(const w in E){if(!H(p)&&!l)break;const L=ls(await E[w](_,s),X,w);L&&(p={...L,...K(w,L.message)},k(L.message),l&&(A[C]=p))}
1if(!H(p)&&(A[C]={ref:X,...p},!l))return A}}return k(!0),A};const nr={mode:Z.onSubmit,reValidateMode:Z.onChange,shouldFocusError:!0};function or(e={}){let t={...nr,...e},s={submitCount:0,isDirty:!1,isReady:!1,isLoading:Q(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},l={},d=O(t.defaultValues)||O(t.values)?U(t.defaultValues||t.values)||{}:{},n=t.shouldUnregister?{}:U(d),u={action:!1,mount:!1,watch:!1,keepIsValid:!1},g={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},R,M=0;const F={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},v={...F};let j={...v};const y={array:Ye(),state:Ye()},E=t.criteriaMode===Z.all,C=r=>i=>{clearTimeout(M),M=setTimeout(r,i)},I=async r=>{if(!u.keepIsValid&&!t.disabled&&(v.isValid||j.isValid||r)){let i;t.resolver?(i=H((await ie()).errors),q()):i=await K(l,!0),i!==s.isValid&&y.state.next({isValid:i})}},q=(r,i)=>{!t.disabled&&(v.isValidating||v.validatingFields||j.isValidating||j.validatingFields)&&((r||Array.from(g.mount)).forEach(o=>{o&&(i?S(s.validatingFields,o,i):T(s.validatingFields,o))}),y.state.next({validatingFields:s.validatingFields,isValidating:!H(s.validatingFields)}))},_=(r,i=[],o,m,f=!0,c=!0)=>{if(m&&o&&!t.disabled){if(u.action=!0,c&&Array.isArray(h(l,r))){const x=o(h(l,r),m.argA,m.argB);f&&S(l,r,x)}if(c&&Array.isArray(h(s.errors,r))){const x=o(h(s.errors,r),m.argA,m.argB);f&&S(s.errors,r,x),ir(s.errors,r)}if((v.touchedFields||j.touchedFields)&&c&&Array.isArray(h(s.touchedFields,r))){const x=o(h(s.touchedFields,r),m.argA,m.argB);f&&S(s.touchedFields,r,x)}(v.dirtyFields||j.dirtyFields)&&(s.dirtyFields=fe(d,n)),y.state.next({name:r,isDirty:p(r,i),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else S(n,r,i)},X=(r,i)=>{S(s.errors,r,i),y.state.next({errors:s.errors})},k=r=>{s.errors=r,y.state.next({errors:s.errors,isValid:!1})},A=(r,i,o,m)=>{const f=h(l,r);if(f){const c=h(n,r,D(o)?h(d,r):o);D(c)||m&&m.defaultChecked||i?S(n,r,i?c:ss(f._f)):B(r,c),u.mount&&!u.action&&I()}},P=(r,i,o,m,f)=>{let c=!1,x=!1;const N={name:r};if(!t.disabled){if(!o||m){(v.isDirty||j.isDirty)&&(x=s.isDirty,s.isDirty=N.isDirty=p(),c=x!==N.isDirty);const V=ae(h(d,r),i);x=!!h(s.dirtyFields,r),V?T(s.dirtyFields,r):S(s.dirtyFields,r,!0),N.dirtyFields=s.dirtyFields,c=c||(v.dirtyFields||j.dirtyFields)&&x!==!V}if(o){const V=h(s.touchedFields,r);V||(S(s.touchedFields,r,o),N.touchedFields=s.touchedFields,c=c||(v.touchedFields||j.touchedFields)&&V!==o)}c&&f&&y.state.next(N)}return c?N:{}},b=(r,i,o,m)=>{const f=h(s.errors,r),c=(v.isValid||j.isValid)&&se(i)&&s.isValid!==i;if(t.delayError&&o?(R=C(()=>X(r,o)),R(t.delayError)):(clearTimeout(M),R=null,o?S(s.errors,r,o):T(s.errors,r)),(o?!ae(f,o):f)||!H(m)||c){const x={...m,...c&&se(i)?{isValid:i}:{},errors:s.errors,name:r};s={...s,...x},y.state.next(x)}},ie=async r=>(q(r,!0),await t.resolver(n,t.context,Zs(r||g.mount,l,t.criteriaMode,t.shouldUseNativeValidation))),oe=async r=>{const{errors:i}=await ie(r);if(q(r),r)for(const o of r){const m=h(i,o);m?S(s.errors,o,m):T(s.errors,o)}else s.errors=i;return i},K=async(r,i,o={valid:!0})=>{for(const m in r){const f=r[m];if(f){const{_f:c,...x}=f;if(c){const N=g.array.has(c.name),V=f._f&&er(f._f);V&&v.validatingFields&&q([c.name],!0);const W=await ns(f,g.disabled,n,E,t.shouldUseNativeValidation&&!i,N);if(V&&v.validatingFields&&q([c.name]),W[c.name]&&(o.valid=!1,i||e.shouldUseNativeValidation))break;!i&&(h(W,c.name)?N?lr(s.errors,W,c.name):S(s.errors,c.name,W[c.name]):T(s.errors,c.name))}!H(x)&&await K(x,i,o)}}return o.valid},_e=()=>{for(const r of g.unMount){const i=h(l,r);i&&(i._f.refs?i._f.refs.every(o=>!Ee(o)):!Ee(i._f.ref))&&Ve(r)}g.unMount=new Set},p=(r,i)=>!t.disabled&&(r&&i&&S(n,r,i),!ae(Re(),d)),w=(r,i,o)=>Gs(r,g,{...u.mount?n:D(i)?d:z(r)?{[r]:i}:i},o,i),L=r=>Te(h(u.mount?n:d,r,t.shouldUnregister?h(d,r,[]):[])),B=(r,i,o={})=>{const m=h(l,r);let f=i;if(m){const c=m._f;c&&(!c.disabled&&S(n,r,gs(i,c)),f=je(c.ref)&&G(i)?"":i,cs(c.ref)?[...c.ref.options].forEac
1h(x=>x.selected=f.includes(x.value)):c.refs?ve(c.ref)?c.refs.forEach(x=>{(!x.defaultChecked||!x.disabled)&&(Array.isArray(f)?x.checked=!!f.find(N=>N===x.value):x.checked=f===x.value||!!f)}):c.refs.forEach(x=>x.checked=x.value===f):Le(c.ref)?c.ref.value="":(c.ref.value=f,c.ref.type||y.state.next({name:r,values:U(n)})))}(o.shouldDirty||o.shouldTouch)&&P(r,f,o.shouldTouch,o.shouldDirty,!0),o.shouldValidate&&xe(r)},Y=(r,i,o)=>{for(const m in i){if(!i.hasOwnProperty(m))return;const f=i[m],c=r+"."+m,x=h(l,c);(g.array.has(r)||O(f)||x&&!x._f)&&!ne(f)?Y(c,f,o):B(c,f,o)}},J=(r,i,o={})=>{const m=h(l,r),f=g.array.has(r),c=U(i);S(n,r,c),f?(y.array.next({name:r,values:U(n)}),(v.isDirty||v.dirtyFields||j.isDirty||j.dirtyFields)&&o.shouldDirty&&y.state.next({name:r,dirtyFields:fe(d,n),isDirty:p(r,c)})):m&&!m._f&&!G(c)?Y(r,c,o):B(r,c,o),as(r,g)?y.state.next({...s,name:r,values:U(n)}):y.state.next({name:u.mount?r:void 0,values:U(n)})},me=async r=>{u.mount=!0;const i=r.target;let o=i.name,m=!0;const f=h(l,o),c=V=>{m=Number.isNaN(V)||ne(V)&&isNaN(V.getTime())||ae(V,h(n,o,V))},x=rs(t.mode),N=rs(t.reValidateMode);if(f){let V,W;const le=i.type?ss(f._f):Rs(r),te=r.type===Xe.BLUR||r.type===Xe.FOCUS_OUT,js=!sr(f._f)&&!t.resolver&&!h(s.errors,o)&&!f._f.deps||ar(te,h(s.touchedFields,o),s.isSubmitted,N,x),ke=as(o,g,te);S(n,o,le),te?(!i||!i.readOnly)&&(f._f.onBlur&&f._f.onBlur(r),R&&R(0)):f._f.onChange&&f._f.onChange(r);const Se=P(o,le,te),ws=!H(Se)||ke;if(!te&&y.state.next({name:o,type:r.type,values:U(n)}),js)return(v.isValid||j.isValid)&&(t.mode==="onBlur"?te&&I():te||I()),ws&&y.state.next({name:o,...ke?{}:Se});if(!te&&ke&&y.state.next({...s}),t.resolver){const{errors:ze}=await ie([o]);if(q([o]),c(le),m){const Ns=is(s.errors,l,o),Ke=is(ze,l,Ns.name||o);V=Ke.error,o=Ke.name,W=H(ze)}}else q([o],!0),V=(await ns(f,g.disabled,n,E,t.shouldUseNativeValidation))[o],q([o]),c(le),m&&(V?W=!1:(v.isValid||j.isValid)&&(W=await K(l,!0)));m&&(f._f.deps&&(!Array.isArray(f._f.deps)||f._f.deps.length>0)&&xe(f._f.deps),b(o,W,V,Se))}},he=(r,i)=>{if(h(s.errors,i)&&r.focus)return r.focus(),1},xe=async(r,i={})=>{let o,m;const f=be(r);if(t.resolver){const c=await oe(D(r)?r:f);o=H(c),m=r?!f.some(x=>h(c,x)):o}else r?(m=(await Promise.all(f.map(async c=>{const x=h(l,c);return await K(x&&x._f?{[c]:x}:x)}
vendor: 6,207 bytes, line 1
1))).every(Boolean),!(!m&&!s.isValid)&&I()):m=o=await K(l);return y.state.next({...!z(r)||(v.isValid||j.isValid)&&o!==s.isValid?{}:{name:r},...t.resolver||!r?{isValid:o}:{},errors:s.errors}),i.shouldFocus&&!m&&pe(l,he,r?f:g.mount),m},Re=(r,i)=>{let o={...u.mount?n:d};return i&&(o=ds(i.dirtyFields?s.dirtyFields:s.touchedFields,o)),D(r)?o:z(r)?h(o,r):r.map(m=>h(o,m))},Me=(r,i)=>({invalid:!!h((i||s).errors,r),isDirty:!!h((i||s).dirtyFields,r),error:h((i||s).errors,r),isValidating:!!h(s.validatingFields,r),isTouched:!!h((i||s).touchedFields,r)}),hs=r=>{const i=r?be(r):void 0;i?.forEach(o=>T(s.errors,o)),i?i.forEach(o=>{y.state.next({name:o,errors:s.errors})}):y.state.next({errors:{}})},qe=(r,i,o)=>{const m=(h(l,r,{_f:{}})._f||{}).ref,f=h(s.errors,r)||{},{ref:c,message:x,type:N,...V}=f;S(s.errors,r,{...V,...i,ref:m}),y.state.next({name:r,errors:s.errors,isValid:!1}),o&&o.shouldFocus&&m&&m.focus&&m.focus()},xs=(r,i)=>Q(r)?y.state.subscribe({next:o=>"values"in o&&r(w(void 0,i),o)}):w(r,i,!0),Be=r=>y.state.subscribe({next:i=>{tr(r.name,i.name,r.exact)&&rr(i,r.formState||v,_s,r.reRenderRoot)&&r.callback({values:{...n},...s,...i,defaultValues:d})}}).unsubscribe,ys=r=>(u.mount=!0,j={...j,...r.formState},Be({...r,formState:{...F,...r.formState}})),Ve=(r,i={})=>{for(const o of r?be(r):g.mount)g.mount.delete(o),g.array.delete(o),i.keepValue||(T(l,o),T(n,o)),!i.keepError&&T(s.errors,o),!i.keepDirty&&T(s.dirtyFields,o),!i.keepTouched&&T(s.touchedFields,o),!i.keepIsValidating&&T(s.validatingFields,o),!t.shouldUnregister&&!i.keepDefaultValue&&T(d,o);y.state.next({values:U(n)}),y.state.next({...s,...i.keepDirty?{isDirty:p()}:{}}),!i.keepIsValid&&I()},We=({disabled:r,name:i})=>{if(se(r)&&u.mount||r||g.disabled.has(i)){const f=g.disabled.has(i)!==!!r;r?g.disabled.add(i):g.disabled.delete(i),f&&u.mount&&!u.action&&I()}},Fe=(r,i={})=>{let o=h(l,r);const m=se(i.disabled)||se(t.disabled);return S(l,r,{...o||{},_f:{...o&&o._f?o._f:{ref:{name:r}},name:r,mount:!0,...i}}),g.mount.add(r),o?We({disabled:se(i.disabled)?i.disabled:t.disabled,name:r}):A(r,!0,i.value),{...m?{disabled:i.disabled||t.disabled}:{},...t.progressive?{required:!!i.required,min:ye(i.min),max:ye(i.max),minLength:ye(i.minLength),maxLength:ye(i.maxLength),pattern:ye(i.pattern)}:{},name:r,onChange:me,onBlur:me,ref:f=>{if(f){Fe(r,i),o=h(l,r);const c=D(f.value)&&f.querySelectorAll&&f.querySelectorAll("input,select,textarea")[0]||f,x=Ks(c),N=o._f.refs||[];if(x?N.find(V=>V===c):c===o._f.ref)return;S(l,r,{_f:{...o._f,...x?{refs:[...N.filter(Ee),c,...Array.isArray(h(d,r))?[{}]:[]],ref:{type:c.type,name:r}}:{ref:c}}}),A(r,!1,void 0,c)}else o=h(l,r,{}),o._f&&(o._f.mount=!1),(t.shouldUnregister||i.shouldUnregister)&&!(qs(g.array,r)&&u.action)&&g.unMount.add(r)}}},Ae=()=>t.shouldFocusError&&pe(l,he,g.mount),bs=r=>{se(r)&&(y.state.next({disabled:r}),pe(l,(i,o)=>{const m=h(l,o);m&&(i.disabled=m._f.disabled||r,Array.isArray(m._f.refs)&&m._f.refs.forEach(f=>{f.disabled=m._f.disabled||r}))},0,!1))},$e=(r,i)=>async o=>{let m;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let f=U(n);if(y.state.next({isSubmitting:!0}),t.resolver){const{errors:c,values:x}=await ie();q(),s.errors=c,f=U(x)}else await K(l);if(g.disabled.size)for(const c of g.disabled)T(f,c);if(T(s.errors,"root"),H(s.errors)){y.state.next({errors:{}});try{await r(f,o)}catch(c){m=c}}else i&&await i({...s.errors},o),Ae(),setTimeout(Ae);if(y.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:H(s.errors)&&!m,submitCount:s.submitCount+1,errors:s.errors}),m)throw m},ps=(r,i={})=>{h(l,r)&&(D(i.defaultValue)?J(r,U(h(d,r))):(J(r,i.defaultValue),S(d,r,U(i.defaultValue))),i.keepTouched||T(s.touchedFields,r),i.keepDirty||(T(s.dirtyFields,r),s.isDirty=i.defaultValue?p(r,U(h(d,r))):p()),i.keepError||(T(s.errors,r),v.isValid&&I()),y.state.next({...s}))},He=(r,i={})=>{const o=r?U(r):d,m=U(o),f=H(r),c=f?d:m;if(i.keepDefaultValues||(d=o),!i.keepValues){if(i.keepDirtyValues){const x=new Set([...g.mount,...Object.keys(fe(d,n))]);for(const N of Array.from(x)){const V=h(s.dirtyFields,N),W=h(n,N),le=h(c,N);V&&!D(W)?S(c,N,W):!V&&!D(le)&&J(N,le)}}else{if(Pe&&D(r))for(const x of g.mount){const N=h(l,x);if(N&&N._f){const V=Array.isArray(N._f.refs)?N._f.refs[0]:N._f.ref;if(je(V)){const W=V.closest("form");if(W){W.reset();break}}}}if(i.keepFieldsRef)for(const x of g.mount)J(x,h(c,x));else l={}}n=t.shouldUnregister?i.keepDefaultValues?U(d):{}:U(c),y.array.next({values:{...c}}),y.state.next({values:{...c}})}g={mount:i.keepDirtyValues?g.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},u.mount=!v.isValid||!!i.keepIsValid||!!i.keepDirtyValues||!t.shouldUnregister&&!H(c),u.watch=!!t.shouldUnregister,u.keepIsValid=!!i.keepIsValid,u.action=!1,i.keepErrors||(s.errors={}),y.state.next({submitCount:i.keepSubmitCount?s.submitCount:0,isDirty:f?!1:i.keepDirty?s.isDirty:!!(i.keepDefaultValues&&!ae(r,d)),isSubmitted:i.keepIsSubmitted?s.isSubmitted:!1,dirtyFields:f?{}:i.keepDirtyValues?i.keepDefaultValues&&n?fe(d,n):s.dirtyFields:i.keepDefaultValues&&r?fe(d,r):i.keepDirty?s.dirtyFields:{},touchedFields:i.keepTouched?s.touchedFields:{},errors:i.keepErrors?s.errors:{},isSubmitSuccessful:i.keepIsSubmitSuccessful?s.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:d})},Ge=(r,i)=>He(Q(r)?r(n):r,{...t.resetOptions,...i}),vs=(r,i={})=>{const o=h(l,r),m=o&&o._f;if(m){const f=m.refs?m.refs[0]:m.ref;f.focus&&setTimeout(()=>{f.focus(),i.shouldSelect&&Q(f.select)&&f.select()})}},_s=r=>{s={...s,...r}},Je={control:{register:Fe,unregister:Ve,getFieldState:Me,handleSubmit:$e,setError:qe,_subscribe:Be,_runSchema:ie,_updateIsValidating:q,_focusError:Ae,_getWatch:w,_getDirty:p,_setValid:I,_setFieldArray:_,_setDisabledField:We,_setErrors:k,_getFieldArray:L,_reset:He,_resetDefaultValues:()=>Q(t.defaultValues)&&t.defaultValues().then(r=>{Ge(r,t.resetOptions),y.state.next({isLoading:!1})}),_removeUnmounted:_e,_disableForm:bs,_subjects:y,_proxyFormState:v,get _fields(){return l},get _formValues(){return n},get _state(){return u},set _state(r){u=r},get _defaultValues(){return d},get _names(){return g},set _names(r){g=r},get _formState(){return s},get _options(){return t},set _options(r){t={...t,...r}}}
1,subscribe:ys,trigger:xe,register:Fe,handleSubmit:$e,watch:xs,setValue:J,getValues:Re,reset:Ge,resetField:ps,clearErrors:hs,unregister:Ve,setError:qe,setFocus:vs,getFieldState:Me};return{...Je,formControl:Je}}function dr(e={}){const t=$.useRef(void 0),s=$.useRef(void 0),[l,d]=$.useState({isDirty:!1,isValidating:!1,isLoading:Q(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Q(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:l},e.defaultValues&&!Q(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:u,...g}=or(e);t.current={...g,formState:l}}const n=t.current.control;return n._options=e,Hs(()=>{const u=n._subscribe({formState:n._proxyFormState,callback:()=>d({...n._formState}),reRenderRoot:!0});return d(g=>({...g,isReady:!0})),n._formState.isReady=!0,u},[n]),$.useEffect(()=>n._disableForm(e.disabled),[n,e.disabled]),$.useEffect(()=>{e.mode&&(n._options.mode=e.mode),e.reValidateMode&&(n._options.reValidateMode=e.reValidateMode)},[n,e.mode,e.reValidateMode]),$.useEffect(()=>{e.errors&&(n._setErrors(e.errors),n._focusError())},[n,e.errors]),$.useEffect(()=>{e.shouldUnregister&&n._subjects.state.next({values:n._getWatch()})},[n,e.shouldUnregister]),$.useEffect(()=>{if(n._proxyFormState.isDirty){const u=n._getDirty();u!==l.isDirty&&n._subjects.state.next({isDirty:u})}},[n,l.isDirty]),$.useEffect(()=>{var u;e.values&&!ae(e.values,s.current)?(n._reset(e.values,{keepFieldsRef:!0,...n._options.resetOptions}),!((u=n._options.resetOptions)===null||u===void 0)&&u.keepIsValid||n._setValid(),s.current=e.values,d(g=>({...g}))):n._resetDefaultValues()},[n,e.values]),$.useEffect(()=>{n._state.mount||(n._setValid(),n._state.mount=!0),n._state.watch&&(n._state.watch=!1,n._subjects.state.next({...n._formState})),n._removeUnmounted()}),t.current.formState=$.useMemo(()=>$s(l,n),[n,l]),t.current}const cr=({form:e})=>{const t=e.formState.errors;return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["ìì²´ìíì½ë ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{...e.register("company_goods_cd",{required:"íì ì
ë ¥ í목ì
ëë¤.",maxLength:{value:30,message:"ìµë 30ìê¹ì§ ì
ë ¥ ê°ë¥í©ëë¤."}}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"ì: PROD-001"}),t.company_goods_cd&&a.jsx("p",{className:"text-red-500 text-sm mt-1",children:t.company_goods_cd.message})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["ìíëª
",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{...e.register("goods_nm",{required:"íì ì
ë ¥ í목ì
ëë¤.",maxLength:{value:100,message:"ìµë 100ìê¹ì§ ì
ë ¥ ê°ë¥í©ëë¤."}}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"ì: ì¬ë¼ì´ë© ì ë°"}),t.goods_nm&&a.jsx("p",{className:"text-red-500 text-sm mt-1",children:t.goods_nm.message})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["ìíêµ¬ë¶ ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("select",{...e.register("goods_gubun",{required:"íì ì í í목ì
ëë¤."}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:de.goods_gubun.map(s=>a.jsx("option",{value:s.value,children:s.label},s.value))})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["ìì°ì§ ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{...e.register("origin",{required:"íì ì
ë ¥ í목ì
ëë¤."}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"ì: ëí민êµ"})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["ëë¶ë¥ ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsxs("select",{...e.register("class_cd1",{required:"íì ì í í목ì
ëë¤."}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[a.jsx("option",{value:"",children:"ì ííì¸ì"}),De.class_cd1.map(s=>a.jsx("option",{value:s.value,children:s.label},s.value))]})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["ì¤ë¶ë¥ ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsxs("select",{...e.register("class_cd2",{required:"íì ì í í목ì
ëë¤."}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[a.jsx("option",{value:"",children:"ì ííì¸ì"}),De.class_cd2.map(s=>a.jsx("option",{value:s.value,children:s.label},s.value))]})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["ìë¶ë¥ ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsxs("select",{...e.register("class_cd3",{required:"íì ì í í목ì
ëë¤."}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[a.jsx("option",{value:"",children:"ì ííì¸ì"}),De.class_cd3.map(s=>a.jsx("option",{value:s.value,children:s.label},s.value))]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["ìì¦ ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("select",{...e.register("goods_season",{required:"íì ì í í목ì
ëë¤."}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:de.goods_season.map(s=>a.jsx("option",{value:s.value,children:s.label},s.value))})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["ë¨ë
êµ¬ë¶ ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("select",{...e.register("sex",{required:"íì ì í í목ì
ëë¤."}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:de.sex.map(s=>a.jsx("option",{value:s.value,children:s.label},s.value))})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["ìíìí ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("select",{...e.register("status",{required:"íì ì í í목ì
ëë¤."}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:de.status.map(s=>a.jsx("option",{value:s.value,children:s.label},s.value))})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["ì¸ê¸êµ¬ë¶ ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("select",{...e.register("tax_yn",{required:"íì ì í í목ì
ëë¤."}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:de.tax_yn.map(s=>a.jsx("option",{value:s.value,children:s.label},s.value))})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["ë°°ì¡ë¹êµ¬ë¶ ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("select",{...e.register("delv_type",{required:"íì ì í í목ì
ëë¤."}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:de.delv_type.map(s=>a.jsx("option",{value:s.value,children:s.label},s.value))})]})]})]})},ur=({form:e})=>{const t=e.formState.errors;return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["ìê° ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsxs("div",{className:"relative",children:[a.jsx("input",{type:"number",...e.register("goods_cost",{required:"íì ì
ë ¥ í목ì
ëë¤.",min:{value:0,message:"0 ì´ìì ê°ì ì
ë ¥íì¸ì."},valueAsNumber:!0}),className:"w-full px-3 py-2 pr-10 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"0"}),a.jsx("span",{className:"absolute right-3 top-2 text-gray-500",children:"ì"})]}),t.goods_cost&&a.jsx("p",{className:"text-red-500 text-sm mt-1",children:t.goods_cost.message})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["íë§¤ê° ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsxs("div",{className:"relative",children:[a.jsx("input",{type:"number",...e.register("goods_price",{required:"íì ì
ë ¥ í목ì
ëë¤.",min:{value:0,message:"0 ì´ìì ê°ì ì
ë ¥íì¸ì."},valueAsNumber:!0}),className:"w-full px-3 py-2 pr-10 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"0"}),a.jsx("span",{className:"absolute right-3 top-2 text-gray-500",children:"ì"})]}),t.goods_price&&a.jsx("p",{className:"text-red-500 text-sm mt-1",children:t.goods_price.message})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["ìë¹ìê° ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsxs("div",{className:"relative",children:[a.jsx("input",{type:"number",...e.register("goods_consumer_price",{required:"íì ì
ë ¥ í목ì
ëë¤.",min:{value:0,message:"0 ì´ìì ê°ì ì
ë ¥íì¸ì."},valueAsNumber:!0}),className:"w-full px-3 py-2 pr-10 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"0"}),a.jsx("span",{className:"absolute right-3 top-2 text-gray-500",children:"ì"})]}),t.goods_consumer_price&&a.jsx("p",{className:"text-red-500 text-sm mt-1",children:t.goods_consumer_price.message})]})]}),a.jsxs("div",{className:"bg-gray-50 rounded-lg p-4",children:[a.jsx("h3",{className:"text-sm font-medium text-gray-700 mb-2",children:"ê°ê²© ì¤ì ìë´"}),a.jsxs("ul",{className:"text-sm text-gray-600 space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"ìê°: ì íì ìê°ë¥¼ ì
ë ¥íì¸ì."}),a.jsx("li",{children:"í매ê°: ì¤ì í매í ê°ê²©ì ì
ë ¥íì¸ì."}),a.jsx("li",{children:"ìë¹ìê°: ìë¹ììê² íìëë ê¶ì¥ ìë¹ì ê°ê²©ì ì
ë ¥íì¸ì."}),a.jsx("li",{children:"모ë ê°ê²©ì ì ë¨ìë¡ ì
ë ¥íë©°, 0 ì´ìì ê°ì´ì´ì¼ í©ëë¤."})]})]})]})},fr=({form:e})=>{const t=e.formState.errors,s=e.watch("img_path"),l=e.watch("img_path1"),d=e.watch("img_path3"),[n,u]=ue.useState({img_path:!1,img_path1:!1,img_path3:!1}),g=async(F,v)=>{try{if(u({...n,[v]:!0}),!F.type.startsWith("image/")){ee.warning("ì´ë¯¸ì§ íì¼ë§ ì
ë¡ë ê°ë¥í©ëë¤.");return}if(F.size>5*1024*1024){ee.warning("íì¼ í¬ê¸°ë 5MB ì´íì¬ì¼ í©ëë¤.");return}const j=Date.now(),y=F.name.split(".").pop(),E=`sabangnet/products/${j}_${v}.${y}`,{data:C,error:I}=await ge.storage.from("topping").upload(E,F,{cacheControl:"3600",upsert:!1});if(I)throw I;const{data:q}=ge.storage.from("topping").getPublicUrl(E);e.setValue(v,q.publicUrl)}catch(j){console.error("Image upload error:",j),ee.error("ì´ë¯¸ì§ ì
ë¡ë ì¤í¨: "+j.message)}finally{u({...n,[v]:!1})}},R=F=>{e.setValue(F,"")},M=(F,v,j)=>a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:[v," ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("input",{type:"file",accept:"image/*",onChange:y=>{const E=y.target.files?.[0];E&&g(E,F)},className:"hidden",id:`file-${F}`,disabled:n[F]}),a.jsxs("label",{htmlFor:`file-${F}`,className:`inline-flex items-center px-4 py-2 border border-gray-300 rounded-lg text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 cursor-pointer ${n[F]?"opacity-50 cursor-not-allowed":""}`,children:[a.jsx(Is,{className:"w-4 h-4 mr-2"}
1),n[F]?"ì
ë¡ë ì¤...":"íì¼ ì í"]}),a.jsx("span",{className:"ml-3 text-sm text-gray-500",children:"ëë URLì ì§ì ì
ë ¥íì¸ì"})]}),a.jsx("input",{...e.register(F,{required:"íì ì
ë ¥ í목ì
ëë¤."}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"https://example.com/image.jpg"}),t[F]&&a.jsx("p",{className:"text-red-500 text-sm",children:t[F]?.message}),j&&a.jsxs("div",{className:"relative border border-gray-200 rounded-lg p-3 inline-block",children:[a.jsx("button",{type:"button",onClick:()=>R(F),className:"absolute top-1 right-1 p-1 bg-red-500 text-white rounded-full hover:bg-red-600",children:a.jsx(Ds,{className:"w-4 h-4"})}),a.jsx("img",{src:j,alt:v,className:"max-w-xs h-auto rounded",onError:y=>{const E=y.target;E.style.display="none"}})]})]})]});return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 mb-6",children:[a.jsx("h3",{className:"text-sm font-medium text-blue-800 mb-2",children:"ì´ë¯¸ì§ ì
ë¡ë ìë´"}),a.jsxs("ul",{className:"text-sm text-blue-700 space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"íì¼ì ì§ì ì
ë¡ëíê±°ë URLì ì
ë ¥í ì ììµëë¤."}),a.jsx("li",{children:"ìµë íì¼ í¬ê¸°: 5MB"}),a.jsx("li",{children:"ì§ì í¬ë§·: JPG, PNG, GIF, WebP"})]})]}),a.jsxs("div",{className:"space-y-6",children:[M("img_path","ëíì´ë¯¸ì§",s),M("img_path1","ì¢
í©ëª°(JPG) ì´ë¯¸ì§",l),M("img_path3","11ë²ê° ì´ë¯¸ì§",d)]}),a.jsxs("div",{className:"bg-gray-50 rounded-lg p-4",children:[a.jsxs("h3",{className:"text-sm font-medium text-gray-700 mb-2 flex items-center",children:[a.jsx(Cs,{className:"w-4 h-4 mr-2"}),"ì´ë¯¸ì§ ê°ì´ëë¼ì¸"]}),a.jsxs("ul",{className:"text-sm text-gray-600 space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"ê¶ì¥ ì´ë¯¸ì§ í¬ê¸°: 800x800px ì´ì"}),a.jsx("li",{children:"ì§ì í¬ë§·: JPG, PNG"}),a.jsx("li",{children:"ë°°ê²½: í°ì ëë í¬ëª
ë°°ê²½ ê¶ì¥"}),a.jsx("li",{children:"ìíì´ ëª
ííê² ë³´ì´ëë¡ ì´¬ì"})]})]})]})},kr=()=>{const e=Vs(),t=Fs(),l=As().id,[d]=ks(),n=t.state?.returnUrl||"/admin/sabangnet-products",[u,g]=Ss("basic"),[R,M]=ue.useState(!1),[F,v]=ue.useState(!1),[j,y]=ue.useState(!1),E=!!l,C=d.get("copyFrom");Ps(!E&&C?"ì¬ë°©ë· ìí ë³µì¬":null),ue.useEffect(()=>{(async()=>{const{data:{user:A},error:P}=await ge.auth.getUser();P&&console.error("Auth error:",P)})()},[]);const I=dr({defaultValues:{company_goods_cd:"",goods_nm:"",goods_gubun:"2",class_cd1:"",class_cd2:"",class_cd3:"",origin:"ëí민êµ",goods_season:"7",sex:"4",status:"1",tax_yn:"1",delv_type:"1",goods_cost:0,goods_price:0,goods_consumer_price:0,img_path:"",img_path1:"",img_path3:""}});ue.useEffect(()=>{(async()=>{if(!(!l&&!C))try{M(!0);const A=l||C,P=await ge.from("sbn_products").select("*").eq("id",A).single();if(P.error)throw P.error;const b=P.data;I.reset({company_goods_cd:C?"":b.company_goods_cd,goods_nm:b.goods_nm,goods_gubun:b.goods_gubun,class_cd1:b.class_cd1,class_cd2:b.class_cd2,class_cd3:b.class_cd3,origin:b.origin,goods_season:b.goods_season,sex:b.sex,status:b.status,tax_yn:b.tax_yn,delv_type:b.delv_type,goods_cost:b.goods_cost,goods_price:b.goods_price,goods_consumer_price:b.goods_consumer_price,img_path:b.img_path,img_path1:b.img_path1,img_path3:b.img_path3})}catch(A){ee.error("ë°ì´í° ë¡ë ì¤í¨: "+A.message),e(n)}finally{M(!1)}})()},[l,C,I,e]);const q=async(k,A=!1)=>{try{v(!0);let P=l;if(E&&l){const b=await ge.from("sbn_products").update(k).eq("id",l).select();if(b.error)throw console.error("Update error:",b.error),b.error;ee.success("ìì ëììµëë¤.")}else{const b=await ge.from("sbn_products").insert([k]).select();if(b.error)throw console.error("Insert error:",b.error),b.error;P=b.data?.[0]?.id,ee.success("ë±ë¡ëììµëë¤.")}if(A&&P){y(!0);try{const b=await Es(P);b.success?ee.success(b.message):ee.error(`ì ì¡ ì¤í¨: ${b.message}`)}catch(b){ee.error(`ì ì¡ ì¤ ì¤ë¥ ë°ì: ${b instanceof Error?b.message:"ì ì ìë ì¤ë¥"}`)}finally{y(!1)}}e(n)}catch(P){console.error("Save error:",P),ee.error("ì ì¥ ì¤í¨: "+P.message)}finally{v(!1)}},_=[{id:"basic",label:"기본 ì ë³´"},{id:"price",label:"ê°ê²© ì ë³´"},{id:"image",label:"ì´ë¯¸ì§"}];if(R)return a.jsx("div",{className:"p-6",children:a.jsx("div",{className:"bg-white rounded-lg shadow p-12 text-center text-gray-500",children:"ë¡ë© ì¤..."})});const X=E?"ìí ìì ":C?"ìí ë³µì¬":"ìí ë±ë¡";return a.jsxs("div",{className:"p-6",children:[a.jsx("div",{className:"mb-6 flex items-center justify-between",children:a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsx("button",{onClick:()=>e(n),className:"p-2 hover:bg-gray-100 rounded-lg",children:a.jsx(Ts,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:X}),a.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"ì¬ë°©ë· ì°ë ìí ì 보를 ì
ë ¥íì¸ì."})]})]})}),a.jsxs("form",{onSubmit:I.handleSubmit(k=>q(k,!1)),children:[a.jsxs("div",{className:"bg-white rounded-lg shadow mb-4",children:[a.jsx("div",{className:"border-b border-gray-200",children:a.jsx("nav",{className:"flex space-x-8 px-6",children:_.map(k=>{const P=u===k.id?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300";return a.jsx("button",{type:"button",onClick:()=>g(k.id),className:"py-4 px-1 border-b-2 font-medium text-sm "+P,children:k.label},k.id)})})}),a.jsxs("div",{className:"p-6",children:[u==="basic"&&a.jsx(cr,{form:I}),u==="price"&&a.jsx(ur,{form:I}),u==="image"&&a.jsx(fr,{form:I})]})]}),a.jsxs("div",{className:"flex justify-end space-x-3",children:[a.jsx("button",{type:"button",onClick:()=>e(n),className:"px-6 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50",children:"ì·¨ì"}),a.jsxs("button",{type:"submit",disabled:F||j,className:"flex items-center px-6 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:bg-gray-400 disabled:cursor-not-allowed",children:[a.jsx(Os,{className:"w-4 h-4 mr-2"}),F?"ì ì¥ ì¤...":"ì ì¥"]}),a.jsx("button",{type:"button",onClick:()=>I.handleSubmit(k=>q(k,!0))(),disabled:F||j,className:"flex items-center px-6 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 disabled:bg-gray-400 disabled:cursor-not-allowed",children:j?a.jsxs(a.Fragment,{children:[a.jsx(Ls,{className:"w-4 h-4 mr-2 animate-spin"}),"ì ì¡ ì¤..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Us,{className:"w-4 h-4 mr-2"}),"ì ì¥ í ì ì¡"]})})]})]})]})};export{kr as SabangnetProductFormPage};
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.