JezK
Edit File: handpicked-products.js
(()=>{var e,t,r,s={9552:(e,t,r)=>{"use strict";const s=window.wp.blocks,o=window.wc.wcSettings;var i=r(3450),n=r(5642);r(9202);const c=JSON.parse('{"name":"woocommerce/handpicked-products","title":"Hand-picked Products","category":"woocommerce","keywords":["Handpicked Products","WooCommerce"],"description":"Display a selection of hand-picked products in a grid.","supports":{"interactivity":{"clientNavigation":false},"align":["wide","full"],"html":false,"inserter":false},"attributes":{"align":{"type":"string"},"columns":{"type":"number","default":3},"contentVisibility":{"type":"object","default":{"image":true,"title":true,"price":true,"rating":true,"button":true},"properties":{"image":{"type":"boolean","image":true},"title":{"type":"boolean","title":true},"price":{"type":"boolean","price":true},"rating":{"type":"boolean","rating":true},"button":{"type":"boolean","button":true}}},"orderby":{"type":"string","enum":["date","popularity","price_asc","price_desc","rating","title","menu_order"],"default":"date"},"products":{"type":"array","default":[]},"alignButtons":{"type":"boolean","default":false},"isPreview":{"type":"boolean","default":false}},"textdomain":"woocommerce","apiVersion":3,"$schema":"https://schemas.wp.org/trunk/block.json"}'),l=window.wp.blockEditor,a=window.wp.components;var d=r(6087),h=r(7723),m=r(790);const u=({onChange:e,settings:t})=>{const{image:r,button:s,price:o,rating:i,title:n}=t,c=!1!==r;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(a.ToggleControl,{label:(0,h.__)("Product image","woocommerce"),checked:c,onChange:()=>e({...t,image:!c})}),(0,m.jsx)(a.ToggleControl,{label:(0,h.__)("Product title","woocommerce"),checked:n,onChange:()=>e({...t,title:!n})}),(0,m.jsx)(a.ToggleControl,{label:(0,h.__)("Product price","woocommerce"),checked:o,onChange:()=>e({...t,price:!o})}),(0,m.jsx)(a.ToggleControl,{label:(0,h.__)("Product rating","woocommerce"),checked:i,onChange:()=>e({...t,rating:!i})}),(0,m.jsx)(a.ToggleControl,{label:(0,h.__)("Add to Cart button","woocommerce"),checked:s,onChange:()=>e({...t,button:!s})})]})},p=({value:e,setAttributes:t})=>(0,m.jsx)(a.SelectControl,{label:(0,h.__)("Order products by","woocommerce"),value:e,options:[{label:(0,h.__)("Newness - newest first","woocommerce"),value:"date"},{label:(0,h.__)("Price - low to high","woocommerce"),value:"price_asc"},{label:(0,h.__)("Price - high to low","woocommerce"),value:"price_desc"},{label:(0,h.__)("Rating - highest first","woocommerce"),value:"rating"},{label:(0,h.__)("Sales - most first","woocommerce"),value:"popularity"},{label:(0,h.__)("Title - alphabetical","woocommerce"),value:"title"},{label:(0,h.__)("Menu Order","woocommerce"),value:"menu_order"}],onChange:e=>t({orderby:e})});var x=r(7051),g=r(4921),w=r(9491);const E={clear:(0,h.__)("Clear all selected items","woocommerce"),noItems:(0,h.__)("No items found.","woocommerce"), /* Translators: %s search term */ noResults:(0,h.__)("No results for %s","woocommerce"),search:(0,h.__)("Search for items","woocommerce"),selected:e=>(0,h.sprintf)(/* translators: Number of items selected from list. */ /* translators: Number of items selected from list. */ (0,h._n)("%d item selected","%d items selected",e,"woocommerce"),e),updated:(0,h.__)("Search results updated.","woocommerce")},_=(e,t)=>null!==t&&(e.id===t||!!(Array.isArray(e.children)&&e.children.length>0)&&e.children.some(e=>_(e,t))),j=(e,t=e)=>{const r=e.reduce((e,t)=>{const r=t.parent||0;return e[r]||(e[r]=[]),e[r].push(t),e},{}),s=t.reduce((e,t)=>(e[String(t.id)]=t,e),{});const o=["0"],i=(e={})=>e.parent?[...i(s[e.parent]),e.name]:e.name?[e.name]:[],n=e=>e.map(e=>{const t=r[e.id];return o.push(""+e.id),{...e,breadcrumbs:i(s[e.parent]),children:t&&t.length?n(t):[]}}),c=n(r[0]||[]);return Object.entries(r).forEach(([e,t])=>{o.includes(e)||c.push(...n(t||[]))}),c},f=(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,m.jsx)("strong",{children:e},t):(0,m.jsx)(d.Fragment,{children:e},t))};function b(e,t,r){const s=new Set(t.map(e=>e[r]));return e.filter(e=>!s.has(e[r]))}const y=window.wp.htmlEntities,v=e=>{const t=e.children?.map(e=>[e,...v(e)]);return t?t.flat():[]},S=(e,t)=>v(e).some(e=>t.find(t=>t.id===e.id)),k=(e,t)=>v(e).every(e=>t.find(t=>t.id===e.id)),C=({label:e})=>(0,m.jsx)("span",{className:"woocommerce-search-list__item-count",children:e}),P=e=>{const{item:t,search:r}=e,s=t.breadcrumbs&&t.breadcrumbs.length;return(0,m.jsxs)("span",{className:"woocommerce-search-list__item-label",children:[s?(0,m.jsx)("span",{className:"woocommerce-search-list__item-prefix",children:(o=t.breadcrumbs,1===o.length?o.slice(0,1).toString():2===o.length?o.slice(0,1).toString()+" › "+o.slice(-1).toString():o.slice(0,1).toString()+" … "+o.slice(-1).toString())}):null,(0,m.jsx)("span",{className:"woocommerce-search-list__item-name",children:f((0,y.decodeEntities)(t.name),r)})]});var o},O=({countLabel:e,className:t,depth:r=0,controlId:s="",disabled:o=!1,item:i,isSelected:n,isSelectable:c=!0,isSingle:l,onSelect:h,search:u="",selected:p,useExpandedPanelId:x,...w})=>{const[E,j]=x,O=null!=e&&void 0!==i.count&&null!==i.count,N=!!i.breadcrumbs?.length,A=!!i.children?.length,T=_(i,E),I=(0,g.A)(["woocommerce-search-list__item",`depth-${r}`,t],{"has-breadcrumbs":N,"has-children":A,"has-count":O,"is-expanded":T,"is-radio-button":l}),B=w.name||`search-list-item-${s}`,M=`${B}-${i.id}`,R=(0,d.useCallback)(()=>{T||"number"!=typeof i.id&&"string"!=typeof i.id?!i.parent||"number"!=typeof i.parent&&"string"!=typeof i.parent?j(null):j(i.parent):j(i.id)},[T,i.id,i.parent,j]),L=(n||!c)&&k(i,p);return A?(0,m.jsx)("div",{className:I,onClick:R,onKeyDown:e=>"Enter"===e.key||" "===e.key?R():null,role:"treeitem",tabIndex:0,children:l?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("input",{type:"radio",id:M,name:B,value:i.value,onChange:()=>{h(i)(),T||j(i.id)},onClick:e=>e.stopPropagation(),checked:n,disabled:o,className:"woocommerce-search-list__item-input",...w}),(0,m.jsx)(P,{item:i,search:u}),O?(0,m.jsx)(C,{label:e||i.count}):null]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(a.CheckboxControl,{className:"woocommerce-search-list__item-input",checked:L,disabled:o,indeterminate:!L&&(n||S(i,p)),label:f((0,y.decodeEntities)(i.name),u),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),onChange:()=>{const e=v(i),t=c?[i,...e]:[...e],r=k(i,p);c&&n||!c&&r?h(b(p,t,"id"))():(h(function(e,t){const r=b(t,e,"id");return[...e,...r]}(p,t))(),T||j(i.id))},__nextHasNoMarginBottom:!0}),O?(0,m.jsx)(C,{label:e||i.count}):null]})}):(0,m.jsxs)("div",{className:I,onClick:o?void 0:h(i),children:[l?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("input",{...w,type:"radio",id:M,name:B,value:i.value,onChange:h(i),checked:n,disabled:o,className:"woocommerce-search-list__item-input",onClick:e=>e.stopPropagation()}),(0,m.jsx)("label",{htmlFor:M,children:(0,m.jsx)(P,{item:i,search:u})})]}):(0,m.jsx)(a.CheckboxControl,{...w,id:M,name:B,className:"woocommerce-search-list__item-input",value:(0,y.decodeEntities)(i.value),label:f((0,y.decodeEntities)(i.name),u),onChange:()=>{h(i)(),T||j(i.id)},checked:n,disabled:o,__nextHasNoMarginBottom:!0,onClick:e=>e.stopPropagation()}),O?(0,m.jsx)(C,{label:e||i.count}):null]})};var N=r(1884);r(5022);const A=({id:e,label:t,popoverContents:r,remove:s,screenReaderLabel:o,className:n=""})=>{const[c,l]=(0,d.useState)(!1),u=(0,w.useInstanceId)(A);if(o=o||t,!t)return null;t=(0,y.decodeEntities)(t);const p=(0,g.A)("woocommerce-tag",n,{"has-remove":!!s}),x=`woocommerce-tag__label-${u}`,E=(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("span",{className:"screen-reader-text",children:o}),(0,m.jsx)("span",{"aria-hidden":"true",children:t})]});return(0,m.jsxs)("span",{className:p,children:[r?(0,m.jsx)(a.Button,{className:"woocommerce-tag__text",id:x,onClick:()=>l(!0),children:E}):(0,m.jsx)("span",{className:"woocommerce-tag__text",id:x,children:E}),r&&c&&(0,m.jsx)(a.Popover,{onClose:()=>l(!1),children:r}),s&&(0,m.jsx)(a.Button,{className:"woocommerce-tag__remove",onClick:s(e),label:(0,h.sprintf)( // Translators: %s label. // Translators: %s label. (0,h.__)("Remove %s","woocommerce"),t),"aria-describedby":x,children:(0,m.jsx)(i.A,{icon:N.A,size:20,className:"clear-icon",role:"img"})})]})},T=A;r(1939);const I=e=>(0,m.jsx)(O,{...e}),B=e=>{const{list:t,selected:r,renderItem:s,depth:o=0,loadMoreChildrenText:i,onLoadMoreChildren:n,totalChildren:c,onSelect:l,instanceId:a,isSingle:u,search:p,useExpandedPanelId:x}=e,[g]=x;return t?(0,m.jsx)(m.Fragment,{children:t.map(t=>{const w=t.children?.length??0,E=!!r.find(({id:e})=>e===t.id),j=_(t,g),f=c?.[t.id],b="number"==typeof f&&w<f;return(0,m.jsxs)(d.Fragment,{children:[(0,m.jsx)("li",{children:s({item:t,isSelected:E,onSelect:l,isSingle:u,selected:r,search:p,depth:o,useExpandedPanelId:x,controlId:a})}),j?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(B,{...e,list:t.children,depth:o+1}),n&&b?(0,m.jsx)("li",{children:(0,m.jsx)("button",{type:"button",className:"woocommerce-search-list__item woocommerce-search-list__item-load-more",onClick:()=>n(),children:i||(0,h.__)("Load more","woocommerce")})}):null]}):null]},t.id)})}):null},M=({isLoading:e,isSingle:t,selected:r,messages:s,onChange:o,onRemove:i})=>{if(e||t||!r)return null;const n=r.length;return(0,m.jsxs)("div",{className:"woocommerce-search-list__selected",children:[(0,m.jsxs)("div",{className:"woocommerce-search-list__selected-header",children:[(0,m.jsx)("strong",{children:s.selected(n)}),n>0?(0,m.jsx)(a.Button,{variant:"link",isDestructive:!0,onClick:()=>o([]),"aria-label":s.clear,children:(0,h.__)("Clear all","woocommerce")}):null]}),n>0?(0,m.jsx)("ul",{children:r.map((e,t)=>(0,m.jsx)("li",{children:(0,m.jsx)(T,{label:e.name,id:e.id,remove:i})},t))}):null]})},R=({filteredList:e,search:t,onSelect:r,instanceId:s,useExpandedPanelId:o,...n})=>{const{messages:c,renderItem:l,selected:a,isSingle:d,loadMoreChildrenText:u,onLoadMoreChildren:p,totalChildren:g}=n,w=l||I;return 0===e.length?(0,m.jsxs)("div",{className:"woocommerce-search-list__list is-not-found",children:[(0,m.jsx)("span",{className:"woocommerce-search-list__not-found-icon",children:(0,m.jsx)(i.A,{icon:x.A,role:"img"})}),(0,m.jsx)("span",{className:"woocommerce-search-list__not-found-text",children:t?(0,h.sprintf)(c.noResults,t):c.noItems})]}):(0,m.jsx)("ul",{className:"woocommerce-search-list__list",children:(0,m.jsx)(B,{useExpandedPanelId:o,list:e,selected:a,renderItem:w,loadMoreChildrenText:u,onLoadMoreChildren:p,totalChildren:g,onSelect:r,instanceId:s,isSingle:d,search:t})})},L=e=>{const{className:t="",isCompact:r,isHierarchical:s,isLoading:o,isSingle:i,list:n,messages:c=E,onChange:l,onSearch:u,selected:p,type:x="text",debouncedSpeak:_}=e,[f,b]=(0,d.useState)(""),y=(0,d.useState)(null),v=(0,w.useInstanceId)(L),S=(0,d.useMemo)(()=>({...E,...c}),[c]),k=(0,d.useMemo)(()=>((e,t,r)=>{if(!t)return r?j(e):e;const s=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),o=e.map(e=>!!s.test(e.name)&&e).filter(Boolean);return r?j(o,e):o})(n,f,s),[n,f,s]);(0,d.useEffect)(()=>{_&&_(S.updated)},[_,S]),(0,d.useEffect)(()=>{"function"==typeof u&&u(f)},[f,u]);const C=(0,d.useCallback)(e=>()=>{i&&l([]);const t=p.findIndex(({id:t})=>t===e);l([...p.slice(0,t),...p.slice(t+1)])},[i,p,l]),P=(0,d.useCallback)(e=>()=>{Array.isArray(e)?l(e):-1===p.findIndex(({id:t})=>t===e.id)?l(i?[e]:[...p,e]):C(e.id)()},[i,C,l,p]),O=(0,d.useCallback)(e=>{const[t]=p.filter(t=>!e.find(e=>t.id===e.id));C(t.id)()},[C,p]);return(0,m.jsxs)("div",{className:(0,g.A)("woocommerce-search-list",t,{"is-compact":r,"is-loading":o,"is-token":"token"===x}),children:["text"===x&&(0,m.jsx)(M,{...e,onRemove:C,messages:S}),(0,m.jsx)("div",{className:"woocommerce-search-list__search",children:"text"===x?(0,m.jsx)(a.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:S.search,type:"search",value:f,onChange:e=>b(e)}):(0,m.jsx)(a.FormTokenField,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,disabled:o,label:S.search,onChange:O,onInputChange:e=>b(e),suggestions:[],__experimentalValidateInput:()=>!1,value:o?[(0,h.__)("Loading…","woocommerce")]:p.map(e=>({...e,value:e.name})),__experimentalShowHowTo:!1})}),o?(0,m.jsx)("div",{className:"woocommerce-search-list__list",children:(0,m.jsx)(a.Spinner,{})}):(0,m.jsx)(R,{...e,search:f,filteredList:k,messages:S,onSelect:P,instanceId:v,useExpandedPanelId:y})]})},F=((0,a.withSpokenMessages)(L),(0,o.getSetting)("wcBlocksConfig",{pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"})),G=(F.pluginUrl,F.pluginUrl,o.STORE_PAGES.shop,o.STORE_PAGES.checkout,o.STORE_PAGES.checkout,o.STORE_PAGES.privacy,o.STORE_PAGES.privacy,o.STORE_PAGES.terms,o.STORE_PAGES.terms,o.STORE_PAGES.cart,o.STORE_PAGES.cart,o.STORE_PAGES.myaccount?.permalink?o.STORE_PAGES.myaccount.permalink:(0,o.getSetting)("wpLoginUrl","/wp-login.php"),(0,o.getSetting)("localPickupEnabled",!1),(0,o.getSetting)("shippingMethodsExist",!1),(0,o.getSetting)("shippingEnabled",!0),(0,o.getSetting)("countries",{})),H=(0,o.getSetting)("countryData",{}),$={...Object.fromEntries(Object.keys(H).filter(e=>!0===H[e].allowBilling).map(e=>[e,G[e]||""])),...Object.fromEntries(Object.keys(H).filter(e=>!0===H[e].allowShipping).map(e=>[e,G[e]||""]))},D=(Object.fromEntries(Object.keys($).map(e=>[e,H[e].states||{}])),Object.fromEntries(Object.keys($).map(e=>[e,H[e].locale||{}])),{address:["first_name","last_name","company","address_1","address_2","city","postcode","country","state","phone"],contact:["email"],order:[]}),V=((0,o.getSetting)("addressFieldsLocations",D).address,(0,o.getSetting)("addressFieldsLocations",D).contact,(0,o.getSetting)("addressFieldsLocations",D).order,(0,o.getSetting)("additionalOrderFields",{}),(0,o.getSetting)("additionalContactFields",{}),(0,o.getSetting)("additionalAddressFields",{}),window.wp.url),J=window.wp.apiFetch;var U=r.n(J);const q=({selected:e=[],search:t="",queryArgs:r={}})=>{const s=(({selected:e=[],search:t="",queryArgs:r={}})=>{const s=F.productCount>100&&e.length>0,o=[(0,V.addQueryArgs)("/wc/store/v1/products",{per_page:100,catalog_visibility:"any",search:t,orderby:"title",order:"asc",exclude:s?e:[],...r})];if(s){const t=Math.ceil(e.length/100);for(let r=1;r<=t;r++)o.push((0,V.addQueryArgs)("/wc/store/v1/products",{catalog_visibility:"any",include:e,per_page:100,page:r}))}return o})({selected:e,search:t,queryArgs:r});return Promise.all(s.map(e=>U()({path:e}))).then(e=>[...new Map(e.flatMap(e=>e.map(e=>[e.id,{...e,parent:0}]))).values()])};var z=r(4347);const Q=window.wp.escapeHtml,W=({message:e,type:t})=>e?"general"===t?(0,m.jsxs)("span",{children:[(0,h.__)("The following error was returned","woocommerce"),(0,m.jsx)("br",{}),(0,m.jsx)("code",{children:(0,Q.escapeHTML)(e)})]}):"api"===t?(0,m.jsxs)("span",{children:[(0,h.__)("The following error was returned from the API","woocommerce"),(0,m.jsx)("br",{}),(0,m.jsx)("code",{children:(0,Q.escapeHTML)(e)})]}):e:(0,h.__)("An error has prevented the block from being updated.","woocommerce"),K=({error:e})=>(0,m.jsx)("div",{className:"wc-block-error-message",children:W(e)}),Y=e=>{const{id:t,name:r,parent:s}=e;return{id:t,name:r,parent:s,breadcrumbs:[],children:[],details:e,value:e.slug}},X=(re=({error:e,onChange:t,onSearch:r,selected:s=[],products:o=[],isLoading:i=!0,isCompact:n=!1})=>{const c={clear:(0,h.__)("Clear all products","woocommerce"),noItems:(0,h.__)("Your store doesn't have any products.","woocommerce"),search:(0,h.__)("Search for products to display","woocommerce"),selected:e=>(0,h.sprintf)(/* translators: %d is the number of selected products. */ /* translators: %d is the number of selected products. */ (0,h._n)("%d product selected","%d products selected",e,"woocommerce"),e),updated:(0,h.__)("Product search results updated.","woocommerce")};if(e)return(0,m.jsx)(K,{error:e});const l=o.map(Y);return(0,m.jsx)(L,{className:"woocommerce-products",list:l.map(e=>{const t=e.details?.sku?" ("+e.details.sku+")":"";return{...e,name:`${(0,y.decodeEntities)(e.name)}${t}`}}),isCompact:n,isLoading:i,isSingle:!1,selected:l.filter(({details:e})=>!(!e||!Number.isSafeInteger(e.id))&&s.includes(e.id)),onSearch:r,onChange:t,messages:c})},({selected:e,...t})=>{const[r,s]=(0,d.useState)(!0),[o,i]=(0,d.useState)(null),[n,c]=(0,d.useState)([]),l=F.productCount>100,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),s(!1)},h=(0,d.useRef)(e);(0,d.useEffect)(()=>{q({selected:h.current}).then(e=>{c(e),s(!1)}).catch(a)},[h]);const u=(0,z.YQ)(t=>{q({selected:e,search:t}).then(e=>{c(e),s(!1)}).catch(a)},400),p=(0,d.useCallback)(e=>{s(!0),u(e)},[s,u]);return(0,m.jsx)(re,{...t,selected:e,error:o,products:n,isLoading:r,onSearch:l?p:null})}),Z=e=>{const{attributes:t,setAttributes:r}=e,{columns:s,contentVisibility:i,orderby:n,alignButtons:c}=t;return(0,m.jsxs)(l.InspectorControls,{children:[(0,m.jsxs)(a.PanelBody,{title:(0,h.__)("Layout","woocommerce"),initialOpen:!0,children:[(0,m.jsx)(a.RangeControl,{label:(0,h.__)("Columns","woocommerce"),value:s,onChange:e=>r({columns:e}),min:(0,o.getSetting)("minColumns",1),max:(0,o.getSetting)("maxColumns",6)}),(0,m.jsx)(a.ToggleControl,{label:(0,h.__)("Align Buttons","woocommerce"),help:c?(0,h.__)("Buttons are aligned vertically.","woocommerce"):(0,h.__)("Buttons follow content.","woocommerce"),checked:c,onChange:()=>r({alignButtons:!c})})]}),(0,m.jsx)(a.PanelBody,{title:(0,h.__)("Content","woocommerce"),initialOpen:!0,children:(0,m.jsx)(u,{settings:i,onChange:e=>r({contentVisibility:e})})}),(0,m.jsx)(a.PanelBody,{title:(0,h.__)("Order By","woocommerce"),initialOpen:!1,children:(0,m.jsx)(p,{setAttributes:r,value:n})}),(0,m.jsx)(a.PanelBody,{title:(0,h.__)("Products","woocommerce"),initialOpen:!1,children:(0,m.jsx)(X,{selected:t.products,onChange:(e=[])=>{const t=e.map(({id:e})=>e);r({products:t})},isCompact:!0})})]},"inspector")},ee=e=>{const{attributes:t,setAttributes:r,debouncedSpeak:s,isEditing:o,setIsEditing:c}=e;return(0,m.jsxs)(a.Placeholder,{icon:(0,m.jsx)(i.A,{icon:n.A}),label:(0,h.__)("Hand-picked Products","woocommerce"),className:"wc-block-products-grid wc-block-handpicked-products",children:[(0,h.__)("Display a selection of hand-picked products in a grid.","woocommerce"),(0,m.jsxs)("div",{className:"wc-block-handpicked-products__selection",children:[(0,m.jsx)(X,{selected:t.products,onChange:(e=[])=>{const t=e.map(({id:e})=>e);r({products:t})}}),(0,m.jsx)(a.Button,{variant:"primary",onClick:()=>{c(!o),s((0,h.__)("Now displaying a preview of the Hand-picked Products block.","woocommerce"))},children:(0,h.__)("Done","woocommerce")})]})]})},te=window.wp.serverSideRender;var re,se=r.n(te);const oe=(0,m.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 230 250",style:{width:"100%"},children:[(0,m.jsx)("title",{children:"Grid Block Preview"}),(0,m.jsx)("rect",{width:"65.374",height:"65.374",x:".162",y:".779",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),(0,m.jsx)("rect",{width:"62.8",height:"15",x:"1.565",y:"101.448",fill:"#E1E3E6",rx:"5"}),(0,m.jsx)("rect",{width:"65.374",height:"65.374",x:".162",y:"136.277",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),(0,m.jsx)("rect",{width:"62.8",height:"15",x:"1.565",y:"236.946",fill:"#E1E3E6",rx:"5"}),(0,m.jsx)("rect",{width:"65.374",height:"65.374",x:"82.478",y:".779",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),(0,m.jsx)("rect",{width:"62.8",height:"15",x:"83.882",y:"101.448",fill:"#E1E3E6",rx:"5"}),(0,m.jsx)("rect",{width:"65.374",height:"65.374",x:"82.478",y:"136.277",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),(0,m.jsx)("rect",{width:"62.8",height:"15",x:"83.882",y:"236.946",fill:"#E1E3E6",rx:"5"}),(0,m.jsx)("rect",{width:"65.374",height:"65.374",x:"164.788",y:".779",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),(0,m.jsx)("rect",{width:"62.8",height:"15",x:"166.192",y:"101.448",fill:"#E1E3E6",rx:"5"}),(0,m.jsx)("rect",{width:"65.374",height:"65.374",x:"164.788",y:"136.277",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),(0,m.jsx)("rect",{width:"62.8",height:"15",x:"166.192",y:"236.946",fill:"#E1E3E6",rx:"5"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,m.jsx)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"221.798",fill:"#E1E3E6",rx:"3"})]}),ie=e=>{const{attributes:t,name:r}=e;return t.isPreview?oe:(0,m.jsx)(se(),{block:r,attributes:t})},ne=(0,a.withSpokenMessages)(e=>{const t=(0,l.useBlockProps)(),{attributes:{products:r}}=e,[s,o]=(0,d.useState)(!r.length);return(0,m.jsxs)("div",{...t,children:[(0,m.jsx)(l.BlockControls,{children:(0,m.jsx)(a.ToolbarGroup,{controls:[{icon:"edit",title:(0,h.__)("Edit selected products","woocommerce"),onClick:()=>o(!s),isActive:s}]})}),(0,m.jsx)(Z,{...e}),s?(0,m.jsx)(ee,{isEditing:s,setIsEditing:o,...e}):(0,m.jsx)(a.Disabled,{children:(0,m.jsx)(ie,{...e})})]})});(0,s.registerBlockType)(c,{icon:{src:(0,m.jsx)(i.A,{icon:n.A,className:"wc-block-editor-components-block-icon"})},attributes:{...c.attributes,columns:{type:"number",default:(0,o.getSetting)("defaultColumns",3)}},edit:ne,save:()=>null})},9202:()=>{},1939:()=>{},5022:()=>{},1609:e=>{"use strict";e.exports=window.React},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}},o={};function i(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}};return s[e](r,r.exports,i),r.exports}i.m=s,e=[],i.O=(t,r,s,o)=>{if(!r){var n=1/0;for(d=0;d<e.length;d++){for(var[r,s,o]=e[d],c=!0,l=0;l<r.length;l++)(!1&o||n>=o)&&Object.keys(i.O).every(e=>i.O[e](r[l]))?r.splice(l--,1):(c=!1,o<n&&(n=o));if(c){e.splice(d--,1);var a=s();void 0!==a&&(t=a)}}return t}o=o||0;for(var d=e.length;d>0&&e[d-1][2]>o;d--)e[d]=e[d-1];e[d]=[r,s,o]},i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(e,s){if(1&s&&(e=this(e)),8&s)return e;if("object"==typeof e&&e){if(4&s&&e.__esModule)return e;if(16&s&&"function"==typeof e.then)return e}var o=Object.create(null);i.r(o);var n={};t=t||[null,r({}),r([]),r(r)];for(var c=2&s&&e;"object"==typeof c&&!~t.indexOf(c);c=r(c))Object.getOwnPropertyNames(c).forEach(t=>n[t]=()=>e[t]);return n.default=()=>e,i.d(o,n),o},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},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=6461,(()=>{var e={6461:0};i.O.j=t=>0===e[t];var t=(t,r)=>{var s,o,[n,c,l]=r,a=0;if(n.some(t=>0!==e[t])){for(s in c)i.o(c,s)&&(i.m[s]=c[s]);if(l)var d=l(i)}for(t&&t(r);a<n.length;a++)o=n[a],i.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return i.O(d)},r=globalThis.webpackChunkwebpackWcBlocksMainJsonp=globalThis.webpackChunkwebpackWcBlocksMainJsonp||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var n=i.O(void 0,[94],()=>i(9552));n=i.O(n),((this.wc=this.wc||{}).blocks=this.wc.blocks||{})["handpicked-products"]=n})();