(()=>{var e,t={6467:(e,t,o)=>{"use strict";o.r(t);var c={};o.r(c),o.d(c,{blockifyConfig:()=>S,getDescription:()=>I,getTitle:()=>B,isConversionPossible:()=>C});var r={};o.r(r),o.d(r,{blockifyConfig:()=>M,getDescription:()=>N,getTitle:()=>P,isConversionPossible:()=>T});var l=o(9196);const i=window.wp.blocks,n=window.wp.blockEditor,a=window.wp.components;var s=o(5736),h=o(1984),d=o(3370);const m=window.wp.data;var u=o(9307);const w=window.wp.notices;var p=o(444),g=o(4184),b=o.n(g);const k=(0,l.createElement)((({className:e,height:t,width:o,...c})=>(0,l.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 245 145",className:b()("woo-icon",e),width:o,height:t,...c},(0,l.createElement)("path",{fill:"#7f54b3",d:"M22.76 0h199.1a22.77 22.77 0 0 1 22.8 22.76v75.92a22.77 22.77 0 0 1-22.78 22.78h-71.41l9.77 24-43.13-24H22.76C10.1946 121.449.011 111.2654 0 98.7V22.76C.011 10.1946 10.1946.011 22.76 0z"}),(0,l.createElement)("path",{fill:"#FFF",fillRule:"nonzero",d:"M12.32 20.63a8.16 8.16 0 0 1 6.25-3.09c5.0733-.36 7.9867 2.0333 8.74 7.18 3.14 20.86 6.4933 38.5633 10.06 53.11l21.92-41.69c2-3.76 4.49-5.76 7.52-6 4.3867-.3067 7.13 2.49 8.23 8.39a186 186 0 0 0 9.47 34.23c2.62-25.38 7.0133-43.7133 13.18-55a7.73 7.73 0 0 1 6.6-4.43 8.8 8.8 0 0 1 6.32 2 7.75 7.75 0 0 1 3.05 5.74 8.52 8.52 0 0 1-1 4.77c-3.9 7.24-7.12 19.28-9.66 36.12-2.48 16.2533-3.3967 28.9633-2.75 38.13a12.25 12.25 0 0 1-1.16 6.56 6.32 6.32 0 0 1-5.33 3.53c-2.6667.18-5.3033-1.0567-7.91-3.71-9.2933-9.54-16.6567-23.7267-22.09-42.56C57.3 76.7167 52.48 86.3333 49.3 92.76c-5.86 11.3333-10.89 17.13-15.09 17.39-2.7333.1933-5.0667-2.0933-7-6.86-5.1-13.0933-10.5833-38.4033-16.45-75.93a8.56 8.56 0 0 1 1.56-6.73zM227.23 36.34a23.17 23.17 0 0 0-16-11.59 26.25 26.25 0 0 0-5.42-.58c-9.5867 0-17.41 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6167 14.3333 4.85 19.8a23.15 23.15 0 0 0 16 11.59 26.28 26.28 0 0 0 5.42.59c9.68 0 17.5033-5 23.47-15A53.89 53.89 0 0 0 232.08 56c0-7.7333-1.6167-14.2867-4.85-19.66zm-12.61 27.72c-1.3733 6.56-3.9167 11.5-7.63 14.82-2.9267 2.6667-5.6133 3.7433-8.06 3.23-2.4467-.5133-4.4033-2.6667-5.87-6.46a25.68 25.68 0 0 1-1.76-9.09 35.9 35.9 0 0 1 .73-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.68 25.68 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03zM164.57 36.34a23.2 23.2 0 0 0-16-11.59 26.42 26.42 0 0 0-5.43-.58c-9.5933 0-17.4167 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6133 14.3333 4.84 19.8a23.19 23.19 0 0 0 16 11.59 26.44 26.44 0 0 0 5.43.59c9.68 0 17.5033-5 23.47-15A53.88 53.88 0 0 0 169.4 56c0-7.7333-1.6133-14.2867-4.84-19.66h.01zm-12.61 27.72c-1.3667 6.56-3.91 11.5-7.63 14.82-2.93 2.64-5.63 3.72-8.07 3.23-2.44-.49-4.4-2.64-5.86-6.46a25.7 25.7 0 0 1-1.77-9.09 35.9 35.9 0 0 1 .74-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.91 25.91 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03z"}))),null),x=({blocks:e,findCondition:t})=>{for(const o of e){if(t(o))return o;if(o.innerBlocks){const e=x({blocks:o.innerBlocks,findCondition:t});if(e)return e}}};o(9879),o(8995);const f=()=>(0,l.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 892 516"},(0,l.createElement)(p.G,{fill:"currentColor",transform:"translate(-1)"},(0,l.createElement)(p.Rect,{width:"100",height:"20",x:"1",rx:"2"}),(0,l.createElement)(p.Rect,{width:"100",height:"20",x:"421",rx:"2"}),(0,l.createElement)(p.Rect,{width:"100",height:"20",x:"793",rx:"2"}),(0,l.createElement)(p.Rect,{width:"150",height:"24",x:"125",y:"48",rx:"2"}),(0,l.createElement)(p.Rect,{width:"50",height:"24",x:"125",y:"86",rx:"2"}),(0,l.createElement)(p.Rect,{width:"50",height:"24",x:"457",y:"48",rx:"2"}),(0,l.createElement)(p.Rect,{width:"100",height:"100",x:"15",y:"48",rx:"2"}),(0,l.createElement)(p.Rect,{width:"150",height:"150",x:"1",y:"318",rx:"2"}),(0,l.createElement)(p.Rect,{width:"150",height:"150",x:"373",y:"318",rx:"2"}),(0,l.createElement)(p.Rect,{width:"150",height:"150",x:"187",y:"318",rx:"2"}),(0,l.createElement)(p.Rect,{width:"150",height:"24",x:"125",y:"178",rx:"2"}),(0,l.createElement)(p.Rect,{width:"50",height:"24",x:"125",y:"216",rx:"2"}),(0,l.createElement)(p.Rect,{width:"50",height:"24",x:"457",y:"178",rx:"2"}),(0,l.createElement)(p.Rect,{width:"100",height:"100",x:"15",y:"178",rx:"2"}),(0,l.createElement)(p.Rect,{width:"304",height:"359",x:"588",y:"34",rx:"2"}),(0,l.createElement)(p.Rect,{width:"520",height:"1",x:"1",y:"34",rx:".5"}),(0,l.createElement)(p.Rect,{width:"520",height:"1",y:"162",rx:".5"}),(0,l.createElement)(p.Rect,{width:"520",height:"1",x:"1",y:"292",rx:".5"}),(0,l.createElement)(p.Rect,{width:"304",height:"64",x:"589",y:"407",rx:"2"}),(0,l.createElement)(p.Rect,{width:"100",height:"38",x:"26",y:"478",rx:"2"}),(0,l.createElement)(p.Rect,{width:"100",height:"38",x:"212",y:"478",rx:"2"}),(0,l.createElement)(p.Rect,{width:"100",height:"38",x:"398",y:"478",rx:"2"}))),E=()=>(0,l.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 892 726"},(0,l.createElement)(p.G,{fill:"currentColor",transform:"translate(-1)"},(0,l.createElement)(p.Rect,{width:"203",height:"38",x:"1",rx:"2"}),(0,l.createElement)(p.Rect,{width:"434",height:"38",x:"1",y:"62",rx:"2"}),(0,l.createElement)(p.Rect,{width:"434",height:"38",y:"124",rx:"2"}),(0,l.createElement)(p.Rect,{width:"434",height:"38",x:"1",y:"186",rx:"2"}),(0,l.createElement)(p.Rect,{width:"434",height:"38",x:"2",y:"248",rx:"2"}),(0,l.createElement)(p.Rect,{width:"434",height:"38",x:"3",y:"310",rx:"2"}),(0,l.createElement)(p.Rect,{width:"434",height:"38",x:"3",y:"372",rx:"2"}),(0,l.createElement)(p.Rect,{width:"892",height:"204",x:"2",y:"434",rx:"2"}),(0,l.createElement)(p.Rect,{width:"203",height:"38",x:"231",rx:"2"}),(0,l.createElement)(p.Rect,{width:"203",height:"38",x:"514",rx:"2"}),(0,l.createElement)(p.Rect,{width:"427",height:"100",x:"466",y:"62",rx:"2"}),(0,l.createElement)(p.Rect,{width:"304",height:"64",x:"588",y:"662",rx:"2"}),(0,l.createElement)(p.Rect,{width:"38",height:"38",x:"466",rx:"2"}),(0,l.createElement)(p.Rect,{width:"203",height:"38",x:"48",y:"662",rx:"2"}),(0,l.createElement)(p.Rect,{width:"38",height:"38",y:"662",rx:"2"}))),y="cart",v="checkout",_={cart:{type:y,title:(0,s.__)("Cart Shortcode","woocommerce"),description:(0,s.__)("Renders the classic cart shortcode.","woocommerce"),placeholder:"cart"},checkout:{type:v,title:(0,s.__)("Checkout Cart","woocommerce"),description:(0,s.__)("Renders the classic checkout shortcode.","woocommerce"),placeholder:"checkout"}},C=()=>!0,R=e=>[(0,i.createBlock)("woocommerce/checkout",{...e,className:"wc-block-checkout"})].filter(Boolean),B=()=>(0,s.__)("Classic Checkout","woocommerce"),I=()=>(0,s.__)("This block will render the classic checkout shortcode. You can optionally transform it into blocks for more control over the checkout experience.","woocommerce"),S={getButtonLabel:()=>(0,s.__)("Transform into blocks","woocommerce"),onClickCallback:({clientId:e,attributes:t,getBlocks:o,replaceBlock:c,selectBlock:r})=>{c(e,R(t));const l=o().find((e=>"core/group"===e.name&&e.innerBlocks.some((e=>"woocommerce/store-notices"===e.name))));l&&r(l.clientId)},getBlockifiedTemplate:R},T=()=>!0,O=e=>[(0,i.createBlock)("woocommerce/cart",{...e,className:"wc-block-cart"})].filter(Boolean),P=()=>(0,s.__)("Classic Cart","woocommerce"),N=()=>(0,s.__)("This block will render the classic cart shortcode. You can optionally transform it into blocks for more control over the cart experience.","woocommerce"),M={getButtonLabel:()=>(0,s.__)("Transform into blocks","woocommerce"),onClickCallback:({clientId:e,attributes:t,getBlocks:o,replaceBlock:c,selectBlock:r})=>{c(e,O(t));const l=o().find((e=>"core/group"===e.name&&e.innerBlocks.some((e=>"woocommerce/store-notices"===e.name))));l&&r(l.clientId)},getBlockifiedTemplate:O},j=JSON.parse('{"name":"woocommerce/classic-shortcode","version":"1.0.0","title":"Classic Shortcode","description":"Renders classic WooCommerce shortcodes.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"align":true,"html":false,"multiple":false,"reusable":false,"inserter":true},"attributes":{"shortcode":{"type":"string","default":"cart","enum":["cart","checkout"]},"align":{"type":"string","default":"wide"}},"textdomain":"woocommerce","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}'),z={[y]:r,[v]:c,fallback:{isConversionPossible:()=>!1,getBlockifiedTemplate:()=>[],getDescription:()=>"",onClickCallback:()=>{}}},W=({blockifyConfig:e,clientId:t,attributes:o})=>{const{getButtonLabel:c,onClickCallback:r,getBlockifiedTemplate:h}=e,[d,p]=(0,u.useState)(!1),{replaceBlock:g,selectBlock:b}=(0,m.useDispatch)(n.store),{createInfoNotice:k}=(0,m.useDispatch)(w.store),{getBlocks:f}=(0,m.useSelect)((e=>({getBlocks:e(n.store).getBlocks})),[]);return(0,l.createElement)(a.TabbableContainer,{className:"wp-block-woocommerce-classic-shortcode__placeholder-migration-button-container"},(0,l.createElement)(a.Button,{variant:"primary",onClick:()=>{r({clientId:t,getBlocks:f,attributes:o,replaceBlock:g,selectBlock:b}),k((0,s.__)("Classic shortcode transformed to blocks.","woocommerce"),{actions:[{label:(0,s.__)("Undo","woocommerce"),onClick:()=>{const e=["woocommerce/cart","woocommerce/checkout"],t=x({blocks:f(),findCondition:t=>e.includes(t.name)});t&&g(t.clientId,(0,i.createBlock)("woocommerce/classic-shortcode",{shortcode:o.shortcode}))}}],type:"snackbar"})},onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),text:c?c():"",tabIndex:0},d&&(0,l.createElement)(a.Popover,{resize:!1,placement:"right-end"},(0,l.createElement)("div",{style:{minWidth:"250px",width:"250px",maxWidth:"250px",minHeight:"300px",height:"300px",maxHeight:"300px",cursor:"pointer"}},(0,l.createElement)(n.BlockPreview,{blocks:h({...o,isPreview:!0}),viewportWidth:1200,additionalStyles:[{css:"body { padding: 20px !important; height: fit-content !important; overflow:hidden}"}]})))),(0,l.createElement)(a.Button,{variant:"secondary",href:"https://woocommerce.com/document/cart-checkout-blocks-support-status/",target:"_blank",tabIndex:0},(0,s.__)("Learn more","woocommerce")))},D=({clientId:e,attributes:t})=>{var o,c;const r=(0,n.useBlockProps)(),i=function(e,t){const o=Object.keys(t);let c=null;for(let r=0;o.length>r;r++){const l=t[e.substr(0,o[r].length)];if(l){c=l;break}}return c}(t.shortcode,_),d=t.shortcode,m=null!==(o=null==i?void 0:i.placeholder)&&void 0!==o?o:"cart",w=null!==(c=null==i?void 0:i.type)&&void 0!==c?c:"fallback",{isConversionPossible:p,getDescription:g,getTitle:b,blockifyConfig:x}=z[w],y=p(),v=b?b():(0,s.__)("Classic Shortcode Placeholder","woocommerce"),C=g(d,y),R=(0,u.createInterpolateElement)((0,s.__)("You can learn more about the benefits of switching to blocks, compatibility with extensions, and how to switch back to shortcodes in our documentation.","woocommerce"),{a:(0,l.createElement)(a.ExternalLink,{href:"https://woocommerce.com/document/cart-checkout-blocks-support-status/"})});return(0,l.createElement)("div",{...r},(0,l.createElement)(a.Placeholder,{className:"wp-block-woocommerce-classic-shortcode__placeholder"},(0,l.createElement)("div",{className:"wp-block-woocommerce-classic-shortcode__placeholder-wireframe"},"cart"===m?(0,l.createElement)(f,null):(0,l.createElement)(E,null)),(0,l.createElement)("div",{className:"wp-block-woocommerce-classic-shortcode__placeholder-copy"},(0,l.createElement)("div",{className:"wp-block-woocommerce-classic-shortcode__placeholder-copy__icon-container"},(0,l.createElement)("span",{className:"woo-icon"},(0,l.createElement)(h.Z,{icon:k})," ",(0,s.__)("WooCommerce","woocommerce")),(0,l.createElement)("span",null,v)),(0,l.createElement)("p",{dangerouslySetInnerHTML:{__html:C}}),(0,l.createElement)("p",null,R),y&&x&&(0,l.createElement)(W,{clientId:e,blockifyConfig:x,attributes:t}))))},L={icon:(0,l.createElement)(h.Z,{icon:d.Z,className:"wc-block-editor-components-block-icon"}),edit:({attributes:e,clientId:t,setAttributes:o})=>(0,l.createElement)(D,{attributes:e,setAttributes:o,clientId:t}),save:()=>null,variations:[{name:"checkout",title:(0,s.__)("Classic Checkout","woocommerce"),attributes:{shortcode:"checkout"},isActive:(e,t)=>e.shortcode===t.shortcode,scope:["inserter"]},{name:"cart",title:(0,s.__)("Classic Cart","woocommerce"),attributes:{shortcode:"cart"},isActive:(e,t)=>e.shortcode===t.shortcode,scope:["inserter"],isDefault:!0}]};(0,i.registerBlockType)(j,L)},9879:()=>{},8995:()=>{},9196:e=>{"use strict";e.exports=window.React},9307:e=>{"use strict";e.exports=window.wp.element},5736:e=>{"use strict";e.exports=window.wp.i18n},444:e=>{"use strict";e.exports=window.wp.primitives}},o={};function c(e){var r=o[e];if(void 0!==r)return r.exports;var l=o[e]={exports:{}};return t[e].call(l.exports,l,l.exports,c),l.exports}c.m=t,e=[],c.O=(t,o,r,l)=>{if(!o){var i=1/0;for(h=0;h=l)&&Object.keys(c.O).every((e=>c.O[e](o[a])))?o.splice(a--,1):(n=!1,l0&&e[h-1][2]>l;h--)e[h]=e[h-1];e[h]=[o,r,l]},c.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return c.d(t,{a:t}),t},c.d=(e,t)=>{for(var o in t)c.o(t,o)&&!c.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.j=9569,(()=>{var e={9569:0};c.O.j=t=>0===e[t];var t=(t,o)=>{var r,l,[i,n,a]=o,s=0;if(i.some((t=>0!==e[t]))){for(r in n)c.o(n,r)&&(c.m[r]=n[r]);if(a)var h=a(c)}for(t&&t(o);sc(6467)));r=c.O(r),((this.wc=this.wc||{}).blocks=this.wc.blocks||{})["classic-shortcode"]=r})();