'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("@gem-sdk/core"),s=require("@gem-sdk/system"),a=require("../../helpers.js"),r=require("../common/attrs.js"),l=require("../common/styles.js"),n=require("../common/classes.js"),o=require("./ButtonIcon.js"),u=require("./ButtonLabel.js"),c=require("./ButtonLoadingIndicator.js"),i=require("../common/helpers.js");exports.default=g=>{let{children:d,advanced:y,className:j,nodePrice:m,customAttrs:p,styles:C={},setting:f={},builderProps:x,builderAttrs:B,wrapClassName:I="",onClick:h}=g,{iconSvg:q,btnLink:S,htmlType:b,loading:L,disabled:k,shouldClearSpace:v,enableBtnLink:T}=f,{enableTextStyle:N=!0}=C,M=t.useEditorMode(),_=t.usePageType(),{customCss:H,wrapStyle:W,restStyle:A,dataState:D,dataIdAttr:E,isShowIcon:P,isScrollToElement:O,getArialLabel:w,getLabelToDisplay:z,checkIsShowLabel:F,checkIsEditableLabel:G}=i.getData(g),{HTMLTag:J,urlData:K,shouldRenderLink:Q}=i.getInsertLinkData({enableBtnLink:T,htmlType:b,setting:S,defaultTag:"button",pageType:_}),R=s.createStyle({...l.getButtonStyles(C,f.enableHoverEffect)}),U=s.createStyle({...l.getTypoStyles(C)}),V=s.createStyle({...l.getTypoStyles(C),...l.getButtonIconStyles(C,f)}),X=s.createStyle({...l.getButtonWrapperStyles(A,C)}),Y=s.createClass({...n.getButtonClasses({styles:C,className:j,shouldRenderLink:Q,uid:x?.uid,advanced:y})}),Z=s.createClass({...n.getButtonIconClasses(z(),v,N)}),$=s.createClass({...n.getButtonLabelClasses(C,G({mode:M}))}),ee=s.createClass({...n.getButtonWrapperClasses(I,j,y?.cssClass)}),et=s.createClass({...n.getButtonContentWrapperClasses(f)}),es=s.createClass({...n.getButtonContainerClasses()}),ea=s.createAttr({...r.getButtonAttributes({disabled:k,dataState:D,dataId:E,arialLabel:w()})});return e.jsx("div",{style:W,className:es,children:e.jsxs("div",{...B,style:X,className:ee,children:[e.jsx("style",{type:"text/css",dangerouslySetInnerHTML:{__html:H}}),s.If(O,e.jsx("a",{className:"gp-trigger-button-link gp-hidden",href:K.href,target:K.target})),e.jsxs(J,{...ea,...p,..."button"!==J&&{setting:K},style:R,className:Y,onClick:e=>{h?.(e),a.handleClickLink(S,M)},children:[s.If(L,e.jsx(c.default,{})),e.jsxs("div",{className:et,children:[s.If(P,e.jsx(o.default,{iconSvg:q??"",styles:V,classes:Z})),s.If(N&&F(),e.jsx(u.default,{label:z(),styles:U,classes:$}))]}),s.If(!!m,m??"")]}),d]})})};
