@markupai/sidebar-adapter 2.0.0 → 2.1.0

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.
package/dist/main.js CHANGED
@@ -1,11 +1,11 @@
1
- var oe = /* @__PURE__ */ (function(e) {
1
+ var ce = /* @__PURE__ */ (function(e) {
2
2
  return e.TEXT_PLAIN = "text/plain", e.TEXT_MARKDOWN = "text/markdown", e.TEXT_HTML = "text/html", e.APPLICATION_DITA_XML = "application/dita+xml", e;
3
- })({}), se = [
3
+ })({}), de = [
4
4
  "text/plain",
5
5
  "text/markdown",
6
6
  "text/html",
7
7
  "application/dita+xml"
8
- ], le = {
8
+ ], ge = {
9
9
  integrationName: "unknown",
10
10
  integrationVersion: "unknown",
11
11
  integrationId: "markupai-sidebar-app",
@@ -13,7 +13,7 @@ var oe = /* @__PURE__ */ (function(e) {
13
13
  supportCheckSelection: !0,
14
14
  multiAgent: !1,
15
15
  multiDocument: !1
16
- }, ce = (e) => typeof e != "object" || e === null ? !1 : Array.isArray(e.fields), de = (e) => {
16
+ }, pe = (e) => typeof e != "object" || e === null ? !1 : Array.isArray(e.fields), ue = (e) => {
17
17
  if (typeof e != "object" || e === null) return !1;
18
18
  const t = e;
19
19
  return typeof t.id != "string" || t.id.length === 0 || typeof t.label != "string" ? !1 : t.type === "boolean" ? typeof t.default == "boolean" : t.type === "enum" ? typeof t.default != "string" || !Array.isArray(t.options) || t.options.length === 0 ? !1 : t.options.every((n) => {
@@ -21,33 +21,33 @@ var oe = /* @__PURE__ */ (function(e) {
21
21
  const r = n;
22
22
  return typeof r.value == "string" && typeof r.label == "string";
23
23
  }) : !1;
24
- }, O = class T extends Error {
24
+ }, he = "2.1.0", T = class D extends Error {
25
25
  name = "TextLookupError";
26
26
  constructor(t) {
27
- super(t), Object.setPrototypeOf(this, T.prototype);
27
+ super(t), Object.setPrototypeOf(this, D.prototype);
28
28
  }
29
29
  };
30
- function ge(e) {
31
- return e instanceof O;
30
+ function fe(e) {
31
+ return e instanceof T;
32
32
  }
33
- var P = { TextLookupError: (e) => new O(e) };
34
- function U(e) {
35
- const t = e.message ?? "", n = e.name, r = typeof n == "string" && n in P ? P[n] : void 0;
33
+ var E = { TextLookupError: (e) => new T(e) };
34
+ function H(e) {
35
+ const t = e.message ?? "", n = e.name, r = typeof n == "string" && n in E ? E[n] : void 0;
36
36
  return r ? r(t, e) : Object.assign(new Error(t), n ? { name: n } : {});
37
37
  }
38
- var x = ":", D = /^[a-z][a-z0-9-]*$/;
39
- function pe(e) {
38
+ var x = ":", _ = /^[a-z][a-z0-9-]*$/;
39
+ function me(e) {
40
40
  const t = e.indexOf(x);
41
- return t <= 0 || t === e.length - 1 ? !1 : D.test(e.slice(0, t));
41
+ return t <= 0 || t === e.length - 1 ? !1 : _.test(e.slice(0, t));
42
42
  }
43
- function ue(e, t) {
43
+ function ye(e, t) {
44
44
  const n = e.trim().toLowerCase(), r = t.trim();
45
- if (!D.test(n)) throw new Error(`Invalid document reference prefix ${JSON.stringify(e)}: expected a lowercase name like "word".`);
45
+ if (!_.test(n)) throw new Error(`Invalid document reference prefix ${JSON.stringify(e)}: expected a lowercase name like "word".`);
46
46
  if (r.length === 0) throw new Error("Invalid document reference: the document id is empty.");
47
47
  const i = `${n}${x}`;
48
48
  return r.startsWith(i) ? r : `${i}${r}`;
49
49
  }
50
- var H = class extends Promise {
50
+ var $ = class extends Promise {
51
51
  static get [Symbol.species]() {
52
52
  return Promise;
53
53
  }
@@ -60,15 +60,15 @@ var H = class extends Promise {
60
60
  t = r, n = i, e(r, i);
61
61
  }), this.resolve = t, this.reject = n;
62
62
  }
63
- }, $ = { timeout: 1e4 };
64
- function j(e) {
63
+ }, j = { timeout: 1e4 };
64
+ function F(e) {
65
65
  const t = JSON.stringify(e, Object.getOwnPropertyNames(e)), n = JSON.parse(t);
66
66
  return n.message === void 0 || n.message === "" ? JSON.stringify({
67
67
  message: e instanceof Error ? e.message : String(e),
68
68
  name: e instanceof Error ? e.name : void 0
69
69
  }) : t;
70
70
  }
71
- var L = class {
71
+ var M = class {
72
72
  promisesByID = {};
73
73
  receiversByName = {};
74
74
  currentID = 0;
@@ -76,7 +76,7 @@ var L = class {
76
76
  postMessage;
77
77
  constructor(e, t) {
78
78
  this.postMessage = e, this.config = {
79
- ...$,
79
+ ...j,
80
80
  ...t
81
81
  };
82
82
  }
@@ -90,7 +90,7 @@ var L = class {
90
90
  return this.callWithOptions(e, {}, ...t);
91
91
  }
92
92
  callWithOptions(e, t, ...n) {
93
- const r = this.currentID++, i = new H(), a = t.timeout ?? this.config.timeout, o = setTimeout(() => {
93
+ const r = this.currentID++, i = new $(), a = t.timeout ?? this.config.timeout, o = setTimeout(() => {
94
94
  if (r in this.promisesByID) {
95
95
  const l = /* @__PURE__ */ new Error(`IPC call timeout: "${e}" did not respond within ${String(a)}ms`);
96
96
  i.reject(l), Reflect.deleteProperty(this.promisesByID, r);
@@ -158,7 +158,7 @@ var L = class {
158
158
  type: "error",
159
159
  id: t,
160
160
  name: n,
161
- errorJSON: j(a)
161
+ errorJSON: F(a)
162
162
  };
163
163
  this.postMessage(o);
164
164
  }
@@ -176,7 +176,7 @@ var L = class {
176
176
  const { promise: r, timeoutId: i } = this.promisesByID[t];
177
177
  clearTimeout(i);
178
178
  try {
179
- const a = JSON.parse(n), o = U(a);
179
+ const a = JSON.parse(n), o = H(a);
180
180
  r.reject(o);
181
181
  } catch {
182
182
  r.reject(/* @__PURE__ */ new Error("Failed to parse error from IPC"));
@@ -189,12 +189,12 @@ var L = class {
189
189
  clearTimeout(t), e.reject(/* @__PURE__ */ new Error("IPC destroyed"));
190
190
  this.promisesByID = {}, this.receiversByName = {};
191
191
  }
192
- }, F = class {
192
+ }, z = class {
193
193
  ipc;
194
194
  sidebar;
195
195
  targetOrigin;
196
196
  constructor(e, t, n = "*") {
197
- this.sidebar = e || {}, this.targetOrigin = n, this.ipc = new L((r) => {
197
+ this.sidebar = e || {}, this.targetOrigin = n, this.ipc = new M((r) => {
198
198
  window.parent.postMessage(r, this.targetOrigin);
199
199
  }, t), window.addEventListener("message", this.handleMessage), this.registerReceivers();
200
200
  }
@@ -250,8 +250,11 @@ var L = class {
250
250
  });
251
251
  }
252
252
  }
253
- async getInitConfig() {
254
- return await this.ipc.call("getInitConfig");
253
+ async getInitConfig(e) {
254
+ return e ? await this.ipc.call("getInitConfig", {
255
+ ...e,
256
+ adapterVersion: e.adapterVersion ?? "2.1.0"
257
+ }) : await this.ipc.call("getInitConfig");
255
258
  }
256
259
  async getContent(e) {
257
260
  return this.ipc.callWithOptions("getContent", e ?? {});
@@ -308,16 +311,16 @@ var L = class {
308
311
  destroy() {
309
312
  window.removeEventListener("message", this.handleMessage), this.ipc.destroy();
310
313
  }
311
- }, he = class {
314
+ }, Ie = class {
312
315
  ipcAdapter;
313
316
  constructor(e, t, n) {
314
- this.ipcAdapter = new F(e, t, n);
317
+ this.ipcAdapter = new z(e, t, n);
315
318
  }
316
319
  destroy() {
317
320
  this.ipcAdapter.destroy();
318
321
  }
319
- async getInitConfig() {
320
- return await this.ipcAdapter.getInitConfig();
322
+ async getInitConfig(e) {
323
+ return await this.ipcAdapter.getInitConfig(e);
321
324
  }
322
325
  async getContent(e) {
323
326
  return await this.ipcAdapter.getContent(e);
@@ -364,14 +367,33 @@ var L = class {
364
367
  getTargetOrigin() {
365
368
  return this.ipcAdapter.getTargetOrigin();
366
369
  }
367
- }, z = class {
370
+ };
371
+ var V = /* @__PURE__ */ new Set(["auto", "prompt"]), I = (e, t) => {
372
+ const n = e[t];
373
+ if (!(typeof n != "string" || n.length === 0))
374
+ return n.slice(0, 64);
375
+ };
376
+ function W(e) {
377
+ if (typeof e != "object" || e === null || Array.isArray(e)) return null;
378
+ const t = e, n = I(t, "version"), r = I(t, "commitHash");
379
+ if (n === void 0 || r === void 0) return null;
380
+ const i = {
381
+ version: n,
382
+ commitHash: r
383
+ };
384
+ typeof t.swControlled == "boolean" && (i.swControlled = t.swControlled), V.has(t.pwaUpdateMode) && (i.pwaUpdateMode = t.pwaUpdateMode);
385
+ const a = I(t, "adapterVersion");
386
+ return a !== void 0 && (i.adapterVersion = a), i;
387
+ }
388
+ var G = class {
368
389
  ipc;
369
390
  plugin;
370
391
  iframe;
371
392
  window;
372
393
  targetOrigin;
394
+ latestSidebarBuildInfo = null;
373
395
  constructor(e, t, n, r, i = "*") {
374
- this.plugin = e, this.iframe = t, this.window = n ?? window, this.targetOrigin = i, this.ipc = new L((a) => {
396
+ this.plugin = e, this.iframe = t, this.window = n ?? window, this.targetOrigin = i, this.ipc = new M((a) => {
375
397
  this.iframe.contentWindow?.postMessage(a, this.targetOrigin);
376
398
  }, r), this.window.addEventListener("message", this.handleMessage, !1), this.registerReceivers();
377
399
  }
@@ -380,7 +402,10 @@ var L = class {
380
402
  e.origin !== t && (n !== "*" && e.origin !== n || e.data && typeof e.data == "object" && this.ipc.handleMessage(e.data));
381
403
  };
382
404
  registerReceivers() {
383
- if (this.ipc.receive("getInitConfig", async () => await this.plugin.getInitConfig()), this.ipc.receive("getContent", async () => await this.plugin.getContent()), this.ipc.receive("getSelectedContent", async () => await this.plugin.getSelectedContent()), this.ipc.receive("replaceContent", async (e, t, n) => {
405
+ if (this.ipc.receive("getInitConfig", async (e) => {
406
+ const t = W(e);
407
+ return this.latestSidebarBuildInfo = t, await this.plugin.getInitConfig(t ?? void 0);
408
+ }), this.ipc.receive("getContent", async () => await this.plugin.getContent()), this.ipc.receive("getSelectedContent", async () => await this.plugin.getSelectedContent()), this.ipc.receive("replaceContent", async (e, t, n) => {
384
409
  await this.plugin.replaceContent(e, t, typeof n == "string" ? n : null);
385
410
  }), this.ipc.receive("selectContent", async (e, t) => {
386
411
  await this.plugin.selectContent(e, typeof t == "string" ? t : null);
@@ -451,16 +476,19 @@ var L = class {
451
476
  async notifyActiveDocumentChanged(e) {
452
477
  await this.ipc.call("onActiveDocumentChanged", e);
453
478
  }
479
+ getSidebarBuildInfo() {
480
+ return this.latestSidebarBuildInfo;
481
+ }
454
482
  configure(e) {
455
483
  this.ipc.configure(e);
456
484
  }
457
485
  destroy() {
458
486
  this.window.removeEventListener("message", this.handleMessage), this.ipc.destroy();
459
487
  }
460
- }, W = class {
488
+ }, J = class {
461
489
  ipcAdapter;
462
490
  constructor(e, t, n) {
463
- this.ipcAdapter = new z(e, t, n?.win, n?.config, n?.targetOrigin);
491
+ this.ipcAdapter = new G(e, t, n?.win, n?.config, n?.targetOrigin);
464
492
  }
465
493
  destroy() {
466
494
  this.ipcAdapter.destroy();
@@ -489,10 +517,13 @@ var L = class {
489
517
  async notifyActiveDocumentChanged(e) {
490
518
  await this.ipcAdapter.notifyActiveDocumentChanged(e);
491
519
  }
520
+ getSidebarBuildInfo() {
521
+ return this.ipcAdapter.getSidebarBuildInfo();
522
+ }
492
523
  configure(e) {
493
524
  this.ipcAdapter.configure(e);
494
525
  }
495
- }, G = `
526
+ }, Y = `
496
527
  <div class="sidebar-load-overlay-card">
497
528
  <div class="sidebar-load-overlay-title">Sidebar failed to load</div>
498
529
  <div class="sidebar-load-overlay-description">Check your connection or try again.</div>
@@ -513,16 +544,16 @@ var L = class {
513
544
  <span>Retry</span>
514
545
  </button>
515
546
  </div>
516
- `, J = () => {
547
+ `, X = () => {
517
548
  const e = document.createElement("div");
518
- e.className = "sidebar-load-overlay", e.style.display = "none", e.innerHTML = G;
549
+ e.className = "sidebar-load-overlay", e.style.display = "none", e.innerHTML = Y;
519
550
  const t = e.querySelector(".sidebar-load-overlay-button");
520
551
  if (!t) throw new Error("Missing retry button in load overlay template.");
521
552
  return {
522
553
  overlay: e,
523
554
  button: t
524
555
  };
525
- }, E = "markupai-sidebar-load-overlay-styles", Y = `
556
+ }, R = "markupai-sidebar-load-overlay-styles", K = `
526
557
  :root {
527
558
  --background: #f5f5f4;
528
559
  --foreground: #333332;
@@ -614,21 +645,21 @@ var L = class {
614
645
  box-shadow: 0 0 0 2px
615
646
  color-mix(in srgb, var(--accent, #ef4640) 60%, transparent);
616
647
  }
617
- `, V = (e) => {
648
+ `, q = (e) => {
618
649
  const t = e ?? document;
619
- if (t.getElementById(E)) return;
650
+ if (t.getElementById(R)) return;
620
651
  const n = t.createElement("style");
621
- n.id = E, n.textContent = Y, t.head.appendChild(n);
622
- }, X = 8e3, K = 12e3, q = (e, t, n = {}) => {
623
- V(e.ownerDocument);
624
- const { sidebarUrl: r, targetOrigin: i, timeoutMs: a = X, retryIntervalMs: o = K, messageListenWindow: s } = n, l = s ?? (typeof globalThis.window < "u" ? globalThis.window : globalThis), p = () => r ?? t.src, N = () => {
652
+ n.id = R, n.textContent = K, t.head.appendChild(n);
653
+ }, Z = 8e3, Q = 12e3, ee = (e, t, n = {}) => {
654
+ q(e.ownerDocument);
655
+ const { sidebarUrl: r, targetOrigin: i, timeoutMs: a = Z, retryIntervalMs: o = Q, messageListenWindow: s } = n, l = s ?? (typeof globalThis.window < "u" ? globalThis.window : globalThis), p = () => r ?? t.src, B = () => {
625
656
  if (i) return i;
626
657
  try {
627
658
  return new URL(p()).origin;
628
659
  } catch {
629
660
  return "*";
630
661
  }
631
- }, { overlay: y, button: I } = J();
662
+ }, { overlay: y, button: v } = X();
632
663
  e.appendChild(y);
633
664
  let u = !1, h, d;
634
665
  const g = (c) => {
@@ -637,45 +668,45 @@ var L = class {
637
668
  g(!1);
638
669
  const f = () => {
639
670
  h && (globalThis.clearTimeout(h), h = void 0);
640
- }, v = () => {
671
+ }, A = () => {
641
672
  f(), h = globalThis.setTimeout(() => {
642
673
  u || g(!0);
643
674
  }, a);
644
- }, A = (c) => {
675
+ }, C = (c) => {
645
676
  const m = c?.preserveOverlay ?? !0;
646
- u = !1, m || g(!1), t.src = p(), v();
647
- }, B = () => {
677
+ u = !1, m || g(!1), t.src = p(), A();
678
+ }, U = () => {
648
679
  d || o <= 0 || (d = globalThis.setInterval(() => {
649
- u || A({ preserveOverlay: !0 });
680
+ u || C({ preserveOverlay: !0 });
650
681
  }, o));
651
- }, C = () => {
682
+ }, b = () => {
652
683
  d && (globalThis.clearInterval(d), d = void 0);
653
- }, b = (c) => {
684
+ }, S = (c) => {
654
685
  if (!t.contentWindow || c.source !== t.contentWindow) return;
655
- const m = N();
656
- m !== "*" && c.origin !== m || (u = !0, f(), C(), g(!1));
657
- }, S = () => {
658
- f(), g(!0);
686
+ const m = B();
687
+ m !== "*" && c.origin !== m || (u = !0, f(), b(), g(!1));
659
688
  }, w = () => {
660
- A();
689
+ f(), g(!0);
690
+ }, P = () => {
691
+ C();
661
692
  };
662
- return I.addEventListener("click", w), t.addEventListener("error", S), l.addEventListener("message", b), v(), B(), () => {
663
- f(), C(), t.removeEventListener("error", S), l.removeEventListener("message", b), I.removeEventListener("click", w), y.remove();
693
+ return v.addEventListener("click", P), t.addEventListener("error", w), l.addEventListener("message", S), A(), U(), () => {
694
+ f(), b(), t.removeEventListener("error", w), l.removeEventListener("message", S), v.removeEventListener("click", P), y.remove();
664
695
  };
665
- }, Z = "Markup AI Sidebar", Q = "clipboard-read; clipboard-write", fe = "markupai.sidebarNextGen.overrideUrl", me = "https://sidebar.markup.ai/";
666
- function ye(e) {
696
+ }, te = "Markup AI Sidebar", ne = "clipboard-read; clipboard-write", ve = "markupai.sidebarNextGen.overrideUrl", Ae = "https://sidebar.markup.ai/";
697
+ function Ce(e) {
667
698
  try {
668
699
  return "localStorage" in globalThis && globalThis.localStorage.getItem("markupai.sidebarNextGen.overrideUrl")?.trim() || e;
669
700
  } catch {
670
701
  return e;
671
702
  }
672
703
  }
673
- var ee = "markupai.sidebarNextGen.authOverride";
674
- function Ie(e, t) {
704
+ var re = "markupai.sidebarNextGen.authOverride";
705
+ function be(e, t) {
675
706
  if (!t) return e;
676
707
  try {
677
708
  if (!("localStorage" in globalThis)) return e;
678
- const n = globalThis.localStorage.getItem(ee)?.trim();
709
+ const n = globalThis.localStorage.getItem(re)?.trim();
679
710
  if (!n) return e;
680
711
  const r = JSON.parse(n);
681
712
  return r !== null && typeof r == "object" && "type" in r && (r.type === "mediation" || r.type === "popup") ? r : e;
@@ -683,17 +714,17 @@ function Ie(e, t) {
683
714
  return e;
684
715
  }
685
716
  }
686
- function ve(e, t) {
717
+ function Se(e, t) {
687
718
  try {
688
719
  return new URL(e).origin;
689
720
  } catch (n) {
690
721
  return t?.onInvalidUrl?.(e, n), "*";
691
722
  }
692
723
  }
693
- function Ae(e, t = "Expected SidebarAdapter from createSidebarHost") {
724
+ function we(e, t = "Expected SidebarAdapter from createSidebarHost") {
694
725
  if (e.adapter === null) throw new Error(t);
695
726
  }
696
- function te(e) {
727
+ function ie(e) {
697
728
  const { iframe: t, iframeMount: n } = e;
698
729
  if (t !== void 0 && n !== void 0) throw new Error("createSidebarHost: pass only one of `iframe` or `iframeMount`");
699
730
  if (t !== void 0) return {
@@ -701,18 +732,18 @@ function te(e) {
701
732
  removeMountedIframe: null
702
733
  };
703
734
  if (n === void 0) throw new Error("createSidebarHost: pass either `iframe` or `iframeMount`");
704
- const { container: r, src: i, allow: a = Q } = n, o = document.createElement("iframe");
705
- return o.title = Z, o.src = i, a && o.setAttribute("allow", a), r.appendChild(o), {
735
+ const { container: r, src: i, allow: a = ne } = n, o = document.createElement("iframe");
736
+ return o.title = te, o.src = i, a && o.setAttribute("allow", a), r.appendChild(o), {
706
737
  iframe: o,
707
738
  removeMountedIframe: () => {
708
739
  o.remove();
709
740
  }
710
741
  };
711
742
  }
712
- function Ce(e) {
713
- const { plugin: t, loadOverlayContainer: n, loadOverlayOptions: r, adapterOptions: i } = e, { iframe: a, removeMountedIframe: o } = te(e), s = n !== void 0 ? q(n, a, r ?? {}) : null;
743
+ function Pe(e) {
744
+ const { plugin: t, loadOverlayContainer: n, loadOverlayOptions: r, adapterOptions: i } = e, { iframe: a, removeMountedIframe: o } = ie(e), s = n !== void 0 ? ee(n, a, r ?? {}) : null;
714
745
  if (t !== void 0) {
715
- const l = new W(t, a, i);
746
+ const l = new J(t, a, i);
716
747
  return {
717
748
  iframe: a,
718
749
  adapter: l,
@@ -729,14 +760,14 @@ function Ce(e) {
729
760
  }
730
761
  };
731
762
  }
732
- var M = "sidebarContainer", R = "markupai-sidebar-host-shell-styles";
733
- function _(e) {
763
+ var L = "sidebarContainer", O = "markupai-sidebar-host-shell-styles";
764
+ function k(e) {
734
765
  if (typeof CSS < "u" && typeof CSS.escape == "function") return CSS.escape(e);
735
766
  if (!/^[a-zA-Z_][\w-]*$/.test(e)) throw new Error(String.raw`sidebar host shell: containerId must match /^[a-zA-Z_][\w-]*$/ when CSS.escape is unavailable (got ${JSON.stringify(e)})`);
736
767
  return e;
737
768
  }
738
- function k(e = M) {
739
- const t = _(e);
769
+ function N(e = L) {
770
+ const t = k(e);
740
771
  return `
741
772
  html {
742
773
  height: 100%;
@@ -761,21 +792,21 @@ body {
761
792
  }
762
793
  `.trim();
763
794
  }
764
- var be = k();
765
- function ne(e) {
795
+ var Ee = N();
796
+ function ae(e) {
766
797
  return e instanceof Document ? e : e.ownerDocument;
767
798
  }
768
- function re(e, t, n) {
769
- if (!t || e.getElementById(R)) return;
799
+ function oe(e, t, n) {
800
+ if (!t || e.getElementById(O)) return;
770
801
  const r = e.createElement("style");
771
- r.id = R, r.textContent = k(n), e.head.appendChild(r);
802
+ r.id = O, r.textContent = N(n), e.head.appendChild(r);
772
803
  }
773
- function Se(e) {
774
- const { root: t = typeof document < "u" ? document : void 0, containerId: n = M, includeDefaultStyles: r = !0 } = e ?? {};
804
+ function Re(e) {
805
+ const { root: t = typeof document < "u" ? document : void 0, containerId: n = L, includeDefaultStyles: r = !0 } = e ?? {};
775
806
  if (t === void 0) throw new Error("ensureSidebarHostShell: no document — pass `root` in non-browser environments");
776
- const i = ne(t);
777
- re(i, r, n);
778
- const a = t instanceof Document ? i.getElementById(n) : t.querySelector(`#${_(n)}`);
807
+ const i = ae(t);
808
+ oe(i, r, n);
809
+ const a = t instanceof Document ? i.getElementById(n) : t.querySelector(`#${k(n)}`);
779
810
  if (a instanceof HTMLElement && (t instanceof Document || t.contains(a))) return a;
780
811
  if (!(t instanceof Document)) {
781
812
  const s = i.createElement("div");
@@ -784,18 +815,18 @@ function Se(e) {
784
815
  const o = i.createElement("div");
785
816
  return o.id = n, i.body.appendChild(o), o;
786
817
  }
787
- function ie() {
818
+ function se() {
788
819
  return ' <meta name="viewport" content="width=device-width, initial-scale=1.0" />';
789
820
  }
790
- function we(e) {
791
- const { title: t = "Markup AI Sidebar", headInnerHtml: n = "", includePluginHostHead: r = !1, bodyScriptsHtml: i, htmlLang: a = "en", htmlAttrs: o = `lang="${a}" style="height:100%"`, bodyAttrs: s = 'style="height:100%;margin:0"' } = e, l = [r ? ie() : "", n].filter((p) => p.trim().length > 0).join(`
821
+ function Oe(e) {
822
+ const { title: t = "Markup AI Sidebar", headInnerHtml: n = "", includePluginHostHead: r = !1, bodyScriptsHtml: i, htmlLang: a = "en", htmlAttrs: o = `lang="${a}" style="height:100%"`, bodyAttrs: s = 'style="height:100%;margin:0"' } = e, l = [r ? se() : "", n].filter((p) => p.trim().length > 0).join(`
792
823
  `);
793
824
  return `<!DOCTYPE html>
794
825
  <html ${o}>
795
826
  <head>
796
827
  <base target="_top" />
797
828
  <meta charset="UTF-8" />
798
- <title>${ae(t)}</title>${l ? `
829
+ <title>${le(t)}</title>${l ? `
799
830
  ${l}` : ""}
800
831
  </head>
801
832
  <body ${s}>
@@ -804,43 +835,44 @@ ${l}` : ""}
804
835
  </html>
805
836
  `;
806
837
  }
807
- function ae(e) {
838
+ function le(e) {
808
839
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
809
840
  }
810
841
  export {
811
- ee as AUTH_CONFIG_OVERRIDE_STORAGE_KEY,
812
- $ as DEFAULT_IPC_CONFIG,
813
- le as DEFAULT_SIDEBAR_CONFIG,
814
- H as DeferredPromise,
815
- L as IPCCore,
816
- oe as MimeType,
817
- he as PluginAdapter,
818
- F as PluginIPCAdapter,
819
- me as SIDEBAR_DEFAULT_PRODUCTION_BASE_URL,
820
- M as SIDEBAR_HOST_CONTAINER_ID,
821
- be as SIDEBAR_HOST_SHELL_CSS,
822
- Q as SIDEBAR_IFRAME_DEFAULT_ALLOW,
823
- Z as SIDEBAR_IFRAME_DEFAULT_TITLE,
824
- fe as SIDEBAR_URL_OVERRIDE_STORAGE_KEY,
825
- W as SidebarAdapter,
826
- z as SidebarIPCAdapter,
827
- se as TEXT_MIME_TYPES,
828
- O as TextLookupError,
829
- Ae as assertSidebarHostAdapter,
830
- ue as buildDocumentReference,
831
- we as buildSidebarHostHtmlDocument,
832
- k as buildSidebarHostShellCss,
833
- ie as buildSidebarPluginHostHeadInnerHtml,
834
- Ce as createSidebarHost,
835
- Se as ensureSidebarHostShell,
836
- Ie as getAuthConfigWithOverride,
837
- ye as getSidebarBaseUrlWithOverride,
838
- P as ipcErrorReconstructors,
839
- pe as isDocumentReference,
840
- de as isIntegrationSettingField,
841
- ce as isIntegrationSettingsSchema,
842
- ge as isTextLookupError,
843
- U as reconstructError,
844
- q as setupSidebarLoadOverlay,
845
- ve as sidebarPostMessageTargetOrigin
842
+ he as ADAPTER_VERSION,
843
+ re as AUTH_CONFIG_OVERRIDE_STORAGE_KEY,
844
+ j as DEFAULT_IPC_CONFIG,
845
+ ge as DEFAULT_SIDEBAR_CONFIG,
846
+ $ as DeferredPromise,
847
+ M as IPCCore,
848
+ ce as MimeType,
849
+ Ie as PluginAdapter,
850
+ z as PluginIPCAdapter,
851
+ Ae as SIDEBAR_DEFAULT_PRODUCTION_BASE_URL,
852
+ L as SIDEBAR_HOST_CONTAINER_ID,
853
+ Ee as SIDEBAR_HOST_SHELL_CSS,
854
+ ne as SIDEBAR_IFRAME_DEFAULT_ALLOW,
855
+ te as SIDEBAR_IFRAME_DEFAULT_TITLE,
856
+ ve as SIDEBAR_URL_OVERRIDE_STORAGE_KEY,
857
+ J as SidebarAdapter,
858
+ G as SidebarIPCAdapter,
859
+ de as TEXT_MIME_TYPES,
860
+ T as TextLookupError,
861
+ we as assertSidebarHostAdapter,
862
+ ye as buildDocumentReference,
863
+ Oe as buildSidebarHostHtmlDocument,
864
+ N as buildSidebarHostShellCss,
865
+ se as buildSidebarPluginHostHeadInnerHtml,
866
+ Pe as createSidebarHost,
867
+ Re as ensureSidebarHostShell,
868
+ be as getAuthConfigWithOverride,
869
+ Ce as getSidebarBaseUrlWithOverride,
870
+ E as ipcErrorReconstructors,
871
+ me as isDocumentReference,
872
+ ue as isIntegrationSettingField,
873
+ pe as isIntegrationSettingsSchema,
874
+ fe as isTextLookupError,
875
+ H as reconstructError,
876
+ ee as setupSidebarLoadOverlay,
877
+ Se as sidebarPostMessageTargetOrigin
846
878
  };