'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}=e,n=r?.d,{name:i,fullScreen:c,width:y,height:m,position:d,overlayColor:u,overlayOpacity:g,iconSize:C,closeButtonPosition:j,iconSvg:x}=s??{},p=core.useEditorMode(),{ref:S,overlay:v,handleClickOverlay:b,closeModal:h,open:D,dialogId:f}=useDialog.useDialog(s,l,"edit"===p),B="edit"!==p,R=system.createAttr({...attrs.getAttr({uid:l?.uid||""})}),q=system.createStyle({...styles.getWrapperStyle(n)}),k=system.createClass({...classes.getContainClasses(r?.cssClass,g,u)}),A=system.createAttr({...attrs.getAttrContainer({uid:f||""})}),N=system.createStyle({...styles.getContainStyle()}),I=system.createClass({...classes.getBackdropClasses(d)}),L=system.createStyle({...styles.getBackdropStyle(a)}),O=system.createAttr({...attrs.getAttrOverlay()}),w=system.createClass({...classes.getOverlayClasses()}),E=system.createStyle({...styles.getOverlayStyle(g,u,a)}),M=system.createStyle({...styles.getDialogContentStyle({style:a,width:y,height:m,fullScreen:c})}),P=system.createClass({...classes.getDialogContentClasses({setting:s,enableEffect:D,isILP:B})}),T=system.createAttr({...attrs.getAttrClose()}),_=system.createClass({...classes.getHeadContentClasses()}),z=system.createStyle({...styles.getButtonContentStyle(s)}),H=system.createClass({...classes.getButtonContentClasses(j)}),W=system.createStyle({...styles.getSvgContentStyle(C)}),F=system.createClass({...classes.getSvgContentClasses()}),G=system.createStyle({...styles.getBodyContentStyle(s,a)}),J=system.createClass({...classes.getBodyContentClasses()});return jsxRuntime.jsx("div",{...R,style:q,children:(D||"edit"!==p)&&jsxRuntime.jsx("dialog",{ref:S,open:D,"aria-label":i,...A,className:k,style:N,children:jsxRuntime.jsxs("div",{"aria-label":"Backdrop",className:I,style:L,children:[system.If(!!u,jsxRuntime.jsx("div",{ref:v,...O,className:w,style:E,onClick:b,"aria-hidden":!0})),jsxRuntime.jsx("span",{className:_}),jsxRuntime.jsxs("div",{role:"dialog","aria-label":"Dialog content",...o,className:P,style:M,children:[jsxRuntime.jsx("button",{...T,type:"button",tabIndex:-1,className:H,style:z,onClick:h,children:jsxRuntime.jsx(ButtonIcon.default,{iconSvg:x??`<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:W,classes:F})}),jsxRuntime.jsx("div",{"aria-label":"Dialog body",style:G,className:J,children:core.isEmptyChildren(t)?jsxRuntime.jsx(ChildrenDroppable.default,{}):core.filterToolbarPreview(t)}),core.filterToolbarPreview(t,!0)]})]})})})};exports.default=Dialog;
