import { BottomContent as t } from "./BottomContent-279e560b.js";
import { iF as e, cr as o, iG as r, iH as i, fe as s, iI as a, iJ as n } from "./index-2be62fff.js";
import { d as m } from "./styled-components-c6abe9a3.js";
import { useContext as p, useRef as d, useState as l, useMemo as c } from "react";
import { D as j } from "./react-draggable-fda4f1cb.js";
import { u as h, H as u } from "./index-91499317.js";
import { lA as x, lR as f, lS as b } from "./ant-design-icons-14ab96af.js";
import { H as g } from "./antd-97b654da.js";
import "./react-router-8d1fc2f1.js";
import "./DraggableTree-5eba09cc.js";
import "./dnd-kit-e67c9595.js";
import "react-dom";
import "./lodash-226cb5b1.js";
import "./alasql-f59e855e.js";
import "./BottomMetaDrawer-f2c42805.js";
import "./axios-125479b5.js";
import "./redux-devtools-f8b1cd80.js";
import "./fontawesome-89eb6278.js";
import "./moment-d8baa15a.js";
import "./crypto-js-8020edb5.js";
import "./dayjs-7fc5ce65.js";
import "./numbro-48e81844.js";
import "./papaparse-088c0adc.js";
import "./uuid-82f303b2.js";
import "./supabase-2e4a9112.js";
import "./fetch-6a200310.js";
import "./remark-gfm-e9b5dec7.js";
import "./buffer-e20f80c8.js";
import "./rehype-raw-41b6145f.js";
import "./parse5-6476676e.js";
import "./rehype-sanitize-deb53e9a.js";
import "./simplebar-react-cab52c82.js";
import "./react-best-gradient-color-picker-812be7ee.js";
import "./ua-parser-js-1d18a3f8.js";
import "./clsx-469c2c43.js";
import "./loglevel-5e7e37fc.js";
import "./codemirror-edf161cb.js";
import "./really-relaxed-json-e5391d6a.js";
import "./immer-c0428a8d.js";
import "./redux-saga-1b0a458d.js";
import "./hotkeys-js-0dddb21a.js";
import "./cnchar-8c3eaa86.js";
import "./react-documents-ae08f8b5.js";
import "./sql-formatter-69e8df59.js";
import "./rc-trigger-9e54e169.js";
import "./react-json-view-364658b4.js";
import "./qrcode-react-e4f7745b.js";
import "./katex-cda5b990.js";
import "./ecogis-maps-10bb29cf.js";
import "./devextreme-28d23085.js";
import "./exceljs-1678d36b.js";
import "./file-saver-es-c18fae8f.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;
`, v = (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: v2 } = 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 }), v2] }) }) : null;
}, y = 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(v, { bottom: s2 }), x(y, { 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
};
