14 lines
37 KiB
JavaScript
14 lines
37 KiB
JavaScript
import{d as H,aT as Ie,s as fe,e as lt,C,k as W,aB as S,aK as ie,bo as ut,aR as ct,aJ as De,r as O,I as He,bb as dt,a9 as ft,bR as je,bP as pt,ae as oe,bn as ze,aH as _e,a5 as he,aI as Se,co as J,aP as mt,aQ as vt,a_ as gt,b6 as Me,cu as ht,aD as yt,$ as Le,bM as wt,bU as xt,G as re,J as y,y as $,z as A,F as pe,T as bt,D as Y,a0 as ce,aq as ye,H as de,ap as $e,cC as Ve,ai as Ue,A as m,B as E,cD as Ct,bS as ke,a2 as le,a1 as Oe,S as ue,cA as _t,o as Ke,M as St,u as We,a3 as kt,a8 as we,a6 as Ot,cE as Ye,P as Pe,cF as Pt}from"./D9_UoUeZ.js";import{B as qe}from"./DUyB6TM5.js";import{a as Ze}from"./Da4GJYa-.js";import{e as ge}from"./Cr9IxpvL.js";import{a as Xe,_ as Ge}from"./CeBd9vH3.js";import{B as Q}from"./iCGCN3gx.js";import{_ as It}from"./DlAUqK2U.js";import{C as Lt}from"./xIZO8mng.js";import{U as $t}from"./CTRz734b.js";import"./DtmCxWXi.js";import{B as jt}from"./D72ALlip.js";import{T as Mt}from"./PF-7vMOJ.js";import{M as Tt,_ as xe,u as Bt}from"./DtVgA60k.js";import{S as Je}from"./CX_9C0QJ.js";import{a as At}from"./cCboYNG-.js";import{u as Et,b as Ft}from"./DGGMJEpV.js";import{g as Nt,a as Te}from"./Dr89U1pn.js";import{i as Rt,g as Dt,c as Ht,d as zt,a as Vt,e as Ut}from"./Un5QC_jd.js";import"./Cq497dur.js";import{u as Kt}from"./Dxbb2UFv.js";function Wt(e){const{selectionStart:s}=e;return e.value.slice(0,s)}function Yt(e){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(Array.isArray(s)?s:[s]).reduce((t,l)=>{const u=e.lastIndexOf(l);return u>t.location?{location:u,prefix:l}:t},{location:-1,prefix:""})}function Be(e){return(e||"").toLowerCase()}function qt(e,s,n){const t=e[0];if(!t||t===n)return e;let l=e;const u=s.length;for(let i=0;i<u;i+=1)if(Be(l[i])!==Be(s[i])){l=l.slice(i);break}else i===u-1&&(l=l.slice(u));return l}function Zt(e,s){const{measureLocation:n,prefix:t,targetText:l,selectionStart:u,split:i}=s;let d=e.slice(0,n);d[d.length-i.length]===i&&(d=d.slice(0,d.length-i.length)),d&&(d=`${d}${i}`);let v=qt(e.slice(u),l.slice(u-n-t.length),i);v.slice(0,i.length)===i&&(v=v.slice(i.length));const f=`${d}${t}${l}${i}`;return{text:`${f}${v}`,selectionLocation:f.length}}function Xt(e,s){e.setSelectionRange(s,s),e.blur(),e.focus()}function Gt(e,s){const{split:n}=s;return!n||e.indexOf(n)===-1}function Jt(e,s){let{value:n=""}=s;const t=e.toLowerCase();return n.toLowerCase().indexOf(t)!==-1}const Qe=Symbol("MentionsContextKey");function Qt(){}const en=H({compatConfig:{MODE:3},name:"DropdownMenu",props:{prefixCls:String,options:{type:Array,default:()=>[]}},setup(e,s){let{slots:n}=s;const{activeIndex:t,setActiveIndex:l,selectOption:u,onFocus:i=Qt,loading:d}=Ie(Qe,{activeIndex:fe(),loading:fe(!1)});let v;const f=b=>{clearTimeout(v),v=setTimeout(()=>{i(b)})};return lt(()=>{clearTimeout(v)}),()=>{var b;const{prefixCls:r,options:p}=e,o=p[t.value]||{};return C(Tt,{prefixCls:`${r}-menu`,activeKey:o.value,onSelect:c=>{let{key:w}=c;const a=p.find(g=>{let{value:B}=g;return B===w});u(a)},onMousedown:f},{default:()=>[!d.value&&p.map((c,w)=>{var a,g;const{value:B,disabled:M,label:k=c.value,class:T,style:F}=c;return C(xe,{key:B,disabled:M,onMouseenter:()=>{l(w)},class:T,style:F},{default:()=>[(g=(a=n.option)===null||a===void 0?void 0:a.call(n,c))!==null&&g!==void 0?g:typeof k=="function"?k(c):k]})}),!d.value&&p.length===0?C(xe,{key:"notFoundContent",disabled:!0},{default:()=>[(b=n.notFoundContent)===null||b===void 0?void 0:b.call(n)]}):null,d.value&&C(xe,{key:"loading",disabled:!0},{default:()=>[C(Je,{size:"small"},null)]})]})}}}),tn={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}}},nn=H({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,s){let{slots:n}=s;const t=()=>`${e.prefixCls}-dropdown`,l=()=>{const{options:i}=e;return C(en,{prefixCls:t(),options:i},{notFoundContent:n.notFoundContent,option:n.option})},u=W(()=>{const{placement:i,direction:d}=e;let v="topRight";return d==="rtl"?v=i==="top"?"topLeft":"bottomLeft":v=i==="top"?"topRight":"bottomRight",v});return()=>{const{visible:i,transitionName:d,getPopupContainer:v}=e;return C(Mt,{prefixCls:t(),popupVisible:i,popup:l(),popupClassName:e.dropdownClassName,popupPlacement:u.value,popupTransitionName:d,builtinPlacements:tn,getPopupContainer:v},{default:n.default})}}}),on=ct("top","bottom"),et={autofocus:{type:Boolean,default:void 0},prefix:ie.oneOfType([ie.string,ie.arrayOf(ie.string)]),prefixCls:String,value:String,disabled:{type:Boolean,default:void 0},split:String,transitionName:String,placement:ie.oneOf(on),character:ie.any,characterRender:Function,filterOption:{type:[Boolean,Function]},validateSearch:Function,getPopupContainer:{type:Function},options:ut(),loading:{type:Boolean,default:void 0},rows:[Number,String],direction:{type:String}},tt=S(S({},et),{dropdownClassName:String}),nt={prefix:"@",split:" ",rows:1,validateSearch:Gt,filterOption:()=>Jt};De(tt,nt);var Ae=function(e,s){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&s.indexOf(t)<0&&(n[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var l=0,t=Object.getOwnPropertySymbols(e);l<t.length;l++)s.indexOf(t[l])<0&&Object.prototype.propertyIsEnumerable.call(e,t[l])&&(n[t[l]]=e[t[l]]);return n};function Ee(){}const sn=H({compatConfig:{MODE:3},name:"Mentions",inheritAttrs:!1,props:De(tt,nt),emits:["change","select","search","focus","blur","pressenter"],setup(e,s){let{emit:n,attrs:t,expose:l,slots:u}=s;const i=O(null),d=O(null),v=O(),f=He({value:e.value||"",measuring:!1,measureLocation:0,measureText:null,measurePrefix:"",activeIndex:0,isFocus:!1});dt(()=>{f.value=e.value});const b=x=>{n("change",x)},r=x=>{let{target:{value:h,composing:P},isComposing:j}=x;j||P||b(h)},p=(x,h,P)=>{S(f,{measuring:!0,measureText:x,measurePrefix:h,measureLocation:P,activeIndex:0})},o=x=>{S(f,{measuring:!1,measureLocation:0,measureText:null}),x?.()},c=x=>{const{which:h}=x;if(f.measuring){if(h===J.UP||h===J.DOWN){const P=q.value.length,j=h===J.UP?-1:1,N=(f.activeIndex+j+P)%P;f.activeIndex=N,x.preventDefault()}else if(h===J.ESC)o();else if(h===J.ENTER){if(x.preventDefault(),!q.value.length){o();return}const P=q.value[f.activeIndex];T(P)}}},w=x=>{const{key:h,which:P}=x,{measureText:j,measuring:N}=f,{prefix:se,validateSearch:X}=e,ee=x.target;if(ee.composing)return;const Z=Wt(ee),{location:U,prefix:z}=Yt(Z,se);if([J.ESC,J.UP,J.DOWN,J.ENTER].indexOf(P)===-1)if(U!==-1){const V=Z.slice(U+z.length),te=X(V,e),ne=!!ae(V).length;te?(h===z||h==="Shift"||N||V!==j&&ne)&&p(V,z,U):N&&o(),te&&n("search",V,z)}else N&&o()},a=x=>{f.measuring||n("pressenter",x)},g=x=>{M(x)},B=x=>{k(x)},M=x=>{clearTimeout(v.value);const{isFocus:h}=f;!h&&x&&n("focus",x),f.isFocus=!0},k=x=>{v.value=setTimeout(()=>{f.isFocus=!1,o(),n("blur",x)},100)},T=x=>{const{split:h}=e,{value:P=""}=x,{text:j,selectionLocation:N}=Zt(f.value,{measureLocation:f.measureLocation,targetText:P,prefix:f.measurePrefix,selectionStart:d.value.selectionStart,split:h});b(j),o(()=>{Xt(d.value,N)}),n("select",x,f.measurePrefix)},F=x=>{f.activeIndex=x},ae=x=>{const h=x||f.measureText||"",{filterOption:P}=e;return e.options.filter(N=>P?P(h,N):!0)},q=W(()=>ae());return l({blur:()=>{d.value.blur()},focus:()=>{d.value.focus()}}),ft(Qe,{activeIndex:je(f,"activeIndex"),setActiveIndex:F,selectOption:T,onFocus:M,onBlur:k,loading:je(e,"loading")}),pt(()=>{oe(()=>{f.measuring&&(i.value.scrollTop=d.value.scrollTop)})}),()=>{const{measureLocation:x,measurePrefix:h,measuring:P}=f,{prefixCls:j,placement:N,transitionName:se,getPopupContainer:X,direction:ee}=e,Z=Ae(e,["prefixCls","placement","transitionName","getPopupContainer","direction"]),{class:U,style:z}=t,V=Ae(t,["class","style"]),te=ze(Z,["value","prefix","split","validateSearch","filterOption","options","loading"]),ne=S(S(S({},te),V),{onChange:Ee,onSelect:Ee,value:f.value,onInput:r,onBlur:B,onKeydown:c,onKeyup:w,onFocus:g,onPressenter:a});return C("div",{class:_e(j,U),style:z},[he(C("textarea",Se({ref:d},ne),null),[[At]]),P&&C("div",{ref:i,class:`${j}-measure`},[f.value.slice(0,x),C(nn,{prefixCls:j,transitionName:se,dropdownClassName:e.dropdownClassName,placement:N,options:P?q.value:[],visible:!0,direction:ee,getPopupContainer:X},{default:()=>[C("span",null,[h])],notFoundContent:u.notFoundContent,option:u.option}),f.value.slice(x+h.length)])])}}}),rn={value:String,disabled:Boolean,payload:vt()},ot=S(S({},rn),{label:mt([])}),st={name:"Option",props:ot,render(e,s){let{slots:n}=s;var t;return(t=n.default)===null||t===void 0?void 0:t.call(n)}};H(S({compatConfig:{MODE:3}},st));const an=e=>{const{componentCls:s,colorTextDisabled:n,controlItemBgHover:t,controlPaddingHorizontal:l,colorText:u,motionDurationSlow:i,lineHeight:d,controlHeight:v,inputPaddingHorizontal:f,inputPaddingVertical:b,fontSize:r,colorBgElevated:p,borderRadiusLG:o,boxShadowSecondary:c}=e,w=Math.round((e.controlHeight-e.fontSize*e.lineHeight)/2);return{[s]:S(S(S(S(S({},Me(e)),Dt(e)),{position:"relative",display:"inline-block",height:"auto",padding:0,overflow:"hidden",lineHeight:d,whiteSpace:"pre-wrap",verticalAlign:"bottom"}),Ht(e,s)),{"&-disabled":{"> textarea":S({},Ut(e))},"&-focused":S({},Vt(e)),[`&-affix-wrapper ${s}-suffix`]:{position:"absolute",top:0,insetInlineEnd:f,bottom:0,zIndex:1,display:"inline-flex",alignItems:"center",margin:"auto"},[`> textarea, ${s}-measure`]:{color:u,boxSizing:"border-box",minHeight:v-2,margin:0,padding:`${b}px ${f}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":S({width:"100%",border:"none",outline:"none",resize:"none",backgroundColor:"inherit"},zt(e.colorTextPlaceholder)),[`${s}-measure`]:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,zIndex:-1,color:"transparent",pointerEvents:"none","> span":{display:"inline-block",minHeight:"1em"}},"&-dropdown":S(S({},Me(e)),{position:"absolute",top:-9999,insetInlineStart:-9999,zIndex:e.zIndexPopup,boxSizing:"border-box",fontSize:r,fontVariant:"initial",backgroundColor:p,borderRadius:o,outline:"none",boxShadow:c,"&-hidden":{display:"none"},[`${s}-dropdown-menu`]:{maxHeight:e.dropdownHeight,marginBottom:0,paddingInlineStart:0,overflow:"auto",listStyle:"none",outline:"none","&-item":S(S({},ht),{position:"relative",display:"block",minWidth:e.controlItemWidth,padding:`${w}px ${l}px`,color:u,fontWeight:"normal",lineHeight:d,cursor:"pointer",transition:`background ${i} ease`,"&:hover":{backgroundColor:t},"&:first-child":{borderStartStartRadius:o,borderStartEndRadius:o,borderEndStartRadius:0,borderEndEndRadius:0},"&:last-child":{borderStartStartRadius:0,borderStartEndRadius:0,borderEndStartRadius:o,borderEndEndRadius:o},"&-disabled":{color:n,cursor:"not-allowed","&:hover":{color:n,backgroundColor:t,cursor:"not-allowed"}},"&-selected":{color:u,fontWeight:e.fontWeightStrong,backgroundColor:t},"&-active":{backgroundColor:t}})}})})}},ln=gt("Mentions",e=>{const s=Rt(e);return[an(s)]},e=>({dropdownHeight:250,controlItemWidth:100,zIndexPopup:e.zIndexPopupBase+50}));var Fe=function(e,s){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&s.indexOf(t)<0&&(n[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var l=0,t=Object.getOwnPropertySymbols(e);l<t.length;l++)s.indexOf(t[l])<0&&Object.prototype.propertyIsEnumerable.call(e,t[l])&&(n[t[l]]=e[t[l]]);return n};function un(){return!0}const cn=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{prefix:n="@",split:t=" "}=s,l=Array.isArray(n)?n:[n];return e.split(t).map(function(){let u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",i=null;return l.some(d=>u.slice(0,d.length)===d?(i=d,!0):!1),i!==null?{prefix:i,value:u.slice(i.length)}:null}).filter(u=>!!u&&!!u.value)},dn=()=>S(S({},et),{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:ie.any,defaultValue:String,id:String,status:String}),be=H({compatConfig:{MODE:3},name:"AMentions",inheritAttrs:!1,props:dn(),slots:Object,setup(e,s){let{slots:n,emit:t,attrs:l,expose:u}=s;var i,d;const{prefixCls:v,renderEmpty:f,direction:b}=yt("mentions",e),[r,p]=ln(v),o=fe(!1),c=fe(null),w=fe((d=(i=e.value)!==null&&i!==void 0?i:e.defaultValue)!==null&&d!==void 0?d:""),a=Et(),g=Ft.useInject(),B=W(()=>Nt(g.status,e.status));Bt({prefixCls:W(()=>`${v.value}-menu`),mode:W(()=>"vertical"),selectable:W(()=>!1),onClick:()=>{},validator:h=>{let{mode:P}=h}}),Le(()=>e.value,h=>{w.value=h});const M=h=>{o.value=!0,t("focus",h)},k=h=>{o.value=!1,t("blur",h),a.onFieldBlur()},T=function(){for(var h=arguments.length,P=new Array(h),j=0;j<h;j++)P[j]=arguments[j];t("select",...P),o.value=!0},F=h=>{e.value===void 0&&(w.value=h),t("update:value",h),t("change",h),a.onFieldChange()},ae=()=>{const h=e.notFoundContent;return h!==void 0?h:n.notFoundContent?n.notFoundContent():f("Select")},q=()=>{var h;return wt(((h=n.default)===null||h===void 0?void 0:h.call(n))||[]).map(P=>{var j,N;return S(S({},xt(P)),{label:(N=(j=P.children)===null||j===void 0?void 0:j.default)===null||N===void 0?void 0:N.call(j)})})};u({focus:()=>{c.value.focus()},blur:()=>{c.value.blur()}});const x=W(()=>e.loading?un:e.filterOption);return()=>{const{disabled:h,getPopupContainer:P,rows:j=1,id:N=a.id.value}=e,se=Fe(e,["disabled","getPopupContainer","rows","id"]),{hasFeedback:X,feedbackIcon:ee}=g,{class:Z}=l,U=Fe(l,["class"]),z=ze(se,["defaultValue","onUpdate:value","prefixCls"]),V=_e({[`${v.value}-disabled`]:h,[`${v.value}-focused`]:o.value,[`${v.value}-rtl`]:b.value==="rtl"},Te(v.value,B.value),!X&&Z,p.value),te=S(S(S(S({prefixCls:v.value},z),{disabled:h,direction:b.value,filterOption:x.value,getPopupContainer:P,options:e.loading?[{value:"ANTDV_SEARCHING",disabled:!0,label:C(Je,{size:"small"},null)}]:e.options||q(),class:V}),U),{rows:j,onChange:F,onSelect:T,onFocus:M,onBlur:k,ref:c,value:w.value,id:N}),ne=C(sn,Se(Se({},te),{},{dropdownClassName:p.value}),{notFoundContent:ae,option:n.option});return r(X?C("div",{class:_e(`${v.value}-affix-wrapper`,Te(`${v.value}-affix-wrapper`,B.value,X),Z,p.value)},[ne,C("span",{class:`${v.value}-suffix`},[ee])]):ne)}}}),Ce=H(S(S({compatConfig:{MODE:3}},st),{name:"AMentionsOption",props:ot})),fn=S(be,{Option:Ce,getMentions:cn,install:e=>(e.component(be.name,be),e.component(Ce.name,Ce),e)}),pn="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",mn="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",vn={key:0,src:pn,alt:"comment","cursor-pointer":""},gn={key:1,src:mn,alt:"comment","cursor-pointer":""},Vo=H({__name:"comment",setup(e){const s=re();return(n,t)=>y(s).isNightStore?($(),A("img",vn)):($(),A("img",gn))}}),hn="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",yn="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",wn="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",xn="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",bn={key:0,src:hn,alt:"comment","cursor-pointer":""},Cn={key:1,src:yn,alt:"comment","cursor-pointer":""},_n={key:0,src:wn,alt:"comment","cursor-pointer":""},Sn={key:1,src:xn,alt:"comment","cursor-pointer":""},Uo=H({__name:"save",props:{isSaved:{type:Boolean}},setup(e){const s=re();return(n,t)=>($(),pe(bt,{name:"fade-nav",mode:"out-in"},{default:Y(()=>[n.isSaved?($(),A(ce,{key:1},[y(s).isNightStore?($(),A("img",_n)):($(),A("img",Sn))],64)):($(),A(ce,{key:0},[y(s).isNightStore?($(),A("img",bn)):($(),A("img",Cn))],64))]),_:1}))}}),kn="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",On="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",Pn={key:0,src:kn,alt:"comment","cursor-pointer":""},In={key:1,class:"rtl:-scale-x-100",src:On,alt:"comment","cursor-pointer":""},Ko=H({__name:"share",setup(e){const s=re();return(n,t)=>y(s).isNightStore?($(),A("img",Pn)):($(),A("img",In))}}),Wo=async e=>await $e.post("/media/create-like",{product_id:e}),Yo=async e=>ye.fetch("likes","delete",{field:["user_id","product_id"],value:[de().user.id,e]}),Ln=async e=>await $e.post("/media/create-comment-like",{comment_id:e}),$n=async e=>ye.fetch("likes","delete",{field:["user_id","comment_id"],value:[de().user.id,e]}),jn={class:"flex flex-col gap-1"},Mn={class:"text-red-6"},Tn={class:"flex text-xs gap-2"},Bn=["alt"],An={class:"flex-1"},En={class:"flex gap-2 items-center"},Fn={class:"text-xs text-gray-500"},Nn=["aria-disabled"],Rn=H({__name:"SubCommentCard",props:{item:{},addLikeLoading:{type:Boolean},showComment:{type:Boolean},activeEditId:{}},emits:["likeComment","reply","edit","delete","LongPress"],setup(e,{emit:s}){const n=e,t=de(),l=re(),u=Ie("ownerPostId"),i=O(),d=W(()=>n.showComment&&n.activeEditId==n.item.id),v=W(()=>t.user.user_id==u.value||t.user.user_id==n.item.user_id),f=s;Ve(i,b,{delay:1e3});function b(){v.value&&f("LongPress",n.item.id)}return(r,p)=>{const o=Ge,c=Ue("lazy");return $(),A("div",{class:"mt-4",ref_key:"targetForLongPressSubItem",ref:i},[C(o,{open:d.value,"onUpdate:open":p[3]||(p[3]=w=>d.value=w),placement:y(l).lang=="en"?"bottomLeft":"bottomRight",trigger:"click"},{content:Y(()=>[m("div",jn,[m("div",{class:"flex gap-2",onClick:p[0]||(p[0]=w=>f("edit",r.item))},[C(Q,{icon:"vuesax-linear:edit",class:"w-5",color:(y(l).isNightStore,"black")},null,8,["color"]),m("div",null,E(y(l).useString("edit")),1)]),m("div",{class:"flex gap-2",onClick:p[1]||(p[1]=()=>{f("edit",r.item),f("delete")})},[C(Q,{icon:"vuesax-linear:trash",class:"w-5",color:(y(l).isNightStore,"red")},null,8,["color"]),m("div",Mn,E(y(l).useString("delete")),1)])])]),default:Y(()=>[m("div",Tn,[m("div",null,[he(m("img",{alt:y(l).appName.en,width:"40",class:"rounded-full aspect-square"},null,8,Bn),[[c,{src:y(l).useDataStorage(r.item?.user?.avatar),loading:y(ge),error:y(ge)}]])]),m("div",An,[m("div",En,[m("div",null,E(r.item.user.name),1),m("div",Fn,E(y(Ze)(r.item.created_at)),1)]),m("div",null,E(r.item.message),1)]),m("div",{class:"flex flex-col items-center gap-1 w-14px",onClick:p[2]||(p[2]=w=>f("likeComment",r.item.like?.some(a=>a.user_id===y(t).user?.id),r.item.id)),"aria-disabled":r.addLikeLoading},[C(Xe,{"is-gray":"","is-liked":r.item.like?.some(w=>w.user_id===y(t).user?.id)},null,8,["is-liked"]),m("div",null,E(r.item.like?.length),1)],8,Nn)])]),_:1},8,["open","placement"])],512)}}}),Dn={class:"mb-5 noSelect"},Hn={class:"text-red-6"},zn=["alt"],Vn={class:"flex-1"},Un={class:"flex gap-2 items-center"},Kn={class:"text-xs text-gray-500"},Wn=["aria-disabled"],Yn={key:1,class:"ms11"},qn=H({__name:"CommentCard",props:{item:{},addLikeLoading:{type:Boolean},showComment:{type:Boolean},activeEditId:{}},emits:["likeComment","reply","edit","startPress","endPress","clickOutside","delete"],setup(e,{emit:s}){const n=e,t=W(()=>n.showComment&&n.activeEditId==n.item.id),l=de(),u=re(),i=s,d=O(!1),v=Ie("ownerPostId"),f=O(),b=O(),r=O(),p=W(()=>l.user.user_id==v.value||l.user.user_id==n.item.user_id||l.user.user_id==r.value);Ve(b,o,{delay:1e3});function o(){console.log("ddddd"),p.value&&i("startPress",n.item.id)}function c(a){console.log("dddddshhhd"),console.log("dddddsd"),i("startPress",a)}Ct(f,w);function w(){console.log("aaaaa"),i("clickOutside")}return(a,g)=>{const B=Ge,M=Ue("lazy");return $(),A("div",Dn,[C(B,{open:t.value,"onUpdate:open":g[5]||(g[5]=k=>t.value=k),trigger:"click",placement:y(u).lang=="en"?"bottomLeft":"bottomRight"},{content:Y(()=>[m("div",{ref_key:"targetForClickOutside",ref:f,class:"flex flex-col gap-1"},[m("div",{class:"flex gap-2",onClick:g[0]||(g[0]=k=>i("edit",a.item))},[C(Q,{icon:"vuesax-linear:edit",class:"w-5",color:(y(u).isNightStore,"black")},null,8,["color"]),m("div",null,E(y(u).useString("edit")),1)]),m("div",{class:"flex gap-2",onClick:g[1]||(g[1]=()=>{i("edit",a.item),i("delete")})},[C(Q,{icon:"vuesax-linear:trash",class:"w-5",color:(y(u).isNightStore,"red")},null,8,["color"]),m("div",Hn,E(y(u).useString("delete")),1)])],512)]),default:Y(()=>[m("div",{ref_key:"targetForLongPress",ref:b},[m("div",{ref_key:"targetForClickOutside",ref:f,class:le(["flex text-xs gap-2",a.showComment&&a.activeEditId!=a.item.id?"blur-sm":""]),onContextmenu:g[4]||(g[4]=ke(()=>{},["prevent"]))},[m("div",null,[he(m("img",{alt:y(u).appName.en,width:"40",class:"rounded-full aspect-square"},null,8,zn),[[M,{src:y(u).useDataStorage(a.item.user.avatar),loading:y(ge),error:y(ge)}]])]),m("div",Vn,[m("div",Un,[m("div",null,E(a.item.user.name),1),m("div",Kn,E(y(Ze)(a.item.created_at)),1)]),m("div",null,E(a.item.message),1),m("div",{class:"text-gray-5",onClick:g[2]||(g[2]=k=>i("reply"))},E(y(u).useString("reply")),1)]),m("div",{class:"flex flex-col items-center gap-1 w-14px","aria-disabled":a.addLikeLoading,onClick:g[3]||(g[3]=k=>i("likeComment",a.item.like?.some(T=>T.user_id===y(l).user?.id),a.item.id,!1,a.item.id))},[C(Xe,{"is-gray":"","is-liked":a.item.like?.some(k=>k.user_id===y(l).user?.id)},null,8,["is-liked"]),m("div",null,E(a.item.like?.length),1)],8,Wn)],34)],512)]),_:1},8,["open","placement"]),a.item?.replies?.length>0?($(),A(ce,{key:0},[d.value?($(),A("div",Yn,[($(!0),A(ce,null,Oe(a.item?.replies,k=>($(),pe(Rn,{item:k,key:k.id,"show-comment":a.showComment,"active-edit-id":a.activeEditId,onDelete:()=>{i("edit",k),i("delete")},onEdit:T=>i("edit",k),class:le(a.showComment&&a.activeEditId!=k.id?"blur-sm":""),onLongPress:c,onContextmenu:g[7]||(g[7]=ke(()=>{},["prevent"])),onLikeComment:T=>i("likeComment",k.like?.some(F=>F.user_id===y(l).user?.id),k.id,!0,a.item.id),addLikeLoading:a.addLikeLoading},null,8,["item","show-comment","active-edit-id","onDelete","onEdit","class","onLikeComment","addLikeLoading"]))),128))])):($(),A("div",{key:0,onClick:g[6]||(g[6]=k=>d.value=!d.value),class:"text-zinc-5 text-xs mt-2 ms-20"},E(y(u).useString("viewMoreReplies",a.item?.replies?.length)),1))],64)):ue("",!0)])}}}),Zn=It(qn,[["__scopeId","data-v-f47ce143"]]),Xn=["width"],Gn=H({__name:"CommentCardSkeleton",setup(e){const s=O(!1),n=O(null),t=He(_t(n,{width:0,height:0},{box:"border-box"}));return Ke(async()=>{s.value=!0}),(l,u)=>s.value?($(),A("div",{key:0,ref_key:"skeletonRatio",ref:n,class:"h-fit"},[C(y(Lt),{width:t.width,height:"60"},{default:Y(()=>[u[0]||(u[0]=m("circle",{cx:15,cy:"30",r:"15"},null,-1)),u[1]||(u[1]=m("rect",{x:"45",y:"15",rx:"3",ry:"3",width:"100",height:"12"},null,-1)),m("rect",{x:"45",y:"35",rx:"5",ry:"5",width:t.width-100,height:"10"},null,8,Xn)]),_:1,__:[0,1]},8,["width"])],512)):ue("",!0)}}),Jn=async(e,s=1,n=10)=>{const t=(s-1)*n,l=t+n-1;return(await St.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,l).order("created_at",{ascending:!1}))?.data},Ne=async(e,s,n=void 0)=>await $e.post("/media/add-comment",{message:e,product_id:s,parent_id:n}),Qn=async(e,s)=>await ye.fetch("comments","update",{columns:`*,
|
|
user:users(name, avatar),
|
|
like:likes(user_id),
|
|
replies:comments(*,
|
|
user:users(name, avatar),
|
|
like:likes(user_id)
|
|
)`,data:{message:s},field:"id",value:e}),eo=async e=>{await ye.fetch("comments","delete",{field:"id",value:e})};var to=Object.create,it=Object.defineProperty,no=Object.getOwnPropertyDescriptor,rt=Object.getOwnPropertyNames,oo=Object.getPrototypeOf,so=Object.prototype.hasOwnProperty,io=(e,s)=>function(){return s||(0,e[rt(e)[0]])((s={exports:{}}).exports,s),s.exports},ro=(e,s,n,t)=>{if(s&&typeof s=="object"||typeof s=="function")for(var l=rt(s),u=0,i=l.length,d;u<i;u++)d=l[u],!so.call(e,d)&&d!==n&&it(e,d,{get:(v=>s[v]).bind(null,d),enumerable:!(t=no(s,d))||t.enumerable});return e},ao=(e,s,n)=>(n=e!=null?to(oo(e)):{},ro(it(n,"default",{value:e,enumerable:!0}),e));const Re=typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof global<"u"?global:{};typeof Re.chrome<"u"&&Re.chrome.devtools;typeof navigator<"u"&&navigator.userAgent?.toLowerCase().includes("electron");var lo=io({"../../node_modules/.pnpm/rfdc@1.4.1/node_modules/rfdc/index.js":((e,s)=>{s.exports=t;function n(u){return u instanceof Buffer?Buffer.from(u):new u.constructor(u.buffer.slice(),u.byteOffset,u.length)}function t(u){if(u=u||{},u.circles)return l(u);const i=new Map;if(i.set(Date,r=>new Date(r)),i.set(Map,(r,p)=>new Map(v(Array.from(r),p))),i.set(Set,(r,p)=>new Set(v(Array.from(r),p))),u.constructorHandlers)for(const r of u.constructorHandlers)i.set(r[0],r[1]);let d=null;return u.proto?b:f;function v(r,p){const o=Object.keys(r),c=new Array(o.length);for(let w=0;w<o.length;w++){const a=o[w],g=r[a];typeof g!="object"||g===null?c[a]=g:g.constructor!==Object&&(d=i.get(g.constructor))?c[a]=d(g,p):ArrayBuffer.isView(g)?c[a]=n(g):c[a]=p(g)}return c}function f(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return v(r,f);if(r.constructor!==Object&&(d=i.get(r.constructor)))return d(r,f);const p={};for(const o in r){if(Object.hasOwnProperty.call(r,o)===!1)continue;const c=r[o];typeof c!="object"||c===null?p[o]=c:c.constructor!==Object&&(d=i.get(c.constructor))?p[o]=d(c,f):ArrayBuffer.isView(c)?p[o]=n(c):p[o]=f(c)}return p}function b(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return v(r,b);if(r.constructor!==Object&&(d=i.get(r.constructor)))return d(r,b);const p={};for(const o in r){const c=r[o];typeof c!="object"||c===null?p[o]=c:c.constructor!==Object&&(d=i.get(c.constructor))?p[o]=d(c,b):ArrayBuffer.isView(c)?p[o]=n(c):p[o]=b(c)}return p}}function l(u){const i=[],d=[],v=new Map;if(v.set(Date,o=>new Date(o)),v.set(Map,(o,c)=>new Map(b(Array.from(o),c))),v.set(Set,(o,c)=>new Set(b(Array.from(o),c))),u.constructorHandlers)for(const o of u.constructorHandlers)v.set(o[0],o[1]);let f=null;return u.proto?p:r;function b(o,c){const w=Object.keys(o),a=new Array(w.length);for(let g=0;g<w.length;g++){const B=w[g],M=o[B];if(typeof M!="object"||M===null)a[B]=M;else if(M.constructor!==Object&&(f=v.get(M.constructor)))a[B]=f(M,c);else if(ArrayBuffer.isView(M))a[B]=n(M);else{const k=i.indexOf(M);k!==-1?a[B]=d[k]:a[B]=c(M)}}return a}function r(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return b(o,r);if(o.constructor!==Object&&(f=v.get(o.constructor)))return f(o,r);const c={};i.push(o),d.push(c);for(const w in o){if(Object.hasOwnProperty.call(o,w)===!1)continue;const a=o[w];if(typeof a!="object"||a===null)c[w]=a;else if(a.constructor!==Object&&(f=v.get(a.constructor)))c[w]=f(a,r);else if(ArrayBuffer.isView(a))c[w]=n(a);else{const g=i.indexOf(a);g!==-1?c[w]=d[g]:c[w]=r(a)}}return i.pop(),d.pop(),c}function p(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return b(o,p);if(o.constructor!==Object&&(f=v.get(o.constructor)))return f(o,p);const c={};i.push(o),d.push(c);for(const w in o){const a=o[w];if(typeof a!="object"||a===null)c[w]=a;else if(a.constructor!==Object&&(f=v.get(a.constructor)))c[w]=f(a,p);else if(ArrayBuffer.isView(a))c[w]=n(a);else{const g=i.indexOf(a);g!==-1?c[w]=d[g]:c[w]=p(a)}}return i.pop(),d.pop(),c}}})}),uo=ao(lo());(0,uo.default)({circles:!0});const co={flex:"","justify-center":"","items-center":"","flex-col":"","p-2":""},fo={"mt-1":"","font-semibold":""},po={class:"flex items-center"},mo={class:"me-1"},vo={class:"flex items-center"},go={class:"me-1"},ho={class:"flex items-center p1 gap-1"},yo=H({__name:"CommentAddEdit",props:{open:{type:Boolean},id:{}},emits:["update:open","addCommentId","deleteCommentId"],setup(e,{emit:s}){const n=We(),t=re(),l=de(),u=O(null),i=O(!0),d=O(null),v=O(!1),f=O(!1),b=O(!1);de();const r=O(void 0),p=O(void 0);function o(_){r.value=void 0,p.value=_,F.value=_.message}function c(){p.value=void 0,F.value=""}const w=()=>{i.value=d.value.scrollTop<=5};function a(){r.value=void 0}function g(){setTimeout(()=>{document.activeElement?.scrollIntoView({behavior:"smooth",block:"center"}),v.value=!0},300)}Ke(()=>{oe(()=>{d.value&&w()})});const B=e,M=s,k=O(!1),T=O([]),F=O(""),ae=O(null),q=O(!1),me=O(0),ve=O(20),x=async()=>{try{if(!q.value){k.value=!0;const _=await Jn(B.id,++me.value,ve.value);_?.length<ve.value&&(q.value=!0),T.value.push(..._)}}catch(_){console.log("e ===>",_)}finally{k.value=!1}};async function h(){await x(),await oe(),await u.value?.setOpen(),await ae.value?.focus()}async function P(){await oe(),await u.value?.setClose(),j(),a(),c(),z.value=!1}function j(){T.value=[],me.value=0,q.value=!1}const N=async()=>{try{if(F.value?.length>0){if(f.value=!0,p.value){const _=await Qn(p.value.id,F.value),L=p.value.id,D=p.value.parent_id;if(D){const I=T.value.find(R=>R.id===D);if(I){const R=I.replies.findIndex(K=>K.id===L);R!==-1&&I.replies.splice(R,1,_[0])}}else{const I=T.value.findIndex(R=>R.id===L);I!==-1&&T.value.splice(I,1,_[0])}}else if(r.value){const _=await Ne(F.value,B.id,r.value.id);r.value?.replies||(r.value.replies=[]),r.value?.replies.push({message:F.value,user:{name:l.user.name,avatar:l.user.avatar},like:[],..._}),M("addCommentId",_.id)}else{const _=await Ne(F.value,B.id);T.value?.unshift({message:F.value,user:{name:l.user.name,avatar:l.user.avatar},like:[],replies:[],..._}),M("addCommentId",_.id)}await oe(()=>{F.value="",r.value=void 0,p.value=void 0})}}catch(_){console.log(_)}finally{f.value=!1}};async function se(){await Ye(t.useString("areYouSureToDeleteThisComment"),X)}async function X(){try{f.value=!0,await eo(p.value.id);const _=p.value.id,L=p.value.parent_id;if(L){const D=T.value.find(I=>I.id===L);if(D){const I=D.replies.findIndex(R=>R.id===_);I!==-1&&D.replies.splice(I,1)}}else{const D=T.value.findIndex(I=>I.id===_);D!==-1&&T.value.splice(D,1)}M("deleteCommentId"),await oe(()=>{F.value="",r.value=void 0,p.value=void 0})}catch(_){console.log(_)}finally{f.value=!1}}function ee(_,L,D,I){try{if(b.value=!0,we())if(_)if($n(L),D){const K=T.value.find(G=>G.id===I)?.replies.find(G=>G.id===L);K?.like.splice(K.like?.findIndex(G=>G.user_id===l.user?.id))}else{const R=T.value.find(K=>K.id===I);R?.like.splice(R?.like?.findIndex(K=>K.user_id===l.user?.id))}else Ln(L),D?T.value.find(G=>G.id===I)?.replies.find(G=>G.id===L)?.like.push({product_id:L,user_id:l.user.id}):T.value.find(K=>K.id===I)?.like?.push({product_id:L,user_id:l.user.id});else n.push({name:"auth-login"}),Pe.warn(t.useString("pleaseLoginOrRegister"))}catch(R){console.log(R)}finally{b.value=!1}}const Z=O();kt(Z,([{isIntersecting:_}])=>{_&&B.open&&setTimeout(()=>{x()},100)}),Le(B,_=>{_.open?h():P()});const U=O(null),z=O(!1),V=O(void 0),te=_=>{V.value=_,z.value=!0,console.log("Long press detected!",_)},ne=()=>{U.value&&(clearTimeout(U.value),U.value=null)},at=()=>{z.value=!1};return(_,L)=>{const D=fn;return $(),pe(qe,{title:"",ref_key:"sheetRef",ref:u,headerCls:"",allowCloseScrollup:i.value,closeOnClickOutside:"",onOnClickOutside:L[4]||(L[4]=I=>M("update:open",!1)),onOnClose:L[5]||(L[5]=I=>M("update:open",!1))},{header:Y(()=>[m("div",co,[L[6]||(L[6]=m("div",{"bg-gray-500":"","h-2px":"","w-2.5rem":""},null,-1)),m("div",fo,E(y(t).useString("comments")),1)])]),default:Y(()=>[m("div",{class:le(["h-70vh w-full relative relative",y(we)()?"pb-4rem":""])},[m("div",{class:"h-full px-4 overflow-auto",ref_key:"scrollArea",ref:d,onScroll:w},[($(!0),A(ce,null,Oe(T.value,I=>($(),pe(Zn,{item:I,"active-edit-id":V.value,"show-comment":z.value,onLikeComment:ee,onStartPress:te,onEndPress:ne,onClickOutside:at,onDelete:se,onContextmenu:L[0]||(L[0]=ke(()=>{},["prevent"])),onEdit:o,onReply:R=>{r.value=I,c()},addLikeLoading:b.value},null,8,["item","active-edit-id","show-comment","onReply","addLikeLoading"]))),256)),k.value?($(),A(ce,{key:0},Oe(5,I=>C(Gn)),64)):ue("",!0),he(m("div",{ref_key:"observer",ref:Z,class:"w-full opacity-0 relative"}," load ",512),[[Ot,!k.value]])],544),y(we)()?($(),A("div",{key:0,class:"flex w-inherit fixed gap-1 items-center my-2 px2 py-1 bottom-1",onFocusin:g,onFocusout:L[3]||(L[3]=I=>v.value=!1)},[C($t,{width:"40",class:"w-40 ms-2",src:y(l).user?.avatar,"just-show-profile":""},null,8,["src"]),m("div",{class:le(["border-solid flex-1 border-1 comment_input",r.value||p.value?"rounded-3xl":"rounded-full"])},[r.value?($(),A("div",{key:0,class:le(["rounded-t-3xl text-xs p3 mb1 flex justify-between",y(t).isNightStore?"bg-zinc-7 text-gray-2":"bg-gray-50 text-gray-4"])},[m("div",po,[m("span",null,[m("span",mo,E(y(t).useString("replyingTo")),1),m("span",null,E(r.value?.user?.name),1)])]),C(Q,{icon:"vuesax-linear:add",class:"rotate-45",color:y(t).isNightStore?"bg-zinc-7":"text-gray-4",onClick:L[1]||(L[1]=I=>r.value=void 0)},null,8,["color"])],2)):ue("",!0),p.value?($(),A("div",{key:1,class:le(["rounded-t-3xl text-xs p3 mb1 flex justify-between",y(t).isNightStore?"bg-zinc-7 text-gray-2":"bg-gray-50 text-gray-4"])},[m("div",vo,[m("span",null,[m("span",go,E(y(t).useString("editComment")),1),m("span",null,E(p.value?.user?.name),1)])]),C(Q,{icon:"vuesax-linear:add",class:"rotate-45",color:y(t).isNightStore?"bg-zinc-7":"text-gray-4",onClick:c},null,8,["color"])],2)):ue("",!0),m("div",ho,[C(D,{value:F.value,"onUpdate:value":L[2]||(L[2]=I=>F.value=I),placeholder:y(t).useString("yourComment"),class:"comment_input"},null,8,["value","placeholder"]),C(jt,{onClick:N,class:"rounded-full w-3.5rem",type:"primary",loading:f.value},{default:Y(()=>[C(Q,{icon:"vuesax-linear:arrow-up"})]),_:1},8,["loading"])])],2)],32)):ue("",!0)],2)]),_:1},8,["allowCloseScrollup"])}}}),qo=Object.assign(yo,{__name:"CommentAddEdit"}),wo={class:"h-fit px-4"},xo={class:"flex flex-col gap-2 mt-5 mb-5"},bo={class:"text-sm text-white"},Co={class:"text-red text-sm"},Zo=H({__name:"moreOptionProduct",props:{open:{type:Boolean},id:{}},emits:["update:open"],setup(e,{emit:s}){const n=We(),t=re(),l=O(null),u=e,i=s;async function d(){await oe(),await l.value?.setOpen()}async function v(){await oe(),await l.value?.setClose()}async function f(){await Ye(t.useString("areYouSureToDeleteThisProduct"),r)}const b=Kt();async function r(){b.percentUpload=0,b.loading=!0;try{await Pt(u.id),b.percentUpload=100,Pe.success(t.useString("deletedSuccessfully"))}catch(p){console.log(p),Pe.error(t.useString("errorInAction"))}finally{b.loading=!1,i("update:open",!1)}}return Le(u,p=>{p.open?d():v()}),(p,o)=>($(),pe(qe,{title:"",ref_key:"sheetRef",ref:l,headerCls:"",closeOnClickOutside:"",onOnClickOutside:o[2]||(o[2]=c=>i("update:open",!1)),onOnClose:o[3]||(o[3]=c=>i("update:open",!1))},{header:Y(()=>o[4]||(o[4]=[m("div",{flex:"","justify-center":"","items-center":"","flex-col":"","p-2":""},[m("div",{"bg-gray-500":"","h-2px":"","w-2.5rem":""})],-1)])),default:Y(()=>[m("div",wo,[m("div",xo,[m("div",{class:"flex items-center gap-3 p-3 rounded-lg bg-primary",onClick:o[0]||(o[0]=c=>y(n).push({name:"edit-product-id",params:{id:u.id}}))},[C(Q,{icon:"vuesax-linear:edit",color:"white"}),m("div",bo,E(y(t).useString("edit")),1)]),m("div",{class:"flex items-center gap-3 p-3 rounded-lg bg-red-100",onClick:o[1]||(o[1]=c=>f())},[C(Q,{icon:"vuesax-linear:trash",color:"red"}),m("div",Co,E(y(t).useString("delete")),1)])])])]),_:1},512))}});export{qo as C,Zo as _,Ko as a,Vo as b,Wo as c,Yo as d,Uo as e};
|