import{j as t,b as o}from"./chunks/BlockEditorTranslator.js?ver=1.3.20";import{s as b,U as _}from"./chunks/Icons.js?ver=1.3.20";const{InspectorControls:f}=wp.blockEditor,{PanelBody:x,TextControl:m,ToggleControl:a,__experimentalToggleGroupControl:y,__experimentalToggleGroupControlOption:k}=wp.components,w=y,s=k,j=({attributes:n,setAttributes:r})=>t.jsx(t.Fragment,{children:t.jsx(f,{children:t.jsxs(x,{title:o("Settings","fluent-cart"),initialOpen:!0,children:[t.jsxs(w,{isBlock:!0,label:o("Display type","fluent-cart"),value:n.display_type,onChange:e=>r({display_type:e}),children:[t.jsx(s,{value:"button",label:o("Button","fluent-cart")}),t.jsx(s,{value:"link",label:o("Link","fluent-cart")})]}),t.jsx(m,{label:o("Button text","fluent-cart"),help:o("Leave empty to use the default text: My Account","fluent-cart"),value:n.button_text,onChange:e=>r({button_text:e})}),t.jsx(a,{label:o("Show icon","fluent-cart"),checked:n.show_icon,onChange:e=>r({show_icon:e})}),t.jsx(a,{label:o("Open in new tab","fluent-cart"),checked:n.link_target==="_blank",onChange:e=>r({link_target:e?"_blank":"_self"})})]})})}),{useBlockProps:C,RichText:B}=wp.blockEditor,{registerBlockType:T}=wp.blocks,l=window.fluent_cart_customer_dashboard_button_data;T(l.slug+"/"+l.name,{apiVersion:3,title:l.title,description:l.description,icon:{src:b},category:"fluent-cart",attributes:{display_type:{type:"string",default:"button"},button_text:{type:"string",default:""},link_target:{type:"string",default:"_self"},show_icon:{type:"boolean",default:!0}},supports:{html:!1,align:["left","center","right"],alignWide:!1,typography:{fontSize:!0,fontFamily:!0,fontWeight:!0,lineHeight:!0},color:{text:!0,background:!0},spacing:{margin:!0,padding:!0},__experimentalBorder:{color:!0,radius:!0,width:!0,style:!0,__experimentalDefaultControls:{color:!0,radius:!0,width:!0}},border:{color:!0,radius:!0,width:!0,style:!0},shadow:!0},edit:n=>{const{attributes:r,setAttributes:e,clientId:c}=n,{display_type:u,button_text:i,show_icon:p}=r,d=C({className:u==="button"?"wp-block-button__link wp-element-button fct-customer-dashboard-btn":"fct-customer-dashboard-link"}),g=o("My Account","fluent-cart");return t.jsxs("div",{children:[t.jsx(j,{attributes:r,setAttributes:e,clientId:c}),t.jsxs("a",{...d,children:[p&&t.jsx("span",{className:"fct-customer-dashboard-icon",children:t.jsx(_,{})}),t.jsx(B,{tagName:"span",value:i,onChange:h=>e({button_text:h}),placeholder:g,allowedFormats:["core/bold","core/italic"]})]})]})},save:function(n){return null}});
