import { getVtxToken } from '@vtx/utils';
import useSettings from "../../_hooks/useSettings";
import "./style/index.less";
import dayjs from 'dayjs';
import { jsx as _jsx } from "react/jsx-runtime";
var VmCustom = function VmCustom(_ref) {
  var id = _ref.id,
    url = _ref.url;
  var _useSettings = useSettings(),
    theme = _useSettings.theme,
    date = _useSettings.date;
  var _getVtxToken = getVtxToken(),
    token = _getVtxToken.token,
    userId = _getVtxToken.userId,
    tenantId = _getVtxToken.tenantId;
  var param = (url === null || url === void 0 ? void 0 : url.indexOf('http')) > -1 ? "&userId=".concat(userId, "&tenantId=").concat(tenantId, "&token=").concat(token) : '';
  return /*#__PURE__*/_jsx("iframe", {
    src: "".concat(url).concat(id, "&theme=").concat(theme).concat(param, "&date=").concat(date ? dayjs(date).format('YYYY-MM-DD') : ''),
    style: {
      width: '100%',
      height: 600,
      border: 'none',
      overflowY: 'auto'
    }
  }, url);
};
export default VmCustom;