(()=>{"use strict";var e={n:s=>{var t=s&&s.__esModule?()=>s.default:()=>s;return e.d(t,{a:t}),t},d:(s,t)=>{for(var a in t)e.o(t,a)&&!e.o(s,a)&&Object.defineProperty(s,a,{enumerable:!0,get:t[a]})},o:(e,s)=>Object.prototype.hasOwnProperty.call(e,s)};const s=window.wp.element,t=window.wp.i18n,a=window.wp.data,r={search:"",isSearching:!1,total:0,productId:0,userId:0},n={getSearch(e){const{search:s}=e;return s},isSearching(e){const{isSearching:s}=e;return s},getTotalQuestion(e){const{total:s}=e;return s},getProductId(e){const{productId:s}=e;return s},getUserId(e){const{userId:s}=e;return s}},l=window.wp.apiFetch;var d=e.n(l);const o={FETCH_FROM_API:e=>d()({path:e.path}),FETCH_FROM_API_UNPARSED:e=>d()({path:e.path,parse:!1}).then(e=>Promise.all([e.headers,e.json()]).then(([e,s])=>({headers:e,data:s}))),SAVE_TO_API:e=>d()({path:e.path,method:"POST",data:e.payload}),UPDATE_TO_API(e){const s=e.path+"/"+e.payload.ID;return d()({path:s,method:"PATCH",data:e.payload})}},i=(0,a.createReduxStore)("dokan-pro/product-qa",{reducer:(e=r,s)=>{switch(s.type){case"SET_SEARCH":return{...e,search:s.search,isSearching:""!==s.search};case"SET_IS_SEARCHING":return{...e,isSearching:s.isSearching};case"SET_TOTAL":return{...e,total:s.total};case"INCREMENT_TOTAL":return{...e,total:e.total+1};case"SET_PRODUCT_ID":return{...e,productId:s.id};case"SET_USER_ID":return{...e,userId:s.id}}return e},actions:{setSearch:e=>({type:"SET_SEARCH",search:e}),setIsSearching:e=>({type:"SET_IS_SEARCHING",isSearching:e}),setTotal:e=>({type:"SET_TOTAL",total:e}),incrementTotal:()=>({type:"INCREMENT_TOTAL"}),setProductId:e=>({type:"SET_PRODUCT_ID",id:e}),setUserId:e=>({type:"SET_USER_ID",id:e})},selectors:n,controls:o,resolvers:{}}),c=window.ReactJSXRuntime,u=()=>(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("div",{role:"status",className:"max-w-sm animate-pulse",children:[(0,c.jsx)("div",{className:"h-2.5 bg-gray-200 rounded-full w-48 mb-4"}),(0,c.jsx)("div",{className:"h-2 bg-gray-200 rounded-full max-w-[360px] mb-2.5"}),(0,c.jsx)("div",{className:"h-2 bg-gray-200 rounded-full mb-2.5"}),(0,c.jsx)("div",{className:"h-2 bg-gray-200 rounded-full max-w-[330px] mb-2.5"}),(0,c.jsx)("div",{className:"h-2 bg-gray-200 rounded-full max-w-[300px] mb-2.5"}),(0,c.jsx)("div",{className:"h-2 bg-gray-200 rounded-full max-w-[360px]"}),(0,c.jsx)("span",{className:"sr-only",children:(0,t.__)("Loading…","dokan")})]}),(0,c.jsxs)("div",{role:"status",className:"max-w-sm animate-pulse",children:[(0,c.jsx)("div",{className:"h-2.5 bg-gray-200 rounded-full w-48 mb-4"}),(0,c.jsx)("div",{className:"h-2 bg-gray-200 rounded-full max-w-[360px] mb-2.5"}),(0,c.jsx)("div",{className:"h-2 bg-gray-200 rounded-full mb-2.5"}),(0,c.jsx)("div",{className:"h-2 bg-gray-200 rounded-full max-w-[330px] mb-2.5"}),(0,c.jsx)("div",{className:"h-2 bg-gray-200 rounded-full max-w-[300px] mb-2.5"}),(0,c.jsx)("div",{className:"h-2 bg-gray-200 rounded-full max-w-[360px]"}),(0,c.jsx)("span",{className:"sr-only",children:(0,t.__)("Loading…","dokan")})]}),(0,c.jsxs)("div",{role:"status",className:"max-w-sm animate-pulse",children:[(0,c.jsx)("div",{className:"h-2.5 bg-gray-200 rounded-full w-48 mb-4"}),(0,c.jsx)("div",{className:"h-2 bg-gray-200 rounded-full max-w-[360px] mb-2.5"}),(0,c.jsx)("div",{className:"h-2 bg-gray-200 rounded-full mb-2.5"}),(0,c.jsx)("div",{className:"h-2 bg-gray-200 rounded-full max-w-[330px] mb-2.5"}),(0,c.jsx)("div",{className:"h-2 bg-gray-200 rounded-full max-w-[300px] mb-2.5"}),(0,c.jsx)("div",{className:"h-2 bg-gray-200 rounded-full max-w-[360px]"}),(0,c.jsx)("span",{className:"sr-only",children:(0,t.__)("Loading…","dokan")})]}),(0,c.jsxs)("div",{role:"status",className:"max-w-sm animate-pulse",children:[(0,c.jsx)("div",{className:"h-2.5 bg-gray-200 rounded-full w-48 mb-4"}),(0,c.jsx)("div",{className:"h-2 bg-gray-200 rounded-full max-w-[360px] mb-2.5"}),(0,c.jsx)("div",{className:"h-2 bg-gray-200 rounded-full mb-2.5"}),(0,c.jsx)("div",{className:"h-2 bg-gray-200 rounded-full max-w-[330px] mb-2.5"}),(0,c.jsx)("div",{className:"h-2 bg-gray-200 rounded-full max-w-[300px] mb-2.5"}),(0,c.jsx)("div",{className:"h-2 bg-gray-200 rounded-full max-w-[360px]"}),(0,c.jsx)("span",{className:"sr-only",children:(0,t.__)("Loading…","dokan")})]}),(0,c.jsxs)("div",{role:"status",className:"max-w-sm animate-pulse",children:[(0,c.jsx)("div",{className:"h-2.5 bg-gray-200 rounded-full w-48 mb-4"}),(0,c.jsx)("div",{className:"h-2 bg-gray-200 rounded-full max-w-[360px] mb-2.5"}),(0,c.jsx)("div",{className:"h-2 bg-gray-200 rounded-full mb-2.5"}),(0,c.jsx)("div",{className:"h-2 bg-gray-200 rounded-full max-w-[330px] mb-2.5"}),(0,c.jsx)("div",{className:"h-2 bg-gray-200 rounded-full max-w-[300px] mb-2.5"}),(0,c.jsx)("div",{className:"h-2 bg-gray-200 rounded-full max-w-[360px]"}),(0,c.jsx)("span",{className:"sr-only",children:(0,t.__)("Loading…","dokan")})]})]}),m=window.wp.components,h=window.wp.htmlEntities,x=({answer:e})=>{const r=(0,a.useSelect)(e=>e(i).getSearch(),[]),n=(0,a.useSelect)(e=>e(i).isSearching(),[]),[l,d]=(0,s.useState)(e.answer);return(0,s.useEffect)(()=>{if(n)try{d((0,s.renderToString)((0,c.jsx)(m.__experimentalText,{highlightClassName:"bg-yellow-200",highlightWords:r.split(" "),highlightEscape:!0,children:e.answer})))}catch(e){}else d(e.answer);return()=>{d(e.answer)}},[r,n,e.answer]),(0,c.jsxs)("div",{className:"flex items-start gap-3 mt-3",children:[(0,c.jsx)("div",{className:"shrink-0",children:(0,c.jsxs)("svg",{className:"w-6 h-6 text-red-500",viewBox:"0 0 21 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,c.jsx)("path",{d:"M10.1779 7.5625C9.21396 7.5625 8.42969 8.34677 8.42969 9.31076V9.94013H11.9262V9.31076C11.9262 8.34677 11.1419 7.5625 10.1779 7.5625Z",fill:"currentColor"}),(0,c.jsx)("path",{d:"M19.725 18.5164L17.643 17.085C19.2683 15.2634 20.1797 12.9019 20.1797 10.4297C20.1797 4.91563 15.6937 0.429688 10.1797 0.429688C4.66563 0.429688 0.179688 4.91563 0.179688 10.4297C0.179688 15.9437 4.66563 20.4297 10.1797 20.4297H19.1307C19.5902 20.4297 19.9962 20.1307 20.1325 19.6919C20.2688 19.2531 20.1036 18.7767 19.725 18.5164ZM14.0258 13.2269C14.0258 13.8062 13.5562 14.2758 12.9769 14.2758C12.3976 14.2758 11.9279 13.8062 11.9279 13.2269V12.0381H8.43144V13.2269C8.43144 13.8062 7.96179 14.2758 7.38249 14.2758C6.80318 14.2758 6.33353 13.8062 6.33353 13.2269V9.31081C6.33353 7.19004 8.05892 5.46465 10.1797 5.46465C12.3005 5.46465 14.0258 7.19004 14.0258 9.31081V13.2269Z",fill:"currentColor"})]})}),(0,c.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,c.jsx)("div",{className:"!prose break-words",children:(0,c.jsx)(s.RawHTML,{children:(0,h.decodeEntities)(l)})}),(0,c.jsx)("p",{className:"text-xs text-slate-500",children:(0,t.sprintf)(
(0,t.__)("by the vendor of the product, %s","dokan"),e.human_readable_created_at)})]})]})},g=({question:e})=>{const s=(0,a.useSelect)(e=>e(i).getSearch(),[]),r=(0,a.useSelect)(e=>e(i).isSearching(),[]);return(0,c.jsxs)("div",{className:"py-5",children:[(0,c.jsxs)("div",{className:"flex items-start gap-3",children:[(0,c.jsx)("div",{className:"shrink-0",children:(0,c.jsxs)("svg",{className:"w-6 h-6 text-slate-500",viewBox:"0 0 21 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,c.jsx)("path",{d:"M20.2656 10.1992C20.2656 4.68515 15.7797 0.199219 10.2657 0.199219C4.75164 0.199219 0.265707 4.68515 0.265707 10.1992C0.265707 12.6713 1.17717 15.0329 2.80234 16.8545L0.720391 18.2859C0.34179 18.5461 0.176616 19.0226 0.312909 19.4614C0.449203 19.9001 0.855215 20.1992 1.31465 20.1992H10.2657C15.7797 20.1991 20.2656 15.7132 20.2656 10.1992ZM14.364 12.8141C14.7737 13.2237 14.7737 13.8879 14.364 14.2976C14.1592 14.5024 13.8908 14.6048 13.6224 14.6048C13.354 14.6048 13.0855 14.5024 12.8807 14.2976L12.5489 13.9658C11.8827 14.3712 11.1011 14.6048 10.2658 14.6048C7.83659 14.6048 5.86023 12.6285 5.86023 10.1993C5.86023 7.77003 7.83659 5.79367 10.2658 5.79367C12.695 5.79367 14.6714 7.77003 14.6714 10.1993C14.6714 11.0345 14.4378 11.8162 14.0324 12.4824L14.364 12.8141Z",fill:"currentColor"}),(0,c.jsx)("path",{d:"M10.2647 7.89453C8.99228 7.89453 7.95703 8.92978 7.95703 10.2022C7.95703 11.4747 8.99228 12.5099 10.2647 12.5099C10.513 12.5099 10.752 12.4701 10.9763 12.3972L10.6419 12.0629C10.2323 11.6533 10.2323 10.9891 10.6419 10.5794C11.0515 10.1698 11.7157 10.1698 12.1254 10.5794L12.4597 10.9138C12.5326 10.6895 12.5724 10.4505 12.5724 10.2022C12.5724 8.92978 11.5372 7.89453 10.2647 7.89453Z",fill:"currentColor"})]})}),(0,c.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,c.jsx)("p",{className:"text-base break-words",children:r?(0,c.jsx)(m.__experimentalText,{highlightClassName:"bg-yellow-300",highlightWords:s.split(" "),highlightEscape:!0,children:e.question}):e.question}),(0,c.jsx)("p",{className:"text-xs text-slate-500",children:(0,t.sprintf)(
(0,t.__)("by %1$s, %2$s","dokan"),e.user_display_name,e.human_readable_created_at)})]})]}),0!==e.answer.id&&(0,c.jsx)(x,{answer:e.answer},e.answer.id)]})},p=e=>(d().use(d().createNonceMiddleware(productQAGlobal.nonce)),d().use(d().createRootURLMiddleware(productQAGlobal.url)),d()(e)),f=(e,t,a=!0)=>{const[r,n]=(0,s.useState)(!0),[l,d]=(0,s.useState)(0),[o,i]=(0,s.useState)(0),[c,u]=(0,s.useState)([]),[m,h]=(0,s.useState)(t||{});return(0,s.useEffect)(()=>{if(!a)return;n(!0);const s=new URLSearchParams(m).toString();var t;(t=e+"?"+s,p({path:t,parse:!1}).then(e=>Promise.all([e.headers,e.json()]).then(([e,s])=>({headers:e,data:s})))).then(e=>{void 0!==e.headers&&(i(parseInt(e.headers.get("X-WP-TotalPages"))),d(parseInt(e.headers.get("X-WP-Total")))),u(e.data),n(!1)}).catch(e=>{n(!1)})},[e,m,a]),[c,r,l,o,e=>{h({...m,...e})},m]},w=e=>{const s=productQAGlobal?.locale||"en-US";return Intl.NumberFormat(s).format(e)},b=({filters:e,loading:s,onChange:a,data:r})=>{let{recordCounts:n,totalPages:l}=r;l=parseInt(l);const d=parseInt(e.page),o=1===d,i=d===l,u=d-1==1?1:d-1,m=d+1,h=(d-1)*parseInt(e.per_page)+1,x=h+parseInt(n)-1;return(0,c.jsxs)("div",{className:"bg-white rounded-b-md px-4 py-3 flex flex-wrap items-center justify-between gap-3 border-0 border-gray-200 sm:px-6",children:[(0,c.jsxs)("p",{className:"text-sm text-gray-700",children:[(0,t.__)("Showing ","dokan"),(0,c.jsx)("span",{className:"font-medium",children:h}),(0,t.__)(" to ","dokan"),(0,c.jsx)("span",{className:"font-medium",children:x}),(0,t.__)(" of ","dokan"),(0,c.jsx)("span",{className:"font-medium",children:r.totalRecord}),(0,t.__)(" results","dokan")]}),(0,c.jsxs)("nav",{className:"relative z-0 inline-flex rounded-md shadow-sm -space-x-px","aria-label":"Pagination",children:[(0,c.jsxs)("button",{disabled:o,onClick:()=>a({perPage:e.per_page,page:u}),className:"relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50 focus:outline-none! disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,c.jsx)("span",{className:"sr-only",children:(0,t.__)("Previous","dokan")}),(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-6 h-6",children:(0,c.jsx)("path",{fillRule:"evenodd",d:"M7.72 12.53a.75.75 0 010-1.06l7.5-7.5a.75.75 0 111.06 1.06L9.31 12l6.97 6.97a.75.75 0 11-1.06 1.06l-7.5-7.5z",clipRule:"evenodd"})})]}),(0,c.jsxs)("button",{disabled:i||!l,onClick:()=>a({perPage:e.per_page,page:m}),className:"relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50 focus:outline-none! disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,c.jsx)("span",{className:"sr-only",children:(0,t.__)("Next","dokan")}),(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-6 h-6",children:(0,c.jsx)("path",{fillRule:"evenodd",d:"M16.28 11.47a.75.75 0 010 1.06l-7.5 7.5a.75.75 0 01-1.06-1.06L14.69 12 7.72 5.03a.75.75 0 011.06-1.06l7.5 7.5z",clipRule:"evenodd"})})]})]})]})},j=window.dokan.components,v=({productId:e,userId:r})=>{const n=(0,a.useDispatch)(),[l,d]=(0,s.useState)(!1),o=(0,a.useSelect)(e=>e(i).getSearch(),[]),[u,m]=(0,s.useState)(""),[h,x]=(0,s.useState)(""),g=()=>{d(!1),m(""),x("")},f=s=>{s?.preventDefault?.(),p({path:"dokan/v1/product-questions",method:"POST",data:{product_id:e,user_id:r,question:u}}).then(()=>{x(""),g(),n(i).incrementTotal(),n(i).setIsSearching(!0),n(i).setIsSearching(!1),n(i).setSearch("")}).catch(e=>{x(e.message)})};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{className:"bg-slate-100 shadow mt-4 sm:rounded-lg",children:(0,c.jsx)("div",{className:"px-4 py-5 sm:p-6",children:(0,c.jsxs)("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[(0,c.jsx)("div",{className:"min-w-0 flex-1",children:(0,c.jsx)("h3",{className:"text-base font-semibold leading-7 text-gray-900 break-words",children:(0,t.__)("Don't see the answer you're looking for?","dokan")})}),(0,c.jsx)("div",{className:"flex shrink-0 items-center",children:0===r?(0,c.jsx)("button",{type:"button",onClick:()=>(()=>{const s=new URL(productQAGlobal.account_endpoint);s.searchParams.set("product_qa",e.toString()),s.searchParams.set("redirect",window.location.href),window.location.href=s.toString()})(),className:"inline-flex items-center rounded-md bg-red-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-red-500 focus:outline-none! focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-red-600 focus-visible:bg-red-700",children:(0,t.__)("Login to post your Question","dokan")}):(0,c.jsx)("button",{type:"button",onClick:()=>{d(!0),x(""),m(o)},className:"inline-flex items-center rounded-md bg-red-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-red-500 focus:outline-none! focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-red-600 focus-visible:bg-red-700",children:(0,t.__)("Post your Question","dokan")})})]})})}),(0,c.jsx)(j.DokanModal,{isOpen:l,onClose:g,onConfirm:f,namespace:"dokan-product-qa-post-question",dialogTitle:(0,t.__)("Post your question","dokan"),dialogContent:(0,c.jsxs)("div",{className:"space-y-4",children:[h&&(0,c.jsx)("div",{className:"rounded-md bg-red-50 p-4",children:(0,c.jsxs)("div",{className:"flex",children:[(0,c.jsx)("div",{className:"shrink-0",children:(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"h-5 w-5 text-red-400",children:(0,c.jsx)("path",{fillRule:"evenodd",d:"M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25zm-1.72 6.97a.75.75 0 10-1.06 1.06L10.94 12l-1.72 1.72a.75.75 0 101.06 1.06L12 13.06l1.72 1.72a.75.75 0 101.06-1.06L13.06 12l1.72-1.72a.75.75 0 10-1.06-1.06L12 10.94l-1.72-1.72z",clipRule:"evenodd"})})}),(0,c.jsx)("div",{className:"ml-3",children:(0,c.jsx)("h5",{className:"text-sm font-medium text-red-800",children:h})})]})}),(0,c.jsx)("div",{children:(0,c.jsx)("textarea",{rows:4,name:"comment",id:"comment",className:"block w-full rounded-md border-0 py-1.5 px-2 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:outline-none! focus:ring-1 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6",value:u,onChange:e=>m(e.target.value)})}),(0,c.jsx)("p",{className:"text-sm text-gray-500",children:(0,t.__)("You'll get a response to your question from the marketplace staff.","dokan")})]}),dialogFooterContent:(0,c.jsxs)("div",{className:"flex w-full flex-col-reverse gap-3 sm:flex-row sm:justify-end",children:[(0,c.jsx)("button",{type:"button",className:"inline-flex w-full justify-center rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50 focus:outline-none! sm:w-auto",onClick:g,children:(0,t.__)("Cancel","dokan")}),(0,c.jsx)("button",{type:"button",className:"inline-flex w-full justify-center rounded-md bg-red-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-red-500 focus:outline-none! sm:ml-3 sm:w-auto disabled:cursor-not-allowed disabled:opacity-60",onClick:f,disabled:0===u.length,children:(0,t.__)("Post","dokan")})]})})]})},y=({isUserSection:e,userId:s,productId:a})=>{const r={page:1,per_page:5,status:"visible",product_id:a};e&&(r.user_id=s),e||0===s||(r.exclude_user_id=s);const[n,l,d,o,i,m]=f("dokan/v1/product-questions",r);return(0,c.jsxs)("div",{className:"mt-4",children:[l&&(0,c.jsx)(u,{}),!l&&n.length>0&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("h3",{className:"text-black text-base font-semibold leading-loose",children:e?(0,t.__)("My Questions","dokan"):(0,t.__)("Customer Questions","dokan")}),(0,c.jsx)("div",{className:"grid grid-cols-1 divide-y divide-violet-100",children:n.map(e=>(0,c.jsx)(g,{question:e},e.id))}),o>1&&(0,c.jsx)(b,{data:{recordCounts:n.length,totalPages:o,totalRecord:d},loading:l,onChange:e=>{i({...m,...e})},filters:m})]}),!l&&!e&&0===n.length&&(0,c.jsx)(v,{productId:a,userId:s})]})},N=({productId:e,userId:s})=>{if(e)return(0,c.jsxs)(c.Fragment,{children:[0!==s&&(0,c.jsx)(y,{isUserSection:!0,userId:s,productId:e},"user-section"),(0,c.jsx)(y,{isUserSection:!1,userId:s,productId:e},"others-section")]})},_=({productId:e,userId:r})=>{const n=(0,a.useSelect)(e=>e(i).getSearch(),[]),l={page:1,per_page:5,status:"visible",product_id:e,search:n};(0,s.useEffect)(()=>{x({...l,search:n})},[n]);const[d,o,m,h,x,p]=f("dokan/v1/product-questions",l),w=(0,a.useDispatch)();return(0,c.jsxs)("div",{className:"mt-4",children:[!o&&d.length>0&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("button",{onClick:()=>{w(i).setSearch("")},className:"text-center text-gray-400 text-sm font-semibold tracking-tight flex gap-x-1 items-center hover:text-gray-600 hover:bg-transparent focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-violet-600 py-1",children:[(0,t.__)("Clear Result","dokan"),(0,c.jsxs)("svg",{width:"19",height:"20",viewBox:"0 0 19 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,c.jsx)("path",{d:"M13.8867 5.50781L4.62891 14.7656",stroke:"currentColor",strokeWidth:"1.54297",strokeLinecap:"round",strokeLinejoin:"round"}),(0,c.jsx)("path",{d:"M4.62891 5.50781L13.8867 14.7656",stroke:"currentColor",strokeWidth:"1.54297",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(0,c.jsx)("h3",{className:"text-black text-base font-semibold leading-loose",children:(0,t.sprintf)(
(0,t.__)('Matching %1$s Q&A with "%2$s"',"dokan"),d.length,n)}),(0,c.jsx)("div",{className:"grid grid-cols-1 divide-y divide-violet-100",children:d.map(e=>(0,c.jsx)(g,{question:e},e.id))}),h>1&&(0,c.jsx)(b,{data:{recordCounts:d.length,totalPages:h,totalRecord:m},loading:o,onChange:e=>{x({...p,...e})},filters:p})]}),o&&(0,c.jsx)(u,{}),(0,c.jsx)(v,{productId:e,userId:r},"post-new-question-on-noquestion-found")]})},C=()=>{const e=(0,a.useSelect)(e=>e(i).isSearching(),[]),s=(0,a.useSelect)(e=>e(i).getUserId(),[]),t=(0,a.useSelect)(e=>e(i).getProductId(),[]),r=(0,a.useSelect)(e=>e(i).getTotalQuestion(),[]);return e?(0,c.jsx)(_,{userId:s,productId:t},"search-result"):(0,c.jsx)(N,{productId:t,userId:s},"content-section"+r+s+t)},S=window.wp.compose,k=()=>{const e=(0,a.useDispatch)(),[r,n]=(0,s.useState)(""),l=(0,a.useSelect)(e=>e(i).getSearch(),[]);(0,s.useEffect)(()=>(n(l),()=>{}),[l]);const d=(0,s.useCallback)((0,S.debounce)(s=>{s.trim().length>3&&e(i).setSearch(s)},800),[]);return(0,c.jsxs)("div",{className:"relative",children:[(0,c.jsx)("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:(0,c.jsx)("svg",{className:"w-4 h-4 text-gray-500","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",children:(0,c.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"})})}),(0,c.jsx)("input",{type:"search",onChange:e=>{n(e.target.value),d(e.target.value)},value:r,className:"block w-full p-4 pl-10 text-sm text-gray-900 border border-gray-300 rounded-sm bg-gray-50 focus:ring-blue-500 focus:border-blue-500",placeholder:(0,t.__)("Search Questions & Answers","dokan")})]})},I=({productId:e,userId:r,count:n})=>{const l=(0,a.useDispatch)(),d=(0,a.useSelect)(e=>e(i).getTotalQuestion(),[]);return(0,s.useEffect)(()=>{l(i).setProductId(parseInt(e)),l(i).setTotal(parseInt(n)),l(i).setUserId(parseInt(r))},[e,r]),(0,c.jsxs)("div",{children:[(0,c.jsx)("h2",{children:(0,t.sprintf)(
(0,t.__)("Questions about this product (%s)","dokan"),w(d))}),(0,c.jsxs)("div",{className:"my-4 mr-1",children:[(0,c.jsx)(k,{}),(0,c.jsx)(C,{})]})]})};(0,a.register)(i);const T=document.getElementById("dokan-product-qa-frontend-root"),E=new URL(window.location.href);if(T){const e=T.dataset.product,t=T.dataset.user,a=T.dataset.count;(0,s.createRoot)(T).render((0,c.jsx)(I,{productId:e,userId:t,count:a}))}if(E.searchParams.has("product_qa")){const e=document.getElementById("tab-title-product_qa").firstElementChild;setTimeout(function(){e.click()},1e3)}})();
(()=>{var e={};(()=>{var t;globalThis.importScripts&&(t=globalThis.location+"");var r=globalThis.document;if(!t&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(t=r.currentScript.src),!t)){var a=r.getElementsByTagName("script");if(a.length)for(var n=a.length-1;n>-1&&(!t||!/^http(s?):/.test(t));)t=a[n--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),e.p=t})(),e.p=window.wcpayAssets.url,(()=>{"use strict";window.wp.domReady;const e=e=>"undefined"!=typeof wcpayConfig&&void 0!==wcpayConfig[e]?wcpayConfig[e]:t(e),t=e=>{let t=null;if("undefined"!=typeof wcpay_upe_config)t=wcpay_upe_config;else{if("object"!=typeof wc||void 0===wc.wcSettings)return null;t=wc.wcSettings.getSetting("woocommerce_payments_data")||{}}return t[e]||null},r=e=>"object"==typeof wcpayExpressCheckoutParams&&wcpayExpressCheckoutParams.hasOwnProperty(e)?wcpayExpressCheckoutParams[e]:null,a=(t,a={})=>{if(!1===(e("isShopperTrackingEnabled")??r("is_shopper_tracking_enabled")))return;const n=e("platformTrackerNonce")??r("nonce")?.platform_tracker,o=e("ajaxUrl")??r("ajax_url"),c=new FormData;c.append("tracksNonce",n),c.append("action","platform_tracks"),c.append("tracksEventName",t),c.append("tracksEventProp",JSON.stringify(a)),fetch(o,{method:"post",body:c}).then(e=>e.json())};if(window.wcPayFrontendTracks&&window.wcPayFrontendTracks.length){for(const e of window.wcPayFrontendTracks)a(e.event,e.properties);window.wcPayFrontendTracks=[]}})()})();
(()=>{"use strict";const t=window.wp.hooks,e=(t,e)=>{const a={id:"gla_"+t.id,quantity:e,google_business_vertical:"retail"};return t.name&&(a.name=t.name),t?.categories?.length&&(a.category=t.categories[0].name),t?.prices?.price&&(a.price=parseInt(t.prices.price,10)/10**t.prices.currency_minor_unit),a},a=(t,a=1)=>{((t,e)=>{if("function"!=typeof gtag)throw new Error("Function gtag not implemented.");window.gtag("event","add_to_cart",{send_to:"GLA",...e})})(0,{ecomm_pagetype:"cart",event_category:"ecommerce",items:[e(t,a)]})},n=t=>{var e;return glaGtagData.products[t.id]&&(t.name=glaGtagData.products[t.id].name,t.prices=(e=glaGtagData.products[t.id].price,{price:Math.round(e*10**glaGtagData.currency_minor_unit),currency_minor_unit:glaGtagData.currency_minor_unit})),t};(0,t.addAction)("experimental__woocommerce_blocks-cart-add-item","google-listings-and-ads",({product:t,quantity:e=1})=>{a(t,e)});const r=function(t){const e=t.currentTarget.dataset,r=n({id:e.product_id});a(r,e.quantity||1)},o=function(t){const e=t.target.closest("form.cart");if(!e)return;const r=e.querySelector("[name=add-to-cart]");if(!r)return;const o=e.querySelector("[name=variation_id]"),c=e.querySelector("[name=quantity]"),i=n({id:parseInt(o?o.value:r.value,10)});a(i,c?parseInt(c.value,10):1)};document.defaultView.addEventListener("DOMContentLoaded",function(){document.querySelectorAll(".add_to_cart_button:not(.product_type_variable):not(.product_type_grouped):not(.wc-block-components-product-button__button)").forEach(t=>{t.addEventListener("click",r)}),document.querySelectorAll('[data-block-name="woocommerce/product-button"] > .add_to_cart_button:not(.product_type_variable):not(.product_type_grouped)').forEach(t=>{t.addEventListener("click",r)}),document.querySelectorAll(".single_add_to_cart_button").forEach(t=>{t.addEventListener("click",o)})}),"function"==typeof jQuery&&jQuery(document).on("found_variation","form.cart",function(t,e){(t=>{t?.variation_id&&(glaGtagData.products[t.variation_id]={name:t.display_name,price:t.display_price})})(e)})})();
(()=>{const e={statistics:["analytics_storage"],marketing:["ad_storage","ad_user_data","ad_personalization"]},t=()=>{if("function"==typeof wp_has_consent){void 0===window.wp_consent_type&&(window.wp_consent_type="optin");const t={};for(const[n,o]of Object.entries(e))if(""!==consent_api_get_cookie(window.consent_api.cookie_prefix+"_"+n)){const e=wp_has_consent(n)?"granted":"denied";o.forEach(n=>{t[n]=e})}Object.keys(t).length>0&&window.gtag("consent","update",t)}};document.addEventListener("wp_listen_for_consent_change",t=>{const n={},o=e[Object.keys(t.detail)[0]],a="allow"===Object.values(t.detail)[0]?"granted":"denied";void 0!==o&&(o.forEach(e=>{n[e]=a}),Object.keys(n).length>0&&window.gtag("consent","update",n))}),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t()})();
jQuery(document).ready(function(a){if(!localStorage)return;if(!window.dokanPageViewsParams)return;let o=(new Date).toISOString().slice(0,10),e=JSON.parse(localStorage.getItem("dokan_pageview_count"));(null===e||e.today&&e.today!==o)&&(e={today:o,post_ids:[]}),e.post_ids.includes(window.dokanPageViewsParams.post_id)||(a.post(window.dokanPageViewsParams.ajax_url,{action:"dokan_pageview",_ajax_nonce:window.dokanPageViewsParams.nonce,post_id:window.dokanPageViewsParams.post_id}),e.post_ids.push(window.dokanPageViewsParams.post_id),localStorage.setItem("dokan_pageview_count",JSON.stringify(e)))});