1/*! For license information please see 9247.06a97fcc.chunk.js.LICENSE.txt */ 2"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[9247],{797(e,t,a){a.d(t,{A:()=>s});const s=(0,a(7784).A)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]])},1360(e,t,a){a.d(t,{A:()=>s});const s=(0,a(7784).A)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},2024(e,t,a){a.d(t,{A:()=>s});const s=(0,a(7784).A)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},3883(e,t,a){a.d(t,{$:()=>s,_:()=>r});const s=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const t=new Set;return e.filter(e=>{const a=(e.title||e.categorytitle||"").trim();return!(!a||t.has(a))&&(t.add(a),!0)})},r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const t=new Map;for(const s of e){const e=(s.title||s.categorytitle||"").trim().toLowerCase();if(!e)continue;const a=Number(s.productCount||0),r=t.get(e);(!r||a>Number(r.productCount||0))&&t.set(e,s)}const a=new Set([...t.values()].map(e=>e.id||e._id));return e.filter(e=>a.has(e.id||e._id))}},5884(){},6210(e,t,a){a.d(t,{A:()=>s});const s=(0,a(7784).A)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},7097(e,t,a){a.d(t,{n:()=>w});var s,r,i,l,n,o=a(9379),c=a(5043),d=a(9790),p=a(5149),x=a(8458),u=a(6562),g=a(4558),m=a(5239),h=a(1454),b=a(329),y=a(9723),f=(s=new WeakMap,r=new WeakMap,i=new WeakMap,l=new WeakMap,n=new WeakSet,class extends b.Q{constructor(e,t){super(),(0,d.A)(this,n),(0,p.A)(this,s,void 0),(0,p.A)(this,r,void 0),(0,p.A)(this,i,void 0),(0,p.A)(this,l,void 0),(0,g.A)(s,this,e),this.setOptions(t),this.bindMethods(),(0,u.A)(n,this,v).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){var t;const a=this.options;this.options=(0,x.A)(s,this).defaultMutationOptions(e),(0,y.f8)(this.options,a)||(0,x.A)(s,this).getMutationCache().notify({type:"observerOptionsUpdated",mutation:(0,x.A)(i,this),observer:this}),null!==a&&void 0!==a&&a.mutationKey&&this.options.mutationKey&&(0,y.EN)(a.mutationKey)!==(0,y.EN)(this.options.mutationKey)?this.reset():"pending"===(null===(t=(0,x.A)(i,this))||void 0===t?void 0:t.state.status)&&(0,x.A)(i,this).setOptions(this.options)}onUnsubscribe(){var e;this.hasListeners()||(null===(e=(0,x.A)(i,this))||void 0===e||e.removeObserver(this))}onMutationUpdate(e){(0,u.A)(n,this,v).call(this),(0,u.A)(n,this,j).call(this,e)}getCurrentResult(){return(0,x.A)(r,this)}reset(){var e;null===(e=(0,x.A)(i,this))||void 0===e||e.removeObserver(this),(0,g.A)(i,this,void 0),(0,u.A)(n,this,v).call(this),(0,u.A)(n,this,j).call(this)}mutate(e,t){var a;return(0,g.A)(l,this,t),null===(a=(0,x.A)(i,this))||void 0===a||a.removeObserver(this),(0,g.A)(i,this,(0,x.A)(s,this).getMutationCache().build((0,x.A)(s,this),this.options)),(0,x.A)(i,this).addObserver(this),(0,x.A)(i,this).execute(e)}});function v(){var e,t;const a=null!==(e=null===(t=(0,x.A)(i,this))||void 0===t?void 0:t.state)&&void 0!==e?e:(0,m.$)();(0,g.A)(r,this,(0,o.A)((0,o.A)({},a),{},{isPending:"pending"===a.status,isSuccess:"success"===a.status,isError:"error"===a.status,isIdle:"idle"===a.status,mutate:this.mutate,reset:this.reset}))}function j(e){h.jG.batch(()=>{if((0,x.A)(l,this)&&this.hasListeners()){const g=(0,x.A)(r,this).variables,m=(0,x.A)(r,this).context,h={client:(0,x.A)(s,this),meta:this.options.meta,mutationKey:this.options.mutationKey};if("success"===(null===e||void 0===e?void 0:e.type)){try{var t,a;null===(t=(a=(0,x.A)(l,this)).onSuccess)||void 0===t||t.call(a,e.data,g,m,h)}catch(u){Promise.reject(u)}try{var i,n;null===(i=(n=(0,x.A)(l,this)).onSettled)||void 0===i||i.call(n,e.data,null,g,m,h)}catch(u){Promise.reject(u)}}else if("error"===(null===e||void 0===e?void 0:e.type)){try{var o,c;null===(o=(c=(0,x.A)(l,this)).onError)||void 0===o||o.call(c,e.error,g,m,h)}catch(u){Promise.reject(u)}try{var d,p;null===(d=(p=(0,x.A)(l,this)).onSettled)||void 0===d||d.call(p,void 0,e.error,g,m,h)}catch(u){Promise.reject(u)}}}
2this.listeners.forEach(e=>{e((0,x.A)(r,this))})})}var N=a(3248);function w(e,t){const a=(0,N.jE)(t),[s]=c.useState(()=>new f(a,e));c.useEffect(()=>{s.setOptions(e)},[s,e]);const r=c.useSyncExternalStore(c.useCallback(e=>s.subscribe(h.jG.batchCalls(e)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),i=c.useCallback((e,t)=>{s.mutate(e,t).catch(y.lQ)},[s]);if(r.error&&(0,y.GU)(s.options.throwOnError,[r.error]))throw r.error;return(0,o.A)((0,o.A)({},r),{},{mutate:i,mutateAsync:r.mutate})}},9247(e,t,a){a.r(t),a.d(t,{default:()=>N});var s=a(9379),r=a(5043),i=a(2024),l=a(6210),n=a(2382),o=a(1360),c=a(797),d=a(614),p=a(2339),x=a(7874),u=a(8555),g=a.n(u),m=(a(5884),a(3046)),h=a(2532),b=a(7097),y=a(9502),f=a(3883),v=a(579);const j=[{id:1,label:"Author"},{id:2,label:"Editor"},{id:3,label:"Translator"},{id:4,label:"Introduction"},{id:5,label:"Foreword"},{id:6,label:"Photography"},{id:7,label:"Compiler"},{id:8,label:"Collaborator"},{id:9,label:"Curator"}],N=()=>{var e;const t=(0,x.Zp)(),a=(0,r.useRef)(null),[u,N]=(0,r.useState)(null),[w,_]=(0,r.useState)([]),[A,k]=(0,r.useState)(null),[C,S]=(0,r.useState)(null),[P,z]=(0,r.useState)(null),[L,D]=(0,r.useState)([]),[O,E]=(0,r.useState)([]),[M,F]=(0,r.useState)([]),[R,T]=(0,r.useState)(""),[I,U]=(0,r.useState)(""),[B,W]=(0,r.useState)(""),[q,K]=(0,r.useState)(""),[$,J]=(0,r.useState)(!1),[G,Q]=(0,r.useState)(!1),[H,V]=(0,r.useState)([]),[Y,Z]=(0,r.useState)(""),[X,ee]=(0,r.useState)(""),[te,ae]=(0,r.useState)(!1),[se,re]=(0,r.useState)([]),[ie,le]=(0,r.useState)(""),[ne,oe]=(0,r.useState)(!1),[ce,de]=(0,r.useState)([]),[pe,xe]=(0,r.useState)(""),[ue,ge]=(0,r.useState)(!1),[me,he]=(0,r.useState)({}),[be,ye]=(0,r.useState)({}),[fe,ve]=(0,r.useState)([]),[je,Ne]=(0,r.useState)(!1),[we,_e]=(0,r.useState)([]),[Ae,ke]=(0,r.useState)(""),[Ce,Se]=(0,r.useState)(!1),[Pe,ze]=(0,r.useState)([]),[Le,De]=(0,r.useState)(""),[Oe,Ee]=(0,r.useState)(!1),[Me,Fe]=(0,r.useState)([]),[Re,Te]=(0,r.useState)(""),[Ie,Ue]=(0,r.useState)(!1),[Be,We]=(0,r.useState)({}),[qe,Ke]=(0,r.useState)([]),[$e,Je]=(0,r.useState)(!1),Ge=(0,r.useRef)(null),Qe=(0,r.useRef)(null),[He,Ve]=(0,r.useState)(""),[Ye,Ze]=(0,r.useState)([]),[Xe,et]=(0,r.useState)(!1),[tt,at]=(0,r.useState)(!1),[st,rt]=(0,r.useState)([]),[it,lt]=(0,r.useState)(!1),[nt,ot]=(0,r.useState)({first_name:"",last_name:"",origin:""}),[ct,dt]=(0,r.useState)(""),[pt,xt]=(0,r.useState)(null),[ut,gt]=(0,r.useState)(!1),[mt,ht]=(0,r.useState)({title:""}),[bt,yt]=(0,r.useState)((new Date).toISOString().split("T")[0]),[ft,vt]=(0,r.useState)(30),[jt,Nt]=(0,r.useState)(!1),[wt,_t]=(0,r.useState)(null),[At,kt]=(0,r.useState)(null),[Ct,St]=(0,r.useState)({category:"",title:"",company:"",address:"",place:"",email:"",phone:"",fax:"",date:"",order:"",show:"",slug:"",ship_in_days:""}),[Pt,zt]=(0,r.useState)({title:"",leading_category:"",product_categories:[],product_languages:[],product_tags:[],product_formats:[],related_products:"",authors_search:"",authors:[],volume:"",edition:"",isbn10:"",isbn13:"",total_pages:"",weight:"",price:"",real_price:"",inr_price:"",discount:"",bagchee_id:"",stock:"active",availability:"",notes:"",meta_title:"",meta_keywords:"",meta_description:"",active:"active",recommended:"inactive",upcoming:"inactive",upcoming_date:"",new_release:"active",exclusive:"inactive",series:[],series_number:"",publisher:"",ship_days:"",deliver_days:"",pub_date:"",source:"",rating:"",rated_times:"",new_release_until:(()=>{const e=new Date;
2return e.setDate(e.getDate()+120),e.toISOString().split("T")[0]})()}),{data:Lt,isLoading:Dt}=(0,h.I)({queryKey:["addBookMasterData"],queryFn:async()=>{const e="https://www.bagchee.com/api",[t,a,s,r,i,l,n,o]=await Promise.all([m.A.get("".concat(e,"/category/fetch?withCounts=true&withProducts=true")),m.A.get("".concat(e,"/languages/list")),m.A.get("".concat(e,"/tags/list?limit=1000")),m.A.get("".concat(e,"/authors/list?limit=200")),m.A.get("".concat(e,"/formats/list")),m.A.get("".concat(e,"/series/list?limit=1000")),m.A.get("".concat(e,"/publishers/list?limit=1000")),m.A.get("".concat(e,"/settings/list")).catch(()=>({data:{status:!1,data:[]}}))]);return{categories:t.data.data||[],languages:a.data.data||[],tags:s.data.data||[],authors:r.data.data||[],formats:i.data.data||[],series:l.data.data||[],publishers:n.data.data||[],arrivalDays:o.data.status&&o.data.data.length>0&&(o.data.data[0].newArrivalTime||o.data.data[0].new_arrival_time)||30}},staleTime:6e5});(0,r.useEffect)(()=>{if(Lt){_(Lt.categories),V(Lt.languages),re(Lt.tags),de(Lt.authors),_e(Lt.formats),ze(Lt.series),Fe(Lt.publishers),vt(Lt.arrivalDays);const e=new Date;e.setDate(e.getDate()+Number(Lt.arrivalDays||120));const t=e.toISOString().split("T")[0];zt(e=>(0,s.A)((0,s.A)({},e),{},{new_release_until:t})),yt(t)}},[Lt]);const Ot=(0,b.n)({mutationFn:async e=>(await m.A.post("".concat("https://www.bagchee.com/api","/product/save"),e,{headers:{"Content-Type":"multipart/form-data"}})).data}),Et=(0,b.n)({mutationFn:async e=>(await m.A.post("".concat("https://www.bagchee.com/api","/authors/save"),e)).data}),Mt=(0,b.n)({mutationFn:async e=>(await m.A.post("".concat("https://www.bagchee.com/api","/publishers/save"),e)).data}),Ft=(0,b.n)({mutationFn:async e=>(await m.A.post("".concat("https://www.bagchee.com/api","/series/save"),e)).data});(0,r.useEffect)(()=>{if("active"===Pt.new_release&&bt){const e=new Date(bt);e.setDate(e.getDate()+Number(ft));const t=e.toISOString().split("T")[0];zt(e=>(0,s.A)((0,s.A)({},e),{},{new_release_until:t}))}},[bt,Pt.new_release,ft]);const Rt=e=>{if("active"===e.target.value){const e=bt||(new Date).toISOString().split("T")[0];zt((0,s.A)((0,s.A)({},Pt),{},{new_release:"active",new_release_until:e})),yt(e)}else zt((0,s.A)((0,s.A)({},Pt),{},{new_release:"inactive",new_release_until:""})),yt("")},Tt=e=>{zt((0,s.A)((0,s.A)({},Pt),{},{[e.target.name]:e.target.value}))},It=(e,t)=>
2{zt(a=>{const r=a[e]||[];return r.includes(t)?(0,s.A)((0,s.A)({},a),{},{[e]:r.filter(e=>e!==t)}):(0,s.A)((0,s.A)({},a),{},{[e]:[...r,t]})})},Ut=e=>{e(e=>[...e,{id:Date.now(),file:null,order:e.length+1}])},Bt=(e,t)=>{e(e=>e.filter(e=>e.id!==t))},Wt=(e,t,a,r)=>{a&&((0,y.$)(a)?e(e=>e.map(e=>e.id===t?(0,s.A)((0,s.A)({},e),{},{file:a}):e)):r&&(r.target.value=""))},qt=(e,t,a)=>{e(e=>e.map(e=>e.id===t?(0,s.A)((0,s.A)({},e),{},{order:a}):e))},Kt=(e,a)=>{if(e.preventDefault(),!Pt.title||!Pt.price)return p.Ay.error("Title and Price are required!");if(!Pt.leading_category)return p.Ay.error("Please select a Category!");const s=p.Ay.loading("Saving book details..."),r=new FormData;if(r.append("title",Pt.title),r.append("price",Pt.price),r.append("real_price",Pt.real_price||""),r.append("inr_price",Pt.inr_price),r.append("discount",Pt.discount||""),r.append("isbn13",Pt.isbn13||""),r.append("isbn10",Pt.isbn10||""),r.append("leading_category",Pt.leading_category),r.append("language",Pt.language||"English"),r.append("pages",Pt.total_pages||""),r.append("weight",Pt.weight||""),r.append("edition",Pt.edition||""),r.append("volume",Pt.volume||""),r.append("active",Pt.active),r.append("recommended",Pt.recommended),r.append("upcoming",Pt.upcoming),r.append("upcoming_date",Pt.upcoming_date||""),r.append("new_release",Pt.new_release),r.append("new_release_until",Pt.new_release_until||""),r.append("exclusive",Pt.exclusive),r.append("stock",Pt.stock),r.append("availability",Pt.availability||""),r.append("notes",Pt.notes||""),r.append("ship_days",Pt.ship_days||""),r.append("deliver_days",Pt.deliver_days||""),r.append("pub_date",Pt.pub_date||""),r.append("source",Pt.source||""),r.append("rating",Pt.rating||""),r.append("rated_times",Pt.rated_times||""),r.append("related_products",Pt.related_products||""),Pt.authors&&Pt.authors.length>0){const e=Pt.authors[0];r.append("author",e),r.append("author_id",e),r.append("authors",JSON.stringify(Pt.authors)),r.append("author_roles",JSON.stringify(be))}Pt.product_categories&&r.append("product_categories",JSON.stringify(Pt.product_categories)),Pt.product_languages&&r.append("product_languages",JSON.stringify(Pt.product_languages)),Pt.product_tags&&r.append("product_tags",JSON.stringify(Pt.product_tags)),Pt.product_formats&&r.append("product_formats",JSON.stringify(Pt.product_formats)),r.append("bagchee_id",Pt.bagchee_id||""),Pt.series&&r.append("series",Pt.series),Pt.series_number&&r.append("series_number",Pt.series_number),Pt.publisher&&r.append("publisher",Pt.publisher),r.append("meta_title",Pt.meta_title||""),r.append("meta_description",Pt.meta_description||""),r.append("meta_keywords",Pt.meta_keywords||""),r.append("synopsis",R||""),r.append("critics_note",I||""),r.append("search_text",B||""),u&&r.append("default_image",u),C&&r.append("toc_image",C),L.forEach(e=>{e.file&&(r.append("toc_images",e.file),r.append("toc_images_order",e.order))}),O.forEach(e=>{e.file&&(r.append("related_images",e.file),r.append("related_images_order",e.order))}),M.forEach(e=>{e.file&&(r.append("sample_images",e.file),r.append("sample_images_order",e.order))}),Ot.mutate(r,{onSuccess:e=>{e.status?(p.Ay.success("Book Added Successfully!",{id:s}),"back"===a?t("/admin/books"):window.location.reload()):p.Ay.error(e.msg||"Error saving book",{id:s})},onError:e=>{var t,a,r,i;const l=(null===(t=e.response)||void 0===t||null===(a=t.data)||void 0===a?void 0:a.message)||(null===(r=e.response)||void 0===r||null===(i=r.data)||void 0===i?void 0:i.msg)||"Failed to save book";p.Ay.error(l,{id:s})}})},$t=(0,r.useMemo)(()=>({readonly:!1,placeholder:"Start typing here...",toolbarSticky:!1,theme:"default",buttons:["source","|","bold","italic","underline","strikethrough","|","superscript","subscript","|","brush","eraser","|","ul","ol","|","outdent","indent","|","font","fontsize","brush","paragraph","|","image","table","link","|","align","undo","redo","|","hr","eraser","fullsize","print","about"],height:500}),[]),Jt=e=>{const t=e.id||e._id;zt(e=>(0,s.A)((0,s.A)({},e),{},{publisher:t})),We(a=>(0,s.A)((0,s.A)({},a),{},{[String(t)]:e.title||e.name})),Ue(!1),Te(""),Ke([])};(0,r.useEffect)(()=>{const e=setTimeout(async()=>
2{if(pe.length>1&&ue){Ne(!0);try{const e=await m.A.get("".concat("https://www.bagchee.com/api","/authors/list?q=").concat(encodeURIComponent(pe),"&limit=20"));e.data.status&&ve(e.data.data||[])}catch(e){ve([])}finally{Ne(!1)}}else ve([])},350);return()=>clearTimeout(e)},[pe,ue]),(0,r.useEffect)(()=>{const e=setTimeout(async()=>{if(Re.length>1&&Ie){Je(!0);try{const e=await m.A.get("".concat("https://www.bagchee.com/api","/publishers/list?q=").concat(encodeURIComponent(Re),"&limit=30"));e.data.status&&Ke(e.data.data||[])}catch(e){Ke([])}finally{Je(!1)}}else Ke([])},350);return()=>clearTimeout(e)},[Re,Ie]),(0,r.useEffect)(()=>{const e=setTimeout(async()=>{if(He.length>2&&Xe){at(!0);try{const e="https://www.bagchee.com/api",t=await m.A.get("".concat(e,"/product/fetch?keyword=").concat(He,"&limit=10"));t.data.status&&Ze(t.data.data)}catch(e){console.error(e)}finally{at(!1)}}else Ze([])},500);return()=>clearTimeout(e)},[He,Xe]),(0,r.useEffect)(()=>{if(!Xe)return;const e=e=>{Qe.current&&!Qe.current.contains(e.target)&&et(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[Xe]);(0,r.useEffect)(()=>{const{title:e,isbn10:t,isbn13:a}=Pt,r=a||(t||""),i=e?"".concat(e," ").concat(r?", ".concat(r):""):"",l=e?r?"".concat(r,", ").concat(e):e:"";zt(e=>(0,s.A)((0,s.A)({},e),{},{meta_title:i,meta_description:l}))},[Pt.title,Pt.isbn10,Pt.isbn13]),(0,r.useEffect)(()=>{if(!u)return void k(null);const e=URL.createObjectURL(u);return k(e),()=>URL.revokeObjectURL(e)},[u]);(0,r.useEffect)(()=>{if(!C)return void z(null);const e=URL.createObjectURL(C);return z(e),()=>URL.revokeObjectURL(e)},[C]);const Gt=w.find(e=>(e.id||e._id)===Pt.leading_category),Qt=(0,r.useMemo)(()=>(0,f._)(w),[w]);return(0,r.useEffect)(()=>{const e=Number(Pt.price)||0,t=Number(Pt.discount)||0;if(e>0)if(t>0){const a=e-e*t/100;zt(e=>(0,s.A)((0,s.A)({},e),{},{real_price:Math.round(a)}))}else zt(t=>(0,s.A)((0,s.A)({},t),{},{real_price:e}))},[Pt.price,Pt.discount]),(0,v.jsxs)("div",{className:"bg-gray-50 min-h-screen font-body text-text-main",children:[(0,v.jsx)("div",{className:"bg-primary text-white border-b px-6 py-3 flex justify-between items-center shadow-sm",children:(0,v.jsx)("h1",{className:"text-lg font-bold text-gray-700 uppercase tracking-tight",children:"Add Books"})}),(0,v.jsx)("div",{className:"max-w-6xl mx-auto p-6",children:(0,v.jsx)("div",{className:"bg-white rounded border border-gray-200 shadow-sm overflow-hidden",children:(0,v.jsxs)("div",{className:"p-8 space-y-6",children:[Dt&&(0,v.jsx)("div",{className:"text-center text-primary font-bold text-sm py-4 animate-pulse",children:"Loading application data..."}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight",children:"Title*"}),(0,v.jsx)("div",{className:"col-span-9",children:(0,v.jsx)("input",{name:"title",type:"text",onChange:Tt,className:"theme-input w-full",placeholder:"Enter book title"})})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight",children:"Leading category*"}),(0,v.jsxs)("div",{className:"col-span-9 relative",children:[(0,v.jsxs)("div",{onClick:()=>J(!$),className:"theme-input w-1/2 cursor-pointer flex justify-between items-center bg-white border border-gray-300 rounded p-2 text-sm",children:[(0,v.jsx)("span",{className:Gt?"text-gray-700":"text-gray-400",children:Gt?Gt.title||Gt.categorytitle:"Select category"}),(0,v.jsx)("span",{className:"text-gray-400 text-[10px]",children:"\u25bc"})]}),$&&(0,v.jsxs)("div",{className:"absolute z-50 mt-1 w-1/2 bg-white border border-gray-300 rounded shadow-lg max-h-60 flex flex-col",children:[(0,v.jsx)("div",{className:"p-2 border-b border-gray-100 sticky top-0 bg-white",children:(0,v.jsx)("input",{type:"text",placeholder:"Search...",value:X,onChange:e=>ee(e.target.value),className:"w-full text-xs p-1.5 border border-gray-200 rounded focus:border-primary outline-none",autoFocus:!0})}),(0,v.jsxs)("div",{className:"overflow-y-auto",children:[Qt.filter(e=>(e.title||e.categorytitle||"").toLowerCase().includes(X.toLowerCase())).map(e=>(0,v.jsx)("div",{onClick:()=>{zt((0,s.A)((0,s.A)({},Pt),{},{leading_category:e.id||e._id})),J(!1),ee("")},className:"px-3 py-2 text-sm cursor-pointer hover:bg-blue-50 ".concat(Pt.leading_category===(e.id||e._id)?"bg-blue-50 text-primary font-bold":"text-gray-600"),children:e.title||e.categorytitle},e.id||e.id||e._id)),0===Qt.filter(e=>(e.title||e.categorytitle||"").toLowerCase().includes(X.toLowerCase())).length&&(0,v.jsx)("div",{className:"p-3 text-xs text-gray-400 text-center",children:"No category found"})]})]})]})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-start border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight pt-3",children:"Product categories"}),(0,v.jsxs)("div",{className:"col-span-9 relative",children:[(0,v.jsxs)("div",{className:"border border-gray-300 rounded p-2 bg-white cursor-pointer min-h-[38px] flex flex-wrap gap-2 items-center hover:border-primary transition-colors",onClick:()=>{const e=!G;Q(e),e&&K("")},children:[Pt.product_categories&&Pt.product_categories.length>0?Pt.product_categories.map(e=>{const t=w.find(t=>(t.id||t._id)===e);return t?(0,v.jsxs)("span",{className:"bg-blue-50 text-blue-700 text-[10px] font-bold px-2 py-0.5 rounded border border-blue-100 flex items-center gap-1",children:[t.title||t.categorytitle,(0,v.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),It("product_categories",e)},className:"hover:text-red-500",children:"\xd7"})]},e):null}):(0,v.jsx)("span",{className:"text-gray-400 text-xs",children:"Select categories..."}),(0,v.jsx)("div",{className:"ml-auto text-gray-400 text-[10px]",children:"\u25bc"})]}),G&&(0,v.jsxs)("div",{className:"absolute z-20 top-full left-0 w-full bg-white border border-gray-300 rounded shadow-lg mt-1",children:[(0,v.jsx)("div",{className:"p-2 border-b border-gray-100 bg-gray-50 rounded-t",children:(0,v.jsx)("input",{ref:Ge,type:"text",placeholder:"Search categories...",value:q,onChange:e=>K(e.target.value),onInput:e=>K(e.target.value),onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onContextMenu:e=>e.stopPropagation(),className:"w-full text-xs p-1.5 border border-gray-300 rounded focus:border-primary outline-none bg-white",autoFocus:!0})}),(0,v.jsxs)("div",{className:"max-h-48 overflow-y-auto p-1 scrollbar-thin scrollbar-thumb-gray-300",children:[Qt.filter(e=>(e.title||e.categorytitle||"").toLowerCase().includes(q.toLowerCase())).map(e=>{const t=Pt.product_categories.includes(e.id||e._id);return(0,v.jsxs)("div",{onClick:t=>{t.stopPropagation(),It("product_categories",e.id||e._id),K(""),setTimeout(()=>{var e;return null===(e=Ge.current)||void 0===e?void 0:e.focus()},0)},className:"flex items-center gap-2 p-2 cursor-pointer text-sm rounded hover:bg-blue-50 transition-colors ".concat(t?"bg-blue-50":""),children:[(0,v.jsx)("input",{type:"checkbox",checked:t,readOnly:!0,className:"accent-primary h-4 w-4 pointer-events-none"}),(0,v.jsx)("span",{className:"text-gray-700 ".concat(t?"font-bold text-primary":""),children:e.title||e.categorytitle})]},e.id||e._id)}),0===Qt.filter(e=>(e.title||e.categorytitle||"").toLowerCase().includes(q.toLowerCase())).length&&(0,v.jsx)("div",{className:"p-3 text-xs text-gray-400 text-center",children:"No categories found"})]})]}),G&&(0,v.jsx)("div",{className:"fixed inset-0 z-10",onClick:()=>{Q(!1),K("")}})]})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-start border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight pt-3",children:"Product languages"}),(0,v.jsxs)("div",{className:"col-span-9 relative",children:[(0,v.jsxs)("div",{className:"border border-gray-300 rounded p-2 bg-white cursor-pointer min-h-[38px] flex flex-wrap gap-2 items-center hover:border-primary transition-colors",onClick:()=>ae(!te),children:[Pt.product_languages&&Pt.product_languages.length>0?Pt.product_languages.map((e,t)=>(0,v.jsxs)("span",{className:"bg-blue-50 text-blue-700 text-[10px] font-bold px-2 py-0.5 rounded border border-blue-100 flex items-center gap-1",children:[e,(0,v.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),It("product_languages",e)},className:"hover:text-red-500",children:"\xd7"})]},t)):(0,v.jsx)("span",{className:"text-gray-400 text-xs",children:"Select languages..."}),(0,v.jsx)("div",{className:"ml-auto text-gray-400 text-[10px]",children:"\u25bc"})]}),te&&(0,v.jsxs)("div",{className:"absolute z-50 top-full left-0 w-full bg-white border border-gray-300 rounded shadow-lg mt-1",children:[(0,v.jsx)("div",{className:"p-2 border-b border-gray-100 bg-gray-50 rounded-t",children:(0,v.jsx)("input",{type:"text",placeholder:"Search languages...",value:Y,onChange:e=>Z(e.target.value),onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onContextMenu:e=>e.stopPropagation(),className:"w-full text-xs p-1.5 border border-gray-300 rounded focus:border-primary outline-none bg-white",autoFocus:!0})}),(0,v.jsxs)("div",{className:"max-h-48 overflow-y-auto p-1 scrollbar-thin scrollbar-thumb-gray-300",children:[H.filter(e=>(e.title||e).toLowerCase().includes(Y.toLowerCase())).map((e,t)=>{const a=e.title||e,s=Pt.product_languages&&Pt.product_languages.includes(a);return(0,v.jsxs)("div",{onClick:()=>It("product_languages",a),className:"flex items-center gap-2 p-2 cursor-pointer text-sm rounded hover:bg-blue-50 transition-colors ".concat(s?"bg-blue-50":""),children:[(0,v.jsx)("input",{type:"checkbox",checked:s,readOnly:!0,className:"accent-primary h-4 w-4 pointer-events-none"}),(0,v.jsx)("span",{className:"text-gray-700 ".concat(s?"font-bold text-primary":""),children:a})]},t)}),0===H.filter(e=>(e.title||e).toLowerCase().includes(Y.toLowerCase())).length&&(0,v.jsx)("div",{className:"p-3 text-xs text-gray-400 text-center",children:"No language found"})]})]}),te&&(0,v.jsx)("div",{className:"fixed inset-0 z-40",onClick:()=>ae(!1)})]})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-start border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight pt-3",children:"Product tags"}),(0,v.jsxs)("div",{className:"col-span-9 relative",children:[(0,v.jsxs)("div",{className:"border border-gray-300 rounded p-2 bg-white cursor-pointer min-h-[38px] flex flex-wrap gap-2 items-center hover:border-primary transition-colors",onClick:()=>oe(!ne),children:[Pt.product_tags&&Pt.product_tags.length>0?Pt.product_tags.map((e,t)=>(0,v.jsxs)("span",{className:"bg-blue-50 text-blue-700 text-[10px] font-bold px-2 py-0.5 rounded border border-blue-100 flex items-center gap-1",children:[e,(0,v.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),It("product_tags",e)},className:"hover:text-red-500",children:"\xd7"})]},t)):(0,v.jsx)("span",{className:"text-gray-400 text-xs",children:"Select tags..."}),(0,v.jsx)("div",{className:"ml-auto text-gray-400 text-[10px]",children:"\u25bc"})]}),ne&&(0,v.jsxs)("div",{className:"absolute z-20 top-full left-0 w-full bg-white border border-gray-300 rounded shadow-lg mt-1",children:[(0,v.jsx)("div",{className:"p-2 border-b border-gray-100 bg-gray-50 rounded-t",children:(0,v.jsx)("input",{type:"text",placeholder:"Search tags...",value:ie,onChange:e=>le(e.target.value),onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onContextMenu:e=>e.stopPropagation(),className:"w-full text-xs p-1.5 border border-gray-300 rounded focus:border-primary outline-none bg-white",autoFocus:!0})}),(0,v.jsxs)("div",{className:"max-h-48 overflow-y-auto p-1 scrollbar-thin scrollbar-thumb-gray-300",children:[se.filter(e=>(e.title||e).toLowerCase().includes(ie.toLowerCase())).map((e,t)=>{const a=e.title||e,s=Pt.product_tags&&Pt.product_tags.includes(a);return(0,v.jsxs)("div",{onClick:()=>It("product_tags",a),className:"flex items-center gap-2 p-2 cursor-pointer text-sm rounded hover:bg-blue-50 transition-colors ".concat(s?"bg-blue-50":""),children:[(0,v.jsx)("input",{type:"checkbox",checked:s,readOnly:!0,className:"accent-primary h-4 w-4 pointer-events-none"}),(0,v.jsx)("span",{className:"text-gray-700 ".concat(s?"font-bold text-primary":""),children:a})]},t)}),0===se.filter(e=>(e.title||e).toLowerCase().includes(ie.toLowerCase())).length&&(0,v.jsx)("div",{className:"p-3 text-xs text-gray-400 text-center",children:"No tag found"})]})]}),ne&&(0,v.jsx)("div",{className:"fixed inset-0 z-10",onClick:()=>oe(!1)})]})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-start border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight pt-3",children:"Related products"}),(0,v.jsxs)("div",{className:"col-span-9 space-y-3",children:[st.length>0&&(0,v.jsx)("div",{className:"space-y-1",children:st.map(e=>(0,v.jsxs)("div",{className:"flex items-center justify-between bg-gray-50 border border-gray-200 rounded px-3 py-2",children:[(0,v.jsxs)("span",{className:"text-xs text-gray-700 font-medium",children:[e.title," ",(0,v.jsxs)("span",{className:"text-gray-400",children:["(",e.id,")"]})]}),(0,v.jsx)("button",{type:"button",onClick:()=>(e=>{const t=st.filter(t=>t.id!==e);rt(t);const a=t.map(e=>e.id).join(",");zt(e=>(0,s.A)((0,s.A)({},e),{},{related_products:a}))})(e.id),className:"text-red-500 hover:text-red-700 font-bold px-2",children:"\u2715"})]},e.id))}),(0,v.jsxs)("div",{className:"relative",ref:Qe,children:[(0,v.jsx)("input",{type:"text",value:He,onCh
2ange:e=>{Ve(e.target.value),et(!0)},onFocus:()=>et(!0),onMouseDown:e=>e.stopPropagation(),onContextMenu:e=>e.stopPropagation(),placeholder:"Search product by isbn or title or id",className:"theme-input w-full"}),Xe&&He.length>2&&(0,v.jsx)("div",{className:"absolute z-50 top-full left-0 w-full bg-white border border-gray-300 rounded shadow-lg mt-1 max-h-60 overflow-y-auto",children:Ye.length>0?Ye.map(e=>(0,v.jsxs)("div",{onClick:()=>(e=>{const t=e.bagcheeId||e.bagchee_id;if(st.find(e=>e.id===t))return p.Ay.error("Already linked!");const a=[...st,{id:t,title:e.title}];rt(a);const r=a.map(e=>e.id).join(",");zt(e=>(0,s.A)((0,s.A)({},e),{},{related_products:r})),p.Ay.success("Linked!"),Ve(""),et(!1)})(e),className:"px-3 py-2 border-b hover:bg-blue-50 cursor-pointer",children:[(0,v.jsx)("span",{className:"text-sm font-bold block",children:e.title}),(0,v.jsxs)("span",{className:"text-[10px] text-gray-500",children:["ID: ",e.bagchee_id||e.id||e._id]})]},e.id||e.id||e._id)):(0,v.jsx)("div",{className:"p-3 text-xs text-gray-400 text-center",children:"No products found"})})]})]})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-start border-b border-gray-50 pb-6",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight pt-3",children:"Authors"}),(0,v.jsxs)("div",{className:"col-span-9 space-y-3",children:[(0,v.jsxs)("div",{className:"relative",children:[(0,v.jsxs)("div",{className:"border border-gray-300 rounded p-2 bg-white cursor-pointer min-h-[38px] flex flex-wrap gap-2 items-center hover:border-primary transition-colors",onClick:()=>ge(!ue),children:[Pt.authors&&Pt.authors.length>0?Pt.authors.map(e=>{const t=me[String(e)]||"Author #".concat(e);return(0,v.jsxs)("span",{className:"bg-blue-50 text-blue-700 text-[10px] font-bold px-2 py-0.5 rounded border border-blue-100 flex items-center gap-1",children:[t,(0,v.jsx)("select",{value:be[String(e)]||1,onChange:t=>{t.stopPropagation(),ye(a=>(0,s.A)((0,s.A)({},a),{},{[String(e)]:Number(t.target.value)}))},onClick:e=>e.stopPropagation(),className:"text-[9px] bg-blue-100 border-0 outline-none cursor-pointer rounded px-0.5 text-blue-800 font-normal",children:j.map(e=>(0,v.jsx)("option",{value:e.id,children:e.label},e.id))}),(0,v.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),It("authors",e)},className:"hover:text-red-500",children:"\xd7"})]},e)}):(0,v.jsx)("span",{className:"text-gray-400 text-xs",children:"Select authors..."}),(0,v.jsx)("div",{className:"ml-auto text-gray-400 text-[10px]",children:"\u25bc"})]}),ue&&(0,v.jsxs)("div",{className:"absolute z-[100] top-full left-0 w-full bg-white border border-gray-300 rounded shadow-lg mt-1 flex flex-col overflow-hidden animate-in fade-in zoom-in-95",children:[(0,v.jsx)("div",{className:"p-2 border-b border-gray-100 bg-gray-50 rounded-t",children:(0,v.jsx)("input",{type:"text",placeholder:"Search authors...",value:pe,onChange:e=>xe(e.target.value),onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onContextMenu:e=>e.stopPropagation(),className:"w-full text-xs p-1.5 border border-gray-300 rounded focus:border-primary outline-none bg-white",autoFocus:!0})}),(0,v.jsx)("div",{className:"max-h-48 overflow-y-auto p-1 scrollbar-thin",children:je?(0,v.jsx)("div",{className:"p-3 text-xs text-gray-400 text-center",children:"Searching..."}):pe.length<2?(0,v.jsx)("div",{className:"p-3 text-xs text-gray-400 text-center",children:"Type at least 2 characters to search"}):0===fe.length?(0,v.jsx)("div",{className:"p-3 text-xs text-gray-400 text-center",children:"No authors found"}):fe.map(e=>{const t=Pt.authors.includes(e.id),a=e.fullName||"".concat(e.firstName||""," ").concat(e.lastName||"").trim();return(0,v.jsxs)("div",{onClick:()=>{It("authors",e.id),he(t=>(0,s.A)((0,s.A)({},t),{},{[String(e.id)]:a})),ye(t=>(0,s.A)((0,s.A)({},t),{},{[String(e.id)]:t[String(e.id)]||1}))},className:"flex items-center gap-2 p-2 cursor-pointer text-sm rounded hover:bg-blue-50 transition-colors ".concat(t?"bg-blue-50 font-bold text-primary":""),children:[(0,v.jsx)("input",{type:"checkbox",checked:t,readOnly:!0,className:"accent-primary h-4 w-4 pointer-events-none"}),(0,v.jsx)("span",{children:a||"Unknown Author"})]},e.id)})})]}),ue&&(0,v.jsx)("div",{className:"fixed inset-0 z-[90]",onClick:()=>ge(!1)})]}),(0,v.jsx)("div",{className:"flex justify-start",children:(0,v.jsxs)("button",{type:"button",onClick:()=>lt(!it),className:"bg-gray-100 border border-gray-300 px-4 py-1.5 rounded text-[11px] font-bold uppercase text-gray-700 hover:bg-gray-200 shadow-sm flex items-center gap-2",children:[it?(0,v.jsx)(d.A,{size:14}):(0,v.jsx)(o.A,{size:14})," Add new author"]})}),it&&(0,v.jsxs)("div",{className:"p-6 bg-cream-50/50 border-2 border-primary/10 rounded-xl space-y-5 animate-in slide-in-from-top-2 duration-300 shadow-inner",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 text-primary border-b border-primary/10 pb-2",children:[(0,v.jsx)(o.A,{size:16,strokeWidth:3}),(0,v.jsx)("h3",{className:"text-xs font-bold uppercase font-montserrat tracking-wider",children:"Qu
2ick Author Registration"})]}),(0,v.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,v.jsxs)("div",{className:"space-y-1",children:[(0,v.jsx)("label",{className:"text-[10px] font-bold text-gray-400 uppercase ml-1",children:"First Name*"}),(0,v.jsx)("input",{type:"text",value:nt.first_name,onChange:e=>ot((0,s.A)((0,s.A)({},nt),{},{first_name:e.target.value})),className:"theme-input w-full bg-white",placeholder:"First Name"})]}),(0,v.jsxs)("div",{className:"space-y-1",children:[(0,v.jsx)("label",{className:"text-[10px] font-bold text-gray-400 uppercase ml-1",children:"Last Name"}),(0,v.jsx)("input",{type:"text",value:nt.last_name,onChange:e=>ot((0,s.A)((0,s.A)({},nt),{},{last_name:e.target.value})),className:"theme-input w-full bg-white",placeholder:"Last Name"})]})]}),(0,v.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,v.jsxs)("div",{className:"space-y-1",children:[(0,v.jsx)("label",{className:"text-[10px] font-bold text-gray-400 uppercase ml-1",children:"Author Picture"}),(0,v.jsxs)("div",{className:"flex items-center gap-3",children:[(0,v.jsxs)("label",{className:"cursor-pointer bg-white border border-gray-300 px-4 py-2 rounded text-[10px] font-bold uppercase hover:bg-primary hover:text-white transition-all shadow-sm",children:[(0,v.jsx)(c.A,{size:14,className:"inline mr-2"})," ",pt?"Change file":"Upload Picture",(0,v.jsx)("input",{type:"file",className:"hidden",accept:"image/*",onChange:e=>{const t=e.target.files[0];t&&((0,y.$)(t)?xt(t):e.target.value="")}})]}),pt&&(0,v.jsx)("span",{className:"text-[10px] text-green-600 font-bold italic",children:pt.name})]})]}),(0,v.jsxs)("div",{className:"space-y-1",children:[(0,v.jsx)("label",{className:"text-[10px] font-bold text-gray-400 uppercase ml-1",children:"Origin"}),(0,v.jsx)("input",{type:"text",value:nt.origin,onChange:e=>ot((0,s.A)((0,s.A)({},nt),{},{origin:e.target.value})),className:"theme-input w-full bg-white",placeholder:"e.g. India"})]})]}),(0,v.jsxs)("div",{className:"space-y-1",children:[(0,v.jsx)("label",{className:"text-[10px] font-bold text-gray-400 uppercase ml-1",children:"Author Profile"}),(0,v.jsx)("div",{className:"bg-white rounded border shadow-sm overflow-hidden",children:(0,v.jsx)(g(),{value:ct,config:{height:200,placeholder:"Write author profile details..."},onBlur:e=>dt(e)})})]}),(0,v.jsxs)("div",{className:"flex justify-end gap-3 pt-4 border-t border-primary/10",children:[(0,v.jsx)("button",{type:"button",onClick:()=>lt(!1),className:"text-[10px] font-bold uppercase text-gray-400 hover:text-gray-600 px-4 transition-colors",children:"Discard"}),(0,v.jsxs)("button",{type:"button",disabled:Et.isPending,onClick:e=>{if(e.preventDefault(),!nt.first_name)return p.Ay.error("First name is required!");const t=p.Ay.loading("Saving new author..."),a=new FormData;a.append("first_name",nt.first_name),a.append("last_name",nt.last_name),a.append("origin",nt.origin),a.append("profile",ct),pt&&a.append("picture",pt),Et.mutate(a,{onSuccess:e=>{if(e.status){p.Ay.success("Author added & linked!",{id:t});const a=e.data,r=a.id||a._id,i=a.fullName||"".concat(a.firstName||""," ").concat(a.lastName||"").trim();de(e=>[...e,a]),he(e=>(0,s.A)((0,s.A)({},e),{},{[String(r)]:i})),zt(e=>(0,s.A)((0,s.A)({},e),{},{authors:[...e.authors,r]})),lt(!1),ot({first_name:"",last_name:"",origin:""}),dt(""),xt(null)}else p.Ay.error("Failed to save",{id:t})},onError:()=>p.Ay.error("Failed to save author",{id:t})})},className:"bg-primary text-white px-6 py-2 rounded font-bold text-[10px] uppercase shadow-md flex items-center gap-2 hover:brightness-110 disabled:opacity-50 transition-all",children:[Et.isPending?(0,v.jsx)(i.A,{size:14,className:"animate-spin"}):(0,v.jsx)(l.A,{size:14})," Save & Link Author"]})]})]})]})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center border-b border-gray-50 pb-4 text-gray-400",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-400 uppercase tracking-tight",children:"Ordered items"}),(0,v.jsx)("div",{className:"col-span-9",children:(0,v.jsx)("input",{type:"text",disabled:!0,readOnly:!0,value:"No orders yet",className:"theme-input w-full bg-gray-50 cursor-not-allowed border-dashed"})})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-start border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight pt-3",children:"Product formats"}),(0,v.jsxs)("div",{className:"col-span-9 relative",children:[(0,v.jsxs)("div",{className:"border border-gray-300 rounded p-2 bg-white cursor-pointer min-h-[38px] flex flex-wrap gap-2 items-center hover:border-primary transition-colors",onClick:()=>Se(!Ce),children:[Pt.product_formats&&Pt.product_formats.length>0?Pt.product_formats.map((e,t)=>(0,v.jsxs)("span",{className:"bg-blue-50 text-blue-700 text-[10px] font-bold px-2 py-0.5 rounded border border-blue-100 flex items-center gap-1",children:[e,(0,v.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),It("product_formats",e)},className:"hover:text-red-500",children:"\xd7"})]},t)):(0,v.jsx)("span",{className:"text-gray-400 text-xs",children:"Select formats..."}),(0,v.jsx)("div",{className:"ml-auto text-gray-400 text-[10px]",children:"\u25bc"})]}),Ce&&(0,v.jsxs)("div",{className:"absolute z-20 top-full left-0 w-full bg-white border border-gray-300 rounded shadow-lg mt-1 flex flex-col",children:[(0,v.jsx)("div",{className:"p-2 border-b border-gray-100 bg-gray-50 rounded-t",children:(0,v.jsx)("input",{type:"text",placeholder:"Search formats...",value:Ae,onChange:e=>ke(e.target.value),onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onContextMenu:e=>e.stopPropagation(),className:"w-full text-xs p-1.5 border border-gray-300 rounded focus:border-primary outline-none bg-white",autoFocus:!0})}),(0,v.jsxs)("div",{className:"max-h-48 overflow-y-auto p-1 scrollbar-thin scrollbar-thumb-gray-300",children:[we.filter(e=>(e.title||e).toLowerCase().includes(Ae.toLowerCase())).map((e,t)=>{const a=e.title||e,s=Pt.product_formats&&Pt.product_formats.includes(a);return(0,v.jsxs)("div",{onClick:()=>It("product_formats",a),className:"flex items-center gap-2 p-2 cursor-pointer text-sm rounded hover:bg-blue-50 transition-colors ".concat(s?"bg-blue-50":""),children:[(0,v.jsx)("input",{type:"checkbox",checked:s,readOnly:!0,className:"accent-primary h-4 w-4 pointer-events-none"}),(0,v.jsx)("span",{className:"text-gray-700 ".concat(s?"font-bold text-primary":""),children:a})]},t)}),0===we.filter(e=>(e.title||e).toLowerCase().includes(Ae.toLowerCase())).length&&(0,v.jsx)("div",{className:"p-3 text-xs text-gray-400 text-center",children:"No format found"})]})]}),Ce&&(0,v.jsx)("div",{className:"fixed inset-0 z-10",onClick:()=>Se(!1)})]})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight",children:"Volume"}),(0,v.jsx)("div",{className:"col-span-9",children:(0,v.jsx)("input",{name:"volume",type:"text",onCh
2ange:Tt,className:"theme-input w-full md:w-1/3"})})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight",children:"Edition"}),(0,v.jsx)("div",{className:"col-span-9",children:(0,v.jsx)("input",{name:"edition",type:"text",onChange:Tt,className:"theme-input w-full md:w-1/3"})})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight",children:"Isbn 10"}),(0,v.jsx)("div",{className:"col-span-9",children:(0,v.jsx)("input",{name:"isbn10",type:"text",onChange:Tt,className:"theme-input w-full md:w-1/2"})})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight",children:"Isbn 13"}),(0,v.jsx)("div",{className:"col-span-9",children:(0,v.jsx)("input",{name:"isbn13",type:"text",onChange:Tt,className:"theme-input w-full md:w-1/2"})})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight",children:"Total pages"}),(0,v.jsx)("div",{className:"col-span-9",children:(0,v.jsx)("input",{name:"total_pages",type:"text",onChange:Tt,className:"theme-input w-full",placeholder:"e.g. 171p., Plates; Notes; 23cm."})})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight",children:"Weight"}),(0,v.jsx)("div",{className:"col-span-9",children:(0,v.jsx)("input",{name:"weight",type:"text",onChange:Tt,className:"theme-input w-32",placeholder:"e.g. 500g"})})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-start border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight pt-2",children:"Default image"}),(0,v.jsxs)("div",{className:"col-span-9",children:[(0,v.jsx)("input",{type:"file",id:"default_image_input",className:"hidden",accept:"image/*",onChange:e=>{const t=e.target.files[0];t&&((0,y.$)(t)?N(t):e.target.value="")}}),(0,v.jsxs)("div",{className:"flex items-start gap-4",children:[(0,v.jsxs)("label",{htmlFor:"default_image_input",className:"cursor-pointer bg-white border border-dashed border-gray-300 px-4 py-3 rounded-lg text-[11px] font-bold uppercase hover:bg-gray-50 hover:border-blue-400 transition-all shadow-sm flex flex-col items-center gap-1 text-gray-500 min-w-[100px]",children:[(0,v.jsx)(c.A,{size:18,className:"text-gray-400"}),(0,v.jsx)("span",{children:"Upload"})]}),A&&(0,v.jsxs)("div",{className:"relative group",children:[(0,v.jsx)("div",{className:"w-16 h-16 rounded-lg overflow-hidden border border-gray-200 shadow-sm relative",children:(0,v.jsx)("img",{src:A,alt:"Preview",className:"w-full h-full object-cover"})}),(0,v.jsx)("div",{className:"flex flex-col justify-center ml-2",children:(0,v.jsx)("button",{onClick:()=>{N(null),document.getElementById("default_image_input").value=""},type:"button",className:"absolute -top-2 -right-2 bg-red-500 text-white rounded-full p-0.5 shadow-md hover:bg-red-600 transition-colors",title:"Remove image",children:(0,v.jsx)(d.A,{size:12})})})]}),u&&(0,v.jsxs)("div",{className:"flex flex-col justify-center h-16",children:[(0,v.jsx)("span",{className:"text-[11px] font-bold text-gray-700 truncate max-w-[150px]",children:u.name}),(0,v.jsxs)("span",{className:"text-[9px] text-gray-400",children:[(u.size/1024).toFixed(1)," KB"]})]})]})]})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-start border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight pt-2",children:"Default toc image"}),(0,v.jsx)("div",{className:"col-span-9 flex flex-col gap-3",children:(0,v.jsxs)("div",{className:"flex items-center gap-3",children:[P&&(0,v.jsxs)("div",{className:"relative group",children:[(0,v.jsx)("img",{src:P,alt:"TOC Preview",className:"w-16 h-20 object-cover border rounded shadow-sm"}),(0,v.jsx)("button",{type:"button",onClick:()=>{S(null),document.getElementById("toc_image_input").value=""},className:"absolute -top-2 -right-2 bg-red-500 text-white rounded-full p-1 shadow-md hover:scale-110",children:(0,v.jsx)(d.A,{size:10})})]}),(0,v.jsx)("input",{type:"file",id:"toc_image_input",className:"hidden",accept:"image/*",onChange:e=>{const t=e.target.files[0];t&&((0,y.$)(t)?S(t):e.target.value="")}}),(0,v.jsxs)("label",{htmlFor:"toc_image_input",className:"cursor-pointer bg-white border border-dashed border-gray-300 px-4 py-2 rounded-lg text-[11px] font-bold uppercase hover:border-primary hover:text-primary transition-all flex items-center gap-2",children:[(0,v.jsx)(c.A,{size:14})," ",P?"Change":"Upload"]}),C&&(0,v.jsxs)("div",{className:"flex flex-col justify-center h-16",children:[(0,v.jsx)("span",{className:"text-[11px] font-bold text-gray-700 truncate max-w-[150px]",children:C.name}),(0,v.jsxs)("span",{className:"text-[9px] text-gray-400",children:[(C.size/1024).toFixed(1)," KB"]}
2)]})]})})]}),(0,v.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-4 items-start border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"md:col-span-3 text-left md:text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight pt-2",children:"Add toc images"}),(0,v.jsxs)("div",{className:"md:col-span-9 space-y-3",children:[L.map((e,t)=>(0,v.jsxs)("div",{className:"flex flex-col sm:flex-row items-center gap-3 border p-3 rounded bg-gray-50",children:[(0,v.jsx)("div",{className:"w-full sm:w-14 h-14 border bg-white flex-shrink-0 overflow-hidden rounded relative",children:e.file?(0,v.jsx)("img",{src:URL.createObjectURL(e.file),alt:"preview",className:"w-full h-full object-cover"}):(0,v.jsx)("div",{className:"flex items-center justify-center h-full bg-gray-100 text-[9px] text-gray-400",children:"No Img"})}),(0,v.jsxs)("div",{className:"flex-1 w-full text-center sm:text-left",children:[(0,v.jsx)("input",{type:"file",id:"toc_upload_".concat(e.id),className:"hidden",accept:"image/*",onChange:t=>Wt(D,e.id,t.target.files[0],t)}),(0,v.jsxs)("label",{htmlFor:"toc_upload_".concat(e.id),className:"cursor-pointer bg-white border border-dashed border-gray-300 px-3 py-1.5 rounded text-[10px] font-bold uppercase hover:border-primary hover:text-primary transition-all inline-flex items-center gap-2",children:[(0,v.jsx)(c.A,{size:12})," ",e.file?"Change":"Upload Image"]}),e.file&&(0,v.jsx)("span",{className:"text-[10px] text-gray-500 mt-1 block truncate max-w-[200px] mx-auto sm:mx-0",children:e.file.name})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 w-full sm:w-auto justify-end",children:[(0,v.jsx)("input",{type:"number",value:e.order,onChange:t=>qt(D,e.id,t.target.value),className:"theme-input w-16 text-center text-xs",placeholder:"Ord"}),(0,v.jsx)("button",{type:"button",onClick:()=>Bt(D,e.id),className:"bg-red-100 text-red-500 p-2 rounded hover:bg-red-200 transition-colors",children:(0,v.jsx)(d.A,{size:14})})]})]},e.id)),(0,v.jsxs)("button",{type:"button",onClick:()=>Ut(D),className:"w-full sm:w-auto flex items-center justify-center gap-2 bg-gray-100 border border-gray-300 px-4 py-2 rounded text-[11px] font-bold text-gray-600 hover:bg-gray-200 transition-all shadow-sm",children:[(0,v.jsx)(o.A,{size:14})," Add additional toc image"]})]})]}),(0,v.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-4 items-start border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"md:col-span-3 text-left md:text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight pt-2",children:"Related images"}),(0,v.jsxs)("div",{className:"md:col-span-9 space-y-3",children:[O.map((e,t)=>(0,v.jsxs)("div",{className:"flex flex-col sm:flex-row items-center gap-3 border p-3 rounded bg-gray-50",children:[(0,v.jsx)("div",{className:"w-full sm:w-14 h-14 border bg-white flex-shrink-0 overflow-hidden rounded relative",children:e.file?(0,v.jsx)("img",{src:URL.createObjectURL(e.file),alt:"preview",className:"w-full h-full object-cover"}):(0,v.jsx)("div",{className:"flex items-center justify-center h-full bg-gray-100 text-[9px] text-gray-400",children:"No Img"})}),(0,v.jsxs)("div",{className:"flex-1 w-full text-center sm:text-left",children:[(0,v.jsx)("input",{type:"file",id:"rel_upload_".concat(e.id),className:"hidden",accept:"image/*",onChange:t=>Wt(E,e.id,t.target.files[0],t)}),(0,v.jsxs)("label",{htmlFor:"rel_upload_".concat(e.id),className:"cursor-pointer bg-white border border-dashed border-gray-300 px-3 py-1.5 rounded text-[10px] font-bold uppercase hover:border-primary hover:text-primary transition-all inline-flex items-center gap-2",children:[(0,v.jsx)(c.A,{size:12})," ",e.file?"Change":"Upload Image"]}),e.file&&(0,v.jsx)("span",{className:"text-[10px] text-gray-500 mt-1 block truncate max-w-[200px] mx-auto sm:mx-0",children:e.file.name})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 w-full sm:w-auto justify-end",children:[(0,v.jsx)("input",{type:"number",value:e.order,onChange:t=>qt(E,e.id,t.target.value),className:"theme-input w-16 text-center text-xs",placeholder:"Ord"}),(0,v.jsx)("button",{type:"button",onClick:()=>Bt(E,e.id),className:"bg-red-100 text-red-500 p-2 rounded hover:bg-red-200 transition-colors",children:(0,v.jsx)(d.A,{size:14})})]})]},e.id)),(0,v.jsxs)("button",{type:"button",onClick:()=>Ut(E),className:"w-full sm:w-auto flex items-center justify-center gap-2 bg-gray-100 border border-gray-300 px-4 py-2 rounded text-[11px] font-bold text-gray-600 hover:bg-gray-200 transition-all shadow-sm",children:[(0,v.jsx)(o.A,{size:14})," Add related image"]})]})]}),(0,v.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-4 items-start border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"md:col-span-3 text-left md:text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight pt-2",children:"Sample images"}),(0,v.jsxs)("div",{className:"md:col-span-9 space-y-3",children:[M.map((e,t)=>(0,v.jsxs)("div",{className:"flex flex-col sm:flex-row items-center gap-3 border p-3 rounded bg-gray-50",children:[(0,v.jsx)("div",{className:"w-full sm:w-14 h-14 border bg-white flex-shrink-0 overflow-hidden rounded relative",children:e.file?(0,v.jsx)("img",{src:URL.createObjectURL(e.file),alt:"preview",className:"w-full h-full object-cover"}):(0,v.jsx)("div",{className:"flex items-center justify-center h-full bg-gray-100 text-[9px] text-gray-400",children:"No Img"})}),(0,v.jsxs)("div",{className:"flex-1 w-full text-center sm:text-left",children:[(0,v.jsx)("input",{type:"file",id:"samp_upload_".concat(e.id),className:"hidden",accept:"image/*",onChange:t=>Wt(F,e.id,t.target.files[0],t)}),(0,v.jsxs)("label",{htmlFor:"samp_upload_".concat(e.id),className:"cursor-pointer bg-white border border-dashed border-gray-300 px-3 py-1.5 rounded text-[10px] font-bold uppercase hover:border-primary hover:text-primary transition-all inline-flex items-center gap-2",children:[(0,v.jsx)(c.A,{size:12})," ",e.file?"Change":"Upload Image"]}),e.file&&(0,v.jsx)("span",{className:"text-[10px] text-gray-500 mt-1 block truncate max-w-[200px] mx-auto
2sm:mx-0",children:e.file.name})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 w-full sm:w-auto justify-end",children:[(0,v.jsx)("input",{type:"number",value:e.order,onChange:t=>qt(F,e.id,t.target.value),className:"theme-input w-16 text-center text-xs",placeholder:"Ord"}),(0,v.jsx)("button",{type:"button",onClick:()=>Bt(F,e.id),className:"bg-red-100 text-red-500 p-2 rounded hover:bg-red-200 transition-colors",children:(0,v.jsx)(d.A,{size:14})})]})]},e.id)),(0,v.jsxs)("button",{type:"button",onClick:()=>Ut(F),className:"w-full sm:w-auto flex items-center justify-center gap-2 bg-gray-100 border border-gray-300 px-4 py-2 rounded text-[11px] font-bold text-gray-600 hover:bg-gray-200 transition-all shadow-sm",children:[(0,v.jsx)(o.A,{size:14})," Add sample image"]})]})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-start border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight pt-2",children:"Pub date"}),(0,v.jsxs)("div",{className:"col-span-9 space-y-1",children:[(0,v.jsx)("input",{name:"pub_date",type:"date",value:Pt.pub_date||"",onChange:Tt,className:"theme-input w-full md:w-1/3 cursor-pointer"}),(0,v.jsx)("button",{type:"button",onClick:()=>zt((0,s.A)((0,s.A)({},Pt),{},{pub_date:""})),className:"block text-primary text-[10px] font-bold hover:underline mt-1",children:"Clear Date"})]})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight",children:"Source"}),(0,v.jsx)("div",{className:"col-span-9",children:(0,v.jsx)("input",{name:"source",type:"text",onChange:Tt,className:"theme-input w-full"})})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight",children:"Bagchee id"}),(0,v.jsxs)("div",{className:"col-span-9 flex gap-2",children:[(0,v.jsx)("input",{name:"bagchee_id",type:"text",value:"Auto-generated (BB + ID)",readOnly:!0,className:"theme-input w-full bg-gray-100 text-gray-500 cursor-not-allowed"}),(0,v.jsx)("button",{type:"button",disabled:!0,className:"bg-gray-100 border border-gray-300 px-4 py-2 rounded text-[11px] font-bold uppercase text-gray-400 cursor-not-allowed shadow-sm whitespace-nowrap",children:"Product page"})]})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight",children:"Rating"}),(0,v.jsx)("div",{className:"col-span-9",children:(0,v.jsxs)("select",{name:"rating",onChange:Tt,className:"theme-input w-32",children:[(0,v.jsx)("option",{value:"",children:"Select"}),[1,2,3,4,5].map(e=>(0,v.jsx)("option",{value:e,children:e},e))]})})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight",children:"Rated times"}),(0,v.jsx)("div",{className:"col-span-9",children:(0,v.jsx)("input",{name:"rated_times",type:"number",onChange:Tt,className:"theme-input w-32"})})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-start border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight pt-3",children:"Series"}),(0,v.jsxs)("div",{className:"col-span-9 space-y-3",children:[(0,v.jsxs)("div",{className:"relative",children:[(0,v.jsxs)("div",{className:"border border-gray-300 rounded p-2 bg-white cursor-pointer min-h-[38px] flex flex-wrap gap-2 items-center hover:border-primary transition-colors",onClick:()=>Ee(!Oe),children:[Pt.series&&Pt.series.length>0?Pt.series.map(e=>{const t=Pe.find(t=>(t.id||t._id)===e);return t?(0,v.jsxs)("span",{className:"bg-purple-50 text-purple-700 text-[10px] font-bold px-2 py-0.5 rounded border border-purple-100 flex items-center gap-1",children:[t.title,(0,v.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),It("series",e)},className:"hover:text-red-500 font-bold ml-1",children:"\xd7"})]},e):null}):(0,v.jsx)("span",{className:"text-gray-400 text-xs",children:"Select series..."}),(0,v.jsx)("div",{className:"ml-auto text-gray-400 text-[10px]",children:"\u25bc"})]}),Oe&&(0,v.jsxs)("div",{className:"absolute z-50 top-full left-0 w-full md:w-1/2 bg-white border border-gray-300 rounded shadow-lg mt-1 flex flex-col overflow-hidden animate-in fade-in zoom-in-95 duration-200",children:[(0,v.jsx)("div",{className:"p-2 border-b border-gray-100 bg-gray-50",children:(0,v.jsx)("input",{type:"text",placeholder:"Search series...",value:Le,onChange:e=>De(e.target.value),onClick:e=>e.stopPropagation(),className:"w-full text-xs p-1.5 border border-gray-200 rounded focus:border-primary outline-none",autoFocus:!0})}),(0,v.jsxs)("div",{className:"max-h-48 overflow-y-auto p-1 scrollbar-thin",children:[Pe.filter(e=>e.title.toLowerCase().includes(Le.toLowerCase())).map(e=>{const t=Pt.series.includes(e.id||e._id);return(0,v.jsxs)("div",{onClick:()=>(e=>{const t=e.id||e._id;zt(a=>{const r=Array.isArray(a.series)?a.series:[];return r.includes(t)?(p.Ay.error("This series is already added!"),a):(0,s.A)((0,s.A)({},a),{},{series:[...r,t],series_number:a.series_number||(e.total_books?(e.total_books+1).toString():"1")})}),Ee(!1),De("")}
2)(e),className:"px-3 py-2 text-sm cursor-pointer rounded hover:bg-blue-50 flex justify-between items-center ".concat(t?"bg-blue-50 text-primary font-bold":"text-gray-600"),children:[e.title,t&&(0,v.jsx)(l.A,{size:14})]},e.id||e.id||e._id)}),0===Pe.filter(e=>e.title.toLowerCase().includes(Le.toLowerCase())).length&&(0,v.jsx)("div",{className:"p-3 text-xs text-gray-400 text-center",children:"No series found"})]})]}),Oe&&(0,v.jsx)("div",{className:"fixed inset-0 z-10",onClick:()=>Ee(!1)})]}),(0,v.jsx)("div",{className:"flex justify-start",children:(0,v.jsxs)("button",{type:"button",onClick:()=>gt(!ut),className:"bg-gray-100 border border-gray-300 px-4 py-1.5 rounded text-[11px] font-bold uppercase text-gray-700 hover:bg-gray-200 shadow-sm flex items-center gap-2 transition-all",children:[ut?(0,v.jsx)(d.A,{size:14}):(0,v.jsx)(o.A,{size:14})," Add new series"]})}),ut&&(0,v.jsxs)("div",{className:"p-5 bg-cream-50/50 border-2 border-primary/10 rounded-xl space-y-4 animate-in slide-in-from-top-2 duration-300 shadow-inner",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 text-primary border-b border-primary/10 pb-2",children:[(0,v.jsx)(o.A,{size:16,strokeWidth:3}),(0,v.jsx)("h3",{className:"text-xs font-bold uppercase font-montserrat tracking-wider",children:"Quick Series Registration"})]}),(0,v.jsxs)("div",{className:"space-y-1",children:[(0,v.jsx)("label",{className:"text-[10px] font-bold text-gray-400 uppercase ml-1",children:"Series Title*"}),(0,v.jsx)("input",{type:"text",value:mt.title,onChange:e=>ht({title:e.target.value}),className:"theme-input w-full bg-white text-xs",placeholder:"e.g. Harry Potter"})]}),(0,v.jsxs)("div",{className:"flex justify-end gap-3 pt-2",children:[(0,v.jsx)("button",{type:"button",onClick:()=>gt(!1),className:"text-[10px] font-bold uppercase text-gray-400 hover:text-gray-600 px-4",children:"Discard"}),(0,v.jsxs)("button",{type:"button",disabled:Ft.isPending,onClick:e=>{if(e.preventDefault(),!mt.title)return p.Ay.error("Series title is required!");const t=p.Ay.loading("Saving new series...");Ft.mutate(mt,{onSuccess:e=>{if(e.status){p.Ay.success("Series added & linked!",{id:t});const a=e.data;ze(e=>[...e,a]);const r=a.id||a._id;zt(e=>(0,s.A)((0,s.A)({},e),{},{series:Array.isArray(e.series)?[...e.series,r]:[r],series_number:"1"})),gt(!1),ht({title:""})}},onError:()=>p.Ay.error("Failed to save series",{id:t})})},className:"bg-primary text-white px-6 py-2 rounded font-bold text-[10px] uppercase shadow-md flex items-center gap-2 hover:brightness-110 disabled:opacity-50",children:[Ft.isPending?(0,v.jsx)(i.A,{size:14,className:"animate-spin"}):(0,v.jsx)(l.A,{size:14})," Save & Link Series"]})]})]})]})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight",children:"Series number"}),(0,v.jsxs)("div",{className:"col-span-9",children:[(0,v.jsx)("input",{name:"series_number",type:"number",value:Pt.series_number||"",onChange:Tt,className:"theme-input w-full md:w-1/3",placeholder:"e.g. 1, 2, 3"}),(0,v.jsx)("p",{className:"text-[10px] text-gray-400 mt-1",children:"Automatically suggested based on series count (editable)."})]})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight",children:"INR Price"}),(0,v.jsx)("div",{className:"col-span-9",children:(0,v.jsx)("input",{name:"inr_price",type:"number",value:Pt.inr_price||"",onChange:Tt,className:"theme-input w-full md:w-1/3",placeholder:"Price in Indian Rupees"})})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight",children:"Price*"}),(0,v.jsx)("div",{className:"col-span-9",children:(0,v.jsx)("input",{name:"price",type:"number",value:Pt.price||"",onChange:Tt,className:"theme-input w-full md:w-1/3"})})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight",children:"Real price"}),(0,v.jsx)("div",{className:"col-span-9",children:(0,v.jsx)("input",{name:"real_price",type:"number",value:Pt.real_price||"",onChange:Tt,className:"theme-input w-full md:w-1/3 bg-gray-50",readOnly:!0,title:"Auto-calculated based on discount"})})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight",children:"Discount"}),(0,v.jsx)("div",{className:"col-span-9",children:(0,v.jsx)("input",{name:"discount",type:"number",value:Pt.discount||"",onChange:Tt,className:"theme-input w-32",placeholder:"%"})})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-start border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight pt-1",children:"Stock"}),(0,v.jsxs)("div",{className:"col-span-9 space-y-2",children:[(0,v.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[(0,v.jsx)("input",{type:"radio",name:"stock",value:"active",onChange:Tt,className:"accent-primary",defaultChecked:!0})," active"]}),(0,v.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[(0,v.jsx)("input",{type:"radio",name:"stock",value:"inactive",onChange:Tt,className:"accent-primary"})," inactive"]})]})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight",children:"Availability"}),(0,v.jsx)("div",{className:"col-span-9",children:(0,v.jsx)("input",{name:"availability",type:"text",onCh
2ange:Tt,className:"theme-input w-full"})})]}),(0,v.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-4 items-start border-b border-gray-50 pb-12",children:[(0,v.jsx)("label",{className:"col-span-3 text-left md:text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight pt-2",children:"Synopsis"}),(0,v.jsx)("div",{className:"col-span-9 border rounded-md overflow-hidden shadow-sm",children:(0,v.jsx)(g(),{ref:a,value:R,config:$t,onBlur:e=>T(e)})})]}),(0,v.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-4 items-start border-b border-gray-50 pb-12",children:[(0,v.jsx)("label",{className:"col-span-3 text-left md:text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight pt-2",children:"From the critics"}),(0,v.jsx)("div",{className:"col-span-9 border rounded-md overflow-hidden shadow-sm",children:(0,v.jsx)(g(),{value:I,config:$t,onBlur:e=>U(e)})})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center border-b border-gray-50 pb-4 mt-6",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight",children:"Notes"}),(0,v.jsx)("div",{className:"col-span-9",children:(0,v.jsx)("input",{name:"notes",type:"text",onChange:Tt,className:"theme-input w-full"})})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-start border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight pt-3",children:"Publisher"}),(0,v.jsxs)("div",{className:"col-span-9 space-y-3",children:[(0,v.jsxs)("div",{className:"relative",children:[(0,v.jsxs)("div",{className:"border border-gray-300 rounded p-2 bg-white cursor-pointer min-h-[38px] flex justify-between items-center hover:border-primary transition-colors theme-input w-full md:w-1/2",onClick:()=>Ue(!Ie),children:[(0,v.jsx)("span",{className:Pt.publisher?"text-gray-700 font-medium":"text-gray-400 text-sm",children:Pt.publisher?Be[String(Pt.publisher)]||(null===(e=Me.find(e=>(e.id||e._id)===Pt.publisher))||void 0===e?void 0:e.title)||"Selected Publisher":"Select Publisher"}),(0,v.jsx)(n.A,{size:14,className:"text-gray-400"})]}),Ie&&(0,v.jsxs)("div",{className:"absolute z-20 top-full left-0 w-full md:w-1/2 bg-white border border-gray-300 rounded shadow-lg mt-1 flex flex-col overflow-hidden animate-in fade-in zoom-in-95",children:[(0,v.jsx)("div",{className:"p-2 border-b bg-gray-50",children:(0,v.jsx)("input",{type:"text",placeholder:"Search publishers...",value:Re,onChange:e=>Te(e.target.value),onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onContextMenu:e=>e.stopPropagation(),className:"w-full text-xs p-1.5 border rounded outline-none",autoFocus:!0})}),(0,v.jsx)("div",{className:"max-h-48 overflow-y-auto",children:$e?(0,v.jsx)("div",{className:"p-3 text-xs text-gray-400 text-center",children:"Searching..."}):Re.length>1?0===qe.length?(0,v.jsx)("div",{className:"p-3 text-xs text-gray-400 text-center",children:"No publishers found"}):qe.map(e=>(0,v.jsx)("div",{onClick:()=>
2Jt(e),className:"px-3 py-2 text-sm hover:bg-primary/5 cursor-pointer",children:e.title||e.name},e.id||e._id)):Me.filter(e=>(e.title||e.name||"").toLowerCase().includes(Re.toLowerCase())).map(e=>(0,v.jsx)("div",{onClick:()=>Jt(e),className:"px-3 py-2 text-sm hover:bg-primary/5 cursor-pointer",children:e.title||e.name},e.id||e._id))})]})]}),(0,v.jsx)("div",{className:"flex justify-start",children:(0,v.jsxs)("button",{type:"button",onClick:()=>Nt(!jt),className:"bg-gray-100 border border-gray-300 px-4 py-1.5 rounded text-[11px] font-bold uppercase text-gray-700 hover:bg-gray-200 shadow-sm flex items-center gap-2",children:[jt?(0,v.jsx)(d.A,{size:14}):(0,v.jsx)(o.A,{size:14})," Add new publisher"]})}),jt&&(0,v.jsxs)("div",{className:"mt-4 p-6 bg-cream-50/50 border-2 border-primary/10 rounded-xl space-y-4 animate-in slide-in-from-top-2 max-h-[600px] overflow-y-auto custom-scrollbar shadow-inner",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 text-primary border-b border-primary/10 pb-2 mb-2",children:[(0,v.jsx)(o.A,{size:16,strokeWidth:3}),(0,v.jsx)("h3",{className:"text-xs font-bold uppercase font-montserrat",children:"Quick Publisher Registration"})]}),(0,v.jsx)("div",{className:"grid grid-cols-1 gap-4",children:(0,v.jsxs)("div",{className:"space-y-1",children:[(0,v.jsx)("label",{className:"text-[10px] font-bold text-gray-400 uppercase ml-1",children:"Title*"}),(0,v.jsx)("input",{type:"text",value:Ct.title,onChange:e=>{const t=e.target.value;St((0,s.A)((0,s.A)({},Ct),{},{title:t,slug:t.toLowerCase().replace(/\s+/g,"-")}))},className:"theme-input w-full bg-white text-xs",placeholder:"Publisher Title"})]})}),(0,v.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,v.jsxs)("div",{className:"space-y-1",children:[(0,v.jsx)("label",{className:"text-[10px] font-bold text-gray-400 uppercase ml-1",children:"Email"}),(0,v.jsx)("input",{type:"email",value:Ct.email,onChange:e=>St((0,s.A)((0,s.A)({},Ct),{},{email:e.target.value})),className:"theme-input w-full bg-white text-xs"})]}),(0,v.jsxs)("div",{className:"space-y-1",children:[(0,v.jsx)("label",{className:"text-[10px] font-bold text-gray-400 uppercase ml-1",children:"Image"}),(0,v.jsxs)("div",{className:"flex items-center gap-2",children:[(0,v.jsxs)("label",{className:"cursor-pointer bg-white border border-gray-300 px-3 py-1.5 rounded text-[10px] font-bold uppercase hover:bg-gray-50 flex items-center gap-1 shadow-sm",children:[(0,v.jsx)(c.A,{size:12})," ",wt?"Changed":"Upload",(0,v.jsx)("input",{type:"file",className:"hidden",onChange:e=>{const t=e.target.files[0];t&&((0,y.$)(t)?(_t(t),kt(URL.createObjectURL(t))):e.target.value="")}})]}),At&&(0,v.jsx)("img",{src:At,className:"h-8 w-8 object-contain rounded border bg-white",alt:"prev"})]})]})]}),(0,v.jsxs)("div",{className:"grid grid-cols-1 gap-3",children:[(0,v.jsx)("input",{type:"text",placeholder:"Address",value:Ct.address,onChange:e=>St((0,s.A)((0,s.A)({},Ct),{},{address:e.target.value})),className:"theme-input w-full bg-white text-xs"}),(0,v.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,v.jsx)("input",{type:"text",placeholder:"Place",value:Ct.place,onChange:e=>St((0,s.A)((0,s.A)({},Ct),{},{place:e.target.value})),className:"theme-input text-xs"}),(0,v.jsx)("input",{type:"text",placeholder:"Phone",value:Ct.phone,onChange:e=>St((0,s.A)((0,s.A)({},Ct),{},{phone:e.target.value})),className:"theme-input text-xs"}),(0,v.jsx)("input",{type:"number",placeholder:"Order",value:Ct.order,onChange:e=>St((0,s.A)((0,s.A)({},Ct),{},{order:e.target.value})),className:"theme-input text-xs"})]})]}),(0,v.jsxs)("div",{className:"flex justify-end gap-3 pt-4 border-t border-primary/10",children:[(0,v.jsx)("button",{type:"button",onClick:()=>Nt(!1),className:"text-[10px] font-bold uppercase text-gray-400 px-4",children:"Discard"}),(0,v.jsxs)("button",{type:"button",disabled:Mt.isPending,onClick:e=>{if(e.preventDefault(),!Ct.title)return p.Ay.error("Title is required!");const t=p.Ay.loading("Saving publisher..."),a=new FormData;Object.keys(Ct).forEach(e=>{("date"!==e||Ct[e])&&a.append(e,Ct[e])}),wt&&a.append("image",wt),Mt.mutate(a,{onSuccess:e=>{if(e.status){p.Ay.success("Publisher added & linked!",{id:t});const a=e.data;Fe(e=>[...e,a]),zt(e=>(0,s.A)((0,s.A)({},e),{},{publisher:a.id||a._id})),Nt(!1),St({category:"",title:"",company:"",address:"",place:"",email:"",ph
2one:"",fax:"",date:"",order:"",show:"",slug:"",ship_in_days:""}),_t(null),kt(null)}},onError:()=>p.Ay.error("Save failed",{id:t})})},className:"bg-primary text-white px-6 py-2 rounded font-bold text-[10px] uppercase shadow-md flex items-center gap-2 disabled:opacity-50",children:[Mt.isPending?(0,v.jsx)(i.A,{size:14,className:"animate-spin"}):(0,v.jsx)(l.A,{size:14})," Save & Link Publisher"]})]})]})]})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight",children:"Meta title"}),(0,v.jsx)("div",{className:"col-span-9",children:(0,v.jsx)("input",{name:"meta_title",type:"text",value:Pt.meta_title||"",onChange:Tt,className:"theme-input w-full",placeholder:"Auto-generated from Title & ISBN"})})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight",children:"Meta keywords"}),(0,v.jsx)("div",{className:"col-span-9",children:(0,v.jsx)("input",{name:"meta_keywords",type:"text",onChange:Tt,className:"theme-input w-full"})})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-start border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight pt-2",children:"Meta description"}),(0,v.jsx)("div",{className:"col-span-9",children:(0,v.jsx)("input",{name:"meta_description",type:"text",onChange:Tt,value:Pt.meta_description||"",className:"theme-input w-full ",placeholder:"Auto-generated description..."})})]}),[{label:"Active",name:"active"},{label:"Recommended",name:"recommended"}].map(e=>(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight",children:e.label}),(0,v.jsxs)("div",{className:"col-span-9 flex gap-6",children:[(0,v.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[(0,v.jsx)("input",{type:"radio",name:e.name,value:"active",checked:"active"===Pt[e.name],onChange:Tt,className:"accent-primary w-4 h-4"})," active"]}),(0,v.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[(0,v.jsx)("input",{type:"radio",name:e.name,value:"inactive",checked:"inactive"===Pt[e.name],onChange:Tt,className:"accent-primary w-4 h-4"})," inactive"]})]})]},e.name)),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-start border-b border-gray-50 pb-4 mt-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight pt-1 font-montserrat",children:"Upcoming"}),(0,v.jsxs)("div",{className:"col-span-9",children:[(0,v.jsxs)("div",{className:"flex gap-6 mb-2",children:[(0,v.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer font-body",children:[(0,v.jsx)("input",{type:"radio",name:"upcoming",value:"active",onChange:Tt,checked:"active"===Pt.upcoming,className:"accent-primary w-4 h-4"})," active"]}),(0,v.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer font-body",children:[(0,v.jsx)("input",{type:"radio",name:"upcoming",value:"inactive",onChange:e=>{Tt(e),zt(e=>(0,s.A)((0,s.A)({},e),{},{upcoming_date:""}))},checked:"inactive"===Pt.upcoming,className:"accent-primary w-4 h-4"})," inactive"]})]}),"active"===Pt.upcoming&&(0,v.jsxs)("div",{className:"animate-in fade-in slide-in-from-top-1 duration-300 p-3 bg-orange-50/50 rounded border border-orange-100 mt-2",children:[(0,v.jsx)("label",{className:"block text-[10px] text-orange-600 font-bold mb-1 font-montserrat uppercase",children:"Expected Launch Date"}),(0,v.jsxs)("div",{className:"flex items-center gap-3",children:[(0,v.jsx)("input",{type:"date",name:"upcoming_date",value:Pt.upcoming_date,onChange:Tt,className:"theme-input w-40 border-orange-200 focus:border-orange-400 focus:ring-orange-100"}),(0,v.jsx)("span",{className:"text-gray-400 text-[11px] italic font-body",children:"* This book will be highlighted as 'Pre-Order' or 'Coming Soon'"})]})]})]})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-start border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight pt-1",children:"New release"}),(0,v.jsxs)("div",{className:"col-span-9",children:[(0,v.jsxs)("div",{className:"flex gap-6 mb-2",children:[(0,v.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[(0,v.jsx)("input",{type:"radio",name:"new_release",value:"active",onChange:e=>{Rt(e),bt||yt((new Date).toISOString().split("T")[0])},checked:"active"===Pt.new_release,className:"accent-primary w-4 h-4"})," active"]}),(0,v.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[(0,v.jsx)("input",{type:"radio",name:"new_release",value:"inactive",onChange:Rt,checked:"inactive"===Pt.new_release,className:"accent-primary w-4 h-4"})," inactive"]})]}),"active"===Pt.new_release&&(0,v.jsxs)("div",{className:"animate-in fade-in slide-in-from-top-1 duration-300 p-3 bg-blue-50/50 rounded border border-blue-100",children:[(0,v.jsx)("label",{className:"block text-[10px] text-primary font-bold mb-1",children:"SELECT START DATE"}),(0,v.jsxs)("div",{className:"flex items-center gap-3",children:[(0,v.jsx)("input",{type:"date",value:bt,onCh
2ange:e=>yt(e.target.value),className:"theme-input w-40 border-primary/50"}),(0,v.jsxs)("span",{className:"text-gray-400 text-xs font-bold",children:["+ ",ft," Days (Settings)"]})]}),(0,v.jsxs)("div",{className:"mt-2 text-[11px] text-gray-500",children:['Will stay in "New Arrivals" until: ',(0,v.jsx)("span",{className:"font-bold text-black bg-yellow-100 px-1 rounded",children:Pt.new_release_until||"..."})]})]})]})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight font-montserrat",children:"Exclusive"}),(0,v.jsxs)("div",{className:"col-span-9 flex gap-6",children:[(0,v.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer font-body",children:[(0,v.jsx)("input",{type:"radio",name:"exclusive",value:"active",checked:"active"===Pt.exclusive,onChange:Tt,className:"accent-primary w-4 h-4"})," active"]}),(0,v.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer font-body",children:[(0,v.jsx)("input",{type:"radio",name:"exclusive",value:"inactive",checked:"inactive"===Pt.exclusive,onChange:Tt,className:"accent-primary w-4 h-4"})," inactive"]})]})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight",children:"Ship in days"}),(0,v.jsx)("div",{className:"col-span-9",children:(0,v.jsxs)("select",{name:"ship_days",onChange:Tt,className:"theme-input w-48",children:[(0,v.jsx)("option",{value:"",children:"Select Days"}),["24","1-2","2-4","3-5","1-7","5-7","7-10","7-14","10-15","10-18","14-21","15-25","28","25-30","28-45","30-45"].map(e=>(0,v.jsxs)("option",{value:e,children:[e," Days"]},e))]})})]}),(0,v.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center border-b border-gray-50 pb-4",children:[(0,v.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight",children:"Deliver in days"}),(0,v.jsx)("div",{className:"col-span-9",children:(0,v.jsxs)("select",{name:"deliver_days",onChange:Tt,className:"theme-input w-48",children:[(0,v.jsx)("option",{value:"",children:"Select Days"}),["1-2","3-5","5-7","10-18"].map(e=>(0,v.jsxs)("option",{value:e,children:[e," Days"]},e))]})})]}),(0,v.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-4 items-start border-b border-gray-50 pb-12",children:[(0,v.jsx)("label",{className:"col-span-3 text-left md:text-right text-[11px] font-bold text-gray-500 uppercase tracking-tight pt-2",children:"Search text"}),(0,v.jsx)("div",{className:"col-span-9 border rounded-md overflow-hidden shadow-sm",children:(0,v.jsx)(g(),{value:B,config:$t,onCh
2ange:e=>W(e)})})]}),(0,v.jsxs)("div",{className:"flex justify-center items-center gap-4 pt-10 pb-6 border-t mt-8",children:[(0,v.jsx)("button",{onClick:e=>Kt(e,"stay"),disabled:Ot.isPending,type:"button",className:"flex items-center bg-primary text-white px-8 py-2.5 rounded font-bold text-xs uppercase shadow-md hover:brightness-110 active:scale-95 transition-all disabled:opacity-50",children:Ot.isPending?"Processing...":(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(l.A,{size:16,className:"inline mr-2"})," Save"]})}),(0,v.jsx)("button",{onClick:e=>Kt(e,"back"),type:"button",disabled:Ot.isPending,className:"flex items-center bg-gray-800 text-white px-8 py-2.5 rounded font-bold text-xs uppercase shadow-md hover:bg-gray-900 active:scale-95 transition-all disabled:opacity-50",children:"Save and go back to list"}),(0,v.jsxs)("button",{type:"button",disabled:Ot.isPending,onClick:()=>t("/admin/books"),className:"flex items-center bg-white border border-gray-300 text-gray-600 px-8 py-2.5 rounded font-bold text-xs uppercase shadow-sm hover:bg-gray-50 active:scale-95 transition-all disabled:opacity-50",children:[(0,v.jsx)(d.A,{size:16,className:"mr-2"})," Cancel"]})]})]})})}),(0,v.jsx)("style",{children:'\n .theme-input { \n border: 1px solid #d1d5db; \n border-radius: 4px; \n padding: 8px 12px; \n font-size: 13px; \n outline: none; \n transition: border-color 0.2s; \n }\n .theme-input:focus { \n border-color: #008DDA; \n box-shadow: 0 0 0 2px rgba(0, 141, 218, 0.1); \n }\n\n /* \ud83d\udfe2 NAYI CSS: Number input ke up-down arrows (spinners) hatane ke liye */\n /* Chrome, Safari, Edge, Opera ke liye */\n input[type="number"]::-webkit-outer-spin-button,\n input[type="number"]::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n /* Firefox ke liye */\n input[type="number"] {\n -moz-appearance: textfield;\n }\n '})]})}},9502(e,t,a){a.d(t,{$:()=>r});var s=a(2339);const r=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;if(!e)return!1;const a=e instanceof FileList?Array.from(e):Array.isArray(e)?e:[e],r=1024*t*1024,i=["image/jpeg","image/png","image/webp","image/jpg"];for(let l=0;l<a.length;l++){const e=a[l];if(!i.includes(e.type))return s.Ay.error("\u274c Invalid format: ".concat(e.name,". Only JPG, PNG, and WEBP allowed.")),!1;if(e.size>r)return s.Ay.error("\u274c File too large: ".concat(e.name,". Max size allowed is ").concat(t,"MB.")),!1}return!0}}}]); 3//# sourceMappingURL=9247.06a97fcc.chunk.js.map
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.