import { S as e, o as r } from "./antd-2abdded3.js";
import { b as i, A as o, a as t, H as s } from "./AppPermissionDialog-68667112.js";
import { fy as a, cd as n, dI as p, eE as m, fz as l, ej as d, ep as c, eF as f, ac as h, fA as j, a8 as g, eh as u, ei as x, ek as b, eH as v, ez as y, eA as w, fB as k, fC as C, eq as A, eI as z, ey as S, fD as T } from "./index-f927b013.js";
import I, { useContext as q, useState as D, useMemo as E } from "react";
import { lz as M, lI as $, lJ as H, mH as O, mI as B, mJ as F } from "./ant-design-icons-6bfdc7d5.js";
import { u as J } from "./styled-components-7cfa37e6.js";
import "react-dom";
import "./dayjs-2035e031.js";
import "./alasql-f60045ee.js";
import "./lodash-b5661970.js";
import "./customerService-d62a9c61.js";
import "./folderSelector-e6108de8.js";
import "./axios-04f95181.js";
import "./redux-devtools-8dd21e4f.js";
import "./fontawesome-3904a214.js";
import "./dnd-kit-8227a2db.js";
import "./moment-059406e8.js";
import "./numbro-47982265.js";
import "./papaparse-07642d76.js";
import "./uuid-bd83cae2.js";
import "./supabase-b2e314d0.js";
import "./fetch-648a91f6.js";
import "./react-draggable-ed505bfc.js";
import "./remark-gfm-18306abe.js";
import "./buffer-d3713d77.js";
import "./rehype-raw-6ebcba88.js";
import "./parse5-f837f753.js";
import "./rehype-sanitize-953d0761.js";
import "./simplebar-react-2133d981.js";
import "./react-best-gradient-color-picker-92c01739.js";
import "./ua-parser-js-c952c07b.js";
import "./clsx-469c2c43.js";
import "./loglevel-b4003767.js";
import "./file-saver-55285fc1.js";
import "./codemirror-8412b963.js";
import "./really-relaxed-json-056be70b.js";
import "./immer-c0428a8d.js";
import "./hotkeys-js-699906bc.js";
import "./cnchar-e1339167.js";
import "./react-documents-041601c7.js";
import "./react-sortable-hoc-4fbe0c32.js";
import "./sql-formatter-577b4ab0.js";
import "./rc-trigger-3f038851.js";
import "./react-json-view-5330ce92.js";
import "./qrcode-react-d377d762.js";
const L = J.div`
  font-weight: 500;
  font-size: 14px;
  color: ${(e2) => a(e2.$bgColor) ? "#ffffff" : "#000000"};
  font-style: normal;
  line-height: 24px;
  margin-right: 8px;
  margin-left: 20px;
  max-width: 264px;
  ${n};
`, P = J.a`
  display: flex;
  align-items: center;
`, V = J(z)`
  height: 28px;
  width: 28px;
`, G = J(S)`
  min-width: 60px;
  padding: 0;
  height: 28px;
  margin-right: 4px;
`, R = J(S)`
  min-width: 60px;
  height: 28px;
`, U = J(S)`
  &&& {
    color: #ffffff;
    background: #8b8fa34c;
    border: none;
    height: 28px;
    margin-right: 8px;
    min-width: 60px;
    padding: 0;
    cursor: pointer;
  
    &:hover {
      background: #666666;
      color: #ffffff;
      border: none;
    }
  
    &:focus {
      background: #666666;
      color: #ffffff;
      border: none;
    }
  }
`, Y = J(T)`
  margin-right: 4px;

  g g {
    fill: #ffffff;
  }
`, Z = J(S)`
  min-width: 60px;
  height: 28px;
  margin-right: 24px;
  padding: 0;
`, _ = J.div`
  display: inherit;
  @media screen and (max-width: 500px) {
    > div:nth-of-type(1),
    > button {
      display: none;
    }
  }
`;
function K(r2) {
  const { user: o2 } = r2, t2 = p(m), s2 = p(l), a2 = p(d);
  return t2 ? M(e.Avatar, { shape: "circle", size: 28 }) : M("div", { children: o2.isAnonymous ? s2 ? null : M(G, { buttonType: "primary", onClick: () => {
    var _a;
    a2 ? (_a = window.top) == null ? void 0 : _a.open("https://app.lowcoder.cloud/user/auth/login") : c.push(f);
  }, children: h("userAuth.login") }) : M(i, { user: o2, profileSide: 28, fontSize: 12 }) });
}
const N = I.memo(() => {
  const e2 = j(), i2 = q(g), a2 = p(u), n2 = p(x), m2 = p(d), f2 = b(), z2 = p(l), S2 = p(v), [T2, I2] = D(false), J2 = "view_marketplace" === e2.viewMode || m2, G2 = $(H, { children: [M(P, { onClick: () => !m2 && c.push(A), children: M(V, { branding: true }) }), J2 && M(s, { setEdit: () => {
  }, isViewMarketplaceMode: J2 }), !J2 && M(L, { $bgColor: (S2 == null ? void 0 : S2.headerColor) ?? "#2c2c2c", children: n2 && n2.name })] }), N2 = $(_, { children: [y(a2, n2) && !m2 && M(o, { applicationId: f2, visible: T2, onVisibleChange: (e3) => !e3 && I2(false) }), y(a2, n2) && !m2 && M(U, { onClick: () => I2(true), children: w }), k(a2, n2) && !m2 && $(Z, { buttonType: "primary", onClick: () => window.open(C(f2, "edit")), children: [M(Y, {}), h("edit")] }), !!z2 && M(R, { style: { marginRight: a2.isAnonymous ? "" : "24px" }, buttonType: "primary", onClick: () => {
    window.open(h("template.cloneUrl") + z2);
  }, children: h("header.clone") }), M(K, { user: a2 })] }), Q = E(() => m2 ? null : $(H, { children: [M(r, { options: [{ value: "mobile", icon: M(O, {}) }, { value: "tablet", icon: M(B, {}) }, { value: "desktop", icon: M(F, {}) }], value: i2.deviceType, onChange: (e3) => {
    i2.setDeviceType(e3);
  } }), "desktop" !== i2.deviceType && M(r, { options: [{ value: "portrait", label: "Portrait" }, { value: "landscape", label: "Landscape" }], value: i2.deviceOrientation, onChange: (e3) => {
    i2.setDeviceOrientation(e3);
  } })] }), [m2, i2.deviceType, i2.deviceOrientation]);
  return M(t, { headerStart: G2, headerMiddle: Q, headerEnd: N2, style: { backgroundColor: S2 == null ? void 0 : S2.headerColor } });
});
export {
  K as HeaderProfile,
  N as PreviewHeader
};
