"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
    for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
var jsx_runtime_1 = require("react/jsx-runtime");
var react_1 = require("react");
var PACKAGE_NAME = "@wormhole-foundation/wormhole-connect";
var DEFAULT_VERSION = "0.0.12" || "latest";
function WormholeBridge(_a) {
    var config = _a.config, _b = _a.versionOrTag, versionOrTag = _b === void 0 ? DEFAULT_VERSION : _b;
    (0, react_1.useEffect)(function () {
        var script = document.createElement("script");
        script.src = "https://www.unpkg.com/".concat(PACKAGE_NAME, "@").concat(versionOrTag, "/dist/main.js");
        script.async = true;
        var link = document.createElement("link");
        link.href = "https://www.unpkg.com/".concat(PACKAGE_NAME, "@").concat(versionOrTag, "/dist/main.css");
        document.body.appendChild(script);
        document.body.appendChild(link);
        return function () {
            script.remove();
            link.remove();
        };
    }, [versionOrTag]);
    return ((0, jsx_runtime_1.jsx)("div", { id: "wormhole-connect", 
        //@ts-ignore
        config: config ? JSON.stringify(config) : null }));
}
__exportStar(require("./theme"), exports);
__exportStar(require("./types"), exports);
exports.default = WormholeBridge;
