@mihe-dev/js 0.0.0-stage → 0.2.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.
Files changed (95) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +114 -2
  3. package/dist/audio.d.ts +121 -0
  4. package/dist/audio.d.ts.map +1 -0
  5. package/dist/audio.js +377 -0
  6. package/dist/audio.js.map +1 -0
  7. package/dist/card-view.d.ts +79 -0
  8. package/dist/card-view.d.ts.map +1 -0
  9. package/dist/card-view.js +99 -0
  10. package/dist/card-view.js.map +1 -0
  11. package/dist/chart.d.ts +15 -0
  12. package/dist/chart.d.ts.map +1 -0
  13. package/dist/chart.js +58 -0
  14. package/dist/chart.js.map +1 -0
  15. package/dist/client.d.ts +226 -0
  16. package/dist/client.d.ts.map +1 -0
  17. package/dist/client.js +358 -0
  18. package/dist/client.js.map +1 -0
  19. package/dist/commands.d.ts +70 -0
  20. package/dist/commands.d.ts.map +1 -0
  21. package/dist/commands.js +295 -0
  22. package/dist/commands.js.map +1 -0
  23. package/dist/debug.d.ts +17 -0
  24. package/dist/debug.d.ts.map +1 -0
  25. package/dist/debug.js +29 -0
  26. package/dist/debug.js.map +1 -0
  27. package/dist/declarations.d.ts +160 -0
  28. package/dist/declarations.d.ts.map +1 -0
  29. package/dist/declarations.js +171 -0
  30. package/dist/declarations.js.map +1 -0
  31. package/dist/highlight.d.ts +77 -0
  32. package/dist/highlight.d.ts.map +1 -0
  33. package/dist/highlight.js +233 -0
  34. package/dist/highlight.js.map +1 -0
  35. package/dist/index.d.ts +41 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +32 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/mihe.d.ts +364 -0
  40. package/dist/mihe.d.ts.map +1 -0
  41. package/dist/mihe.iife.min.js +217 -0
  42. package/dist/mihe.iife.min.js.map +7 -0
  43. package/dist/mihe.js +758 -0
  44. package/dist/mihe.js.map +1 -0
  45. package/dist/mihe.min.js +217 -0
  46. package/dist/mihe.min.js.map +7 -0
  47. package/dist/store.d.ts +175 -0
  48. package/dist/store.d.ts.map +1 -0
  49. package/dist/store.js +208 -0
  50. package/dist/store.js.map +1 -0
  51. package/dist/voice.d.ts +192 -0
  52. package/dist/voice.d.ts.map +1 -0
  53. package/dist/voice.js +443 -0
  54. package/dist/voice.js.map +1 -0
  55. package/dist/widget/card.d.ts +17 -0
  56. package/dist/widget/card.d.ts.map +1 -0
  57. package/dist/widget/card.js +31 -0
  58. package/dist/widget/card.js.map +1 -0
  59. package/dist/widget/dom.d.ts +24 -0
  60. package/dist/widget/dom.d.ts.map +1 -0
  61. package/dist/widget/dom.js +49 -0
  62. package/dist/widget/dom.js.map +1 -0
  63. package/dist/widget/element.d.ts +88 -0
  64. package/dist/widget/element.d.ts.map +1 -0
  65. package/dist/widget/element.js +285 -0
  66. package/dist/widget/element.js.map +1 -0
  67. package/dist/widget/format.d.ts +24 -0
  68. package/dist/widget/format.d.ts.map +1 -0
  69. package/dist/widget/format.js +64 -0
  70. package/dist/widget/format.js.map +1 -0
  71. package/dist/widget/icons.d.ts +5 -0
  72. package/dist/widget/icons.d.ts.map +1 -0
  73. package/dist/widget/icons.js +19 -0
  74. package/dist/widget/icons.js.map +1 -0
  75. package/dist/widget/launcher.d.ts +13 -0
  76. package/dist/widget/launcher.d.ts.map +1 -0
  77. package/dist/widget/launcher.js +27 -0
  78. package/dist/widget/launcher.js.map +1 -0
  79. package/dist/widget/mark.d.ts +10 -0
  80. package/dist/widget/mark.d.ts.map +1 -0
  81. package/dist/widget/mark.js +20 -0
  82. package/dist/widget/mark.js.map +1 -0
  83. package/dist/widget/orb.d.ts +92 -0
  84. package/dist/widget/orb.d.ts.map +1 -0
  85. package/dist/widget/orb.js +500 -0
  86. package/dist/widget/orb.js.map +1 -0
  87. package/dist/widget/panel.d.ts +40 -0
  88. package/dist/widget/panel.d.ts.map +1 -0
  89. package/dist/widget/panel.js +240 -0
  90. package/dist/widget/panel.js.map +1 -0
  91. package/dist/widget/styles.d.ts +22 -0
  92. package/dist/widget/styles.d.ts.map +1 -0
  93. package/dist/widget/styles.js +192 -0
  94. package/dist/widget/styles.js.map +1 -0
  95. package/package.json +43 -4
@@ -0,0 +1,88 @@
1
+ /**
2
+ * `<mihe-assistant>`: the widget as a web component, for any page and any
3
+ * framework (doc 08). The orb by default, or the classic launcher and panel,
4
+ * or just the panel inside a container of the host's.
5
+ *
6
+ * ```ts
7
+ * import { createMihe, mountWidget } from "@mihe-dev/js";
8
+ * const mihe = createMihe({ … });
9
+ * mountWidget(mihe); // floating
10
+ * mountWidget(mihe, { layout: "inline", container: sidebar }); // in a sidebar
11
+ * ```
12
+ *
13
+ * Or in HTML, connected by script:
14
+ *
15
+ * ```html
16
+ * <mihe-assistant form="classic" corner="bottom-left"></mihe-assistant>
17
+ * <script type="module">
18
+ * defineMiheAssistant();
19
+ * document.querySelector("mihe-assistant").mihe = createMihe({ … });
20
+ * </script>
21
+ * ```
22
+ *
23
+ * Everything renders in a shadow root, so the host page's CSS cannot reach
24
+ * it. One consequence: the panel's id is inside the shadow root, so a host
25
+ * trigger's `aria-controls` cannot point at it.
26
+ *
27
+ * The class is defined when `defineMiheAssistant` first runs, never on
28
+ * import: importing must work where `HTMLElement` does not exist, such as a
29
+ * server render, and must not register anything a page did not ask for.
30
+ */
31
+ import type { VoiceMode, WidgetCorner, WidgetForm } from "@mihe-dev/protocol";
32
+ import type { Mihe } from "../mihe.js";
33
+ export declare const ELEMENT_NAME = "mihe-assistant";
34
+ export interface WidgetOptions {
35
+ /**
36
+ * `"floating"`, the default: the orb or launcher, and a panel over the
37
+ * page. `"inline"`: the panel alone, filling the element, for a sidebar or
38
+ * a drawer the host app owns.
39
+ */
40
+ layout?: "floating" | "inline";
41
+ /** Header title, and the launcher's accessible name. The app's assistant name otherwise. */
42
+ title?: string;
43
+ placeholder?: string;
44
+ /** Show the orb or launcher. Off when the host app has its own trigger. */
45
+ showLauncher?: boolean;
46
+ /** Open on first mount. */
47
+ defaultOpen?: boolean;
48
+ /** Inline only: a close button in the header. */
49
+ showClose?: boolean;
50
+ /** Drawn in the orb or launcher in place of the uploaded icon. Cloned. */
51
+ launcherIcon?: Node;
52
+ /**
53
+ * How far the orb, launcher and floating panel sit from the bottom and side
54
+ * edges, in pixels; 20 by default. For a page with its own floating widget
55
+ * in the same corner, such as a support chat: lift Mihe above it rather
56
+ * than stacking the two.
57
+ */
58
+ offset?: {
59
+ bottom?: number;
60
+ side?: number;
61
+ };
62
+ form?: WidgetForm;
63
+ draggable?: boolean;
64
+ corner?: WidgetCorner;
65
+ voiceModes?: VoiceMode[];
66
+ }
67
+ /** `<mihe-assistant>`, once defined. */
68
+ export interface MiheAssistantElement extends HTMLElement {
69
+ /** The assistant it draws. Setting it connects the element. */
70
+ mihe: Mihe | null;
71
+ /** Merged over the element's attributes. */
72
+ options: WidgetOptions;
73
+ }
74
+ /** Register `<mihe-assistant>`. Safe to call more than once. */
75
+ export declare function defineMiheAssistant(): void;
76
+ export interface MountedWidget {
77
+ element: MiheAssistantElement;
78
+ /** Remove the widget. The assistant stays connected. */
79
+ unmount: () => void;
80
+ }
81
+ /**
82
+ * Put the widget on the page: floating over it by default, or inline in
83
+ * `container` with `layout: "inline"`.
84
+ */
85
+ export declare function mountWidget(mihe: Mihe, options?: WidgetOptions & {
86
+ container?: Element;
87
+ }): MountedWidget;
88
+ //# sourceMappingURL=element.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../../../js/src/widget/element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAkB,MAAM,oBAAoB,CAAC;AAE9F,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAOpC,eAAO,MAAM,YAAY,mBAAmB,CAAC;AAE7C,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,MAAM,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAC;IAC/B,4FAA4F;IAC5F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2EAA2E;IAC3E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,2BAA2B;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iDAAiD;IACjD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB;;;;;OAKG;IACH,MAAM,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAO5C,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;CAC1B;AAED,wCAAwC;AACxC,MAAM,WAAW,oBAAqB,SAAQ,WAAW;IACvD,+DAA+D;IAC/D,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,4CAA4C;IAC5C,OAAO,EAAE,aAAa,CAAC;CACxB;AA4CD,gEAAgE;AAChE,wBAAgB,mBAAmB,IAAI,IAAI,CAqN1C;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,oBAAoB,CAAC;IAC9B,wDAAwD;IACxD,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,IAAI,EACV,OAAO,GAAE,aAAa,GAAG;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAO,GACpD,aAAa,CAQf"}
@@ -0,0 +1,285 @@
1
+ /**
2
+ * `<mihe-assistant>`: the widget as a web component, for any page and any
3
+ * framework (doc 08). The orb by default, or the classic launcher and panel,
4
+ * or just the panel inside a container of the host's.
5
+ *
6
+ * ```ts
7
+ * import { createMihe, mountWidget } from "@mihe-dev/js";
8
+ * const mihe = createMihe({ … });
9
+ * mountWidget(mihe); // floating
10
+ * mountWidget(mihe, { layout: "inline", container: sidebar }); // in a sidebar
11
+ * ```
12
+ *
13
+ * Or in HTML, connected by script:
14
+ *
15
+ * ```html
16
+ * <mihe-assistant form="classic" corner="bottom-left"></mihe-assistant>
17
+ * <script type="module">
18
+ * defineMiheAssistant();
19
+ * document.querySelector("mihe-assistant").mihe = createMihe({ … });
20
+ * </script>
21
+ * ```
22
+ *
23
+ * Everything renders in a shadow root, so the host page's CSS cannot reach
24
+ * it. One consequence: the panel's id is inside the shadow root, so a host
25
+ * trigger's `aria-controls` cannot point at it.
26
+ *
27
+ * The class is defined when `defineMiheAssistant` first runs, never on
28
+ * import: importing must work where `HTMLElement` does not exist, such as a
29
+ * server render, and must not register anything a page did not ask for.
30
+ */
31
+ import { h, replace, setAttrs } from "./dom.js";
32
+ import { launcherFace } from "./launcher.js";
33
+ import { Orb } from "./orb.js";
34
+ import { DEFAULT_VOICE_MODES, Panel } from "./panel.js";
35
+ import { STYLES } from "./styles.js";
36
+ export const ELEMENT_NAME = "mihe-assistant";
37
+ /** A setting passed in code, the app's setting otherwise, the SDK's default last. */
38
+ function resolve(options, settings) {
39
+ const allowed = settings?.voiceModes ?? DEFAULT_VOICE_MODES;
40
+ return {
41
+ form: options.form ?? settings?.form ?? "orb",
42
+ draggable: options.draggable ?? settings?.draggable ?? false,
43
+ corner: options.corner ?? settings?.corner ?? "bottom-right",
44
+ voiceModes: options.voiceModes ? options.voiceModes.filter((mode) => allowed.includes(mode)) : allowed,
45
+ };
46
+ }
47
+ /** Options written as attributes, for a widget placed in HTML. */
48
+ function fromAttributes(element) {
49
+ const read = (name) => element.getAttribute(name) ?? undefined;
50
+ const flag = (name) => (element.hasAttribute(name) ? read(name) !== "false" : undefined);
51
+ const modes = read("voice-modes");
52
+ return {
53
+ layout: read("layout"),
54
+ // Not `title`, which every element already has as its tooltip.
55
+ title: read("heading"),
56
+ placeholder: read("placeholder"),
57
+ showLauncher: flag("show-launcher"),
58
+ defaultOpen: flag("default-open"),
59
+ showClose: flag("show-close"),
60
+ form: read("form"),
61
+ draggable: flag("draggable"),
62
+ corner: read("corner"),
63
+ offset: read("offset-bottom") === undefined && read("offset-side") === undefined
64
+ ? undefined
65
+ : {
66
+ bottom: read("offset-bottom") === undefined ? undefined : Number(read("offset-bottom")),
67
+ side: read("offset-side") === undefined ? undefined : Number(read("offset-side")),
68
+ },
69
+ voiceModes: modes === undefined ? undefined : modes.split(/[\s,]+/).filter(Boolean),
70
+ };
71
+ }
72
+ function withoutUndefined(options) {
73
+ return Object.fromEntries(Object.entries(options).filter(([, value]) => value !== undefined));
74
+ }
75
+ /** Register `<mihe-assistant>`. Safe to call more than once. */
76
+ export function defineMiheAssistant() {
77
+ if (typeof customElements === "undefined" || customElements.get(ELEMENT_NAME))
78
+ return;
79
+ class Element extends HTMLElement {
80
+ static observedAttributes = [
81
+ "layout",
82
+ "heading",
83
+ "placeholder",
84
+ "show-launcher",
85
+ "default-open",
86
+ "show-close",
87
+ "form",
88
+ "draggable",
89
+ "corner",
90
+ "voice-modes",
91
+ "offset-bottom",
92
+ "offset-side",
93
+ ];
94
+ assistant = null;
95
+ ownOptions = {};
96
+ unsubscribe = null;
97
+ shadow = null;
98
+ panel = null;
99
+ orb = null;
100
+ launcher = null;
101
+ launcherKey = [];
102
+ failedIcon = null;
103
+ openedByDefault = false;
104
+ get mihe() {
105
+ return this.assistant;
106
+ }
107
+ set mihe(value) {
108
+ if (value === this.assistant)
109
+ return;
110
+ this.disconnectAssistant();
111
+ this.assistant = value;
112
+ if (this.isConnected)
113
+ this.connectAssistant();
114
+ }
115
+ get options() {
116
+ return this.ownOptions;
117
+ }
118
+ set options(value) {
119
+ this.ownOptions = { ...value };
120
+ this.render();
121
+ }
122
+ connectedCallback() {
123
+ if (!this.shadow) {
124
+ this.shadow = this.attachShadow({ mode: "open" });
125
+ this.shadow.appendChild(h("style", {}, STYLES));
126
+ }
127
+ this.connectAssistant();
128
+ }
129
+ disconnectedCallback() {
130
+ this.disconnectAssistant();
131
+ }
132
+ attributeChangedCallback() {
133
+ this.render();
134
+ }
135
+ connectAssistant() {
136
+ if (!this.assistant || this.unsubscribe || !this.shadow)
137
+ return;
138
+ const mihe = this.assistant;
139
+ this.panel = new Panel(mihe, { showClose: true, showVoice: true });
140
+ this.shadow.appendChild(this.panel.root);
141
+ this.unsubscribe = mihe.subscribe(() => this.render());
142
+ // Honoured once. After that the assistant owns open and closed, so a
143
+ // host trigger and this option cannot fight over it.
144
+ if (this.resolved().defaultOpen && !this.openedByDefault) {
145
+ this.openedByDefault = true;
146
+ mihe.open();
147
+ }
148
+ this.render();
149
+ }
150
+ disconnectAssistant() {
151
+ this.unsubscribe?.();
152
+ this.unsubscribe = null;
153
+ this.orb?.destroy();
154
+ for (const part of [this.panel?.root, this.orb?.root, this.launcher])
155
+ part?.remove();
156
+ this.panel = null;
157
+ this.orb = null;
158
+ this.launcher = null;
159
+ this.launcherKey = [];
160
+ }
161
+ resolved() {
162
+ return { ...withoutUndefined(fromAttributes(this)), ...withoutUndefined(this.ownOptions) };
163
+ }
164
+ render() {
165
+ const mihe = this.assistant;
166
+ if (!mihe || !this.shadow || !this.panel)
167
+ return;
168
+ const state = mihe.getState();
169
+ const options = this.resolved();
170
+ const widget = resolve(options, state.widgetSettings);
171
+ const heading = options.title ?? state.assistantName ?? "Assistant";
172
+ const offset = { bottom: options.offset?.bottom ?? 20, side: options.offset?.side ?? 20 };
173
+ const showLauncher = options.showLauncher ?? true;
174
+ const panel = this.panel;
175
+ if (options.layout === "inline") {
176
+ // For `:host([layout="inline"])`. Set only when missing, because
177
+ // setting an observed attribute calls back into this render.
178
+ if (this.getAttribute("layout") !== "inline")
179
+ this.setAttribute("layout", "inline");
180
+ panel.setOptions({
181
+ title: options.title,
182
+ placeholder: options.placeholder,
183
+ showClose: options.showClose ?? false,
184
+ showVoice: true,
185
+ });
186
+ panel.root.classList.remove("floating", "left", "right");
187
+ panel.root.removeAttribute("style");
188
+ panel.root.hidden = false;
189
+ panel.update(state);
190
+ this.hideOrb();
191
+ if (this.launcher)
192
+ this.launcher.hidden = true;
193
+ return;
194
+ }
195
+ if (widget.form === "orb") {
196
+ if (this.launcher)
197
+ this.launcher.hidden = true;
198
+ if (!this.orb) {
199
+ this.orb = new Orb(mihe);
200
+ this.shadow.appendChild(this.orb.root);
201
+ }
202
+ this.orb.update(state, {
203
+ heading,
204
+ draggable: widget.draggable,
205
+ corner: widget.corner,
206
+ voiceModes: widget.voiceModes,
207
+ launcherIcon: options.launcherIcon,
208
+ offset,
209
+ });
210
+ // Chat open: the panel takes the orb's place, on the orb's side.
211
+ // Voice is the orb's, so the panel has no microphone.
212
+ this.orb.root.hidden = state.isOpen || !showLauncher;
213
+ this.showPanel(state.isOpen, this.orb.side(), offset, {
214
+ title: options.title,
215
+ placeholder: options.placeholder,
216
+ showClose: true,
217
+ showVoice: false,
218
+ });
219
+ return;
220
+ }
221
+ this.hideOrb();
222
+ this.showPanel(state.isOpen, "right", offset, {
223
+ title: options.title,
224
+ placeholder: options.placeholder,
225
+ showClose: true,
226
+ showVoice: true,
227
+ });
228
+ const launcher = this.drawLauncher(heading, options.launcherIcon, state.launcherIconUrl);
229
+ launcher.hidden = state.isOpen || !showLauncher;
230
+ launcher.style.bottom = `${offset.bottom}px`;
231
+ launcher.style.right = `${offset.side}px`;
232
+ }
233
+ showPanel(open, side, offset, options) {
234
+ const panel = this.panel;
235
+ panel.root.hidden = !open;
236
+ panel.root.classList.add("floating");
237
+ panel.root.style.bottom = `${offset.bottom}px`;
238
+ panel.root.style.left = side === "left" ? `${offset.side}px` : "";
239
+ panel.root.style.right = side === "right" ? `${offset.side}px` : "";
240
+ // The panel keeps to the viewport however far it is lifted.
241
+ panel.root.style.height = `min(560px, calc(100vh - ${offset.bottom + 20}px))`;
242
+ panel.setOptions(options);
243
+ panel.update(this.assistant.getState());
244
+ }
245
+ hideOrb() {
246
+ if (this.orb)
247
+ this.orb.root.hidden = true;
248
+ }
249
+ drawLauncher(heading, icon, url) {
250
+ if (!this.launcher) {
251
+ this.launcher = h("button", {
252
+ class: "launcher",
253
+ attrs: { type: "button", "aria-controls": "mihe-panel", "aria-expanded": "false" },
254
+ on: { click: () => this.assistant?.open() },
255
+ });
256
+ this.shadow.appendChild(this.launcher);
257
+ }
258
+ setAttrs(this.launcher, { "aria-label": `Open ${heading}` });
259
+ const key = [icon, url, this.failedIcon];
260
+ if (key.some((value, index) => value !== this.launcherKey[index])) {
261
+ this.launcherKey = key;
262
+ replace(this.launcher, launcherFace(icon, url, this.failedIcon, (failed) => {
263
+ this.failedIcon = failed;
264
+ this.render();
265
+ }));
266
+ }
267
+ return this.launcher;
268
+ }
269
+ }
270
+ customElements.define(ELEMENT_NAME, Element);
271
+ }
272
+ /**
273
+ * Put the widget on the page: floating over it by default, or inline in
274
+ * `container` with `layout: "inline"`.
275
+ */
276
+ export function mountWidget(mihe, options = {}) {
277
+ defineMiheAssistant();
278
+ const { container, ...widget } = options;
279
+ const element = document.createElement(ELEMENT_NAME);
280
+ element.options = widget;
281
+ element.mihe = mihe;
282
+ (container ?? document.body).appendChild(element);
283
+ return { element, unmount: () => element.remove() };
284
+ }
285
+ //# sourceMappingURL=element.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"element.js","sourceRoot":"","sources":["../../../../js/src/widget/element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAKH,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EA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WAAW,CAAC,OAAO,CAAC,CAAC;IAClD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;AACtD,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * How a proposal's input reads on the approval card, for every card Mihe
3
+ * draws: the web component's and the React SDK's.
4
+ *
5
+ * One copy, because the card is the last thing a user reads before approving
6
+ * something consequential, and two copies would drift in exactly the place
7
+ * where "what they were shown" has to mean one thing.
8
+ */
9
+ /**
10
+ * Render one field of a proposal for a person to read.
11
+ *
12
+ * This is the last thing a user sees before approving something consequential,
13
+ * so `JSON.stringify` is not good enough — it was showing
14
+ * `[{"productName":"Chocolate Protein Loaf","quantity":3}]` where the sentence
15
+ * "3 × Chocolate Protein Loaf" was wanted. Someone who cannot read the card
16
+ * cannot meaningfully consent to what it describes.
17
+ *
18
+ * Values still come entirely from the schema-validated input, never from model
19
+ * prose, so this changes how the payload is *shown* and not what it can say.
20
+ */
21
+ export declare function formatValue(value: unknown): string;
22
+ /** `productName` and `order_number` both become "Product name". */
23
+ export declare function humanizeKey(key: string): string;
24
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../js/src/widget/format.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAsClD;AAED,mEAAmE;AACnE,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM/C"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * How a proposal's input reads on the approval card, for every card Mihe
3
+ * draws: the web component's and the React SDK's.
4
+ *
5
+ * One copy, because the card is the last thing a user reads before approving
6
+ * something consequential, and two copies would drift in exactly the place
7
+ * where "what they were shown" has to mean one thing.
8
+ */
9
+ /**
10
+ * Render one field of a proposal for a person to read.
11
+ *
12
+ * This is the last thing a user sees before approving something consequential,
13
+ * so `JSON.stringify` is not good enough — it was showing
14
+ * `[{"productName":"Chocolate Protein Loaf","quantity":3}]` where the sentence
15
+ * "3 × Chocolate Protein Loaf" was wanted. Someone who cannot read the card
16
+ * cannot meaningfully consent to what it describes.
17
+ *
18
+ * Values still come entirely from the schema-validated input, never from model
19
+ * prose, so this changes how the payload is *shown* and not what it can say.
20
+ */
21
+ export function formatValue(value) {
22
+ if (value === null || value === undefined)
23
+ return "—";
24
+ if (typeof value === "string")
25
+ return value;
26
+ if (typeof value === "number" || typeof value === "boolean") {
27
+ return String(value);
28
+ }
29
+ if (Array.isArray(value)) {
30
+ return value.map(formatValue).join(", ") || "—";
31
+ }
32
+ if (typeof value === "object") {
33
+ const entries = Object.entries(value);
34
+ // A quantity paired with a name is common enough — order lines, stock
35
+ // adjustments, recipe amounts — to be worth reading as one.
36
+ const quantity = entries.find(([key]) => /^(quantity|qty|count)$/i.test(key));
37
+ // An id is not a product name. Only compact a labelled quantity; all
38
+ // remaining fields still have to be visible before the user consents.
39
+ const name = entries.find(([key, nested]) => /(?:name|title|label)$|^(?:product|item)$/i.test(key) &&
40
+ typeof nested === "string");
41
+ if (quantity && name) {
42
+ const details = entries
43
+ .filter(([key]) => key !== quantity[0] && key !== name[0])
44
+ .map(([key, nested]) => `${humanizeKey(key)}: ${formatValue(nested)}`);
45
+ return [
46
+ `${formatValue(quantity[1])} × ${formatValue(name[1])}`,
47
+ ...details,
48
+ ].join("; ");
49
+ }
50
+ return entries
51
+ .map(([key, nested]) => `${humanizeKey(key)}: ${formatValue(nested)}`)
52
+ .join(", ");
53
+ }
54
+ return String(value);
55
+ }
56
+ /** `productName` and `order_number` both become "Product name". */
57
+ export function humanizeKey(key) {
58
+ const spaced = key
59
+ .replace(/[_-]+/g, " ")
60
+ .replace(/([a-z0-9])([A-Z])/g, "$1 $2")
61
+ .trim();
62
+ return spaced.charAt(0).toUpperCase() + spaced.slice(1).toLowerC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AAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC;iBACzD,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,KAAK,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACzE,OAAO;gBACL,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;gBACvD,GAAG,OAAO;aACX,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACf,CAAC;QAED,OAAO,OAAO;aACX,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,KAAK,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;aACrE,IAAI,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAED,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,MAAM,MAAM,GAAG,GAAG;SACf,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;SACtB,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC;SACtC,IAAI,EAAE,CAAC;IACV,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;AACxE,CAAC"}
@@ -0,0 +1,5 @@
1
+ /** The orb menu's icons, the same strokes as the React SDK's. */
2
+ export declare const chatIcon: () => SVGElement;
3
+ export declare const micIcon: () => SVGElement;
4
+ export declare const waveIcon: () => SVGElement;
5
+ //# sourceMappingURL=icons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../../js/src/widget/icons.ts"],"names":[],"mappings":"AAAA,iEAAiE;AAsBjE,eAAO,MAAM,QAAQ,kBACwH,CAAC;AAE9I,eAAO,MAAM,OAAO,kBAIjB,CAAC;AAEJ,eAAO,MAAM,QAAQ,kBAA6E,CAAC"}
@@ -0,0 +1,19 @@
1
+ /** The orb menu's icons, the same strokes as the React SDK's. */
2
+ import { svg } from "./dom.js";
3
+ function icon(...children) {
4
+ return svg("svg", {
5
+ viewBox: "0 0 20 20",
6
+ width: 18,
7
+ height: 18,
8
+ fill: "none",
9
+ stroke: "currentColor",
10
+ "stroke-width": 1.7,
11
+ "stroke-linecap": "round",
12
+ "stroke-linejoin": "round",
13
+ "aria-hidden": "true",
14
+ }, ...children);
15
+ }
16
+ export const chatIcon = () => icon(svg("path", { d: "M4 4.5h12a1.5 1.5 0 0 1 1.5 1.5v7a1.5 1.5 0 0 1-1.5 1.5H9l-4 3v-3H4A1.5 1.5 0 0 1 2.5 13V6A1.5 1.5 0 0 1 4 4.5Z" }));
17
+ export const micIcon = () => icon(svg("rect", { x: 7, y: 2.5, width: 6, height: 10, rx: 3 }), svg("path", { d: "M4.5 9.5a5.5 5.5 0 0 0 11 0M10 15v2.5" }));
18
+ export const waveIcon = () => icon(svg("path", { d: "M3 10v0M6.5 7v6M10 4v12M13.5 7v6M17 10v0" }));
19
+ //# sourceMappingURL=icons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icons.js","sourceRoot":"","sources":["../../../../js/src/widget/icons.ts"],"names":[],"mappings":"AAAA,iEAAiE;AAEjE,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,SAAS,IAAI,CAAC,GAAG,QAAsB;IACrC,OAAO,GAAG,CACR,KAAK,EACL;QACE,OAAO,EAAE,WAAW;QACpB,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,cAAc;QACtB,cAAc,EAAE,GAAG;QACnB,gBAAgB,EAAE,OAAO;QACzB,iBAAiB,EAAE,OAAO;QAC1B,aAAa,EAAE,MAAM;KACtB,EACD,GAAG,QAAQ,CACZ,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE,CAC3B,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,iHAAiH,EAAE,CAAC,CAAC,CAAC;AAE9I,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,EAAE,CAC1B,IAAI,CACF,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAC1D,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,uCAAuC,EAAE,CAAC,CAC5D,CAAC;AAEJ,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,0CAA0C,EAAE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * What the launcher and the orb show: the host's own icon, the customer's
3
+ * uploaded icon, or the Mihe mark on the brand's warm ink.
4
+ */
5
+ /**
6
+ * The uploaded image fills the circle, so what the dashboard's preview shows
7
+ * is what a user sees. If it cannot load (a Content-Security-Policy that does
8
+ * not allow the storage's domain, say), it falls back to the mark instead of
9
+ * an empty circle: `onFail` is told which URL failed, and the next draw skips
10
+ * it.
11
+ */
12
+ export declare function launcherFace(override: Node | undefined, url: string | null, failed: string | null, onFail: (url: string) => void): Node;
13
+ //# sourceMappingURL=launcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../../../../js/src/widget/launcher.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,IAAI,GAAG,SAAS,EAC1B,GAAG,EAAE,MAAM,GAAG,IAAI,EAClB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAC5B,IAAI,CAUN"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * What the launcher and the orb show: the host's own icon, the customer's
3
+ * uploaded icon, or the Mihe mark on the brand's warm ink.
4
+ */
5
+ import { h } from "./dom.js";
6
+ import { miheMark } from "./mark.js";
7
+ import { LAUNCHER_INK, LAUNCHER_VOICE } from "./styles.js";
8
+ /**
9
+ * The uploaded image fills the circle, so what the dashboard's preview shows
10
+ * is what a user sees. If it cannot load (a Content-Security-Policy that does
11
+ * not allow the storage's domain, say), it falls back to the mark instead of
12
+ * an empty circle: `onFail` is told which URL failed, and the next draw skips
13
+ * it.
14
+ */
15
+ export function launcherFace(override, url, failed, onFail) {
16
+ if (override)
17
+ return override.cloneNode(true);
18
+ if (url && url !== failed) {
19
+ return h("img", {
20
+ class: "launcher-image",
21
+ attrs: { src: url, alt: "", draggable: "false" },
22
+ on: { error: () => onFail(url) },
23
+ });
24
+ }
25
+ return miheMark(34, LAUNCHER_INK, LAUNCHER_VOICE);
26
+ }
27
+ //# sourceMappingURL=launcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"launcher.js","sourceRoot":"","sources":["../../../../js/src/widget/launcher.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAC1B,QAA0B,EAC1B,GAAkB,EAClB,MAAqB,EACrB,MAA6B;IAE7B,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC9C,IAAI,GAAG,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;QAC1B,OAAO,CAAC,CAAC,KAAK,EAAE;YACd,KAAK,EAAE,gBAAgB;YACvB,KAAK,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE;YAChD,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;SACjC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC,EAAE,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;AACpD,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The Mihe mark, the widget's default launcher icon (amendment 58).
3
+ *
4
+ * An oracle in an open ring, with one pair of arcs for its voice. Drawn inline
5
+ * rather than loaded, so the default launcher needs no request and no
6
+ * permission from the host page's Content-Security-Policy. A copy of the
7
+ * React SDK's `mark.tsx`, which holds the same two paths.
8
+ */
9
+ export declare function miheMark(size: number, body: string, voice: string): SVGElement;
10
+ //# sourceMappingURL=mark.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mark.d.ts","sourceRoot":"","sources":["../../../../js/src/widget/mark.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU,CAS9E"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The Mihe mark, the widget's default launcher icon (amendment 58).
3
+ *
4
+ * An oracle in an open ring, with one pair of arcs for its voice. Drawn inline
5
+ * rather than loaded, so the default launcher needs no request and no
6
+ * permission from the host page's Content-Security-Policy. A copy of the
7
+ * React SDK's `mark.tsx`, which holds the same two paths.
8
+ */
9
+ import { svg } from "./dom.js";
10
+ const TRANSFORM = "translate(0.000000,1760.000000) scale(0.100000,-0.100000)";
11
+ /** The figure and the ring. */
12
+ const BODY = "M8165 16868 c-450 -31 -1057 -131 -1495 -248 -76 -20 -156 -42 -180 -50 -14 -5 -50 -15 -80 -24 -146 -41 -273 -82 -360 -117 -25 -9 -74 -27 -110 -39 -36 -12 -74 -25 -85 -30 -11 -4 -40 -15 -65 -25 -25 -10 -54 -21 -65 -26 -11 -4 -85 -35 -165 -67 -218 -90 -530 -238 -715 -340 -38 -21 -106 -58 -150 -82 -44 -24 -108 -61 -143 -82 -34 -21 -65 -38 -68 -38 -2 0 -17 -8 -32 -19 -15 -10 -52 -34 -82 -53 -1161 -733 -2106 -1735 -2771 -2935 -74 -134 -219 -425 -219 -440 0 -4 -10 -24 -23 -43 -13 -19 -34 -60 -46 -90 -13 -30 -35 -80 -48 -110 -49 -112 -56 -127 -91 -220 -16 -41 -32 -84 -37 -95 -45 -114 -195 -563 -238 -715 -26 -88 -58 -212 -67 -255 -5 -22 -16 -69 -25 -105 -19 -78 -66 -317 -89 -455 -140 -836 -144 -1701 -11 -2525 9 -52 20 -122 25 -155 9 -53 17 -97 51 -262 16 -78 80 -337 105 -423 74 -256 219 -700 264 -810 26 -63 55 -135 79 -192 6 -13 24 -54 40 -91 17 -38 31 -70 31 -72 0 -3 105 -221 203 -425 39 -79 80 -154 128 -233 16 -26 29 -50 29 -52 0 -3 37 -65 82 -138 45 -72 88 -143 95 -157 64 -113 285 -440 339 -500 12 -14 43 -56 70 -95 42 -63 164 -220 221 -285 12 -14 36 -43 55 -66 250 -310 644 -706 1038 -1045 68 -59 396 -310 514 -395 88 -63 522 -341 596 -382 19 -10 80 -45 135 -77 120 -69 571 -298 670 -339 39 -16 107 -47 153 -68 46 -21 87 -38 93 -38 5 0 17 -4 27 -10 25 -13 78 -35 157 -63 39 -14 120 -43 180 -65 222 -82 417 -145 565 -183 41 -10 91 -23 110 -29 134 -37 514 -119 645 -139 836 -130 1685 -150 2385 -57 63 8 151 20 195 26 44 6 100 15 125 20 25 5 88 17 140 25 286 49 729 160 1015 256 198 67 349 119 370 129 11 6 72 30 135 54 63 24 142 56 175 71 103 46 118 52 183 79 53 22 224 108 572 287 750 385 1586 1059 2290 1844 219 244 499 612 666 873 32 52 91 144 131 205 91 141 268 456 366 652 87 172 167 341 167 350 0 4 6 21 14 38 56 124 212 529 241 627 9 30 21 64 26 75 4 11 16 45 25 75 9 30 25 82 36 115 54 166 146 535 178 710 82 461 106 640 137 1030 20 252 23 814 5 1015 -6 74 -17 191 -23 260 -12 141 -34 328 -49 410 -5 30 -16 100 -25 155 -9 55 -26 145 -37 200 -11 55 -24 118 -28 140 -4 22 -16 72 -25 110 -9 39 -20 86 -24 105 -203 889 -617 1816 -1181 2640 -141 205 -236 333 -350 470 -52 63 -113 138 -135 165 -203 255 -745 786 -1035 1016 -58 45 -138 109 -179 142 -228 181 -749 524 -1006 662 -49 26 -115 62 -145 78 -71 38 -346 176 -430 215 -138 64 -201 92 -206 92 -3 0 -35 14 -71 30 -35 17 -70 30 -77 30 -6 0 -16 4 -21 8 -9 8 -216 87 -387 148 -38 13 -98 35 -135 49 -38 13 -102 34 -143 45 -41 12 -97 28 -125 36 -180 53 -464 125 -610 154 -165 33 -214 43 -240 47 -16 2 -66 10 -110 18 -328 56 -573 84 -755 88 l-125 2 0 -515 0 -515 190 -21 c105 -12 242 -29 305 -39 63 -10 138 -21 165 -26 123 -18 192 -30 225 -39 19 -5 62 -14 95 -20 233 -44 615 -154 905 -260 47 -17 105 -38 130 -47 25 -8 59 -21 75 -28 17 -7 93 -39 170 -71 418 -173 867 -425 1345 -757 747 -518 1525 -1379 1970 -2182 18 -33 41 -73 50 -90 64 -116 84 -152 123 -231 25 -49 57 -118 72 -154 15 -36 36 -85 47 -110 42 -93 56 -127 78 -180 12 -30 26 -64 31 -75 61 -146 144 -376 194 -540 15 -49 31 -101 36 -115 9 -26 46 -175 74 -295 8 -38 20 -86 25 -105 15 -58 45 -214 80 -425 24 -141 62 -499 79 -745 34 -482 -17 -1111 -134 -1655 -14 -66 -30 -140 -35 -165 -8 -38 -22 -93 -65 -260 -28 -107 -86 -292 -127 -405 -59 -164 -118 -318 -128 -337 -6 -10 -10 -22 -10 -27 0 -6 -18 -49 -40 -96 -22 -47 -40 -88 -40 -90 0 -27 -247 -518 -314 -624 -14 -22 -26 -43 -26 -45 0 -37 -381 -596 -565 -829 -225 -283 -622 -706 -875 -929 -155 -137 -228 -198 -237 -198 -9 0 -127 185 -183 285 -12 22 -28 47 -35 55 -7 8 -32 49 -55 90 -24 41 -76 125 -115 185 -40 61 -123 195 -186 298 -63 103 -126 207 -141 230 -15 23 -31 49 -35 57 -3 8 -16 29 -27 45 -12 17 -26 39 -33 50 -7 11 -33 54 -59 95 -67 106 -620 996 -1072 1725 -58 94 -129 206 -158 251 -29 45 -65 103 -80 130 -15 27 -55 92 -89 144 -88 134 -280 445 -400 645 -56 94 -163 269 -239 389 -75 121 -135 224 -134 228 2 5 35 54 73 109 403 577 447 641 713 1032 134 197 262 399 262 413 0 8 -36 85 -79 172 -44 86 -142 285 -219 442 -77 157 -244 497 -372 755 -128 259 -297 601 -375 760 -78 160 -220 448 -315 640 -95 193 -264 535 -376 760 -400 810 -543 1101 -566 1155 -14 30 -33 74 -43 98 -17 39 -55 61 -55 31 0 -6 -35 -83 -79 -172 -43 -89 -106 -218 -139 -287 -68 -142 -323 -661 -607 -1235 -106 -214 -271 -550 -368 -745 -225 -457 -457 -927 -747 -1515 -363 -735 -420 -852 -420 -862 0 -10 166 -267 241 -373 21 -30 95 -138 164 -240 68 -102 160 -237 204 -300 80 -115 147 -212 296 -430 43 -63 93 -135 112 -159 42 -56 42 -57 -11 -134 -24 -35 -58 -90 -76 -122 -29 -52 -66 -114 -107 -180 -7 -11 -20 -33 -29 -50 -9 -16 -45 -73 -79 -125 -34 -52 -74 -117 -89 -145 -16 -27 -34 -57 -42 -66 -8 -8 -14 -19 -14 -23 0 -4 -10 -22 -23 -39 -12 -18 -28 -41 -34 -52 -7 -11 -33 -54 -59 -95 -26 -41 -58 -95 -72 -120 -13 -25 -35 -58 -47 -75 -21 -29 -238 -378 -619 -995 -96 -157 -210 -339 -252 -405 -104 -164 -269 -429 -343 -550 -33 -55 -92 -149 -131 -210 -38 -60 -78 -126 -90 -145 -11 -19 -25 -42 -30 -50 -5 -8 -44 -71 -86 -140 -42 -69 -104 -168 -138 -220 -34 -53 -66 -104 -73 -115 -6 -11 -76 -123 -155 -249 -79 -126 -145 -234 -147 -240 -2 -6 -21 -36 -41 -66 -76 -112 -170 -260 -170 -267 0 -5 -14 -24 -30 -43 -29 -35 -29 -35 -82 16 -29 28 -91 84 -138 124 -567 490 -1171 1224 -1508 1832 -47 85 -232 451 -274 543 -20 44 -53 115 -72 158 -20 42 -36 80 -36 83 0 3 -6 20 -14 37 -20 47 -40 99 -85 222 -79 217 -90 252 -140 420 -49 167 -85 311 -141 558 -120 534 -163 1390 -99 1962 41 369 37 343 84 595 48 260 75 373 159 683 39 143 224 654 286 792 110 242 174 371 314 630 563 1039 1532 2008 2644 2642 68 38 455 233 532 267 131 58 397 168 465 192 108 39 384 130 445 148 30 8 87 25 125 36 316 96 789 185 1190 225 94 9 176 20 183 24 12 5 16 287 12 1022 0 13 -27 15 -135 7z m660 -4508 c4 -16 11 -32 16 -35 5 -4 9 -12 9 -20 0 -8 19 -53 41 -102 71 -151 106 -226 129 -278 12 -27 39 -86 60 -130 21 -44 52 -111 70 -150 17 -38 44 -97 60 -130 15 -33 35 -76 43 -95 8 -19 31 -69 50 -110 62 -134 89 -194 107 -240 10 -25 46 -103 80 -175 90 -190 106 -224 133 -285 49 -108 70 -156 97 -215 15 -33 37 -82 50 -110 12 -27 40 -87 61 -133 40 -83 40 -83 6 -140 -19 -31 -50 -86 -69 -122 -65 -120 -91 -165 -140 -242 -26 -43 -48 -80 -48 -83 0 -2 -17 -33 -38 -67 -21 -35 -41 -70 -45 -78 -4 -8 -11 -22 -17 -30 -34 -54 -110 -181 -110 -185 0 -3 -11 -23 -25 -45 -14 -22 -46 -80 -72 -128 -25 -48 -54 -98 -63 -112 -41 -58 -150 -263 -150 -280 0 -10 15 -47 33 -82 62 -117 120 -223 128 -234 5 -6 48 -87 95 -180 47 -93 90 -173 94 -179 4 -5 27 -46 50 -90 23 -44 67 -127 98 -185 30 -58 59 -110 63 -116 11 -14 72 -130 111 -209 37 -77 56 -114 103 -200 142 -264 186 -348 323 -615 63 -124 128 -250 145 -280 33 -59 82 -154 250 -480 58 -113 129 -250 157 -305 96 -182 151 -288 268 -515 63 -124 135 -263 160 -310 24 -47 118 -229 207 -405 170 -333 225 -440 277 -534 17 -31 112 -216 211 -411 99 -195 188 -372 199 -393 11 -22 18 -40 16 -42 -10 -11 -431 -215 -443 -215 -2 0 -36 -15 -77 -34 -40 -18 -109 -48 -153 -66 -44 -18 -93 -38 -110 -45 -16 -7 -75 -29 -130 -50 -55 -20 -116 -43 -135 -50 -39 -14 -282 -90 -345 -107 -22 -6 -60 -16 -85 -24 -61 -17 -216 -55 -265 -64 -22 -4 -85 -17 -140 -28 -165 -33 -277 -52 -513 -87 -183 -27 -182 -27 -182 78 0 34 -4 98 -10 142 -5 44 -14 141 -20 215 -24 285 -30 360 -45 530 -9 96 -20 229 -25 295 -5 66 -17 206 -25 310 -9 105 -20 249 -25 320 -5 72 -12 148 -15 170 -3 22 -10 105 -15 185 -5 80 -17 228 -25 330 -9 102 -20 237 -24 300 -5 63 -19 225 -30 360 -11 135 -27 335 -36 445 -30 392 -37 461 -50 510 -8 28 -26 97 -41 155 -14 58 -37 146 -50 195 -41 154 -55 209 -64 245 -9 33 -23 89 -55 205 -7 28 -25 100 -40 160 -24 98 -49 196 -61 233 -8 27 -28 5 -40 -44 -6 -27 -24 -94 -38 -149 -15 -55 -43 -161 -62 -235 -20 -74 -49 -187 -65 -250 -17 -63 -39 -151 -50 -195 -23 -92 -39 -157 -69 -270 -30 -113 -36 -170 -75 -720 -8 -110 -21 -276 -30 -370 -8 -93 -19 -226 -25 -295 -5 -69 -12 -143 -15 -165 -3 -22 -10 -105 -16 -185 -24 -330 -41 -552 -59 -745 -22 -237 -31 -345 -40 -460 -5 -66 -16 -201 -25 -300 -8 -99 -19 -234 -25 -300 -15 -193 -40 -482 -50 -590 -5 -55 -9 -106 -10 -112 0 -18 -71 -17 -184 2 -50 9 -122 20 -161 26 -108 16 -241 39 -345 61 -52 11 -113 24 -135 28 -52 11 -235 56 -300 75 -27 7 -75 20 -106 29 -62 17 -397 127 -444 146 -16 7 -39 16 -50 21 -11 5 -56 22 -100 39 -214 82 -663 292 -724 339 -23 18 -23 18 62 182 46 90 130 252 185 359 55 107 121 236 147 285 26 50 100 194 165 320 64 127 146 286 182 355 36 69 100 193 143 275 43 83 106 204 140 270 34 66 109 210 165 320 108 211 202 391 280 540 26 50 70 133 97 185 28 52 112 217 188 365 76 149 141 275 145 280 4 6 54 100 110 210 57 110 123 238 148 285 25 47 63 119 85 160 22 41 71 133 110 205 39 71 107 202 152 290 45 88 91 177 103 197 12 21 37 66 55 100 19 35 51 95 72 133 238 435 243 447 218 497 -34 66 -100 186 -137 247 -19 31 -43 72 -53 91 -65 116 -87 155 -142 248 -34 57 -61 106 -61 108 0 2 -10 21 -23 42 -13 20 -44 75 -69 122 -25 47 -73 132 -107 188 -33 57 -61 106 -61 108 0 2 -29 52 -65 110 -68 111 -74 132 -51 180 26 52 103 218 126 269 13 28 41 88 62 135 22 47 54 114 70 150 48 104 78 169 124 267 24 51 44 98 44 103 0 6 4 18 10 28 13 22 90 192 90 198 0 2 23 52 51 112 54 112 81 171 205 440 19 41 34 76 34 78 0 3 15 37 34 77 18 40 43 95 56 122 12 28 43 93 67 145 25 52 49 105 54 117 12 32 36 28 44 -7z";
13
+ /** The two arcs, the only part of the mark in colour. */
14
+ const VOICE = "M4399 12732 c-37 -42 -101 -117 -143 -166 -123 -145 -496 -679 -496 -712 0 -2 -18 -34 -41 -71 -100 -164 -271 -530 -369 -793 -17 -47 -36 -96 -42 -110 -35 -86 -134 -426 -172 -595 -50 -218 -49 -218 -81 -445 -85 -598 -74 -1269 30 -1820 8 -47 20 -107 24 -135 11 -60 68 -292 87 -355 8 -25 21 -67 29 -95 23 -79 72 -227 85 -260 7 -16 16 -39 20 -50 34 -90 73 -186 108 -265 11 -25 30 -70 43 -100 45 -106 197 -400 256 -493 14 -22 36 -60 50 -85 97 -175 409 -612 437 -612 6 0 85 66 176 147 91 80 199 176 240 212 41 36 100 89 130 117 30 29 73 67 95 86 123 107 120 82 23 209 -209 275 -459 726 -589 1064 -112 292 -165 474 -219 750 -19 96 -26 136 -50 287 -70 444 -45 1047 65 1543 9 39 20 88 24 110 149 680 553 1448 1043 1980 15 17 28 33 28 36 0 11 -703 699 -714 699 -6 0 -41 -35 -77 -78z M12835 12532 c-154 -152 -313 -307 -354 -344 -84 -76 -85 -63 16 -174 227 -250 460 -601 637 -959 70 -144 93 -192 130 -280 10 -22 21 -49 26 -60 5 -11 16 -42 25 -70 10 -27 21 -59 26 -70 23 -55 77 -234 112 -370 45 -175 56 -227 78 -345 24 -127 27 -151 58 -425 26 -231 28 -544 6 -780 -17 -180 -30 -267 -85 -570 -9 -47 -39 -165 -89 -350 -23 -83 -54 -178 -76 -230 -7 -16 -19 -48 -28 -70 -144 -374 -335 -726 -576 -1060 -56 -77 -100 -145 -99 -151 2 -5 68 -68 148 -140 80 -71 172 -154 205 -185 138 -128 375 -329 388 -329 23 0 437 582 437 614 0 3 16 30 35 60 62 98 305 576 305 601 0 3 14 35 31 72 54 117 135 338 174 478 124 434 155 590 214 1065 67 536 5 1382 -141 1930 -11 41 -24 89 -28 105 -24 91 -128 414 -175 543 -34 95 -127 306 -196 447 -145 295 -273 511 -475 795 -154 217 -416 530 -443 530 -3 0 -132 -125 -286 -278z";
15
+ export function miheMark(size, body, voice) {
16
+ const mark = svg("svg", { viewBox: "0 0 1760 1760", width: size, height: size, "aria-hidden": "true", focusable: "false" }, svg("path", { fill: body, "fill-rule": "evenodd", transform: TRANSFORM, d: BODY }), svg("path", { fill: voice, "fill-rule": "evenodd", transform: TRANSFORM, d: VOICE }));
17
+ mark.style.display = "block";
18
+ return mark;
19
+ }
20
+ //# sourceMappingURL=mark.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mark.js","sourceRoot":"","sources":["../../../../js/src/widget/mark.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,MAAM,SAAS,GAAG,2DAA2D,CAAC;AAE9E,+BAA+B;AAC/B,MAAM,IAAI,GAAG,m2RAAm2R,CAAC;AAEj3R,yDAAyD;AACzD,MAAM,KAAK,GAAG,0iDAA0iD,CAAC;AAEzjD,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,IAAY,EAAE,KAAa;IAChE,MAAM,IAAI,GAAG,GAAG,CACd,KAAK,EACL,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,EAClG,GAAG,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAClF,GAAG,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CACrF,CAAC;IACF,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;IAC7B,OAAO,IAAI,CAAC;AACd,CAAC"}