!function(){"use strict";var e=window.wp.element,t=window.wp.hooks,o=window.wp.compose,n=window.wp.components,r=window.wp.blockEditor;const l=["core/button"];(0,t.addFilter)("blocks.registerBlockType","checkoutpage/custom-attributes",(function(e,t){return l.includes(t)?Object.assign({},e,{attributes:Object.assign({},e.attributes,{checkoutUrl:{type:"string",default:""},behavior:{type:"string",default:""}})}):e}));const c=(0,o.createHigherOrderComponent)((t=>o=>{if(!l.includes(o.name))return(0,e.createElement)(t,o);const{attributes:c,setAttributes:a}=o;return c.behavior||a({behavior:"popup"}),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(t,o),(0,e.createElement)(r.InspectorControls,null,(0,e.createElement)(n.PanelBody,{title:"Checkout Page",initialOpen:!1},(0,e.createElement)(n.TextControl,{label:(0,e.createElement)("div",{style:{marginBottom:"-8px",fontWeight:"bold"}},"Checkout link"),value:c.checkoutUrl,onChange:e=>a({checkoutUrl:e}),help:(0,e.createElement)("div",null,"Paste your checkout's payment link here."," ",(0,e.createElement)("a",{href:"https://checkoutpage.co/help/wordpress-plugin"},"Learn more"))}),(0,e.createElement)(n.SelectControl,{label:(0,e.createElement)("div",{style:{fontWeight:"bold"}},"Button action"),value:c.behavior,options:[{label:"Open checkout pop up",value:"popup"},{label:"Open checkout in new tab",value:"link"}],onChange:e=>a({behavior:e})}))))}),"extendControls");(0,t.addFilter)("editor.BlockEdit","checkoutpage/custom-advanced-control",c),wp.hooks.addFilter("blocks.getSaveContent.extraProps","checkoutpage/save-extended-options",((e,t,o)=>{if(l.includes(t.name)){const{checkoutUrl:t,behavior:n}=o;e.checkoutUrl=t,e.behavior=n}return e}))}();