@financial-times/custom-code-component 2.0.1-alpha.9 → 2.0.1-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1,3 @@
1
- export declare const init: () => void;
1
+ export declare const init: () => void;
2
+
3
+ export { }
@@ -28,7 +28,7 @@ p.prototype.on = function(o, t, e, n) {
28
28
  throw new TypeError("Invalid event type: " + o);
29
29
  if (typeof t == "function" && (n = e, e = t, t = null), n === void 0 && (n = this.captureForType(o)), typeof e != "function")
30
30
  throw new TypeError("Handler must be a type of Function");
31
- return s = this.rootElement, r = this.listenerMap[n ? 1 : 0], r[o] || (s && s.addEventListener(o, this.handle, n), r[o] = []), t ? /^[a-z]+$/i.test(t) ? (c = t, i = T) : /^#[a-z0-9\-_]+$/i.test(t) ? (c = t.slice(1), i = S) : (c = t, i = Element.prototype.matches) : (c = null, i = $.bind(this)), r[o].push({
31
+ return s = this.rootElement, r = this.listenerMap[n ? 1 : 0], r[o] || (s && s.addEventListener(o, this.handle, n), r[o] = []), t ? /^[a-z]+$/i.test(t) ? (c = t, i = T) : /^#[a-z0-9\-_]+$/i.test(t) ? (c = t.slice(1), i = L) : (c = t, i = Element.prototype.matches) : (c = null, i = $.bind(this)), r[o].push({
32
32
  selector: t,
33
33
  handler: e,
34
34
  matcher: i,
@@ -54,8 +54,8 @@ p.prototype.handle = function(o) {
54
54
  let t, e;
55
55
  const n = o.type;
56
56
  let s, r, i, c, h = [], a;
57
- const d = "ftLabsDelegateIgnore";
58
- if (o[d] === !0)
57
+ const l = "ftLabsDelegateIgnore";
58
+ if (o[l] === !0)
59
59
  return;
60
60
  switch (a = o.target, a.nodeType === 3 && (a = a.parentNode), a.correspondingUseElement && (a = a.correspondingUseElement), s = this.rootElement, r = o.eventPhase || (o.target !== o.currentTarget ? 3 : 2), r) {
61
61
  case 1:
@@ -75,13 +75,13 @@ p.prototype.handle = function(o) {
75
75
  if (a === s || (e = h.length, a = a.parentElement || a.parentNode, a instanceof HTMLDocument))
76
76
  break;
77
77
  }
78
- let b;
78
+ let v;
79
79
  for (t = 0; t < u.length; t++)
80
80
  if (!(this._removedListeners.indexOf(u[t][2]) > -1) && (c = this.fire.apply(this, u[t]), c === !1)) {
81
- u[t][0][d] = !0, u[t][0].preventDefault(), b = !1;
81
+ u[t][0][l] = !0, u[t][0].preventDefault(), v = !1;
82
82
  break;
83
83
  }
84
- return b;
84
+ return v;
85
85
  };
86
86
  p.prototype.fire = function(o, t, e) {
87
87
  return e.handler.call(t, o, t);
@@ -97,16 +97,16 @@ function $(o, t) {
97
97
  t === window
98
98
  ) : this.rootElement === t;
99
99
  }
100
- function S(o, t) {
100
+ function L(o, t) {
101
101
  return o === t.id;
102
102
  }
103
103
  p.prototype.destroy = function() {
104
104
  this.off(), this.root();
105
105
  };
106
- function y(o) {
106
+ function A(o) {
107
107
  return typeof o == "string" ? o.trim() : o;
108
108
  }
109
- function v(o, t) {
109
+ function R(o, t) {
110
110
  for (const e in o)
111
111
  t[e] ? console.warn(`You can't set a custom property called ${e}`) : t[e] = o[e];
112
112
  }
@@ -118,11 +118,11 @@ const m = Object.freeze({
118
118
  TEST: 4,
119
119
  DEFAULT: 2
120
120
  });
121
- function L(o) {
121
+ function N(o) {
122
122
  const t = o == null ? void 0 : o.toLowerCase();
123
123
  return t === "debug" ? m.DEBUG : t === "info" ? m.INFO : t === "warn" ? m.WARN : t === "error" ? m.ERROR : t === "test" ? m.TEST : m.DEFAULT;
124
124
  }
125
- class C {
125
+ class k {
126
126
  constructor({ level: t = m.DEFAULT } = {
127
127
  level: m.DEFAULT
128
128
  }) {
@@ -141,14 +141,14 @@ class C {
141
141
  this.level <= m.ERROR && console.error(...t);
142
142
  }
143
143
  }
144
- const N = (o, t, e) => {
144
+ const S = (o, t, e) => {
145
145
  const n = Array.from((o == null ? void 0 : o.querySelectorAll(e)) ?? []), s = n.findIndex((r) => r === t);
146
146
  if (s !== -1)
147
147
  return {
148
148
  siblings: n.length,
149
149
  position: s
150
150
  };
151
- }, k = [
151
+ }, C = [
152
152
  "nodeName",
153
153
  "className",
154
154
  "id",
@@ -157,9 +157,9 @@ const N = (o, t, e) => {
157
157
  "role"
158
158
  ], O = (o) => {
159
159
  const t = {};
160
- for (const e of k) {
160
+ for (const e of C) {
161
161
  const n = o[e] || o.getAttribute(e) || o.hasAttribute(e);
162
- n !== void 0 && (typeof n == "boolean" ? t[e] = n : t[e] = y(n));
162
+ n !== void 0 && (typeof n == "boolean" ? t[e] = n : t[e] = A(n));
163
163
  }
164
164
  return t;
165
165
  }, P = (o) => {
@@ -178,7 +178,7 @@ const N = (o, t, e) => {
178
178
  t[e.name] = e.value;
179
179
  }), t), M = (o, t, e) => {
180
180
  const n = {};
181
- return e && k.forEach((s) => {
181
+ return e && C.forEach((s) => {
182
182
  typeof t[s] < "u" && s !== "id" && (n[s] = t[s]);
183
183
  }), o.filter((s) => s.name.match(/^data-trackable-context-/i)).forEach((s) => {
184
184
  n[s.name.replace("data-trackable-context-", "")] = x(s.value);
@@ -191,10 +191,10 @@ function D(o, t) {
191
191
  let h = I(c, i);
192
192
  h["data-trackable"] && (h = Object.assign(
193
193
  h,
194
- N(o, e, n)
194
+ S(o, e, n)
195
195
  )), s.push(h);
196
196
  const a = M(c, i, o === e);
197
- v(a, r), o = o.parentNode;
197
+ R(a, r), o = o.parentNode;
198
198
  }
199
199
  return { trace: s, customContext: r };
200
200
  }
@@ -210,7 +210,7 @@ class F {
210
210
  elements: c = 'a, button, input, [role="button"]',
211
211
  logger: h
212
212
  }) {
213
- this.cccId = t, this.cccName = e, this.subtype = n, this.teamName = s, this.shadowRoot = r, this.category = i, this.elements = c, this.isInitialised = !1, this.log = h ?? new C();
213
+ this.cccId = t, this.cccName = e, this.subtype = n, this.teamName = s, this.shadowRoot = r, this.category = i, this.elements = c, this.isInitialised = !1, this.log = h ?? new k();
214
214
  }
215
215
  // Get properties for the event (as opposed to properties of the clicked element)
216
216
  getEventProperties(t) {
@@ -218,7 +218,7 @@ class F {
218
218
  for (const n of U)
219
219
  if (t[n])
220
220
  try {
221
- e[n] = y(t[n]);
221
+ e[n] = A(t[n]);
222
222
  } catch (s) {
223
223
  this.log.info(s);
224
224
  }
@@ -233,7 +233,7 @@ class F {
233
233
  name: this.cccName,
234
234
  type: "custom-code-component",
235
235
  subtype: this.subtype
236
- }, r.teamName = this.teamName, r.url = document.URL, v(c, r), r.method = "ftCustomAnalytics", t = { ...t, ...r }, document.body.dispatchEvent(
236
+ }, r.teamName = this.teamName, r.url = document.URL, R(c, r), r.method = "ftCustomAnalytics", t = { ...t, ...r }, document.body.dispatchEvent(
237
237
  new CustomEvent("oTracking.event", {
238
238
  detail: t,
239
239
  bubbles: !0,
@@ -282,66 +282,57 @@ class F {
282
282
  }
283
283
  }
284
284
  }
285
- class l {
285
+ class f {
286
286
  constructor(t) {
287
- const { org: e, repo: n, component: s, versionRange: r } = w(
288
- t
289
- ) ? t : l.fromString(t);
290
- this.org = e, this.repo = n, this.component = s, this.versionRange = r;
287
+ this.org = "local", this.repo = "dev";
288
+ const { org: e, repo: n, name: s, versionRange: r } = E(t) ? t : f.fromString(t);
289
+ e && (this.org = e), n && (this.repo = n), this.name = s, this.versionRange = r;
291
290
  }
292
291
  set path(t) {
293
- const { org: e, repo: n, component: s, versionRange: r } = w(
294
- t
295
- ) ? t : l.fromString(t);
296
- this.org = e, this.repo = n, this.component = s, this.versionRange = r;
292
+ const { org: e, repo: n, name: s, versionRange: r } = E(t) ? t : f.fromString(t);
293
+ this.org = e, this.repo = n, this.name = s, this.versionRange = r;
297
294
  }
298
295
  get path() {
299
- return `${this.org}/${this.repo}@${this.versionRange}/${this.component}`;
296
+ return `${this.org}/${this.repo}@${this.versionRange}/${this.name}`;
300
297
  }
301
298
  toString() {
302
299
  return this.path;
303
300
  }
304
301
  static fromString(t, e) {
305
302
  var c;
306
- if (!t)
307
- throw new f("No path specified");
308
- const n = e ?? ((c = t.match(/@[^\/]+/)) == null ? void 0 : c.toString().replace("@", "")) ?? "unknown";
309
- if (!n)
310
- throw new f("No version specified");
311
- const [s, r, i] = t.replace(/@[^\/]+/, "").split("/").reverse();
312
- return new l({ org: i, repo: r, component: s, versionRange: n });
303
+ if (!t) throw new d("No path specified");
304
+ const [n, s, r] = t.replace(/@[^\/]+/, "").split("/").reverse(), i = e ?? ((c = t.match(/@[^\/]+/)) == null ? void 0 : c.toString().replace("@", "")) ?? "unknown";
305
+ if (s && !i) throw new d("No version specified");
306
+ return new f({ org: r, repo: s, name: n, versionRange: i });
313
307
  }
314
308
  }
315
- function w(o) {
316
- return typeof o == "object" && o !== null ? "org" in o && "repo" in o && "component" in o : !1;
309
+ function E(o) {
310
+ return typeof o == "object" && o !== null ? "org" in o && "repo" in o && "name" in o : !1;
317
311
  }
318
- class f extends Error {
312
+ class d extends Error {
319
313
  constructor(t, e) {
320
- var n = (...s) => {
321
- super(...s);
322
- };
323
- !e && t ? (n(t), this.component = null) : typeof (e == null ? void 0 : e.component) == "string" ? (n(
314
+ !e && t ? (super(t), this.component = null) : typeof (e == null ? void 0 : e.component) == "string" ? (super(
324
315
  t ?? `${e.cause ?? "Unknown error"} in ${e.component} imported from ${e.source ?? "an undefined source"}.`
325
- ), this.component = l.fromString(e.component)) : w(e == null ? void 0 : e.component) ? (n(
326
- t ?? `${e.cause ?? "Unknown error"} in ${e.component.org}/${e.component.repo}/${e.component.component}@${e.component.versionRange} imported from ${e.source ?? "an undefined source"}.`
327
- ), this.component = new l(e.component)) : (n(
316
+ ), this.component = f.fromString(e.component)) : E(e == null ? void 0 : e.component) ? (super(
317
+ t ?? `${e.cause ?? "Unknown error"} in ${e.component.org}/${e.component.repo}/${e.component.name}@${e.component.versionRange} imported from ${e.source ?? "an undefined source"}.`
318
+ ), this.component = new f(e.component)) : (super(
328
319
  `${(e == null ? void 0 : e.cause) ?? "Unknown error"} in unknown component imported from ${(e == null ? void 0 : e.source) ?? "unknown source"}.`
329
- ), this.component = null), this.source = e == null ? void 0 : e.source, Error.captureStackTrace && Error.captureStackTrace(this, f), this.name = "CCCError";
320
+ ), this.component = null), this.source = e == null ? void 0 : e.source, Error.captureStackTrace && Error.captureStackTrace(this, d), this.name = "CCCError";
330
321
  }
331
322
  }
332
- class g extends f {
323
+ class g extends d {
333
324
  constructor(t, e) {
334
325
  super(t, { ...e, cause: "Import error" }), this.name = "CCCImportError";
335
326
  }
336
327
  }
337
- class W extends f {
328
+ class j extends d {
338
329
  constructor(t) {
339
330
  super(null, { ...t, cause: "Timeout error" }), this.name = "CCCTimeoutError";
340
331
  }
341
332
  }
342
- const R = class A extends Event {
333
+ const w = class w extends Event {
343
334
  constructor(t, e) {
344
- super(A.eventType, {
335
+ super(w.eventType, {
345
336
  bubbles: !0,
346
337
  cancelable: !1,
347
338
  composed: !0,
@@ -349,36 +340,36 @@ const R = class A extends Event {
349
340
  }), this.component = t.component, this.source = t.source;
350
341
  }
351
342
  };
352
- R.eventType = "ccc:ConnectedEvent";
353
- let j = R;
354
- const _ = (o) => o.replace(
343
+ w.eventType = "ccc:ConnectedEvent";
344
+ let b = w;
345
+ const V = (o) => o.replace(
355
346
  /[A-Z]+(?![a-z])|[A-Z]/g,
356
347
  (t, e) => (e ? "-" : "") + t.toLowerCase()
357
348
  );
358
- function V(o) {
359
- return E([
349
+ function q(o) {
350
+ return y([
360
351
  "localhost",
361
352
  "local.ft.com",
362
353
  /^.*\.apps\.in\.ft\.com$/
363
354
  ], o);
364
355
  }
365
356
  function z() {
366
- return E([
357
+ return y([
367
358
  "localhost",
368
359
  "local.ft.com",
369
360
  /^.*\.in\.ft\.com$/
370
361
  ], window.location.hostname);
371
362
  }
372
- function J() {
373
- return E([
363
+ function H() {
364
+ return y([
374
365
  "spark.ft.com",
375
366
  "spark-staging.ft.com"
376
367
  ], window.location.host);
377
368
  }
378
- function E(o, t) {
369
+ function y(o, t) {
379
370
  return t ? o.some((e) => typeof e == "string" ? e === t : e.test(t)) : !1;
380
371
  }
381
- function H(o) {
372
+ function J(o) {
382
373
  if (o === null)
383
374
  return;
384
375
  let t;
@@ -387,35 +378,23 @@ function H(o) {
387
378
  if (typeof o == "string") {
388
379
  if ((o === "" || o.toLowerCase() === "true") && z())
389
380
  t = e;
390
- else if (t = o.startsWith("http://") || o.startsWith("https://") ? new URL(o) : void 0, t && !V(t == null ? void 0 : t.hostname))
381
+ else if (t = o.startsWith("http://") || o.startsWith("https://") ? new URL(o) : void 0, t && !q(t == null ? void 0 : t.hostname))
391
382
  throw new Error("Unsafe testing host override");
392
- } else
393
- J() && (t = e);
383
+ } else H() && (t = e);
394
384
  } catch {
395
385
  return t;
396
386
  }
397
387
  return t;
398
388
  }
399
- async function K(o) {
400
- if (!o)
401
- return !1;
402
- function t(n) {
403
- try {
404
- return new Promise((s) => {
405
- const r = new WebSocket(`ws://${n}`, "vite-hmr"), i = setTimeout(() => {
406
- s(r.readyState === WebSocket.OPEN), r.close();
407
- }, 50);
408
- r.addEventListener("error", () => {
409
- clearTimeout(i), r.close(), s(!1);
410
- }, { once: !0 });
411
- });
412
- } catch {
413
- return Promise.resolve(!1);
389
+ async function W(o, t) {
390
+ return t ? fetch(
391
+ new URL(`src/${o}/config.yaml`, t),
392
+ {
393
+ method: "HEAD"
414
394
  }
415
- }
416
- return await t(o == null ? void 0 : o.host);
395
+ ).then(() => !0).catch(() => !1) : !1;
417
396
  }
418
- class q extends HTMLElement {
397
+ class K extends HTMLElement {
419
398
  constructor() {
420
399
  super(), this.mode = "open", this.RESERVED_ATTRS = /* @__PURE__ */ new Set([
421
400
  "iframe",
@@ -436,8 +415,8 @@ class q extends HTMLElement {
436
415
  `Error initialising tracking on <custom-code-component> ${s}@${r}`
437
416
  ), this.log.error(n);
438
417
  }
439
- }, this.log = new C({
440
- level: L(this.getAttribute("log"))
418
+ }, this.log = new k({
419
+ level: N(this.getAttribute("log"))
441
420
  });
442
421
  const t = HTMLElement.prototype.hasOwnProperty("attachInternals");
443
422
  try {
@@ -449,7 +428,7 @@ class q extends HTMLElement {
449
428
  async connectedCallback() {
450
429
  try {
451
430
  const t = this.getAttribute("path"), e = this.getAttribute("version");
452
- this.component = l.fromString(t, e), this.lightRoot = Array.from(this.childNodes), this.app = await this.load(), await this.mount(), await this.initTracking();
431
+ this.component = f.fromString(t, e), this.app = await this.load(), await this.mount(), await this.initTracking();
453
432
  } catch (t) {
454
433
  t instanceof Error && requestAnimationFrame(() => {
455
434
  this.emitError(t);
@@ -459,7 +438,7 @@ class q extends HTMLElement {
459
438
  emitError(t) {
460
439
  var n;
461
440
  let e;
462
- if (t instanceof f && ((n = t.name) != null && n.startsWith("CCC")) ? e = t.name.replace(/^CCC/, "ccc:") : e = `ccc:${(t == null ? void 0 : t.name) ?? "UnknownError"}`, !e)
441
+ if (t instanceof d && ((n = t.name) != null && n.startsWith("CCC")) ? e = t.name.replace(/^CCC/, "ccc:") : e = `ccc:${(t == null ? void 0 : t.name) ?? "UnknownError"}`, !e)
463
442
  return this.log.debug(t);
464
443
  this.dispatchEvent(
465
444
  new ErrorEvent(e, {
@@ -483,65 +462,82 @@ class q extends HTMLElement {
483
462
  try {
484
463
  await t;
485
464
  } catch (e) {
486
- e instanceof Error && this.emitError(e);
465
+ e instanceof Error && requestAnimationFrame(() => {
466
+ this.emitError(e);
467
+ }), this.unmount(e);
487
468
  }
488
469
  }
489
470
  postMessage(t) {
490
471
  this.channel.port1.postMessage(t);
491
472
  }
492
473
  async mount(t) {
474
+ var e, n;
493
475
  try {
494
- if (this.mode = this.getAttribute("shadow-open") == "false" ? "closed" : "open", this.dispatchEvent(
495
- new j({
496
- component: this.component,
497
- source: this.source
498
- })
499
- ), this.dataset.cccReady = "true", delete this.dataset.cccError, !this.app)
500
- throw new Error("CCC mounted without App");
501
- const e = this.shadowRoot !== null, n = this.shadowRoot ?? this.attachShadow({ mode: this.mode }), s = JSON.parse(this.getAttribute("data-component-props")), r = Object.fromEntries(
502
- [...this.attributes].filter((a) => !this.RESERVED_ATTRS.has(a.name)).map((a) => [a.name, a.value])
503
- );
504
- this.tracking = new F({
505
- name: this.component.toString(),
506
- subtype: "interactive",
507
- teamName: "djd",
508
- shadowRoot: this.shadowRoot,
509
- logger: this.log
510
- });
511
- const { unmount: i, onmessage: c, ready: h } = this.app(
512
- n,
513
- {
514
- ...r,
515
- data: s,
516
- port: this.channel.port2,
517
- tracking: this.tracking,
518
- prerendered: !!t,
519
- children: this.children
520
- },
521
- e
522
- ) || {};
523
- i && (this.onunmount = i), c && (this.onmessage = c), h && this.onready(h);
524
- } catch (e) {
476
+ if (this.mode = this.getAttribute("shadow-open") == "false" ? "closed" : "open", this.component) {
477
+ if (this.dispatchEvent(
478
+ new b({
479
+ component: this.component,
480
+ source: this.source
481
+ })
482
+ ), this.dataset.cccReady = "true", delete this.dataset.cccError, !this.app)
483
+ throw new Error("CCC mounted without App");
484
+ const s = this.shadowRoot !== null, r = this.shadowRoot ?? this.attachShadow({ mode: this.mode });
485
+ if (!s) {
486
+ const u = document.createElement("template");
487
+ u.innerHTML = "<div data-component-root><slot></slot></div>", this.appendChild(u), r.appendChild(u.content.cloneNode(!0));
488
+ }
489
+ const i = JSON.parse(this.getAttribute("data-component-props")), c = Object.fromEntries(
490
+ [...this.attributes].filter((u) => !this.RESERVED_ATTRS.has(u.name)).map((u) => [u.name, u.value])
491
+ );
492
+ this.tracking = new F({
493
+ name: (e = this.component) == null ? void 0 : e.toString(),
494
+ subtype: "interactive",
495
+ teamName: "djd",
496
+ shadowRoot: this.shadowRoot,
497
+ logger: this.log
498
+ });
499
+ const { unmount: h, onmessage: a, ready: l } = this.app(
500
+ r,
501
+ {
502
+ ...c,
503
+ data: i,
504
+ port: this.channel.port2,
505
+ tracking: this.tracking,
506
+ prerendered: !!t,
507
+ children: this.children
508
+ },
509
+ s
510
+ ) || {};
511
+ h && (this.onunmount = h), a && (this.onmessage = a), l && this.onready(l);
512
+ }
513
+ } catch (s) {
525
514
  throw this.log.info(
526
- `<custom-code-component> uncaught error during mount from ${this.component.toString()}`
527
- ), this.log.error(e), e;
515
+ `<custom-code-component> uncaught error during mount from ${(n = this.component) == null ? void 0 : n.toString()}`
516
+ ), this.log.error(s), s;
528
517
  }
529
518
  }
530
519
  // Called in top-level error handler
531
- // Replace shadow root with light DOM children on error
520
+ // Replace shadow root with either <slot> or template[data-component-fallback]
521
+ // slot on failure
532
522
  unmount(t) {
533
- var e;
534
- this.onunmount(), (e = this.shadowRoot) == null || e.replaceChildren(...this.lightRoot), this.dataset.cccError || (this.dataset.cccError = _(t.name.replace("CCC", ""))), delete this.dataset.cccReady;
523
+ var n;
524
+ this.onunmount();
525
+ const e = this.querySelector(
526
+ "template[data-component-fallback]"
527
+ ) ?? this.querySelector("template");
528
+ e && ((n = this.shadowRoot) == null || n.replaceChildren(e.content.cloneNode(!0))), this.dataset.cccError || (this.dataset.cccError = V(t.name.replace("CCC", ""))), delete this.dataset.cccReady;
535
529
  }
536
530
  async load() {
537
- const t = this.getAttribute("path"), e = this.getAttribute("version"), n = Number(this.getAttribute("load-timeout") || 1e4), s = this.getAttribute("testEnv"), r = H(s), i = await K(r), c = this.getAttribute("id");
538
- this.source = i ? `${r == null ? void 0 : r.origin}/src/${this.component.component}/index.jsx?id=${c}` : `https://www.ft.com/__component/${this.component.org}/${this.component.repo}${e ? `@${e}` : "@latest"}/${this.component.component}/${this.component.component}.js?id=${c}`;
531
+ if (!this.component)
532
+ throw new Error("No path found");
533
+ const t = this.getAttribute("path"), e = this.getAttribute("version"), n = Number(this.getAttribute("load-timeout") || 1e4), s = this.getAttribute("testEnv"), r = J(s), i = await W(this.component.name, r), c = this.getAttribute("id");
534
+ this.source = i ? `${r == null ? void 0 : r.origin}/src/${this.component.name}/index.jsx?id=${c}` : `https://www.ft.com/__component/${this.component.org}/${this.component.repo}${e ? `@${e}` : "@latest"}/${this.component.name}/${this.component.name}.js?id=${c}`;
539
535
  try {
540
536
  return await new Promise(
541
537
  (h, a) => {
542
- const d = setTimeout(() => {
538
+ const l = setTimeout(() => {
543
539
  this.log.error("CCC import timeout error"), a(
544
- new W({
540
+ new j({
545
541
  component: this.component,
546
542
  source: this.source
547
543
  })
@@ -554,7 +550,7 @@ class q extends HTMLElement {
554
550
  /* @vite-ignore */
555
551
  ).then(({ default: u }) => {
556
552
  if (u)
557
- clearTimeout(d), h(u);
553
+ clearTimeout(l), h(u);
558
554
  else
559
555
  throw new g(
560
556
  "No component renderer default export found",
@@ -564,7 +560,7 @@ class q extends HTMLElement {
564
560
  }
565
561
  );
566
562
  }).catch((u) => {
567
- clearTimeout(d), this.log.error(u), u instanceof Error && !(u instanceof g) ? a(
563
+ clearTimeout(l), this.log.error(u), u instanceof Error && !(u instanceof g) ? a(
568
564
  new g(u.message, {
569
565
  component: this.component,
570
566
  source: this.source
@@ -572,7 +568,7 @@ class q extends HTMLElement {
572
568
  ) : a(u);
573
569
  });
574
570
  else
575
- throw clearTimeout(d), new g(`Unable to mount ${t}`, {
571
+ throw clearTimeout(l), new g(`Unable to mount ${t}`, {
576
572
  component: this.component,
577
573
  source: this.source
578
574
  });
@@ -585,9 +581,9 @@ class q extends HTMLElement {
585
581
  }
586
582
  }
587
583
  }
588
- const B = () => customElements.define("custom-code-component", q);
589
- customElements && !customElements.get("custom-code-component") && B();
584
+ const _ = () => customElements.define("custom-code-component", K);
585
+ customElements && !customElements.get("custom-code-component") && _();
590
586
  export {
591
- B as init
587
+ _ as init
592
588
  };
593
- //# sourceMappingURL=index.js.map
589
+ //# sourceMappingURL=CustomCodeComponent.js.map