"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[7387],{31098:(e,t,o)=>{o.r(t),o.d(t,{default:()=>f});var r=o(51393),d=o(86020),c=o(14599),n=o(99196),i=o(98817),s=o(93601),u=o(46530),a=o(65736),l=o(37798),p=o(9818),_=o(69307),m=o(57726),x=o(81514);(0,r.productEditorHeaderApiFetchMiddleware)(),(0,r.productApiFetchMiddleware)();const h=(0,n.lazy)((()=>o.e(363).then(o.bind(o,70363)))),b=(0,n.lazy)((()=>Promise.resolve().then(o.t.bind(o,51393,23)).then((e=>({default:e.__experimentalProductMVPFeedbackModalContainer})))));function f(){const{productId:e}=(0,s.UO)();(0,n.useEffect)((()=>{document.body.classList.add("is-product-editor");const e=(0,r.__experimentalInitBlocks)();return()=>{document.body.classList.remove("is-product-editor"),e()}}),[]),(0,n.useEffect)((()=>((0,i.registerPlugin)("wc-admin-product-editor",{scope:"woocommerce-product-block-editor",render:()=>(0,n.useContext)(r.__experimentalEditorLoadingContext)?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(r.__experimentalWooProductMoreMenuItem,{children:({onClose:e})=>(0,x.jsx)(m.e,{onClose:e})}),(0,x.jsx)(u.WooFooterItem,{children:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(r.__experimentalProductMVPCESFooter,{productType:"product"}),(0,x.jsx)(n.Suspense,{fallback:(0,x.jsx)(d.Spinner,{}),children:(0,x.jsx)(b,{productId:e?Number.parseInt(e,10):void 0})})]})}),(0,x.jsx)(n.Suspense,{fallback:(0,x.jsx)(d.Spinner,{}),children:(0,x.jsx)(h,{})})]})}),()=>{(0,i.unregisterPlugin)("wc-admin-product-editor")})),[e]),(0,n.useEffect)((function(){e?(0,c.recordEvent)("product_edit_view",{source:r.TRACKS_SOURCE,product_id:e}):(0,c.recordEvent)("product_add_view",{source:r.TRACKS_SOURCE})}),[e]);const t=function(e){const[t,o]=(0,_.useState)(void 0);return(0,_.useEffect)((()=>{e?o(Number.parseInt(e,10)):(0,p.dispatch)(l.store).saveEntityRecord("postType","product",{title:r.AUTO_DRAFT_NAME,status:"auto-draft"}).then((e=>o(e.id))).catch((e=>{throw o(void 0),e}))}),[e]),t}(e);return t?(0,x.jsx)(r.__experimentalEditor,{productId:t}):(0,x.jsx)("div",{className:"woocommerce-layout__loading",children:(0,x.jsx)(d.Spinner,{"aria-label":(0,a.__)("Creating the product","woocommerce")})})}}}]);