kritzel-stencil 0.3.33 → 0.3.35

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 (158) hide show
  1. package/dist/cjs/index-Xav9JFHg.js +2 -2
  2. package/dist/cjs/index.cjs.js +1 -1
  3. package/dist/cjs/{kritzel-active-users_45.cjs.entry.js → kritzel-active-users_46.cjs.entry.js} +3223 -76
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/{schema.constants-BHr5Bcqs.js → schema.constants-Di56GD6q.js} +16 -3
  6. package/dist/cjs/stencil.cjs.js +1 -1
  7. package/dist/collection/classes/objects/shape.class.js +14 -3
  8. package/dist/collection/collection-manifest.json +1 -0
  9. package/dist/collection/components/core/kritzel-editor/kritzel-editor.css +5 -0
  10. package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +26 -18
  11. package/dist/collection/components/core/kritzel-engine/kritzel-engine.css +0 -41
  12. package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +20 -2
  13. package/dist/collection/components/core/kritzel-watermark/kritzel-watermark.js +1 -1
  14. package/dist/collection/components/shared/kritzel-avatar/kritzel-avatar.js +3 -3
  15. package/dist/collection/components/shared/kritzel-button/kritzel-button.css +1 -0
  16. package/dist/collection/components/shared/kritzel-button/kritzel-button.js +2 -2
  17. package/dist/collection/components/shared/kritzel-color/kritzel-color.js +2 -2
  18. package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.js +1 -1
  19. package/dist/collection/components/shared/kritzel-font/kritzel-font.js +1 -1
  20. package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.js +1 -1
  21. package/dist/collection/components/shared/kritzel-input/kritzel-input.js +1 -1
  22. package/dist/collection/components/shared/kritzel-master-detail/kritzel-master-detail.js +3 -3
  23. package/dist/collection/components/shared/kritzel-menu/kritzel-menu.js +1 -1
  24. package/dist/collection/components/shared/kritzel-menu-item/kritzel-menu-item.js +2 -2
  25. package/dist/collection/components/shared/kritzel-numeric-input/kritzel-numeric-input.js +1 -1
  26. package/dist/collection/components/shared/kritzel-opacity-slider/kritzel-opacity-slider.js +1 -1
  27. package/dist/collection/components/shared/kritzel-pill-tabs/kritzel-pill-tabs.css +10 -0
  28. package/dist/collection/components/shared/kritzel-portal/kritzel-portal.js +1 -1
  29. package/dist/collection/components/shared/kritzel-slide-toggle/kritzel-slide-toggle.js +1 -1
  30. package/dist/collection/components/shared/kritzel-split-button/kritzel-split-button.js +1 -1
  31. package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.js +1 -1
  32. package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.js +2 -2
  33. package/dist/collection/components/ui/kritzel-back-to-content/kritzel-back-to-content.js +1 -1
  34. package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js +6 -6
  35. package/dist/collection/components/ui/kritzel-current-user/kritzel-current-user.js +1 -8
  36. package/dist/collection/components/ui/kritzel-current-user-dialog/kritzel-current-user-dialog.css +10 -0
  37. package/dist/collection/components/ui/kritzel-current-user-dialog/kritzel-current-user-dialog.js +25 -1
  38. package/dist/collection/components/ui/kritzel-export/kritzel-export.js +1 -1
  39. package/dist/collection/components/ui/kritzel-loading-overlay/kritzel-loading-overlay.css +50 -0
  40. package/dist/collection/components/ui/kritzel-loading-overlay/kritzel-loading-overlay.js +70 -0
  41. package/dist/collection/components/ui/kritzel-login-dialog/kritzel-login-dialog.js +1 -1
  42. package/dist/collection/components/ui/kritzel-more-menu/kritzel-more-menu.js +1 -1
  43. package/dist/collection/components/ui/kritzel-settings/kritzel-settings.js +1 -1
  44. package/dist/collection/components/ui/kritzel-share-dialog/kritzel-share-dialog.css +17 -0
  45. package/dist/collection/components/ui/kritzel-share-dialog/kritzel-share-dialog.js +44 -3
  46. package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.js +1 -1
  47. package/dist/collection/components/ui/kritzel-zoom-panel/kritzel-zoom-panel.js +1 -1
  48. package/dist/collection/constants/version.js +1 -1
  49. package/dist/collection/themes/dark-theme.js +1 -0
  50. package/dist/collection/themes/light-theme.js +1 -0
  51. package/dist/components/index.d.ts +2 -0
  52. package/dist/components/index.js +1 -1
  53. package/dist/components/kritzel-active-users.js +1 -1
  54. package/dist/components/kritzel-avatar.js +1 -1
  55. package/dist/components/kritzel-awareness-cursors.js +1 -1
  56. package/dist/components/kritzel-back-to-content.js +1 -1
  57. package/dist/components/kritzel-button.js +1 -1
  58. package/dist/components/kritzel-color-palette.js +1 -1
  59. package/dist/components/kritzel-color.js +1 -1
  60. package/dist/components/kritzel-controls.js +1 -1
  61. package/dist/components/kritzel-current-user-dialog.js +1 -1
  62. package/dist/components/kritzel-current-user.js +1 -1
  63. package/dist/components/kritzel-editor.js +1 -1
  64. package/dist/components/kritzel-engine.js +1 -1
  65. package/dist/components/kritzel-export.js +1 -1
  66. package/dist/components/kritzel-font-size.js +1 -1
  67. package/dist/components/kritzel-font.js +1 -1
  68. package/dist/components/kritzel-input.js +1 -1
  69. package/dist/components/kritzel-loading-overlay.d.ts +11 -0
  70. package/dist/components/kritzel-loading-overlay.js +1 -0
  71. package/dist/components/kritzel-login-dialog.js +1 -1
  72. package/dist/components/kritzel-master-detail.js +1 -1
  73. package/dist/components/kritzel-menu-item.js +1 -1
  74. package/dist/components/kritzel-menu.js +1 -1
  75. package/dist/components/kritzel-more-menu.js +1 -1
  76. package/dist/components/kritzel-numeric-input.js +1 -1
  77. package/dist/components/kritzel-opacity-slider.js +1 -1
  78. package/dist/components/kritzel-pill-tabs.js +1 -1
  79. package/dist/components/kritzel-portal.js +1 -1
  80. package/dist/components/kritzel-settings.js +1 -1
  81. package/dist/components/kritzel-share-dialog.js +1 -1
  82. package/dist/components/kritzel-slide-toggle.js +1 -1
  83. package/dist/components/kritzel-split-button.js +1 -1
  84. package/dist/components/kritzel-stroke-size.js +1 -1
  85. package/dist/components/kritzel-tool-config.js +1 -1
  86. package/dist/components/kritzel-tooltip.js +1 -1
  87. package/dist/components/kritzel-utility-panel.js +1 -1
  88. package/dist/components/kritzel-watermark.js +1 -1
  89. package/dist/components/kritzel-workspace-manager.js +1 -1
  90. package/dist/components/kritzel-zoom-panel.js +1 -1
  91. package/dist/components/{p-CO0eEzos.js → p-1nG2hxfJ.js} +1 -1
  92. package/dist/components/{p-DfIknZRl.js → p-2Swq9rEm.js} +1 -1
  93. package/dist/components/{p-Cb5YwXbC.js → p-8xkoVMfO.js} +1 -1
  94. package/dist/components/p-BFTU3MAI.js +1 -0
  95. package/dist/components/{p-14NPx-_P.js → p-BH4AasB1.js} +1 -1
  96. package/dist/components/{p-Dl3MwBL1.js → p-BJlf4iHH.js} +1 -1
  97. package/dist/components/{p-BntMEYss.js → p-BKOsmXB5.js} +1 -1
  98. package/dist/components/{p-DSd5xTAH.js → p-BLOPBDUF.js} +1 -1
  99. package/dist/components/p-B_6RNask.js +1 -0
  100. package/dist/components/{p-NwN6r0N0.js → p-Bd_yPNfg.js} +1 -1
  101. package/dist/components/{p-COhjyuRa.js → p-BlozPPKi.js} +1 -1
  102. package/dist/components/{p-C1jg5IQi.js → p-Bm_BWQa4.js} +1 -1
  103. package/dist/components/p-BmyTdQGy.js +1 -0
  104. package/dist/components/{p-BmX2Vb4Z.js → p-BoA6RXEA.js} +1 -1
  105. package/dist/components/{p-BixEMVtW.js → p-BulDbBWB.js} +1 -1
  106. package/dist/components/{p-D0RYktBV.js → p-BzJEwFtn.js} +1 -1
  107. package/dist/components/{p-CdkNxxut.js → p-BzrxIesp.js} +1 -1
  108. package/dist/components/{p-vf28uSsc.js → p-CMphprF1.js} +1 -1
  109. package/dist/components/{p-D0v9WP5w.js → p-CVhcOiEA.js} +1 -1
  110. package/dist/components/{p-CC0J_kEP.js → p-CwuGA058.js} +1 -1
  111. package/dist/components/p-D09kgc5Q.js +1 -0
  112. package/dist/components/p-D52oKO_e.js +1 -0
  113. package/dist/components/{p-M9m9-OEY.js → p-D8TOEhPY.js} +1 -1
  114. package/dist/components/p-D9BugXUi.js +9 -0
  115. package/dist/components/p-DEqpY4K2.js +1 -0
  116. package/dist/components/{p-BrAeYciD.js → p-DIMNEOTW.js} +1 -1
  117. package/dist/components/{p-DeqALrzV.js → p-DMAScsJF.js} +1 -1
  118. package/dist/components/{p-y5T0_Wvi.js → p-DPpPd5GI.js} +1 -1
  119. package/dist/components/{p-Bg0xIZiR.js → p-DSOc0eIT.js} +1 -1
  120. package/dist/components/{p-W1ZwImdd.js → p-DXcjIb_a.js} +1 -1
  121. package/dist/components/{p-DPlEzPKO.js → p-DZcwchEg.js} +1 -1
  122. package/dist/components/{p-BX-nQAyH.js → p-DgnK50xO.js} +1 -1
  123. package/dist/components/p-Di5dpXrF.js +1 -0
  124. package/dist/components/{p-CZQz_mul.js → p-Ds-P2bYH.js} +1 -1
  125. package/dist/components/{p-meY80XnF.js → p-jzuGPW5o.js} +1 -1
  126. package/dist/components/p-oGAPPwAL.js +1 -0
  127. package/dist/components/{p-BEucPbiz.js → p-sLHApVnR.js} +1 -1
  128. package/dist/components/{p-DEpnJBA3.js → p-yD_3Z3K1.js} +1 -1
  129. package/dist/components/{p-C4-Som48.js → p-zd7zXld8.js} +1 -1
  130. package/dist/esm/index-Dhio9uis.js +2 -2
  131. package/dist/esm/index.js +2 -2
  132. package/dist/esm/{kritzel-active-users_45.entry.js → kritzel-active-users_46.entry.js} +3223 -77
  133. package/dist/esm/loader.js +1 -1
  134. package/dist/esm/{schema.constants-3oYjlURq.js → schema.constants-Cphx5M7a.js} +16 -3
  135. package/dist/esm/stencil.js +1 -1
  136. package/dist/stencil/index.esm.js +1 -1
  137. package/dist/stencil/p-Cphx5M7a.js +1 -0
  138. package/dist/stencil/p-ac77b486.entry.js +9 -0
  139. package/dist/stencil/stencil.esm.js +1 -1
  140. package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +5 -0
  141. package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +2 -0
  142. package/dist/types/components/ui/kritzel-current-user/kritzel-current-user.d.ts +0 -3
  143. package/dist/types/components/ui/kritzel-current-user-dialog/kritzel-current-user-dialog.d.ts +4 -0
  144. package/dist/types/components/ui/kritzel-loading-overlay/kritzel-loading-overlay.d.ts +11 -0
  145. package/dist/types/components/ui/kritzel-share-dialog/kritzel-share-dialog.d.ts +4 -0
  146. package/dist/types/components.d.ts +61 -0
  147. package/dist/types/constants/version.d.ts +1 -1
  148. package/dist/types/interfaces/theme.interface.d.ts +8 -0
  149. package/package.json +6 -4
  150. package/dist/components/p-BG6hOSrm.js +0 -1
  151. package/dist/components/p-COdwK_mi.js +0 -1
  152. package/dist/components/p-CQZYGZzF.js +0 -9
  153. package/dist/components/p-Ckpa5tHF.js +0 -1
  154. package/dist/components/p-CpzicliK.js +0 -1
  155. package/dist/components/p-XDNjFYRB.js +0 -1
  156. package/dist/components/p-X_pyPCe8.js +0 -1
  157. package/dist/stencil/p-3oYjlURq.js +0 -1
  158. package/dist/stencil/p-767b5a14.entry.js +0 -9
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-Xav9JFHg.js');
4
- var schema_constants = require('./schema.constants-BHr5Bcqs.js');
4
+ var schema_constants = require('./schema.constants-Di56GD6q.js');
5
5
  var Y = require('yjs');
6
6
  require('y-indexeddb');
7
7
  require('y-websocket');
@@ -28,6 +28,10 @@ var Y__namespace = /*#__PURE__*/_interopNamespace(Y);
28
28
 
29
29
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
30
30
 
31
+ function getDefaultExportFromCjs (x) {
32
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
33
+ }
34
+
31
35
  const kritzelActiveUsersCss = () => `:host{display:inline-flex;align-items:center}.avatars{display:flex;align-items:center}.avatar-wrapper{position:relative;transition:margin-left 200ms ease}.avatar-wrapper kritzel-avatar{border-radius:50%;box-shadow:0 0 0 2px var(--kritzel-active-users-avatar-border-color, #ffffff)}.avatars:hover .avatar-wrapper{margin-left:-6px !important}.avatar-tooltip{position:absolute;top:100%;left:50%;transform:translateX(-50%);margin-top:12px;padding:4px 8px;background-color:var(--kritzel-active-users-tooltip-background, #333333);color:var(--kritzel-active-users-tooltip-color, #ffffff);font-family:sans-serif;font-size:12px;font-weight:500;border-radius:4px;white-space:nowrap;width:max-content;pointer-events:none;opacity:0;transition:opacity 150ms ease}.avatar-wrapper:hover .avatar-tooltip,.overflow-count:hover .avatar-tooltip{opacity:1}.overflow-count{position:relative;margin-left:8px;font-family:sans-serif;font-size:var(--kritzel-active-users-overflow-font-size, 14px);font-weight:500;color:var(--kritzel-active-users-overflow-color, #666666);white-space:nowrap;cursor:default}.overflow-count .avatar-tooltip{white-space:nowrap;text-align:left;margin-top:20px}`;
32
36
 
33
37
  const KritzelActiveUsers = class {
@@ -154,16 +158,16 @@ const KritzelAvatar = class {
154
158
  height: `${this.size}px`,
155
159
  fontSize: `${Math.round(this.size * 0.4)}px`,
156
160
  };
157
- return (index.h(index.Host, { key: '4bdbe2c1d5d3a1708189166498ae4e36c19c46ff', style: containerStyles, class: {
161
+ return (index.h(index.Host, { key: '116725d55e4443e80216b3b3251e957d2009b43e', style: containerStyles, class: {
158
162
  'has-image': !!showImage,
159
163
  'has-initials': !!showInitials,
160
164
  'has-default': !!showDefaultIcon,
161
- }, role: "img", "aria-label": this.getDisplayName() || 'User avatar' }, showImage && (index.h("img", { key: '55c3a13c9d514ea700c6b1a9339cd0dff1828b2b', src: imageUrl, alt: "", class: "avatar-image", ref: (el) => {
165
+ }, role: "img", "aria-label": this.getDisplayName() || 'User avatar' }, showImage && (index.h("img", { key: 'd70ad4eb484404b18c13e066e8c10b3c86918ee5', src: imageUrl, alt: "", class: "avatar-image", ref: (el) => {
162
166
  if (el) {
163
167
  el.referrerPolicy = 'no-referrer';
164
168
  el.crossOrigin = 'anonymous';
165
169
  }
166
- }, onError: this.handleImageError })), showInitials && (index.h("span", { key: 'b60cbe2b94ea1d2cd2a09d10c928290fc1469a4a', class: "avatar-initials", style: { backgroundColor: this.getBackgroundColor() } }, initials)), showDefaultIcon && (index.h("span", { key: 'e8a0f49952b5b7e5e4a1fe3d67e68a56081d5e4c', class: "avatar-default" }, index.h("svg", { key: '1fdc256fd53aa5c866bb0e81fdd40393c8a7d69d', viewBox: "0 0 24 24", fill: "currentColor" }, index.h("path", { key: '8f3a5a6775154e46a2f331534fe75671b9ad081a', d: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" }))))));
170
+ }, onError: this.handleImageError })), showInitials && (index.h("span", { key: '21a9022cffdb69e0c3626e513cb3c036a9d3a16d', class: "avatar-initials", style: { backgroundColor: this.getBackgroundColor() } }, initials)), showDefaultIcon && (index.h("span", { key: '43e676af007bf254b1921f3efcbc7fff4e204359', class: "avatar-default" }, index.h("svg", { key: 'a7378795539a902e28ca644a80f1ca00cc9f818a', viewBox: "0 0 24 24", fill: "currentColor" }, index.h("path", { key: '31548a495a86f033325c98cfcc0ae398b6bb8281', d: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" }))))));
167
171
  }
168
172
  static get watchers() { return {
169
173
  "user": [{
@@ -473,12 +477,12 @@ const KritzelBackToContent = class {
473
477
  this.backToContent.emit();
474
478
  };
475
479
  render() {
476
- return (index.h(index.Host, { key: 'a7d52616642f45a0c0e7b76deb3cc5994184b968' }, index.h("button", { key: '9e7acae2b62f7f66ee0127545ee8ab115f9d340e', class: { 'back-to-content-button': true, visible: this.visible }, onClick: this.handleClick, "aria-label": this.text }, index.h("kritzel-icon", { key: '6c404376643554cdb86c33957c066dd4580f19f1', name: "chevrons-left" }))));
480
+ return (index.h(index.Host, { key: 'ab9e9297f5f26bcf79ec32e51ee0ff2524ad421f' }, index.h("button", { key: 'c32536edc9943bc9ad66f4fa727338bb01e148a6', class: { 'back-to-content-button': true, visible: this.visible }, onClick: this.handleClick, "aria-label": this.text }, index.h("kritzel-icon", { key: 'bd3aa6ffe524ad9093d1e0693574dc2d63c311bd', name: "chevrons-left" }))));
477
481
  }
478
482
  };
479
483
  KritzelBackToContent.style = kritzelBackToContentCss();
480
484
 
481
- const kritzelButtonCss = () => `:host{display:inline-block;font-family:sans-serif}button{border:none;background-color:transparent;padding:0;margin:0;font-family:inherit;font-size:inherit;-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:var(--kritzel-global-pointer-cursor, pointer);display:inline-flex;align-items:center;justify-content:center;gap:6px;border-radius:var(--kritzel-button-border-radius, 8px);padding:var(--kritzel-button-padding, 12px 20px);font-size:var(--kritzel-button-font-size, 14px);font-weight:var(--kritzel-button-font-weight, 500);transition:background-color 0.15s ease, opacity 0.15s ease;-webkit-tap-highlight-color:transparent}button.primary{background-color:var(--kritzel-button-primary-background-color, #007AFF);color:var(--kritzel-button-primary-color, #ffffff)}button.primary:hover{background-color:var(--kritzel-button-primary-hover-background-color, #006ae6)}button.primary:active{background-color:var(--kritzel-button-primary-active-background-color, #005bbf)}button.secondary{background-color:var(--kritzel-button-secondary-background-color, #f0f0f0);color:var(--kritzel-button-secondary-color, #333333)}button.secondary:hover{background-color:var(--kritzel-button-secondary-hover-background-color, #e0e0e0)}button.secondary:active{background-color:var(--kritzel-button-secondary-active-background-color, #d0d0d0)}button.text{background-color:transparent;color:var(--kritzel-button-text-color, #007AFF)}button.text:hover{background-color:var(--kritzel-button-text-hover-background-color, rgba(0, 122, 255, 0.08))}button.text:active{background-color:var(--kritzel-button-text-active-background-color, rgba(0, 122, 255, 0.15))}button.disabled{opacity:0.4;cursor:not-allowed;pointer-events:none}`;
485
+ const kritzelButtonCss = () => `:host{display:inline-block;font-family:sans-serif}button{border:none;background-color:transparent;padding:0;margin:0;font-family:inherit;font-size:inherit;-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:var(--kritzel-global-pointer-cursor, pointer);display:inline-flex;width:var(--kritzel-button-width, auto);align-items:center;justify-content:center;gap:6px;border-radius:var(--kritzel-button-border-radius, 8px);padding:var(--kritzel-button-padding, 12px 20px);font-size:var(--kritzel-button-font-size, 14px);font-weight:var(--kritzel-button-font-weight, 500);transition:background-color 0.15s ease, opacity 0.15s ease;-webkit-tap-highlight-color:transparent}button.primary{background-color:var(--kritzel-button-primary-background-color, #007AFF);color:var(--kritzel-button-primary-color, #ffffff)}button.primary:hover{background-color:var(--kritzel-button-primary-hover-background-color, #006ae6)}button.primary:active{background-color:var(--kritzel-button-primary-active-background-color, #005bbf)}button.secondary{background-color:var(--kritzel-button-secondary-background-color, #f0f0f0);color:var(--kritzel-button-secondary-color, #333333)}button.secondary:hover{background-color:var(--kritzel-button-secondary-hover-background-color, #e0e0e0)}button.secondary:active{background-color:var(--kritzel-button-secondary-active-background-color, #d0d0d0)}button.text{background-color:transparent;color:var(--kritzel-button-text-color, #007AFF)}button.text:hover{background-color:var(--kritzel-button-text-hover-background-color, rgba(0, 122, 255, 0.08))}button.text:active{background-color:var(--kritzel-button-text-active-background-color, rgba(0, 122, 255, 0.15))}button.disabled{opacity:0.4;cursor:not-allowed;pointer-events:none}`;
482
486
 
483
487
  const KritzelButton = class {
484
488
  constructor(hostRef) {
@@ -500,11 +504,11 @@ const KritzelButton = class {
500
504
  this.buttonClick.emit();
501
505
  };
502
506
  render() {
503
- return (index.h(index.Host, { key: '0de2b5dcf75de9f5b7de0c6b876bd18733bf21b9' }, index.h("button", { key: '5ab9d80167c6b90add7779d4b1c3ebb80fafaed5', type: this.type, class: {
507
+ return (index.h(index.Host, { key: 'b9de2a1261ca0cb491f6980db6a596c48fa45b3a' }, index.h("button", { key: 'a9507ea0f6a1d9fcb19a7df16bea54cc0ead24f9', type: this.type, class: {
504
508
  'kritzel-button': true,
505
509
  [this.variant]: true,
506
510
  'disabled': this.disabled,
507
- }, disabled: this.disabled, onClick: this.handleClick }, index.h("slot", { key: 'dc105f7d1f87aa55c314d942a1cc6522b272526a' }))));
511
+ }, disabled: this.disabled, onClick: this.handleClick }, index.h("slot", { key: '8449a26d4f9fe0226c6150a6639c522486b59780' }))));
508
512
  }
509
513
  };
510
514
  KritzelButton.style = kritzelButtonCss();
@@ -552,13 +556,13 @@ const KritzelColorComponent = class {
552
556
  render() {
553
557
  const resolvedColor = this.resolveColor();
554
558
  const isColorVeryLight = this.isLightColor(resolvedColor);
555
- return (index.h(index.Host, { key: '0d56c7ad01eddd523ebcf11a32e68367c96090bd' }, index.h("div", { key: '0bef4cb73804b98e6eea6b3cf006c19c8786bdb9', class: "checkerboard-bg", style: {
559
+ return (index.h(index.Host, { key: 'e39c77c55942b9c615e404efabf4939b2cf05a34' }, index.h("div", { key: 'ac343295592ea80ca7d3da61ca1244dd1aaa50db', class: "checkerboard-bg", style: {
556
560
  width: `${this.size}px`,
557
561
  height: `${this.size}px`,
558
562
  borderRadius: '50%',
559
563
  display: 'inline-block',
560
564
  position: 'relative',
561
- } }, index.h("div", { key: '5be9714c3ddd56ae77c2870333ff97a59b58bd45', class: {
565
+ } }, index.h("div", { key: '4c87934b3febd4c41874cd290d86a9a9a557e3e5', class: {
562
566
  'color-circle': true,
563
567
  'white': isColorVeryLight,
564
568
  }, style: {
@@ -614,7 +618,7 @@ const KritzelColorPalette = class {
614
618
  render() {
615
619
  const displayedColors = this.isExpanded ? this.colors : this.colors.slice(0, 6);
616
620
  const expandedHeight = this.isExpanded ? this.calculateHeight() : '32px';
617
- return (index.h(index.Host, { key: '6d003ec5b92f586532782144c25ca5a733741f20' }, index.h("div", { key: '031838b45da4916aa91d87c066ac950cfe3a1ddc', class: {
621
+ return (index.h(index.Host, { key: '16aa405a43b3943473e577c5a6ab86adf4ae1ba9' }, index.h("div", { key: 'f65bb286889700dc1f0e8d84ff59721071b7b73a', class: {
618
622
  'color-grid': true,
619
623
  'expanded': this.isExpanded,
620
624
  }, style: {
@@ -1182,13 +1186,13 @@ const KritzelControls = class {
1182
1186
  // Separate tool controls from config control
1183
1187
  const toolControls = this.internalControls.filter(c => c.type === 'tool' || c.type === 'separator');
1184
1188
  const configControl = this.internalControls.find(c => c.type === 'config' && c.name === this.firstConfig?.name);
1185
- return (index.h(index.Host, { key: '266e38cdeffb8c22a7f778e865e5fab6b461f5b6', style: { display: this.visible ? '' : 'none' }, class: {
1189
+ return (index.h(index.Host, { key: 'f66fd3057bd88d31d7d585f2c286feb7e33c3611', style: { display: this.visible ? '' : 'none' }, class: {
1186
1190
  mobile: this.isTouchDevice,
1187
- } }, this.isUtilityPanelVisible && (index.h("kritzel-utility-panel", { key: '5e75ece000ac02675d3d226461b7f522dcf5ead9', style: {
1191
+ } }, this.isUtilityPanelVisible && (index.h("kritzel-utility-panel", { key: '4841cd070407422f0081dd528566d3943d2db7cd', style: {
1188
1192
  position: 'absolute',
1189
1193
  bottom: '56px',
1190
1194
  left: '12px',
1191
- }, undoState: this.undoState, terms: this.terms, onUndo: () => this.kritzelEngine?.undo(), onRedo: () => this.kritzelEngine?.redo(), onDelete: () => this.kritzelEngine?.delete() })), index.h("div", { key: 'fc98b1675afe1abb6a8d391c4ace34c7f0e46677', class: "kritzel-controls" }, index.h("div", { key: 'b17bc9e9a65646735c56f78a326a281229fa9790', class: { 'scroll-indicator-left': true, 'visible': this.canScrollLeft } }), index.h("div", { key: '9ab9d5c44e515551d75f27c31875de72e9d3407c', class: "kritzel-tools-scroll", ref: el => (this.toolsScrollRef = el), onScroll: this.handleToolsScroll }, toolControls.map(control => {
1195
+ }, undoState: this.undoState, terms: this.terms, onUndo: () => this.kritzelEngine?.undo(), onRedo: () => this.kritzelEngine?.redo(), onDelete: () => this.kritzelEngine?.delete() })), index.h("div", { key: '54fb1da3f8b070c4c75e27930c95ca06f46f48f1', class: "kritzel-controls" }, index.h("div", { key: '9ce27b621a8fb668716f1eb15f3b01302e476d86', class: { 'scroll-indicator-left': true, 'visible': this.canScrollLeft } }), index.h("div", { key: 'eb9f499b5139c481b5748b09ecf21cd414918a11', class: "kritzel-tools-scroll", ref: el => (this.toolsScrollRef = el), onScroll: this.handleToolsScroll }, toolControls.map(control => {
1192
1196
  // Check if this control has sub-options (split-button)
1193
1197
  if (control.subOptions?.length) {
1194
1198
  const selectedSubOption = this.getSelectedSubOption(control);
@@ -1218,10 +1222,10 @@ const KritzelControls = class {
1218
1222
  'kritzel-control': true,
1219
1223
  'selected': this.activeControl?.name === control?.name,
1220
1224
  }, key: control.name, "data-testid": `tool-${control.name}`, onClick: _event => this.handleControlClick?.(control), "aria-label": control.name.charAt(0).toUpperCase() + control.name.slice(1) }, index.h("kritzel-icon", { name: control.icon })));
1221
- })), index.h("div", { key: 'fad7512f5d1aa68905a56b8f22d498380f166f9f', class: { 'scroll-indicator-right': true, 'visible': this.canScrollRight && !(configControl && this.activeControl && hasConfigUI) } }), configControl && this.activeControl && (index.h("div", { class: {
1225
+ })), index.h("div", { key: 'c990abf4ff2970e6519c605135f3fbded691e91a', class: { 'scroll-indicator-right': true, 'visible': this.canScrollRight && !(configControl && this.activeControl && hasConfigUI) } }), configControl && this.activeControl && (index.h("div", { class: {
1222
1226
  'kritzel-config-container': true,
1223
1227
  'visible': hasConfigUI,
1224
- }, key: configControl.name }, index.h("div", { key: '2ff7cb3ad18608102f3d8188b5936cf00b00451f', class: { 'config-gradient-left': true, 'visible': this.needsScrolling } }), index.h("kritzel-tooltip", { key: '10f15f717c8573cbad6ea53b412ad56254099ad1', anchorElement: this.host.shadowRoot?.querySelector('.kritzel-config-container'), triggerElement: this.configTriggerRef }, index.h("kritzel-tool-config", { key: 'a1b0ed8ecc2696a591e32add642a3d5cb2bf7f4a', tool: this.activeControl.tool, theme: this.theme, engine: this.kritzelEngine, terms: this.terms, onToolChange: event => this.handleToolChange?.(event), onDisplayValuesChange: this.handleDisplayValuesChange, style: { width: '100%', height: '100%' } })), index.h("div", { key: '7ac8214a3dbad5323a38cad3ff7324b57f9dbfb5', tabIndex: hasConfigUI ? 0 : -1, class: "kritzel-config", "data-testid": "tool-config", ref: el => {
1228
+ }, key: configControl.name }, index.h("div", { key: '1c163b818eed3a76bda9e802b083d2bfe8431c87', class: { 'config-gradient-left': true, 'visible': this.needsScrolling } }), index.h("kritzel-tooltip", { key: 'f7252d9aa17bdde580ca31cd558ba93d99822937', anchorElement: this.host.shadowRoot?.querySelector('.kritzel-config-container'), triggerElement: this.configTriggerRef }, index.h("kritzel-tool-config", { key: 'a15a873d8740d5c45a657bb4677a514fe9e183de', tool: this.activeControl.tool, theme: this.theme, engine: this.kritzelEngine, terms: this.terms, onToolChange: event => this.handleToolChange?.(event), onDisplayValuesChange: this.handleDisplayValuesChange, style: { width: '100%', height: '100%' } })), index.h("div", { key: 'ffbf1e35387ee732c6877f8425dbe07234d8233f', tabIndex: hasConfigUI ? 0 : -1, class: "kritzel-config", "data-testid": "tool-config", ref: el => {
1225
1229
  if (el)
1226
1230
  this.configTriggerRef = el;
1227
1231
  }, onKeyDown: event => {
@@ -1230,7 +1234,7 @@ const KritzelControls = class {
1230
1234
  }
1231
1235
  }, style: {
1232
1236
  cursor: 'pointer',
1233
- } }, this.displayValues && (index.h("div", { key: '7e64f79859f7f2b03d72bb7a93fb295e7d2b2ac0', class: "color-container" }, index.h("kritzel-color", { key: 'b87d9861949379d84954ef1ecb554e13317b3287', value: this.displayValues.color, theme: this.theme, size: 18, style: {
1237
+ } }, this.displayValues && (index.h("div", { key: 'eb272119da9354eb069231c3d29a196c5b0e4aa2', class: "color-container" }, index.h("kritzel-color", { key: '465b3af943d740b83bd260ee493840edd235a9af', value: this.displayValues.color, theme: this.theme, size: 18, style: {
1234
1238
  borderRadius: '50%',
1235
1239
  border: 'none',
1236
1240
  } })))))))));
@@ -1253,7 +1257,6 @@ const KritzelCurrentUser = class {
1253
1257
  constructor(hostRef) {
1254
1258
  index.registerInstance(this, hostRef);
1255
1259
  }
1256
- get host() { return index.getElement(this); }
1257
1260
  /**
1258
1261
  * The current user to display
1259
1262
  */
@@ -1264,28 +1267,26 @@ const KritzelCurrentUser = class {
1264
1267
  avatarSize = 40;
1265
1268
  /** Resolved localized strings keyed by term key, supplied by the editor. */
1266
1269
  terms = {};
1267
- dialogRef;
1268
- handleAvatarClick = (event) => {
1269
- event.stopPropagation();
1270
- this.dialogRef?.open();
1271
- };
1272
1270
  render() {
1273
- return (index.h(index.Host, { key: 'bdee6b71c08d6ea22aec40e88ba56077882b301d' }, index.h("kritzel-avatar", { key: '97bcaaa6b683c0d26d547ac5cbd9df7814f0cd80', user: this.user, size: this.avatarSize, onClick: this.handleAvatarClick }), index.h("kritzel-current-user-dialog", { key: 'c984ea1803bcf2b06569fd66d12e4e7054235225', ref: el => (this.dialogRef = el), user: this.user, terms: this.terms })));
1271
+ return (index.h(index.Host, { key: 'e9746bbb98dbdae8f73ac7129bc1eb772746c576' }, index.h("kritzel-avatar", { key: '04f493ba649484cd95607c54b77e27134baa3122', user: this.user, size: this.avatarSize })));
1274
1272
  }
1275
1273
  };
1276
1274
  KritzelCurrentUser.style = kritzelCurrentUserCss();
1277
1275
 
1278
- const kritzelCurrentUserDialogCss = () => `:host{display:contents}kritzel-dialog{--kritzel-dialog-width-small:380px}.user-info{display:flex;flex-direction:column;align-items:center;gap:8px;padding:8px 0}.user-name{font-size:18px;font-weight:600;color:var(--kritzel-current-user-dialog-name-color, #333333);text-align:center;margin-top:8px}.user-email{font-size:14px;color:var(--kritzel-current-user-dialog-email-color, #666666);text-align:center}`;
1276
+ const kritzelCurrentUserDialogCss = () => `:host{display:contents}kritzel-dialog{--kritzel-dialog-width-small:380px}.user-info{display:flex;flex-direction:column;align-items:center;gap:8px;padding:8px 0}.user-name{font-size:18px;font-weight:600;color:var(--kritzel-current-user-dialog-name-color, #333333);text-align:center;margin-top:8px}.user-email{font-size:14px;color:var(--kritzel-current-user-dialog-email-color, #666666);text-align:center}.logout-button{margin-top:16px;width:100%;--kritzel-button-width:100%;--kritzel-button-primary-background-color:var(--kritzel-current-user-dialog-logout-button-background-color, #007AFF);--kritzel-button-primary-hover-background-color:var(--kritzel-current-user-dialog-logout-button-hover-background-color, #006ae6);--kritzel-button-primary-active-background-color:var(--kritzel-current-user-dialog-logout-button-active-background-color, #005bbf);--kritzel-button-primary-color:var(--kritzel-current-user-dialog-logout-button-color, #ffffff)}`;
1279
1277
 
1280
1278
  const KritzelCurrentUserDialog = class {
1281
1279
  constructor(hostRef) {
1282
1280
  index.registerInstance(this, hostRef);
1281
+ this.logoutRequest = index.createEvent(this, "logoutRequest");
1283
1282
  }
1284
1283
  get host() { return index.getElement(this); }
1285
1284
  user;
1286
1285
  /** Resolved localized strings keyed by term key, supplied by the editor. */
1287
1286
  terms = {};
1288
1287
  isDialogOpen = false;
1288
+ /** Emitted when the user clicks the logout action. */
1289
+ logoutRequest;
1289
1290
  async open() {
1290
1291
  this.isDialogOpen = true;
1291
1292
  }
@@ -1295,6 +1296,10 @@ const KritzelCurrentUserDialog = class {
1295
1296
  closeDialog = () => {
1296
1297
  this.isDialogOpen = false;
1297
1298
  };
1299
+ handleLogout = () => {
1300
+ this.logoutRequest.emit();
1301
+ this.closeDialog();
1302
+ };
1298
1303
  getDisplayName() {
1299
1304
  if (!this.user)
1300
1305
  return undefined;
@@ -1304,7 +1309,7 @@ const KritzelCurrentUserDialog = class {
1304
1309
  }
1305
1310
  render() {
1306
1311
  const displayName = this.getDisplayName();
1307
- return (index.h(index.Host, { key: '042455d68a432e0e218d5b8750fb1d22b0d202fc' }, index.h("kritzel-dialog", { key: '058abbc8e1c38c647cc02e85c272e89693cab22a', dialogTitle: this.terms['currentUser.dialogTitle'] ?? 'Account', isOpen: this.isDialogOpen, onDialogClose: this.closeDialog, size: "small", contained: true }, index.h("div", { key: 'ee141b2e91f093527e2d8f6649bade8e1a14f130', class: "user-info" }, index.h("kritzel-avatar", { key: '2734bb0d3c69df14d26c204eeaf726174afaabc0', user: this.user, size: 80 }), displayName && index.h("div", { key: '56cbad7a51264ebada0cb029e6455aabb9cb4ae9', class: "user-name" }, displayName), this.user?.email && index.h("div", { key: 'ef9075dfdeb52ce6f90bb41d1348fbdf7dbb93ee', class: "user-email" }, this.user.email)))));
1312
+ return (index.h(index.Host, { key: '6eb573d072c5c0b47de4a88538a507adf49bd9b4' }, index.h("kritzel-dialog", { key: '9e85ed790f146ac408023759b1fe87e60bc80282', dialogTitle: this.terms['currentUser.dialogTitle'] ?? 'Account', isOpen: this.isDialogOpen, onDialogClose: this.closeDialog, size: "small", contained: true }, index.h("div", { key: '33a55e6023ad6f63514085d57b7278d4733bd411', class: "user-info" }, index.h("kritzel-avatar", { key: '4580f83fc6c5bcf8a1ffcd0d635da233817233d3', user: this.user, size: 80 }), displayName && index.h("div", { key: '5e2b98005e9b4ab7cc3db2dc81f4180e8ba3abea', class: "user-name" }, displayName), this.user?.email && index.h("div", { key: '1041266c4a4525d2f08c60d59bec5a518de2184b', class: "user-email" }, this.user.email), index.h("kritzel-button", { key: 'b695c05d24ab9d4d252a45ec496d75d79583ed4d', class: "logout-button", variant: "primary", onButtonClick: this.handleLogout }, this.terms['menu.logout'] ?? 'Logout')))));
1308
1313
  }
1309
1314
  };
1310
1315
  KritzelCurrentUserDialog.style = kritzelCurrentUserDialogCss();
@@ -2128,7 +2133,7 @@ const DEFAULT_SYNC_CONFIG = {
2128
2133
  providers: [],
2129
2134
  };
2130
2135
 
2131
- const kritzelEditorCss = () => `kritzel-editor{display:flex;margin:0;position:relative;container-type:inline-size;overflow:hidden;width:100%;height:100%;align-items:center;justify-content:center;touch-action:manipulation;user-select:none;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;text-align:start;line-height:normal}kritzel-controls{position:absolute;left:0;right:0;margin-inline:auto;width:max-content;max-width:calc(100% - 16px);bottom:var(--kritzel-editor-controls-bottom, 14px);transition:transform var(--kritzel-editor-controls-transition-duration, 0.1s) var(--kritzel-editor-controls-transition, ease-in-out)}kritzel-controls.keyboard-open{transform:var(--kritzel-editor-controls-transform, translateY(300%))}.top-left-buttons{position:absolute;top:var(--kritzel-editor-top-left-buttons-top, 14px);left:var(--kritzel-editor-top-left-buttons-left, 14px);display:flex;align-items:flex-start;gap:8px}.top-center-notification-layer{position:absolute;top:var(--kritzel-editor-top-center-notification-top, 14px);left:0;right:0;z-index:var(--kritzel-editor-top-center-notification-z-index, 10001);display:flex;justify-content:center;pointer-events:none}.top-center-notification-container{width:min(90vw, 420px);pointer-events:auto;animation:kritzel-notification-slide-in var(--kritzel-editor-notification-animation-duration, 220ms) var(--kritzel-editor-notification-animation-easing, cubic-bezier(0.22, 1, 0.36, 1))}.top-center-notification-container.is-dismissing{animation:kritzel-notification-fade-out var(--kritzel-editor-notification-dismiss-animation-duration, 180ms) var(--kritzel-editor-notification-dismiss-animation-easing, ease-in) forwards}@keyframes kritzel-notification-slide-in{from{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes kritzel-notification-fade-out{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-6px)}}@media (prefers-reduced-motion: reduce){.top-center-notification-container{animation:none}}.top-right-buttons{position:absolute;top:var(--kritzel-editor-top-right-buttons-top, 14px);right:var(--kritzel-editor-top-right-buttons-right, 14px);display:flex;align-items:center;gap:8px}.bottom-left-buttons{position:absolute;left:var(--kritzel-editor-top-left-buttons-left, 14px);bottom:var(--kritzel-editor-controls-bottom, 14px);display:flex;align-items:flex-end}@container (max-width: 767px){.bottom-left-buttons{display:none}}.top-right-button{display:flex;align-items:center;justify-content:center;width:50px;height:50px;padding:0;border:var(--kritzel-split-button-border, 1px solid #ebebeb);border-radius:var(--kritzel-split-button-border-radius, 12px);background-color:var(--kritzel-split-button-background-color, #ffffff);cursor:var(--kritzel-global-pointer-cursor, pointer);box-shadow:var(--kritzel-split-button-box-shadow, 0 0 3px rgba(0, 0, 0, 0.08));transition:background-color 150ms ease;-webkit-tap-highlight-color:transparent}.top-right-button:hover{background-color:#f5f5f5}.top-right-button:active{background-color:#ebebeb}`;
2136
+ const kritzelEditorCss = () => `kritzel-editor{display:flex;margin:0;position:relative;container-type:inline-size;overflow:hidden;width:100%;height:100%;align-items:center;justify-content:center;touch-action:manipulation;user-select:none;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;text-align:start;line-height:normal}.editor-content{position:absolute;inset:0}kritzel-controls{position:absolute;left:0;right:0;margin-inline:auto;width:max-content;max-width:calc(100% - 16px);bottom:var(--kritzel-editor-controls-bottom, 14px);transition:transform var(--kritzel-editor-controls-transition-duration, 0.1s) var(--kritzel-editor-controls-transition, ease-in-out)}kritzel-controls.keyboard-open{transform:var(--kritzel-editor-controls-transform, translateY(300%))}.top-left-buttons{position:absolute;top:var(--kritzel-editor-top-left-buttons-top, 14px);left:var(--kritzel-editor-top-left-buttons-left, 14px);display:flex;align-items:flex-start;gap:8px}.top-center-notification-layer{position:absolute;top:var(--kritzel-editor-top-center-notification-top, 14px);left:0;right:0;z-index:var(--kritzel-editor-top-center-notification-z-index, 10001);display:flex;justify-content:center;pointer-events:none}.top-center-notification-container{width:min(90vw, 420px);pointer-events:auto;animation:kritzel-notification-slide-in var(--kritzel-editor-notification-animation-duration, 220ms) var(--kritzel-editor-notification-animation-easing, cubic-bezier(0.22, 1, 0.36, 1))}.top-center-notification-container.is-dismissing{animation:kritzel-notification-fade-out var(--kritzel-editor-notification-dismiss-animation-duration, 180ms) var(--kritzel-editor-notification-dismiss-animation-easing, ease-in) forwards}@keyframes kritzel-notification-slide-in{from{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes kritzel-notification-fade-out{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-6px)}}@media (prefers-reduced-motion: reduce){.top-center-notification-container{animation:none}}.top-right-buttons{position:absolute;top:var(--kritzel-editor-top-right-buttons-top, 14px);right:var(--kritzel-editor-top-right-buttons-right, 14px);display:flex;align-items:center;gap:8px}.bottom-left-buttons{position:absolute;left:var(--kritzel-editor-top-left-buttons-left, 14px);bottom:var(--kritzel-editor-controls-bottom, 14px);display:flex;align-items:flex-end}@container (max-width: 767px){.bottom-left-buttons{display:none}}.top-right-button{display:flex;align-items:center;justify-content:center;width:50px;height:50px;padding:0;border:var(--kritzel-split-button-border, 1px solid #ebebeb);border-radius:var(--kritzel-split-button-border-radius, 12px);background-color:var(--kritzel-split-button-background-color, #ffffff);cursor:var(--kritzel-global-pointer-cursor, pointer);box-shadow:var(--kritzel-split-button-box-shadow, 0 0 3px rgba(0, 0, 0, 0.08));transition:background-color 150ms ease;-webkit-tap-highlight-color:transparent}.top-right-button:hover{background-color:#f5f5f5}.top-right-button:active{background-color:#ebebeb}`;
2132
2137
 
2133
2138
  const KritzelEditor = class {
2134
2139
  constructor(hostRef) {
@@ -2359,6 +2364,8 @@ const KritzelEditor = class {
2359
2364
  isEditorVisible = false;
2360
2365
  activeNotification;
2361
2366
  isNotificationDismissing = false;
2367
+ /** Combined loading state reported by the engine (external `isLoading` prop or internal workspace loading). Starts true so the overlay is shown until the engine reports otherwise. */
2368
+ isEngineLoading = true;
2362
2369
  notificationDismissTimeout;
2363
2370
  notificationDismissAnimationTimeout;
2364
2371
  notificationDisplayDurationMs = 5000;
@@ -2664,6 +2671,7 @@ const KritzelEditor = class {
2664
2671
  splitButtonRef;
2665
2672
  shareDialogRef;
2666
2673
  loginDialogRef;
2674
+ currentUserDialogRef;
2667
2675
  componentWillLoad() {
2668
2676
  this.loadSettingsFromStorage();
2669
2677
  this.applyTheme();
@@ -2784,6 +2792,10 @@ const KritzelEditor = class {
2784
2792
  event.stopPropagation();
2785
2793
  this.awarenessChange.emit(event.detail);
2786
2794
  }
2795
+ handleLoadingChange(event) {
2796
+ event.stopPropagation();
2797
+ this.isEngineLoading = event.detail;
2798
+ }
2787
2799
  handleNotificationsChange(event) {
2788
2800
  event.stopPropagation();
2789
2801
  this.clearNotificationDismissAnimationTimer();
@@ -2888,15 +2900,7 @@ const KritzelEditor = class {
2888
2900
  label: this.resolvedTerms['menu.settings'] ?? 'Settings',
2889
2901
  icon: 'settings',
2890
2902
  action: () => this.settingsRef.open(),
2891
- },
2892
- {
2893
- id: 'logout',
2894
- label: this.resolvedTerms['menu.logout'] ?? 'Logout',
2895
- icon: 'log-out',
2896
- color: '#ff3b30',
2897
- isVisible: this.isLoggedIn,
2898
- action: () => this.logout.emit(),
2899
- },
2903
+ }
2900
2904
  ];
2901
2905
  }
2902
2906
  handleToggleIsPublic = async (event) => {
@@ -2922,6 +2926,9 @@ const KritzelEditor = class {
2922
2926
  handleProviderLogin = (event) => {
2923
2927
  this.login.emit(event.detail);
2924
2928
  };
2929
+ handleCurrentUserLogout = () => {
2930
+ this.logout.emit();
2931
+ };
2925
2932
  get isLoggedIn() {
2926
2933
  return !!this.user && !this.user.isGuest;
2927
2934
  }
@@ -3073,35 +3080,40 @@ const KritzelEditor = class {
3073
3080
  const isLoggedIn = this.isLoggedIn;
3074
3081
  const shouldShowCurrentUser = isLoggedIn;
3075
3082
  const shouldShowLoginButton = this.isReady && !!this.loginConfig && !isLoggedIn;
3076
- return (index.h(index.Host, { key: '56b172459e6d940229dc1d4f409157e403ad5f27', style: {
3083
+ return (index.h(index.Host, { key: 'a397bb3a5ab632193a0d6af07054d9235c8af7ba' }, index.h("kritzel-loading-overlay", { key: '8ac3ec51ec15a7ce3dfac4e1afb7e2d272d6fee2', visible: this.isLoading || !this.isEditorVisible || this.isEngineLoading, text: this.resolvedTerms['engine.loading'] ?? 'Loading...' }), index.h("div", { key: '0ac709cf7d3e9889f99675f20c1f2ac5bcca55da', class: "editor-content", style: {
3077
3084
  opacity: this.isEditorVisible ? '1' : '0',
3078
3085
  visibility: this.isEditorVisible ? 'visible' : 'hidden',
3079
3086
  transition: 'opacity 0.2s ease-in-out, visibility 0.2s ease-in-out',
3080
- } }, index.h("div", { key: '93a2195c14402f38416b2d377c684e2650418edb', class: "top-left-buttons" }, index.h("kritzel-workspace-manager", { key: '1b42b21bc35e1fc56202e19a78053e46d87ca51a', visible: this.isWorkspaceManagerVisible, workspaces: this.workspaces, activeWorkspace: this.activeWorkspace, terms: this.resolvedTerms, onWorkspaceChange: event => (this.activeWorkspace = event.detail), onIsWorkspaceManagerReady: () => (this.isWorkspaceManagerReady = true) }), index.h("kritzel-back-to-content", { key: '3b90b69a5b83a6e5593d4f752c4094a2a3af8c4d', visible: this.isBackToContentButtonVisible, text: this.resolvedTerms['backToContent.label'] ?? 'Back to content', onBackToContent: () => this.backToContent() })), this.activeNotification && (index.h("div", { key: '9c2ee1e10212145bf2f97a1a7f27746aa18cfc98', class: "top-center-notification-layer", role: "presentation" }, index.h("div", { key: 'a77b025329da64e1f1223a2f749aa2fc60e5c469', class: { 'top-center-notification-container': true, 'is-dismissing': this.isNotificationDismissing }, role: "presentation" }, index.h("kritzel-notification-card", { key: '9ced0bc5213ec8c3387915cd71272a1f56161405', notification: this.activeNotification, locale: this.locale, onDismiss: this.dismissNotification, onHoverChange: event => this.handleNotificationHoverChange(event) })))), index.h("kritzel-engine", { key: '884b7f088e164a51c49158c409904ca5419f2d55', ref: el => {
3087
+ } }, index.h("div", { key: '019cbb191155260c635cb13a4d94eebbb5913045', class: "top-left-buttons" }, index.h("kritzel-workspace-manager", { key: 'b9a60281c57f90dedebd2a01ccc27a689a8f2a09', visible: this.isWorkspaceManagerVisible, workspaces: this.workspaces, activeWorkspace: this.activeWorkspace, terms: this.resolvedTerms, onWorkspaceChange: event => (this.activeWorkspace = event.detail), onIsWorkspaceManagerReady: () => (this.isWorkspaceManagerReady = true) }), index.h("kritzel-back-to-content", { key: 'b0b625e1cd07f29d9622b03e49cf75c9324b2d38', visible: this.isBackToContentButtonVisible, text: this.resolvedTerms['backToContent.label'] ?? 'Back to content', onBackToContent: () => this.backToContent() })), this.activeNotification && (index.h("div", { key: '80868e85dc8a0810750ff5dd04c59057d81fb823', class: "top-center-notification-layer", role: "presentation" }, index.h("div", { key: '8cfe3895cb8dcd137950daff0e677d397c20817b', class: { 'top-center-notification-container': true, 'is-dismissing': this.isNotificationDismissing }, role: "presentation" }, index.h("kritzel-notification-card", { key: 'f50a8ff5fba9ee8df8bb0fa5c2b3198ad30fd8cd', notification: this.activeNotification, locale: this.locale, onDismiss: this.dismissNotification, onHoverChange: event => this.handleNotificationHoverChange(event) })))), index.h("kritzel-engine", { key: '7b31643384b19dfd84b6093a4ccb719dd04b7669', ref: el => {
3081
3088
  if (el) {
3082
3089
  this.engineRef = el;
3083
3090
  }
3084
- }, workspace: this.activeWorkspace, activeWorkspaceId: this.activeWorkspaceId, editorId: this.editorId, syncConfig: this.syncConfig, assetStorageConfig: this.assetStorageConfig, user: this.user, scaleMax: this.scaleMax, lockDrawingScale: this.lockDrawingScale, isObjectDistanceFadingActive: this.isObjectDistanceFadingActive, scaleMin: this.scaleMin, cursorTarget: this.cursorTarget, isLoading: this.isLoading, viewportBoundaryLeft: this.viewportBoundaryLeft, viewportBoundaryRight: this.viewportBoundaryRight, viewportBoundaryTop: this.viewportBoundaryTop, viewportBoundaryBottom: this.viewportBoundaryBottom, isPanningEnabled: this.isPanningEnabled, isZoomingEnabled: this.isZoomingEnabled, theme: this.theme, themes: this.themes, licenseKey: this.licenseKey, locale: this.locale, locales: this.locales, fallbackLocale: this.fallbackLocale, debugInfo: this.debugInfo, globalContextMenuItems: this.globalContextMenuItems, objectContextMenuItems: this.objectContextMenuItems, onIsEngineReady: event => this.onEngineReady(event), onWorkspacesChange: event => this.handleWorkspacesChange(event), onActiveWorkspaceChange: event => this.handleActiveWorkspaceChange(event), onObjectsChange: event => this.handleObjectsChange(event), onObjectsAdded: event => this.handleObjectsAdded(event), onObjectsRemoved: event => this.handleObjectsRemoved(event), onObjectsUpdated: event => this.handleObjectsUpdated(event), onUndoStateChange: event => this.handleUndoStateChange(event), onObjectsInViewportChange: event => this.handleObjectsInViewportChange(event), onViewportChange: event => this.handleViewportChange(event), onAwarenessChange: event => this.handleAwarenessChange(event), onNotificationsChange: event => this.handleNotificationsChange(event) }), index.h("kritzel-controls", { key: '3a7c22f037d551636c53190eb07b318c2b857162', visible: this.isControlsVisible, class: { 'keyboard-open': this.isVirtualKeyboardOpen }, ref: el => {
3091
+ }, workspace: this.activeWorkspace, activeWorkspaceId: this.activeWorkspaceId, editorId: this.editorId, syncConfig: this.syncConfig, assetStorageConfig: this.assetStorageConfig, user: this.user, scaleMax: this.scaleMax, lockDrawingScale: this.lockDrawingScale, isObjectDistanceFadingActive: this.isObjectDistanceFadingActive, scaleMin: this.scaleMin, cursorTarget: this.cursorTarget, isLoading: this.isLoading, viewportBoundaryLeft: this.viewportBoundaryLeft, viewportBoundaryRight: this.viewportBoundaryRight, viewportBoundaryTop: this.viewportBoundaryTop, viewportBoundaryBottom: this.viewportBoundaryBottom, isPanningEnabled: this.isPanningEnabled, isZoomingEnabled: this.isZoomingEnabled, theme: this.theme, themes: this.themes, licenseKey: this.licenseKey, locale: this.locale, locales: this.locales, fallbackLocale: this.fallbackLocale, debugInfo: this.debugInfo, globalContextMenuItems: this.globalContextMenuItems, objectContextMenuItems: this.objectContextMenuItems, onIsEngineReady: event => this.onEngineReady(event), onWorkspacesChange: event => this.handleWorkspacesChange(event), onActiveWorkspaceChange: event => this.handleActiveWorkspaceChange(event), onObjectsChange: event => this.handleObjectsChange(event), onObjectsAdded: event => this.handleObjectsAdded(event), onObjectsRemoved: event => this.handleObjectsRemoved(event), onObjectsUpdated: event => this.handleObjectsUpdated(event), onUndoStateChange: event => this.handleUndoStateChange(event), onObjectsInViewportChange: event => this.handleObjectsInViewportChange(event), onViewportChange: event => this.handleViewportChange(event), onAwarenessChange: event => this.handleAwarenessChange(event), onNotificationsChange: event => this.handleNotificationsChange(event), onLoadingChange: event => this.handleLoadingChange(event) }), index.h("kritzel-controls", { key: '14ee52a07381785c4b8ce1f2e1b7304d44e0e128', visible: this.isControlsVisible, class: { 'keyboard-open': this.isVirtualKeyboardOpen }, ref: el => {
3085
3092
  if (el) {
3086
3093
  this.controlsRef = el;
3087
3094
  }
3088
- }, controls: this.controls, isUtilityPanelVisible: this.isUtilityPanelVisible, undoState: this.undoState ?? undefined, theme: this.theme, terms: this.resolvedTerms, onIsControlsReady: () => (this.isControlsReady = true) }), index.h("div", { key: 'c0dad9086679397c46f5550c38686a9b7d8bae6c', class: "bottom-left-buttons" }, index.h("kritzel-zoom-panel", { key: '1639d6d2092ecd3fbc657dfdcfc3f12c02539329', visible: this.isZoomPanelVisible, disabled: !this.isZoomingEnabled, zoomPercent: this.currentZoomPercent, terms: this.resolvedTerms, onZoomIn: () => this.zoomIn(), onZoomOut: () => this.zoomOut() })), index.h("div", { key: '45313b28a5e4bd75d09980e4765c2241d54fe1df', class: "top-right-buttons" }, index.h("kritzel-settings", { key: '33737a005cd6580505ee741be0dc40bd69873276', ref: el => {
3095
+ }, controls: this.controls, isUtilityPanelVisible: this.isUtilityPanelVisible, undoState: this.undoState ?? undefined, theme: this.theme, terms: this.resolvedTerms, onIsControlsReady: () => (this.isControlsReady = true) }), index.h("div", { key: 'c9ddf5fe7d74f32aff8182ce9dd70931f35a7274', class: "bottom-left-buttons" }, index.h("kritzel-zoom-panel", { key: '3ede1bacaa3ff6876429347c8edc20939b1ec59e', visible: this.isZoomPanelVisible, disabled: !this.isZoomingEnabled, zoomPercent: this.currentZoomPercent, terms: this.resolvedTerms, onZoomIn: () => this.zoomIn(), onZoomOut: () => this.zoomOut() })), index.h("div", { key: 'af1f5f33065d5693e1c363f6e0d49d43cf839f88', class: "top-right-buttons" }, index.h("kritzel-settings", { key: 'f281c4b2c47d0fa15e947c2bd9e6e34f6ab064cf', ref: el => {
3089
3096
  if (el) {
3090
3097
  this.settingsRef = el;
3091
3098
  }
3092
- }, shortcuts: this.shortcuts, availableThemes: this.themes && this.themes.length > 0 ? this.themes.map(t => t.name) : ['light', 'dark'], availableLocales: this.availableLocaleOptions, settings: this.currentSettingsConfig, terms: this.resolvedTerms, onSettingsChange: event => this.handleSettingsChange(event) }), index.h("kritzel-export", { key: '9e13001850b15b9ce9d8a502466ed9fa05ac1518', ref: el => {
3099
+ }, shortcuts: this.shortcuts, availableThemes: this.themes && this.themes.length > 0 ? this.themes.map(t => t.name) : ['light', 'dark'], availableLocales: this.availableLocaleOptions, settings: this.currentSettingsConfig, terms: this.resolvedTerms, onSettingsChange: event => this.handleSettingsChange(event) }), index.h("kritzel-export", { key: 'aa9f4d755cd429e287bd9dc513f059006e47c037', ref: el => {
3093
3100
  if (el) {
3094
3101
  this.exportRef = el;
3095
3102
  }
3096
- }, workspaceName: this.activeWorkspace?.name || 'workspace', terms: this.resolvedTerms, onExportPng: () => this.engineRef.exportViewportAsPng(), onExportSvg: () => this.engineRef.exportViewportAsSvg(), onExportJson: event => this.engineRef.downloadAsJson(event.detail) }), index.h("kritzel-active-users", { key: 'f2494af1241ecc068ace09b23cfd405c76bd1273', users: this.activeUsers }), shouldShowCurrentUser && index.h("kritzel-current-user", { key: '7f199e3493805977b5e5b8d2c736f31729919f96', user: this.user, terms: this.resolvedTerms }), shouldShowLoginButton && (index.h("kritzel-button", { key: 'c6c192ddb1245acc771ac550c1fe3e4f9bc08eab', onButtonClick: () => this.loginDialogRef?.open() }, this.resolvedTerms['login.dialogTitle'] ?? 'Sign in')), index.h("kritzel-more-menu", { key: '869194078a4c90d42c5ebd604bc58b4f55fc4cb6', items: this.moreMenuItems, visible: this.isMoreMenuVisible, terms: this.resolvedTerms }), index.h("kritzel-share-dialog", { key: '8daed8fd7267aca056b6a53626c721e2f23cead4', ref: el => {
3103
+ }, workspaceName: this.activeWorkspace?.name || 'workspace', terms: this.resolvedTerms, onExportPng: () => this.engineRef.exportViewportAsPng(), onExportSvg: () => this.engineRef.exportViewportAsSvg(), onExportJson: event => this.engineRef.downloadAsJson(event.detail) }), index.h("kritzel-active-users", { key: 'e7f019162bf7fa84c591e78c9255ed54d49d624f', users: this.activeUsers }), shouldShowCurrentUser && index.h("kritzel-current-user", { key: '5b51e312ca1d94717c8eae781435a1c253dfecc3', user: this.user, terms: this.resolvedTerms, onClick: () => this.currentUserDialogRef?.open() }), shouldShowCurrentUser && (index.h("kritzel-current-user-dialog", { key: '328297225ea30570baa1aeec8dffda3e5fb90f6e', ref: el => {
3104
+ if (el) {
3105
+ this.currentUserDialogRef = el;
3106
+ this.currentUserDialogRef.addEventListener('logoutRequest', this.handleCurrentUserLogout);
3107
+ }
3108
+ }, user: this.user, terms: this.resolvedTerms })), shouldShowLoginButton && (index.h("kritzel-button", { key: '719da0f8c343b0e3be80b37318bb27e102ea0f1e', onButtonClick: () => this.loginDialogRef?.open() }, this.resolvedTerms['login.dialogTitle'] ?? 'Sign in')), index.h("kritzel-more-menu", { key: 'c3d0f82f8e21b53b966fcc99c598051b6e294b6a', items: this.moreMenuItems, visible: this.isMoreMenuVisible, terms: this.resolvedTerms }), index.h("kritzel-share-dialog", { key: '49a929e16684131fe4e0c7cc9d5f5ad769b6785c', ref: el => {
3097
3109
  if (el) {
3098
3110
  this.shareDialogRef = el;
3099
3111
  }
3100
- }, isPublic: this.currentIsPublic, workspaceId: this.activeWorkspace?.id, terms: this.resolvedTerms, onToggleIsPublic: this.handleToggleIsPublic }), this.loginConfig && (index.h("kritzel-login-dialog", { key: 'b65ea0940cee31b152b60881180fab2445c92b0c', ref: el => {
3112
+ }, isPublic: this.currentIsPublic, workspaceId: this.activeWorkspace?.id, terms: this.resolvedTerms, onToggleIsPublic: this.handleToggleIsPublic }), this.loginConfig && (index.h("kritzel-login-dialog", { key: '113bd2574096d3e64ff36b2b8d152b28ff4ba8f7', ref: el => {
3101
3113
  if (el) {
3102
3114
  this.loginDialogRef = el;
3103
3115
  }
3104
- }, providers: this.loginConfig.providers, dialogTitle: this.loginConfig.title ?? this.resolvedTerms['login.dialogTitle'] ?? 'Sign in', subtitle: this.loginConfig.subtitle, onProviderLogin: this.handleProviderLogin })))));
3116
+ }, providers: this.loginConfig.providers, dialogTitle: this.loginConfig.title ?? this.resolvedTerms['login.dialogTitle'] ?? 'Sign in', subtitle: this.loginConfig.subtitle, onProviderLogin: this.handleProviderLogin }))))));
3105
3117
  }
3106
3118
  static get watchers() { return {
3107
3119
  "isEngineReady": [{
@@ -27419,7 +27431,7 @@ class KritzelWheelHelper {
27419
27431
  }
27420
27432
  }
27421
27433
 
27422
- const kritzelEngineCss = () => `:host{display:block;position:relative;height:100%;width:100%;overflow:hidden;background-color:var(--kritzel-engine-background-color, #ffffff)}:host,:host *{touch-action:none;user-select:none}.ProseMirror{outline:none}p,h1,h2,h3,h4,h5,h6,blockquote,pre{margin:0;padding:0}.workspace-loading-overlay{position:absolute;inset:0;z-index:9999;display:flex;align-items:center;justify-content:center;gap:10px;background-color:var(--kritzel-engine-loading-overlay-background, rgba(255, 255, 255, 0.6));color:var(--kritzel-engine-loading-overlay-color, #333);font-family:var(--kritzel-font-family, sans-serif);font-size:1.25rem;pointer-events:all;animation:workspace-loading-fade-in 200ms ease-out var(--kritzel-engine-loading-overlay-delay, 300ms) forwards;opacity:0}.workspace-loading-spinner{width:20px;height:20px;box-sizing:border-box;display:block;flex-shrink:0;border:2px solid var(--kritzel-engine-loading-overlay-spinner-color, #cccccc);border-top-color:var(--kritzel-engine-loading-overlay-spinner-active-color, #333333);border-radius:50%;animation:workspace-loading-spin 0.6s linear infinite}@keyframes workspace-loading-spin{to{transform:rotate(360deg)}}@keyframes workspace-loading-fade-in{to{opacity:1}}.debug-panel{position:absolute;pointer-events:none;top:0;right:0}.origin{position:relative;top:0;left:0;height:0;width:0;pointer-events:none;-webkit-transform-origin:top left;-moz-transform-origin:top left;transform-origin:top left;overflow:visible}.object{overflow:visible}.PlaygroundEditorTheme__quote{margin:0;margin-left:20px;margin-bottom:10px;font-size:15px;color:rgb(101, 103, 107);border-left-color:rgb(206, 208, 212);border-left-width:4px;border-left-style:solid;padding-left:16px}`;
27434
+ const kritzelEngineCss = () => `:host{display:block;position:relative;height:100%;width:100%;overflow:hidden;background-color:var(--kritzel-engine-background-color, #ffffff)}:host,:host *{touch-action:none;user-select:none}.ProseMirror{outline:none}p,h1,h2,h3,h4,h5,h6,blockquote,pre{margin:0;padding:0}.debug-panel{position:absolute;pointer-events:none;top:0;right:0}.origin{position:relative;top:0;left:0;height:0;width:0;pointer-events:none;-webkit-transform-origin:top left;-moz-transform-origin:top left;transform-origin:top left;overflow:visible}.object{overflow:visible}.PlaygroundEditorTheme__quote{margin:0;margin-left:20px;margin-bottom:10px;font-size:15px;color:rgb(101, 103, 107);border-left-color:rgb(206, 208, 212);border-left-width:4px;border-left-style:solid;padding-left:16px}`;
27423
27435
 
27424
27436
  const KritzelEngine = class {
27425
27437
  get host() { return index.getElement(this); }
@@ -27649,6 +27661,8 @@ const KritzelEngine = class {
27649
27661
  awarenessChange;
27650
27662
  /** Emitted when notifications change. */
27651
27663
  notificationsChange;
27664
+ /** Emitted when the combined loading state (external `isLoading` prop or internal workspace loading) changes. */
27665
+ loadingChange;
27652
27666
  forceUpdate = 0;
27653
27667
  /** Manually triggers the `objectsSelectionChange` event. */
27654
27668
  async triggerSelectionChange() {
@@ -29107,6 +29121,7 @@ const KritzelEngine = class {
29107
29121
  _objectDistanceFadeCloseMinOpacity = 0;
29108
29122
  syncLoadingState() {
29109
29123
  this.core.store.state.isLoading = this._isWorkspaceLoading || this.isLoading;
29124
+ this.loadingChange.emit(this.core.store.state.isLoading);
29110
29125
  }
29111
29126
  applyToolConfig(tool, toolConfig) {
29112
29127
  Object.entries(toolConfig).forEach(([key, value]) => {
@@ -29152,6 +29167,7 @@ const KritzelEngine = class {
29152
29167
  this.viewportChange = index.createEvent(this, "viewportChange");
29153
29168
  this.awarenessChange = index.createEvent(this, "awarenessChange");
29154
29169
  this.notificationsChange = index.createEvent(this, "notificationsChange");
29170
+ this.loadingChange = index.createEvent(this, "loadingChange");
29155
29171
  this.core = new KritzelCore(this);
29156
29172
  }
29157
29173
  disconnectedCallback() {
@@ -29506,7 +29522,7 @@ const KritzelEngine = class {
29506
29522
  }
29507
29523
  render() {
29508
29524
  if (!this.viewport) {
29509
- return (index.h(index.Host, null, this.core.store.state.isLoading && (index.h("div", { class: "workspace-loading-overlay" }, index.h("span", { class: "workspace-loading-spinner" }), this.core.localizationManager.translate('engine.loading')))));
29525
+ return index.h(index.Host, null);
29510
29526
  }
29511
29527
  const currentTheme = this.core.themeManager.getStoredTheme();
29512
29528
  const computedStyle = window.getComputedStyle(this.host);
@@ -29563,7 +29579,7 @@ const KritzelEngine = class {
29563
29579
  this.emitObjectsInViewportChange();
29564
29580
  }
29565
29581
  }
29566
- return (index.h(index.Host, null, this.core.store.state.isLoading && (index.h("div", { class: "workspace-loading-overlay" }, index.h("span", { class: "workspace-loading-spinner" }), "Loading...")), this.core.store.state.debugInfo.showViewportInfo && (index.h("div", { class: "debug-panel" }, index.h("div", null, "ActiveWorkspaceId: ", this.core.store.state?.activeWorkspace?.id), index.h("div", null, "ActiveWorkspaceName: ", this.core.store.state?.activeWorkspace?.name), index.h("div", null, "TranslateX: ", this.core.store.state?.translateX), index.h("div", null, "TranslateY: ", this.core.store.state?.translateY), index.h("div", null, "ViewportWidth: ", this.core.store.state?.viewportWidth), index.h("div", null, "ViewportHeight: ", this.core.store.state?.viewportHeight), index.h("div", null, "PointerCount: ", this.core.store.state.pointers.size), index.h("div", null, "Scale: ", this.core.store.state?.scale), index.h("div", null, "ActiveTool: ", this.core.store.state?.activeTool?.name), index.h("div", null, "HasViewportChanged: ", this.core.store.state?.hasViewportChanged ? 'true' : 'false'), index.h("div", null, "IsEnabled: ", this.core.store.state?.isEnabled ? 'true' : 'false'), index.h("div", null, "IsScaling: ", this.core.store.state?.isScaling ? 'true' : 'false'), index.h("div", null, "IsPanning: ", this.core.store.state?.isPanning ? 'true' : 'false'), index.h("div", null, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), index.h("div", null, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), index.h("div", null, "IsResizeHandleSelected: ", this.core.store.state.isResizeHandleSelected ? 'true' : 'false'), index.h("div", null, "IsRotationHandleSelected: ", this.core.store.state.isRotationHandleSelected ? 'true' : 'false'), index.h("div", null, "IsRotationHandleHovered: ", this.core.store.state.isRotationHandleHovered ? 'true' : 'false'), index.h("div", null, "IsDrawing: ", this.core.store.state.isDrawing ? 'true' : 'false'), index.h("div", null, "IsWriting: ", this.core.store.state.isWriting ? 'true' : 'false'), index.h("div", null, "IsPointerDown: ", this.core.store.isPointerDown ? 'true' : 'false'), index.h("div", null, "PointerX: ", this.core.store.state?.pointerX), index.h("div", null, "PointerY: ", this.core.store.state?.pointerY), index.h("div", null, "TotalObjects: ", this.core.store.totalObjectCount), index.h("div", null, "ObjectsInViewport: ", this.core.store.objectsInViewport.length), index.h("div", null, "SelectedObjects: ", this.core.store.selectionGroup?.objects.length || 0), index.h("div", null, "ViewportCenter: (", viewportCenterX.toFixed(2), ", ", viewportCenterY.toFixed(2), ")"))), index.h("div", { id: "origin", class: "origin", style: {
29582
+ return (index.h(index.Host, null, this.core.store.state.debugInfo.showViewportInfo && (index.h("div", { class: "debug-panel" }, index.h("div", null, "ActiveWorkspaceId: ", this.core.store.state?.activeWorkspace?.id), index.h("div", null, "ActiveWorkspaceName: ", this.core.store.state?.activeWorkspace?.name), index.h("div", null, "TranslateX: ", this.core.store.state?.translateX), index.h("div", null, "TranslateY: ", this.core.store.state?.translateY), index.h("div", null, "ViewportWidth: ", this.core.store.state?.viewportWidth), index.h("div", null, "ViewportHeight: ", this.core.store.state?.viewportHeight), index.h("div", null, "PointerCount: ", this.core.store.state.pointers.size), index.h("div", null, "Scale: ", this.core.store.state?.scale), index.h("div", null, "ActiveTool: ", this.core.store.state?.activeTool?.name), index.h("div", null, "HasViewportChanged: ", this.core.store.state?.hasViewportChanged ? 'true' : 'false'), index.h("div", null, "IsEnabled: ", this.core.store.state?.isEnabled ? 'true' : 'false'), index.h("div", null, "IsScaling: ", this.core.store.state?.isScaling ? 'true' : 'false'), index.h("div", null, "IsPanning: ", this.core.store.state?.isPanning ? 'true' : 'false'), index.h("div", null, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), index.h("div", null, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), index.h("div", null, "IsResizeHandleSelected: ", this.core.store.state.isResizeHandleSelected ? 'true' : 'false'), index.h("div", null, "IsRotationHandleSelected: ", this.core.store.state.isRotationHandleSelected ? 'true' : 'false'), index.h("div", null, "IsRotationHandleHovered: ", this.core.store.state.isRotationHandleHovered ? 'true' : 'false'), index.h("div", null, "IsDrawing: ", this.core.store.state.isDrawing ? 'true' : 'false'), index.h("div", null, "IsWriting: ", this.core.store.state.isWriting ? 'true' : 'false'), index.h("div", null, "IsPointerDown: ", this.core.store.isPointerDown ? 'true' : 'false'), index.h("div", null, "PointerX: ", this.core.store.state?.pointerX), index.h("div", null, "PointerY: ", this.core.store.state?.pointerY), index.h("div", null, "TotalObjects: ", this.core.store.totalObjectCount), index.h("div", null, "ObjectsInViewport: ", this.core.store.objectsInViewport.length), index.h("div", null, "SelectedObjects: ", this.core.store.selectionGroup?.objects.length || 0), index.h("div", null, "ViewportCenter: (", viewportCenterX.toFixed(2), ", ", viewportCenterY.toFixed(2), ")"))), index.h("div", { id: "origin", class: "origin", style: {
29567
29583
  transform: `matrix(${this.core.store.state?.scale}, 0, 0, ${this.core.store.state?.scale}, ${this.core.store.state?.translateX}, ${this.core.store.state?.translateY})`,
29568
29584
  } }, visibleObjects?.map(object => {
29569
29585
  const { multiplied: effectiveOpacity, overridden: effectiveOpacityString } = this.getObjectEffectiveOpacity(object, viewportScale);
@@ -30161,7 +30177,7 @@ const KritzelExport = class {
30161
30177
  return (index.h("div", { class: "export-tab-content" }, index.h("kritzel-input", { label: this.terms['export.filename.label'] ?? 'Filename', value: this.exportFilename, placeholder: this.terms['export.filename.placeholder'] ?? 'Enter filename', suffix: ".json", onValueChange: this.handleFilenameChange })));
30162
30178
  }
30163
30179
  render() {
30164
- return (index.h(index.Host, { key: 'fd219fffd4d8bb528e6a90055c2b43a5f5a73060' }, index.h("kritzel-dialog", { key: '9f4ba5b05f5ad31084aab457386a86cbc6d4f2bc', isOpen: this.isDialogOpen, dialogTitle: this.terms['export.dialogTitle'] ?? 'Export', closable: true, contained: true, onDialogClose: this.closeDialog }, index.h("div", { key: '920bb8f20b42897680084bde47270b3812e2f3e4', class: "export-content" }, index.h("kritzel-pill-tabs", { key: '7090bd0a371457adceaa4bd7461a616839a66349', tabs: this.tabs, value: this.activeTab, onValueChange: this.handleTabChange }), this.activeTab === 'viewport' && this.renderViewportExport(), this.activeTab === 'workspace' && this.renderWorkspaceExport(), index.h("button", { key: 'ddf36c1e7cb81409c2cecfa6585e0f1dd7aca2c3', class: "export-primary-button", onClick: this.handleExport }, this.terms['export.exportButton'] ?? 'Export')))));
30180
+ return (index.h(index.Host, { key: '5706e0f8688777826452ca0cf81e2581f6e2d14a' }, index.h("kritzel-dialog", { key: '8d0d26a672604aec2b899a7ea05ab40031ac9c43', isOpen: this.isDialogOpen, dialogTitle: this.terms['export.dialogTitle'] ?? 'Export', closable: true, contained: true, onDialogClose: this.closeDialog }, index.h("div", { key: 'a4c3f5a2961aca9dd5cba4045b8bd53635681ab0', class: "export-content" }, index.h("kritzel-pill-tabs", { key: '51a40a8596e492130cc8fa4c977cde916d7d8392', tabs: this.tabs, value: this.activeTab, onValueChange: this.handleTabChange }), this.activeTab === 'viewport' && this.renderViewportExport(), this.activeTab === 'workspace' && this.renderWorkspaceExport(), index.h("button", { key: 'a4b8e1503a0a8e682d10623bc334fcc70b5ea243', class: "export-primary-button", onClick: this.handleExport }, this.terms['export.exportButton'] ?? 'Export')))));
30165
30181
  }
30166
30182
  };
30167
30183
  KritzelExport.style = kritzelExportCss();
@@ -30176,7 +30192,7 @@ const KritzelFont = class {
30176
30192
  size = 24;
30177
30193
  color = '#000000';
30178
30194
  render() {
30179
- return (index.h(index.Host, { key: 'e37350dd092fb7c81a5624bfdc39c3b9af66b894' }, index.h("div", { key: 'a962ccc23a48f62b86d49ae41b1c9c27bdc9a5b9', class: "font-preview", style: {
30195
+ return (index.h(index.Host, { key: '054371cac30a2433611139a670406b0a1e3b99ff' }, index.h("div", { key: 'b4f2142b3cb31d067f39952a38b6f665f28f63bf', class: "font-preview", style: {
30180
30196
  fontFamily: this.fontFamily,
30181
30197
  fontSize: `${this.size}px`,
30182
30198
  color: this.color
@@ -30252,7 +30268,7 @@ const KritzelFontSize = class {
30252
30268
  render() {
30253
30269
  const color = 'var(--kritzel-global-text-primary)';
30254
30270
  const sizes = this.sizes ?? [];
30255
- return (index.h(index.Host, { key: 'a314e990b56cb4e819c4d83a139016b1658606b8' }, sizes.map(size => (index.h("div", { tabIndex: 0, class: {
30271
+ return (index.h(index.Host, { key: '56eb19367abe312bac3b626cfcae3b1ff6e90d21' }, sizes.map(size => (index.h("div", { tabIndex: 0, class: {
30256
30272
  'size-container': true,
30257
30273
  'selected': this.selectedSize === size,
30258
30274
  }, onClick: () => this.handleSizeClick(size), onKeyDown: event => this.handleKeyDown(event, size) }, index.h("kritzel-font", { fontFamily: this.fontFamily, size: size, color: color }))))));
@@ -30319,7 +30335,7 @@ const KritzelInput = class {
30319
30335
  this.valueChange.emit(input.value);
30320
30336
  };
30321
30337
  render() {
30322
- return (index.h(index.Host, { key: '7e16272802a5485207721f4f01ddf8e956b56dac' }, index.h("div", { key: 'ab60dacd08c6199db507d896c00cd0c788ecf7fa', class: "input-container" }, this.label && index.h("label", { key: 'e2e5769ca2954442da5a0f2a2abb07847986eac8', class: "input-label" }, this.label), index.h("div", { key: 'e7131f6d1a770cf71de9f7086e3a8a092296b80e', class: { 'input-wrapper': true, 'has-suffix': !!this.suffix } }, index.h("input", { key: '565cb30ed36818badc148475c596b468cdd2a65b', type: this.type, class: "text-input", value: this.inputValue, placeholder: this.placeholder, disabled: this.disabled, onInput: this.handleInput }), this.suffix && index.h("span", { key: 'ec4afb63443b6c89a829e515df7d33066f0f8def', class: "input-suffix" }, this.suffix)))));
30338
+ return (index.h(index.Host, { key: '46a0a48902a06ad85edcbaad3679ce3fe9ba850c' }, index.h("div", { key: 'a6beaf920614aa959d2fbd68b7268afba8637358', class: "input-container" }, this.label && index.h("label", { key: 'ca6d3fb3c22f1540795dbb0695ddd9b87cc05eee', class: "input-label" }, this.label), index.h("div", { key: '78d116e82531a9cca996d594792245449bcaf9c8', class: { 'input-wrapper': true, 'has-suffix': !!this.suffix } }, index.h("input", { key: '0d10d6356dea3a11338172bbe8c3c878eefcc708', type: this.type, class: "text-input", value: this.inputValue, placeholder: this.placeholder, disabled: this.disabled, onInput: this.handleInput }), this.suffix && index.h("span", { key: '0e6166ba8728efc1035302d7fb048306efbe5a68', class: "input-suffix" }, this.suffix)))));
30323
30339
  }
30324
30340
  static get watchers() { return {
30325
30341
  "value": [{
@@ -30412,6 +30428,26 @@ const KritzelLineEndings = class {
30412
30428
  };
30413
30429
  KritzelLineEndings.style = kritzelLineEndingsCss();
30414
30430
 
30431
+ const kritzelLoadingOverlayCss = () => `:host{display:contents}.loading-overlay{position:absolute;inset:0;z-index:var(--kritzel-loading-overlay-z-index, 9999);display:flex;align-items:center;justify-content:center;gap:10px;background-color:var(--kritzel-loading-overlay-background, rgba(255, 255, 255, 0.6));color:var(--kritzel-loading-overlay-color, #333);font-family:var(--kritzel-font-family, sans-serif);font-size:1.25rem;opacity:0;pointer-events:none;visibility:hidden}.loading-overlay.visible{pointer-events:all;visibility:visible;animation:kritzel-loading-fade-in 200ms ease-out var(--kritzel-loading-overlay-delay, 300ms) forwards}.loading-spinner{width:20px;height:20px;box-sizing:border-box;display:block;flex-shrink:0;border:2px solid var(--kritzel-loading-overlay-spinner-color, #cccccc);border-top-color:var(--kritzel-loading-overlay-spinner-active-color, #333333);border-radius:50%;animation:kritzel-loading-spin 0.6s linear infinite}@keyframes kritzel-loading-spin{to{transform:rotate(360deg)}}@keyframes kritzel-loading-fade-in{to{opacity:1}}`;
30432
+
30433
+ const KritzelLoadingOverlay = class {
30434
+ constructor(hostRef) {
30435
+ index.registerInstance(this, hostRef);
30436
+ }
30437
+ /**
30438
+ * Whether the overlay is visible
30439
+ */
30440
+ visible = false;
30441
+ /**
30442
+ * The text to display next to the spinner
30443
+ */
30444
+ text = 'Loading...';
30445
+ render() {
30446
+ return (index.h(index.Host, { key: 'b8c4784803ca5a0e6bf3f25c1d39139307bb6d50' }, index.h("div", { key: '5a8a2c44f1800c0275d1a94aa0eb5c2854be63b5', class: { 'loading-overlay': true, visible: this.visible }, "aria-hidden": this.visible ? 'false' : 'true' }, index.h("span", { key: '04e33166e054d7a600a83dacd48e3fb50ab69d22', class: "loading-spinner" }), this.text)));
30447
+ }
30448
+ };
30449
+ KritzelLoadingOverlay.style = kritzelLoadingOverlayCss();
30450
+
30415
30451
  const kritzelLoginDialogCss = () => `:host{display:contents}kritzel-dialog{--kritzel-dialog-width-small:380px}.login-content{display:flex;flex-direction:column;gap:20px}.login-subtitle{font-size:13px;color:var(--kritzel-login-dialog-subtitle-color, #666666);margin:0;line-height:1.5;text-align:center}.login-providers{display:flex;flex-direction:column;gap:10px}.provider-button{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;padding:12px 16px;border:1px solid var(--kritzel-login-dialog-button-border-color, #e0e0e0);border-radius:8px;background:var(--kritzel-login-dialog-button-background, #ffffff);color:var(--kritzel-login-dialog-button-text-color, #333333);font-size:14px;font-weight:500;font-family:inherit;cursor:var(--kritzel-global-pointer-cursor, pointer);transition:background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;-webkit-tap-highlight-color:transparent}.provider-button:hover:not(:disabled){background:var(--kritzel-login-dialog-button-hover-background, #f5f5f5);border-color:var(--kritzel-login-dialog-button-hover-border-color, #cccccc)}.provider-button:active:not(:disabled){background:var(--kritzel-login-dialog-button-active-background, #ebebeb)}.provider-button:focus-visible{outline:revert;outline-offset:revert}.provider-button.is-disabled{opacity:0.5;cursor:default;pointer-events:none}.provider-button.is-loading{cursor:default}.provider-label{flex-shrink:0}.provider-button.is-loading .provider-label{opacity:0.7}@keyframes kritzel-login-spin{to{transform:rotate(360deg)}}.spinner{width:20px;height:20px;box-sizing:border-box;display:block;flex-shrink:0;border:2px solid var(--kritzel-login-dialog-spinner-color, #cccccc);border-top-color:var(--kritzel-login-dialog-spinner-active-color, #333333);border-radius:50%;animation:kritzel-login-spin 0.6s linear infinite}`;
30416
30452
 
30417
30453
  const KritzelLoginDialog = class {
@@ -30459,7 +30495,7 @@ const KritzelLoginDialog = class {
30459
30495
  this.dialogClosed.emit();
30460
30496
  };
30461
30497
  render() {
30462
- return (index.h(index.Host, { key: '6ef65077c95d32fee8da4b70ad2e832ad1bb78f7' }, index.h("kritzel-dialog", { key: '04f3d3350393475c7267d8ca90c0b3f0fce10c38', dialogTitle: this.dialogTitle, isOpen: this.isDialogOpen, onDialogClose: this.closeDialog, size: "small", contained: true }, index.h("div", { key: 'c2ed4e339d86dcea23b4a0778b8966a6ae36107a', class: "login-content" }, this.subtitle && (index.h("p", { key: 'ae46baa70526d057b3427459903287489e645e08', class: "login-subtitle" }, this.subtitle)), index.h("div", { key: '1055d5861e5281be234094a3c5c86a6aaf58935f', class: "login-providers" }, this.providers.map(provider => (index.h("button", { key: provider.name, class: {
30498
+ return (index.h(index.Host, { key: '5cedcb4fa0a9026338e930cfbbdbfa1df9853530' }, index.h("kritzel-dialog", { key: '1502a2dc67630b0a1399ef6e8d1a2fdcd4d50913', dialogTitle: this.dialogTitle, isOpen: this.isDialogOpen, onDialogClose: this.closeDialog, size: "small", contained: true }, index.h("div", { key: 'f84a888ccc0b1cb2052e30af56a08910da8d85b5', class: "login-content" }, this.subtitle && (index.h("p", { key: '971040609c43efea30a7bfd0c1a3de2113f77a2b', class: "login-subtitle" }, this.subtitle)), index.h("div", { key: 'ecb0c648ce0d9a8ca8b10e6a520273d817c7a0fe', class: "login-providers" }, this.providers.map(provider => (index.h("button", { key: provider.name, class: {
30463
30499
  'provider-button': true,
30464
30500
  'is-loading': this.loadingProvider === provider.name,
30465
30501
  'is-disabled': this.loadingProvider !== null && this.loadingProvider !== provider.name,
@@ -30565,15 +30601,15 @@ const KritzelMasterDetail = class {
30565
30601
  const selectedItem = this.items.find(item => item.id === this.selectedItemId);
30566
30602
  const panelId = 'master-detail-panel';
30567
30603
  const selectedTabId = selectedItem ? `tab-${selectedItem.id}` : undefined;
30568
- return (index.h(index.Host, { key: 'e094bc3df0e0d1598e84c9a17a033079b1db33f6' }, index.h("div", { key: '79509ba5d63703fe36650b07b5172f77bd6eafde', class: {
30604
+ return (index.h(index.Host, { key: '0edf50b0b853633b88bf481f97f22aceba9e163e' }, index.h("div", { key: '21a0a3f81e5a60889ccd152c905cb41f52c3e037', class: {
30569
30605
  'master-detail-container': true,
30570
30606
  'is-mobile-detail-visible': this.showMobileDetail,
30571
- } }, index.h("nav", { key: '79d200d8c2e54789a33fc88b07c48f034de140ad', class: "master-menu", role: "tablist", "aria-orientation": "vertical", "aria-label": "Settings categories" }, this.items.map((item, index$1) => (index.h("button", { key: item.id, id: `tab-${item.id}`, ref: el => this.setTabRef(el, index$1), class: {
30607
+ } }, index.h("nav", { key: '41f88248cc372c8cae4cb50a19edf462a01e43f2', class: "master-menu", role: "tablist", "aria-orientation": "vertical", "aria-label": "Settings categories" }, this.items.map((item, index$1) => (index.h("button", { key: item.id, id: `tab-${item.id}`, ref: el => this.setTabRef(el, index$1), class: {
30572
30608
  'menu-item': true,
30573
30609
  'is-selected': item.id === this.selectedItemId,
30574
30610
  'is-disabled': !!item.disabled,
30575
30611
  'is-focused': index$1 === this.focusedIndex,
30576
- }, role: "tab", "aria-selected": item.id === this.selectedItemId ? 'true' : 'false', "aria-controls": panelId, "aria-disabled": item.disabled ? 'true' : undefined, tabIndex: this.getTabIndex(item, index$1), disabled: item.disabled, onClick: () => this.handleItemClick(item), onKeyDown: e => this.handleKeyDown(e, item, index$1), onFocus: () => this.handleFocus(index$1), onBlur: this.handleBlur }, item.icon && (index.h("kritzel-icon", { name: item.icon, size: 20, class: "menu-item-icon" })), index.h("span", { class: "menu-item-label" }, item.label), index.h("span", { class: "menu-item-chevron", "aria-hidden": "true" }, index.h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }, index.h("path", { d: "m9 18 6-6-6-6" }))))))), index.h("div", { key: '642b65781509d192330bb2602dd081585d16f76d', id: panelId, class: "detail-panel", role: "tabpanel", "aria-labelledby": selectedTabId }, index.h("button", { key: '18a922dbaad63f05bc3ca7de176de4996b5d7fcb', class: "mobile-back-button", onClick: this.handleBackClick, "aria-label": "Back to menu" }, index.h("kritzel-icon", { key: 'b31732cef2ffdb78e67be7ab793aaaf60e373763', name: "chevron-left", size: 20, class: "mobile-back-icon" }), "Back"), index.h("slot", { key: '48fe4ae631a8c0b2db9e4a232edb6300d603562c' })))));
30612
+ }, role: "tab", "aria-selected": item.id === this.selectedItemId ? 'true' : 'false', "aria-controls": panelId, "aria-disabled": item.disabled ? 'true' : undefined, tabIndex: this.getTabIndex(item, index$1), disabled: item.disabled, onClick: () => this.handleItemClick(item), onKeyDown: e => this.handleKeyDown(e, item, index$1), onFocus: () => this.handleFocus(index$1), onBlur: this.handleBlur }, item.icon && (index.h("kritzel-icon", { name: item.icon, size: 20, class: "menu-item-icon" })), index.h("span", { class: "menu-item-label" }, item.label), index.h("span", { class: "menu-item-chevron", "aria-hidden": "true" }, index.h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }, index.h("path", { d: "m9 18 6-6-6-6" }))))))), index.h("div", { key: 'f8447facf3dfdbd7772823654847e1b90b03f73e', id: panelId, class: "detail-panel", role: "tabpanel", "aria-labelledby": selectedTabId }, index.h("button", { key: '3edc9784267613e6b3a706739bbb537161e4c747', class: "mobile-back-button", onClick: this.handleBackClick, "aria-label": "Back to menu" }, index.h("kritzel-icon", { key: 'ec0b4691735578525e5863842271366e04b13fb7', name: "chevron-left", size: 20, class: "mobile-back-icon" }), "Back"), index.h("slot", { key: 'c21fbaff78f98859b9756427125b60504d4bb630' })))));
30577
30613
  }
30578
30614
  static get watchers() { return {
30579
30615
  "selectedItemId": [{
@@ -30646,7 +30682,7 @@ const KritzelMenu = class {
30646
30682
  this.itemCloseChildMenu.emit(event.detail);
30647
30683
  };
30648
30684
  render() {
30649
- return (index.h(index.Host, { key: '6dfdc7928ae69aa191b2c64f9db79801e6978e92', tabIndex: 0, onClick: e => e.stopPropagation() }, this.openChildMenuItem && index.h("div", { key: 'ab8fa25f1b6ee0b7960cb0df84c40b1a7648c4e9', class: "has-open-child-overlay", onClick: this.onOverlayClick }), this.items.map(item => (index.h("kritzel-menu-item", { key: item.id, "data-testid": `menu-item-${item.id}`, item: item, parent: this.parent, style: { pointerEvents: this.editingMenuItem && !item.isEditing ? 'none' : 'auto' }, onItemSelect: this.handleItemSelect, onItemSave: this.handleSave, onItemCancel: this.handleCancel, onItemToggleChildMenu: this.handleToggleChildMenu, onItemCloseChildMenu: this.handleCloseChildMenu })))));
30685
+ return (index.h(index.Host, { key: '27a90a3a8549517a2d6e341a5da13496bf714970', tabIndex: 0, onClick: e => e.stopPropagation() }, this.openChildMenuItem && index.h("div", { key: 'c0c2351fac389f6676b38481eaacee553ca6867a', class: "has-open-child-overlay", onClick: this.onOverlayClick }), this.items.map(item => (index.h("kritzel-menu-item", { key: item.id, "data-testid": `menu-item-${item.id}`, item: item, parent: this.parent, style: { pointerEvents: this.editingMenuItem && !item.isEditing ? 'none' : 'auto' }, onItemSelect: this.handleItemSelect, onItemSave: this.handleSave, onItemCancel: this.handleCancel, onItemToggleChildMenu: this.handleToggleChildMenu, onItemCloseChildMenu: this.handleCloseChildMenu })))));
30650
30686
  }
30651
30687
  };
30652
30688
  KritzelMenu.style = kritzelMenuCss();
@@ -30751,12 +30787,12 @@ const KritzelMenuItem = class {
30751
30787
  ];
30752
30788
  }
30753
30789
  render() {
30754
- return (index.h(index.Host, { key: 'dbdcfcee7fd36fe0b9c405dd3d1641aa62465e53', tabIndex: this.item.isDisabled ? -1 : 0, class: {
30790
+ return (index.h(index.Host, { key: '9d6653a630da5a3da38291d89d6d7d59d6994e02', tabIndex: this.item.isDisabled ? -1 : 0, class: {
30755
30791
  'selected': this.item.isSelected,
30756
30792
  'editing': this.item.isEditing,
30757
30793
  'disabled': this.item.isDisabled,
30758
30794
  'child-open': this.item.isChildMenuOpen,
30759
- }, onClick: this.handleItemSelect }, index.h("div", { key: 'ef97c7cf48190c1bbdde0dd9011cc1d5674b7c94', class: "menu-item-overlay" }), this.item.isEditing ? this.renderEditMode() : this.renderViewMode()));
30795
+ }, onClick: this.handleItemSelect }, index.h("div", { key: '48a1678296e672c6c03fb3e1473c42d3a246d481', class: "menu-item-overlay" }), this.item.isEditing ? this.renderEditMode() : this.renderViewMode()));
30760
30796
  }
30761
30797
  static get watchers() { return {
30762
30798
  "item": [{
@@ -30829,7 +30865,7 @@ const KritzelMoreMenu = class {
30829
30865
  this.closeMenu();
30830
30866
  };
30831
30867
  render() {
30832
- return (index.h(index.Host, { key: '3e7179c87713cb0087d2d2053f97db8f603f7321', class: { mobile: this.isTouchDevice }, style: { display: this.visible ? '' : 'none' } }, index.h("div", { key: '23d6be1ec2c25cd0335c1134f18aad7d5be25c85', class: { 'more-menu-wrapper': true, visible: this.visible } }, index.h("button", { key: 'e3064ba3f7b4c20e8447e16327b73d0f47f3842b', class: "more-menu-button", "data-testid": "more-menu-button", onClick: this.toggleMenu, "aria-label": this.terms['moreMenu.ariaLabel'] ?? 'More options' }, index.h("kritzel-icon", { key: 'feed090efe4f80c62a29c8146c2d7d8041624381', name: this.icon, size: this.iconSize })), index.h("kritzel-portal", { key: '7b1a5db932c7bfb5ea8f4d666571c4f7fbbcd238', anchor: this.menuAnchor, offsetY: this.offsetY, onClose: this.closeMenu }, index.h("kritzel-menu", { key: '65b1225b15a494d49712ad1d2d108e90f09507e9', items: this.visibleItems, onItemSelect: this.handleMenuItemSelect })))));
30868
+ return (index.h(index.Host, { key: 'b7736b67210f2d2f6b54296dd680104548d61641', class: { mobile: this.isTouchDevice }, style: { display: this.visible ? '' : 'none' } }, index.h("div", { key: '076ecc02a1469bd87cb27f63f1d41183bedb11d4', class: { 'more-menu-wrapper': true, visible: this.visible } }, index.h("button", { key: 'cefe02e440391eb079af7b8accc367a291e93d6a', class: "more-menu-button", "data-testid": "more-menu-button", onClick: this.toggleMenu, "aria-label": this.terms['moreMenu.ariaLabel'] ?? 'More options' }, index.h("kritzel-icon", { key: 'cb6f4dd0f37ac0fbf1e1c28a0dc06e097e38ee00', name: this.icon, size: this.iconSize })), index.h("kritzel-portal", { key: '29099deb5b56b1a1388caa81a3c7104a05ad66a7', anchor: this.menuAnchor, offsetY: this.offsetY, onClose: this.closeMenu }, index.h("kritzel-menu", { key: 'b77286ec05add0a20bbc46f99ac7210395d0d33d', items: this.visibleItems, onItemSelect: this.handleMenuItemSelect })))));
30833
30869
  }
30834
30870
  };
30835
30871
  KritzelMoreMenu.style = kritzelMoreMenuCss();
@@ -30996,7 +31032,7 @@ const KritzelNumericInput = class {
30996
31032
  this.valueChange.emit(newValue);
30997
31033
  };
30998
31034
  render() {
30999
- return (index.h(index.Host, { key: '008f18fc5ab81adcd82364706ca7d4c39ea39d77' }, index.h("div", { key: '5d91b2ec6e0458d186d923c422e8f6461ac7c51a', class: "input-container" }, this.label && index.h("label", { key: '45c911f1e11ff8289ab876192511f506eb65c940', class: "input-label" }, this.label), index.h("div", { key: 'f5e0bd1610a4085a291cc1d32787b68066757c69', class: "input-wrapper" }, index.h("input", { key: '897b1af7725f59df86a530836dda802e8cb04038', type: "number", class: "numeric-input", title: "", min: this.min === Number.MIN_SAFE_INTEGER ? undefined : this.min, max: this.max === Number.MAX_SAFE_INTEGER ? undefined : this.max, step: this.step, value: this.inputValue, placeholder: this.placeholder, onInput: this.handleInput, onBlur: this.handleBlur, onKeyDown: this.handleKeyDown, onInvalid: this.handleInvalid }), index.h("div", { key: '1acab70c82ff7431f916685084a6e5dd827cdca3', class: "spinner-buttons" }, index.h("button", { key: 'd93c4bec338d49ead87897baf61d2e036999a035', type: "button", class: "spinner-button spinner-up", onClick: this.handleIncrement, tabIndex: -1, "aria-label": "Increase value" }, index.h("svg", { key: '1e52d43c1eb1e9a43025302a7cd1f3d74c038c36', viewBox: "0 0 10 6", class: "spinner-icon" }, index.h("path", { key: '2a96516390bd9caf5b6a3617d07f7b10e2b42451', d: "M1 5L5 1L9 5", stroke: "currentColor", "stroke-width": "1.5", fill: "none", "stroke-linecap": "round", "stroke-linejoin": "round" }))), index.h("button", { key: '038cf61f4b8982a17bf5c279d78556872a03efea', type: "button", class: "spinner-button spinner-down", onClick: this.handleDecrement, tabIndex: -1, "aria-label": "Decrease value" }, index.h("svg", { key: '30110c2ad975b51049a902953c52be66c1b7b0af', viewBox: "0 0 10 6", class: "spinner-icon" }, index.h("path", { key: '5abe735234debfa80a983d2fb60eeeaedb1dbf9b', d: "M1 1L5 5L9 1", stroke: "currentColor", "stroke-width": "1.5", fill: "none", "stroke-linecap": "round", "stroke-linejoin": "round" }))))))));
31035
+ return (index.h(index.Host, { key: '8901e0b56ccbc344420483a4a56663f7cd74d9e8' }, index.h("div", { key: '5f3d6b5c56007e11383aa69f60f22031b0e8f332', class: "input-container" }, this.label && index.h("label", { key: '2cb102a5b6c16d068f4f304fbcc6241f79fc0ce8', class: "input-label" }, this.label), index.h("div", { key: '96441095acc3d9a8e77b6d2bac2ceda683c9c976', class: "input-wrapper" }, index.h("input", { key: '523a5485111077e20faded235df6362e5ea9cfd4', type: "number", class: "numeric-input", title: "", min: this.min === Number.MIN_SAFE_INTEGER ? undefined : this.min, max: this.max === Number.MAX_SAFE_INTEGER ? undefined : this.max, step: this.step, value: this.inputValue, placeholder: this.placeholder, onInput: this.handleInput, onBlur: this.handleBlur, onKeyDown: this.handleKeyDown, onInvalid: this.handleInvalid }), index.h("div", { key: '2071e98125a8d014513e93052bd8c1fee17932a5', class: "spinner-buttons" }, index.h("button", { key: '12422e5285dfb532dbbb6eb1a36dbcb3de50f2bc', type: "button", class: "spinner-button spinner-up", onClick: this.handleIncrement, tabIndex: -1, "aria-label": "Increase value" }, index.h("svg", { key: '49ad5625c80fae6706ba4ab91f47bd550481ef74', viewBox: "0 0 10 6", class: "spinner-icon" }, index.h("path", { key: 'ff7d19b61baeb5ba58bb60f2cc629bcec6eb4411', d: "M1 5L5 1L9 5", stroke: "currentColor", "stroke-width": "1.5", fill: "none", "stroke-linecap": "round", "stroke-linejoin": "round" }))), index.h("button", { key: 'e4fec28e4fc997e007127f2b30b00cc752433221', type: "button", class: "spinner-button spinner-down", onClick: this.handleDecrement, tabIndex: -1, "aria-label": "Decrease value" }, index.h("svg", { key: '27bf06cde8de11f4a97090911afd6b8993463112', viewBox: "0 0 10 6", class: "spinner-icon" }, index.h("path", { key: 'ed7071dd79bfe509ebb319ce43ecb3e982dd4157', d: "M1 1L5 5L9 1", stroke: "currentColor", "stroke-width": "1.5", fill: "none", "stroke-linecap": "round", "stroke-linejoin": "round" }))))))));
31000
31036
  }
31001
31037
  static get watchers() { return {
31002
31038
  "value": [{
@@ -31035,7 +31071,7 @@ const KritzelOpacitySlider = class {
31035
31071
  }
31036
31072
  render() {
31037
31073
  const percentage = this.getPercentage();
31038
- return (index.h(index.Host, { key: 'e3a18981e5193ecd1ffaae5c807bdf6fa67e9695' }, index.h("div", { key: 'ee5ff0bb1355ca4f7e5d727ab8861933259c1a82', class: "opacity-container" }, index.h("div", { key: '6362fb3dba6910c55f5fe3b2a4245bcbb33dcdbb', class: "slider-wrapper" }, index.h("input", { key: 'f435f00fff7cc17ccdc181f39b29e032f6c5bf8d', type: "range", class: "opacity-slider", min: this.min, max: this.max, step: this.step, value: this.value, onInput: (e) => this.handleInput(e), style: {
31074
+ return (index.h(index.Host, { key: '2dadd8a7c4d1af748e91a6005433288ab231f2e8' }, index.h("div", { key: '65ae90d95bffff244d97329754cf0cb8f73331fa', class: "opacity-container" }, index.h("div", { key: '90e95347f7015882112f0653a25347e715233227', class: "slider-wrapper" }, index.h("input", { key: '15836bc089c1725062016677d3b95384d1958431', type: "range", class: "opacity-slider", min: this.min, max: this.max, step: this.step, value: this.value, onInput: (e) => this.handleInput(e), style: {
31039
31075
  '--slider-progress': `${percentage}%`,
31040
31076
  '--kritzel-opacity-slider-thumb-border-color': this.previewColor,
31041
31077
  } })))));
@@ -31043,7 +31079,7 @@ const KritzelOpacitySlider = class {
31043
31079
  };
31044
31080
  KritzelOpacitySlider.style = kritzelOpacitySliderCss();
31045
31081
 
31046
- const kritzelPillTabsCss = () => `:host{display:block}.pill-tabs-container{display:inline-flex;align-items:center;gap:4px;padding:4px;border-radius:var(--kritzel-pill-tabs-border-radius, 10px);background:var(--kritzel-pill-tabs-background, #f0f0f0);box-sizing:border-box}.pill-tab{display:flex;align-items:center;justify-content:center;gap:6px;padding:8px 16px;border:none;border-radius:var(--kritzel-pill-tabs-tab-border-radius, 8px);background:var(--kritzel-pill-tabs-tab-background, transparent);color:var(--kritzel-pill-tabs-tab-text-color, #666666);font-family:inherit;font-size:14px;font-weight:500;cursor:var(--kritzel-global-pointer-cursor, pointer);transition:background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;white-space:nowrap}.pill-tab:hover:not(.selected){background:var(--kritzel-pill-tabs-tab-background-hover, rgba(0, 0, 0, 0.05))}.pill-tab.selected{background:var(--kritzel-pill-tabs-tab-background-selected, #ffffff);color:var(--kritzel-pill-tabs-tab-text-color-selected, #000000);box-shadow:var(--kritzel-pill-tabs-tab-shadow-selected, 0 1px 3px rgba(0, 0, 0, 0.1))}.pill-tab:focus{outline:none}.pill-tab:focus-visible{box-shadow:0 0 0 2px var(--kritzel-global-focus-ring-color, rgba(0, 122, 255, 0.3))}.pill-tab-label{line-height:1}.pill-tab kritzel-icon{flex-shrink:0}`;
31082
+ const kritzelPillTabsCss = () => `:host{display:block;max-width:100%}.pill-tabs-container{display:inline-flex;align-items:center;gap:4px;padding:4px;max-width:100%;border-radius:var(--kritzel-pill-tabs-border-radius, 10px);background:var(--kritzel-pill-tabs-background, #f0f0f0);box-sizing:border-box}.pill-tab{display:flex;align-items:center;justify-content:center;gap:6px;min-width:0;max-width:100%;padding:8px 16px;border:none;border-radius:var(--kritzel-pill-tabs-tab-border-radius, 8px);background:var(--kritzel-pill-tabs-tab-background, transparent);color:var(--kritzel-pill-tabs-tab-text-color, #666666);font-family:inherit;font-size:14px;font-weight:500;cursor:var(--kritzel-global-pointer-cursor, pointer);transition:background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;white-space:nowrap}.pill-tab:hover:not(.selected){background:var(--kritzel-pill-tabs-tab-background-hover, rgba(0, 0, 0, 0.05))}.pill-tab.selected{background:var(--kritzel-pill-tabs-tab-background-selected, #ffffff);color:var(--kritzel-pill-tabs-tab-text-color-selected, #000000);box-shadow:var(--kritzel-pill-tabs-tab-shadow-selected, 0 1px 3px rgba(0, 0, 0, 0.1))}.pill-tab:focus{outline:none}.pill-tab:focus-visible{box-shadow:0 0 0 2px var(--kritzel-global-focus-ring-color, rgba(0, 122, 255, 0.3))}.pill-tab-label{display:block;min-width:0;max-width:var(--kritzel-pill-tabs-tab-label-max-width, 10rem);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1}.pill-tab kritzel-icon{flex-shrink:0}`;
31047
31083
 
31048
31084
  const KritzelPillTabs = class {
31049
31085
  constructor(hostRef) {
@@ -31388,7 +31424,7 @@ const KritzelPortal = class {
31388
31424
  this.portal.style.visibility = 'visible';
31389
31425
  }
31390
31426
  render() {
31391
- return (index.h(index.Host, { key: '95fbfde070f33a7f1b59026de7c687a2f6d0119c', style: { display: this.anchor ? 'block' : 'none' } }, index.h("slot", { key: '14af59a35c5caf71079f7afb5ea6f4c5f13b05f8' })));
31427
+ return (index.h(index.Host, { key: '72273b4c7811473072ee27668836a5ddddcfd618', style: { display: this.anchor ? 'block' : 'none' } }, index.h("slot", { key: 'b4f37ca27c47ab950a4639162fa31a3c2362d6f7' })));
31392
31428
  }
31393
31429
  static get watchers() { return {
31394
31430
  "anchor": [{
@@ -31402,7 +31438,7 @@ const KritzelPortal = class {
31402
31438
  * This file is auto-generated by the version bump scripts.
31403
31439
  * Do not modify manually.
31404
31440
  */
31405
- const KRITZEL_VERSION = '0.3.33';
31441
+ const KRITZEL_VERSION = '0.3.35';
31406
31442
 
31407
31443
  const kritzelSettingsCss = () => `:host{display:contents}kritzel-dialog{--kritzel-dialog-body-padding:0;--kritzel-dialog-width-large:800px;--kritzel-dialog-height-large:500px}.footer-button{padding:8px 16px;border-radius:6px;cursor:pointer;font-size:14px}.cancel-button{border:1px solid #ebebeb;background:#fff;color:inherit}.cancel-button:hover{background:#f5f5f5}.settings-content{padding:0}.settings-content h3{margin:0 0 16px 0;font-size:18px;font-weight:600;color:var(--kritzel-settings-content-heading-color, #333333)}.settings-content p{margin:0;font-size:14px;color:var(--kritzel-settings-content-text-color, #666666);line-height:1.5}.settings-group{display:flex;flex-direction:column;gap:24px}.settings-item{display:flex;flex-direction:column;gap:8px}.settings-row{display:flex;align-items:center;justify-content:space-between;gap:16px}.settings-label{font-size:14px;font-weight:600;color:var(--kritzel-settings-label-color, #333333);margin:0 0 4px 0}.settings-description{font-size:12px;color:var(--kritzel-settings-description-color, #888888);margin:0;line-height:1.4}.shortcuts-list{display:flex;flex-direction:column;gap:24px}.shortcuts-category{display:flex;flex-direction:column;gap:8px}.shortcuts-category-title{font-size:14px;font-weight:600;color:var(--kritzel-settings-label-color, #333333);margin:0 0 4px 0}.shortcuts-group{display:flex;flex-direction:column;gap:4px}.shortcut-item{display:flex;justify-content:space-between;align-items:center;padding:6px 8px;border-radius:4px;background:var(--kritzel-settings-shortcut-item-bg, rgba(0, 0, 0, 0.02))}.shortcut-label{font-size:14px;color:var(--kritzel-settings-content-text-color, #666666)}.shortcut-key{font-family:monospace;font-size:12px;padding:2px 8px;border-radius:4px;background:var(--kritzel-settings-shortcut-key-bg, #f0f0f0);color:var(--kritzel-settings-shortcut-key-color, #333333);border:1px solid var(--kritzel-settings-shortcut-key-border, #ddd)}`;
31408
31444
 
@@ -31627,7 +31663,7 @@ const KritzelSettings = class {
31627
31663
  }
31628
31664
  }
31629
31665
  render() {
31630
- return (index.h(index.Host, { key: '8b96261465efeabb2eb0cf724d29699de5e230a8' }, index.h("kritzel-dialog", { key: '273a9df290bb97d59000a97f91821e7bad3f3896', isOpen: this.isDialogOpen, dialogTitle: this.t('settings.dialogTitle', 'Settings'), size: "large", contained: true, onDialogClose: this.closeDialog }, index.h("kritzel-master-detail", { key: '64d17dfaa2a0baf2d4a5d00fe5fc65ad40c96ec6', items: this.categories, selectedItemId: this.selectedCategoryId, onItemSelect: this.handleCategorySelect }, this.renderCategoryContent()))));
31666
+ return (index.h(index.Host, { key: '7e65885051a30635291bb98fb87addf0bdbca8e8' }, index.h("kritzel-dialog", { key: 'c795bad227882904d8dda96768e8ccdd7c48df71', isOpen: this.isDialogOpen, dialogTitle: this.t('settings.dialogTitle', 'Settings'), size: "large", contained: true, onDialogClose: this.closeDialog }, index.h("kritzel-master-detail", { key: 'eff1486d14d4b55441b9a52b293da7459771331d', items: this.categories, selectedItemId: this.selectedCategoryId, onItemSelect: this.handleCategorySelect }, this.renderCategoryContent()))));
31631
31667
  }
31632
31668
  static get watchers() { return {
31633
31669
  "settings": [{
@@ -31671,7 +31707,3078 @@ const KritzelShapeFill = class {
31671
31707
  };
31672
31708
  KritzelShapeFill.style = kritzelShapeFillCss();
31673
31709
 
31674
- const kritzelShareDialogCss = () => `:host{display:contents}kritzel-dialog{--kritzel-dialog-width-small:420px}.share-content{display:flex;flex-direction:column;gap:20px}.share-section{display:flex;flex-direction:column;gap:8px}.share-section-revoke{padding-top:12px;border-top:1px solid var(--kritzel-share-dialog-border-color, #e5e5e5)}.share-row{display:flex;align-items:center;justify-content:space-between;gap:16px}.share-label-group{display:flex;flex-direction:column;gap:8px;flex:1}.share-label{font-size:14px;font-weight:600;color:var(--kritzel-share-dialog-label-color, #333333);margin:0}.share-description{font-size:12px;color:var(--kritzel-share-dialog-description-color, #666666);margin:0;line-height:1.4}.share-url-container{display:flex;align-items:center;gap:8px;background:var(--kritzel-share-dialog-input-background, #f5f5f5);border:1px solid var(--kritzel-share-dialog-input-border-color, #e0e0e0);border-radius:6px;padding:4px 4px 4px 12px}.share-url-input{flex:1;border:none;background:transparent;font-size:13px;color:var(--kritzel-share-dialog-input-text-color, #333333);outline:none;min-width:0;padding:8px 0}.share-url-input:focus{outline:none}.share-url-input::selection{background:var(--kritzel-share-dialog-selection-color, #cce5ff)}.copy-button{display:flex;align-items:center;justify-content:center;width:36px;height:36px;border:none;border-radius:4px;background:var(--kritzel-share-dialog-copy-button-background, #ffffff);color:var(--kritzel-share-dialog-copy-button-color, #666666);cursor:pointer;transition:all 0.15s ease;flex-shrink:0}.copy-button:hover{background:var(--kritzel-share-dialog-copy-button-hover-background, #e8e8e8);color:var(--kritzel-share-dialog-copy-button-hover-color, #333333)}.copy-button.copy-success{background:var(--kritzel-share-dialog-copy-success-background, #d4edda);color:var(--kritzel-share-dialog-copy-success-color, #28a745)}.revoke-button{align-self:flex-start;padding:8px 16px;border:1px solid var(--kritzel-share-dialog-revoke-button-border-color, #dc3545);border-radius:6px;background:transparent;color:var(--kritzel-share-dialog-revoke-button-color, #dc3545);font-size:13px;font-weight:500;cursor:pointer;transition:all 0.15s ease}.revoke-button:hover{background:var(--kritzel-share-dialog-revoke-button-hover-background, #dc3545);color:var(--kritzel-share-dialog-revoke-button-hover-color, #ffffff)}kritzel-dropdown{--kritzel-dropdown-trigger-padding:8px 12px;--kritzel-dropdown-trigger-font-size:13px}`;
31710
+ var browser = {};
31711
+
31712
+ var canPromise;
31713
+ var hasRequiredCanPromise;
31714
+
31715
+ function requireCanPromise () {
31716
+ if (hasRequiredCanPromise) return canPromise;
31717
+ hasRequiredCanPromise = 1;
31718
+ // can-promise has a crash in some versions of react native that dont have
31719
+ // standard global objects
31720
+ // https://github.com/soldair/node-qrcode/issues/157
31721
+
31722
+ canPromise = function () {
31723
+ return typeof Promise === 'function' && Promise.prototype && Promise.prototype.then
31724
+ };
31725
+ return canPromise;
31726
+ }
31727
+
31728
+ var qrcode = {};
31729
+
31730
+ var utils$1 = {};
31731
+
31732
+ var hasRequiredUtils$1;
31733
+
31734
+ function requireUtils$1 () {
31735
+ if (hasRequiredUtils$1) return utils$1;
31736
+ hasRequiredUtils$1 = 1;
31737
+ let toSJISFunction;
31738
+ const CODEWORDS_COUNT = [
31739
+ 0, // Not used
31740
+ 26, 44, 70, 100, 134, 172, 196, 242, 292, 346,
31741
+ 404, 466, 532, 581, 655, 733, 815, 901, 991, 1085,
31742
+ 1156, 1258, 1364, 1474, 1588, 1706, 1828, 1921, 2051, 2185,
31743
+ 2323, 2465, 2611, 2761, 2876, 3034, 3196, 3362, 3532, 3706
31744
+ ];
31745
+
31746
+ /**
31747
+ * Returns the QR Code size for the specified version
31748
+ *
31749
+ * @param {Number} version QR Code version
31750
+ * @return {Number} size of QR code
31751
+ */
31752
+ utils$1.getSymbolSize = function getSymbolSize (version) {
31753
+ if (!version) throw new Error('"version" cannot be null or undefined')
31754
+ if (version < 1 || version > 40) throw new Error('"version" should be in range from 1 to 40')
31755
+ return version * 4 + 17
31756
+ };
31757
+
31758
+ /**
31759
+ * Returns the total number of codewords used to store data and EC information.
31760
+ *
31761
+ * @param {Number} version QR Code version
31762
+ * @return {Number} Data length in bits
31763
+ */
31764
+ utils$1.getSymbolTotalCodewords = function getSymbolTotalCodewords (version) {
31765
+ return CODEWORDS_COUNT[version]
31766
+ };
31767
+
31768
+ /**
31769
+ * Encode data with Bose-Chaudhuri-Hocquenghem
31770
+ *
31771
+ * @param {Number} data Value to encode
31772
+ * @return {Number} Encoded value
31773
+ */
31774
+ utils$1.getBCHDigit = function (data) {
31775
+ let digit = 0;
31776
+
31777
+ while (data !== 0) {
31778
+ digit++;
31779
+ data >>>= 1;
31780
+ }
31781
+
31782
+ return digit
31783
+ };
31784
+
31785
+ utils$1.setToSJISFunction = function setToSJISFunction (f) {
31786
+ if (typeof f !== 'function') {
31787
+ throw new Error('"toSJISFunc" is not a valid function.')
31788
+ }
31789
+
31790
+ toSJISFunction = f;
31791
+ };
31792
+
31793
+ utils$1.isKanjiModeEnabled = function () {
31794
+ return typeof toSJISFunction !== 'undefined'
31795
+ };
31796
+
31797
+ utils$1.toSJIS = function toSJIS (kanji) {
31798
+ return toSJISFunction(kanji)
31799
+ };
31800
+ return utils$1;
31801
+ }
31802
+
31803
+ var errorCorrectionLevel = {};
31804
+
31805
+ var hasRequiredErrorCorrectionLevel;
31806
+
31807
+ function requireErrorCorrectionLevel () {
31808
+ if (hasRequiredErrorCorrectionLevel) return errorCorrectionLevel;
31809
+ hasRequiredErrorCorrectionLevel = 1;
31810
+ (function (exports) {
31811
+ exports.L = { bit: 1 };
31812
+ exports.M = { bit: 0 };
31813
+ exports.Q = { bit: 3 };
31814
+ exports.H = { bit: 2 };
31815
+
31816
+ function fromString (string) {
31817
+ if (typeof string !== 'string') {
31818
+ throw new Error('Param is not a string')
31819
+ }
31820
+
31821
+ const lcStr = string.toLowerCase();
31822
+
31823
+ switch (lcStr) {
31824
+ case 'l':
31825
+ case 'low':
31826
+ return exports.L
31827
+
31828
+ case 'm':
31829
+ case 'medium':
31830
+ return exports.M
31831
+
31832
+ case 'q':
31833
+ case 'quartile':
31834
+ return exports.Q
31835
+
31836
+ case 'h':
31837
+ case 'high':
31838
+ return exports.H
31839
+
31840
+ default:
31841
+ throw new Error('Unknown EC Level: ' + string)
31842
+ }
31843
+ }
31844
+
31845
+ exports.isValid = function isValid (level) {
31846
+ return level && typeof level.bit !== 'undefined' &&
31847
+ level.bit >= 0 && level.bit < 4
31848
+ };
31849
+
31850
+ exports.from = function from (value, defaultValue) {
31851
+ if (exports.isValid(value)) {
31852
+ return value
31853
+ }
31854
+
31855
+ try {
31856
+ return fromString(value)
31857
+ } catch (e) {
31858
+ return defaultValue
31859
+ }
31860
+ };
31861
+ } (errorCorrectionLevel));
31862
+ return errorCorrectionLevel;
31863
+ }
31864
+
31865
+ var bitBuffer;
31866
+ var hasRequiredBitBuffer;
31867
+
31868
+ function requireBitBuffer () {
31869
+ if (hasRequiredBitBuffer) return bitBuffer;
31870
+ hasRequiredBitBuffer = 1;
31871
+ function BitBuffer () {
31872
+ this.buffer = [];
31873
+ this.length = 0;
31874
+ }
31875
+
31876
+ BitBuffer.prototype = {
31877
+
31878
+ get: function (index) {
31879
+ const bufIndex = Math.floor(index / 8);
31880
+ return ((this.buffer[bufIndex] >>> (7 - index % 8)) & 1) === 1
31881
+ },
31882
+
31883
+ put: function (num, length) {
31884
+ for (let i = 0; i < length; i++) {
31885
+ this.putBit(((num >>> (length - i - 1)) & 1) === 1);
31886
+ }
31887
+ },
31888
+
31889
+ getLengthInBits: function () {
31890
+ return this.length
31891
+ },
31892
+
31893
+ putBit: function (bit) {
31894
+ const bufIndex = Math.floor(this.length / 8);
31895
+ if (this.buffer.length <= bufIndex) {
31896
+ this.buffer.push(0);
31897
+ }
31898
+
31899
+ if (bit) {
31900
+ this.buffer[bufIndex] |= (0x80 >>> (this.length % 8));
31901
+ }
31902
+
31903
+ this.length++;
31904
+ }
31905
+ };
31906
+
31907
+ bitBuffer = BitBuffer;
31908
+ return bitBuffer;
31909
+ }
31910
+
31911
+ /**
31912
+ * Helper class to handle QR Code symbol modules
31913
+ *
31914
+ * @param {Number} size Symbol size
31915
+ */
31916
+
31917
+ var bitMatrix;
31918
+ var hasRequiredBitMatrix;
31919
+
31920
+ function requireBitMatrix () {
31921
+ if (hasRequiredBitMatrix) return bitMatrix;
31922
+ hasRequiredBitMatrix = 1;
31923
+ function BitMatrix (size) {
31924
+ if (!size || size < 1) {
31925
+ throw new Error('BitMatrix size must be defined and greater than 0')
31926
+ }
31927
+
31928
+ this.size = size;
31929
+ this.data = new Uint8Array(size * size);
31930
+ this.reservedBit = new Uint8Array(size * size);
31931
+ }
31932
+
31933
+ /**
31934
+ * Set bit value at specified location
31935
+ * If reserved flag is set, this bit will be ignored during masking process
31936
+ *
31937
+ * @param {Number} row
31938
+ * @param {Number} col
31939
+ * @param {Boolean} value
31940
+ * @param {Boolean} reserved
31941
+ */
31942
+ BitMatrix.prototype.set = function (row, col, value, reserved) {
31943
+ const index = row * this.size + col;
31944
+ this.data[index] = value;
31945
+ if (reserved) this.reservedBit[index] = true;
31946
+ };
31947
+
31948
+ /**
31949
+ * Returns bit value at specified location
31950
+ *
31951
+ * @param {Number} row
31952
+ * @param {Number} col
31953
+ * @return {Boolean}
31954
+ */
31955
+ BitMatrix.prototype.get = function (row, col) {
31956
+ return this.data[row * this.size + col]
31957
+ };
31958
+
31959
+ /**
31960
+ * Applies xor operator at specified location
31961
+ * (used during masking process)
31962
+ *
31963
+ * @param {Number} row
31964
+ * @param {Number} col
31965
+ * @param {Boolean} value
31966
+ */
31967
+ BitMatrix.prototype.xor = function (row, col, value) {
31968
+ this.data[row * this.size + col] ^= value;
31969
+ };
31970
+
31971
+ /**
31972
+ * Check if bit at specified location is reserved
31973
+ *
31974
+ * @param {Number} row
31975
+ * @param {Number} col
31976
+ * @return {Boolean}
31977
+ */
31978
+ BitMatrix.prototype.isReserved = function (row, col) {
31979
+ return this.reservedBit[row * this.size + col]
31980
+ };
31981
+
31982
+ bitMatrix = BitMatrix;
31983
+ return bitMatrix;
31984
+ }
31985
+
31986
+ var alignmentPattern = {};
31987
+
31988
+ /**
31989
+ * Alignment pattern are fixed reference pattern in defined positions
31990
+ * in a matrix symbology, which enables the decode software to re-synchronise
31991
+ * the coordinate mapping of the image modules in the event of moderate amounts
31992
+ * of distortion of the image.
31993
+ *
31994
+ * Alignment patterns are present only in QR Code symbols of version 2 or larger
31995
+ * and their number depends on the symbol version.
31996
+ */
31997
+
31998
+ var hasRequiredAlignmentPattern;
31999
+
32000
+ function requireAlignmentPattern () {
32001
+ if (hasRequiredAlignmentPattern) return alignmentPattern;
32002
+ hasRequiredAlignmentPattern = 1;
32003
+ (function (exports) {
32004
+ const getSymbolSize = requireUtils$1().getSymbolSize;
32005
+
32006
+ /**
32007
+ * Calculate the row/column coordinates of the center module of each alignment pattern
32008
+ * for the specified QR Code version.
32009
+ *
32010
+ * The alignment patterns are positioned symmetrically on either side of the diagonal
32011
+ * running from the top left corner of the symbol to the bottom right corner.
32012
+ *
32013
+ * Since positions are simmetrical only half of the coordinates are returned.
32014
+ * Each item of the array will represent in turn the x and y coordinate.
32015
+ * @see {@link getPositions}
32016
+ *
32017
+ * @param {Number} version QR Code version
32018
+ * @return {Array} Array of coordinate
32019
+ */
32020
+ exports.getRowColCoords = function getRowColCoords (version) {
32021
+ if (version === 1) return []
32022
+
32023
+ const posCount = Math.floor(version / 7) + 2;
32024
+ const size = getSymbolSize(version);
32025
+ const intervals = size === 145 ? 26 : Math.ceil((size - 13) / (2 * posCount - 2)) * 2;
32026
+ const positions = [size - 7]; // Last coord is always (size - 7)
32027
+
32028
+ for (let i = 1; i < posCount - 1; i++) {
32029
+ positions[i] = positions[i - 1] - intervals;
32030
+ }
32031
+
32032
+ positions.push(6); // First coord is always 6
32033
+
32034
+ return positions.reverse()
32035
+ };
32036
+
32037
+ /**
32038
+ * Returns an array containing the positions of each alignment pattern.
32039
+ * Each array's element represent the center point of the pattern as (x, y) coordinates
32040
+ *
32041
+ * Coordinates are calculated expanding the row/column coordinates returned by {@link getRowColCoords}
32042
+ * and filtering out the items that overlaps with finder pattern
32043
+ *
32044
+ * @example
32045
+ * For a Version 7 symbol {@link getRowColCoords} returns values 6, 22 and 38.
32046
+ * The alignment patterns, therefore, are to be centered on (row, column)
32047
+ * positions (6,22), (22,6), (22,22), (22,38), (38,22), (38,38).
32048
+ * Note that the coordinates (6,6), (6,38), (38,6) are occupied by finder patterns
32049
+ * and are not therefore used for alignment patterns.
32050
+ *
32051
+ * let pos = getPositions(7)
32052
+ * // [[6,22], [22,6], [22,22], [22,38], [38,22], [38,38]]
32053
+ *
32054
+ * @param {Number} version QR Code version
32055
+ * @return {Array} Array of coordinates
32056
+ */
32057
+ exports.getPositions = function getPositions (version) {
32058
+ const coords = [];
32059
+ const pos = exports.getRowColCoords(version);
32060
+ const posLength = pos.length;
32061
+
32062
+ for (let i = 0; i < posLength; i++) {
32063
+ for (let j = 0; j < posLength; j++) {
32064
+ // Skip if position is occupied by finder patterns
32065
+ if ((i === 0 && j === 0) || // top-left
32066
+ (i === 0 && j === posLength - 1) || // bottom-left
32067
+ (i === posLength - 1 && j === 0)) { // top-right
32068
+ continue
32069
+ }
32070
+
32071
+ coords.push([pos[i], pos[j]]);
32072
+ }
32073
+ }
32074
+
32075
+ return coords
32076
+ };
32077
+ } (alignmentPattern));
32078
+ return alignmentPattern;
32079
+ }
32080
+
32081
+ var finderPattern = {};
32082
+
32083
+ var hasRequiredFinderPattern;
32084
+
32085
+ function requireFinderPattern () {
32086
+ if (hasRequiredFinderPattern) return finderPattern;
32087
+ hasRequiredFinderPattern = 1;
32088
+ const getSymbolSize = requireUtils$1().getSymbolSize;
32089
+ const FINDER_PATTERN_SIZE = 7;
32090
+
32091
+ /**
32092
+ * Returns an array containing the positions of each finder pattern.
32093
+ * Each array's element represent the top-left point of the pattern as (x, y) coordinates
32094
+ *
32095
+ * @param {Number} version QR Code version
32096
+ * @return {Array} Array of coordinates
32097
+ */
32098
+ finderPattern.getPositions = function getPositions (version) {
32099
+ const size = getSymbolSize(version);
32100
+
32101
+ return [
32102
+ // top-left
32103
+ [0, 0],
32104
+ // top-right
32105
+ [size - FINDER_PATTERN_SIZE, 0],
32106
+ // bottom-left
32107
+ [0, size - FINDER_PATTERN_SIZE]
32108
+ ]
32109
+ };
32110
+ return finderPattern;
32111
+ }
32112
+
32113
+ var maskPattern = {};
32114
+
32115
+ /**
32116
+ * Data mask pattern reference
32117
+ * @type {Object}
32118
+ */
32119
+
32120
+ var hasRequiredMaskPattern;
32121
+
32122
+ function requireMaskPattern () {
32123
+ if (hasRequiredMaskPattern) return maskPattern;
32124
+ hasRequiredMaskPattern = 1;
32125
+ (function (exports) {
32126
+ exports.Patterns = {
32127
+ PATTERN000: 0,
32128
+ PATTERN001: 1,
32129
+ PATTERN010: 2,
32130
+ PATTERN011: 3,
32131
+ PATTERN100: 4,
32132
+ PATTERN101: 5,
32133
+ PATTERN110: 6,
32134
+ PATTERN111: 7
32135
+ };
32136
+
32137
+ /**
32138
+ * Weighted penalty scores for the undesirable features
32139
+ * @type {Object}
32140
+ */
32141
+ const PenaltyScores = {
32142
+ N1: 3,
32143
+ N2: 3,
32144
+ N3: 40,
32145
+ N4: 10
32146
+ };
32147
+
32148
+ /**
32149
+ * Check if mask pattern value is valid
32150
+ *
32151
+ * @param {Number} mask Mask pattern
32152
+ * @return {Boolean} true if valid, false otherwise
32153
+ */
32154
+ exports.isValid = function isValid (mask) {
32155
+ return mask != null && mask !== '' && !isNaN(mask) && mask >= 0 && mask <= 7
32156
+ };
32157
+
32158
+ /**
32159
+ * Returns mask pattern from a value.
32160
+ * If value is not valid, returns undefined
32161
+ *
32162
+ * @param {Number|String} value Mask pattern value
32163
+ * @return {Number} Valid mask pattern or undefined
32164
+ */
32165
+ exports.from = function from (value) {
32166
+ return exports.isValid(value) ? parseInt(value, 10) : undefined
32167
+ };
32168
+
32169
+ /**
32170
+ * Find adjacent modules in row/column with the same color
32171
+ * and assign a penalty value.
32172
+ *
32173
+ * Points: N1 + i
32174
+ * i is the amount by which the number of adjacent modules of the same color exceeds 5
32175
+ */
32176
+ exports.getPenaltyN1 = function getPenaltyN1 (data) {
32177
+ const size = data.size;
32178
+ let points = 0;
32179
+ let sameCountCol = 0;
32180
+ let sameCountRow = 0;
32181
+ let lastCol = null;
32182
+ let lastRow = null;
32183
+
32184
+ for (let row = 0; row < size; row++) {
32185
+ sameCountCol = sameCountRow = 0;
32186
+ lastCol = lastRow = null;
32187
+
32188
+ for (let col = 0; col < size; col++) {
32189
+ let module = data.get(row, col);
32190
+ if (module === lastCol) {
32191
+ sameCountCol++;
32192
+ } else {
32193
+ if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5);
32194
+ lastCol = module;
32195
+ sameCountCol = 1;
32196
+ }
32197
+
32198
+ module = data.get(col, row);
32199
+ if (module === lastRow) {
32200
+ sameCountRow++;
32201
+ } else {
32202
+ if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5);
32203
+ lastRow = module;
32204
+ sameCountRow = 1;
32205
+ }
32206
+ }
32207
+
32208
+ if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5);
32209
+ if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5);
32210
+ }
32211
+
32212
+ return points
32213
+ };
32214
+
32215
+ /**
32216
+ * Find 2x2 blocks with the same color and assign a penalty value
32217
+ *
32218
+ * Points: N2 * (m - 1) * (n - 1)
32219
+ */
32220
+ exports.getPenaltyN2 = function getPenaltyN2 (data) {
32221
+ const size = data.size;
32222
+ let points = 0;
32223
+
32224
+ for (let row = 0; row < size - 1; row++) {
32225
+ for (let col = 0; col < size - 1; col++) {
32226
+ const last = data.get(row, col) +
32227
+ data.get(row, col + 1) +
32228
+ data.get(row + 1, col) +
32229
+ data.get(row + 1, col + 1);
32230
+
32231
+ if (last === 4 || last === 0) points++;
32232
+ }
32233
+ }
32234
+
32235
+ return points * PenaltyScores.N2
32236
+ };
32237
+
32238
+ /**
32239
+ * Find 1:1:3:1:1 ratio (dark:light:dark:light:dark) pattern in row/column,
32240
+ * preceded or followed by light area 4 modules wide
32241
+ *
32242
+ * Points: N3 * number of pattern found
32243
+ */
32244
+ exports.getPenaltyN3 = function getPenaltyN3 (data) {
32245
+ const size = data.size;
32246
+ let points = 0;
32247
+ let bitsCol = 0;
32248
+ let bitsRow = 0;
32249
+
32250
+ for (let row = 0; row < size; row++) {
32251
+ bitsCol = bitsRow = 0;
32252
+ for (let col = 0; col < size; col++) {
32253
+ bitsCol = ((bitsCol << 1) & 0x7FF) | data.get(row, col);
32254
+ if (col >= 10 && (bitsCol === 0x5D0 || bitsCol === 0x05D)) points++;
32255
+
32256
+ bitsRow = ((bitsRow << 1) & 0x7FF) | data.get(col, row);
32257
+ if (col >= 10 && (bitsRow === 0x5D0 || bitsRow === 0x05D)) points++;
32258
+ }
32259
+ }
32260
+
32261
+ return points * PenaltyScores.N3
32262
+ };
32263
+
32264
+ /**
32265
+ * Calculate proportion of dark modules in entire symbol
32266
+ *
32267
+ * Points: N4 * k
32268
+ *
32269
+ * k is the rating of the deviation of the proportion of dark modules
32270
+ * in the symbol from 50% in steps of 5%
32271
+ */
32272
+ exports.getPenaltyN4 = function getPenaltyN4 (data) {
32273
+ let darkCount = 0;
32274
+ const modulesCount = data.data.length;
32275
+
32276
+ for (let i = 0; i < modulesCount; i++) darkCount += data.data[i];
32277
+
32278
+ const k = Math.abs(Math.ceil((darkCount * 100 / modulesCount) / 5) - 10);
32279
+
32280
+ return k * PenaltyScores.N4
32281
+ };
32282
+
32283
+ /**
32284
+ * Return mask value at given position
32285
+ *
32286
+ * @param {Number} maskPattern Pattern reference value
32287
+ * @param {Number} i Row
32288
+ * @param {Number} j Column
32289
+ * @return {Boolean} Mask value
32290
+ */
32291
+ function getMaskAt (maskPattern, i, j) {
32292
+ switch (maskPattern) {
32293
+ case exports.Patterns.PATTERN000: return (i + j) % 2 === 0
32294
+ case exports.Patterns.PATTERN001: return i % 2 === 0
32295
+ case exports.Patterns.PATTERN010: return j % 3 === 0
32296
+ case exports.Patterns.PATTERN011: return (i + j) % 3 === 0
32297
+ case exports.Patterns.PATTERN100: return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 === 0
32298
+ case exports.Patterns.PATTERN101: return (i * j) % 2 + (i * j) % 3 === 0
32299
+ case exports.Patterns.PATTERN110: return ((i * j) % 2 + (i * j) % 3) % 2 === 0
32300
+ case exports.Patterns.PATTERN111: return ((i * j) % 3 + (i + j) % 2) % 2 === 0
32301
+
32302
+ default: throw new Error('bad maskPattern:' + maskPattern)
32303
+ }
32304
+ }
32305
+
32306
+ /**
32307
+ * Apply a mask pattern to a BitMatrix
32308
+ *
32309
+ * @param {Number} pattern Pattern reference number
32310
+ * @param {BitMatrix} data BitMatrix data
32311
+ */
32312
+ exports.applyMask = function applyMask (pattern, data) {
32313
+ const size = data.size;
32314
+
32315
+ for (let col = 0; col < size; col++) {
32316
+ for (let row = 0; row < size; row++) {
32317
+ if (data.isReserved(row, col)) continue
32318
+ data.xor(row, col, getMaskAt(pattern, row, col));
32319
+ }
32320
+ }
32321
+ };
32322
+
32323
+ /**
32324
+ * Returns the best mask pattern for data
32325
+ *
32326
+ * @param {BitMatrix} data
32327
+ * @return {Number} Mask pattern reference number
32328
+ */
32329
+ exports.getBestMask = function getBestMask (data, setupFormatFunc) {
32330
+ const numPatterns = Object.keys(exports.Patterns).length;
32331
+ let bestPattern = 0;
32332
+ let lowerPenalty = Infinity;
32333
+
32334
+ for (let p = 0; p < numPatterns; p++) {
32335
+ setupFormatFunc(p);
32336
+ exports.applyMask(p, data);
32337
+
32338
+ // Calculate penalty
32339
+ const penalty =
32340
+ exports.getPenaltyN1(data) +
32341
+ exports.getPenaltyN2(data) +
32342
+ exports.getPenaltyN3(data) +
32343
+ exports.getPenaltyN4(data);
32344
+
32345
+ // Undo previously applied mask
32346
+ exports.applyMask(p, data);
32347
+
32348
+ if (penalty < lowerPenalty) {
32349
+ lowerPenalty = penalty;
32350
+ bestPattern = p;
32351
+ }
32352
+ }
32353
+
32354
+ return bestPattern
32355
+ };
32356
+ } (maskPattern));
32357
+ return maskPattern;
32358
+ }
32359
+
32360
+ var errorCorrectionCode = {};
32361
+
32362
+ var hasRequiredErrorCorrectionCode;
32363
+
32364
+ function requireErrorCorrectionCode () {
32365
+ if (hasRequiredErrorCorrectionCode) return errorCorrectionCode;
32366
+ hasRequiredErrorCorrectionCode = 1;
32367
+ const ECLevel = requireErrorCorrectionLevel();
32368
+
32369
+ const EC_BLOCKS_TABLE = [
32370
+ // L M Q H
32371
+ 1, 1, 1, 1,
32372
+ 1, 1, 1, 1,
32373
+ 1, 1, 2, 2,
32374
+ 1, 2, 2, 4,
32375
+ 1, 2, 4, 4,
32376
+ 2, 4, 4, 4,
32377
+ 2, 4, 6, 5,
32378
+ 2, 4, 6, 6,
32379
+ 2, 5, 8, 8,
32380
+ 4, 5, 8, 8,
32381
+ 4, 5, 8, 11,
32382
+ 4, 8, 10, 11,
32383
+ 4, 9, 12, 16,
32384
+ 4, 9, 16, 16,
32385
+ 6, 10, 12, 18,
32386
+ 6, 10, 17, 16,
32387
+ 6, 11, 16, 19,
32388
+ 6, 13, 18, 21,
32389
+ 7, 14, 21, 25,
32390
+ 8, 16, 20, 25,
32391
+ 8, 17, 23, 25,
32392
+ 9, 17, 23, 34,
32393
+ 9, 18, 25, 30,
32394
+ 10, 20, 27, 32,
32395
+ 12, 21, 29, 35,
32396
+ 12, 23, 34, 37,
32397
+ 12, 25, 34, 40,
32398
+ 13, 26, 35, 42,
32399
+ 14, 28, 38, 45,
32400
+ 15, 29, 40, 48,
32401
+ 16, 31, 43, 51,
32402
+ 17, 33, 45, 54,
32403
+ 18, 35, 48, 57,
32404
+ 19, 37, 51, 60,
32405
+ 19, 38, 53, 63,
32406
+ 20, 40, 56, 66,
32407
+ 21, 43, 59, 70,
32408
+ 22, 45, 62, 74,
32409
+ 24, 47, 65, 77,
32410
+ 25, 49, 68, 81
32411
+ ];
32412
+
32413
+ const EC_CODEWORDS_TABLE = [
32414
+ // L M Q H
32415
+ 7, 10, 13, 17,
32416
+ 10, 16, 22, 28,
32417
+ 15, 26, 36, 44,
32418
+ 20, 36, 52, 64,
32419
+ 26, 48, 72, 88,
32420
+ 36, 64, 96, 112,
32421
+ 40, 72, 108, 130,
32422
+ 48, 88, 132, 156,
32423
+ 60, 110, 160, 192,
32424
+ 72, 130, 192, 224,
32425
+ 80, 150, 224, 264,
32426
+ 96, 176, 260, 308,
32427
+ 104, 198, 288, 352,
32428
+ 120, 216, 320, 384,
32429
+ 132, 240, 360, 432,
32430
+ 144, 280, 408, 480,
32431
+ 168, 308, 448, 532,
32432
+ 180, 338, 504, 588,
32433
+ 196, 364, 546, 650,
32434
+ 224, 416, 600, 700,
32435
+ 224, 442, 644, 750,
32436
+ 252, 476, 690, 816,
32437
+ 270, 504, 750, 900,
32438
+ 300, 560, 810, 960,
32439
+ 312, 588, 870, 1050,
32440
+ 336, 644, 952, 1110,
32441
+ 360, 700, 1020, 1200,
32442
+ 390, 728, 1050, 1260,
32443
+ 420, 784, 1140, 1350,
32444
+ 450, 812, 1200, 1440,
32445
+ 480, 868, 1290, 1530,
32446
+ 510, 924, 1350, 1620,
32447
+ 540, 980, 1440, 1710,
32448
+ 570, 1036, 1530, 1800,
32449
+ 570, 1064, 1590, 1890,
32450
+ 600, 1120, 1680, 1980,
32451
+ 630, 1204, 1770, 2100,
32452
+ 660, 1260, 1860, 2220,
32453
+ 720, 1316, 1950, 2310,
32454
+ 750, 1372, 2040, 2430
32455
+ ];
32456
+
32457
+ /**
32458
+ * Returns the number of error correction block that the QR Code should contain
32459
+ * for the specified version and error correction level.
32460
+ *
32461
+ * @param {Number} version QR Code version
32462
+ * @param {Number} errorCorrectionLevel Error correction level
32463
+ * @return {Number} Number of error correction blocks
32464
+ */
32465
+ errorCorrectionCode.getBlocksCount = function getBlocksCount (version, errorCorrectionLevel) {
32466
+ switch (errorCorrectionLevel) {
32467
+ case ECLevel.L:
32468
+ return EC_BLOCKS_TABLE[(version - 1) * 4 + 0]
32469
+ case ECLevel.M:
32470
+ return EC_BLOCKS_TABLE[(version - 1) * 4 + 1]
32471
+ case ECLevel.Q:
32472
+ return EC_BLOCKS_TABLE[(version - 1) * 4 + 2]
32473
+ case ECLevel.H:
32474
+ return EC_BLOCKS_TABLE[(version - 1) * 4 + 3]
32475
+ default:
32476
+ return undefined
32477
+ }
32478
+ };
32479
+
32480
+ /**
32481
+ * Returns the number of error correction codewords to use for the specified
32482
+ * version and error correction level.
32483
+ *
32484
+ * @param {Number} version QR Code version
32485
+ * @param {Number} errorCorrectionLevel Error correction level
32486
+ * @return {Number} Number of error correction codewords
32487
+ */
32488
+ errorCorrectionCode.getTotalCodewordsCount = function getTotalCodewordsCount (version, errorCorrectionLevel) {
32489
+ switch (errorCorrectionLevel) {
32490
+ case ECLevel.L:
32491
+ return EC_CODEWORDS_TABLE[(version - 1) * 4 + 0]
32492
+ case ECLevel.M:
32493
+ return EC_CODEWORDS_TABLE[(version - 1) * 4 + 1]
32494
+ case ECLevel.Q:
32495
+ return EC_CODEWORDS_TABLE[(version - 1) * 4 + 2]
32496
+ case ECLevel.H:
32497
+ return EC_CODEWORDS_TABLE[(version - 1) * 4 + 3]
32498
+ default:
32499
+ return undefined
32500
+ }
32501
+ };
32502
+ return errorCorrectionCode;
32503
+ }
32504
+
32505
+ var polynomial = {};
32506
+
32507
+ var galoisField = {};
32508
+
32509
+ var hasRequiredGaloisField;
32510
+
32511
+ function requireGaloisField () {
32512
+ if (hasRequiredGaloisField) return galoisField;
32513
+ hasRequiredGaloisField = 1;
32514
+ const EXP_TABLE = new Uint8Array(512);
32515
+ const LOG_TABLE = new Uint8Array(256)
32516
+ /**
32517
+ * Precompute the log and anti-log tables for faster computation later
32518
+ *
32519
+ * For each possible value in the galois field 2^8, we will pre-compute
32520
+ * the logarithm and anti-logarithm (exponential) of this value
32521
+ *
32522
+ * ref {@link https://en.wikiversity.org/wiki/Reed%E2%80%93Solomon_codes_for_coders#Introduction_to_mathematical_fields}
32523
+ */
32524
+ ;(function initTables () {
32525
+ let x = 1;
32526
+ for (let i = 0; i < 255; i++) {
32527
+ EXP_TABLE[i] = x;
32528
+ LOG_TABLE[x] = i;
32529
+
32530
+ x <<= 1; // multiply by 2
32531
+
32532
+ // The QR code specification says to use byte-wise modulo 100011101 arithmetic.
32533
+ // This means that when a number is 256 or larger, it should be XORed with 0x11D.
32534
+ if (x & 0x100) { // similar to x >= 256, but a lot faster (because 0x100 == 256)
32535
+ x ^= 0x11D;
32536
+ }
32537
+ }
32538
+
32539
+ // Optimization: double the size of the anti-log table so that we don't need to mod 255 to
32540
+ // stay inside the bounds (because we will mainly use this table for the multiplication of
32541
+ // two GF numbers, no more).
32542
+ // @see {@link mul}
32543
+ for (let i = 255; i < 512; i++) {
32544
+ EXP_TABLE[i] = EXP_TABLE[i - 255];
32545
+ }
32546
+ }());
32547
+
32548
+ /**
32549
+ * Returns log value of n inside Galois Field
32550
+ *
32551
+ * @param {Number} n
32552
+ * @return {Number}
32553
+ */
32554
+ galoisField.log = function log (n) {
32555
+ if (n < 1) throw new Error('log(' + n + ')')
32556
+ return LOG_TABLE[n]
32557
+ };
32558
+
32559
+ /**
32560
+ * Returns anti-log value of n inside Galois Field
32561
+ *
32562
+ * @param {Number} n
32563
+ * @return {Number}
32564
+ */
32565
+ galoisField.exp = function exp (n) {
32566
+ return EXP_TABLE[n]
32567
+ };
32568
+
32569
+ /**
32570
+ * Multiplies two number inside Galois Field
32571
+ *
32572
+ * @param {Number} x
32573
+ * @param {Number} y
32574
+ * @return {Number}
32575
+ */
32576
+ galoisField.mul = function mul (x, y) {
32577
+ if (x === 0 || y === 0) return 0
32578
+
32579
+ // should be EXP_TABLE[(LOG_TABLE[x] + LOG_TABLE[y]) % 255] if EXP_TABLE wasn't oversized
32580
+ // @see {@link initTables}
32581
+ return EXP_TABLE[LOG_TABLE[x] + LOG_TABLE[y]]
32582
+ };
32583
+ return galoisField;
32584
+ }
32585
+
32586
+ var hasRequiredPolynomial;
32587
+
32588
+ function requirePolynomial () {
32589
+ if (hasRequiredPolynomial) return polynomial;
32590
+ hasRequiredPolynomial = 1;
32591
+ (function (exports) {
32592
+ const GF = requireGaloisField();
32593
+
32594
+ /**
32595
+ * Multiplies two polynomials inside Galois Field
32596
+ *
32597
+ * @param {Uint8Array} p1 Polynomial
32598
+ * @param {Uint8Array} p2 Polynomial
32599
+ * @return {Uint8Array} Product of p1 and p2
32600
+ */
32601
+ exports.mul = function mul (p1, p2) {
32602
+ const coeff = new Uint8Array(p1.length + p2.length - 1);
32603
+
32604
+ for (let i = 0; i < p1.length; i++) {
32605
+ for (let j = 0; j < p2.length; j++) {
32606
+ coeff[i + j] ^= GF.mul(p1[i], p2[j]);
32607
+ }
32608
+ }
32609
+
32610
+ return coeff
32611
+ };
32612
+
32613
+ /**
32614
+ * Calculate the remainder of polynomials division
32615
+ *
32616
+ * @param {Uint8Array} divident Polynomial
32617
+ * @param {Uint8Array} divisor Polynomial
32618
+ * @return {Uint8Array} Remainder
32619
+ */
32620
+ exports.mod = function mod (divident, divisor) {
32621
+ let result = new Uint8Array(divident);
32622
+
32623
+ while ((result.length - divisor.length) >= 0) {
32624
+ const coeff = result[0];
32625
+
32626
+ for (let i = 0; i < divisor.length; i++) {
32627
+ result[i] ^= GF.mul(divisor[i], coeff);
32628
+ }
32629
+
32630
+ // remove all zeros from buffer head
32631
+ let offset = 0;
32632
+ while (offset < result.length && result[offset] === 0) offset++;
32633
+ result = result.slice(offset);
32634
+ }
32635
+
32636
+ return result
32637
+ };
32638
+
32639
+ /**
32640
+ * Generate an irreducible generator polynomial of specified degree
32641
+ * (used by Reed-Solomon encoder)
32642
+ *
32643
+ * @param {Number} degree Degree of the generator polynomial
32644
+ * @return {Uint8Array} Buffer containing polynomial coefficients
32645
+ */
32646
+ exports.generateECPolynomial = function generateECPolynomial (degree) {
32647
+ let poly = new Uint8Array([1]);
32648
+ for (let i = 0; i < degree; i++) {
32649
+ poly = exports.mul(poly, new Uint8Array([1, GF.exp(i)]));
32650
+ }
32651
+
32652
+ return poly
32653
+ };
32654
+ } (polynomial));
32655
+ return polynomial;
32656
+ }
32657
+
32658
+ var reedSolomonEncoder;
32659
+ var hasRequiredReedSolomonEncoder;
32660
+
32661
+ function requireReedSolomonEncoder () {
32662
+ if (hasRequiredReedSolomonEncoder) return reedSolomonEncoder;
32663
+ hasRequiredReedSolomonEncoder = 1;
32664
+ const Polynomial = requirePolynomial();
32665
+
32666
+ function ReedSolomonEncoder (degree) {
32667
+ this.genPoly = undefined;
32668
+ this.degree = degree;
32669
+
32670
+ if (this.degree) this.initialize(this.degree);
32671
+ }
32672
+
32673
+ /**
32674
+ * Initialize the encoder.
32675
+ * The input param should correspond to the number of error correction codewords.
32676
+ *
32677
+ * @param {Number} degree
32678
+ */
32679
+ ReedSolomonEncoder.prototype.initialize = function initialize (degree) {
32680
+ // create an irreducible generator polynomial
32681
+ this.degree = degree;
32682
+ this.genPoly = Polynomial.generateECPolynomial(this.degree);
32683
+ };
32684
+
32685
+ /**
32686
+ * Encodes a chunk of data
32687
+ *
32688
+ * @param {Uint8Array} data Buffer containing input data
32689
+ * @return {Uint8Array} Buffer containing encoded data
32690
+ */
32691
+ ReedSolomonEncoder.prototype.encode = function encode (data) {
32692
+ if (!this.genPoly) {
32693
+ throw new Error('Encoder not initialized')
32694
+ }
32695
+
32696
+ // Calculate EC for this data block
32697
+ // extends data size to data+genPoly size
32698
+ const paddedData = new Uint8Array(data.length + this.degree);
32699
+ paddedData.set(data);
32700
+
32701
+ // The error correction codewords are the remainder after dividing the data codewords
32702
+ // by a generator polynomial
32703
+ const remainder = Polynomial.mod(paddedData, this.genPoly);
32704
+
32705
+ // return EC data blocks (last n byte, where n is the degree of genPoly)
32706
+ // If coefficients number in remainder are less than genPoly degree,
32707
+ // pad with 0s to the left to reach the needed number of coefficients
32708
+ const start = this.degree - remainder.length;
32709
+ if (start > 0) {
32710
+ const buff = new Uint8Array(this.degree);
32711
+ buff.set(remainder, start);
32712
+
32713
+ return buff
32714
+ }
32715
+
32716
+ return remainder
32717
+ };
32718
+
32719
+ reedSolomonEncoder = ReedSolomonEncoder;
32720
+ return reedSolomonEncoder;
32721
+ }
32722
+
32723
+ var version = {};
32724
+
32725
+ var mode = {};
32726
+
32727
+ var versionCheck = {};
32728
+
32729
+ /**
32730
+ * Check if QR Code version is valid
32731
+ *
32732
+ * @param {Number} version QR Code version
32733
+ * @return {Boolean} true if valid version, false otherwise
32734
+ */
32735
+
32736
+ var hasRequiredVersionCheck;
32737
+
32738
+ function requireVersionCheck () {
32739
+ if (hasRequiredVersionCheck) return versionCheck;
32740
+ hasRequiredVersionCheck = 1;
32741
+ versionCheck.isValid = function isValid (version) {
32742
+ return !isNaN(version) && version >= 1 && version <= 40
32743
+ };
32744
+ return versionCheck;
32745
+ }
32746
+
32747
+ var regex = {};
32748
+
32749
+ var hasRequiredRegex;
32750
+
32751
+ function requireRegex () {
32752
+ if (hasRequiredRegex) return regex;
32753
+ hasRequiredRegex = 1;
32754
+ const numeric = '[0-9]+';
32755
+ const alphanumeric = '[A-Z $%*+\\-./:]+';
32756
+ let kanji = '(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|' +
32757
+ '[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|' +
32758
+ '[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|' +
32759
+ '[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+';
32760
+ kanji = kanji.replace(/u/g, '\\u');
32761
+
32762
+ const byte = '(?:(?![A-Z0-9 $%*+\\-./:]|' + kanji + ')(?:.|[\r\n]))+';
32763
+
32764
+ regex.KANJI = new RegExp(kanji, 'g');
32765
+ regex.BYTE_KANJI = new RegExp('[^A-Z0-9 $%*+\\-./:]+', 'g');
32766
+ regex.BYTE = new RegExp(byte, 'g');
32767
+ regex.NUMERIC = new RegExp(numeric, 'g');
32768
+ regex.ALPHANUMERIC = new RegExp(alphanumeric, 'g');
32769
+
32770
+ const TEST_KANJI = new RegExp('^' + kanji + '$');
32771
+ const TEST_NUMERIC = new RegExp('^' + numeric + '$');
32772
+ const TEST_ALPHANUMERIC = new RegExp('^[A-Z0-9 $%*+\\-./:]+$');
32773
+
32774
+ regex.testKanji = function testKanji (str) {
32775
+ return TEST_KANJI.test(str)
32776
+ };
32777
+
32778
+ regex.testNumeric = function testNumeric (str) {
32779
+ return TEST_NUMERIC.test(str)
32780
+ };
32781
+
32782
+ regex.testAlphanumeric = function testAlphanumeric (str) {
32783
+ return TEST_ALPHANUMERIC.test(str)
32784
+ };
32785
+ return regex;
32786
+ }
32787
+
32788
+ var hasRequiredMode;
32789
+
32790
+ function requireMode () {
32791
+ if (hasRequiredMode) return mode;
32792
+ hasRequiredMode = 1;
32793
+ (function (exports) {
32794
+ const VersionCheck = requireVersionCheck();
32795
+ const Regex = requireRegex();
32796
+
32797
+ /**
32798
+ * Numeric mode encodes data from the decimal digit set (0 - 9)
32799
+ * (byte values 30HEX to 39HEX).
32800
+ * Normally, 3 data characters are represented by 10 bits.
32801
+ *
32802
+ * @type {Object}
32803
+ */
32804
+ exports.NUMERIC = {
32805
+ id: 'Numeric',
32806
+ bit: 1 << 0,
32807
+ ccBits: [10, 12, 14]
32808
+ };
32809
+
32810
+ /**
32811
+ * Alphanumeric mode encodes data from a set of 45 characters,
32812
+ * i.e. 10 numeric digits (0 - 9),
32813
+ * 26 alphabetic characters (A - Z),
32814
+ * and 9 symbols (SP, $, %, *, +, -, ., /, :).
32815
+ * Normally, two input characters are represented by 11 bits.
32816
+ *
32817
+ * @type {Object}
32818
+ */
32819
+ exports.ALPHANUMERIC = {
32820
+ id: 'Alphanumeric',
32821
+ bit: 1 << 1,
32822
+ ccBits: [9, 11, 13]
32823
+ };
32824
+
32825
+ /**
32826
+ * In byte mode, data is encoded at 8 bits per character.
32827
+ *
32828
+ * @type {Object}
32829
+ */
32830
+ exports.BYTE = {
32831
+ id: 'Byte',
32832
+ bit: 1 << 2,
32833
+ ccBits: [8, 16, 16]
32834
+ };
32835
+
32836
+ /**
32837
+ * The Kanji mode efficiently encodes Kanji characters in accordance with
32838
+ * the Shift JIS system based on JIS X 0208.
32839
+ * The Shift JIS values are shifted from the JIS X 0208 values.
32840
+ * JIS X 0208 gives details of the shift coded representation.
32841
+ * Each two-byte character value is compacted to a 13-bit binary codeword.
32842
+ *
32843
+ * @type {Object}
32844
+ */
32845
+ exports.KANJI = {
32846
+ id: 'Kanji',
32847
+ bit: 1 << 3,
32848
+ ccBits: [8, 10, 12]
32849
+ };
32850
+
32851
+ /**
32852
+ * Mixed mode will contain a sequences of data in a combination of any of
32853
+ * the modes described above
32854
+ *
32855
+ * @type {Object}
32856
+ */
32857
+ exports.MIXED = {
32858
+ bit: -1
32859
+ };
32860
+
32861
+ /**
32862
+ * Returns the number of bits needed to store the data length
32863
+ * according to QR Code specifications.
32864
+ *
32865
+ * @param {Mode} mode Data mode
32866
+ * @param {Number} version QR Code version
32867
+ * @return {Number} Number of bits
32868
+ */
32869
+ exports.getCharCountIndicator = function getCharCountIndicator (mode, version) {
32870
+ if (!mode.ccBits) throw new Error('Invalid mode: ' + mode)
32871
+
32872
+ if (!VersionCheck.isValid(version)) {
32873
+ throw new Error('Invalid version: ' + version)
32874
+ }
32875
+
32876
+ if (version >= 1 && version < 10) return mode.ccBits[0]
32877
+ else if (version < 27) return mode.ccBits[1]
32878
+ return mode.ccBits[2]
32879
+ };
32880
+
32881
+ /**
32882
+ * Returns the most efficient mode to store the specified data
32883
+ *
32884
+ * @param {String} dataStr Input data string
32885
+ * @return {Mode} Best mode
32886
+ */
32887
+ exports.getBestModeForData = function getBestModeForData (dataStr) {
32888
+ if (Regex.testNumeric(dataStr)) return exports.NUMERIC
32889
+ else if (Regex.testAlphanumeric(dataStr)) return exports.ALPHANUMERIC
32890
+ else if (Regex.testKanji(dataStr)) return exports.KANJI
32891
+ else return exports.BYTE
32892
+ };
32893
+
32894
+ /**
32895
+ * Return mode name as string
32896
+ *
32897
+ * @param {Mode} mode Mode object
32898
+ * @returns {String} Mode name
32899
+ */
32900
+ exports.toString = function toString (mode) {
32901
+ if (mode && mode.id) return mode.id
32902
+ throw new Error('Invalid mode')
32903
+ };
32904
+
32905
+ /**
32906
+ * Check if input param is a valid mode object
32907
+ *
32908
+ * @param {Mode} mode Mode object
32909
+ * @returns {Boolean} True if valid mode, false otherwise
32910
+ */
32911
+ exports.isValid = function isValid (mode) {
32912
+ return mode && mode.bit && mode.ccBits
32913
+ };
32914
+
32915
+ /**
32916
+ * Get mode object from its name
32917
+ *
32918
+ * @param {String} string Mode name
32919
+ * @returns {Mode} Mode object
32920
+ */
32921
+ function fromString (string) {
32922
+ if (typeof string !== 'string') {
32923
+ throw new Error('Param is not a string')
32924
+ }
32925
+
32926
+ const lcStr = string.toLowerCase();
32927
+
32928
+ switch (lcStr) {
32929
+ case 'numeric':
32930
+ return exports.NUMERIC
32931
+ case 'alphanumeric':
32932
+ return exports.ALPHANUMERIC
32933
+ case 'kanji':
32934
+ return exports.KANJI
32935
+ case 'byte':
32936
+ return exports.BYTE
32937
+ default:
32938
+ throw new Error('Unknown mode: ' + string)
32939
+ }
32940
+ }
32941
+
32942
+ /**
32943
+ * Returns mode from a value.
32944
+ * If value is not a valid mode, returns defaultValue
32945
+ *
32946
+ * @param {Mode|String} value Encoding mode
32947
+ * @param {Mode} defaultValue Fallback value
32948
+ * @return {Mode} Encoding mode
32949
+ */
32950
+ exports.from = function from (value, defaultValue) {
32951
+ if (exports.isValid(value)) {
32952
+ return value
32953
+ }
32954
+
32955
+ try {
32956
+ return fromString(value)
32957
+ } catch (e) {
32958
+ return defaultValue
32959
+ }
32960
+ };
32961
+ } (mode));
32962
+ return mode;
32963
+ }
32964
+
32965
+ var hasRequiredVersion;
32966
+
32967
+ function requireVersion () {
32968
+ if (hasRequiredVersion) return version;
32969
+ hasRequiredVersion = 1;
32970
+ (function (exports) {
32971
+ const Utils = requireUtils$1();
32972
+ const ECCode = requireErrorCorrectionCode();
32973
+ const ECLevel = requireErrorCorrectionLevel();
32974
+ const Mode = requireMode();
32975
+ const VersionCheck = requireVersionCheck();
32976
+
32977
+ // Generator polynomial used to encode version information
32978
+ const G18 = (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0);
32979
+ const G18_BCH = Utils.getBCHDigit(G18);
32980
+
32981
+ function getBestVersionForDataLength (mode, length, errorCorrectionLevel) {
32982
+ for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {
32983
+ if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, mode)) {
32984
+ return currentVersion
32985
+ }
32986
+ }
32987
+
32988
+ return undefined
32989
+ }
32990
+
32991
+ function getReservedBitsCount (mode, version) {
32992
+ // Character count indicator + mode indicator bits
32993
+ return Mode.getCharCountIndicator(mode, version) + 4
32994
+ }
32995
+
32996
+ function getTotalBitsFromDataArray (segments, version) {
32997
+ let totalBits = 0;
32998
+
32999
+ segments.forEach(function (data) {
33000
+ const reservedBits = getReservedBitsCount(data.mode, version);
33001
+ totalBits += reservedBits + data.getBitsLength();
33002
+ });
33003
+
33004
+ return totalBits
33005
+ }
33006
+
33007
+ function getBestVersionForMixedData (segments, errorCorrectionLevel) {
33008
+ for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {
33009
+ const length = getTotalBitsFromDataArray(segments, currentVersion);
33010
+ if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, Mode.MIXED)) {
33011
+ return currentVersion
33012
+ }
33013
+ }
33014
+
33015
+ return undefined
33016
+ }
33017
+
33018
+ /**
33019
+ * Returns version number from a value.
33020
+ * If value is not a valid version, returns defaultValue
33021
+ *
33022
+ * @param {Number|String} value QR Code version
33023
+ * @param {Number} defaultValue Fallback value
33024
+ * @return {Number} QR Code version number
33025
+ */
33026
+ exports.from = function from (value, defaultValue) {
33027
+ if (VersionCheck.isValid(value)) {
33028
+ return parseInt(value, 10)
33029
+ }
33030
+
33031
+ return defaultValue
33032
+ };
33033
+
33034
+ /**
33035
+ * Returns how much data can be stored with the specified QR code version
33036
+ * and error correction level
33037
+ *
33038
+ * @param {Number} version QR Code version (1-40)
33039
+ * @param {Number} errorCorrectionLevel Error correction level
33040
+ * @param {Mode} mode Data mode
33041
+ * @return {Number} Quantity of storable data
33042
+ */
33043
+ exports.getCapacity = function getCapacity (version, errorCorrectionLevel, mode) {
33044
+ if (!VersionCheck.isValid(version)) {
33045
+ throw new Error('Invalid QR Code version')
33046
+ }
33047
+
33048
+ // Use Byte mode as default
33049
+ if (typeof mode === 'undefined') mode = Mode.BYTE;
33050
+
33051
+ // Total codewords for this QR code version (Data + Error correction)
33052
+ const totalCodewords = Utils.getSymbolTotalCodewords(version);
33053
+
33054
+ // Total number of error correction codewords
33055
+ const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
33056
+
33057
+ // Total number of data codewords
33058
+ const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8;
33059
+
33060
+ if (mode === Mode.MIXED) return dataTotalCodewordsBits
33061
+
33062
+ const usableBits = dataTotalCodewordsBits - getReservedBitsCount(mode, version);
33063
+
33064
+ // Return max number of storable codewords
33065
+ switch (mode) {
33066
+ case Mode.NUMERIC:
33067
+ return Math.floor((usableBits / 10) * 3)
33068
+
33069
+ case Mode.ALPHANUMERIC:
33070
+ return Math.floor((usableBits / 11) * 2)
33071
+
33072
+ case Mode.KANJI:
33073
+ return Math.floor(usableBits / 13)
33074
+
33075
+ case Mode.BYTE:
33076
+ default:
33077
+ return Math.floor(usableBits / 8)
33078
+ }
33079
+ };
33080
+
33081
+ /**
33082
+ * Returns the minimum version needed to contain the amount of data
33083
+ *
33084
+ * @param {Segment} data Segment of data
33085
+ * @param {Number} [errorCorrectionLevel=H] Error correction level
33086
+ * @param {Mode} mode Data mode
33087
+ * @return {Number} QR Code version
33088
+ */
33089
+ exports.getBestVersionForData = function getBestVersionForData (data, errorCorrectionLevel) {
33090
+ let seg;
33091
+
33092
+ const ecl = ECLevel.from(errorCorrectionLevel, ECLevel.M);
33093
+
33094
+ if (Array.isArray(data)) {
33095
+ if (data.length > 1) {
33096
+ return getBestVersionForMixedData(data, ecl)
33097
+ }
33098
+
33099
+ if (data.length === 0) {
33100
+ return 1
33101
+ }
33102
+
33103
+ seg = data[0];
33104
+ } else {
33105
+ seg = data;
33106
+ }
33107
+
33108
+ return getBestVersionForDataLength(seg.mode, seg.getLength(), ecl)
33109
+ };
33110
+
33111
+ /**
33112
+ * Returns version information with relative error correction bits
33113
+ *
33114
+ * The version information is included in QR Code symbols of version 7 or larger.
33115
+ * It consists of an 18-bit sequence containing 6 data bits,
33116
+ * with 12 error correction bits calculated using the (18, 6) Golay code.
33117
+ *
33118
+ * @param {Number} version QR Code version
33119
+ * @return {Number} Encoded version info bits
33120
+ */
33121
+ exports.getEncodedBits = function getEncodedBits (version) {
33122
+ if (!VersionCheck.isValid(version) || version < 7) {
33123
+ throw new Error('Invalid QR Code version')
33124
+ }
33125
+
33126
+ let d = version << 12;
33127
+
33128
+ while (Utils.getBCHDigit(d) - G18_BCH >= 0) {
33129
+ d ^= (G18 << (Utils.getBCHDigit(d) - G18_BCH));
33130
+ }
33131
+
33132
+ return (version << 12) | d
33133
+ };
33134
+ } (version));
33135
+ return version;
33136
+ }
33137
+
33138
+ var formatInfo = {};
33139
+
33140
+ var hasRequiredFormatInfo;
33141
+
33142
+ function requireFormatInfo () {
33143
+ if (hasRequiredFormatInfo) return formatInfo;
33144
+ hasRequiredFormatInfo = 1;
33145
+ const Utils = requireUtils$1();
33146
+
33147
+ const G15 = (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0);
33148
+ const G15_MASK = (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1);
33149
+ const G15_BCH = Utils.getBCHDigit(G15);
33150
+
33151
+ /**
33152
+ * Returns format information with relative error correction bits
33153
+ *
33154
+ * The format information is a 15-bit sequence containing 5 data bits,
33155
+ * with 10 error correction bits calculated using the (15, 5) BCH code.
33156
+ *
33157
+ * @param {Number} errorCorrectionLevel Error correction level
33158
+ * @param {Number} mask Mask pattern
33159
+ * @return {Number} Encoded format information bits
33160
+ */
33161
+ formatInfo.getEncodedBits = function getEncodedBits (errorCorrectionLevel, mask) {
33162
+ const data = ((errorCorrectionLevel.bit << 3) | mask);
33163
+ let d = data << 10;
33164
+
33165
+ while (Utils.getBCHDigit(d) - G15_BCH >= 0) {
33166
+ d ^= (G15 << (Utils.getBCHDigit(d) - G15_BCH));
33167
+ }
33168
+
33169
+ // xor final data with mask pattern in order to ensure that
33170
+ // no combination of Error Correction Level and data mask pattern
33171
+ // will result in an all-zero data string
33172
+ return ((data << 10) | d) ^ G15_MASK
33173
+ };
33174
+ return formatInfo;
33175
+ }
33176
+
33177
+ var segments = {};
33178
+
33179
+ var numericData;
33180
+ var hasRequiredNumericData;
33181
+
33182
+ function requireNumericData () {
33183
+ if (hasRequiredNumericData) return numericData;
33184
+ hasRequiredNumericData = 1;
33185
+ const Mode = requireMode();
33186
+
33187
+ function NumericData (data) {
33188
+ this.mode = Mode.NUMERIC;
33189
+ this.data = data.toString();
33190
+ }
33191
+
33192
+ NumericData.getBitsLength = function getBitsLength (length) {
33193
+ return 10 * Math.floor(length / 3) + ((length % 3) ? ((length % 3) * 3 + 1) : 0)
33194
+ };
33195
+
33196
+ NumericData.prototype.getLength = function getLength () {
33197
+ return this.data.length
33198
+ };
33199
+
33200
+ NumericData.prototype.getBitsLength = function getBitsLength () {
33201
+ return NumericData.getBitsLength(this.data.length)
33202
+ };
33203
+
33204
+ NumericData.prototype.write = function write (bitBuffer) {
33205
+ let i, group, value;
33206
+
33207
+ // The input data string is divided into groups of three digits,
33208
+ // and each group is converted to its 10-bit binary equivalent.
33209
+ for (i = 0; i + 3 <= this.data.length; i += 3) {
33210
+ group = this.data.substr(i, 3);
33211
+ value = parseInt(group, 10);
33212
+
33213
+ bitBuffer.put(value, 10);
33214
+ }
33215
+
33216
+ // If the number of input digits is not an exact multiple of three,
33217
+ // the final one or two digits are converted to 4 or 7 bits respectively.
33218
+ const remainingNum = this.data.length - i;
33219
+ if (remainingNum > 0) {
33220
+ group = this.data.substr(i);
33221
+ value = parseInt(group, 10);
33222
+
33223
+ bitBuffer.put(value, remainingNum * 3 + 1);
33224
+ }
33225
+ };
33226
+
33227
+ numericData = NumericData;
33228
+ return numericData;
33229
+ }
33230
+
33231
+ var alphanumericData;
33232
+ var hasRequiredAlphanumericData;
33233
+
33234
+ function requireAlphanumericData () {
33235
+ if (hasRequiredAlphanumericData) return alphanumericData;
33236
+ hasRequiredAlphanumericData = 1;
33237
+ const Mode = requireMode();
33238
+
33239
+ /**
33240
+ * Array of characters available in alphanumeric mode
33241
+ *
33242
+ * As per QR Code specification, to each character
33243
+ * is assigned a value from 0 to 44 which in this case coincides
33244
+ * with the array index
33245
+ *
33246
+ * @type {Array}
33247
+ */
33248
+ const ALPHA_NUM_CHARS = [
33249
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
33250
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
33251
+ 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
33252
+ ' ', '$', '%', '*', '+', '-', '.', '/', ':'
33253
+ ];
33254
+
33255
+ function AlphanumericData (data) {
33256
+ this.mode = Mode.ALPHANUMERIC;
33257
+ this.data = data;
33258
+ }
33259
+
33260
+ AlphanumericData.getBitsLength = function getBitsLength (length) {
33261
+ return 11 * Math.floor(length / 2) + 6 * (length % 2)
33262
+ };
33263
+
33264
+ AlphanumericData.prototype.getLength = function getLength () {
33265
+ return this.data.length
33266
+ };
33267
+
33268
+ AlphanumericData.prototype.getBitsLength = function getBitsLength () {
33269
+ return AlphanumericData.getBitsLength(this.data.length)
33270
+ };
33271
+
33272
+ AlphanumericData.prototype.write = function write (bitBuffer) {
33273
+ let i;
33274
+
33275
+ // Input data characters are divided into groups of two characters
33276
+ // and encoded as 11-bit binary codes.
33277
+ for (i = 0; i + 2 <= this.data.length; i += 2) {
33278
+ // The character value of the first character is multiplied by 45
33279
+ let value = ALPHA_NUM_CHARS.indexOf(this.data[i]) * 45;
33280
+
33281
+ // The character value of the second digit is added to the product
33282
+ value += ALPHA_NUM_CHARS.indexOf(this.data[i + 1]);
33283
+
33284
+ // The sum is then stored as 11-bit binary number
33285
+ bitBuffer.put(value, 11);
33286
+ }
33287
+
33288
+ // If the number of input data characters is not a multiple of two,
33289
+ // the character value of the final character is encoded as a 6-bit binary number.
33290
+ if (this.data.length % 2) {
33291
+ bitBuffer.put(ALPHA_NUM_CHARS.indexOf(this.data[i]), 6);
33292
+ }
33293
+ };
33294
+
33295
+ alphanumericData = AlphanumericData;
33296
+ return alphanumericData;
33297
+ }
33298
+
33299
+ var byteData;
33300
+ var hasRequiredByteData;
33301
+
33302
+ function requireByteData () {
33303
+ if (hasRequiredByteData) return byteData;
33304
+ hasRequiredByteData = 1;
33305
+ const Mode = requireMode();
33306
+
33307
+ function ByteData (data) {
33308
+ this.mode = Mode.BYTE;
33309
+ if (typeof (data) === 'string') {
33310
+ this.data = new TextEncoder().encode(data);
33311
+ } else {
33312
+ this.data = new Uint8Array(data);
33313
+ }
33314
+ }
33315
+
33316
+ ByteData.getBitsLength = function getBitsLength (length) {
33317
+ return length * 8
33318
+ };
33319
+
33320
+ ByteData.prototype.getLength = function getLength () {
33321
+ return this.data.length
33322
+ };
33323
+
33324
+ ByteData.prototype.getBitsLength = function getBitsLength () {
33325
+ return ByteData.getBitsLength(this.data.length)
33326
+ };
33327
+
33328
+ ByteData.prototype.write = function (bitBuffer) {
33329
+ for (let i = 0, l = this.data.length; i < l; i++) {
33330
+ bitBuffer.put(this.data[i], 8);
33331
+ }
33332
+ };
33333
+
33334
+ byteData = ByteData;
33335
+ return byteData;
33336
+ }
33337
+
33338
+ var kanjiData;
33339
+ var hasRequiredKanjiData;
33340
+
33341
+ function requireKanjiData () {
33342
+ if (hasRequiredKanjiData) return kanjiData;
33343
+ hasRequiredKanjiData = 1;
33344
+ const Mode = requireMode();
33345
+ const Utils = requireUtils$1();
33346
+
33347
+ function KanjiData (data) {
33348
+ this.mode = Mode.KANJI;
33349
+ this.data = data;
33350
+ }
33351
+
33352
+ KanjiData.getBitsLength = function getBitsLength (length) {
33353
+ return length * 13
33354
+ };
33355
+
33356
+ KanjiData.prototype.getLength = function getLength () {
33357
+ return this.data.length
33358
+ };
33359
+
33360
+ KanjiData.prototype.getBitsLength = function getBitsLength () {
33361
+ return KanjiData.getBitsLength(this.data.length)
33362
+ };
33363
+
33364
+ KanjiData.prototype.write = function (bitBuffer) {
33365
+ let i;
33366
+
33367
+ // In the Shift JIS system, Kanji characters are represented by a two byte combination.
33368
+ // These byte values are shifted from the JIS X 0208 values.
33369
+ // JIS X 0208 gives details of the shift coded representation.
33370
+ for (i = 0; i < this.data.length; i++) {
33371
+ let value = Utils.toSJIS(this.data[i]);
33372
+
33373
+ // For characters with Shift JIS values from 0x8140 to 0x9FFC:
33374
+ if (value >= 0x8140 && value <= 0x9FFC) {
33375
+ // Subtract 0x8140 from Shift JIS value
33376
+ value -= 0x8140;
33377
+
33378
+ // For characters with Shift JIS values from 0xE040 to 0xEBBF
33379
+ } else if (value >= 0xE040 && value <= 0xEBBF) {
33380
+ // Subtract 0xC140 from Shift JIS value
33381
+ value -= 0xC140;
33382
+ } else {
33383
+ throw new Error(
33384
+ 'Invalid SJIS character: ' + this.data[i] + '\n' +
33385
+ 'Make sure your charset is UTF-8')
33386
+ }
33387
+
33388
+ // Multiply most significant byte of result by 0xC0
33389
+ // and add least significant byte to product
33390
+ value = (((value >>> 8) & 0xff) * 0xC0) + (value & 0xff);
33391
+
33392
+ // Convert result to a 13-bit binary string
33393
+ bitBuffer.put(value, 13);
33394
+ }
33395
+ };
33396
+
33397
+ kanjiData = KanjiData;
33398
+ return kanjiData;
33399
+ }
33400
+
33401
+ var dijkstra = {exports: {}};
33402
+
33403
+ var hasRequiredDijkstra;
33404
+
33405
+ function requireDijkstra () {
33406
+ if (hasRequiredDijkstra) return dijkstra.exports;
33407
+ hasRequiredDijkstra = 1;
33408
+ (function (module) {
33409
+
33410
+ /******************************************************************************
33411
+ * Created 2008-08-19.
33412
+ *
33413
+ * Dijkstra path-finding functions. Adapted from the Dijkstar Python project.
33414
+ *
33415
+ * Copyright (C) 2008
33416
+ * Wyatt Baldwin <self@wyattbaldwin.com>
33417
+ * All rights reserved
33418
+ *
33419
+ * Licensed under the MIT license.
33420
+ *
33421
+ * http://www.opensource.org/licenses/mit-license.php
33422
+ *
33423
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
33424
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33425
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33426
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33427
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
33428
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
33429
+ * THE SOFTWARE.
33430
+ *****************************************************************************/
33431
+ var dijkstra = {
33432
+ single_source_shortest_paths: function(graph, s, d) {
33433
+ // Predecessor map for each node that has been encountered.
33434
+ // node ID => predecessor node ID
33435
+ var predecessors = {};
33436
+
33437
+ // Costs of shortest paths from s to all nodes encountered.
33438
+ // node ID => cost
33439
+ var costs = {};
33440
+ costs[s] = 0;
33441
+
33442
+ // Costs of shortest paths from s to all nodes encountered; differs from
33443
+ // `costs` in that it provides easy access to the node that currently has
33444
+ // the known shortest path from s.
33445
+ // XXX: Do we actually need both `costs` and `open`?
33446
+ var open = dijkstra.PriorityQueue.make();
33447
+ open.push(s, 0);
33448
+
33449
+ var closest,
33450
+ u, v,
33451
+ cost_of_s_to_u,
33452
+ adjacent_nodes,
33453
+ cost_of_e,
33454
+ cost_of_s_to_u_plus_cost_of_e,
33455
+ cost_of_s_to_v,
33456
+ first_visit;
33457
+ while (!open.empty()) {
33458
+ // In the nodes remaining in graph that have a known cost from s,
33459
+ // find the node, u, that currently has the shortest path from s.
33460
+ closest = open.pop();
33461
+ u = closest.value;
33462
+ cost_of_s_to_u = closest.cost;
33463
+
33464
+ // Get nodes adjacent to u...
33465
+ adjacent_nodes = graph[u] || {};
33466
+
33467
+ // ...and explore the edges that connect u to those nodes, updating
33468
+ // the cost of the shortest paths to any or all of those nodes as
33469
+ // necessary. v is the node across the current edge from u.
33470
+ for (v in adjacent_nodes) {
33471
+ if (adjacent_nodes.hasOwnProperty(v)) {
33472
+ // Get the cost of the edge running from u to v.
33473
+ cost_of_e = adjacent_nodes[v];
33474
+
33475
+ // Cost of s to u plus the cost of u to v across e--this is *a*
33476
+ // cost from s to v that may or may not be less than the current
33477
+ // known cost to v.
33478
+ cost_of_s_to_u_plus_cost_of_e = cost_of_s_to_u + cost_of_e;
33479
+
33480
+ // If we haven't visited v yet OR if the current known cost from s to
33481
+ // v is greater than the new cost we just found (cost of s to u plus
33482
+ // cost of u to v across e), update v's cost in the cost list and
33483
+ // update v's predecessor in the predecessor list (it's now u).
33484
+ cost_of_s_to_v = costs[v];
33485
+ first_visit = (typeof costs[v] === 'undefined');
33486
+ if (first_visit || cost_of_s_to_v > cost_of_s_to_u_plus_cost_of_e) {
33487
+ costs[v] = cost_of_s_to_u_plus_cost_of_e;
33488
+ open.push(v, cost_of_s_to_u_plus_cost_of_e);
33489
+ predecessors[v] = u;
33490
+ }
33491
+ }
33492
+ }
33493
+ }
33494
+
33495
+ if (typeof d !== 'undefined' && typeof costs[d] === 'undefined') {
33496
+ var msg = ['Could not find a path from ', s, ' to ', d, '.'].join('');
33497
+ throw new Error(msg);
33498
+ }
33499
+
33500
+ return predecessors;
33501
+ },
33502
+
33503
+ extract_shortest_path_from_predecessor_list: function(predecessors, d) {
33504
+ var nodes = [];
33505
+ var u = d;
33506
+ while (u) {
33507
+ nodes.push(u);
33508
+ u = predecessors[u];
33509
+ }
33510
+ nodes.reverse();
33511
+ return nodes;
33512
+ },
33513
+
33514
+ find_path: function(graph, s, d) {
33515
+ var predecessors = dijkstra.single_source_shortest_paths(graph, s, d);
33516
+ return dijkstra.extract_shortest_path_from_predecessor_list(
33517
+ predecessors, d);
33518
+ },
33519
+
33520
+ /**
33521
+ * A very naive priority queue implementation.
33522
+ */
33523
+ PriorityQueue: {
33524
+ make: function (opts) {
33525
+ var T = dijkstra.PriorityQueue,
33526
+ t = {},
33527
+ key;
33528
+ opts = opts || {};
33529
+ for (key in T) {
33530
+ if (T.hasOwnProperty(key)) {
33531
+ t[key] = T[key];
33532
+ }
33533
+ }
33534
+ t.queue = [];
33535
+ t.sorter = opts.sorter || T.default_sorter;
33536
+ return t;
33537
+ },
33538
+
33539
+ default_sorter: function (a, b) {
33540
+ return a.cost - b.cost;
33541
+ },
33542
+
33543
+ /**
33544
+ * Add a new item to the queue and ensure the highest priority element
33545
+ * is at the front of the queue.
33546
+ */
33547
+ push: function (value, cost) {
33548
+ var item = {value: value, cost: cost};
33549
+ this.queue.push(item);
33550
+ this.queue.sort(this.sorter);
33551
+ },
33552
+
33553
+ /**
33554
+ * Return the highest priority element in the queue.
33555
+ */
33556
+ pop: function () {
33557
+ return this.queue.shift();
33558
+ },
33559
+
33560
+ empty: function () {
33561
+ return this.queue.length === 0;
33562
+ }
33563
+ }
33564
+ };
33565
+
33566
+
33567
+ // node.js module exports
33568
+ {
33569
+ module.exports = dijkstra;
33570
+ }
33571
+ } (dijkstra));
33572
+ return dijkstra.exports;
33573
+ }
33574
+
33575
+ var hasRequiredSegments;
33576
+
33577
+ function requireSegments () {
33578
+ if (hasRequiredSegments) return segments;
33579
+ hasRequiredSegments = 1;
33580
+ (function (exports) {
33581
+ const Mode = requireMode();
33582
+ const NumericData = requireNumericData();
33583
+ const AlphanumericData = requireAlphanumericData();
33584
+ const ByteData = requireByteData();
33585
+ const KanjiData = requireKanjiData();
33586
+ const Regex = requireRegex();
33587
+ const Utils = requireUtils$1();
33588
+ const dijkstra = requireDijkstra();
33589
+
33590
+ /**
33591
+ * Returns UTF8 byte length
33592
+ *
33593
+ * @param {String} str Input string
33594
+ * @return {Number} Number of byte
33595
+ */
33596
+ function getStringByteLength (str) {
33597
+ return unescape(encodeURIComponent(str)).length
33598
+ }
33599
+
33600
+ /**
33601
+ * Get a list of segments of the specified mode
33602
+ * from a string
33603
+ *
33604
+ * @param {Mode} mode Segment mode
33605
+ * @param {String} str String to process
33606
+ * @return {Array} Array of object with segments data
33607
+ */
33608
+ function getSegments (regex, mode, str) {
33609
+ const segments = [];
33610
+ let result;
33611
+
33612
+ while ((result = regex.exec(str)) !== null) {
33613
+ segments.push({
33614
+ data: result[0],
33615
+ index: result.index,
33616
+ mode: mode,
33617
+ length: result[0].length
33618
+ });
33619
+ }
33620
+
33621
+ return segments
33622
+ }
33623
+
33624
+ /**
33625
+ * Extracts a series of segments with the appropriate
33626
+ * modes from a string
33627
+ *
33628
+ * @param {String} dataStr Input string
33629
+ * @return {Array} Array of object with segments data
33630
+ */
33631
+ function getSegmentsFromString (dataStr) {
33632
+ const numSegs = getSegments(Regex.NUMERIC, Mode.NUMERIC, dataStr);
33633
+ const alphaNumSegs = getSegments(Regex.ALPHANUMERIC, Mode.ALPHANUMERIC, dataStr);
33634
+ let byteSegs;
33635
+ let kanjiSegs;
33636
+
33637
+ if (Utils.isKanjiModeEnabled()) {
33638
+ byteSegs = getSegments(Regex.BYTE, Mode.BYTE, dataStr);
33639
+ kanjiSegs = getSegments(Regex.KANJI, Mode.KANJI, dataStr);
33640
+ } else {
33641
+ byteSegs = getSegments(Regex.BYTE_KANJI, Mode.BYTE, dataStr);
33642
+ kanjiSegs = [];
33643
+ }
33644
+
33645
+ const segs = numSegs.concat(alphaNumSegs, byteSegs, kanjiSegs);
33646
+
33647
+ return segs
33648
+ .sort(function (s1, s2) {
33649
+ return s1.index - s2.index
33650
+ })
33651
+ .map(function (obj) {
33652
+ return {
33653
+ data: obj.data,
33654
+ mode: obj.mode,
33655
+ length: obj.length
33656
+ }
33657
+ })
33658
+ }
33659
+
33660
+ /**
33661
+ * Returns how many bits are needed to encode a string of
33662
+ * specified length with the specified mode
33663
+ *
33664
+ * @param {Number} length String length
33665
+ * @param {Mode} mode Segment mode
33666
+ * @return {Number} Bit length
33667
+ */
33668
+ function getSegmentBitsLength (length, mode) {
33669
+ switch (mode) {
33670
+ case Mode.NUMERIC:
33671
+ return NumericData.getBitsLength(length)
33672
+ case Mode.ALPHANUMERIC:
33673
+ return AlphanumericData.getBitsLength(length)
33674
+ case Mode.KANJI:
33675
+ return KanjiData.getBitsLength(length)
33676
+ case Mode.BYTE:
33677
+ return ByteData.getBitsLength(length)
33678
+ }
33679
+ }
33680
+
33681
+ /**
33682
+ * Merges adjacent segments which have the same mode
33683
+ *
33684
+ * @param {Array} segs Array of object with segments data
33685
+ * @return {Array} Array of object with segments data
33686
+ */
33687
+ function mergeSegments (segs) {
33688
+ return segs.reduce(function (acc, curr) {
33689
+ const prevSeg = acc.length - 1 >= 0 ? acc[acc.length - 1] : null;
33690
+ if (prevSeg && prevSeg.mode === curr.mode) {
33691
+ acc[acc.length - 1].data += curr.data;
33692
+ return acc
33693
+ }
33694
+
33695
+ acc.push(curr);
33696
+ return acc
33697
+ }, [])
33698
+ }
33699
+
33700
+ /**
33701
+ * Generates a list of all possible nodes combination which
33702
+ * will be used to build a segments graph.
33703
+ *
33704
+ * Nodes are divided by groups. Each group will contain a list of all the modes
33705
+ * in which is possible to encode the given text.
33706
+ *
33707
+ * For example the text '12345' can be encoded as Numeric, Alphanumeric or Byte.
33708
+ * The group for '12345' will contain then 3 objects, one for each
33709
+ * possible encoding mode.
33710
+ *
33711
+ * Each node represents a possible segment.
33712
+ *
33713
+ * @param {Array} segs Array of object with segments data
33714
+ * @return {Array} Array of object with segments data
33715
+ */
33716
+ function buildNodes (segs) {
33717
+ const nodes = [];
33718
+ for (let i = 0; i < segs.length; i++) {
33719
+ const seg = segs[i];
33720
+
33721
+ switch (seg.mode) {
33722
+ case Mode.NUMERIC:
33723
+ nodes.push([seg,
33724
+ { data: seg.data, mode: Mode.ALPHANUMERIC, length: seg.length },
33725
+ { data: seg.data, mode: Mode.BYTE, length: seg.length }
33726
+ ]);
33727
+ break
33728
+ case Mode.ALPHANUMERIC:
33729
+ nodes.push([seg,
33730
+ { data: seg.data, mode: Mode.BYTE, length: seg.length }
33731
+ ]);
33732
+ break
33733
+ case Mode.KANJI:
33734
+ nodes.push([seg,
33735
+ { data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }
33736
+ ]);
33737
+ break
33738
+ case Mode.BYTE:
33739
+ nodes.push([
33740
+ { data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }
33741
+ ]);
33742
+ }
33743
+ }
33744
+
33745
+ return nodes
33746
+ }
33747
+
33748
+ /**
33749
+ * Builds a graph from a list of nodes.
33750
+ * All segments in each node group will be connected with all the segments of
33751
+ * the next group and so on.
33752
+ *
33753
+ * At each connection will be assigned a weight depending on the
33754
+ * segment's byte length.
33755
+ *
33756
+ * @param {Array} nodes Array of object with segments data
33757
+ * @param {Number} version QR Code version
33758
+ * @return {Object} Graph of all possible segments
33759
+ */
33760
+ function buildGraph (nodes, version) {
33761
+ const table = {};
33762
+ const graph = { start: {} };
33763
+ let prevNodeIds = ['start'];
33764
+
33765
+ for (let i = 0; i < nodes.length; i++) {
33766
+ const nodeGroup = nodes[i];
33767
+ const currentNodeIds = [];
33768
+
33769
+ for (let j = 0; j < nodeGroup.length; j++) {
33770
+ const node = nodeGroup[j];
33771
+ const key = '' + i + j;
33772
+
33773
+ currentNodeIds.push(key);
33774
+ table[key] = { node: node, lastCount: 0 };
33775
+ graph[key] = {};
33776
+
33777
+ for (let n = 0; n < prevNodeIds.length; n++) {
33778
+ const prevNodeId = prevNodeIds[n];
33779
+
33780
+ if (table[prevNodeId] && table[prevNodeId].node.mode === node.mode) {
33781
+ graph[prevNodeId][key] =
33782
+ getSegmentBitsLength(table[prevNodeId].lastCount + node.length, node.mode) -
33783
+ getSegmentBitsLength(table[prevNodeId].lastCount, node.mode);
33784
+
33785
+ table[prevNodeId].lastCount += node.length;
33786
+ } else {
33787
+ if (table[prevNodeId]) table[prevNodeId].lastCount = node.length;
33788
+
33789
+ graph[prevNodeId][key] = getSegmentBitsLength(node.length, node.mode) +
33790
+ 4 + Mode.getCharCountIndicator(node.mode, version); // switch cost
33791
+ }
33792
+ }
33793
+ }
33794
+
33795
+ prevNodeIds = currentNodeIds;
33796
+ }
33797
+
33798
+ for (let n = 0; n < prevNodeIds.length; n++) {
33799
+ graph[prevNodeIds[n]].end = 0;
33800
+ }
33801
+
33802
+ return { map: graph, table: table }
33803
+ }
33804
+
33805
+ /**
33806
+ * Builds a segment from a specified data and mode.
33807
+ * If a mode is not specified, the more suitable will be used.
33808
+ *
33809
+ * @param {String} data Input data
33810
+ * @param {Mode | String} modesHint Data mode
33811
+ * @return {Segment} Segment
33812
+ */
33813
+ function buildSingleSegment (data, modesHint) {
33814
+ let mode;
33815
+ const bestMode = Mode.getBestModeForData(data);
33816
+
33817
+ mode = Mode.from(modesHint, bestMode);
33818
+
33819
+ // Make sure data can be encoded
33820
+ if (mode !== Mode.BYTE && mode.bit < bestMode.bit) {
33821
+ throw new Error('"' + data + '"' +
33822
+ ' cannot be encoded with mode ' + Mode.toString(mode) +
33823
+ '.\n Suggested mode is: ' + Mode.toString(bestMode))
33824
+ }
33825
+
33826
+ // Use Mode.BYTE if Kanji support is disabled
33827
+ if (mode === Mode.KANJI && !Utils.isKanjiModeEnabled()) {
33828
+ mode = Mode.BYTE;
33829
+ }
33830
+
33831
+ switch (mode) {
33832
+ case Mode.NUMERIC:
33833
+ return new NumericData(data)
33834
+
33835
+ case Mode.ALPHANUMERIC:
33836
+ return new AlphanumericData(data)
33837
+
33838
+ case Mode.KANJI:
33839
+ return new KanjiData(data)
33840
+
33841
+ case Mode.BYTE:
33842
+ return new ByteData(data)
33843
+ }
33844
+ }
33845
+
33846
+ /**
33847
+ * Builds a list of segments from an array.
33848
+ * Array can contain Strings or Objects with segment's info.
33849
+ *
33850
+ * For each item which is a string, will be generated a segment with the given
33851
+ * string and the more appropriate encoding mode.
33852
+ *
33853
+ * For each item which is an object, will be generated a segment with the given
33854
+ * data and mode.
33855
+ * Objects must contain at least the property "data".
33856
+ * If property "mode" is not present, the more suitable mode will be used.
33857
+ *
33858
+ * @param {Array} array Array of objects with segments data
33859
+ * @return {Array} Array of Segments
33860
+ */
33861
+ exports.fromArray = function fromArray (array) {
33862
+ return array.reduce(function (acc, seg) {
33863
+ if (typeof seg === 'string') {
33864
+ acc.push(buildSingleSegment(seg, null));
33865
+ } else if (seg.data) {
33866
+ acc.push(buildSingleSegment(seg.data, seg.mode));
33867
+ }
33868
+
33869
+ return acc
33870
+ }, [])
33871
+ };
33872
+
33873
+ /**
33874
+ * Builds an optimized sequence of segments from a string,
33875
+ * which will produce the shortest possible bitstream.
33876
+ *
33877
+ * @param {String} data Input string
33878
+ * @param {Number} version QR Code version
33879
+ * @return {Array} Array of segments
33880
+ */
33881
+ exports.fromString = function fromString (data, version) {
33882
+ const segs = getSegmentsFromString(data, Utils.isKanjiModeEnabled());
33883
+
33884
+ const nodes = buildNodes(segs);
33885
+ const graph = buildGraph(nodes, version);
33886
+ const path = dijkstra.find_path(graph.map, 'start', 'end');
33887
+
33888
+ const optimizedSegs = [];
33889
+ for (let i = 1; i < path.length - 1; i++) {
33890
+ optimizedSegs.push(graph.table[path[i]].node);
33891
+ }
33892
+
33893
+ return exports.fromArray(mergeSegments(optimizedSegs))
33894
+ };
33895
+
33896
+ /**
33897
+ * Splits a string in various segments with the modes which
33898
+ * best represent their content.
33899
+ * The produced segments are far from being optimized.
33900
+ * The output of this function is only used to estimate a QR Code version
33901
+ * which may contain the data.
33902
+ *
33903
+ * @param {string} data Input string
33904
+ * @return {Array} Array of segments
33905
+ */
33906
+ exports.rawSplit = function rawSplit (data) {
33907
+ return exports.fromArray(
33908
+ getSegmentsFromString(data, Utils.isKanjiModeEnabled())
33909
+ )
33910
+ };
33911
+ } (segments));
33912
+ return segments;
33913
+ }
33914
+
33915
+ var hasRequiredQrcode;
33916
+
33917
+ function requireQrcode () {
33918
+ if (hasRequiredQrcode) return qrcode;
33919
+ hasRequiredQrcode = 1;
33920
+ const Utils = requireUtils$1();
33921
+ const ECLevel = requireErrorCorrectionLevel();
33922
+ const BitBuffer = requireBitBuffer();
33923
+ const BitMatrix = requireBitMatrix();
33924
+ const AlignmentPattern = requireAlignmentPattern();
33925
+ const FinderPattern = requireFinderPattern();
33926
+ const MaskPattern = requireMaskPattern();
33927
+ const ECCode = requireErrorCorrectionCode();
33928
+ const ReedSolomonEncoder = requireReedSolomonEncoder();
33929
+ const Version = requireVersion();
33930
+ const FormatInfo = requireFormatInfo();
33931
+ const Mode = requireMode();
33932
+ const Segments = requireSegments();
33933
+
33934
+ /**
33935
+ * QRCode for JavaScript
33936
+ *
33937
+ * modified by Ryan Day for nodejs support
33938
+ * Copyright (c) 2011 Ryan Day
33939
+ *
33940
+ * Licensed under the MIT license:
33941
+ * http://www.opensource.org/licenses/mit-license.php
33942
+ *
33943
+ //---------------------------------------------------------------------
33944
+ // QRCode for JavaScript
33945
+ //
33946
+ // Copyright (c) 2009 Kazuhiko Arase
33947
+ //
33948
+ // URL: http://www.d-project.com/
33949
+ //
33950
+ // Licensed under the MIT license:
33951
+ // http://www.opensource.org/licenses/mit-license.php
33952
+ //
33953
+ // The word "QR Code" is registered trademark of
33954
+ // DENSO WAVE INCORPORATED
33955
+ // http://www.denso-wave.com/qrcode/faqpatent-e.html
33956
+ //
33957
+ //---------------------------------------------------------------------
33958
+ */
33959
+
33960
+ /**
33961
+ * Add finder patterns bits to matrix
33962
+ *
33963
+ * @param {BitMatrix} matrix Modules matrix
33964
+ * @param {Number} version QR Code version
33965
+ */
33966
+ function setupFinderPattern (matrix, version) {
33967
+ const size = matrix.size;
33968
+ const pos = FinderPattern.getPositions(version);
33969
+
33970
+ for (let i = 0; i < pos.length; i++) {
33971
+ const row = pos[i][0];
33972
+ const col = pos[i][1];
33973
+
33974
+ for (let r = -1; r <= 7; r++) {
33975
+ if (row + r <= -1 || size <= row + r) continue
33976
+
33977
+ for (let c = -1; c <= 7; c++) {
33978
+ if (col + c <= -1 || size <= col + c) continue
33979
+
33980
+ if ((r >= 0 && r <= 6 && (c === 0 || c === 6)) ||
33981
+ (c >= 0 && c <= 6 && (r === 0 || r === 6)) ||
33982
+ (r >= 2 && r <= 4 && c >= 2 && c <= 4)) {
33983
+ matrix.set(row + r, col + c, true, true);
33984
+ } else {
33985
+ matrix.set(row + r, col + c, false, true);
33986
+ }
33987
+ }
33988
+ }
33989
+ }
33990
+ }
33991
+
33992
+ /**
33993
+ * Add timing pattern bits to matrix
33994
+ *
33995
+ * Note: this function must be called before {@link setupAlignmentPattern}
33996
+ *
33997
+ * @param {BitMatrix} matrix Modules matrix
33998
+ */
33999
+ function setupTimingPattern (matrix) {
34000
+ const size = matrix.size;
34001
+
34002
+ for (let r = 8; r < size - 8; r++) {
34003
+ const value = r % 2 === 0;
34004
+ matrix.set(r, 6, value, true);
34005
+ matrix.set(6, r, value, true);
34006
+ }
34007
+ }
34008
+
34009
+ /**
34010
+ * Add alignment patterns bits to matrix
34011
+ *
34012
+ * Note: this function must be called after {@link setupTimingPattern}
34013
+ *
34014
+ * @param {BitMatrix} matrix Modules matrix
34015
+ * @param {Number} version QR Code version
34016
+ */
34017
+ function setupAlignmentPattern (matrix, version) {
34018
+ const pos = AlignmentPattern.getPositions(version);
34019
+
34020
+ for (let i = 0; i < pos.length; i++) {
34021
+ const row = pos[i][0];
34022
+ const col = pos[i][1];
34023
+
34024
+ for (let r = -2; r <= 2; r++) {
34025
+ for (let c = -2; c <= 2; c++) {
34026
+ if (r === -2 || r === 2 || c === -2 || c === 2 ||
34027
+ (r === 0 && c === 0)) {
34028
+ matrix.set(row + r, col + c, true, true);
34029
+ } else {
34030
+ matrix.set(row + r, col + c, false, true);
34031
+ }
34032
+ }
34033
+ }
34034
+ }
34035
+ }
34036
+
34037
+ /**
34038
+ * Add version info bits to matrix
34039
+ *
34040
+ * @param {BitMatrix} matrix Modules matrix
34041
+ * @param {Number} version QR Code version
34042
+ */
34043
+ function setupVersionInfo (matrix, version) {
34044
+ const size = matrix.size;
34045
+ const bits = Version.getEncodedBits(version);
34046
+ let row, col, mod;
34047
+
34048
+ for (let i = 0; i < 18; i++) {
34049
+ row = Math.floor(i / 3);
34050
+ col = i % 3 + size - 8 - 3;
34051
+ mod = ((bits >> i) & 1) === 1;
34052
+
34053
+ matrix.set(row, col, mod, true);
34054
+ matrix.set(col, row, mod, true);
34055
+ }
34056
+ }
34057
+
34058
+ /**
34059
+ * Add format info bits to matrix
34060
+ *
34061
+ * @param {BitMatrix} matrix Modules matrix
34062
+ * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
34063
+ * @param {Number} maskPattern Mask pattern reference value
34064
+ */
34065
+ function setupFormatInfo (matrix, errorCorrectionLevel, maskPattern) {
34066
+ const size = matrix.size;
34067
+ const bits = FormatInfo.getEncodedBits(errorCorrectionLevel, maskPattern);
34068
+ let i, mod;
34069
+
34070
+ for (i = 0; i < 15; i++) {
34071
+ mod = ((bits >> i) & 1) === 1;
34072
+
34073
+ // vertical
34074
+ if (i < 6) {
34075
+ matrix.set(i, 8, mod, true);
34076
+ } else if (i < 8) {
34077
+ matrix.set(i + 1, 8, mod, true);
34078
+ } else {
34079
+ matrix.set(size - 15 + i, 8, mod, true);
34080
+ }
34081
+
34082
+ // horizontal
34083
+ if (i < 8) {
34084
+ matrix.set(8, size - i - 1, mod, true);
34085
+ } else if (i < 9) {
34086
+ matrix.set(8, 15 - i - 1 + 1, mod, true);
34087
+ } else {
34088
+ matrix.set(8, 15 - i - 1, mod, true);
34089
+ }
34090
+ }
34091
+
34092
+ // fixed module
34093
+ matrix.set(size - 8, 8, 1, true);
34094
+ }
34095
+
34096
+ /**
34097
+ * Add encoded data bits to matrix
34098
+ *
34099
+ * @param {BitMatrix} matrix Modules matrix
34100
+ * @param {Uint8Array} data Data codewords
34101
+ */
34102
+ function setupData (matrix, data) {
34103
+ const size = matrix.size;
34104
+ let inc = -1;
34105
+ let row = size - 1;
34106
+ let bitIndex = 7;
34107
+ let byteIndex = 0;
34108
+
34109
+ for (let col = size - 1; col > 0; col -= 2) {
34110
+ if (col === 6) col--;
34111
+
34112
+ while (true) {
34113
+ for (let c = 0; c < 2; c++) {
34114
+ if (!matrix.isReserved(row, col - c)) {
34115
+ let dark = false;
34116
+
34117
+ if (byteIndex < data.length) {
34118
+ dark = (((data[byteIndex] >>> bitIndex) & 1) === 1);
34119
+ }
34120
+
34121
+ matrix.set(row, col - c, dark);
34122
+ bitIndex--;
34123
+
34124
+ if (bitIndex === -1) {
34125
+ byteIndex++;
34126
+ bitIndex = 7;
34127
+ }
34128
+ }
34129
+ }
34130
+
34131
+ row += inc;
34132
+
34133
+ if (row < 0 || size <= row) {
34134
+ row -= inc;
34135
+ inc = -inc;
34136
+ break
34137
+ }
34138
+ }
34139
+ }
34140
+ }
34141
+
34142
+ /**
34143
+ * Create encoded codewords from data input
34144
+ *
34145
+ * @param {Number} version QR Code version
34146
+ * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
34147
+ * @param {ByteData} data Data input
34148
+ * @return {Uint8Array} Buffer containing encoded codewords
34149
+ */
34150
+ function createData (version, errorCorrectionLevel, segments) {
34151
+ // Prepare data buffer
34152
+ const buffer = new BitBuffer();
34153
+
34154
+ segments.forEach(function (data) {
34155
+ // prefix data with mode indicator (4 bits)
34156
+ buffer.put(data.mode.bit, 4);
34157
+
34158
+ // Prefix data with character count indicator.
34159
+ // The character count indicator is a string of bits that represents the
34160
+ // number of characters that are being encoded.
34161
+ // The character count indicator must be placed after the mode indicator
34162
+ // and must be a certain number of bits long, depending on the QR version
34163
+ // and data mode
34164
+ // @see {@link Mode.getCharCountIndicator}.
34165
+ buffer.put(data.getLength(), Mode.getCharCountIndicator(data.mode, version));
34166
+
34167
+ // add binary data sequence to buffer
34168
+ data.write(buffer);
34169
+ });
34170
+
34171
+ // Calculate required number of bits
34172
+ const totalCodewords = Utils.getSymbolTotalCodewords(version);
34173
+ const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
34174
+ const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8;
34175
+
34176
+ // Add a terminator.
34177
+ // If the bit string is shorter than the total number of required bits,
34178
+ // a terminator of up to four 0s must be added to the right side of the string.
34179
+ // If the bit string is more than four bits shorter than the required number of bits,
34180
+ // add four 0s to the end.
34181
+ if (buffer.getLengthInBits() + 4 <= dataTotalCodewordsBits) {
34182
+ buffer.put(0, 4);
34183
+ }
34184
+
34185
+ // If the bit string is fewer than four bits shorter, add only the number of 0s that
34186
+ // are needed to reach the required number of bits.
34187
+
34188
+ // After adding the terminator, if the number of bits in the string is not a multiple of 8,
34189
+ // pad the string on the right with 0s to make the string's length a multiple of 8.
34190
+ while (buffer.getLengthInBits() % 8 !== 0) {
34191
+ buffer.putBit(0);
34192
+ }
34193
+
34194
+ // Add pad bytes if the string is still shorter than the total number of required bits.
34195
+ // Extend the buffer to fill the data capacity of the symbol corresponding to
34196
+ // the Version and Error Correction Level by adding the Pad Codewords 11101100 (0xEC)
34197
+ // and 00010001 (0x11) alternately.
34198
+ const remainingByte = (dataTotalCodewordsBits - buffer.getLengthInBits()) / 8;
34199
+ for (let i = 0; i < remainingByte; i++) {
34200
+ buffer.put(i % 2 ? 0x11 : 0xEC, 8);
34201
+ }
34202
+
34203
+ return createCodewords(buffer, version, errorCorrectionLevel)
34204
+ }
34205
+
34206
+ /**
34207
+ * Encode input data with Reed-Solomon and return codewords with
34208
+ * relative error correction bits
34209
+ *
34210
+ * @param {BitBuffer} bitBuffer Data to encode
34211
+ * @param {Number} version QR Code version
34212
+ * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
34213
+ * @return {Uint8Array} Buffer containing encoded codewords
34214
+ */
34215
+ function createCodewords (bitBuffer, version, errorCorrectionLevel) {
34216
+ // Total codewords for this QR code version (Data + Error correction)
34217
+ const totalCodewords = Utils.getSymbolTotalCodewords(version);
34218
+
34219
+ // Total number of error correction codewords
34220
+ const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
34221
+
34222
+ // Total number of data codewords
34223
+ const dataTotalCodewords = totalCodewords - ecTotalCodewords;
34224
+
34225
+ // Total number of blocks
34226
+ const ecTotalBlocks = ECCode.getBlocksCount(version, errorCorrectionLevel);
34227
+
34228
+ // Calculate how many blocks each group should contain
34229
+ const blocksInGroup2 = totalCodewords % ecTotalBlocks;
34230
+ const blocksInGroup1 = ecTotalBlocks - blocksInGroup2;
34231
+
34232
+ const totalCodewordsInGroup1 = Math.floor(totalCodewords / ecTotalBlocks);
34233
+
34234
+ const dataCodewordsInGroup1 = Math.floor(dataTotalCodewords / ecTotalBlocks);
34235
+ const dataCodewordsInGroup2 = dataCodewordsInGroup1 + 1;
34236
+
34237
+ // Number of EC codewords is the same for both groups
34238
+ const ecCount = totalCodewordsInGroup1 - dataCodewordsInGroup1;
34239
+
34240
+ // Initialize a Reed-Solomon encoder with a generator polynomial of degree ecCount
34241
+ const rs = new ReedSolomonEncoder(ecCount);
34242
+
34243
+ let offset = 0;
34244
+ const dcData = new Array(ecTotalBlocks);
34245
+ const ecData = new Array(ecTotalBlocks);
34246
+ let maxDataSize = 0;
34247
+ const buffer = new Uint8Array(bitBuffer.buffer);
34248
+
34249
+ // Divide the buffer into the required number of blocks
34250
+ for (let b = 0; b < ecTotalBlocks; b++) {
34251
+ const dataSize = b < blocksInGroup1 ? dataCodewordsInGroup1 : dataCodewordsInGroup2;
34252
+
34253
+ // extract a block of data from buffer
34254
+ dcData[b] = buffer.slice(offset, offset + dataSize);
34255
+
34256
+ // Calculate EC codewords for this data block
34257
+ ecData[b] = rs.encode(dcData[b]);
34258
+
34259
+ offset += dataSize;
34260
+ maxDataSize = Math.max(maxDataSize, dataSize);
34261
+ }
34262
+
34263
+ // Create final data
34264
+ // Interleave the data and error correction codewords from each block
34265
+ const data = new Uint8Array(totalCodewords);
34266
+ let index = 0;
34267
+ let i, r;
34268
+
34269
+ // Add data codewords
34270
+ for (i = 0; i < maxDataSize; i++) {
34271
+ for (r = 0; r < ecTotalBlocks; r++) {
34272
+ if (i < dcData[r].length) {
34273
+ data[index++] = dcData[r][i];
34274
+ }
34275
+ }
34276
+ }
34277
+
34278
+ // Apped EC codewords
34279
+ for (i = 0; i < ecCount; i++) {
34280
+ for (r = 0; r < ecTotalBlocks; r++) {
34281
+ data[index++] = ecData[r][i];
34282
+ }
34283
+ }
34284
+
34285
+ return data
34286
+ }
34287
+
34288
+ /**
34289
+ * Build QR Code symbol
34290
+ *
34291
+ * @param {String} data Input string
34292
+ * @param {Number} version QR Code version
34293
+ * @param {ErrorCorretionLevel} errorCorrectionLevel Error level
34294
+ * @param {MaskPattern} maskPattern Mask pattern
34295
+ * @return {Object} Object containing symbol data
34296
+ */
34297
+ function createSymbol (data, version, errorCorrectionLevel, maskPattern) {
34298
+ let segments;
34299
+
34300
+ if (Array.isArray(data)) {
34301
+ segments = Segments.fromArray(data);
34302
+ } else if (typeof data === 'string') {
34303
+ let estimatedVersion = version;
34304
+
34305
+ if (!estimatedVersion) {
34306
+ const rawSegments = Segments.rawSplit(data);
34307
+
34308
+ // Estimate best version that can contain raw splitted segments
34309
+ estimatedVersion = Version.getBestVersionForData(rawSegments, errorCorrectionLevel);
34310
+ }
34311
+
34312
+ // Build optimized segments
34313
+ // If estimated version is undefined, try with the highest version
34314
+ segments = Segments.fromString(data, estimatedVersion || 40);
34315
+ } else {
34316
+ throw new Error('Invalid data')
34317
+ }
34318
+
34319
+ // Get the min version that can contain data
34320
+ const bestVersion = Version.getBestVersionForData(segments, errorCorrectionLevel);
34321
+
34322
+ // If no version is found, data cannot be stored
34323
+ if (!bestVersion) {
34324
+ throw new Error('The amount of data is too big to be stored in a QR Code')
34325
+ }
34326
+
34327
+ // If not specified, use min version as default
34328
+ if (!version) {
34329
+ version = bestVersion;
34330
+
34331
+ // Check if the specified version can contain the data
34332
+ } else if (version < bestVersion) {
34333
+ throw new Error('\n' +
34334
+ 'The chosen QR Code version cannot contain this amount of data.\n' +
34335
+ 'Minimum version required to store current data is: ' + bestVersion + '.\n'
34336
+ )
34337
+ }
34338
+
34339
+ const dataBits = createData(version, errorCorrectionLevel, segments);
34340
+
34341
+ // Allocate matrix buffer
34342
+ const moduleCount = Utils.getSymbolSize(version);
34343
+ const modules = new BitMatrix(moduleCount);
34344
+
34345
+ // Add function modules
34346
+ setupFinderPattern(modules, version);
34347
+ setupTimingPattern(modules);
34348
+ setupAlignmentPattern(modules, version);
34349
+
34350
+ // Add temporary dummy bits for format info just to set them as reserved.
34351
+ // This is needed to prevent these bits from being masked by {@link MaskPattern.applyMask}
34352
+ // since the masking operation must be performed only on the encoding region.
34353
+ // These blocks will be replaced with correct values later in code.
34354
+ setupFormatInfo(modules, errorCorrectionLevel, 0);
34355
+
34356
+ if (version >= 7) {
34357
+ setupVersionInfo(modules, version);
34358
+ }
34359
+
34360
+ // Add data codewords
34361
+ setupData(modules, dataBits);
34362
+
34363
+ if (isNaN(maskPattern)) {
34364
+ // Find best mask pattern
34365
+ maskPattern = MaskPattern.getBestMask(modules,
34366
+ setupFormatInfo.bind(null, modules, errorCorrectionLevel));
34367
+ }
34368
+
34369
+ // Apply mask pattern
34370
+ MaskPattern.applyMask(maskPattern, modules);
34371
+
34372
+ // Replace format info bits with correct values
34373
+ setupFormatInfo(modules, errorCorrectionLevel, maskPattern);
34374
+
34375
+ return {
34376
+ modules: modules,
34377
+ version: version,
34378
+ errorCorrectionLevel: errorCorrectionLevel,
34379
+ maskPattern: maskPattern,
34380
+ segments: segments
34381
+ }
34382
+ }
34383
+
34384
+ /**
34385
+ * QR Code
34386
+ *
34387
+ * @param {String | Array} data Input data
34388
+ * @param {Object} options Optional configurations
34389
+ * @param {Number} options.version QR Code version
34390
+ * @param {String} options.errorCorrectionLevel Error correction level
34391
+ * @param {Function} options.toSJISFunc Helper func to convert utf8 to sjis
34392
+ */
34393
+ qrcode.create = function create (data, options) {
34394
+ if (typeof data === 'undefined' || data === '') {
34395
+ throw new Error('No input text')
34396
+ }
34397
+
34398
+ let errorCorrectionLevel = ECLevel.M;
34399
+ let version;
34400
+ let mask;
34401
+
34402
+ if (typeof options !== 'undefined') {
34403
+ // Use higher error correction level as default
34404
+ errorCorrectionLevel = ECLevel.from(options.errorCorrectionLevel, ECLevel.M);
34405
+ version = Version.from(options.version);
34406
+ mask = MaskPattern.from(options.maskPattern);
34407
+
34408
+ if (options.toSJISFunc) {
34409
+ Utils.setToSJISFunction(options.toSJISFunc);
34410
+ }
34411
+ }
34412
+
34413
+ return createSymbol(data, version, errorCorrectionLevel, mask)
34414
+ };
34415
+ return qrcode;
34416
+ }
34417
+
34418
+ var canvas = {};
34419
+
34420
+ var utils = {};
34421
+
34422
+ var hasRequiredUtils;
34423
+
34424
+ function requireUtils () {
34425
+ if (hasRequiredUtils) return utils;
34426
+ hasRequiredUtils = 1;
34427
+ (function (exports) {
34428
+ function hex2rgba (hex) {
34429
+ if (typeof hex === 'number') {
34430
+ hex = hex.toString();
34431
+ }
34432
+
34433
+ if (typeof hex !== 'string') {
34434
+ throw new Error('Color should be defined as hex string')
34435
+ }
34436
+
34437
+ let hexCode = hex.slice().replace('#', '').split('');
34438
+ if (hexCode.length < 3 || hexCode.length === 5 || hexCode.length > 8) {
34439
+ throw new Error('Invalid hex color: ' + hex)
34440
+ }
34441
+
34442
+ // Convert from short to long form (fff -> ffffff)
34443
+ if (hexCode.length === 3 || hexCode.length === 4) {
34444
+ hexCode = Array.prototype.concat.apply([], hexCode.map(function (c) {
34445
+ return [c, c]
34446
+ }));
34447
+ }
34448
+
34449
+ // Add default alpha value
34450
+ if (hexCode.length === 6) hexCode.push('F', 'F');
34451
+
34452
+ const hexValue = parseInt(hexCode.join(''), 16);
34453
+
34454
+ return {
34455
+ r: (hexValue >> 24) & 255,
34456
+ g: (hexValue >> 16) & 255,
34457
+ b: (hexValue >> 8) & 255,
34458
+ a: hexValue & 255,
34459
+ hex: '#' + hexCode.slice(0, 6).join('')
34460
+ }
34461
+ }
34462
+
34463
+ exports.getOptions = function getOptions (options) {
34464
+ if (!options) options = {};
34465
+ if (!options.color) options.color = {};
34466
+
34467
+ const margin = typeof options.margin === 'undefined' ||
34468
+ options.margin === null ||
34469
+ options.margin < 0
34470
+ ? 4
34471
+ : options.margin;
34472
+
34473
+ const width = options.width && options.width >= 21 ? options.width : undefined;
34474
+ const scale = options.scale || 4;
34475
+
34476
+ return {
34477
+ width: width,
34478
+ scale: width ? 4 : scale,
34479
+ margin: margin,
34480
+ color: {
34481
+ dark: hex2rgba(options.color.dark || '#000000ff'),
34482
+ light: hex2rgba(options.color.light || '#ffffffff')
34483
+ },
34484
+ type: options.type,
34485
+ rendererOpts: options.rendererOpts || {}
34486
+ }
34487
+ };
34488
+
34489
+ exports.getScale = function getScale (qrSize, opts) {
34490
+ return opts.width && opts.width >= qrSize + opts.margin * 2
34491
+ ? opts.width / (qrSize + opts.margin * 2)
34492
+ : opts.scale
34493
+ };
34494
+
34495
+ exports.getImageWidth = function getImageWidth (qrSize, opts) {
34496
+ const scale = exports.getScale(qrSize, opts);
34497
+ return Math.floor((qrSize + opts.margin * 2) * scale)
34498
+ };
34499
+
34500
+ exports.qrToImageData = function qrToImageData (imgData, qr, opts) {
34501
+ const size = qr.modules.size;
34502
+ const data = qr.modules.data;
34503
+ const scale = exports.getScale(size, opts);
34504
+ const symbolSize = Math.floor((size + opts.margin * 2) * scale);
34505
+ const scaledMargin = opts.margin * scale;
34506
+ const palette = [opts.color.light, opts.color.dark];
34507
+
34508
+ for (let i = 0; i < symbolSize; i++) {
34509
+ for (let j = 0; j < symbolSize; j++) {
34510
+ let posDst = (i * symbolSize + j) * 4;
34511
+ let pxColor = opts.color.light;
34512
+
34513
+ if (i >= scaledMargin && j >= scaledMargin &&
34514
+ i < symbolSize - scaledMargin && j < symbolSize - scaledMargin) {
34515
+ const iSrc = Math.floor((i - scaledMargin) / scale);
34516
+ const jSrc = Math.floor((j - scaledMargin) / scale);
34517
+ pxColor = palette[data[iSrc * size + jSrc] ? 1 : 0];
34518
+ }
34519
+
34520
+ imgData[posDst++] = pxColor.r;
34521
+ imgData[posDst++] = pxColor.g;
34522
+ imgData[posDst++] = pxColor.b;
34523
+ imgData[posDst] = pxColor.a;
34524
+ }
34525
+ }
34526
+ };
34527
+ } (utils));
34528
+ return utils;
34529
+ }
34530
+
34531
+ var hasRequiredCanvas;
34532
+
34533
+ function requireCanvas () {
34534
+ if (hasRequiredCanvas) return canvas;
34535
+ hasRequiredCanvas = 1;
34536
+ (function (exports) {
34537
+ const Utils = requireUtils();
34538
+
34539
+ function clearCanvas (ctx, canvas, size) {
34540
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
34541
+
34542
+ if (!canvas.style) canvas.style = {};
34543
+ canvas.height = size;
34544
+ canvas.width = size;
34545
+ canvas.style.height = size + 'px';
34546
+ canvas.style.width = size + 'px';
34547
+ }
34548
+
34549
+ function getCanvasElement () {
34550
+ try {
34551
+ return document.createElement('canvas')
34552
+ } catch (e) {
34553
+ throw new Error('You need to specify a canvas element')
34554
+ }
34555
+ }
34556
+
34557
+ exports.render = function render (qrData, canvas, options) {
34558
+ let opts = options;
34559
+ let canvasEl = canvas;
34560
+
34561
+ if (typeof opts === 'undefined' && (!canvas || !canvas.getContext)) {
34562
+ opts = canvas;
34563
+ canvas = undefined;
34564
+ }
34565
+
34566
+ if (!canvas) {
34567
+ canvasEl = getCanvasElement();
34568
+ }
34569
+
34570
+ opts = Utils.getOptions(opts);
34571
+ const size = Utils.getImageWidth(qrData.modules.size, opts);
34572
+
34573
+ const ctx = canvasEl.getContext('2d');
34574
+ const image = ctx.createImageData(size, size);
34575
+ Utils.qrToImageData(image.data, qrData, opts);
34576
+
34577
+ clearCanvas(ctx, canvasEl, size);
34578
+ ctx.putImageData(image, 0, 0);
34579
+
34580
+ return canvasEl
34581
+ };
34582
+
34583
+ exports.renderToDataURL = function renderToDataURL (qrData, canvas, options) {
34584
+ let opts = options;
34585
+
34586
+ if (typeof opts === 'undefined' && (!canvas || !canvas.getContext)) {
34587
+ opts = canvas;
34588
+ canvas = undefined;
34589
+ }
34590
+
34591
+ if (!opts) opts = {};
34592
+
34593
+ const canvasEl = exports.render(qrData, canvas, opts);
34594
+
34595
+ const type = opts.type || 'image/png';
34596
+ const rendererOpts = opts.rendererOpts || {};
34597
+
34598
+ return canvasEl.toDataURL(type, rendererOpts.quality)
34599
+ };
34600
+ } (canvas));
34601
+ return canvas;
34602
+ }
34603
+
34604
+ var svgTag = {};
34605
+
34606
+ var hasRequiredSvgTag;
34607
+
34608
+ function requireSvgTag () {
34609
+ if (hasRequiredSvgTag) return svgTag;
34610
+ hasRequiredSvgTag = 1;
34611
+ const Utils = requireUtils();
34612
+
34613
+ function getColorAttrib (color, attrib) {
34614
+ const alpha = color.a / 255;
34615
+ const str = attrib + '="' + color.hex + '"';
34616
+
34617
+ return alpha < 1
34618
+ ? str + ' ' + attrib + '-opacity="' + alpha.toFixed(2).slice(1) + '"'
34619
+ : str
34620
+ }
34621
+
34622
+ function svgCmd (cmd, x, y) {
34623
+ let str = cmd + x;
34624
+ if (typeof y !== 'undefined') str += ' ' + y;
34625
+
34626
+ return str
34627
+ }
34628
+
34629
+ function qrToPath (data, size, margin) {
34630
+ let path = '';
34631
+ let moveBy = 0;
34632
+ let newRow = false;
34633
+ let lineLength = 0;
34634
+
34635
+ for (let i = 0; i < data.length; i++) {
34636
+ const col = Math.floor(i % size);
34637
+ const row = Math.floor(i / size);
34638
+
34639
+ if (!col && !newRow) newRow = true;
34640
+
34641
+ if (data[i]) {
34642
+ lineLength++;
34643
+
34644
+ if (!(i > 0 && col > 0 && data[i - 1])) {
34645
+ path += newRow
34646
+ ? svgCmd('M', col + margin, 0.5 + row + margin)
34647
+ : svgCmd('m', moveBy, 0);
34648
+
34649
+ moveBy = 0;
34650
+ newRow = false;
34651
+ }
34652
+
34653
+ if (!(col + 1 < size && data[i + 1])) {
34654
+ path += svgCmd('h', lineLength);
34655
+ lineLength = 0;
34656
+ }
34657
+ } else {
34658
+ moveBy++;
34659
+ }
34660
+ }
34661
+
34662
+ return path
34663
+ }
34664
+
34665
+ svgTag.render = function render (qrData, options, cb) {
34666
+ const opts = Utils.getOptions(options);
34667
+ const size = qrData.modules.size;
34668
+ const data = qrData.modules.data;
34669
+ const qrcodesize = size + opts.margin * 2;
34670
+
34671
+ const bg = !opts.color.light.a
34672
+ ? ''
34673
+ : '<path ' + getColorAttrib(opts.color.light, 'fill') +
34674
+ ' d="M0 0h' + qrcodesize + 'v' + qrcodesize + 'H0z"/>';
34675
+
34676
+ const path =
34677
+ '<path ' + getColorAttrib(opts.color.dark, 'stroke') +
34678
+ ' d="' + qrToPath(data, size, opts.margin) + '"/>';
34679
+
34680
+ const viewBox = 'viewBox="' + '0 0 ' + qrcodesize + ' ' + qrcodesize + '"';
34681
+
34682
+ const width = !opts.width ? '' : 'width="' + opts.width + '" height="' + opts.width + '" ';
34683
+
34684
+ const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg + path + '</svg>\n';
34685
+
34686
+ if (typeof cb === 'function') {
34687
+ cb(null, svgTag);
34688
+ }
34689
+
34690
+ return svgTag
34691
+ };
34692
+ return svgTag;
34693
+ }
34694
+
34695
+ var hasRequiredBrowser;
34696
+
34697
+ function requireBrowser () {
34698
+ if (hasRequiredBrowser) return browser;
34699
+ hasRequiredBrowser = 1;
34700
+ const canPromise = requireCanPromise();
34701
+
34702
+ const QRCode = requireQrcode();
34703
+ const CanvasRenderer = requireCanvas();
34704
+ const SvgRenderer = requireSvgTag();
34705
+
34706
+ function renderCanvas (renderFunc, canvas, text, opts, cb) {
34707
+ const args = [].slice.call(arguments, 1);
34708
+ const argsNum = args.length;
34709
+ const isLastArgCb = typeof args[argsNum - 1] === 'function';
34710
+
34711
+ if (!isLastArgCb && !canPromise()) {
34712
+ throw new Error('Callback required as last argument')
34713
+ }
34714
+
34715
+ if (isLastArgCb) {
34716
+ if (argsNum < 2) {
34717
+ throw new Error('Too few arguments provided')
34718
+ }
34719
+
34720
+ if (argsNum === 2) {
34721
+ cb = text;
34722
+ text = canvas;
34723
+ canvas = opts = undefined;
34724
+ } else if (argsNum === 3) {
34725
+ if (canvas.getContext && typeof cb === 'undefined') {
34726
+ cb = opts;
34727
+ opts = undefined;
34728
+ } else {
34729
+ cb = opts;
34730
+ opts = text;
34731
+ text = canvas;
34732
+ canvas = undefined;
34733
+ }
34734
+ }
34735
+ } else {
34736
+ if (argsNum < 1) {
34737
+ throw new Error('Too few arguments provided')
34738
+ }
34739
+
34740
+ if (argsNum === 1) {
34741
+ text = canvas;
34742
+ canvas = opts = undefined;
34743
+ } else if (argsNum === 2 && !canvas.getContext) {
34744
+ opts = text;
34745
+ text = canvas;
34746
+ canvas = undefined;
34747
+ }
34748
+
34749
+ return new Promise(function (resolve, reject) {
34750
+ try {
34751
+ const data = QRCode.create(text, opts);
34752
+ resolve(renderFunc(data, canvas, opts));
34753
+ } catch (e) {
34754
+ reject(e);
34755
+ }
34756
+ })
34757
+ }
34758
+
34759
+ try {
34760
+ const data = QRCode.create(text, opts);
34761
+ cb(null, renderFunc(data, canvas, opts));
34762
+ } catch (e) {
34763
+ cb(e);
34764
+ }
34765
+ }
34766
+
34767
+ browser.create = QRCode.create;
34768
+ browser.toCanvas = renderCanvas.bind(null, CanvasRenderer.render);
34769
+ browser.toDataURL = renderCanvas.bind(null, CanvasRenderer.renderToDataURL);
34770
+
34771
+ // only svg for now.
34772
+ browser.toString = renderCanvas.bind(null, function (data, _, opts) {
34773
+ return SvgRenderer.render(data, opts)
34774
+ });
34775
+ return browser;
34776
+ }
34777
+
34778
+ var browserExports = requireBrowser();
34779
+ var QRCode = /*@__PURE__*/getDefaultExportFromCjs(browserExports);
34780
+
34781
+ const kritzelShareDialogCss = () => `:host{display:contents}kritzel-dialog{--kritzel-dialog-width-small:420px}.share-content{display:flex;flex-direction:column;gap:20px}.share-section{display:flex;flex-direction:column;gap:8px}.share-section-revoke{padding-top:12px;border-top:1px solid var(--kritzel-share-dialog-border-color, #e5e5e5)}.share-row{display:flex;align-items:center;justify-content:space-between;gap:16px}.share-label-group{display:flex;flex-direction:column;gap:8px;flex:1}.share-label{font-size:14px;font-weight:600;color:var(--kritzel-share-dialog-label-color, #333333);margin:0}.share-description{font-size:12px;color:var(--kritzel-share-dialog-description-color, #666666);margin:0;line-height:1.4}.share-url-container{display:flex;align-items:center;gap:8px;background:var(--kritzel-share-dialog-input-background, #f5f5f5);border:1px solid var(--kritzel-share-dialog-input-border-color, #e0e0e0);border-radius:6px;padding:4px 4px 4px 12px}.share-qr-container{display:flex;justify-content:center;margin-top:16px;margin-bottom:16px}.share-qr-image{width:180px;height:180px;border-radius:8px;border:1px solid var(--kritzel-share-dialog-qr-border-color, #e0e0e0);background:var(--kritzel-share-dialog-qr-background, #ffffff);padding:8px;box-sizing:border-box}.share-url-input{flex:1;border:none;background:transparent;font-size:13px;color:var(--kritzel-share-dialog-input-text-color, #333333);outline:none;min-width:0;padding:8px 0}.share-url-input:focus{outline:none}.share-url-input::selection{background:var(--kritzel-share-dialog-selection-color, #cce5ff)}.copy-button{display:flex;align-items:center;justify-content:center;width:36px;height:36px;border:none;border-radius:4px;background:var(--kritzel-share-dialog-copy-button-background, #ffffff);color:var(--kritzel-share-dialog-copy-button-color, #666666);cursor:pointer;transition:all 0.15s ease;flex-shrink:0}.copy-button:hover{background:var(--kritzel-share-dialog-copy-button-hover-background, #e8e8e8);color:var(--kritzel-share-dialog-copy-button-hover-color, #333333)}.copy-button.copy-success{background:var(--kritzel-share-dialog-copy-success-background, #d4edda);color:var(--kritzel-share-dialog-copy-success-color, #28a745)}.revoke-button{align-self:flex-start;padding:8px 16px;border:1px solid var(--kritzel-share-dialog-revoke-button-border-color, #dc3545);border-radius:6px;background:transparent;color:var(--kritzel-share-dialog-revoke-button-color, #dc3545);font-size:13px;font-weight:500;cursor:pointer;transition:all 0.15s ease}.revoke-button:hover{background:var(--kritzel-share-dialog-revoke-button-hover-background, #dc3545);color:var(--kritzel-share-dialog-revoke-button-hover-color, #ffffff)}kritzel-dropdown{--kritzel-dropdown-trigger-padding:8px 12px;--kritzel-dropdown-trigger-font-size:13px}`;
31675
34782
 
31676
34783
  const KritzelShareDialog = class {
31677
34784
  constructor(hostRef) {
@@ -31692,10 +34799,16 @@ const KritzelShareDialog = class {
31692
34799
  terms = {};
31693
34800
  onIsPublicChange(newValue) {
31694
34801
  this.internalIsPublic = newValue;
34802
+ void this.updateQrCodeDataUrl();
34803
+ }
34804
+ onWorkspaceIdChange() {
34805
+ void this.updateQrCodeDataUrl();
31695
34806
  }
31696
34807
  isDialogOpen = false;
31697
34808
  internalIsPublic = false;
31698
34809
  copySuccess = false;
34810
+ qrCodeDataUrl = '';
34811
+ qrCodeUpdateSequence = 0;
31699
34812
  /**
31700
34813
  * Emitted when the user toggles the public sharing state.
31701
34814
  */
@@ -31710,6 +34823,7 @@ const KritzelShareDialog = class {
31710
34823
  async open() {
31711
34824
  this.internalIsPublic = this.isPublic;
31712
34825
  this.isDialogOpen = true;
34826
+ await this.updateQrCodeDataUrl();
31713
34827
  }
31714
34828
  /**
31715
34829
  * Closes the share dialog.
@@ -31721,8 +34835,37 @@ const KritzelShareDialog = class {
31721
34835
  const enabled = event.detail;
31722
34836
  // Update local state optimistically for immediate UI feedback
31723
34837
  this.internalIsPublic = enabled;
34838
+ void this.updateQrCodeDataUrl();
31724
34839
  this.toggleIsPublic.emit(enabled);
31725
34840
  };
34841
+ async updateQrCodeDataUrl() {
34842
+ if (!this.internalIsPublic) {
34843
+ this.qrCodeDataUrl = '';
34844
+ return;
34845
+ }
34846
+ const shareUrl = this.getShareUrl();
34847
+ if (!shareUrl) {
34848
+ this.qrCodeDataUrl = '';
34849
+ return;
34850
+ }
34851
+ const sequence = ++this.qrCodeUpdateSequence;
34852
+ try {
34853
+ const dataUrl = await QRCode.toDataURL(shareUrl, {
34854
+ margin: 1,
34855
+ width: 180,
34856
+ });
34857
+ if (sequence !== this.qrCodeUpdateSequence) {
34858
+ return;
34859
+ }
34860
+ this.qrCodeDataUrl = dataUrl;
34861
+ }
34862
+ catch {
34863
+ if (sequence !== this.qrCodeUpdateSequence) {
34864
+ return;
34865
+ }
34866
+ this.qrCodeDataUrl = '';
34867
+ }
34868
+ }
31726
34869
  getShareUrl() {
31727
34870
  if (!this.workspaceId)
31728
34871
  return '';
@@ -31760,13 +34903,16 @@ const KritzelShareDialog = class {
31760
34903
  this.dialogClosed.emit();
31761
34904
  };
31762
34905
  render() {
31763
- return (index.h(index.Host, { key: '031cf5d1ab48f2791454d4c7348352295359d225' }, index.h("kritzel-dialog", { key: 'cdce63c86ca329a97d1f1787adcb2b92bbfa40f9', dialogTitle: this.terms['share.dialogTitle'] ?? 'Share Workspace', size: "small", isOpen: this.isDialogOpen, onDialogClose: this.closeDialog, contained: true }, index.h("div", { key: 'dbb62b3cb175358955b11f6c2d74b0b0eecf212e', class: "share-content" }, index.h("div", { key: '8dc0eaea9644b60ff33812dac20def226fa14232', class: "share-section" }, index.h("div", { key: 'd3cfbf05c28a01681b1223edb6f0b73998ccfd08', class: "share-row" }, index.h("div", { key: '2400f062f92dd918341391cf71086c2676f7fc66', class: "share-label-group" }, index.h("label", { key: 'ab01691b9f53f59f92116a2994b6e3551d347c7b', class: "share-label" }, this.terms['share.linkSharing.label'] ?? 'Link sharing'), index.h("p", { key: 'fd830ad21e32e4fc5d8ba97d5cea7ef8da15fba4', class: "share-description" }, this.internalIsPublic
34906
+ return (index.h(index.Host, { key: 'b96c4cc6a9e4778715f496574f307a540285f70c' }, index.h("kritzel-dialog", { key: '9a9cead56cc50042f59f677c0a846fc9fff01a8b', dialogTitle: this.terms['share.dialogTitle'] ?? 'Share Workspace', size: "small", isOpen: this.isDialogOpen, onDialogClose: this.closeDialog, contained: true }, index.h("div", { key: 'f1ffe37126343d84f9cb70f85530596d594c6e04', class: "share-content" }, index.h("div", { key: 'e1b20fccdb127eb30d240a2812742977b6512113', class: "share-section" }, index.h("div", { key: 'fb0d4226d638309fd5696dace0cc0c73d82150fc', class: "share-row" }, index.h("div", { key: '301a27b975bb63610d94e1140aef39aa0594dda6', class: "share-label-group" }, index.h("label", { key: 'acf694843423d42414951ae88ec7eee541dd8f7f', class: "share-label" }, this.terms['share.linkSharing.label'] ?? 'Link sharing'), index.h("p", { key: '4c29b6448a27c69fceadb4166bc878216010475f', class: "share-description" }, this.internalIsPublic
31764
34907
  ? (this.terms['share.linkSharing.enabledDescription'] ?? 'Anyone with the link can access this workspace.')
31765
- : (this.terms['share.linkSharing.disabledDescription'] ?? 'Link sharing is disabled. Only you can access this workspace.'))), index.h("kritzel-slide-toggle", { key: '6f1a71ba524b34753ccd5437eab00bfcbeffdd79', checked: this.internalIsPublic, onCheckedChange: this.handleToggleChange, label: this.terms['share.linkSharing.toggleLabel'] ?? 'Enable link sharing' }))), this.internalIsPublic && (index.h("div", { key: '298680e1afdf0094c5393aa95c4983a0a8dd5e18', class: "share-section" }, index.h("div", { key: '546645a748cf9a42df0c8163f2478ef31445273a', class: "share-url-container" }, index.h("input", { key: '9d5b93d762d1cd899f3fc8041380bae603a4919c', type: "text", class: "share-url-input", value: this.getShareUrl(), readOnly: true, onClick: (e) => e.target.select() }), index.h("button", { key: '747a7ca4a25827de6934b7df30cabc2db4583e1b', class: { 'copy-button': true, 'copy-success': this.copySuccess }, onClick: this.handleCopyUrl, title: this.copySuccess ? (this.terms['share.copyLink.copied'] ?? 'Copied!') : (this.terms['share.copyLink.title'] ?? 'Copy link') }, index.h("kritzel-icon", { key: '096ca9a0527796462769dc9d42dd81d8f97f2865', name: this.copySuccess ? 'check' : 'copy', size: 18 })))))))));
34908
+ : (this.terms['share.linkSharing.disabledDescription'] ?? 'Link sharing is disabled. Only you can access this workspace.'))), index.h("kritzel-slide-toggle", { key: 'c813213e7cf53125993de209e15c921779c019b6', checked: this.internalIsPublic, onCheckedChange: this.handleToggleChange, label: this.terms['share.linkSharing.toggleLabel'] ?? 'Enable link sharing' }))), this.internalIsPublic && (index.h("div", { key: 'af32cbadc775ce4ca3c79bdc0f8b4351c8723b28', class: "share-section" }, index.h("div", { key: 'd5c4e2b8a77306a141cc73c37dc6c57b1dc9daa5', class: "share-url-container" }, index.h("input", { key: 'f2f364c3fabd7f693247f5ad05594bd089a194ea', type: "text", class: "share-url-input", value: this.getShareUrl(), readOnly: true, onClick: (e) => e.target.select() }), index.h("button", { key: 'd27a6f00e6b14bff3f4c8d1694cc8a38eebc5ec0', class: { 'copy-button': true, 'copy-success': this.copySuccess }, onClick: this.handleCopyUrl, title: this.copySuccess ? (this.terms['share.copyLink.copied'] ?? 'Copied!') : (this.terms['share.copyLink.title'] ?? 'Copy link') }, index.h("kritzel-icon", { key: '60c72ee8d789dc14baa4c169f70c78837b0cbd0c', name: this.copySuccess ? 'check' : 'copy', size: 18 }))), this.qrCodeDataUrl && (index.h("div", { key: 'f5d361b7ed145ab5f4f7b89f9c63046ce831220b', class: "share-qr-container" }, index.h("img", { key: '5f2d4650dffab907f5a53dfb2fd4c337da3e51ee', class: "share-qr-image", src: this.qrCodeDataUrl, alt: "QR code for share link" })))))))));
31766
34909
  }
31767
34910
  static get watchers() { return {
31768
34911
  "isPublic": [{
31769
34912
  "onIsPublicChange": 0
34913
+ }],
34914
+ "workspaceId": [{
34915
+ "onWorkspaceIdChange": 0
31770
34916
  }]
31771
34917
  }; }
31772
34918
  };
@@ -31800,7 +34946,7 @@ const KritzelSlideToggle = class {
31800
34946
  }
31801
34947
  };
31802
34948
  render() {
31803
- return (index.h(index.Host, { key: '5850c758ccf3263b21c397219bf2301fa088087d', class: { checked: this.checked, disabled: this.disabled }, tabIndex: this.disabled ? -1 : 0, role: "switch", "aria-checked": this.checked ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : 'false', "aria-label": this.label, onClick: this.handleToggle, onKeyDown: this.handleKeyDown }, index.h("div", { key: 'df0adeca0447a13d5499219ac9d27b526252fdbe', class: "toggle-track" }, index.h("div", { key: '3938239bbdca29e62ed72229dfcf1904fcbaa983', class: "toggle-thumb" }))));
34949
+ return (index.h(index.Host, { key: '00160c9cfdafa0d53f3acfb1fb235b29abf2622a', class: { checked: this.checked, disabled: this.disabled }, tabIndex: this.disabled ? -1 : 0, role: "switch", "aria-checked": this.checked ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : 'false', "aria-label": this.label, onClick: this.handleToggle, onKeyDown: this.handleKeyDown }, index.h("div", { key: '385008948ffbdc0f26249d2d833aae8f04eeb6a0', class: "toggle-track" }, index.h("div", { key: '43929e94335589feb24ee45f1c34a270653dd412', class: "toggle-thumb" }))));
31804
34950
  }
31805
34951
  };
31806
34952
  KritzelSlideToggle.style = kritzelSlideToggleCss();
@@ -31900,7 +35046,7 @@ const KritzelSplitButton = class {
31900
35046
  this.menuScrollTop = event.target.scrollTop;
31901
35047
  };
31902
35048
  render() {
31903
- return (index.h(index.Host, { key: 'd6856a86b3be4d9a22c5e78df1bda19113cb988b', class: { mobile: this.isTouchDevice } }, index.h("button", { key: 'd26026af275a8bd5717254223d5829e3d7f02bcb', class: "split-main-button", tabIndex: 0, onClick: this.handleButtonClick, disabled: this.mainButtonDisabled, "aria-label": "Main action" }, this.buttonIcon && index.h("kritzel-icon", { key: '1b3e2f4c2f8245b281d0f85458fd6bcc0cc73c59', name: this.buttonIcon })), index.h("div", { key: 'b002b904e168d62075fa086c88df72e36cc8e8c2', class: "split-divider" }), index.h("button", { key: 'd39084da6775613f2c896f3fa1ae4e216505bacc', ref: el => (this.splitMenuButtonRef = el), class: "split-menu-button", tabIndex: 0, onClick: this.toggleMenu, disabled: this.menuButtonDisabled, "aria-label": "Open menu" }, index.h("kritzel-icon", { key: 'b1bc427b0d7cd26a283dbeb772dee0a6d2ca172c', name: this.dropdownIcon })), index.h("kritzel-portal", { key: 'e76300f48a23772a5923ea2cbd0824590302e7e7', anchor: this.anchorElement, offsetY: 4, onClose: this.closeMenu }, index.h("kritzel-menu", { key: 'f110b9315ec63dca9bb1b615136b2d3e284567ba', ref: el => (this.menuRef = el), items: this.items, onItemSelect: this.handleItemSelect, onItemSave: this.handleItemSave, onItemCancel: this.handleItemCancel, onItemToggleChildMenu: this.handleItemToggleChildMenu, onItemCloseChildMenu: this.handleItemCloseChildMenu, onClose: this.closeMenu, onScroll: this.handleScroll }))));
35049
+ return (index.h(index.Host, { key: 'fa22dc1185ef07d8127d9ee9f6dbe482d126f934', class: { mobile: this.isTouchDevice } }, index.h("button", { key: 'a48aba702b70e9b24ad5486dde61fa9f9c8f7cdc', class: "split-main-button", tabIndex: 0, onClick: this.handleButtonClick, disabled: this.mainButtonDisabled, "aria-label": "Main action" }, this.buttonIcon && index.h("kritzel-icon", { key: '0d1c9a3e9f744541dd6ebe491105f6ee65233543', name: this.buttonIcon })), index.h("div", { key: 'c9db29f0b9c9cf1974d78f4f60be9e1b0e26c5d2', class: "split-divider" }), index.h("button", { key: '57addfd5228b7c7668be902c53683d12c976b89b', ref: el => (this.splitMenuButtonRef = el), class: "split-menu-button", tabIndex: 0, onClick: this.toggleMenu, disabled: this.menuButtonDisabled, "aria-label": "Open menu" }, index.h("kritzel-icon", { key: 'd860cc503043425860b1234b5d34693bfdd1d5ab', name: this.dropdownIcon })), index.h("kritzel-portal", { key: 'cd6dda8869aea4205d922fc639073019bbd2b102', anchor: this.anchorElement, offsetY: 4, onClose: this.closeMenu }, index.h("kritzel-menu", { key: '1ef1c2b319662e7a2af15b46362addcc75bceb68', ref: el => (this.menuRef = el), items: this.items, onItemSelect: this.handleItemSelect, onItemSave: this.handleItemSave, onItemCancel: this.handleItemCancel, onItemToggleChildMenu: this.handleItemToggleChildMenu, onItemCloseChildMenu: this.handleItemCloseChildMenu, onClose: this.closeMenu, onScroll: this.handleScroll }))));
31904
35050
  }
31905
35051
  };
31906
35052
  KritzelSplitButton.style = kritzelSplitButtonCss();
@@ -31921,7 +35067,7 @@ const KritzelStrokeSize = class {
31921
35067
  }
31922
35068
  render() {
31923
35069
  const sizes = this.sizes ?? [];
31924
- return (index.h(index.Host, { key: 'bde2cc986aebbe869a3eea026654229dee0d3e0e' }, index.h("div", { key: 'f84c4b844b865080f4e0e245bbccc6d77ac3f049', class: "size-grid" }, sizes.map(size => (index.h("div", { tabIndex: 0, class: {
35070
+ return (index.h(index.Host, { key: 'ba181d798d2bf7b60308746635d2077ce1353b83' }, index.h("div", { key: '048fc8934190359b9337747567844ca88925a6ce', class: "size-grid" }, sizes.map(size => (index.h("div", { tabIndex: 0, class: {
31925
35071
  'size-container': true,
31926
35072
  'selected': this.selectedSize === size,
31927
35073
  }, onClick: () => this.handleSizeClick(size) }, index.h("kritzel-color", { value: 'var(--kritzel-global-text-primary)', size: size })))))));
@@ -32302,14 +35448,14 @@ const KritzelTooltip = class {
32302
35448
  }
32303
35449
  }
32304
35450
  render() {
32305
- return (index.h(index.Host, { key: 'ba4d13171aa25acac6c615ee12f35eab96d0aad6', style: {
35451
+ return (index.h(index.Host, { key: '1e318ff48b72ae5e0853a92c61fd4174d6e45271', style: {
32306
35452
  position: 'fixed',
32307
35453
  zIndex: '9999',
32308
35454
  transition: 'opacity 0.3s ease-in-out, transform 0.3s ease-in-out',
32309
35455
  visibility: this.isVisible ? 'visible' : 'hidden',
32310
35456
  left: `${this.positionX}px`,
32311
35457
  bottom: `${this.positionY}px`,
32312
- } }, index.h("div", { key: '923168164a018b08eac4246d88c7f8648b71d078', class: "tooltip-content", onClick: event => event.stopPropagation(), onPointerDown: event => event.stopPropagation(), onMouseDown: event => event.stopPropagation() }, index.h("slot", { key: 'aafad8ab026d591ebb9e2aeffa15d07718eba261' }))));
35458
+ } }, index.h("div", { key: 'c66c9978787c59de6ca29944f666354fed2ab4c3', class: "tooltip-content", onClick: event => event.stopPropagation(), onPointerDown: event => event.stopPropagation(), onMouseDown: event => event.stopPropagation() }, index.h("slot", { key: '664e78076bb988b0829b805aad4393c443db2dc7' }))));
32313
35459
  }
32314
35460
  static get watchers() { return {
32315
35461
  "triggerElement": [{
@@ -32350,7 +35496,7 @@ const KritzelUtilityPanel = class {
32350
35496
  this.redo.emit();
32351
35497
  }
32352
35498
  render() {
32353
- return (index.h(index.Host, { key: '22f3826d57b4d8f0e476951a860bde3dbc6c7200' }, index.h("button", { key: 'c3259c5e924b3cf74920dc4676ec8a682c3273e8', class: "utility-button", "data-testid": "utility-undo", disabled: !this.undoState?.canUndo, onClick: event => this.handleUndo(event), "aria-label": this.terms['utility.undo'] ?? 'Undo' }, index.h("kritzel-icon", { key: 'ab4e9da6b60d9fa470fd8f5002f2acd5a758a8ba', name: "undo" })), index.h("button", { key: 'd17e25e78831b5ee13596cc2639cfbb5bd75a1cb', class: "utility-button", "data-testid": "utility-redo", disabled: !this.undoState?.canRedo, onClick: event => this.handleRedo(event), "aria-label": this.terms['utility.redo'] ?? 'Redo' }, index.h("kritzel-icon", { key: '7ae8cec39ffab1303d76315ab85ac575b886b233', name: "redo" })), index.h("div", { key: 'f54e0262f133ad0eed0bbf853b67edd6c2f5e87f', class: "utility-separator" }), index.h("button", { key: '162d6e85965338b5700e661595dc6da6131ebccf', class: "utility-button", "data-testid": "utility-delete", onClick: () => this.delete.emit(), "aria-label": this.terms['utility.delete'] ?? 'Delete selected items' }, index.h("kritzel-icon", { key: 'dc00247ed45f09b86ad9314395f56e70d1122a4b', name: "delete" }))));
35499
+ return (index.h(index.Host, { key: '90b96b2f4693016650394e085c1ccf5c61759713' }, index.h("button", { key: '325e3a869061ce7fda2d86e74250f4ea7414da8e', class: "utility-button", "data-testid": "utility-undo", disabled: !this.undoState?.canUndo, onClick: event => this.handleUndo(event), "aria-label": this.terms['utility.undo'] ?? 'Undo' }, index.h("kritzel-icon", { key: '70335427bc3a9a54a994ad22935bde4010d8f96b', name: "undo" })), index.h("button", { key: 'cf3000675d594ffe64f947b57e5aabe084be32a7', class: "utility-button", "data-testid": "utility-redo", disabled: !this.undoState?.canRedo, onClick: event => this.handleRedo(event), "aria-label": this.terms['utility.redo'] ?? 'Redo' }, index.h("kritzel-icon", { key: 'b33336374abb36a7cdb685fb970805ec1f4073e2', name: "redo" })), index.h("div", { key: '34323fd33574ba65c825687fec5b772facbd2c62', class: "utility-separator" }), index.h("button", { key: 'aff157ab166ed15b8f9172b5b63f62996ed51c6e', class: "utility-button", "data-testid": "utility-delete", onClick: () => this.delete.emit(), "aria-label": this.terms['utility.delete'] ?? 'Delete selected items' }, index.h("kritzel-icon", { key: '413104d9d493fc47ad5ae8e61af514dfd530f6ee', name: "delete" }))));
32354
35500
  }
32355
35501
  };
32356
35502
  KritzelUtilityPanel.style = kritzelUtilityPanelCss();
@@ -32371,7 +35517,7 @@ const KritzelWatermark = class {
32371
35517
  label;
32372
35518
  render() {
32373
35519
  const label = this.label ?? this.core.localizationManager.translate('watermark.poweredBy');
32374
- return (index.h(index.Host, { key: '975534180d82064e38fa0289a2955e97a4ca0a08' }, index.h("a", { key: 'c59723d1f5bf3089256c0b610d0574bfc385ef85', class: "watermark-link", href: KRITZEL_WEBSITE_URL, target: "_blank", rel: "noopener noreferrer", part: "watermark", onPointerDown: (ev) => ev.stopPropagation(), onPointerUp: (ev) => ev.stopPropagation() }, label)));
35520
+ return (index.h(index.Host, { key: '0eccc75e51c7ac199e23d8f3a871593f1fb65a17' }, index.h("a", { key: '2029f8b56ba8609ca621447eac0df9d30ebfbbbe', class: "watermark-link", href: KRITZEL_WEBSITE_URL, target: "_blank", rel: "noopener noreferrer", part: "watermark", onPointerDown: (ev) => ev.stopPropagation(), onPointerUp: (ev) => ev.stopPropagation() }, label)));
32375
35521
  }
32376
35522
  };
32377
35523
  KritzelWatermark.style = kritzelWatermarkCss();
@@ -32559,7 +35705,7 @@ const KritzelZoomPanel = class {
32559
35705
  return Number.isFinite(this.zoomPercent) ? Math.max(1, Math.round(this.zoomPercent)) : 100;
32560
35706
  }
32561
35707
  render() {
32562
- return (index.h(index.Host, { key: '00d5c674581d4efa40da3a2ad5cbdd8295406590' }, index.h("div", { key: 'c7a4158f57b8062f37ee69f7b198442ec357d746', class: { panel: true, visible: this.visible } }, index.h("button", { key: 'e20344f5e522d481185a9dab7afdb2668cf44408', class: "zoom-button", type: "button", "aria-label": this.terms['zoom.zoomOut'] ?? 'Zoom out', disabled: this.disabled, onClick: this.handleZoomOut }, index.h("kritzel-icon", { key: '4fc1eeb78669894b0939a96c5e6945cea5056ac1', name: "minus" })), index.h("span", { key: 'ed26096e2ca76fe91b50d73ea6c9481996d01590', class: "zoom-level", "aria-live": "polite" }, this.normalizedZoomPercent, "%"), index.h("button", { key: '42609c6e8558b7d9e9e348b864639ead6c4cc9bb', class: "zoom-button", type: "button", "aria-label": this.terms['zoom.zoomIn'] ?? 'Zoom in', disabled: this.disabled, onClick: this.handleZoomIn }, index.h("kritzel-icon", { key: '3a321afb57f532ef867bae73751314f3fd355214', name: "plus" })))));
35708
+ return (index.h(index.Host, { key: '56b65a376d4bd94553416e07f2621192c4457bc2' }, index.h("div", { key: 'bdbfea3b3ee7e37eeb5c5f03388eb92ed8af9962', class: { panel: true, visible: this.visible } }, index.h("button", { key: 'de5ad152aaf7965f731bee95170b67e62af94ea2', class: "zoom-button", type: "button", "aria-label": this.terms['zoom.zoomOut'] ?? 'Zoom out', disabled: this.disabled, onClick: this.handleZoomOut }, index.h("kritzel-icon", { key: '104eb632666c55c032a40e6df2097aaa643fd23b', name: "minus" })), index.h("span", { key: 'd601b324e26a6c2737138b8f151b13dcdb2d20ab', class: "zoom-level", "aria-live": "polite" }, this.normalizedZoomPercent, "%"), index.h("button", { key: 'c976d03c69978f2d5cedf2a94b38419ed81088f6', class: "zoom-button", type: "button", "aria-label": this.terms['zoom.zoomIn'] ?? 'Zoom in', disabled: this.disabled, onClick: this.handleZoomIn }, index.h("kritzel-icon", { key: '844105bd53f3307425789aa6baf0ac3c25407414', name: "plus" })))));
32563
35709
  }
32564
35710
  };
32565
35711
  KritzelZoomPanel.style = kritzelZoomPanelCss();
@@ -32587,6 +35733,7 @@ exports.kritzel_font_size = KritzelFontSize;
32587
35733
  exports.kritzel_icon = KritzelIcon;
32588
35734
  exports.kritzel_input = KritzelInput;
32589
35735
  exports.kritzel_line_endings = KritzelLineEndings;
35736
+ exports.kritzel_loading_overlay = KritzelLoadingOverlay;
32590
35737
  exports.kritzel_login_dialog = KritzelLoginDialog;
32591
35738
  exports.kritzel_master_detail = KritzelMasterDetail;
32592
35739
  exports.kritzel_menu = KritzelMenu;