var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, {
  get: (a2, b3) => (typeof require !== "undefined" ? require : a2)[b3]
}) : x2)(function(x2) {
  if (typeof require !== "undefined")
    return require.apply(this, arguments);
  throw Error('Dynamic require of "' + x2 + '" is not supported');
});
var __commonJS = (cb, mod) => function __require2() {
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));

// ../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js
var require_use_sync_external_store_shim_production = __commonJS({
  "../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js"(exports) {
    "use strict";
    var React2 = __require("react");
    function is(x2, y3) {
      return x2 === y3 && (0 !== x2 || 1 / x2 === 1 / y3) || x2 !== x2 && y3 !== y3;
    }
    var objectIs = "function" === typeof Object.is ? Object.is : is;
    var useState = React2.useState;
    var useEffect = React2.useEffect;
    var useLayoutEffect = React2.useLayoutEffect;
    var useDebugValue = React2.useDebugValue;
    function useSyncExternalStore$2(subscribe, getSnapshot) {
      var value = getSnapshot(), _useState = useState({ inst: { value, getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1];
      useLayoutEffect(
        function() {
          inst.value = value;
          inst.getSnapshot = getSnapshot;
          checkIfSnapshotChanged(inst) && forceUpdate({ inst });
        },
        [subscribe, value, getSnapshot]
      );
      useEffect(
        function() {
          checkIfSnapshotChanged(inst) && forceUpdate({ inst });
          return subscribe(function() {
            checkIfSnapshotChanged(inst) && forceUpdate({ inst });
          });
        },
        [subscribe]
      );
      useDebugValue(value);
      return value;
    }
    function checkIfSnapshotChanged(inst) {
      var latestGetSnapshot = inst.getSnapshot;
      inst = inst.value;
      try {
        var nextValue = latestGetSnapshot();
        return !objectIs(inst, nextValue);
      } catch (error) {
        return true;
      }
    }
    function useSyncExternalStore$1(subscribe, getSnapshot) {
      return getSnapshot();
    }
    var shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
    exports.useSyncExternalStore = void 0 !== React2.useSyncExternalStore ? React2.useSyncExternalStore : shim;
  }
});

// ../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
var require_use_sync_external_store_shim_development = __commonJS({
  "../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) {
    "use strict";
    "production" !== process.env.NODE_ENV && function() {
      function is(x2, y3) {
        return x2 === y3 && (0 !== x2 || 1 / x2 === 1 / y3) || x2 !== x2 && y3 !== y3;
      }
      function useSyncExternalStore$2(subscribe, getSnapshot) {
        didWarnOld18Alpha || void 0 === React2.startTransition || (didWarnOld18Alpha = true, console.error(
          "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
        ));
        var value = getSnapshot();
        if (!didWarnUncachedGetSnapshot) {
          var cachedValue = getSnapshot();
          objectIs(value, cachedValue) || (console.error(
            "The result of getSnapshot should be cached to avoid an infinite loop"
          ), didWarnUncachedGetSnapshot = true);
        }
        cachedValue = useState({
          inst: { value, getSnapshot }
        });
        var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
        useLayoutEffect(
          function() {
            inst.value = value;
            inst.getSnapshot = getSnapshot;
            checkIfSnapshotChanged(inst) && forceUpdate({ inst });
          },
          [subscribe, value, getSnapshot]
        );
        useEffect(
          function() {
            checkIfSnapshotChanged(inst) && forceUpdate({ inst });
            return subscribe(function() {
              checkIfSnapshotChanged(inst) && forceUpdate({ inst });
            });
          },
          [subscribe]
        );
        useDebugValue(value);
        return value;
      }
      function checkIfSnapshotChanged(inst) {
        var latestGetSnapshot = inst.getSnapshot;
        inst = inst.value;
        try {
          var nextValue = latestGetSnapshot();
          return !objectIs(inst, nextValue);
        } catch (error) {
          return true;
        }
      }
      function useSyncExternalStore$1(subscribe, getSnapshot) {
        return getSnapshot();
      }
      "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
      var React2 = __require("react"), objectIs = "function" === typeof Object.is ? Object.is : is, useState = React2.useState, useEffect = React2.useEffect, useLayoutEffect = React2.useLayoutEffect, useDebugValue = React2.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
      exports.useSyncExternalStore = void 0 !== React2.useSyncExternalStore ? React2.useSyncExternalStore : shim;
      "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
    }();
  }
});

// ../../node_modules/use-sync-external-store/shim/index.js
var require_shim = __commonJS({
  "../../node_modules/use-sync-external-store/shim/index.js"(exports, module) {
    "use strict";
    if (process.env.NODE_ENV === "production") {
      module.exports = require_use_sync_external_store_shim_production();
    } else {
      module.exports = require_use_sync_external_store_shim_development();
    }
  }
});

// ../../node_modules/@preact/signals-core/dist/signals-core.mjs
var i = Symbol.for("preact-signals");
function t() {
  if (r > 1) {
    r--;
    return;
  }
  let i3, t2 = false;
  while (void 0 !== s) {
    let o = s;
    s = void 0;
    f++;
    while (void 0 !== o) {
      const n2 = o.o;
      o.o = void 0;
      o.f &= -3;
      if (!(8 & o.f) && v(o))
        try {
          o.c();
        } catch (o2) {
          if (!t2) {
            i3 = o2;
            t2 = true;
          }
        }
      o = n2;
    }
  }
  f = 0;
  r--;
  if (t2)
    throw i3;
}
var n;
var s;
function h(i3) {
  const t2 = n;
  n = void 0;
  try {
    return i3();
  } finally {
    n = t2;
  }
}
var r = 0;
var f = 0;
var e = 0;
function c(i3) {
  if (void 0 === n)
    return;
  let t2 = i3.n;
  if (void 0 === t2 || t2.t !== n) {
    t2 = { i: 0, S: i3, p: n.s, n: void 0, t: n, e: void 0, x: void 0, r: t2 };
    if (void 0 !== n.s)
      n.s.n = t2;
    n.s = t2;
    i3.n = t2;
    if (32 & n.f)
      i3.S(t2);
    return t2;
  } else if (-1 === t2.i) {
    t2.i = 0;
    if (void 0 !== t2.n) {
      t2.n.p = t2.p;
      if (void 0 !== t2.p)
        t2.p.n = t2.n;
      t2.p = n.s;
      t2.n = void 0;
      n.s.n = t2;
      n.s = t2;
    }
    return t2;
  }
}
function u(i3, t2) {
  this.v = i3;
  this.i = 0;
  this.n = void 0;
  this.t = void 0;
  this.W = null == t2 ? void 0 : t2.watched;
  this.Z = null == t2 ? void 0 : t2.unwatched;
}
u.prototype.brand = i;
u.prototype.h = function() {
  return true;
};
u.prototype.S = function(i3) {
  const t2 = this.t;
  if (t2 !== i3 && void 0 === i3.e) {
    i3.x = t2;
    this.t = i3;
    if (void 0 !== t2)
      t2.e = i3;
    else
      h(() => {
        var i4;
        null == (i4 = this.W) || i4.call(this);
      });
  }
};
u.prototype.U = function(i3) {
  if (void 0 !== this.t) {
    const t2 = i3.e, o = i3.x;
    if (void 0 !== t2) {
      t2.x = o;
      i3.e = void 0;
    }
    if (void 0 !== o) {
      o.e = t2;
      i3.x = void 0;
    }
    if (i3 === this.t) {
      this.t = o;
      if (void 0 === o)
        h(() => {
          var i4;
          null == (i4 = this.Z) || i4.call(this);
        });
    }
  }
};
u.prototype.subscribe = function(i3) {
  return E(() => {
    const t2 = this.value, o = n;
    n = void 0;
    try {
      i3(t2);
    } finally {
      n = o;
    }
  });
};
u.prototype.valueOf = function() {
  return this.value;
};
u.prototype.toString = function() {
  return this.value + "";
};
u.prototype.toJSON = function() {
  return this.value;
};
u.prototype.peek = function() {
  const i3 = n;
  n = void 0;
  try {
    return this.value;
  } finally {
    n = i3;
  }
};
Object.defineProperty(u.prototype, "value", { get() {
  const i3 = c(this);
  if (void 0 !== i3)
    i3.i = this.i;
  return this.v;
}, set(i3) {
  if (i3 !== this.v) {
    if (f > 100)
      throw new Error("Cycle detected");
    this.v = i3;
    this.i++;
    e++;
    r++;
    try {
      for (let i4 = this.t; void 0 !== i4; i4 = i4.x)
        i4.t.N();
    } finally {
      t();
    }
  }
} });
function v(i3) {
  for (let t2 = i3.s; void 0 !== t2; t2 = t2.n)
    if (t2.S.i !== t2.i || !t2.S.h() || t2.S.i !== t2.i)
      return true;
  return false;
}
function l(i3) {
  for (let t2 = i3.s; void 0 !== t2; t2 = t2.n) {
    const o = t2.S.n;
    if (void 0 !== o)
      t2.r = o;
    t2.S.n = t2;
    t2.i = -1;
    if (void 0 === t2.n) {
      i3.s = t2;
      break;
    }
  }
}
function y(i3) {
  let t2, o = i3.s;
  while (void 0 !== o) {
    const i4 = o.p;
    if (-1 === o.i) {
      o.S.U(o);
      if (void 0 !== i4)
        i4.n = o.n;
      if (void 0 !== o.n)
        o.n.p = i4;
    } else
      t2 = o;
    o.S.n = o.r;
    if (void 0 !== o.r)
      o.r = void 0;
    o = i4;
  }
  i3.s = t2;
}
function a(i3, t2) {
  u.call(this, void 0);
  this.x = i3;
  this.s = void 0;
  this.g = e - 1;
  this.f = 4;
  this.W = null == t2 ? void 0 : t2.watched;
  this.Z = null == t2 ? void 0 : t2.unwatched;
}
a.prototype = new u();
a.prototype.h = function() {
  this.f &= -3;
  if (1 & this.f)
    return false;
  if (32 == (36 & this.f))
    return true;
  this.f &= -5;
  if (this.g === e)
    return true;
  this.g = e;
  this.f |= 1;
  if (this.i > 0 && !v(this)) {
    this.f &= -2;
    return true;
  }
  const i3 = n;
  try {
    l(this);
    n = this;
    const i4 = this.x();
    if (16 & this.f || this.v !== i4 || 0 === this.i) {
      this.v = i4;
      this.f &= -17;
      this.i++;
    }
  } catch (i4) {
    this.v = i4;
    this.f |= 16;
    this.i++;
  }
  n = i3;
  y(this);
  this.f &= -2;
  return true;
};
a.prototype.S = function(i3) {
  if (void 0 === this.t) {
    this.f |= 36;
    for (let i4 = this.s; void 0 !== i4; i4 = i4.n)
      i4.S.S(i4);
  }
  u.prototype.S.call(this, i3);
};
a.prototype.U = function(i3) {
  if (void 0 !== this.t) {
    u.prototype.U.call(this, i3);
    if (void 0 === this.t) {
      this.f &= -33;
      for (let i4 = this.s; void 0 !== i4; i4 = i4.n)
        i4.S.U(i4);
    }
  }
};
a.prototype.N = function() {
  if (!(2 & this.f)) {
    this.f |= 6;
    for (let i3 = this.t; void 0 !== i3; i3 = i3.x)
      i3.t.N();
  }
};
Object.defineProperty(a.prototype, "value", { get() {
  if (1 & this.f)
    throw new Error("Cycle detected");
  const i3 = c(this);
  this.h();
  if (void 0 !== i3)
    i3.i = this.i;
  if (16 & this.f)
    throw this.v;
  return this.v;
} });
function _(i3) {
  const o = i3.u;
  i3.u = void 0;
  if ("function" == typeof o) {
    r++;
    const s3 = n;
    n = void 0;
    try {
      o();
    } catch (t2) {
      i3.f &= -2;
      i3.f |= 8;
      g(i3);
      throw t2;
    } finally {
      n = s3;
      t();
    }
  }
}
function g(i3) {
  for (let t2 = i3.s; void 0 !== t2; t2 = t2.n)
    t2.S.U(t2);
  i3.x = void 0;
  i3.s = void 0;
  _(i3);
}
function p(i3) {
  if (n !== this)
    throw new Error("Out-of-order effect");
  y(this);
  n = i3;
  this.f &= -2;
  if (8 & this.f)
    g(this);
  t();
}
function b(i3) {
  this.x = i3;
  this.u = void 0;
  this.s = void 0;
  this.o = void 0;
  this.f = 32;
}
b.prototype.c = function() {
  const i3 = this.S();
  try {
    if (8 & this.f)
      return;
    if (void 0 === this.x)
      return;
    const t2 = this.x();
    if ("function" == typeof t2)
      this.u = t2;
  } finally {
    i3();
  }
};
b.prototype.S = function() {
  if (1 & this.f)
    throw new Error("Cycle detected");
  this.f |= 1;
  this.f &= -9;
  _(this);
  l(this);
  r++;
  const i3 = n;
  n = this;
  return p.bind(this, i3);
};
b.prototype.N = function() {
  if (!(2 & this.f)) {
    this.f |= 2;
    this.o = s;
    s = this;
  }
};
b.prototype.d = function() {
  this.f |= 8;
  if (!(1 & this.f))
    g(this);
};
function E(i3) {
  const t2 = new b(i3);
  try {
    t2.c();
  } catch (i4) {
    t2.d();
    throw i4;
  }
  return t2.d.bind(t2);
}

// ../../node_modules/@preact/signals-react/runtime/dist/runtime.mjs
var import_shim = __toESM(require_shim(), 1);
import { version as i2, useRef as r2, useMemo as f2, useEffect as s2, useLayoutEffect as u2 } from "react";
var [l2] = i2.split(".").map(Number);
var d2 = Symbol.for(l2 >= 19 ? "react.transitional.element" : "react.element");
var m = Symbol.dispose || Symbol.for("Symbol.dispose");
var b2;
function y2(t2, n2) {
  const e2 = n2.effect.S();
  b2 = n2;
  return g2.bind(n2, t2, e2);
}
function g2(t2, n2) {
  n2();
  b2 = t2;
}
var h2 = () => {
};
var v2 = { o: 0, effect: { s: void 0, c() {
}, S: () => h2, d() {
} }, subscribe: () => h2, getSnapshot: () => 0, S() {
}, f() {
}, [m]() {
} };
var _2 = Promise.prototype.then.bind(Promise.resolve());
var S;
function w2() {
  if (!S)
    S = _2(x);
}
function x() {
  var t2;
  S = void 0;
  null == (t2 = b2) || t2.f();
}
var j = "undefined" != typeof window ? u2 : s2;
function P(t2 = 0) {
  w2();
  const n2 = r2();
  if (null == n2.current)
    if ("undefined" == typeof window)
      n2.current = v2;
    else
      n2.current = function(t3) {
        let n3, e3, i3, r3 = 0, f3 = E(function() {
          n3 = this;
        });
        n3.c = function() {
          r3 = r3 + 1 | 0;
          if (i3)
            i3();
        };
        return { o: t3, effect: n3, subscribe(t4) {
          i3 = t4;
          return function() {
            r3 = r3 + 1 | 0;
            i3 = void 0;
            f3();
          };
        }, getSnapshot: () => r3, S() {
          if (null == b2) {
            e3 = y2(void 0, this);
            return;
          }
          const t4 = b2.o, n4 = this.o;
          if (0 == t4 && 0 == n4 || 0 == t4 && 1 == n4) {
            b2.f();
            e3 = y2(void 0, this);
          } else if (1 == t4 && 0 == n4 || 2 == t4 && 0 == n4)
            ;
          else
            e3 = y2(b2, this);
        }, f() {
          const t4 = e3;
          e3 = void 0;
          null == t4 || t4();
        }, [m]() {
          this.f();
        } };
      }(t2);
  const e2 = n2.current;
  (0, import_shim.useSyncExternalStore)(e2.subscribe, e2.getSnapshot, e2.getSnapshot);
  e2.S();
  if (0 === t2)
    j(x);
  return e2;
}
Object.defineProperties(u.prototype, { $$typeof: { configurable: true, value: d2 }, type: { configurable: true, value: function({ data: t2 }) {
  const n2 = P(1);
  try {
    return t2.value;
  } finally {
    n2.f();
  }
} }, props: { configurable: true, get() {
  return { data: this };
} }, ref: { configurable: true, value: null } });
function $(t2) {
  return P(t2);
}

// ../sdk-react-context/build/index.mjs
import { createContext } from "react";
if (!globalThis.WixReactContext) {
  globalThis.WixReactContext = createContext(void 0);
}
var WixContext = globalThis.WixReactContext;

// ../services-definitions/build/index.js
var ThreadMode;
(function(ThreadMode2) {
  ThreadMode2[ThreadMode2["MAIN"] = 0] = "MAIN";
  ThreadMode2[ThreadMode2["REMOTE"] = 1] = "REMOTE";
})(ThreadMode || (ThreadMode = {}));
function defineService(id) {
  return id;
}
function implementService(_3, factory) {
  return factory;
}
implementService.withConfig = function() {
  return function(_3, factory) {
    return factory;
  };
};

// src/core-services/provide-component/definition.ts
var ProvideComponentServiceDefinition = defineService("core:provide-component");

// src/index.tsx
import React, { useContext } from "react";
function ServicesManagerProvider({
  servicesManager,
  children
}) {
  const getProvidedComponent = () => {
    const provideComponentService = servicesManager.hasService(
      ProvideComponentServiceDefinition
    ) ? servicesManager.getService(
      ProvideComponentServiceDefinition
    ) : {
      getAllProviders: () => null,
      getAllTopComponents: () => null,
      getAllBottomComponents: () => null
    };
    return {
      ProvidersComponent: provideComponentService?.getAllProviders(),
      TopComponents: provideComponentService?.getAllTopComponents(),
      BottomComponents: provideComponentService?.getAllBottomComponents()
    };
  };
  const { ProvidersComponent, TopComponents, BottomComponents } = getProvidedComponent();
  return /* @__PURE__ */ React.createElement(WixContext.Provider, { value: { getService: servicesManager.getService } }, TopComponents && /* @__PURE__ */ React.createElement(TopComponents, null), ProvidersComponent ? /* @__PURE__ */ React.createElement(ProvidersComponent, null, children) : children, BottomComponents && /* @__PURE__ */ React.createElement(BottomComponents, null));
}
function useGetService() {
  const { getService } = useContext(WixContext);
  if (!getService) {
    throw new Error(
      "No ServiceManagerProvider found in the component tree, make sure to wrap your app with ServicesManagerProvider"
    );
  }
  return getService;
}
function useService(service) {
  const getService = useGetService();
  $();
  return getService(service);
}
function useServices(services) {
  const getService = useGetService();
  if (!getService) {
    throw new Error(
      "No ServiceManagerProvider found in the component tree, make sure to wrap your app with ServicesManagerProvider"
    );
  }
  return services.map((service) => getService(service));
}
export {
  ServicesManagerProvider,
  useGetService,
  useService,
  useServices
};
/*! Bundled license information:

use-sync-external-store/cjs/use-sync-external-store-shim.production.js:
  (**
   * @license React
   * use-sync-external-store-shim.production.js
   *
   * Copyright (c) Meta Platforms, Inc. and affiliates.
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE file in the root directory of this source tree.
   *)

use-sync-external-store/cjs/use-sync-external-store-shim.development.js:
  (**
   * @license React
   * use-sync-external-store-shim.development.js
   *
   * Copyright (c) Meta Platforms, Inc. and affiliates.
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE file in the root directory of this source tree.
   *)
*/