14 lines
No EOL
43 KiB
JavaScript
14 lines
No EOL
43 KiB
JavaScript
(()=>{var e,t={4748:(e,t,r)=>{"use strict";r.r(t);var o=r(9196),n=r(1984),a=r(4734),l=(r(1887),r(2611),r(4942)),i=r(9307),s=r(4333);const c=window.wp.url,d=window.wp.apiFetch;var u=r.n(d);const m=window.wc.wcSettings;var g,p,h,b,v,_,w,E,k,f;const y=(0,m.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),S=y.pluginUrl+"images/",I=(y.pluginUrl,y.buildPhase),C=(null===(g=m.STORE_PAGES.shop)||void 0===g||g.permalink,null===(p=m.STORE_PAGES.checkout)||void 0===p||p.id,null===(h=m.STORE_PAGES.checkout)||void 0===h||h.permalink,null===(b=m.STORE_PAGES.privacy)||void 0===b||b.permalink,null===(v=m.STORE_PAGES.privacy)||void 0===v||v.title,null===(_=m.STORE_PAGES.terms)||void 0===_||_.permalink,null===(w=m.STORE_PAGES.terms)||void 0===w||w.title,null===(E=m.STORE_PAGES.cart)||void 0===E||E.id,null===(k=m.STORE_PAGES.cart)||void 0===k||k.permalink,null!==(f=m.STORE_PAGES.myaccount)&&void 0!==f&&f.permalink?m.STORE_PAGES.myaccount.permalink:(0,m.getSetting)("wpLoginUrl","/wp-login.php"),(0,m.getSetting)("localPickupEnabled",!1),(0,m.getSetting)("countries",{})),x=(0,m.getSetting)("countryData",{}),P=(Object.fromEntries(Object.keys(x).filter((e=>!0===x[e].allowBilling)).map((e=>[e,C[e]||""]))),Object.fromEntries(Object.keys(x).filter((e=>!0===x[e].allowBilling)).map((e=>[e,x[e].states||[]]))),Object.fromEntries(Object.keys(x).filter((e=>!0===x[e].allowShipping)).map((e=>[e,C[e]||""]))),Object.fromEntries(Object.keys(x).filter((e=>!0===x[e].allowShipping)).map((e=>[e,x[e].states||[]]))),Object.fromEntries(Object.keys(x).map((e=>[e,x[e].locale||[]]))),window.wp.blocks),N=()=>I>1,R=({selected:e=[],search:t="",queryArgs:r={}})=>{const o=(({selected:e=[],search:t="",queryArgs:r={}})=>{const o=y.productCount>100,n={per_page:o?100:0,catalog_visibility:"any",search:t,orderby:"title",order:"asc"},a=[(0,c.addQueryArgs)("/wc/store/v1/products",{...n,...r})];return o&&e.length&&a.push((0,c.addQueryArgs)("/wc/store/v1/products",{catalog_visibility:"any",include:e,per_page:0})),a})({selected:e,search:t,queryArgs:r});return Promise.all(o.map((e=>u()({path:e})))).then((e=>{const t=((e,t)=>{const r=new Map;return e.filter((e=>{const o=t(e);return!r.has(o)&&(r.set(o,e),!0)}))})(e.flat(),(e=>e.id));return t.map((e=>({...e,parent:0})))})).catch((e=>{throw e}))},A=async e=>{if(!("json"in e))return{message:e.message,type:e.type||"general"};try{const t=await e.json();return{message:t.message,type:t.type||"api"}}catch(e){return{message:e.message,type:"general"}}},L=(0,s.createHigherOrderComponent)((e=>class extends i.Component{constructor(...e){super(...e),(0,l.Z)(this,"state",{error:null,loading:!1,product:"preview"===this.props.attributes.productId?this.props.attributes.previewProduct:null}),(0,l.Z)(this,"loadProduct",(()=>{const{productId:e}=this.props.attributes;"preview"!==e&&(e?(this.setState({loading:!0}),(e=>u()({path:`/wc/store/v1/products/${e}`}))(e).then((e=>{this.setState({product:e,loading:!1,error:null})})).catch((async e=>{const t=await A(e);this.setState({product:null,loading:!1,error:t})}))):this.setState({product:null,loading:!1,error:null}))}))}componentDidMount(){this.loadProduct()}componentDidUpdate(e){e.attributes.productId!==this.props.attributes.productId&&this.loadProduct()}render(){const{error:t,loading:r,product:n}=this.state;return(0,o.createElement)(e,{...this.props,error:t,getProduct:this.loadProduct,isLoading:r,product:n})}}),"withProduct"),$=window.wp.components;var T=r(5736);const O=window.wp.blockEditor;var F=r(1525);const M=e=>{const{id:t,name:r,parent:o}=e;return{id:t,name:r,parent:o,breadcrumbs:[],children:[],details:e,value:e.slug}},j="woocommerce/featured-category",B="woocommerce/featured-product",G=e=>"number"==typeof e;function H(e){return!!e&&G(e.id)&&"string"==typeof e.src}function D({blockName:e,item:t,mediaId:r,mediaSrc:o}){const[n,a]=(0,i.useState)(0),[l,s]=(0,i.useState)("");return(0,i.useEffect)((()=>{var o,n;a(r||(e===B?(n=t)&&n.images&&n.images.length&&n.images[0].id||0:(o=t)&&H(o.image)?o.image.id:0))}),[e,t,r]),(0,i.useEffect)((()=>{var r,n;s(o||(e===B?(n=t)&&n.images&&n.images.length&&n.images[0].src||"":(r=t)&&H(r.image)?r.image.src:""))}),[e,t,o]),{backgroundImageId:n,backgroundImageSrc:l}}const z=({backgroundImageId:e,backgroundImageSrc:t,contentAlign:r,cropLabel:n,editLabel:a,editMode:l,isEditingImage:i,mediaSrc:s,setAttributes:c,setIsEditingImage:d})=>(0,o.createElement)(O.BlockControls,null,(0,o.createElement)(O.AlignmentToolbar,{value:r,onChange:e=>{c({contentAlign:e})}}),(0,o.createElement)($.ToolbarGroup,null,t&&!i&&(0,o.createElement)($.ToolbarButton,{onClick:()=>d(!0),icon:F.Z,label:n}),(0,o.createElement)(O.MediaReplaceFlow,{mediaId:e,mediaURL:s,accept:"image/*",onSelect:e=>{c({mediaId:e.id,mediaSrc:e.url})},allowedTypes:["image"]}),e&&s?(0,o.createElement)($.ToolbarButton,{onClick:()=>c({mediaId:0,mediaSrc:""})},(0,T.__)("Reset","woocommerce")):null),(0,o.createElement)($.ToolbarGroup,{controls:[{icon:"edit",title:a,onClick:()=>c({editMode:!l}),isActive:l}]})),V=({align:e,backgroundImageId:t,backgroundImageSize:r,backgroundImageSrc:n,containerRef:a,isEditingImage:l,setAttributes:s,setIsEditingImage:c})=>{const d=function(e,t){const[r,o]=(0,i.useState)(),n=(0,i.useCallback)((()=>{var t;o(null===(t=e.current)||void 0===t?void 0:t.clientWidth)}),[e]);return(0,i.useEffect)(n,[n,...t]),(0,i.useEffect)((()=>{if(!e.current)return;const{defaultView:t}=e.current.ownerDocument;return t?(t.addEventListener("resize",n),()=>{t.removeEventListener("resize",n)}):void 0}),[e,n]),r}(a,[e]);return"function"==typeof O.__experimentalImageEditingProvider?(0,o.createElement)(O.__experimentalImageEditingProvider,{id:t,url:n,naturalHeight:r.height||500,naturalWidth:r.width||500,onSaveImage:({id:e,url:t})=>{s({mediaId:e,mediaSrc:t})},isEditing:l,onFinishEditing:()=>c(!1)},(0,o.createElement)(O.__experimentalImageEditor,{url:n,height:r.height||500,width:r.width||500})):(0,o.createElement)(O.__experimentalImageEditor,{id:t,url:n,height:r.height||500,width:r.width||500,naturalHeight:r.height,naturalWidth:r.width,onSaveImage:({id:e,url:t})=>{s({mediaId:e,mediaSrc:t})},onFinishEditing:()=>c(!1),clientWidth:d})},Z=({alt:e,backgroundImageSrc:t,contentPanel:r,dimRatio:n,focalPoint:a,hasParallax:l,imageFit:i,isRepeated:s,overlayColor:c,overlayGradient:d,setAttributes:u,setGradient:m,showDesc:g})=>{const p="function"==typeof $.FocalPointPicker,h=!s&&!l;return(0,o.createElement)(O.InspectorControls,{key:"inspector"},(0,o.createElement)($.PanelBody,{title:(0,T.__)("Content","woocommerce")},(0,o.createElement)($.ToggleControl,{label:(0,T.__)("Show description","woocommerce"),checked:g,onChange:()=>u({showDesc:!g})}),r),!!t&&(0,o.createElement)(o.Fragment,null,p&&(0,o.createElement)($.PanelBody,{title:(0,T.__)("Media settings","woocommerce")},(0,o.createElement)($.ToggleControl,{label:(0,T.__)("Fixed background","woocommerce"),checked:l,onChange:()=>{u({hasParallax:!l})}}),(0,o.createElement)($.ToggleControl,{label:(0,T.__)("Repeated background","woocommerce"),checked:s,onChange:()=>{u({isRepeated:!s})}}),!s&&(0,o.createElement)($.__experimentalToggleGroupControl,{help:(0,o.createElement)(o.Fragment,null,(0,o.createElement)("span",{style:{display:"block",marginBottom:"1em"}},(0,T.__)("Select “Cover” to have the image automatically fit its container.","woocommerce")),(0,o.createElement)("span",null,(0,T.__)("This may affect your ability to freely move the focal point of the image.","woocommerce"))),label:(0,T.__)("Image fit","woocommerce"),value:i,onChange:e=>u({imageFit:e})},(0,o.createElement)($.__experimentalToggleGroupControlOption,{label:(0,T.__)("None","woocommerce"),value:"none"}),(0,o.createElement)($.__experimentalToggleGroupControlOption
|
||
/* translators: "Cover" is a verb that indicates an image covering the entire container. */,{label:(0,T.__)("Cover","woocommerce"),value:"cover"})),(0,o.createElement)($.FocalPointPicker,{label:(0,T.__)("Focal Point Picker","woocommerce"),url:t,value:a,onChange:e=>u({focalPoint:e})}),h&&(0,o.createElement)($.TextareaControl,{label:(0,T.__)("Alt text (alternative text)","woocommerce"),value:e,onChange:e=>{u({alt:e})},help:(0,o.createElement)(o.Fragment,null,(0,o.createElement)($.ExternalLink,{href:"https://www.w3.org/WAI/tutorials/images/decision-tree"},(0,T.__)("Describe the purpose of the image","woocommerce")))})),(0,o.createElement)(O.__experimentalPanelColorGradientSettings,{__experimentalHasMultipleOrigins:!0,__experimentalIsRenderedInSidebar:!0,title:(0,T.__)("Overlay","woocommerce"),initialOpen:!0,settings:[{colorValue:c,gradientValue:d,onColorChange:e=>u({overlayColor:e}),onGradientChange:e=>{m(e),u({overlayGradient:e})},label:(0,T.__)("Color","woocommerce")}]},(0,o.createElement)($.RangeControl,{label:(0,T.__)("Opacity","woocommerce"),value:n,onChange:e=>u({dimRatio:e}),min:0,max:100,step:10,required:!0}))))};var W=r(7329),U=r(4184),q=r.n(U);const J=window.wp.escapeHtml,Q=({error:e})=>(0,o.createElement)("div",{className:"wc-block-error-message"},(({message:e,type:t})=>e?"general"===t?(0,o.createElement)("span",null,(0,T.__)("The following error was returned","woocommerce"),(0,o.createElement)("br",null),(0,o.createElement)("code",null,(0,J.escapeHTML)(e))):"api"===t?(0,o.createElement)("span",null,(0,T.__)("The following error was returned from the API","woocommerce"),(0,o.createElement)("br",null),(0,o.createElement)("code",null,(0,J.escapeHTML)(e))):e:(0,T.__)("An error has prevented the block from being updated.","woocommerce"))(e));r(2513);const Y=({className:e="",error:t,isLoading:r=!1,onRetry:a})=>(0,o.createElement)($.Placeholder,{icon:(0,o.createElement)(n.Z,{icon:W.Z}),label:(0,T.__)("Sorry, an error occurred","woocommerce"),className:q()("wc-block-api-error",e)},(0,o.createElement)(Q,{error:t}),a&&(0,o.createElement)(o.Fragment,null,r?(0,o.createElement)($.Spinner,null):(0,o.createElement)($.Button,{isSecondary:!0,onClick:a},(0,T.__)("Retry","woocommerce"))));function K(e){return e?`${Math.round(100*e.x)}% ${Math.round(100*e.y)}%`:""}function X(e){return`wc-block-${e.split("/")[1]}`}function ee(e,t,r){const o=new Set(t.map((e=>e[r])));return e.filter((e=>!o.has(e[r])))}const te=window.wp.htmlEntities,re={clear:(0,T.__)("Clear all selected items","woocommerce"),noItems:(0,T.__)("No items found.","woocommerce"),
|
||
/* Translators: %s search term */
|
||
noResults:(0,T.__)("No results for %s","woocommerce"),search:(0,T.__)("Search for items","woocommerce"),selected:e=>(0,T.sprintf)(/* translators: Number of items selected from list. */
|
||
(0,T._n)("%d item selected","%d items selected",e,"woocommerce"),e),updated:(0,T.__)("Search results updated.","woocommerce")},oe=(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=("id",t.reduce(((e,t)=>(e[String(t.id)]=t,e)),{}));const n=["0"],a=(e={})=>e.parent?[...a(o[e.parent]),e.name]:e.name?[e.name]:[],l=e=>e.map((e=>{const t=r[e.id];return n.push(""+e.id),{...e,breadcrumbs:a(o[e.parent]),children:t&&t.length?l(t):[]}})),i=l(r[0]||[]);return Object.entries(r).forEach((([e,t])=>{n.includes(e)||i.push(...l(t||[]))})),i},ne=(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,o.createElement)("strong",{key:t},e):(0,o.createElement)(i.Fragment,{key:t},e)))},ae=({label:e})=>(0,o.createElement)("span",{className:"woocommerce-search-list__item-count"},e),le=e=>{const{item:t,search:r}=e,n=t.breadcrumbs&&t.breadcrumbs.length;return(0,o.createElement)("span",{className:"woocommerce-search-list__item-label"},n?(0,o.createElement)("span",{className:"woocommerce-search-list__item-prefix"},1===(a=t.breadcrumbs).length?a.slice(0,1).toString():2===a.length?a.slice(0,1).toString()+" › "+a.slice(-1).toString():a.slice(0,1).toString()+" … "+a.slice(-1).toString()):null,(0,o.createElement)("span",{className:"woocommerce-search-list__item-name"},ne((0,te.decodeEntities)(t.name),r)));var a},ie=({countLabel:e,className:t,depth:r=0,controlId:n="",item:a,isSelected:l,isSingle:s,onSelect:c,search:d="",selected:u,useExpandedPanelId:m,...g})=>{var p,h;const[b,v]=m,_=null!=e&&void 0!==a.count&&null!==a.count,w=!(null===(p=a.breadcrumbs)||void 0===p||!p.length),E=!(null===(h=a.children)||void 0===h||!h.length),k=b===a.id,f=q()(["woocommerce-search-list__item",`depth-${r}`,t],{"has-breadcrumbs":w,"has-children":E,"has-count":_,"is-expanded":k,"is-radio-button":s}),y=g.name||`search-list-item-${n}`,S=`${y}-${a.id}`,I=(0,i.useCallback)((()=>{v(k?-1:Number(a.id))}),[k,a.id,v]);return E?(0,o.createElement)("div",{className:f,onClick:I,onKeyDown:e=>"Enter"===e.key||" "===e.key?I():null,role:"treeitem",tabIndex:0},s?(0,o.createElement)(o.Fragment,null,(0,o.createElement)("input",{type:"radio",id:S,name:y,value:a.value,onChange:c(a),onClick:e=>e.stopPropagation(),checked:l,className:"woocommerce-search-list__item-input",...g}),(0,o.createElement)(le,{item:a,search:d}),_?(0,o.createElement)(ae,{label:e||a.count}):null):(0,o.createElement)(o.Fragment,null,(0,o.createElement)($.CheckboxControl,{className:"woocommerce-search-list__item-input",checked:l,...!l&&a.children.some((e=>u.find((t=>t.id===e.id))))?{indeterminate:!0}:{},label:ne((0,te.decodeEntities)(a.name),d),onChange:()=>{l?c(ee(u,a.children,"id"))():c(function(e,t,r){const o=ee(t,e,"id");return[...e,...o]}(u,a.children))()},onClick:e=>e.stopPropagation()}),_?(0,o.createElement)(ae,{label:e||a.count}):null)):(0,o.createElement)("label",{htmlFor:S,className:f},s?(0,o.createElement)(o.Fragment,null,(0,o.createElement)("input",{...g,type:"radio",id:S,name:y,value:a.value,onChange:c(a),checked:l,className:"woocommerce-search-list__item-input"}),(0,o.createElement)(le,{item:a,search:d})):(0,o.createElement)($.CheckboxControl,{...g,id:S,name:y,className:"woocommerce-search-list__item-input",value:(0,te.decodeEntities)(a.value),label:ne((0,te.decodeEntities)(a.name),d),onChange:c(a),checked:l}),_?(0,o.createElement)(ae,{label:e||a.count}):null)},se=ie;var ce=r(5430),de=r(906);r(5932);const ue=({id:e,label:t,popoverContents:r,remove:a,screenReaderLabel:l,className:c=""})=>{const[d,u]=(0,i.useState)(!1),m=(0,s.useInstanceId)(ue);if(l=l||t,!t)return null;t=(0,te.decodeEntities)(t);const g=q()("woocommerce-tag",c,{"has-remove":!!a}),p=`woocommerce-tag__label-${m}`,h=(0,o.createElement)(o.Fragment,null,(0,o.createElement)("span",{className:"screen-reader-text"},l),(0,o.createElement)("span",{"aria-hidden":"true"},t));return(0,o.createElement)("span",{className:g},r?(0,o.createElement)($.Button,{className:"woocommerce-tag__text",id:p,onClick:()=>u(!0)},h):(0,o.createElement)("span",{className:"woocommerce-tag__text",id:p},h),r&&d&&(0,o.createElement)($.Popover,{onClose:()=>u(!1)},r),a&&(0,o.createElement)($.Button,{className:"woocommerce-tag__remove",onClick:a(e),label:(0,T.sprintf)(
|
||
// Translators: %s label.
|
||
(0,T.__)("Remove %s","woocommerce"),t),"aria-describedby":p},(0,o.createElement)(n.Z,{icon:de.Z,size:20,className:"clear-icon",role:"img"})))},me=ue;r(8462);const ge=e=>(0,o.createElement)(se,{...e}),pe=e=>{const{list:t,selected:r,renderItem:n,depth:a=0,onSelect:l,instanceId:s,isSingle:c,search:d,useExpandedPanelId:u}=e,[m]=u;return t?(0,o.createElement)(i.Fragment,null,t.map((t=>{var g,p;const h=null!==(g=t.children)&&void 0!==g&&g.length&&!c?t.children.every((({id:e})=>r.find((t=>t.id===e)))):!!r.find((({id:e})=>e===t.id)),b=(null===(p=t.children)||void 0===p?void 0:p.length)&&m===t.id;return(0,o.createElement)(i.Fragment,{key:t.id},(0,o.createElement)("li",null,n({item:t,isSelected:h,onSelect:l,isSingle:c,selected:r,search:d,depth:a,useExpandedPanelId:u,controlId:s})),b?(0,o.createElement)(pe,{...e,list:t.children,depth:a+1}):null)}))):null},he=({isLoading:e,isSingle:t,selected:r,messages:n,onChange:a,onRemove:l})=>{if(e||t||!r)return null;const i=r.length;return(0,o.createElement)("div",{className:"woocommerce-search-list__selected"},(0,o.createElement)("div",{className:"woocommerce-search-list__selected-header"},(0,o.createElement)("strong",null,n.selected(i)),i>0?(0,o.createElement)($.Button,{isLink:!0,isDestructive:!0,onClick:()=>a([]),"aria-label":n.clear},(0,T.__)("Clear all","woocommerce")):null),i>0?(0,o.createElement)("ul",null,r.map(((e,t)=>(0,o.createElement)("li",{key:t},(0,o.createElement)(me,{label:e.name,id:e.id,remove:l}))))):null)},be=({filteredList:e,search:t,onSelect:r,instanceId:a,useExpandedPanelId:l,...i})=>{const{messages:s,renderItem:c,selected:d,isSingle:u}=i,m=c||ge;return 0===e.length?(0,o.createElement)("div",{className:"woocommerce-search-list__list is-not-found"},(0,o.createElement)("span",{className:"woocommerce-search-list__not-found-icon"},(0,o.createElement)(n.Z,{icon:ce.Z,role:"img"})),(0,o.createElement)("span",{className:"woocommerce-search-list__not-found-text"},t?(0,T.sprintf)(s.noResults,t):s.noItems)):(0,o.createElement)("ul",{className:"woocommerce-search-list__list"},(0,o.createElement)(pe,{useExpandedPanelId:l,list:e,selected:d,renderItem:m,onSelect:r,instanceId:a,isSingle:u,search:t}))},ve=e=>{const{className:t="",isCompact:r,isHierarchical:n,isLoading:a,isSingle:l,list:c,messages:d=re,onChange:u,onSearch:m,selected:g,type:p="text",debouncedSpeak:h}=e,[b,v]=(0,i.useState)(""),_=(0,i.useState)(-1),w=(0,s.useInstanceId)(ve),E=(0,i.useMemo)((()=>({...re,...d})),[d]),k=(0,i.useMemo)((()=>((e,t,r)=>{if(!t)return r?oe(e):e;const o=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),n=e.map((e=>!!o.test(e.name)&&e)).filter(Boolean);return r?oe(n,e):n})(c,b,n)),[c,b,n]);(0,i.useEffect)((()=>{h&&h(E.updated)}),[h,E]),(0,i.useEffect)((()=>{"function"==typeof m&&m(b)}),[b,m]);const f=(0,i.useCallback)((e=>()=>{l&&u([]);const t=g.findIndex((({id:t})=>t===e));u([...g.slice(0,t),...g.slice(t+1)])}),[l,g,u]),y=(0,i.useCallback)((e=>()=>{Array.isArray(e)?u(e):-1===g.findIndex((({id:t})=>t===e.id))?u(l?[e]:[...g,e]):f(e.id)()}),[l,f,u,g]),S=(0,i.useCallback)((e=>{const[t]=g.filter((t=>!e.find((e=>t.id===e.id))));f(t.id)()}),[f,g]);return(0,o.createElement)("div",{className:q()("woocommerce-search-list",t,{"is-compact":r,"is-loading":a,"is-token":"token"===p})},"text"===p&&(0,o.createElement)(he,{...e,onRemove:f,messages:E}),(0,o.createElement)("div",{className:"woocommerce-search-list__search"},"text"===p?(0,o.createElement)($.TextControl,{label:E.search,type:"search",value:b,onChange:e=>v(e)}):(0,o.createElement)($.FormTokenField,{disabled:a,label:E.search,onChange:S,onInputChange:e=>v(e),suggestions:[],__experimentalValidateInput:()=>!1,value:a?[(0,T.__)("Loading…","woocommerce")]:g.map((e=>({...e,value:e.name}))),__experimentalShowHowTo:!1})),a?(0,o.createElement)("div",{className:"woocommerce-search-list__list"},(0,o.createElement)($.Spinner,null)):(0,o.createElement)(be,{...e,search:b,filteredList:k,messages:E,onSelect:y,instanceId:w,useExpandedPanelId:_}))},_e=((0,$.withSpokenMessages)(ve),(0,s.createHigherOrderComponent)((e=>class extends i.Component{constructor(){super(...arguments),this.state={error:null,loading:!1,categories:[]},this.loadCategories=this.loadCategories.bind(this)}componentDidMount(){this.loadCategories()}loadCategories(){this.setState({loading:!0}),u()({path:(0,c.addQueryArgs)("wc/store/v1/products/categories",{per_page:0})}).then((e=>{this.setState({categories:e,loading:!1,error:null})})).catch((async e=>{const t=await A(e);this.setState({categories:[],loading:!1,error:t})}))}render(){const{error:t,loading:r,categories:n}=this.state;return(0,o.createElement)(e,{...this.props,error:t,isLoading:r,categories:n})}}),"withCategories"));r(3366);const we=({categories:e,error:t,isLoading:r,onChange:n,onOperatorChange:a,operator:l,selected:i,isCompact:s,isSingle:c,showReviewCount:d})=>{const u={clear:(0,T.__)("Clear all product categories","woocommerce"),list:(0,T.__)("Product Categories","woocommerce"),noItems:(0,T.__)("Your store doesn't have any product categories.","woocommerce"),search:(0,T.__)("Search for product categories","woocommerce"),selected:e=>(0,T.sprintf)(/* translators: %d is the count of selected categories. */
|
||
(0,T._n)("%d category selected","%d categories selected",e,"woocommerce"),e),updated:(0,T.__)("Category search results updated.","woocommerce")};return t?(0,o.createElement)(Q,{error:t}):(0,o.createElement)(o.Fragment,null,(0,o.createElement)(ve,{className:"woocommerce-product-categories",list:e,isLoading:r,selected:i.map((t=>e.find((e=>e.id===t)))).filter(Boolean),onChange:n,renderItem:e=>{const{item:t,search:r,depth:n=0}=e,a=t.breadcrumbs.length?`${t.breadcrumbs.join(", ")}, ${t.name}`:t.name,l=d?(0,T.sprintf)(/* translators: %1$s is the item name, %2$d is the count of reviews for the item. */
|
||
(0,T._n)("%1$s, has %2$d review","%1$s, has %2$d reviews",t.review_count,"woocommerce"),a,t.review_count):(0,T.sprintf)(/* translators: %1$s is the item name, %2$d is the count of products for the item. */
|
||
(0,T._n)("%1$s, has %2$d product","%1$s, has %2$d products",t.count,"woocommerce"),a,t.count),i=d?(0,T.sprintf)(/* translators: %d is the count of reviews. */
|
||
(0,T._n)("%d review","%d reviews",t.review_count,"woocommerce"),t.review_count):(0,T.sprintf)(/* translators: %d is the count of products. */
|
||
(0,T._n)("%d product","%d products",t.count,"woocommerce"),t.count);return(0,o.createElement)(ie,{className:q()("woocommerce-product-categories__item","has-count",{"is-searching":r.length>0,"is-skip-level":0===n&&0!==t.parent}),...e,countLabel:i,"aria-label":l})},messages:u,isCompact:s,isHierarchical:!0,isSingle:c}),!!a&&(0,o.createElement)("div",{hidden:i.length<2},(0,o.createElement)($.SelectControl,{className:"woocommerce-product-categories__operator",label:(0,T.__)("Display products matching","woocommerce"),help:(0,T.__)("Pick at least two categories to use this setting.","woocommerce"),value:l,onChange:a,options:[{label:(0,T.__)("Any selected categories","woocommerce"),value:"any"},{label:(0,T.__)("All selected categories","woocommerce"),value:"all"}]})))};we.defaultProps={operator:"any",isCompact:!1,isSingle:!1};const Ee=_e(we),ke=e=>null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length;var fe=r(4697);var ye=r(9127),Se=r.n(ye);const Ie=(0,s.createHigherOrderComponent)((e=>{class t extends i.Component{constructor(...e){super(...e),(0,l.Z)(this,"state",{error:null,loading:!1,variations:{}}),(0,l.Z)(this,"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 n=e.find((e=>e.id===o));var a;n.variations&&0!==n.variations.length?(this.setState({loading:!0}),(a=o,u()({path:(0,c.addQueryArgs)("wc/store/v1/products",{per_page:0,type:"variation",parent:a})})).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 A(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})}))}componentDidMount(){const{selected:e,showVariations:t}=this.props;e&&t&&this.loadVariations()}componentDidUpdate(e){const{isLoading:t,selected:r,showVariations:o}=this.props;o&&(!Se()(e.selected,r)||e.isLoading&&!t)&&this.loadVariations()}isProductId(e){const{products:t}=this.props;return t.some((t=>t.id===e))}findParentProduct(e){var t;const{products:r}=this.props;return null===(t=r.filter((t=>t.variations&&t.variations.find((({id:t})=>t===e))))[0])||void 0===t?void 0:t.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:n,loading:a,variations:l}=this.state;return(0,o.createElement)(e,{...this.props,error:n||t,expandedProduct:this.getExpandedProduct(),isLoading:r,variations:l,variationsLoading:a})}}return(0,l.Z)(t,"defaultProps",{selected:[],showVariations:!1}),t}),"withProductVariations"),Ce=({className:e,item:t,isSelected:r,isLoading:n,onSelect:a,disabled:l,...i})=>(0,o.createElement)(o.Fragment,null,(0,o.createElement)(ie,{...i,key:t.id,className:e,isSelected:r,item:t,onSelect:a,disabled:l}),r&&n&&(0,o.createElement)("div",{key:"loading",className:q()("woocommerce-search-list__item","woocommerce-product-attributes__item","depth-1","is-loading","is-not-active")},(0,o.createElement)($.Spinner,null)));r(5301);const xe={list:(0,T.__)("Products","woocommerce"),noItems:(0,T.__)("Your store doesn't have any products.","woocommerce"),search:(0,T.__)("Search for a product to display","woocommerce"),updated:(0,T.__)("Product search results updated.","woocommerce")},Pe=(e=>t=>{let{selected:r}=t;r=void 0===r?null:r;const n=null===r;return Array.isArray(r)?(0,o.createElement)(e,{...t}):(0,o.createElement)(e,{...t,selected:n?[]:[r]})})((Re=Ie((0,s.withInstanceId)((e=>{const{expandedProduct:t=null,error:r,instanceId:n,isCompact:a=!1,isLoading:l,onChange:i,onSearch:s,products:c,renderItem:d,selected:u=[],showVariations:m=!1,variations:g,variationsLoading:p}=e;if(r)return(0,o.createElement)(Q,{error:r});const h=[...c,...g&&t&&g[t]?g[t]:[]].map(M);return(0,o.createElement)(ve,{className:"woocommerce-products",list:h,isCompact:a,isLoading:l,isSingle:!0,selected:h.filter((({id:e})=>u.includes(Number(e)))),onChange:i,renderItem:d||(m?e=>{var t,r,a,i;const{item:s,search:c,depth:d=0,isSelected:u,onSelect:m}=e,g=null!==(t=s.details)&&void 0!==t&&t.variations&&Array.isArray(s.details.variations)?s.details.variations.length:0,h=q()("woocommerce-search-product__item","woocommerce-search-list__item",`depth-${d}`,"has-count",{"is-searching":c.length>0,"is-skip-level":0===d&&0!==s.parent,"is-variable":g>0});if(!s.breadcrumbs.length){var b,v,_,w,E;const t=(null===(b=s.details)||void 0===b?void 0:b.variations)&&s.details.variations.length>0;return(0,o.createElement)(Ce,{...e,className:q()(h,{"is-selected":u}),isSelected:u,item:s,onSelect:()=>()=>{m(s)()},isLoading:l||p,countLabel:t?(0,T.sprintf)(/* translators: %1$d is the number of variations of a product product. */
|
||
(0,T.__)("%1$d variations","woocommerce"),null===(v=s.details)||void 0===v?void 0:v.variations.length):null,name:`products-${n}`,"aria-label":t?(0,T.sprintf)(/* translators: %1$s is the product name, %2$d is the number of variations of that product. */
|
||
(0,T._n)("%1$s, has %2$d variation","%1$s, has %2$d variations",null===(_=s.details)||void 0===_||null===(w=_.variations)||void 0===w?void 0:w.length,"woocommerce"),s.name,null===(E=s.details)||void 0===E?void 0:E.variations.length):void 0})}const k=ke(null===(r=s.details)||void 0===r?void 0:r.variation)?e:{...e,item:{...e.item,name:null===(a=s.details)||void 0===a?void 0:a.variation},"aria-label":`${s.breadcrumbs[0]}: ${null===(i=s.details)||void 0===i?void 0:i.variation}`};return(0,o.createElement)(ie,{...k,className:h,name:`variations-${n}`})}:()=>null),onSearch:s,messages:xe,isHierarchical:!0})}))),({selected:e,...t})=>{const[r,n]=(0,i.useState)(!0),[a,l]=(0,i.useState)(null),[s,c]=(0,i.useState)([]),d=y.productCount>100,u=async e=>{const t=await A(e);l(t),n(!1)},m=(0,i.useRef)(e);(0,i.useEffect)((()=>{R({selected:m.current}).then((e=>{c(e),n(!1)})).catch(u)}),[m]);const g=(0,fe.y1)((t=>{R({selected:e,search:t}).then((e=>{c(e),n(!1)})).catch(u)}),400),p=(0,i.useCallback)((e=>{n(!0),g(e)}),[n,g]);return(0,o.createElement)(Re,{...t,selected:e,error:a,products:s,isLoading:r,onSearch:d?p:null})})),Ne=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;var Re;const Ae=e=>"string"==typeof e;var Le=r(9784);const $e=window.wp.styleEngine;function Te(e={}){const t={};return(0,$e.getCSSRules)(e,{selector:""}).forEach((e=>{t[e.key]=e.value})),t}function Oe(e,t){return e&&t?`has-${(0,Le.o)(t)}-${e}`:""}const Fe=e=>{const t=(e=>{const t=Ne(e)?e:{style:{}};let r=t.style;return Ae(r)&&(r=JSON.parse(r)||{}),Ne(r)||(r={}),{...t,style:r}})(e),r=function(e){var t,r,o,n,a,l,i;const{backgroundColor:s,textColor:c,gradient:d,style:u}=e,m=Oe("background-color",s),g=Oe("color",c),p=function(e){if(e)return`has-${e}-gradient-background`}(d),h=p||(null==u||null===(t=u.color)||void 0===t?void 0:t.gradient);return{className:q()(g,p,{[m]:!h&&!!m,"has-text-color":c||(null==u||null===(r=u.color)||void 0===r?void 0:r.text),"has-background":s||(null==u||null===(o=u.color)||void 0===o?void 0:o.background)||d||(null==u||null===(n=u.color)||void 0===n?void 0:n.gradient),"has-link-color":Ne(null==u||null===(a=u.elements)||void 0===a?void 0:a.link)?null==u||null===(l=u.elements)||void 0===l||null===(i=l.link)||void 0===i?void 0:i.color:void 0}),style:Te({color:(null==u?void 0:u.color)||{}})}}(t),o=function(e){var t;const r=(null===(t=e.style)||void 0===t?void 0:t.border)||{};return{className:function(e){var t;const{borderColor:r,style:o}=e,n=r?Oe("border-color",r):"";return q()({"has-border-color":!!r||!(null==o||null===(t=o.border)||void 0===t||!t.color),[n]:!!n})}(e),style:Te({border:r})}}(t),n=function(e){var t;return{className:void 0,style:Te({spacing:(null===(t=e.style)||void 0===t?void 0:t.spacing)||{}})}}(t),a=(e=>{const t=Ne(e.style.typography)?e.style.typography:{},r=Ae(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:q()(a.className,r.className,o.className,n.className),style:{...a.style,...r.style,...o.style,...n.style}}},Me=({itemId:e,linkText:t,permalink:r})=>{const n=q()("wp-block-button__link","is-style-fill");return"preview"===e?(0,o.createElement)("div",{className:"wp-block-button aligncenter",style:{width:"100%"}},(0,o.createElement)(O.RichText.Content,{tagName:"a",className:n,href:r,title:t,style:{backgroundColor:"vivid-green-cyan",borderRadius:"5px"},value:t,target:r})):(0,o.createElement)(O.InnerBlocks,{template:[["core/buttons",{layout:{type:"flex",justifyContent:"center"}},[["core/button",{text:(0,T.__)("Shop now","woocommerce"),url:r}]]]],templateLock:"all"})},je=({className:e="",onResize:t,...r})=>{const[n,a]=(0,i.useState)(!1),l=q()(e,{"is-resizing":n}),s=(0,fe.zl)(((e,r,o,l)=>{n||a(!0),null==t||t(e,r,o,l)}),50,{leading:!0});return(0,o.createElement)($.ResizableBox,{className:l,enable:{bottom:!0},onResize:s,onResizeStop:(...e)=>{null==t||t(...e),a(!1)},...r})},Be=window.wp.data,Ge={icon:a.Z,label:(0,T.__)("Featured Product","woocommerce")},He={...Ge,cropLabel:(0,T.__)("Edit product image","woocommerce"),editLabel:(0,T.__)("Edit selected product","woocommerce")},De={...Ge,emptyMessage:(0,T.__)("No product is selected.","woocommerce"),noSelectionButtonLabel:(0,T.__)("Select a product","woocommerce")},ze={...Ge,description:(0,T.__)("Highlight a product or variation.","woocommerce"),editLabel:(0,T.__)("Showing Featured Product block preview.","woocommerce")},Ve=(0,s.compose)([L,$.withSpokenMessages,e=>t=>{var r;const[n,a]=(0,i.useState)(!1),{attributes:l,category:s,clientId:c,product:d}=t,u=s||d,{editMode:m}=l,g=(null==u?void 0:u.link)||(null==u?void 0:u.permalink),p=(0,Be.useSelect)((e=>e("core/block-editor").getBlock(c))),h=null==p||null===(r=p.innerBlocks[0])||void 0===r?void 0:r.innerBlocks[0],b=(null==h?void 0:h.clientId)||"",v=(0,i.useMemo)((()=>(null==h?void 0:h.attributes)||{}),[h]),{url:_}=v,{updateBlockAttributes:w}=(0,Be.useDispatch)("core/block-editor");return(0,i.useEffect)((()=>{n&&b&&!m&&g&&_&&g!==_&&(w(b,{url:g}),a(!1))}),[b,n,m,g,w,_]),(0,o.createElement)(e,{...t,triggerUrlUpdate:()=>a(!0)})},e=>t=>{const[r,n]=(0,i.useState)(!1),{isSelected:a}=t;return(0,i.useEffect)((()=>{n(!1)}),[a]),(0,o.createElement)(e,{...t,useEditingImage:[r,n]})},(({description:e,editLabel:t,icon:r,label:n})=>a=>l=>{const{attributes:i,debouncedSpeak:s,name:c,setAttributes:d,triggerUrlUpdate:u=(()=>{})}=l,m=X(c);return i.editMode?(0,o.createElement)($.Placeholder,{icon:(0,o.createElement)($.Icon,{icon:r}),label:n,className:m},e,(0,o.createElement)("div",{className:`${m}__selection`},c===j&&(0,o.createElement)(Ee,{selected:[i.categoryId],onChange:(e=[])=>{const t=e[0]?e[0].id:0;d({categoryId:t,mediaId:0,mediaSrc:""}),u()},isSingle:!0}),c===B&&(0,o.createElement)(Pe,{selected:i.productId?[i.productId]:[],showVariations:!0,onChange:(e=[])=>{const t=e[0]?e[0].id:0;d({productId:t,mediaId:0,mediaSrc:""}),u()}}),(0,o.createElement)($.Button,{isPrimary:!0,onClick:()=>{d({editMode:!1}),s(t)}},(0,T.__)("Done","woocommerce")))):(0,o.createElement)(a,{...l})})(ze),(({emptyMessage:e,icon:t,label:r,noSelectionButtonLabel:n})=>a=>l=>{const[s]=l.useEditingImage,{attributes:c,category:d,isLoading:u,isSelected:m,name:g,product:p,setAttributes:h}=l,{mediaId:b,mediaSrc:v}=c,_=d||p,[w,E]=(0,i.useState)({}),{backgroundImageSrc:k}=D({item:_,mediaId:b,mediaSrc:v,blockName:g}),f=X(g),y=(0,i.useCallback)(((e,t,r)=>{h({minHeight:parseInt(r.style.height,10)})}),[h]),S=Fe(c);return s?(0,o.createElement)(a,{...l,backgroundImageSize:w}):(0,o.createElement)(o.Fragment,null,(0,o.createElement)(a,{...l,backgroundImageSize:w}),_?(()=>{var e,t;const{contentAlign:r,dimRatio:n,focalPoint:a,hasParallax:l,isRepeated:i,imageFit:s,minHeight:g,overlayColor:h,overlayGradient:b,showDesc:v,showPrice:w,style:I,textColor:C}=c,x=q()(f,{"is-selected":m&&"preview"!==c.categoryId&&"preview"!==c.productId,"is-loading":!_&&u,"is-not-found":!_&&!u,"has-background-dim":0!==n,"is-repeated":i},0===(P=n)||50===P?null:"has-background-dim-"+10*Math.round(P/10),"center"!==r&&`has-${r}-content`,S.className);var P;const N={borderRadius:null==I||null===(e=I.border)||void 0===e?void 0:e.radius,color:C?`var(--wp--preset--color--${C})`:null==I||null===(t=I.color)||void 0===t?void 0:t.text,boxSizing:"border-box",minHeight:g,...S.style},R=!i&&!l,A=function({focalPoint:e,imageFit:t,isImgElement:r,isRepeated:o,url:n}){let a={};var l;return a=r?{...a,...(l=e,l?{objectPosition:K(l)}:{}),objectFit:t}:{...a,...n&&{backgroundImage:`url(${n})`},backgroundPosition:K(e),...!o&&{backgroundRepeat:"no-repeat",backgroundSize:"cover"===t?t:"auto"}},a}({focalPoint:a,imageFit:s,isImgElement:R,isRepeated:i,url:k}),L={background:b,backgroundColor:h};return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(je,{enable:{bottom:!0},onResize:y,showHandle:m,style:{minHeight:g}}),(0,o.createElement)("div",{className:x,style:N},(0,o.createElement)("div",{className:`${f}__wrapper`},(0,o.createElement)("div",{className:"background-dim__overlay",style:L}),k&&(R?(0,o.createElement)("img",{alt:_.name,className:`${f}__background-image`,src:k,style:A,onLoad:e=>{var t,r;E({height:null===(t=e.currentTarget)||void 0===t?void 0:t.naturalHeight,width:null===(r=e.currentTarget)||void 0===r?void 0:r.naturalWidth})}}):(0,o.createElement)("div",{className:q()(`${f}__background-image`,{"has-parallax":l}),style:A})),(0,o.createElement)("h2",{className:`${f}__title`,dangerouslySetInnerHTML:{__html:_.name}}),!ke(null==p?void 0:p.variation)&&(0,o.createElement)("h3",{className:`${f}__variation`,dangerouslySetInnerHTML:{__html:p.variation}}),v&&(0,o.createElement)("div",{className:`${f}__description`,dangerouslySetInnerHTML:{__html:(null==d?void 0:d.description)||(null==p?void 0:p.short_description)}}),w&&(0,o.createElement)("div",{className:`${f}__price`,dangerouslySetInnerHTML:{__html:p.price_html}}),(0,o.createElement)("div",{className:`${f}__link`},(()=>{const{categoryId:e,linkText:t,productId:r}=c;return(0,o.createElement)(Me,{itemId:e||r,linkText:t,permalink:(d||p).permalink})})()))))})():(0,o.createElement)($.Placeholder,{className:f,icon:(0,o.createElement)($.Icon,{icon:t}),label:r},u?(0,o.createElement)($.Spinner,null):(0,o.createElement)(o.Fragment,null,(0,o.createElement)("p",null,e),(0,o.createElement)("div",{style:{flexBasis:"100%",height:"0"}}),(0,o.createElement)("button",{type:"button",className:"components-button is-secondary",onClick:()=>h({editMode:!0})},n))))})(De),e=>t=>{const{error:r,isLoading:n,name:a}=t,l=X(a),i=a===j?t.getCategory:t.getProduct;return r?(0,o.createElement)(Y,{className:`${l}-error`,error:r,isLoading:n,onRetry:i}):(0,o.createElement)(e,{...t})},e=>t=>{const[r,n]=t.useEditingImage,a=(0,i.useRef)(null),{attributes:l,backgroundImageSize:s,name:c,setAttributes:d}=t,{mediaId:u,mediaSrc:m}=l,g=c===B?t.product:t.category,{backgroundImageId:p,backgroundImageSrc:h}=D({item:g,mediaId:u,mediaSrc:m,blockName:c});return r?(0,o.createElement)("div",{ref:a},(0,o.createElement)(V,{align:l.align,backgroundImageId:p,backgroundImageSize:s,backgroundImageSrc:h,containerRef:a,isEditingImage:r,setAttributes:d,setIsEditingImage:n})):(0,o.createElement)(e,{...t})},e=>t=>{const{attributes:r,name:n,setAttributes:a}=t,{alt:l,dimRatio:i,focalPoint:s,hasParallax:c,isRepeated:d,imageFit:u,mediaId:m,mediaSrc:g,overlayColor:p,overlayGradient:h,showDesc:b,showPrice:v}=r,_=n===B?t.product:t.category,{setGradient:w}=(0,O.__experimentalUseGradient)({gradientAttribute:"overlayGradient",customGradientAttribute:"overlayGradient"}),{backgroundImageSrc:E}=D({item:_,mediaId:m,mediaSrc:g,blockName:n}),k=n===B?(0,o.createElement)($.ToggleControl,{label:(0,T.__)("Show price","woocommerce"),checked:v,onChange:()=>a({showPrice:!v})}):void 0;return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(Z,{alt:l,backgroundImageSrc:E,contentPanel:k,dimRatio:i,focalPoint:s,hasParallax:c,isRepeated:d,imageFit:u,overlayColor:p,overlayGradient:h,setAttributes:a,setGradient:w,showDesc:b}),(0,o.createElement)(e,{...t}))},(({cropLabel:e,editLabel:t})=>r=>n=>{const[a,l]=n.useEditingImage,{attributes:i,category:s,name:c,product:d,setAttributes:u}=n,{contentAlign:m,editMode:g,mediaId:p,mediaSrc:h}=i,b=s||d,{backgroundImageId:v,backgroundImageSrc:_}=D({item:b,mediaId:p,mediaSrc:h,blockName:c});return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(z,{backgroundImageId:v,backgroundImageSrc:_,contentAlign:m,cropLabel:e,editLabel:t,editMode:g,isEditingImage:a,mediaSrc:h,setAttributes:u,setIsEditingImage:l}),(0,o.createElement)(r,{...n}))})(He)])((()=>(0,o.createElement)(o.Fragment,null)));function Ze(e){return function(t){const r=(0,O.useBlockProps)(),{color:n,...a}=r.style;return(0,o.createElement)("div",{...r,style:a},(0,o.createElement)(e,{...t}))}}!function(e,t,r,n){var a,l,i,s,c,d,u,g,p,h,b;const v={attributes:{...r.attributes,minHeight:{type:"number",default:(0,m.getSetting)("defaultHeight",500)}},supports:{...r.supports,color:{background:null===(a=r.supports)||void 0===a||null===(l=a.color)||void 0===l?void 0:l.background,text:null===(i=r.supports)||void 0===i||null===(s=i.color)||void 0===s?void 0:s.text},spacing:{padding:null===(c=r.supports)||void 0===c||null===(d=c.spacing)||void 0===d?void 0:d.padding,...N()&&{__experimentalDefaultControls:{padding:null===(u=r.supports)||void 0===u||null===(g=u.spacing)||void 0===g?void 0:g.__experimentalDefaultControls},__experimentalSkipSerialization:null===(p=r.supports)||void 0===p||null===(h=p.spacing)||void 0===h?void 0:h.__experimentalSkipSerialization}},...N()&&{__experimentalBorder:null==r||null===(b=r.supports)||void 0===b?void 0:b.__experimentalBorder}}},_={attributes:{alt:"",contentAlign:"center",dimRatio:50,editMode:!1,hasParallax:!1,isRepeated:!1,height:(0,m.getSetting)("defaultHeight",500),mediaSrc:"",overlayColor:"#000000",showDesc:!0}};(0,P.registerBlockType)(r,{...v,example:{..._,...t},edit:Ze(e),save:()=>(0,o.createElement)(O.InnerBlocks.Content,null),...n})}(Ve,{attributes:{productId:"preview",previewProduct:{id:1,name:"WordPress Pennant",variation:"",permalink:"https://example.org",sku:"wp-pennant",short_description:(0,T.__)("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:S+"previews/pennant.jpg",thumbnail:S+"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,T.__)("Add to cart","woocommerce"),description:(0,T.__)("Add to cart","woocommerce")},has_options:!1,is_purchasable:!0,is_in_stock:!0,on_sale:!0},editMode:!1}},JSON.parse('{"name":"woocommerce/featured-product","version":"1.0.0","title":"Featured Product","description":"Highlight a product or variation.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"align":["wide","full"],"html":false,"color":{"background":true,"text":true},"spacing":{"padding":true,"__experimentalDefaultControls":{"padding":true},"__experimentalSkipSerialization":true},"__experimentalBorder":{"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},"editMode":{"type":"boolean","default":true},"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},"showDesc":{"type":"boolean","default":true},"showPrice":{"type":"boolean","default":true}},"textdomain":"woocommerce","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}'),{icon:{src:(0,o.createElement)(n.Z,{icon:a.Z,className:"wc-block-editor-components-block-icon"})}})},2611:()=>{},1887:()=>{},2513:()=>{},3366:()=>{},5301:()=>{},8462:()=>{},5932:()=>{},9196:e=>{"use strict";e.exports=window.React},4333:e=>{"use strict";e.exports=window.wp.compose},9307:e=>{"use strict";e.exports=window.wp.element},5736:e=>{"use strict";e.exports=window.wp.i18n},9127:e=>{"use strict";e.exports=window.wp.isShallowEqual},444:e=>{"use strict";e.exports=window.wp.primitives}},r={};function o(e){var n=r[e];if(void 0!==n)return n.exports;var a=r[e]={exports:{}};return t[e].call(a.exports,a,a.exports,o),a.exports}o.m=t,e=[],o.O=(t,r,n,a)=>{if(!r){var l=1/0;for(d=0;d<e.length;d++){for(var[r,n,a]=e[d],i=!0,s=0;s<r.length;s++)(!1&a||l>=a)&&Object.keys(o.O).every((e=>o.O[e](r[s])))?r.splice(s--,1):(i=!1,a<l&&(l=a));if(i){e.splice(d--,1);var c=n();void 0!==c&&(t=c)}}return t}a=a||0;for(var d=e.length;d>0&&e[d-1][2]>a;d--)e[d]=e[d-1];e[d]=[r,n,a]},o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.j=5639,(()=>{var e={5639:0};o.O.j=t=>0===e[t];var t=(t,r)=>{var n,a,[l,i,s]=r,c=0;if(l.some((t=>0!==e[t]))){for(n in i)o.o(i,n)&&(o.m[n]=i[n]);if(s)var d=s(o)}for(t&&t(r);c<l.length;c++)a=l[c],o.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return o.O(d)},r=self.webpackChunkwebpackWcBlocksJsonp=self.webpackChunkwebpackWcBlocksJsonp||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var n=o.O(void 0,[2869],(()=>o(4748)));n=o.O(n),((this.wc=this.wc||{}).blocks=this.wc.blocks||{})["featured-product"]=n})(); |