JezK
Edit File: product-top-rated.js
(()=>{var e,t,o,r={705:(e,t,o)=>{"use strict";var r=o(7723);const s=window.wp.blocks;var i=o(5573),n=o(790);const c=(0,n.jsxs)(i.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24",children:[(0,n.jsx)("path",{opacity:".87",fill:"none",d:"M0 0h24v24H0V0z"}),(0,n.jsx)("path",{d:"M21 8h-6.31l.95-4.57.03-.32c0-.41-.17-.79-.44-1.06L14.17 1 7.59 7.59C7.22 7.95 7 8.45 7 9v10c0 1.1.9 2 2 2h9c.83 0 1.54-.5 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73v-2c0-1.1-.9-2-2-2zm0 4l-3 7H9V9l4.34-4.34L12.23 10H21v2zM1 9h4v12H1z"})]});var l=o(3450);const a=JSON.parse('{"name":"woocommerce/product-top-rated","title":"Top Rated Products","category":"woocommerce","keywords":["WooCommerce"],"description":"Display a grid of your top rated products.","supports":{"interactivity":{"clientNavigation":false},"align":["wide","full"],"html":false,"inserter":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":"rating"}},"textdomain":"woocommerce","apiVersion":3,"$schema":"https://schemas.wp.org/trunk/block.json"}'),d=window.wc.wcSettings,m={columns:{type:"number",default:(0,d.getSetting)("defaultColumns",3)},rows:{type:"number",default:(0,d.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,d.getSetting)("stockStatusOptions",[]))}},h=window.wp.blockEditor,u=window.wp.components,x=window.wp.serverSideRender;var p=o.n(x);const g=({onChange:e,settings:t})=>{const{image:o,button:s,price:i,rating:c,title:l}=t,a=!1!==o;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(u.ToggleControl,{label:(0,r.__)("Product image","woocommerce"),checked:a,onChange:()=>e({...t,image:!a})}),(0,n.jsx)(u.ToggleControl,{label:(0,r.__)("Product title","woocommerce"),checked:l,onChange:()=>e({...t,title:!l})}),(0,n.jsx)(u.ToggleControl,{label:(0,r.__)("Product price","woocommerce"),checked:i,onChange:()=>e({...t,price:!i})}),(0,n.jsx)(u.ToggleControl,{label:(0,r.__)("Product rating","woocommerce"),checked:c,onChange:()=>e({...t,rating:!c})}),(0,n.jsx)(u.ToggleControl,{label:(0,r.__)("Add to Cart button","woocommerce"),checked:s,onChange:()=>e({...t,button:!s})})]})},w=(e,t,o)=>o?Math.min(e,t)===e?t:Math.max(e,o)===e?o:e:Math.max(e,t)===t?e:t,f=({columns:e,rows:t,setAttributes:o,alignButtons:s,minColumns:i=1,maxColumns:c=6,minRows:l=1,maxRows:a=6})=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(u.RangeControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,r.__)("Columns","woocommerce"),value:e,onChange:e=>{const t=w(e,i,c);o({columns:Number.isNaN(t)?"":t})},min:i,max:c}),(0,n.jsx)(u.RangeControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,r.__)("Rows","woocommerce"),value:t,onChange:e=>{const t=w(e,l,a);o({rows:Number.isNaN(t)?"":t})},min:l,max:a}),(0,n.jsx)(u.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Align the last block to the bottom","woocommerce"),help:s?(0,r.__)("Align the last block to the bottom.","woocommerce"):(0,r.__)("The last inner block will follow other content.","woocommerce"),checked:s,onChange:()=>o({alignButtons:!s})})]});var j=o(4921),_=o(6087);function b(e,t,o){const r=new Set(t.map(e=>e[o]));return e.filter(e=>!r.has(e[o]))}const E=window.wp.htmlEntities,y={clear:(0,r.__)("Clear all selected items","woocommerce"),noItems:(0,r.__)("No items found.","woocommerce"), /* Translators: %s search term */ noResults:(0,r.__)("No results for %s","woocommerce"),search:(0,r.__)("Search for items","woocommerce"),selected:e=>(0,r.sprintf)(/* translators: Number of items selected from list. */ /* translators: Number of items selected from list. */ (0,r._n)("%d item selected","%d items selected",e,"woocommerce"),e),updated:(0,r.__)("Search results updated.","woocommerce")},v=(e,t)=>null!==t&&(e.id===t||!!(Array.isArray(e.children)&&e.children.length>0)&&e.children.some(e=>v(e,t))),C=(e,t=e)=>{const o=e.reduce((e,t)=>{const o=t.parent||0;return e[o]||(e[o]=[]),e[o].push(t),e},{}),r=t.reduce((e,t)=>(e[String(t.id)]=t,e),{});const s=["0"],i=(e={})=>e.parent?[...i(r[e.parent]),e.name]:e.name?[e.name]:[],n=e=>e.map(e=>{const t=o[e.id];return s.push(""+e.id),{...e,breadcrumbs:i(r[e.parent]),children:t&&t.length?n(t):[]}}),c=n(o[0]||[]);return Object.entries(o).forEach(([e,t])=>{s.includes(e)||c.push(...n(t||[]))}),c},k=(e,t)=>{if(!t)return e;const o=new RegExp(`(${t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")})`,"ig");return e.split(o).map((e,t)=>o.test(e)?(0,n.jsx)("strong",{children:e},t):(0,n.jsx)(_.Fragment,{children:e},t))},S=e=>{const t=e.children?.map(e=>[e,...S(e)]);return t?t.flat():[]},N=(e,t)=>S(e).some(e=>t.find(t=>t.id===e.id)),O=(e,t)=>S(e).every(e=>t.find(t=>t.id===e.id)),P=({label:e})=>(0,n.jsx)("span",{className:"woocommerce-search-list__item-count",children:e}),I=e=>{const{item:t,search:o}=e,r=t.breadcrumbs&&t.breadcrumbs.length;return(0,n.jsxs)("span",{className:"woocommerce-search-list__item-label",children:[r?(0,n.jsx)("span",{className:"woocommerce-search-list__item-prefix",children:(s=t.breadcrumbs,1===s.length?s.slice(0,1).toString():2===s.length?s.slice(0,1).toString()+" › "+s.slice(-1).toString():s.slice(0,1).toString()+" … "+s.slice(-1).toString())}):null,(0,n.jsx)("span",{className:"woocommerce-search-list__item-name",children:k((0,E.decodeEntities)(t.name),o)})]});var s},M=({countLabel:e,className:t,depth:o=0,controlId:r="",disabled:s=!1,item:i,isSelected:c,isSelectable:l=!0,isSingle:a,onSelect:d,search:m="",selected:h,useExpandedPanelId:x,...p})=>{const[g,w]=x,f=null!=e&&void 0!==i.count&&null!==i.count,y=!!i.breadcrumbs?.length,C=!!i.children?.length,M=v(i,g),B=(0,j.A)(["woocommerce-search-list__item",`depth-${o}`,t],{"has-breadcrumbs":y,"has-children":C,"has-count":f,"is-expanded":M,"is-radio-button":a}),A=p.name||`search-list-item-${r}`,T=`${A}-${i.id}`,R=(0,_.useCallback)(()=>{M||"number"!=typeof i.id&&"string"!=typeof i.id?!i.parent||"number"!=typeof i.parent&&"string"!=typeof i.parent?w(null):w(i.parent):w(i.id)},[M,i.id,i.parent,w]),$=(c||!l)&&O(i,h);return C?(0,n.jsx)("div",{className:B,onClick:R,onKeyDown:e=>"Enter"===e.key||" "===e.key?R():null,role:"treeitem",tabIndex:0,children:a?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("input",{type:"radio",id:T,name:A,value:i.value,onChange:()=>{d(i)(),M||w(i.id)},onClick:e=>e.stopPropagation(),checked:c,disabled:s,className:"woocommerce-search-list__item-input",...p}),(0,n.jsx)(I,{item:i,search:m}),f?(0,n.jsx)(P,{label:e||i.count}):null]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(u.CheckboxControl,{className:"woocommerce-search-list__item-input",checked:$,disabled:s,indeterminate:!$&&(c||N(i,h)),label:k((0,E.decodeEntities)(i.name),m),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),onChange:()=>{const e=S(i),t=l?[i,...e]:[...e],o=O(i,h);l&&c||!l&&o?d(b(h,t,"id"))():(d(function(e,t){const o=b(t,e,"id");return[...e,...o]}(h,t))(),M||w(i.id))},__nextHasNoMarginBottom:!0}),f?(0,n.jsx)(P,{label:e||i.count}):null]})}):(0,n.jsxs)("div",{className:B,onClick:s?void 0:d(i),children:[a?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("input",{...p,type:"radio",id:T,name:A,value:i.value,onChange:d(i),checked:c,disabled:s,className:"woocommerce-search-list__item-input",onClick:e=>e.stopPropagation()}),(0,n.jsx)("label",{htmlFor:T,children:(0,n.jsx)(I,{item:i,search:m})})]}):(0,n.jsx)(u.CheckboxControl,{...p,id:T,name:A,className:"woocommerce-search-list__item-input",value:(0,E.decodeEntities)(i.value),label:k((0,E.decodeEntities)(i.name),m),onChange:()=>{d(i)(),M||w(i.id)},checked:c,disabled:s,__nextHasNoMarginBottom:!0,onClick:e=>e.stopPropagation()}),f?(0,n.jsx)(P,{label:e||i.count}):null]})},B=M;var A=o(7051),T=o(9491),R=o(1884);o(5022);const $=({id:e,label:t,popoverContents:o,remove:s,screenReaderLabel:i,className:c=""})=>{const[a,d]=(0,_.useState)(!1),m=(0,T.useInstanceId)($);if(i=i||t,!t)return null;t=(0,E.decodeEntities)(t);const h=(0,j.A)("woocommerce-tag",c,{"has-remove":!!s}),x=`woocommerce-tag__label-${m}`,p=(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"screen-reader-text",children:i}),(0,n.jsx)("span",{"aria-hidden":"true",children:t})]});return(0,n.jsxs)("span",{className:h,children:[o?(0,n.jsx)(u.Button,{className:"woocommerce-tag__text",id:x,onClick:()=>d(!0),children:p}):(0,n.jsx)("span",{className:"woocommerce-tag__text",id:x,children:p}),o&&a&&(0,n.jsx)(u.Popover,{onClose:()=>d(!1),children:o}),s&&(0,n.jsx)(u.Button,{className:"woocommerce-tag__remove",onClick:s(e),label:(0,r.sprintf)( // Translators: %s label. // Translators: %s label. (0,r.__)("Remove %s","woocommerce"),t),"aria-describedby":x,children:(0,n.jsx)(l.A,{icon:R.A,size:20,className:"clear-icon",role:"img"})})]})},F=$;o(1939);const L=e=>(0,n.jsx)(B,{...e}),H=e=>{const{list:t,selected:o,renderItem:s,depth:i=0,loadMoreChildrenText:c,onLoadMoreChildren:l,totalChildren:a,onSelect:d,instanceId:m,isSingle:h,search:u,useExpandedPanelId:x}=e,[p]=x;return t?(0,n.jsx)(n.Fragment,{children:t.map(t=>{const g=t.children?.length??0,w=!!o.find(({id:e})=>e===t.id),f=v(t,p),j=a?.[t.id],b="number"==typeof j&&g<j;return(0,n.jsxs)(_.Fragment,{children:[(0,n.jsx)("li",{children:s({item:t,isSelected:w,onSelect:d,isSingle:h,selected:o,search:u,depth:i,useExpandedPanelId:x,controlId:m})}),f?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(H,{...e,list:t.children,depth:i+1}),l&&b?(0,n.jsx)("li",{children:(0,n.jsx)("button",{type:"button",className:"woocommerce-search-list__item woocommerce-search-list__item-load-more",onClick:()=>l(),children:c||(0,r.__)("Load more","woocommerce")})}):null]}):null]},t.id)})}):null},D=({isLoading:e,isSingle:t,selected:o,messages:s,onChange:i,onRemove:c})=>{if(e||t||!o)return null;const l=o.length;return(0,n.jsxs)("div",{className:"woocommerce-search-list__selected",children:[(0,n.jsxs)("div",{className:"woocommerce-search-list__selected-header",children:[(0,n.jsx)("strong",{children:s.selected(l)}),l>0?(0,n.jsx)(u.Button,{variant:"link",isDestructive:!0,onClick:()=>i([]),"aria-label":s.clear,children:(0,r.__)("Clear all","woocommerce")}):null]}),l>0?(0,n.jsx)("ul",{children:o.map((e,t)=>(0,n.jsx)("li",{children:(0,n.jsx)(F,{label:e.name,id:e.id,remove:c})},t))}):null]})},V=({filteredList:e,search:t,onSelect:o,instanceId:s,useExpandedPanelId:i,...c})=>{const{messages:a,renderItem:d,selected:m,isSingle:h,loadMoreChildrenText:u,onLoadMoreChildren:x,totalChildren:p}=c,g=d||L;return 0===e.length?(0,n.jsxs)("div",{className:"woocommerce-search-list__list is-not-found",children:[(0,n.jsx)("span",{className:"woocommerce-search-list__not-found-icon",children:(0,n.jsx)(l.A,{icon:A.A,role:"img"})}),(0,n.jsx)("span",{className:"woocommerce-search-list__not-found-text",children:t?(0,r.sprintf)(a.noResults,t):a.noItems})]}):(0,n.jsx)("ul",{className:"woocommerce-search-list__list",children:(0,n.jsx)(H,{useExpandedPanelId:i,list:e,selected:m,renderItem:g,loadMoreChildrenText:u,onLoadMoreChildren:x,totalChildren:p,onSelect:o,instanceId:s,isSingle:h,search:t})})},z=e=>{const{className:t="",isCompact:o,isHierarchical:s,isLoading:i,isSingle:c,list:l,messages:a=y,onChange:d,onSearch:m,selected:h,type:x="text",debouncedSpeak:p}=e,[g,w]=(0,_.useState)(""),f=(0,_.useState)(null),b=(0,T.useInstanceId)(z),E=(0,_.useMemo)(()=>({...y,...a}),[a]),v=(0,_.useMemo)(()=>((e,t,o)=>{if(!t)return o?C(e):e;const r=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),s=e.map(e=>!!r.test(e.name)&&e).filter(Boolean);return o?C(s,e):s})(l,g,s),[l,g,s]);(0,_.useEffect)(()=>{p&&p(E.updated)},[p,E]),(0,_.useEffect)(()=>{"function"==typeof m&&m(g)},[g,m]);const k=(0,_.useCallback)(e=>()=>{c&&d([]);const t=h.findIndex(({id:t})=>t===e);d([...h.slice(0,t),...h.slice(t+1)])},[c,h,d]),S=(0,_.useCallback)(e=>()=>{Array.isArray(e)?d(e):-1===h.findIndex(({id:t})=>t===e.id)?d(c?[e]:[...h,e]):k(e.id)()},[c,k,d,h]),N=(0,_.useCallback)(e=>{const[t]=h.filter(t=>!e.find(e=>t.id===e.id));k(t.id)()},[k,h]);return(0,n.jsxs)("div",{className:(0,j.A)("woocommerce-search-list",t,{"is-compact":o,"is-loading":i,"is-token":"token"===x}),children:["text"===x&&(0,n.jsx)(D,{...e,onRemove:k,messages:E}),(0,n.jsx)("div",{className:"woocommerce-search-list__search",children:"text"===x?(0,n.jsx)(u.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:E.search,type:"search",value:g,onChange:e=>w(e)}):(0,n.jsx)(u.FormTokenField,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,disabled:i,label:E.search,onChange:N,onInputChange:e=>w(e),suggestions:[],__experimentalValidateInput:()=>!1,value:i?[(0,r.__)("Loading…","woocommerce")]:h.map(e=>({...e,value:e.name})),__experimentalShowHowTo:!1})}),i?(0,n.jsx)("div",{className:"woocommerce-search-list__list",children:(0,n.jsx)(u.Spinner,{})}):(0,n.jsx)(V,{...e,search:g,filteredList:v,messages:E,onSelect:S,instanceId:b,useExpandedPanelId:f})]})},J=((0,u.withSpokenMessages)(z),window.wp.url),W=window.wp.apiFetch;var G=o.n(W);const K=window.wp.escapeHtml,Q=({message:e,type:t})=>e?"general"===t?(0,n.jsxs)("span",{children:[(0,r.__)("The following error was returned","woocommerce"),(0,n.jsx)("br",{}),(0,n.jsx)("code",{children:(0,K.escapeHTML)(e)})]}):"api"===t?(0,n.jsxs)("span",{children:[(0,r.__)("The following error was returned from the API","woocommerce"),(0,n.jsx)("br",{}),(0,n.jsx)("code",{children:(0,K.escapeHTML)(e)})]}):e:(0,r.__)("An error has prevented the block from being updated.","woocommerce"),X=({error:e})=>(0,n.jsx)("div",{className:"wc-block-error-message",children:Q(e)}),Y=e=>{const{id:t,name:o,parent:r,count:s}=e;return{id:t,name:o,parent:r,count:s,breadcrumbs:[],children:[],details:e,value:e.slug}};o(6982);const q=(re=({categories:e=[],error:t=null,isLoading:o=!1,onChange:s,onOperatorChange:i,operator:c="any",selected:l,isCompact:a=!1,isSingle:d=!1,showReviewCount:m})=>{const h={clear:(0,r.__)("Clear all product categories","woocommerce"),list:(0,r.__)("Product Categories","woocommerce"),noItems:(0,r.__)("Your store doesn't have any product categories.","woocommerce"),search:(0,r.__)("Search for product categories","woocommerce"),selected:e=>(0,r.sprintf)(/* translators: %d is the count of selected categories. */ /* translators: %d is the count of selected categories. */ (0,r._n)("%d category selected","%d categories selected",e,"woocommerce"),e),updated:(0,r.__)("Category search results updated.","woocommerce")};if(t)return(0,n.jsx)(X,{error:t});const x=e.map(Y);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(z,{className:"woocommerce-product-categories",list:x,isLoading:o,selected:x.filter(({id:e})=>l.includes(Number(e))),onChange:s,renderItem:e=>{const{item:t,search:o,depth:s=0}=e,i=t.breadcrumbs.length?`${t.breadcrumbs.join(", ")}, ${t.name}`:t.name,c=m?(0,r.sprintf)(/* translators: %1$s is the item name, %2$d is the count of reviews for the item. */ /* translators: %1$s is the item name, %2$d is the count of reviews for the item. */ (0,r._n)("%1$s, has %2$d review","%1$s, has %2$d reviews",t.details?.review_count||0,"woocommerce"),i,t.details?.review_count||0):(0,r.sprintf)(/* translators: %1$s is the item name, %2$d is the count of products for the item. */ /* translators: %1$s is the item name, %2$d is the count of products for the item. */ (0,r._n)("%1$s, has %2$d product","%1$s, has %2$d products",t.details?.count||0,"woocommerce"),i,t.details?.count||0),l=m?(0,r.sprintf)(/* translators: %d is the count of reviews. */ /* translators: %d is the count of reviews. */ (0,r._n)("%d review","%d reviews",t.details?.review_count||0,"woocommerce"),t.details?.review_count||0):(0,r.sprintf)(/* translators: %d is the count of products. */ /* translators: %d is the count of products. */ (0,r._n)("%d product","%d products",t.details?.count||0,"woocommerce"),t.details?.count||0);return(0,n.jsx)(M,{className:(0,j.A)("woocommerce-product-categories__item","has-count",{"is-searching":o.length>0,"is-skip-level":0===s&&0!==t.parent}),...e,countLabel:l,"aria-label":c})},messages:h,isCompact:a,isHierarchical:!0,isSingle:d}),!!i&&(0,n.jsx)("div",{hidden:l.length<2,children:(0,n.jsx)(u.SelectControl,{className:"woocommerce-product-categories__operator",label:(0,r.__)("Display products matching","woocommerce"),help:(0,r.__)("Pick at least two categories to use this setting.","woocommerce"),value:c,onChange:i,options:[{label:(0,r.__)("Any selected categories","woocommerce"),value:"any"},{label:(0,r.__)("All selected categories","woocommerce"),value:"all"}]})})]})},({selected:e,...t})=>{const[o,r]=(0,_.useState)(!0),[s,i]=(0,_.useState)(null),[c,l]=(0,_.useState)([]),a=async e=>{const t=await(async e=>{if(!("json"in e))return{code:e.code||"",message:e.message,type:e.type||"general"};try{const t=await e.json();return{code:t.code||"",message:t.message,type:t.type||"api"}}catch(e){return{message:e.message,type:"general"}}})(e);i(t),r(!1)},d=(0,_.useRef)(e);return(0,_.useEffect)(()=>{var e;(e={selected:d.current},G()({path:(0,J.addQueryArgs)("wc/store/v1/products/categories",{per_page:0,...e})})).then(e=>{l(e),r(!1)}).catch(a)},[d]),(0,n.jsx)(re,{...t,selected:e,error:s,categories:c,isLoading:o})}),U=(0,d.getSetting)("hideOutOfStockItems",!1),Z=(0,d.getSetting)("stockStatusOptions",{}),ee=({value:e,setAttributes:t})=>{const{outofstock:o,...s}=Z,i=U?s:Z,c=Object.entries(i).map(([e,t])=>({value:e,label:t})).filter(e=>!!e.label),l=Object.keys(i).filter(e=>!!e),[a,d]=(0,_.useState)(e||l);(0,_.useEffect)(()=>{t({stockStatus:["",...a]})},[a,t]);const m=(0,_.useCallback)(e=>{const t=a.includes(e),o=a.filter(t=>t!==e);t||(o.push(e),o.sort()),d(o)},[a]);return(0,n.jsx)(n.Fragment,{children:c.map(e=>{const t=a.includes(e.value)?/* translators: %s stock status. */ /* translators: %s stock status. */(0,r.__)('Stock status "%s" visible.',"woocommerce"):/* translators: %s stock status. */ /* translators: %s stock status. */(0,r.__)('Stock status "%s" hidden.',"woocommerce");return(0,n.jsx)(u.ToggleControl,{label:e.label,help:(0,r.sprintf)(t,e.label),checked:a.includes(e.value),onChange:()=>m(e.value)},e.value)})})},te=(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 230 250",style:{width:"100%"},children:[(0,n.jsx)("title",{children:"Grid Block Preview"}),(0,n.jsx)("rect",{width:"65.374",height:"65.374",x:".162",y:".779",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),(0,n.jsx)("rect",{width:"62.8",height:"15",x:"1.565",y:"101.448",fill:"#E1E3E6",rx:"5"}),(0,n.jsx)("rect",{width:"65.374",height:"65.374",x:".162",y:"136.277",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),(0,n.jsx)("rect",{width:"62.8",height:"15",x:"1.565",y:"236.946",fill:"#E1E3E6",rx:"5"}),(0,n.jsx)("rect",{width:"65.374",height:"65.374",x:"82.478",y:".779",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),(0,n.jsx)("rect",{width:"62.8",height:"15",x:"83.882",y:"101.448",fill:"#E1E3E6",rx:"5"}),(0,n.jsx)("rect",{width:"65.374",height:"65.374",x:"82.478",y:"136.277",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),(0,n.jsx)("rect",{width:"62.8",height:"15",x:"83.882",y:"236.946",fill:"#E1E3E6",rx:"5"}),(0,n.jsx)("rect",{width:"65.374",height:"65.374",x:"164.788",y:".779",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),(0,n.jsx)("rect",{width:"62.8",height:"15",x:"166.192",y:"101.448",fill:"#E1E3E6",rx:"5"}),(0,n.jsx)("rect",{width:"65.374",height:"65.374",x:"164.788",y:"136.277",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),(0,n.jsx)("rect",{width:"62.8",height:"15",x:"166.192",y:"236.946",fill:"#E1E3E6",rx:"5"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,n.jsx)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"221.798",fill:"#E1E3E6",rx:"3"})]}),oe=({attributes:e,name:t,setAttributes:o})=>{const{categories:s,catOperator:i,columns:c,contentVisibility:l,rows:a,alignButtons:m,stockStatus:x,isPreview:w}=e;return w?te:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(h.InspectorControls,{children:[(0,n.jsx)(u.PanelBody,{title:(0,r.__)("Layout","woocommerce"),initialOpen:!0,children:(0,n.jsx)(f,{columns:c,rows:a,alignButtons:m,setAttributes:o,minColumns:(0,d.getSetting)("minColumns",1),maxColumns:(0,d.getSetting)("maxColumns",6),minRows:(0,d.getSetting)("minRows",1),maxRows:(0,d.getSetting)("maxRows",6)})}),(0,n.jsx)(u.PanelBody,{title:(0,r.__)("Content","woocommerce"),initialOpen:!0,children:(0,n.jsx)(g,{settings:l,onChange:e=>o({contentVisibility:e})})}),(0,n.jsx)(u.PanelBody,{title:(0,r.__)("Filter by Product Category","woocommerce"),initialOpen:!1,children:(0,n.jsx)(q,{selected:s,onChange:(e=[])=>{const t=e.map(({id:e})=>e);o({categories:t})},operator:i,onOperatorChange:(e="any")=>o({catOperator:e})})}),(0,n.jsx)(u.PanelBody,{title:(0,r.__)("Filter by stock status","woocommerce"),initialOpen:!1,children:(0,n.jsx)(ee,{setAttributes:o,value:x})})]},"inspector"),(0,n.jsx)(u.Disabled,{children:(0,n.jsx)(p(),{block:t,attributes:e})})]})};var re;(0,s.registerBlockType)(a,{icon:{src:(0,n.jsx)(l.A,{icon:c,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[(0,r.__)("WooCommerce","woocommerce")],description:(0,r.__)("Display a grid of your top rated products.","woocommerce"),attributes:{...m,...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-top-rated"!==e),transform:e=>(0,s.createBlock)("woocommerce/product-top-rated",e)}]},edit:e=>{const t=(0,h.useBlockProps)();return(0,n.jsx)("div",{...t,children:(0,n.jsx)(oe,{...e})})},save:()=>null})},6982:()=>{},1939:()=>{},5022:()=>{},790:e=>{"use strict";e.exports=window.ReactJSXRuntime},9491:e=>{"use strict";e.exports=window.wp.compose},6087:e=>{"use strict";e.exports=window.wp.element},7723:e=>{"use strict";e.exports=window.wp.i18n},5573:e=>{"use strict";e.exports=window.wp.primitives}},s={};function i(e){var t=s[e];if(void 0!==t)return t.exports;var o=s[e]={exports:{}};return r[e](o,o.exports,i),o.exports}i.m=r,e=[],i.O=(t,o,r,s)=>{if(!o){var n=1/0;for(d=0;d<e.length;d++){for(var[o,r,s]=e[d],c=!0,l=0;l<o.length;l++)(!1&s||n>=s)&&Object.keys(i.O).every(e=>i.O[e](o[l]))?o.splice(l--,1):(c=!1,s<n&&(n=s));if(c){e.splice(d--,1);var a=r();void 0!==a&&(t=a)}}return t}s=s||0;for(var d=e.length;d>0&&e[d-1][2]>s;d--)e[d]=e[d-1];e[d]=[o,r,s]},i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},o=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var s=Object.create(null);i.r(s);var n={};t=t||[null,o({}),o([]),o(o)];for(var c=2&r&&e;"object"==typeof c&&!~t.indexOf(c);c=o(c))Object.getOwnPropertyNames(c).forEach(t=>n[t]=()=>e[t]);return n.default=()=>e,i.d(s,n),s},i.d=(e,t)=>{for(var o in t)i.o(t,o)&&!i.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.j=9595,(()=>{var e={9595:0};i.O.j=t=>0===e[t];var t=(t,o)=>{var r,s,[n,c,l]=o,a=0;if(n.some(t=>0!==e[t])){for(r in c)i.o(c,r)&&(i.m[r]=c[r]);if(l)var d=l(i)}for(t&&t(o);a<n.length;a++)s=n[a],i.o(e,s)&&e[s]&&e[s][0](),e[s]=0;return i.O(d)},o=globalThis.webpackChunkwebpackWcBlocksMainJsonp=globalThis.webpackChunkwebpackWcBlocksMainJsonp||[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})();var n=i.O(void 0,[94],()=>i(705));n=i.O(n),((this.wc=this.wc||{}).blocks=this.wc.blocks||{})["product-top-rated"]=n})();