"use strict";(globalThis.webpackChunkplugin_slug=globalThis.webpackChunkplugin_slug||[]).push([[9175],{9175(e,a,s){s.r(a),s.d(a,{default:()=>h});var t=s(7723),l=s(1609),c=s.n(l),n=s(937),i=s(5698),o=s(4715),r=s(790);const d=({tag:e="p",placeholder:a=(0,t.__)("Enter text...","section-collection"),value:s="",isBackend:l=!1,onChange:n=()=>{},className:i=""})=>l?(0,r.jsx)(o.RichText,{tagName:e,className:i,placeholder:a,value:s,onChange:n}):s&&c().createElement(e,{className:i,dangerouslySetInnerHTML:{__html:s}}),h=({attributes:e,setAttributes:a,isBackend:s=!1})=>{const[c,o]=(0,l.useState)("all"),[h,u]=(0,l.useState)(""),[g,m]=(0,l.useState)(null),{faqData:x=[],faqHeader:p={}}=e||{},v=(0,l.useCallback)((e=>{m((a=>a===e?null:e))}),[]),j=(0,l.useCallback)((()=>u("")),[]),N=(0,l.useMemo)((()=>{const e=h.toLowerCase();return x.filter((e=>"all"===c||e.category===c)).map((a=>({...a,items:a.items.filter((a=>a.question.toLowerCase().includes(e)||a.answer.toLowerCase().includes(e)))}))).filter((e=>e.items.length>0))}),[x,c,h]);return(0,l.useEffect)((()=>{m(null)}),[c,h]),(0,r.jsx)("div",{className:"bpl-sc-mfaq-section",children:(0,r.jsxs)("div",{className:"faq-container",children:[(0,r.jsxs)("div",{className:"faq-header",children:[(0,r.jsx)(d,{tag:"h1",placeholder:(0,t.__)("title...","section-collection"),isBackend:s,value:p.title,onChange:e=>a({faqHeader:(0,i.O)(p,e,"title")})}),(0,r.jsx)(d,{isBackend:s,tagName:"p",placeholder:(0,t.__)("sub title...","section-collection"),value:p.subTitle,onChange:e=>a({faqHeader:(0,i.O)(p,e,"subTitle")})}),(0,r.jsx)("div",{className:"search-container",children:(0,r.jsxs)("div",{className:"search-box",children:[(0,r.jsx)(n.KSO,{className:"search-icon"}),(0,r.jsx)("input",{type:"text",value:h,placeholder:"Search questions...",onChange:e=>u(e.target.value)}),h&&(0,r.jsx)("button",{className:"clear-search visible",onClick:j,title:"Clear search",children:(0,r.jsx)(n.QCr,{})})]})}),(0,r.jsxs)("div",{className:"category-filter",children:[(0,r.jsx)("button",{className:"category-btn "+("all"===c?"active":""),onClick:()=>o("all"),"data-category":"all",children:"All"}),x.map((e=>(0,r.jsx)("button",{className:"category-btn "+(c===e.category?"active":""),onClick:()=>o(e.category),"data-category":e.category,children:e.category.charAt(0).toUpperCase()+e.category.slice(1)},e.category)))]})]}),(0,r.jsx)("div",{className:"faq-content",children:N.length>0?N.map(((e,l)=>(0,r.jsxs)("div",{className:"faq-category","data-category":e.category,children:[(0,r.jsx)(d,{tag:"h2",placeholder:(0,t.__)("category name...","section-collection"),value:e.title,isBackend:s,onChange:e=>a({faqData:(0,i.O)(x,e,l,"title")})}),e.items.map(((e,c)=>{const o=`${l}-${c}`,h=g===o;return(0,r.jsxs)("div",{className:"faq-item "+(h?"active":""),children:[(0,r.jsxs)("div",{className:"faq-question",onClick:()=>v(o),children:[(0,r.jsx)(d,{isBackend:s,tag:"h3",placeholder:(0,t.__)("question...","section-collection"),value:e.question,onChange:e=>a({faqData:(0,i.O)(x,e,l,"items",c,"question")})}),(0,r.jsx)("span",{className:"faq-icon",children:(0,r.jsx)(n.OiG,{className:"plus-icon"})})]}),(0,r.jsx)("div",{className:"faq-answer "+(h?"active":""),children:(0,r.jsx)(d,{isBackend:s,tagName:"p",placeholder:(0,t.__)("answer...","section-collection"),value:e.answer,onChange:e=>a({faqData:(0,i.O)(x,e,l,"items",c,"answer")})})})]},o)}))]},e.category||l))):(0,r.jsx)(d,{isBackend:s,tagName:"p",className:"no-data-message",placeholder:(0,t.__)("No FAQ available","section-collection"),value:p.noDataMessage,onChange:e=>a({faqHeader:(0,i.O)(p,e,"noDataMessage")})})})]})})}}}]);