'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-8277cbb3.js');
const domContextHooks_module = require('./dom-context-hooks.module-e7b6727c.js');
const index_module = require('./index.module-f8c8495f.js');

async function useGraphQLClientProvider({ domain }) {
  const token = index_module.G();
  const appDomain = domain;
  const tenantAlias = index_module.Q();
  // Memoization is shared. One client per domain, tenant and token (or null)
  const managedIdentityClient = index_module.Ee(appDomain, tenantAlias, token);
  const [, setGraphQLClient] = domContextHooks_module.m(index_module.Pe, managedIdentityClient);
  domContextHooks_module.useEffect(() => {
    setGraphQLClient(managedIdentityClient);
  }, [managedIdentityClient]);
}

const GraphQLClientProvider = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.ignored = true;
    domContextHooks_module.h$1(this);
  }
  disconnectedCallback() { }
  render() {
     useGraphQLClientProvider(this);
    return (index.h(index.Host, { style: { display: "contents" } }, index.h("slot", null)));
  }
};

exports.sqm_graphql_client_provider = GraphQLClientProvider;
