!function(){var e={7005:function(e,t,r){"use strict";var n=r(1609),o=Symbol.for("react.element"),a=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),c=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};t.jsx=function(e,t,r){var n,i={},u=null,s=null;for(n in void 0!==r&&(u=""+r),void 0!==t.key&&(u=""+t.key),void 0!==t.ref&&(s=t.ref),t)a.call(t,n)&&!l.hasOwnProperty(n)&&(i[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===i[n]&&(i[n]=t[n]);return{$$typeof:o,type:e,key:u,ref:s,props:i,_owner:c.current}}},9255:function(e,t,r){"use strict";e.exports=r(7005)},1609:function(e){"use strict";e.exports=window.React},3373:function(e,t){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e="",t=0;t<arguments.length;t++){var r=arguments[t];r&&(e=c(e,a(r)))}return e}function a(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 r in e)n.call(e,r)&&e[r]&&(t=c(t,r));return t}function c(e,t){return t?e?e+" "+t:e+t:e}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,r),a.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){"use strict";var e=window.wp.blocks,t=window.wp.primitives,n=r(9255),o=(0,n.jsx)(t.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,n.jsx)(t.Path,{d:"M8 12.5h8V11H8v1.5Z M19 6.5H5a2 2 0 0 0-2 2V15a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a2 2 0 0 0-2-2ZM5 8h14a.5.5 0 0 1 .5.5V15a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V8.5A.5.5 0 0 1 5 8Z"})}),a=window.wp.blockEditor,c=window.wp.i18n,l=r(3373),i=r.n(l),u=r(1609),s=r.n(u);function p(e){let{name:t,...r}=e;const[n,o]=(0,u.useState)(null),a=window?.scData?.plugin_url+"/dist/icon-assets";if((0,u.useEffect)((()=>{fetch(`${a}/${t}.svg`).then((e=>e.text())).then((e=>{const t=(new DOMParser).parseFromString(e,"image/svg+xml");o(t?.documentElement)})).catch(console.error)}),[t]),!n)return null;const c={...Array.from(n.attributes).reduce(((e,t)=>(e[t.name]=t.value,e)),{}),...r};return s().createElement(n.tagName,{...c,dangerouslySetInnerHTML:{__html:n.innerHTML}})}const _=e=>{if(!e)return;const t=e.match(/var:preset\|spacing\|(.+)/);return t?`var(--wp--preset--spacing--${t[1]})`:e};var d=window.wp.components,w=(window.wp.data,window.wp.element,window.wp.coreData,window.wp.htmlEntities,window.wp.compose);function m(){return(0,w.useViewportMatch)("medium","<")?{}:{popoverProps:{placement:"left-start",offset:259}}}var f=e=>{let{attributes:t,setAttributes:r}=e;const{quick_view_button_type:n,width:o}=t,a=m();return React.createElement(d.__experimentalToolsPanel,{label:(0,c.__)("Design","surecart"),resetAll:()=>r({quick_view_button_type:"both",width:null}),dropdownMenuProps:a},React.createElement(d.__experimentalToolsPanelItem,{hasValue:()=>!!n,label:(0,c.__)("Icon & Text","surecart"),onDeselect:()=>r({quick_view_button_type:"both"}),isShownByDefault:!0},React.createElement(d.__experimentalToggleGroupControl,{label:(0,c.__)("Icon & Text","surecart"),value:n,onChange:e=>r({quick_view_button_type:e}),help:(0,c.__)("A decorative way to show quick view trigger of the product.","surecart"),isBlock:!0},React.createElement(d.__experimentalToggleGroupControlOption,{value:"icon",label:(0,c._x)("Icon","Button option for product quick view button.","surecart")}),React.createElement(d.__experimentalToggleGroupControlOption,{value:"text",label:(0,c._x)("Text","Button option for product quick view button.","surecart")}),React.createElement(d.__experimentalToggleGroupControlOption,{value:"both",label:(0,c._x)("Both","Button option for product quick view button.","surecart")}))),React.createElement(d.__experimentalToolsPanelItem,{label:(0,c.__)("Width","surecart"),isShownByDefault:!0,hasValue:()=>!!o,onDeselect:()=>r({width:void 0})},React.createElement(d.__experimentalToggleGroupControl,{label:(0,c.__)("Width","surecart"),help:(0,c.__)("The width of the button in its container.","surecart"),value:o,onChange:e=>r({width:e}),isBlock:!0},[25,50,75,100].map((e=>React.createElement(d.__experimentalToggleGroupControlOption,{key:e,value:e,label:sprintf(/* translators: Percentage value. */ /* translators: Percentage value. */
(0,c.__)("%d%%","surecart"),e)}))))))},b=e=>{let{attributes:t,setAttributes:r}=e;const{direct_add_to_cart:n}=t,o=m();return React.createElement(d.__experimentalToolsPanel,{label:(0,c.__)("Settings","surecart"),resetAll:()=>r({direct_add_to_cart:!0}),dropdownMenuProps:o},React.createElement(d.__experimentalToolsPanelItem,{hasValue:()=>!!n,label:(0,c.__)("Direct add to cart","surecart"),onDeselect:()=>r({direct_add_to_cart:!0}),isShownByDefault:!0},React.createElement(d.ToggleControl,{label:(0,c.__)("Direct add to cart","surecart"),help:(0,c.__)("Add the product directly to cart if it has no options.","surecart"),checked:n,onChange:e=>{r({direct_add_to_cart:e})}})))};function h(){return h=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},h.apply(null,arguments)}var v=JSON.parse('{"UU":"surecart/product-quick-view-button"}');(0,e.registerBlockType)(v.UU,{icon:o,edit:e=>{let{attributes:t,setAttributes:r}=e;const{icon:n,quick_view_button_type:o,label:l,style:u,width:s,icon_position:d}=t,w=(0,a.useBlockProps)({style:{gap:_(u?.spacing?.blockGap),justifyContent:u?.typography?.textAlign}});return React.createElement(React.Fragment,null,React.createElement(a.InspectorControls,null,React.createElement(f,{attributes:t,setAttributes:r}),React.createElement(b,{attributes:t,setAttributes:r})),React.createElement("div",{className:"wp-block-buttons"},React.createElement("div",{className:i()({"wp-block-button":!0,[`has-custom-width wp-block-button__width-${s}`]:s,[`has-custom-width sc-block-button__width-${s}`]:s})},React.createElement("div",h({},w,{className:i()(w.className,{"wp-block-button__link":!0})}),(()=>{const e=["icon","both"].includes(o),t=["text","both"].includes(o);return React.createElement(React.Fragment,null,e&&"before"===d&&React.createElement(p,{className:"wp-block-surecart-product-quick-view-button__icon",name:n}),t&&React.createElement(a.PlainText,{__experimentalVersion:2,tagName:"span","aria-label":(0,c.__)("Quick add button"),placeholder:(0,c.__)("Quick Add"),value:l,onChange:e=>r({label:e})}),e&&"after"===d&&React.createElement(p,{className:"wp-block-surecart-product-quick-view-button__icon",name:n}))})()))))}})}()}();