(()=>{var e,t,o,r={3847:(e,t,o)=>{"use strict";var r=o(5573),a=o(790);const i=(0,a.jsxs)(r.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24",children:[(0,a.jsx)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),(0,a.jsx)("path",{d:"M20 6h-8l-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V6h5.17l2 2H20v10zm-6.92-3.96L12.39 17 15 15.47 17.61 17l-.69-2.96 2.3-1.99-3.03-.26L15 9l-1.19 2.79-3.03.26z"})]});var n=o(7871),s=(o(9926),o(1117),o(6087)),c=o(9491);const l=window.wp.url,d=window.wp.apiFetch;var m=o.n(d);const u=window.wc.wcSettings,g=(0,u.getSetting)("wcBlocksConfig",{pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),p=g.pluginUrl+"assets/images/",h=(g.pluginUrl,u.STORE_PAGES.shop,u.STORE_PAGES.checkout,u.STORE_PAGES.checkout,u.STORE_PAGES.privacy,u.STORE_PAGES.privacy,u.STORE_PAGES.terms,u.STORE_PAGES.terms,u.STORE_PAGES.cart,u.STORE_PAGES.cart,u.STORE_PAGES.myaccount?.permalink?u.STORE_PAGES.myaccount.permalink:(0,u.getSetting)("wpLoginUrl","/wp-login.php"),(0,u.getSetting)("localPickupEnabled",!1),(0,u.getSetting)("shippingMethodsExist",!1),(0,u.getSetting)("shippingEnabled",!0),(0,u.getSetting)("countries",{})),b=(0,u.getSetting)("countryData",{}),x={...Object.fromEntries(Object.keys(b).filter(e=>!0===b[e].allowBilling).map(e=>[e,h[e]||""])),...Object.fromEntries(Object.keys(b).filter(e=>!0===b[e].allowShipping).map(e=>[e,h[e]||""]))},w=(Object.fromEntries(Object.keys(x).map(e=>[e,b[e].states||{}])),Object.fromEntries(Object.keys(x).map(e=>[e,b[e].locale||{}])),{address:["first_name","last_name","company","address_1","address_2","city","postcode","country","state","phone"],contact:["email"],order:[]}),_=((0,u.getSetting)("addressFieldsLocations",w).address,(0,u.getSetting)("addressFieldsLocations",w).contact,(0,u.getSetting)("addressFieldsLocations",w).order,(0,u.getSetting)("additionalOrderFields",{}),(0,u.getSetting)("additionalContactFields",{}),(0,u.getSetting)("additionalAddressFields",{}),({selected:e=[],search:t="",queryArgs:o={}})=>{const r=(({selected:e=[],search:t="",queryArgs:o={}})=>{const r=g.productCount>100&&e.length>0,a=[(0,l.addQueryArgs)("/wc/store/v1/products",{per_page:100,catalog_visibility:"any",search:t,orderby:"title",order:"asc",exclude:r?e:[],...o})];if(r){const t=Math.ceil(e.length/100);for(let o=1;o<=t;o++)a.push((0,l.addQueryArgs)("/wc/store/v1/products",{catalog_visibility:"any",include:e,per_page:100,page:o}))}return a})({selected:e,search:t,queryArgs:o});return Promise.all(r.map(e=>m()({path:e}))).then(e=>[...new Map(e.flatMap(e=>e.map(e=>[e.id,{...e,parent:0}]))).values()])}),y=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"}}},f=(0,c.createHigherOrderComponent)(e=>class extends s.Component{constructor(){super(...arguments),this.state={error:null,loading:!1,category:"preview"===this.props.attributes.categoryId?this.props.attributes.previewCategory:null},this.loadCategory=this.loadCategory.bind(this)}componentDidMount(){this.loadCategory()}componentDidUpdate(e){e.attributes.categoryId!==this.props.attributes.categoryId&&this.loadCategory()}loadCategory(){const{categoryId:e}=this.props.attributes;"preview"!==e&&(e?(this.setState({loading:!0}),(e=>m()({path:`wc/store/v1/products/categories/${e}`}))(e).then(e=>{this.setState({category:e,loading:!1,error:null})}).catch(async e=>{const t=await y(e);this.setState({category:null,loading:!1,error:t})})):this.setState({category:null,loading:!1,error:null}))}render(){const{error:t,loading:o,category:r}=this.state;return(0,a.jsx)(e,{...this.props,error:t,getCategory:this.loadCategory,isLoading:o,category:r})}},"withCategory"),v=window.wp.components;var S=o(7723);const j=window.wp.blockEditor;var k=o(3931);const I=e=>{const{id:t,name:o,parent:r}=e;return{id:t,name:o,parent:r,breadcrumbs:[],children:[],details:e,value:e.slug}},C=e=>{const{id:t,name:o,parent:r,count:a}=e;return{id:t,name:o,parent:r,count:a,breadcrumbs:[],children:[],details:e,value:e.slug}},E=`${JSON.parse('{"name":"woocommerce/product-collection"}').name}/product-title`,N="woocommerce/featured-category",A="woocommerce/featured-product",P=e=>[["woocommerce/category-title",{level:2,textAlign:"center"}],["woocommerce/category-description",{textAlign:"center"}],["core/buttons",{layout:{type:"flex",justifyContent:"center"}},[["core/button",{text:(0,S.__)("Shop now","woocommerce"),url:e.permalink}]]]],R=e=>[["core/post-title",{isLink:!0,level:2,textAlign:"center",__woocommerceNamespace:E}],["woocommerce/product-summary",{showDescriptionIfEmpty:!0,style:{typography:{textAlign:"center"}},summaryLength:80}],["woocommerce/product-price",{style:{spacing:{padding:{bottom:"16px"}}},textAlign:"center"}],["core/buttons",{layout:{type:"flex",justifyContent:"center"}},[["core/button",{text:(0,S.__)("Shop now","woocommerce"),url:e.permalink}]]]],L=window.wc.wcTypes;function T(e){return!!e&&(0,L.isNumber)(e.id)&&"string"==typeof e.src}function F({blockName:e,item:t,mediaId:o,mediaSrc:r}){const[a,i]=(0,s.useState)(0),[n,c]=(0,s.useState)(""),[l,d]=(0,s.useState)(!1),[m,u]=(0,s.useState)({height:0,width:0}),g=(0,s.useRef)(null),p=(0,s.useRef)(null);return(0,s.useEffect)(()=>{var r,a;i(o||(e===A?(a=t)&&a.images&&a.images.length&&a.images[0].id||0:(r=t)&&T(r.image)?r.image.id:0))},[e,t,o]),(0,s.useEffect)(()=>{var o,a;c(r||(e===A?(a=t)&&a.images&&a.images.length&&a.images[0].src||"":(o=t)&&T(o.image)?o.image.src:""))},[e,t,r]),(0,s.useEffect)(()=>{if(n){g.current||(g.current=new Image),p.current||(p.current=document.createElement("canvas"));const e=g.current,t=p.current;e.src=n,e.onload=()=>{const o=e.naturalWidth,r=e.naturalHeight;null!==r&&null!==o&&u({height:r,width:o}),t.width=o,t.height=r;const a=t.getContext("2d",{willReadFrequently:!0});if(!a)return;a.drawImage(e,0,0,o,r);const i=a.getImageData(0,0,o,r).data,n=(()=>{for(let e=3;e{g.current&&(g.current.onload=null)}},[n]),{backgroundImageId:a,backgroundImageSrc:n,isImageBgTransparent:l,originalImgDimension:m}}const O=({backgroundImageId:e,backgroundImageSrc:t,contentAlign:o,cropLabel:r,editLabel:i,editMode:n,isEditingImage:s,mediaSrc:c,setAttributes:l,setIsEditingImage:d,setEditMode:m})=>(0,a.jsxs)(j.BlockControls,{children:[(0,a.jsx)(j.AlignmentToolbar,{value:o,onChange:e=>{l({contentAlign:e})}}),(0,a.jsxs)(v.ToolbarGroup,{children:[t&&!s&&(0,a.jsx)(v.ToolbarButton,{onClick:()=>d(!0),icon:k.A,label:r}),(0,a.jsx)(j.MediaReplaceFlow,{mediaId:e,mediaURL:c,accept:"image/*",onSelect:e=>{l({mediaId:e.id,mediaSrc:e.url})},allowedTypes:["image"]}),e&&c?(0,a.jsx)(v.ToolbarButton,{onClick:()=>l({mediaId:0,mediaSrc:""}),children:(0,S.__)("Reset","woocommerce")}):null]}),(0,a.jsx)(v.ToolbarGroup,{controls:[{icon:"edit",title:i,onClick:()=>m(!n),isActive:n}]})]}),B=({align:e,backgroundImageId:t,backgroundImageSize:o,backgroundImageSrc:r,containerRef:i,isEditingImage:n,setAttributes:c,setIsEditingImage:l})=>{const d=function(e,t){const[o,r]=(0,s.useState)(),a=(0,s.useCallback)(()=>{r(e.current?.clientWidth)},[e]);return(0,s.useEffect)(a,[a,...t]),(0,s.useEffect)(()=>{if(!e.current)return;const{defaultView:t}=e.current.ownerDocument;return t?(t.addEventListener("resize",a),()=>{t.removeEventListener("resize",a)}):void 0},[e,a]),o}(i,[e]);return"function"==typeof j.__experimentalImageEditingProvider?(0,a.jsx)(j.__experimentalImageEditingProvider,{id:t,url:r,naturalHeight:o.height||500,naturalWidth:o.width||500,onSaveImage:({id:e,url:t})=>{c({mediaId:e,mediaSrc:t})},isEditing:n,onFinishEditing:()=>l(!1),children:(0,a.jsx)(j.__experimentalImageEditor,{url:r,height:o.height||500,width:o.width||500})}):(0,a.jsx)(j.__experimentalImageEditor,{id:t,url:r,height:o.height||500,width:o.width||500,naturalHeight:o.height,naturalWidth:o.width,onSaveImage:({id:e,url:t})=>{c({mediaId:e,mediaSrc:t})},onFinishEditing:()=>l(!1),clientWidth:d})},M=({alt:e,backgroundColor:t,backgroundColorVisibilityStatus:o,backgroundImageSrc:r,clientId:i,dimRatio:n,focalPoint:s,hasParallax:c,imageFit:l,isRepeated:d,overlayColor:m,overlayGradient:u,setAttributes:g,setGradient:p})=>{const h="function"==typeof v.FocalPointPicker,b=!d&&!c,x=(0,j.__experimentalUseMultipleOriginColorsAndGradients)();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(j.InspectorControls,{children:!!r&&(0,a.jsx)(a.Fragment,{children:h&&(0,a.jsxs)(v.PanelBody,{title:(0,S.__)("Media settings","woocommerce"),children:[(0,a.jsx)(v.ToggleControl,{label:(0,S.__)("Fixed background","woocommerce"),checked:c,onChange:()=>{g({hasParallax:!c})}}),(0,a.jsx)(v.ToggleControl,{label:(0,S.__)("Repeated background","woocommerce"),checked:d,onChange:()=>{g({isRepeated:!d})}}),!d&&(0,a.jsxs)(v.__experimentalToggleGroupControl,{help:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{style:{display:"block",marginBottom:"1em"},children:(0,S.__)("Select “Cover” to have the image automatically fit its container.","woocommerce")}),(0,a.jsx)("span",{children:(0,S.__)("This may affect your ability to freely move the focal point of the image.","woocommerce")})]}),label:(0,S.__)("Image fit","woocommerce"),isBlock:!0,value:l,onChange:e=>g({imageFit:e}),children:[(0,a.jsx)(v.__experimentalToggleGroupControlOption,{label:(0,S.__)("None","woocommerce"),value:"none"}),(0,a.jsx)(v.__experimentalToggleGroupControlOption /* translators: "Cover" is a verb that indicates an image covering the entire container. */,{label:(0,S.__)("Cover","woocommerce"),value:"cover"})]}),(0,a.jsx)(v.FocalPointPicker,{label:(0,S.__)("Focal Point Picker","woocommerce"),url:r,value:s,onChange:e=>g({focalPoint:e})}),b&&(0,a.jsx)(v.TextareaControl,{label:(0,S.__)("Alt text (alternative text)","woocommerce"),value:e,onChange:e=>{g({alt:e})},help:(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(v.ExternalLink,{href:"https://www.w3.org/WAI/tutorials/images/decision-tree",children:(0,S.__)("Describe the purpose of the image","woocommerce")})})})]})})},"inspector"),x.hasColorsOrGradients&&(0,a.jsxs)(j.InspectorControls,{group:"color",children:[!!r&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(j.__experimentalColorGradientSettingsDropdown,{__experimentalIsRenderedInSidebar:!0,settings:[{clearable:!0,colorValue:m,gradientValue:u,label:(0,S.__)("Overlay","woocommerce"),onColorChange:e=>g({overlayColor:e}),onGradientChange:e=>{p(e),g({overlayGradient:e})},isShownByDefault:!0,resetAllFilter:()=>({overlayColor:void 0,overlayGradient:void 0})}],panelId:i,...x}),(0,a.jsx)(v.__experimentalToolsPanelItem,{isShownByDefault:!0,hasValue:()=>50!==n,label:(0,S.__)("Overlay opacity","woocommerce"),onDeselect:()=>g({dimRatio:50}),panelId:i,resetAllFilter:()=>({dimRatio:50}),children:(0,a.jsx)(v.RangeControl,{required:!0,label:(0,S.__)("Overlay opacity","woocommerce"),max:100,min:0,onChange:e=>g({dimRatio:e}),step:10,value:n})})]}),!1===o?.isBackgroundVisible&&o?.message&&t&&(0,a.jsx)("div",{className:"image-bg-color-warning",children:(0,a.jsx)(v.Notice,{status:"warning",isDismissible:!1,children:o.message})})]})]})};var $=o(7681),V=o(4921);const D=window.wp.escapeHtml,G=({message:e,type:t})=>e?"general"===t?(0,a.jsxs)("span",{children:[(0,S.__)("The following error was returned","woocommerce"),(0,a.jsx)("br",{}),(0,a.jsx)("code",{children:(0,D.escapeHTML)(e)})]}):"api"===t?(0,a.jsxs)("span",{children:[(0,S.__)("The following error was returned from the API","woocommerce"),(0,a.jsx)("br",{}),(0,a.jsx)("code",{children:(0,D.escapeHTML)(e)})]}):e:(0,S.__)("An error has prevented the block from being updated.","woocommerce"),z=({error:e})=>(0,a.jsx)("div",{className:"wc-block-error-message",children:G(e)});o(3120);const H=({className:e="",error:t,isLoading:o=!1,onRetry:r})=>(0,a.jsxs)(v.Placeholder,{icon:(0,a.jsx)(n.A,{icon:$.A}),label:(0,S.__)("Sorry, an error occurred","woocommerce"),className:(0,V.A)("wc-block-api-error",e),children:[(0,a.jsx)(z,{error:t}),r&&(0,a.jsx)(a.Fragment,{children:o?(0,a.jsx)(v.Spinner,{}):(0,a.jsx)(v.Button,{variant:"secondary",onClick:r,children:(0,S.__)("Retry","woocommerce")})})]});function U(e){return e?`${Math.round(100*e.x)}% ${Math.round(100*e.y)}%`:""}function W(e){return`wc-block-${e.split("/")[1]}`}function q(e){return e===A?(0,S.__)("Previously selected product is no longer available","woocommerce"):(0,S.__)("Previously selected category is no longer available","woocommerce")}var J=o(229);function Y(e,t,o){const r=new Set(t.map(e=>e[o]));return e.filter(e=>!r.has(e[o]))}const Q=window.wp.htmlEntities,K={clear:(0,S.__)("Clear all selected items","woocommerce"),noItems:(0,S.__)("No items found.","woocommerce"), /* Translators: %s search term */ noResults:(0,S.__)("No results for %s","woocommerce"),search:(0,S.__)("Search for items","woocommerce"),selected:e=>(0,S.sprintf)(/* translators: Number of items selected from list. */ /* translators: Number of items selected from list. */ (0,S._n)("%d item selected","%d items selected",e,"woocommerce"),e),updated:(0,S.__)("Search results updated.","woocommerce")},X=(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 a=["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 a.push(""+e.id),{...e,breadcrumbs:i(r[e.parent]),children:t&&t.length?n(t):[]}}),s=n(o[0]||[]);return Object.entries(o).forEach(([e,t])=>{a.includes(e)||s.push(...n(t||[]))}),s},Z=(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,a.jsx)("strong",{children:e},t):(0,a.jsx)(s.Fragment,{children:e},t))},ee=({label:e})=>(0,a.jsx)("span",{className:"woocommerce-search-list__item-count",children:e}),te=e=>{const{item:t,search:o}=e,r=t.breadcrumbs&&t.breadcrumbs.length;return(0,a.jsxs)("span",{className:"woocommerce-search-list__item-label",children:[r?(0,a.jsx)("span",{className:"woocommerce-search-list__item-prefix",children:(i=t.breadcrumbs,1===i.length?i.slice(0,1).toString():2===i.length?i.slice(0,1).toString()+" › "+i.slice(-1).toString():i.slice(0,1).toString()+" … "+i.slice(-1).toString())}):null,(0,a.jsx)("span",{className:"woocommerce-search-list__item-name",children:Z((0,Q.decodeEntities)(t.name),o)})]});var i},oe=({countLabel:e,className:t,depth:o=0,controlId:r="",item:i,isSelected:n,isSingle:c,onSelect:l,search:d="",selected:m,useExpandedPanelId:u,...g})=>{const[p,h]=u,b=null!=e&&void 0!==i.count&&null!==i.count,x=!!i.breadcrumbs?.length,w=!!i.children?.length,_=p===i.id,y=(0,V.A)(["woocommerce-search-list__item",`depth-${o}`,t],{"has-breadcrumbs":x,"has-children":w,"has-count":b,"is-expanded":_,"is-radio-button":c});(0,s.useEffect)(()=>{w&&n&&h(i.id)},[i,w,n,h]);const f=g.name||`search-list-item-${r}`,S=`${f}-${i.id}`,j=(0,s.useCallback)(()=>{h(_?-1:Number(i.id))},[_,i.id,h]);return w?(0,a.jsx)("div",{className:y,onClick:j,onKeyDown:e=>"Enter"===e.key||" "===e.key?j():null,role:"treeitem",tabIndex:0,children:c?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("input",{type:"radio",id:S,name:f,value:i.value,onChange:l(i),onClick:e=>e.stopPropagation(),checked:n,className:"woocommerce-search-list__item-input",...g}),(0,a.jsx)(te,{item:i,search:d}),b?(0,a.jsx)(ee,{label:e||i.count}):null]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(v.CheckboxControl,{className:"woocommerce-search-list__item-input",checked:n,...!n&&i.children.some(e=>m.find(t=>t.id===e.id))?{indeterminate:!0}:{},label:Z((0,Q.decodeEntities)(i.name),d),onChange:()=>{n?l(Y(m,i.children,"id"))():l(function(e,t){const o=Y(t,e,"id");return[...e,...o]}(m,i.children))()},onClick:e=>e.stopPropagation()}),b?(0,a.jsx)(ee,{label:e||i.count}):null]})}):(0,a.jsxs)("label",{htmlFor:S,className:y,children:[c?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("input",{...g,type:"radio",id:S,name:f,value:i.value,onChange:l(i),checked:n,className:"woocommerce-search-list__item-input"}),(0,a.jsx)(te,{item:i,search:d})]}):(0,a.jsx)(v.CheckboxControl,{...g,id:S,name:f,className:"woocommerce-search-list__item-input",value:(0,Q.decodeEntities)(i.value),label:Z((0,Q.decodeEntities)(i.name),d),onChange:l(i),checked:n}),b?(0,a.jsx)(ee,{label:e||i.count}):null]})},re=oe;var ae=o(125);o(5022);const ie=({id:e,label:t,popoverContents:o,remove:r,screenReaderLabel:i,className:l=""})=>{const[d,m]=(0,s.useState)(!1),u=(0,c.useInstanceId)(ie);if(i=i||t,!t)return null;t=(0,Q.decodeEntities)(t);const g=(0,V.A)("woocommerce-tag",l,{"has-remove":!!r}),p=`woocommerce-tag__label-${u}`,h=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"screen-reader-text",children:i}),(0,a.jsx)("span",{"aria-hidden":"true",children:t})]});return(0,a.jsxs)("span",{className:g,children:[o?(0,a.jsx)(v.Button,{className:"woocommerce-tag__text",id:p,onClick:()=>m(!0),children:h}):(0,a.jsx)("span",{className:"woocommerce-tag__text",id:p,children:h}),o&&d&&(0,a.jsx)(v.Popover,{onClose:()=>m(!1),children:o}),r&&(0,a.jsx)(v.Button,{className:"woocommerce-tag__remove",onClick:r(e),label:(0,S.sprintf)( // Translators: %s label. // Translators: %s label. (0,S.__)("Remove %s","woocommerce"),t),"aria-describedby":p,children:(0,a.jsx)(n.A,{icon:ae.A,size:20,className:"clear-icon",role:"img"})})]})},ne=ie;o(1939);const se=e=>(0,a.jsx)(re,{...e}),ce=e=>{const{list:t,selected:o,renderItem:r,depth:i=0,loadMoreChildrenText:n,onLoadMoreChildren:c,totalChildren:l,onSelect:d,instanceId:m,isSingle:u,search:g,useExpandedPanelId:p}=e,[h]=p;return t?(0,a.jsx)(a.Fragment,{children:t.map(t=>{const b=t.children?.length??0,x=b&&!u?t.children?.every(({id:e})=>o.find(t=>t.id===e)):!!o.find(({id:e})=>e===t.id),w=b&&h===t.id,_=l?.[t.id],y="number"==typeof _&&b<_;return(0,a.jsxs)(s.Fragment,{children:[(0,a.jsx)("li",{children:r({item:t,isSelected:x,onSelect:d,isSingle:u,selected:o,search:g,depth:i,useExpandedPanelId:p,controlId:m})}),w?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ce,{...e,list:t.children,depth:i+1}),c&&y?(0,a.jsx)("li",{children:(0,a.jsx)("button",{type:"button",className:"woocommerce-search-list__item woocommerce-search-list__item-load-more",onClick:()=>c(),children:n||(0,S.__)("Load more","woocommerce")})}):null]}):null]},t.id)})}):null},le=({isLoading:e,isSingle:t,selected:o,messages:r,onChange:i,onRemove:n})=>{if(e||t||!o)return null;const s=o.length;return(0,a.jsxs)("div",{className:"woocommerce-search-list__selected",children:[(0,a.jsxs)("div",{className:"woocommerce-search-list__selected-header",children:[(0,a.jsx)("strong",{children:r.selected(s)}),s>0?(0,a.jsx)(v.Button,{variant:"link",isDestructive:!0,onClick:()=>i([]),"aria-label":r.clear,children:(0,S.__)("Clear all","woocommerce")}):null]}),s>0?(0,a.jsx)("ul",{children:o.map((e,t)=>(0,a.jsx)("li",{children:(0,a.jsx)(ne,{label:e.name,id:e.id,remove:n})},t))}):null]})},de=({filteredList:e,search:t,onSelect:o,instanceId:r,useExpandedPanelId:i,...s})=>{const{messages:c,renderItem:l,selected:d,isSingle:m,loadMoreChildrenText:u,onLoadMoreChildren:g,totalChildren:p}=s,h=l||se;return 0===e.length?(0,a.jsxs)("div",{className:"woocommerce-search-list__list is-not-found",children:[(0,a.jsx)("span",{className:"woocommerce-search-list__not-found-icon",children:(0,a.jsx)(n.A,{icon:J.A,role:"img"})}),(0,a.jsx)("span",{className:"woocommerce-search-list__not-found-text",children:t?(0,S.sprintf)(c.noResults,t):c.noItems})]}):(0,a.jsx)("ul",{className:"woocommerce-search-list__list",children:(0,a.jsx)(ce,{useExpandedPanelId:i,list:e,selected:d,renderItem:h,loadMoreChildrenText:u,onLoadMoreChildren:g,totalChildren:p,onSelect:o,instanceId:r,isSingle:m,search:t})})},me=e=>{const{className:t="",isCompact:o,isHierarchical:r,isLoading:i,isSingle:n,list:l,messages:d=K,onChange:m,onSearch:u,selected:g,type:p="text",debouncedSpeak:h}=e,[b,x]=(0,s.useState)(""),w=(0,s.useState)(-1),_=(0,c.useInstanceId)(me),y=(0,s.useMemo)(()=>({...K,...d}),[d]),f=(0,s.useMemo)(()=>((e,t,o)=>{if(!t)return o?X(e):e;const r=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),a=e.map(e=>!!r.test(e.name)&&e).filter(Boolean);return o?X(a,e):a})(l,b,r),[l,b,r]);(0,s.useEffect)(()=>{h&&h(y.updated)},[h,y]),(0,s.useEffect)(()=>{"function"==typeof u&&u(b)},[b,u]);const j=(0,s.useCallback)(e=>()=>{n&&m([]);const t=g.findIndex(({id:t})=>t===e);m([...g.slice(0,t),...g.slice(t+1)])},[n,g,m]),k=(0,s.useCallback)(e=>()=>{Array.isArray(e)?m(e):-1===g.findIndex(({id:t})=>t===e.id)?m(n?[e]:[...g,e]):j(e.id)()},[n,j,m,g]),I=(0,s.useCallback)(e=>{const[t]=g.filter(t=>!e.find(e=>t.id===e.id));j(t.id)()},[j,g]);return(0,a.jsxs)("div",{className:(0,V.A)("woocommerce-search-list",t,{"is-compact":o,"is-loading":i,"is-token":"token"===p}),children:["text"===p&&(0,a.jsx)(le,{...e,onRemove:j,messages:y}),(0,a.jsx)("div",{className:"woocommerce-search-list__search",children:"text"===p?(0,a.jsx)(v.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:y.search,type:"search",value:b,onChange:e=>x(e)}):(0,a.jsx)(v.FormTokenField,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,disabled:i,label:y.search,onChange:I,onInputChange:e=>x(e),suggestions:[],__experimentalValidateInput:()=>!1,value:i?[(0,S.__)("Loading…","woocommerce")]:g.map(e=>({...e,value:e.name})),__experimentalShowHowTo:!1})}),i?(0,a.jsx)("div",{className:"woocommerce-search-list__list",children:(0,a.jsx)(v.Spinner,{})}):(0,a.jsx)(de,{...e,search:b,filteredList:f,messages:y,onSelect:k,instanceId:_,useExpandedPanelId:w})]})},ue=((0,v.withSpokenMessages)(me),e=>({selected:t,...o})=>{const[r,i]=(0,s.useState)(!0),[n,c]=(0,s.useState)(null),[d,u]=(0,s.useState)([]),g=async e=>{const t=await y(e);c(t),i(!1)},p=(0,s.useRef)(t);return(0,s.useEffect)(()=>{var e;(e={selected:p.current},m()({path:(0,l.addQueryArgs)("wc/store/v1/products/categories",{per_page:0,...e})})).then(e=>{u(e),i(!1)}).catch(g)},[p]),(0,a.jsx)(e,{...o,selected:t,error:n,categories:d,isLoading:r})});o(6982);const ge=ue(({categories:e=[],error:t=null,isLoading:o=!1,onChange:r,onOperatorChange:i,operator:n="any",selected:s,isCompact:c=!1,isSingle:l=!1,showReviewCount:d})=>{const m={clear:(0,S.__)("Clear all product categories","woocommerce"),list:(0,S.__)("Product Categories","woocommerce"),noItems:(0,S.__)("Your store doesn't have any product categories.","woocommerce"),search:(0,S.__)("Search for product categories","woocommerce"),selected:e=>(0,S.sprintf)(/* translators: %d is the count of selected categories. */ /* translators: %d is the count of selected categories. */ (0,S._n)("%d category selected","%d categories selected",e,"woocommerce"),e),updated:(0,S.__)("Category search results updated.","woocommerce")};if(t)return(0,a.jsx)(z,{error:t});const u=e.map(C);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(me,{className:"woocommerce-product-categories",list:u,isLoading:o,selected:u.filter(({id:e})=>s.includes(Number(e))),onChange:r,renderItem:e=>{const{item:t,search:o,depth:r=0}=e,i=t.breadcrumbs.length?`${t.breadcrumbs.join(", ")}, ${t.name}`:t.name,n=d?(0,S.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,S._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,S.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,S._n)("%1$s, has %2$d product","%1$s, has %2$d products",t.details?.count||0,"woocommerce"),i,t.details?.count||0),s=d?(0,S.sprintf)(/* translators: %d is the count of reviews. */ /* translators: %d is the count of reviews. */ (0,S._n)("%d review","%d reviews",t.details?.review_count||0,"woocommerce"),t.details?.review_count||0):(0,S.sprintf)(/* translators: %d is the count of products. */ /* translators: %d is the count of products. */ (0,S._n)("%d product","%d products",t.details?.count||0,"woocommerce"),t.details?.count||0);return(0,a.jsx)(oe,{className:(0,V.A)("woocommerce-product-categories__item","has-count",{"is-searching":o.length>0,"is-skip-level":0===r&&0!==t.parent}),...e,countLabel:s,"aria-label":n})},messages:m,isCompact:c,isHierarchical:!0,isSingle:l}),!!i&&(0,a.jsx)("div",{hidden:s.length<2,children:(0,a.jsx)(v.SelectControl,{className:"woocommerce-product-categories__operator",label:(0,S.__)("Display products matching","woocommerce"),help:(0,S.__)("Pick at least two categories to use this setting.","woocommerce"),value:n,onChange:i,options:[{label:(0,S.__)("Any selected categories","woocommerce"),value:"any"},{label:(0,S.__)("All selected categories","woocommerce"),value:"all"}]})})]})});var pe=o(4347);var he=o(923),be=o.n(he);const xe=(0,c.createHigherOrderComponent)(e=>{class t extends s.Component{state={error:null,loading:!1,variations:{},totalVariations:{}};componentDidMount(){const{selected:e,showVariations:t}=this.props;e&&t&&this.loadVariations()}componentDidUpdate(e){const{isLoading:t,selected:o,showVariations:r}=this.props;r&&(!be()(e.selected,o)||e.isLoading&&!t)&&this.loadVariations()}loadVariations=({offset:e=0}={})=>{const{products:t}=this.props,{loading:o,variations:r,totalVariations:a}=this.state;if(o)return;const i=this.getExpandedProduct();if(!i)return;if(!e&&r?.[i])return;if(r?.[i]&&a?.[i]&&r[i].length>=a[i])return;const n=t.find(e=>e.id===i);if(!n?.variations||0===n.variations.length)return void this.setState({variations:{...this.state.variations,[i]:null},loading:!1,error:null});this.setState({loading:!0});const s=this.state.variations[i]||[];((e,t={})=>m()({path:(0,l.addQueryArgs)("wc/store/v1/products",{type:"variation",parent:e,orderby:"title",per_page:25,...t}),parse:!1}).then(e=>e.json().then(t=>{const o=e.headers.get("x-wp-total");return{variations:t,total:o?Number(o):null}})))(i,{offset:e}).then(({variations:e,total:t})=>{const o=e.map(e=>({...e,parent:i}));this.setState({variations:{...this.state.variations,[i]:[...s,...o]},totalVariations:{...this.state.totalVariations,[i]:t},loading:!1,error:null})}).catch(async e=>{const t=await y(e);this.setState({variations:{...this.state.variations,[i]:null},totalVariations:{...this.state.totalVariations,[i]:null},loading:!1,error:t})})};isProductId(e){const{products:t}=this.props;return t.some(t=>t.id===e)}findParentProduct(e){const{products:t}=this.props,o=t.filter(t=>t.variations&&t.variations.find(({id:t})=>t===e));return o[0]?.id}getExpandedProduct(){const{isLoading:e,selected:t,showVariations:o}=this.props;if(!o)return null;let r=t&&t.length?t[0]:null;return r?this.prevSelectedItem=r:!this.prevSelectedItem||e||this.isProductId(this.prevSelectedItem)||(r=this.prevSelectedItem),!e&&r?this.isProductId(r)?r:this.findParentProduct(r):null}render(){const{error:t,isLoading:o}=this.props,{error:r,loading:i,variations:n,totalVariations:s}=this.state,c=this.getExpandedProduct(),l=c&&n[c]?.length||0;return(0,a.jsx)(e,{...this.props,error:r||t,onLoadMoreVariations:()=>this.loadVariations({offset:l}),expandedProduct:this.getExpandedProduct(),isLoading:o,totalVariations:s,variations:n,variationsLoading:i})}}return t},"withProductVariations");var we=o(1609);const _e=({className:e,item:t,isSelected:o,isLoading:r,onSelect:i,disabled:n,...s})=>(0,a.jsxs)(a.Fragment,{children:[(0,we.createElement)(oe,{...s,key:t.id,className:e,isSelected:o,item:t,onSelect:i,disabled:n}),o&&r&&(0,a.jsx)("div",{className:(0,V.A)("woocommerce-search-list__item","woocommerce-product-attributes__item","depth-1","is-loading","is-not-active"),children:(0,a.jsx)(v.Spinner,{})},"loading")]});o(5653);const ye={list:(0,S.__)("Products","woocommerce"),noItems:(0,S.__)("Your store doesn't have any products.","woocommerce"),search:(0,S.__)("Search for a product to display","woocommerce"),updated:(0,S.__)("Product search results updated.","woocommerce")},fe=(e=>t=>{let{selected:o}=t;o=void 0===o?null:o;const r=null===o;return Array.isArray(o)?(0,a.jsx)(e,{...t}):(0,a.jsx)(e,{...t,selected:r?[]:[o]})})((ke=xe((0,c.withInstanceId)(e=>{const{expandedProduct:t=null,error:o,instanceId:r,isCompact:i=!1,isLoading:n,onChange:s,onLoadMoreVariations:c,totalVariations:l,onSearch:d,products:m,renderItem:u,selected:g=[],showVariations:p=!1,variations:h,variationsLoading:b}=e;if(o)return(0,a.jsx)(z,{error:o});const x=[...m,...h&&t&&h[t]?h[t]:[]].map(I);return(0,a.jsx)(me,{className:"woocommerce-products",list:x,isCompact:i,isLoading:n,isSingle:!0,selected:x.filter(({id:e})=>g.includes(Number(e))),onChange:s,loadMoreChildrenText:p?(0,S.__)("Load more variations","woocommerce"):void 0,onLoadMoreChildren:p?c:void 0,totalChildren:p?l:void 0,renderItem:u||(p?e=>{const{item:t,search:o,depth:i=0,isSelected:s,onSelect:c}=e,l=t.details?.variations&&Array.isArray(t.details.variations)?t.details.variations.length:0,d=(0,V.A)("woocommerce-search-product__item","woocommerce-search-list__item",`depth-${i}`,"has-count",{"is-searching":o.length>0,"is-skip-level":0===i&&0!==t.parent,"is-variable":l>0});if(!t.breadcrumbs.length){const o=t.details?.variations&&t.details.variations.length>0;return(0,a.jsx)(_e,{...e,className:(0,V.A)(d,{"is-selected":s}),isSelected:s,item:t,onSelect:()=>()=>{c(t)()},isLoading:n||b,countLabel:o?(0,S.sprintf)(/* translators: %1$d is the number of variations of a product product. */ /* translators: %1$d is the number of variations of a product product. */ (0,S.__)("%1$d variations","woocommerce"),t.details?.variations.length):null,name:`products-${r}`,"aria-label":o?(0,S.sprintf)(/* translators: %1$s is the product name, %2$d is the number of variations of that product. */ /* translators: %1$s is the product name, %2$d is the number of variations of that product. */ (0,S._n)("%1$s, has %2$d variation","%1$s, has %2$d variations",t.details?.variations?.length,"woocommerce"),t.name,t.details?.variations.length):void 0})}const m=(0,L.isEmpty)(t.details?.variation)?e:{...e,item:{...e.item,name:t.details?.variation},"aria-label":`${t.breadcrumbs[0]}: ${t.details?.variation}`};return(0,a.jsx)(oe,{...m,className:d,name:`variations-${r}`})}:void 0),onSearch:d,messages:{...ye,...e.messages},isHierarchical:!0})})),({selected:e,...t})=>{const[o,r]=(0,s.useState)(!0),[i,n]=(0,s.useState)(null),[c,l]=(0,s.useState)([]),d=g.productCount>100,m=async e=>{const t=await y(e);n(t),r(!1)},u=(0,s.useRef)(e);(0,s.useEffect)(()=>{_({selected:u.current}).then(e=>{l(e),r(!1)}).catch(m)},[u]);const p=(0,pe.YQ)(t=>{_({selected:e,search:t}).then(e=>{l(e),r(!1)}).catch(m)},400),h=(0,s.useCallback)(e=>{r(!0),p(e)},[r,p]);return(0,a.jsx)(ke,{...t,selected:e,error:i,products:c,isLoading:o,onSearch:d?h:null})})),ve=window.wp.data,Se=window.wp.coreData,je=window.wc.wcBlocksSharedContext;var ke,Ie=o(7356);const Ce=window.wp.styleEngine;function Ee(e={}){const t={};return(0,Ce.getCSSRules)(e,{selector:""}).forEach(e=>{t[e.key]=e.value}),t}function Ne(e,t){return e&&t?`has-${(0,Ie.c)(t)}-${e}`:""}const Ae=e=>{const t=(e=>{const t=(0,L.isObject)(e)?e:{style:{}};let o=t.style;return(0,L.isString)(o)&&(o=JSON.parse(o)||{}),(0,L.isObject)(o)||(o={}),{...t,style:o}})(e),o=function(e){const{backgroundColor:t,textColor:o,gradient:r,style:a}=e,i=Ne("background-color",t),n=Ne("color",o),s=function(e){if(e)return`has-${e}-gradient-background`}(r),c=s||a?.color?.gradient;return{className:(0,V.A)(n,s,{[i]:!c&&!!i,"has-text-color":o||a?.color?.text,"has-background":t||a?.color?.background||r||a?.color?.gradient,"has-link-color":(0,L.isObject)(a?.elements?.link)?a?.elements?.link?.color:void 0}),style:Ee({color:a?.color||{}})}}(t),r=function(e){const t=e.style?.border||{};return{className:function(e){const{borderColor:t,style:o}=e,r=t?Ne("border-color",t):"";return(0,V.A)({"has-border-color":!!t||!!o?.border?.color,[r]:!!r})}(e),style:Ee({border:t})}}(t),a=function(e){return{className:void 0,style:Ee({spacing:e.style?.spacing||{}})}}(t),i=(e=>{const t=(0,L.isObject)(e.style.typography)?e.style.typography:{},o=(0,L.isString)(t.fontFamily)?t.fontFamily:"";return{className:e.fontFamily?`has-${e.fontFamily}-font-family`:o,style:{fontSize:e.fontSize?`var(--wp--preset--font-size--${e.fontSize})`:t.fontSize,fontStyle:t.fontStyle,fontWeight:t.fontWeight,letterSpacing:t.letterSpacing,lineHeight:t.lineHeight,textDecoration:t.textDecoration,textTransform:t.textTransform}}})(t);return{className:(0,V.A)(i.className,o.className,r.className,a.className),style:{...i.style,...o.style,...r.style,...a.style}}},Pe=({className:e="",onResize:t,...o})=>{const[r,i]=(0,s.useState)(!1),n=(0,V.A)(e,{"is-resizing":r}),c=(0,pe.dh)((e,o,a,n)=>{r||i(!0),t?.(e,o,a,n)},50,{leading:!0});return(0,a.jsx)(v.ResizableBox,{className:n,enable:{bottom:!0},onResize:c,onResizeStop:(...e)=>{t?.(...e),i(!1)},...o})},Re={icon:i,label:(0,S.__)("Featured Category","woocommerce")},Le={...Re,cropLabel:(0,S.__)("Edit category image","woocommerce"),editLabel:(0,S.__)("Edit selected category","woocommerce")},Te={...Re,emptyMessage:(0,S.__)("No product category is selected.","woocommerce"),noSelectionButtonLabel:(0,S.__)("Select a category","woocommerce")},Fe={...Re,description:(0,S.__)("Visually highlight a product category and encourage prompt action.","woocommerce"),editLabel:(0,S.__)("Showing Featured Product block preview.","woocommerce")},Oe=(0,c.compose)([f,v.withSpokenMessages,e=>t=>{const[o,r]=(0,s.useState)(!1),{category:i,clientId:n,editMode:c,product:l}=t,d=i||l,m=d?.link||d?.permalink,u=(0,ve.useSelect)(e=>e("core/block-editor").getBlock(n),[n]),g=e=>{if(!e)return;if("core/button"===e.name)return e;const t=e.innerBlocks||[];for(const e of t){const t=g(e);if(t)return t}},p=u?.innerBlocks?.[0],h=g(p),b=h?.clientId||"",x=(0,s.useMemo)(()=>h?.attributes||{},[h]),{url:w}=x,{updateBlockAttributes:_}=(0,ve.useDispatch)("core/block-editor");return(0,s.useEffect)(()=>{o&&b&&!c&&m&&w&&m!==w&&(_(b,{url:m}),r(!1))},[b,o,c,m,_,w]),(0,a.jsx)(e,{...t,triggerUrlUpdate:()=>r(!0)})},e=>t=>{const[o,r]=(0,s.useState)(!1),{isSelected:i}=t;return(0,s.useEffect)(()=>{r(!1)},[i]),(0,a.jsx)(e,{...t,useEditingImage:[o,r]})},(({description:e,editLabel:t,icon:o,label:r})=>i=>n=>{const{attributes:c,debouncedSpeak:l,name:d,setAttributes:m,triggerUrlUpdate:u=()=>{},error:g}=n,p=W(d),[h,b]=(0,s.useState)(),x=d===A&&c.productId||d===N&&c.categoryId,[w,_]=(0,s.useState)(!x),y=d===A?c?.productId:c?.categoryId,{status:f,isDeleted:j,isLoading:k}=(({itemId:e,itemType:t})=>{const{product:o,isResolutionFinished:r}=(a=e,(0,ve.useSelect)(e=>{if(!a)return{product:void 0,isResolving:!1};const t="string"==typeof a?parseInt(a,10):a;return{product:e(Se.store).getEditedEntityRecord("root","product",t),isResolving:e(Se.store).isResolving("getEditedEntityRecord",["root","product",t]),isResolutionFinished:e(Se.store).hasFinishedResolution("getEditedEntityRecord",["root","product",t])}},[a]));var a;return(0,ve.useSelect)(a=>{if(!e)return{status:null,isDeleted:!1,isLoading:!1};if(t===A){const e=!r,t="trash"===o?.status||!e&&!o;return{status:o?.status??null,isDeleted:t,isLoading:e}}if(t===N){const{getEntityRecords:t,hasFinishedResolution:o}=a(Se.store),r=["taxonomy","product_cat",{include:[e]}],i=t(...r),n=o("getEntityRecords",r),s=!i?.length;return{status:s?"deleted":null,isDeleted:s,isLoading:!n}}return{status:null,isDeleted:!0,isLoading:!1}},[e,t,o,r])})({itemId:y,itemType:d});return(0,s.useEffect)(()=>{if(!k){const e=d===A&&"publish"!==f||j;e&&_(e)}},[f,j,d,k]),w?(0,a.jsxs)(v.Placeholder,{icon:(0,a.jsx)(v.Icon,{icon:o}),label:r,className:p,children:[(0,a.jsxs)(v.__experimentalHStack,{alignment:"center",children:[j?(0,a.jsx)(v.Icon,{icon:J.A,className:"wc-blocks-featured-items__orange-info-icon"}):(0,a.jsx)(v.Icon,{icon:J.A}),(0,a.jsx)(v.__experimentalText,{children:j?q(d):e})]}),(0,a.jsxs)("div",{className:`${p}__selection`,children:[d===N&&(0,a.jsx)(ge,{selected:h?.categoryId?[h.categoryId]:[],onChange:(e=[])=>{const t=e[0]?e[0].id:0;b({categoryId:t,mediaId:0,mediaSrc:""}),u()},isSingle:!0}),d===A&&(0,a.jsx)(fe,{selected:h?.productId?[h.productId]:[],showVariations:!0,onChange:(e=[])=>{const t=e[0]?e[0].id:0;b({productId:t,mediaId:0,mediaSrc:""}),u()}}),(0,a.jsx)(v.Button,{variant:"primary",onClick:()=>{h&&(m(h),_(!1),l(t))},children:(0,S.__)("Done","woocommerce")})]})]}):(0,a.jsx)(i,{...n,isLoading:k,error:k?null:g,useEditMode:[w,_]})})(Fe),(({emptyMessage:e,icon:t,label:o,noSelectionButtonLabel:r})=>i=>n=>{const[c]=n.useEditingImage,[,l]=n.useEditMode,{attributes:d,category:m,isLoading:u,isSelected:g,name:p,product:h,setAttributes:b}=n,{mediaId:x,mediaSrc:w,isRepeated:_,imageFit:y}=d,f=m||h,[k,I]=(0,s.useState)({}),{backgroundImageSrc:C,isImageBgTransparent:E,originalImgDimension:N}=F({item:f,mediaId:x,mediaSrc:w,blockName:p}),A=(0,s.useRef)(null),[L,T]=(0,s.useState)({height:0,width:0});(0,s.useEffect)(()=>{const e=new ResizeObserver(e=>{T({height:e[0].contentRect.height,width:e[0].contentRect.width})});if(!1===u){const t=A.current;if(!t)return;e.observe(t)}return()=>e.disconnect()},[u]);const O=(0,s.useMemo)(()=>(({isImageBgTransparent:e,originalImgDimension:t,parentContainerDimension:o,isRepeated:r,imageFit:a})=>e?{isBackgroundVisible:!0,message:null}:e||!r&&"cover"!==a?!e&&t.height>=o.height&&t.width>=o.width?{isBackgroundVisible:!1,message:(0,S.__)("You've set background color to an opaque image, the background color cannot be seen.","woocommerce")}:(t.height{b({minHeight:parseInt(o.style.height,10)})},[b]),$=Ae(d);return c?(0,a.jsx)(i,{...n,backgroundImageSize:k,backgroundColorVisibilityStatus:O}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i,{...n,backgroundImageSize:k,backgroundColorVisibilityStatus:O}),f?(()=>{const{contentAlign:e,dimRatio:t,focalPoint:o,hasParallax:r,minHeight:i,overlayColor:n,overlayGradient:s,style:c,textColor:l}=d,p=(0,V.A)(B,{"is-selected":g&&"preview"!==d.categoryId&&"preview"!==d.productId,"is-loading":!f&&u,"is-not-found":!f&&!u,"has-background-dim":0!==t,"is-repeated":_},0===(b=t)||50===b?null:"has-background-dim-"+10*Math.round(b/10),"center"!==e&&`has-${e}-content`,$.className);var b;const x={borderRadius:c?.border?.radius,color:l?`var(--wp--preset--color--${l})`:c?.color?.text,boxSizing:"border-box",minHeight:i,...$.style},w=!_&&!r,v=function({focalPoint:e,imageFit:t,isImgElement:o,isRepeated:r,url:a}){let i={};var n;return i=o?{...i,...(n=e,n?{objectPosition:U(n)}:{}),objectFit:t}:{...i,...a&&{backgroundImage:`url(${a})`},backgroundPosition:U(e),...!r&&{backgroundRepeat:"no-repeat",backgroundSize:"cover"===t?t:"auto"}},i}({focalPoint:o,imageFit:y,isImgElement:w,isRepeated:_,url:C}),S={background:s,backgroundColor:n};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Pe,{enable:{bottom:!0},onResize:M,showHandle:g,style:{minHeight:i}}),(0,a.jsx)("div",{className:p,ref:A,style:x,children:(0,a.jsxs)("div",{className:`${B}__wrapper`,children:[(0,a.jsx)("div",{className:"background-dim__overlay",style:S}),C&&(w?(0,a.jsx)("img",{alt:f.name,className:`${B}__background-image`,src:C,style:v,onLoad:e=>{I({height:e.currentTarget?.naturalHeight,width:e.currentTarget?.naturalWidth})}}):(0,a.jsx)("div",{className:(0,V.A)(`${B}__background-image`,{"has-parallax":r}),style:v})),h?(0,a.jsx)(j.BlockContextProvider,{value:{postId:h.id,postType:"product"},children:(0,a.jsx)(je.ProductDataContextProvider,{product:h,isLoading:u,children:(0,a.jsx)("div",{className:`${B}__inner-blocks`,children:(0,a.jsx)(j.InnerBlocks,{template:R(h),templateLock:!1})})})}):(0,a.jsx)(j.BlockContextProvider,{value:{termId:m.term_id,termTaxonomy:"product_cat"},children:(0,a.jsx)("div",{className:`${B}__inner-blocks`,children:(0,a.jsx)(j.InnerBlocks,{template:P(m),templateLock:!1})})})]})})]})})():(0,a.jsx)(v.Placeholder,{className:B,icon:(0,a.jsx)(v.Icon,{icon:t}),label:o,children:u?(0,a.jsx)(v.Spinner,{}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:e}),(0,a.jsx)("div",{style:{flexBasis:"100%",height:"0"}}),(0,a.jsx)("button",{type:"button",className:"components-button is-secondary",onClick:()=>l(!0),children:r})]})})]})})(Te),e=>t=>{const{error:o,isLoading:r,name:i}=t,n=W(i),s=i===N?t.getCategory:t.getProduct;return o?(0,a.jsx)(H,{className:`${n}-error`,error:o,isLoading:r,onRetry:s}):(0,a.jsx)(e,{...t})},e=>t=>{const[o,r]=t.useEditingImage,i=(0,s.useRef)(null),{attributes:n,backgroundImageSize:c,name:l,setAttributes:d}=t,{mediaId:m,mediaSrc:u}=n,g=l===A?t.product:t.category,{backgroundImageId:p,backgroundImageSrc:h}=F({item:g,mediaId:m,mediaSrc:u,blockName:l});return o?(0,a.jsx)("div",{ref:i,children:(0,a.jsx)(B,{align:n.align,backgroundImageId:p,backgroundImageSize:c,backgroundImageSrc:h,containerRef:i,isEditingImage:o,setAttributes:d,setIsEditingImage:r})}):(0,a.jsx)(e,{...t})},e=>t=>{const{attributes:o,backgroundColorVisibilityStatus:r,clientId:i,name:n,setAttributes:s}=t,{alt:c,dimRatio:l,focalPoint:d,hasParallax:m,isRepeated:u,imageFit:g,mediaId:p,mediaSrc:h,overlayColor:b,overlayGradient:x,backgroundColor:w,style:_}=o,y=n===A?t.product:t.category,{setGradient:f}=(0,j.__experimentalUseGradient)({gradientAttribute:"overlayGradient",customGradientAttribute:"overlayGradient"}),{backgroundImageSrc:v}=F({item:y,mediaId:p,mediaSrc:h,blockName:n});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(M,{alt:c,backgroundImageSrc:v,dimRatio:l,focalPoint:d,hasParallax:m,isRepeated:u,imageFit:g,overlayColor:b,overlayGradient:x,setAttributes:s,setGradient:f,backgroundColorVisibilityStatus:r,backgroundColor:w||_?.color?.background,clientId:i}),(0,a.jsx)(e,{...t})]})},(({cropLabel:e,editLabel:t})=>o=>r=>{const[i,n]=r.useEditingImage,[s,c]=r.useEditMode,{attributes:l,category:d,name:m,product:u,setAttributes:g}=r,{contentAlign:p,mediaId:h,mediaSrc:b}=l,x=d||u,{backgroundImageId:w,backgroundImageSrc:_}=F({item:x,mediaId:h,mediaSrc:b,blockName:m});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(O,{backgroundImageId:w,backgroundImageSrc:_,contentAlign:p,cropLabel:e,editLabel:t,editMode:s,isEditingImage:i,mediaSrc:b,setAttributes:g,setIsEditingImage:n,setEditMode:c}),(0,a.jsx)(o,{...r})]})})(Le)])(()=>(0,a.jsx)(a.Fragment,{})),Be=JSON.parse('{"name":"woocommerce/featured-category","title":"Featured Category","category":"woocommerce","keywords":["WooCommerce"],"description":"Visually highlight a product category and encourage prompt action.","supports":{"interactivity":{"clientNavigation":true},"align":["wide","full"],"ariaLabel":true,"color":{"background":true,"text":true},"html":false,"filter":{"duotone":true},"spacing":{"padding":true,"__experimentalDefaultControls":{"padding":true},"__experimentalSkipSerialization":true},"__experimentalBorder":{"color":true,"radius":true,"width":true,"__experimentalDefaultControls":{"color":true,"radius":true,"width":true},"__experimentalSkipSerialization":true}},"attributes":{"alt":{"type":"string","default":""},"contentAlign":{"type":"string","default":"center"},"dimRatio":{"type":"number","default":50},"focalPoint":{"type":"object","default":{"x":0.5,"y":0.5}},"imageFit":{"type":"string","default":"none"},"hasParallax":{"type":"boolean","default":false},"isRepeated":{"type":"boolean","default":false},"mediaId":{"type":"number","default":0},"mediaSrc":{"type":"string","default":""},"minHeight":{"type":"number","default":500},"linkText":{"default":"Shop now","type":"string"},"categoryId":{"type":"number"},"overlayColor":{"type":"string","default":"#000000"},"overlayGradient":{"type":"string"},"previewCategory":{"type":"object","default":null}},"selectors":{"filter":{"duotone":".wp-block-woocommerce-featured-category .wc-block-featured-category__background-image"}},"textdomain":"woocommerce","apiVersion":3,"$schema":"https://schemas.wp.org/trunk/block.json","usesContext":["termId","termTaxonomy"],"providesContext":{"termId":"categoryId","termTaxonomy":"termTaxonomy"}}'),Me=window.wp.blocks;function $e(e){return function(t){const o=(0,j.useBlockProps)(),{color:r,...i}=o.style;return(0,a.jsx)("div",{...o,style:i,children:(0,a.jsx)(e,{...t})})}}!function(e,t,o,r){const i={attributes:{...o.attributes,minHeight:{type:"number",default:(0,u.getSetting)("defaultHeight",500)}},supports:{...o.supports,color:{background:o.supports?.color?.background,text:o.supports?.color?.text},spacing:{padding:o.supports?.spacing?.padding,__experimentalDefaultControls:{padding:o.supports?.spacing?.__experimentalDefaultControls},__experimentalSkipSerialization:o.supports?.spacing?.__experimentalSkipSerialization},__experimentalBorder:o?.supports?.__experimentalBorder}},n={attributes:{alt:"",contentAlign:"center",dimRatio:50,hasParallax:!1,isRepeated:!1,height:(0,u.getSetting)("defaultHeight",500),mediaSrc:"",overlayColor:"#000000",showDesc:!0}};(0,Me.registerBlockType)(o,{...i,example:{...n,...t},edit:$e(e),save:()=>(0,a.jsx)(j.InnerBlocks.Content,{}),...r})}(Oe,{attributes:{categoryId:"preview",previewCategory:{id:1,name:(0,S.__)("Clothing","woocommerce"),slug:"clothing",parent:0,count:10,description:`

${(0,S.__)("Branded t-shirts, jumpers, pants and more!","woocommerce")}

\n`,image:{id:1,date_created:"2019-07-15T17:05:04",date_created_gmt:"2019-07-15T17:05:04",date_modified:"2019-07-15T17:05:04",date_modified_gmt:"2019-07-15T17:05:04",src:p+"previews/collection.jpg",name:"",alt:""},permalink:"#"}}},Be,{deprecated:[{attributes:{...Be.attributes,showDesc:{type:"boolean",default:!0}},save:()=>(0,a.jsx)(j.InnerBlocks.Content,{}),isEligible:e=>"boolean"==typeof e.editMode,migrate:(e,t)=>{const{editMode:o,showDesc:r,...a}=e,i="16px";return r&&t.unshift((0,Me.createBlock)("woocommerce/category-description",{textAlign:"center",style:{padding:{bottom:i}}})),t.unshift((0,Me.createBlock)("woocommerce/category-title",{level:2,isLink:!1,textAlign:"center",style:{padding:{bottom:i}}})),[a,t]}}],icon:{src:(0,a.jsx)(n.A,{icon:i,className:"wc-block-editor-components-block-icon"})}})},1117:()=>{},9926:()=>{},3120:()=>{},6982:()=>{},5653:()=>{},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},923:e=>{"use strict";e.exports=window.wp.isShallowEqual},5573:e=>{"use strict";e.exports=window.wp.primitives}},a={};function i(e){var t=a[e];if(void 0!==t)return t.exports;var o=a[e]={exports:{}};return r[e](o,o.exports,i),o.exports}i.m=r,e=[],i.O=(t,o,r,a)=>{if(!o){var n=1/0;for(d=0;d=a)&&Object.keys(i.O).every(e=>i.O[e](o[c]))?o.splice(c--,1):(s=!1,a0&&e[d-1][2]>a;d--)e[d]=e[d-1];e[d]=[o,r,a]},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 a=Object.create(null);i.r(a);var n={};t=t||[null,o({}),o([]),o(o)];for(var s=2&r&&e;"object"==typeof s&&!~t.indexOf(s);s=o(s))Object.getOwnPropertyNames(s).forEach(t=>n[t]=()=>e[t]);return n.default=()=>e,i.d(a,n),a},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=9918,(()=>{var e={9918:0};i.O.j=t=>0===e[t];var t=(t,o)=>{var r,a,[n,s,c]=o,l=0;if(n.some(t=>0!==e[t])){for(r in s)i.o(s,r)&&(i.m[r]=s[r]);if(c)var d=c(i)}for(t&&t(o);li(3847));n=i.O(n),((this.wc=this.wc||{}).blocks=this.wc.blocks||{})["featured-category"]=n})();