'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),ChildrenDroppable=require("../../grid/components/ChildrenDroppable.js"),system=require("@gem-sdk/system"),attrs=require("../common/attrs.js"),styles=require("../common/styles.js"),classes=require("../common/classes.js"),ButtonIcon=require("../../button/components/ButtonIcon.js"),useDialog=require("../hooks/useDialog.js");const Dialog=e=>{let{setting:s,children:t,builderProps:l,style:a,advanced:r,builderAttrs:o,pageContext:n}=e,i=r?.d,{name:c,fullScreen:y,width:m,height:d,position:u,overlayColor:g,overlayOpacity:C,iconSize:j,closeButtonPosition:x,iconSvg:p}=s??{},S=core.useEditorMode(),{ref:v,overlay:b,handleClickOverlay:h,closeModal:D,open:f,dialogId:B}=useDialog.useDialog(s,l,"edit"===S),R="edit"!==S,q=system.createAttr({...attrs.getAttr({uid:l?.uid||""})}),k=system.createStyle({...styles.getWrapperStyle(i)}),A=system.createClass({...classes.getContainClasses(r?.cssClass,C,g)}),N=system.createAttr({...attrs.getAttrContainer({uid:B||""})}),I=system.createStyle({...styles.getContainStyle()}),L=system.createClass({...classes.getBackdropClasses(u)}),O=system.createStyle({...styles.getBackdropStyle(a)}),w=system.createAttr({...attrs.getAttrOverlay()}),E=system.createClass({...classes.getOverlayClasses()}),M=system.createStyle({...styles.getOverlayStyle(C,g,a)}),P=system.createStyle({...styles.getDialogContentStyle({style:a,width:m,height:d,fullScreen:y})}),T=system.createClass({...classes.getDialogContentClasses({setting:s,enableEffect:f,isILP:R})}),_=system.createAttr({...attrs.getAttrClose()}),z=system.createClass({...classes.getHeadContentClasses()}),H=system.createStyle({...styles.getButtonContentStyle(s)}),W=system.createClass({...classes.getButtonContentClasses(x)}),F=system.createStyle({...styles.getSvgContentStyle(j)}),G=system.createClass({...classes.getSvgContentClasses()}),J=system.createStyle({...styles.getBodyContentStyle({setting:s,style:a,uid:l?.uid,pageContext:n??{}})}),K=system.createClass({...classes.getBodyContentClasses()});return jsxRuntime.jsx("div",{...q,style:k,children:(f||"edit"!==S)&&jsxRuntime.jsx("dialog",{ref:v,open:f,"aria-label":c,...N,className:A,style:I,children:jsxRuntime.jsxs("div",{"aria-label":"Backdrop",className:L,style:O,children:[system.If(!!g,jsxRuntime.jsx("div",{ref:b,...w,className:E,style:M,onClick:h,"aria-hidden":!0})),jsxRuntime.jsx("span",{className:z}),jsxRuntime.jsxs("div",{role:"dialog","aria-label":"Dialog content",...o,className:T,style:P,children:[jsxRuntime.jsx("button",{..._,type:"button",tabIndex:-1,className:W,style:H,onClick:D,children:jsxRuntime.jsx(ButtonIcon.default,{iconSvg:p??`<svg viewBox="0 0 12 12" fill="currentColor" style={svgContentStyle}>
                  <path d="M7.1,6l4.5,4.5l-1.1,1.1L6,7.1l-4.5,4.5l-1.1-1.1L4.9,6L0.5,1.5l1.1-1.1L6,4.9l4.5-4.5l1.1,1.1L7.1,6z"></path>
                </svg>`,styles:F,classes:G})}),jsxRuntime.jsx("div",{"aria-label":"Dialog body",style:J,className:K,children:core.isEmptyChildren(t)?jsxRuntime.jsx(ChildrenDroppable.default,{}):core.filterToolbarPreview(t)}),core.filterToolbarPreview(t,!0)]})]})})})};exports.default=Dialog;
