1import{E as e}from"./dist-DiEP1Qns.js";import{D as t,E as n,On as r,Yt as i,Zn as a,_ as o,b as s,bt as c,ct as l,mt as u,o as d,qt as f,tr as p,tt as m,un as h,v as g,vn as _,y as v}from"./runtime-core.esm-bundler-BKdLzFmX.js";import{n as y}from"./vue-i18n-CD8MIotv.js";import{t as b}from"./Button-D-DnbTTq.js";import{t as x}from"./helper-D5ziWoUd.js";import{t as S}from"./ImageElement-DuUHuuKh.js";import{t as C}from"./InputError-CyGGRdYx.js";var w={style:{"word-break":`break-word`},class:`text-sm text-dark font-cr-regular text-left ml-2 mb-0 word-break`},T={class:`mt-3`},E={class:`relative w-full`},D={class:`mb-0 relative w-full z-1`},O={__name:`ExtraQandASection`,props:[`creatorData`,`supporterPic`,`currentUser`,`extra`,`token`,`fromPage`,`purchaseMessage`,`btnText`,`autoFocusTextArea`],emits:[`savePurchaseMessage`,`updatePurchaseMessage`],setup(O,{expose:k,emit:A}){let{t:j}=y(),M=O,N=M.purchaseMessage||``,P=M.purchaseMessage||``,F=_(!1),I=_(!1),L=_([]),R=_(``),z=_(null),B=()=>{z.value?.focus()};l(()=>{V(),M.autoFocusTextArea&&B()});let V=()=>{let e=z.value;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight+2}px`)},H=()=>{let e=N.replace(/\s/g,``).length>0,t=N!==P;e?(R.value=``,I.value=t):I.value=!1,V()};k({validate:()=>x.sanitizeHtml(N).replace(/\s/g,``).length?(R.value=``,!0):(R.value=j(`lang.error.required_field`),z.value?.scrollIntoView({behavior:`smooth`,block:`center`}),!1)});let U=()=>{if(x.sanitizeHtml(N).replace(/\s/g,``).length){F.value=!0;let e={purchase_message:x.sanitizeHtml(N),access_token:M.token};axios.post(`api/v1/rewards/${M.extra.reward_id}/reply/${M.extra.purchase_id}`,e).then(e=>{e.data&&(L.value.push(x.sanitizeHtml(N)),N=``,F.value=!1,I.value=!1,m(V))}).catch(()=>{F.value=!1})}else R.value=j(`lang.error.required_field`)};return(l,m)=>(u(),s(d,null,[r(L).length&&O.supporterPic?(u(!0),s(d,{key:0},c(r(L),(e,n)=>(u(),s(`div`,{class:`flex my-4`,key:n},[t(S,{src:O.supporterPic,alt:O.supporterPic,width:20,height:20,cropWidth:[100],cropSize:[100],intrinsicSize:100,imageClass:`flex-shrink-0 w-5 h-5 rounded-full object-cover`},null,8,[`src`,`alt`]),o(`p`,w,p(e),1)]))),128)):v(``,!0),o(`div`,T,[o(`div`,E,[o(`div`,D,[i(o(`textarea`,{ref_key:`answerTextarea`,ref:z,"onUpdate:modelValue":m[0]||=e=>h(N)?N.value=e:N=e,onInput:H,contenteditable:`true`,"data-emoji-input":`unicode`,"data-emojiable":`true`,rows:`1`,class:`z-1 text-md font-cr-regular bg-white text-black border border-solid border-dark/10 focus:bg-white focus:border-dark/20 hover:border-dark/20 focus:outline-none focus:ring-0 focus:ring-offset-0 rounded-lg w-full resize-none overflow-hidden`,maxlength:`255`},null,544),[[e,r(N)]]),r(R)?(u(),g(C,{key:0,class:`my-1 text-sm pr-5 text-left`,message:r(R)},null,8,[`message`])):v(``,!0)])])]),t(b,{class:a([[r(I)?``:`hidden`],`font-cr-bold text-sm h-9 w-auto min-w-32 ml-auto px-4 mt-1 block text-themeTextColor tw-theme-color-rounded-full`]),onClick:U,disabled:r(F),btnType:`primary`},{default:f(()=>[n(p(l.$t(`lang.common.save`)),1)]),_:1},8,[`class`,`disabled`])],64))}};export{O as t};
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.