File: /home/h340499/public_html/wp-content/plugins/woocommerce/assets/client/blocks/featured-product.js
(()=>{var e,t,r,o={3367:(e,t,r)=>{"use strict";var o=r(4530),s=r(2108),i=(r(6388),r(210),r(6087)),a=r(9491);const n=window.wp.url,c=window.wp.apiFetch;var l=r.n(c);const d=window.wc.wcSettings,u=(0,d.getSetting)("wcBlocksConfig",{pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),m=u.pluginUrl+"assets/images/",g=(u.pluginUrl,d.STORE_PAGES.shop,d.STORE_PAGES.checkout,d.STORE_PAGES.checkout,d.STORE_PAGES.privacy,d.STORE_PAGES.privacy,d.STORE_PAGES.terms,d.STORE_PAGES.terms,d.STORE_PAGES.cart,d.STORE_PAGES.cart,d.STORE_PAGES.myaccount?.permalink?d.STORE_PAGES.myaccount.permalink:(0,d.getSetting)("wpLoginUrl","/wp-login.php"),(0,d.getSetting)("localPickupEnabled",!1),(0,d.getSetting)("shippingMethodsExist",!1),(0,d.getSetting)("shippingEnabled",!0),(0,d.getSetting)("countries",{})),p=(0,d.getSetting)("countryData",{}),h={...Object.fromEntries(Object.keys(p).filter((e=>!0===p[e].allowBilling)).map((e=>[e,g[e]||""]))),...Object.fromEntries(Object.keys(p).filter((e=>!0===p[e].allowShipping)).map((e=>[e,g[e]||""])))},b=(Object.fromEntries(Object.keys(h).map((e=>[e,p[e].states||{}]))),Object.fromEntries(Object.keys(h).map((e=>[e,p[e].locale||{}]))),{address:["first_name","last_name","company","address_1","address_2","city","postcode","country","state","phone"],contact:["email"],order:[]}),w=((0,d.getSetting)("addressFieldsLocations",b).address,(0,d.getSetting)("addressFieldsLocations",b).contact,(0,d.getSetting)("addressFieldsLocations",b).order,(0,d.getSetting)("additionalOrderFields",{}),(0,d.getSetting)("additionalContactFields",{}),(0,d.getSetting)("additionalAddressFields",{}),(e,t)=>{const r=new Map;return e.filter((e=>{const o=t(e);return!r.has(o)&&(r.set(o,e),!0)}))}),_=({selected:e=[],search:t="",queryArgs:r={}})=>{const o=(({selected:e=[],search:t="",queryArgs:r={}})=>{const o=u.productCount>100&&e.length>0,s=[(0,n.addQueryArgs)("/wc/store/v1/products",{per_page:100,catalog_visibility:"any",search:t,orderby:"title",order:"asc",exclude:o?e:[],...r})];if(o){const t=Math.ceil(e.length/100);for(let r=1;r<=t;r++)s.push((0,n.addQueryArgs)("/wc/store/v1/products",{catalog_visibility:"any",include:e,per_page:100,page:r}))}return s})({selected:e,search:t,queryArgs:r});return Promise.all(o.map((e=>l()({path:e})))).then((e=>{const t=e.flat(),r=w(t,(e=>e.id));return r.map((e=>({...e,parent:0})))})).catch((e=>{throw e}))},x=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"}}};var f=r(790);const y=(0,a.createHigherOrderComponent)((e=>class extends i.Component{state={error:null,loading:!1,product:"preview"===this.props.attributes.productId?this.props.attributes.previewProduct:null};componentDidMount(){this.loadProduct()}componentDidUpdate(e){e.attributes.productId!==this.props.attributes.productId&&this.loadProduct()}loadProduct=()=>{const{productId:e}=this.props.attributes;"preview"!==e&&(e?(this.setState({loading:!0}),(e=>l()({path:`/wc/store/v1/products/${e}`}))(e).then((e=>{this.setState({product:e,loading:!1,error:null})})).catch((async e=>{const t=await x(e);this.setState({product:null,loading:!1,error:t})}))):this.setState({product:null,loading:!1,error:null}))};render(){const{error:t,loading:r,product:o}=this.state;return(0,f.jsx)(e,{...this.props,error:t,getProduct:this.loadProduct,isLoading:r,product:o})}}),"withProduct"),v=window.wp.components;var S=r(7723);const j=window.wp.blockEditor;var k=r(3462);const I=e=>{const{id:t,name:r,parent:o}=e;return{id:t,name:r,parent:o,breadcrumbs:[],children:[],details:e,value:e.slug}},C=e=>{const{id:t,name:r,parent:o,count:s}=e;return{id:t,name:r,parent:o,count:s,breadcrumbs:[],children:[],details:e,value:e.slug}},E=`${JSON.parse('{"name":"woocommerce/product-collection"}').name}/product-title`,P="woocommerce/featured-category",A="woocommerce/featured-product",N=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 F(e){return!!e&&(0,L.isNumber)(e.id)&&"string"==typeof e.src}function O({blockName:e,item:t,mediaId:r,mediaSrc:o}){const[s,a]=(0,i.useState)(0),[n,c]=(0,i.useState)(""),[l,d]=(0,i.useState)(!1),[u,m]=(0,i.useState)({height:0,width:0}),g=(0,i.useRef)(null),p=(0,i.useRef)(null);return(0,i.useEffect)((()=>{var o,s;a(r||(e===A?(s=t)&&s.images&&s.images.length&&s.images[0].id||0:(o=t)&&F(o.image)?o.image.id:0))}),[e,t,r]),(0,i.useEffect)((()=>{var r,s;c(o||(e===A?(s=t)&&s.images&&s.images.length&&s.images[0].src||"":(r=t)&&F(r.image)?r.image.src:""))}),[e,t,o]),(0,i.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 r=e.naturalWidth,o=e.naturalHeight;null!==o&&null!==r&&m({height:o,width:r}),t.width=r,t.height=o;const s=t.getContext("2d",{willReadFrequently:!0});if(!s)return;s.drawImage(e,0,0,r,o);const i=s.getImageData(0,0,r,o).data,a=(()=>{for(let e=3;e<i.length;e+=4)if(i[e]<255)return!0;return!1})();l!==a&&d(a)}}else d(!0);return()=>{g.current&&(g.current.onload=null)}}),[n]),{backgroundImageId:s,backgroundImageSrc:n,isImageBgTransparent:l,originalImgDimension:u}}const T=({backgroundImageId:e,backgroundImageSrc:t,contentAlign:r,cropLabel:o,editLabel:s,editMode:i,isEditingImage:a,mediaSrc:n,setAttributes:c,setIsEditingImage:l,setEditMode:d})=>(0,f.jsxs)(j.BlockControls,{children:[(0,f.jsx)(j.AlignmentToolbar,{value:r,onChange:e=>{c({contentAlign:e})}}),(0,f.jsxs)(v.ToolbarGroup,{children:[t&&!a&&(0,f.jsx)(v.ToolbarButton,{onClick:()=>l(!0),icon:k.A,label:o}),(0,f.jsx)(j.MediaReplaceFlow,{mediaId:e,mediaURL:n,accept:"image/*",onSelect:e=>{c({mediaId:e.id,mediaSrc:e.url})},allowedTypes:["image"]}),e&&n?(0,f.jsx)(v.ToolbarButton,{onClick:()=>c({mediaId:0,mediaSrc:""}),children:(0,S.__)("Reset","woocommerce")}):null]}),(0,f.jsx)(v.ToolbarGroup,{controls:[{icon:"edit",title:s,onClick:()=>d(!i),isActive:i}]})]}),B=({align:e,backgroundImageId:t,backgroundImageSize:r,backgroundImageSrc:o,containerRef:s,isEditingImage:a,setAttributes:n,setIsEditingImage:c})=>{const l=function(e,t){const[r,o]=(0,i.useState)(),s=(0,i.useCallback)((()=>{o(e.current?.clientWidth)}),[e]);return(0,i.useEffect)(s,[s,...t]),(0,i.useEffect)((()=>{if(!e.current)return;const{defaultView:t}=e.current.ownerDocument;return t?(t.addEventListener("resize",s),()=>{t.removeEventListener("resize",s)}):void 0}),[e,s]),r}(s,[e]);return"function"==typeof j.__experimentalImageEditingProvider?(0,f.jsx)(j.__experimentalImageEditingProvider,{id:t,url:o,naturalHeight:r.height||500,naturalWidth:r.width||500,onSaveImage:({id:e,url:t})=>{n({mediaId:e,mediaSrc:t})},isEditing:a,onFinishEditing:()=>c(!1),children:(0,f.jsx)(j.__experimentalImageEditor,{url:o,height:r.height||500,width:r.width||500})}):(0,f.jsx)(j.__experimentalImageEditor,{id:t,url:o,height:r.height||500,width:r.width||500,naturalHeight:r.height,naturalWidth:r.width,onSaveImage:({id:e,url:t})=>{n({mediaId:e,mediaSrc:t})},onFinishEditing:()=>c(!1),clientWidth:l})},$=({alt:e,backgroundColor:t,backgroundColorVisibilityStatus:r,backgroundImageSrc:o,clientId:s,dimRatio:i,focalPoint:a,hasParallax:n,imageFit:c,isRepeated:l,overlayColor:d,overlayGradient:u,setAttributes:m,setGradient:g})=>{const p="function"==typeof v.FocalPointPicker,h=!l&&!n,b=(0,j.__experimentalUseMultipleOriginColorsAndGradients)();return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(j.InspectorControls,{children:!!o&&(0,f.jsx)(f.Fragment,{children:p&&(0,f.jsxs)(v.PanelBody,{title:(0,S.__)("Media settings","woocommerce"),children:[(0,f.jsx)(v.ToggleControl,{label:(0,S.__)("Fixed background","woocommerce"),checked:n,onChange:()=>{m({hasParallax:!n})}}),(0,f.jsx)(v.ToggleControl,{label:(0,S.__)("Repeated background","woocommerce"),checked:l,onChange:()=>{m({isRepeated:!l})}}),!l&&(0,f.jsxs)(v.__experimentalToggleGroupControl,{help:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("span",{style:{display:"block",marginBottom:"1em"},children:(0,S.__)("Select “Cover” to have the image automatically fit its container.","woocommerce")}),(0,f.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:c,onChange:e=>m({imageFit:e}),children:[(0,f.jsx)(v.__experimentalToggleGroupControlOption,{label:(0,S.__)("None","woocommerce"),value:"none"}),(0,f.jsx)(v.__experimentalToggleGroupControlOption
/* translators: "Cover" is a verb that indicates an image covering the entire container. */,{label:(0,S.__)("Cover","woocommerce"),value:"cover"})]}),(0,f.jsx)(v.FocalPointPicker,{label:(0,S.__)("Focal Point Picker","woocommerce"),url:o,value:a,onChange:e=>m({focalPoint:e})}),h&&(0,f.jsx)(v.TextareaControl,{label:(0,S.__)("Alt text (alternative text)","woocommerce"),value:e,onChange:e=>{m({alt:e})},help:(0,f.jsx)(f.Fragment,{children:(0,f.jsx)(v.ExternalLink,{href:"https://www.w3.org/WAI/tutorials/images/decision-tree",children:(0,S.__)("Describe the purpose of the image","woocommerce")})})})]})})},"inspector"),b.hasColorsOrGradients&&(0,f.jsxs)(j.InspectorControls,{group:"color",children:[!!o&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(j.__experimentalColorGradientSettingsDropdown,{__experimentalIsRenderedInSidebar:!0,settings:[{clearable:!0,colorValue:d,gradientValue:u,label:(0,S.__)("Overlay","woocommerce"),onColorChange:e=>m({overlayColor:e}),onGradientChange:e=>{g(e),m({overlayGradient:e})},isShownByDefault:!0,resetAllFilter:()=>({overlayColor:void 0,overlayGradient:void 0})}],panelId:s,...b}),(0,f.jsx)(v.__experimentalToolsPanelItem,{isShownByDefault:!0,hasValue:()=>50!==i,label:(0,S.__)("Overlay opacity","woocommerce"),onDeselect:()=>m({dimRatio:50}),panelId:s,resetAllFilter:()=>({dimRatio:50}),children:(0,f.jsx)(v.RangeControl,{required:!0,label:(0,S.__)("Overlay opacity","woocommerce"),max:100,min:0,onChange:e=>m({dimRatio:e}),step:10,value:i})})]}),!1===r?.isBackgroundVisible&&r?.message&&t&&(0,f.jsx)("div",{className:"image-bg-color-warning",children:(0,f.jsx)(v.Notice,{status:"warning",isDismissible:!1,children:r.message})})]})]})};var D=r(2098),M=r(4921);const G=window.wp.escapeHtml,z=({message:e,type:t})=>e?"general"===t?(0,f.jsxs)("span",{children:[(0,S.__)("The following error was returned","woocommerce"),(0,f.jsx)("br",{}),(0,f.jsx)("code",{children:(0,G.escapeHTML)(e)})]}):"api"===t?(0,f.jsxs)("span",{children:[(0,S.__)("The following error was returned from the API","woocommerce"),(0,f.jsx)("br",{}),(0,f.jsx)("code",{children:(0,G.escapeHTML)(e)})]}):e:(0,S.__)("An error has prevented the block from being updated.","woocommerce"),H=({error:e})=>(0,f.jsx)("div",{className:"wc-block-error-message",children:z(e)});r(3120);const V=({className:e="",error:t,isLoading:r=!1,onRetry:s})=>(0,f.jsxs)(v.Placeholder,{icon:(0,f.jsx)(o.A,{icon:D.A}),label:(0,S.__)("Sorry, an error occurred","woocommerce"),className:(0,M.A)("wc-block-api-error",e),children:[(0,f.jsx)(H,{error:t}),s&&(0,f.jsx)(f.Fragment,{children:r?(0,f.jsx)(v.Spinner,{}):(0,f.jsx)(v.Button,{variant:"secondary",onClick:s,children:(0,S.__)("Retry","woocommerce")})})]});function W(e){return e?`${Math.round(100*e.x)}% ${Math.round(100*e.y)}%`:""}function U(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=r(2624);function Y(e,t,r){const o=new Set(t.map((e=>e[r])));return e.filter((e=>!o.has(e[r])))}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 r=e.reduce(((e,t)=>{const r=t.parent||0;return e[r]||(e[r]=[]),e[r].push(t),e}),{}),o=t.reduce(((e,t)=>(e[String(t.id)]=t,e)),{});const s=["0"],i=(e={})=>e.parent?[...i(o[e.parent]),e.name]:e.name?[e.name]:[],a=e=>e.map((e=>{const t=r[e.id];return s.push(""+e.id),{...e,breadcrumbs:i(o[e.parent]),children:t&&t.length?a(t):[]}})),n=a(r[0]||[]);return Object.entries(r).forEach((([e,t])=>{s.includes(e)||n.push(...a(t||[]))})),n},Z=(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,f.jsx)("strong",{children:e},t):(0,f.jsx)(i.Fragment,{children:e},t)))},ee=({label:e})=>(0,f.jsx)("span",{className:"woocommerce-search-list__item-count",children:e}),te=e=>{const{item:t,search:r}=e,o=t.breadcrumbs&&t.breadcrumbs.length;return(0,f.jsxs)("span",{className:"woocommerce-search-list__item-label",children:[o?(0,f.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,f.jsx)("span",{className:"woocommerce-search-list__item-name",children:Z((0,Q.decodeEntities)(t.name),r)})]});var s},re=({countLabel:e,className:t,depth:r=0,controlId:o="",item:s,isSelected:a,isSingle:n,onSelect:c,search:l="",selected:d,useExpandedPanelId:u,...m})=>{const[g,p]=u,h=null!=e&&void 0!==s.count&&null!==s.count,b=!!s.breadcrumbs?.length,w=!!s.children?.length,_=g===s.id,x=(0,M.A)(["woocommerce-search-list__item",`depth-${r}`,t],{"has-breadcrumbs":b,"has-children":w,"has-count":h,"is-expanded":_,"is-radio-button":n});(0,i.useEffect)((()=>{w&&a&&p(s.id)}),[s,w,a,p]);const y=m.name||`search-list-item-${o}`,S=`${y}-${s.id}`,j=(0,i.useCallback)((()=>{p(_?-1:Number(s.id))}),[_,s.id,p]);return w?(0,f.jsx)("div",{className:x,onClick:j,onKeyDown:e=>"Enter"===e.key||" "===e.key?j():null,role:"treeitem",tabIndex:0,children:n?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("input",{type:"radio",id:S,name:y,value:s.value,onChange:c(s),onClick:e=>e.stopPropagation(),checked:a,className:"woocommerce-search-list__item-input",...m}),(0,f.jsx)(te,{item:s,search:l}),h?(0,f.jsx)(ee,{label:e||s.count}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(v.CheckboxControl,{className:"woocommerce-search-list__item-input",checked:a,...!a&&s.children.some((e=>d.find((t=>t.id===e.id))))?{indeterminate:!0}:{},label:Z((0,Q.decodeEntities)(s.name),l),onChange:()=>{a?c(Y(d,s.children,"id"))():c(function(e,t){const r=Y(t,e,"id");return[...e,...r]}(d,s.children))()},onClick:e=>e.stopPropagation()}),h?(0,f.jsx)(ee,{label:e||s.count}):null]})}):(0,f.jsxs)("label",{htmlFor:S,className:x,children:[n?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("input",{...m,type:"radio",id:S,name:y,value:s.value,onChange:c(s),checked:a,className:"woocommerce-search-list__item-input"}),(0,f.jsx)(te,{item:s,search:l})]}):(0,f.jsx)(v.CheckboxControl,{...m,id:S,name:y,className:"woocommerce-search-list__item-input",value:(0,Q.decodeEntities)(s.value),label:Z((0,Q.decodeEntities)(s.name),l),onChange:c(s),checked:a}),h?(0,f.jsx)(ee,{label:e||s.count}):null]})},oe=re;var se=r(3028);r(5022);const ie=({id:e,label:t,popoverContents:r,remove:s,screenReaderLabel:n,className:c=""})=>{const[l,d]=(0,i.useState)(!1),u=(0,a.useInstanceId)(ie);if(n=n||t,!t)return null;t=(0,Q.decodeEntities)(t);const m=(0,M.A)("woocommerce-tag",c,{"has-remove":!!s}),g=`woocommerce-tag__label-${u}`,p=(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("span",{className:"screen-reader-text",children:n}),(0,f.jsx)("span",{"aria-hidden":"true",children:t})]});return(0,f.jsxs)("span",{className:m,children:[r?(0,f.jsx)(v.Button,{className:"woocommerce-tag__text",id:g,onClick:()=>d(!0),children:p}):(0,f.jsx)("span",{className:"woocommerce-tag__text",id:g,children:p}),r&&l&&(0,f.jsx)(v.Popover,{onClose:()=>d(!1),children:r}),s&&(0,f.jsx)(v.Button,{className:"woocommerce-tag__remove",onClick:s(e),label:(0,S.sprintf)(
// Translators: %s label.
// Translators: %s label.
(0,S.__)("Remove %s","woocommerce"),t),"aria-describedby":g,children:(0,f.jsx)(o.A,{icon:se.A,size:20,className:"clear-icon",role:"img"})})]})},ae=ie;r(1939);const ne=e=>(0,f.jsx)(oe,{...e}),ce=e=>{const{list:t,selected:r,renderItem:o,depth:s=0,onSelect:a,instanceId:n,isSingle:c,search:l,useExpandedPanelId:d}=e,[u]=d;return t?(0,f.jsx)(f.Fragment,{children:t.map((t=>{const m=t.children?.length&&!c?t.children.every((({id:e})=>r.find((t=>t.id===e)))):!!r.find((({id:e})=>e===t.id)),g=t.children?.length&&u===t.id;return(0,f.jsxs)(i.Fragment,{children:[(0,f.jsx)("li",{children:o({item:t,isSelected:m,onSelect:a,isSingle:c,selected:r,search:l,depth:s,useExpandedPanelId:d,controlId:n})}),g?(0,f.jsx)(ce,{...e,list:t.children,depth:s+1}):null]},t.id)}))}):null},le=({isLoading:e,isSingle:t,selected:r,messages:o,onChange:s,onRemove:i})=>{if(e||t||!r)return null;const a=r.length;return(0,f.jsxs)("div",{className:"woocommerce-search-list__selected",children:[(0,f.jsxs)("div",{className:"woocommerce-search-list__selected-header",children:[(0,f.jsx)("strong",{children:o.selected(a)}),a>0?(0,f.jsx)(v.Button,{variant:"link",isDestructive:!0,onClick:()=>s([]),"aria-label":o.clear,children:(0,S.__)("Clear all","woocommerce")}):null]}),a>0?(0,f.jsx)("ul",{children:r.map(((e,t)=>(0,f.jsx)("li",{children:(0,f.jsx)(ae,{label:e.name,id:e.id,remove:i})},t)))}):null]})},de=({filteredList:e,search:t,onSelect:r,instanceId:s,useExpandedPanelId:i,...a})=>{const{messages:n,renderItem:c,selected:l,isSingle:d}=a,u=c||ne;return 0===e.length?(0,f.jsxs)("div",{className:"woocommerce-search-list__list is-not-found",children:[(0,f.jsx)("span",{className:"woocommerce-search-list__not-found-icon",children:(0,f.jsx)(o.A,{icon:J.A,role:"img"})}),(0,f.jsx)("span",{className:"woocommerce-search-list__not-found-text",children:t?(0,S.sprintf)(n.noResults,t):n.noItems})]}):(0,f.jsx)("ul",{className:"woocommerce-search-list__list",children:(0,f.jsx)(ce,{useExpandedPanelId:i,list:e,selected:l,renderItem:u,onSelect:r,instanceId:s,isSingle:d,search:t})})},ue=e=>{const{className:t="",isCompact:r,isHierarchical:o,isLoading:s,isSingle:n,list:c,messages:l=K,onChange:d,onSearch:u,selected:m,type:g="text",debouncedSpeak:p}=e,[h,b]=(0,i.useState)(""),w=(0,i.useState)(-1),_=(0,a.useInstanceId)(ue),x=(0,i.useMemo)((()=>({...K,...l})),[l]),y=(0,i.useMemo)((()=>((e,t,r)=>{if(!t)return r?X(e):e;const o=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),s=e.map((e=>!!o.test(e.name)&&e)).filter(Boolean);return r?X(s,e):s})(c,h,o)),[c,h,o]);(0,i.useEffect)((()=>{p&&p(x.updated)}),[p,x]),(0,i.useEffect)((()=>{"function"==typeof u&&u(h)}),[h,u]);const j=(0,i.useCallback)((e=>()=>{n&&d([]);const t=m.findIndex((({id:t})=>t===e));d([...m.slice(0,t),...m.slice(t+1)])}),[n,m,d]),k=(0,i.useCallback)((e=>()=>{Array.isArray(e)?d(e):-1===m.findIndex((({id:t})=>t===e.id))?d(n?[e]:[...m,e]):j(e.id)()}),[n,j,d,m]),I=(0,i.useCallback)((e=>{const[t]=m.filter((t=>!e.find((e=>t.id===e.id))));j(t.id)()}),[j,m]);return(0,f.jsxs)("div",{className:(0,M.A)("woocommerce-search-list",t,{"is-compact":r,"is-loading":s,"is-token":"token"===g}),children:["text"===g&&(0,f.jsx)(le,{...e,onRemove:j,messages:x}),(0,f.jsx)("div",{className:"woocommerce-search-list__search",children:"text"===g?(0,f.jsx)(v.TextControl,{label:x.search,type:"search",value:h,onChange:e=>b(e)}):(0,f.jsx)(v.FormTokenField,{disabled:s,label:x.search,onChange:I,onInputChange:e=>b(e),suggestions:[],__experimentalValidateInput:()=>!1,value:s?[(0,S.__)("Loading…","woocommerce")]:m.map((e=>({...e,value:e.name}))),__experimentalShowHowTo:!1})}),s?(0,f.jsx)("div",{className:"woocommerce-search-list__list",children:(0,f.jsx)(v.Spinner,{})}):(0,f.jsx)(de,{...e,search:h,filteredList:y,messages:x,onSelect:k,instanceId:_,useExpandedPanelId:w})]})},me=((0,v.withSpokenMessages)(ue),e=>({selected:t,...r})=>{const[o,s]=(0,i.useState)(!0),[a,c]=(0,i.useState)(null),[d,u]=(0,i.useState)([]),m=async e=>{const t=await x(e);c(t),s(!1)},g=(0,i.useRef)(t);return(0,i.useEffect)((()=>{var e;(e={selected:g.current},l()({path:(0,n.addQueryArgs)("wc/store/v1/products/categories",{per_page:0,...e})})).then((e=>{u(e),s(!1)})).catch(m)}),[g]),(0,f.jsx)(e,{...r,selected:t,error:a,categories:d,isLoading:o})});r(6982);const ge=me((({categories:e=[],error:t=null,isLoading:r=!1,onChange:o,onOperatorChange:s,operator:i="any",selected:a,isCompact:n=!1,isSingle:c=!1,showReviewCount:l})=>{const d={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,f.jsx)(H,{error:t});const u=e.map(C);return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(ue,{className:"woocommerce-product-categories",list:u,isLoading:r,selected:u.filter((({id:e})=>a.includes(Number(e)))),onChange:o,renderItem:e=>{const{item:t,search:r,depth:o=0}=e,s=t.breadcrumbs.length?`${t.breadcrumbs.join(", ")}, ${t.name}`:t.name,i=l?(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"),s,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"),s,t.details?.count||0),a=l?(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,f.jsx)(re,{className:(0,M.A)("woocommerce-product-categories__item","has-count",{"is-searching":r.length>0,"is-skip-level":0===o&&0!==t.parent}),...e,countLabel:a,"aria-label":i})},messages:d,isCompact:n,isHierarchical:!0,isSingle:c}),!!s&&(0,f.jsx)("div",{hidden:a.length<2,children:(0,f.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:i,onChange:s,options:[{label:(0,S.__)("Any selected categories","woocommerce"),value:"any"},{label:(0,S.__)("All selected categories","woocommerce"),value:"all"}]})})]})}));var pe=r(4347);var he=r(923),be=r.n(he);const we=(0,a.createHigherOrderComponent)((e=>{class t extends i.Component{state={error:null,loading:!1,variations:{}};componentDidMount(){const{selected:e,showVariations:t}=this.props;e&&t&&this.loadVariations()}componentDidUpdate(e){const{isLoading:t,selected:r,showVariations:o}=this.props;o&&(!be()(e.selected,r)||e.isLoading&&!t)&&this.loadVariations()}loadVariations=()=>{const{products:e}=this.props,{loading:t,variations:r}=this.state;if(t)return;const o=this.getExpandedProduct();if(!o||r[o])return;const s=e.find((e=>e.id===o));var i;s?.variations&&0!==s.variations.length?(this.setState({loading:!0}),(i=o,l()({path:(0,n.addQueryArgs)("wc/store/v1/products",{per_page:0,type:"variation",parent:i})})).then((e=>{const t=e.map((e=>({...e,parent:o})));this.setState({variations:{...this.state.variations,[o]:t},loading:!1,error:null})})).catch((async e=>{const t=await x(e);this.setState({variations:{...this.state.variations,[o]:null},loading:!1,error:t})}))):this.setState({variations:{...this.state.variations,[o]:null},loading:!1,error:null})};isProductId(e){const{products:t}=this.props;return t.some((t=>t.id===e))}findParentProduct(e){const{products:t}=this.props,r=t.filter((t=>t.variations&&t.variations.find((({id:t})=>t===e))));return r[0]?.id}getExpandedProduct(){const{isLoading:e,selected:t,showVariations:r}=this.props;if(!r)return null;let o=t&&t.length?t[0]:null;return o?this.prevSelectedItem=o:!this.prevSelectedItem||e||this.isProductId(this.prevSelectedItem)||(o=this.prevSelectedItem),!e&&o?this.isProductId(o)?o:this.findParentProduct(o):null}render(){const{error:t,isLoading:r}=this.props,{error:o,loading:s,variations:i}=this.state;return(0,f.jsx)(e,{...this.props,error:o||t,expandedProduct:this.getExpandedProduct(),isLoading:r,variations:i,variationsLoading:s})}}return t}),"withProductVariations");var _e=r(1609);const xe=({className:e,item:t,isSelected:r,isLoading:o,onSelect:s,disabled:i,...a})=>(0,f.jsxs)(f.Fragment,{children:[(0,_e.createElement)(re,{...a,key:t.id,className:e,isSelected:r,item:t,onSelect:s,disabled:i}),r&&o&&(0,f.jsx)("div",{className:(0,M.A)("woocommerce-search-list__item","woocommerce-product-attributes__item","depth-1","is-loading","is-not-active"),children:(0,f.jsx)(v.Spinner,{})},"loading")]});r(5653);const fe={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")},ye=(e=>t=>{let{selected:r}=t;r=void 0===r?null:r;const o=null===r;return Array.isArray(r)?(0,f.jsx)(e,{...t}):(0,f.jsx)(e,{...t,selected:o?[]:[r]})})((ke=we((0,a.withInstanceId)((e=>{const{expandedProduct:t=null,error:r,instanceId:o,isCompact:s=!1,isLoading:i,onChange:a,onSearch:n,products:c,renderItem:l,selected:d=[],showVariations:u=!1,variations:m,variationsLoading:g}=e;if(r)return(0,f.jsx)(H,{error:r});const p=[...c,...m&&t&&m[t]?m[t]:[]].map(I);return(0,f.jsx)(ue,{className:"woocommerce-products",list:p,isCompact:s,isLoading:i,isSingle:!0,selected:p.filter((({id:e})=>d.includes(Number(e)))),onChange:a,renderItem:l||(u?e=>{const{item:t,search:r,depth:s=0,isSelected:a,onSelect:n}=e,c=t.details?.variations&&Array.isArray(t.details.variations)?t.details.variations.length:0,l=(0,M.A)("woocommerce-search-product__item","woocommerce-search-list__item",`depth-${s}`,"has-count",{"is-searching":r.length>0,"is-skip-level":0===s&&0!==t.parent,"is-variable":c>0});if(!t.breadcrumbs.length){const r=t.details?.variations&&t.details.variations.length>0;return(0,f.jsx)(xe,{...e,className:(0,M.A)(l,{"is-selected":a}),isSelected:a,item:t,onSelect:()=>()=>{n(t)()},isLoading:i||g,countLabel:r?(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-${o}`,"aria-label":r?(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 d=(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,f.jsx)(re,{...d,className:l,name:`variations-${o}`})}:void 0),onSearch:n,messages:{...fe,...e.messages},isHierarchical:!0})}))),({selected:e,...t})=>{const[r,o]=(0,i.useState)(!0),[s,a]=(0,i.useState)(null),[n,c]=(0,i.useState)([]),l=u.productCount>100,d=async e=>{const t=await x(e);a(t),o(!1)},m=(0,i.useRef)(e);(0,i.useEffect)((()=>{_({selected:m.current}).then((e=>{c(e),o(!1)})).catch(d)}),[m]);const g=(0,pe.YQ)((t=>{_({selected:e,search:t}).then((e=>{c(e),o(!1)})).catch(d)}),400),p=(0,i.useCallback)((e=>{o(!0),g(e)}),[o,g]);return(0,f.jsx)(ke,{...t,selected:e,error:s,products:n,isLoading:r,onSearch:l?p:null})})),ve=window.wp.data,Se=window.wp.coreData,je=window.wc.wcBlocksSharedContext;var ke,Ie=r(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 Pe(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 r=t.style;return(0,L.isString)(r)&&(r=JSON.parse(r)||{}),(0,L.isObject)(r)||(r={}),{...t,style:r}})(e),r=function(e){const{backgroundColor:t,textColor:r,gradient:o,style:s}=e,i=Pe("background-color",t),a=Pe("color",r),n=function(e){if(e)return`has-${e}-gradient-background`}(o),c=n||s?.color?.gradient;return{className:(0,M.A)(a,n,{[i]:!c&&!!i,"has-text-color":r||s?.color?.text,"has-background":t||s?.color?.background||o||s?.color?.gradient,"has-link-color":(0,L.isObject)(s?.elements?.link)?s?.elements?.link?.color:void 0}),style:Ee({color:s?.color||{}})}}(t),o=function(e){const t=e.style?.border||{};return{className:function(e){const{borderColor:t,style:r}=e,o=t?Pe("border-color",t):"";return(0,M.A)({"has-border-color":!!t||!!r?.border?.color,[o]:!!o})}(e),style:Ee({border:t})}}(t),s=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:{},r=(0,L.isString)(t.fontFamily)?t.fontFamily:"";return{className:e.fontFamily?`has-${e.fontFamily}-font-family`:r,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,M.A)(i.className,r.className,o.className,s.className),style:{...i.style,...r.style,...o.style,...s.style}}},Ne=({className:e="",onResize:t,...r})=>{const[o,s]=(0,i.useState)(!1),a=(0,M.A)(e,{"is-resizing":o}),n=(0,pe.dh)(((e,r,i,a)=>{o||s(!0),t?.(e,r,i,a)}),50,{leading:!0});return(0,f.jsx)(v.ResizableBox,{className:a,enable:{bottom:!0},onResize:n,onResizeStop:(...e)=>{t?.(...e),s(!1)},...r})},Re={icon:s.A,label:(0,S.__)("Featured Product","woocommerce")},Le={...Re,cropLabel:(0,S.__)("Edit product image","woocommerce"),editLabel:(0,S.__)("Edit selected product","woocommerce")},Fe={...Re,emptyMessage:(0,S.__)("No product is selected.","woocommerce"),noSelectionButtonLabel:(0,S.__)("Select a product","woocommerce")},Oe={...Re,description:(0,S.__)("Highlight a product or variation.","woocommerce"),editLabel:(0,S.__)("Showing Featured Product block preview.","woocommerce")},Te=(0,a.compose)([y,v.withSpokenMessages,e=>t=>{const[r,o]=(0,i.useState)(!1),{category:s,clientId:a,editMode:n,product:c}=t,l=s||c,d=l?.link||l?.permalink,u=(0,ve.useSelect)((e=>e("core/block-editor").getBlock(a)),[a]),m=e=>{if(!e)return;if("core/button"===e.name)return e;const t=e.innerBlocks||[];for(const e of t){const t=m(e);if(t)return t}},g=u?.innerBlocks?.[0],p=m(g),h=p?.clientId||"",b=(0,i.useMemo)((()=>p?.attributes||{}),[p]),{url:w}=b,{updateBlockAttributes:_}=(0,ve.useDispatch)("core/block-editor");return(0,i.useEffect)((()=>{r&&h&&!n&&d&&w&&d!==w&&(_(h,{url:d}),o(!1))}),[h,r,n,d,_,w]),(0,f.jsx)(e,{...t,triggerUrlUpdate:()=>o(!0)})},e=>t=>{const[r,o]=(0,i.useState)(!1),{isSelected:s}=t;return(0,i.useEffect)((()=>{o(!1)}),[s]),(0,f.jsx)(e,{...t,useEditingImage:[r,o]})},(({description:e,editLabel:t,icon:r,label:o})=>s=>a=>{const{attributes:n,debouncedSpeak:c,name:l,setAttributes:d,triggerUrlUpdate:u=()=>{},error:m}=a,g=U(l),[p,h]=(0,i.useState)(),b=l===A&&n.productId||l===P&&n.categoryId,[w,_]=(0,i.useState)(!b),x=l===A?n?.productId:n?.categoryId,{status:y,isDeleted:j,isLoading:k}=(({itemId:e,itemType:t})=>{const{product:r,isResolutionFinished:o}=(s=e,(0,ve.useSelect)((e=>{if(!s)return{product:void 0,isResolving:!1};const t="string"==typeof s?parseInt(s,10):s;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])}}),[s]));var s;return(0,ve.useSelect)((s=>{if(!e)return{status:null,isDeleted:!1,isLoading:!1};if(t===A){var i;const e=!o,t="trash"===r?.status||!e&&!r;return{status:null!==(i=r?.status)&&void 0!==i?i:null,isDeleted:t,isLoading:e}}if(t===P){const{getEntityRecords:t,hasFinishedResolution:r}=s(Se.store),o=["taxonomy","product_cat",{include:[e]}],i=t(...o),a=r("getEntityRecords",o),n=!i?.length;return{status:n?"deleted":null,isDeleted:n,isLoading:!a}}return{status:null,isDeleted:!0,isLoading:!1}}),[e,t,r,o])})({itemId:x,itemType:l});return(0,i.useEffect)((()=>{if(!k){const e=l===A&&"publish"!==y||j;e&&_(e)}}),[y,j,l,k]),w?(0,f.jsxs)(v.Placeholder,{icon:(0,f.jsx)(v.Icon,{icon:r}),label:o,className:g,children:[(0,f.jsxs)(v.__experimentalHStack,{alignment:"center",children:[j?(0,f.jsx)(v.Icon,{icon:J.A,className:"wc-blocks-featured-items__orange-info-icon"}):(0,f.jsx)(v.Icon,{icon:J.A}),(0,f.jsx)(v.__experimentalText,{children:j?q(l):e})]}),(0,f.jsxs)("div",{className:`${g}__selection`,children:[l===P&&(0,f.jsx)(ge,{selected:p?.categoryId?[p.categoryId]:[],onChange:(e=[])=>{const t=e[0]?e[0].id:0;h({categoryId:t,mediaId:0,mediaSrc:""}),u()},isSingle:!0}),l===A&&(0,f.jsx)(ye,{selected:p?.productId?[p.productId]:[],showVariations:!0,onChange:(e=[])=>{const t=e[0]?e[0].id:0;h({productId:t,mediaId:0,mediaSrc:""}),u()}}),(0,f.jsx)(v.Button,{variant:"primary",onClick:()=>{p&&(d(p),_(!1),c(t))},children:(0,S.__)("Done","woocommerce")})]})]}):(0,f.jsx)(s,{...a,isLoading:k,error:k?null:m,useEditMode:[w,_]})})(Oe),(({emptyMessage:e,icon:t,label:r,noSelectionButtonLabel:o})=>s=>a=>{const[n]=a.useEditingImage,[,c]=a.useEditMode,{attributes:l,category:d,isLoading:u,isSelected:m,name:g,product:p,setAttributes:h}=a,{mediaId:b,mediaSrc:w,isRepeated:_,imageFit:x}=l,y=d||p,[k,I]=(0,i.useState)({}),{backgroundImageSrc:C,isImageBgTransparent:E,originalImgDimension:P}=O({item:y,mediaId:b,mediaSrc:w,blockName:g}),A=(0,i.useRef)(null),[L,F]=(0,i.useState)({height:0,width:0});(0,i.useEffect)((()=>{const e=new ResizeObserver((e=>{F({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 T=(0,i.useMemo)((()=>(({isImageBgTransparent:e,originalImgDimension:t,parentContainerDimension:r,isRepeated:o,imageFit:s})=>e?{isBackgroundVisible:!0,message:null}:e||!o&&"cover"!==s?!e&&t.height>=r.height&&t.width>=r.width?{isBackgroundVisible:!1,message:(0,S.__)("You've set background color to an opaque image, the background color cannot be seen.","woocommerce")}:(t.height<r.height||(t.width,r.width),{isBackgroundVisible:!0,message:null}):o?{isBackgroundVisible:!1,message:(0,S.__)("You’ve set a background color behind an image set to repeat, the background color cannot be seen.","woocommerce")}:{isBackgroundVisible:!1,message:(0,S.__)("You’ve set a background color behind an image set to cover, the background color cannot be seen.","woocommerce")})({isImageBgTransparent:E,originalImgDimension:P,parentContainerDimension:L,isRepeated:_,imageFit:x})),[L,P,_,x,E]),B=U(g),$=(0,i.useCallback)(((e,t,r)=>{h({minHeight:parseInt(r.style.height,10)})}),[h]),D=Ae(l);return n?(0,f.jsx)(s,{...a,backgroundImageSize:k,backgroundColorVisibilityStatus:T}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(s,{...a,backgroundImageSize:k,backgroundColorVisibilityStatus:T}),y?(()=>{const{contentAlign:e,dimRatio:t,focalPoint:r,hasParallax:o,minHeight:s,overlayColor:i,overlayGradient:a,style:n,textColor:c}=l,g=(0,M.A)(B,{"is-selected":m&&"preview"!==l.categoryId&&"preview"!==l.productId,"is-loading":!y&&u,"is-not-found":!y&&!u,"has-background-dim":0!==t,"is-repeated":_},0===(h=t)||50===h?null:"has-background-dim-"+10*Math.round(h/10),"center"!==e&&`has-${e}-content`,D.className);var h;const b={borderRadius:n?.border?.radius,color:c?`var(--wp--preset--color--${c})`:n?.color?.text,boxSizing:"border-box",minHeight:s,...D.style},w=!_&&!o,v=function({focalPoint:e,imageFit:t,isImgElement:r,isRepeated:o,url:s}){let i={};var a;return i=r?{...i,...(a=e,a?{objectPosition:W(a)}:{}),objectFit:t}:{...i,...s&&{backgroundImage:`url(${s})`},backgroundPosition:W(e),...!o&&{backgroundRepeat:"no-repeat",backgroundSize:"cover"===t?t:"auto"}},i}({focalPoint:r,imageFit:x,isImgElement:w,isRepeated:_,url:C}),S={background:a,backgroundColor:i};return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Ne,{enable:{bottom:!0},onResize:$,showHandle:m,style:{minHeight:s}}),(0,f.jsx)("div",{className:g,ref:A,style:b,children:(0,f.jsxs)("div",{className:`${B}__wrapper`,children:[(0,f.jsx)("div",{className:"background-dim__overlay",style:S}),C&&(w?(0,f.jsx)("img",{alt:y.name,className:`${B}__background-image`,src:C,style:v,onLoad:e=>{I({height:e.currentTarget?.naturalHeight,width:e.currentTarget?.naturalWidth})}}):(0,f.jsx)("div",{className:(0,M.A)(`${B}__background-image`,{"has-parallax":o}),style:v})),p?(0,f.jsx)(j.BlockContextProvider,{value:{postId:p.id,postType:"product"},children:(0,f.jsx)(je.ProductDataContextProvider,{product:p,isLoading:u,children:(0,f.jsx)("div",{className:`${B}__inner-blocks`,children:(0,f.jsx)(j.InnerBlocks,{template:R(p),templateLock:!1})})})}):(0,f.jsx)(j.BlockContextProvider,{value:{termId:d.term_id,termTaxonomy:"product_cat"},children:(0,f.jsx)("div",{className:`${B}__inner-blocks`,children:(0,f.jsx)(j.InnerBlocks,{template:N(d),templateLock:!1})})})]})})]})})():(0,f.jsx)(v.Placeholder,{className:B,icon:(0,f.jsx)(v.Icon,{icon:t}),label:r,children:u?(0,f.jsx)(v.Spinner,{}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("p",{children:e}),(0,f.jsx)("div",{style:{flexBasis:"100%",height:"0"}}),(0,f.jsx)("button",{type:"button",className:"components-button is-secondary",onClick:()=>c(!0),children:o})]})})]})})(Fe),e=>t=>{const{error:r,isLoading:o,name:s}=t,i=U(s),a=s===P?t.getCategory:t.getProduct;return r?(0,f.jsx)(V,{className:`${i}-error`,error:r,isLoading:o,onRetry:a}):(0,f.jsx)(e,{...t})},e=>t=>{const[r,o]=t.useEditingImage,s=(0,i.useRef)(null),{attributes:a,backgroundImageSize:n,name:c,setAttributes:l}=t,{mediaId:d,mediaSrc:u}=a,m=c===A?t.product:t.category,{backgroundImageId:g,backgroundImageSrc:p}=O({item:m,mediaId:d,mediaSrc:u,blockName:c});return r?(0,f.jsx)("div",{ref:s,children:(0,f.jsx)(B,{align:a.align,backgroundImageId:g,backgroundImageSize:n,backgroundImageSrc:p,containerRef:s,isEditingImage:r,setAttributes:l,setIsEditingImage:o})}):(0,f.jsx)(e,{...t})},e=>t=>{const{attributes:r,backgroundColorVisibilityStatus:o,clientId:s,name:i,setAttributes:a}=t,{alt:n,dimRatio:c,focalPoint:l,hasParallax:d,isRepeated:u,imageFit:m,mediaId:g,mediaSrc:p,overlayColor:h,overlayGradient:b,backgroundColor:w,style:_}=r,x=i===A?t.product:t.category,{setGradient:y}=(0,j.__experimentalUseGradient)({gradientAttribute:"overlayGradient",customGradientAttribute:"overlayGradient"}),{backgroundImageSrc:v}=O({item:x,mediaId:g,mediaSrc:p,blockName:i});return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)($,{alt:n,backgroundImageSrc:v,dimRatio:c,focalPoint:l,hasParallax:d,isRepeated:u,imageFit:m,overlayColor:h,overlayGradient:b,setAttributes:a,setGradient:y,backgroundColorVisibilityStatus:o,backgroundColor:w||_?.color?.background,clientId:s}),(0,f.jsx)(e,{...t})]})},(({cropLabel:e,editLabel:t})=>r=>o=>{const[s,i]=o.useEditingImage,[a,n]=o.useEditMode,{attributes:c,category:l,name:d,product:u,setAttributes:m}=o,{contentAlign:g,mediaId:p,mediaSrc:h}=c,b=l||u,{backgroundImageId:w,backgroundImageSrc:_}=O({item:b,mediaId:p,mediaSrc:h,blockName:d});return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(T,{backgroundImageId:w,backgroundImageSrc:_,contentAlign:g,cropLabel:e,editLabel:t,editMode:a,isEditingImage:s,mediaSrc:h,setAttributes:m,setIsEditingImage:i,setEditMode:n}),(0,f.jsx)(r,{...o})]})})(Le)])((()=>(0,f.jsx)(f.Fragment,{}))),Be=window.wp.blocks;function $e(e){return function(t){const r=(0,j.useBlockProps)(),{color:o,...s}=r.style;return(0,f.jsx)("div",{...r,style:s,children:(0,f.jsx)(e,{...t})})}}const De={attributes:{productId:"preview",previewProduct:{id:1,name:"WordPress Pennant",variation:"",permalink:"https://example.org",sku:"wp-pennant",short_description:(0,S.__)("Fly your WordPress banner with this beauty! Deck out your office space or add it to your kids walls. This banner will spruce up any space it’s hung!","woocommerce"),description:"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",price:"7.99",price_html:'<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>7.99</span>',images:[{id:1,src:m+"previews/pennant.jpg",thumbnail:m+"previews/pennant.jpg",name:"pennant-1.jpg",alt:"WordPress Pennant",srcset:"",sizes:""}],average_rating:5,categories:[{id:1,name:"Decor",slug:"decor",link:"https://example.org"}],review_count:1,prices:{currency_code:"GBP",decimal_separator:".",thousand_separator:",",decimals:2,price_prefix:"£",price_suffix:"",price:"7.99",regular_price:"9.99",sale_price:"7.99",price_range:null},add_to_cart:{text:(0,S.__)("Add to cart","woocommerce"),description:(0,S.__)("Add to cart","woocommerce")},has_options:!1,is_purchasable:!0,is_in_stock:!0,on_sale:!0}}},Me=JSON.parse('{"name":"woocommerce/featured-product","title":"Featured Product","description":"Highlight a product or variation.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"interactivity":{"clientNavigation":true},"align":["wide","full"],"ariaLabel":true,"html":false,"filter":{"duotone":true},"color":{"background":true,"text":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},"multiple":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":{"type":"string","default":"Shop now"},"overlayColor":{"type":"string","default":"#000000"},"overlayGradient":{"type":"string"},"productId":{"type":"number"},"previewProduct":{"type":"object","default":null}},"selectors":{"filter":{"duotone":".wp-block-woocommerce-featured-product .wc-block-featured-product__background-image"}},"textdomain":"woocommerce","apiVersion":3,"$schema":"https://schemas.wp.org/trunk/block.json"}');!function(e,t,r,o){const s={attributes:{...r.attributes,minHeight:{type:"number",default:(0,d.getSetting)("defaultHeight",500)}},supports:{...r.supports,color:{background:r.supports?.color?.background,text:r.supports?.color?.text},spacing:{padding:r.supports?.spacing?.padding,__experimentalDefaultControls:{padding:r.supports?.spacing?.__experimentalDefaultControls},__experimentalSkipSerialization:r.supports?.spacing?.__experimentalSkipSerialization},__experimentalBorder:r?.supports?.__experimentalBorder}},i={attributes:{alt:"",contentAlign:"center",dimRatio:50,hasParallax:!1,isRepeated:!1,height:(0,d.getSetting)("defaultHeight",500),mediaSrc:"",overlayColor:"#000000",showDesc:!0}};(0,Be.registerBlockType)(r,{...s,example:{...i,...t},edit:$e(e),save:()=>(0,f.jsx)(j.InnerBlocks.Content,{}),...o})}(Te,De,Me,{deprecated:[{attributes:{...Me.attributes,showDesc:{type:"boolean",default:!0},showPrice:{type:"boolean",default:!0}},save:()=>(0,f.jsx)(j.InnerBlocks.Content,{}),isEligible:e=>"boolean"==typeof e.editMode,migrate:(e,t)=>{const{editMode:r,showDesc:o,showPrice:s,...i}=e;return!1!==s&&t.unshift((0,Be.createBlock)("woocommerce/product-price",{style:{spacing:{padding:{bottom:"16px"}}},textAlign:"center"})),!1!==o&&t.unshift((0,Be.createBlock)("woocommerce/product-summary",{showDescriptionIfEmpty:!0,summaryLength:80,style:{typography:{textAlign:"center"}}})),t.unshift((0,Be.createBlock)("core/post-title",{level:2,isLink:!1,textAlign:"center",__woocommerceNamespace:"woocommerce/product-collection/product-title"})),[i,t]}}],icon:{src:(0,f.jsx)(o.A,{icon:s.A,className:"wc-block-editor-components-block-icon"})}})},210:()=>{},6388:()=>{},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}},s={};function i(e){var t=s[e];if(void 0!==t)return t.exports;var r=s[e]={exports:{}};return o[e](r,r.exports,i),r.exports}i.m=o,e=[],i.O=(t,r,o,s)=>{if(!r){var a=1/0;for(d=0;d<e.length;d++){for(var[r,o,s]=e[d],n=!0,c=0;c<r.length;c++)(!1&s||a>=s)&&Object.keys(i.O).every((e=>i.O[e](r[c])))?r.splice(c--,1):(n=!1,s<a&&(a=s));if(n){e.splice(d--,1);var l=o();void 0!==l&&(t=l)}}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]=[r,o,s]},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,o){if(1&o&&(e=this(e)),8&o)return e;if("object"==typeof e&&e){if(4&o&&e.__esModule)return e;if(16&o&&"function"==typeof e.then)return e}var s=Object.create(null);i.r(s);var a={};t=t||[null,r({}),r([]),r(r)];for(var n=2&o&&e;"object"==typeof n&&!~t.indexOf(n);n=r(n))Object.getOwnPropertyNames(n).forEach((t=>a[t]=()=>e[t]));return a.default=()=>e,i.d(s,a),s},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.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=8931,(()=>{var e={8931:0};i.O.j=t=>0===e[t];var t=(t,r)=>{var o,s,[a,n,c]=r,l=0;if(a.some((t=>0!==e[t]))){for(o in n)i.o(n,o)&&(i.m[o]=n[o]);if(c)var d=c(i)}for(t&&t(r);l<a.length;l++)s=a[l],i.o(e,s)&&e[s]&&e[s][0](),e[s]=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 a=i.O(void 0,[94],(()=>i(3367)));a=i.O(a),((this.wc=this.wc||{}).blocks=this.wc.blocks||{})["featured-product"]=a})();