import { a3 as I, f5 as b, am as X, cS as Y, H as n, e$ as q, gU as D, gV as J, ad as P, gW as f, I as C, fa as k, eh as p, fc as u, gX as O, fk as A, aC as K, fj as v } from "./56c67d3b.js";
import { useContext as Q, useRef as Z, useEffect as _ } from "react";
import "react-dom";
const {
  Header: S,
  Content: G,
  Footer: y,
  Sider: w
} = f, F = I.div`
  width: 100%;
  top: 0;
  max-width: inherit;
  overflow: auto;
  height: 100%;
`, aa = (o) => K`
    border-color: ${o.border};
    border-width: ${o.borderWidth};
    border-style: ${o.borderStyle};
    border-radius: ${o.radius};
    overflow: hidden;
    padding: ${o.padding};
    ${o && b(o)}
  `, ra = I.div`
  display: flex;
  flex-flow: column;
  height: 100%;
  border: 1px solid #d7d9e0;
  border-radius: 4px;
  ${(o) => o.$style && aa(o.$style)}
  ${(o) => o.$animationStyle}

  #pageLayout::-webkit-scrollbar {
    display: ${(o) => o.$mainScrollbars ? "block" : "none"};
  }
  
  .ant-layout {
    background: transparent;
  }
`, oa = I(v)`
  overflow: visible;
  border-radius: 0;
  ${(o) => b({
  background: o.$backgroundColor,
  backgroundImage: o.$headerBackgroundImage,
  backgroundImageSize: o.$headerBackgroundImageSize,
  backgroundImageRepeat: o.$headerBackgroundImageRepeat,
  backgroundImageOrigin: o.$headerBackgroundImageOrigin,
  backgroundImagePosition: o.$headerBackgroundImagePosition
})}
`, R = I(v)`
  overflow: auto;
  border-radius: 0;
  ${(o) => b({
  background: o.$backgroundColor,
  backgroundImage: o.$siderBackgroundImage,
  backgroundImageSize: o.$siderBackgroundImageSize,
  backgroundImageRepeat: o.$siderBackgroundImageRepeat,
  backgroundImageOrigin: o.$siderBackgroundImageOrigin,
  backgroundImagePosition: o.$siderBackgroundImagePosition
})}
`, L = I(v)`
  border-top: ${(o) => `${o.$showBorder ? o.$borderWidth : 0} solid ${o.$borderColor}`};
  flex: 1;
  border-radius: 0;

  ${(o) => b({
  background: o.$backgroundColor,
  backgroundImage: o.$bodyBackgroundImage,
  backgroundImageSize: o.$bodyBackgroundImageSize,
  backgroundImageRepeat: o.$bodyBackgroundImageRepeat,
  backgroundImageOrigin: o.$bodyBackgroundImageOrigin,
  backgroundImagePosition: o.$bodyBackgroundImagePosition
})}
`, ea = I(v)`
  border-top: ${(o) => `${o.$showBorder ? o.$borderWidth : 0} solid ${o.$borderColor}`};
  overflow: visible;
  border-radius: 0;
  ${(o) => b({
  background: o.$backgroundColor,
  backgroundImage: o.$footerBackgroundImage,
  backgroundImageSize: o.$footerBackgroundImageSize,
  backgroundImageRepeat: o.$footerBackgroundImageRepeat,
  backgroundImageOrigin: o.$footerBackgroundImageOrigin,
  backgroundImagePosition: o.$footerBackgroundImagePosition
})}
`;
function ca(o) {
  const {
    container: r,
    siderCollapsed: l,
    setSiderCollapsed: B,
    animationStyle: N
  } = o, {
    showHeader: s,
    showFooter: h,
    showSider: m
  } = r, {
    items: U,
    ...V
  } = r.header, {
    items: H,
    ...W
  } = r.body[0].children.view.getView(), {
    items: j,
    ...T
  } = r.footer, {
    items: $,
    ...x
  } = r.sider, {
    style: d,
    headerStyle: i,
    siderStyle: a,
    bodyStyle: e,
    footerStyle: g,
    horizontalGridCells: t
  } = r, E = Q(X).getAppSettings().maxWidth;
  Y(E);
  const z = Z();
  function M(c) {
    o.setSiderCollapsed(c);
  }
  return _(() => {
    B(r.siderCollapsed);
  }, [r.siderCollapsed]), /* @__PURE__ */ n("div", {
    style: {
      padding: d.margin,
      height: "100%"
    },
    children: /* @__PURE__ */ n(q, {
      theme: {
        components: {
          Layout: {
            triggerBg: D(r.siderStyle.siderBackground),
            triggerColor: J(r.siderStyle.siderBackground, "black", "white"),
            siderBg: r.siderStyle.siderBackground
          }
        }
      },
      children: /* @__PURE__ */ P(ra, {
        $style: d,
        $animationStyle: N,
        $mainScrollbars: r.mainScrollbars,
        children: [/* @__PURE__ */ P(f, {
          id: "pageLayout",
          style: {
            padding: "0px",
            overflowY: "scroll"
          },
          hasSider: m && !r.innerSider,
          children: [m && !r.innerSider && !r.siderRight && /* @__PURE__ */ n(C, {
            children: /* @__PURE__ */ n(k.Provider, {
              value: a == null ? void 0 : a.siderBackground,
              children: /* @__PURE__ */ n(w, {
                width: r.siderWidth,
                style: {
                  padding: "0px",
                  margin: "0px",
                  backgroundColor: (a == null ? void 0 : a.siderBackground) || "transparent"
                },
                collapsible: r.siderCollapsible,
                breakpoint: "sm",
                collapsedWidth: r.siderCollapsedWidth,
                collapsed: l,
                onCollapse: (c) => M(c),
                children: /* @__PURE__ */ n(p, {
                  style: {
                    height: r.autoHeight ? "auto" : "100%",
                    margin: "0px",
                    padding: "0px"
                  },
                  hideScrollbar: !r.siderScrollbars,
                  children: /* @__PURE__ */ n(R, {
                    ...x,
                    items: u($),
                    horizontalGridCells: t,
                    autoHeight: !0,
                    emptyRows: 30,
                    minHeight: `calc(100vh - ${d.padding}px)`,
                    containerPadding: [0, 0],
                    showName: {
                      bottom: h ? 20 : 0
                    },
                    $backgroundColor: (a == null ? void 0 : a.siderBackground) || "transparent",
                    $siderBackgroundImage: a == null ? void 0 : a.siderBackgroundImage,
                    $siderBackgroundImageRepeat: a == null ? void 0 : a.siderBackgroundImageRepeat,
                    $siderBackgroundImageSize: a == null ? void 0 : a.siderBackgroundImageSize,
                    $siderBackgroundImagePosition: a == null ? void 0 : a.siderBackgroundImagePosition,
                    $siderBackgroundImageOrigin: a == null ? void 0 : a.siderBackgroundImageOrigin,
                    style: {
                      padding: a.containerSiderPadding
                    }
                  })
                })
              })
            })
          }), /* @__PURE__ */ P(f, {
            style: {
              padding: "0px"
            },
            children: [s && /* @__PURE__ */ n(C, {
              children: /* @__PURE__ */ n(k.Provider, {
                value: d.background,
                children: /* @__PURE__ */ n(S, {
                  style: {
                    backgroundColor: (i == null ? void 0 : i.headerBackground) || "transparent",
                    padding: "0px",
                    margin: "0px"
                  },
                  children: /* @__PURE__ */ n(oa, {
                    ...V,
                    items: u(U),
                    horizontalGridCells: t,
                    autoHeight: !0,
                    emptyRows: 5,
                    minHeight: "60px",
                    containerPadding: [0, 0],
                    showName: {
                      bottom: h ? 20 : 0
                    },
                    $backgroundColor: (i == null ? void 0 : i.headerBackground) || "transparent",
                    $headerBackgroundImage: i == null ? void 0 : i.headerBackgroundImage,
                    $headerBackgroundImageRepeat: i == null ? void 0 : i.headerBackgroundImageRepeat,
                    $headerBackgroundImageSize: i == null ? void 0 : i.headerBackgroundImageSize,
                    $headerBackgroundImagePosition: i == null ? void 0 : i.headerBackgroundImagePosition,
                    $headerBackgroundImageOrigin: i == null ? void 0 : i.headerBackgroundImageOrigin,
                    style: {
                      padding: i.containerHeaderPadding
                    }
                  })
                })
              })
            }), m && r.innerSider ? /* @__PURE__ */ n(C, {
              children: /* @__PURE__ */ P(f, {
                style: {
                  padding: "0px"
                },
                hasSider: m && r.innerSider,
                children: [m && !r.siderRight && /* @__PURE__ */ n(k.Provider, {
                  value: a == null ? void 0 : a.siderBackground,
                  children: /* @__PURE__ */ n(w, {
                    width: r.siderWidth,
                    style: {
                      padding: "0px",
                      margin: "0px",
                      marginTop: d.borderWidth,
                      backgroundColor: (a == null ? void 0 : a.siderBackground) || "transparent"
                    },
                    collapsible: r.siderCollapsible,
                    breakpoint: "sm",
                    collapsedWidth: r.siderCollapsedWidth,
                    collapsed: l,
                    onCollapse: (c) => B(c),
                    children: /* @__PURE__ */ n(p, {
                      style: {
                        height: r.autoHeight ? "auto" : "100%",
                        margin: "0px",
                        padding: "0px"
                      },
                      hideScrollbar: !r.siderScrollbars,
                      children: /* @__PURE__ */ n(R, {
                        ...x,
                        items: u($),
                        horizontalGridCells: t,
                        autoHeight: !0,
                        emptyRows: 30,
                        minHeight: `calc(100vh - ${d.padding}px)`,
                        containerPadding: [0, 0],
                        showName: {
                          bottom: h ? 20 : 0
                        },
                        $backgroundColor: (a == null ? void 0 : a.siderBackground) || "transparent",
                        $siderBackgroundImage: a == null ? void 0 : a.siderBackgroundImage,
                        $siderBackgroundImageRepeat: a == null ? void 0 : a.siderBackgroundImageRepeat,
                        $siderBackgroundImageSize: a == null ? void 0 : a.siderBackgroundImageSize,
                        $siderBackgroundImagePosition: a == null ? void 0 : a.siderBackgroundImagePosition,
                        $siderBackgroundImageOrigin: a == null ? void 0 : a.siderBackgroundImageOrigin,
                        style: {
                          padding: a.containerSiderPadding
                        }
                      })
                    })
                  })
                }), /* @__PURE__ */ n(G, {
                  style: {
                    padding: "0px",
                    margin: "0px",
                    backgroundColor: (e == null ? void 0 : e.background) || "transparent"
                  },
                  children: /* @__PURE__ */ n(p, {
                    style: {
                      height: r.autoHeight ? "auto" : "100%",
                      margin: "0px",
                      padding: "0px"
                    },
                    hideScrollbar: !r.contentScrollbars,
                    children: r.showApp && r.contentApp != "" ? /* @__PURE__ */ n(k.Provider, {
                      value: e == null ? void 0 : e.background,
                      children: /* @__PURE__ */ n(F, {
                        children: /* @__PURE__ */ n(O, {
                          ref: z,
                          appId: r.contentApp,
                          baseUrl: r.baseUrl
                        })
                      })
                    }) : /* @__PURE__ */ n(L, {
                      $showBorder: s,
                      ...W,
                      items: u(H),
                      horizontalGridCells: t,
                      autoHeight: r.autoHeight,
                      emptyRows: 14,
                      minHeight: s ? "143px" : "142px",
                      containerPadding: [0, 0],
                      hintPlaceholder: o.hintPlaceholder ?? A,
                      $backgroundColor: (e == null ? void 0 : e.background) || "transparent",
                      $bodyBackgroundImage: e == null ? void 0 : e.backgroundImage,
                      $bodyBackgroundImageRepeat: e == null ? void 0 : e.backgroundImageRepeat,
                      $bodyBackgroundImageSize: e == null ? void 0 : e.backgroundImageSize,
                      $bodyBackgroundImagePosition: e == null ? void 0 : e.backgroundImagePosition,
                      $bodyBackgroundImageOrigin: e == null ? void 0 : e.backgroundImageOrigin,
                      $borderColor: d == null ? void 0 : d.border,
                      $borderWidth: d == null ? void 0 : d.borderWidth,
                      style: {
                        padding: e.containerBodyPadding
                      }
                    })
                  })
                }), m && r.siderRight && /* @__PURE__ */ n(k.Provider, {
                  value: a == null ? void 0 : a.siderBackground,
                  children: /* @__PURE__ */ n(w, {
                    width: r.siderWidth,
                    style: {
                      padding: "0px",
                      margin: "0px",
                      backgroundColor: (a == null ? void 0 : a.siderBackground) || "transparent"
                    },
                    collapsible: r.siderCollapsible,
                    breakpoint: "sm",
                    collapsedWidth: r.siderCollapsedWidth,
                    reverseArrow: !0,
                    collapsed: l,
                    onCollapse: (c) => B(c),
                    children: /* @__PURE__ */ n(p, {
                      style: {
                        height: r.autoHeight ? "auto" : "100%",
                        margin: "0px",
                        padding: "0px"
                      },
                      hideScrollbar: !r.siderScrollbars,
                      children: /* @__PURE__ */ n(R, {
                        ...x,
                        items: u($),
                        horizontalGridCells: t,
                        autoHeight: !0,
                        emptyRows: 30,
                        minHeight: `calc(100vh - ${d.padding}px)`,
                        containerPadding: [0, 0],
                        showName: {
                          bottom: h ? 20 : 0
                        },
                        $backgroundColor: (a == null ? void 0 : a.siderBackground) || "transparent",
                        $siderBackgroundImage: a == null ? void 0 : a.siderBackgroundImage,
                        $siderBackgroundImageRepeat: a == null ? void 0 : a.siderBackgroundImageRepeat,
                        $siderBackgroundImageSize: a == null ? void 0 : a.siderBackgroundImageSize,
                        $siderBackgroundImagePosition: a == null ? void 0 : a.siderBackgroundImagePosition,
                        $siderBackgroundImageOrigin: a == null ? void 0 : a.siderBackgroundImageOrigin,
                        style: {
                          padding: a.containerSiderPadding
                        }
                      })
                    })
                  })
                })]
              })
            }) : /* @__PURE__ */ n(G, {
              style: {
                padding: "0px",
                margin: "0px"
              },
              children: /* @__PURE__ */ n(p, {
                style: {
                  height: r.autoHeight ? "auto" : "100%",
                  margin: "0px",
                  padding: "0px"
                },
                hideScrollbar: !r.contentScrollbars,
                children: r.showApp && r.contentApp != "" ? /* @__PURE__ */ n(k.Provider, {
                  value: e == null ? void 0 : e.background,
                  children: /* @__PURE__ */ n(F, {
                    children: /* @__PURE__ */ n(O, {
                      ref: z,
                      appId: r.contentApp,
                      baseUrl: r.baseUrl
                    })
                  })
                }) : /* @__PURE__ */ n(L, {
                  $showBorder: s,
                  ...W,
                  items: u(H),
                  horizontalGridCells: t,
                  autoHeight: r.autoHeight,
                  emptyRows: 14,
                  minHeight: s ? "143px" : "142px",
                  containerPadding: [0, 0],
                  hintPlaceholder: o.hintPlaceholder ?? A,
                  $backgroundColor: (e == null ? void 0 : e.background) || "transparent",
                  $bodyBackgroundImage: e == null ? void 0 : e.backgroundImage,
                  $bodyBackgroundImageRepeat: e == null ? void 0 : e.backgroundImageRepeat,
                  $bodyBackgroundImageSize: e == null ? void 0 : e.backgroundImageSize,
                  $bodyBackgroundImagePosition: e == null ? void 0 : e.backgroundImagePosition,
                  $bodyBackgroundImageOrigin: e == null ? void 0 : e.backgroundImageOrigin,
                  $borderColor: d == null ? void 0 : d.border,
                  $borderWidth: d == null ? void 0 : d.borderWidth,
                  style: {
                    padding: e.containerBodyPadding
                  }
                })
              })
            }), h && /* @__PURE__ */ n(y, {
              style: {
                textAlign: "center",
                padding: "0px",
                margin: "0px",
                backgroundColor: (g == null ? void 0 : g.footerBackground) || "transparent"
              },
              children: /* @__PURE__ */ n(ea, {
                $showBorder: s,
                ...T,
                items: u(j),
                horizontalGridCells: t,
                autoHeight: !0,
                emptyRows: 5,
                minHeight: "48px",
                containerPadding: [0, 0],
                showName: {
                  top: s ? 20 : 0
                },
                $backgroundColor: (g == null ? void 0 : g.footerBackground) || "transparent",
                $footerBackgroundImage: g == null ? void 0 : g.footerBackgroundImage,
                $footerBackgroundImageRepeat: g == null ? void 0 : g.footerBackgroundImageRepeat,
                $footerBackgroundImageSize: g == null ? void 0 : g.footerBackgroundImageSize,
                $footerBackgroundImagePosition: g == null ? void 0 : g.footerBackgroundImagePosition,
                $footerBackgroundImageOrigin: g == null ? void 0 : g.footerBackgroundImageOrigin,
                $borderColor: d == null ? void 0 : d.border,
                $borderWidth: d == null ? void 0 : d.borderWidth,
                style: {
                  padding: g.containerFooterPadding
                }
              })
            })]
          }), m && !r.innerSider && r.siderRight && /* @__PURE__ */ n(C, {
            children: /* @__PURE__ */ n(k.Provider, {
              value: a == null ? void 0 : a.siderBackground,
              children: /* @__PURE__ */ n(w, {
                width: r.siderWidth,
                style: {
                  padding: "0px",
                  margin: "0px",
                  backgroundColor: (a == null ? void 0 : a.siderBackground) || "transparent"
                },
                collapsible: r.siderCollapsible,
                breakpoint: "sm",
                collapsedWidth: r.siderCollapsedWidth,
                reverseArrow: !0,
                collapsed: l,
                onCollapse: (c) => B(c),
                children: /* @__PURE__ */ n(p, {
                  style: {
                    height: r.autoHeight ? "auto" : "100%",
                    margin: "0px",
                    padding: "0px"
                  },
                  hideScrollbar: !r.siderScrollbars,
                  children: /* @__PURE__ */ n(R, {
                    ...x,
                    items: u($),
                    horizontalGridCells: t,
                    autoHeight: !0,
                    emptyRows: 30,
                    minHeight: `calc(100vh - ${d.padding}px)`,
                    containerPadding: [0, 0],
                    showName: {
                      bottom: h ? 20 : 0
                    },
                    $backgroundColor: (a == null ? void 0 : a.siderBackground) || "transparent",
                    $siderBackgroundImage: a == null ? void 0 : a.siderBackgroundImage,
                    $siderBackgroundImageRepeat: a == null ? void 0 : a.siderBackgroundImageRepeat,
                    $siderBackgroundImageSize: a == null ? void 0 : a.siderBackgroundImageSize,
                    $siderBackgroundImagePosition: a == null ? void 0 : a.siderBackgroundImagePosition,
                    $siderBackgroundImageOrigin: a == null ? void 0 : a.siderBackgroundImageOrigin,
                    style: {
                      padding: a.containerSiderPadding
                    }
                  })
                })
              })
            })
          })]
        }), /* @__PURE__ */ n("style", {
          children: `
              .ant-layout-sider-trigger {
                bottom: 4px !important;
                ${r.siderRight ? `
                  right: 8px !important;
                ` : `
                  left: 8px !important;}
                `}
                
              }
            `
        })]
      })
    })
  });
}
export {
  ca as PageLayout
};
