(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,15288,e=>{"use strict";var a=e.i(43476),s=e.i(71645),t=e.i(75157);let r=s.forwardRef(({className:e,...s},r)=>(0,a.jsx)("div",{ref:r,className:(0,t.cn)("rounded-xl border border-slate-200 bg-white text-slate-950 shadow-sm",e),...s}));r.displayName="Card";let l=s.forwardRef(({className:e,...s},r)=>(0,a.jsx)("div",{ref:r,className:(0,t.cn)("flex flex-col space-y-1.5 p-6",e),...s}));l.displayName="CardHeader";let i=s.forwardRef(({className:e,...s},r)=>(0,a.jsx)("h3",{ref:r,className:(0,t.cn)("font-semibold leading-none tracking-tight",e),...s}));i.displayName="CardTitle";let d=s.forwardRef(({className:e,...s},r)=>(0,a.jsx)("p",{ref:r,className:(0,t.cn)("text-sm text-slate-500",e),...s}));d.displayName="CardDescription";let n=s.forwardRef(({className:e,...s},r)=>(0,a.jsx)("div",{ref:r,className:(0,t.cn)("p-6 pt-0",e),...s}));n.displayName="CardContent",s.forwardRef(({className:e,...s},r)=>(0,a.jsx)("div",{ref:r,className:(0,t.cn)("flex items-center p-6 pt-0",e),...s})).displayName="CardFooter",e.s(["Card",0,r,"CardContent",0,n,"CardDescription",0,d,"CardHeader",0,l,"CardTitle",0,i])},56522,e=>{"use strict";let a=(0,e.i(56420).default)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);e.s(["Save",0,a],56522)},11241,e=>{"use strict";let a=(0,e.i(56420).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["ArrowLeft",0,a],11241)},22853,e=>{"use strict";var a=e.i(43476),s=e.i(71645),t=e.i(18566),r=e.i(19455),l=e.i(15288),i=e.i(93479),d=e.i(5766),n=e.i(11241),c=e.i(56522),o=e.i(22016);e.s(["default",0,function(){let e=(0,t.useRouter)(),[m,h]=(0,s.useState)(!1),[x,u]=(0,s.useState)({name:"",slug:"",description:""}),p=async a=>{a.preventDefault(),h(!0);try{if(!(await fetch("/api/categories",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)})).ok)throw Error("Failed to create category");d.default.success("Category created successfully!"),e.push("/admin/categories"),e.refresh()}catch(e){d.default.error(e.message||"Something went wrong")}finally{h(!1)}};return(0,a.jsxs)("div",{className:"max-w-2xl mx-auto space-y-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsx)(r.Button,{variant:"ghost",size:"icon",asChild:!0,className:"shrink-0",children:(0,a.jsx)(o.default,{href:"/admin/categories",children:(0,a.jsx)(n.ArrowLeft,{className:"w-5 h-5"})})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:"Add Category"}),(0,a.jsx)("p",{className:"text-sm text-slate-500",children:"Create a new product category."})]})]}),(0,a.jsx)("form",{onSubmit:p,children:(0,a.jsxs)(l.Card,{children:[(0,a.jsxs)(l.CardHeader,{children:[(0,a.jsx)(l.CardTitle,{children:"Category Details"}),(0,a.jsx)(l.CardDescription,{children:"Basic information for the category."})]}),(0,a.jsxs)(l.CardContent,{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("label",{className:"text-sm font-medium leading-none",children:"Name"}),(0,a.jsx)(i.Input,{required:!0,value:x.name,onChange:e=>{let a=e.target.value;u({...x,name:a,slug:a.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)+/g,"")})},placeholder:"e.g. Toothbrushes"})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("label",{className:"text-sm font-medium leading-none",children:"Slug"}),(0,a.jsx)(i.Input,{required:!0,value:x.slug,onChange:e=>u({...x,slug:e.target.value}),placeholder:"e.g. toothbrushes"}),(0,a.jsx)("p",{className:"text-[0.8rem] text-slate-500",children:"The URL friendly name. Generated automatically."})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("label",{className:"text-sm font-medium leading-none",children:"Description"}),(0,a.jsx)("textarea",{className:"flex min-h-[80px] w-full rounded-md border border-slate-200 bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-slate-500 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-indigo-500",value:x.description,onChange:e=>u({...x,description:e.target.value}),placeholder:"Category description (optional)"})]}),(0,a.jsx)("div",{className:"pt-4 flex justify-end",children:(0,a.jsxs)(r.Button,{type:"submit",disabled:m,className:"gap-2 bg-indigo-600 hover:bg-indigo-700",children:[(0,a.jsx)(c.Save,{className:"w-4 h-4"})," ",m?"Saving...":"Save Category"]})})]})]})})]})}])}]);