(()=>{var e,t={5132:(e,t,r)=>{"use strict";r.r(t);var l=r(9196),o=r(1984),n=r(9518);const c=window.wp.blocks,a=JSON.parse('{"name":"woocommerce/product-best-sellers","title":"Best Selling Products","category":"woocommerce","keywords":["WooCommerce"],"description":"Display a grid of your all-time best selling products.","supports":{"align":["wide","full"],"html":false},"attributes":{"columns":{"type":"number","default":3},"rows":{"type":"number","default":3},"alignButtons":{"type":"boolean","default":false},"contentVisibility":{"type":"object","default":{"image":true,"title":true,"price":true,"rating":true,"button":true},"properties":{"image":{"type":"boolean","default":true},"title":{"type":"boolean","default":true},"price":{"type":"boolean","default":true},"rating":{"type":"boolean","default":true},"button":{"type":"boolean","default":true}}},"categories":{"type":"array","default":[]},"catOperator":{"type":"string","default":"any"},"isPreview":{"type":"boolean","default":false},"stockStatus":{"type":"array"},"editMode":{"type":"boolean","default":true},"orderby":{"type":"string","enum":["date","popularity","price_asc","price_desc","rating","title","menu_order"],"default":"popularity"}},"textdomain":"woocommerce","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}'),s=window.wp.blockEditor,i=window.wp.components,d=window.wp.serverSideRender;var m=r.n(d);const u=(0,l.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 230 250",style:{width:"100%"}},(0,l.createElement)("title",null,"Grid Block Preview"),(0,l.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:".779",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),(0,l.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"101.448",fill:"#E1E3E6",rx:"5"}),(0,l.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:"136.277",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),(0,l.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"236.946",fill:"#E1E3E6",rx:"5"}),(0,l.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:".779",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),(0,l.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"101.448",fill:"#E1E3E6",rx:"5"}),(0,l.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:"136.277",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),(0,l.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"236.946",fill:"#E1E3E6",rx:"5"}),(0,l.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:".779",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),(0,l.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"101.448",fill:"#E1E3E6",rx:"5"}),(0,l.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:"136.277",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),(0,l.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"236.946",fill:"#E1E3E6",rx:"5"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"221.798",fill:"#E1E3E6",rx:"3"}));var g=r(5736);const h=(e,t,r)=>r?Math.min(e,t)===e?t:Math.max(e,r)===e?r:e:Math.max(e,t)===t?e:t,E=({columns:e,rows:t,setAttributes:r,alignButtons:o,minColumns:n=1,maxColumns:c=6,minRows:a=1,maxRows:s=6})=>(0,l.createElement)(l.Fragment,null,(0,l.createElement)(i.RangeControl,{label:(0,g.__)("Columns","woocommerce"),value:e,onChange:e=>{const t=h(e,n,c);r({columns:Number.isNaN(t)?"":t})},min:n,max:c}),(0,l.createElement)(i.RangeControl,{label:(0,g.__)("Rows","woocommerce"),value:t,onChange:e=>{const t=h(e,a,s);r({rows:Number.isNaN(t)?"":t})},min:a,max:s}),(0,l.createElement)(i.ToggleControl,{label:(0,g.__)("Align the last block to the bottom","woocommerce"),help:o?(0,g.__)("Align the last block to the bottom.","woocommerce"):(0,g.__)("The last inner block will follow other content.","woocommerce"),checked:o,onChange:()=>r({alignButtons:!o})})),p=window.wc.wcSettings,w=({onChange:e,settings:t})=>{const{image:r,button:o,price:n,rating:c,title:a}=t,s=!1!==r;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(i.ToggleControl,{label:(0,g.__)("Product image","woocommerce"),checked:s,onChange:()=>e({...t,image:!s})}),(0,l.createElement)(i.ToggleControl,{label:(0,g.__)("Product title","woocommerce"),checked:a,onChange:()=>e({...t,title:!a})}),(0,l.createElement)(i.ToggleControl,{label:(0,g.__)("Product price","woocommerce"),checked:n,onChange:()=>e({...t,price:!n})}),(0,l.createElement)(i.ToggleControl,{label:(0,g.__)("Product rating","woocommerce"),checked:c,onChange:()=>e({...t,rating:!c})}),(0,l.createElement)(i.ToggleControl,{label:(0,g.__)("Add to Cart button","woocommerce"),checked:o,onChange:()=>e({...t,button:!o})}))};var b=r(4184),f=r.n(b),x=r(9307);function y(e,t,r){const l=new Set(t.map((e=>e[r])));return e.filter((e=>!l.has(e[r])))}const _=window.wp.htmlEntities,k={clear:(0,g.__)("Clear all selected items","woocommerce"),noItems:(0,g.__)("No items found.","woocommerce"), /* Translators: %s search term */ noResults:(0,g.__)("No results for %s","woocommerce"),search:(0,g.__)("Search for items","woocommerce"),selected:e=>(0,g.sprintf)(/* translators: Number of items selected from list. */ (0,g._n)("%d item selected","%d items selected",e,"woocommerce"),e),updated:(0,g.__)("Search results updated.","woocommerce")},v=(e,t=e)=>{const r=e.reduce(((e,t)=>{const r=t.parent||0;return e[r]||(e[r]=[]),e[r].push(t),e}),{}),l=("id",t.reduce(((e,t)=>(e[String(t.id)]=t,e)),{}));const o=["0"],n=(e={})=>e.parent?[...n(l[e.parent]),e.name]:e.name?[e.name]:[],c=e=>e.map((e=>{const t=r[e.id];return o.push(""+e.id),{...e,breadcrumbs:n(l[e.parent]),children:t&&t.length?c(t):[]}})),a=c(r[0]||[]);return Object.entries(r).forEach((([e,t])=>{o.includes(e)||a.push(...c(t||[]))})),a},C=(e,t)=>{if(!t)return e;const r=new RegExp(`(${t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")})`,"ig");return e.split(r).map(((e,t)=>r.test(e)?(0,l.createElement)("strong",{key:t},e):(0,l.createElement)(x.Fragment,{key:t},e)))},S=({label:e})=>(0,l.createElement)("span",{className:"woocommerce-search-list__item-count"},e),N=e=>{const{item:t,search:r}=e,o=t.breadcrumbs&&t.breadcrumbs.length;return(0,l.createElement)("span",{className:"woocommerce-search-list__item-label"},o?(0,l.createElement)("span",{className:"woocommerce-search-list__item-prefix"},1===(n=t.breadcrumbs).length?n.slice(0,1).toString():2===n.length?n.slice(0,1).toString()+" › "+n.slice(-1).toString():n.slice(0,1).toString()+" … "+n.slice(-1).toString()):null,(0,l.createElement)("span",{className:"woocommerce-search-list__item-name"},C((0,_.decodeEntities)(t.name),r)));var n},P=({countLabel:e,className:t,depth:r=0,controlId:o="",item:n,isSelected:c,isSingle:a,onSelect:s,search:d="",selected:m,useExpandedPanelId:u,...g})=>{var h,E;const[p,w]=u,b=null!=e&&void 0!==n.count&&null!==n.count,k=!(null===(h=n.breadcrumbs)||void 0===h||!h.length),v=!(null===(E=n.children)||void 0===E||!E.length),P=p===n.id,I=f()(["woocommerce-search-list__item",`depth-${r}`,t],{"has-breadcrumbs":k,"has-children":v,"has-count":b,"is-expanded":P,"is-radio-button":a}),O=g.name||`search-list-item-${o}`,B=`${O}-${n.id}`,R=(0,x.useCallback)((()=>{w(P?-1:Number(n.id))}),[P,n.id,w]);return v?(0,l.createElement)("div",{className:I,onClick:R,onKeyDown:e=>"Enter"===e.key||" "===e.key?R():null,role:"treeitem",tabIndex:0},a?(0,l.createElement)(l.Fragment,null,(0,l.createElement)("input",{type:"radio",id:B,name:O,value:n.value,onChange:s(n),onClick:e=>e.stopPropagation(),checked:c,className:"woocommerce-search-list__item-input",...g}),(0,l.createElement)(N,{item:n,search:d}),b?(0,l.createElement)(S,{label:e||n.count}):null):(0,l.createElement)(l.Fragment,null,(0,l.createElement)(i.CheckboxControl,{className:"woocommerce-search-list__item-input",checked:c,...!c&&n.children.some((e=>m.find((t=>t.id===e.id))))?{indeterminate:!0}:{},label:C((0,_.decodeEntities)(n.name),d),onChange:()=>{c?s(y(m,n.children,"id"))():s(function(e,t,r){const l=y(t,e,"id");return[...e,...l]}(m,n.children))()},onClick:e=>e.stopPropagation()}),b?(0,l.createElement)(S,{label:e||n.count}):null)):(0,l.createElement)("label",{htmlFor:B,className:I},a?(0,l.createElement)(l.Fragment,null,(0,l.createElement)("input",{...g,type:"radio",id:B,name:O,value:n.value,onChange:s(n),checked:c,className:"woocommerce-search-list__item-input"}),(0,l.createElement)(N,{item:n,search:d})):(0,l.createElement)(i.CheckboxControl,{...g,id:B,name:O,className:"woocommerce-search-list__item-input",value:(0,_.decodeEntities)(n.value),label:C((0,_.decodeEntities)(n.name),d),onChange:s(n),checked:c}),b?(0,l.createElement)(S,{label:e||n.count}):null)},I=P;var O=r(5430),B=r(4333),R=r(906);r(5932);const $=({id:e,label:t,popoverContents:r,remove:n,screenReaderLabel:c,className:a=""})=>{const[s,d]=(0,x.useState)(!1),m=(0,B.useInstanceId)($);if(c=c||t,!t)return null;t=(0,_.decodeEntities)(t);const u=f()("woocommerce-tag",a,{"has-remove":!!n}),h=`woocommerce-tag__label-${m}`,E=(0,l.createElement)(l.Fragment,null,(0,l.createElement)("span",{className:"screen-reader-text"},c),(0,l.createElement)("span",{"aria-hidden":"true"},t));return(0,l.createElement)("span",{className:u},r?(0,l.createElement)(i.Button,{className:"woocommerce-tag__text",id:h,onClick:()=>d(!0)},E):(0,l.createElement)("span",{className:"woocommerce-tag__text",id:h},E),r&&s&&(0,l.createElement)(i.Popover,{onClose:()=>d(!1)},r),n&&(0,l.createElement)(i.Button,{className:"woocommerce-tag__remove",onClick:n(e),label:(0,g.sprintf)( // Translators: %s label. (0,g.__)("Remove %s","woocommerce"),t),"aria-describedby":h},(0,l.createElement)(o.Z,{icon:R.Z,size:20,className:"clear-icon",role:"img"})))},T=$;r(8462);const j=e=>(0,l.createElement)(I,{...e}),F=e=>{const{list:t,selected:r,renderItem:o,depth:n=0,onSelect:c,instanceId:a,isSingle:s,search:i,useExpandedPanelId:d}=e,[m]=d;return t?(0,l.createElement)(x.Fragment,null,t.map((t=>{var u,g;const h=null!==(u=t.children)&&void 0!==u&&u.length&&!s?t.children.every((({id:e})=>r.find((t=>t.id===e)))):!!r.find((({id:e})=>e===t.id)),E=(null===(g=t.children)||void 0===g?void 0:g.length)&&m===t.id;return(0,l.createElement)(x.Fragment,{key:t.id},(0,l.createElement)("li",null,o({item:t,isSelected:h,onSelect:c,isSingle:s,selected:r,search:i,depth:n,useExpandedPanelId:d,controlId:a})),E?(0,l.createElement)(F,{...e,list:t.children,depth:n+1}):null)}))):null},L=({isLoading:e,isSingle:t,selected:r,messages:o,onChange:n,onRemove:c})=>{if(e||t||!r)return null;const a=r.length;return(0,l.createElement)("div",{className:"woocommerce-search-list__selected"},(0,l.createElement)("div",{className:"woocommerce-search-list__selected-header"},(0,l.createElement)("strong",null,o.selected(a)),a>0?(0,l.createElement)(i.Button,{isLink:!0,isDestructive:!0,onClick:()=>n([]),"aria-label":o.clear},(0,g.__)("Clear all","woocommerce")):null),a>0?(0,l.createElement)("ul",null,r.map(((e,t)=>(0,l.createElement)("li",{key:t},(0,l.createElement)(T,{label:e.name,id:e.id,remove:c}))))):null)},A=({filteredList:e,search:t,onSelect:r,instanceId:n,useExpandedPanelId:c,...a})=>{const{messages:s,renderItem:i,selected:d,isSingle:m}=a,u=i||j;return 0===e.length?(0,l.createElement)("div",{className:"woocommerce-search-list__list is-not-found"},(0,l.createElement)("span",{className:"woocommerce-search-list__not-found-icon"},(0,l.createElement)(o.Z,{icon:O.Z,role:"img"})),(0,l.createElement)("span",{className:"woocommerce-search-list__not-found-text"},t?(0,g.sprintf)(s.noResults,t):s.noItems)):(0,l.createElement)("ul",{className:"woocommerce-search-list__list"},(0,l.createElement)(F,{useExpandedPanelId:c,list:e,selected:d,renderItem:u,onSelect:r,instanceId:n,isSingle:m,search:t}))},M=e=>{const{className:t="",isCompact:r,isHierarchical:o,isLoading:n,isSingle:c,list:a,messages:s=k,onChange:d,onSearch:m,selected:u,type:h="text",debouncedSpeak:E}=e,[p,w]=(0,x.useState)(""),b=(0,x.useState)(-1),y=(0,B.useInstanceId)(M),_=(0,x.useMemo)((()=>({...k,...s})),[s]),C=(0,x.useMemo)((()=>((e,t,r)=>{if(!t)return r?v(e):e;const l=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),o=e.map((e=>!!l.test(e.name)&&e)).filter(Boolean);return r?v(o,e):o})(a,p,o)),[a,p,o]);(0,x.useEffect)((()=>{E&&E(_.updated)}),[E,_]),(0,x.useEffect)((()=>{"function"==typeof m&&m(p)}),[p,m]);const S=(0,x.useCallback)((e=>()=>{c&&d([]);const t=u.findIndex((({id:t})=>t===e));d([...u.slice(0,t),...u.slice(t+1)])}),[c,u,d]),N=(0,x.useCallback)((e=>()=>{Array.isArray(e)?d(e):-1===u.findIndex((({id:t})=>t===e.id))?d(c?[e]:[...u,e]):S(e.id)()}),[c,S,d,u]),P=(0,x.useCallback)((e=>{const[t]=u.filter((t=>!e.find((e=>t.id===e.id))));S(t.id)()}),[S,u]);return(0,l.createElement)("div",{className:f()("woocommerce-search-list",t,{"is-compact":r,"is-loading":n,"is-token":"token"===h})},"text"===h&&(0,l.createElement)(L,{...e,onRemove:S,messages:_}),(0,l.createElement)("div",{className:"woocommerce-search-list__search"},"text"===h?(0,l.createElement)(i.TextControl,{label:_.search,type:"search",value:p,onChange:e=>w(e)}):(0,l.createElement)(i.FormTokenField,{disabled:n,label:_.search,onChange:P,onInputChange:e=>w(e),suggestions:[],__experimentalValidateInput:()=>!1,value:n?[(0,g.__)("Loading…","woocommerce")]:u.map((e=>({...e,value:e.name}))),__experimentalShowHowTo:!1})),n?(0,l.createElement)("div",{className:"woocommerce-search-list__list"},(0,l.createElement)(i.Spinner,null)):(0,l.createElement)(A,{...e,search:p,filteredList:C,messages:_,onSelect:N,instanceId:y,useExpandedPanelId:b}))},H=((0,i.withSpokenMessages)(M),window.wp.url),D=window.wp.apiFetch;var V=r.n(D);const Z=(0,B.createHigherOrderComponent)((e=>class extends x.Component{constructor(){super(...arguments),this.state={error:null,loading:!1,categories:[]},this.loadCategories=this.loadCategories.bind(this)}componentDidMount(){this.loadCategories()}loadCategories(){this.setState({loading:!0}),V()({path:(0,H.addQueryArgs)("wc/store/v1/products/categories",{per_page:0})}).then((e=>{this.setState({categories:e,loading:!1,error:null})})).catch((async e=>{const t=await(async e=>{if(!("json"in e))return{message:e.message,type:e.type||"general"};try{const t=await e.json();return{message:t.message,type:t.type||"api"}}catch(e){return{message:e.message,type:"general"}}})(e);this.setState({categories:[],loading:!1,error:t})}))}render(){const{error:t,loading:r,categories:o}=this.state;return(0,l.createElement)(e,{...this.props,error:t,isLoading:r,categories:o})}}),"withCategories"),J=window.wp.escapeHtml,W=({error:e})=>(0,l.createElement)("div",{className:"wc-block-error-message"},(({message:e,type:t})=>e?"general"===t?(0,l.createElement)("span",null,(0,g.__)("The following error was returned","woocommerce"),(0,l.createElement)("br",null),(0,l.createElement)("code",null,(0,J.escapeHTML)(e))):"api"===t?(0,l.createElement)("span",null,(0,g.__)("The following error was returned from the API","woocommerce"),(0,l.createElement)("br",null),(0,l.createElement)("code",null,(0,J.escapeHTML)(e))):e:(0,g.__)("An error has prevented the block from being updated.","woocommerce"))(e));r(3366);const z=({categories:e,error:t,isLoading:r,onChange:o,onOperatorChange:n,operator:c,selected:a,isCompact:s,isSingle:d,showReviewCount:m})=>{const u={clear:(0,g.__)("Clear all product categories","woocommerce"),list:(0,g.__)("Product Categories","woocommerce"),noItems:(0,g.__)("Your store doesn't have any product categories.","woocommerce"),search:(0,g.__)("Search for product categories","woocommerce"),selected:e=>(0,g.sprintf)(/* translators: %d is the count of selected categories. */ (0,g._n)("%d category selected","%d categories selected",e,"woocommerce"),e),updated:(0,g.__)("Category search results updated.","woocommerce")};return t?(0,l.createElement)(W,{error:t}):(0,l.createElement)(l.Fragment,null,(0,l.createElement)(M,{className:"woocommerce-product-categories",list:e,isLoading:r,selected:a.map((t=>e.find((e=>e.id===t)))).filter(Boolean),onChange:o,renderItem:e=>{const{item:t,search:r,depth:o=0}=e,n=t.breadcrumbs.length?`${t.breadcrumbs.join(", ")}, ${t.name}`:t.name,c=m?(0,g.sprintf)(/* translators: %1$s is the item name, %2$d is the count of reviews for the item. */ (0,g._n)("%1$s, has %2$d review","%1$s, has %2$d reviews",t.review_count,"woocommerce"),n,t.review_count):(0,g.sprintf)(/* translators: %1$s is the item name, %2$d is the count of products for the item. */ (0,g._n)("%1$s, has %2$d product","%1$s, has %2$d products",t.count,"woocommerce"),n,t.count),a=m?(0,g.sprintf)(/* translators: %d is the count of reviews. */ (0,g._n)("%d review","%d reviews",t.review_count,"woocommerce"),t.review_count):(0,g.sprintf)(/* translators: %d is the count of products. */ (0,g._n)("%d product","%d products",t.count,"woocommerce"),t.count);return(0,l.createElement)(P,{className:f()("woocommerce-product-categories__item","has-count",{"is-searching":r.length>0,"is-skip-level":0===o&&0!==t.parent}),...e,countLabel:a,"aria-label":c})},messages:u,isCompact:s,isHierarchical:!0,isSingle:d}),!!n&&(0,l.createElement)("div",{hidden:a.length<2},(0,l.createElement)(i.SelectControl,{className:"woocommerce-product-categories__operator",label:(0,g.__)("Display products matching","woocommerce"),help:(0,g.__)("Pick at least two categories to use this setting.","woocommerce"),value:c,onChange:n,options:[{label:(0,g.__)("Any selected categories","woocommerce"),value:"any"},{label:(0,g.__)("All selected categories","woocommerce"),value:"all"}]})))};z.defaultProps={operator:"any",isCompact:!1,isSingle:!1};const G=Z(z),K=e=>{const{attributes:t,setAttributes:r}=e,{categories:o,catOperator:n,columns:c,contentVisibility:a,rows:d,alignButtons:m}=t;return(0,l.createElement)(s.InspectorControls,{key:"inspector"},(0,l.createElement)(i.PanelBody,{title:(0,g.__)("Layout","woocommerce"),initialOpen:!0},(0,l.createElement)(E,{columns:c,rows:d,alignButtons:m,setAttributes:r,minColumns:(0,p.getSetting)("minColumns",1),maxColumns:(0,p.getSetting)("maxColumns",6),minRows:(0,p.getSetting)("minRows",1),maxRows:(0,p.getSetting)("maxRows",6)})),(0,l.createElement)(i.PanelBody,{title:(0,g.__)("Content","woocommerce"),initialOpen:!0},(0,l.createElement)(w,{settings:a,onChange:e=>r({contentVisibility:e})})),(0,l.createElement)(i.PanelBody,{title:(0,g.__)("Filter by Product Category","woocommerce"),initialOpen:!1},(0,l.createElement)(G,{selected:o,onChange:(e=[])=>{const t=e.map((({id:e})=>e));r({categories:t})},operator:n,onOperatorChange:(e="any")=>r({catOperator:e})})))},Q=e=>{const{attributes:t,name:r}=e;return t.isPreview?u:(0,l.createElement)("div",{className:"wc-block-product-best-sellers"},(0,l.createElement)(K,{...e}),(0,l.createElement)(i.Disabled,null,(0,l.createElement)(m(),{block:r,attributes:t})))},Y={columns:{type:"number",default:(0,p.getSetting)("defaultColumns",3)},rows:{type:"number",default:(0,p.getSetting)("defaultRows",3)},alignButtons:{type:"boolean",default:!1},categories:{type:"array",default:[]},catOperator:{type:"string",default:"any"},contentVisibility:{type:"object",default:{image:!0,title:!0,price:!0,rating:!0,button:!0}},isPreview:{type:"boolean",default:!1},stockStatus:{type:"array",default:Object.keys((0,p.getSetting)("stockStatusOptions",[]))}};(0,c.registerBlockType)(a,{icon:{src:(0,l.createElement)(o.Z,{icon:n.Z,className:"wc-block-editor-components-block-icon"})},attributes:{...Y,...a.attributes},transforms:{from:[{type:"block",blocks:["woocommerce/product-best-sellers","woocommerce/product-category","woocommerce/product-new","woocommerce/product-on-sale","woocommerce/product-top-rated"].filter((e=>"woocommerce/product-best-sellers"!==e)),transform:e=>(0,c.createBlock)("woocommerce/product-best-sellers",e)}]},edit:e=>{const t=(0,s.useBlockProps)();return(0,l.createElement)("div",{...t},(0,l.createElement)(Q,{...e}))},save:()=>null})},3366:()=>{},8462:()=>{},5932:()=>{},9196:e=>{"use strict";e.exports=window.React},4333:e=>{"use strict";e.exports=window.wp.compose},9307:e=>{"use strict";e.exports=window.wp.element},5736:e=>{"use strict";e.exports=window.wp.i18n},444:e=>{"use strict";e.exports=window.wp.primitives}},r={};function l(e){var o=r[e];if(void 0!==o)return o.exports;var n=r[e]={exports:{}};return t[e].call(n.exports,n,n.exports,l),n.exports}l.m=t,e=[],l.O=(t,r,o,n)=>{if(!r){var c=1/0;for(d=0;d=n)&&Object.keys(l.O).every((e=>l.O[e](r[s])))?r.splice(s--,1):(a=!1,n0&&e[d-1][2]>n;d--)e[d]=e[d-1];e[d]=[r,o,n]},l.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return l.d(t,{a:t}),t},l.d=(e,t)=>{for(var r in t)l.o(t,r)&&!l.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.j=7006,(()=>{var e={7006:0};l.O.j=t=>0===e[t];var t=(t,r)=>{var o,n,[c,a,s]=r,i=0;if(c.some((t=>0!==e[t]))){for(o in a)l.o(a,o)&&(l.m[o]=a[o]);if(s)var d=s(l)}for(t&&t(r);il(5132)));o=l.O(o),((this.wc=this.wc||{}).blocks=this.wc.blocks||{})["product-best-sellers"]=o})();