1 line
No EOL
24 KiB
JavaScript
1 line
No EOL
24 KiB
JavaScript
(()=>{var e={4184:(e,t)=>{var n;!function(){"use strict";var o={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var i=typeof n;if("string"===i||"number"===i)e.push(n);else if(Array.isArray(n)){if(n.length){var s=r.apply(null,n);s&&e.push(s)}}else if("object"===i)if(n.toString===Object.prototype.toString)for(var c in n)o.call(n,c)&&n[c]&&e.push(c);else e.push(n.toString())}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(n=function(){return r}.apply(t,[]))||(e.exports=n)}()},5482:()=>{},1365:()=>{},129:()=>{}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=window.React,t=window.wc.wcBlocksData,o=window.wc.__experimentalInteractivity,r=window.wp.data,i=window.wp.element;var s=n(4184),c=n.n(s);const a=window.wp.i18n,l=(0,i.forwardRef)((function({icon:e,size:t=24,...n},o){return(0,i.cloneElement)(e,{width:t,height:t,...n,ref:o})})),u=window.wp.primitives,m=(0,e.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(u.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"}));n(1365);const d=(0,e.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(u.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})),p=(0,e.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(u.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"})),f=(0,e.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(u.Path,{fillRule:"evenodd",d:"M6.863 13.644L5 13.25h-.5a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5H5L18 6.5h2V16h-2l-3.854-.815.026.008a3.75 3.75 0 01-7.31-1.549zm1.477.313a2.251 2.251 0 004.356.921l-4.356-.921zm-2.84-3.28L18.157 8h.343v6.5h-.343L5.5 11.823v-1.146z",clipRule:"evenodd"})),h=e=>{switch(e){case"success":case"warning":case"info":case"default":return"polite";default:return"assertive"}},w=e=>{switch(e){case"success":return d;case"warning":case"info":case"error":return p;default:return f}};function g(){return g=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},g.apply(this,arguments)}const v=window.lodash,E=window.wp.deprecated;var b=n.n(E);const y=window.wp.compose,x=window.wp.dom,C=(0,i.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,i.createElement)(u.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 S(e,t,n){const{defaultView:o}=t,{frameElement:r}=o;if(!r||t===n.ownerDocument)return e;const i=r.getBoundingClientRect();return new o.DOMRect(e.left+i.left,e.top+i.top,e.width,e.height)}let _=0;function L(e){const t=document.scrollingElement||document.body;e&&(_=t.scrollTop);const n=e?"add":"remove";t.classList[n]("lockscroll"),document.documentElement.classList[n]("lockscroll"),e||(t.scrollTop=_)}let T=0;function R(){return(0,i.useEffect)((()=>(0===T&&L(!0),++T,()=>{1===T&&L(!1),--T})),[]),null}window.wp.warning;const I=(0,i.createContext)({slots:{},fills:{},registerSlot:()=>{"undefined"!=typeof process&&process.env},updateSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{}});function O(e){const t=(0,i.useContext)(I),n=t.slots[e]||{},o=t.fills[e],r=(0,i.useMemo)((()=>o||[]),[o]);return{...n,updateSlot:(0,i.useCallback)((n=>{t.updateSlot(e,n)}),[e,t.updateSlot]),unregisterSlot:(0,i.useCallback)((n=>{t.unregisterSlot(e,n)}),[e,t.unregisterSlot]),fills:r,registerFill:(0,i.useCallback)((n=>{t.registerFill(e,n)}),[e,t.registerFill]),unregisterFill:(0,i.useCallback)((n=>{t.unregisterFill(e,n)}),[e,t.unregisterFill])}}const D=(0,i.createContext)({registerSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{},getSlot:()=>{},getFills:()=>{},subscribe:()=>{}});function N({name:e,children:t,registerFill:n,unregisterFill:o}){const r=(e=>{const{getSlot:t,subscribe:n}=(0,i.useContext)(D),[o,r]=(0,i.useState)(t(e));return(0,i.useEffect)((()=>(r(t(e)),n((()=>{r(t(e))})))),[e]),o})(e),s=(0,i.useRef)({name:e,children:t});return(0,i.useLayoutEffect)((()=>(n(e,s.current),()=>o(e,s.current))),[]),(0,i.useLayoutEffect)((()=>{s.current.children=t,r&&r.forceUpdate()}),[t]),(0,i.useLayoutEffect)((()=>{e!==s.current.name&&(o(s.current.name,s.current),s.current.name=e,n(e,s.current))}),[e]),r&&r.node?((0,v.isFunction)(t)&&(t=t(r.props.fillProps)),(0,i.createPortal)(t,r.node)):null}const F=e=>(0,i.createElement)(D.Consumer,null,(({registerFill:t,unregisterFill:n})=>(0,i.createElement)(N,g({},e,{registerFill:t,unregisterFill:n}))));class k extends i.Component{constructor(){super(...arguments),this.isUnmounted=!1,this.bindNode=this.bindNode.bind(this)}componentDidMount(){const{registerSlot:e}=this.props;e(this.props.name,this)}componentWillUnmount(){const{unregisterSlot:e}=this.props;this.isUnmounted=!0,e(this.props.name,this)}componentDidUpdate(e){const{name:t,unregisterSlot:n,registerSlot:o}=this.props;e.name!==t&&(n(e.name),o(t,this))}bindNode(e){this.node=e}forceUpdate(){this.isUnmounted||super.forceUpdate()}render(){const{children:e,name:t,fillProps:n={},getFills:o}=this.props,r=(0,v.map)(o(t,this),(e=>{const t=(0,v.isFunction)(e.children)?e.children(n):e.children;return i.Children.map(t,((e,t)=>{if(!e||(0,v.isString)(e))return e;const n=e.key||t;return(0,i.cloneElement)(e,{key:n})}))})).filter((0,v.negate)(i.isEmptyElement));return(0,i.createElement)(i.Fragment,null,(0,v.isFunction)(e)?e(r):r)}}const M=e=>(0,i.createElement)(D.Consumer,null,(({registerSlot:t,unregisterSlot:n,getFills:o})=>(0,i.createElement)(k,g({},e,{registerSlot:t,unregisterSlot:n,getFills:o}))));function A(){const[,e]=(0,i.useState)({}),t=(0,i.useRef)(!0);return(0,i.useEffect)((()=>()=>{t.current=!1}),[]),()=>{t.current&&e({})}}function P({name:e,children:t}){const n=O(e),o=(0,i.useRef)({rerender:A()});return(0,i.useEffect)((()=>(n.registerFill(o),()=>{n.unregisterFill(o)})),[n.registerFill,n.unregisterFill]),n.ref&&n.ref.current?("function"==typeof t&&(t=t(n.fillProps)),(0,i.createPortal)(t,n.ref.current)):null}const B=(0,i.forwardRef)((function({name:e,fillProps:t={},as:n="div",...o},r){const s=(0,i.useContext)(I),c=(0,i.useRef)();return(0,i.useLayoutEffect)((()=>(s.registerSlot(e,c,t),()=>{s.unregisterSlot(e,c)})),[s.registerSlot,s.unregisterSlot,e]),(0,i.useLayoutEffect)((()=>{s.updateSlot(e,t)})),(0,i.createElement)(n,g({ref:(0,y.useMergeRefs)([r,c])},o))}));function V(e){return(0,i.createElement)(i.Fragment,null,(0,i.createElement)(F,e),(0,i.createElement)(P,e))}const W=(0,i.forwardRef)((({bubblesVirtually:e,...t},n)=>e?(0,i.createElement)(B,g({},t,{ref:n})):(0,i.createElement)(M,t)));function z(e){return"appear"===e?"top":"left"}const H="Popover";function U(e,t){const{paddingTop:n,paddingBottom:o,paddingLeft:r,paddingRight:i}=(s=t).ownerDocument.defaultView.getComputedStyle(s);var s;const c=n?parseInt(n,10):0,a=o?parseInt(o,10):0,l=r?parseInt(r,10):0,u=i?parseInt(i,10):0;return{x:e.left+l,y:e.top+c,width:e.width-l-u,height:e.height-c-a,left:e.left+l,right:e.right-u,top:e.top+c,bottom:e.bottom-a}}function j(e,t,n){n?e.getAttribute(t)!==n&&e.setAttribute(t,n):e.hasAttribute(t)&&e.removeAttribute(t)}function q(e,t,n=""){e.style[t]!==n&&(e.style[t]=n)}function G(e,t,n){n?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}const K=(0,i.forwardRef)((({headerTitle:e,onClose:t,children:n,className:o,noArrow:r=!0,isAlternate:s,position:l="bottom right",range:u,focusOnMount:m="firstElement",anchorRef:d,shouldAnchorIncludePadding:p,anchorRect:f,getAnchorRect:h,expandOnMobile:w,animate:v=!0,onClickOutside:E,onFocusOutside:_,__unstableStickyBoundaryElement:L,__unstableSlotName:T=H,__unstableObserveElement:I,__unstableBoundaryParent:D,__unstableForcePosition:N,__unstableForceXAlignment:F,...k},M)=>{const A=(0,i.useRef)(null),P=(0,i.useRef)(null),B=(0,i.useRef)(),W=(0,y.useViewportMatch)("medium","<"),[K,Y]=(0,i.useState)(),X=O(T),J=w&&W,[Q,Z]=(0,y.useResizeObserver)();r=J||r,(0,i.useLayoutEffect)((()=>{if(J)return G(B.current,"is-without-arrow",r),G(B.current,"is-alternate",s),j(B.current,"data-x-axis"),j(B.current,"data-y-axis"),q(B.current,"top"),q(B.current,"left"),q(P.current,"maxHeight"),void q(P.current,"maxWidth");const e=()=>{if(!B.current||!P.current)return;let e=function(e,t,n,o=!1,r,i){if(t)return t;if(n){if(!e.current)return;const t=n(e.current);return S(t,t.ownerDocument||e.current.ownerDocument,i)}if(!1!==o){if(!(o&&window.Range&&window.Element&&window.DOMRect))return;if("function"==typeof(null==o?void 0:o.cloneRange))return S((0,x.getRectangleFromRange)(o),o.endContainer.ownerDocument,i);if("function"==typeof(null==o?void 0:o.getBoundingClientRect)){const e=S(o.getBoundingClientRect(),o.ownerDocument,i);return r?e:U(e,o)}const{top:e,bottom:t}=o,n=e.getBoundingClientRect(),s=t.getBoundingClientRect(),c=S(new window.DOMRect(n.left,n.top,n.width,s.bottom-n.top),e.ownerDocument,i);return r?c:U(c,o)}if(!e.current)return;const{parentNode:s}=e.current,c=s.getBoundingClientRect();return r?c:U(c,s)}(A,f,h,d,p,B.current);if(!e)return;const{offsetParent:t,ownerDocument:n}=B.current;let o,i=0;if(t&&t!==n.body){const n=t.getBoundingClientRect();i=n.top,e=new window.DOMRect(e.left-n.left,e.top-n.top,e.width,e.height)}var c;D&&(o=null===(c=B.current.closest(".popover-slot"))||void 0===c?void 0:c.parentNode);const u=Z.height?Z:P.current.getBoundingClientRect(),{popoverTop:m,popoverLeft:w,xAxis:g,yAxis:v,contentHeight:E,contentWidth:b}=function(e,t,n="top",o,r,i,s,c,l){const[u,m="center",d]=n.split(" "),p=function(e,t,n,o,r,i,s,c){const{height:a}=t;if(r){const t=r.getBoundingClientRect().top+a-s;if(e.top<=t)return{yAxis:n,popoverTop:Math.min(e.bottom,t)}}let l=e.top+e.height/2;"bottom"===o?l=e.bottom:"top"===o&&(l=e.top);const u={popoverTop:l,contentHeight:(l-a/2>0?a/2:l)+(l+a/2>window.innerHeight?window.innerHeight-l:a/2)},m={popoverTop:e.top,contentHeight:e.top-10-a>0?a:e.top-10},d={popoverTop:e.bottom,contentHeight:e.bottom+10+a>window.innerHeight?window.innerHeight-10-e.bottom:a};let p,f=n,h=null;if(!r&&!c)if("middle"===n&&u.contentHeight===a)f="middle";else if("top"===n&&m.contentHeight===a)f="top";else if("bottom"===n&&d.contentHeight===a)f="bottom";else{f=m.contentHeight>d.contentHeight?"top":"bottom";const e="top"===f?m.contentHeight:d.contentHeight;h=e!==a?e:null}return p="middle"===f?u.popoverTop:"top"===f?m.popoverTop:d.popoverTop,{yAxis:f,popoverTop:p,contentHeight:h}}(e,t,u,d,o,0,i,c),f=function(e,t,n,o,r,i,s,c,l){const{width:u}=t;"left"===n&&(0,a.isRTL)()?n="right":"right"===n&&(0,a.isRTL)()&&(n="left"),"left"===o&&(0,a.isRTL)()?o="right":"right"===o&&(0,a.isRTL)()&&(o="left");const m=Math.round(e.left+e.width/2),d={popoverLeft:m,contentWidth:(m-u/2>0?u/2:m)+(m+u/2>window.innerWidth?window.innerWidth-m:u/2)};let p=e.left;"right"===o?p=e.right:"middle"===i||l||(p=m);let f=e.right;"left"===o?f=e.left:"middle"===i||l||(f=m);const h={popoverLeft:p,contentWidth:p-u>0?u:p},w={popoverLeft:f,contentWidth:f+u>window.innerWidth?window.innerWidth-f:u};let g,v=n,E=null;if(!r&&!c)if("center"===n&&d.contentWidth===u)v="center";else if("left"===n&&h.contentWidth===u)v="left";else if("right"===n&&w.contentWidth===u)v="right";else{v=h.contentWidth>w.contentWidth?"left":"right";const e="left"===v?h.contentWidth:w.contentWidth;u>window.innerWidth&&(E=window.innerWidth),e!==u&&(v="center",d.popoverLeft=window.innerWidth/2)}if(g="center"===v?d.popoverLeft:"left"===v?h.popoverLeft:w.popoverLeft,s){const e=s.getBoundingClientRect();g=Math.min(g,e.right-u),(0,a.isRTL)()||(g=Math.max(g,0))}return{xAxis:v,popoverLeft:g,contentWidth:E}}(e,t,m,d,o,p.yAxis,s,c,l);return{...f,...p}}(e,u,l,L,B.current,i,o,N,F);"number"==typeof m&&"number"==typeof w&&(q(B.current,"top",m+"px"),q(B.current,"left",w+"px")),G(B.current,"is-without-arrow",r||"center"===g&&"middle"===v),G(B.current,"is-alternate",s),j(B.current,"data-x-axis",g),j(B.current,"data-y-axis",v),q(P.current,"maxHeight","number"==typeof E?E+"px":""),q(P.current,"maxWidth","number"==typeof b?b+"px":""),Y(({left:"right",right:"left"}[g]||"center")+" "+({top:"bottom",bottom:"top"}[v]||"middle"))};e();const{ownerDocument:t}=B.current,{defaultView:n}=t,o=n.setInterval(e,500);let i;const c=()=>{n.cancelAnimationFrame(i),i=n.requestAnimationFrame(e)};n.addEventListener("click",c),n.addEventListener("resize",e),n.addEventListener("scroll",e,!0);const u=function(e){if(e)return e.endContainer?e.endContainer.ownerDocument:e.top?e.top.ownerDocument:e.ownerDocument}(d);let m;return u&&u!==t&&(u.defaultView.addEventListener("resize",e),u.defaultView.addEventListener("scroll",e,!0)),I&&(m=new n.MutationObserver(e),m.observe(I,{attributes:!0})),()=>{n.clearInterval(o),n.removeEventListener("resize",e),n.removeEventListener("scroll",e,!0),n.removeEventListener("click",c),n.cancelAnimationFrame(i),u&&u!==t&&(u.defaultView.removeEventListener("resize",e),u.defaultView.removeEventListener("scroll",e,!0)),m&&m.disconnect()}}),[J,f,h,d,p,l,Z,L,I,D]);const $=(e,n)=>{if("focus-outside"===e&&_)_(n);else if("focus-outside"===e&&E){const e=new window.MouseEvent("click");Object.defineProperty(e,"target",{get:()=>n.relatedTarget}),b()("Popover onClickOutside prop",{since:"5.3",alternative:"onFocusOutside"}),E(e)}else t&&t()},[ee,te]=(0,y.__experimentalUseDialog)({focusOnMount:m,__unstableOnClose:$,onClose:$}),ne=(0,y.useMergeRefs)([B,ee,M]),oe=Boolean(v&&K)&&function(e){if("loading"===e.type)return c()("components-animate__loading");const{type:t,origin:n=z(t)}=e;if("appear"===t){const[e,t="center"]=n.split(" ");return c()("components-animate__appear",{["is-from-"+t]:"center"!==t,["is-from-"+e]:"middle"!==e})}return"slide-in"===t?c()("components-animate__slide-in","is-from-"+n):void 0}({type:"appear",origin:K});let re=(0,i.createElement)("div",g({className:c()("components-popover",o,oe,{"is-expanded":J,"is-without-arrow":r,"is-alternate":s})},k,{ref:ne},te,{tabIndex:"-1"}),J&&(0,i.createElement)(R,null),J&&(0,i.createElement)("div",{className:"components-popover__header"},(0,i.createElement)("span",{className:"components-popover__header-title"},e),(0,i.createElement)(ie,{className:"components-popover__close",icon:C,onClick:t})),(0,i.createElement)("div",{ref:P,className:"components-popover__content"},(0,i.createElement)("div",{style:{position:"relative"}},Q,n)));return X.ref&&(re=(0,i.createElement)(V,{name:T},re)),d||f?re:(0,i.createElement)("span",{ref:A},re)}));K.Slot=(0,i.forwardRef)((function({name:e=H},t){return(0,i.createElement)(W,{bubblesVirtually:!0,name:e,className:"popover-slot",ref:t})}));const Y=K,X=function({shortcut:e,className:t}){if(!e)return null;let n,o;return(0,v.isString)(e)&&(n=e),(0,v.isObject)(e)&&(n=e.display,o=e.ariaLabel),(0,i.createElement)("span",{className:t,"aria-label":o},n)},J=(0,i.createElement)("div",{className:"event-catcher"}),Q=({eventHandlers:e,child:t,childrenWithPopover:n})=>(0,i.cloneElement)((0,i.createElement)("span",{className:"disabled-element-wrapper"},(0,i.cloneElement)(J,e),(0,i.cloneElement)(t,{children:n}),","),e),Z=({child:e,eventHandlers:t,childrenWithPopover:n})=>(0,i.cloneElement)(e,{...t,children:n}),$=(e,t,n)=>{if(1!==i.Children.count(e))return;const o=i.Children.only(e);"function"==typeof o.props[t]&&o.props[t](n)},ee=function({children:e,position:t,text:n,shortcut:o}){const[r,s]=(0,i.useState)(!1),[c,a]=(0,i.useState)(!1),l=(0,y.useDebounce)(a,700),u=t=>{$(e,"onMouseDown",t),document.addEventListener("mouseup",p),s(!0)},m=t=>{$(e,"onMouseUp",t),document.removeEventListener("mouseup",p),s(!1)},d=e=>"mouseUp"===e?m:"mouseDown"===e?u:void 0,p=d("mouseUp"),f=(t,n)=>o=>{if($(e,t,o),o.currentTarget.disabled)return;if("focus"===o.type&&r)return;l.cancel();const i=(0,v.includes)(["focus","mouseenter"],o.type);i!==c&&(n?l(i):a(i))},h=()=>{l.cancel(),document.removeEventListener("mouseup",p)};if((0,i.useEffect)((()=>h),[]),1!==i.Children.count(e))return e;const w={onMouseEnter:f("onMouseEnter",!0),onMouseLeave:f("onMouseLeave"),onClick:f("onClick"),onFocus:f("onFocus"),onBlur:f("onBlur"),onMouseDown:d("mouseDown")},g=i.Children.only(e),{children:E,disabled:b}=g.props,x=b?Q:Z,C=(({grandchildren:e,isOver:t,position:n,text:o,shortcut:r})=>(0,i.concatChildren)(e,t&&(0,i.createElement)(Y,{focusOnMount:!1,position:n,className:"components-tooltip","aria-hidden":"true",animate:!1,noArrow:!0},o,(0,i.createElement)(X,{className:"components-tooltip__shortcut",shortcut:r}))))({grandchildren:E,isOver:c,position:t,text:n,shortcut:o});return x({child:g,eventHandlers:w,childrenWithPopover:C})},te=function({icon:e,className:t,...n}){const o=["dashicon","dashicons","dashicons-"+e,t].filter(Boolean).join(" ");return(0,i.createElement)("span",g({className:o},n))},ne=function({icon:e=null,size:t=24,...n}){if("string"==typeof e)return(0,i.createElement)(te,g({icon:e},n));if((0,i.isValidElement)(e)&&te===e.type)return(0,i.cloneElement)(e,{...n});if("function"==typeof e)return e.prototype instanceof i.Component?(0,i.createElement)(e,{size:t,...n}):e({size:t,...n});if(e&&("svg"===e.type||e.type===u.SVG)){const o={width:t,height:t,...e.props,...n};return(0,i.createElement)(u.SVG,o)}return(0,i.isValidElement)(e)?(0,i.cloneElement)(e,{size:t,...n}):e},oe=(0,i.forwardRef)((function({as:e="div",className:t,...n},o){return function({as:e="div",...t}){return"function"==typeof t.children?t.children(t):(0,i.createElement)(e,t)}({as:e,className:c()("components-visually-hidden",t),...n,ref:o})})),re=["onMouseDown","onClick"],ie=(0,i.forwardRef)((function(e,t){const{href:n,target:o,isSmall:r,isPressed:s,isBusy:a,isDestructive:l,className:u,disabled:m,icon:d,iconPosition:p="left",iconSize:f,showTooltip:h,tooltipPosition:w,shortcut:E,label:y,children:x,text:C,variant:S,__experimentalIsFocusable:_,describedBy:L,...T}=function({isDefault:e,isPrimary:t,isSecondary:n,isTertiary:o,isLink:r,variant:i,...s}){let c=i;var a,l,u,m,d;return t&&(null!==(a=c)&&void 0!==a||(c="primary")),o&&(null!==(l=c)&&void 0!==l||(c="tertiary")),n&&(null!==(u=c)&&void 0!==u||(c="secondary")),e&&(b()("Button isDefault prop",{since:"5.4",alternative:'variant="secondary"'}),null!==(m=c)&&void 0!==m||(c="secondary")),r&&(null!==(d=c)&&void 0!==d||(c="link")),{...s,variant:c}}(e),R=c()("components-button",u,{"is-secondary":"secondary"===S,"is-primary":"primary"===S,"is-small":r,"is-tertiary":"tertiary"===S,"is-pressed":s,"is-busy":a,"is-link":"link"===S,"is-destructive":l,"has-text":!!d&&!!x,"has-icon":!!d}),I=m&&!_,O=void 0===n||I?"button":"a",D="a"===O?{href:n,target:o}:{type:"button",disabled:I,"aria-pressed":s};if(m&&_){D["aria-disabled"]=!0;for(const e of re)T[e]=e=>{e.stopPropagation(),e.preventDefault()}}const N=!I&&(h&&y||E||!!y&&(!x||(0,v.isArray)(x)&&!x.length)&&!1!==h),F=L?(0,v.uniqueId)():null,k=T["aria-describedby"]||F,M=(0,i.createElement)(O,g({},D,T,{className:R,"aria-label":T["aria-label"]||y,"aria-describedby":k,ref:t}),d&&"left"===p&&(0,i.createElement)(ne,{icon:d,size:f}),C&&(0,i.createElement)(i.Fragment,null,C),d&&"right"===p&&(0,i.createElement)(ne,{icon:d,size:f}),x);return N?(0,i.createElement)(i.Fragment,null,(0,i.createElement)(ee,{text:L||y,shortcut:E,position:w},M),L&&(0,i.createElement)(oe,null,(0,i.createElement)("span",{id:F},L))):(0,i.createElement)(i.Fragment,null,M,L&&(0,i.createElement)(oe,null,(0,i.createElement)("span",{id:F},L)))}));n(5482),n(129);const se=()=>(0,e.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"}),ce=({className:t,showSpinner:n=!1,children:o,variant:r="contained",...i})=>{const s=c()("wc-block-components-button","wp-element-button",t,r,{"wc-block-components-button--loading":n});return(0,e.createElement)(ie,{className:s,...i},n&&(0,e.createElement)(se,null),(0,e.createElement)("span",{className:"wc-block-components-button__text"},o))},ae=window.wp.a11y,le=({className:t,status:n="default",children:o,spokenMessage:r=o,onRemove:s=(()=>{}),isDismissible:u=!0,politeness:d=h(n),summary:p})=>(((e,t)=>{const n="string"==typeof e?e:(0,i.renderToString)(e);(0,i.useEffect)((()=>{n&&(0,ae.speak)(n,t)}),[n,t])})(r,d),(0,e.createElement)("div",{className:c()(t,"wc-block-components-notice-banner","is-"+n,{"is-dismissible":u})},(0,e.createElement)(l,{icon:w(n)}),(0,e.createElement)("div",{className:"wc-block-components-notice-banner__content"},p&&(0,e.createElement)("p",{className:"wc-block-components-notice-banner__summary"},p),o),!!u&&(0,e.createElement)(ce,{className:"wc-block-components-notice-banner__dismiss",icon:m,label:(0,a.__)("Dismiss this notice","woocommerce"),onClick:e=>{"function"==typeof(null==e?void 0:e.preventDefault)&&e.preventDefault&&e.preventDefault(),s()},showTooltip:!1})));var ue=function(e){return e.IDLE="IDLE",e.SLIDE_OUT="SLIDE-OUT",e.SLIDE_IN="SLIDE-IN",e}(ue||{});const me=".wc-block-store-notices",de=window.requestIdleCallback||(e=>setTimeout(e,100)),pe=({addToCartText:e,inTheCartText:t,numberOfItems:n})=>0===n?e:t.replace("###",n.toString()),fe={woocommerce:{addToCartText:e=>{const{context:t,state:n,selectors:o}=e;return t.woocommerce.animationStatus===ue.IDLE||t.woocommerce.animationStatus===ue.SLIDE_OUT?pe({addToCartText:t.woocommerce.addToCartText,inTheCartText:n.woocommerce.inTheCartText,numberOfItems:t.woocommerce.temporaryNumberOfItems}):pe({addToCartText:t.woocommerce.addToCartText,inTheCartText:n.woocommerce.inTheCartText,numberOfItems:o.woocommerce.numberOfItemsInTheCart(e)})},displayViewCart:e=>{const{context:t,selectors:n}=e;return!!t.woocommerce.displayViewCart&&(n.woocommerce.hasCartLoaded(e)?n.woocommerce.numberOfItemsInTheCart(e)>0:t.woocommerce.temporaryNumberOfItems>0)},hasCartLoaded:({state:e})=>void 0!==e.woocommerce.cart,numberOfItemsInTheCart:({state:e,context:t})=>{const n=(o=e.woocommerce.cart,r=t.woocommerce.productId,null==o?void 0:o.items.find((e=>e.id===r)));var o,r;return(null==n?void 0:n.quantity)||0},slideOutAnimation:({context:e})=>e.woocommerce.animationStatus===ue.SLIDE_OUT,slideInAnimation:({context:e})=>e.woocommerce.animationStatus===ue.SLIDE_IN}};(0,o.store)({selectors:fe,actions:{woocommerce:{addToCart:async n=>{const{context:o,selectors:s,ref:c}=n;if(!c.classList.contains("ajax_add_to_cart"))return;o.woocommerce.isLoading=!0;const a=new CustomEvent("should_send_ajax_request.adding_to_cart",{detail:[c],cancelable:!0});if(!1===document.body.dispatchEvent(a)){const e=new CustomEvent("ajax_request_not_sent.adding_to_cart",{detail:[!1,!1,c]});return document.body.dispatchEvent(e),!0}try{await(0,r.dispatch)(t.CART_STORE_KEY).addItemToCart(o.woocommerce.productId,o.woocommerce.quantityToAdd),o.woocommerce.temporaryNumberOfItems=s.woocommerce.numberOfItemsInTheCart(n)}catch(t){const n=document.querySelector(me);var l;n||null===(l=document.querySelector(".entry-content"))||void 0===l||l.prepend((()=>{const e=document.createElement("div");return e.classList.add(me.replace(".","")),e})());const o=null!=n?n:document.querySelector(me);o&&((t,n)=>{const o=(0,i.createRoot)(t);o.render((0,e.createElement)(le,{status:"error",onRemove:()=>o.unmount()},n)),null==t||t.scrollIntoView({behavior:"smooth",inline:"nearest"})})(o,t.message),console.error(t)}finally{o.woocommerce.displayViewCart=!0,o.woocommerce.isLoading=!1}},handleAnimationEnd:e=>{const{event:t,context:n,selectors:o}=e;"slideOut"===t.animationName?n.woocommerce.animationStatus=ue.SLIDE_IN:"slideIn"===t.animationName&&(n.woocommerce.temporaryNumberOfItems=o.woocommerce.numberOfItemsInTheCart(e),n.woocommerce.animationStatus=ue.IDLE)}}},init:{woocommerce:{syncTemporaryNumberOfItemsOnLoad:e=>{const{selectors:t,context:n}=e;t.woocommerce.hasCartLoaded(e)&&(n.woocommerce.temporaryNumberOfItems=t.woocommerce.numberOfItemsInTheCart(e))}}},effects:{woocommerce:{startAnimation:e=>{const{context:t,selectors:n}=e;n.woocommerce.hasCartLoaded(e)&&t.woocommerce.temporaryNumberOfItems!==n.woocommerce.numberOfItemsInTheCart(e)&&!t.woocommerce.isLoading&&t.woocommerce.animationStatus===ue.IDLE&&(t.woocommerce.animationStatus=ue.SLIDE_OUT)}}}},{afterLoad:e=>{const{state:n,selectors:o}=e;(0,r.subscribe)((()=>{const e=(0,r.select)(t.CART_STORE_KEY).getCartData();(0,r.select)(t.CART_STORE_KEY).hasFinishedResolution("getCartData")&&(n.woocommerce.cart=e)}),t.CART_STORE_KEY),de((()=>{o.woocommerce.hasCartLoaded(e)||(0,r.select)(t.CART_STORE_KEY).getCartData()}))}})})()})(); |