import { Chart as Chart$1, KpiCard as KpiCard$1, MarkdownText as MarkdownText$1, ChoroplethGeoJson as ChoroplethGeoJson$1, ChoroplethVectorTiles as ChoroplethVectorTiles$1, ChoroplethSvg as ChoroplethSvg$1, PoiMap as PoiMap$1, WebGlMap as WebGlMap$1, Table as Table$1 } from '@opendatasoft/visualizations';
import React, { useRef, useLayoutEffect } from 'react';

/******************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise */


var __assign = function() {
    __assign = Object.assign || function __assign(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};

function reactifySvelte(Component, className) {
  return function (props) {
    var svelteComponentRef = useRef(null);
    var mountRef = useRef(null);
    useLayoutEffect(function () {
      if (mountRef === null || mountRef === void 0 ? void 0 : mountRef.current) {
        var component = new Component({
          target: mountRef.current,
          props: props
        });
        svelteComponentRef.current = component;
      }
      return function () {
        var _a;
        (_a = svelteComponentRef.current) === null || _a === void 0 ? void 0 : _a.$destroy();
      };
      // We especially don't want to react to props to avoid creating a new component each render
      // eslint-disable-next-line react-hooks/exhaustive-deps
    }, [mountRef]);
    if (svelteComponentRef === null || svelteComponentRef === void 0 ? void 0 : svelteComponentRef.current) {
      svelteComponentRef.current.$set(__assign({}, props));
    }
    return /*#__PURE__*/React.createElement("div", {
      className: "ods-visualization ".concat(className),
      ref: mountRef
    });
  };
}

var Chart = reactifySvelte(Chart$1, 'ods-visualizations-chart');
var KpiCard = reactifySvelte(KpiCard$1, 'ods-visualizations-kpi');
var MarkdownText = reactifySvelte(MarkdownText$1, 'ods-visualizations-md-text');
var ChoroplethGeoJson = reactifySvelte(ChoroplethGeoJson$1, 'ods-visualizations-choropleth');
var ChoroplethVectorTiles = reactifySvelte(ChoroplethVectorTiles$1, 'ods-visualizations-choropleth');
var ChoroplethSvg = reactifySvelte(ChoroplethSvg$1, 'ods-visualizations-choropleth-svg');
var PoiMap = reactifySvelte(PoiMap$1, 'ods-visualizations-poi-map');
var WebGlMap = reactifySvelte(WebGlMap$1, 'ods-visualizations-webgl-map');
var Table = reactifySvelte(Table$1, 'ods-visualizations-table');

export { Chart, ChoroplethGeoJson, ChoroplethSvg, ChoroplethVectorTiles, KpiCard, MarkdownText, PoiMap, Table, WebGlMap };
//# sourceMappingURL=index.es.js.map
