import { BottomContent as t } from "./BottomContent-64f5e769.js";
import { hE as o, a8 as e, hF as r, hG as s, eh as i, hH as a, hI as n } from "./index-f927b013.js";
import { u as m } from "./styled-components-7cfa37e6.js";
import { useContext as p, useRef as d, useState as l, useMemo as c } from "react";
import { D as h } from "./react-draggable-ed505bfc.js";
import { u as j, H as u } from "./index-37c096d4.js";
import { lz as b, lI as f, lJ as x } from "./ant-design-icons-6bfdc7d5.js";
import "./DraggableTree-a141a05a.js";
import "./dnd-kit-8227a2db.js";
import "react-dom";
import "./lodash-b5661970.js";
import "./alasql-f60045ee.js";
import "./antd-2abdded3.js";
import "./dayjs-2035e031.js";
import "./BottomMetaDrawer-db0cdfbb.js";
import "./axios-04f95181.js";
import "./redux-devtools-8dd21e4f.js";
import "./fontawesome-3904a214.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 "./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 g = 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: ${o.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;
`, w = (t2) => {
  const { bottom: o2 } = t2, r2 = p(e), s2 = r2.showResultComp(), i2 = s2 == null ? void 0 : s2.result(), a2 = d(null), [n2, m2] = l(true), [c2, x2] = l({ left: 0, top: 0, bottom: 0, right: 0 }), { header: w2, body: y2 } = j({ ...i2 ?? { data: "", dataType: "default", success: true }, onClose: () => r2.setShowResultCompName(void 0) });
  return i2 ? b(h, { disabled: n2, bounds: c2, enableUserSelectHack: false, onStart: (t3, o3) => {
    var _a;
    const { clientWidth: e2, clientHeight: r3 } = window.document.documentElement, s3 = (_a = a2.current) == null ? void 0 : _a.getBoundingClientRect();
    s3 && x2({ left: -s3.left + o3.x, right: e2 - (s3.right - o3.x), top: -s3.top + o3.y, bottom: r3 - (s3.bottom - o3.y) });
  }, children: f(g, { $bottom: o2, ref: a2, children: [b(u, { onMouseOver: () => m2(false), onMouseOut: () => m2(true), children: w2 }), y2] }) }) : null;
}, y = m(n)`
  position: relative;
  box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
  border-top: 1px solid #e1e3eb;
  z-index: ${o.bottomPanel};

  .react-resizable-handle {
    position: absolute;
    border-top: transparent solid 3px;
    width: 100%;
    padding: 0 3px 3px 0;
    top: 0;
    cursor: row-resize;
  }
`, v = (t2) => {
  t2.preventDefault();
}, z = () => {
  window.addEventListener("mousedown", v);
};
const C = r((t2) => ({ orgId: i(t2).currentOrgId, datasourceInfos: t2.entities.datasource.data }), null)(function(o2) {
  const e2 = c(() => s(), []), r2 = document.documentElement.clientHeight, [i2, n2] = l(e2.bottom.h);
  return f(x, { children: [b(w, { bottom: i2 }), b(y, { width: 1 / 0, height: e2.bottom.h, resizeHandles: ["n"], minConstraints: [680, 285], maxConstraints: [1 / 0, r2 - 48 - 40], onResizeStart: z, onResizeStop: (t2, o3) => {
    a({ ...e2, bottom: { h: o3.size.height } }), n2(o3.size.height), window.removeEventListener("mousedown", v);
  }, children: b(t, {}) })] });
});
export {
  C as default
};
