"use client";
'use strict';

var react = require('react');
var jsxRuntime = require('react/jsx-runtime');

var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
function CompanyProfile({
  symbol = "NASDAQ:AAPL",
  width = "100%",
  height = "100%",
  locale = "en",
  colorTheme = "dark",
  isTransparent = false
}) {
  const containerRef = react.useRef(null);
  react.useEffect(() => {
    if (!containerRef.current) return;
    if (containerRef.current.dataset.initialized === "true") {
      return;
    }
    containerRef.current.dataset.initialized = "true";
    const script = document.createElement("script");
    script.src = "https://s3.tradingview.com/external-embedding/embed-widget-symbol-profile.js";
    script.async = true;
    script.innerHTML = JSON.stringify({
      width,
      height,
      colorTheme,
      isTransparent,
      symbol,
      locale
    });
    containerRef.current.appendChild(script);
    return () => {
      if (containerRef.current) {
        delete containerRef.current.dataset.initialized;
        const scripts = containerRef.current.querySelectorAll("script");
        scripts.forEach((s) => s.remove());
      }
    };
  }, [symbol, width, height, locale, colorTheme, isTransparent]);
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tradingview-widget-container", ref: containerRef, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tradingview-widget-container__widget" }) });
}
__name(CompanyProfile, "CompanyProfile");

module.exports = CompanyProfile;
