UNPKG

@zooom/integration-react

Version:

A Zooom integration for using React in PHP based websites

467 lines (464 loc) 16.8 kB
import ye from "react"; import { createRoot as je } from "react-dom/client"; var O = { exports: {} }, k = {}; /** * @license React * react-jsx-runtime.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. */ var ie; function Ce() { if (ie) return k; ie = 1; var f = Symbol.for("react.transitional.element"), h = Symbol.for("react.fragment"); function l(w, c, i) { var E = null; if (i !== void 0 && (E = "" + i), c.key !== void 0 && (E = "" + c.key), "key" in c) { i = {}; for (var d in c) d !== "key" && (i[d] = c[d]); } else i = c; return c = i.ref, { $$typeof: f, type: w, key: E, ref: c !== void 0 ? c : null, props: i }; } return k.Fragment = h, k.jsx = l, k.jsxs = l, k; } var p = {}; /** * @license React * react-jsx-runtime.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. */ var Ee; function ke() { return Ee || (Ee = 1, process.env.NODE_ENV !== "production" && function() { function f(e) { if (e == null) return null; if (typeof e == "function") return e.$$typeof === he ? null : e.displayName || e.name || null; if (typeof e == "string") return e; switch (e) { case Y: return "Fragment"; case Re: return "Portal"; case F: return "Profiler"; case L: return "StrictMode"; case $: return "Suspense"; case W: return "SuspenseList"; } if (typeof e == "object") switch (typeof e.tag == "number" && console.error( "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." ), e.$$typeof) { case I: return (e.displayName || "Context") + ".Provider"; case Z: return (e._context.displayName || "Context") + ".Consumer"; case M: var r = e.render; return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e; case U: return r = e.displayName || null, r !== null ? r : f(e.type) || "Memo"; case q: r = e._payload, e = e._init; try { return f(e(r)); } catch { } } return null; } function h(e) { return "" + e; } function l(e) { try { h(e); var r = !1; } catch { r = !0; } if (r) { r = console; var t = r.error, n = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object"; return t.call( r, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", n ), h(e); } } function w() { } function c() { if (j === 0) { D = console.log, ee = console.info, re = console.warn, te = console.error, oe = console.group, ne = console.groupCollapsed, ae = console.groupEnd; var e = { configurable: !0, enumerable: !0, value: w, writable: !0 }; Object.defineProperties(console, { info: e, log: e, warn: e, error: e, group: e, groupCollapsed: e, groupEnd: e }); } j++; } function i() { if (j--, j === 0) { var e = { configurable: !0, enumerable: !0, writable: !0 }; Object.defineProperties(console, { log: R({}, e, { value: D }), info: R({}, e, { value: ee }), warn: R({}, e, { value: re }), error: R({}, e, { value: te }), group: R({}, e, { value: oe }), groupCollapsed: R({}, e, { value: ne }), groupEnd: R({}, e, { value: ae }) }); } 0 > j && console.error( "disabledDepth fell below zero. This is a bug in React. Please file an issue." ); } function E(e) { if (z === void 0) try { throw Error(); } catch (t) { var r = t.stack.trim().match(/\n( *(at )?)/); z = r && r[1] || "", ue = -1 < t.stack.indexOf(` at`) ? " (<anonymous>)" : -1 < t.stack.indexOf("@") ? "@unknown:0:0" : ""; } return ` ` + z + e + ue; } function d(e, r) { if (!e || H) return ""; var t = V.get(e); if (t !== void 0) return t; H = !0, t = Error.prepareStackTrace, Error.prepareStackTrace = void 0; var n = null; n = _.H, _.H = null, c(); try { var u = { DetermineComponentFrameRoot: function() { try { if (r) { var b = function() { throw Error(); }; if (Object.defineProperty(b.prototype, "props", { set: function() { throw Error(); } }), typeof Reflect == "object" && Reflect.construct) { try { Reflect.construct(b, []); } catch (m) { var A = m; } Reflect.construct(e, [], b); } else { try { b.call(); } catch (m) { A = m; } e.call(b.prototype); } } else { try { throw Error(); } catch (m) { A = m; } (b = e()) && typeof b.catch == "function" && b.catch(function() { }); } } catch (m) { if (m && A && typeof m.stack == "string") return [m.stack, A.stack]; } return [null, null]; } }; u.DetermineComponentFrameRoot.displayName = "DetermineComponentFrameRoot"; var a = Object.getOwnPropertyDescriptor( u.DetermineComponentFrameRoot, "name" ); a && a.configurable && Object.defineProperty( u.DetermineComponentFrameRoot, "name", { value: "DetermineComponentFrameRoot" } ); var o = u.DetermineComponentFrameRoot(), v = o[0], y = o[1]; if (v && y) { var s = v.split(` `), T = y.split(` `); for (o = a = 0; a < s.length && !s[a].includes( "DetermineComponentFrameRoot" ); ) a++; for (; o < T.length && !T[o].includes( "DetermineComponentFrameRoot" ); ) o++; if (a === s.length || o === T.length) for (a = s.length - 1, o = T.length - 1; 1 <= a && 0 <= o && s[a] !== T[o]; ) o--; for (; 1 <= a && 0 <= o; a--, o--) if (s[a] !== T[o]) { if (a !== 1 || o !== 1) do if (a--, o--, 0 > o || s[a] !== T[o]) { var C = ` ` + s[a].replace( " at new ", " at " ); return e.displayName && C.includes("<anonymous>") && (C = C.replace("<anonymous>", e.displayName)), typeof e == "function" && V.set(e, C), C; } while (1 <= a && 0 <= o); break; } } } finally { H = !1, _.H = n, i(), Error.prepareStackTrace = t; } return s = (s = e ? e.displayName || e.name : "") ? E(s) : "", typeof e == "function" && V.set(e, s), s; } function x(e) { if (e == null) return ""; if (typeof e == "function") { var r = e.prototype; return d( e, !(!r || !r.isReactComponent) ); } if (typeof e == "string") return E(e); switch (e) { case $: return E("Suspense"); case W: return E("SuspenseList"); } if (typeof e == "object") switch (e.$$typeof) { case M: return e = d(e.render, !1), e; case U: return x(e.type); case q: r = e._payload, e = e._init; try { return x(e(r)); } catch { } } return ""; } function g() { var e = _.A; return e === null ? null : e.getOwner(); } function S(e) { if (K.call(e, "key")) { var r = Object.getOwnPropertyDescriptor(e, "key").get; if (r && r.isReactWarning) return !1; } return e.key !== void 0; } function ve(e, r) { function t() { le || (le = !0, console.error( "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", r )); } t.isReactWarning = !0, Object.defineProperty(e, "key", { get: t, configurable: !0 }); } function me() { var e = f(this.type); return se[e] || (se[e] = !0, console.error( "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release." )), e = this.props.ref, e !== void 0 ? e : null; } function be(e, r, t, n, u, a) { return t = a.ref, e = { $$typeof: P, type: e, key: r, props: a, _owner: u }, (t !== void 0 ? t : null) !== null ? Object.defineProperty(e, "ref", { enumerable: !1, get: me }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: 0 }), Object.defineProperty(e, "_debugInfo", { configurable: !1, enumerable: !1, writable: !0, value: null }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e; } function G(e, r, t, n, u, a) { if (typeof e == "string" || typeof e == "function" || e === Y || e === F || e === L || e === $ || e === W || e === Te || typeof e == "object" && e !== null && (e.$$typeof === q || e.$$typeof === U || e.$$typeof === I || e.$$typeof === Z || e.$$typeof === M || e.$$typeof === we || e.getModuleId !== void 0)) { var o = r.children; if (o !== void 0) if (n) if (J(o)) { for (n = 0; n < o.length; n++) X(o[n], e); Object.freeze && Object.freeze(o); } else console.error( "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead." ); else X(o, e); } else o = "", (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (o += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."), e === null ? n = "null" : J(e) ? n = "array" : e !== void 0 && e.$$typeof === P ? (n = "<" + (f(e.type) || "Unknown") + " />", o = " Did you accidentally export a JSX literal instead of a component?") : n = typeof e, console.error( "React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", n, o ); if (K.call(r, "key")) { o = f(e); var v = Object.keys(r).filter(function(s) { return s !== "key"; }); n = 0 < v.length ? "{key: someKey, " + v.join(": ..., ") + ": ...}" : "{key: someKey}", ce[o + n] || (v = 0 < v.length ? "{" + v.join(": ..., ") + ": ...}" : "{}", console.error( `A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; <%s key={someKey} {...props} />`, n, o, v, o ), ce[o + n] = !0); } if (o = null, t !== void 0 && (l(t), o = "" + t), S(r) && (l(r.key), o = "" + r.key), "key" in r) { t = {}; for (var y in r) y !== "key" && (t[y] = r[y]); } else t = r; return o && ve( t, typeof e == "function" ? e.displayName || e.name || "Unknown" : e ), be(e, o, a, u, g(), t); } function X(e, r) { if (typeof e == "object" && e && e.$$typeof !== xe) { if (J(e)) for (var t = 0; t < e.length; t++) { var n = e[t]; N(n) && B(n, r); } else if (N(e)) e._store && (e._store.validated = 1); else if (e === null || typeof e != "object" ? t = null : (t = Q && e[Q] || e["@@iterator"], t = typeof t == "function" ? t : null), typeof t == "function" && t !== e.entries && (t = t.call(e), t !== e)) for (; !(e = t.next()).done; ) N(e.value) && B(e.value, r); } } function N(e) { return typeof e == "object" && e !== null && e.$$typeof === P; } function B(e, r) { if (e._store && !e._store.validated && e.key == null && (e._store.validated = 1, r = ge(r), !fe[r])) { fe[r] = !0; var t = ""; e && e._owner != null && e._owner !== g() && (t = null, typeof e._owner.tag == "number" ? t = f(e._owner.type) : typeof e._owner.name == "string" && (t = e._owner.name), t = " It was passed a child from " + t + "."); var n = _.getCurrentStack; _.getCurrentStack = function() { var u = x(e.type); return n && (u += n() || ""), u; }, console.error( 'Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.', r, t ), _.getCurrentStack = n; } } function ge(e) { var r = "", t = g(); return t && (t = f(t.type)) && (r = ` Check the render method of \`` + t + "`."), r || (e = f(e)) && (r = ` Check the top-level render call using <` + e + ">."), r; } var _e = ye, P = Symbol.for("react.transitional.element"), Re = Symbol.for("react.portal"), Y = Symbol.for("react.fragment"), L = Symbol.for("react.strict_mode"), F = Symbol.for("react.profiler"), Z = Symbol.for("react.consumer"), I = Symbol.for("react.context"), M = Symbol.for("react.forward_ref"), $ = Symbol.for("react.suspense"), W = Symbol.for("react.suspense_list"), U = Symbol.for("react.memo"), q = Symbol.for("react.lazy"), Te = Symbol.for("react.offscreen"), Q = Symbol.iterator, he = Symbol.for("react.client.reference"), _ = _e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, K = Object.prototype.hasOwnProperty, R = Object.assign, we = Symbol.for("react.client.reference"), J = Array.isArray, j = 0, D, ee, re, te, oe, ne, ae; w.__reactDisabledLog = !0; var z, ue, H = !1, V = new (typeof WeakMap == "function" ? WeakMap : Map)(), xe = Symbol.for("react.client.reference"), le, se = {}, ce = {}, fe = {}; p.Fragment = Y, p.jsx = function(e, r, t, n, u) { return G(e, r, t, !1, n, u); }, p.jsxs = function(e, r, t, n, u) { return G(e, r, t, !0, n, u); }; }()), p; } var de; function pe() { return de || (de = 1, process.env.NODE_ENV === "production" ? O.exports = Ce() : O.exports = ke()), O.exports; } var Ae = pe(); function Ne(f, h, l) { class w extends HTMLElement { constructor() { super(); } connectedCallback() { const E = l != null && l.shadowRoot ? this.attachShadow( typeof l.shadowRoot == "object" ? l.shadowRoot : { mode: l.shadowRoot } ) : this, d = Object.fromEntries( Array.from(this.attributes).map((g) => { const S = [g.name, g.value]; return this.removeAttribute(g.name), S; }) ), x = this.innerHTML.trim(); x !== "" && (d.children = x), je(E).render(/* @__PURE__ */ Ae.jsx(h, { ...d })); } } const c = `${(l == null ? void 0 : l.prefix) || "react"}-${f}`; customElements.get(c) || customElements.define(c, w); } export { Ne as registerReactComponent };