1"use strict";(self.webpackChunkwebpackYWCASBlocksJsonp=self.webpackChunkwebpackYWCASBlocksJsonp||[]).push([[716],{821(e,t,a){a.d(t,{Z8:()=>x,bM:()=>h,z6:()=>w,Eg:()=>m,cM:()=>k,ZM:()=>N,Lw:()=>i});var r=a(1609),o=a(6427),s=a(828),c=a(4939);const l=({submitStyle:e,buttonLabel:t,iconType:a,onClick:l,wrapperStyle:n})=>{switch(e){case"text":return(0,r.createElement)(c.Button,{className:"ywcas-submit-button",color:"secondary",size:"sm",onClick:l},t);case"icon":return"icon-right"===a&&(0,r.createElement)(c.Box,{className:"ywcas-submit-wrapper",sx:n},(0,r.createElement)(o.Icon,{className:"ywcas-submit-icon",onClick:l,icon:(0,s.$p)()}));case"iconText":return(0,r.createElement)(c.Button,{className:"ywcas-submit-button",color:"secondary",size:"sm",onClick:l},(0,r.createElement)(o.Icon,{className:"ywcas-submit-icon",icon:(0,s.$p)()})," ",t)}};var n=a(2315);const i=({queryString:e,placeholder:t,placeholderTextColor:a,inputTextColor:i,inputBgColor:m,inputBgFocusColor:u,inputBorderColor:p,inputBorderFocusColor:d,inputBorderSize:y,inputBorderRadius:h,submitContentColor:g,submitContentHoverColor:w,submitBgColor:b,submitBgHoverColor:_,submitBorderColor:f,submitBorderHoverColor:E,submitStyle:k,size:C,setSearchQuery:S,iconType:x,buttonLabel:N,buttonBorderRadius:B,onFocus:A=null,onBlur:v=null,onCloseMobile:L=null,isSmallDevice:T=!1})=>{const $=()=>({borderRadius:"50%",backgroundColor:`${b}!important`,border:"1px solid",borderColor:`${f||"#FFF"} !important`,svg:{height:""!==b&&"#fff"!==b.toLowerCase()&&"#ffffff"!==b.toLowerCase()?"20px":"24px"},"&:hover, & > sgv:hover":{backgroundColor:`${_}!important`,borderColor:`${E||"#FFF"} !important`}}),F=()=>{if(""!==e){const t=n.YWCAS_SITE_URL+"?ywcas=1&post_type=product&lang="+n.YWCAS_LANG+"&s="+e;window.location.href=t}};let I="ywcas-search-field-"+Math.floor(10*Math.random());return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(c.Box,{className:"ywcas-block-components-search-field",sx:{"& .ywcas-input-field-wrapper":{flex:1,borderRadius:`${h.topLeft} ${h.topRight} ${h.bottomRight} ${h.bottomLeft}`,borderColor:`${p||"#7C7C7C"}!important`,borderWidth:`${y.topLeft} ${y.topRight} ${y.bottomLeft} ${y.bottomRight}`,backgroundColor:`${m||"#FFF"}!important`,borderStyle:"solid",overflow:"hidden","&:focus-within":{backgroundColor:`${u||"#FFF"}!important`,borderColor:`${d||"#5B5B5B"}!important`},"& >div":{width:"100%",padding:0,input:{flex:1}}},"& .ywcas-input-field":{fontSize:"1em!important"},"& .ywcas-input-field input":{color:`${i||"#000"} !important`},"& .ywcas-input-field input::placeholder":{color:`${a||"#000"}`,opacity:1},"& .ywcas-submit-button":{color:`${g||"#fff"} !important`,backgroundColor:`${b||"#a7ab06"} !important`,borderColor:`${f||"#FFF"} !important`,borderRadius:`${B.topLeft} ${B.topRight} ${B.bottomRight} ${B.bottomLeft}`},"& .ywcas-submit-button:hover":{color:`${w||"#fff"} !important`,backgroundColor:`${_||"#a7ab06"} !important`,borderColor:`${E||"#FFF"} !important`},"& .ywcas-submit-icon":{color:`${g||"#000"} !important`},"&:hover .ywcas-submit-icon, & .ywcas-submit-icon:hover":{color:`${w||"#000"} !important`},"& .lapilliUI-Input__backdrop":{display:"none"}}},T&&(0,r.createElement)("div",{className:"mobile-search-close",onClick:L},(0,r.createElement)(o.Icon,{icon:(0,s.US)()})),(0,r.createElement)(c.Stack,{direction:"row",spacing:0},(0,r.createElement)(c.Stack,{className:"ywcas-input-field-wrapper"},(0,r.createElement)(c.Input,{id:I,className:"ywcas-input-field",placeholder:t,autoComplete:"off",size:C,value:e,onChange:S,onFocus:A,onBlur:v,onKeyDown:e=>{"Enter"===e.key&&F()},startAdornment:"icon"===k&&"icon-left"===x?(0,r.createElement)(c.Box,{className:"ywcas-submit-wrapper",sx:$()},(0,r.createElement)(o.Icon,{className:"ywcas-submit-icon",icon:(0,s.$p)()})):(0,r.createElement)("label",{className:"screen-reader-text",for:I},t),endAdornment:(0,r.createElement)(l,{submitStyle:k,buttonLabel:N,submitBgColor:b,iconType:x,onClick:F,wrapperStyle:$()})})))))},m=({title:e,searches:t,onClick:a})=>{const o=e=>{e.stopPropagation(),a(e.target.id)};return(0,r.createElement)(c.Stack,{className:"ywcas-popular-searches-wrapper"},(0,r.createElement)(c.Typography,{className:"ywcas-popular-searches__title"},e),t&&(0,r.createElement)(c.Stack,{className:"ywcas-popular-searches-items",direction:"row",sx:{flexWrap:"wrap"},spacing:1},t.map(e=>(0,r.createElement)(c.Button,{className:"ywcas-popular-searches-item",key:e,id:e,onClick:o,size:"md",variant:"outlined"},e))))};var u=a(1455),p=a.n(u),d=a(6087);const y=({label:e,onClick:t})=>(0,r.createElement)(c.Box,{id:e,className:"ywcas-history-search-item",onClick:t,sx:{"&":{textTransform:"capitalize",fontSize:"0.93em",color:"var(--wp--preset--color--contrast, #709422)"},"&:hover":{cursor:"pointer",textDecoration:"underline"}}},(0,r.createElement)(c.Stack,{direction:"row",spacing:1,align:"center"},(0,r.createElement)(c.Stack,{align:"center",className:"ywcas-history-search-item--icon"}
1,(0,s.O4)({width:"20px"})),(0,r.createElement)(c.Box,{className:"ywcas-history-search-item--item"},e))),h=({title:e,searches:t,onClick:a})=>{const[o,s]=(0,d.useState)(t);(0,d.useEffect)(()=>{s(t)},[t]);const l=e=>{e.stopPropagation();const t=e.target;let r=!1;r="ywcas-history-search-item"!==t.className?t.closest(".ywcas-history-search-item").id:t.id,r&&a(r)};return 0===o.length?null:(0,r.createElement)("div",{className:"ywcas-history-searches-wrapper"},(0,r.createElement)(c.Stack,{direction:"row",justify:"space-between",align:"center",className:"ywcas-history-header"},(0,r.createElement)(c.Typography,{className:"ywcas-history-searches__title"},e),(0,r.createElement)(c.Box,{className:"ywcas-delete-all-history",onClick:()=>{p()({path:"/ywcas/v1/reset-user-history"}).then(e=>{s([])}).catch(e=>{console.log(e)})}},n.YWCAS_DELETE_ALL)),o&&o.length>0&&(0,r.createElement)(c.Stack,{className:"ywcas-history-searches-items",spacing:1},o.map(e=>(0,r.createElement)(y,{label:e,key:e,onClick:l}))))};var g=a(8572);const w=({children:e,...t})=>{const a=(0,g.Ub)(`(max-width: ${n.YWCAS_MOBILE_BREAKPOINT})`);return(0,r.createElement)(r.Fragment,null,!a&&(0,r.createElement)(c.Popover,{...t},(0,r.createElement)(c.Box,{className:"popover-content"},e)),a&&(0,r.createElement)(c.Box,{className:"mobile-search-content"},e))};var b=a(5232);const _=({className:e,label:t,backgroundColor:a,color:o,top:s})=>(0,r.createElement)(c.Box,{className:`ywcas-badge ${e}`,sx:{top:`${s}px`,backgroundColor:a,color:o}},t),f=({imageSize:e,marginLeft:t,item:a,showSaleBadge:o,showOutOfStockBadge:s,showFeaturedBadge:l,hideFeaturedIfOnSale:i})=>{const m=Boolean(parseInt(a.instock)),u=o&&Boolean(parseInt(a.onsale)),p=(!i||!u)&&l&&Boolean(parseInt(a.featured)),d=s&&!m,{saleBadgeLabel:y,saleFeaturedLabel:h,saleOutOfStockLabel:g,saleBadgeColors:w,featuredBadgeColors:f,outOfStockBadgeColors:E}=n.ywcasDefaultSettings,k=u?30:5,C=p?k+25:u?30:5;return(0,r.createElement)(c.Stack,{className:"search-result-item__thumbnail",sx:{width:e,marginLeft:t}},u&&(0,r.createElement)(_,{className:"ywcas-onsale-badge",top:5,label:(0,b.Ay)(y),backgroundColor:w.bgcolor,color:w.color}),p&&(0,r.createElement)(_,{className:"ywcas-featured-badge",top:k,label:h,backgroundColor:f.bgcolor,color:f.color}),d&&(0,r.createElement)(_,{className:"ywcas-outofstock-badge",top:C,label:g,backgroundColor:E.bgcolor,color:E.color}),(0,r.createElement)("img",{src:a.thumbnail.small,alt:a.name,width:e}))},E=function(e){const{item:t,searchQuery:a,onClick:s,showName:l,showImage:i,showPrice:m,showCategories:u,showStock:p,showSKU:y,showSummary:h,showAddToCart:w,layout:_,imageSize:E,imagePosition:k,summaryMaxWord:C,productNameColor:S,priceLabel:x,categoryResults:N,results:B}=e,A=(0,g.Ub)("(max-width: 600px)"),v="grid"===_?"column":"row",L="list"===_&&"right"===k?"auto":0,[T,$]=(0,d.useState)(!1),F=e=>{let t=N.find(t=>parseInt(t.term_id)===e.parent);return t&&0!==t.parent&&(t=F(t)),t},I=e=>{const t=e.name;return(0,r.createElement)("a",{href:e.url},(0,b.Ay)(t))},z=e=>{e.stopPropagation(),e.target.classList.contains("search-result-add-to-cart")&&(s(e,t,!1),$(!0),jQuery.ajax({url:n.YWCAS_AJAX_URL.toString().replace("%%endpoint%%","add_to_cart"),data:{quantity:1,product_id:t.post_id,product_sku:t.sku},type:"POST",success:function(e){$(!1),jQuery(document.body).trigger("added_to_cart",[e.fragments,e.cart_hash])}}))};return(0,r.createElement)(c.Box,{className:`search-result-item ${_} ${parseInt(t.is_purchasable)?"":"not-purchasable"}`},(0,r.createElement)(c.Stack,{align:"center",direction:v,spacing:2,className:"search-result-item__content","data-id":t.post_id,"data-name":t.name,onClick:e=>s(e,t)},i&&("grid"===_||"list"===_&&"right"!==k)&&(0,r.createElement)(f,{marginLeft:L,item:t,...e}),(0,r.createElement)(()=>{if(!i&&(0,g.Im)(t.thumbnail))return"";const e=(""!==t.min_price||""!==t.max_price)&&m,a=parseInt(t.instock)>0?"in-stock":"out-of-stock";return(0,r.createElement)(c.Stack,{className:"search-result-item_name",sx:{flex:1,alignItems:"left"},onClick:e=>s(e,t,B.totalResults)},l&&(0,r.createElement)(c.Typography,{sx:{color:S,fontSize:"0.9em"},className:"search-result-item__name"},(0,b.Ay)(t.name)),e&&(0,r.createElement)(c.Typography,{className:"search-result-item__price",sx:{fontSize:"0.9em",fontWeight:"600"}},x," ",(0,b.Ay)((0,g.y8)(t))),(0,r.createElement)(c.Box,{className:"search-result-item__inline_group",direction:"row",sx:{dis
1play:"block"}},y&&t.sku&&(0,r.createElement)(c.Typography,{className:"search-result-item__sku"},(0,r.createElement)("strong",null,n.YWCAS_SKU_LABEL)," ",t.sku),y&&p&&t.sku&&(0,r.createElement)("span",null,"-"),p&&(0,r.createElement)(c.Typography,{className:`search-result-item__stock stock ${a}`},parseInt(t.instock)?n.YWCAS_IN_STOCK_LABEL:n.YWCAS_OUT_OF_STOCK_LABEL)),u&&(0,r.createElement)(c.Box,{className:"search-result-item__category",sx:{fontSize:"0.7em"}},(e=>{if(N){const t=N.find(t=>parseInt(t.term_id)===e[0]);if(!t)return"";const a=0!==t.parent&&F(t);return a?(0,r.createElement)(c.Box,null,I(a)," ",(0,r.createElement)("span",null," > ")," ",I(t)):I(t)}return""})(t.parent_category)),h&&"grid"===_&&(0,r.createElement)(c.Typography,{className:"search-result-item__summary",sx:{fontSize:"0.8em"}},(0,g.GH)(t.summary,C)))},null),A&&h&&"grid"!==_&&(0,r.createElement)(c.Typography,{className:"search-result-item__summary",sx:{fontSize:"0.8em"}},(0,b.Ay)((0,g.GH)(t.summary,C))),w&&(T?(0,r.createElement)(c.Spinner,{color:"default",size:"sm",thickness:3.6}):(0,r.createElement)("div",{className:"wp-block-button"},(0,r.createElement)(()=>{const e=parseInt(t.instock),a="wp-element-button wp-block-button__link wp-block-woocommerce-product-button search-result-add-to-cart";return parseInt(t.is_purchasable)&&e&&("simple"===t.product_type||"variation"===t.product_type)&&0<parseFloat(null==t?void 0:t.max_price)?(0,r.createElement)(o.Button,{className:a,onClick:z},n.YWCAS_ADD_TO_CART_LABEL):e&&"variable"===t.product_type&&0<parseFloat(null==t?void 0:t.max_price)?(0,r.createElement)(o.Button,{size:"sm",className:a,onClick:e=>s(e,t)},n.YWCAS_SELECT_OPTIONS):(0,r.createElement)(o.Button,{size:"sm",className:a,onClick:e=>s(e,t)},n.YWCAS_READ_MORE)},null))),i&&"list"===_&&"right"===k&&(0,r.createElement)(f,{marginLeft:L,item:t,...e})),!A&&h&&"grid"!==_&&(0,r.createElement)(c.Typography,{className:"search-result-item__summary",sx:{fontSize:"0.8em"}},(0,b.Ay)((0,g.GH)(t.summary,C))))},k=e=>{const{searchQuery:t,layout:a,results:o,categoryList:s,noResults:l,showViewAll:i,showViewAllText:m,maxResultsToShow:u}=e,d=(e,a,r=!0)=>{e.stopPropagation();const s="/ywcas/v1/register?itemID="+a.post_id+"&queryString="+t+"&totalResults="+o.totalResults+"&lang="+n.YWCAS_LANG;p()({path:s}).then(()=>{r&&y(a)}).catch(e=>{console.log(e)})},y=e=>{e.url&&window.location.replace(e.url.replaceAll(new RegExp("&?#038;","g"),"&"))},h=m.replace("{total}",o.totalResults),g=o.results;return(0,r.createElement)(r.Fragment,null,g&&g.length&&(0,r.createElement)(c.Grid,{className:`ywcas-search-results-grid ${a}`,columns:1},g.map((t,a)=>(0,r.createElement)(E,{key:a,item:t,onClick:d,results:o,categoryResults:s,...e}))),!g&&(0,r.createElement)(c.Typography,null,l),g&&i&&u<o.totalResults&&(0,r.createElement)("div",{className:"ywcas-total-results"},(0,r.createElement)("span",{className:"total-results-arrow"},">")," ",(0,r.createElement)("a",{className:"total-results-link",href:"#",onClick:()=>{const e=!1!==o.fuzzyToken&&""!==o.fuzzyToken?o.fuzzyToken:t,a=n.YWCAS_SITE_URL+"?ywcas=1&post_type=product&lang="+n.YWCAS_LANG+"&s="+e;window.location.href=a}},h)))};var C=a(7723);const S=({query:e,singleCategory:t})=>{const a=t.url+"?ywcas=1&ywcas_filter="+e+"&lang="+n.YWCAS_LANG;return(0,r.createElement)(c.Stack,{direction:"row",align:"center",sx:{gap:"4px",paddingBottom:"10px"},className:"ywcas-category-result"},(0,r.createElement)(c.Typography,{sx:{fontWeight:"bold",fontSize:"0.93em"}},e),(0,r.createElement)(c.Typography,{sx:{fontSize:"0.81em",color:"#8F8080"}},n.YWCAS_IN_CATEGORY),(0,r.createElement)("a",{href:a},(0,r.createElement)(c.Typography,{sx:{fontSize:"0.93em",textTransform:"capitalize",color:"var(--wp--preset--color--contrast,#007565)"}},(0,b.Ay)(t.name))))},x=({label:e,query:t,categories:a,results:o,maxResults:s})=>{const l=(e,t)=>{let a=!1;return e.forEach(e=>{a||(e.term_id===t?a=e:Array.isArray(e.children)&&(a=l(e.children,t)))}),a};return(0,r.createElement)(c.Stack,null,(()=>{let n=(()=>{let e=[];
1if(o)return o.forEach(t=>{(null==t?void 0:t.parent_category.length)>0&&(e=e.concat(t.parent_category))}),e})();if(n.length>0){const o=(0,g.wJ)(n,s);return(0,r.createElement)(c.Stack,{className:"search-category-results",sx:{"& .ywcas-category-result:last-child":{paddingBottom:0}}},e&&(0,r.createElement)(c.Typography,{sx:{"&":{borderBottom:"1px solid #9797972e",marginBottom:"17px"}},className:"search-category-results-label"},e),o.map(e=>{const o=l(a,e);if(o)return(0,r.createElement)(S,{key:o.term_id,query:t,singleCategory:o})}))}})())},N=({label:e,posts:t,background:a,maxResults:o})=>{let s=!1;return t&&t.length&&(s=t.length>o?t.slice(0,o):t),(0,r.createElement)(c.Box,{className:"ywcas-related-content",sx:{background:a}},(0,r.createElement)(c.Typography,{className:"ywcas-related-content__label"},e),s&&s.map(e=>(0,r.createElement)(c.Typography,{className:"ywcas-related-content__link",key:e.post_id},"> ",(0,r.createElement)("a",{key:e,href:e.url},e.name))),!s&&(0,r.createElement)(c.Typography,{className:"ywcas-related-content__no_result"},(0,C.__)("No related content found","yith-woocommerce-ajax-search")))};a(6942),a(2089)},8572(e,t,a){a(5232);var r=a(2315),o=a(1609);const s=e=>accounting.formatMoney(e,{symbol:r.ywcas_wc_data.currency.symbol,decimal:r.ywcas_wc_data.currency.decimal_sep,thousand:r.ywcas_wc_data.currency.thousand_sep,precision:r.ywcas_wc_data.currency.decimals,format:r.ywcas_wc_data.currency.format}),c=(e,t=0)=>{const a=s(e);return parseFloat(t)&&t!==e?`${s(t)} - ${a}`:a};a.d(t,["GH",0,(e,t)=>e.split(" ").slice(0,t).join(" "),"Im",0,e=>void 0===e||("object"==typeof e?0===Object.keys(e).length:e.hasOwnProperty(length)?0===e.length:"undefined"),"Ub",0,e=>{const t=(0,o.useMemo)(()=>window.matchMedia(e),[e]),[a,r]=(0,o.useState)(t.matches);return(0,o.useEffect)(()=>{const e=()=>r(t.matches);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},[t]),a},"wJ",0,(e,t=3)=>{const a=new Map;for(const t of e)a.has(t)?a.set(t,a.get(t)+1):a.set(t,1);return[...a.entries()].sort((e,t)=>t[1]-e[1]).slice(0,t).map(e=>e[0])},"y8",0,e=>{let t=""!==e.max_price?c(e.max_price):"";return"variable"===e.product_type?t=c(e.max_price,e.min_price):parseInt(e.onsale)&&""!==e.min_price&&(t=`<del>${c(e.max_price)}</del> ${c(e.min_price)}`),t}])},2193(e,t,a){a.r(t);var r=a(1609),o=a(6087),s=a(4939),c=a(2106),l=a(821),n=a(2315);a.d(t,["default",0,({totalInnerBlocks:e,hasHistoryBlock:t,hasPopularBlock:a,children:i})=>{const{query:m,inputFocused:u,size:p,setInputFocused:d}=(0,c.$A)();let y=!1,h=0;if("yes"===t&&(h=1),"yes"===a&&(h+=1),e<=h){let e=0;"yes"===t&&0===n.history.length&&(e=1),"yes"===a&&0===n.popular.length&&(e+=1),y=h-e===0}return(0,o.useEffect)(()=>{const e=e=>{var t;const a=document.getElementsByClassName("wp-block-yith-empty-block"),r=null!==(t=e.target.parentNode.parentNode)&&void 0!==t&&t;r&&r.classList&&r.classList.contains("ywcas-input-field-wrapper")||a[0]&&!a[0].contains(e.target)&&d(null)};return document.addEventListener("click",e),()=>{document.removeEventListener("click",e)}},[d]),!n.YWCAS_HAS_AUTOCOMPLETE||y?null:u&&(""===m||m.length<n.YWCAS_MIN_CHARS)?(0,r.createElement)(l.z6,{className:"ywcas-popover-results",anchorRef:u,verticalMargin:5,forceMinWidth:!0,forceInView:!1,fixed:!0},(0,r.createElement)(s.Stack,{direction:"column",spacing:4,className:"wp-block-yith-empty-block",sx:{fontSize:"small"===p?"16px":"18px"}},i)):null}])}}]);
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.