PATH:
home
/
lab2454c
/
adenbic.com
/
wp-content
/
plugins
/
woocommerce
/
assets
/
client
/
admin
/
product-editor
/*! For license information please see index.js.LICENSE.txt */ (()=>{var e={83849:(e,t)=>{var o;!function(){"use strict";var r={}.hasOwnProperty;function n(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var a=typeof o;if("string"===a||"number"===a)e.push(o);else if(Array.isArray(o)){if(o.length){var i=n.apply(null,o);i&&e.push(i)}}else if("object"===a)if(o.toString===Object.prototype.toString)for(var l in o)r.call(o,l)&&o[l]&&e.push(l);else e.push(o.toString())}}return e.join(" ")}e.exports?(n.default=n,e.exports=n):void 0===(o=function(){return n}.apply(t,[]))||(e.exports=o)}()},74944:function(e){e.exports=function(){"use strict";var e=Object.hasOwnProperty,t=Object.setPrototypeOf,o=Object.isFrozen,r=Object.getPrototypeOf,n=Object.getOwnPropertyDescriptor,a=Object.freeze,i=Object.seal,l=Object.create,c="undefined"!=typeof Reflect&&Reflect,s=c.apply,m=c.construct;s||(s=function(e,t,o){return e.apply(t,o)}),a||(a=function(e){return e}),i||(i=function(e){return e}),m||(m=function(e,t){return new(Function.prototype.bind.apply(e,[null].concat(function(e){if(Array.isArray(e)){for(var t=0,o=Array(e.length);t<e.length;t++)o[t]=e[t];return o}return Array.from(e)}(t))))});var d,u=y(Array.prototype.forEach),p=y(Array.prototype.pop),_=y(Array.prototype.push),f=y(String.prototype.toLowerCase),h=y(String.prototype.match),g=y(String.prototype.replace),w=y(String.prototype.indexOf),v=y(String.prototype.trim),E=y(RegExp.prototype.test),b=(d=TypeError,function(){for(var e=arguments.length,t=Array(e),o=0;o<e;o++)t[o]=arguments[o];return m(d,t)});function y(e){return function(t){for(var o=arguments.length,r=Array(o>1?o-1:0),n=1;n<o;n++)r[n-1]=arguments[n];return s(e,t,r)}}function C(e,r){t&&t(e,null);for(var n=r.length;n--;){var a=r[n];if("string"==typeof a){var i=f(a);i!==a&&(o(r)||(r[n]=i),a=i)}e[a]=!0}return e}function k(t){var o=l(null),r=void 0;for(r in t)s(e,t,[r])&&(o[r]=t[r]);return o}function S(e,t){for(;null!==e;){var o=n(e,t);if(o){if(o.get)return y(o.get);if("function"==typeof o.value)return y(o.value)}e=r(e)}return function(e){return console.warn("fallback value for",e),null}}var N=a(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),T=a(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),x=a(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),P=a(["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),A=a(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),I=a(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),M=a(["#text"]),R=a(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),L=a(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),O=a(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),D=a(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),B=i(/\{\{[\s\S]*|[\s\S]*\}\}/gm),F=i(/<%[\s\S]*|[\s\S]*%>/gm),V=i(/^data-[\-\w.\u00B7-\uFFFF]/),H=i(/^aria-[\-\w]+$/),U=i(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),z=i(/^(?:\w+script|data):/i),$=i(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),G=i(/^html$/i),W="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function j(e){if(Array.isArray(e)){for(var t=0,o=Array(e.length);t<e.length;t++)o[t]=e[t];return o}return Array.from(e)}var q=function(){return"undefined"==typeof window?null:window},Z=function(e,t){if("object"!==(void 0===e?"undefined":W(e))||"function"!=typeof e.createPolicy)return null;var o=null,r="data-tt-policy-suffix";t.currentScript&&t.currentScript.hasAttribute(r)&&(o=t.currentScript.getAttribute(r));var n="dompurify"+(o?"#"+o:"");try{return e.createPolicy(n,{createHTML:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+n+" could not be created."),null}};return function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:q(),o=function(t){return e(t)};if(o.version="2.3.6",o.removed=[],!t||!t.document||9!==t.document.nodeType)return o.isSupported=!1,o;var r=t.document,n=t.document,i=t.DocumentFragment,l=t.HTMLTemplateElement,c=t.Node,s=t.Element,m=t.NodeFilter,d=t.NamedNodeMap,y=void 0===d?t.NamedNodeMap||t.MozNamedAttrMap:d,J=t.HTMLFormElement,X=t.DOMParser,Y=t.trustedTypes,K=s.prototype,Q=S(K,"cloneNode"),ee=S(K,"nextSibling"),te=S(K,"childNodes"),oe=S(K,"parentNode");if("function"==typeof l){var re=n.createElement("template");re.content&&re.content.ownerDocument&&(n=re.content.ownerDocument)}var ne=Z(Y,r),ae=ne?ne.createHTML(""):"",ie=n,le=ie.implementation,ce=ie.createNodeIterator,se=ie.createDocumentFragment,me=ie.getElementsByTagName,de=r.importNode,ue={};try{ue=k(n).documentMode?n.documentMode:{}}catch(e){}var pe={};o.isSupported="function"==typeof oe&&le&&void 0!==le.createHTMLDocument&&9!==ue;var _e=B,fe=F,he=V,ge=H,we=z,ve=$,Ee=U,be=null,ye=C({},[].concat(j(N),j(T),j(x),j(A),j(M))),Ce=null,ke=C({},[].concat(j(R),j(L),j(O),j(D))),Se=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ne=null,Te=null,xe=!0,Pe=!0,Ae=!1,Ie=!1,Me=!1,Re=!1,Le=!1,Oe=!1,De=!1,Be=!1,Fe=!0,Ve=!0,He=!1,Ue={},ze=null,$e=C({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Ge=null,We=C({},["audio","video","img","source","image","track"]),je=null,qe=C({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ze="http://www.w3.org/1998/Math/MathML",Je="http://www.w3.org/2000/svg",Xe="http://www.w3.org/1999/xhtml",Ye=Xe,Ke=!1,Qe=void 0,et=["application/xhtml+xml","text/html"],tt="text/html",ot=void 0,rt=null,nt=n.createElement("form"),at=function(e){return e instanceof RegExp||e instanceof Function},it=function(e){rt&&rt===e||(e&&"object"===(void 0===e?"undefined":W(e))||(e={}),e=k(e),be="ALLOWED_TAGS"in e?C({},e.ALLOWED_TAGS):ye,Ce="ALLOWED_ATTR"in e?C({},e.ALLOWED_ATTR):ke,je="ADD_URI_SAFE_ATTR"in e?C(k(qe),e.ADD_URI_SAFE_ATTR):qe,Ge="ADD_DATA_URI_TAGS"in e?C(k(We),e.ADD_DATA_URI_TAGS):We,ze="FORBID_CONTENTS"in e?C({},e.FORBID_CONTENTS):$e,Ne="FORBID_TAGS"in e?C({},e.FORBID_TAGS):{},Te="FORBID_ATTR"in e?C({},e.FORBID_ATTR):{},Ue="USE_PROFILES"in e&&e.USE_PROFILES,xe=!1!==e.ALLOW_ARIA_ATTR,Pe=!1!==e.ALLOW_DATA_ATTR,Ae=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ie=e.SAFE_FOR_TEMPLATES||!1,Me=e.WHOLE_DOCUMENT||!1,Oe=e.RETURN_DOM||!1,De=e.RETURN_DOM_FRAGMENT||!1,Be=e.RETURN_TRUSTED_TYPE||!1,Le=e.FORCE_BODY||!1,Fe=!1!==e.SANITIZE_DOM,Ve=!1!==e.KEEP_CONTENT,He=e.IN_PLACE||!1,Ee=e.ALLOWED_URI_REGEXP||Ee,Ye=e.NAMESPACE||Xe,e.CUSTOM_ELEMENT_HANDLING&&at(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Se.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&at(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Se.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Se.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Qe=Qe=-1===et.indexOf(e.PARSER_MEDIA_TYPE)?tt:e.PARSER_MEDIA_TYPE,ot="application/xhtml+xml"===Qe?function(e){return e}:f,Ie&&(Pe=!1),De&&(Oe=!0),Ue&&(be=C({},[].concat(j(M))),Ce=[],!0===Ue.html&&(C(be,N),C(Ce,R)),!0===Ue.svg&&(C(be,T),C(Ce,L),C(Ce,D)),!0===Ue.svgFilters&&(C(be,x),C(Ce,L),C(Ce,D)),!0===Ue.mathMl&&(C(be,A),C(Ce,O),C(Ce,D))),e.ADD_TAGS&&(be===ye&&(be=k(be)),C(be,e.ADD_TAGS)),e.ADD_ATTR&&(Ce===ke&&(Ce=k(Ce)),C(Ce,e.ADD_ATTR)),e.ADD_URI_SAFE_ATTR&&C(je,e.ADD_URI_SAFE_ATTR),e.FORBID_CONTENTS&&(ze===$e&&(ze=k(ze)),C(ze,e.FORBID_CONTENTS)),Ve&&(be["#text"]=!0),Me&&C(be,["html","head","body"]),be.table&&(C(be,["tbody"]),delete Ne.tbody),a&&a(e),rt=e)},lt=C({},["mi","mo","mn","ms","mtext"]),ct=C({},["foreignobject","desc","title","annotation-xml"]),st=C({},T);C(st,x),C(st,P);var mt=C({},A);C(mt,I);var dt=function(e){var t=oe(e);t&&t.tagName||(t={namespaceURI:Xe,tagName:"template"});var o=f(e.tagName),r=f(t.tagName);if(e.namespaceURI===Je)return t.namespaceURI===Xe?"svg"===o:t.namespaceURI===Ze?"svg"===o&&("annotation-xml"===r||lt[r]):Boolean(st[o]);if(e.namespaceURI===Ze)return t.namespaceURI===Xe?"math"===o:t.namespaceURI===Je?"math"===o&&ct[r]:Boolean(mt[o]);if(e.namespaceURI===Xe){if(t.namespaceURI===Je&&!ct[r])return!1;if(t.namespaceURI===Ze&&!lt[r])return!1;var n=C({},["title","style","font","a","script"]);return!mt[o]&&(n[o]||!st[o])}return!1},ut=function(e){_(o.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=ae}catch(t){e.remove()}}},pt=function(e,t){try{_(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){_(o.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!Ce[e])if(Oe||De)try{ut(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},_t=function(e){var t=void 0,o=void 0;if(Le)e="<remove></remove>"+e;else{var r=h(e,/^[\r\n\t ]+/);o=r&&r[0]}"application/xhtml+xml"===Qe&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");var a=ne?ne.createHTML(e):e;if(Ye===Xe)try{t=(new X).parseFromString(a,Qe)}catch(e){}if(!t||!t.documentElement){t=le.createDocument(Ye,"template",null);try{t.documentElement.innerHTML=Ke?"":a}catch(e){}}var i=t.body||t.documentElement;return e&&o&&i.insertBefore(n.createTextNode(o),i.childNodes[0]||null),Ye===Xe?me.call(t,Me?"html":"body")[0]:Me?t.documentElement:i},ft=function(e){return ce.call(e.ownerDocument||e,e,m.SHOW_ELEMENT|m.SHOW_COMMENT|m.SHOW_TEXT,null,!1)},ht=function(e){return e instanceof J&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof y)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore)},gt=function(e){return"object"===(void 0===c?"undefined":W(c))?e instanceof c:e&&"object"===(void 0===e?"undefined":W(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},wt=function(e,t,r){pe[e]&&u(pe[e],(function(e){e.call(o,t,r,rt)}))},vt=function(e){var t=void 0;if(wt("beforeSanitizeElements",e,null),ht(e))return ut(e),!0;if(h(e.nodeName,/[\u0080-\uFFFF]/))return ut(e),!0;var r=ot(e.nodeName);if(wt("uponSanitizeElement",e,{tagName:r,allowedTags:be}),!gt(e.firstElementChild)&&(!gt(e.content)||!gt(e.content.firstElementChild))&&E(/<[/\w]/g,e.innerHTML)&&E(/<[/\w]/g,e.textContent))return ut(e),!0;if("select"===r&&E(/<template/i,e.innerHTML))return ut(e),!0;if(!be[r]||Ne[r]){if(!Ne[r]&&bt(r)){if(Se.tagNameCheck instanceof RegExp&&E(Se.tagNameCheck,r))return!1;if(Se.tagNameCheck instanceof Function&&Se.tagNameCheck(r))return!1}if(Ve&&!ze[r]){var n=oe(e)||e.parentNode,a=te(e)||e.childNodes;if(a&&n)for(var i=a.length-1;i>=0;--i)n.insertBefore(Q(a[i],!0),ee(e))}return ut(e),!0}return e instanceof s&&!dt(e)?(ut(e),!0):"noscript"!==r&&"noembed"!==r||!E(/<\/no(script|embed)/i,e.innerHTML)?(Ie&&3===e.nodeType&&(t=e.textContent,t=g(t,_e," "),t=g(t,fe," "),e.textContent!==t&&(_(o.removed,{element:e.cloneNode()}),e.textContent=t)),wt("afterSanitizeElements",e,null),!1):(ut(e),!0)},Et=function(e,t,o){if(Fe&&("id"===t||"name"===t)&&(o in n||o in nt))return!1;if(Pe&&!Te[t]&&E(he,t));else if(xe&&E(ge,t));else if(!Ce[t]||Te[t]){if(!(bt(e)&&(Se.tagNameCheck instanceof RegExp&&E(Se.tagNameCheck,e)||Se.tagNameCheck instanceof Function&&Se.tagNameCheck(e))&&(Se.attributeNameCheck instanceof RegExp&&E(Se.attributeNameCheck,t)||Se.attributeNameCheck instanceof Function&&Se.attributeNameCheck(t))||"is"===t&&Se.allowCustomizedBuiltInElements&&(Se.tagNameCheck instanceof RegExp&&E(Se.tagNameCheck,o)||Se.tagNameCheck instanceof Function&&Se.tagNameCheck(o))))return!1}else if(je[t]);else if(E(Ee,g(o,ve,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==w(o,"data:")||!Ge[e])if(Ae&&!E(we,g(o,ve,"")));else if(o)return!1;return!0},bt=function(e){return e.indexOf("-")>0},yt=function(e){var t=void 0,r=void 0,n=void 0,a=void 0;wt("beforeSanitizeAttributes",e,null);var i=e.attributes;if(i){var l={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ce};for(a=i.length;a--;){var c=t=i[a],s=c.name,m=c.namespaceURI;if(r=v(t.value),n=ot(s),l.attrName=n,l.attrValue=r,l.keepAttr=!0,l.forceKeepAttr=void 0,wt("uponSanitizeAttribute",e,l),r=l.attrValue,!l.forceKeepAttr&&(pt(s,e),l.keepAttr))if(E(/\/>/i,r))pt(s,e);else{Ie&&(r=g(r,_e," "),r=g(r,fe," "));var d=ot(e.nodeName);if(Et(d,n,r))try{m?e.setAttributeNS(m,s,r):e.setAttribute(s,r),p(o.removed)}catch(e){}}}wt("afterSanitizeAttributes",e,null)}},Ct=function e(t){var o=void 0,r=ft(t);for(wt("beforeSanitizeShadowDOM",t,null);o=r.nextNode();)wt("uponSanitizeShadowNode",o,null),vt(o)||(o.content instanceof i&&e(o.content),yt(o));wt("afterSanitizeShadowDOM",t,null)};return o.sanitize=function(e,n){var a=void 0,l=void 0,s=void 0,m=void 0,d=void 0;if((Ke=!e)&&(e="\x3c!--\x3e"),"string"!=typeof e&&!gt(e)){if("function"!=typeof e.toString)throw b("toString is not a function");if("string"!=typeof(e=e.toString()))throw b("dirty is not a string, aborting")}if(!o.isSupported){if("object"===W(t.toStaticHTML)||"function"==typeof t.toStaticHTML){if("string"==typeof e)return t.toStaticHTML(e);if(gt(e))return t.toStaticHTML(e.outerHTML)}return e}if(Re||it(n),o.removed=[],"string"==typeof e&&(He=!1),He){if(e.nodeName){var u=ot(e.nodeName);if(!be[u]||Ne[u])throw b("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof c)1===(l=(a=_t("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===l.nodeName||"HTML"===l.nodeName?a=l:a.appendChild(l);else{if(!Oe&&!Ie&&!Me&&-1===e.indexOf("<"))return ne&&Be?ne.createHTML(e):e;if(!(a=_t(e)))return Oe?null:Be?ae:""}a&&Le&&ut(a.firstChild);for(var p=ft(He?e:a);s=p.nextNode();)3===s.nodeType&&s===m||vt(s)||(s.content instanceof i&&Ct(s.content),yt(s),m=s);if(m=null,He)return e;if(Oe){if(De)for(d=se.call(a.ownerDocument);a.firstChild;)d.appendChild(a.firstChild);else d=a;return Ce.shadowroot&&(d=de.call(r,d,!0)),d}var _=Me?a.outerHTML:a.innerHTML;return Me&&be["!doctype"]&&a.ownerDocument&&a.ownerDocument.doctype&&a.ownerDocument.doctype.name&&E(G,a.ownerDocument.doctype.name)&&(_="<!DOCTYPE "+a.ownerDocument.doctype.name+">\n"+_),Ie&&(_=g(_,_e," "),_=g(_,fe," ")),ne&&Be?ne.createHTML(_):_},o.setConfig=function(e){it(e),Re=!0},o.clearConfig=function(){rt=null,Re=!1},o.isValidAttribute=function(e,t,o){rt||it({});var r=ot(e),n=ot(t);return Et(r,n,o)},o.addHook=function(e,t){"function"==typeof t&&(pe[e]=pe[e]||[],_(pe[e],t))},o.removeHook=function(e){pe[e]&&p(pe[e])},o.removeHooks=function(e){pe[e]&&(pe[e]=[])},o.removeAllHooks=function(){pe={}},o}()}()},31772:(e,t,o)=>{"use strict";var r=o(25148);function n(){}function a(){}a.resetWarningCache=n,e.exports=function(){function e(e,t,o,n,a,i){if(i!==r){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function t(){return e}e.isRequired=e;var o={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:n};return o.PropTypes=o,o}},7862:(e,t,o)=>{e.exports=o(31772)()},25148:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,o),a.exports}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})};var r={};(()=>{"use strict";o.r(r),o.d(r,{AUTO_DRAFT_NAME:()=>D,AddNewShippingClassModal:()=>on,DETAILS_SECTION_ID:()=>T,NEW_PRODUCT_MANAGEMENT_ENABLED_OPTION_NAME:()=>C,PRODUCT_STATUS_LABELS:()=>Pl,PostTypeContext:()=>je,ProductPageSkeleton:()=>Nl,RemoveConfirmationModal:()=>ba,TAB_GENERAL_ID:()=>N,TRACKS_SOURCE:()=>x,__experimentalAttributeControl:()=>Ca,__experimentalAttributes:()=>Ta,__experimentalBlockIcon:()=>ul,__experimentalCheckboxControl:()=>ct,__experimentalDetailsDescriptionField:()=>W,__experimentalDetailsFeatureField:()=>z,__experimentalDetailsNameField:()=>H,__experimentalDetailsSummaryField:()=>G,__experimentalEditor:()=>Je,__experimentalInitBlocks:()=>dl,__experimentalManageDownloadLimitsModal:()=>Io,__experimentalNumberControl:()=>il,__experimentalProductFieldSection:()=>s,__experimentalProductMVPCESFooter:()=>fl,__experimentalProductMVPFeedbackModal:()=>vl,__experimentalProductMVPFeedbackModalContainer:()=>El,__experimentalProductSectionLayout:()=>l,__experimentalShippingDimensionsImage:()=>un,__experimentalTextControl:()=>el,__experimentalUseCurrencyInputProps:()=>wr,__experimentalUseFeedbackBar:()=>Re,__experimentalUseProductEntityProp:()=>it,__experimentalUseProductHelper:()=>V,__experimentalUseVariationSwitcher:()=>kl,__experimentalUseVariationsOrder:()=>zl,__experimentalVariationSwitcherFooter:()=>Sl,__experimentalWooProductFieldItem:()=>f,__experimentalWooProductMoreMenuItem:()=>q,__experimentalWooProductSectionItem:()=>h,__experimentalWooProductTabItem:()=>g,createOrderedChildren:()=>d,deferSelectInFocus:()=>xo,formatCurrencyDisplayValue:()=>gr,getCheckboxTracks:()=>U,getCurrencySymbolProps:()=>Tl,getDerivedProductType:()=>O,getHeaderTitle:()=>Ce,getProductStatus:()=>Al,getProductStockStatus:()=>oi,getProductStockStatusClass:()=>ri,getProductTitle:()=>Il,getProductVariationTitle:()=>Ml,getTruncatedProductVariationTitle:()=>Rl,hasAttributesUsedForVariations:()=>La,initBlock:()=>Ll,isValidEmail:()=>_l,preventLeavingProductForm:()=>$e,productApiFetchMiddleware:()=>Fl,registerProductEditorBlockType:()=>et,sift:()=>ka,sortFillsByOrder:()=>u,truncate:()=>vi,useValidation:()=>tr,useValidations:()=>Te});var e={};o.r(e),o.d(e,{disableComplementaryArea:()=>se,enableComplementaryArea:()=>ce,pinItem:()=>me,setFeatureDefaults:()=>_e,setFeatureValue:()=>pe,toggleFeature:()=>ue,unpinItem:()=>de});var t={};o.r(t),o.d(t,{getActiveComplementaryArea:()=>fe,isFeatureActive:()=>ge,isItemPinned:()=>he});var n={};o.r(n),o.d(n,{attributesInit:()=>Aa,initCatalogVisibility:()=>nt,initCheckbox:()=>ut,initCollapsible:()=>ht,initConditional:()=>Et,initDescription:()=>_o,initDownloads:()=>zo,initImages:()=>Ko,initInventoryQuantity:()=>Xn,initLowStockQty:()=>ar,initName:()=>fr,initNotice:()=>Hi,initNoticeHasVariations:()=>Wi,initNumber:()=>ml,initPricing:()=>yr,initRadio:()=>xr,initRegularPrice:()=>Rr,initRequirePassword:()=>$a,initSalePrice:()=>Fr,initScheduleSale:()=>jr,initSection:()=>Yr,initShippingClass:()=>mn,initShippingDimensions:()=>hn,initSku:()=>mr,initSummary:()=>xn,initTab:()=>Dn,initTag:()=>Wn,initTaxonomy:()=>Ki,initText:()=>nl,initToggle:()=>ta,initVariationItems:()=>Ai,initVariationOptions:()=>Oi,initVariations:()=>Fa});const a=window.wp.element,i=window.wc.components,l=e=>{let{title:t,description:o,className:r,children:n}=e;return(0,a.createElement)(i.FormSection,{title:t,description:o,className:r},a.Children.map(n,(e=>(0,a.isValidElement)(e)&&e.props.onChange?(0,a.createElement)("div",{className:"product-field-layout"},e):e)))},c=window.wp.components,s=e=>{let{id:t,title:o,description:r,className:n,children:s}=e;return(0,a.createElement)(l,{title:o,description:r,className:n},(0,a.createElement)(c.Card,null,(0,a.createElement)(c.CardBody,null,s,(0,a.createElement)(i.__experimentalWooProductFieldItem.Slot,{section:t}))))},m=window.React;function d(e,t,o,r){const{children:n,props:i}=function(e,t,o,r){if("function"==typeof e)return{children:e({...o,order:t,...r}),props:{order:t,...r}};if((0,m.isValidElement)(e))return"function"==typeof(null==e?void 0:e.type)?{children:e,props:{...o,order:t,...r}}:{children:e,props:{order:t,...r}};throw Error("Invalid children type")}(e,t,o,r);return(0,a.cloneElement)(n,i)}const u=e=>{const t=[...e].sort(((e,t)=>e[0].props.order-t[0].props.order));return(0,a.createElement)(m.Fragment,null,t)},p=20,_=e=>{let{fieldName:t,sectionName:o,order:r,children:n}=e;const{registerFill:l,getFillHelpers:s}=(0,i.useSlotContext)(),m=`product_field/${o}/${t}`;return(0,a.useEffect)((()=>{l(m)}),[]),(0,a.createElement)(c.Fill,{name:`woocommerce_product_field_${o}`,key:m},(e=>d(n,r,{sectionName:o,...e,...s()},{_id:m})))},f=e=>{let{children:t,sections:o,id:r}=e;return(0,a.createElement)(a.Fragment,null,o.map((e=>{let{name:o,order:n=p}=e;return(0,a.createElement)(_,{fieldName:r,sectionName:o,order:n,key:o},t)})))};f.Slot=e=>{let{fillProps:t,section:o}=e;const{filterRegisteredFills:r}=(0,i.useSlotContext)();return(0,a.createElement)(c.Slot,{name:`woocommerce_product_field_${o}`,fillProps:t},(e=>{var t;return u?a.Children.map(null===(t=u(r(e)))||void 0===t?void 0:t.props.children,(e=>(0,a.createElement)("div",{className:"woocommerce-product-form__field"},e))):null}))};const h=e=>{let{children:t,tabs:o}=e;return(0,a.createElement)(a.Fragment,null,o.map((e=>{let{name:o,order:r}=e;return(0,a.createElement)(c.Fill,{name:`woocommerce_product_section_${o}`,key:o},(e=>d(t,r||20,{tabName:o,...e})))})))};h.Slot=e=>{let{fillProps:t,tab:o}=e;return(0,a.createElement)(c.Slot,{name:`woocommerce_product_section_${o}`,fillProps:t},(e=>u?u(e):null))};const g=e=>{let{children:t,tabProps:o,templates:r}=e;return r?(0,a.createElement)(a.Fragment,null,r.map((e=>(0,a.createElement)(c.Fill,{name:`woocommerce_product_tab_${e.name}`,key:e.name},(r=>d(t,e.order||20,{},{tabProps:o,templateName:e.name,order:e.order||20,...r})))))):(console.warn("WooProductTabItem fill is missing templates property."),null)};g.Slot=e=>{let{fillProps:t,template:o,children:r}=e;return(0,a.createElement)(c.Slot,{name:`woocommerce_product_tab_${o}`,fillProps:t},(e=>{const o=e.reduce(((e,o)=>{let{childrenMap:r,tabs:n}=e;var a;const i=o[0].props;if(i&&i.tabProps){r[i.tabProps.name]=o[0];const e="function"==typeof i.tabProps?i.tabProps(t):i.tabProps;n.push({...e,order:null!==(a=i.order)&&void 0!==a?a:20})}return{childrenMap:r,tabs:n}}),{childrenMap:{},tabs:[]}),n=o.tabs.sort(((e,t)=>e.order-t.order));return r(n,o.childrenMap)}))};const w=window.wp.data,v=window.wp.i18n,E=window.wp.url,b=window.wc.data,y="woocommerce_product_editor_show_feedback_bar",C="woocommerce_new_product_management_enabled",k="woocommerce_single_variation_notice_dismissed",S="__ADD_NEW_SHIPPING_CLASS_OPTION__",N="tab/general",T=`${N}/details`,x="product-block-editor-v1",P=5,A=[5,10,25],I=window.wc.tracks,M=e=>{let{product:t,permalinkPrefix:o,permalinkSuffix:r,onCancel:n,onSaved:i,saveHandler:l}=e;const{createNotice:s}=(0,w.useDispatch)("core/notices"),[m,d]=(0,a.useState)(!1),[u,p]=(0,a.useState)(t.slug||(0,E.cleanForSlug)(t.name)),_=o+(0,E.cleanForSlug)(u)+r;return(0,a.createElement)(c.Modal,{title:(0,v.__)("Edit product link","woocommerce"),onRequestClose:()=>n(),className:"woocommerce-product-link-edit-modal"},(0,a.createElement)("div",{className:"woocommerce-product-link-edit-modal__wrapper"},(0,a.createElement)("p",{className:"woocommerce-product-link-edit-modal__description"},(0,v.__)("Create a unique link for this product. Use simple, descriptive words and numbers. We'll replace spaces with hyphens (-).","woocommerce")),(0,a.createElement)(c.TextControl,{label:(0,v.__)("Product link","woocommerce"),name:"slug",value:u,onChange:p,hideLabelFromVision:!0,help:(0,a.createInterpolateElement)((0,v.__)("Preview: <link />","woocommerce"),{link:(0,a.createElement)("strong",null,_)})}),(0,a.createElement)("div",{className:"woocommerce-product-link-edit-modal__buttons"},(0,a.createElement)(c.Button,{isSecondary:!0,onClick:()=>n()},(0,v.__)("Cancel","woocommerce")),(0,a.createElement)(c.Button,{isPrimary:!0,isBusy:m,disabled:m||u===t.slug,onClick:async()=>{d(!0),await(async()=>{var e;(0,I.recordEvent)("product_update_slug",{source:x,product_id:t.id,product_type:t.type});const{slug:o,permalink:r}=null!==(e=await l(u))&&void 0!==e?e:{};o?s(o===(0,E.cleanForSlug)(u)?"success":"info",o===(0,E.cleanForSlug)(u)?(0,v.__)("Product link successfully updated.","woocommerce"):(0,v.__)("Product link already existed, updated to ","woocommerce")+r):s("error",(0,v.__)("Failed to update product link.","woocommerce")),i()})(),d(!1)}},(0,v.__)("Save","woocommerce")))))},R=window.wc.number,L=window.wc.currency,O=e=>{var t;return window.wcAdminFeatures["product-variation-management"]&&(null===(t=e.attributes)||void 0===t?void 0:t.find((e=>e.options.length&&e.variation)))?"variable":"simple"},D="AUTO-DRAFT";function B(e){return b.productReadOnlyProperties.forEach((t=>delete e[t])),e}function F(e,t){return"publish"===e&&t?[{label:(0,v.__)("View in store","woocommerce"),onClick:()=>{(0,I.recordEvent)("product_preview_changes",{source:x}),window.open(t,"_blank")}}]:[]}function V(){const{createProduct:e,updateProduct:t,deleteProduct:o}=(0,w.useDispatch)(b.PRODUCTS_STORE_NAME),{batchUpdateProductVariations:r,invalidateResolutionForStoreSelector:n}=(0,w.useDispatch)(b.EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME),{createNotice:i}=(0,w.useDispatch)("core/notices"),[l,c]=(0,a.useState)(!1),[s,m]=(0,a.useState)({draft:!1,publish:!1}),d=(0,a.useContext)(L.CurrencyContext),u=(0,a.useCallback)((async function(t,o){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return m({...s,[o]:!0}),e({...t,status:o,type:O(t)}).then((e=>{if(!r){const t="publish"===e.status?(0,v.__)("Product published.","woocommerce"):(0,v.__)("Product successfully created.","woocommerce");i("success",`🎉 ${t}`,{actions:F(e.status,e.permalink)})}return m({...s,[o]:!1}),e}),(e=>(r||i("error","publish"===o?(0,v.__)("Failed to publish product.","woocommerce"):(0,v.__)("Failed to create product.","woocommerce")),m({...s,[o]:!1}),e)))}),[s]);async function p(e,t){if(t)return r({product_id:e},{update:Object.values(t).flatMap(Object.entries).map((e=>{let[t,o]=e;return{id:t,menu_order:o}}))})}const _=(0,a.useCallback)((async function(e,o,r){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return m({...s,[r]:!0}),t(e,{...o,status:r,type:O(o)}).then((async e=>p(e.id,o.variationsOrder).then((()=>n("getProductVariations"))).then((()=>e)))).then((e=>{if(!a){const t="draft"===o.status&&"publish"===e.status?(0,v.__)("Product published.","woocommerce"):(0,v.__)("Product successfully updated.","woocommerce");i("success",`🎉 ${t}`,{actions:F(e.status,e.permalink)})}return m({...s,[r]:!1}),e}),(e=>(a||i("error",(0,v.__)("Failed to update product.","woocommerce")),m({...s,[r]:!1}),e)))}),[s]),f=(0,a.useCallback)((async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"draft";return u(B({...e,name:(e.name||D)+" - Copy"}),t)}),[]),h=(0,a.useCallback)((async e=>(c(!0),o(e).then((e=>{const t=(0,v.__)("Successfully moved product to Trash.","woocommerce");return i("success",`🎉 ${t}`),c(!1),e}),(e=>(i("error",(0,v.__)("Failed to move product to Trash.","woocommerce")),c(!1),e))))),[]),g=(0,a.useCallback)((e=>{if(!e.length)return"";const{getCurrencyConfig:t}=d,{decimalSeparator:o}=t(),r=new RegExp("[^-\\d\\%s]+".replace("%s",o),"g"),n=new RegExp("[%s](?=%s*[%s])".replaceAll("%s",o),"g");return e.replace(r,"").replace(n,"").replace(o,".")}),[d]),E=(0,a.useCallback)((e=>{const{getCurrencyConfig:t}=d,{decimalSeparator:o,thousandSeparator:r}=t();return R.numberFormat({decimalSeparator:o,thousandSeparator:r},e)}),[d]),y=(0,a.useCallback)((e=>{const{getCurrencyConfig:t}=d,{decimalSeparator:o,thousandSeparator:r}=t();return R.parseNumber({decimalSeparator:o,thousandSeparator:r},e)}),[d]);return{createProductWithStatus:u,updateProductWithStatus:_,copyProductWithStatus:f,deleteProductAndRedirect:h,sanitizePrice:g,formatNumber:E,parseNumber:y,isUpdatingDraft:s.draft,isUpdatingPublished:s.publish,isDeleting:l}}const H=e=>{let{}=e;const{updateProductWithStatus:t}=V(),[o,r]=(0,a.useState)(!1),{getInputProps:n,values:l,touched:s,errors:m,setValue:d,resetForm:u}=(0,i.useFormContext)(),{permalinkPrefix:p,permalinkSuffix:_}=(0,w.useSelect)((e=>{const{getPermalinkParts:t}=e(b.PRODUCTS_STORE_NAME);if(l.id){const e=t(l.id);return{permalinkPrefix:null==e?void 0:e.prefix,permalinkSuffix:null==e?void 0:e.suffix}}return{}}));return(0,a.createElement)("div",null,(0,a.createElement)(c.TextControl,{label:(0,a.createInterpolateElement)((0,v.__)("Name <required />","woocommerce"),{required:(0,a.createElement)("span",{className:"woocommerce-product-form__optional-input"},(0,v.__)("(required)","woocommerce"))}),name:"product-details-name",placeholder:(0,v.__)("e.g. 12 oz Coffee Mug","woocommerce"),...n("name",{onBlur:()=>{var e;!l.sku&&(null===(e=l.name)||void 0===e?void 0:e.length)&&d("sku",(0,E.cleanForSlug)(l.name))}})}),l.id&&!(Boolean(s.name)&&Boolean(m.name))&&p&&(0,a.createElement)("span",{className:"woocommerce-product-form__secondary-text product-details-section__product-link"},(0,v.__)("Product link","woocommerce"),": ",(0,a.createElement)("a",{href:l.permalink,target:"_blank",rel:"noreferrer"},p,l.slug||(0,E.cleanForSlug)(l.name),_),(0,a.createElement)(c.Button,{variant:"link",onClick:()=>r(!0)},(0,v.__)("Edit","woocommerce"))),o&&(0,a.createElement)(M,{permalinkPrefix:p||"",permalinkSuffix:_||"",product:l,onCancel:()=>r(!1),onSaved:()=>r(!1),saveHandler:async e=>{const o=await t(l.id,{slug:e},l.status,!0);if(o&&o.id)return u({...l,slug:o.slug,permalink:o.permalink},s,m),{slug:o.slug,permalink:o.permalink}}}))};function U(e){return{onChange:t=>{(0,I.recordEvent)(`product_checkbox_${e}`,{checked:t})}}}const z=()=>{const{getCheckboxControlProps:e}=(0,i.useFormContext)();return(0,a.createElement)(c.CheckboxControl,{label:(0,a.createElement)(a.Fragment,null,(0,v.__)("Feature this product","woocommerce"),(0,a.createElement)(i.__experimentalTooltip,{text:(0,a.createInterpolateElement)((0,v.__)("Include this product in a featured section on your website with a widget or shortcode. <moreLink />","woocommerce"),{moreLink:(0,a.createElement)(i.Link,{href:"https://woo.com/document/woocommerce-shortcodes/#products",target:"_blank",type:"external",onClick:()=>(0,I.recordEvent)("add_product_learn_more",{category:"product-details"})},(0,v.__)("Learn more","woocommerce"))})})),...e("featured",U("featured"))})},$=window.wp.blocks,G=()=>{const{setValue:e,values:t}=(0,i.useFormContext)(),[o,r]=(0,a.useState)((0,$.parse)(t.short_description||""));return(0,a.createElement)(i.__experimentalRichTextEditor,{label:(0,v.__)("Summary","woocommerce"),blocks:o,onChange:t=>{r(t),o.length&&e("short_description",(0,$.serialize)(t))},placeholder:(0,v.__)("Summarize this product in 1-2 short sentences. We'll show it at the top of the page.","woocommerce")})},W=()=>{const{setValue:e,values:t}=(0,i.useFormContext)(),[o,r]=(0,a.useState)((0,$.parse)(t.description||""));return(0,a.createElement)(i.__experimentalRichTextEditor,{label:(0,v.__)("Description","woocommerce"),blocks:o,onChange:t=>{r(t),o.length&&e("description",(0,$.serialize)(t))},placeholder:(0,v.__)("Describe this product. What makes it unique? What are its most important features?","woocommerce")})},j="WooProductMenuMenuItem",q=e=>{let{children:t,order:o=1}=e;return(0,a.createElement)(c.Fill,{name:j},(e=>(0,i.createOrderedChildren)(t,o,e)))};q.Slot=e=>{let{fillProps:t}=e;return(0,a.createElement)(c.Slot,{name:j,fillProps:t},i.sortFillsByOrder)};const Z=window.wc.adminLayout,J=window.wp.coreData,X=window.wp.keyboardShortcuts;function Y(){return Y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},Y.apply(this,arguments)}var K=o(83849),Q=o.n(K);const ee=window.wp.compose,te=(0,a.forwardRef)((function(e,t){let{footer:o,header:r,sidebar:n,secondarySidebar:i,notices:l,content:s,drawer:m,actions:d,labels:u,className:p,shortcuts:_}=e;const f=(0,c.__unstableUseNavigateRegions)(_);!function(e){(0,a.useEffect)((()=>{const t=document&&document.querySelector(`html:not(.${e})`);if(t)return t.classList.toggle(e),()=>{t.classList.toggle(e)}}),[e])}("interface-interface-skeleton__html-container");const h={drawer:(0,v.__)("Drawer"),header:(0,v.__)("Header"),body:(0,v.__)("Content"),secondarySidebar:(0,v.__)("Block Library"),sidebar:(0,v.__)("Settings"),actions:(0,v.__)("Publish"),footer:(0,v.__)("Footer"),...u};return(0,a.createElement)("div",Y({},f,{ref:(0,ee.useMergeRefs)([t,f.ref]),className:Q()(p,"interface-interface-skeleton",f.className,!!o&&"has-footer")}),!!m&&(0,a.createElement)("div",{className:"interface-interface-skeleton__drawer",role:"region","aria-label":h.drawer,tabIndex:"-1"},m),(0,a.createElement)("div",{className:"interface-interface-skeleton__editor"},!!r&&(0,a.createElement)("div",{className:"interface-interface-skeleton__header",role:"region","aria-label":h.header,tabIndex:"-1"},r),(0,a.createElement)("div",{className:"interface-interface-skeleton__body"},!!i&&(0,a.createElement)("div",{className:"interface-interface-skeleton__secondary-sidebar",role:"region","aria-label":h.secondarySidebar,tabIndex:"-1"},i),!!l&&(0,a.createElement)("div",{className:"interface-interface-skeleton__notices"},l),(0,a.createElement)("div",{className:"interface-interface-skeleton__content",role:"region","aria-label":h.body,tabIndex:"-1"},s),!!n&&(0,a.createElement)("div",{className:"interface-interface-skeleton__sidebar",role:"region","aria-label":h.sidebar,tabIndex:"-1"},n),!!d&&(0,a.createElement)("div",{className:"interface-interface-skeleton__actions",role:"region","aria-label":h.actions,tabIndex:"-1"},d))),!!o&&(0,a.createElement)("div",{className:"interface-interface-skeleton__footer",role:"region","aria-label":h.footer,tabIndex:"-1"},o))})),oe=window.wp.primitives,re=(0,a.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(oe.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"}));function ne(e){let{as:t=c.DropdownMenu,className:o,label:r=(0,v.__)("Options"),popoverProps:n,toggleProps:i,children:l}=e;return(0,a.createElement)(t,{className:Q()("interface-more-menu-dropdown",o),icon:re,label:r,popoverProps:{position:"bottom left",...n,className:Q()("interface-more-menu-dropdown__content",null==n?void 0:n.className)},toggleProps:{tooltipPosition:"bottom",...i}},(e=>l(e)))}const ae=window.wp.deprecated;var ie=o.n(ae);const le=window.wp.preferences,ce=(e,t)=>o=>{let{registry:r}=o;t&&r.dispatch(le.store).set(e,"complementaryArea",t)},se=e=>t=>{let{registry:o}=t;o.dispatch(le.store).set(e,"complementaryArea",null)},me=(e,t)=>o=>{let{registry:r}=o;if(!t)return;const n=r.select(le.store).get(e,"pinnedItems");!0!==(null==n?void 0:n[t])&&r.dispatch(le.store).set(e,"pinnedItems",{...n,[t]:!0})},de=(e,t)=>o=>{let{registry:r}=o;if(!t)return;const n=r.select(le.store).get(e,"pinnedItems");r.dispatch(le.store).set(e,"pinnedItems",{...n,[t]:!1})};function ue(e,t){return function(o){let{registry:r}=o;ie()("dispatch( 'core/interface' ).toggleFeature",{since:"6.0",alternative:"dispatch( 'core/preferences' ).toggle"}),r.dispatch(le.store).toggle(e,t)}}function pe(e,t,o){return function(r){let{registry:n}=r;ie()("dispatch( 'core/interface' ).setFeatureValue",{since:"6.0",alternative:"dispatch( 'core/preferences' ).set"}),n.dispatch(le.store).set(e,t,!!o)}}function _e(e,t){return function(o){let{registry:r}=o;ie()("dispatch( 'core/interface' ).setFeatureDefaults",{since:"6.0",alternative:"dispatch( 'core/preferences' ).setDefaults"}),r.dispatch(le.store).setDefaults(e,t)}}const fe=(0,w.createRegistrySelector)((e=>(t,o)=>e(le.store).get(o,"complementaryArea"))),he=(0,w.createRegistrySelector)((e=>(t,o,r)=>{var n;const a=e(le.store).get(o,"pinnedItems");return null===(n=null==a?void 0:a[r])||void 0===n||n})),ge=(0,w.createRegistrySelector)((e=>(t,o,r)=>(ie()("select( 'core/interface' ).isFeatureActive( scope, featureName )",{since:"6.0",alternative:"select( 'core/preferences' ).get( scope, featureName )"}),!!e(le.store).get(o,r)))),we=(0,w.createReduxStore)("core/interface",{reducer:()=>{},actions:e,selectors:t});(0,w.register)(we);const ve=(0,a.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(oe.Path,{d:"M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"})),Ee=function(e){let{icon:t,size:o=24,...r}=e;return(0,a.cloneElement)(t,{width:o,height:o,...r})},be=(0,a.createElement)(oe.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(oe.Path,{d:"M18 4h-7c-1.1 0-2 .9-2 2v3H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-3h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4.5 14c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h3V13c0 1.1.9 2 2 2h2.5v3zm0-4.5H11c-.3 0-.5-.2-.5-.5v-2.5H13c.3 0 .5.2.5.5v2.5zm5-.5c0 .3-.2.5-.5.5h-3V11c0-1.1-.9-2-2-2h-2.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7z"})),ye=window.wc.navigation,Ce=(e,t)=>Boolean(e)&&e!==t?e:t===D?(0,v.__)("Add new product","woocommerce"):t,ke=()=>(0,a.createElement)(a.Fragment,null,(0,a.createElement)(ne,{toggleProps:{onClick:()=>(0,I.recordEvent)("product_dropdown_click")},popoverProps:{className:"woocommerce-product-header__more-menu"}},(e=>{let{onClose:t}=e;return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(q.Slot,{fillProps:{onClose:t}}))})));function Se(e){switch(e.code){case"variable_product_no_variation_prices":case"product_form_field_error":return e.message;case"product_invalid_sku":return(0,v.__)("Invalid or duplicated SKU.","woocommerce");case"product_create_error":return(0,v.__)("Failed to create product.","woocommerce");case"product_publish_error":return(0,v.__)("Failed to publish product.","woocommerce");case"product_preview_error":return(0,v.__)("Failed to preview product.","woocommerce");default:return(0,v.__)("Failed to save product.","woocommerce")}}const Ne=(0,a.createContext)({errors:{},registerValidator:()=>()=>{},unRegisterValidator:()=>()=>{},validateField:()=>Promise.resolve(void 0),validateAll:()=>Promise.resolve({})});function Te(){const e=(0,a.useContext)(Ne),[t,o]=(0,a.useState)(!1);return{isValidating:t,validate:async t=>(o(!0),new Promise(((o,r)=>{e.validateAll(t).then((e=>{!function(e){return Object.values(e).some(Boolean)}(e)?o():r(e)})).catch((()=>{r(e.errors)}))})).finally((()=>{o(!1)})))}}function xe(e){let{productStatus:t,...o}=e;const{createErrorNotice:r}=(0,w.useDispatch)("core/notices"),n=function(e){let{productStatus:t,productType:o="product",disabled:r,onClick:n,onSaveSuccess:i,onSaveError:l,...c}=e;const s=(0,a.useRef)(),[m]=(0,J.useEntityProp)("postType",o,"id"),[d]=(0,J.useEntityProp)("postType",o,"permalink"),{hasEdits:u,isDisabled:p}=(0,w.useSelect)((e=>{const{hasEditsForEntityRecord:t,isSavingEntityRecord:r}=e("core");return{isDisabled:r("postType",o,m),hasEdits:t("postType",o,m)}}),[m]),{isValidating:_,validate:f}=Te(),h=r||p||_,{editEntityRecord:g,saveEditedEntityRecord:E}=(0,w.useDispatch)("core");let b;return"string"==typeof d&&(b=new URL(d),b.searchParams.append("preview","true")),{"aria-label":(0,v.__)("Preview in new tab","woocommerce"),children:(0,v.__)("Preview","woocommerce"),target:"_blank",...c,ref(e){"function"==typeof c.ref&&c.ref(e),s.current=e},"aria-disabled":h,href:null==b?void 0:b.toString(),variant:"tertiary",onClick:async function(e){var r;if(h)return e.preventDefault();if(n&&n(e),u){e.preventDefault();try{await f(),"auto-draft"===t&&await g("postType",o,m,{status:"draft"});const e=await E("postType",o,m,{throwOnError:!0});null===(r=s.current)||void 0===r||r.click(),i&&i(e)}catch(e){if(l){let t=e;t.code||(t={code:"product_preview_error"}),l(t)}}}}}}({productStatus:t,...o,onClick(){(0,I.recordEvent)("product_preview_changes",{source:x})},onSaveSuccess(e){if("auto-draft"===t){const t=(0,ye.getNewPath)({},`/product/${e.id}`);(0,ye.navigateTo)({url:t})}},onSaveError(e){const t=Se(e);r(t)}});return(0,a.createElement)(c.Button,{...n})}const Pe={cross_sell_ids:"cross_sells",reviews_allowed:"enable_reviews",downloadable:"is_downloadable",virtual:"is_virtual",images:"product_gallery",upsell_ids:"upsells"},Ae=["attributes","categories","description","manage_stock","menu_order","note","purchase_note","sale_price","short_description","tags","weight","cross_sell_ids","reviews_allowed","downloadable","virtual","images","upsell_ids"];function Ie(e,t){const{id:o,type:r}=t,n={product_id:o,source:"product-blocks-editor-v1",product_type:r};t.parent_id>0&&(t.note=t.description,delete t.description);for(const e of Object.keys(t))if(Ae.includes(e)){const o=Pe[e]||e;Array.isArray(t[e])||"string"==typeof t[e]?n[o]=t[e].length?"yes":"no":n[o]=t[e]?"yes":"no"}if(t.downloadable||t.virtual){const{downloadable:e,virtual:o}=t,r={virtual:o,downloadable:e};n.product_type_options=Object.keys(r).filter((e=>r[e])).join(",")}"images"in t&&(n.product_image=t.images.length?"yes":"no"),t.dimensions&&(n.dimensions=t.dimensions.length.length||t.dimensions.width.length||t.dimensions.height.length?"yes":"no"),(0,I.recordEvent)(e,n)}const Me=(0,a.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(oe.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})),Re=()=>{const{updateOptions:e}=(0,w.useDispatch)(b.OPTIONS_STORE_NAME),{shouldShowFeedbackBar:t}=(0,w.useSelect)((e=>{var t;const{getOption:o,hasFinishedResolution:r}=e(b.OPTIONS_STORE_NAME),n=o(y);return{shouldShowFeedbackBar:!!r("getOption",[y])&&(null===(t=window.wcTracks)||void 0===t?void 0:t.isEnabled)&&"yes"===n}}),[]);return{shouldShowFeedbackBar:t,maybeShowFeedbackBar:async()=>{var t;const{showFeedbackBarOption:o}=await(async()=>{const{getOption:e}=(0,w.resolveSelect)(b.OPTIONS_STORE_NAME);return{showFeedbackBarOption:await e(y)}})();(null===(t=window.wcTracks)||void 0===t?void 0:t.isEnabled)&&"no"!==o&&e({[y]:"yes"})},hideFeedbackBar:()=>{e({[y]:"no"})}}};function Le(e){let{productStatus:t,productType:o="product",...r}=e;const{createSuccessNotice:n,createErrorNotice:i}=(0,w.useDispatch)("core/notices"),{maybeShowFeedbackBar:l}=Re(),s=function(e){let{productStatus:t,productType:o="product",disabled:r,onClick:n,onSaveSuccess:i,onSaveError:l,...s}=e;const[m]=(0,J.useEntityProp)("postType",o,"id"),{hasEdits:d,isDisabled:u}=(0,w.useSelect)((e=>{const{hasEditsForEntityRecord:t,isSavingEntityRecord:r}=e("core");return{isDisabled:r("postType",o,m),hasEdits:t("postType",o,m)}}),[m]),{isValidating:p,validate:_}=Te(),f=r||u||"publish"!==t&&!d||p,{editEntityRecord:h,saveEditedEntityRecord:g}=(0,w.useDispatch)("core");let E;return E="publish"===t?(0,v.__)("Switch to draft","woocommerce"):d||"auto-draft"===t?(0,v.__)("Save draft","woocommerce"):(0,a.createElement)(a.Fragment,null,(0,a.createElement)(c.Icon,{icon:Me}),(0,v.__)("Saved","woocommerce")),{children:E,...s,"aria-disabled":f,variant:"tertiary",onClick:async function(e){if(f)return e.preventDefault();n&&n(e);try{await _({status:"draft"}),await h("postType",o,m,{status:"draft"});const e=await g("postType",o,m,{throwOnError:!0});i&&i(e)}catch(e){l&&l(e)}}}}({productStatus:t,productType:o,...r,onSaveSuccess(e){if(Ie("product_edit",e),n((0,v.__)("Product saved as draft.","woocommerce")),l(),"auto-draft"===t){const t=(0,ye.getNewPath)({},`/product/${e.id}`);(0,ye.navigateTo)({url:t})}},onSaveError(e){const t=Se(e);i(t)}});return(0,a.createElement)(c.Button,{...s})}function Oe(e){let{productStatus:t,productType:o="product",...r}=e;const{createSuccessNotice:n,createErrorNotice:i}=(0,w.useDispatch)("core/notices"),{maybeShowFeedbackBar:l}=Re(),s=function(e){let{productType:t="product",productStatus:o,disabled:r,onClick:n,onPublishSuccess:a,onPublishError:i,...l}=e;const{isValidating:c,validate:s}=Te(),[m]=(0,J.useEntityProp)("postType",t,"id"),{isSaving:d,isDirty:u}=(0,w.useSelect)((e=>{const{isSavingEntityRecord:o,hasEditsForEntityRecord:r,getRawEntityRecord:n}=e("core");return{isSaving:o("postType",t,m),isDirty:r("postType",t,m),currentPost:n("postType",t,m)}}),[m]),p=d||c,_=r||p||!u,f="product"!==t||"publish"===o,{editEntityRecord:h,saveEditedEntityRecord:g}=(0,w.useDispatch)("core");return{children:f?(0,v.__)("Update","woocommerce"):(0,v.__)("Add","woocommerce"),...l,isBusy:p,"aria-disabled":_,variant:"primary",onClick:async function(e){n&&n(e);try{"product"===t?(await s({status:"publish"}),f||await h("postType",t,m,{status:"publish"})):await s();const e=await g("postType",t,m,{throwOnError:!0});e&&a&&a(e)}catch(e){if(i){let t=e;if(!t.code)if(t={code:f?"product_publish_error":"product_create_error"},e.variations)t.code="variable_product_no_variation_prices",t.message=e.variations;else{const o=Object.values(e).find((e=>void 0!==e));void 0!==o&&(t.code="product_form_field_error",t.message=o)}i(t)}}}}}({productType:o,productStatus:t,...r,onPublishSuccess(e){const r="product"!==o||"publish"===t;r&&Ie("product_update",e);const a=r?(0,v.__)("Product updated.","woocommerce"):(0,v.__)("Product added.","woocommerce"),i={icon:"🎉",actions:[{label:(0,v.__)("View in store","woocommerce"),url:e.permalink,onClick(t){t.preventDefault(),window.open(e.permalink,"_blank")}}]};if(n(a,i),l(),"auto-draft"===t){const t=(0,ye.getNewPath)({},`/product/${e.id}`);(0,ye.navigateTo)({url:t})}},onPublishError(e){const t=Se(e);i(t)}});return(0,a.createElement)(c.Button,{...s})}const De="woocommerce_product_tabs";function Be(e){let{onChange:t=(()=>{})}=e;const[o,r]=(0,a.useState)(null),n=(0,ye.getQuery)(),[i]=(0,J.useEntityProp)("postType","product","id"),l=(0,w.useSelect)((e=>e("core").getEditedEntityRecord("postType","product",i)));return(0,a.useEffect)((()=>{t(o)}),[o]),(0,a.useEffect)((()=>{n.tab&&r(n.tab)}),[n.tab]),(0,a.createElement)(c.NavigableMenu,{role:"tablist",onNavigate:function(e,t){t.click()},className:"woocommerce-product-tabs",orientation:"horizontal"},(0,a.createElement)(c.Slot,{fillProps:{onClick:e=>{(0,ye.navigateTo)({url:(0,ye.getNewPath)({tab:e})}),(0,I.recordEvent)("product_tab_click",function(e,t){const o={product_tab:e,product_type:t.type,source:x};return"inventory"===e?{...o,is_store_stock_management_enabled:t.manage_stock}:o}(e,l))}},name:De},(e=>u?(function(e){var t,n;if(!o)for(let o=0;o<e.length;o++){if(e[o][0].props.disabled)continue;const a=(null===(n=null===(t=e[o][0].props)||void 0===t?void 0:t.children)||void 0===n?void 0:n.key)||null;return void r(a)}}(e),u(e)):null)))}const Fe=(0,v.__)("Return to the main product","woocommerce");function Ve(e){let{onTabSelect:t,productType:o="product"}=e;const[r]=(0,J.useEntityProp)("postType",o,"id"),n=(0,w.useSelect)((e=>{const{getEntityRecord:t}=e("core");return t("postType",o,r)}),[r]),[i]=(0,J.useEntityProp)("postType",o,"name");if(!r)return null;const l=(null==n?void 0:n.parent_id)>0;return(0,a.createElement)("div",{className:"woocommerce-product-header",role:"region","aria-label":(0,v.__)("Product Editor top bar.","woocommerce"),tabIndex:-1},(0,a.createElement)("div",{className:"woocommerce-product-header__inner"},l?(0,a.createElement)("div",{className:"woocommerce-product-header__back"},(0,a.createElement)(c.Tooltip,{className:"woocommerce-product-header__back-tooltip",text:Fe},(0,a.createElement)("div",{className:"woocommerce-product-header__back-tooltip-wrapper"},(0,a.createElement)(c.Button,{icon:ve,isTertiary:!0,onClick:()=>{(0,I.recordEvent)("product_variation_back_to_main_product",{source:x});const e=(0,ye.getNewPath)({tab:"variations"},`/product/${n.parent_id}`);(0,ye.navigateTo)({url:e})}},(0,v.__)("Main product","woocommerce"))))):(0,a.createElement)("div",null),(0,a.createElement)("h1",{className:"woocommerce-product-header__title"},l?(0,a.createElement)("div",{className:"woocommerce-product-header__variable-product-title"},(0,a.createElement)(Ee,{icon:be}),(0,a.createElement)("span",{className:"woocommerce-product-header__variable-product-name"},null==n?void 0:n.name),(0,a.createElement)("span",{className:"woocommerce-product-header__variable-product-id"},"# ",n.id)):Ce(i,n.name)),(0,a.createElement)("div",{className:"woocommerce-product-header__actions"},!l&&(0,a.createElement)(Le,{productType:o,productStatus:n.status}),(0,a.createElement)(xe,{productType:o,productStatus:n.status}),(0,a.createElement)(Oe,{productType:o,productStatus:n.status}),(0,a.createElement)(Z.WooHeaderItem.Slot,{name:"product"}),(0,a.createElement)(ke,null))),(0,a.createElement)(Be,{onChange:t}))}const He=window.wp.mediaUtils,Ue=window.wp.plugins,ze=window.wp.blockEditor,$e=e=>(t,o)=>{const r=new URLSearchParams(t.search),n=new URLSearchParams(o.search);return r.delete("tab"),n.delete("tab"),(void 0===e||"/add-product"!==n.get("path")||r.get("path")!=="/product/"+e)&&r.toString()!==n.toString()};function Ge(e){return delete e.content,delete e.blocks,e}function We(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"product";const[t]=(0,J.useEntityProp)("postType",e,"id"),{edits:o}=(0,w.useSelect)((o=>{const{getEntityRecordNonTransientEdits:r}=o("core");return{edits:Ge(r("postType",e,t))}}),[t,e]);function r(e){if(e.startsWith("meta_data.")){const t=e.replace("meta_data.","");return o.hasOwnProperty("meta_data")&&-1!==o.meta_data.findIndex((e=>e.key===t))}return o.hasOwnProperty(e)}return{hasEdit:r,hasEdits:Object.keys(o).length>0}}const je=(0,a.createContext)("product");function qe(e){let{context:t,settings:o,productType:r,productId:n}=e;!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"product";const[t]=(0,J.useEntityProp)("postType",e,"id"),{hasEdits:o}=We(e),{isSaving:r}=(0,w.useSelect)((o=>{const{isSavingEntityRecord:r}=o("core");return{isSaving:r("postType",e,t)}}),[t,e]);(0,ye.useConfirmUnsavedChanges)(o||r,$e(t))}(r);const i=(0,w.useSelect)((e=>{const{canUser:t}=e("core");return!1!==t("create","media","")}),[]),l=(0,a.useMemo)((()=>{const e=i?{mediaUpload(e){let{onError:t,...r}=e;(0,He.uploadMedia)({wpAllowedMimeTypes:(null==o?void 0:o.allowedMimeTypes)||void 0,onError:e=>{let{message:o}=e;return t(o)},...r})}}:{};return{...o,...e,templateLock:"all"}}),[i,o]),[c,s,m]=(0,J.useEntityBlockEditor)("postType",r,{id:n}),{updateEditorSettings:d}=(0,w.useDispatch)("core/editor");return(0,a.useLayoutEffect)((()=>{var e;const t=null===(e=null==l?void 0:l.templates)||void 0===e?void 0:e[r];if(!t)return;const o=(0,$.synchronizeBlocksWithTemplate)([],t);m(o,{}),d(null!=l?l:{})}),[r,n]),c?(0,a.createElement)("div",{className:"woocommerce-product-block-editor"},(0,a.createElement)(ze.BlockContextProvider,{value:t},(0,a.createElement)(ze.BlockEditorProvider,{value:c,onInput:s,onChange:m,settings:l},(0,a.createElement)(ze.BlockEditorKeyboardShortcuts.Register,null),(0,a.createElement)(ze.BlockTools,null,(0,a.createElement)(ze.ObserveTyping,null,(0,a.createElement)(ze.BlockList,{className:"woocommerce-product-block-editor__block-list"}))),(0,a.createElement)(je.Provider,{value:t.postType},(0,a.createElement)(Ue.PluginArea,{scope:"woocommerce-product-block-editor"}))))):null}function Ze(e){let{initialValue:t,children:o}=e;const r=(0,a.useRef)({}),n=(0,a.useRef)({}),[i,l]=(0,a.useState)({});async function c(e,o){const n=r.current;return e in n?(0,n[e])(t,o).then((t=>(l((o=>({...o,[e]:t}))),t))):Promise.resolve(void 0)}return(0,a.createElement)(Ne.Provider,{value:{errors:i,registerValidator:function(e,t){return r.current={...r.current,[e]:t},t=>{n.current[e]=t}},unRegisterValidator:function(e){r.current[e]&&delete r.current[e],n.current[e]&&delete n.current[e]},validateField:c,validateAll:async function(e){const t={},o=r.current;for(const r in o)t[r]=await c(r,e);l(t);const a=function(e,t){const o=Object.entries(e).filter((e=>{let[o,r]=e;return(null==r?void 0:r.closest('.is-selected[role="tabpanel"]'))&&Boolean(t[o])})),[r]=o.sort(((e,t)=>{let[,o]=e,[,r]=t;return o.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1})),[,n]=null!=r?r:[];return n}(n.current,t);return null==a||a.focus(),t}}},o)}function Je(e){let{product:t,productType:o="product",settings:r}=e;const[n,i]=(0,a.useState)(null),l=(0,Z.useExtendLayout)("product-block-editor");return(0,a.createElement)(Z.LayoutContextProvider,{value:l},(0,a.createElement)(a.StrictMode,null,(0,a.createElement)(J.EntityProvider,{kind:"postType",type:o,id:t.id},(0,a.createElement)(X.ShortcutProvider,null,(0,a.createElement)(Ze,{initialValue:t},(0,a.createElement)(te,{header:(0,a.createElement)(Ve,{onTabSelect:i,productType:o}),content:(0,a.createElement)(a.Fragment,null,(0,a.createElement)(qe,{settings:r,productType:o,productId:t.id,context:{selectedTab:n,postType:o,postId:t.id}}))}),(0,a.createElement)(c.Popover.Slot,null))))))}const Xe=window.wp.blockLibrary,Ye=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-catalog-visibility-field","description":"A checkbox to manage the catalog visibility of the product.","title":"Product catalog visibility","category":"widgets","keywords":["products","catalog"],"textdomain":"default","attributes":{"label":{"type":"string","__experimentalRole":"content"},"visibility":{"type":"string","enum":["visible","catalog","search","hidden"],"default":"visible"}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false}}'),Ke=window.wc.blockTemplates;function Qe(e){const{postType:t}=e,o=(0,J.useEntityId)("postType",t);return{getEvaluationContext:r=>{const n=r("core").getEditedEntityRecord("postType",t,o);return{...e,editedProduct:n}}}}function et(e){const{metadata:t,settings:o,name:r}=e,n={...t,usesContext:(a=t.usesContext,[...a||[],"postType"])};var a;return(0,Ke.registerWooBlockType)({name:r,metadata:n,settings:o},Qe)}const{name:tt,...ot}=Ye,rt={example:{},edit:function(e){let{attributes:t}=e;const{label:o,visibility:r}=t,n=(0,Ke.useWooBlockProps)(t),[i,l]=(0,J.useEntityProp)("postType","product","catalog_visibility"),s=i===r||"hidden"===i;return(0,a.createElement)("div",{...n},(0,a.createElement)(c.CheckboxControl,{label:o,checked:s,onChange:function(e){if(e){if("visible"===i)return void l(r);l("hidden")}else{if("hidden"===i)return"catalog"===r?void l("search"):"search"===r?void l("catalog"):void 0;l("visible")}}}))}};function nt(){return et({name:tt,metadata:ot,settings:rt})}const at=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-checkbox-field","title":"Product checkbox control","category":"woocommerce","description":"A reusable checkbox for the product editor.","keywords":["products","checkbox","input"],"textdomain":"default","attributes":{"title":{"type":"string","__experimentalRole":"content"},"label":{"type":"string"},"property":{"type":"string"},"tooltip":{"type":"string"},"checkedValue":{"type":"string"},"uncheckedValue":{"type":"string"}},"supports":{"align":false,"html":false,"multiple":true,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css","usesContext":["postType"]}'),it=function(e,t){var o;const r=e.startsWith("meta_data."),n=e.replace("meta_data.",""),[a,i]=(0,J.useEntityProp)("postType",(null==t?void 0:t.postType)||"product",e),[l,c]=(0,J.useEntityProp)("postType",(null==t?void 0:t.postType)||"product","meta_data");return[r?(null===(o=l.find((e=>e.key===n)))||void 0===o?void 0:o.value)||(null==t?void 0:t.fallbackValue):a,r?e=>{const t=l.find((e=>e.key===n)),o=t?{...t,value:e}:{key:n,value:e};c([...l.filter((e=>e.key!==n)),o])}:i]},lt=(0,a.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(oe.Path,{d:"M12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zM3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 8.75a1.5 1.5 0 01.167 2.99c-.465.052-.917.44-.917 1.01V14h1.5v-.845A3 3 0 109 10.25h1.5a1.5 1.5 0 011.5-1.5zM11.25 15v1.5h1.5V15h-1.5z"})),ct=e=>{let{value:t,label:o,onChange:r,tooltip:n,title:i,checkedValue:l,uncheckedValue:s,disabled:m}=e;return(0,a.createElement)("div",{className:"woocommerce-product-form__checkbox"},i&&(0,a.createElement)("h4",null,i),(0,a.createElement)("div",{className:"woocommerce-product-form__checkbox-wrapper"},(0,a.createElement)(c.CheckboxControl,{label:o,checked:void 0!==l?l===t:t,onChange:function(e){r(e?void 0!==l?l:e:void 0!==s?s:e)},disabled:m}),n&&(0,a.createElement)(c.Tooltip,{text:(0,a.createElement)("span",null,n),position:"top center",className:"woocommerce-product-form__checkbox-tooltip",delay:0},(0,a.createElement)("span",{className:"woocommerce-product-form__checkbox-tooltip-icon"},(0,a.createElement)(Ee,{icon:lt,size:21.94,fill:"#949494"})))))},{name:st,...mt}=at,dt={example:{},edit:function(e){let{attributes:t,context:{postType:o}}=e;const{property:r,title:n,label:i,tooltip:l,checkedValue:c,uncheckedValue:s,disabled:m}=t,d=(0,Ke.useWooBlockProps)(t),[u,p]=it(r,{postType:o,fallbackValue:!1});return(0,a.createElement)("div",{...d},(0,a.createElement)(ct,{value:u||null,onChange:p,label:i||"",title:n,tooltip:l,checkedValue:c,uncheckedValue:s,disabled:m}))}},ut=()=>et({name:st,metadata:mt,settings:dt}),pt=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-collapsible","title":"Collapsible","category":"widgets","description":"Container with collapsible inner blocks.","textdomain":"default","attributes":{"toggleText":{"type":"string","__experimentalRole":"content"},"initialCollapsed":{"type":"boolean"},"persistRender":{"type":"boolean"}},"supports":{"align":false,"html":false,"multiple":true,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false}}'),{name:_t}=pt,ft={example:{},edit:function(e){let{attributes:t}=e;const o=(0,Ke.useWooBlockProps)(t),{toggleText:r,initialCollapsed:n,persistRender:l=!0}=t;return(0,a.createElement)("div",{...o},(0,a.createElement)(i.CollapsibleContent,{toggleText:r,initialCollapsed:n,persistRender:l},(0,a.createElement)(ze.InnerBlocks,{templateLock:"all"})))}},ht=()=>et({name:_t,metadata:pt,settings:ft}),gt=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/conditional","title":"Conditional","category":"widgets","description":"Container to only conditionally render inner blocks.","textdomain":"default","attributes":{"mustMatch":{"__experimentalRole":"content","type":"array","items":{"type":"object"},"default":[]}},"supports":{"align":false,"html":false,"multiple":true,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false}}'),{name:wt}=gt,vt={example:{},edit:function(e){let{attributes:t,context:o}=e;ie()("`woocommerce/conditional` block",{alternative:"`hideConditions` attribute on any block"});const{postType:r}=o,n=(0,Ke.useWooBlockProps)(t),{mustMatch:l}=t,c=(0,J.useEntityId)("postType",r),s=(0,w.useSelect)((e=>{const t=e("core").getEditedEntityRecord("postType",r,c);for(const[e,o]of Object.entries(l))if(!o.includes(t[e]))return!1;return!0}),[r,c,l]);return(0,a.createElement)("div",{...n},(0,a.createElement)(i.DisplayState,{state:s?"visible":"visually-hidden"},(0,a.createElement)(ze.InnerBlocks,{templateLock:"all"})))}},Et=()=>et({name:wt,metadata:gt,settings:vt}),bt=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-description-field","title":"Product description","category":"woocommerce","description":"The product description.","keywords":["products","description"],"textdomain":"default","attributes":{"__contentEditable":{"type":"string","__experimentalRole":"content"}},"supports":{"align":false,"html":false,"multiple":true,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false}}');var yt=o(74944);const Ct=["a","b","em","i","strong","p","br"],kt=["target","href","rel","name","download"];function St(e,t){const o=(null==t?void 0:t.tags)||Ct,r=(null==t?void 0:t.attr)||kt;return{__html:(0,yt.sanitize)(e,{ALLOWED_TAGS:o,ALLOWED_ATTR:r})}}const Nt=["a","b","em","i","strong","p","br","img","blockquote","cite","h1","h2","h3","h4","h5","h6","ul","li","ol","div"],Tt=["target","href","rel","name","download","src","style","class"];function xt(e){let{content:t}=e;const o=(0,w.useSelect)((e=>e(ze.store).getSettings()));return(0,a.createElement)("div",{className:"woocommerce-content-preview"},(0,a.createElement)(ze.__unstableIframe,{className:"woocommerce-content-preview__iframe"},(0,a.createElement)(a.Fragment,null,(0,a.createElement)(ze.__unstableEditorStyles,{styles:null==o?void 0:o.styles}),(0,a.createElement)("style",null,"body {\n\t\t\t\t\t\t\t\t\toverflow: hidden;\n\t\t\t\t\t\t\t\t}"),(0,a.createElement)("div",{className:"woocommerce-content-preview__content",dangerouslySetInnerHTML:St(t,{tags:Nt,attr:Tt})}))))}const Pt=(0,a.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(oe.Path,{d:"M20 10.8H6.7l4.1-4.5-1.1-1.1-5.8 6.3 5.8 5.8 1.1-1.1-4-3.9H20z"}));function At(e){let{onClick:t}=e;return(0,a.createElement)(c.Button,{className:"woocommerce-iframe-editor__back-button",icon:Pt,onClick:t},(0,v.__)("Back","woocommerce"))}function It(e){let{children:t,enableResizing:o,settings:r,...n}=e;const i=(0,ze.__unstableUseMouseMoveTypingReset)();return(0,a.createElement)(ze.__unstableIframe,{ref:i,name:"editor-canvas",className:"edit-site-visual-editor__editor-canvas",...n},(0,a.createElement)(a.Fragment,null,(0,a.createElement)(ze.__unstableEditorStyles,{styles:null==r?void 0:r.styles}),(0,a.createElement)("style",null,".is-root-container {\n\t\t\t\t\t\t\t\tpadding: 36px;\n\t\t\t\t\t\t\t\tdisplay: flow-root;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbody { position: relative; }"),o&&(0,a.createElement)("style",null,".is-root-container { min-height: 0 !important; }"),t))}const Mt=(0,a.createContext)({hasRedo:!1,hasUndo:!1,isDocumentOverviewOpened:!1,isInserterOpened:!1,isSidebarOpened:!0,redo:()=>{},setIsDocumentOverviewOpened:()=>{},setIsInserterOpened:()=>{},setIsSidebarOpened:()=>{},undo:()=>{}}),Rt=(0,a.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(oe.Path,{d:"M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"})),Lt=(0,a.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(oe.Path,{d:"M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z"})),Ot=(0,a.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(oe.Path,{d:"M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"})),Dt=(0,a.forwardRef)((function(e,t){const{hasRedo:o,redo:r}=(0,a.useContext)(Mt);return(0,a.createElement)(c.Button,{...e,ref:t,icon:(0,v.isRTL)()?Ot:Lt,label:(0,v.__)("Redo","woocommerce"),"aria-disabled":!o,onClick:o?r:void 0,className:"editor-history__redo"})})),Bt=(0,a.forwardRef)((function(e,t){const{hasUndo:o,undo:r}=(0,a.useContext)(Mt);return(0,a.createElement)(c.Button,{...e,ref:t,icon:(0,v.isRTL)()?Lt:Ot,label:(0,v.__)("Undo","woocommerce"),"aria-disabled":!o,onClick:o?r:void 0,className:"editor-history__undo"})})),Ft=(0,a.createElement)(oe.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(oe.Path,{d:"M13.8 5.2H3v1.5h10.8V5.2zm-3.6 12v1.5H21v-1.5H10.2zm7.2-6H6.6v1.5h10.8v-1.5z"})),Vt=(0,a.forwardRef)((function(e,t){const{isDocumentOverviewOpened:o,setIsDocumentOverviewOpened:r}=(0,a.useContext)(Mt);return(0,a.createElement)(c.Button,{...e,ref:t,icon:Ft,isPressed:o,label:(0,v.__)("Document overview","woocommerce"),onClick:function(){r(!o)},className:"document-overview"})})),Ht=(0,a.createElement)("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false"},(0,a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4 14.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h8v13zm4.5-.5c0 .3-.2.5-.5.5h-2.5v-13H18c.3 0 .5.2.5.5v12z"})),Ut=(0,a.forwardRef)((function(e,t){const{isSidebarOpened:o,setIsSidebarOpened:r}=(0,a.useContext)(Mt);return(0,a.createElement)(c.Button,{...e,ref:t,icon:Ht,isPressed:o,label:(0,v.__)("Show/hide block inspector","woocommerce"),onClick:function(){r(!o)}})})),zt=()=>{const{createNotice:e}=(0,w.useDispatch)("core/notices"),{blocks:t}=(0,w.useSelect)((e=>{const{getBlocks:t}=e(ze.store);return{blocks:t()}}),[]),o=(0,ee.useCopyToClipboard)((()=>(0,$.serialize)(t)),(()=>{e("success",(0,v.__)("All content copied.","woocommerce"))}));return(0,a.createElement)(c.MenuItem,{ref:o,role:"menuitem",onClick:()=>{(0,I.recordEvent)("product_iframe_editor_copy_all_content_menu_item_click")},disabled:!t.length},(0,v.__)("Copy all content","woocommerce"))},$t=(0,a.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(oe.Path,{d:"M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z"})),Gt=()=>(0,a.createElement)(c.MenuItem,{role:"menuitem",icon:$t,href:(0,v.__)("https://wordpress.org/documentation/article/wordpress-block-editor/","woocommerce"),onClick:()=>{(0,I.recordEvent)("product_iframe_editor_help_menu_item_click")},target:"_blank",rel:"noopener noreferrer"},(0,v.__)("Help","woocommerce"),(0,a.createElement)(c.VisuallyHidden,{as:"span"},(0,v.__)("(opens in a new tab)","woocommerce"))),Wt=()=>(0,a.createElement)(c.MenuGroup,{label:(0,v.__)("Tools","woocommerce")},(0,a.createElement)(zt,null),(0,a.createElement)(Gt,null)),jt=()=>(0,a.createElement)(ne,null,(()=>(0,a.createElement)(a.Fragment,null,(0,a.createElement)(Wt,null))));function qt(e){let{onSave:t=(()=>{}),onCancel:o=(()=>{})}=e;const{isInserterOpened:r,setIsInserterOpened:n}=(0,a.useContext)(Mt),i=(0,ee.useViewportMatch)("medium"),l=(0,a.useRef)(null),{isInserterEnabled:s,isTextModeEnabled:m}=(0,w.useSelect)((e=>{const{hasInserterItems:t,getBlockRootClientId:o,getBlockSelectionEnd:r,__unstableGetEditorMode:n}=e(ze.store);return{isTextModeEnabled:"text"===n(),isInserterEnabled:t(o(r()))}}),[]),d=(0,v.__)("Document tools","woocommerce"),u=(0,a.useCallback)((()=>{var e;r?(null===(e=l.current)||void 0===e||e.focus(),n(!1)):n(!0)}),[r,n]);return(0,a.createElement)(ze.NavigableToolbar,{className:"woocommerce-iframe-editor__header-toolbar","aria-label":d},(0,a.createElement)("div",{className:"woocommerce-iframe-editor__header-toolbar-left"},(0,a.createElement)(c.ToolbarItem,{ref:l,as:c.Button,className:"woocommerce-iframe-editor__header-toolbar-inserter-toggle",variant:"primary",isPressed:r,onMouseDown:e=>{e.preventDefault()},onClick:u,disabled:!s,icon:Rt,label:r?(0,v.__)("Close","woocommerce"):(0,v.__)("Add","woocommerce"),showTooltip:!0}),i&&(0,a.createElement)(c.ToolbarItem,{as:ze.ToolSelector,disabled:m}),(0,a.createElement)(c.ToolbarItem,{as:Bt}),(0,a.createElement)(c.ToolbarItem,{as:Dt}),(0,a.createElement)(c.ToolbarItem,{as:Vt})),(0,a.createElement)("div",{className:"woocommerce-iframe-editor__header-toolbar-right"},(0,a.createElement)(c.ToolbarItem,{as:c.Button,variant:"tertiary",className:"woocommerce-modal-actions__cancel-button",onClick:o,text:(0,v.__)("Cancel","woocommerce")}),(0,a.createElement)(c.ToolbarItem,{as:c.Button,variant:"primary",className:"woocommerce-modal-actions__done-button",onClick:t,text:(0,v.__)("Done","woocommerce")}),(0,a.createElement)(c.ToolbarItem,{as:Ut,className:"woocommerce-show-block-inspector-panel"}),(0,a.createElement)(c.ToolbarItem,{as:jt})))}const Zt=window.wp.keycodes;function Jt(e){let{direction:t,resizeWidthBy:o}=e;return(0,a.createElement)(a.Fragment,null,(0,a.createElement)("button",{className:`resizable-editor__drag-handle is-${t}`,"aria-label":(0,v.__)("Drag to resize","woocommerce"),"aria-describedby":`resizable-editor__resize-help-${t}`,onKeyDown:function(e){const{keyCode:r}=e;"left"===t&&r===Zt.LEFT||"right"===t&&r===Zt.RIGHT?o(20):("left"===t&&r===Zt.RIGHT||"right"===t&&r===Zt.LEFT)&&o(-20)}}),(0,a.createElement)(c.VisuallyHidden,{id:`resizable-editor__resize-help-${t}`},(0,v.__)("Use left and right arrow keys to resize the canvas.","woocommerce")))}const Xt={position:void 0,userSelect:void 0,cursor:void 0,width:void 0,height:void 0,top:void 0,right:void 0,bottom:void 0,left:void 0};function Yt(e){let{enableResizing:t,height:o,children:r}=e;const[n,i]=(0,a.useState)("100%"),l=(0,a.useRef)(),s=(0,a.useCallback)((e=>{l.current&&i(l.current.offsetWidth+e)}),[]);return(0,a.createElement)(c.ResizableBox,{ref:e=>{l.current=null==e?void 0:e.resizable},size:{width:t?n:"100%",height:t&&o?o:"100%"},onResizeStop:(e,t,o)=>{i(o.style.width)},minWidth:300,maxWidth:"100%",maxHeight:"100%",minHeight:o,enable:{right:t,left:t},showHandle:t,resizeRatio:2,handleComponent:{left:(0,a.createElement)(Jt,{direction:"left",resizeWidthBy:s}),right:(0,a.createElement)(Jt,{direction:"right",resizeWidthBy:s})},handleClasses:void 0,handleStyles:{left:Xt,right:Xt}},r)}const Kt=(0,a.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(oe.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}));function Qt(){const{setIsInserterOpened:e}=(0,a.useContext)(Mt),t=(0,ee.useViewportMatch)("medium","<"),{rootClientId:o}=(0,w.useSelect)((e=>{const{getBlockRootClientId:t}=e(ze.store);return{rootClientId:t()}})),r=(0,a.useCallback)((()=>e(!1)),[e]),n=t?"div":c.VisuallyHidden,[i,l]=(0,ee.__experimentalUseDialog)({onClose:r,focusOnMount:!1}),s=(0,a.useRef)(null);return(0,a.useEffect)((()=>{var e;null===(e=s.current)||void 0===e||e.focusSearch()}),[]),(0,a.createElement)("div",{ref:i,...l,className:"woocommerce-iframe-editor__inserter-panel"},(0,a.createElement)(n,{className:"woocommerce-iframe-editor__inserter-panel-header"},(0,a.createElement)(c.Button,{icon:Kt,onClick:r,label:(0,v.__)("Close block inserter","woocommerce")})),(0,a.createElement)("div",{className:"woocommerce-iframe-editor__inserter-panel-content"},(0,a.createElement)(ze.__experimentalLibrary,{showInserterHelpPanel:!0,shouldFocusBlock:t,rootClientId:o,ref:s})))}const eo=(0,a.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(oe.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}));function to(){const{setIsDocumentOverviewOpened:e}=(0,a.useContext)(Mt),t=(0,ee.useFocusOnMount)("firstElement"),o=(0,ee.useFocusReturn)(),r=(0,ee.useFocusReturn)(),[n,i]=(0,a.useState)(null),[l,s]=(0,a.useState)("list-view"),m=(0,a.useRef)(null),d=(0,ee.useMergeRefs)([r,t,m,i]);return(0,a.createElement)("div",{className:"woocommerce-iframe-editor__document-overview-sidebar",onKeyDown:function(t){"Escape"!==t.code||t.defaultPrevented||(t.preventDefault(),e(!1))}},(0,a.createElement)(c.Button,{className:"woocommerce-iframe-editor__document-overview-sidebar-close-button",ref:o,icon:eo,label:(0,v.__)("Close","woocommerce"),onClick:()=>e(!1)}),(0,a.createElement)(c.TabPanel,{className:"woocommerce-iframe-editor__document-overview-sidebar-tab-panel",initialTabName:l,onSelect:s,tabs:[{name:"list-view",title:"List View",className:"woocommerce-iframe-editor__document-overview-sidebar-tab-item"}]},(e=>(0,a.createElement)("div",{className:"woocommerce-iframe-editor__document-overview-sidebar-tab-content",ref:d},"list-view"===e.name?(0,a.createElement)(ze.__experimentalListView,{dropZoneElement:n}):null))))}function oo(){const{isInserterOpened:e,isDocumentOverviewOpened:t}=(0,a.useContext)(Mt);return e?(0,a.createElement)(Qt,null):t?(0,a.createElement)(to,null):null}const ro=50;function no(e){let{maxHistory:t=ro,setBlocks:o}=e;const[r,n]=(0,a.useState)([]),[i,l]=(0,a.useState)(0);return{appendEdit:function(e){const o=[...r.slice(0,i+1),e].slice(-1*t);n(o),l(o.length-1)},hasRedo:!!r.length&&i<r.length-1,hasUndo:!!r.length&&i>0,redo:function(){const e=Math.min(r.length-1,i+1);r[e]&&(o(r[e]),l(e))},undo:function(){const e=Math.max(0,i-1);r[e]&&(o(r[e]),l(e))}}}function ao(e){let{closeModal:t=(()=>{}),initialBlocks:o=[],onChange:r=(()=>{}),onClose:n,onInput:i=(()=>{}),settings:l}=e;const[s]=(0,ee.useResizeObserver)(),[m,d]=(0,a.useState)(o),[u,p]=(0,a.useState)(o),{appendEdit:_}=no({setBlocks:d}),{appendEdit:f,hasRedo:h,hasUndo:g,redo:v,undo:E}=no({setBlocks:p}),[b,y]=(0,a.useState)(!1),[C,k]=(0,a.useState)(!1),[S,N]=(0,a.useState)(!0),{clearSelectedBlock:T,updateSettings:x}=(0,w.useDispatch)(ze.store),P=(0,w.useSelect)((e=>e(ze.store).getSettings()),[]);(0,a.useEffect)((()=>{x(productBlockEditorSettings)}),[]);const A=l||P;return(0,a.createElement)("div",{className:"woocommerce-iframe-editor"},(0,a.createElement)(Mt.Provider,{value:{hasRedo:h,hasUndo:g,isInserterOpened:b,isDocumentOverviewOpened:C,redo:v,setIsInserterOpened:y,setIsDocumentOverviewOpened:k,undo:E,isSidebarOpened:S,setIsSidebarOpened:N}},(0,a.createElement)(ze.BlockEditorProvider,{settings:{...A,hasFixedToolbar:!0,templateLock:!1},value:m,onChange:e=>{f(e),p(e),r(e)},onInput:e=>{f(e),p(e),i(e)},useSubRegistry:!0},(0,a.createElement)(qt,{onSave:()=>{_(u),d(u),r(u),t()},onCancel:()=>{_(m),d(m),r(m),p(m),t()}}),(0,a.createElement)("div",{className:"woocommerce-iframe-editor__main"},(0,a.createElement)(oo,null),(0,a.createElement)(ze.BlockTools,{className:"woocommerce-iframe-editor__content",onClick:e=>{e.target===e.currentTarget&&T()}},(0,a.createElement)(ze.BlockEditorKeyboardShortcuts.Register,null),n&&(0,a.createElement)(At,{onClick:()=>{setTimeout(n,550)}}),(0,a.createElement)(Yt,{enableResizing:!0,height:"100%"},(0,a.createElement)(It,{enableResizing:!0,settings:A},s,(0,a.createElement)(ze.BlockList,{className:"edit-site-block-editor__block-list wp-site-blocks"})),(0,a.createElement)(c.Popover.Slot,null)),(0,a.createElement)("div",{className:"woocommerce-iframe-editor__content-inserter-clipper"})),S&&(0,a.createElement)("div",{className:"woocommerce-iframe-editor__sidebar"},(0,a.createElement)(ze.BlockInspector,null))))))}function io(e){let{initialBlocks:t,onChange:o,onClose:r,title:n}=e;const i=(0,ee.useDebounce)((e=>{o(e)}),250);function l(){const e=i.flush();e&&o(e),r()}return(0,a.createElement)(c.Modal,{className:"woocommerce-modal-editor",title:n,onRequestClose:l,shouldCloseOnClickOutside:!1},(0,a.createElement)(ao,{initialBlocks:t,onInput:i,onChange:i,closeModal:l}))}function lo(e){let{nonAnimatedSrc:t,animatedSrc:o}=e;return(0,a.createElement)("picture",{className:"edit-post-welcome-guide__image"},(0,a.createElement)("source",{srcSet:t,media:"(prefers-reduced-motion: reduce)"}),(0,a.createElement)("img",{src:o,width:"312",height:"240",alt:""}))}function co(){const{toggle:e}=(0,w.useDispatch)("core/preferences");return(0,a.createElement)(c.Guide,{className:"edit-post-welcome-guide",contentLabel:(0,v.__)("Welcome to the block editor","woocommerce"),finishButtonText:(0,v.__)("Get started","woocommerce"),onFinish:()=>e("core/edit-post","welcomeGuide"),pages:[{image:(0,a.createElement)(lo,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-canvas.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-canvas.gif"}),content:(0,a.createElement)(a.Fragment,null,(0,a.createElement)("h1",{className:"edit-post-welcome-guide__heading"},(0,v.__)("Welcome to the block editor","woocommerce")),(0,a.createElement)("p",{className:"edit-post-welcome-guide__text"},(0,v.__)("In the WordPress editor, each paragraph, image, or video is presented as a distinct “block” of content.","woocommerce")))},{image:(0,a.createElement)(lo,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-editor.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-editor.gif"}),content:(0,a.createElement)(a.Fragment,null,(0,a.createElement)("h1",{className:"edit-post-welcome-guide__heading"},(0,v.__)("Make each block your own","woocommerce")),(0,a.createElement)("p",{className:"edit-post-welcome-guide__text"},(0,v.__)("Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected.","woocommerce")))},{image:(0,a.createElement)(lo,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-library.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-library.gif"}),content:(0,a.createElement)(a.Fragment,null,(0,a.createElement)("h1",{className:"edit-post-welcome-guide__heading"},(0,v.__)("Get to know the block library","woocommerce")),(0,a.createElement)("p",{className:"edit-post-welcome-guide__text"},(0,a.createInterpolateElement)((0,v.__)("All of the blocks available to you live in the block library. You’ll find it wherever you see the <InserterIconImage /> icon.","woocommerce"),{InserterIconImage:(0,a.createElement)("img",{alt:(0,v.__)("inserter","woocommerce"),src:"data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A"})})))},{image:(0,a.createElement)(lo,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.gif"}),content:(0,a.createElement)(a.Fragment,null,(0,a.createElement)("h1",{className:"edit-post-welcome-guide__heading"},(0,v.__)("Learn how to use the block editor","woocommerce")),(0,a.createElement)("p",{className:"edit-post-welcome-guide__text"},(0,v.__)("New to the block editor? Want to learn more about using it? ","woocommerce"),(0,a.createElement)(c.ExternalLink,{href:(0,v.__)("https://wordpress.org/documentation/article/wordpress-block-editor/","woocommerce")},(0,v.__)("Here's a detailed guide.","woocommerce"))))}]})}function so(){const{isActive:e}=(0,w.useSelect)((e=>{const{get:t}=e("core/preferences");return{isActive:t("core/edit-post","welcomeGuide")}}),[]);return e?(0,a.createElement)(co,null):null}const{name:mo,...uo}=bt,po={example:{},edit:function(e){let{attributes:t}=e;const o=(0,Ke.useWooBlockProps)(t),[r,n]=(0,a.useState)(!1),[i,l]=(0,J.useEntityProp)("postType","product","description");return(0,a.createElement)("div",{...o},(0,a.createElement)(c.Button,{variant:"secondary",onClick:()=>{n(!0),(0,I.recordEvent)("product_add_description_click")}},i.length?(0,v.__)("Edit description","woocommerce"):(0,v.__)("Add description","woocommerce")),r&&(0,a.createElement)(io,{initialBlocks:(0,$.parse)(i),onChange:e=>{const t=(0,$.serialize)(function(e){if(1===e.length){const{content:t}=e[0].attributes;if(!t||!t.trim())return[]}return e}(e));l(t)},onClose:()=>n(!1),title:(0,v.__)("Edit description","woocommerce")}),!!i.length&&(0,a.createElement)(xt,{content:i}),r&&(0,a.createElement)(so,null))}},_o=()=>et({name:mo,metadata:uo,settings:po}),fo=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-downloads-field","title":"Product downloads","category":"widgets","description":"The product downloads.","keywords":["products","downloads"],"textdomain":"default","attributes":{"name":{"type":"string","__experimentalRole":"content"}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css","usesContext":["postType"]}'),ho=(0,a.createElement)(oe.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(oe.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})),go=(0,a.createElement)(oe.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(oe.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})),wo=(0,a.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(oe.Path,{d:"M18.7 3H5.3C4 3 3 4 3 5.3v13.4C3 20 4 21 5.3 21h13.4c1.3 0 2.3-1 2.3-2.3V5.3C21 4 20 3 18.7 3zm.8 15.7c0 .4-.4.8-.8.8H5.3c-.4 0-.8-.4-.8-.8V5.3c0-.4.4-.8.8-.8h13.4c.4 0 .8.4.8.8v13.4zM10 15l5-3-5-3v6z"}));function vo(e){let{allowedTypes:t,modalTitle:o,modalButtonText:r,multiple:n,className:i,uploaderParams:l,children:c,onSelect:s}=e;const m=(0,a.useMemo)((function(){return wp.media({title:o,library:{type:t},button:{text:r},multiple:n,states:[new wp.media.controller.Library({title:o,library:wp.media.query(),multiple:n,priority:20,filterable:"all"})]})}),[t,o,r,n]);return(0,a.useEffect)((function(){function e(){const e=m.state().get("selection").toJSON();s(e)}function t(){m.uploader.options.uploader.params=l}return m.on("select",e),m.on("ready",t),function(){m.off("select",e),m.off("ready",t)}}),[m,l,s]),(0,a.useEffect)((()=>function(){m.remove()}),[m]),c({open:function(){m.$el.addClass(i),m.open()}})}const Eo="woocommerce-media-library-menu-item__upload_files_modal",bo="woocommerce-media-library-menu-item__upload_files_modal_wrapper";function yo(e){let{allowedTypes:t,onUploadSuccess:o}=e;const[r,n]=(0,a.useState)(!1);return(0,a.useEffect)((function(){const e=document.querySelector(`.${Eo}`),t=null==e?void 0:e.closest('[role="dialog"]'),o=null==t?void 0:t.parentElement;return null==o||o.classList.add(bo),()=>{null==o||o.classList.remove(bo)}}),[r]),(0,a.createElement)(vo,{className:Eo,allowedTypes:t,multiple:"add",uploaderParams:{type:"downloadable_product"},onSelect:function(e){o(e)}},(e=>{let{open:t}=e;return(0,a.createElement)(c.MenuItem,{icon:wo,iconPosition:"left",onClick:(o=t,function(){o(),n(!0)}),info:(0,v.__)("Choose from uploaded media","woocommerce")},(0,v.__)("Media Library","woocommerce"));var o}))}const Co=(0,a.createElement)(oe.SVG,{xmlns:"https://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(oe.Path,{d:"M12.5 14.5h-1V16h1c2.2 0 4-1.8 4-4s-1.8-4-4-4h-1v1.5h1c1.4 0 2.5 1.1 2.5 2.5s-1.1 2.5-2.5 2.5zm-4 1.5v-1.5h-1C6.1 14.5 5 13.4 5 12s1.1-2.5 2.5-2.5h1V8h-1c-2.2 0-4 1.8-4 4s1.8 4 4 4h1zm-1-3.2h5v-1.5h-5v1.5zM18 4H9c-1.1 0-2 .9-2 2v.5h1.5V6c0-.3.2-.5.5-.5h9c.3 0 .5.2.5.5v12c0 .3-.2.5-.5.5H9c-.3 0-.5-.2-.5-.5v-.5H7v.5c0 1.1.9 2 2 2h9c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2z"})),ko=(0,a.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,a.createElement)(oe.Path,{d:"M6.734 16.106l2.176-2.38-1.093-1.028-3.846 4.158 3.846 4.157 1.093-1.027-2.176-2.38h2.811c1.125 0 2.25.03 3.374 0 1.428-.001 3.362-.25 4.963-1.277 1.66-1.065 2.868-2.906 2.868-5.859 0-2.479-1.327-4.896-3.65-5.93-1.82-.813-3.044-.8-4.806-.788l-.567.002v1.5c.184 0 .368 0 .553-.002 1.82-.007 2.704-.014 4.21.657 1.854.827 2.76 2.657 2.76 4.561 0 2.472-.973 3.824-2.178 4.596-1.258.807-2.864 1.04-4.163 1.04h-.02c-1.115.03-2.229 0-3.344 0H6.734z"}));function So(e){e.required=!0,e.setCustomValidity(""),e.validity.valueMissing&&e.setCustomValidity((0,v.__)("The URL is required","woocommerce")),e.validity.typeMismatch&&e.setCustomValidity((0,v.__)("Insert a valid URL","woocommerce"))}function No(e){let{onUploadSuccess:t,onUploadError:o}=e;function r(e){e.preventDefault();const r=e.currentTarget,n=r.url;if(So(n),r.checkValidity()){const e=r.url.value;t([{url:e}])}else o(n.validationMessage)}function n(e){So(e.target)}function i(e){So(e.target)}return(0,a.createElement)(c.Dropdown,{position:"middle left",renderToggle:e=>{let{isOpen:t,onToggle:o}=e;return(0,a.createElement)(c.MenuItem,{"aria-expanded":t,icon:Co,iconPosition:"left",onClick:o,info:(0,v.__)("Link to a file hosted elsewhere","woocommerce")},(0,v.__)("Insert from URL","woocommerce"))},renderContent:()=>(0,a.createElement)("form",{className:"components-dropdown-menu__menu",noValidate:!0,onSubmit:r},(0,a.createElement)(c.__experimentalInputControl,{name:"url",type:"url",placeholder:(0,v.__)("Insert URL","woocommerce"),suffix:(0,a.createElement)(c.Button,{icon:ko,type:"submit"}),className:"woocommerce-inert-url-menu-item__input","aria-label":(0,v.__)("Insert URL","woocommerce"),onInput:n,onBlur:i}))})}function To(e){let{allowedTypes:t,onUploadSuccess:o,onUploadError:r}=e;return(0,a.createElement)(c.Dropdown,{position:"bottom left",contentClassName:"woocommerce-downloads-menu__menu-content",renderToggle:e=>{let{isOpen:t,onToggle:o}=e;return(0,a.createElement)(c.Button,{"aria-expanded":t,icon:t?ho:go,variant:"secondary",onClick:o,className:"woocommerce-downloads-menu__toogle"},(0,a.createElement)("span",null,(0,v.__)("Add new","woocommerce")))},renderContent:e=>{let{onClose:n}=e;return(0,a.createElement)("div",{className:"components-dropdown-menu__menu"},(0,a.createElement)(c.MenuGroup,null,(0,a.createElement)(yo,{allowedTypes:t,onUploadSuccess:e=>{o(e),n()}}),(0,a.createElement)(No,{onUploadSuccess:e=>{o(e),n()},onUploadError:r})))}})}function xo(e){setTimeout((function(t){e.ownerDocument.activeElement===t&&t.select()}),0,e)}const Po=e=>{let{value:t,onChange:o,onFocus:r,onKeyUp:n}=e;const{formatNumber:a,parseNumber:i}=V();return{value:a(t),onFocus(e){xo(e.currentTarget),r&&r(e)},onKeyUp(e){const r=Number.parseFloat(t||"0"),a=Number(e.currentTarget.step||"1");"ArrowUp"===e.code&&o(String(r+a)),"ArrowDown"===e.code&&o(String(r-a)),n&&n(e)},onChange(e){const t=i(e);o(t)}}};function Ao(e){return null===e?"0":-1===e?"":String(e)}function Io(e){let{initialValue:t,onSubmit:o,onClose:r}=e;const[n,i]=(0,a.useState)(Ao(t.downloadLimit)),[l,s]=(0,a.useState)(Ao(t.downloadExpiry)),[m,d]=(0,a.useState)({});function u(){return n&&!Number.isInteger(Number(n))?(d((e=>({...e,downloadLimit:(0,v.__)("Download limit must be an integer number","woocommerce")}))),!1):Number.parseInt(n,10)<0?(d((e=>({...e,downloadLimit:(0,v.sprintf)((0,v.__)("Download limit must be greater than or equal to %d","woocommerce"),0)}))),!1):(d((e=>{let{downloadLimit:t,...o}=e;return o})),!0)}function p(){return l&&!Number.isInteger(Number(l))?(d((e=>({...e,downloadExpiry:(0,v.__)("Expiry period must be an integer number","woocommerce")}))),!1):Number.parseInt(l,10)<0?(d((e=>({...e,downloadExpiry:(0,v.sprintf)((0,v.__)("Expiry period must be greater than or equal to %d","woocommerce"),0)}))),!1):(d((e=>{let{downloadExpiry:t,...o}=e;return o})),!0)}const _={...Po({value:n,onChange:i}),id:(0,ee.useInstanceId)(c.BaseControl,"product_download_limit_field"),type:"number",min:0,className:Q()({"has-error":m.downloadLimit}),label:(0,v.__)("Download limit","woocommerce"),help:m.downloadLimit||(0,v.__)("Decide how many times customers can download files after purchasing the product. Leave blank for unlimited re-downloads.","woocommerce"),placeholder:(0,v.__)("Unlimited","woocommerce"),suffix:(0,a.createElement)("span",{className:"woocommerce-manage-download-limits-modal__input-suffix"},(0,v.__)("times","woocommerce")),onBlur(){u()}},f={...Po({value:l,onChange:s}),id:(0,ee.useInstanceId)(c.BaseControl,"product_download_expiry_field"),type:"number",min:0,className:Q()({"has-error":m.downloadExpiry}),label:(0,v.__)("Expiry period","woocommerce"),help:m.downloadExpiry||(0,v.__)("Decide how long customers can access the files after purchasing the product. Leave blank for unlimited access.","woocommerce"),placeholder:(0,v.__)("Unlimited","woocommerce"),suffix:(0,a.createElement)("span",{className:"woocommerce-manage-download-limits-modal__input-suffix"},(0,v.__)("days","woocommerce")),onBlur(){p()}};return(0,a.createElement)(c.Modal,{title:(0,v.__)("Manage download limits","woocommerce"),className:"woocommerce-manage-download-limits-modal",onRequestClose:r},(0,a.createElement)("form",{noValidate:!0,onSubmit:function(e){e.preventDefault();const t=u(),r=p();t&&r&&o({downloadLimit:""===n?-1:Number.parseInt(n,10),downloadExpiry:""===l?-1:Number.parseInt(l,10)})}},(0,a.createElement)("div",{className:"woocommerce-manage-download-limits-modal__content"},(0,a.createElement)(c.__experimentalInputControl,{..._}),(0,a.createElement)(c.__experimentalInputControl,{...f})),(0,a.createElement)("div",{className:"woocommerce-manage-download-limits-modal__actions"},(0,a.createElement)(c.Button,{variant:"tertiary",type:"button",onClick:function(){r()}},(0,v.__)("Cancel","woocommerce")),(0,a.createElement)(c.Button,{variant:"primary",type:"submit"},(0,v.__)("Save","woocommerce")))))}const Mo=(0,a.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(oe.Path,{d:"M20 5h-5.7c0-1.3-1-2.3-2.3-2.3S9.7 3.7 9.7 5H4v2h1.5v.3l1.7 11.1c.1 1 1 1.7 2 1.7h5.7c1 0 1.8-.7 2-1.7l1.7-11.1V7H20V5zm-3.2 2l-1.7 11.1c0 .1-.1.2-.3.2H9.1c-.1 0-.3-.1-.3-.2L7.2 7h9.6z"})),Ro=()=>(0,a.createElement)("svg",{width:"14",height:"16",viewBox:"0 0 14 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.25 6C0.25 5.0335 1.0335 4.25 2 4.25L3 4.25L3 5.75L2 5.75C1.86193 5.75 1.75 5.86193 1.75 6L1.75 14C1.75 14.1381 1.86193 14.25 2 14.25L8 14.25C8.13807 14.25 8.25 14.1381 8.25 14L8.25 13L9.75 13L9.75 14C9.75 14.9665 8.9665 15.75 8 15.75L2 15.75C1.0335 15.75 0.25 14.9665 0.25 14L0.25 6ZM6 0.25C5.0335 0.25 4.25 1.0335 4.25 2L4.25 10C4.25 10.9665 5.0335 11.75 6 11.75L12 11.75C12.9665 11.75 13.75 10.9665 13.75 10L13.75 2C13.75 1.0335 12.9665 0.249999 12 0.249999L6 0.25ZM5.75 2C5.75 1.86193 5.86193 1.75 6 1.75L12 1.75C12.1381 1.75 12.25 1.86193 12.25 2L12.25 10C12.25 10.1381 12.1381 10.25 12 10.25L6 10.25C5.86193 10.25 5.75 10.1381 5.75 10L5.75 2Z",fill:"#007CBA"})),Lo=()=>(0,a.createElement)("svg",{width:"56",height:"72",viewBox:"0 0 56 72",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M37.9551 0H1.41177C0.63207 0 0 0.632067 0 1.41176V70.5882C0 71.3679 0.632067 72 1.41176 72H54.5882C55.3679 72 56 71.3679 56 70.5882V17.9261L37.9551 0Z",fill:"#F0F0F0"}),(0,a.createElement)("rect",{x:"28.6191",y:"40.6892",width:"13.3101",height:"13.3107",rx:"2.85325",fill:"#DDDDDD"}),(0,a.createElement)("ellipse",{cx:"18.1551",cy:"47.3446",rx:"6.65505",ry:"6.65537",fill:"#DDDDDD"}),(0,a.createElement)("path",{d:"M25.9557 24.1401C26.5048 23.1889 27.8776 23.1889 28.4267 24.1401L34.6041 34.84C35.1531 35.7911 34.4668 36.9799 33.3686 36.9799H21.0139C19.9157 36.9799 19.2293 35.7911 19.7784 34.84L25.9557 24.1401Z",fill:"#DDDDDD"}),(0,a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M38.0005 9.53674e-05L56 17.9995H40.824C39.2646 17.9995 38.0005 16.7354 38.0005 15.176V9.53674e-05Z",fill:"#DDDDDD"})),Oo=e=>{let{downloableItem:t,onCancel:o,onChange:r,onRemove:n,onSave:l}=e;const{createNotice:s}=(0,w.useDispatch)("core/notices"),[m,d]=(0,a.useState)(!1),{id:u=0,file:p="",name:_=""}=t;return(0,a.createElement)(c.Modal,{title:(0,v.sprintf)((0,v.__)("Edit %s","woocommerce"),_),onRequestClose:e=>{e.isPropagationStopped()||m||((0,I.recordEvent)("product_downloads_modal_cancel"),o())},className:"woocommerce-edit-downloads-modal"},(0,a.createElement)("div",{className:"woocommerce-edit-downloads-modal__preview"},(0,a.createElement)(i.ImageGallery,{allowDragging:!1,columns:1},function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if(!e)return;const t=["jpg","jpeg","png","gif","webp"],o=(e.split(".").pop()||"").toLowerCase();return t.includes(o)}(p)?(0,a.createElement)(i.ImageGalleryItem,{key:u,alt:_,src:p,id:`${u}`,isCover:!1}):(0,a.createElement)(Lo,null)),(0,a.createElement)("div",{className:"components-form-file-upload"},(0,a.createElement)("p",null,_))),(0,a.createElement)(c.BaseControl,{id:"file-name-help",className:"woocommerce-edit-downloads-modal__file-name",help:(0,v.__)("Your customers will see this on the thank-you page and in their order confirmation email.","woocommerce")},(0,a.createElement)(c.__experimentalInputControl,{id:"file-name",label:(0,v.__)("FILE NAME","woocommerce"),name:"file-name",value:_||"",onChange:r})),(0,a.createElement)("div",{className:"woocommerce-edit-downloads-modal__file-url"},(0,a.createElement)(c.__experimentalInputControl,{disabled:!0,id:"file-url",label:(0,v.__)("FILE URL","woocommerce"),name:"file-url",value:p||"",suffix:(0,a.createElement)(c.Button,{icon:(0,a.createElement)(Ro,null),onClick:async function(){(0,I.recordEvent)("product_downloads_modal_copy_url_to_clipboard"),d(!0),await async function(e){if("clipboard"in navigator)await navigator.clipboard.writeText(e);else{const t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}await void s("success",(0,v.__)("URL copied successfully.","woocommerce"))}(p),d(!1)}})})),(0,a.createElement)("div",{className:"woocommerce-edit-downloads-modal__buttons"},(0,a.createElement)("div",{className:"woocommerce-edit-downloads-modal__buttons-left"},(0,a.createElement)(c.Button,{icon:Mo,isDestructive:!0,variant:"tertiary",label:(0,v.__)("Delete","woocommerce"),onClick:()=>{(0,I.recordEvent)("product_downloads_modal_delete"),n()}},(0,v.__)("Delete file","woocommerce"))),(0,a.createElement)("div",{className:"woocommerce-edit-downloads-modal__buttons-right"},(0,a.createElement)(c.Button,{label:(0,v.__)("Cancel","woocommerce"),onClick:()=>{(0,I.recordEvent)("product_downloads_modal_cancel"),o()},variant:"tertiary"},(0,v.__)("Cancel","woocommerce")),(0,a.createElement)(c.Button,{label:(0,v.__)("Update","woocommerce"),onClick:()=>{(0,I.recordEvent)("product_downloads_modal_update"),l()},variant:"primary"},(0,v.__)("Update","woocommerce")))))};function Do(e){var t;const[o]=null!==(t=null==e?void 0:e.split("/").reverse())&&void 0!==t?t:[];return o}function Bo(e){return e?String(e):""}function Fo(e){return{...e,id:Bo(e.id)}}const{name:Vo,...Ho}=fo,Uo={example:{},edit:function(e){let{attributes:t,context:{postType:o}}=e;const r=(0,Ke.useWooBlockProps)(t),[,n]=(0,J.useEntityProp)("postType",o,"downloadable"),[l,s]=(0,J.useEntityProp)("postType",o,"downloads"),[m,d]=(0,J.useEntityProp)("postType",o,"download_limit"),[u,p]=(0,J.useEntityProp)("postType",o,"download_expiry"),[_,f]=(0,a.useState)(),{allowedMimeTypes:h}=(0,w.useSelect)((e=>{const{getEditorSettings:t}=e("core/editor");return t()})),g=h?Object.values(h):[],{createErrorNotice:E}=(0,w.useDispatch)("core/notices"),[b,y]=(0,a.useState)(!1);function C(e){const t=l.reduce((function(t,o){return o.file===e.file?t:[...t,Fo(o)]}),[]);t.length||n(!1),s(t)}function k(e){return function(){C(e)}}function S(e){return function(){f(Fo(e))}}function N(e){E("string"==typeof e?e:(0,v.__)("There was an error uploading files","woocommerce"))}return(0,a.createElement)("div",{...r},(0,a.createElement)("div",{className:"wp-block-woocommerce-product-downloads-field__header"},Boolean(l.length)&&(0,a.createElement)(c.Button,{variant:"tertiary",onClick:function(){y(!0)}},(0,v.__)("Manage limits","woocommerce")),(0,a.createElement)(To,{allowedTypes:g,onUploadSuccess:function(e){if(!Array.isArray(e))return;const t=e.filter((e=>!l.some((t=>t.file===e.url))));if(t.length!==e.length&&E(1===e.length?(0,v.__)("This file has already been added","woocommerce"):(0,v.__)("Some of these files have already been added","woocommerce")),t.length){l.length||n(!0);const e=t.map((e=>({id:Bo(e.id),file:e.url,name:e.title||e.alt||e.caption||Do(e.url)}))),o=l.map(Fo);o.push(...e),s(o)}},onUploadError:N})),(0,a.createElement)("div",{className:"wp-block-woocommerce-product-downloads-field__body"},!Boolean(l.length)&&(0,a.createElement)("div",{className:"wp-block-woocommerce-product-downloads-field__drop-zone-content"},(0,a.createElement)("p",{className:"wp-block-woocommerce-product-downloads-field__drop-zone-label"},(0,a.createInterpolateElement)((0,v.__)("Supported file types: <Types /> and more. <link>View all</link>","woocommerce"),{Types:(0,a.createElement)(a.Fragment,null,"PNG, JPG, PDF, PPT, DOC, MP3, MP4"),link:(0,a.createElement)("a",{href:"https://codex.wordpress.org/Uploading_Files",target:"_blank",rel:"noreferrer",onClick:e=>e.stopPropagation()})}))),Boolean(l.length)&&(0,a.createElement)(i.Sortable,{className:"wp-block-woocommerce-product-downloads-field__table"},l.map((e=>{const t=Do(e.file),o=e.file.startsWith("blob");return(0,a.createElement)(i.ListItem,{key:e.file},(0,a.createElement)("div",{className:"wp-block-woocommerce-product-downloads-field__table-filename"},(0,a.createElement)("span",null,e.name),e.name!==t&&(0,a.createElement)("span",{className:"wp-block-woocommerce-product-downloads-field__table-filename-description"},t)),(0,a.createElement)("div",{className:"wp-block-woocommerce-product-downloads-field__table-actions"},o&&(0,a.createElement)(c.Spinner,{"aria-label":(0,v.__)("Uploading file","woocommerce")}),!o&&(0,a.createElement)(c.Button,{onClick:S(e),variant:"tertiary"},(0,v.__)("Edit","woocommerce")),(0,a.createElement)(c.Button,{icon:eo,label:(0,v.__)("Remove file","woocommerce"),disabled:o,onClick:k(e)})))})))),b&&(0,a.createElement)(Io,{initialValue:{downloadLimit:m,downloadExpiry:u},onSubmit:function(e){d(e.downloadLimit),p(e.downloadExpiry),y(!1)},onClose:function(){y(!1)}}),_&&(0,a.createElement)(Oo,{downloableItem:{..._},onCancel:()=>f(null),onRemove:()=>{C(_),f(null)},onChange:e=>{f({..._,name:e})},onSave:(T=_,function(){const e=l.map(Fo).map((e=>e.id===T.id?T:e));s(e),f(null)}),onUploadSuccess:function(e){var t;if(!Array.isArray(e)||!(null==e?void 0:e.length)||void 0===(null===(t=e[0])||void 0===t?void 0:t.id))return;l.length||n(!0);const o={id:Bo(e[0].id),file:e[0].url,name:e[0].title||e[0].alt||e[0].caption||Do(e[0].url)},r=l.map((e=>e.file===(null==_?void 0:_.file)?Fo(o):Fo(e)));s(r),f(o)},onUploadError:N}));var T}};function zo(){return et({name:Vo,metadata:Ho,settings:Uo})}const $o=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-images-field","title":"Product images","category":"widgets","description":"The product images.","keywords":["products","image","images","gallery"],"textdomain":"default","attributes":{"mediaId":{"type":"number","__experimentalRole":"content"},"property":{"type":"string"},"multiple":{"type":"boolean","default":true},"images":{"__experimentalRole":"content","type":"array","items":{"type":"number"},"default":[]}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css","usesContext":["postType"]}');function Go(e){let{...t}=e;return(0,a.createElement)("svg",{...t,width:"32",height:"65",viewBox:"0 0 32 65",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("path",{d:"M29.1535 7.61841C23.142 7.61841 19.6604 8.66953 17.6751 11.0101C18.9601 6.48043 21.3345 3.07988 25.672 0C20.5319 0.663632 17.5484 2.61667 16.1033 5.4115C14.6582 2.6189 11.6747 0.665859 6.53464 0C10.8721 3.07988 13.2465 6.47821 14.5315 11.0101C12.5462 8.66953 9.06465 7.61841 3.0531 7.61841C10.2185 10.9833 12.9597 13.6913 15.2941 18.5438H16.9103C19.2447 13.6913 21.9881 10.9833 29.1513 7.61841H29.1535Z",fill:"#DDDDDD"}),(0,a.createElement)("path",{d:"M20.8963 60.4609C23.2279 59.5968 31.7769 57.6994 31.7769 49.4182C31.7769 44.4995 27.3285 40.7894 22.2783 39.9284C24.5252 39.1942 27.8063 35.9252 27.8063 32.2574C27.8063 27.5321 23.5303 25.6469 20.0344 24.9157C20.0344 23.8371 23.9204 18.272 23.9204 18.272H7.85652C7.85652 18.272 11.7425 23.8371 11.7425 24.9157C8.24361 25.6499 3.97061 27.5321 3.97061 32.2574C3.97061 35.9252 7.25172 39.1942 9.4986 39.9284C4.44538 40.7925 0 44.5026 0 49.4182C0 57.7025 8.54904 59.5998 10.8806 60.4609C5.3526 60.9775 2.5886 63.1347 2.15918 64.8598H29.6207C29.1883 63.1347 26.4243 60.9775 20.8993 60.4609H20.8963Z",fill:"#F0F0F0"}))}function Wo(e){let{...t}=e;return(0,a.createElement)("svg",{...t,width:"59",height:"80",viewBox:"0 0 59 80",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("path",{d:"M54.0218 14.4803C43.085 14.4803 36.7511 16.3926 33.1392 20.6507C35.477 12.41 39.7967 6.22334 47.6879 0.620117C38.3366 1.82746 32.9086 5.38063 30.2796 10.4653C27.6506 5.38468 22.2226 1.83152 12.8713 0.620117C20.7625 6.22334 25.0822 12.4059 27.42 20.6507C23.8081 16.3926 17.4742 14.4803 6.53735 14.4803C19.5733 20.6021 24.5604 25.5287 28.8073 34.357H31.7478C35.9947 25.5287 40.9858 20.6021 54.0178 14.4803H54.0218Z",fill:"#DDDDDD"}),(0,a.createElement)("path",{d:"M38.9992 110.617C43.241 109.045 58.7943 105.593 58.7943 90.5271C58.7943 81.5787 50.7013 74.8288 41.5135 73.2623C45.6013 71.9266 51.5706 65.9793 51.5706 59.3065C51.5706 50.7098 43.7912 47.28 37.4313 45.9498C37.4313 43.9875 44.5009 33.8628 44.5009 33.8628H15.276C15.276 33.8628 22.3456 43.9875 22.3456 45.9498C15.9802 47.2855 8.20633 50.7098 8.20633 59.3065C8.20633 65.9793 14.1757 71.9266 18.2634 73.2623C9.07009 74.8343 0.982605 81.5841 0.982605 90.5271C0.982605 105.599 16.5359 109.051 20.7777 110.617C10.7206 111.557 5.69205 115.482 4.91081 118.62H54.8716C54.0849 115.482 49.0563 111.557 39.0047 110.617H38.9992Z",fill:"#F0F0F0"}))}function jo(e){let{...t}=e;return(0,a.createElement)("svg",{...t,width:"62",height:"65",viewBox:"0 0 62 65",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("path",{d:"M59.3177 7.59526C53.3245 7.59526 49.8535 8.64319 47.8742 10.9766C49.1553 6.46075 51.5225 3.07052 55.8468 0C50.7224 0.661616 47.7479 2.60872 46.3072 5.39506C44.8665 2.61094 41.8921 0.663836 36.7676 0C41.0919 3.07052 43.4591 6.45853 44.7402 10.9766C42.7609 8.64319 39.29 7.59526 33.2967 7.59526C40.4403 10.95 43.1732 13.6497 45.5004 18.4875H47.1118C49.4391 13.6497 52.1741 10.95 59.3155 7.59526H59.3177Z",fill:"#E0E0E0"}),(0,a.createElement)("path",{d:"M51.1522 60.2087C53.4766 59.3472 61.9997 57.4556 61.9997 49.1995C61.9997 44.2958 57.5648 40.597 52.53 39.7386C54.77 39.0066 58.0411 35.7476 58.0411 32.0909C58.0411 27.38 53.7781 25.5004 50.2929 24.7715C50.2929 23.6962 54.167 18.1479 54.167 18.1479H38.152C38.152 18.1479 42.0261 23.6962 42.0261 24.7715C38.5379 25.5035 34.2779 27.38 34.2779 32.0909C34.2779 35.7476 37.5491 39.0066 39.7891 39.7386C34.7513 40.6 30.3194 44.2989 30.3194 49.1995C30.3194 57.4587 38.8424 59.3502 41.1669 60.2087C35.6557 60.7238 32.9001 62.8744 32.472 64.5943H59.8501C59.4189 62.8744 56.6633 60.7238 51.1552 60.2087H51.1522Z",fill:"#F0F0F0"}),(0,a.createElement)("path",{d:"M18.2238 61.2964C20.1078 60.597 27.012 59.0606 27.012 52.3534C27.012 48.3704 23.4192 45.3665 19.3387 44.6672C21.1518 44.0744 23.8026 41.4257 23.8026 38.4551C23.8026 34.6297 20.3494 33.1022 17.5256 32.5094C17.5256 31.6369 20.6641 27.1299 20.6641 27.1299H7.69128C7.69128 27.1299 10.8298 31.6369 10.8298 32.5094C8.0038 33.1022 4.55279 34.6297 4.55279 38.4551C4.55279 41.4235 7.20367 44.0721 9.01672 44.6672C4.93624 45.3665 1.34338 48.3704 1.34338 52.3534C1.34338 59.0606 8.24761 60.597 10.1316 61.2964C5.66767 61.716 3.43571 63.4633 3.08773 64.8598H25.2677C24.9197 63.4633 22.6877 61.716 18.2238 61.2964Z",fill:"white"}),(0,a.createElement)("path",{d:"M14.705 29.1672C16.3668 19.7341 14.7486 11.8172 9.57432 9.5886C4.55918 7.42903 1.86622 9.95303 2.88996 12.0076C4.11785 14.4701 7.87058 12.5775 11.1745 15.6654C14.2667 18.5553 14.3478 29.5136 14.3478 29.5136L14.7066 29.1657L14.705 29.1672Z",fill:"#E0E0E0"}),(0,a.createElement)("path",{d:"M14.6523 26.841C14.6523 26.841 15.8096 19.2256 20.5681 15.9277C25.274 12.6659 29.9139 14.515 30.085 16.3566C30.2561 18.1983 28.9967 19.398 25.1884 19.398C19.4888 19.398 17.078 21.8845 15.0996 26.928C14.5457 28.3407 14.6523 26.841 14.6523 26.841Z",fill:"#E0E0E0"}),(0,a.createElement)("path",{d:"M15.4498 29.3576C15.4498 29.3576 14.2925 21.7422 9.534 18.4443C4.82808 15.1825 0.18821 17.0316 0.0170856 18.8732C-0.154039 20.7149 0.91774 22.0421 6.06198 21.9146C11.532 21.7781 14.1213 29.6156 14.1213 29.6156L15.4498 29.3591V29.3576Z",fill:"#E0E0E0"}),(0,a.createElement)("path",{d:"M18.2243 61.2964C20.1082 60.597 27.0125 59.0606 27.0125 52.3534C27.0125 48.3704 23.4196 45.3665 19.3391 44.6672C21.1522 44.0744 23.803 41.4257 23.803 38.4551C23.803 34.6297 20.3498 33.1022 17.5261 32.5094C17.5261 31.6369 20.6646 27.1299 20.6646 27.1299H7.69171C7.69171 27.1299 10.8302 31.6369 10.8302 32.5094C8.00423 33.1022 4.55322 34.6297 4.55322 38.4551C4.55322 41.4235 7.20409 44.0721 9.01714 44.6672C4.93667 45.3665 1.34381 48.3704 1.34381 52.3534C1.34381 59.0606 8.24804 60.597 10.132 61.2964C5.6681 61.716 3.43614 63.4633 3.08816 64.8598H25.2681C24.9201 63.4633 22.6882 61.716 18.2243 61.2964Z",fill:"#F0F0F0"}),(0,a.createElement)("path",{d:"M14.1795 49.7139C9.43406 49.7139 5.83677 48.8391 2.8889 48.1064C1.92696 49.3053 1.34625 50.7485 1.34625 52.3514C1.34625 53.8035 1.66985 55.0112 2.19737 56.0214C5.63507 57.1892 8.91762 57.7709 14.1817 57.7709C19.4457 57.7709 22.7283 57.1892 26.166 56.0214C26.6913 55.0112 27.0171 53.8012 27.0171 52.3514C27.0171 50.7485 26.4342 49.3053 25.4745 48.1064C22.5266 48.8391 18.9293 49.7139 14.1839 49.7139H14.1795Z",fill:"#E0E0E0"}),(0,a.createElement)("path",{d:"M23.4906 40.2536C23.6901 39.6786 23.8053 39.0747 23.8053 38.4575C23.8053 37.4695 23.5726 36.6347 23.1825 35.9287C21.7307 36.597 17.9162 37.5894 14.1793 37.5894C10.4424 37.5894 6.62788 36.597 5.17611 35.9287C4.78601 36.6347 4.55328 37.4673 4.55328 38.4575C4.55328 39.0769 4.66854 39.6808 4.86802 40.2536C7.2906 41.1417 10.735 41.8566 14.1793 41.8566C17.6237 41.8566 21.0658 41.1417 23.4906 40.2536Z",fill:"#E0E0E0"}))}function qo(e){let{...t}=e;return(0,a.createElement)("svg",{...t,width:"118",height:"77",viewBox:"0 0 118 77",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("rect",{width:"118",height:"77",fill:"white"}),(0,a.createElement)("path",{d:"M72.0248 20.5848C66.0397 20.5848 62.5735 21.6313 60.597 23.9615C61.8763 19.4519 64.2402 16.0663 68.5586 13C63.4412 13.6607 60.4708 15.6051 59.0321 18.3876C57.5934 15.6074 54.623 13.6629 49.5056 13C53.824 16.0663 56.1879 19.4496 57.4672 23.9615C55.4906 21.6313 52.0245 20.5848 46.0394 20.5848C53.1732 23.9349 55.9023 26.6309 58.2264 31.4621H59.8356C62.1596 26.6309 64.891 23.9349 72.0225 20.5848H72.0248Z",fill:"#E0E0E0"}),(0,a.createElement)("path",{d:"M63.8041 73.1943C66.1254 72.334 74.6367 70.445 74.6367 62.2003C74.6367 57.3033 70.2079 53.6096 65.18 52.7523C67.417 52.0214 70.6836 48.7668 70.6836 45.1152C70.6836 40.4107 66.4265 38.5338 62.946 37.8059C62.946 36.732 66.8148 31.1914 66.8148 31.1914H50.8218C50.8218 31.1914 54.6906 36.732 54.6906 37.8059C51.2072 38.5368 46.953 40.4107 46.953 45.1152C46.953 48.7668 50.2197 52.0214 52.4567 52.7523C47.4257 53.6126 42.9999 57.3064 42.9999 62.2003C42.9999 70.448 51.5113 72.337 53.8326 73.1943C48.3289 73.7087 45.5771 75.8563 45.1496 77.5739H72.4901C72.0595 75.8563 69.3077 73.7087 63.8071 73.1943H63.8041Z",fill:"#F0F0F0"}),(0,a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M41.1884 77.8602C39.7296 75.1315 38.8029 71.0481 38.8029 66.4848C38.8029 61.9215 39.7296 57.8381 41.1884 55.1094H30.5839C32.0427 57.8381 32.9693 61.9215 32.9693 66.4848C32.9693 71.0481 32.0427 75.1315 30.5839 77.8602H41.1884Z",fill:"#F0F0F0"}),(0,a.createElement)("path",{d:"M35.8259 32.3584H30.0536L16 55.5332H31.058H40.5939H55.6518L41.5982 32.3584H35.8259Z",fill:"#E0E0E0"}),(0,a.createElement)("path",{d:"M50.9764 47.8242H20.6754L16 55.5332L50.9764 47.8242Z",fill:"#F0F0F0"}),(0,a.createElement)("path",{d:"M46.301 40.1118H25.3508L20.6754 47.8242L46.301 40.1118Z",fill:"#F0F0F0"}),(0,a.createElement)("path",{d:"M41.598 32.3584H30.0535L25.3506 40.1119L41.598 32.3584Z",fill:"#F0F0F0"}),(0,a.createElement)("path",{d:"M77.5858 59H96.2531L95.155 77.6673H78.6838L77.5858 59Z",fill:"#F0F0F0"}),(0,a.createElement)("path",{d:"M88.6696 53.9424C88.6696 56.1976 86.9196 58.0258 86.9196 58.0258C86.9196 58.0258 85.1695 56.1976 85.1695 53.9424C85.1695 51.6871 86.9196 49.8589 86.9196 49.8589C86.9196 49.8589 88.6696 51.6871 88.6696 53.9424Z",fill:"#E0E0E0"}),(0,a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M95.9589 64H77.8798L77.5857 59H96.253L95.9589 64Z",fill:"#E0E0E0"}))}function Zo(){const e=[{id:"front-side",image:(0,a.createElement)(Go,null),text:(0,v.__)("Front side","woocommerce")},{id:"close-up",image:(0,a.createElement)(Wo,null),text:(0,v.__)("Close-up","woocommerce")},{id:"variants",image:(0,a.createElement)(jo,null),text:(0,v.__)("Variants","woocommerce")},{id:"lifestyle-scene",image:(0,a.createElement)(qo,null),text:(0,v.__)("Lifestyle scene","woocommerce")}];return(0,a.createElement)("div",{className:"woocommerce-image-placeholder__wrapper"},e.map((e=>{let{id:t,image:o,text:r}=e;return(0,a.createElement)("div",{key:t,className:"woocommerce-image-placeholder__item"},o,(0,a.createElement)("p",null,r))})))}function Jo(e){return e.id?{id:e.id,name:e.title,src:e.url,alt:e.alt}:null}const{name:Xo}=$o,Yo={example:{},edit:function(e){let{attributes:t,context:o}=e;var r;const{property:n,multiple:l}=t,[s,m]=(0,J.useEntityProp)("postType",o.postType,n),[d,u]=(0,a.useState)(!1),[p,_]=(0,a.useState)(!1),[f,h]=(0,a.useState)(null),g=(0,Ke.useWooBlockProps)(t,{className:Q()({"has-images":Array.isArray(s)?s.length>0:Boolean(s)})});function w(e){return function(t){var o;if((0,I.recordEvent)(e),Array.isArray(t)){const e=t.filter((e=>e.id)).map((e=>({id:e.id,name:e.title,src:e.url,alt:e.alt})));(null===(o=t[0])||void 0===o?void 0:o.id)&&m([...s,...e])}else t.id&&m(Jo(t))}}const E=null!==s&&(!Array.isArray(s)||s.length>0);return(0,a.createElement)("div",{...g},(0,a.createElement)("div",{className:"woocommerce-product-form__image-drop-zone"},d?(0,a.createElement)("div",{className:"woocommerce-product-form__remove-image-drop-zone"},(0,a.createElement)("span",null,(0,a.createElement)(Ee,{icon:Mo,size:20,className:"icon-control"}),(0,v.__)("Drop here to remove","woocommerce")),(0,a.createElement)(c.DropZone,{onHTMLDrop:()=>_(!0),onDrop:()=>_(!0),label:(0,v.__)("Drop here to remove","woocommerce")})):(0,a.createElement)(i.MediaUploader,{value:Array.isArray(s)?s.map((e=>{let{id:t}=e;return t})):null!==(r=null==s?void 0:s.id)&&void 0!==r?r:void 0,multipleSelect:!!l&&"add",onError:()=>null,onFileUploadChange:w("product_images_add_via_file_upload_area"),onMediaGalleryOpen:()=>{(0,I.recordEvent)("product_images_media_gallery_open")},onSelect:function(e){if((0,I.recordEvent)("product_images_add_via_media_library"),Array.isArray(e)){const t=e.map(Jo).filter((e=>null!==e));m(t)}else m(Jo(e))},onUpload:w("product_images_add_via_drag_and_drop_upload"),label:"",buttonText:(0,v.__)("Choose an image","woocommerce")})),E?(0,a.createElement)(i.ImageGallery,{allowDragging:!1,onDragStart:function(e){var t,o;if(Array.isArray(s)){const{id:r,dataset:n}=e.target;if(r)h(parseInt(r,10));else if(null==n?void 0:n.index){const e=parseInt(n.index,10);h(null!==(o=null===(t=s[e])||void 0===t?void 0:t.id)&&void 0!==o?o:null)}u((e=>!e))}},onDragEnd:function(){Array.isArray(s)&&(p&&f&&((0,I.recordEvent)("product_images_remove_image_button_click"),m(s.filter((e=>e.id!==f))),_(!1),h(null)),u((e=>!e)))},onOrderChange:function(e){if(Array.isArray(s)){const t=s.reduce(((e,t)=>({...e,[`${t.id}`]:t})),{}),o=e.filter((e=>{var o;return(null===(o=null==e?void 0:e.props)||void 0===o?void 0:o.id)in t})).map((e=>{var o;return t[null===(o=null==e?void 0:e.props)||void 0===o?void 0:o.id]}));(0,I.recordEvent)("product_images_change_image_order_via_image_gallery"),m(o)}},onReplace:function(e){let{replaceIndex:t,media:o}=e;if((0,I.recordEvent)("product_images_replace_image_button_click"),Array.isArray(s)&&!s.some((e=>o.id===e.id))){const e=Jo(o);if(e){const o=[...s];o[t]=e,m(o)}}else m(Jo(o))},onRemove:function(e){let{removedItem:t}=e;if((0,I.recordEvent)("product_images_remove_image_button_click"),Array.isArray(s)){const e=s.filter((e=>e.id===t.props.id));m(e)}else m(null)},onSelectAsCover:()=>(0,I.recordEvent)("product_images_select_image_as_cover_button_click")},(Array.isArray(s)?s:[s]).map(((e,t)=>(0,a.createElement)(i.ImageGalleryItem,{key:e.id,alt:e.alt,src:e.src,id:`${e.id}`,isCover:l&&0===t})))):(0,a.createElement)(Zo,null))}},Ko=()=>et({name:Xo,metadata:$o,settings:Yo}),Qo=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-inventory-email-field","title":"Stock level threshold","category":"widgets","description":"Stock management minimum quantity.","keywords":["products","inventory","email","minimum"],"textdomain":"default","attributes":{"name":{"type":"string","__experimentalRole":"content"}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css"}'),er=window.wc.wcSettings;function tr(e,t){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];const r=(0,a.useContext)(Ne),[n,i]=(0,a.useState)(!1),l=(0,a.useMemo)((()=>r.registerValidator(e,t)),[e,...o]);return(0,a.useEffect)((()=>()=>{r.unRegisterValidator(e)}),[]),{ref:l,error:r.errors[e],isValidating:n,validate:async()=>(i(!0),r.validateField(e).finally((()=>{i(!1)})))}}const{name:or,...rr}=Qo,nr={example:{},edit:function(e){let{attributes:t,clientId:o}=e;const r=(0,Ke.useWooBlockProps)(t),n=(0,er.getSetting)("notifyLowStockAmount",2),[l,s]=(0,J.useEntityProp)("postType","product","low_stock_amount"),m=(0,ee.useInstanceId)(c.BaseControl,"low_stock_amount"),{ref:d,error:u,validate:p}=tr(`low_stock_amount-${o}`,(async function(){if(l&&l<0)return(0,v.__)("This field must be a positive number.","woocommerce")}),[l]);return(0,a.createElement)(a.Fragment,null,(0,a.createElement)("div",{...r},(0,a.createElement)("div",{className:"wp-block-columns"},(0,a.createElement)("div",{className:"wp-block-column"},(0,a.createElement)(c.BaseControl,{id:m,label:(0,v.__)("Email me when stock reaches","woocommerce"),help:u||(0,a.createInterpolateElement)((0,v.__)("Make sure to enable notifications in <link>store settings.</link>","woocommerce"),{link:(0,a.createElement)(i.Link,{href:`${(0,er.getSetting)("adminUrl")}admin.php?page=wc-settings&tab=products§ion=inventory`,target:"_blank",type:"external"})}),className:u&&"has-error"},(0,a.createElement)(c.__experimentalInputControl,{id:m,ref:d,name:"low_stock_amount",placeholder:(0,v.sprintf)((0,v.__)("%d (store default)","woocommerce"),n),onChange:s,onBlur:p,value:l,type:"number",min:0}))),(0,a.createElement)("div",{className:"wp-block-column"}))))}};function ar(){return et({name:or,metadata:rr,settings:nr})}const ir=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-sku-field","title":"Product text control","category":"woocommerce","description":"The product sku.","keywords":["products","sku"],"textdomain":"default","attributes":{"name":{"type":"string","__experimentalRole":"content"}},"supports":{"align":false,"html":false,"multiple":true,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css","usesContext":["postType"]}'),{name:lr,...cr}=ir,sr={example:{},edit:function(e){let{attributes:t,context:o}=e;const r=(0,Ke.useWooBlockProps)(t),[n,i]=(0,J.useEntityProp)("postType",o.postType,"sku");return(0,a.createElement)("div",{...r},(0,a.createElement)(c.BaseControl,{id:"product_sku",className:"woocommerce-product-form_inventory-sku",label:(0,a.createInterpolateElement)((0,v.__)("Sku <description />","woocommerce"),{description:(0,a.createElement)("span",{className:"woocommerce-product-form__optional-input"},(0,v.__)("(STOCK KEEPING UNIT)","woocommerce"))})},(0,a.createElement)(c.__experimentalInputControl,{name:"woocommerce-product-sku",onChange:i,value:n||""})))}},mr=()=>et({name:lr,metadata:cr,settings:sr}),dr=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-name-field","title":"Product name","category":"widgets","description":"The product name.","keywords":["products","name","title"],"textdomain":"default","attributes":{"name":{"type":"string","__experimentalRole":"content"},"autoFocus":{"type":"boolean","default":false}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css"}'),ur=e=>{let{label:t,required:o,tooltip:r}=e;return(0,a.createElement)("div",{className:"woocommerce-product-form-label__label"},o?(0,a.createInterpolateElement)((0,v.__)("<label/> <required/>","woocommerce"),{label:(0,a.createElement)("span",null,t),required:(0,a.createElement)("span",{className:"woocommerce-product-form-label__required"},(0,v.__)("*","woocommerce"))}):t,r&&(0,a.createElement)(c.Tooltip,{text:(0,a.createElement)("span",null,r),position:"top center",className:"woocommerce-product-form-label__tooltip",delay:0},(0,a.createElement)("span",{className:"woocommerce-product-form-label__icon"},(0,a.createElement)(Ee,{icon:lt,size:18,fill:"#949494"}))))},{name:pr}=dr,_r={example:{},edit:function(e){let{attributes:t,clientId:o}=e;const r=(0,Ke.useWooBlockProps)(t),{editEntityRecord:n,saveEntityRecord:i}=(0,w.useDispatch)("core"),{hasEdit:l}=We(),[s,m]=(0,a.useState)(!1),d=(0,J.useEntityId)("postType","product"),u=(0,w.useSelect)((e=>e("core").getEditedEntityRecord("postType","product",d))),[p,_]=(0,J.useEntityProp)("postType","product","sku"),[f,h]=(0,J.useEntityProp)("postType","product","name"),{permalinkPrefix:g,permalinkSuffix:y}=(0,w.useSelect)((e=>{const{getPermalinkParts:t}=e(b.PRODUCTS_STORE_NAME);if(d){const e=t(d);return{permalinkPrefix:null==e?void 0:e.prefix,permalinkSuffix:null==e?void 0:e.suffix}}return{}})),{ref:C,error:k,validate:S}=tr("name",(async function(){return f&&f!==D?f.length>120?(0,v.__)("Please enter a product name shorter than 120 characters.","woocommerce"):void 0:(0,v.__)("Name field is required.","woocommerce")}),[f]),N=null!=k?k:d&&["publish","draft"].includes(u.status)&&g&&(0,a.createElement)("span",{className:"woocommerce-product-form__secondary-text product-details-section__product-link"},(0,v.__)("Product link","woocommerce"),": ",(0,a.createElement)("a",{href:u.permalink,target:"_blank",rel:"noreferrer"},g,u.slug||(0,E.cleanForSlug)(f),y),(0,a.createElement)(c.Button,{variant:"link",onClick:()=>m(!0)},(0,v.__)("Edit","woocommerce"))),T=(0,ee.useInstanceId)(c.BaseControl,"product_name"),{selectBlock:x}=(0,w.useDispatch)("core/block-editor");return(0,a.useEffect)((()=>{t.autoFocus&&x(o)}),[]),(0,a.createElement)(a.Fragment,null,(0,a.createElement)("div",{...r},(0,a.createElement)(c.BaseControl,{id:T,label:(0,a.createElement)(ur,{label:(0,v.__)("Name","woocommerce"),required:!0}),className:Q()({"has-error":k}),help:N},(0,a.createElement)(c.__experimentalInputControl,{id:T,ref:C,name:"name",autoFocus:t.autoFocus,placeholder:(0,v.__)("e.g. 12 oz Coffee Mug","woocommerce"),onChange:h,value:f&&f!==D?f:"",autoComplete:"off","data-1p-ignore":!0,onBlur:()=>{l("name")&&(p||k||_((0,E.cleanForSlug)(f)),S())}})),s&&(0,a.createElement)(M,{permalinkPrefix:g||"",permalinkSuffix:y||"",product:u,onCancel:()=>m(!1),onSaved:()=>m(!1),saveHandler:async e=>{const{slug:t,permalink:o}=await i("postType","product",{id:u.id,slug:e});if(t&&o)return n("postType","product",u.id,{slug:t,permalink:o}),{slug:t,permalink:o}}})))}},fr=()=>et({name:pr,metadata:dr,settings:_r}),hr=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-pricing-field","description":"A product price block with currency display.","title":"Product pricing","category":"widgets","keywords":["products","price"],"textdomain":"default","attributes":{"property":{"type":"string","__experimentalRole":"content"},"label":{"type":"string"},"help":{"type":"string"}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css","usesContext":["postType"]}'),gr=(e,t,o)=>{const{decimalSeparator:r,thousandSeparator:n}=t,a=new RegExp("[^-0-9%s1%s2]".replace("%s1",r).replace("%s2",n),"g");return void 0===e?e:o(e).replace(a,"")},wr=e=>{let{value:t,onChange:o,onFocus:r,onKeyUp:n}=e;const{sanitizePrice:i}=V(),l=(0,a.useContext)(L.CurrencyContext),{getCurrencyConfig:c,formatAmount:s}=l,m=c();return{prefix:m.symbol,className:"components-currency-control",value:gr(String(t),m,s),sanitize:e=>i(String(e)),onFocus(e){xo(e.currentTarget),r&&r(e)},onKeyUp(e){const r=Number.parseFloat(i(t||"0")),a=Number(e.currentTarget.step||"1");"ArrowUp"===e.code&&o(String(r+a)),"ArrowDown"===e.code&&o(String(r-a)),n&&n(e)},onChange(e){const t=i(e);o&&o(t)}}},{name:vr,...Er}=hr,br={example:{},edit:function(e){let{attributes:t,context:{postType:o}}=e;const r=(0,Ke.useWooBlockProps)(t),{property:n,label:l,help:s,disabled:m}=t,[d,u]=it(n,{postType:o,fallbackValue:""}),p=wr({value:d||"",onChange:u}),_=s?(0,a.createInterpolateElement)(s,{PricingTab:(0,a.createElement)(i.Link,{href:(0,ye.getNewPath)({tab:"pricing"}),onClick:()=>{(0,I.recordEvent)("product_pricing_help_click")}})}):null,f=(0,ee.useInstanceId)(c.BaseControl,"wp-block-woocommerce-product-pricing-field");return(0,a.createElement)("div",{...r},(0,a.createElement)(c.BaseControl,{id:f,help:_},(0,a.createElement)(c.__experimentalInputControl,{...p,disabled:m,id:f,name:n,label:l||(0,v.__)("Price","woocommerce")})))}};function yr(){return et({name:vr,metadata:Er,settings:br})}const Cr=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-radio-field","title":"Product radio control","category":"woocommerce","description":"The product radio.","keywords":["products","radio","input"],"textdomain":"default","attributes":{"title":{"type":"string"},"description":{"type":"string"},"property":{"type":"string"},"options":{"type":"array","items":{"type":"object"},"default":[],"__experimentalRole":"content"}},"supports":{"align":false,"html":false,"multiple":true,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"usesContext":["postType"]}');function kr(e){let{title:t,description:o,className:r,...n}=e;return(0,a.createElement)(c.RadioControl,{...n,className:Q()(r,"woocommerce-radio-field"),label:(0,a.createElement)(a.Fragment,null,(0,a.createElement)("span",{className:"woocommerce-radio-field__title"},t),o&&(0,a.createElement)("span",{className:"woocommerce-radio-field__description",dangerouslySetInnerHTML:St(o)}))})}const{name:Sr,...Nr}=Cr,Tr={example:{},edit:function(e){let{attributes:t,context:{postType:o}}=e;const r=(0,Ke.useWooBlockProps)(t),{description:n,options:i,property:l,title:c}=t,[s,m]=it(l,{postType:o,fallbackValue:""});return(0,a.createElement)("div",{...r},(0,a.createElement)(kr,{title:c,description:n,selected:s,options:i,onChange:e=>m(e||"")}))}};function xr(){return et({name:Sr,metadata:Nr,settings:Tr})}const Pr=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-regular-price-field","description":"A product price block with currency display.","title":"Product regular price","category":"widgets","keywords":["products","price"],"textdomain":"default","attributes":{"label":{"type":"string","__experimentalRole":"content"},"help":{"type":"string"},"isRequired":{"type":"boolean","default":false}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"usesContext":["postType"],"editorStyle":"file:./editor.css"}'),{name:Ar,...Ir}=Pr,Mr={example:{},edit:function(e){let{attributes:t,clientId:o,context:r}=e;const n=(0,Ke.useWooBlockProps)(t),{label:l,help:s,isRequired:m}=t,[d,u]=(0,J.useEntityProp)("postType",r.postType||"product","regular_price"),[p]=(0,J.useEntityProp)("postType",r.postType||"product","sale_price"),_=wr({value:d,onChange:u}),f=s?(0,a.createInterpolateElement)(s,{PricingTab:(0,a.createElement)(i.Link,{href:(0,ye.getNewPath)({tab:"pricing"}),onClick:()=>{(0,I.recordEvent)("product_pricing_help_click")}})}):null,h=(0,ee.useInstanceId)(c.BaseControl,"wp-block-woocommerce-product-regular-price-field"),{ref:g,error:w,validate:E}=tr(`regular_price-${o}`,(async function(){const e=Number.parseFloat(d);if(e){if(e<0)return(0,v.__)("List price must be greater than or equals to zero.","woocommerce");if(p&&e<=Number.parseFloat(p))return(0,v.__)("List price must be greater than the sale price.","woocommerce")}else if(m)return(0,v.sprintf)((0,v.__)("%s is required.","woocommerce"),l)}),[d,p]);return(0,a.useEffect)((()=>{m&&E()}),[]),(0,a.createElement)("div",{...n},(0,a.createElement)(c.BaseControl,{id:h,help:w||f,className:Q()({"has-error":w})},(0,a.createElement)(c.__experimentalInputControl,{..._,id:h,name:"regular_price",ref:g,label:l,onBlur:E})))}};function Rr(){return et({name:Ar,metadata:Ir,settings:Mr})}const Lr=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-sale-price-field","description":"A product price block with currency display.","title":"Product sale price","category":"widgets","keywords":["products","price"],"textdomain":"default","attributes":{"label":{"type":"string","__experimentalRole":"content"},"help":{"type":"string"}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"usesContext":["postType"],"editorStyle":"file:./editor.css"}'),{name:Or,...Dr}=Lr,Br={example:{},edit:function(e){let{attributes:t,clientId:o,context:r}=e;const n=(0,Ke.useWooBlockProps)(t),{label:i,help:l}=t,[s]=(0,J.useEntityProp)("postType",r.postType||"product","regular_price"),[m,d]=(0,J.useEntityProp)("postType",r.postType||"product","sale_price"),u=wr({value:m,onChange:d}),p=(0,ee.useInstanceId)(c.BaseControl,"wp-block-woocommerce-product-sale-price-field"),{ref:_,error:f,validate:h}=tr(`sale-price-${o}`,(async function(){if(m){if(Number.parseFloat(m)<0)return(0,v.__)("Sale price must be greater than or equals to zero.","woocommerce");const e=Number.parseFloat(s);if(!e||e<=Number.parseFloat(m))return(0,v.__)("Sale price must be lower than the list price.","woocommerce")}}),[s,m]);return(0,a.createElement)("div",{...n},(0,a.createElement)(c.BaseControl,{id:p,help:f||l,className:Q()({"has-error":f})},(0,a.createElement)(c.__experimentalInputControl,{...u,id:p,name:"sale_price",ref:_,label:i,onBlur:h})))}};function Fr(){return et({name:Or,metadata:Dr,settings:Br})}const Vr=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-schedule-sale-fields","title":"Product schedule sale fields","category":"woocommerce","description":"The product schedule sale fields.","keywords":["products","schedule","sale"],"textdomain":"default","attributes":{"name":{"type":"string","__experimentalRole":"content"}},"supports":{"align":false,"html":false,"multiple":true,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css","usesContext":["postType"]}'),Hr=window.moment;var Ur=o.n(Hr);const zr=window.wp.date,{name:$r,...Gr}=Vr,Wr={example:{},edit:function(e){let{attributes:t,clientId:o,context:r}=e;const n=(0,Ke.useWooBlockProps)(t),{hasEdit:l}=We(),s=(0,zr.getSettings)().formats.datetime,[m,d]=(0,a.useState)(!1),[u]=(0,J.useEntityProp)("postType",r.postType||"product","sale_price"),p=Number.parseFloat(u||"0")>0,[_,f]=(0,J.useEntityProp)("postType",r.postType||"product","date_on_sale_from_gmt"),[h,g]=(0,J.useEntityProp)("postType",r.postType||"product","date_on_sale_to_gmt"),w=Ur()().startOf("minute").toISOString();(0,a.useEffect)((()=>{l("sale_price")&&!p&&(d(!1),f(""),g(""))}),[p]),(0,a.useEffect)((()=>{(_||h)&&d(!0)}),[_,h]);const E=Ur()(_,Ur().ISO_8601,!0),b=Ur()(h,Ur().ISO_8601,!0),{ref:y,error:C,validate:k}=tr(`date_on_sale_from_gmt-${o}`,(async function(){if(m&&_){if(!E.isValid())return(0,v.__)("Please enter a valid date.","woocommerce");if(E.isAfter(b))return(0,v.__)("The start date of the sale must be before the end date.","woocommerce")}}),[m,_,E,b]),{ref:S,error:N,validate:T}=tr(`date_on_sale_to_gmt-${o}`,(async function(){if(m&&h){if(!b.isValid())return(0,v.__)("Please enter a valid date.","woocommerce");if(b.isBefore(E))return(0,v.__)("The end date of the sale must be after the start date.","woocommerce")}}),[m,_,E,b]);return(0,a.createElement)("div",{...n},(0,a.createElement)(c.ToggleControl,{label:(0,v.__)("Schedule sale","woocommerce"),checked:m,onChange:function(e){(0,I.recordEvent)("product_pricing_schedule_sale_toggle_click",{enabled:e}),d(e),e?(f(w),g("")):(f(""),g(""))},disabled:!p}),m&&(0,a.createElement)("div",{className:"wp-block-columns wp-block-woocommerce-product-schedule-sale-fields__content"},(0,a.createElement)("div",{className:"wp-block-column"},(0,a.createElement)(i.DateTimePickerControl,{ref:y,label:(0,v.__)("From","woocommerce"),placeholder:(0,v.__)("Sale start date and time (optional)","woocommerce"),dateTimeFormat:s,currentDate:_,onChange:f,className:C&&"has-error",help:C,onBlur:k})),(0,a.createElement)("div",{className:"wp-block-column"},(0,a.createElement)(i.DateTimePickerControl,{ref:S,label:(0,v.__)("To","woocommerce"),placeholder:(0,v.__)("Sale end date and time (optional)","woocommerce"),dateTimeFormat:s,currentDate:h,onChange:e=>g(Ur()(e).startOf("minute").toISOString()),onBlur:T,className:N&&"has-error",help:N}))))}};function jr(){return et({name:$r,metadata:Gr,settings:Wr})}const qr=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-section","title":"Product section","category":"woocommerce","description":"The product section.","keywords":["products","section","group"],"textdomain":"default","attributes":{"title":{"type":"string"},"description":{"type":"string","__experimentalRole":"content"},"blockGap":{"type":"string","enum":["unit-30","unit-40"],"default":"unit-30"}},"supports":{"align":false,"html":false,"multiple":true,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css"}'),{name:Zr,...Jr}=qr,Xr={example:{},edit:function(e){let{attributes:t,clientId:o}=e;const{description:r,title:n,blockGap:l}=t,c=(0,Ke.useWooBlockProps)(t),s=(0,ze.useInnerBlocksProps)({className:Q()("wp-block-woocommerce-product-section__content",`wp-block-woocommerce-product-section__content--block-gap-${l}`)},{templateLock:"all"}),m=n?"fieldset":"div",d="fieldset"===m?"legend":"div",u=`wp-block-woocommerce-product-section__heading-tooltip-${o}`;return(0,a.createElement)(m,{...c},n&&(0,a.createElement)(d,{className:"wp-block-woocommerce-product-section__heading"},(0,a.createElement)("h2",{className:"wp-block-woocommerce-product-section__heading-title"},n,r&&(0,a.createElement)(i.__experimentalTooltip,{className:u,text:(0,a.createElement)("p",{className:"wp-block-woocommerce-product-section__heading-description",dangerouslySetInnerHTML:St(r)}),position:"bottom center",helperText:(0,v.__)("View helper text","woocommerce")}))),(0,a.createElement)("div",{...s}))}};function Yr(){return et({name:Zr,metadata:Jr,settings:Xr})}const Kr=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-shipping-class-field","title":"Product shipping class field","category":"woocommerce","description":"The product shipping class field.","keywords":["products","shipping","class"],"textdomain":"default","attributes":{"title":{"type":"string","__experimentalRole":"content"}},"supports":{"align":false,"html":false,"multiple":true,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"usesContext":["postType"]}');function Qr(e){let{onAdd:t,onCancel:o}=e;var r;const{errors:n,getInputProps:l,isValidForm:s}=(0,i.useFormContext)(),[m,d]=(0,a.useState)(!1);return(0,a.createElement)("div",{className:"woocommerce-add-new-shipping-class-modal__wrapper"},(0,a.createElement)(c.TextControl,{...l("name"),placeholder:(0,v.__)("e.g. Fragile products","woocommerce"),label:(0,a.createInterpolateElement)((0,v.__)("Name <required />","woocommerce"),{required:(0,a.createElement)("span",{className:"woocommerce-add-new-shipping-class-modal__optional-input"},(0,v.__)("(required)","woocommerce"))})}),(0,a.createElement)(c.TextControl,{...l("slug"),label:(0,v.__)("Slug","woocommerce")}),(0,a.createElement)(c.TextControl,{...l("description"),label:(0,v.__)("Description","woocommerce"),help:null!==(r=null==n?void 0:n.description)&&void 0!==r?r:(0,v.__)("Describe how you and other store administrators can use this shipping class.","woocommerce")}),(0,a.createElement)("div",{className:"woocommerce-add-new-shipping-class-modal__buttons"},(0,a.createElement)(c.Button,{isSecondary:!0,onClick:o},(0,v.__)("Cancel","woocommerce")),(0,a.createElement)(c.Button,{isPrimary:!0,isBusy:m,disabled:!s||m,onClick:function(){d(!0),t().then((()=>{d(!1),o()})).catch((()=>{d(!1)}))}},(0,v.__)("Add","woocommerce"))))}function en(e){var t;const o={};return(null===(t=e.name)||void 0===t?void 0:t.length)||(o.name=(0,v.__)("The shipping class name is required.","woocommerce")),o}const tn={name:"",slug:"",description:""};function on(e){let{shippingClass:t,onAdd:o,onCancel:r}=e;return(0,a.createElement)(c.Modal,{title:(0,v.__)("New shipping class","woocommerce"),className:"woocommerce-add-new-shipping-class-modal",onRequestClose:r},(0,a.createElement)(i.Form,{initialValues:null!=t?t:tn,validate:en,errors:{},onSubmit:function(e){return o(Object.entries(e).reduce((function(e,t){let[o,r]=t;return{...e,[o]:""===r?void 0:r}}),{}))}},(e=>(0,a.createElement)(Qr,{onAdd:e.handleSubmit,onCancel:r}))))}const rn=[{value:"",label:(0,v.__)("No shipping class","woocommerce")},{value:S,label:(0,v.__)("Add new shipping class","woocommerce")}];function nn(e){return e.map((e=>{let{slug:t,name:o}=e;return{value:t,label:o}}))}function an(e,t){const o=null==e?void 0:e.find((e=>{let{slug:t}=e;return"uncategorized"!==t}));if(o&&!(null==t?void 0:t.some((e=>{let{slug:t}=e;return t===o.slug}))))return{name:o.name,slug:o.slug}}const{name:ln,...cn}=Kr,sn={example:{},edit:function(e){let{attributes:t,context:o}=e;const[r,n]=(0,a.useState)(!1),l=(0,Ke.useWooBlockProps)(t),{createProductShippingClass:s,invalidateResolution:m}=(0,w.useDispatch)(b.EXPERIMENTAL_PRODUCT_SHIPPING_CLASSES_STORE_NAME),{createErrorNotice:d}=(0,w.useDispatch)("core/notices"),[u]=(0,J.useEntityProp)("postType",o.postType,"categories"),[p,_]=(0,J.useEntityProp)("postType",o.postType,"shipping_class"),[f]=(0,J.useEntityProp)("postType",o.postType,"virtual");function h(e){let t=(0,v.__)("We couldn’t add this shipping class. Try again in a few seconds.","woocommerce");throw"term_exists"===e.code&&(t=(0,v.__)("A shipping class with that slug already exists.","woocommerce")),d(t,{explicitDismiss:!0}),e}const{shippingClasses:g}=(0,w.useSelect)((e=>{var t;const{getProductShippingClasses:o}=e(b.EXPERIMENTAL_PRODUCT_SHIPPING_CLASSES_STORE_NAME);return{shippingClasses:null!==(t=o())&&void 0!==t?t:[]}}),[]),E=(0,ee.useInstanceId)(c.BaseControl,"wp-block-woocommerce-product-shipping-class-field");return(0,a.createElement)("div",{...l},(0,a.createElement)("div",{className:"wp-block-columns"},(0,a.createElement)("div",{className:"wp-block-column"},(0,a.createElement)(c.SelectControl,{id:E,name:"shipping_class",value:p,onChange:e=>{e!==S?_(e):n(!0)},label:(0,v.__)("Shipping class","woocommerce"),options:[...rn,...nn(null!=g?g:[])],disabled:f,help:(0,a.createInterpolateElement)((0,v.__)("Manage shipping classes and rates in <Link>global settings</Link>.","woocommerce"),{Link:(0,a.createElement)(i.Link,{href:(0,ye.getNewPath)({tab:"shipping",section:"classes"},"",{},"wc-settings"),target:"_blank",type:"external",onClick:()=>{(0,I.recordEvent)("product_shipping_global_settings_link_click")}},(0,a.createElement)(a.Fragment,null))})})),(0,a.createElement)("div",{className:"wp-block-column"})),r&&(0,a.createElement)(on,{shippingClass:an(u,g),onAdd:e=>s(e).then((e=>((0,I.recordEvent)("product_new_shipping_class_modal_add_button_click"),m("getProductShippingClasses"),_(e.slug),e))).catch(h),onCancel:()=>n(!1)}))}};function mn(){return et({name:ln,metadata:cn,settings:sn})}const dn=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-shipping-dimensions-fields","title":"Product shipping dimensions fields","category":"woocommerce","description":"The product shipping dimensions fields.","keywords":["products","shipping","dimensions"],"textdomain":"default","attributes":{"__contentEditable":{"type":"string","__experimentalRole":"content"}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css","usesContext":["postType"]}');function un(e){let{highlight:t,labels:o={},...r}=e;return(0,a.createElement)("svg",{width:"295",height:"195",viewBox:"0 0 295 195",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},(0,a.createElement)("path",{d:"M11.5664 134.604V35.3599C11.5664 33.9482 12.9862 32.9782 14.3014 33.4915L99.6373 66.7959C100.4 67.0935 100.905 67.8243 100.914 68.6426L102.037 171.578C102.052 173.027 100.574 174.014 99.2419 173.444L12.7831 136.448C12.0451 136.132 11.5664 135.407 11.5664 134.604Z",fill:"A"===t?"#F0F6FC":"#FFFFFF"}),(0,a.createElement)("path",{d:"M11.5664 134.603V35.3599C11.5664 33.9482 12.9862 32.9782 14.3014 33.4915L99.624 66.7908C100.393 67.0909 100.9 67.8314 100.901 68.6569L101.024 174.131L12.7844 136.447C12.0457 136.132 11.5664 135.406 11.5664 134.603Z",stroke:"#E0E0E0",strokeWidth:"2.00574"}),(0,a.createElement)("path",{d:"M1.25977 150.388L86.0112 188.183",stroke:"A"===t?"#006FAD":"#CCCCCC",strokeWidth:"1.50431",strokeMiterlimit:"16"}),(0,a.createElement)("path",{d:"M250.775 32.9793L100.9 66.9577V172.981C100.9 174.297 102.146 175.257 103.418 174.921L251.73 135.764C252.611 135.531 253.224 134.735 253.224 133.824V34.9354C253.224 33.6488 252.03 32.6948 250.775 32.9793Z",fill:"B"===t?"#F0F6FC":"#FFFFFF",stroke:"#E0E0E0",strokeWidth:"2.00574"}),(0,a.createElement)("path",{d:"M270.402 28.9875V132.064",stroke:"C"===t?"#006FAD":"#CCCCCC",strokeWidth:"1.50431",strokeMiterlimit:"16"}),(0,a.createElement)("path",{d:"M257.804 152.679L107.771 192.765",stroke:"B"===t?"#006FAD":"#CCCCCC",strokeWidth:"1.50431",strokeMiterlimit:"16"}),(0,a.createElement)("path",{d:"M13.1406 33.41L161.446 1.61817C161.808 1.54066 162.184 1.56462 162.533 1.68742L251.16 32.8868",stroke:"#E0E0E0",strokeWidth:"2.00574"}),o.C?(0,a.createElement)("text",{x:"280",y:"85",fontSize:11,fill:"C"===t?"#007CBA":"#949494"},o.C):(0,a.createElement)("path",{d:"M282.123 80.7892C282.123 79.5323 282.435 78.5405 283.058 77.8136C283.685 77.0867 284.537 76.7233 285.615 76.7233C286.467 76.7233 287.192 76.9739 287.79 77.4752C288.391 77.9729 288.741 78.6175 288.837 79.4088H287.639C287.525 78.9326 287.285 78.553 286.92 78.2701C286.558 77.9873 286.123 77.8458 285.615 77.8458C284.92 77.8458 284.368 78.1108 283.96 78.6407C283.556 79.1671 283.353 79.8833 283.353 80.7892C283.353 81.6915 283.556 82.4077 283.96 82.9376C284.368 83.464 284.922 83.7272 285.62 83.7272C286.132 83.7272 286.569 83.5983 286.93 83.3405C287.296 83.0826 287.532 82.7353 287.639 82.2985H288.837C288.73 83.0647 288.382 83.6824 287.795 84.1515C287.208 84.617 286.483 84.8497 285.62 84.8497C284.542 84.8497 283.69 84.4863 283.063 83.7594C282.437 83.0325 282.123 82.0424 282.123 80.7892Z",fill:"C"===t?"#007CBA":"#949494"}),o.B?(0,a.createElement)("text",{x:"188",y:"190",fontSize:11,fill:"B"===t?"#007CBA":"#949494"},o.B):(0,a.createElement)("path",{d:"M192.281 189.611V181.861H195.396C196.123 181.861 196.692 182.034 197.104 182.382C197.519 182.725 197.727 183.196 197.727 183.794C197.727 184.199 197.596 184.562 197.335 184.885C197.073 185.203 196.751 185.395 196.368 185.459V185.551C196.891 185.604 197.312 185.803 197.63 186.147C197.953 186.487 198.114 186.91 198.114 187.414C198.114 188.098 197.879 188.635 197.41 189.026C196.941 189.416 196.293 189.611 195.466 189.611H192.281ZM193.484 188.591H195.224C195.765 188.591 196.177 188.483 196.459 188.268C196.742 188.054 196.884 187.74 196.884 187.328C196.884 186.924 196.737 186.618 196.443 186.41C196.15 186.199 195.72 186.093 195.154 186.093H193.484V188.591ZM193.484 185.142H194.913C195.442 185.142 195.844 185.048 196.116 184.858C196.391 184.664 196.529 184.383 196.529 184.015C196.529 183.656 196.404 183.379 196.153 183.182C195.906 182.981 195.561 182.881 195.117 182.881H193.484V185.142Z",fill:"B"===t?"#007CBA":"#949494"}),o.A?(0,a.createElement)("text",{x:"18",y:"185",fontSize:11,fill:"A"===t?"#007CBA":"#949494"},o.A):(0,a.createElement)("path",{d:"M22.7694 185.149L25.5678 177.399H26.8622L29.6605 185.149H28.3822L27.6732 183.092H24.7191L24.0048 185.149H22.7694ZM25.0253 182.082H27.3671L26.2445 178.806H26.1532L25.0253 182.082Z",fill:"A"===t?"#007CBA":"#949494"}))}const{name:pn,..._n}=dn,fn={example:{},edit:function(e){let{attributes:t,clientId:o,context:r}=e;var n,i,l;const s=(0,Ke.useWooBlockProps)(t),[m,d]=(0,J.useEntityProp)("postType",r.postType,"dimensions"),[u,p]=(0,J.useEntityProp)("postType",r.postType,"weight"),[_]=(0,J.useEntityProp)("postType",r.postType,"virtual"),[f,h]=(0,a.useState)(),{formatNumber:g,parseNumber:E}=V(),{dimensionUnit:y,weightUnit:C}=(0,w.useSelect)((e=>{const{getOption:t}=e(b.OPTIONS_STORE_NAME);return{dimensionUnit:t("woocommerce_dimension_unit"),weightUnit:t("woocommerce_weight_unit")}}),[]);function k(e,t){return{name:`dimensions.${e}`,value:m?g(String(m[e])):void 0,onChange:t=>d({...null!=m?m:{},[e]:E(t)}),onFocus:()=>h(t),onBlur:()=>h(void 0),suffix:y,disabled:_}}const{ref:S,error:N,validate:T}=tr(`dimensions_width-${o}`,(async function(){if((null==m?void 0:m.width)&&+m.width<=0)return(0,v.__)("Width must be greater than zero.","woocommerce")}),[null==m?void 0:m.width]),{ref:x,error:P,validate:A}=tr(`dimensions_length-${o}`,(async function(){if((null==m?void 0:m.length)&&+m.length<=0)return(0,v.__)("Length must be greater than zero.","woocommerce")}),[null==m?void 0:m.length]),{ref:I,error:M,validate:R}=tr(`dimensions_height-${o}`,(async function(){if((null==m?void 0:m.height)&&+m.height<=0)return(0,v.__)("Height must be greater than zero.","woocommerce")}),[null==m?void 0:m.height]),{ref:L,error:O,validate:D}=tr(`weight-${o}`,(async function(){if(u&&+u<=0)return(0,v.__)("Weight must be greater than zero.","woocommerce")}),[u]),B={...k("width","A"),id:(0,ee.useInstanceId)(c.BaseControl,"product_shipping_dimensions_width"),ref:S,onBlur:T},F={...k("length","B"),id:(0,ee.useInstanceId)(c.BaseControl,"product_shipping_dimensions_length"),ref:x,onBlur:A},H={...k("height","C"),id:(0,ee.useInstanceId)(c.BaseControl,"product_shipping_dimensions_height"),ref:I,onBlur:R},U={id:(0,ee.useInstanceId)(c.BaseControl,"product_shipping_weight"),name:"weight",value:g(String(u)),onChange:e=>p(E(e)),suffix:C,ref:L,onBlur:D,disabled:_};return(0,a.createElement)("div",{...s},(0,a.createElement)("h4",null,(0,v.__)("Dimensions","woocommerce")),(0,a.createElement)("div",{className:"wp-block-columns"},(0,a.createElement)("div",{className:"wp-block-column"},(0,a.createElement)(c.BaseControl,{id:B.id,label:(0,a.createInterpolateElement)((0,v.__)("Width <Side />","woocommerce"),{Side:(0,a.createElement)("span",null,"A")}),className:Q()({"has-error":N}),help:N},(0,a.createElement)(c.__experimentalInputControl,{...B})),(0,a.createElement)(c.BaseControl,{id:F.id,label:(0,a.createInterpolateElement)((0,v.__)("Length <Side />","woocommerce"),{Side:(0,a.createElement)("span",null,"B")}),className:Q()({"has-error":P}),help:P},(0,a.createElement)(c.__experimentalInputControl,{...F})),(0,a.createElement)(c.BaseControl,{id:H.id,label:(0,a.createInterpolateElement)((0,v.__)("Height <Side />","woocommerce"),{Side:(0,a.createElement)("span",null,"C")}),className:Q()({"has-error":M}),help:M},(0,a.createElement)(c.__experimentalInputControl,{...H})),(0,a.createElement)(c.BaseControl,{id:U.id,label:(0,v.__)("Weight","woocommerce"),className:Q()({"has-error":O}),help:O},(0,a.createElement)(c.__experimentalInputControl,{...U}))),(0,a.createElement)("div",{className:"wp-block-column"},(0,a.createElement)(un,{highlight:f,className:"wp-block-woocommerce-product-shipping-dimensions-fields__dimensions-image",labels:{A:(null===(n=B.value)||void 0===n?void 0:n.length)?B.value:void 0,B:(null===(i=F.value)||void 0===i?void 0:i.length)?F.value:void 0,C:(null===(l=H.value)||void 0===l?void 0:l.length)?H.value:void 0}}))))}};function hn(){return et({name:pn,metadata:_n,settings:fn})}const gn=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-summary-field","title":"Product summary","category":"widgets","description":"The product summary.","keywords":["products","summary","excerpt"],"textdomain":"default","attributes":{"property":{"type":"string"},"align":{"type":"string"},"allowedFormats":{"type":"array","default":["core/bold","core/code","core/italic","core/link","core/strikethrough","core/underline","core/text-color","core/subscript","core/superscript","core/unknown"]},"direction":{"type":"string","enum":["ltr","rtl"]},"label":{"type":"string"},"helpText":{"type":"string"},"content":{"type":"string","__experimentalRole":"content"}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"editorStyle":"file:./editor.css","usesContext":["postType"]}'),wn=(0,a.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,a.createElement)(oe.Path,{d:"M5.52 2h7.43c.55 0 1 .45 1 1s-.45 1-1 1h-1v13c0 .55-.45 1-1 1s-1-.45-1-1V5c0-.55-.45-1-1-1s-1 .45-1 1v12c0 .55-.45 1-1 1s-1-.45-1-1v-5.96h-.43C3.02 11.04 1 9.02 1 6.52S3.02 2 5.52 2zM14 14l5-4-5-4v8z"}));function vn(e){let{direction:t,onChange:o}=e;return(0,a.createElement)(a.Fragment,null,(0,v.isRTL)()&&(0,a.createElement)(c.ToolbarButton,{icon:wn,title:(0,v._x)("Left to right","editor button","woocommerce"),isActive:"ltr"===t,onClick:function(){"function"==typeof o&&o("ltr"===t?void 0:"ltr")}}))}const En=(0,a.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(oe.Path,{d:"M4 19.8h8.9v-1.5H4v1.5zm8.9-15.6H4v1.5h8.9V4.2zm-8.9 7v1.5h16v-1.5H4z"})),bn=(0,a.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(oe.Path,{d:"M16.4 4.2H7.6v1.5h8.9V4.2zM4 11.2v1.5h16v-1.5H4zm3.6 8.6h8.9v-1.5H7.6v1.5z"})),yn=(0,a.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(oe.Path,{d:"M11.1 19.8H20v-1.5h-8.9v1.5zm0-15.6v1.5H20V4.2h-8.9zM4 12.8h16v-1.5H4v1.5z"})),Cn=(0,a.createElement)(oe.SVG,{xmlns:"https://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(oe.Path,{d:"M4 12.8h16v-1.5H4v1.5zm0 7h12.4v-1.5H4v1.5zM4 4.3v1.5h16V4.3H4z"})),kn=[{icon:En,title:(0,v.__)("Align text left","woocommerce"),align:"left"},{icon:bn,title:(0,v.__)("Align text center","woocommerce"),align:"center"},{icon:yn,title:(0,v.__)("Align text right","woocommerce"),align:"right"},{icon:Cn,title:(0,v.__)("Align text justify","woocommerce"),align:"justify"}],{name:Sn,...Nn}=gn,Tn={example:{},edit:function e(t){let{attributes:o,setAttributes:r,context:n}=t;const{align:i,allowedFormats:l,direction:s,label:m,helpText:d}=o,u=(0,Ke.useWooBlockProps)(o,{style:{direction:s}}),p=(0,ee.useInstanceId)(e,"wp-block-woocommerce-product-summary-field__content"),[_,f]=(0,J.useEntityProp)("postType",n.postType||"product",o.property),{clearSelectedBlock:h}=(0,w.useDispatch)(ze.store);return(0,a.createElement)("div",{className:"wp-block wp-block-woocommerce-product-summary-field-wrapper"},(0,a.createElement)(ze.BlockControls,{group:"block"},(0,a.createElement)(ze.AlignmentControl,{alignmentControls:kn,value:i,onChange:function(e){r({align:e})}}),(0,a.createElement)(vn,{direction:s,onChange:function(e){r({direction:e})}})),(0,a.createElement)(c.BaseControl,{id:p.toString(),label:(0,a.createInterpolateElement)(m||(0,v.__)("Summary","woocommerce"),{optional:(0,a.createElement)("span",{className:"woocommerce-product-form__optional-input"},(0,v.__)("(OPTIONAL)","woocommerce"))}),help:"string"==typeof d?d:(0,v.__)("Summarize this product in 1-2 short sentences. We'll show it at the top of the page.","woocommerce")},(0,a.createElement)("div",{...u},(0,a.createElement)(ze.RichText,{id:p.toString(),identifier:"content",tagName:"p",value:_,onChange:f,"data-empty":Boolean(_),className:Q()("components-summary-control",{[`has-text-align-${i}`]:i}),dir:s,allowedFormats:l,onBlur:function(e){var t;(null===(t=e.relatedTarget)||void 0===t?void 0:t.closest(".block-editor-block-contextual-toolbar"))||h()}}))))}};function xn(){return et({name:Sn,metadata:Nn,settings:Tn})}const Pn=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-tab","title":"Product tab","category":"woocommerce","description":"The product tab.","keywords":["products","tab","group"],"textdomain":"default","attributes":{"id":{"type":"string"},"title":{"type":"string"}},"supports":{"align":false,"html":false,"multiple":true,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"providesContext":{"isInSelectedTab":"isSelected"},"usesContext":["selectedTab"],"editorStyle":"file:./editor.css","templateLock":"contentOnly"}'),An=100,In=e=>{let{children:t}=e;return(0,a.createElement)(a.Fragment,null,t)};function Mn(e){let{children:t,className:o,id:r,order:n=An,selected:i=!1}=e;const l=Q()("wp-block-woocommerce-product-tab__button",o,{"is-selected":i});return(0,a.createElement)(c.Fill,{name:De},(e=>{const{onClick:o}=e;return(0,a.createElement)(In,{order:n},(0,a.createElement)(c.Button,{key:r,className:l,onClick:()=>o(r),id:`woocommerce-product-tab__${r}`,"aria-controls":`woocommerce-product-tab__${r}-content`,"aria-selected":i},t))}))}const{name:Rn,...Ln}=Pn,On={example:{},edit:function(e){let{setAttributes:t,attributes:o,context:r}=e;const n=(0,Ke.useWooBlockProps)(o),{id:i,title:l,_templateBlockOrder:c,isSelected:s}=o,m=r.selectedTab===i;m!==s&&t({isSelected:m});const d=Q()("wp-block-woocommerce-product-tab__content",{"is-selected":m});return(0,a.createElement)("div",{...n},(0,a.createElement)(Mn,{id:i,selected:m,order:c},l),(0,a.createElement)("div",{id:`woocommerce-product-tab__${i}-content`,"aria-labelledby":`woocommerce-product-tab__${i}`,role:"tabpanel",className:d},(0,a.createElement)(ze.InnerBlocks,{templateLock:"contentOnly"})))}};function Dn(){return et({name:Rn,metadata:Ln,settings:On})}const Bn=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-tag-field","title":"Product Tag","category":"widgets","description":"A field to select product tags.","keywords":["products","tag"],"textdomain":"default","attributes":{"name":{"type":"string","__experimentalRole":"content"},"label":{"type":"string"},"placeholder":{"type":"string"}},"usesContext":["postType"],"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css"}'),Fn=e=>{let{initialTagName:t,onCancel:o,onCreate:r}=e;const{createNotice:n}=(0,w.useDispatch)("core/notices"),[i,l]=(0,a.useState)(!1),{createProductTag:s,invalidateResolutionForStoreSelector:m}=(0,w.useDispatch)(b.EXPERIMENTAL_PRODUCT_TAGS_STORE_NAME),[d,u]=(0,a.useState)(t||"");return(0,a.createElement)(c.Modal,{title:(0,v.__)("Create tag","woocommerce"),onRequestClose:()=>o(),className:"woocommerce-create-new-tag-modal"},(0,a.createElement)("div",{className:"woocommerce-create-new-tag-modal__wrapper"},(0,a.createElement)(c.TextControl,{label:(0,v.__)("Name","woocommerce"),name:"Tops",value:d,onChange:u}),(0,a.createElement)("div",{className:"woocommerce-create-new-tag-modal__buttons"},(0,a.createElement)(c.Button,{isSecondary:!0,onClick:()=>o(),disabled:i},(0,v.__)("Cancel","woocommerce")),(0,a.createElement)(c.Button,{isPrimary:!0,disabled:0===d.length||i,isBusy:i,onClick:()=>{(async()=>{(0,I.recordEvent)("product_tag_add",{source:x}),l(!0);try{const e=await s({name:d});m("getProductTags"),l(!1),r(e)}catch(e){n("error",(0,v.__)("Failed to create tag.","woocommerce")),l(!1),o()}})()}},(0,v.__)("Save","woocommerce")))))};function Vn(e){return{value:String(e.id),label:e.name}}function Hn(e){return{id:+e.value,name:e.label}}function Un(e){return e.map(Vn)}const zn=e=>{let{id:t,label:o,placeholder:r,value:n=[],onChange:l}=e;const{tagsSelectList:c,searchTags:s}=(()=>{const[e,t]=(0,a.useState)([]),[o,r]=(0,a.useState)(!0),n=e=>{r(!0);const o=void 0!==e?{search:e}:"";(0,w.resolveSelect)(b.EXPERIMENTAL_PRODUCT_TAGS_STORE_NAME).getProductTags(o).then((e=>{t(e)})).finally((()=>{r(!1)}))};return(0,a.useEffect)(n,[]),{searchTags:n,tagsSelectList:e,isSearching:o}})(),[m,d]=(0,a.useState)(""),[u,p]=(0,a.useState)(!1),[_,f]=(0,a.useState)(!1),[h,g]=(0,a.useState)(),{createProductTag:E,invalidateResolutionForStoreSelector:y}=(0,w.useDispatch)(b.EXPERIMENTAL_PRODUCT_TAGS_STORE_NAME),{createNotice:C}=(0,w.useDispatch)("core/notices"),k=e=>{d(e||""),s(e||""),g(e)},S=(0,ee.useDebounce)(k,150);return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.__experimentalSelectTreeControl,{id:t,multiple:!0,shouldNotRecursivelySelect:!0,createValue:m,label:o,isLoading:u,onInputChange:S,placeholder:0===n.length?r:"",initialInputValue:h,onCreateNew:0===m.length?()=>f(!0):async()=>{(0,I.recordEvent)("product_tag_add",{source:x}),p(!0);try{g("");const e=await E({name:m});y("getProductTags"),p(!1),l([...n,e]),k("")}catch(e){C("error",(0,v.__)("Failed to create tag.","woocommerce")),p(!1)}},shouldShowCreateButton:e=>!e||-1===c.findIndex((t=>t.name===e)),items:Un(c),selected:Un(n),onSelect:e=>{if(Array.isArray(e)){const t=e.filter((e=>{let{value:t}=e;return!n.some((e=>e.id===+t))})).map(Hn);l([...n,...t])}},onRemove:e=>{const t=Array.isArray(e)?n.filter((t=>!e.some((e=>{let{value:o}=e;return t.id===+o})))):n.filter((t=>t.id!==+e.value));l(t)}}),_&&(0,a.createElement)(Fn,{initialTagName:m,onCancel:()=>f(!1),onCreate:e=>{l([...n,e]),f(!1),k("")}}))},{name:$n}=Bn,Gn={example:{},edit:function(e){let{attributes:t,context:o}=e;const r=(0,Ke.useWooBlockProps)(t),{name:n,label:i,placeholder:l}=t,[s,m]=(0,J.useEntityProp)("postType",o.postType||"product",n||"tags"),d=(0,ee.useInstanceId)(c.BaseControl,"tag-field");return(0,a.createElement)("div",{...r},(0,a.createElement)(zn,{id:d,label:i||(0,v.__)("Tags","woocommerce"),placeholder:l||(0,v.__)("Search or create tags…","woocommerce"),onChange:m,value:s||[]}))}},Wn=()=>et({name:$n,metadata:Bn,settings:Gn}),jn=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-inventory-quantity-field","title":"Product inventory quantity available","category":"woocommerce","description":"The product available quantity.","keywords":["products","quantity","inventory"],"textdomain":"default","attributes":{"name":{"type":"string","__experimentalRole":"content"}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"usesContext":["postType"]}'),{name:qn,...Zn}=jn,Jn={example:{},edit:function(e){let{attributes:t,clientId:o,context:r}=e;const n=(0,Ke.useWooBlockProps)(t),[i]=(0,J.useEntityProp)("postType",r.postType,"manage_stock"),[l,s]=(0,J.useEntityProp)("postType",r.postType,"stock_quantity"),m=(0,ee.useInstanceId)(c.BaseControl,"product_stock_quantity"),{ref:d,error:u,validate:p}=tr(`stock_quantity-${o}`,(async function(){if(i&&l&&l<0)return(0,v.__)("Stock quantity must be a positive number.","woocommerce")}),[i,l]);return(0,a.useEffect)((()=>{i&&null===l&&s(1)}),[i,l]),(0,a.createElement)("div",{...n},(0,a.createElement)("div",{className:"wp-block-columns"},(0,a.createElement)("div",{className:"wp-block-column"},(0,a.createElement)(c.BaseControl,{id:m,className:u&&"has-error",help:null!=u?u:""},(0,a.createElement)(c.__experimentalInputControl,{id:m,name:"stock_quantity",ref:d,label:(0,v.__)("Available quantity","woocommerce"),value:l,onChange:s,onBlur:p,type:"number",min:0}))),(0,a.createElement)("div",{className:"wp-block-column"})))}};function Xn(){return et({name:qn,metadata:Zn,settings:Jn})}const Yn=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-toggle-field","title":"Product toggle control","category":"woocommerce","description":"The product toggle.","keywords":["products","radio","input"],"textdomain":"default","attributes":{"label":{"type":"string","__experimentalRole":"content"},"help":{"type":"string"},"checkedHelp":{"type":"string"},"uncheckedHelp":{"type":"string"},"property":{"type":"string"},"disabled":{"type":"boolean","default":false},"disabledCopy":{"type":"string","__experimentalRole":"content"},"checkedValue":{"type":"object"},"uncheckedValue":{"type":"object"}},"supports":{"align":false,"html":false,"multiple":true,"reusable":true,"inserter":false,"lock":false,"__experimentalToolbar":false},"usesContext":["postType"]}'),{name:Kn,...Qn}=Yn,ea={example:{},edit:function(e){let{attributes:t,context:{postType:o}}=e;var r,n,i;const l=(0,Ke.useWooBlockProps)(t),{_templateBlockId:s,label:m,property:d,disabled:u,disabledCopy:p,checkedValue:_,uncheckedValue:f}=t,[h,g]=it(d,{postType:o,fallbackValue:!1}),w=(0,J.useEntityId)("postType",o),[v]=(0,J.useEntityProp)("postType",o,"parent_id");function E(){return void 0!==_?_===h:h}let b=null;return(null==t?void 0:t.help)&&(b=(0,a.createElement)("div",{dangerouslySetInnerHTML:{__html:null===(r=St(t.help))||void 0===r?void 0:r.__html}})),(null==t?void 0:t.checkedHelp)&&E()&&(b=(0,a.createElement)("div",{dangerouslySetInnerHTML:{__html:null===(n=St(t.checkedHelp))||void 0===n?void 0:n.__html}})),(null==t?void 0:t.uncheckedHelp)&&!E()&&(b=(0,a.createElement)("div",{dangerouslySetInnerHTML:{__html:null===(i=St(t.uncheckedHelp))||void 0===i?void 0:i.__html}})),(0,a.createElement)("div",{...l},(0,a.createElement)(c.ToggleControl,{label:m,checked:E(),disabled:u,onChange:function(e){(0,I.recordEvent)("product_toggle_click",{block_id:s,source:x,product_id:v>0?v:w}),g(e?void 0!==_?_:e:void 0!==f?f:e)},help:b}),u&&(0,a.createElement)("p",{className:"wp-block-woocommerce-product-toggle__disable-copy",dangerouslySetInnerHTML:St(p)}))}};function ta(){return et({name:Kn,metadata:Qn,settings:ea})}const oa=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-attributes-field","title":"Product attributes","category":"widgets","description":"The product attributes.","keywords":["products","attributes"],"textdomain":"default","attributes":{"name":{"type":"string","__experimentalRole":"content"}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css"}'),ra=e=>{let{initialAttributeTermName:t,attributeId:o,onCancel:r=(()=>{}),onCreated:n=(()=>{})}=e;const{createNotice:l}=(0,w.useDispatch)("core/notices"),[s,m]=(0,a.useState)(!1),{createProductAttributeTerm:d,invalidateResolutionForStoreSelector:u}=(0,w.useDispatch)(b.EXPERIMENTAL_PRODUCT_ATTRIBUTE_TERMS_STORE_NAME);return(0,a.createElement)(c.Modal,{title:(0,v.__)("Create attribute","woocommerce"),onRequestClose:e=>{e.stopPropagation(),r()},className:"woocommerce-create-attribute-term-modal"},(0,a.createElement)(i.Form,{initialValues:{name:t,slug:(0,E.cleanForSlug)(t)},validate:function(e){var t;const o={};return(null===(t=e.name)||void 0===t?void 0:t.length)||(o.name=(0,v.__)("The attribute term name is required.","woocommerce")),o},errors:{},onSubmit:async e=>{(0,I.recordEvent)("product_attribute_term_add",{source:x}),m(!0);try{const t=await d({...e,attribute_id:o});(0,I.recordEvent)("product_attribute_term_add_success",{source:x}),u("getProductAttributes"),m(!1),n(t)}catch(e){(0,I.recordEvent)("product_attribute_term_add_failed",{source:x}),l("error",(0,v.__)("Failed to create attribute term.","woocommerce")),m(!1),r()}}},(e=>{let{getInputProps:t,handleSubmit:o,isValidForm:n,setValue:i,values:l}=e;const m=t("name");return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(c.TextControl,{label:(0,v.__)("Name","woocommerce"),...m,onBlur:()=>{m.onBlur(),i("slug",(0,E.cleanForSlug)(l.name))}}),(0,a.createElement)(c.TextControl,{label:(0,v.__)("Slug","woocommerce"),...t("slug"),help:(0,v.__)("The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.","woocommerce")}),(0,a.createElement)(c.TextareaControl,{label:(0,v.__)("Description","woocommerce"),...t("description")}),(0,a.createElement)("div",{className:"woocommerce-create-attribute-term-modal__buttons"},(0,a.createElement)(c.Button,{isSecondary:!0,label:(0,v.__)("Cancel","woocommerce"),onClick:()=>r()},(0,v.__)("Cancel","woocommerce")),(0,a.createElement)(c.Button,{isPrimary:!0,isBusy:s,label:(0,v.__)("Add attribute","woocommerce"),disabled:!n||s,onClick:o},(0,v.__)("Add","woocommerce"))))})))};let na=0;const aa=e=>{let{value:t=[],onChange:o,placeholder:r,disabled:n,attributeId:l,label:s="",autoCreateOnSelect:m=!0,readOnlyWhenClosed:d=!1}=e;const u=(0,a.useRef)("woocommerce-attribute-term-field-"+ ++na),[p,_]=(0,a.useState)([]),[f,h]=(0,a.useState)(!1),[g,y]=(0,a.useState)(!1),[C,k]=(0,a.useState)(),{createNotice:S}=(0,w.useDispatch)("core/notices"),{createProductAttributeTerm:N,invalidateResolutionForStoreSelector:T}=(0,w.useDispatch)(b.EXPERIMENTAL_PRODUCT_ATTRIBUTE_TERMS_STORE_NAME),P=(0,a.useCallback)((e=>(h(!0),(0,w.resolveSelect)(b.EXPERIMENTAL_PRODUCT_ATTRIBUTE_TERMS_STORE_NAME).getProductAttributeTerms({search:e||"",attribute_id:l}).then((e=>(_(e),h(!1),e)),(e=>(h(!1),e))))),[l]),A=(0,ee.useDebounce)(P,250);(0,a.useEffect)((()=>{n||void 0===l||p.length||P()}),[n,l]);const M=e=>{o(t.filter((t=>t.slug!==e.slug)))},R=()=>{const e=document.querySelector("."+u.current+" .woocommerce-experimental-select-control__input");e&&setTimeout((()=>{e.focus()}),0)},L=e=>{-99!==e.id?t.find((t=>t.slug===e.slug))?M(e):o([...t,e]):m?((async e=>{(0,I.recordEvent)("product_attribute_term_add",{source:x}),y(!0);try{const r=await N({...e,attribute_id:l});(0,I.recordEvent)("product_attribute_term_add_success",{source:x}),o([...t,r]),T("getProductAttributes"),T("getProductAttributeTerms"),y(!1)}catch(e){let t={source:x,code:"Unknown error.",message:"An unknown error occurred."},o=(0,v.__)("Failed to create attribute term.","woocommerce");const r=e;(null==r?void 0:r.code)&&(null==r?void 0:r.message)&&(t={...t,code:r.code,message:r.message},"term_exists"===r.code&&(o=(0,v.__)("Attribute term already exists.","woocommerce"))),(0,I.recordEvent)("product_attribute_term_add_failed",t),S("error",o),y(!1)}})({name:e.name,slug:(0,E.cleanForSlug)(e.name)}),R()):k(e.name)},O=(t||[]).map((e=>e.slug));return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.__experimentalSelectControl,{items:p,multiple:!0,disabled:n||!l,label:s,getFilteredItems:(e,t)=>t.length>0&&!e.find((e=>e.name.toLowerCase()===t.toLowerCase()))?[...e,{id:-99,name:t}]:e,onInputChange:A,placeholder:r||"",getItemLabel:e=>(null==e?void 0:e.name)||"",getItemValue:e=>(null==e?void 0:e.slug)||"",stateReducer:(e,t)=>{const{changes:o,type:r}=t;switch(r){case i.selectControlStateChangeTypes.ControlledPropUpdatedSelectedItem:const t=g?{isOpen:g}:{};return{...o,...t,inputValue:e.inputValue};case i.selectControlStateChangeTypes.ItemClick:return o.selectedItem&&-99===o.selectedItem.id?o:{...o,isOpen:!0,inputValue:e.inputValue,highlightedIndex:e.highlightedIndex};default:return o}},selected:t,onSelect:L,onRemove:M,readOnlyWhenClosed:d,className:"woocommerce-attribute-term-field "+u.current,__experimentalOpenMenuOnFocus:!0},(e=>{let{items:t,highlightedIndex:o,getItemProps:r,getMenuProps:n,isOpen:l}=e;return(0,a.createElement)(i.__experimentalSelectControlMenu,{isOpen:l,getMenuProps:n},[f||g?(0,a.createElement)("div",{key:"loading-spinner",className:"woocommerce-attribute-term-field__loading-spinner"},(0,a.createElement)(c.Spinner,null)):null,...t.map(((e,t)=>{const n=O.includes(e.slug);return(0,a.createElement)(i.__experimentalSelectControlMenuItem,{key:`${e.slug}`,index:t,isActive:o===t,item:e,getItemProps:r},-99!==e.id?(0,a.createElement)(c.CheckboxControl,{onChange:()=>null,checked:n,label:(0,a.createElement)("span",null,e.name)}):(0,a.createElement)("div",{className:"woocommerce-attribute-term-field__add-new"},(0,a.createElement)(c.Icon,{icon:Rt,size:20,className:"woocommerce-attribute-term-field__add-new-icon"}),(0,a.createElement)("span",null,(0,v.sprintf)((0,v.__)('Create "%s"',"woocommerce"),e.name))))}))].filter((e=>null!==e)))})),!m&&C&&void 0!==l&&(0,a.createElement)(ra,{initialAttributeTermName:C,onCancel:()=>{k(void 0),R()},attributeId:l,onCreated:e=>{L(e),k(void 0),T("getProductAttributeTerms"),R()}}))};function ia(e){return null!==e&&"object"==typeof e&&!!e.label}const la=e=>{let{value:t=[],onChange:o,placeholder:r,disabled:n,label:l}=e;const[s,m]=(0,a.useState)(t),d=e=>{o(t.filter((t=>t!==e)))};return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.__experimentalSelectControl,{items:s,multiple:!0,disabled:n,label:l||"",placeholder:r||"",getItemLabel:e=>ia(e)?e.label:e||"",getItemValue:e=>ia(e)?e.id:e||"",getFilteredItems:(e,t)=>{const o=e.filter((e=>!t.length||!ia(e)&&e.toLowerCase().includes(t.toLowerCase())));return t.length>0&&!o.find((e=>!ia(e)&&e.toLowerCase()===t.toLowerCase()))?[...o,{id:"is-new",label:t}]:o},selected:t,onSelect:e=>{if(ia(e))return m([...s,e.label]),void o([...t,e.label]);t.includes(e)?d(e):o([...t,e])},onRemove:d,className:"woocommerce-attribute-term-field"},(e=>{let{items:o,highlightedIndex:r,getItemProps:n,getMenuProps:l,isOpen:s}=e;return(0,a.createElement)(i.__experimentalSelectControlMenu,{isOpen:s,getMenuProps:l},o.map(((e,o)=>(0,a.createElement)(i.__experimentalSelectControlMenuItem,{key:`${ia(e)?e.id:e}`,index:o,isActive:r===o,item:e,getItemProps:n},ia(e)?(0,a.createElement)("div",{className:"woocommerce-attribute-term-field__add-new"},(0,a.createElement)(c.Icon,{icon:Rt,size:20,className:"woocommerce-attribute-term-field__add-new-icon"}),(0,a.createElement)("span",null,(0,v.sprintf)((0,v.__)('Create "%s"',"woocommerce"),e.label))):(0,a.createElement)(c.CheckboxControl,{onChange:()=>null,checked:t.includes(e),label:(0,a.createElement)("span",null," ",e," ")})))))})))};function ca(e){let{title:t="",content:o="",className:r,type:n="info",children:i,isDismissible:l=!1,handleDismiss:s=(()=>{})}=e;return(0,a.createElement)("div",{className:Q()(r,n,"woocommerce-product-notice",{"is-dismissible":l})},t&&(0,a.createElement)("h3",{className:"woocommerce-product-notice__title"},t),o&&(0,a.createElement)("p",{className:"woocommerce-product-notice__content"},o),(0,a.createElement)("div",{className:"woocommerce-product-notice__content"},i),l&&(0,a.createElement)(c.Button,{className:"woocommerce-product-notice__dismiss",icon:eo,onClick:s}))}function sa(e){return 0!==e.id?e.id:e.name}const ma=e=>`${e.id}-${e.name}`;function da(e){return"string"==typeof e?{id:0,name:e,slug:e,options:[]}:e}const ua=e=>{let{title:t=(0,v.__)("Edit attribute","woocommerce"),nameLabel:o=(0,v.__)("Name","woocommerce"),globalAttributeHelperMessage:r,customAttributeHelperMessage:n=(0,v.__)("Your customers will see this on the product page","woocommerce"),termsLabel:l=(0,v.__)("Values","woocommerce"),termsPlaceholder:s=(0,v.__)("Search or create value","woocommerce"),isDefaultLabel:m=(0,v.__)("Set default value","woocommerce"),isDefaultTooltip:d=(0,v.__)("Check to preselect the first choice when customers enter the product page.","woocommerce"),useAsFilterLabel:u=(0,v.__)("Use as filter","woocommerce"),useAsFilterTooltip:p=(0,v.__)("Check to allow customers to search and filter by this option in your store.","woocommerce"),visibleLabel:_=(0,v.__)("Show in product details","woocommerce"),visibleTooltip:f=(0,v.__)("Check to show this option and its values in the product details section on the product page.","woocommerce"),cancelAccessibleLabel:h=(0,v.__)("Cancel","woocommerce"),cancelLabel:g=(0,v.__)("Cancel","woocommerce"),updateAccessibleLabel:w=(0,v.__)("Edit attribute","woocommerce"),updateLabel:E=(0,v.__)("Update","woocommerce"),onCancel:b,onEdit:y,attribute:C,attributes:k}=e;const[S,N]=(0,a.useState)({...C}),T=0===(null==S?void 0:S.id),{additions:x,deletions:P}=(0,a.useMemo)((()=>{var e,t,o,r,n,a,i,l;if(!C.variation)return{};const c=k.filter((e=>ma(e)!==ma(C))).reduce(((e,t)=>{let{terms:o}=t;var r;return e*(null!==(r=null==o?void 0:o.length)&&void 0!==r?r:1)}),1),s=null!==(t=null===(e=C.terms)||void 0===e?void 0:e.length)&&void 0!==t?t:0,m=c*s,d=null!==(n=null===(r=null===(o=null==S?void 0:S.terms)||void 0===o?void 0:o.filter((e=>{var t;return!(null===(t=C.terms)||void 0===t?void 0:t.some((t=>t.id===e.id)))})))||void 0===r?void 0:r.length)&&void 0!==n?n:0,u=s+d||1,p=null!==(l=null===(i=null===(a=C.terms)||void 0===a?void 0:a.filter((e=>{var t;return null===(t=null==S?void 0:S.terms)||void 0===t?void 0:t.some((t=>e.id===t.id))})))||void 0===i?void 0:i.length)&&void 0!==l?l:0;return{additions:Math.abs(m-c*u),deletions:Math.abs(m-c*p)}}),[k,C,S]);return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(c.Modal,{title:t,onRequestClose:()=>b(),className:"woocommerce-edit-attribute-modal"},(0,a.createElement)("div",{className:"woocommerce-edit-attribute-modal__body"},(0,a.createElement)(c.TextControl,{label:o,disabled:!T,value:(null==S?void 0:S.name)?null==S?void 0:S.name:"",onChange:e=>N({...S,name:e})}),(0,a.createElement)("p",{className:"woocommerce-edit-attribute-modal__helper-text"},T?n:r),C.terms?(0,a.createElement)(aa,{label:l,placeholder:(null==S?void 0:S.terms)&&(null==S?void 0:S.terms.length)>0?"":s,value:null==S?void 0:S.terms,attributeId:null==S?void 0:S.id,onChange:e=>{N({...S,terms:e})}}):(0,a.createElement)(la,{label:l,placeholder:(null==S?void 0:S.options)&&(null==S?void 0:S.options.length)>0?"":s,disabled:!(null==C?void 0:C.name),value:null==S?void 0:S.options,onChange:e=>{N({...S,options:e})}}),(0,a.createElement)("div",{className:"woocommerce-edit-attribute-modal__options"},C.variation&&(0,a.createElement)("div",{className:"woocommerce-edit-attribute-modal__option-container"},(0,a.createElement)(c.CheckboxControl,{onChange:e=>N({...S,isDefault:e}),checked:null==S?void 0:S.isDefault,label:m}),(0,a.createElement)(i.__experimentalTooltip,{className:"woocommerce-edit-attribute-modal__tooltip-set-default-value",text:d})),(0,a.createElement)("div",{className:"woocommerce-edit-attribute-modal__option-container"},(0,a.createElement)(c.CheckboxControl,{onChange:e=>N({...S,visible:e}),checked:null==S?void 0:S.visible,label:_}),(0,a.createElement)(i.__experimentalTooltip,{className:"woocommerce-edit-attribute-modal__tooltip-show-in-product-details",text:f})),0!==C.id&&(0,a.createElement)("div",{className:"woocommerce-edit-attribute-modal__option-container"},(0,a.createElement)(c.CheckboxControl,{disabled:!0,onChange:()=>{},checked:!0,label:u}),(0,a.createElement)(i.__experimentalTooltip,{className:"woocommerce-edit-attribute-modal__tooltip-use-as-filter",text:p}))),Boolean(x||P)&&(0,a.createElement)(ca,null,function(){const e=(0,v.sprintf)((0,v.__)("%d variations will be added","woocommerce"),x),t=(0,v.sprintf)((0,v.__)("%d variations will be removed","woocommerce"),P);return x&&P?(0,v.sprintf)("%1$s, %2$s.",e,t):x?(0,v.sprintf)("%s.",e):(0,v.sprintf)("%s.",t)}())),(0,a.createElement)("div",{className:"woocommerce-edit-attribute-modal__buttons"},(0,a.createElement)(c.Button,{isSecondary:!0,label:h,onClick:()=>b()},g),(0,a.createElement)(c.Button,{isPrimary:!0,label:w,onClick:()=>{y(S)}},E))),(0,a.createElement)(i.__experimentalSelectControlMenuSlot,null))};function pa(e){let{width:t=24,height:o=24,...r}=e;return(0,a.createElement)("svg",{...r,width:t,height:o,viewBox:`0 0 ${t} ${o}`,fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)("g",null,(0,a.createElement)("path",{d:"M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z",fill:"#949494"}),(0,a.createElement)("rect",{x:"16.7734",y:"4",width:"1.22727",height:"16",transform:"rotate(30 16.7734 4)",fill:"#949494"}),(0,a.createElement)("rect",{x:"16",y:"3",width:"1.22727",height:"16",transform:"rotate(30 16 3)",fill:"white"})),(0,a.createElement)("defs",null,(0,a.createElement)("clipPath",{id:"clip0_4951_450432"},(0,a.createElement)("rect",{width:"24",height:"24",fill:"white"}))))}function _a(e){let{width:t=24,height:o=24,className:r,...n}=e;return(0,a.createElement)("svg",{...n,width:t,height:o,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",className:Q()(r,"woocommerce-hidden-icon")},(0,a.createElement)("path",{d:"M3.99863 13C4.66945 13.3354 4.66932 13.3357 4.66919 13.3359L4.672 13.3305C4.67523 13.3242 4.68086 13.3135 4.6889 13.2985C4.70497 13.2686 4.73062 13.2218 4.76597 13.1608C4.83672 13.0385 4.94594 12.8592 5.09443 12.6419C5.39214 12.2062 5.84338 11.624 6.45337 11.0431C7.6721 9.88241 9.49621 8.75 11.9986 8.75C14.501 8.75 16.3251 9.88241 17.5439 11.0431C18.1539 11.624 18.6051 12.2062 18.9028 12.6419C19.0513 12.8592 19.1605 13.0385 19.2313 13.1608C19.2666 13.2218 19.2923 13.2686 19.3083 13.2985C19.3164 13.3135 19.322 13.3242 19.3252 13.3305L19.3281 13.3359C19.3279 13.3357 19.3278 13.3354 19.9986 13C20.6694 12.6646 20.6693 12.6643 20.6691 12.664L20.6678 12.6614L20.6652 12.6563L20.6573 12.6408C20.6507 12.6282 20.6417 12.6108 20.63 12.5892C20.6068 12.5459 20.5734 12.4852 20.5296 12.4096C20.4422 12.2584 20.3131 12.0471 20.1413 11.7956C19.7984 11.2938 19.2809 10.626 18.5784 9.9569C17.1721 8.61759 14.9962 7.25 11.9986 7.25C9.00105 7.25 6.82516 8.61759 5.41889 9.9569C4.71638 10.626 4.19886 11.2938 3.85596 11.7956C3.68413 12.0471 3.55507 12.2584 3.46762 12.4096C3.42386 12.4852 3.39044 12.5459 3.3672 12.5892C3.35558 12.6108 3.3465 12.6282 3.33994 12.6408L3.33199 12.6563L3.32943 12.6614L3.3285 12.6632C3.32833 12.6635 3.32781 12.6646 3.99863 13ZM11.9986 16C13.9316 16 15.4986 14.433 15.4986 12.5C15.4986 10.567 13.9316 9 11.9986 9C10.0656 9 8.49863 10.567 8.49863 12.5C8.49863 14.433 10.0656 16 11.9986 16Z",fill:"#949494"}))}const fa=(0,v.__)("Visible in product details","woocommerce"),ha=(0,v.__)("Custom attribute. Customers can’t filter or search by it to find this product","woocommerce"),ga=e=>{let{attribute:t,editLabel:o=(0,v.__)("Edit","woocommerce"),removeLabel:r=(0,v.__)("Remove attribute","woocommerce"),onDragStart:n,onDragEnd:l,onEditClick:s,onRemoveClick:m}=e;return(0,a.createElement)(i.ListItem,{className:"woocommerce-attribute-list-item",onDragStart:n,onDragEnd:l},(0,a.createElement)("div",null,t.name),(0,a.createElement)("div",null,t.options.slice(0,t.options.length>3?2:3).map((e=>(0,a.createElement)(i.Tag,{key:e,label:e}))),t.options.length>3&&(0,a.createElement)(i.Tag,{label:(0,v.sprintf)((0,v.__)("+ %d more","woocommerce"),t.options.length-2)})),(0,a.createElement)("div",{className:"woocommerce-attribute-list-item__actions"},0===t.id&&(0,a.createElement)(c.Tooltip,{className:"woocommerce-attribute-list-item__actions-tooltip",position:"top center",text:ha},(0,a.createElement)("div",{className:"woocommerce-attribute-list-item__actions-icon-wrapper"},(0,a.createElement)(pa,{className:"woocommerce-attribute-list-item__actions-icon-wrapper-icon"}))),t.visible&&(0,a.createElement)(c.Tooltip,{className:"woocommerce-attribute-list-item__actions-tooltip",position:"top center",text:fa},(0,a.createElement)("div",{className:"woocommerce-attribute-list-item__actions-icon-wrapper"},(0,a.createElement)(_a,{className:"woocommerce-attribute-list-item__actions-icon-wrapper-icon"}))),"function"==typeof s&&(0,a.createElement)(c.Button,{variant:"tertiary",onClick:()=>s(t)},o),"function"==typeof m&&(0,a.createElement)(c.Button,{icon:eo,label:r,onClick:()=>m(t)})))};function wa(e){return-99===e.id}const va=e=>{let{value:t=null,onChange:o,placeholder:r,label:n,disabled:l,disabledAttributeIds:s=[],disabledAttributeMessage:m,ignoredAttributeIds:d=[],createNewAttributesAsGlobal:u=!1}=e;const{createErrorNotice:p}=(0,w.useDispatch)("core/notices"),{createProductAttribute:_,invalidateResolution:f}=(0,w.useDispatch)(b.EXPERIMENTAL_PRODUCT_ATTRIBUTES_STORE_NAME),{attributes:h,isLoading:g}=(0,w.useSelect)((e=>{const{getProductAttributes:t,hasFinishedResolution:o}=e(b.EXPERIMENTAL_PRODUCT_ATTRIBUTES_STORE_NAME);return{isLoading:!o("getProductAttributes"),attributes:t()}})),E=(0,a.useMemo)((function(){var e;return null!==(e=null==h?void 0:h.map((e=>({...e,isDisabled:s.includes(e.id)}))))&&void 0!==e?e:[]}),[h,s]);return(0,a.createElement)(i.__experimentalSelectControl,{className:"woocommerce-attribute-input-field",items:E||[],label:n||"",disabled:l,getFilteredItems:(e,t)=>{const o=e.filter((e=>(e=>!d.length||!d.includes(e.id))(e)&&(e.name||"").toLowerCase().startsWith(t.toLowerCase())));return t.length>0&&(u||!e.find((e=>e.name.toLowerCase()===t.toLowerCase())))?[...o,{id:-99,name:t}]:o},placeholder:r,getItemLabel:e=>(null==e?void 0:e.name)||"",getItemValue:e=>(null==e?void 0:e.id)||"",selected:t,onSelect:e=>{wa(e)?(e=>{(0,I.recordEvent)("product_attribute_add_custom_attribute",{source:x}),u?_({name:e.name,generate_slug:!0}).then((e=>{f("getProductAttributes"),o({...e,options:[]})}),(e=>{let t=(0,v.__)("Failed to create new attribute.","woocommerce");"woocommerce_rest_cannot_create"===e.code&&(t=e.message),p(t,{explicitDismiss:!0})})):o(e.name)})(e):o({id:e.id,name:e.name,slug:e.slug,options:[]})},onRemove:()=>o(),__experimentalOpenMenuOnFocus:!0},(e=>{let{items:t,highlightedIndex:o,getItemProps:r,getMenuProps:n,isOpen:l}=e;return(0,a.createElement)(i.__experimentalSelectControlMenu,{getMenuProps:n,isOpen:l},g?(0,a.createElement)(c.Spinner,null):t.map(((e,t)=>{return(0,a.createElement)(i.__experimentalSelectControlMenuItem,{key:e.id,index:t,isActive:o===t,item:e,getItemProps:t=>({...r(t),disabled:e.isDisabled||void 0}),tooltipText:e.isDisabled?m:(n=e.slug,n&&n.startsWith("pa_")?n.substring(3):"")},wa(e)?(0,a.createElement)("div",{className:"woocommerce-attribute-input-field__add-new"},(0,a.createElement)(c.Icon,{icon:Rt,size:20,className:"woocommerce-attribute-input-field__add-new-icon"}),(0,a.createElement)("span",null,(0,v.sprintf)((0,v.__)('Create "%s"',"woocommerce"),e.name))):e.name);var n})))}))},Ea=e=>{let{title:t=(0,v.__)("Add attributes","woocommerce"),description:o="",notice:r,attributeLabel:n=(0,v.__)("Attribute","woocommerce"),valueLabel:l=(0,v.__)("Values","woocommerce"),attributePlaceholder:s=(0,v.__)("Search or create attribute","woocommerce"),termPlaceholder:m=(0,v.__)("Search or create value","woocommerce"),removeLabel:d=(0,v.__)("Remove attribute","woocommerce"),addAnotherAccessibleLabel:u=(0,v.__)("Add another attribute","woocommerce"),addAnotherLabel:p=(0,v.__)("+ Add another","woocommerce"),cancelLabel:_=(0,v.__)("Cancel","woocommerce"),addAccessibleLabel:f=(0,v.__)("Add attributes","woocommerce"),addLabel:h=(0,v.__)("Add","woocommerce"),onCancel:g,onAdd:E,onAddAnother:y=(()=>{}),onRemoveItem:C=(()=>{}),selectedAttributeIds:k=[],createNewAttributesAsGlobal:S=!1,disabledAttributeIds:N=[],disabledAttributeMessage:T=(0,v.__)("Already used in Attributes","woocommerce"),termsAutoSelection:x,defaultVisibility:P=!1}=e;const A=e=>{return(e=>0!==e.id)(e)?(t=e.terms)?t.map((e=>e.name)):[]:e.options;var t},I=e=>void 0!==e.visible?e.visible:P,M=e=>{setTimeout((()=>{const t=document.querySelector(".woocommerce-new-attribute-modal__table-row-"+e+" .woocommerce-new-attribute-modal__table-attribute-value-column .woocommerce-experimental-select-control__input");t&&t.focus()}),0)};return(0,a.useEffect)((function(){const e=document.querySelector(".woocommerce-new-attribute-modal__table-row .woocommerce-attribute-input-field label"),t=setTimeout((()=>{null==e||e.focus()}),100);return()=>clearTimeout(t)}),[]),(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.Form,{initialValues:{attributes:[null]}},(e=>{let{values:i,setValue:v}=e;function P(e){return function(t){x&&t&&"string"!=typeof t?(0,w.resolveSelect)(b.EXPERIMENTAL_PRODUCT_ATTRIBUTE_TERMS_STORE_NAME).getProductAttributeTerms({search:"",attribute_id:t.id}).then((o=>{const r=da(t);"all"===x?r.terms=o:o.length>0&&(r.terms=[o[0]]),v("attributes["+e+"]",{...r}),M(e)})):(v("attributes["+e+"]",t&&da(t)),t&&M(e))}}return(0,a.createElement)(c.Modal,{title:t,onRequestClose:e=>{e.isPropagationStopped()||g()},className:"woocommerce-new-attribute-modal"},r&&(0,a.createElement)(c.Notice,{isDismissible:!1},(0,a.createElement)("p",null,r)),o&&(0,a.createElement)("p",null,o),(0,a.createElement)("div",{className:"woocommerce-new-attribute-modal__body"},(0,a.createElement)("table",{className:"woocommerce-new-attribute-modal__table"},(0,a.createElement)("thead",null,(0,a.createElement)("tr",{className:"woocommerce-new-attribute-modal__table-header"},(0,a.createElement)("th",null,n),(0,a.createElement)("th",null,l))),(0,a.createElement)("tbody",null,i.attributes.map(((e,t)=>(0,a.createElement)("tr",{key:t,className:`woocommerce-new-attribute-modal__table-row woocommerce-new-attribute-modal__table-row-${t}`},(0,a.createElement)("td",{className:"woocommerce-new-attribute-modal__table-attribute-column"},(0,a.createElement)(va,{placeholder:s,value:e,label:n,onChange:P(t),ignoredAttributeIds:[...k,...i.attributes.map((e=>null==e?void 0:e.id)).filter((e=>void 0!==e))],createNewAttributesAsGlobal:S,disabledAttributeIds:N,disabledAttributeMessage:T})),(0,a.createElement)("td",{className:"woocommerce-new-attribute-modal__table-attribute-value-column"},e&&0===e.id?(0,a.createElement)(la,{placeholder:(null==e?void 0:e.options)&&(null==e?void 0:e.options.length)>0?"":m,disabled:!e.name,value:e.options,label:l,onChange:e=>v("attributes["+t+"].options",e)}):(0,a.createElement)(aa,{placeholder:(null==e?void 0:e.terms)&&(null==e?void 0:e.terms.length)>0?"":m,disabled:!e||!e.id,attributeId:e?e.id:void 0,value:null==e?[]:e.terms,label:l,onChange:e=>v("attributes["+t+"].terms",e)})),(0,a.createElement)("td",{className:"woocommerce-new-attribute-modal__table-attribute-trash-column"},(0,a.createElement)(c.Button,{icon:eo,disabled:1===i.attributes.length&&null===i.attributes[0],label:d,onClick:()=>((e,t,o)=>{C(),t.attributes.length>1?o("attributes",t.attributes.filter(((t,o)=>o!==e))):o(`attributes[${e}]`,[null])})(t,i,v)})))))))),(0,a.createElement)("div",null,(0,a.createElement)(c.Button,{className:"woocommerce-new-attribute-modal__add-attribute",variant:"tertiary",label:u,onClick:()=>{((e,t)=>{var o;t("attributes",[...e.attributes,null]),o=e.attributes.length,setTimeout((()=>{const e=document.querySelector(`.woocommerce-new-attribute-modal__table-row-${o}`);null==e||e.scrollIntoView({behavior:"smooth"})}),0),y()})(i,v)}},p)),(0,a.createElement)("div",{className:"woocommerce-new-attribute-modal__buttons"},(0,a.createElement)(c.Button,{isSecondary:!0,label:_,onClick:()=>g()},_),(0,a.createElement)(c.Button,{isPrimary:!0,label:f,disabled:1===i.attributes.length&&(null===i.attributes[0]||void 0===i.attributes[0]),onClick:()=>(e=>{const t=[];e.attributes.forEach((e=>{var o;null!==(o=e)&&o.name.length>0&&(e=>e.terms&&e.terms.length>0||e.options&&e.options.length>0)(o)&&t.push({...e,visible:I(e),options:A(e)})})),E(t)})(i)},h)))})),(0,a.createElement)(i.__experimentalSelectControlMenuSlot,null))};function ba(e){let{title:t,description:o,onCancel:r,onRemove:n}=e;const[i,l]=(0,a.useState)(!1);return(0,a.createElement)(c.Modal,{title:t,onRequestClose:e=>{!e.isPropagationStopped()&&r&&r()},className:"woocommerce-remove-confirmation-modal"},(0,a.createElement)("div",{className:"woocommerce-remove-confirmation-modal__content"},o),(0,a.createElement)("div",{className:"woocommerce-remove-confirmation-modal__buttons"},(0,a.createElement)(c.Button,{isDestructive:!0,variant:"primary",isBusy:i,onClick:async function(){try{l(!0),await n()}finally{l(!1)}}},(0,v.__)("Delete","woocommerce")),(0,a.createElement)(c.Button,{variant:"tertiary",onClick:r},(0,v.__)("Cancel","woocommerce"))))}function ya(){return(0,a.createElement)("div",{className:"woocommerce-product-page-attribute-skeleton"},Array(3).fill(0).map(((e,t)=>(0,a.createElement)("div",{key:t,className:"woocommerce-product-page-attribute-skeleton__row"},(0,a.createElement)("div",{className:Q()("woocommerce-product-page-attribute-skeleton__item")},(0,a.createElement)("div",{className:Q()(`woocommerce-product-page-attribute-skeleton__name${t}`,`woocommerce-product-page-attribute-skeleton__row${t}`)})),(0,a.createElement)("div",{className:"woocommerce-product-page-attribute-skeleton__item"},(0,a.createElement)("div",{className:Q()(`woocommerce-product-page-attribute-skeleton__value${t}`,`woocommerce-product-page-attribute-skeleton__row${t}`)})),(0,a.createElement)("div",{className:"woocommerce-product-page-attribute-skeleton__last-item"},(0,a.createElement)("div",{className:Q()("woocommerce-product-page-attribute-skeleton__buttons",`woocommerce-product-page-attribute-skeleton__row${t}`)}))))))}const Ca=e=>{let{value:t,onAdd:o=(()=>{}),onAddAnother:r=(()=>{}),onRemoveItem:n=(()=>{}),onChange:l,onEdit:s=(()=>{}),onNewModalCancel:m=(()=>{}),onNewModalClose:d=(()=>{}),onNewModalOpen:u=(()=>{}),onEditModalCancel:p=(()=>{}),onEditModalClose:_=(()=>{}),onEditModalOpen:f=(()=>{}),onRemove:h=(()=>{}),onRemoveCancel:g=(()=>{}),onNoticeDismiss:w=(()=>{}),uiStrings:E,createNewAttributesAsGlobal:b=!1,useRemoveConfirmationModal:y=!1,disabledAttributeIds:C=[],termsAutoSelection:k,defaultVisibility:S=!1}=e;E={newAttributeListItemLabel:(0,v.__)("Add new","woocommerce"),globalAttributeHelperMessage:(0,v.__)("You can change the attribute's name in <link>Attributes</link>.","woocommerce"),attributeRemoveConfirmationMessage:(0,v.__)("Remove this attribute?","woocommerce"),...E};const[N,T]=(0,a.useState)(!1),[P,A]=(0,a.useState)(),[M,R]=(0,a.useState)(null),L=e=>{l(e.map((e=>({...e,options:e.terms?e.terms.map((e=>e.name)):e.options,terms:void 0,visible:e.visible||!1}))))},O=e=>{L(t.filter((t=>ma(t)!==ma(e)))),h(e),A(null)},D=()=>{T(!1),d()},B=e=>{R(null),_(e)},F=t.sort(((e,t)=>e.position-t.position)),V=t.reduce(((e,t)=>(e[sa(t)]=t,e)),{}),H=t.find((e=>ma(e)===M)),U=(0,ee.useViewportMatch)("medium","<");return(0,a.createElement)("div",{className:"woocommerce-attribute-field"},(0,a.createElement)(c.Button,{variant:"secondary",className:"woocommerce-add-attribute-list-item__add-button",onClick:()=>{T(!0),u()}},E.newAttributeListItemLabel),E.notice&&(0,a.createElement)(c.Notice,{isDismissible:!0,status:"warning",className:"woocommerce-attribute-field__notice",onRemove:w},(0,a.createElement)("p",null,E.notice)),Boolean(t.length)&&(0,a.createElement)(i.Sortable,{onOrderChange:e=>{const t=e.reduce(((e,t,o)=>{let{props:r}=t;return e[sa(r.attribute)]=o,e}),{});l(function(e,t){return Object.keys(t).map((o=>isNaN(e[o])?{...t[o]}:{...t[o],position:e[o]}))}(t,V))}},F.map((e=>(0,a.createElement)(ga,{attribute:e,removeLabel:null==E?void 0:E.attributeRemoveLabel,key:ma(e),onEditClick:()=>{return t=e,(0,I.recordEvent)("product_options_edit",{source:x,attribute:t.name}),R(ma(t)),void f(t);var t},onRemoveClick:()=>{return t=e,void(y?A(t):window.confirm(null==E?void 0:E.attributeRemoveConfirmationMessage)?O(t):g(t));var t}})))),N&&(0,a.createElement)(Ea,{title:E.newAttributeModalTitle,description:E.newAttributeModalDescription,onCancel:()=>{D(),m()},onAdd:e=>{const r=e.filter((e=>!t.some((t=>ma(e)===ma(t)))));L([...t,...r]),o(e),D()},onAddAnother:r,onRemoveItem:n,selectedAttributeIds:t.map((e=>e.id)),createNewAttributesAsGlobal:b,disabledAttributeIds:C,disabledAttributeMessage:E.disabledAttributeMessage,termsAutoSelection:k,defaultVisibility:S}),(0,a.createElement)(i.__experimentalSelectControlMenuSlot,null),H&&(0,a.createElement)(ua,{title:(0,v.sprintf)((0,v.__)("Edit %s","woocommerce"),H.name),customAttributeHelperMessage:E.customAttributeHelperMessage,globalAttributeHelperMessage:E.globalAttributeHelperMessage?(0,a.createInterpolateElement)(E.globalAttributeHelperMessage,{link:(0,a.createElement)(i.Link,{href:(0,er.getAdminLink)("edit.php?post_type=product&page=product_attributes"),target:"_blank",type:"wp-admin"},(0,a.createElement)(a.Fragment,null))}):void 0,onCancel:()=>{B(H),p(H)},onEdit:e=>{(e=>{var o;(0,I.recordEvent)("product_options_update",{source:x,attribute:e.name,values:null===(o=e.terms)||void 0===o?void 0:o.map((e=>e.name)),default:e.isDefault,visible:e.visible,filter:!0});const r=t.map((t=>ma(t)===ma(e)?e:t));s(e),L(r),B(e)})(e)},attribute:H,attributes:t}),P&&(0,a.createElement)(ba,{title:(0,v.sprintf)((0,v.__)("Delete %(attributeName)s","woocommerce"),{attributeName:P.name}),description:(0,a.createElement)("p",null,E.attributeRemoveConfirmationModalMessage),onRemove:()=>O(P),onCancel:()=>{g(P),A(null)}}),!U&&0===t.length&&(0,a.createElement)(ya,null))},ka=(e,t)=>e.reduce(((e,o)=>(e[t(o)?0:1].push(o),e)),[[],[]]),Sa=(e,t)=>t?e.filter((e=>!!e.variation)):e.filter((e=>!e.variation));function Na(e){let{allAttributes:t=[],isVariationAttributes:o=!1,onChange:r,productId:n}=e;const[i,l]=(0,a.useState)(Sa(t,o)),c=(0,a.useCallback)((e=>(0,w.resolveSelect)(b.EXPERIMENTAL_PRODUCT_ATTRIBUTE_TERMS_STORE_NAME).getProductAttributeTerms({attribute_id:e}).then((e=>e),(e=>e))),[n]),s=(e,t,o)=>e.map(((e,r)=>{let{isDefault:n,terms:a,...i}=e;return{...i,variation:t,position:o+r}}));return(0,a.useEffect)((()=>{const[e,r]=ka(Sa(t,o),(e=>0===e.id));Promise.all(r.map((e=>c(e.id)))).then((t=>{l([...r.map(((e,o)=>{return r=e,n=t[o],{...r,terms:(n||[]).filter((e=>r.options.includes(e.name)))};var r,n})),...e])}))}),[t,o,c]),{attributes:i,handleChange:e=>{const n=e.reduce(((e,t)=>void 0===t.isDefault||!0===t.isDefault?[...e,{id:t.id,name:t.name,option:t.options[0]}]:e),[]);let a=o?t.filter((e=>!e.variation)):t.filter((e=>!!e.variation));a=a.filter((t=>!(t.id>0&&e.some((e=>e.id===t.id))||0===t.id&&e.some((e=>e.name.toLowerCase()===t.name.toLowerCase())))));const i=s(e,o,o?a.length:0),l=s(a,!o,o?0:e.length);r(o?[...l,...i]:[...i,...l],n)},setAttributes:l}}const Ta=e=>{let{value:t,onChange:o,productId:r}=e;const{attributes:n,handleChange:i}=Na({allAttributes:t,onChange:o,productId:r});return(0,a.createElement)(Ca,{value:n,disabledAttributeIds:t.filter((e=>!!e.variation)).map((e=>e.id)),uiStrings:{disabledAttributeMessage:(0,v.__)("Already used in Variations","woocommerce")},onAdd:()=>{(0,I.recordEvent)("product_add_attributes_modal_add_button_click")},onChange:i,onNewModalCancel:()=>{(0,I.recordEvent)("product_add_attributes_modal_cancel_button_click")},onNewModalOpen:()=>{n.length?(0,I.recordEvent)("product_add_attribute_button"):(0,I.recordEvent)("product_add_first_attribute_button_click")},onAddAnother:()=>{(0,I.recordEvent)("product_add_attributes_modal_add_another_attribute_button_click")},onRemoveItem:()=>{(0,I.recordEvent)("product_add_attributes_modal_remove_attribute_button_click")},onRemove:()=>(0,I.recordEvent)("product_remove_attribute_confirmation_confirm_click"),onRemoveCancel:()=>(0,I.recordEvent)("product_remove_attribute_confirmation_cancel_click"),termsAutoSelection:"first",defaultVisibility:!0})},{name:xa}=oa,Pa={example:{},edit:function(e){let{attributes:t}=e;const[o,r]=(0,J.useEntityProp)("postType","product","attributes"),n=(0,J.useEntityId)("postType","product"),i=(0,Ke.useWooBlockProps)(t);return(0,a.createElement)("div",{...i},(0,a.createElement)(Ta,{productId:n,value:o,onChange:r}))}},Aa=()=>et({name:xa,metadata:oa,settings:Pa}),Ia=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-variations-fields","title":"Product variations fields","category":"woocommerce","description":"The product variations.","keywords":["products","variations"],"textdomain":"default","attributes":{"description":{"type":"string","__experimentalRole":"content"}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css"}');function Ma(e){const t=(0,ee.useInstanceId)(c.G,"clip");return(0,a.createElement)(c.SVG,{width:"264",height:"167",...e,viewBox:"0 0 264 167",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(c.G,{clipPath:`url(#${t})`},(0,a.createElement)(c.Path,{d:"M38.5556 0.164185C11.3783 0.164185 -3.89877 21.4091 1.5234 37.3916C7.43365 54.8517 25.6968 71.9169 25.6968 85.7696H51.4188C51.4188 71.908 69.6821 54.8517 75.5923 37.3916C81.0145 21.4091 65.7463 0.164185 38.5556 0.164185Z",fill:"#F0F0F0"}),(0,a.createElement)(c.Path,{d:"M50.5063 48.3114C44.2189 48.3114 40.5228 52.5755 40.5228 59.1735V59.9899C40.079 59.9899 39.6176 59.9899 39.1827 59.9944H38.3486C37.7141 59.9944 37.3325 59.9944 36.5915 59.9944V59.1779C36.5915 52.5755 32.8953 48.3114 26.6124 48.3114C21.0127 48.3114 17.8047 50.4812 17.8047 54.2616C17.8047 57.0969 20.4936 59.0137 25.7915 59.9589C29.0306 60.5357 32.1721 60.6777 35.2781 60.7087V85.7652H36.6003V60.7176C37.3413 60.722 37.7185 60.722 38.3574 60.7176C38.9919 60.7176 39.7906 60.7176 40.5316 60.7176V85.7652H41.8539V60.7132C44.9554 60.6777 48.0969 60.5401 51.3405 59.9633C56.6384 59.0182 59.3273 57.1013 59.3273 54.266C59.3273 50.4856 56.1192 48.3158 50.5196 48.3158L50.5063 48.3114ZM35.2781 59.9855C32.2032 59.95 29.106 59.8124 25.9202 59.2445C21.0172 58.3704 19.6905 56.2938 19.6905 54.1329C19.6905 50.2682 23.5996 49.0347 26.6124 49.0347C32.2342 49.0347 35.2781 53.0148 35.2781 59.169V59.981V59.9855ZM51.1985 59.2445C48.0126 59.8124 44.9155 59.9544 41.845 59.9855V59.1735C41.845 53.0148 44.8889 49.0391 50.5107 49.0391C53.528 49.0391 57.4326 50.2726 57.4326 54.1373C57.4326 56.2982 56.1015 58.3704 51.2029 59.2489L51.1985 59.2445Z",fill:"white"}),(0,a.createElement)(c.Path,{d:"M38.5585 101.872C45.5248 101.872 51.4173 96.1613 51.4173 89.834H25.6953C25.6953 96.1613 31.5923 101.872 38.5585 101.872Z",fill:"#E0E0E0"}),(0,a.createElement)(c.Path,{d:"M57.2858 89.9271H19.832V85.7695H57.2858V89.9271Z",fill:"#E0E0E0"}),(0,a.createElement)(c.Path,{d:"M69.5768 106.602H7.63895L0.4375 167L15.2974 151.328H64.2566L69.5768 106.602Z",fill:"#E0E0E0"}),(0,a.createElement)(c.Path,{d:"M119.436 122.749C113.97 115.072 110.828 111.394 104.652 111.394C97.8809 111.394 94.908 119.061 98.9724 123.853C103.445 129.125 118.993 134.627 118.993 134.627C118.993 134.627 94.0694 129.923 84.9112 129.923C79.8573 129.923 74.6836 131.96 74.6836 139.135C74.6836 146.31 79.8617 148.346 84.9112 148.346C94.0694 148.346 118.993 143.643 118.993 143.643C118.993 143.643 103.445 149.145 98.9724 154.416C94.908 159.208 97.8764 166.876 104.652 166.876C110.828 166.876 113.97 163.197 119.436 155.521C121.287 152.921 130.707 139.135 130.707 139.135C130.707 139.135 121.287 125.349 119.436 122.749Z",fill:"#E0E0E0"}),(0,a.createElement)(c.Path,{d:"M94.2838 102.671L169.715 102.671V80.4849L94.2838 80.4849V102.671Z",fill:"#F0F0F0"}),(0,a.createElement)(c.Path,{d:"M169.712 0H94.2812V75.4311H169.712V0Z",fill:"#E0E0E0"}),(0,a.createElement)(c.Path,{d:"M147.619 49.6336C147.619 44.4156 144.429 39.4194 138.168 36.0116H157.66L139.472 6.00781H124.524L106.336 36.0116H125.828C119.567 39.4194 116.377 44.4156 116.377 49.6336C116.377 55.5394 121.005 61.4985 127.106 64.6888C118.667 62.9849 117.344 69.4232 117.344 69.4232H146.661C146.661 69.4232 145.338 62.9849 136.899 64.6888C143 61.4985 147.628 55.5394 147.628 49.6336H147.619Z",fill:"white"}),(0,a.createElement)(c.Path,{d:"M147.86 80.7911H94.2812V85.2283H147.86V80.7911Z",fill:"#E0E0E0"}),(0,a.createElement)(c.Path,{d:"M169.712 89.8473H94.2812V94.2844H169.712V89.8473Z",fill:"#E0E0E0"}),(0,a.createElement)(c.Path,{d:"M136.82 98.9034H94.2812V103.341H136.82V98.9034Z",fill:"#E0E0E0"}),(0,a.createElement)(c.Path,{d:"M219.52 167C229.042 167 235.063 158.538 235.063 151.457H203.977C203.977 158.538 209.998 167 219.52 167Z",fill:"#DDDDDD"}),(0,a.createElement)(c.Path,{d:"M219.516 58.2018C185.027 58.2018 168.143 86.1557 178.522 110.613C185.541 127.141 202.225 125.264 202.225 138.505H236.826C236.826 125.264 253.514 127.141 260.529 110.613C270.903 86.1557 254.006 58.2018 219.516 58.2018Z",fill:"#F0F0F0"}),(0,a.createElement)(c.Path,{d:"M219.52 167C228.9 167 234.882 158.787 235.059 151.776C235.059 151.67 235.059 142.707 235.059 142.6H203.973C203.973 142.685 203.973 151.63 203.973 151.719C204.115 158.742 210.105 167.004 219.511 167.004L219.52 167Z",fill:"#E0E0E0"}),(0,a.createElement)(c.Path,{d:"M240.248 142.596H198.801V138.505H240.248V142.596Z",fill:"#E0E0E0"}),(0,a.createElement)(c.Path,{d:"M240.248 149.074H198.801V144.983H240.248V149.074Z",fill:"#E0E0E0"}),(0,a.createElement)(c.Path,{d:"M169.656 125.371H142.133V152.894H169.656V125.371Z",fill:"#F0F0F0"}),(0,a.createElement)(c.Path,{d:"M155.015 146.194L162.181 139.587L147.445 139.663V138.571L162.154 138.647L155.015 132.067L155.676 131.228L163.982 139.055V139.184L155.676 147.033L155.015 146.194Z",fill:"#DDDDDD"}),(0,a.createElement)(c.Path,{d:"M22.0977 126.533L27.44 141.921L53.5835 112.729",stroke:"white",strokeMiterlimit:"10"}),(0,a.createElement)(c.Path,{d:"M232.227 110.138C232.227 102.307 227.559 97.4392 220.042 97.4126C220.042 97.4126 220.025 97.4126 220.016 97.4126C220.007 97.4126 219.998 97.4126 219.989 97.4126C212.473 97.4392 207.805 102.928 207.805 110.138C207.805 117.349 212.22 120.774 218.516 125.287C214.704 128.858 212.663 134.516 212.663 138.505H215.867C215.867 134.809 216.572 129.56 220.016 126.462C223.463 129.56 224.164 134.809 224.164 138.505H227.368C227.368 134.516 225.322 128.858 221.515 125.287C227.812 120.778 232.227 116.958 232.227 110.138ZM220.016 124.435C213.773 119.989 209.242 117.158 209.242 110.138C209.242 103.119 213.546 98.7216 220.016 98.7082C226.485 98.7216 230.789 103.354 230.789 110.138C230.789 116.222 226.259 119.989 220.016 124.435Z",fill:"#E0E0E0"}),(0,a.createElement)(c.Path,{d:"M250.84 40.1516C250.84 45.9864 246.155 50.7297 240.342 50.8184H199.862C193.97 50.8184 189.195 46.0441 189.195 40.1516C189.195 34.2591 193.97 29.4847 199.862 29.4847H240.36C246.164 29.4847 250.84 34.3256 250.84 40.1516Z",fill:"#F0F0F0"}),(0,a.createElement)(c.Path,{d:"M240.122 47.7347C244.31 47.7347 247.705 44.3396 247.705 40.1516C247.705 35.9636 244.31 32.5686 240.122 32.5686C235.934 32.5686 232.539 35.9636 232.539 40.1516C232.539 44.3396 235.934 47.7347 240.122 47.7347Z",fill:"#E0E0E0"}),(0,a.createElement)(c.Path,{d:"M131.996 6.00781H124.524L106.332 36.0116H125.824H138.168H157.661L139.468 6.00781H131.996Z",fill:"#F0F0F0"}),(0,a.createElement)(c.Path,{d:"M151.608 26.0281H112.384L106.332 36.0116L151.608 26.0281Z",fill:"white"}),(0,a.createElement)(c.Path,{d:"M145.555 16.0446H118.435L112.383 26.0281L145.555 16.0446Z",fill:"white"}),(0,a.createElement)(c.Path,{d:"M139.469 6.00781H124.525L118.438 16.0446L139.469 6.00781Z",fill:"white"}),(0,a.createElement)(c.Path,{d:"M57.4297 42.9647H87.8994",stroke:"#DDDDDD",strokeWidth:"0.71",strokeMiterlimit:"10"}),(0,a.createElement)(c.Path,{d:"M61.8945 32.1914L83.4412 53.7381",stroke:"#DDDDDD",strokeWidth:"0.71",strokeMiterlimit:"10"}),(0,a.createElement)(c.Path,{d:"M72.668 27.7321V58.2018",stroke:"#DDDDDD",strokeWidth:"0.71",strokeMiterlimit:"10"})),(0,a.createElement)("defs",null,(0,a.createElement)("clipPath",{id:t},(0,a.createElement)(c.Rect,{width:"263.121",height:"167",fill:"white",transform:"translate(0.4375)"}))))}function Ra(){const[e]=(0,J.useEntityProp)("postType","product","id"),[t,o]=(0,a.useState)(!1),{isGeneratingVariations:r,generateError:n}=(0,w.useSelect)((t=>{const{isGeneratingVariations:o,generateProductVariationsError:r}=t(b.EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME);return{isGeneratingVariations:o({product_id:e}),generateError:r({product_id:e})}}),[e]),i=(0,a.useMemo)((()=>t||Boolean(r)),[t,r]);return{generateProductVariations:(0,a.useCallback)((async function(t,r){o(!0);const{status:n,variations:a}=await(0,w.resolveSelect)("core").getEditedEntityRecord("postType","product",e),i=t.some((e=>e.variation)),l=await async function(e){var t,o;try{const{attributes:r}=await(0,w.resolveSelect)("core").getEntityRecord("postType","product",e);if(!r.some((e=>e.variation)))return{};const n=await(0,w.resolveSelect)(b.EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME).getProductVariations({product_id:e,per_page:1,has_price:!0});return n&&n.length>0&&n[0].regular_price?{regular_price:n[0].regular_price,stock_quantity:null!==(t=n[0].stock_quantity)&&void 0!==t?t:void 0,stock_status:n[0].stock_status,manage_stock:n[0].manage_stock,low_stock_amount:null!==(o=n[0].low_stock_amount)&&void 0!==o?o:void 0}:{}}catch{return{}}}(e);return await Promise.all(a.map((e=>(0,w.dispatch)("core").invalidateResolution("getEntityRecord",["postType","product_variation",e])))),await(0,w.dispatch)(b.EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME).invalidateResolutionForStore(),(0,w.dispatch)(b.EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME).generateProductVariations({product_id:e},{type:i?"variable":"simple",attributes:t,default_attributes:r},{delete:!0,default_values:l}).then((async t=>(await(0,w.dispatch)("core").invalidateResolution("getEntityRecord",["postType","product",e]),await(0,w.resolveSelect)("core").getEntityRecord("postType","product",e),await(0,w.dispatch)(b.EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME).invalidateResolutionForStore(),t))).finally((()=>{if(o(!1),"auto-draft"===n&&(0,ye.getPath)().endsWith("add-product")){const t=(0,ye.getNewPath)({},`/product/${e}`);(0,ye.navigateTo)({url:t})}}))}),[]),isGenerating:i,generateError:n}}const La=e=>!(!Array.isArray(e)||!e.length)&&e.some((e=>{let{variation:t}=e;return t})),{name:Oa,...Da}=Ia,Ba={example:{},edit:function(e){let{attributes:t}=e;const{description:o}=t,{generateProductVariations:r}=Ra(),[n,i]=(0,a.useState)(!1),[l,s]=(0,J.useEntityProp)("postType","product","attributes"),[,m]=(0,J.useEntityProp)("postType","product","default_attributes"),{attributes:d,handleChange:u}=Na({allAttributes:l,isVariationAttributes:!0,productId:(0,J.useEntityId)("postType","product"),onChange(e,t){s(e),m(t),r(e,t)}}),p=La(l),_=(0,Ke.useWooBlockProps)(t,{className:Q()({"wp-block-woocommerce-product-variations-fields--has-attributes":p})}),f=(0,ze.useInnerBlocksProps)({className:"wp-block-woocommerce-product-variations-fields__content"},{templateLock:"all"}),h=()=>{i(!1)};return(0,a.createElement)("div",{..._},(0,a.createElement)("div",{className:"wp-block-woocommerce-product-variations-fields__heading"},(0,a.createElement)("div",{className:"wp-block-woocommerce-product-variations-fields__heading-image-container"},(0,a.createElement)(Ma,null)),(0,a.createElement)("p",{className:"wp-block-woocommerce-product-variations-fields__heading-description",dangerouslySetInnerHTML:St(o)}),(0,a.createElement)("div",{className:"wp-block-woocommerce-product-variations-fields__heading-actions"},(0,a.createElement)(c.Button,{variant:"primary",onClick:()=>{i(!0),(0,I.recordEvent)("product_options_add_first_option")}},(0,v.__)("Add variation options","woocommerce")))),(0,a.createElement)("div",{...f}),n&&(0,a.createElement)(Ea,{title:(0,v.__)("Add variation options","woocommerce"),description:(0,v.__)("Select from existing attributes or create new ones to add new variations for your product. You can change the order later.","woocommerce"),createNewAttributesAsGlobal:!0,notice:"",onCancel:()=>{(0,I.recordEvent)("product_options_modal_cancel_button_click"),h()},onAdd:e=>{const t=e.filter((e=>!d.some((t=>ma(e)===ma(t)))));(0,I.recordEvent)("product_options_add",{source:x,options:t.map((e=>({attribute:e.name,values:e.options})))}),u(t),h()},onAddAnother:()=>{(0,I.recordEvent)("product_add_options_modal_add_another_option_button_click")},onRemoveItem:()=>{(0,I.recordEvent)("product_add_options_modal_remove_option_button_click")},selectedAttributeIds:d.map((e=>e.id)),disabledAttributeIds:l.filter((e=>!e.variation)).map((e=>e.id)),termsAutoSelection:"all"}))}};function Fa(){return et({name:Oa,metadata:Da,settings:Ba})}const Va=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-password-field","description":"A checkbox and an input to type a password to view a product.","title":"Product password","category":"widgets","keywords":["products","password"],"textdomain":"default","attributes":{"label":{"type":"string","__experimentalRole":"content"}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css"}'),{name:Ha,...Ua}=Va,za={edit:function(e){let{attributes:t}=e;const o=(0,Ke.useWooBlockProps)(t),{label:r}=t,[n,i]=(0,J.useEntityProp)("postType","product","post_password"),[l,s]=(0,a.useState)(Boolean(n)),m=(0,ee.useInstanceId)(c.BaseControl,"post_password");return(0,a.createElement)("div",{...o},(0,a.createElement)(c.CheckboxControl,{label:r,checked:l,className:"wp-block-woocommerce-product-password-fields__field",onChange:e=>{s(e),e||i("")}}),l&&(0,a.createElement)(c.BaseControl,{id:m,label:(0,v.__)("Password","woocommerce")},(0,a.createElement)(c.__experimentalInputControl,{id:m,value:n,onChange:i})))}};function $a(){return et({name:Ha,metadata:Ua,settings:za})}const Ga=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-variation-items-field","title":"Product variations items","category":"woocommerce","description":"The product variations items.","keywords":["products","variations"],"textdomain":"default","attributes":{"description":{"type":"string","__experimentalRole":"content"}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"usesContext":["isInSelectedTab"],"editorStyle":"file:./editor.css"}');async function Wa(e){let{message:t=(0,v.__)("Enter a value","woocommerce"),defaultValue:o,onOk:r,onCancel:n}=e;const a=window.prompt(t,o);null!==a?r(a):n&&n()}function ja(e){let{selection:t,onChange:o,onClose:r}=e;return(0,a.createElement)(c.MenuItem,{onClick:()=>{const e=Array.isArray(t)?t.map((e=>{let{id:t}=e;return t})):t.id;(0,I.recordEvent)("product_variations_menu_inventory_select",{source:x,action:"stock_quantity_set",variation_id:e}),Wa({onOk(r){const n=Number(r);Number.isNaN(n)||((0,I.recordEvent)("product_variations_menu_inventory_update",{source:x,action:"stock_quantity_set",variation_id:e}),Array.isArray(t)?o(t.map((e=>{let{id:t}=e;return{id:t,stock_quantity:n,manage_stock:!0}}))):o({stock_quantity:n,manage_stock:!0}))}}),r()}},(0,v.__)("Update stock","woocommerce"))}const qa=(0,a.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(oe.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"}));function Za(e){let{selection:t,onChange:o,onClose:r}=e;return(0,a.createElement)(c.MenuItem,{onClick:()=>{const e=Array.isArray(t)?t.map((e=>{let{id:t}=e;return t})):t.id;(0,I.recordEvent)("product_variations_menu_pricing_select",{source:x,action:"list_price_set",variation_id:e}),Wa({onOk(r){(0,I.recordEvent)("product_variations_menu_pricing_update",{source:x,action:"list_price_set",variation_id:e}),Array.isArray(t)?o(t.map((e=>{let{id:t}=e;return{id:t,regular_price:r}}))):o({regular_price:r})}}),r()}},(0,v.__)("Set list price","woocommerce"))}function Ja(e){return e.endsWith("%")}function Xa(e){const t=e.substring(0,e.length-1);if(!Number.isNaN(Number(t)))return Number(t)}function Ya(e,t){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(Ja(t)){if(Number.isNaN(Number(e)))return 0;const r=Xa(t);return void 0===r?Number(e):Number(e)+Number(e)*(r/100)*o}if(Number.isNaN(Number(e))){if(Number.isNaN(Number(t)))return;return Number(t)}return Number(e)+Number(t)*o}function Ka(e){let{selection:t,onChange:o,onClose:r}=e;const n=Array.isArray(t)?t.map((e=>{let{id:t}=e;return t})):t.id;return(0,a.createElement)(c.Dropdown,{position:"middle right",renderToggle:e=>{let{isOpen:t,onToggle:o}=e;return(0,a.createElement)(c.MenuItem,{onClick:()=>{(0,I.recordEvent)("product_variations_menu_pricing_click",{source:x,variation_id:n}),o()},"aria-expanded":t,icon:qa,iconPosition:"right"},(0,v.__)("Pricing","woocommerce"))},renderContent:()=>(0,a.createElement)("div",{className:"components-dropdown-menu__menu"},(0,a.createElement)(c.MenuGroup,{label:(0,v.__)("List price","woocommerce")},(0,a.createElement)(Za,{selection:t,onChange:o,onClose:r}),(0,a.createElement)(c.MenuItem,{onClick:()=>{(0,I.recordEvent)("product_variations_menu_pricing_select",{source:x,action:"list_price_increase",variation_id:n}),Wa({message:(0,v.__)("Enter a value (fixed or %)","woocommerce"),onOk(e){var r;(0,I.recordEvent)("product_variations_menu_pricing_update",{source:x,action:"list_price_increase",variation_id:n}),Array.isArray(t)?o(t.map((t=>{let{id:o,regular_price:r}=t;var n;return{id:o,regular_price:null===(n=Ya(r,e))||void 0===n?void 0:n.toFixed(2)}}))):o({regular_price:null===(r=Ya(t.regular_price,e))||void 0===r?void 0:r.toFixed(2)})}}),r()}},(0,v.__)("Increase list price","woocommerce")),(0,a.createElement)(c.MenuItem,{onClick:()=>{(0,I.recordEvent)("product_variations_menu_pricing_select",{source:x,action:"list_price_decrease",variation_id:n}),Wa({message:(0,v.__)("Enter a value (fixed or %)","woocommerce"),onOk(e){var r;(0,I.recordEvent)("product_variations_menu_pricing_update",{source:x,action:"list_price_increase",variation_id:n}),Array.isArray(t)?o(t.map((t=>{let{id:o,regular_price:r}=t;var n;return{id:o,regular_price:null===(n=Ya(r,e,-1))||void 0===n?void 0:n.toFixed(2)}}))):o({regular_price:null===(r=Ya(t.regular_price,e,-1))||void 0===r?void 0:r.toFixed(2)})}}),r()}},(0,v.__)("Decrease list price","woocommerce"))),(0,a.createElement)(c.MenuGroup,{label:(0,v.__)("Sale price","woocommerce")},(0,a.createElement)(c.MenuItem,{onClick:()=>{(0,I.recordEvent)("product_variations_menu_pricing_select",{source:x,action:"sale_price_set",variation_id:n}),Wa({onOk(e){(0,I.recordEvent)("product_variations_menu_pricing_update",{source:x,action:"sale_price_set",variation_id:n}),Array.isArray(t)?o(t.map((t=>{let{id:o}=t;return{id:o,sale_price:e}}))):o({sale_price:e})}}),r()}},(0,v.__)("Set sale price","woocommerce")),(0,a.createElement)(c.MenuItem,{onClick:()=>{(0,I.recordEvent)("product_variations_menu_pricing_select",{source:x,action:"sale_price_increase",variation_id:n}),Wa({message:(0,v.__)("Enter a value (fixed or %)","woocommerce"),onOk(e){var r;(0,I.recordEvent)("product_variations_menu_pricing_update",{source:x,action:"sale_price_increase",variation_id:n}),Array.isArray(t)?o(t.map((t=>{let{id:o,sale_price:r}=t;var n;return{id:o,sale_price:null===(n=Ya(r,e))||void 0===n?void 0:n.toFixed(2)}}))):o({sale_price:null===(r=Ya(t.sale_price,e))||void 0===r?void 0:r.toFixed(2)})}}),r()}},(0,v.__)("Increase sale price","woocommerce")),(0,a.createElement)(c.MenuItem,{onClick:()=>{(0,I.recordEvent)("product_variations_menu_pricing_select",{source:x,action:"sale_price_decrease",variation_id:n}),Wa({message:(0,v.__)("Enter a value (fixed or %)","woocommerce"),onOk(e){var r;(0,I.recordEvent)("product_variations_menu_pricing_update",{source:x,action:"sale_price_decrease",variation_id:n}),Array.isArray(t)?o(t.map((t=>{let{id:o,sale_price:r}=t;var n;return{id:o,sale_price:null===(n=Ya(r,e,-1))||void 0===n?void 0:n.toFixed(2)}}))):o({sale_price:null===(r=Ya(t.sale_price,e,-1))||void 0===r?void 0:r.toFixed(2)})}}),r()}},(0,v.__)("Decrease sale price","woocommerce")),(0,a.createElement)(c.MenuItem,{onClick:()=>{(0,I.recordEvent)("product_variations_menu_pricing_select",{source:x,action:"sale_price_schedule",variation_id:n}),Wa({message:(0,v.__)("Sale start date (YYYY-MM-DD format or leave blank)","woocommerce"),onOk(e){(0,I.recordEvent)("product_variations_menu_pricing_update",{source:x,action:"sale_price_schedule",variation_id:n}),Array.isArray(t)?o(t.map((t=>{let{id:o}=t;return{id:o,date_on_sale_from_gmt:e}}))):o({date_on_sale_from_gmt:e})}}),Wa({message:(0,v.__)("Sale end date (YYYY-MM-DD format or leave blank)","woocommerce"),onOk(e){(0,I.recordEvent)("product_variations_menu_pricing_update",{source:x,action:"sale_price_schedule",variation_id:n}),Array.isArray(t)?o(t.map((t=>{let{id:o}=t;return{id:o,date_on_sale_to_gmt:e}}))):o({date_on_sale_to_gmt:e})}}),r()}},(0,v.__)("Schedule sale","woocommerce"))))})}var Qa,ei;!function(e){e.instock="instock",e.onbackorder="onbackorder",e.outofstock="outofstock"}(Qa||(Qa={})),function(e){e.instock="green",e.onbackorder="yellow",e.outofstock="red"}(ei||(ei={}));const ti={[Qa.instock]:(0,v.__)("In stock","woocommerce"),[Qa.onbackorder]:(0,v.__)("On backorder","woocommerce"),[Qa.outofstock]:(0,v.__)("Out of stock","woocommerce")},oi=e=>e.manage_stock?e.stock_quantity||0:e.stock_status?ti[e.stock_status]:ti.instock,ri=e=>{if(e.manage_stock){const t=e.stock_quantity||0;return t>=10?ei.instock:t<10&&t>2?ei.onbackorder:ei.outofstock}return e.stock_status?ei[e.stock_status]:""};function ni(e){let{selection:t,onChange:o,onClose:r}=e;const n=Array.isArray(t)?t.map((e=>{let{id:t}=e;return t})):t.id;return(0,a.createElement)(c.Dropdown,{position:"middle right",renderToggle:e=>{let{isOpen:t,onToggle:o}=e;return(0,a.createElement)(c.MenuItem,{onClick:()=>{(0,I.recordEvent)("product_variations_menu_inventory_click",{source:x,variation_id:n}),o()},"aria-expanded":t,icon:qa,iconPosition:"right"},(0,v.__)("Inventory","woocommerce"))},renderContent:()=>(0,a.createElement)("div",{className:"components-dropdown-menu__menu"},(0,a.createElement)(c.MenuGroup,null,(0,a.createElement)(ja,{selection:t,onChange:o,onClose:r}),(0,a.createElement)(c.MenuItem,{onClick:()=>{(0,I.recordEvent)("product_variations_menu_inventory_select",{source:x,action:"manage_stock_toggle",variation_id:n}),Array.isArray(t)?o(t.map((e=>{let{id:t,manage_stock:o}=e;return{id:t,manage_stock:!o}}))):o({manage_stock:!t.manage_stock}),r()}},(0,v.__)('Toggle "track quantity"',"woocommerce")),(0,a.createElement)(c.MenuItem,{onClick:()=>{(0,I.recordEvent)("product_variations_menu_inventory_select",{source:x,action:"set_status_in_stock",variation_id:n}),Array.isArray(t)?o(t.map((e=>{let{id:t}=e;return{id:t,stock_status:Qa.instock,manage_stock:!1}}))):o({stock_status:Qa.instock,manage_stock:!1}),r()}},(0,v.__)("Set status to In stock","woocommerce")),(0,a.createElement)(c.MenuItem,{onClick:()=>{(0,I.recordEvent)("product_variations_menu_inventory_select",{source:x,action:"set_status_out_of_stock",variation_id:n}),Array.isArray(t)?o(t.map((e=>{let{id:t}=e;return{id:t,stock_status:Qa.outofstock,manage_stock:!1}}))):o({stock_status:Qa.outofstock,manage_stock:!1}),r()}},(0,v.__)("Set status to Out of stock","woocommerce")),(0,a.createElement)(c.MenuItem,{onClick:()=>{(0,I.recordEvent)("product_variations_menu_inventory_select",{source:x,action:"set_status_on_back_order",variation_id:n}),Array.isArray(t)?o(t.map((e=>{let{id:t}=e;return{id:t,stock_status:Qa.onbackorder,manage_stock:!1}}))):o({stock_status:Qa.onbackorder,manage_stock:!1}),r()}},(0,v.__)("Set status to On back order","woocommerce")),(0,a.createElement)(c.MenuItem,{onClick:()=>{(0,I.recordEvent)("product_variations_menu_inventory_select",{source:x,action:"low_stock_amount_set",variation_id:n}),Wa({onOk(e){(0,I.recordEvent)("product_variations_menu_inventory_update",{source:x,action:"low_stock_amount_set",variation_id:n});const r=Number(e);if(Number.isNaN(r))return null;Array.isArray(t)?o(t.map((e=>{let{id:t}=e;return{id:t,low_stock_amount:r,manage_stock:!0}}))):o({low_stock_amount:r,manage_stock:!0})}}),r()}},(0,v.__)("Edit low stock threshold","woocommerce"))))})}function ai(e){let{selection:t,onChange:o,onClose:r}=e;const n=Array.isArray(t)?t.map((e=>{let{id:t}=e;return t})):t.id;function i(e){Array.isArray(t)?o(t.map((t=>{let{id:o,dimensions:r}=t;return{id:o,dimensions:{...r,...e}}}))):o({dimensions:{...t.dimensions,...e}})}return(0,a.createElement)(c.Dropdown,{position:"middle right",renderToggle:e=>{let{isOpen:t,onToggle:o}=e;return(0,a.createElement)(c.MenuItem,{onClick:()=>{(0,I.recordEvent)("product_variations_menu_shipping_click",{source:x,variation_id:n}),o()},"aria-expanded":t,icon:qa,iconPosition:"right"},(0,v.__)("Shipping","woocommerce"))},renderContent:()=>(0,a.createElement)("div",{className:"components-dropdown-menu__menu"},window.wcAdminFeatures["product-virtual-downloadable"]&&(0,a.createElement)(c.MenuItem,{onClick:()=>{(0,I.recordEvent)("product_variations_menu_shipping_select",{source:x,action:"toggle_shipping",variation_id:n}),Array.isArray(t)?o(t.map((e=>{let{id:t,virtual:o}=e;return{id:t,virtual:!o}}))):o({virtual:!t.virtual}),(0,I.recordEvent)("product_variations_menu_shipping_update",{source:x,action:"toggle_shipping",variation_id:n}),r()}},(0,v.__)("Toggle shipping","woocommerce")),(0,a.createElement)(c.MenuItem,{onClick:()=>{(0,I.recordEvent)("product_variations_menu_shipping_select",{source:x,action:"dimensions_length_set",variation_id:n}),Wa({onOk(e){(0,I.recordEvent)("product_variations_menu_shipping_update",{source:x,action:"dimensions_length_set",variation_id:n}),i({length:e})}}),r()}},(0,v.__)("Set length","woocommerce")),(0,a.createElement)(c.MenuItem,{onClick:()=>{(0,I.recordEvent)("product_variations_menu_shipping_select",{source:x,action:"dimensions_width_set",variation_id:n}),Wa({onOk(e){(0,I.recordEvent)("product_variations_menu_shipping_update",{source:x,action:"dimensions_width_set",variation_id:n}),i({width:e})}}),r()}},(0,v.__)("Set width","woocommerce")),(0,a.createElement)(c.MenuItem,{onClick:()=>{(0,I.recordEvent)("product_variations_menu_shipping_select",{source:x,action:"dimensions_height_set",variation_id:n}),Wa({onOk(e){(0,I.recordEvent)("product_variations_menu_shipping_update",{source:x,action:"dimensions_height_set",variation_id:n}),i({height:e})}}),r()}},(0,v.__)("Set height","woocommerce")),(0,a.createElement)(c.MenuItem,{onClick:()=>{(0,I.recordEvent)("product_variations_menu_shipping_select",{source:x,action:"weight_set",variation_id:n}),Wa({onOk(e){(0,I.recordEvent)("product_variations_menu_shipping_update",{source:x,action:"weight_set",variation_id:n}),Array.isArray(t)?o(t.map((t=>{let{id:o}=t;return{id:o,weight:e}}))):o({weight:e})}}),r()}},(0,v.__)("Set weight","woocommerce")))})}function ii(e){let{selection:t,onChange:o,onClose:r}=e;function n(e){return"private"===e?"publish":"private"}return(0,a.createElement)(c.MenuItem,{onClick:function(){const e=Array.isArray(t)?t.map((e=>{let{id:t}=e;return t})):t.id;(0,I.recordEvent)("product_variations_menu_toggle_visibility_select",{source:x,action:"status_set",variation_id:e}),Array.isArray(t)?o(t.map((e=>{let{id:t,status:o}=e;return{id:t,status:n(o)}}))):o({status:n(t.status)}),(0,I.recordEvent)("product_variations_toggle_visibility_update",{source:x,action:"status_set",variation_id:e}),r()}},(0,v.__)("Toggle visibility","woocommerce"))}const li="downloads_menu_item__upload_files_modal_wrapper";function ci(e){return{id:`${e.id}`,name:e.name,file:e.url}}function si(e){let{selection:t,onChange:o,onClose:r}=e;const n=Array.isArray(t)?t.map((e=>{let{id:t}=e;return t})):t.id,i=(Array.isArray(t)?t[0].downloads:t.downloads).map((e=>{let{id:t}=e;return Number.parseInt(t,10)})),[l,s]=(0,a.useState)(!1);function m(e){const a={downloadable:!0,downloads:Array.isArray(e)?e.map(ci):ci(e)};Array.isArray(t)?o(t.map((e=>{let{id:t}=e;return{...a,id:t}}))):o(a),(0,I.recordEvent)("product_variations_menu_downloads_update",{source:x,action:"downloads_set",variation_id:n}),r()}function d(e,a){return function(){(0,I.recordEvent)("product_variations_menu_downloads_select",{source:x,action:`${e}_set`,variation_id:n}),Wa({message:a,onOk(r){Array.isArray(t)?o(t.map((t=>{let{id:o}=t;return{id:o,downloadable:!0,[e]:r}}))):o({downloadable:!0,[e]:r}),(0,I.recordEvent)("product_variations_menu_downloads_update",{source:x,action:`${e}_set`,variation_id:n})}}),s(!1),r()}}return(0,a.useEffect)((function(){const e=document.querySelector(".downloads_menu_item__upload_files_modal"),t=null==e?void 0:e.closest('[role="dialog"]'),o=null==t?void 0:t.parentElement;return null==o||o.classList.add(li),()=>{null==o||o.classList.remove(li)}}),[l]),(0,a.createElement)(c.Dropdown,{position:"middle right",renderToggle:e=>{let{isOpen:t,onToggle:o}=e;return(0,a.createElement)(c.MenuItem,{onClick:()=>{(0,I.recordEvent)("product_variations_menu_shipping_click",{source:x,variation_id:n}),o()},"aria-expanded":t,icon:qa,iconPosition:"right"},(0,v.__)("Downloads","woocommerce"))},renderContent:()=>(0,a.createElement)("div",{className:"components-dropdown-menu__menu"},(0,a.createElement)(He.MediaUpload,{modalClass:"downloads_menu_item__upload_files_modal",multiple:"add",value:i,onSelect:m,render:e=>{let{open:t}=e;return(0,a.createElement)(c.MenuItem,{onClick:(o=t,function(){(0,I.recordEvent)("product_variations_menu_downloads_select",{source:x,action:"downloads_set",variation_id:n}),o(),s(!0)})},(0,v.__)("Upload files","woocommerce"));var o}}),(0,a.createElement)(c.MenuItem,{onClick:d("download_limit",(0,v.__)("Leave blank for unlimited re-downloads","woocommerce"))},(0,v.__)("Set download limit","woocommerce")),(0,a.createElement)(c.MenuItem,{onClick:d("download_expiry",(0,v.__)("Enter the number of days before a download link expires, or leave blank","woocommerce"))},(0,v.__)("Set download expiry","woocommerce")))})}function mi(e){let{selection:t,disabled:o,onChange:r,onDelete:n}=e;return(0,a.createElement)(c.Dropdown,{position:"bottom left",renderToggle:e=>{let{isOpen:t,onToggle:r}=e;return(0,a.createElement)(c.Button,{disabled:o,"aria-expanded":t,icon:t?ho:go,variant:"secondary",onClick:r,className:"variations-actions-menu__toogle"},(0,a.createElement)("span",null,(0,v.__)("Quick update","woocommerce")))},renderContent:e=>{let{onClose:o}=e;return(0,a.createElement)("div",{className:"components-dropdown-menu__menu"},(0,a.createElement)(c.MenuGroup,null,(0,a.createElement)(ja,{selection:t,onChange:r,onClose:o}),(0,a.createElement)(Za,{selection:t,onChange:r,onClose:o}),(0,a.createElement)(ii,{selection:t,onChange:r,onClose:o})),(0,a.createElement)(c.MenuGroup,null,(0,a.createElement)(Ka,{selection:t,onChange:r,onClose:o}),(0,a.createElement)(ni,{selection:t,onChange:r,onClose:o}),(0,a.createElement)(ai,{selection:t,onChange:r,onClose:o}),window.wcAdminFeatures["product-virtual-downloadable"]&&(0,a.createElement)(si,{selection:t,onChange:r,onClose:o})),(0,a.createElement)(c.MenuGroup,null,(0,a.createElement)(c.MenuItem,{isDestructive:!0,variant:"link",onClick:()=>{n(t),o()},className:"woocommerce-product-variations__actions--delete"},(0,v.__)("Delete","woocommerce"))))}})}function di(e){let{className:t,totalCount:o,perPageOptions:r=A,defaultPerPage:n=P,onPageChange:l,onPerPageChange:c}=e;const s=(0,i.usePagination)({defaultPerPage:n,totalCount:o,onPageChange:l,onPerPageChange:c}),m=(0,v.__)("Viewing %d-%d of %d items","woocommerce");return(0,a.createElement)("div",{className:Q()(t,"woocommerce-product-variations-pagination")},(0,a.createElement)("div",{className:"woocommerce-product-variations-pagination__info"},(0,v.sprintf)(m,s.start,s.end,o)),(0,a.createElement)("div",{className:"woocommerce-product-variations-pagination__current-page"},(0,a.createElement)(i.PaginationPageArrowsWithPicker,{...s})),(0,a.createElement)("div",{className:"woocommerce-product-variations-pagination__page-size"},(0,a.createElement)(i.PaginationPageSizePicker,{...s,total:o,perPageOptions:r,label:""})))}function ui(){return(0,a.createElement)(c.SVG,{width:"90",height:"64",viewBox:"0 0 90 64",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(c.Path,{d:"M89.4707 32.0026L80.0137 38.0743L83.1112 48.872L71.7948 48.2247L69.3959 59.2741L59.1941 54.3068L53.3124 64L45.001 56.2691L36.6895 64L30.8078 54.3068L20.6061 59.2741L18.2072 48.2247L6.89067 48.872L9.98819 38.0743L0.53125 32.0026L9.98819 25.9257L6.89067 15.1332L18.2072 15.7804L20.6061 4.7259L30.8078 9.69837L36.6895 0L45.001 7.73096L53.3124 0L59.1889 9.69837L69.3959 4.7259L71.7948 15.7804L83.1112 15.1332L80.0137 25.9257L89.4707 32.0026Z",fill:"#E0E0E0"}),(0,a.createElement)(c.Path,{d:"M44.9266 16.8066C41.6031 16.8066 38.9062 19.5292 38.9062 26.0632C38.9062 34.051 44.9266 40.7187 44.9266 40.7187C44.9266 40.7187 50.947 34.0459 50.947 26.0632C50.947 19.5292 48.2502 16.8066 44.9266 16.8066Z",fill:"white"}),(0,a.createElement)(c.Path,{d:"M44.9218 49.9242C46.9389 49.9242 48.5741 48.289 48.5741 46.2719C48.5741 44.2548 46.9389 42.6196 44.9218 42.6196C42.9047 42.6196 41.2695 44.2548 41.2695 46.2719C41.2695 48.289 42.9047 49.9242 44.9218 49.9242Z",fill:"white"}))}function pi(e){let{onActionClick:t,isError:o}=e;return(0,a.createElement)("div",{className:"woocommerce-variations-table-error-or-empty-state"},o?(0,a.createElement)(ui,null):(0,a.createElement)(Ma,null),(0,a.createElement)("p",{className:"woocommerce-variations-table-error-or-empty-state__message"},o?(0,v.__)("We couldn’t load the variations","woocommerce"):(0,v.__)("No variations yet","woocommerce")),(0,a.createElement)("div",{className:"woocommerce-variations-table-error-or-empty-state__actions"},(0,a.createElement)(c.Button,{variant:"link",onClick:t},o?(0,v.__)("Try again","woocommerce"):(0,v.__)("Generate from options","woocommerce"))))}const _i=(0,a.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(oe.Path,{d:"M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z"}));function fi(e){let{initialValues:t,attribute:o,onFilter:r}=e;const[n,i]=(0,a.useState)(t),[l,s]=(0,a.useState)([]),[d,u]=(0,a.useState)(0),[p,_]=(0,a.useState)(!1),[f,h]=(0,a.useState)(""),[g,E]=(0,a.useState)(1),y=(0,m.useRef)(null),C=0===n.length;async function k(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;try{_(!0);const{getProductAttributeTerms:r,getProductAttributeTermsTotalCount:n}=(0,w.resolveSelect)(b.EXPERIMENTAL_PRODUCT_ATTRIBUTE_TERMS_STORE_NAME),a={attribute_id:e,per_page:10,page:o,search:t},i=await r(a),l=await n(a);s(o>1?e=>[...e,...i]:i),u(l)}catch{}finally{_(!1)}}function S(e,t){return async function(){t(),e||await k(o.id)}}async function N(e){if(p||l.length>=d)return;const t=e.currentTarget,r=t.scrollHeight-t.clientHeight;if(t.scrollTop>=r){const e=g+1;await k(o.id,f,e),E(e)}}function T(e){return n.includes(e)}function x(e){return function(t){i((o=>t?[...o,e]:o.reduce((function(t,o){return o===e?t:[...t,o]}),[])))}}function P(e){"Enter"===e.code&&e.preventDefault()}(0,m.useEffect)((()=>i(t)),[t]);const A=(0,ee.useDebounce)((function(e){h(e),s([]),E(1),k(o.id,e)}),300),I=(0,ee.useInstanceId)(c.__experimentalInputControl,"search"),M=(0,ee.useInstanceId)(c.CheckboxControl,"checkbox");return(0,a.createElement)(c.Dropdown,{className:"woocommerce-product-variations-filter",onClose:function(){h(""),E(1)},renderToggle:e=>{let{isOpen:t,onToggle:r}=e;return(0,a.createElement)(c.Button,{"aria-expanded":t,icon:t?ho:go,variant:"tertiary",onClick:S(t,r),className:"woocommerce-product-variations-filter__toggle"},(0,a.createElement)("span",null,(0,v.sprintf)((0,v.__)("Any %s","woocommerce"),o.name)))},renderContent:e=>{let{onClose:t}=e;return(0,a.createElement)("form",{className:"woocommerce-product-variations-filter__form",noValidate:!0,onSubmit:(s=t,function(e){e.preventDefault(),r(n),s()}),onReset:async function(e){var t;e.preventDefault(),C||(h(""),i([]),E(1),null===(t=y.current)||void 0===t||t.focus(),await k(o.id))}},o.options.length>10&&(0,a.createElement)("div",{className:"woocommerce-product-variations-filter__form-header"},(0,a.createElement)("label",{htmlFor:I,"aria-label":(0,v.__)("Search options","woocommerce")},(0,a.createElement)(c.__experimentalInputControl,{ref:y,id:I,type:"search",value:f,suffix:(0,a.createElement)(Ee,{icon:_i}),onChange:A,onKeyDown:P}))),(0,a.createElement)("div",{className:"woocommerce-product-variations-filter__form-body",onScroll:N},l.length>0?(0,a.createElement)("ul",{className:"woocommerce-product-variations-filter__form-list"},l.map((e=>(0,a.createElement)("li",{key:e.slug,className:"woocommerce-product-variations-filter__form-list-item"},(0,a.createElement)("label",{htmlFor:`${M}-${e.slug}`,className:"woocommerce-product-variations-filter__form-list-item-label"},(0,a.createElement)(c.CheckboxControl,{id:`${M}-${e.slug}`,checked:T(e.slug),onChange:x(e.slug)}),(0,a.createElement)("span",null,e.name)))))):!p&&(0,a.createElement)("div",{className:"woocommerce-product-variations-filter__form-list-empty"},(0,v.__)("No options were found for that search","woocommerce")),p&&(0,a.createElement)("div",{className:"woocommerce-product-variations-filter__loading"},(0,a.createElement)(c.Spinner,null))),(0,a.createElement)("div",{className:"woocommerce-product-variations-filter__form-footer"},(0,a.createElement)(c.Button,{type:"reset",variant:"secondary","aria-disabled":C},(0,v.__)("Reset","woocommerce")),(0,a.createElement)(c.Button,{type:"submit",variant:"primary"},(0,v.__)("Filter","woocommerce"))));var s}})}function hi(){return(0,a.createElement)("div",{className:"woocommerce-sortable__item","aria-hidden":"true"},(0,a.createElement)("div",{className:"woocommerce-list-item woocommerce-table-row-skeleton"},(0,a.createElement)("div",{className:"woocommerce-sortable__handle"}),(0,a.createElement)("div",{className:"woocommerce-product-variations__selection"},(0,a.createElement)("div",{className:"woocommerce-table-row-skeleton__checkbox"})),(0,a.createElement)("div",{className:"woocommerce-product-variations__attributes"},Array(3).fill(0).map(((e,t)=>(0,a.createElement)("div",{key:t,className:"woocommerce-tag woocommerce-product-variations__attribute"},(0,a.createElement)("div",{className:"woocommerce-table-row-skeleton__attribute-option"}))))),(0,a.createElement)("div",{className:"woocommerce-product-variations__price"},(0,a.createElement)("div",{className:"woocommerce-table-row-skeleton__regular-price"})),(0,a.createElement)("div",{className:"woocommerce-product-variations__quantity"},(0,a.createElement)("div",{className:"woocommerce-table-row-skeleton__quantity"})),(0,a.createElement)("div",{className:"woocommerce-product-variations__actions"},(0,a.createElement)("div",{className:"woocommerce-table-row-skeleton__visibility-icon"}),(0,a.createElement)("div",{className:"woocommerce-table-row-skeleton__edit-link"}),(0,a.createElement)("div",{className:"woocommerce-table-row-skeleton__menu-toggle"}))))}const gi=(0,a.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(oe.Path,{d:"M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z"}));function wi(e){let{width:t=24,height:o=24,className:r,...n}=e;return(0,a.createElement)("svg",{...n,width:t,height:o,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",className:Q()(r,"woocommerce-hidden-icon")},(0,a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.7226 6.2125C13.1641 6.0766 12.5883 6 11.9999 6C8.10055 6 4.75407 9.36447 3.31899 11.0546C2.8507 11.6061 2.8507 12.3939 3.31899 12.9454C4.17896 13.9582 5.72533 15.5723 7.66574 16.7033L8.41572 15.4043C8.13761 15.242 7.86389 15.0655 7.59553 14.8776C6.25019 13.9359 5.15775 12.7905 4.48406 12C5.15775 11.2095 6.25019 10.0641 7.59553 9.12235C8.96667 8.16257 10.4775 7.5 11.9999 7.5C12.3118 7.5 12.6231 7.5278 12.9329 7.58027L13.7226 6.2125ZM12.3504 8.58923C12.2352 8.57753 12.1182 8.57153 11.9999 8.57153C10.1063 8.57153 8.57132 10.1066 8.57132 12.0001C8.57132 12.7505 8.81237 13.4445 9.22126 14.0091L10.1233 12.4467C10.0893 12.3034 10.0713 12.1538 10.0713 12.0001C10.0713 11.1266 10.652 10.3888 11.4484 10.1515L12.3504 8.58923ZM12.8092 10.2491L13.5611 8.94679C14.6697 9.51479 15.4285 10.6688 15.4285 12.0001C15.4285 13.8937 13.8934 15.4287 11.9999 15.4287C11.3128 15.4287 10.6729 15.2266 10.1364 14.8785L10.8883 13.5763C11.2025 13.7983 11.5859 13.9287 11.9999 13.9287C13.065 13.9287 13.9285 13.0652 13.9285 12.0001C13.9285 11.224 13.4701 10.555 12.8092 10.2491ZM9.51376 15.957C10.3246 16.2986 11.1605 16.5 11.9999 16.5C13.5223 16.5 15.0331 15.8374 16.4043 14.8776C17.7496 13.9359 18.842 12.7905 19.5157 12C18.842 11.2095 17.7496 10.0641 16.4043 9.12235C15.6875 8.62066 14.9327 8.20018 14.1579 7.91308L14.917 6.59839C17.5164 7.64275 19.6204 9.80575 20.6808 11.0546C21.1491 11.6061 21.1491 12.3939 20.6808 12.9454C19.2457 14.6355 15.8992 18 11.9999 18C10.8611 18 9.76945 17.713 8.7588 17.2646L9.51376 15.957Z",fill:"currentColor"}),(0,a.createElement)("rect",{x:"16.0625",y:"4.61377",width:"1.22727",height:"16",transform:"rotate(30 16.0625 4.61377)",fill:"currentColor"}))}function vi(e,t){return e.length>t?e.substring(0,t)+"…":e}function Ei(e){let{selection:t,onChange:o,onDelete:r}=e;return(0,a.createElement)(c.DropdownMenu,{icon:re,label:(0,v.__)("Actions","woocommerce"),toggleProps:{onClick(){(0,I.recordEvent)("product_variations_menu_view",{source:x,variation_id:t.id})}}},(e=>{let{onClose:n}=e;return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(c.MenuGroup,{label:(0,v.sprintf)((0,v.__)("Variation Id: %s","woocommerce"),t.id)},(0,a.createElement)(c.MenuItem,{href:t.permalink,target:"_blank",rel:"noreferrer",onClick:()=>{(0,I.recordEvent)("product_variations_preview",{source:x,variation_id:t.id})}},(0,v.__)("Preview","woocommerce")),(0,a.createElement)(ii,{selection:t,onChange:o,onClose:n})),(0,a.createElement)(c.MenuGroup,null,(0,a.createElement)(Ka,{selection:t,onChange:o,onClose:n}),(0,a.createElement)(ni,{selection:t,onChange:o,onClose:n}),(0,a.createElement)(ai,{selection:t,onChange:o,onClose:n}),window.wcAdminFeatures["product-virtual-downloadable"]&&(0,a.createElement)(si,{selection:t,onChange:o,onClose:n})),(0,a.createElement)(c.MenuGroup,null,(0,a.createElement)(c.MenuItem,{isDestructive:!0,label:(0,v.__)("Delete variation","woocommerce"),variant:"link",onClick:()=>{r(t),n()},className:"woocommerce-product-variations__actions--delete"},(0,v.__)("Delete","woocommerce"))))}))}const bi=(0,v.__)("Not visible to customers","woocommerce");function yi(e){return(0,ye.getNewPath)({},`/product/${e.parent_id}/variation/${e.id}`,{})}function Ci(e){let{variation:t,variableAttributes:o,isUpdating:r,isSelected:n,isSelectionDisabled:l,hideActionButtons:s,onChange:m,onDelete:d,onEdit:u,onSelect:p}=e;const{formatAmount:_}=(0,a.useContext)(L.CurrencyContext),{matchesAny:f,tags:h}=(0,a.useMemo)((function(){let e=!1;const r=o.map((o=>{const r=t.attributes.find((e=>e.id===o.id));return r?{id:r.id,label:r.option}:(e=!0,{id:o.id,label:(0,v.sprintf)((0,v.__)("Any %s","woocommerce"),o.name)})}));return{matchesAny:e,tags:r}}),[o,t]);return(0,a.createElement)(a.Fragment,null,(0,a.createElement)("div",{className:"woocommerce-product-variations__selection"},f&&(0,a.createElement)(i.__experimentalTooltip,{text:(0,v.__)("'Any' variations are no longer fully supported. Use regular variations instead","woocommerce"),helperText:(0,v.__)("View helper text","woocommerce"),position:"middle right"},(0,a.createElement)(Ee,{icon:gi,size:24})),r?(0,a.createElement)(c.Spinner,null):(0,a.createElement)(c.CheckboxControl,{value:t.id,checked:n,onChange:p,disabled:l})),(0,a.createElement)("div",{className:"woocommerce-product-variations__attributes"},h.map((e=>{const t=(0,a.createElement)(i.Tag,{id:e.id,className:"woocommerce-product-variations__attribute",key:e.id,label:vi(e.label,32),screenReaderLabel:e.label});return h.length<=32?t:(0,a.createElement)(i.__experimentalTooltip,{key:e.id,text:e.label,position:"top center"},(0,a.createElement)("span",null,t))}))),(0,a.createElement)("div",{className:Q()("woocommerce-product-variations__price",{"woocommerce-product-variations__price--fade":"private"===t.status})},t.on_sale&&(0,a.createElement)("span",{className:"woocommerce-product-variations__sale-price"},_(t.sale_price)),(0,a.createElement)("span",{className:Q()("woocommerce-product-variations__regular-price",{"woocommerce-product-variations__regular-price--on-sale":t.on_sale})},_(t.regular_price))),(0,a.createElement)("div",{className:Q()("woocommerce-product-variations__quantity",{"woocommerce-product-variations__quantity--fade":"private"===t.status})},t.regular_price&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)("span",{className:Q()("woocommerce-product-variations__status-dot",ri(t))},"●"),oi(t))),(0,a.createElement)("div",{className:"woocommerce-product-variations__actions"},("private"===t.status||!t.regular_price)&&(0,a.createElement)(i.__experimentalTooltip,{className:"woocommerce-attribute-list-item__actions-tooltip",position:"top center",text:bi},(0,a.createElement)("div",{className:"woocommerce-attribute-list-item__actions-icon-wrapper"},(0,a.createElement)(wi,{className:"woocommerce-attribute-list-item__actions-icon-wrapper-icon"}))),s&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(c.Button,{href:yi(t),onClick:u},(0,v.__)("Edit","woocommerce")),(0,a.createElement)(Ei,{selection:t,onChange:function(e){m({...t,...e})},onDelete:d}))))}function ki(e,t){if("id"in e){const e="update"===t?"updated":"deleted";return(0,v.sprintf)((0,v.__)("1 variation %s.","woocommerce"),e)}const{update:o=[],delete:r=[]}=e,n=o.length,a=r.length;return a>0?(0,v.sprintf)((0,v.__)("%s variations deleted.","woocommerce"),a):n>0?(0,v.sprintf)((0,v.__)("%s variations updated.","woocommerce"),n):""}const Si=(0,a.forwardRef)((function(e,t){let{noticeText:o,noticeActions:r=[],noticeStatus:n="error",onNoticeDismiss:l=(()=>{}),onVariationTableChange:s=(()=>{})}=e;const m=(0,J.useEntityId)("postType","product"),[d]=(0,J.useEntityProp)("postType","product","attributes"),u=(0,a.useMemo)((()=>d.filter((e=>e.variation))),[d]),[p]=(0,J.useEntityProp)("postType","product","variations"),{createSuccessNotice:_,createErrorNotice:f}=(0,w.useDispatch)("core/notices"),{isLoading:h,variations:g,totalCount:E,onPageChange:y,onPerPageChange:C,onFilter:k,getFilters:S,hasFilters:N,selected:T,isSelectingAll:A,selectedCount:M,areAllSelected:R,areSomeSelected:L,isSelected:O,onSelect:D,onSelectPage:B,onSelectAll:F,onClearSelection:V,isUpdating:H,onUpdate:U,onDelete:z,onBatchUpdate:$,onBatchDelete:G,isGenerating:W,variationsError:j,onGenerate:q}=function(e){let{productId:t}=e;const[o,r]=(0,a.useState)([]),[n,i]=(0,a.useState)(0),[l,c]=(0,a.useState)(!1),[s,m]=(0,a.useState)(),[d,u]=(0,a.useState)([]),p=(0,a.useRef)(P);async function _(e){const t={page:1,per_page:p.current,order:"asc",orderby:"menu_order",attributes:[],...e};try{const{getProductVariations:e,getProductVariationsTotalCount:o}=(0,w.resolveSelect)(b.EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME);c(!0),m(void 0);const n=await e(t),a=await o(t);r(n),i(a),c(!1)}catch(e){m(e),c(!1)}}(0,a.useEffect)((()=>{_({product_id:t})}),[t]);const[f,h]=(0,a.useState)(0),[g,v]=(0,a.useState)(!1),E=(0,a.useRef)({}),y=(0,a.useMemo)((function(){return f>0?Object.values(E.current):[]}),[f]),C=(0,a.useCallback)((function(e){return f>0&&e.id in E.current}),[f]),k=(0,a.useMemo)((()=>f>0&&o.every(C)),[o,f,C]),S=(0,a.useMemo)((()=>f>0&&o.some(C)),[o,f,C]);function N(e){return function(t){t?(E.current[e.id]=e,h((e=>e+1))):(delete E.current[e.id],h((e=>e-1)))}}function T(){E.current={},h(0)}function x(){u([])}const[A,I]=(0,a.useState)({}),{isGenerating:M,generateProductVariations:R,generateError:L}=Ra(),O=(0,a.useRef)(!1);return(0,a.useEffect)((()=>{M&&(x(),T()),!0===O.current&&!1===M&&_({product_id:t}),O.current=Boolean(M)}),[M]),{isLoading:l,variations:o,totalCount:n,onPageChange:function(e){_({product_id:t,attributes:d,page:e})},onPerPageChange:function(e){p.current=e,_({product_id:t,attributes:d})},onFilter:function(e){return function(o){let r=!1;const n=d.reduce(((t,n)=>n.attribute===e.slug?(r=!0,0===o.length?t:[...t,{...n,terms:o}]):[...t,n]),[]);r||n.push({attribute:e.slug,terms:o}),T(),_({product_id:t,attributes:n}),u(n)}},getFilters:function(e){var t,o;return null!==(o=null===(t=d.find((t=>t.attribute===e.slug)))||void 0===t?void 0:t.terms)&&void 0!==o?o:[]},hasFilters:function(){return d.length},clearFilters:x,selected:y,isSelectingAll:g,selectedCount:f,areAllSelected:k,areSomeSelected:S,isSelected:C,onSelect:N,onSelectPage:function(e){e?o.forEach((e=>{E.current[e.id]=e})):o.forEach((e=>{delete E.current[e.id]})),h(Object.keys(E.current).length)},onSelectAll:async function(){v(!0);const{getProductVariations:e}=(0,w.resolveSelect)(b.EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME);let o=1,r=0;for(;r<n;){const n=await e({product_id:t,page:o++,per_page:50,order:"asc",orderby:"menu_order",attributes:d});r+=n.length,n.forEach((e=>{E.current[e.id]=e}))}return h(r),v(!1),r},onClearSelection:T,isUpdating:A,onUpdate:async function(e){let{id:o,...r}=e;if(A[o])return;const{updateProductVariation:n}=(0,w.dispatch)(b.EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME);return n({product_id:t,id:o},r).then((async e=>(await(0,w.dispatch)("core").invalidateResolution("getEntityRecord",["postType","product_variation",o]),await _({product_id:t,attributes:d}),e)))},onDelete:async function(e){if(A[e])return;const{deleteProductVariation:o,invalidateResolutionForStore:r}=(0,w.dispatch)(b.EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME);return o({product_id:t,id:e}).then((async o=>(N(o)(!1),await(0,w.dispatch)("core").invalidateResolution("getEntityRecord",["postType","product",t]),await(0,w.dispatch)("core").invalidateResolution("getEntityRecord",["postType","product_variation",e]),await r(),await _({product_id:t,attributes:d}),o)))},onBatchUpdate:async function(e){var o;const{invalidateResolution:r}=(0,w.dispatch)("core"),{batchUpdateProductVariations:n,invalidateResolutionForStore:a}=(0,w.dispatch)(b.EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME);let i=1;const l=[];for(;50*(i-1)<e.length;){const a=50*(i-1),c=a+50,s=e.slice(a,c);I((e=>s.reduce(((e,t)=>({...e,[t.id]:!0})),0===a?{}:e)));const m=await n({product_id:t},{update:s});i++,l.push(...null!==(o=null==m?void 0:m.update)&&void 0!==o?o:[]);for(const e of s)await r("getEntityRecord",["postType","product_variation",e.id])}return I({}),await a(),await _({product_id:t,attributes:d}),{update:l}},onBatchDelete:async function(e){var o;const{invalidateResolution:r}=(0,w.dispatch)("core"),{batchUpdateProductVariations:n,invalidateResolutionForStore:a}=(0,w.dispatch)(b.EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME);let i=1;const l=[];for(;50*(i-1)<e.length;){const a=50*(i-1),c=a+50,s=e.slice(a,c);I((e=>s.reduce(((e,t)=>({...e,[t.id]:!0})),0===a?{}:e)));const m=await n({product_id:t},{delete:s});i++,l.push(...null!==(o=null==m?void 0:m.delete)&&void 0!==o?o:[]);for(const e of s)await r("getEntityRecord",["postType","product_variation",e.id]),N(e)(!1)}return I({}),await r("getEntityRecord",["postType","product",t]),await a(),await _({product_id:t,attributes:d}),{delete:l}},isGenerating:M,onGenerate:R,variationsError:null!=L?L:s}}({productId:m}),Z=void 0!==j;if(!h&&!W&&(0===p.length||Z))return(0,a.createElement)(pi,{onActionClick:function(){q(d)},isError:Z});function X(e){z(e.id).then((t=>{(0,I.recordEvent)("product_variations_delete",{source:x,product_id:m,variation_id:e.id}),_(ki(t,"delete")),s("delete")})).catch((()=>{f((0,v.__)("Failed to delete variation.","woocommerce"))}))}function Y(e){U(e).then((t=>{(0,I.recordEvent)("product_variations_change",{source:x,product_id:m,variation_id:e.id}),_(ki(t,"update")),s("update",[e])})).catch((()=>{f((0,v.__)("Failed to save variation.","woocommerce"))}))}function K(e){const t=Date.now();$(e).then((o=>{(0,I.recordEvent)("product_variations_update_all",{source:x,product_id:m,variations_count:e.length,request_time:Date.now()-t}),_(ki(o)),s("update",e)})).catch((()=>{f((0,v.__)("Failed to update variations.","woocommerce"))}))}function Q(e){const t=Date.now();G(e.map((e=>e.id))).then((o=>{(0,I.recordEvent)("product_variations_delete_all",{source:x,product_id:m,variations_count:e.length,request_time:Date.now()-t}),_(ki(o)),s("delete")})).catch((()=>{f((0,v.__)("Failed to delete variations.","woocommerce"))}))}function ee(e){return function(){(0,I.recordEvent)("product_variations_edit",{source:x,product_id:m,variation_id:e.id})}}return(0,a.createElement)("div",{className:"woocommerce-product-variations",ref:t},o&&(0,a.createElement)(c.Notice,{status:n,className:"woocommerce-product-variations__notice",onRemove:l,actions:r.map((e=>({...e,onClick:()=>{null==e||e.onClick(K,Q)}})))},o),(N()||E>0)&&(0,a.createElement)("div",{className:"woocommerce-product-variations__header"},(0,a.createElement)("div",{className:"woocommerce-product-variations__selection"},(0,a.createElement)(c.CheckboxControl,{value:"all",checked:R,indeterminate:!R&&L,onChange:B})),(0,a.createElement)("div",{className:"woocommerce-product-variations__filters"},L?(0,a.createElement)(a.Fragment,null,(0,a.createElement)("span",null,(0,v.sprintf)((0,v.__)("%d selected","woocommerce"),M)),(0,a.createElement)(c.Button,{variant:"tertiary",onClick:()=>B(!0)},(0,v.sprintf)((0,v.__)("Select page (%d)","woocommerce"),g.length)),(0,a.createElement)(c.Button,{variant:"tertiary",isBusy:A,onClick:async function(){const e=Date.now();F().then((t=>{(0,I.recordEvent)("product_variations_select_all",{source:x,product_id:m,variations_count:t,request_time:Date.now()-e})}))}},(0,v.sprintf)((0,v.__)("Select all (%d)","woocommerce"),E)),(0,a.createElement)(c.Button,{variant:"tertiary",onClick:V},(0,v.__)("Clear selection","woocommerce"))):u.map((e=>(0,a.createElement)(fi,{key:e.id,initialValues:S(e),attribute:e,onFilter:k(e)})))),(0,a.createElement)("div",null,(0,a.createElement)(mi,{selection:T,disabled:!L&&!A,onChange:K,onDelete:Q}))),h||W?(0,a.createElement)("div",{className:"woocommerce-product-variations__table","aria-label":W?(0,v.__)("Generating variations…","woocommerce"):(0,v.__)("Loading variations…","woocommerce")},Array.from({length:g.length||5}).map(((e,t)=>(0,a.createElement)(hi,{key:t})))):(0,a.createElement)(i.Sortable,{className:"woocommerce-product-variations__table"},g.map((e=>(0,a.createElement)(i.ListItem,{key:`${e.id}`,className:"woocommerce-product-variations__table-row"},(0,a.createElement)(Ci,{variation:e,variableAttributes:u,isUpdating:H[e.id],isSelected:O(e),isSelectionDisabled:A,hideActionButtons:!L,onChange:Y,onDelete:X,onEdit:ee(e),onSelect:D(e)}))))),E>5&&(0,a.createElement)(di,{className:"woocommerce-product-variations__footer",totalCount:E,onPageChange:y,onPerPageChange:C}))})),Ni=()=>{const[e,t]=(0,a.useState)(!1),o=(0,J.useEntityId)("postType","product"),r=(0,a.useRef)(),n=(0,a.useMemo)((()=>({product_id:o,page:1,per_page:P,order:"asc",orderby:"menu_order"})),[o]),{totalCount:l}=(0,w.useSelect)((e=>{const{getProductVariationsTotalCount:t}=e(b.EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME);return{totalCount:t(n)}}),[o]),{updateUserPreferences:c,variable_product_block_tour_shown:s}=(0,b.useUserPreferences)(),m={placement:"top",steps:[{referenceElements:{desktop:".wp-block-woocommerce-product-variation-items-field"},focusElement:{desktop:".wp-block-woocommerce-product-variation-items-field"},meta:{name:"product-variations-2",heading:(0,v.__)("⚡️ This product now has variations","woocommerce"),descriptions:{desktop:(0,v.__)("From now on, you’ll manage pricing, shipping, and inventory for each variation individually—just like any other product in your store.","woocommerce")},primaryButton:{text:(0,v.__)("Got it","woocommerce")}}}],options:{classNames:["variation-items-product-tour"],effects:{arrowIndicator:!0,spotlight:{interactivity:{enabled:!0}}},callbacks:{onStepViewOnce:()=>{(0,I.recordEvent)("variable_product_block_tour_shown",{variable_count:l})}},popperModifiers:[{name:"offset",options:{offset:[0,32]}}]},closeHandler:()=>{c({variable_product_block_tour_shown:"yes"}),t(!1),(0,I.recordEvent)("variable_product_block_tour_dismissed")}};(0,a.useEffect)((()=>{const o=r.current!==l&&l>0&&0===r.current;r.current=l,o&&!e&&t(!0)}),[l]);const{hasShownProductEditorTour:d}=(0,w.useSelect)((e=>{const{getOption:t}=e(b.OPTIONS_STORE_NAME);return{hasShownProductEditorTour:"yes"===t("woocommerce_block_product_tour_shown")}}));return"yes"!==s&&e&&d?(0,a.createElement)(i.TourKit,{config:m}):null},{name:Ti,...xi}=Ga,Pi={example:{},edit:function(e){let{attributes:t,context:o}=e;const r=(0,a.useRef)(!1),{invalidateResolution:n}=(0,w.useDispatch)(b.EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME),i=(0,J.useEntityId)("postType","product"),l=(0,Ke.useWooBlockProps)(t),[c]=(0,J.useEntityProp)("postType","product","status"),s=(0,a.useMemo)((()=>({product_id:i,order:"asc",orderby:"menu_order",has_price:!1})),[i]),{totalCountWithoutPrice:m}=(0,w.useSelect)((e=>{const{getProductVariationsTotalCount:t}=e(b.EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME);return{totalCountWithoutPrice:t(s)}}),[s]),{updateUserPreferences:d,variable_items_without_price_notice_dismissed:u}=(0,b.useUserPreferences)(),{ref:p}=tr("variations",(async function(e,t){if(m>0&&!r.current&&"publish"!==c&&"publish"===(null==t?void 0:t.status))return"yes"!==u&&d({variable_items_without_price_notice_dismissed:{...u||{},[i]:"no"}}),(0,v.__)("Set variation prices before adding this product.","woocommerce")}),[m]),_=!u||"yes"!==u[i],f=m>0&&_?(0,v.sprintf)((0,v.__)("%d variations do not have prices. Variations that do not have prices will not be visible to customers.","woocommerce"),m):"";return(0,a.createElement)("div",{...l},(0,a.createElement)(Si,{ref:p,noticeText:f,onNoticeDismiss:()=>{r.current=!0,d({variable_items_without_price_notice_dismissed:{...u||{},[i]:"yes"}})},noticeActions:[{label:(0,v.__)("Set prices","woocommerce"),onClick:function(e){(0,I.recordEvent)("product_variations_set_prices_select",{source:x});const t=(0,w.resolveSelect)(b.EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME).getProductVariations({product_id:i,order:"asc",orderby:"menu_order",has_price:!1,_fields:["id"],per_page:m});Wa({onOk(o){(0,I.recordEvent)("product_variations_set_prices_update",{source:x}),t.then((t=>{e(t.map((e=>{let{id:t}=e;return{id:t,regular_price:o}})))}))}})},className:"is-destructive"}],onVariationTableChange:(e,t)=>{("delete"===e||"update"===e&&t&&t.find((e=>"regular_price"in e||"sale_price"in e)))&&n("getProductVariationsTotalCount",[s])}}),o.isInSelectedTab&&(0,a.createElement)(Ni,null))}};function Ai(){return et({name:Ti,metadata:xi,settings:Pi})}const Ii=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-variations-options-field","title":"Product variations options","category":"woocommerce","description":"The product variations options.","keywords":["products","variations"],"textdomain":"default","attributes":{"description":{"type":"string","__experimentalRole":"content"}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css"}'),{name:Mi,...Ri}=Ii,Li={example:{},edit:function(e){let{attributes:t}=e;const o=(0,Ke.useWooBlockProps)(t),{generateProductVariations:r}=Ra(),{updateUserPreferences:n,product_block_variable_options_notice_dismissed:l}=(0,b.useUserPreferences)(),[c,s]=(0,J.useEntityProp)("postType","product","attributes"),[m,d]=(0,J.useEntityProp)("postType","product","default_attributes"),{attributes:u,handleChange:p}=Na({allAttributes:c,isVariationAttributes:!0,productId:(0,J.useEntityId)("postType","product"),onChange(e,t){s(e),d(t),r(e,t)}}),_=u.filter((e=>0===e.id)).map((e=>e.name));let f="";return _.length>0&&"yes"!==l&&(f=(0,a.createInterpolateElement)((0,v.__)("Buyers can’t search or filter by <attributeNames /> to find the variations. Consider adding them again as <globalAttributeLink>global attributes</globalAttributeLink> to make them easier to discover.","woocommerce"),{attributeNames:(0,a.createElement)("span",null,2===_.length?_.join((0,v.__)(" and ","woocommerce")):_.join(", ")),globalAttributeLink:(0,a.createElement)(i.Link,{href:"https://woo.com/document/variable-product/#add-attributes-to-use-for-variations",type:"external",target:"_blank"})})),(0,a.createElement)("div",{...o},(0,a.createElement)(Ca,{value:(0,a.useMemo)((function(){return u.map((e=>({...e,isDefault:m.some((t=>t.id===e.id||t.name===e.name))})))}),[u,m]),onAdd:()=>{(0,I.recordEvent)("product_options_modal_add_button_click")},onChange:p,createNewAttributesAsGlobal:!0,useRemoveConfirmationModal:!0,onNoticeDismiss:()=>n({product_block_variable_options_notice_dismissed:"yes"}),onAddAnother:()=>{(0,I.recordEvent)("product_add_options_modal_add_another_option_button_click")},onNewModalCancel:()=>{(0,I.recordEvent)("product_options_modal_cancel_button_click")},onNewModalOpen:()=>{(0,I.recordEvent)("product_options_add_option")},onRemoveItem:()=>{(0,I.recordEvent)("product_add_options_modal_remove_option_button_click")},onRemove:()=>(0,I.recordEvent)("product_remove_option_confirmation_confirm_click"),onRemoveCancel:()=>(0,I.recordEvent)("product_remove_option_confirmation_cancel_click"),disabledAttributeIds:c.filter((e=>!e.variation)).map((e=>e.id)),termsAutoSelection:"all",uiStrings:{notice:f,globalAttributeHelperMessage:"",customAttributeHelperMessage:"",newAttributeModalNotice:"",newAttributeModalTitle:(0,v.__)("Add variation options","woocommerce"),newAttributeModalDescription:(0,v.__)("Select from existing attributes or create new ones to add new variations for your product. You can change the order later.","woocommerce"),attributeRemoveLabel:(0,v.__)("Remove variation option","woocommerce"),attributeRemoveConfirmationModalMessage:(0,v.__)("If you continue, some variations of this product will be deleted and customers will no longer be able to purchase them.","woocommerce")}}))}};function Oi(){return et({name:Mi,metadata:Ri,settings:Li})}const Di=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-single-variation-notice","title":"Notice","category":"woocommerce","description":"Notice description","keywords":["products","notice"],"textdomain":"default","attributes":{"title":{"type":"string"},"content":{"type":"string"},"isDismissible":{"type":"boolean"},"type":{"type":"string"}},"supports":{"align":false,"html":true,"multiple":true,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css","templateLock":"contentOnly"}');const{name:Bi,...Fi}=Di,Vi={example:{},edit:function(e){let{attributes:t}=e;const o=(0,Ke.useWooBlockProps)(t),{content:r,isDismissible:n,title:l,type:c="info"}=t,[s]=(0,J.useEntityProp)("postType","product_variation","parent_id"),{dismissedNotices:m,dismissNotice:d,isResolving:u}=function(){const{updateOptions:e}=(0,w.useDispatch)(b.OPTIONS_STORE_NAME),{dismissedNotices:t,isResolving:o}=(0,w.useSelect)((e=>{const{getOption:t,hasFinishedResolution:o}=e(b.OPTIONS_STORE_NAME);return{dismissedNotices:t(k)||[],isResolving:!o("getOption",[k])}}),[]);return{dismissedNotices:t,dismissNotice:async t=>{const{dismissedNoticesOption:o}=await(async()=>{const{getOption:e}=(0,w.resolveSelect)(b.OPTIONS_STORE_NAME);return{dismissedNoticesOption:await e(k)||[]}})();e({[k]:[...o,t]})},isResolving:o}}(),{parentName:p,isParentResolving:_}=(0,w.useSelect)((e=>{const{getEditedEntityRecord:t,hasFinishedResolution:o}=e("core"),{name:r}=t("postType","product",s);return{parentName:r||"",isParentResolving:!o("getEditedEntityRecord",["postType","product",s])}}));return m.includes(s)||u||_||""===p?null:(0,a.createElement)("div",{...o},(0,a.createElement)(ca,{title:l,type:c,isDismissible:n,handleDismiss:()=>{(0,I.recordEvent)("product_single_variation_notice_dismissed"),d(s)}},(0,a.createInterpolateElement)(r,{strong:(0,a.createElement)("strong",null),noticeLink:(0,a.createElement)(i.Link,{href:(0,ye.getNewPath)({tab:"variations"},`/product/${s}`),onClick:()=>{(0,I.recordEvent)("product_single_variation_notice_click")}}),parentProductName:(0,a.createElement)("span",null,p)})))}};function Hi(){return et({name:Bi,metadata:Fi,settings:Vi})}const Ui=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-has-variations-notice","title":"Notice","category":"woocommerce","description":"Notice description","keywords":["products","notice"],"textdomain":"default","attributes":{"title":{"type":"string"},"content":{"type":"string"},"buttonText":{"type":"string"},"type":{"type":"string"}},"supports":{"align":false,"html":false,"multiple":true,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css","templateLock":"contentOnly"}'),{name:zi,...$i}=Ui,Gi={example:{},edit:function(e){let{attributes:t}=e;const o=(0,Ke.useWooBlockProps)(t),{buttonText:r,content:n,title:i,type:l="info"}=t,[s]=(0,J.useEntityProp)("postType","product","attributes"),m=La(s);return(0,a.createElement)("div",{...o},m&&(0,a.createElement)(ca,{content:n,title:i,type:l},(0,a.createElement)(c.Button,{isSecondary:!0,onClick:()=>(0,ye.navigateTo)({url:(0,ye.getNewPath)({tab:"variations"})})},r)))}};function Wi(){return et({name:zi,metadata:$i,settings:Gi})}const ji=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-taxonomy-field","title":"Taxonomy","category":"widgets","description":"A block that displays a taxonomy field, allowing searching, selection, and creation of new items","keywords":["taxonomy"],"textdomain":"default","attributes":{"slug":{"type":"string","__experimentalRole":"content"},"property":{"type":"string","__experimentalRole":"content"},"label":{"type":"string","__experimentalRole":"content"},"createTitle":{"type":"string","__experimentalRole":"content"},"dialogNameHelpText":{"type":"string","__experimentalRole":"content"},"parentTaxonomyText":{"type":"string","__experimentalRole":"content"}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css","usesContext":["postType"]}');async function qi(e,t){const o=[],r={};return e.forEach((e=>{r[e.id]=e})),e.forEach((e=>{e.parent>0&&!r[e.parent]&&o.push(e.parent)})),o.length>0?(0,w.resolveSelect)("core").getEntityRecords("taxonomy",t,{include:o}).then((o=>qi([...o,...e],t))):e}const Zi=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{fetchParents:!0};const[o,r]=(0,a.useState)(!1);async function n(o){r(!0);let n=[];try{n=await(0,w.resolveSelect)("core").getEntityRecords("taxonomy",e,{per_page:30,search:(0,i.escapeHTML)(o)}),(null==t?void 0:t.fetchParents)&&(n=await qi(n,e))}finally{r(!1)}return n}return{searchEntity:n,isResolving:o}},Ji=e=>{let{onCancel:t,onCreate:o,initialName:r,slug:n,hierarchical:l,dialogNameHelpText:s,parentTaxonomyText:m,title:d}=e;const[u,p]=(0,a.useState)(""),[_,f]=(0,a.useState)([]),{searchEntity:h,isResolving:g}=Zi(n),E=(0,ee.useDebounce)((0,a.useCallback)((e=>h(e||"").then(f)),[]),150);(0,a.useEffect)((()=>{E("")}),[]);const{saveEntityRecord:b}=(0,w.useDispatch)("core"),[y,C]=(0,a.useState)(!1),[k,S]=(0,a.useState)(null),[N,T]=(0,a.useState)(r||""),[x,P]=(0,a.useState)(null),A=(0,ee.useInstanceId)(c.BaseControl,"taxonomy_name"),I=(0,ee.useInstanceId)(i.__experimentalSelectTreeControl,"parent-taxonomy-select");return(0,a.createElement)(c.Modal,{title:d,onRequestClose:t,className:"woocommerce-create-new-taxonomy-modal"},(0,a.createElement)("div",{className:"woocommerce-create-new-taxonomy-modal__wrapper"},(0,a.createElement)(c.BaseControl,{id:A,label:(0,v.__)("Name","woocommerce"),help:k||s,className:Q()({"has-error":k})},(0,a.createElement)(c.TextControl,{id:A,value:N,onChange:T})),l&&(0,a.createElement)(i.__experimentalSelectTreeControl,{isLoading:g,label:(0,a.createInterpolateElement)(`${m||(0,v.__)("Parent","woocommerce")} <optional/>`,{optional:(0,a.createElement)("span",{className:"woocommerce-create-new-taxonomy-modal__optional"},(0,v.__)("(optional)","woocommerce"))}),id:I,items:_.map((e=>({label:e.name,value:String(e.id),parent:e.parent>0?String(e.parent):void 0}))),shouldNotRecursivelySelect:!0,selected:x?{value:String(x.id),label:x.name}:void 0,onSelect:e=>e&&P({id:+e.value,name:e.label,parent:e.parent?+e.parent:0}),onRemove:()=>P(null),onInputChange:e=>{E(e),p(e||"")},createValue:u}),(0,a.createElement)("div",{className:"woocommerce-create-new-taxonomy-modal__buttons"},(0,a.createElement)(c.Button,{variant:"tertiary",onClick:t,disabled:y},(0,v.__)("Cancel","woocommerce")),(0,a.createElement)(c.Button,{variant:"primary",disabled:0===N.length||y,isBusy:y,onClick:async()=>{S(null),C(!0);try{const e=await b("taxonomy",n,{name:N,parent:x?x.id:null},{throwOnError:!0});C(!1),o(e)}catch(e){if(C(!1),!e.message)throw S((0,v.__)("Failed to create taxonomy","woocommerce")),e;S(e.message)}}},(0,v.__)("Create","woocommerce")))))},{name:Xi}=ji,Yi={example:{},edit:function(e){let{attributes:t,context:{postType:o}}=e;const r=(0,Ke.useWooBlockProps)(t),{hierarchical:n}=(0,w.useSelect)((e=>e("core").getTaxonomy(t.slug)||{hierarchical:!1})),{label:l,slug:c,property:s,createTitle:m,dialogNameHelpText:d,parentTaxonomyText:u,disabled:p}=t,[_,f]=(0,a.useState)(""),[h,g]=(0,a.useState)([]),{searchEntity:v,isResolving:E}=Zi(c,{fetchParents:n}),b=(0,ee.useDebounce)((0,a.useCallback)((e=>{f(e),v(e||"").then(g)}),[n]),150);(0,a.useEffect)((()=>{b("")}),[]);const[y,C]=it(s,{postType:o,fallbackValue:[]}),k=(y||[]).map((e=>({value:String(e.id),label:e.name}))),[S,N]=(0,a.useState)(!1),T=h.map((e=>({parent:n&&e.parent&&e.parent>0?String(e.parent):void 0,label:e.name,value:String(e.id)})));return(0,a.createElement)("div",{...r},(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.__experimentalSelectTreeControl,{id:(0,ee.useInstanceId)(i.__experimentalSelectTreeControl,"woocommerce-taxonomy-select"),label:l,isLoading:E,disabled:p,multiple:!0,createValue:_,onInputChange:b,shouldNotRecursivelySelect:!0,shouldShowCreateButton:e=>!e||-1===T.findIndex((t=>t.label.toLowerCase()===e.toLowerCase())),onCreateNew:()=>N(!0),items:T,selected:k,onSelect:e=>{Array.isArray(e)?C([...e.map((e=>({id:+e.value,name:e.label,parent:+(e.parent||0)}))),...y||[]]):C([{id:+e.value,name:e.label,parent:+(e.parent||0)},...y||[]])},onRemove:e=>{Array.isArray(e)?C((y||[]).filter((t=>!e.find((e=>e.value===String(t.id)))))):C((y||[]).filter((t=>String(t.id)!==e.value)))}}),S&&(0,a.createElement)(Ji,{slug:c,hierarchical:n,title:m,dialogNameHelpText:d,parentTaxonomyText:u,onCancel:()=>N(!1),onCreate:e=>{N(!1),f(""),C([{id:e.id,name:e.name,parent:e.parent},...y||[]])},initialName:_})))}},Ki=()=>et({name:Xi,metadata:ji,settings:Yi}),Qi=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-text-field","title":"Product text field","category":"woocommerce","description":"A text field for use in the product editor.","keywords":["products","text"],"textdomain":"default","attributes":{"label":{"type":"string","__experimentalRole":"content"},"property":{"type":"string"},"placeholder":{"type":"string"},"help":{"type":"string"},"tooltip":{"type":"string"},"suffix":{"type":"object"},"type":{"type":"object"},"required":{"type":"object"},"pattern":{"type":"object"},"minLength":{"type":"object"},"maxLength":{"type":"object"},"min":{"type":"object"},"max":{"type":"object"}},"supports":{"align":false,"html":false,"multiple":true,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css","usesContext":["postType"]}'),el=(0,a.forwardRef)((function(e,t){let{label:o,help:r,error:n,tooltip:i,className:l,required:s,onChange:m,onBlur:d,...u}=e;return(0,a.createElement)(c.__experimentalInputControl,{...u,ref:t,className:Q()(l,{"has-error":n}),label:(0,a.createElement)(ur,{label:o,required:s,tooltip:i}),required:s,help:n||r,onChange:m,onBlur:d})})),{name:tl,...ol}=Qi,rl={example:{},edit:function(e){let{attributes:t,context:{postType:o}}=e;var r;const n=(0,Ke.useWooBlockProps)(t),{property:l,label:c,placeholder:s,required:m,pattern:d,minLength:u,maxLength:p,min:_,max:f,help:h,tooltip:g,disabled:w,type:E,suffix:b}=t,[y,C]=it(l,{postType:o,fallbackValue:""}),{hasEdit:k}=We(),S=(0,a.useRef)(null),{error:N,validate:T}=tr(l,(async function(){var e,t,o,r,n,a;if(!S.current)return;const i=S.current;let l="";return i.validity.typeMismatch&&(l=null!==(e=null==E?void 0:E.message)&&void 0!==e?e:(0,v.__)("Invalid value for the field.","woocommerce")),i.validity.valueMissing&&(l="string"==typeof m?m:(0,v.__)("This field is required.","woocommerce")),i.validity.patternMismatch&&(l=null!==(t=null==d?void 0:d.message)&&void 0!==t?t:(0,v.__)("Invalid value for the field.","woocommerce")),i.validity.tooShort&&(l=(0,v.sprintf)(null!==(o=null==u?void 0:u.message)&&void 0!==o?o:(0,v.__)("The minimum length of the field is %d","woocommerce"),null==u?void 0:u.value)),i.validity.tooLong&&(l=(0,v.sprintf)(null!==(r=null==p?void 0:p.message)&&void 0!==r?r:(0,v.__)("The maximum length of the field is %d","woocommerce"),null==p?void 0:p.value)),i.validity.rangeUnderflow&&(l=(0,v.sprintf)(null!==(n=null==_?void 0:_.message)&&void 0!==n?n:(0,v.__)("The minimum value of the field is %d","woocommerce"),null==_?void 0:_.value)),i.validity.rangeOverflow&&(l=(0,v.sprintf)(null!==(a=null==f?void 0:f.message)&&void 0!==a?a:(0,v.__)("The maximum value of the field is %d","woocommerce"),null==f?void 0:f.value)),i.setCustomValidity(l),i.validity.valid?void 0:i.validationMessage}),[E,m,d,u,p,_,f]);return(0,a.createElement)("div",{...n},(0,a.createElement)(el,{ref:S,type:null!==(r=null==E?void 0:E.value)&&void 0!==r?r:"text",value:y,disabled:w,label:c,onChange:C,onBlur:()=>{k(l)&&T()},error:N,help:h,placeholder:s,tooltip:g,suffix:function(){if(!b||!y||!S.current)return;const e="url"===S.current.type&&!S.current.validity.typeMismatch;return!0===b&&e?(0,a.createElement)(i.Link,{type:"external",href:y,target:"_blank",rel:"noreferrer",className:"wp-block-woocommerce-product-text-field__suffix-link"},(0,a.createElement)(Ee,{icon:$t,size:20})):"string"==typeof b?b:void 0}(),required:Boolean(m),pattern:null==d?void 0:d.value,minLength:null==u?void 0:u.value,maxLength:null==p?void 0:p.value,min:null==_?void 0:_.value,max:null==f?void 0:f.value}))}},nl=()=>et({name:tl,metadata:ol,settings:rl}),al=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-number-field","title":"Product number control","category":"woocommerce","description":"A reusable number field for the product editor.","keywords":["products","number","input"],"textdomain":"default","attributes":{"label":{"type":"string","__experimentalRole":"content"},"property":{"type":"string"},"suffix":{"type":"string"},"help":{"type":"string"},"placeholder":{"type":"string"},"min":{"type":"number"},"max":{"type":"number"},"tooltip":{"type":"string"},"required":{"type":"boolean","default":false}},"supports":{"align":false,"html":false,"multiple":true,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css"}'),il=e=>{let{value:t,onChange:o,label:r,suffix:n,help:i,error:l,onBlur:s,required:m,tooltip:d,placeholder:u,disabled:p}=e;const _=Po({value:t||"",onChange:o}),f=(0,ee.useInstanceId)(c.BaseControl,"product_number_field");return(0,a.createElement)(c.BaseControl,{className:Q()({"has-error":l}),id:f,label:(0,a.createElement)(ur,{label:r,required:m,tooltip:d}),help:l||i},(0,a.createElement)(c.__experimentalInputControl,{..._,disabled:p,id:f,suffix:n,placeholder:u,onBlur:s}))},{name:ll,...cl}=al,sl={example:{},edit:function(e){let{attributes:t,context:{postType:o}}=e;const r=(0,Ke.useWooBlockProps)(t),{label:n,property:i,suffix:l,placeholder:c,help:s,min:m,max:d,required:u,tooltip:p,disabled:_}=t,[f,h]=it(i,{postType:o,fallbackValue:""}),{hasEdit:g}=We(),{error:w,validate:E}=tr(i,(async function(){return"number"==typeof m&&f&&parseFloat(f)<m?(0,v.sprintf)((0,v.__)("Value must be greater than or equal to %d","woocommerce"),m):"number"==typeof d&&f&&parseFloat(f)>d?(0,v.sprintf)((0,v.__)("Value must be less than or equal to %d","woocommerce"),d):u&&!f?(0,v.__)("This field is required.","woocommerce"):void 0}),[f]);return(0,a.createElement)("div",{...r},(0,a.createElement)(il,{label:n,onChange:h,value:f||"",help:s,suffix:l,placeholder:c,error:w,onBlur:()=>{g(i)&&E()},required:u,tooltip:p,disabled:_}))}},ml=()=>et({name:ll,metadata:cl,settings:sl});function dl(){const e=(0,Xe.__experimentalGetCoreBlocks)().filter((e=>!(0,$.getBlockType)(e.name)));(0,Xe.registerCoreBlocks)(e);const t=Object.values(n).map((e=>e())),o=[...e,...t];return function(){o.forEach((e=>e&&(0,$.unregisterBlockType)(e.name)))}}function ul(e){let{clientId:t}=e;const o=(0,w.useSelect)((e=>{const{getBlockAttributes:o,getBlockName:r}=e("core/block-editor"),n=o(t);if(null==n?void 0:n.icon)return n.icon;const{getBlockType:a}=e("core/blocks"),i=a(r(t));return null==i?void 0:i.icon}),[t]);if(!o)return null;if("object"==typeof o){const{src:e,...t}=o;if(/^<(.)+>$/.test(e)){const o=(0,a.createElement)(a.RawHTML,{"aria-hidden":"true",...t},e);return(0,a.createElement)(ze.BlockIcon,{icon:o,showColors:!0})}if(/^https?:\/\/(.)+/.test(e)){const o=(0,a.createElement)("img",{src:e,alt:"","aria-hidden":"true",...t,height:24,width:24});return(0,a.createElement)(ze.BlockIcon,{icon:o,showColors:!0})}}return(0,a.createElement)(ze.BlockIcon,{icon:o,showColors:!0})}const pl=window.wc.customerEffortScore,_l=e=>/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(String(e).toLowerCase());function fl(e){let{productType:t}=e;const{hideFeedbackBar:o,shouldShowFeedbackBar:r}=Re(),{showCesModal:n,showProductMVPFeedbackModal:l}=(0,pl.useCustomerEffortScoreModal)(),s=()=>({product_type:t});return(0,a.createElement)(a.Fragment,null,r&&(0,a.createElement)("div",{className:"woocommerce-product-mvp-ces-footer"},(0,a.createElement)(i.Pill,null,"Beta"),(0,a.createElement)("div",{className:"woocommerce-product-mvp-ces-footer__message"},(0,a.createInterpolateElement)((0,v.__)("How is your experience with the new product form? <span><shareButton>Share feedback</shareButton> or <turnOffButton>turn it off</turnOffButton></span>","woocommerce"),{span:(0,a.createElement)("span",{className:"woocommerce-product-mvp-ces-footer__message-buttons"}),shareButton:(0,a.createElement)(c.Button,{variant:"link",onClick:()=>{(0,I.recordEvent)("product_editor_feedback_bar_share_feedback_click",{...s()}),n({action:"product_editor",showDescription:!1,title:(0,v.__)("What do you think of the new product form?","woocommerce"),firstQuestion:(0,v.__)("The product editing screen is easy to use","woocommerce"),secondQuestion:(0,v.__)("Product form is easy to use","woocommerce"),onsubmitLabel:(0,v.__)("Thanks for the feedback — we'll put it to good use!","woocommerce"),shouldShowComments:()=>!1,getExtraFieldsToBeShown:(e,t,o)=>(0,a.createElement)(a.Fragment,null,(0,a.createElement)(c.BaseControl,{id:"feedback_additional_thoughts",className:"woocommerce-product-feedback__additional-thoughts",label:(0,a.createInterpolateElement)((0,v.__)("ADDITIONAL THOUGHTS <optional />","woocommerce"),{optional:(0,a.createElement)("span",{className:"woocommerce-product-feedback__optional-input"},(0,v.__)("(OPTIONAL)","woocommerce"))})},(0,a.createElement)(c.TextareaControl,{value:e.additional_thoughts||"",onChange:o=>t({...e,additional_thoughts:o}),help:(null==o?void 0:o.additional_thoughts)||""})),(0,a.createElement)(c.BaseControl,{id:"feedback_email",className:"woocommerce-product-feedback__email",label:(0,a.createInterpolateElement)((0,v.__)("YOUR EMAIL ADDRESS <optional />","woocommerce"),{optional:(0,a.createElement)("span",{className:"woocommerce-product-feedback__optional-input"},(0,v.__)("(OPTIONAL)","woocommerce"))})},(0,a.createElement)(c.TextControl,{value:e.email||"",onChange:o=>t({...e,email:o}),help:(null==o?void 0:o.email)||""}),(0,a.createElement)("span",null,(0,v.__)("In case you want to participate in further discussion and future user research.","woocommerce")))),validateExtraFields:e=>{let{email:t="",additional_thoughts:o=""}=e;const r={};return t.length>0&&!_l(t)&&(r.email=(0,v.__)("Please enter a valid email address.","woocommerce")),(null==o?void 0:o.length)>500&&(r.additional_thoughts=(0,v.__)("Please enter no more than 500 characters.","woocommerce")),r}},{},{type:"snackbar"})}}),turnOffButton:(0,a.createElement)(c.Button,{onClick:()=>{(0,I.recordEvent)("product_editor_feedback_bar_turnoff_editor_click",{...s()}),o(),l()},variant:"link"})})),(0,a.createElement)(c.Button,{className:"woocommerce-product-mvp-ces-footer__close-button",icon:eo,label:(0,v.__)("Hide this message","woocommerce"),onClick:()=>{(0,I.recordEvent)("product_editor_feedback_bar_dismiss_click",{...s()}),o()}})))}var hl=o(7862),gl=o.n(hl);const wl=window.wc.experimental;function vl(e){let{recordScoreCallback:t,onCloseModal:o}=e;const[r,n]=(0,a.useState)(!1),[i,l]=(0,a.useState)(!1),[s,m]=(0,a.useState)(!1),[d,u]=(0,a.useState)(!1),[p,_]=(0,a.useState)(!1),f=[{key:"missing-features",label:(0,v.__)("Missing features","woocommerce"),checked:r,onChange:n},{key:"missing-plugins",label:(0,v.__)("Missing plugins","woocommerce"),checked:i,onChange:l},{key:"difficult-to-use",label:(0,v.__)("It's difficult to use","woocommerce"),checked:s,onChange:m},{key:"slow-buggy-or-broken",label:(0,v.__)("It's slow, buggy, or broken","woocommerce"),checked:d,onChange:u},{key:"other",label:(0,v.__)("Other (describe below)","woocommerce"),checked:p,onChange:_}],[h,g]=(0,a.useState)(""),[E,b]=(0,a.useState)(""),y=f.filter((e=>e.checked)).map((e=>e.key)),{createSuccessNotice:C}=(0,w.useDispatch)("core/notices"),k=(0,a.createElement)("span",{className:"woocommerce-product-mvp-feedback-modal__optional"},(0,v.__)("(optional)","woocommerce"));return(0,a.createElement)(pl.FeedbackModal,{title:(0,v.__)("Thanks for trying out the new product form!","woocommerce"),onSubmit:()=>{t(y,h,E),C((0,v.__)("Thanks for the feedback — we'll put it to good use!","woocommerce"))},onModalClose:o,isSubmitButtonDisabled:!y.length,submitButtonLabel:(0,v.__)("Send","woocommerce"),cancelButtonLabel:(0,v.__)("Skip","woocommerce"),className:"woocommerce-product-mvp-feedback-modal"},(0,a.createElement)(a.Fragment,null,(0,a.createElement)(wl.Text,{variant:"subtitle.small",as:"p",weight:"600",size:"14",lineHeight:"20px"}),(0,a.createElement)("fieldset",{className:"woocommerce-product-mvp-feedback-modal__reason"},(0,a.createElement)("legend",null,(0,v.__)("What made you turn off the new product form?","woocommerce")),(0,a.createElement)("div",{className:"woocommerce-product-mvp-feedback-modal__checkboxes"},f.map(((e,t)=>(0,a.createElement)(c.CheckboxControl,{key:t,label:e.label,name:e.key,checked:e.checked,onChange:e.onChange}))))),(0,a.createElement)("div",{className:"woocommerce-product-mvp-feedback-modal__comments"},(0,a.createElement)(c.TextareaControl,{label:(0,a.createInterpolateElement)((0,v.__)("Additional thoughts <optional/>","woocommerce"),{optional:k}),value:h,onChange:e=>g(e),rows:5})),(0,a.createElement)("div",{className:"woocommerce-product-mvp-feedback-modal__email"},(0,a.createElement)(c.TextControl,{label:(0,a.createInterpolateElement)((0,v.__)("Your email address <optional/>","woocommerce"),{optional:k}),value:E,onChange:e=>b(e),rows:5,help:(0,v.__)("In case you want to participate in further discussion and future user research.","woocommerce")}))))}vl.propTypes={recordScoreCallback:gl().func.isRequired,onCloseModal:gl().func};const El=e=>{let{productId:t}=e;const{values:o}=(0,i.useFormContext)(),{hideProductMVPFeedbackModal:r}=(0,w.useDispatch)(pl.STORE_KEY),{isProductMVPModalVisible:n}=(0,w.useSelect)((e=>{const{isProductMVPFeedbackModalVisible:t}=e(pl.STORE_KEY);return{isProductMVPModalVisible:t()}})),l=null!=t?t:null==o?void 0:o.id,{_feature_nonce:c}=(0,er.getSetting)("admin",{}),s=l?(0,er.getAdminLink)(`post.php?post=${l}&action=edit&product_block_editor=0&_feature_nonce=${c}`):(0,er.getAdminLink)(`post-new.php?post_type=product&product_block_editor=0&_feature_nonce=${c}`);return n?(0,a.createElement)(vl,{recordScoreCallback:(e,t,o)=>{(0,I.recordEvent)("product_mvp_feedback",{action:"disable",checked:e,comments:t||"",email:o}),r(),window.location.href=`${s}&new-product-experience-disabled=true`},onCloseModal:()=>{(0,I.recordEvent)("product_mvp_feedback",{action:"disable",checked:"",comments:""}),r(),window.location.href=s}}):null},bl=(0,a.createElement)(oe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(oe.Path,{d:"M14.3 6.7l-1.1 1.1 4 4H4v1.5h13.3l-4.1 4.4 1.1 1.1 5.8-6.3z"}));function yl(e){let{position:t}=e;return(0,a.createElement)(c.Button,{"data-testid":"woocommerce-product-variation-switcher-footer-placeholder",className:"woocommerce-product-variation-switcher-footer__button is-placeholder",disabled:!0},"left"===t&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(Ee,{icon:Pt,size:16,className:"woocommerce-product-variation-switcher-footer__arrow"}),(0,a.createElement)("div",{className:"woocommerce-product-variation-switcher-footer__product-image"})),(0,a.createElement)("div",{className:"woocommerce-product-variation-switcher-footer__item-label"}),"right"===t&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)("div",{className:"woocommerce-product-variation-switcher-footer__product-image"}),(0,a.createElement)(Ee,{icon:bl,size:16,className:"woocommerce-product-variation-switcher-footer__arrow"})))}function Cl(e){let{className:t}=e;return(0,a.createElement)("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:{borderRadius:"3px",background:"var(--wp-gray-gray-0, #F6F7F7)"}},(0,a.createElement)("g",{clipPath:"url(#clip0_7819_478402)"},(0,a.createElement)("path",{d:"M22.9869 7.07134C19.8275 7.07134 17.9977 7.62377 16.9543 8.85386C17.6297 6.47326 18.8776 4.68605 21.1572 3.06738C18.4558 3.41616 16.8877 4.44261 16.1282 5.91147C15.3688 4.44378 13.8007 3.41733 11.0993 3.06738C13.3789 4.68605 14.6268 6.47209 15.3021 8.85386C14.2587 7.62377 12.429 7.07134 9.26953 7.07134C13.0354 8.83982 14.4761 10.263 15.7029 12.8133H16.5524C17.7792 10.263 19.2211 8.83982 22.9858 7.07134H22.9869Z",fill:"#BBBBBB"}),(0,a.createElement)("path",{d:"M18.6464 34.8438C19.8718 34.3897 24.3648 33.3925 24.3648 29.0402C24.3648 26.4551 22.0269 24.5052 19.3727 24.0527C20.5536 23.6669 22.278 21.9488 22.278 20.0211C22.278 17.5377 20.0307 16.5469 18.1934 16.1626C18.1934 15.5957 20.2357 12.6709 20.2357 12.6709H11.7932C11.7932 12.6709 13.8355 15.5957 13.8355 16.1626C11.9966 16.5485 9.75086 17.5377 9.75086 20.0211C9.75086 21.9488 11.4753 23.6669 12.6562 24.0527C10.0004 24.5068 7.66406 26.4567 7.66406 29.0402C7.66406 33.3941 12.1571 34.3913 13.3825 34.8438C10.4772 35.1154 9.02453 36.2491 8.79885 37.1558H23.2316C23.0043 36.2491 21.5517 35.1154 18.648 34.8438H18.6464Z",fill:"#DDDDDD"})),(0,a.createElement)("defs",null,(0,a.createElement)("clipPath",{id:"clip0_7819_478402"},(0,a.createElement)("rect",{width:"34.0881",height:"25.9994",fill:"white",transform:"translate(-1)"}))))}function kl(e){let{variationId:t,parentId:o,parentProductType:r}=e;const{invalidateResolution:n}=(0,w.useDispatch)("core"),{invalidateResolutionForStoreSelector:a}=(0,w.useDispatch)(b.EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME),i=(0,w.useSelect)((e=>{if(void 0===o)return{};const{getEntityRecord:n}=e("core"),a=n("postType",r||"product",o);if(void 0!==t&&a&&a.variations){const e=a.variations.indexOf(t),o=e>0?e-1:null,r=e!==a.variations.length-1?e+1:null;return{activeVariationIndex:e,nextVariationIndex:r,previousVariationIndex:o,numberOfVariations:a.variations.length,previousVariationId:null!==o?a.variations[o]:null,nextVariationId:null!==r?a.variations[r]:null}}return{}}),[t,o]);function l(e){(0,ye.navigateTo)({url:(0,ye.getNewPath)({},`/product/${o}/variation/${e}`)})}return{...i,invalidateVariationList:function(){n("getEntityRecord",["postType",r||"product",o]),a("getProductVariations"),a("getProductVariationsTotalCount")},goToVariation:l,goToNextVariation:function(){return void 0!==i.nextVariationId&&null!==i.nextVariationId&&(l(i.nextVariationId),!0)},goToPreviousVariation:function(){return void 0!==i.previousVariationId&&null!==i.previousVariationId&&(l(i.previousVariationId),!0)}}}function Sl(e){let{parentProductType:t,variationId:o,parentId:r}=e;const{numberOfVariations:n,nextVariationId:i,previousVariationId:l,activeVariationIndex:s,nextVariationIndex:m,previousVariationIndex:d,goToNextVariation:u,goToPreviousVariation:p}=kl({variationId:o,parentId:r,parentProductType:t}),{previousVariation:_,nextVariation:f}=(0,w.useSelect)((e=>{const{getEntityRecord:t}=e("core");return n&&n>0?{previousVariation:null!==l&&t("postType","product_variation",l),nextVariation:null!==i&&t("postType","product_variation",i)}:{}}),[i,l,n]);return!n||n<2?null:(0,a.createElement)("div",{className:"woocommerce-product-variation-switcher-footer"},_&&(0,a.createElement)(c.Button,{className:"woocommerce-product-variation-switcher-footer__button woocommerce-product-variation-switcher-footer__button-previous",label:(0,v.__)("Previous","woocommerce"),onClick:function(){_&&((0,I.recordEvent)("product_variation_switch_previous",{variation_length:n,variation_id:null==_?void 0:_.id,variation_index:s,previous_variation_index:d}),p())}},(0,a.createElement)(Ee,{icon:Pt,size:16}),_.image?(0,a.createElement)("img",{alt:_.image.alt||"",src:_.image.src,className:"woocommerce-product-variation-switcher-footer__product-image"}):(0,a.createElement)(Cl,{className:"woocommerce-product-variation-switcher-footer__product-image"}),_.name),!_&&null!==l&&(0,a.createElement)(yl,{position:"left"}),f&&(0,a.createElement)(c.Button,{className:"woocommerce-product-variation-switcher-footer__button woocommerce-product-variation-switcher-footer__button-next",label:(0,v.__)("Next","woocommerce"),onClick:function(){f&&((0,I.recordEvent)("product_variation_switch_next",{variation_length:n,variation_id:null==f?void 0:f.id,variation_index:s,next_variation_index:m}),u())}},f.name,f.image?(0,a.createElement)("img",{alt:f.image.alt||"",src:f.image.src,className:"woocommerce-product-variation-switcher-footer__product-image"}):(0,a.createElement)(Cl,{className:"woocommerce-product-variation-switcher-footer__product-image"}),(0,a.createElement)(Ee,{icon:bl,size:16})),!f&&null!==i&&(0,a.createElement)(yl,{position:"right"}))}function Nl(){return(0,a.createElement)("div",{className:"woocommerce-product-page-skeleton","aria-hidden":"true"},(0,a.createElement)("div",{className:"woocommerce-product-page-skeleton__header"},(0,a.createElement)("div",{className:"woocommerce-product-page-skeleton__header-row"},(0,a.createElement)("div",null),(0,a.createElement)("div",{className:"woocommerce-product-page-skeleton__header-title"}),(0,a.createElement)("div",{className:"woocommerce-product-page-skeleton__header-actions"},(0,a.createElement)("div",{className:"woocommerce-product-page-skeleton__header-actions-other"}),(0,a.createElement)("div",{className:"woocommerce-product-page-skeleton__header-actions-main"}),(0,a.createElement)("div",{className:"woocommerce-product-page-skeleton__header-actions-config"}))),(0,a.createElement)("div",{className:"woocommerce-product-page-skeleton__header-row"},(0,a.createElement)("div",{className:"woocommerce-product-page-skeleton__tabs"},Array(7).fill(0).map(((e,t)=>(0,a.createElement)("div",{key:t,className:"woocommerce-product-page-skeleton__tab-item"})))))),(0,a.createElement)("div",{className:"woocommerce-product-page-skeleton__body"},(0,a.createElement)("div",{className:"woocommerce-product-page-skeleton__body-tabs-content"},(0,a.createElement)("div",{className:"woocommerce-product-page-skeleton__block-title"}),(0,a.createElement)("div",{className:"woocommerce-product-page-skeleton__block-label"}),(0,a.createElement)("div",{className:"woocommerce-product-page-skeleton__block-input"}),(0,a.createElement)("div",{className:"woocommerce-product-page-skeleton__block-label"}),(0,a.createElement)("div",{className:"woocommerce-product-page-skeleton__block-textarea"}),(0,a.createElement)("div",{className:"woocommerce-product-page-skeleton__block-label"}),(0,a.createElement)("div",{className:"woocommerce-product-page-skeleton__block-textarea"}),(0,a.createElement)("div",{className:"woocommerce-product-page-skeleton__block-separator"}),(0,a.createElement)("div",{className:"woocommerce-product-page-skeleton__block-title"}),(0,a.createElement)("div",{className:"woocommerce-product-page-skeleton__block-label"}),(0,a.createElement)("div",{className:"woocommerce-product-page-skeleton__block-input"}),(0,a.createElement)("div",{className:"woocommerce-product-page-skeleton__block-label"}),(0,a.createElement)("div",{className:"woocommerce-product-page-skeleton__block-textarea"}),(0,a.createElement)("div",{className:"woocommerce-product-page-skeleton__block-label"}),(0,a.createElement)("div",{className:"woocommerce-product-page-skeleton__block-textarea"}))))}const Tl=e=>{const{symbol:t,symbolPosition:o}=e;return{[o.includes("left")?"prefix":"suffix"]:t}};var xl;!function(e){e.unsaved="unsaved",e.draft="draft",e.instock="instock",e.outofstock="outofstock"}(xl||(xl={}));const Pl={[xl.unsaved]:(0,v.__)("Unsaved","woocommerce"),[xl.draft]:(0,v.__)("Draft","woocommerce"),[xl.instock]:(0,v.__)("In stock","woocommerce"),[xl.outofstock]:(0,v.__)("Out of stock","woocommerce")},Al=e=>e?"draft"===e.status?xl.draft:"instock"===e.stock_status?xl.instock:xl.outofstock:xl.unsaved,Il=(e,t,o)=>(null==e?void 0:e.length)?e:o&&o!==D?o:"simple"===t?(0,v.__)("New standard product","woocommerce"):(0,v.__)("New product","woocommerce"),Ml=e=>{var t;return(null===(t=null==e?void 0:e.attributes)||void 0===t?void 0:t.length)?e.attributes.map((e=>e.option)).join(", "):"#"+e.id},Rl=e=>{const t=Ml(e);return t.length>32?t.substring(0,32)+"…":t};function Ll(e){if(ie()("initBlock()",{alternative:"registerProductEditorBlockType()"}),e)return et(e)}const Ol=window.wp.apiFetch;var Dl=o.n(Ol);const Bl=[{matcher:new RegExp("^/wp/v2/product(?!_)"),getReplaceString:()=>"/wc/v3/products"},{matcher:new RegExp("^/wp/v2/product_variation"),replacement:"/wc/v3/products/0/variations",getReplaceString:()=>{const e=(0,ye.getQuery)(),t=new RegExp("/product/([0-9]+)/variation/([0-9]+)"),o=(e.path||"").match(t);return o&&3===o.length?"/wc/v3/products/"+o[1]+"/variations":"/wc/v3/products/0/variations"}}],Fl=()=>{Dl().use(((e,t)=>{if(e.path&&(()=>{const e=(0,ye.getQuery)();return"wc-admin"===(null==e?void 0:e.page)&&["/add-product","/product/"].some((t=>{var o;return null===(o=null==e?void 0:e.path)||void 0===o?void 0:o.startsWith(t)}))})())for(const{matcher:t,getReplaceString:o}of Bl)if(t.test(e.path)){e.path=e.path.replace(t,o());break}return t(e)}))};function Vl(e){return`${e.id}:${e.menu_order}`}function Hl(e){let{key:t}=e;return"string"==typeof t?Number.parseInt(t.split(":")[1],10):Number.MAX_SAFE_INTEGER}function Ul(e,t,o){let{variationsOrder:r}=o;if(!r||!r[t])return e;const n=r[t];return[...e].sort(((e,t)=>n[e.id]&&n[t.id]?n[e.id]-n[t.id]:0))}const zl=e=>{let{variations:t,currentPage:o}=e;const{setValue:r,values:n}=(0,i.useFormContext)();return{sortedVariations:Ul(t,o,n),getVariationKey:Vl,onOrderChange:function(e){const t=Math.min(...e.map(Hl));r("variationsOrder",{...n.variationsOrder,[o]:e.reduce(((e,o,r)=>({...e,[function(e){let{key:t}=e;return"string"==typeof t?Number.parseInt(t.split(":")[0],10):0}(o)]:t+r})),{})})}}}})(),(window.wc=window.wc||{}).productEditor=r})();
[-] style-rtl.css
[edit]
[+]
..
[-] index.asset.php
[edit]
[+]
blocks
[-] style.css
[edit]
[-] index.js
[edit]
[-] index.js.LICENSE.txt
[edit]