!function(e){var t={};function o(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=10)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.plugins},function(e,t){e.exports=window.wp.editSite},function(e,t){e.exports=window.wp.blocks},function(e,t){e.exports=window.wp.components},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wp.blockEditor},function(e,t){e.exports=window.wp.coreData},function(e,t){},function(e,t,o){"use strict";o.r(t);var n=o(0),r=o(3),c=o(1),i=o(4),l=o(5),u=o(6),s=o(8),a=o(7);var d=o(2);o(9);const p=e=>e.some(e=>"woocommerce/legacy-template"===e.name||p(e.innerBlocks)),b=()=>{var e,t,o;const{blocks:d,editedPostId:b}=Object(c.useSelect)(e=>({blocks:e(a.store).getBlocks(),editedPostId:e("core/edit-site").getEditedPostId()}),[]),{replaceBlocks:m}=Object(c.useDispatch)(a.store),f=Object(s.useEntityRecord)("postType","wp_template",b),g=Object(n.useMemo)(()=>p(d),[d]),w=Object(n.useMemo)(()=>(e=>e.reduce((e,t)=>"core/template-part"===t.name?e:[...e,t.clientId],[]))(d),[d]);return Object(n.createElement)(n.Fragment,null,!g&&Object(n.createElement)(r.PluginTemplateSettingPanel,null,Object(n.createElement)(l.PanelBody,{className:"wc-block-editor-revert-button-container"},Object(n.createElement)(l.Button,{variant:"secondary",onClick:()=>{var e;m(w,Object(i.createBlock)("core/group",{layout:{inherit:!0,type:"constrained"}},[Object(i.createBlock)("woocommerce/legacy-template",{template:null==f||null===(e=f.record)||void 0===e?void 0:e.slug})]))}},Object(u.__)("Revert to Classic Product Template","woocommerce")),Object(n.createElement)("span",null,Object(n.createInterpolateElement)(Object(u.__)("The <strongText /> template doesn’t allow for reordering or customizing blocks, but might work better with your extensions","woocommerce"),{strongText:Object(n.createElement)("strong",null,null!==(e=null==f||null===(t=f.record)||void 0===t||null===(o=t.title)||void 0===o?void 0:o.rendered)&&void 0!==e?e:"")})))))},m=["single-product","archive-product","product-search-results","taxonomy-product_cat","taxonomy-product_tag","taxonomy-product_attribute"],f="woocommerce-blocks-revert-button-templates";let g;Object(c.subscribe)(()=>{const e=g,t=Object(c.select)("core/edit-site");if(!(e=>{if(!(e=>null===e)(t=e)&&t instanceof Object&&t.constructor===Object){const t=e.getEditedPostType();return"wp_template"===t||"wp_template_part"===t}var t;return!1})(t))return;if(g=null==t?void 0:t.getEditedPostId(),e===g)return;const o=m.some(e=>{var t;return null===(t=g)||void 0===t?void 0:t.includes(e)}),n=void 0!==r.PluginTemplateSettingPanel;if(o&&n){if(Object(d.getPlugin)(f))return;return Object(d.registerPlugin)(f,{render:b})}void 0!==Object(d.getPlugin)(f)&&Object(d.unregisterPlugin)(f)},"core/edit-site")}]);