!function(){var e={3373:function(e,t){var a;!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e="",t=0;t<arguments.length;t++){var a=arguments[t];a&&(e=l(e,n(a)))}return e}function n(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return o.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var a in e)r.call(e,a)&&e[a]&&(t=l(t,a));return t}function l(e,t){return t?e?e+" "+t:e+t:e}e.exports?(o.default=o,e.exports=o):void 0===(a=function(){return o}.apply(t,[]))||(e.exports=a)}()}},t={};function a(r){var o=t[r];if(void 0!==o)return o.exports;var n=t[r]={exports:{}};return e[r](n,n.exports,a),n.exports}a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},a.d=function(e,t){for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){"use strict";var e=window.wp.blocks,t=a(3373),r=a.n(t),o=window.wp.i18n,n=window.wp.element,l=window.wp.blockEditor,s=window.wp.keycodes,c=window.wp.components,i=(window.wp.data,window.wp.coreData,window.wp.htmlEntities,window.wp.compose);function u(){return(0,i.useViewportMatch)("medium","<")?{}:{popoverProps:{placement:"left-start",offset:259}}}function _(e){let{attributes:t,setAttributes:a}=e;const{out_of_stock_text:r,unavailable_text:n}=t,l=u();return React.createElement(c.__experimentalToolsPanel,{label:(0,o.__)("Labels","surecart"),resetAll:()=>a({out_of_stock_text:"",unavailable_text:""}),dropdownMenuProps:l},React.createElement(c.__experimentalToolsPanelItem,{label:(0,o.__)("Out of stock label","surecart"),hasValue:()=>!!r,onDeselect:()=>a({out_of_stock_text:""})},React.createElement(c.TextControl,{label:(0,o.__)("Out of stock","surecart"),value:r,onChange:e=>a({out_of_stock_text:e}),isBlock:!0,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0})),React.createElement(c.__experimentalToolsPanelItem,{label:(0,o.__)("Unavailable","surecart"),hasValue:()=>!!n,onDeselect:()=>a({unavailable_text:""})},React.createElement(c.TextControl,{label:(0,o.__)("Unavailable label","surecart"),value:n,onChange:e=>a({unavailable_text:e}),isBlock:!0,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0})))}function p(e){let{attributes:t,setAttributes:a,context:r}=e;const{width:n,show_sticky_purchase_button:l}=t,s=u(),i="surecart/product-page"===r?.providerBlock;return React.createElement(c.__experimentalToolsPanel,{label:(0,o.__)("Display","surecart"),resetAll:()=>a({width:void 0,...i?{show_sticky_purchase_button:"never"}:{}}),dropdownMenuProps:s},React.createElement(c.__experimentalToolsPanelItem,{label:(0,o.__)("Width","surecart"),isShownByDefault:!0,hasValue:()=>!!n,onDeselect:()=>a({width:void 0}),__nextHasNoMarginBottom:!0},React.createElement(c.__experimentalToggleGroupControl,{label:(0,o.__)("Width","surecart"),value:n,onChange:e=>a({width:e}),isBlock:!0,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0},[25,50,75,100].map((e=>React.createElement(c.__experimentalToggleGroupControlOption,{key:e,value:e,label:(0,o.sprintf)(/* translators: Percentage value. */ /* translators: Percentage value. */
(0,o.__)("%d%%","surecart"),e)}))))),i&&React.createElement(c.__experimentalToolsPanelItem,{label:(0,o.__)("Sticky purchase button","surecart"),isShownByDefault:!0,hasValue:()=>!!l,onDeselect:()=>a({show_sticky_purchase_button:"never"}),__nextHasNoMarginBottom:!0},React.createElement(c.__experimentalToggleGroupControl,{label:(0,o.__)("Show sticky button","surecart"),value:l,onChange:e=>a({show_sticky_purchase_button:e}),help:{never:(0,o.__)("Do not show a sticky purchase button when scrolling to the bottom of the page","surecart"),in_stock:(0,o.__)("Show a sticky purchase button only when the product is in stock","surecart"),always:(0,o.__)("Always show a sticky purchase button regardless of stock status","surecart")}[l]||(0,o.__)("Show a sticky purchase button when this button is out of view","surecart"),isBlock:!0,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0},React.createElement(c.__experimentalToggleGroupControlOption,{key:"never",value:"never",label:(0,o.__)("Never","surecart")}),React.createElement(c.__experimentalToggleGroupControlOption,{key:"in_stock",value:"in_stock",label:(0,o.__)("In stock","surecart")}),React.createElement(c.__experimentalToggleGroupControlOption,{key:"always",value:"always",label:(0,o.__)("Always","surecart")}))))}function b(){return b=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)({}).hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},b.apply(null,arguments)}var m=JSON.parse('{"UU":"surecart/product-buy-button"}');(0,e.registerBlockType)(m.UU,{edit:e=>{let{attributes:t,setAttributes:a,className:c,context:i}=e;const{style:u,text:m,width:w}=t,d=(0,l.__experimentalUseBorderProps)(t),f=(0,l.__experimentalUseColorProps)(t),h=(0,l.__experimentalGetSpacingClassesAndStyles)(t),x=(0,l.__experimentalGetShadowClassesAndStyles)(t),y=(0,n.useRef)(),v=(0,n.useRef)(),k=(0,l.useBlockProps)({ref:y,onKeyDown:function(e){s.isKeyboardEvent.primary(e,"k")?startEditing(e):s.isKeyboardEvent.primaryShift(e,"k")&&(unlink(),v.current?.focus())}});return React.createElement(React.Fragment,null,React.createElement(l.InspectorControls,null,React.createElement(p,{attributes:t,setAttributes:a,context:i}),React.createElement(_,{attributes:t,setAttributes:a})),React.createElement("div",b({},k,{className:r()(k.className,{"wp-block-button":!0,"sc-block-button":!0,[`has-custom-width sc-block-button__width-${w}`]:w,"has-custom-font-size":k.style.fontSize})}),React.createElement(l.RichText,{"aria-label":(0,o.__)("Button text","surecart"),placeholder:(0,o.__)("Add text…","surecart"),ref:v,className:r()(c,"wp-block-button__link","sc-block-button__link",f.className,d.className,h.className,x.className,{"no-border-radius":0===u?.border?.radius},(0,l.__experimentalGetElementClassName)("button")),style:{...d.style,...h.style,...x.style,...f.style},value:m,onChange:e=>a({text:e}),withoutInteractiveFormatting:!0,allowedFormats:["core/bold","core/italic"]})))}})}()}();