import { BottomContent as t } from "./BottomContent-c7db21dd.js";
import { iP as e, cr as o, iQ as r, iR as i, fr as s, iS as a, iT as n } from "./index-f50c05c4.js";
import { d as m } from "./styled-components-1e696d6b.js";
import { useContext as p, useRef as d, useState as l, useMemo as c } from "react";
import { D as j } from "./react-draggable-60f59f09.js";
import { u as h, H as u } from "./index-25ace9de.js";
import { lA as x, lR as f, lS as b } from "./ant-design-icons-b1480d8d.js";
import { H as g } from "./antd-04a23d13.js";
import "./react-router-a1807b5b.js";
import "./DraggableTree-f6881ca2.js";
import "./dnd-kit-56a2f36f.js";
import "react-dom";
import "./lodash-f1e42446.js";
import "./alasql-0ff6dabf.js";
import "./BottomMetaDrawer-efbb1c6b.js";
import "./axios-84bb1c75.js";
import "./redux-devtools-d38e5b33.js";
import "./fontawesome-2445f580.js";
import "./dayjs-844325ae.js";
import "./numbro-c1edb412.js";
import "./papaparse-1bac8e5f.js";
import "./uuid-82f303b2.js";
import "./supabase-c27c62e3.js";
import "./fetch-a3c8ad94.js";
import "./remark-gfm-f2973785.js";
import "./buffer-d3713d77.js";
import "./rehype-raw-41b6145f.js";
import "./parse5-6476676e.js";
import "./rehype-sanitize-deb53e9a.js";
import "./simplebar-react-e1b123a3.js";
import "./react-best-gradient-color-picker-4dd60dac.js";
import "./ua-parser-js-094f59ba.js";
import "./clsx-469c2c43.js";
import "./loglevel-6fb66d22.js";
import "./crypto-js-d5eac8ba.js";
import "./codemirror-73d8c217.js";
import "./really-relaxed-json-49b6a70d.js";
import "./immer-c0428a8d.js";
import "./redux-saga-5514e228.js";
import "./hotkeys-js-0dddb21a.js";
import "./cnchar-5678e6bc.js";
import "./react-documents-eb6de859.js";
import "./sql-formatter-69e8df59.js";
import "./rc-trigger-5125aafe.js";
import "./react-json-view-9403d8a1.js";
import "./qrcode-react-cb73d2b6.js";
import "./katex-a34f0265.js";
import "./ecogis-maps-bb0d63f9.js";
import "./devextreme-2fa5bb9a.js";
const w = m.div`
  right: calc(313px + 4px); // FIXME: don't rely on the width of the right panel
  bottom: ${(t2) => t2.$bottom ? t2.$bottom + 4 + "px" : "289px"};
  position: fixed;
  z-index: ${e.queryResultPanel};

  display: flex;
  flex-direction: column;
  width: 592px;
  height: fit-content;
  max-height: 250px;
  background: #ffffff;
  box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  pointer-events: auto;
  padding-bottom: 16px;
`, y = (t2) => {
  const { bottom: e2 } = t2, r2 = p(o), i2 = r2.showResultComp(), s2 = i2 == null ? void 0 : i2.result(), a2 = d(null), [n2, m2] = l(true), [c2, b2] = l({ left: 0, top: 0, bottom: 0, right: 0 }), { header: g2, body: y2 } = h({ ...s2 ?? { data: "", dataType: "default", success: true }, onClose: () => r2.setShowResultCompName(void 0) });
  return s2 ? x(j, { nodeRef: a2, disabled: n2, bounds: c2, enableUserSelectHack: false, onStart: (t3, e3) => {
    var _a;
    const { clientWidth: o2, clientHeight: r3 } = window.document.documentElement, i3 = (_a = a2.current) == null ? void 0 : _a.getBoundingClientRect();
    i3 && b2({ left: -i3.left + e3.x, right: o2 - (i3.right - e3.x), top: -i3.top + e3.y, bottom: r3 - (i3.bottom - e3.y) });
  }, children: f(w, { $bottom: e2, ref: a2, children: [x(u, { onMouseOver: () => m2(false), onMouseOut: () => m2(true), children: g2 }), y2] }) }) : null;
}, v = m(n)`
  position: relative;
  box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
  border-top: 1px solid #e1e3eb;
  // remove z-index

  .react-resizable-handle {
    position: absolute;
    border-top: transparent solid 3px;
    width: 100%;
    padding: 0 3px 3px 0;
    top: 0;
    cursor: row-resize;
  }
`;
m(g)`
  width: 40px;
  padding: 6px 0;

  .ant-menu-item {
    height: 30px;
    line-height: 30px;
  }
`, m.div`
  flex: 0 0 35px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e1e3eb;
  background: #fafafa;
`, m.h3`
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: #222222;
`;
const z = (t2) => {
  t2.preventDefault();
}, k = () => {
  window.addEventListener("mousedown", z);
};
const R = r((t2) => ({ orgId: s(t2).currentOrgId, datasourceInfos: t2.entities.datasource.data }), null)(function(e2) {
  const o2 = c(() => i(), []), r2 = document.documentElement.clientHeight, [s2, n2] = l(o2.bottom.h);
  return l("data"), f(b, { children: [x(y, { bottom: s2 }), x(v, { width: 1 / 0, height: o2.bottom.h, resizeHandles: ["n"], minConstraints: [680, 285], maxConstraints: [1 / 0, r2 - 48 - 40], onResizeStart: k, onResizeStop: (t2, e3) => {
    a({ ...o2, bottom: { h: e3.size.height } }), n2(e3.size.height), window.removeEventListener("mousedown", z);
  }, children: x(t, {}) })] });
});
export {
  R as default
};
