@jaak.ai/stamps 2.1.0-dev.9 → 2.2.0-dev.1

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 (79) hide show
  1. package/README.md +42 -9
  2. package/dist/cjs/app-globals-V2Kpy_OQ.js +8 -0
  3. package/dist/cjs/app-globals-V2Kpy_OQ.js.map +1 -0
  4. package/dist/cjs/{index-BfhtOB0D.js → index-D6NBn_qu.js} +203 -121
  5. package/dist/cjs/index-D6NBn_qu.js.map +1 -0
  6. package/dist/cjs/jaak-stamps-webcomponent.cjs.js +5 -4
  7. package/dist/cjs/jaak-stamps-webcomponent.cjs.js.map +1 -1
  8. package/dist/cjs/jaak-stamps.cjs.entry.js +20219 -420
  9. package/dist/cjs/jaak-stamps.cjs.entry.js.map +1 -1
  10. package/dist/cjs/jaak-stamps.entry.cjs.js.map +1 -1
  11. package/dist/cjs/loader.cjs.js +4 -3
  12. package/dist/cjs/loader.cjs.js.map +1 -1
  13. package/dist/collection/collection-manifest.json +1 -1
  14. package/dist/collection/components/my-component/my-component.css +83 -3
  15. package/dist/collection/components/my-component/my-component.js +521 -302
  16. package/dist/collection/components/my-component/my-component.js.map +1 -1
  17. package/dist/collection/services/CameraService.js +84 -2
  18. package/dist/collection/services/CameraService.js.map +1 -1
  19. package/dist/collection/services/DetectionService.js +7 -148
  20. package/dist/collection/services/DetectionService.js.map +1 -1
  21. package/dist/collection/services/LicenseValidationService.js +111 -0
  22. package/dist/collection/services/LicenseValidationService.js.map +1 -0
  23. package/dist/collection/services/MetricsService.js +350 -0
  24. package/dist/collection/services/MetricsService.js.map +1 -0
  25. package/dist/collection/services/ServiceContainer.js +66 -1
  26. package/dist/collection/services/ServiceContainer.js.map +1 -1
  27. package/dist/collection/services/TracingService.js +442 -0
  28. package/dist/collection/services/TracingService.js.map +1 -0
  29. package/dist/collection/services/interfaces/IDetectionService.js.map +1 -1
  30. package/dist/collection/services/interfaces/ILicenseValidationService.js +2 -0
  31. package/dist/collection/services/interfaces/ILicenseValidationService.js.map +1 -0
  32. package/dist/collection/services/interfaces/IMetricsService.js +2 -0
  33. package/dist/collection/services/interfaces/IMetricsService.js.map +1 -0
  34. package/dist/collection/services/interfaces/ITracingService.js +2 -0
  35. package/dist/collection/services/interfaces/ITracingService.js.map +1 -0
  36. package/dist/components/index.js +192 -115
  37. package/dist/components/index.js.map +1 -1
  38. package/dist/components/jaak-stamps.js +20235 -423
  39. package/dist/components/jaak-stamps.js.map +1 -1
  40. package/dist/esm/app-globals-DQuL1Twl.js +6 -0
  41. package/dist/esm/app-globals-DQuL1Twl.js.map +1 -0
  42. package/dist/esm/{index-BP1Q4KOg.js → index-BCfAsrzL.js} +204 -121
  43. package/dist/esm/index-BCfAsrzL.js.map +1 -0
  44. package/dist/esm/jaak-stamps-webcomponent.js +5 -4
  45. package/dist/esm/jaak-stamps-webcomponent.js.map +1 -1
  46. package/dist/esm/jaak-stamps.entry.js +20219 -420
  47. package/dist/esm/jaak-stamps.entry.js.map +1 -1
  48. package/dist/esm/loader.js +4 -3
  49. package/dist/esm/loader.js.map +1 -1
  50. package/dist/jaak-stamps-webcomponent/jaak-stamps-webcomponent.esm.js +1 -1
  51. package/dist/jaak-stamps-webcomponent/jaak-stamps-webcomponent.esm.js.map +1 -1
  52. package/dist/jaak-stamps-webcomponent/jaak-stamps.entry.esm.js.map +1 -1
  53. package/dist/jaak-stamps-webcomponent/loader.esm.js.map +1 -1
  54. package/dist/jaak-stamps-webcomponent/p-8c49893d.entry.js +7 -0
  55. package/dist/jaak-stamps-webcomponent/p-8c49893d.entry.js.map +1 -0
  56. package/dist/jaak-stamps-webcomponent/p-BCfAsrzL.js +3 -0
  57. package/dist/jaak-stamps-webcomponent/p-BCfAsrzL.js.map +1 -0
  58. package/dist/jaak-stamps-webcomponent/p-DQuL1Twl.js +2 -0
  59. package/dist/jaak-stamps-webcomponent/p-DQuL1Twl.js.map +1 -0
  60. package/dist/types/components/my-component/my-component.d.ts +24 -27
  61. package/dist/types/components.d.ts +77 -3
  62. package/dist/types/services/CameraService.d.ts +1 -0
  63. package/dist/types/services/DetectionService.d.ts +1 -9
  64. package/dist/types/services/LicenseValidationService.d.ts +59 -0
  65. package/dist/types/services/MetricsService.d.ts +74 -0
  66. package/dist/types/services/ServiceContainer.d.ts +14 -1
  67. package/dist/types/services/TracingService.d.ts +67 -0
  68. package/dist/types/services/interfaces/IDetectionService.d.ts +0 -6
  69. package/dist/types/services/interfaces/ILicenseValidationService.d.ts +4 -0
  70. package/dist/types/services/interfaces/IMetricsService.d.ts +70 -0
  71. package/dist/types/services/interfaces/ITracingService.d.ts +59 -0
  72. package/dist/types/stencil-public-runtime.d.ts +12 -5
  73. package/package.json +20 -2
  74. package/dist/cjs/index-BfhtOB0D.js.map +0 -1
  75. package/dist/esm/index-BP1Q4KOg.js.map +0 -1
  76. package/dist/jaak-stamps-webcomponent/p-BP1Q4KOg.js +0 -3
  77. package/dist/jaak-stamps-webcomponent/p-BP1Q4KOg.js.map +0 -1
  78. package/dist/jaak-stamps-webcomponent/p-c115e01a.entry.js +0 -2
  79. package/dist/jaak-stamps-webcomponent/p-c115e01a.entry.js.map +0 -1
package/README.md CHANGED
@@ -58,6 +58,10 @@ yarn add @jaak.ai/stamps
58
58
 
59
59
  | Property | Type | Default | Description |
60
60
  |----------|------|---------|-------------|
61
+ | `license` | `string` | `undefined` | License key for component authentication (required) |
62
+ | `environment` | `'dev' \| 'qa' \| 'staging' \| 'prod'` | `'prod'` | API environment for license validation |
63
+ | `trace-id` | `string` | `undefined` | Optional trace ID for request tracing (auto-generated if not provided) |
64
+ | `app-id` | `string` | `'jaak-stamps-web'` | Application identifier for analytics and tracking |
61
65
  | `debug` | `boolean` | `false` | Enable debug mode with additional logging and overlays |
62
66
  | `mask-size` | `number` | `90` | Size percentage of the document detection mask |
63
67
  | `alignment-tolerance` | `number` | `15` | Tolerance level for document alignment detection |
@@ -152,6 +156,7 @@ preloadModel(): Promise<{
152
156
  |-------|-------------|-------------|
153
157
  | `isReady` | `boolean` | Fired when component is fully initialized and ready |
154
158
  | `captureCompleted` | `object` | Fired when document capture process is completed |
159
+ | `traceIdGenerated` | `{ traceId: string }` | Fired after license validation with the generated or provided trace ID for request tracing |
155
160
 
156
161
  ### Type Definitions
157
162
 
@@ -206,6 +211,9 @@ interface StatusResponse {
206
211
  <body>
207
212
  <jaak-stamps
208
213
  id="documentScanner"
214
+ license="your-license-key-here"
215
+ environment="prod"
216
+ app-id="my-custom-app"
209
217
  preferred-camera="auto"
210
218
  capture-delay="1500"
211
219
  use-document-detector="true"
@@ -214,23 +222,29 @@ interface StatusResponse {
214
222
 
215
223
  <script>
216
224
  const scanner = document.getElementById('documentScanner');
217
-
225
+
226
+ // Handle trace ID generation
227
+ scanner.addEventListener('traceIdGenerated', (event) => {
228
+ console.log('Trace ID for this session:', event.detail.traceId);
229
+ // Use this trace ID for correlating requests across your system
230
+ });
231
+
218
232
  // Wait for component to be ready
219
233
  scanner.addEventListener('isReady', () => {
220
234
  console.log('Document scanner is ready');
221
-
235
+
222
236
  // Start the capture process
223
237
  scanner.startCapture();
224
238
  });
225
-
239
+
226
240
  // Handle capture completion
227
241
  scanner.addEventListener('captureCompleted', async (event) => {
228
242
  console.log('Capture completed:', event.detail);
229
-
243
+
230
244
  // Get captured images
231
245
  const images = await scanner.getCapturedImages();
232
246
  console.log('Captured images:', images);
233
-
247
+
234
248
  // Process the images as needed
235
249
  if (images.front.cropped) {
236
250
  // Display or upload the cropped front image
@@ -285,22 +299,29 @@ const DocumentScanner: React.FC = () => {
285
299
  const scanner = scannerRef.current;
286
300
  if (!scanner) return;
287
301
 
302
+ // Trace ID generation handler
303
+ const handleTraceIdGenerated = (event: CustomEvent) => {
304
+ console.log('Trace ID:', event.detail.traceId);
305
+ };
306
+
288
307
  // Component ready handler
289
308
  const handleReady = () => {
290
309
  setIsReady(true);
291
310
  };
292
-
311
+
293
312
  // Capture completion handler
294
313
  const handleCaptureCompleted = async () => {
295
314
  const images = await (scanner as any).getCapturedImages();
296
315
  setCapturedImages(images);
297
316
  };
298
-
317
+
299
318
  // Add event listeners
319
+ scanner.addEventListener('traceIdGenerated', handleTraceIdGenerated);
300
320
  scanner.addEventListener('isReady', handleReady);
301
321
  scanner.addEventListener('captureCompleted', handleCaptureCompleted);
302
322
 
303
323
  return () => {
324
+ scanner.removeEventListener('traceIdGenerated', handleTraceIdGenerated);
304
325
  scanner.removeEventListener('isReady', handleReady);
305
326
  scanner.removeEventListener('captureCompleted', handleCaptureCompleted);
306
327
  };
@@ -318,6 +339,10 @@ const DocumentScanner: React.FC = () => {
318
339
 
319
340
  <jaak-stamps
320
341
  ref={scannerRef}
342
+ license="your-license-key-here"
343
+ environment="prod"
344
+ app-id="my-react-app"
345
+ trace-id="" // Leave empty to auto-generate
321
346
  preferred-camera="auto"
322
347
  capture-delay={1500}
323
348
  use-document-classification={true}
@@ -390,6 +415,9 @@ interface CapturedImages {
390
415
 
391
416
  <jaak-stamps
392
417
  #scanner
418
+ license="your-license-key-here"
419
+ environment="prod"
420
+ app-id="my-angular-app"
393
421
  preferred-camera="auto"
394
422
  [capture-delay]="1500"
395
423
  [use-document-classification]="true"
@@ -506,12 +534,17 @@ export class DocumentScannerComponent implements AfterViewInit {
506
534
 
507
535
  ngAfterViewInit() {
508
536
  const scanner = this.scannerRef.nativeElement;
509
-
537
+
538
+ // Trace ID generation handler
539
+ scanner.addEventListener('traceIdGenerated', (event: CustomEvent) => {
540
+ console.log('Trace ID:', event.detail.traceId);
541
+ });
542
+
510
543
  // Component ready handler
511
544
  scanner.addEventListener('isReady', () => {
512
545
  this.isReady = true;
513
546
  });
514
-
547
+
515
548
  // Capture completion handler
516
549
  scanner.addEventListener('captureCompleted', async () => {
517
550
  this.capturedImages = await scanner.getCapturedImages();
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ const globalScripts = () => {};
4
+
5
+ exports.globalScripts = globalScripts;
6
+ //# sourceMappingURL=app-globals-V2Kpy_OQ.js.map
7
+
8
+ //# sourceMappingURL=app-globals-V2Kpy_OQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-globals-V2Kpy_OQ.js","sources":["@stencil/core/internal/app-globals"],"sourcesContent":["export const globalScripts = () => {};\nexport const globalStyles = \"\";\n"],"names":[],"mappings":";;AAAY,MAAC,aAAa,GAAG,MAAM;;;;"}
@@ -3,11 +3,8 @@
3
3
  const NAMESPACE = 'jaak-stamps-webcomponent';
4
4
  const BUILD = /* jaak-stamps-webcomponent */ { hydratedSelectorName: "hydrated", lazyLoad: true, updatable: true, watchCallback: false };
5
5
 
6
- const globalScripts = () => {};
7
- const globalStyles = "";
8
-
9
6
  /*
10
- Stencil Client Platform v4.33.1 | MIT Licensed | https://stenciljs.com
7
+ Stencil Client Platform v4.36.3 | MIT Licensed | https://stenciljs.com
11
8
  */
12
9
  var __defProp = Object.defineProperty;
13
10
  var __export = (target, all) => {
@@ -15,6 +12,10 @@ var __export = (target, all) => {
15
12
  __defProp(target, name, { get: all[name], enumerable: true });
16
13
  };
17
14
 
15
+ // src/utils/constants.ts
16
+ var SVG_NS = "http://www.w3.org/2000/svg";
17
+ var HTML_NS = "http://www.w3.org/1999/xhtml";
18
+
18
19
  // src/utils/es2022-rewire-class-members.ts
19
20
  var reWireGetterSetter = (instance, hostRef) => {
20
21
  var _a;
@@ -109,7 +110,6 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
109
110
 
110
111
  // src/client/client-style.ts
111
112
  var styles = /* @__PURE__ */ new Map();
112
- var HYDRATED_STYLE_ID = "sty-id";
113
113
  var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
114
114
  var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
115
115
  var win = typeof window !== "undefined" ? window : {};
@@ -131,6 +131,7 @@ var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
131
131
  }
132
132
  return false;
133
133
  })() ;
134
+ var supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets ? /* @__PURE__ */ (() => !!win.document && Object.getOwnPropertyDescriptor(win.document.adoptedStyleSheets, "length").writable)() : false;
134
135
  var queuePending = false;
135
136
  var queueDomReads = [];
136
137
  var queueDomWrites = [];
@@ -230,12 +231,24 @@ var unwrapErr = (result) => {
230
231
  throw result.value;
231
232
  }
232
233
  };
234
+
235
+ // src/utils/style.ts
236
+ function createStyleSheetIfNeededAndSupported(styles2) {
237
+ return void 0;
238
+ }
239
+
240
+ // src/utils/shadow-root.ts
241
+ var globalStyleSheet;
233
242
  function createShadowRoot(cmpMeta) {
243
+ var _a;
234
244
  const shadowRoot = this.attachShadow({ mode: "open" });
235
- if (supportsConstructableStylesheets) {
236
- const sheet = new CSSStyleSheet();
237
- sheet.replaceSync(globalStyles);
238
- shadowRoot.adoptedStyleSheets.push(sheet);
245
+ if (globalStyleSheet === void 0) globalStyleSheet = (_a = createStyleSheetIfNeededAndSupported()) != null ? _a : null;
246
+ if (globalStyleSheet) {
247
+ if (supportsMutableAdoptedStyleSheets) {
248
+ shadowRoot.adoptedStyleSheets.push(globalStyleSheet);
249
+ } else {
250
+ shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, globalStyleSheet];
251
+ }
239
252
  }
240
253
  }
241
254
  var createTime = (fnName, tagName = "") => {
@@ -252,6 +265,110 @@ var uniqueTime = (key, measureText) => {
252
265
  };
253
266
  }
254
267
  };
268
+ var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
269
+ var registerStyle = (scopeId2, cssText, allowCS) => {
270
+ let style = styles.get(scopeId2);
271
+ if (supportsConstructableStylesheets && allowCS) {
272
+ style = style || new CSSStyleSheet();
273
+ if (typeof style === "string") {
274
+ style = cssText;
275
+ } else {
276
+ style.replaceSync(cssText);
277
+ }
278
+ } else {
279
+ style = cssText;
280
+ }
281
+ styles.set(scopeId2, style);
282
+ };
283
+ var addStyle = (styleContainerNode, cmpMeta, mode) => {
284
+ var _a;
285
+ const scopeId2 = getScopeId(cmpMeta);
286
+ const style = styles.get(scopeId2);
287
+ if (!win.document) {
288
+ return scopeId2;
289
+ }
290
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
291
+ if (style) {
292
+ if (typeof style === "string") {
293
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
294
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
295
+ let styleElm;
296
+ if (!appliedStyles) {
297
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
298
+ }
299
+ if (!appliedStyles.has(scopeId2)) {
300
+ {
301
+ styleElm = win.document.createElement("style");
302
+ styleElm.innerHTML = style;
303
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
304
+ if (nonce != null) {
305
+ styleElm.setAttribute("nonce", nonce);
306
+ }
307
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
308
+ if (styleContainerNode.nodeName === "HEAD") {
309
+ const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
310
+ const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
311
+ styleContainerNode.insertBefore(
312
+ styleElm,
313
+ (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
314
+ );
315
+ } else if ("host" in styleContainerNode) {
316
+ if (supportsConstructableStylesheets) {
317
+ const stylesheet = new CSSStyleSheet();
318
+ stylesheet.replaceSync(style);
319
+ if (supportsMutableAdoptedStyleSheets) {
320
+ styleContainerNode.adoptedStyleSheets.unshift(stylesheet);
321
+ } else {
322
+ styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
323
+ }
324
+ } else {
325
+ const existingStyleContainer = styleContainerNode.querySelector("style");
326
+ if (existingStyleContainer) {
327
+ existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
328
+ } else {
329
+ styleContainerNode.prepend(styleElm);
330
+ }
331
+ }
332
+ } else {
333
+ styleContainerNode.append(styleElm);
334
+ }
335
+ }
336
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
337
+ styleContainerNode.insertBefore(styleElm, null);
338
+ }
339
+ }
340
+ if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
341
+ styleElm.innerHTML += SLOT_FB_CSS;
342
+ }
343
+ if (appliedStyles) {
344
+ appliedStyles.add(scopeId2);
345
+ }
346
+ }
347
+ } else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
348
+ if (supportsMutableAdoptedStyleSheets) {
349
+ styleContainerNode.adoptedStyleSheets.push(style);
350
+ } else {
351
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
352
+ }
353
+ }
354
+ }
355
+ return scopeId2;
356
+ };
357
+ var attachStyles = (hostRef) => {
358
+ const cmpMeta = hostRef.$cmpMeta$;
359
+ const elm = hostRef.$hostElement$;
360
+ const flags = cmpMeta.$flags$;
361
+ const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
362
+ const scopeId2 = addStyle(
363
+ elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
364
+ cmpMeta);
365
+ if (flags & 10 /* needsScopedEncapsulation */) {
366
+ elm["s-sc"] = scopeId2;
367
+ elm.classList.add(scopeId2 + "-h");
368
+ }
369
+ endAttachStyles();
370
+ };
371
+ var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
255
372
  var h = (nodeName, vnodeData, ...children) => {
256
373
  let child = null;
257
374
  let key = null;
@@ -328,10 +445,18 @@ var createSupportsRuleRe = (selector) => {
328
445
  createSupportsRuleRe("::slotted");
329
446
  createSupportsRuleRe(":host");
330
447
  createSupportsRuleRe(":host-context");
331
- var parsePropertyValue = (propValue, propType) => {
448
+ var parsePropertyValue = (propValue, propType, isFormAssociated) => {
449
+ if (typeof propValue === "string" && (propType & 16 /* Unknown */ || propType & 8 /* Any */) && (propValue.startsWith("{") && propValue.endsWith("}") || propValue.startsWith("[") && propValue.endsWith("]"))) {
450
+ try {
451
+ return JSON.parse(propValue);
452
+ } catch (e) {
453
+ }
454
+ }
332
455
  if (propValue != null && !isComplexType(propValue)) {
333
456
  if (propType & 4 /* Boolean */) {
334
- return propValue === "false" ? false : propValue === "" || !!propValue;
457
+ {
458
+ return propValue === "false" ? false : propValue === "" || !!propValue;
459
+ }
335
460
  }
336
461
  if (propType & 2 /* Number */) {
337
462
  return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
@@ -343,7 +468,10 @@ var parsePropertyValue = (propValue, propType) => {
343
468
  }
344
469
  return propValue;
345
470
  };
346
- var getElement = (ref) => getHostRef(ref).$hostElement$ ;
471
+ var getElement = (ref) => {
472
+ var _a;
473
+ return (_a = getHostRef(ref)) == null ? void 0 : _a.$hostElement$ ;
474
+ };
347
475
 
348
476
  // src/runtime/event-emitter.ts
349
477
  var createEvent = (ref, name, flags) => {
@@ -364,102 +492,6 @@ var emitEvent = (elm, name, opts) => {
364
492
  elm.dispatchEvent(ev);
365
493
  return ev;
366
494
  };
367
- var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
368
- var registerStyle = (scopeId2, cssText, allowCS) => {
369
- let style = styles.get(scopeId2);
370
- if (supportsConstructableStylesheets && allowCS) {
371
- style = style || new CSSStyleSheet();
372
- if (typeof style === "string") {
373
- style = cssText;
374
- } else {
375
- style.replaceSync(cssText);
376
- }
377
- } else {
378
- style = cssText;
379
- }
380
- styles.set(scopeId2, style);
381
- };
382
- var addStyle = (styleContainerNode, cmpMeta, mode) => {
383
- var _a;
384
- const scopeId2 = getScopeId(cmpMeta);
385
- const style = styles.get(scopeId2);
386
- if (!win.document) {
387
- return scopeId2;
388
- }
389
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
390
- if (style) {
391
- if (typeof style === "string") {
392
- styleContainerNode = styleContainerNode.head || styleContainerNode;
393
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
394
- let styleElm;
395
- if (!appliedStyles) {
396
- rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
397
- }
398
- if (!appliedStyles.has(scopeId2)) {
399
- {
400
- styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || win.document.createElement("style");
401
- styleElm.innerHTML = style;
402
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
403
- if (nonce != null) {
404
- styleElm.setAttribute("nonce", nonce);
405
- }
406
- if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
407
- if (styleContainerNode.nodeName === "HEAD") {
408
- const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
409
- const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
410
- styleContainerNode.insertBefore(
411
- styleElm,
412
- (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
413
- );
414
- } else if ("host" in styleContainerNode) {
415
- if (supportsConstructableStylesheets) {
416
- const stylesheet = new CSSStyleSheet();
417
- stylesheet.replaceSync(style);
418
- styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
419
- } else {
420
- const existingStyleContainer = styleContainerNode.querySelector("style");
421
- if (existingStyleContainer) {
422
- existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
423
- } else {
424
- styleContainerNode.prepend(styleElm);
425
- }
426
- }
427
- } else {
428
- styleContainerNode.append(styleElm);
429
- }
430
- }
431
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
432
- styleContainerNode.insertBefore(styleElm, null);
433
- }
434
- }
435
- if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
436
- styleElm.innerHTML += SLOT_FB_CSS;
437
- }
438
- if (appliedStyles) {
439
- appliedStyles.add(scopeId2);
440
- }
441
- }
442
- } else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
443
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
444
- }
445
- }
446
- return scopeId2;
447
- };
448
- var attachStyles = (hostRef) => {
449
- const cmpMeta = hostRef.$cmpMeta$;
450
- const elm = hostRef.$hostElement$;
451
- const flags = cmpMeta.$flags$;
452
- const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
453
- const scopeId2 = addStyle(
454
- elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
455
- cmpMeta);
456
- if (flags & 10 /* needsScopedEncapsulation */) {
457
- elm["s-sc"] = scopeId2;
458
- elm.classList.add(scopeId2 + "-h");
459
- }
460
- endAttachStyles();
461
- };
462
- var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
463
495
  var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
464
496
  if (oldValue === newValue) {
465
497
  return;
@@ -519,7 +551,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
519
551
  }
520
552
  } else {
521
553
  const isComplex = isComplexType(newValue);
522
- if ((isProp || isComplex && newValue !== null) && true) {
554
+ if ((isProp || isComplex && newValue !== null) && !isSvg) {
523
555
  try {
524
556
  if (!elm.tagName.includes("-")) {
525
557
  const n = newValue == null ? "" : newValue;
@@ -612,14 +644,21 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
612
644
  if (newVNode2.$text$ !== null) {
613
645
  elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
614
646
  } else {
647
+ if (!isSvgMode) {
648
+ isSvgMode = newVNode2.$tag$ === "svg";
649
+ }
615
650
  if (!win.document) {
616
651
  throw new Error(
617
652
  "You are trying to render a Stencil component in an environment that doesn't support the DOM. Make sure to populate the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/window) object before rendering a component."
618
653
  );
619
654
  }
620
- elm = newVNode2.$elm$ = win.document.createElement(
655
+ elm = newVNode2.$elm$ = win.document.createElementNS(
656
+ isSvgMode ? SVG_NS : HTML_NS,
621
657
  newVNode2.$tag$
622
- );
658
+ ) ;
659
+ if (isSvgMode && newVNode2.$tag$ === "foreignObject") {
660
+ isSvgMode = false;
661
+ }
623
662
  {
624
663
  updateElement(null, newVNode2, isSvgMode);
625
664
  }
@@ -631,6 +670,13 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
631
670
  }
632
671
  }
633
672
  }
673
+ {
674
+ if (newVNode2.$tag$ === "svg") {
675
+ isSvgMode = false;
676
+ } else if (elm.tagName === "foreignObject") {
677
+ isSvgMode = true;
678
+ }
679
+ }
634
680
  }
635
681
  elm["s-hn"] = hostTagName;
636
682
  return elm;
@@ -763,8 +809,12 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
763
809
  const elm = newVNode2.$elm$ = oldVNode.$elm$;
764
810
  const oldChildren = oldVNode.$children$;
765
811
  const newChildren = newVNode2.$children$;
812
+ const tag = newVNode2.$tag$;
766
813
  const text = newVNode2.$text$;
767
814
  if (text === null) {
815
+ {
816
+ isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
817
+ }
768
818
  {
769
819
  updateElement(oldVNode, newVNode2, isSvgMode);
770
820
  }
@@ -780,6 +830,9 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
780
830
  !isInitialRender && BUILD.updatable && oldChildren !== null
781
831
  ) {
782
832
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
833
+ } else ;
834
+ if (isSvgMode && tag === "svg") {
835
+ isSvgMode = false;
783
836
  }
784
837
  } else if (oldVNode.$text$ !== text) {
785
838
  elm.data = text;
@@ -839,6 +892,12 @@ var scheduleUpdate = (hostRef, isInitialLoad) => {
839
892
  }
840
893
  attachToAncestor(hostRef, hostRef.$ancestorComponent$);
841
894
  const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
895
+ if (isInitialLoad) {
896
+ queueMicrotask(() => {
897
+ dispatch();
898
+ });
899
+ return;
900
+ }
842
901
  return writeTask(dispatch) ;
843
902
  };
844
903
  var dispatchHooks = (hostRef, isInitialLoad) => {
@@ -976,6 +1035,9 @@ var addHydratedFlag = (elm) => {
976
1035
  var getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
977
1036
  var setValue = (ref, propName, newVal, cmpMeta) => {
978
1037
  const hostRef = getHostRef(ref);
1038
+ if (!hostRef) {
1039
+ return;
1040
+ }
979
1041
  if (!hostRef) {
980
1042
  throw new Error(
981
1043
  `Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/stenciljs/core/issues/5457).`
@@ -984,7 +1046,9 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
984
1046
  const oldVal = hostRef.$instanceValues$.get(propName);
985
1047
  const flags = hostRef.$flags$;
986
1048
  const instance = hostRef.$lazyInstance$ ;
987
- newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1049
+ newVal = parsePropertyValue(
1050
+ newVal,
1051
+ cmpMeta.$members$[propName][0]);
988
1052
  const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
989
1053
  const didValueChange = newVal !== oldVal && !areBothNaN;
990
1054
  if ((!(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
@@ -1033,6 +1097,9 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1033
1097
  Object.defineProperty(prototype, memberName, {
1034
1098
  set(newValue) {
1035
1099
  const ref = getHostRef(this);
1100
+ if (!ref) {
1101
+ return;
1102
+ }
1036
1103
  if (origSetter) {
1037
1104
  const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
1038
1105
  if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
@@ -1040,7 +1107,11 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1040
1107
  } else if (!ref.$instanceValues$.get(memberName) && currentValue) {
1041
1108
  ref.$instanceValues$.set(memberName, currentValue);
1042
1109
  }
1043
- origSetter.apply(this, [parsePropertyValue(newValue, memberFlags)]);
1110
+ origSetter.apply(this, [
1111
+ parsePropertyValue(
1112
+ newValue,
1113
+ memberFlags)
1114
+ ]);
1044
1115
  newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
1045
1116
  setValue(this, memberName, newValue, cmpMeta);
1046
1117
  return;
@@ -1062,7 +1133,9 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1062
1133
  if (!ref.$instanceValues$.get(memberName) && currentValue) {
1063
1134
  ref.$instanceValues$.set(memberName, currentValue);
1064
1135
  }
1065
- ref.$lazyInstance$[memberName] = parsePropertyValue(newValue, memberFlags);
1136
+ ref.$lazyInstance$[memberName] = parsePropertyValue(
1137
+ newValue,
1138
+ memberFlags);
1066
1139
  setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
1067
1140
  };
1068
1141
  if (ref.$lazyInstance$) {
@@ -1101,7 +1174,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1101
1174
  } else if (propName == null) {
1102
1175
  const hostRef = getHostRef(this);
1103
1176
  const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
1104
- if (flags2 && !(flags2 & 8 /* isConstructingInstance */) && flags2 & 128 /* isWatchReady */ && newValue !== oldValue) {
1177
+ if (hostRef && flags2 && !(flags2 & 8 /* isConstructingInstance */) && flags2 & 128 /* isWatchReady */ && newValue !== oldValue) {
1105
1178
  const instance = hostRef.$lazyInstance$ ;
1106
1179
  const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
1107
1180
  entry == null ? void 0 : entry.forEach((callbackName) => {
@@ -1122,7 +1195,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1122
1195
  Cstr.observedAttributes = Array.from(
1123
1196
  /* @__PURE__ */ new Set([
1124
1197
  ...Object.keys((_b = cmpMeta.$watchers$) != null ? _b : {}),
1125
- ...members.filter(([_, m]) => m[0] & 15 /* HasAttribute */).map(([propName, m]) => {
1198
+ ...members.filter(([_, m]) => m[0] & 31 /* HasAttribute */).map(([propName, m]) => {
1126
1199
  const attrName = m[1] || propName;
1127
1200
  attrNameToPropName.set(attrName, propName);
1128
1201
  return attrName;
@@ -1206,6 +1279,9 @@ var fireConnectedCallback = (instance, elm) => {
1206
1279
  var connectedCallback = (elm) => {
1207
1280
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1208
1281
  const hostRef = getHostRef(elm);
1282
+ if (!hostRef) {
1283
+ return;
1284
+ }
1209
1285
  const cmpMeta = hostRef.$cmpMeta$;
1210
1286
  const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
1211
1287
  if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
@@ -1320,7 +1396,10 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1320
1396
  }
1321
1397
  }
1322
1398
  connectedCallback() {
1323
- getHostRef(this);
1399
+ const hostRef = getHostRef(this);
1400
+ if (!hostRef) {
1401
+ return;
1402
+ }
1324
1403
  if (!this.hasRegisteredEventListeners) {
1325
1404
  this.hasRegisteredEventListeners = true;
1326
1405
  }
@@ -1339,6 +1418,9 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1339
1418
  plt.raf(() => {
1340
1419
  var _a3;
1341
1420
  const hostRef = getHostRef(this);
1421
+ if (!hostRef) {
1422
+ return;
1423
+ }
1342
1424
  const i2 = deferredConnectedCallbacks.findIndex((host) => host === this);
1343
1425
  if (i2 > -1) {
1344
1426
  deferredConnectedCallbacks.splice(i2, 1);
@@ -1349,7 +1431,8 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1349
1431
  });
1350
1432
  }
1351
1433
  componentOnReady() {
1352
- return getHostRef(this).$onReadyPromise$;
1434
+ var _a3;
1435
+ return (_a3 = getHostRef(this)) == null ? void 0 : _a3.$onReadyPromise$;
1353
1436
  }
1354
1437
  };
1355
1438
  cmpMeta.$lazyBundleId$ = lazyBundle[0];
@@ -1395,11 +1478,10 @@ var setNonce = (nonce) => plt.$nonce$ = nonce;
1395
1478
  exports.bootstrapLazy = bootstrapLazy;
1396
1479
  exports.createEvent = createEvent;
1397
1480
  exports.getElement = getElement;
1398
- exports.globalScripts = globalScripts;
1399
1481
  exports.h = h;
1400
1482
  exports.promiseResolve = promiseResolve;
1401
1483
  exports.registerInstance = registerInstance;
1402
1484
  exports.setNonce = setNonce;
1403
- //# sourceMappingURL=index-BfhtOB0D.js.map
1485
+ //# sourceMappingURL=index-D6NBn_qu.js.map
1404
1486
 
1405
- //# sourceMappingURL=index-BfhtOB0D.js.map
1487
+ //# sourceMappingURL=index-D6NBn_qu.js.map