Files
appco_dist/.output/public/_nuxt/DBfK_fS6.js
T
2025-08-05 21:16:09 +03:30

8 lines
34 KiB
JavaScript

import{d as V,bm as Je,s as ae,e as et,C as b,k as J,aI as C,bD as tt,aX as Q,aY as ot,aK as Re,r as F,K as _e,b7 as nt,bn as st,bY as Le,bW as it,ae as ie,a$ as Ae,aP as xe,aQ as de,ct as Y,aW as at,aV as rt,bc as lt,be as Pe,cz as ut,aL as dt,a1 as He,bT as ct,b$ as pt,u as be,G,o as me,ak as fe,y as P,z as _,A as r,H as d,D as X,a2 as ee,a3 as ce,F as re,al as le,a7 as ue,aj as Ce,B as A,U as mt,J as te,S as Z,E as Oe,I as Ie,cG as De,az as Ve,ay as ke,N as ft,a5 as vt,a4 as ve,a9 as ge,a8 as gt,Q as ht}from"./l4qGU2QO.js";import{e as se}from"./DWEdiVkG.js";import{f as wt,a as Ue}from"./BQR3x1Fv.js";import{S as yt,a as xt}from"./Ci-uSdqq.js";/* empty css *//* empty css */import{P as _t}from"./DPKLCRhs.js";import{i as Te}from"./CPdY9WI6.js";import{B as pe}from"./CnoIXQ4P.js";import{_ as bt}from"./DlAUqK2U.js";import{_ as Se}from"./C1VA8hux.js";import{C as We}from"./1zD2uc1E.js";import{B as Ct}from"./kbVoKX6w.js";import{U as kt}from"./DjrQXN3k.js";/* empty css */import{_ as St}from"./CJXl8bRJ.js";/* empty css */import{T as $t}from"./BYpAzc8Y.js";import{M as Lt,_ as he,u as Pt}from"./CNiDoGsl.js";import{S as Ke}from"./BxSi6_Vd.js";import{B as Ot}from"./B5y9z2Zl.js";import{u as It,a as Tt}from"./Bq72Mi_i.js";import{g as Mt,a as Me}from"./9L842f8O.js";import{i as Bt,g as Ft,c as Nt,d as Et,a as jt,e as zt}from"./CqHWvl_e.js";function Rt(e){const{selectionStart:i}=e;return e.value.slice(0,i)}function At(e){let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(Array.isArray(i)?i:[i]).reduce((t,s)=>{const l=e.lastIndexOf(s);return l>t.location?{location:l,prefix:s}:t},{location:-1,prefix:""})}function Be(e){return(e||"").toLowerCase()}function Ht(e,i,o){const t=e[0];if(!t||t===o)return e;let s=e;const l=i.length;for(let a=0;a<l;a+=1)if(Be(s[a])!==Be(i[a])){s=s.slice(a);break}else a===l-1&&(s=s.slice(l));return s}function Dt(e,i){const{measureLocation:o,prefix:t,targetText:s,selectionStart:l,split:a}=i;let u=e.slice(0,o);u[u.length-a.length]===a&&(u=u.slice(0,u.length-a.length)),u&&(u=`${u}${a}`);let p=Ht(e.slice(l),s.slice(l-o-t.length),a);p.slice(0,a.length)===a&&(p=p.slice(a.length));const m=`${u}${t}${s}${a}`;return{text:`${m}${p}`,selectionLocation:m.length}}function Vt(e,i){e.setSelectionRange(i,i),e.blur(),e.focus()}function Ut(e,i){const{split:o}=i;return!o||e.indexOf(o)===-1}function Wt(e,i){let{value:o=""}=i;const t=e.toLowerCase();return o.toLowerCase().indexOf(t)!==-1}const qe=Symbol("MentionsContextKey");function Kt(){}const qt=V({compatConfig:{MODE:3},name:"DropdownMenu",props:{prefixCls:String,options:{type:Array,default:()=>[]}},setup(e,i){let{slots:o}=i;const{activeIndex:t,setActiveIndex:s,selectOption:l,onFocus:a=Kt,loading:u}=Je(qe,{activeIndex:ae(),loading:ae(!1)});let p;const m=y=>{clearTimeout(p),p=setTimeout(()=>{a(y)})};return et(()=>{clearTimeout(p)}),()=>{var y;const{prefixCls:k,options:L}=e,n=L[t.value]||{};return b(Lt,{prefixCls:`${k}-menu`,activeKey:n.value,onSelect:h=>{let{key:N}=h;const S=L.find(T=>{let{value:M}=T;return M===N});l(S)},onMousedown:m},{default:()=>[!u.value&&L.map((h,N)=>{var S,T;const{value:M,disabled:z,label:D=h.value,class:U,style:K}=h;return b(he,{key:M,disabled:z,onMouseenter:()=>{s(N)},class:U,style:K},{default:()=>[(T=(S=o.option)===null||S===void 0?void 0:S.call(o,h))!==null&&T!==void 0?T:typeof D=="function"?D(h):D]})}),!u.value&&L.length===0?b(he,{key:"notFoundContent",disabled:!0},{default:()=>[(y=o.notFoundContent)===null||y===void 0?void 0:y.call(o)]}):null,u.value&&b(he,{key:"loading",disabled:!0},{default:()=>[b(Ke,{size:"small"},null)]})]})}}}),Yt={bottomRight:{points:["tl","br"],offset:[0,4],overflow:{adjustX:0,adjustY:1}},bottomLeft:{points:["tr","bl"],offset:[0,4],overflow:{adjustX:0,adjustY:1}},topRight:{points:["bl","tr"],offset:[0,-4],overflow:{adjustX:0,adjustY:1}},topLeft:{points:["br","tl"],offset:[0,-4],overflow:{adjustX:0,adjustY:1}}},Xt=V({compatConfig:{MODE:3},name:"KeywordTrigger",props:{loading:{type:Boolean,default:void 0},options:{type:Array,default:()=>[]},prefixCls:String,placement:String,visible:{type:Boolean,default:void 0},transitionName:String,getPopupContainer:Function,direction:String,dropdownClassName:String},setup(e,i){let{slots:o}=i;const t=()=>`${e.prefixCls}-dropdown`,s=()=>{const{options:a}=e;return b(qt,{prefixCls:t(),options:a},{notFoundContent:o.notFoundContent,option:o.option})},l=J(()=>{const{placement:a,direction:u}=e;let p="topRight";return u==="rtl"?p=a==="top"?"topLeft":"bottomLeft":p=a==="top"?"topRight":"bottomRight",p});return()=>{const{visible:a,transitionName:u,getPopupContainer:p}=e;return b($t,{prefixCls:t(),popupVisible:a,popup:s(),popupClassName:e.dropdownClassName,popupPlacement:l.value,popupTransitionName:u,builtinPlacements:Yt,getPopupContainer:p},{default:o.default})}}}),Zt=ot("top","bottom"),Ye={autofocus:{type:Boolean,default:void 0},prefix:Q.oneOfType([Q.string,Q.arrayOf(Q.string)]),prefixCls:String,value:String,disabled:{type:Boolean,default:void 0},split:String,transitionName:String,placement:Q.oneOf(Zt),character:Q.any,characterRender:Function,filterOption:{type:[Boolean,Function]},validateSearch:Function,getPopupContainer:{type:Function},options:tt(),loading:{type:Boolean,default:void 0},rows:[Number,String],direction:{type:String}},Xe=C(C({},Ye),{dropdownClassName:String}),Ze={prefix:"@",split:" ",rows:1,validateSearch:Ut,filterOption:()=>Wt};Re(Xe,Ze);var Fe=function(e,i){var o={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&i.indexOf(t)<0&&(o[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,t=Object.getOwnPropertySymbols(e);s<t.length;s++)i.indexOf(t[s])<0&&Object.prototype.propertyIsEnumerable.call(e,t[s])&&(o[t[s]]=e[t[s]]);return o};function Ne(){}const Gt=V({compatConfig:{MODE:3},name:"Mentions",inheritAttrs:!1,props:Re(Xe,Ze),emits:["change","select","search","focus","blur","pressenter"],setup(e,i){let{emit:o,attrs:t,expose:s,slots:l}=i;const a=F(null),u=F(null),p=F(),m=_e({value:e.value||"",measuring:!1,measureLocation:0,measureText:null,measurePrefix:"",activeIndex:0,isFocus:!1});nt(()=>{m.value=e.value});const y=v=>{o("change",v)},k=v=>{let{target:{value:c}}=v;y(c)},L=(v,c,$)=>{C(m,{measuring:!0,measureText:v,measurePrefix:c,measureLocation:$,activeIndex:0})},n=v=>{C(m,{measuring:!1,measureLocation:0,measureText:null}),v==null||v()},h=v=>{const{which:c}=v;if(m.measuring){if(c===Y.UP||c===Y.DOWN){const $=W.value.length,O=c===Y.UP?-1:1,f=(m.activeIndex+O+$)%$;m.activeIndex=f,v.preventDefault()}else if(c===Y.ESC)n();else if(c===Y.ENTER){if(v.preventDefault(),!W.value.length){n();return}const $=W.value[m.activeIndex];U($)}}},N=v=>{const{key:c,which:$}=v,{measureText:O,measuring:f}=m,{prefix:x,validateSearch:H}=e,R=v.target;if(R.composing)return;const E=Rt(R),{location:j,prefix:w}=At(E,x);if([Y.ESC,Y.UP,Y.DOWN,Y.ENTER].indexOf($)===-1)if(j!==-1){const g=E.slice(j+w.length),I=H(g,e),B=!!q(g).length;I?(c===w||c==="Shift"||f||g!==O&&B)&&L(g,w,j):f&&n(),I&&o("search",g,w)}else f&&n()},S=v=>{m.measuring||o("pressenter",v)},T=v=>{z(v)},M=v=>{D(v)},z=v=>{clearTimeout(p.value);const{isFocus:c}=m;!c&&v&&o("focus",v),m.isFocus=!0},D=v=>{p.value=setTimeout(()=>{m.isFocus=!1,n(),o("blur",v)},100)},U=v=>{const{split:c}=e,{value:$=""}=v,{text:O,selectionLocation:f}=Dt(m.value,{measureLocation:m.measureLocation,targetText:$,prefix:m.measurePrefix,selectionStart:u.value.getSelectionStart(),split:c});y(O),n(()=>{Vt(u.value.input,f)}),o("select",v,m.measurePrefix)},K=v=>{m.activeIndex=v},q=v=>{const c=v||m.measureText||"",{filterOption:$}=e;return e.options.filter(f=>$?$(c,f):!0)},W=J(()=>q());return s({blur:()=>{u.value.blur()},focus:()=>{u.value.focus()}}),st(qe,{activeIndex:Le(m,"activeIndex"),setActiveIndex:K,selectOption:U,onFocus:z,onBlur:D,loading:Le(e,"loading")}),it(()=>{ie(()=>{m.measuring&&(a.value.scrollTop=u.value.getScrollTop())})}),()=>{const{measureLocation:v,measurePrefix:c,measuring:$}=m,{prefixCls:O,placement:f,transitionName:x,getPopupContainer:H,direction:R}=e,E=Fe(e,["prefixCls","placement","transitionName","getPopupContainer","direction"]),{class:j,style:w}=t,g=Fe(t,["class","style"]),I=Ae(E,["value","prefix","split","validateSearch","filterOption","options","loading"]),B=C(C(C({},I),g),{onChange:Ne,onSelect:Ne,value:m.value,onInput:k,onBlur:M,onKeydown:h,onKeyup:N,onFocus:T,onPressenter:S});return b("div",{class:xe(O,j),style:w},[b(Ot,de(de({},B),{},{ref:u,tag:"textarea"}),null),$&&b("div",{ref:a,class:`${O}-measure`},[m.value.slice(0,v),b(Xt,{prefixCls:O,transitionName:x,dropdownClassName:e.dropdownClassName,placement:f,options:$?W.value:[],visible:!0,direction:R,getPopupContainer:H},{default:()=>[b("span",null,[c])],notFoundContent:l.notFoundContent,option:l.option}),m.value.slice(v+c.length)])])}}}),Qt={value:String,disabled:Boolean,payload:at()},Ge=C(C({},Qt),{label:rt([])}),Qe={name:"Option",props:Ge,render(e,i){let{slots:o}=i;var t;return(t=o.default)===null||t===void 0?void 0:t.call(o)}};V(C({compatConfig:{MODE:3}},Qe));const Jt=e=>{const{componentCls:i,colorTextDisabled:o,controlItemBgHover:t,controlPaddingHorizontal:s,colorText:l,motionDurationSlow:a,lineHeight:u,controlHeight:p,inputPaddingHorizontal:m,inputPaddingVertical:y,fontSize:k,colorBgElevated:L,borderRadiusLG:n,boxShadowSecondary:h}=e,N=Math.round((e.controlHeight-e.fontSize*e.lineHeight)/2);return{[i]:C(C(C(C(C({},Pe(e)),Ft(e)),{position:"relative",display:"inline-block",height:"auto",padding:0,overflow:"hidden",lineHeight:u,whiteSpace:"pre-wrap",verticalAlign:"bottom"}),Nt(e,i)),{"&-disabled":{"> textarea":C({},zt(e))},"&-focused":C({},jt(e)),[`&-affix-wrapper ${i}-suffix`]:{position:"absolute",top:0,insetInlineEnd:m,bottom:0,zIndex:1,display:"inline-flex",alignItems:"center",margin:"auto"},[`> textarea, ${i}-measure`]:{color:l,boxSizing:"border-box",minHeight:p-2,margin:0,padding:`${y}px ${m}px`,overflow:"inherit",overflowX:"hidden",overflowY:"auto",fontWeight:"inherit",fontSize:"inherit",fontFamily:"inherit",fontStyle:"inherit",fontVariant:"inherit",fontSizeAdjust:"inherit",fontStretch:"inherit",lineHeight:"inherit",direction:"inherit",letterSpacing:"inherit",whiteSpace:"inherit",textAlign:"inherit",verticalAlign:"top",wordWrap:"break-word",wordBreak:"inherit",tabSize:"inherit"},"> textarea":C({width:"100%",border:"none",outline:"none",resize:"none",backgroundColor:"inherit"},Et(e.colorTextPlaceholder)),[`${i}-measure`]:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,zIndex:-1,color:"transparent",pointerEvents:"none","> span":{display:"inline-block",minHeight:"1em"}},"&-dropdown":C(C({},Pe(e)),{position:"absolute",top:-9999,insetInlineStart:-9999,zIndex:e.zIndexPopup,boxSizing:"border-box",fontSize:k,fontVariant:"initial",backgroundColor:L,borderRadius:n,outline:"none",boxShadow:h,"&-hidden":{display:"none"},[`${i}-dropdown-menu`]:{maxHeight:e.dropdownHeight,marginBottom:0,paddingInlineStart:0,overflow:"auto",listStyle:"none",outline:"none","&-item":C(C({},ut),{position:"relative",display:"block",minWidth:e.controlItemWidth,padding:`${N}px ${s}px`,color:l,fontWeight:"normal",lineHeight:u,cursor:"pointer",transition:`background ${a} ease`,"&:hover":{backgroundColor:t},"&:first-child":{borderStartStartRadius:n,borderStartEndRadius:n,borderEndStartRadius:0,borderEndEndRadius:0},"&:last-child":{borderStartStartRadius:0,borderStartEndRadius:0,borderEndStartRadius:n,borderEndEndRadius:n},"&-disabled":{color:o,cursor:"not-allowed","&:hover":{color:o,backgroundColor:t,cursor:"not-allowed"}},"&-selected":{color:l,fontWeight:e.fontWeightStrong,backgroundColor:t},"&-active":{backgroundColor:t}})}})})}},eo=lt("Mentions",e=>{const i=Bt(e);return[Jt(i)]},e=>({dropdownHeight:250,controlItemWidth:100,zIndexPopup:e.zIndexPopupBase+50}));var Ee=function(e,i){var o={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&i.indexOf(t)<0&&(o[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,t=Object.getOwnPropertySymbols(e);s<t.length;s++)i.indexOf(t[s])<0&&Object.prototype.propertyIsEnumerable.call(e,t[s])&&(o[t[s]]=e[t[s]]);return o};function to(){return!0}const oo=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{prefix:o="@",split:t=" "}=i,s=Array.isArray(o)?o:[o];return e.split(t).map(function(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",a=null;return s.some(u=>l.slice(0,u.length)===u?(a=u,!0):!1),a!==null?{prefix:a,value:l.slice(a.length)}:null}).filter(l=>!!l&&!!l.value)},no=()=>C(C({},Ye),{loading:{type:Boolean,default:void 0},onFocus:{type:Function},onBlur:{type:Function},onSelect:{type:Function},onChange:{type:Function},onPressenter:{type:Function},"onUpdate:value":{type:Function},notFoundContent:Q.any,defaultValue:String,id:String,status:String}),we=V({compatConfig:{MODE:3},name:"AMentions",inheritAttrs:!1,props:no(),slots:Object,setup(e,i){let{slots:o,emit:t,attrs:s,expose:l}=i;var a,u;const{prefixCls:p,renderEmpty:m,direction:y}=dt("mentions",e),[k,L]=eo(p),n=ae(!1),h=ae(null),N=ae((u=(a=e.value)!==null&&a!==void 0?a:e.defaultValue)!==null&&u!==void 0?u:""),S=It(),T=Tt.useInject(),M=J(()=>Mt(T.status,e.status));Pt({prefixCls:J(()=>`${p.value}-menu`),mode:J(()=>"vertical"),selectable:J(()=>!1),onClick:()=>{},validator:c=>{let{mode:$}=c}}),He(()=>e.value,c=>{N.value=c});const z=c=>{n.value=!0,t("focus",c)},D=c=>{n.value=!1,t("blur",c),S.onFieldBlur()},U=function(){for(var c=arguments.length,$=new Array(c),O=0;O<c;O++)$[O]=arguments[O];t("select",...$),n.value=!0},K=c=>{e.value===void 0&&(N.value=c),t("update:value",c),t("change",c),S.onFieldChange()},q=()=>{const c=e.notFoundContent;return c!==void 0?c:o.notFoundContent?o.notFoundContent():m("Select")},W=()=>{var c;return ct(((c=o.default)===null||c===void 0?void 0:c.call(o))||[]).map($=>{var O,f;return C(C({},pt($)),{label:(f=(O=$.children)===null||O===void 0?void 0:O.default)===null||f===void 0?void 0:f.call(O)})})};l({focus:()=>{h.value.focus()},blur:()=>{h.value.blur()}});const v=J(()=>e.loading?to:e.filterOption);return()=>{const{disabled:c,getPopupContainer:$,rows:O=1,id:f=S.id.value}=e,x=Ee(e,["disabled","getPopupContainer","rows","id"]),{hasFeedback:H,feedbackIcon:R}=T,{class:E}=s,j=Ee(s,["class"]),w=Ae(x,["defaultValue","onUpdate:value","prefixCls"]),g=xe({[`${p.value}-disabled`]:c,[`${p.value}-focused`]:n.value,[`${p.value}-rtl`]:y.value==="rtl"},Me(p.value,M.value),!H&&E,L.value),I=C(C(C(C({prefixCls:p.value},w),{disabled:c,direction:y.value,filterOption:v.value,getPopupContainer:$,options:e.loading?[{value:"ANTDV_SEARCHING",disabled:!0,label:b(Ke,{size:"small"},null)}]:e.options||W(),class:g}),j),{rows:O,onChange:K,onSelect:U,onFocus:z,onBlur:D,ref:h,value:N.value,id:f}),B=b(Gt,de(de({},I),{},{dropdownClassName:L.value}),{notFoundContent:q,option:o.option});return k(H?b("div",{class:xe(`${p.value}-affix-wrapper`,Me(`${p.value}-affix-wrapper`,M.value,H),E,L.value)},[B,b("span",{class:`${p.value}-suffix`},[R])]):B)}}}),ye=V(C(C({compatConfig:{MODE:3}},Qe),{name:"AMentionsOption",props:Ge})),so=C(we,{Option:ye,getMentions:oo,install:e=>(e.component(we.name,we),e.component(ye.name,ye),e)}),io={class:"mt-.5rem"},ao={key:0,class:"video-container"},ro=["src"],lo={key:1,class:"w-full aspect-square flex items-center"},uo=["alt"],co={class:"font-semibold font-azar text-xs"},po={class:"flex items-center"},mo={class:"text-xs"},fo=V({__name:"Content",props:{media:{},name:{},id:{},scrollSave:{}},setup(e){const i=be(),o=G(),t=e,s=F([]);function l(u){const p=document.querySelector(".scrollHome");p&&(sessionStorage.setItem(t.scrollSave,p.scrollTop.toString()),console.log("content",p.scrollTop.toString(),t.scrollSave)),i.push({name:"product_detail-id",params:{id:u}})}me(()=>{const u={root:null,rootMargin:"0px",threshold:.5},p=y=>{y.forEach(k=>{const L=k.target;k.isIntersecting?L.play():L.pause()})},m=new IntersectionObserver(p,u);s.value.forEach(y=>{m.observe(y)})});const a=[_t];return(u,p)=>{const m=fe("lazy");return _(),P("div",io,[b(d(yt),{pagination:!0,modules:a,class:"postConfig !h-unset !aspect-square !m-unset"},{default:X(()=>[(_(!0),P(ee,null,ce(u.media,y=>(_(),re(d(xt),{class:"!w-full !h-unset !aspect-square"},{default:X(()=>[y.type==="video"?(_(),P("div",ao,[r("video",{ref_for:!0,ref_key:"videos",ref:s,src:d(le)(y.url),playsinline:"",muted:"",loop:"",class:"video"},null,8,ro)])):(_(),P("div",lo,[ue(r("img",{alt:d(Ce),class:"w-full"},null,8,uo),[[m,{src:d(le)(y.url),loading:d(Te),error:d(Te)}]])]))]),_:2},1024))),256))]),_:1}),r("div",{class:"flex bg-[#0195f7] text-white px-3 py-3 items-center justify-between",onClick:p[0]||(p[0]=y=>l(u.id))},[r("div",co,A(u.name),1),r("div",po,[r("div",mo,A(d(o).useString("viewProduct")),1),b(pe,{icon:d(o).isRTL?"vuesax-linear:arrow-left-1":"vuesax-linear:arrow-right-1",size:"16"},null,8,["icon"])])])])}}}),vo=bt(fo,[["__scopeId","data-v-8c70fb9e"]]),go="data:image/svg+xml,%3csvg%20width='21'%20height='21'%20viewBox='0%200%2021%2021'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M18.7431%2015.215C19.5381%2013.825%2020.0031%2012.22%2020.0031%2010.5C20.0031%205.255%2015.7481%201%2010.5031%201C5.25811%201%201.00311%205.255%201.00311%2010.5C1.00311%2015.745%205.25811%2020%2010.5031%2020C12.2581%2020%2013.8931%2019.515%2015.3031%2018.69L19.3581%2019.775C19.6481%2019.855%2019.9181%2019.585%2019.8381%2019.295L18.7431%2015.215Z'%20stroke='white'%20stroke-width='2'%20stroke-linejoin='round'/%3e%3c/svg%3e",ho="data:image/svg+xml,%3csvg%20width='21'%20height='21'%20viewBox='0%200%2021%2021'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M18.7431%2015.215C19.5381%2013.825%2020.0031%2012.22%2020.0031%2010.5C20.0031%205.255%2015.7481%201%2010.5031%201C5.25811%201%201.00311%205.255%201.00311%2010.5C1.00311%2015.745%205.25811%2020%2010.5031%2020C12.2581%2020%2013.8931%2019.515%2015.3031%2018.69L19.3581%2019.775C19.6481%2019.855%2019.9181%2019.585%2019.8381%2019.295L18.7431%2015.215Z'%20stroke='black'%20stroke-width='2'%20stroke-linejoin='round'/%3e%3c/svg%3e",wo={key:0,src:go,alt:"comment","cursor-pointer":""},yo={key:1,src:ho,alt:"comment","cursor-pointer":""},xo=V({__name:"comment",setup(e){const i=G();return(o,t)=>d(i).isNightStore?(_(),P("img",wo)):(_(),P("img",yo))}}),_o="data:image/svg+xml,%3csvg%20width='18'%20height='20'%20viewBox='0%200%2018%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9%2011.5L16.94%2019H17V1H1V19H1.06L9%2011.5Z'%20stroke='white'%20stroke-width='2'%20stroke-linejoin='round'/%3e%3c/svg%3e",bo="data:image/svg+xml,%3csvg%20width='18'%20height='20'%20viewBox='0%200%2018%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9%2011.5L16.94%2019H17V1H1V19H1.06L9%2011.5Z'%20stroke='black'%20stroke-width='2'%20stroke-linejoin='round'/%3e%3c/svg%3e",Co="data:image/svg+xml,%3csvg%20width='18'%20height='20'%20viewBox='0%200%2018%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9%2011.5L16.94%2019H17V1H1V19H1.06L9%2011.5Z'%20fill='white'%20stroke='white'%20stroke-width='2'%20stroke-linejoin='round'/%3e%3c/svg%3e",ko="data:image/svg+xml,%3csvg%20width='18'%20height='20'%20viewBox='0%200%2018%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9%2011.5L16.94%2019H17V1H1V19H1.06L9%2011.5Z'%20fill='black'%20stroke='black'%20stroke-width='2'%20stroke-linejoin='round'/%3e%3c/svg%3e",So={key:0,src:_o,alt:"comment","cursor-pointer":""},$o={key:1,src:bo,alt:"comment","cursor-pointer":""},Lo={key:0,src:Co,alt:"comment","cursor-pointer":""},Po={key:1,src:ko,alt:"comment","cursor-pointer":""},Oo=V({__name:"save",props:{isSaved:{type:Boolean}},setup(e){const i=G();return(o,t)=>(_(),re(mt,{name:"fade-nav",mode:"out-in"},{default:X(()=>[o.isSaved?(_(),P(ee,{key:1},[d(i).isNightStore?(_(),P("img",Lo)):(_(),P("img",Po))],64)):(_(),P(ee,{key:0},[d(i).isNightStore?(_(),P("img",So)):(_(),P("img",$o))],64))]),_:1}))}}),Io="data:image/svg+xml,%3csvg%20width='22'%20height='20'%20viewBox='0%200%2022%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M21.0031%201H1.00311L8.50311%208.5M21.0031%201L10.5031%2018.5L8.50311%208.5M21.0031%201L8.50311%208.5'%20stroke='white'%20stroke-width='2'%20stroke-linejoin='round'/%3e%3c/svg%3e",To="data:image/svg+xml,%3csvg%20width='22'%20height='20'%20viewBox='0%200%2022%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M21.0031%201H1.00311L8.50311%208.5M21.0031%201L10.5031%2018.5L8.50311%208.5M21.0031%201L8.50311%208.5'%20stroke='black'%20stroke-width='2'%20stroke-linejoin='round'/%3e%3c/svg%3e",Mo={key:0,src:Io,alt:"comment","cursor-pointer":""},Bo={key:1,class:"rtl:-scale-x-100",src:To,alt:"comment","cursor-pointer":""},Fo=V({__name:"share",setup(e){const i=G();return(o,t)=>d(i).isNightStore?(_(),P("img",Mo)):(_(),P("img",Bo))}}),No=["id"],Eo={class:"flex px-3 items-center justify-between"},jo={alt:"instagram",class:"w-2rem h-2rem rounded-full"},zo={class:"ms-2"},Ro={class:"text-sm font-semibold"},Ao={key:0},Ho={class:"p-4"},Do={class:"flex gap-4 items-center justify-between"},Vo={class:"flex items-center gap-4"},Uo=["aria-disabled"],Wo={class:"mt-2 text-sm"},Ko={class:"font-semibold ms1"},qo={class:"ms-2 font-azar text-xs whitespace-pre-line"},Yo={class:"text-xs mt-1 text-gray-500"},je=100,Zn=V({__name:"Post",props:{post:{},index:{},scrollSave:{},addLikeLoading:{type:Boolean}},emits:["openOption","openComment","handleLike","handleSave"],setup(e,{emit:i}){const o=be(),t=i,s=G(),l=F({}),a=te(),u=n=>(n==null?void 0:n.length)>je;function p(n){t("openOption",n)}function m(n){t("openComment",n)}async function y(n,h,N){if(navigator.share)try{await navigator.share({title:`${s.lang==="fa"?`${Ie.fa} | ${h}`:`${Ie.en} | ${h}`}`,text:`${N}`,url:`${window.location.origin}/product_detail/${n}`})}catch(S){console.error("Sharing failed",S)}else alert("Web Share API not supported in this browser.")}const k=n=>{l.value={...l.value,[n]:!l.value[n]}},L=n=>u(n)?(n==null?void 0:n.slice(0,je))+"...":n;return(n,h)=>{var S,T,M,z,D,U,K,q,W,oe,ne,v,c,$,O,f,x,H,R,E;const N=fe("lazy");return _(),P("div",{class:"w-full mb-2",id:"post-"+n.post.id},[r("div",Eo,[r("div",{class:"flex items-center",onClick:h[0]||(h[0]=j=>{var w,g;return d(o).push({name:"user_detail-id",params:{id:(g=(w=n.post)==null?void 0:w.users)==null?void 0:g.id}})})},[ue(r("img",jo,null,512),[[N,{src:d(le)((T=(S=n.post)==null?void 0:S.users)==null?void 0:T.avatar),loading:d(se),error:d(se)}]]),r("div",zo,[r("div",Ro,A((z=(M=n.post)==null?void 0:M.users)==null?void 0:z.username),1)])]),((U=(D=n.post)==null?void 0:D.users)==null?void 0:U.id)===((K=d(a).user)==null?void 0:K.id)?(_(),P("div",Ao,[b(pe,{icon:"vuesax-linear:more",class:"rotate-90",size:"18",onClick:h[1]||(h[1]=j=>p(n.post.id))})])):Z("",!0)]),b(vo,{media:(q=n.post)==null?void 0:q.files,name:n.post.title_fa,id:n.post.id,scrollSave:n.scrollSave},null,8,["media","name","id","scrollSave"]),r("div",Ho,[r("div",Do,[r("div",Vo,[r("div",{class:"flex items-center gap-1","aria-disabled":n.addLikeLoading,onClick:h[2]||(h[2]=j=>{var w,g;return t("handleLike",(w=n.post.likes)==null?void 0:w.some(I=>{var B;return I.user_id===((B=d(a).user)==null?void 0:B.id)}),(g=n.post)==null?void 0:g.id)})},[b(Se,{"is-liked":(W=n.post.likes)==null?void 0:W.some(j=>{var w;return j.user_id===((w=d(a).user)==null?void 0:w.id)})},null,8,["is-liked"]),Oe(" "+A(((ne=(oe=n.post)==null?void 0:oe.likes)==null?void 0:ne.length)??0),1)],8,Uo),r("div",{class:"flex items-center gap-1",onClick:h[3]||(h[3]=j=>m(n.post.id))},[b(xo),Oe(" "+A(((c=(v=n.post)==null?void 0:v.comments)==null?void 0:c.length)??0),1)]),r("div",{class:"flex items-center gap-1",onClick:h[4]||(h[4]=j=>{var w,g,I;return y((w=n.post)==null?void 0:w.id,(g=n.post)==null?void 0:g.title_fa,(I=n.post)==null?void 0:I.description)})},[b(Fo)])]),r("div",{onClick:h[5]||(h[5]=j=>{var w,g;return t("handleSave",(w=n.post.saved)==null?void 0:w.some(I=>{var B;return I.user_id===((B=d(a).user)==null?void 0:B.id)}),(g=n.post)==null?void 0:g.id)})},[b(Oo,{"is-saved":($=n.post.saved)==null?void 0:$.some(j=>{var w;return j.user_id===((w=d(a).user)==null?void 0:w.id)})},null,8,["is-saved"])])]),r("div",Wo,[r("span",Ko,A((f=(O=n.post)==null?void 0:O.users)==null?void 0:f.username),1),r("span",qo,A(l.value[n.index]?(x=n.post)==null?void 0:x.description:L((H=n.post)==null?void 0:H.description)),1),u((R=n.post)==null?void 0:R.description)?(_(),P("span",{key:0,class:"text-gray cursor-pointer ms-1 whitespace-pre-line",onClick:h[6]||(h[6]=j=>k(n.index))},A(l.value[n.index]?d(s).useString("less"):d(s).useString("more")),1)):Z("",!0),r("div",Yo,A(d(wt)((E=n.post)==null?void 0:E.created_at)),1)])])],8,No)}}}),Xo=["width","height"],Zo=["y"],Go=["y"],Gn=V({__name:"PostCardSkeleton",setup(e){const i=F(!1),o=F(null),t=_e(De(o,{width:0,height:0},{box:"border-box"}));return me(async()=>{i.value=!0}),(s,l)=>i.value?(_(),P("div",{key:0,ref_key:"skeletonRatio",ref:o,class:"h-fit"},[b(d(We),{width:t.width,height:"800"},{default:X(()=>[l[0]||(l[0]=r("circle",{cx:30,cy:"30",r:"20"},null,-1)),l[1]||(l[1]=r("rect",{x:"60",y:"25",rx:"3",ry:"3",width:"100",height:"10"},null,-1)),r("rect",{x:"0",y:"60",rx:"0",ry:"0",width:Math.max(100,t.width),height:Math.max(0,t.width-100)},null,8,Xo),r("rect",{x:"20",y:Math.max(0,t.width-10),rx:"0",ry:"0",width:300,height:10},null,8,Zo),r("rect",{x:"20",y:Math.max(0,t.width+10),rx:"0",ry:"0",width:300,height:8},null,8,Go)]),_:1,__:[0,1]},8,["width"])],512)):Z("",!0)}}),Qn=async e=>await ke.post("/media/create-like",{product_id:e}),Jn=async e=>Ve.fetch("likes","delete",{field:["user_id","product_id"],value:[te().user.id,e]}),Qo=async e=>await ke.post("/media/create-comment-like",{comment_id:e}),Jo=async e=>Ve.fetch("likes","delete",{field:["user_id","comment_id"],value:[te().user.id,e]}),en={class:"mt-4"},tn={class:"flex text-xs gap-2"},on=["alt"],nn={class:"flex-1"},sn={class:"flex gap-2 items-center"},an={class:"text-xs text-gray-500"},rn=["aria-disabled"],ln=V({__name:"SubCommentCard",props:{item:{},addLikeLoading:{type:Boolean}},emits:["likeComment","reply"],setup(e,{emit:i}){const o=te();G();const t=i;return(s,l)=>{var u,p,m,y;const a=fe("lazy");return _(),P("div",en,[r("div",tn,[r("div",null,[ue(r("img",{alt:d(Ce),width:"40",class:"rounded-full aspect-square"},null,8,on),[[a,{src:d(le)((p=(u=s.item)==null?void 0:u.user)==null?void 0:p.avatar),loading:d(se),error:d(se)}]])]),r("div",nn,[r("div",sn,[r("div",null,A(s.item.user.name),1),r("div",an,A(d(Ue)(s.item.created_at)),1)]),r("div",null,A(s.item.message),1)]),r("div",{class:"flex flex-col items-center gap-1 w-14px",onClick:l[0]||(l[0]=k=>{var L;return t("likeComment",(L=s.item.like)==null?void 0:L.some(n=>{var h;return n.user_id===((h=d(o).user)==null?void 0:h.id)}),s.item.id)}),"aria-disabled":s.addLikeLoading},[b(Se,{"is-gray":"","is-liked":(m=s.item.like)==null?void 0:m.some(k=>{var L;return k.user_id===((L=d(o).user)==null?void 0:L.id)})},null,8,["is-liked"]),r("div",null,A((y=s.item.like)==null?void 0:y.length),1)],8,rn)])])}}}),un={class:"mb-5"},dn={class:"flex text-xs gap-2"},cn=["alt"],pn={class:"flex-1"},mn={class:"flex gap-2 items-center"},fn={class:"text-xs text-gray-500"},vn=["aria-disabled"],gn={key:1,class:"ms11"},hn=V({__name:"CommentCard",props:{item:{},addLikeLoading:{type:Boolean}},emits:["likeComment","reply"],setup(e,{emit:i}){const o=te(),t=G(),s=i,l=F(!1);return(a,u)=>{var m,y,k,L,n,h,N;const p=fe("lazy");return _(),P("div",un,[r("div",dn,[r("div",null,[ue(r("img",{alt:d(Ce),width:"40",class:"rounded-full aspect-square"},null,8,cn),[[p,{src:d(le)(a.item.user.avatar),loading:d(se),error:d(se)}]])]),r("div",pn,[r("div",mn,[r("div",null,A(a.item.user.name),1),r("div",fn,A(d(Ue)(a.item.created_at)),1)]),r("div",null,A(a.item.message),1),r("div",{class:"text-gray-5",onClick:u[0]||(u[0]=S=>s("reply"))},A(d(t).useString("reply")),1)]),r("div",{class:"flex flex-col items-center gap-1 w-14px","aria-disabled":a.addLikeLoading,onClick:u[1]||(u[1]=S=>{var T;return s("likeComment",(T=a.item.like)==null?void 0:T.some(M=>{var z;return M.user_id===((z=d(o).user)==null?void 0:z.id)}),a.item.id,!1,a.item.id)})},[b(Se,{"is-gray":"","is-liked":(m=a.item.like)==null?void 0:m.some(S=>{var T;return S.user_id===((T=d(o).user)==null?void 0:T.id)})},null,8,["is-liked"]),r("div",null,A((y=a.item.like)==null?void 0:y.length),1)],8,vn)]),((L=(k=a.item)==null?void 0:k.replies)==null?void 0:L.length)>0?(_(),P(ee,{key:0},[l.value?(_(),P("div",gn,[(_(!0),P(ee,null,ce((N=a.item)==null?void 0:N.replies,S=>(_(),re(ln,{item:S,onLikeComment:T=>{var M;return s("likeComment",(M=S.like)==null?void 0:M.some(z=>{var D;return z.user_id===((D=d(o).user)==null?void 0:D.id)}),S.id,!0,a.item.id)},addLikeLoading:a.addLikeLoading},null,8,["item","onLikeComment","addLikeLoading"]))),256))])):(_(),P("div",{key:0,onClick:u[2]||(u[2]=S=>l.value=!l.value),class:"text-zinc-5 text-xs mt-2 ms-20"},A(d(t).useString("viewMoreReplies",(h=(n=a.item)==null?void 0:n.replies)==null?void 0:h.length)),1))],64)):Z("",!0)])}}}),wn=["width"],yn=V({__name:"CommentCardSkeleton",setup(e){const i=F(!1),o=F(null),t=_e(De(o,{width:0,height:0},{box:"border-box"}));return me(async()=>{i.value=!0}),(s,l)=>i.value?(_(),P("div",{key:0,ref_key:"skeletonRatio",ref:o,class:"h-fit"},[b(d(We),{width:t.width,height:"60"},{default:X(()=>[l[0]||(l[0]=r("circle",{cx:15,cy:"30",r:"15"},null,-1)),l[1]||(l[1]=r("rect",{x:"45",y:"15",rx:"3",ry:"3",width:"100",height:"12"},null,-1)),r("rect",{x:"45",y:"35",rx:"5",ry:"5",width:t.width-100,height:"10"},null,8,wn)]),_:1,__:[0,1]},8,["width"])],512)):Z("",!0)}}),xn=async(e,i=1,o=10)=>{var l;const t=(i-1)*o,s=t+o-1;return(l=await ft.from("comments").select(`*,
user:users(name, avatar),
like:likes(user_id),
replies:comments(*,
user:users(name, avatar),
like:likes(user_id)
)`).eq("product_id",e).is("parent_id",null).range(t,s).order("created_at",{ascending:!1}))==null?void 0:l.data},ze=async(e,i,o=void 0)=>await ke.post("/media/add-comment",{message:e,product_id:i,parent_id:o}),_n={flex:"","justify-center":"","items-center":"","flex-col":"","p-2":""},bn={"mt-1":"","font-semibold":""},Cn={class:"flex items-center"},kn={class:"me-1"},Sn={class:"flex items-center p1"},es=V({__name:"CommentAddEdit",props:{open:{type:Boolean},id:{}},emits:["update:open","addCommentId"],setup(e,{emit:i}){const o=be(),t=G(),s=te(),l=F(null),a=F(!0),u=F(null),p=F(!1),m=F(!1),y=F(!1);te();const k=F(void 0),L=()=>{a.value=u.value.scrollTop<=5};function n(){k.value=void 0}function h(){setTimeout(()=>{var f;(f=document.activeElement)==null||f.scrollIntoView({behavior:"smooth",block:"center"}),p.value=!0},300)}me(()=>{ie(()=>{u.value&&L()})});const N=e,S=i,T=F(!1),M=F([]),z=F(""),D=F(null),U=F(!1),K=F(0),q=F(20),W=async()=>{try{if(!U.value){T.value=!0;const f=await xn(N.id,++K.value,q.value);(f==null?void 0:f.length)<q.value&&(U.value=!0),M.value.push(...f)}}catch(f){console.log("e ===>",f)}finally{T.value=!1}};async function oe(){var f,x;await W(),await ie(),await((f=l.value)==null?void 0:f.setOpen()),await((x=D.value)==null?void 0:x.focus())}async function ne(){var f;await ie(),await((f=l.value)==null?void 0:f.setClose()),v(),n()}function v(){M.value=[],K.value=0,U.value=!1}const c=async()=>{var f,x,H,R;try{if(((f=z.value)==null?void 0:f.length)>0){if(m.value=!0,k.value){const E=await ze(z.value,N.id,k.value.id);(x=k.value)!=null&&x.replies||(k.value.replies=[]),(H=k.value)==null||H.replies.push({message:z.value,user:{name:s.user.name,avatar:s.user.avatar},like:[],...E}),S("addCommentId",E.id)}else{const E=await ze(z.value,N.id);(R=M.value)==null||R.unshift({message:z.value,user:{name:s.user.name,avatar:s.user.avatar},like:[],replies:[],...E}),S("addCommentId",E.id)}await ie(()=>{z.value="",k.value=void 0})}}catch(E){console.log(E)}finally{m.value=!1}};function $(f,x,H,R){var E,j,w;try{if(y.value=!0,ge())if(f)if(Jo(x),H){const g=M.value.find(B=>B.id===R),I=g==null?void 0:g.replies.find(B=>B.id===x);I==null||I.like.splice((E=I.like)==null?void 0:E.findIndex(B=>{var $e;return B.user_id===(($e=s.user)==null?void 0:$e.id)}))}else{const g=M.value.find(I=>I.id===R);g==null||g.like.splice((j=g==null?void 0:g.like)==null?void 0:j.findIndex(I=>{var B;return I.user_id===((B=s.user)==null?void 0:B.id)}))}else if(Qo(x),H){const g=M.value.find(B=>B.id===R),I=g==null?void 0:g.replies.find(B=>B.id===x);I==null||I.like.push({product_id:x,user_id:s.user.id})}else{const g=M.value.find(I=>I.id===R);(w=g==null?void 0:g.like)==null||w.push({product_id:x,user_id:s.user.id})}else o.push({name:"auth-login"}),ht.warn(t.useString("pleaseLoginOrRegister"))}catch(g){console.log(g)}finally{y.value=!1}}const O=F();return vt(O,([{isIntersecting:f}])=>{f&&N.open&&setTimeout(()=>{W()},100)}),He(N,f=>{f.open?oe():ne()}),(f,x)=>{const H=so;return _(),re(Ct,{title:"",ref_key:"sheetRef",ref:l,headerCls:"",allowCloseScrollup:a.value,closeOnClickOutside:"",onOnClickOutside:x[3]||(x[3]=R=>S("update:open",!1)),onOnClose:x[4]||(x[4]=R=>S("update:open",!1))},{header:X(()=>[r("div",_n,[x[5]||(x[5]=r("div",{"bg-gray-500":"","h-2px":"","w-2.5rem":""},null,-1)),r("div",bn,A(d(t).useString("comments")),1)])]),default:X(()=>{var R,E,j;return[r("div",{class:ve(["h-70vh w-full relative relative",d(ge)()?"pb-4rem":""])},[r("div",{class:"h-full px-4 overflow-auto",ref_key:"scrollArea",ref:u,onScroll:L},[(_(!0),P(ee,null,ce(M.value,w=>(_(),re(hn,{item:w,onLikeComment:$,onReply:g=>k.value=w,addLikeLoading:y.value},null,8,["item","onReply","addLikeLoading"]))),256)),T.value?(_(),P(ee,{key:0},ce(5,w=>b(yn)),64)):Z("",!0),ue(r("div",{ref_key:"observer",ref:O,class:"w-full opacity-0 relative"}," load ",512),[[gt,!T.value]])],544),d(ge)()?(_(),P("div",{key:0,class:"flex w-inherit fixed gap-2 items-end my-2 px4 py-1 bottom-1",onFocusin:h,onFocusout:x[2]||(x[2]=w=>p.value=!1)},[b(kt,{width:"40",src:(R=d(s).user)==null?void 0:R.avatar,"just-show-profile":""},null,8,["src"]),r("div",{class:ve(["border-solid w-full border-1 comment_input",k.value?"rounded-3xl":"rounded-full"])},[k.value?(_(),P("div",{key:0,class:ve(["rounded-t-3xl text-xs p3 mb1 flex justify-between",d(t).isNightStore?"bg-zinc-7 text-gray-2":"bg-gray-50 text-gray-4"])},[r("div",Cn,[r("span",null,[r("span",kn,A(d(t).useString("replyingTo")),1),r("span",null,A((j=(E=k.value)==null?void 0:E.user)==null?void 0:j.name),1)])]),b(pe,{icon:"vuesax-linear:add",class:"rotate-45",color:d(t).isNightStore?"bg-zinc-7":"text-gray-4",onClick:x[0]||(x[0]=w=>k.value=void 0)},null,8,["color"])],2)):Z("",!0),r("div",Sn,[b(H,{value:z.value,"onUpdate:value":x[1]||(x[1]=w=>z.value=w),placeholder:d(t).useString("yourComment"),class:"comment_input"},null,8,["value","placeholder"]),b(St,{onClick:c,class:"rounded-full w-3.5rem",type:"primary",loading:m.value},{default:X(()=>[b(pe,{icon:"vuesax-linear:arrow-up"})]),_:1},8,["loading"])])],2)],32)):Z("",!0)],2)]}),_:1},8,["allowCloseScrollup"])}}});export{Gn as _,es as a,Zn as b,Qn as c,Jn as d,Fo as e};