1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9421],{2614:function(e,t,r){r.d(t,{q:function(){return c}});var s=r(85893),l=r(19710),a=r(91444),n=r(14671),i=r(48755),o=r(18974);let c=e=>{let{className:t,textToCopy:r,copyTrigger:c}=e,{t:d}=(0,o.Sk)(),[u,x]=(0,n.Z)();return(0,s.jsx)("button",{onClick:()=>{x(r),a.Am.success(d("copied_to_clipboard","Copied to clipboard"))},type:"button",children:null!=c?c:(0,s.jsx)(l.Z,{className:(0,i.cn)("size-5 text-forest-green-300",t)})})}},79421:function(e,t,r){r.d(t,{R:function(){return ei},H:function(){return ea}});var s=r(85893),l=r(17218),a=r(54676),n=r(41664),i=r.n(n),o=r(98964),c=r(20052),d=r(87917),u=r(2614),x=r(74755),f=r(39504),h=r(56312),m=r(43124),p=r(87536),g=r(1604),v=r(30202),j=r(98029),w=r(91444),b=r(92214),_=r(98493),N=r(2472),y=r(18974),C=r(6815);let O=async e=>{await (0,_.S)();let t=e.slug;if(!t)throw Error("No slug");let r=await b.h.post("/reviews/".concat(t),e.data);return(0,N.JH)(r)},z=e=>{let{t}=(0,y.LD)("profile_page.profile_section.marketplace"),r=(0,v.NL)();return(0,j.D)({mutationFn:O,onSuccess:()=>{r.invalidateQueries({queryKey:C.l.product_offers}),w.Am.success(t("review_posted_toast_message","Your review has been posted successfully."))},onError:N.pE,onSettled:e})},R=async e=>{if(await (0,_.S)(),!e.reviewId)throw Error("Review ID is required");let t=await b.h.patch("/reviews/".concat(e.reviewId),e.data);return(0,N.JH)(t)},E=e=>{let{t}=(0,y.LD)("profile_page.profile_section.marketplace"),r=(0,v.NL)();return(0,j.D)({mutationFn:R,onSuccess:()=>{r.invalidateQueries({queryKey:C.l.product_offers}),w.Am.success(t("review_edited_toast_message","Your review has been edited successfully."))},onError:N.pE,onSettled:e})};var k=r(50048),T=r(82417),I=r(12378),P=r(10996),D=r(23494),S=r(13880);let U=g.z.object({rate:g.z.number().min(1).max(5),description:g.z.string().min(1)}),L={rate:0,description:void 0},A=e=>{let{productOffer:t}=e,{t:r}=(0,y.LD)("profile_page.profile_section.marketplace.rate_user_modal"),{isOpen:l,setIsOpen:a,closeModal:n}=(0,S.E)(),i=z(n),o=(0,p.cI)({resolver:(0,h.F)(U),defaultValues:L});return(0,s.jsxs)(I.Vq,{open:l,onOpenChange:a,children:[(0,s.jsx)(I.hg,{asChild:!0,children:(0,s.jsx)(T.zx,{variant:"outline",className:"h-auto w-auto px-2 py-1 text-sm font-medium text-forest-green-500",children:r("button_text","Rate user")})}),(0,s.jsxs)(I.cZ,{className:"gap-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(I.$N,{className:"text-xl text-forest-green-500",children:r("title","Rate user")}),(0,s.jsx)(I.Be,{className:"text-base text-forest-green-400",children:r("description","How was your experience?")})]}),(0,s.jsx)(P.l0,{...o,children:(0,s.jsx)("form",{onSubmit:o.handleSubmit(e=>{null!=t&&i.mutate({slug:t.slug,data:e})}),children:(0,s.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,s.jsx)(P.Wi,{control:o.control,name:"rate",render:e=>{let{field:t}=e;return(0,s.jsx)(k.J,{size:"large",label:r("rating_label","User rating"),value:t.value,onChange:t.onChange,emptyStarColor:"#00000014",labelClassName:"text-forest-green-500 text-sm font-medium"})}}),(0,s.jsx)(P.Wi,{control:o.control,name:"description",render:e=>{let{field:t}=e;return(0,s.jsxs)(P.xJ,{className:"flex flex-col",children:[(0,s.jsx)(P.lX,{className:"text-forest-green-500",children:r("text_review_label","Text review")}),(0,s.jsx)(D.K,{value:t.value,onChange:t.onChange,className:"rounded-md bg-white px-3 py-2 text-base text-forest-green-500 placeholder:text-base placeholder:text-forest-green-300",rows:4,placeholder:r("text_review_placeholder","Add a text review about the transaction.")}),(0,s.jsx)(P.zG,{})]})}}),(0,s.jsxs)(I.cN,{className:"flex gap-4",children:[(0,s.jsx)(m.GG,{className:"w-full",asChild:!0,children:(0,s.jsx)(T.zx,{variant:"outline",children:r("cancel_button","Cancel")})}),(0,s.jsx)(T.zx,{className:"w-full",disabled:!o.formState.isValid,children:r("submit_button","Rate")})]})]})})})]})]})};var Z=r(43524),J=r(45670),W=r(61027),V=r(21064),q=r(85457),Q=r(48755),G=r(68719),H=r(20987),B=r(93436),F=r(8688),K=r(30920);let Y={reserved:"RESERVED"};function X(e){return(0,H.J)({productOffer:e,getProductOfferImage(){var e,t,r,s,l;return{image:(0,F.J)(null!==(s=null===(t=this.productOffer)||void 0===t?void 0:null===(e=t.image)||void 0===e?void 0:e.path)&&void 0!==s?s:""),fallbackImage:G.Z,alt:null!==(l=null===(r=this.productOffer)||void 0===r?void 0:r.name)&&void 0!==l?l:"product offer image"}},getProductOfferUrl(){return null==this.productOffer?K._.marketplace:"".concat(K._.marketplace,"/").concat(this.productOffer.slug)},getCreatedAt(){return null==this.productOffer?"":(0,B.nQ)(this.productOffer.created_at)},isReserved(){return null!=this.productOffer&&this.productOffer.status===Y.reserved},getUserWhoCanRate(e){let t=this.productOffer;return(0,o.EQ)(e).with("bought",()=>null==t?void 0:t.bought_by).with("sold",()=>null==t?void 0:t.created_by).with("active",()=>void 0).exhaustive()},getUserToDisplayOnCard(e){let t=this.productOffer;return(0,o.EQ)(e).with("sold",()=>null==t?void 0:t.bought_by).otherwise(()=>null==t?void 0:t.created_by)},getReviewToDisplayOnCard(e){let t=this.productOffer,r=null==t?void 0:t.seller_review,s=null==t?void 0:t.buyer_review;return(0,o.EQ)({type:e,sellerReview:r,buyerReview:s}).with({type:"sold",buyerReview:o.P.not(o.P.nullish)},()=>s).with({type:"bought",sellerReview:o.P.not(o.P.nullish)},()=>r).otherwise(()=>null)}})}var $=r(474),M=r(55716),ee=r(24218),et=r(602),er=r(50895);let es=e=>{var t,r;let{review:l}=e,{t:n}=(0,y.LD)("profile_page.profile_section.marketplace.edit_rating_modal"),{isOpen:i,setIsOpen:o,closeModal:c}=(0,S.E)(),d=(0,p.cI)({resolver:(0,h.F)(el),defaultValues:{rate:null!==(t=l.rate)&&void 0!==t?t:0,description:null!==(r=l.description)&&void 0!==r?r:""}}),u=E(c);return(0,s.jsxs)(I.Vq,{open:i,onOpenChange:o,children:[(0,s.jsx)(I.hg,{asChild:!0,children:(0,s.jsx)(T.zx,{variant:"ghost",className:"p-0 h-min",children:(0,s.jsx)(a.Z,{size:20})})}),(0,s.jsxs)(I.cZ,{className:"gap-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(I.$N,{className:"text-xl text-forest-green-500",children:n("title","Edit user rating")}),(0,s.jsx)(I.Be,{className:"text-base text-forest-green-400",children:n("description","How
1was your experience?")})]}),(0,s.jsx)(P.l0,{...d,children:(0,s.jsx)("form",{onSubmit:d.handleSubmit(e=>{l.id&&u.mutate({reviewId:l.id,data:e})}),children:(0,s.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,s.jsx)(P.Wi,{control:d.control,name:"rate",render:e=>{let{field:t}=e;return(0,s.jsx)(k.J,{size:"large",label:n("rating_label","User rating"),value:t.value,onChange:t.onChange,emptyStarColor:"#00000014",labelClassName:"text-forest-green-500 text-sm font-medium"})}}),(0,s.jsx)(P.Wi,{control:d.control,name:"description",render:e=>{let{field:t}=e;return(0,s.jsxs)(P.xJ,{className:"flex flex-col",children:[(0,s.jsx)(P.lX,{className:"text-forest-green-500",children:n("text_review_label","Text review")}),(0,s.jsx)(D.K,{value:t.value,onChange:t.onChange,className:"rounded-md bg-white px-3 py-2 text-base text-forest-green-500 placeholder:text-base placeholder:text-forest-green-300",rows:4,placeholder:n("text_review_placeholder","Add a text review about the transaction.")}),(0,s.jsx)(P.zG,{})]})}}),(0,s.jsxs)(I.cN,{className:"flex gap-4",children:[(0,s.jsx)(m.GG,{className:"w-full",asChild:!0,children:(0,s.jsx)(T.zx,{variant:"outline",children:n("cancel_button","Cancel")})}),(0,s.jsx)(T.zx,{className:"w-full",disabled:!d.formState.isValid||u.isPending,children:n("submit_button","Update rating")})]})]})})})]})]})},el=g.z.object({rate:g.z.number().min(1).max(5),description:g.z.string().min(1)}),ea=e=>{var t;let{type:r,productOffer:l}=e,a=X(l),n=a.getUserWhoCanRate(r),c=(0,er.cT)(n),u=a.getUserToDisplayOnCard(r),h=(0,er.cT)(u);if(null==l)return null;let{image:m,fallbackImage:p,alt:g}=a.getProductOfferImage(),v=a.getProductOfferUrl(),j=a.getCreatedAt(),w=a.getReviewToDisplayOnCard(r),b=a.isReserved(),_="active"===r,N=(0,M.U)(u).getProfileUrl(),y=l.seller_review,C=l.buyer_review,O=(0,o.EQ)({type:r,amITheUserWhoCanRate:c,sellerReview:y,buyerReview:C}).with({type:"sold",amITheUserWhoCanRate:!0,sellerReview:o.P.nullish},()=>(0,s.jsx)(A,{productOffer:l})).with({type:"bought",amITheUserWhoCanRate:!0,buyerReview:o.P.nullish},()=>(0,s.jsx)(A,{productOffer:l})).otherwise(()=>null);return(0,s.jsxs)(V.Zb,{className:"flex min-h-[9.5rem] items-stretch justify-start gap-4 bg-white p-4 lg:gap-6 lg:pr-6",children:[(0,s.jsx)(V.Ol,{className:"flex max-h-[150px] w-[7.5rem] shrink-0 justify-center self-center rounded-md border border-forest-green-100 px-3 py-2",children:(0,s.jsx)(i(),{href:v,children:(0,s.jsx)(J.o,{ratio:1,children:(0,s.jsx)(f.J,{src:m||p,alt:g,fill:!0,className:"w-full object-contain"})})})}),(0,s.jsxs)(V.aY,{className:"flex flex-grow flex-col justify-between gap-2",children:[(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsx)("p",{className:"text-sm text-forest-green-500 opacity-40",children:j}),(0,s.jsx)("div",{className:"flex self-start",children:(0,s.jsx)(eo,{productOffer:l,type:r})}),w&&h&&(0,s.jsx)(es,{review:w})]}),b&&(0,s.jsx)(en,{}),null!=w&&(0,s.jsx)("div",{children:(0,s.jsx)(Z.T,{isStatic:!0,stars:w.rate})}),(0,s.jsxs)("div",{className:"flex flex-col items-start justify-between gap-4 sm:flex-row sm:flex-wrap sm:gap-2 lg:flex-nowrap lg:gap-6",children:[(0,s.jsxs)("div",{className:"flex flex-grow flex-col",children:[(0,s.jsx)(i(),{href:v,children:(0,s.jsx)(q.w,{size:"h4",children:l.name})}),(0,s.jsx)(x.M,{textClassName:"text-base text-forest-green-400",text:null!==(t=null==w?void 0:w.description)&&void 0!==t?t:l.size,expandThreshold:100})]}),!_&&(0,s.jsxs)("div",{className:(0,Q.cn)("flex flex-shrink-0 flex-col items-start gap-4 sm:items-end md:flex-row md:items-center",null!=w&&"md:flex-col md:items-start"),children:[(0,s.jsx)(i(),{href:N,children:(0,s.jsx)(d.VP,{user:u,imgClassName:"size-6 md:size-6 lg:size-8"})}),O]})]})]})]})},en=()=>{let{t:e}=(0,y.LD)("profile_page.profile_section.marketplace");return(0,s.jsx)("div",{className:"self-start",children:(0,s.jsxs)(W.Ct,{bgColor:"sunset-yellow",className:"flex items-center gap-2 rounded",children:[(0,s.jsx)(l.Z,{className:"size-4 text-white"}),(0,s.jsx)("span",{className:"text-xs font-medium leading-loose text-white",children:e("reserved_badge_text","Reserved")})]})})},ei="AVAILABLE",eo=e=>{let{productOffer:t,type:r}=e,l=X(t).getProductOfferUrl(),n=(0,$.m)(l),i="active"===r,o=t.status===ei,d=(0,c.O1)(t)&&i&&o;return(0,s.jsxs)("div",{className:"flex gap-2 lg:mt-1 xl:gap-4",children:[i&&(0,s.jsx)(u.q,{textToCopy:n}),d&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ee.E,{type:"edit",triggerElement:(0,s.jsx)(T.zx,{variant:"ghost",className:"h-auto w-auto p-0",children:(0,s.jsx)(a.Z,{className:"size-5 text-forest-green-300"})}),productOffer:t}),(0,s.jsx)(et.v,{productOffer:t,onlyIcon:!0,noRedirect:!0})]})]})}},474:function(e,t,r){r.d(t,{m:function(){return l}});var s=r(68894);function l(e){return"".concat(s.OB.NEXT_PUBLIC_CLIENT_APP).concat(e)}},602:function(e,t,r){r.d(t,{v:function(){return c}});var s=r(85893),l=r(23825),a=r(9783),n=r(60546),i=r(48755),o=r(18974);let c=e=>{let{t}=(0,o.LD)("marketplace.product_offer.remove_modal"),r=(0,a.DH)(e.productOffer.id,e.noRedirect);return(0,s.jsxs)(n.aR,{children:[(0,s.jsx)(n.vW,{className:(0,i.cn)(!e.onlyIcon&&"flex size-12 shrink-0 items-center justify-center rounded-full bg-error-100"),children:(0,s.jsx)(l.Z,{className:"size-5 text-error-400"})}),(0,s.jsxs)(n._T,{className:"",children:[(0,s.jsx)(n.CI,{}),(0,s.jsxs)(n.fY,{children:[(0,s.jsx)(n.f$,{children:t("title","Remove product from marketplace?")}),(0,s.jsx)(n.yT,{children:t("description","This will remove your product from marketplace with all comments.")})]}),(0,s.jsxs)(n.xo,{children:[(0,s.jsx)(n.le,{className:"flex-grow",children:t("cancel_button","Cancel")}),(0,s.jsx)(n.OL,{className:"flex-grow",onClick:()=>{r.mutate()},children:t("delete_button","Delete")})]})]})]})}}}]);
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.