PageSourceSearch

https://www.shahiin.com/_next/static/chunks/pages/vendor-portal/ai-images-6b903ff61c2a62f2.js

js shahiin.com collected 2026-09-24 14:19:15 UTC 16,901 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6165],{63065:(e,a,s)=>{"use strict";s.r(a),s.d(a,{default:()=>E});var t=s(37876),r=s(14232),l=s(77328),i=s.n(l),n=s(89042),d=s(20727),c=s(77041),o=s(65682),m=s(7446),x=s(36495),h=s(1312),p=s(45884),u=s(498),f=s(3609),g=s(18465),j=s(96575),N=s(94108);let b=()=>{let e=j.AuthService.getJwt();return{"Content-Type":"application/json",Authorization:"Bearer ".concat(e),apikey:N.SUPABASE_ANON_KEY||""}},y=async(e,a)=>{let s=new URLSearchParams({vendor_id:e,...a&&"all"!==a&&{status:a}}),t=await fetch("".concat(N.EDGE_FUNCTIONS_URL,"/ai-image-get-vendor-images?").concat(s),{method:"GET",headers:b()});if(!t.ok)throw Error((await t.json()).error||"Failed to fetch AI images");let r=await t.json();if(!r.success)throw Error(r.error||"Failed to fetch AI images");return r.images||[]},w=async e=>{let a=await fetch("".concat(N.EDGE_FUNCTIONS_URL,"/ai-image-approve"),{method:"POST",headers:b(),body:JSON.stringify({ai_record_id:e})});if(!a.ok)throw Error((await a.json()).error||"Failed to approve AI image")},v=async e=>{let a=await fetch("".concat(N.EDGE_FUNCTIONS_URL,"/ai-image-reject"),{method:"POST",headers:b(),body:JSON.stringify({ai_record_id:e})});if(!a.ok)throw Error((await a.json()).error||"Failed to reject AI image")};var _=s(74725),A=s(89285),C=s(92161);function E(){let{toast:e}=(0,_.dj)(),[a,s]=(0,r.useState)(!0),[l,N]=(0,r.useState)([]),[b,E]=(0,r.useState)([]),[k,S]=(0,r.useState)("all"),[R,U]=(0,r.useState)(null),[z,F]=(0,r.useState)(!1),[O,I]=(0,r.useState)(null);(0,r.useEffect)(()=>{L()},[]),(0,r.useEffect)(()=>{T()},[k,l]);let L=async()=>{try{s(!0);let e=await j.AuthService.getCurrentUserId();if(!e)return;let a=await y(e);N(a)}catch(a){e({title:"خطأ",description:a.message||"فشل تحميل الصور",variant:"destructive"})}finally{s(!1)}},T=()=>{"all"===k?E(l):E(l.filter(e=>e.status===k))},P=async a=>{try{I(a.id),await w(a.id),e({title:"نجح",description:"تم الموافقة على الصورة"}),await L()}catch(a){e({title:"خطأ",description:a.message||"فشل الموافقة على الصورة",variant:"destructive"})}finally{I(null)}},J=async a=>{if(confirm("هل أنت متأكد من رفض هذه الصورة؟"))try{I(a.id),await v(a.id),e({title:"نجح",description:"تم رفض الصورة"}),await L()}catch(a){e({title:"خطأ",description:a.message||"فشل رفض الصورة",variant:"destructive"})}finally{I(null)}},Z=e=>"all"===e?l.length:l.filter(a=>a.status===e).length;return a?(0,t.jsx)(n.T,{title:"صور الذكاء الاصطناعي",children:(0,t.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,t.jsx)(m.A,{className:"h-8 w-8 animate-spin text-blue-600"})})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i(),{children:(0,t.jsx)("title",{children:"صور الذكاء الاصطناعي | بوابة التجار"})}),(0,t.jsxs)(n.T,{title:"صور الذكاء الاصطناعي",children:[(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4 mb-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("h1",{className:"text-2xl font-bold text-gray-900 flex items-center gap-2",children:[(0,t.jsx)(x.A,{className:"h-6 w-6 text-purple-600"}),"صور الذكاء الاصطناعي"]}),(0,t.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:"عرض وإدارة الصور المحسّنة بالذكاء الاصطناعي"})]}),(0,t.jsxs)(c.$,{onClick:L,variant:"outline",disabled:a,children:[(0,t.jsx)(h.A,{className:"ml-2 h-4 w-4 ".concat(a?"animate-spin":"")}),"تحديث"]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 mb-6",children:[(0,t.jsx)(d.Zp,{className:"hover:shadow-md transition-shadow cursor-pointer",onClick:()=>S("all"),children:(0,t.jsxs)(d.Wu,{className:"p-4",children:[(0,t.jsx)("p",{className:"text-sm text-gray-600 mb-1",children:"الكل"}),(0,t.jsx)("p",{className:"text-2xl font-bold text-gray-900",children:Z("all")})]})}),(0,t.jsx)(d.Zp,{className:"hover:shadow-md transition-shadow cursor-pointer",onClick:()=>S("pending"),children:(0,t.jsxs)(d.Wu,{className:"p-4",children:[(0,t.jsx)("p",{className:"text-sm text-gray-600 mb-1",children:"قيد الانتظار"}),(0,t.jsx)("p",{className:"text-2xl font-bold text-yellow-600",children:Z("pending")})]})}),(0,t.jsx)(d.Zp,{className:"hover:shadow-md transition-shadow cursor-pointer",onClick:()=>S("approved"),children:(0,t.jsxs)(d.Wu,{className:"p-4",children:[(0,t.jsx)("p",{className:"text-sm text-gray-600 mb-1",children:"مقبول"}),(0,t.jsx)("p",{className:"text-2xl font-bold text-green-600",children:Z("approved")})]})}),(0,t.jsx)(d.Zp,{className:"hover:shadow-md transition-shadow cursor-pointer",onClick:()=>S("rejected"),children:(0,t.jsxs)(d.Wu,{className:"p-4",children:[(0,t.jsx)("p",{className:"text-sm text-gray-600 mb-1",children:"مرفوض"}),(0,t.jsx)("p",{className:"text-2xl font-bold text-red-600",children:Z("rejected")})]})})]}),(0,t.jsx)("div",{className:"mb-6",children:(0,t.jsxs)(A.l6,{value:k,onValueChange:S,children:[(0,t.jsx)(A.bq,{className:"w-full sm:w-48",children:(0,t.jsx)(A.yv,{placeholder:"تصفية حسب الحالة"})}),(0,t.jsxs)(A.gC,{children:[(0,t.jsx)(A.eb,{value:"all",children:"جميع الصور"}),(0,t.jsx)(A.eb,{value:"pending",children:"قيد الانتظار"}),(0,t.jsx)(A.eb,{value:"processing",children:"قيد المعالجة"}),(0,t.jsx)(A.eb,{value:"approved",children:"مقبول"}),(0,t.jsx)(A.eb,{value:"rejected",children:"مرفوض"})]})]})}),0===b.length?(0,t.jsx)(d.Zp,{children:(0,t.jsxs)(d.Wu,{className:"p-12 text-center",children:[(0,t.jsx)(x.A,{className:"h-16 w-16 mx-auto mb-4 text-gray-300"}),(0,t.jsx)("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"لا توجد صور"}),(0,t.jsx)("p",{className:"text-gray-600",children:"all"===k?"لم يتم إنشاء أي صور محسّنة بالذكاء الاصطناعي بعد":"لا توجد صور بهذه الحالة"})]})}):(0,t.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:b.map(e=>(0,t.jsxs)(d.Zp,{className:"overflow-hidden hover:shadow-lg transition-shadow",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("div",{className:"absolute top-3 right-3 z-10",children:(e=>{let a={pending:{text:"قيد الانتظار",className:"bg-yellow-100 text-yellow-800 border-yellow-200"},processing:{text:"قيد المعالجة",className:"bg-blue-100 text-blue-800 border-blue-200"},approved:{text:"مقبول",className:"bg-green-100 text-green-800 border-green-200"},rejected:{text:"مرفوض",className:"bg-red-100 text-red-800 border-red-200"}},s=a[e]||a.pending;return(0,t.jsx)(o.E,{className:"".concat(s.className," border"),children:s.text})})(e.status)}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-1 bg-gray-100",children:[(0,t.jsxs)("div",{className:"relative aspect-square bg-white",children:[(0,t.jsx)("img",{src:e.original_image_url,alt:"Original",className:"w-full h-full object-cover"}),(0,t.jsx)("div",{className:"absolute bottom-1 left-1 bg-black/70 text-white text-xs px-2 py-1 rounded",children:"الأصلية"})]}),(0,t.jsx)("div",{className:"relative aspect-square bg-white",children:e.ai_image_url?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("img",{src:e.ai_image_url,alt:"AI Enhanced",className:"w-full h-full object-cover"}),(0,t.jsx)("div",{className:"absolute bottom-1 left-1 bg-purple-600/70 text-white text-xs px-2 py-1 rounded",children:"AI"})]}):(0,t.jsx)("div",{className:"w-full h-full flex items-center justify-center",children:(0,t.jsx)(m.A,{className:"h-8 w-8 animate-spin text-gray-400"})})})]})]}),(0,t.jsxs)(d.Wu,{className:"p-4",children:[e.product&&(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,t.jsx)(p.A,{className:"h-3 w-3 text-gray-500"}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:"المنتج"})]}),(0,t.jsx)("p",{className:"text-sm font-semibold text-gray-900 line-clamp-1",children:e.product.name})]}),(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("p",{className:"text-xs text-gray-500 mb-1",children:"الوصف المستخدم"}),(0,t.jsx)("p",{className:"text-xs text-gray-700 line-clamp-2",children:e.prompt})]}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mb-4",children:new Date(e.created_at).toLocaleDateString("ar-SY",{year:"numeric",month:"short",day:"numeric"})}),"pending"===e.status&&e.ai_image_url&&(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(c.$,{size:"sm",variant:"outline",className:"flex-1 border-green-200 text-green-700 hover:bg-green-50",onClick:()=>P(e),disabled:O===e.id,children:O===e.id?(0,t.jsx)(m.A,{className:"h-3 w-3 animate-spin"}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.A,{className:"ml-1 h-3 w-3"}),"موافقة"]})}),(0,t.jsx)(c.$,{size:"sm",variant:"outline",className:"flex-1 border-red-200 text-red-700 hover:bg-red-50",onClick:()=>J(e),disabled:O===e.id,children:O===e.id?(0,t.jsx)(m.A,{className:"h-3 w-3 animate-spin"}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f.A,{className:"ml-1 h-3 w-3"}),"رفض"]})})]}),(0,t.jsxs)(c.$,{size:"sm",variant:"ghost",className:"w-full mt-2",onClick:()=>{U(e),F(!0)},children:[(0,t.jsx)(g.A,{className:"ml-1 h-3 w-3"}),"عرض بالحجم الكامل"]})]})]},e.id))}),(0,t.jsx)(C.lG,{open:z,onOpenChange:F,children:(0,t.jsxs)(C.Cf,{className:"max-w-4xl",children:[(0,t.jsx)(C.c7,{children:(0,t.jsx)(C.L3,{children:"معاينة الصورة"})}),R&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-semibold mb-2 text-center",children:"الصورة الأصلية"}),(0,t.jsx)("img",{src:R.original_image_url,alt:"Original",className:"w-full rounded-lg border"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-semibold mb-2 text-center",children:"الصورة المحسّنة"}),R.ai_image_url?(0,t.jsx)("img",{src:R.ai_image_url,alt:"AI Enhanced",className:"w-full rounded-lg border"}):(0,t.jsx)("div",{className:"w-full aspect-square bg-gray-100 rounded-lg flex items-center justify-center",children:(0,t.jsx)(m.A,{className:"h-8 w-8 animate-spin text-gray-400"})})]})]}),(0,t.jsxs)("div",{className:"pt-4 border-t",children:[(0,t.jsx)("p",{className:"text-sm font-semibold mb-2",children:"الوصف المستخدم:"}),(0,t.jsx)("p",{className:"text-sm text-gray-700",children:R.prompt})]})]})]})})]})]})}},65682:(e,a,s)=>{"use strict";s.d(a,{E:()=>n});var t=s(37876);s(14232);var r=s(47137),l=s(65870);let i=(0,r.F)("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function n(e){let{className:a,variant:s,...r}=e;return(0,t.jsx)("div",{className:(0,l.cn)(i({variant:s}),a),...r})}},89285:(e,a,s)=>{"use strict";s.d(a,{bq:()=>x,eb:()=>f,gC:()=>u,l6:()=>o,yv:()=>m});var t=s(37876),r=s(14232),l=s(94615),i=s(30822),n=s(21575),d=s(33276),c=s(65870);let o=l.bL;l.YJ;let m=l.WT,x=r.forwardRef((e,a)=>{let{className:s,children:r,...n}=e;
1return(0,t.jsxs)(l.l9,{ref:a,className:(0,c.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",s),...n,children:[r,(0,t.jsx)(l.In,{asChild:!0,children:(0,t.jsx)(i.A,{className:"h-4 w-4 opacity-50"})})]})});x.displayName=l.l9.displayName;let h=r.forwardRef((e,a)=>{let{className:s,...r}=e;return(0,t.jsx)(l.PP,{ref:a,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",s),...r,children:(0,t.jsx)(n.A,{className:"h-4 w-4"})})});h.displayName=l.PP.displayName;let p=r.forwardRef((e,a)=>{let{className:s,...r}=e;return(0,t.jsx)(l.wn,{ref:a,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",s),...r,children:(0,t.jsx)(i.A,{className:"h-4 w-4"})})});p.displayName=l.wn.displayName;let u=r.forwardRef((e,a)=>{let{className:s,children:r,position:i="popper",...n}=e;return(0,t.jsx)(l.ZL,{children:(0,t.jsxs)(l.UC,{ref:a,className:(0,c.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===i&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",s),position:i,...n,children:[(0,t.jsx)(h,{}),(0,t.jsx)(l.LM,{className:(0,c.cn)("p-1","popper"===i&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r}),(0,t.jsx)(p,{})]})})});u.displayName=l.UC.displayName,r.forwardRef((e,a)=>{let{className:s,...r}=e;return(0,t.jsx)(l.JU,{ref:a,className:(0,c.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",s),...r})}).displayName=l.JU.displayName;let f=r.forwardRef((e,a)=>{let{className:s,children:r,...i}=e;return(0,t.jsxs)(l.q7,{ref:a,className:(0,c.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...i,children:[(0,t.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,t.jsx)(l.VF,{children:(0,t.jsx)(d.A,{className:"h-4 w-4"})})}),(0,t.jsx)(l.p4,{children:r})]})});f.displayName=l.q7.displayName,r.forwardRef((e,a)=>{let{className:s,...r}=e;return(0,t.jsx)(l.wv,{ref:a,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",s),...r})}).displayName=l.wv.displayName},90376:(e,a,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/vendor-portal/ai-images",function(){return s(63065)}])},92161:(e,a,s)=>{"use strict";s.d(a,{Cf:()=>x,L3:()=>p,c7:()=>h,lG:()=>d,rr:()=>u,zM:()=>c});var t=s(37876),r=s(14232),l=s(26303),i=s(70672),n=s(65870);let d=l.bL,c=l.l9,o=l.ZL;l.bm;let m=r.forwardRef((e,a)=>{let{className:s,...r}=e;return(0,t.jsx)(l.hJ,{ref:a,className:(0,n.cn)("fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...r})});m.displayName=l.hJ.displayName;let x=r.forwardRef((e,a)=>{let{className:s,children:r,...d}=e;return(0,t.jsxs)(o,{children:[(0,t.jsx)(m,{}),(0,t.jsxs)(l.UC,{ref:a,className:(0,n.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rou
1nded-lg",s),"aria-describedby":"dialog-description",...d,children:[r,(0,t.jsxs)(l.bm,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,t.jsx)(i.A,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});x.displayName=l.UC.displayName;let h=e=>{let{className:a,...s}=e;return(0,t.jsx)("div",{className:(0,n.cn)("flex flex-col space-y-1.5 text-center sm:text-left",a),...s})};h.displayName="DialogHeader";let p=r.forwardRef((e,a)=>{let{className:s,...r}=e;return(0,t.jsx)(l.hE,{ref:a,className:(0,n.cn)("text-lg font-semibold leading-none tracking-tight",s),...r})});p.displayName=l.hE.displayName;let u=r.forwardRef((e,a)=>{let{className:s,...r}=e;return(0,t.jsx)(l.VY,{ref:a,id:"dialog-description",className:(0,n.cn)("text-sm text-muted-foreground",s),...r})});u.displayName=l.VY.displayName}},e=>{e.O(0,[1987,8524,3740,633,7224,6514,2347,9376,9334,9042,636,6593,8792],()=>e(e.s=90376)),_N_E=e.O()}]);

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.