kritzel-stencil 0.1.77 → 0.1.78

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 (121) hide show
  1. package/dist/cjs/{index-Dc7LOVhs.js → index-BRZ6e6oa.js} +1 -1
  2. package/dist/cjs/index.cjs.js +1 -1
  3. package/dist/cjs/kritzel-active-users_42.cjs.entry.js +63 -43
  4. package/dist/cjs/kritzel-brush-style.cjs.entry.js +1 -1
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/stencil.cjs.js +2 -2
  7. package/dist/cjs/{workspace.migrations-OULs44dI.js → workspace.migrations-sUPrO23c.js} +47 -11
  8. package/dist/collection/collection-manifest.json +1 -1
  9. package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +14 -10
  10. package/dist/collection/components/core/kritzel-engine/kritzel-engine.css +21 -0
  11. package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +8 -4
  12. package/dist/collection/components/ui/kritzel-login-dialog/kritzel-login-dialog.css +3 -0
  13. package/dist/collection/configs/default-engine-config.js +1 -0
  14. package/dist/collection/constants/version.js +1 -1
  15. package/dist/components/index.js +1 -1
  16. package/dist/components/kritzel-active-users.js +1 -1
  17. package/dist/components/kritzel-avatar.js +1 -1
  18. package/dist/components/kritzel-awareness-cursors.js +1 -1
  19. package/dist/components/kritzel-back-to-content.js +1 -1
  20. package/dist/components/kritzel-brush-style.js +1 -1
  21. package/dist/components/kritzel-button.js +1 -1
  22. package/dist/components/kritzel-color-palette.js +1 -1
  23. package/dist/components/kritzel-color.js +1 -1
  24. package/dist/components/kritzel-context-menu.js +1 -1
  25. package/dist/components/kritzel-controls.js +1 -1
  26. package/dist/components/kritzel-current-user-dialog.js +1 -1
  27. package/dist/components/kritzel-current-user.js +1 -1
  28. package/dist/components/kritzel-cursor-trail.js +1 -1
  29. package/dist/components/kritzel-dialog.js +1 -1
  30. package/dist/components/kritzel-dropdown.js +1 -1
  31. package/dist/components/kritzel-editor.js +1 -1
  32. package/dist/components/kritzel-engine.js +1 -1
  33. package/dist/components/kritzel-export.js +1 -1
  34. package/dist/components/kritzel-font-family.js +1 -1
  35. package/dist/components/kritzel-font-size.js +1 -1
  36. package/dist/components/kritzel-font.js +1 -1
  37. package/dist/components/kritzel-icon.js +1 -1
  38. package/dist/components/kritzel-input.js +1 -1
  39. package/dist/components/kritzel-line-endings.js +1 -1
  40. package/dist/components/kritzel-login-dialog.js +1 -1
  41. package/dist/components/kritzel-master-detail.js +1 -1
  42. package/dist/components/kritzel-menu-item.js +1 -1
  43. package/dist/components/kritzel-menu.js +1 -1
  44. package/dist/components/kritzel-more-menu.js +1 -1
  45. package/dist/components/kritzel-numeric-input.js +1 -1
  46. package/dist/components/kritzel-opacity-slider.js +1 -1
  47. package/dist/components/kritzel-pill-tabs.js +1 -1
  48. package/dist/components/kritzel-portal.js +1 -1
  49. package/dist/components/kritzel-settings.js +1 -1
  50. package/dist/components/kritzel-shape-fill.js +1 -1
  51. package/dist/components/kritzel-share-dialog.js +1 -1
  52. package/dist/components/kritzel-slide-toggle.js +1 -1
  53. package/dist/components/kritzel-split-button.js +1 -1
  54. package/dist/components/kritzel-stroke-size.js +1 -1
  55. package/dist/components/kritzel-tool-config.js +1 -1
  56. package/dist/components/kritzel-tooltip.js +1 -1
  57. package/dist/components/kritzel-utility-panel.js +1 -1
  58. package/dist/components/kritzel-workspace-manager.js +1 -1
  59. package/dist/components/{p-Dt-J69xt.js → p-53di1Zko.js} +1 -1
  60. package/dist/components/{p-DS0xx1eT.js → p-6NFl6EB2.js} +1 -1
  61. package/dist/components/{p-DSzQ6H2j.js → p-76W5pG2O.js} +1 -1
  62. package/dist/components/{p-DRbG92F9.js → p-BLsH_Oi0.js} +1 -1
  63. package/dist/components/p-Ban3OlgZ.js +9 -0
  64. package/dist/components/{p-CUkKKbnu.js → p-BrZ_gL8Q.js} +1 -1
  65. package/dist/components/{p-kj9wbLY8.js → p-BuI6Gkzg.js} +1 -1
  66. package/dist/components/{p-BeFUNGEI.js → p-BueaqfA2.js} +1 -1
  67. package/dist/components/{p-BiByyU2C.js → p-C2l9mZ1P.js} +1 -1
  68. package/dist/components/{p-CsR4owzk.js → p-C4fKLlrd.js} +1 -1
  69. package/dist/components/{p-BA0ayKqO.js → p-CBslLN3-.js} +1 -1
  70. package/dist/components/{p-WotNmY5q.js → p-CHY71o5B.js} +1 -1
  71. package/dist/components/{p-KQzWumjB.js → p-CI9Nbh-x.js} +1 -1
  72. package/dist/components/{p-C_X8stam.js → p-CN8IxBlU.js} +1 -1
  73. package/dist/components/{p-_LbtY-TA.js → p-CWMFGEe0.js} +1 -1
  74. package/dist/components/{p-Dj_Qjga5.js → p-CYh7yV-K.js} +1 -1
  75. package/dist/components/{p-xM-_OeRO.js → p-Ck1dhpUQ.js} +1 -1
  76. package/dist/components/{p-b4gyXoju.js → p-Cns7qSKS.js} +1 -1
  77. package/dist/components/{p-C69Stayh.js → p-D14QNK3X.js} +1 -1
  78. package/dist/components/{p-iRL0wQHQ.js → p-D3pNw-SV.js} +1 -1
  79. package/dist/components/{p-BEJQ2kP7.js → p-D5IhryUR.js} +1 -1
  80. package/dist/components/{p-CZhyKp-f.js → p-D7yzmu1l.js} +1 -1
  81. package/dist/components/{p-HLbqRJGs.js → p-DDKjsXCe.js} +1 -1
  82. package/dist/components/{p-TyR-YTXm.js → p-DV7Z_qfa.js} +1 -1
  83. package/dist/components/{p-ByR0VXeU.js → p-DWsCbu01.js} +1 -1
  84. package/dist/components/{p-XS5J5W5_.js → p-DaGZEV0R.js} +1 -1
  85. package/dist/components/{p-Da46jw3N.js → p-DkWWzVg8.js} +1 -1
  86. package/dist/components/{p-D1O7DxL4.js → p-Dr3-pKVg.js} +1 -1
  87. package/dist/components/{p-JdNoaqqb.js → p-Dte67BWd.js} +1 -1
  88. package/dist/components/{p-CHmi1QWx.js → p-DxzDda_J.js} +1 -1
  89. package/dist/components/{p-CAIGuV2J.js → p-KJ4dHzrS.js} +1 -1
  90. package/dist/components/{p-BiouZo1q.js → p-Lhyh6KeB.js} +1 -1
  91. package/dist/components/{p-CFhp1W9F.js → p-Md9Y-b3d.js} +1 -1
  92. package/dist/components/{p-C1uR_ZNW.js → p-ZC5YELQJ.js} +1 -1
  93. package/dist/components/{p-C7SBI_0T.js → p-ZQ2bKafG.js} +1 -1
  94. package/dist/components/{p-0kShCfeb.js → p-_QEHfsIk.js} +1 -1
  95. package/dist/components/{p-DXjuuVq9.js → p-gtQlsorg.js} +1 -1
  96. package/dist/components/{p-GYI7sDxr.js → p-l_YGO7RB.js} +1 -1
  97. package/dist/components/{p-BK1hLBTd.js → p-m1nVDC3G.js} +1 -1
  98. package/dist/components/{p-7o2FWtFx.js → p-pCC6t6BH.js} +1 -1
  99. package/dist/components/p-pGzF7PUB.js +1 -0
  100. package/dist/esm/{index-MV-81ybv.js → index-BbOHefEf.js} +1 -1
  101. package/dist/esm/index.js +1 -1
  102. package/dist/esm/kritzel-active-users_42.entry.js +63 -43
  103. package/dist/esm/kritzel-brush-style.entry.js +1 -1
  104. package/dist/esm/loader.js +2 -2
  105. package/dist/esm/stencil.js +3 -3
  106. package/dist/esm/{workspace.migrations-D6whgl7G.js → workspace.migrations-NhRgr2_H.js} +47 -11
  107. package/dist/stencil/index.esm.js +1 -1
  108. package/dist/stencil/p-4a4b38e4.entry.js +9 -0
  109. package/dist/stencil/{p-fc21e29c.entry.js → p-98238bf9.entry.js} +1 -1
  110. package/dist/stencil/p-NhRgr2_H.js +1 -0
  111. package/dist/stencil/stencil.esm.js +1 -1
  112. package/dist/types/components.d.ts +2 -6
  113. package/dist/types/constants/version.d.ts +1 -1
  114. package/dist/types/interfaces/engine-state.interface.d.ts +1 -0
  115. package/package.json +2 -2
  116. package/dist/components/p-BdGcOXa5.js +0 -9
  117. package/dist/components/p-_CqLIbO6.js +0 -1
  118. package/dist/stencil/p-8fe1ec39.entry.js +0 -9
  119. package/dist/stencil/p-D6whgl7G.js +0 -1
  120. /package/dist/components/{p-pebXO4LU.js → p-CGGiwvWZ.js} +0 -0
  121. /package/dist/stencil/{p-MV-81ybv.js → p-BbOHefEf.js} +0 -0
@@ -2,7 +2,7 @@ const NAMESPACE = 'stencil';
2
2
  const BUILD = /* stencil */ { hotModuleReplacement: false, hydratedSelectorName: "hydrated", lazyLoad: true, propChangeCallback: true, state: true, updatable: true};
3
3
 
4
4
  /*
5
- Stencil Client Platform v4.43.2 | MIT Licensed | https://stenciljs.com
5
+ Stencil Client Platform v4.43.3 | MIT Licensed | https://stenciljs.com
6
6
  */
7
7
 
8
8
 
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { A as APP_STATE_MIGRATIONS, C as CURRENT_APP_STATE_SCHEMA_VERSION, v as CURRENT_WORKSPACE_SCHEMA_VERSION, D as DEFAULT_BRUSH_CONFIG, r as DEFAULT_LINE_TOOL_CONFIG, q as DEFAULT_TEXT_CONFIG, H as HocuspocusSyncProvider, I as IndexedDBSyncProvider, u as KritzelAlignment, o as KritzelAnchorManager, f as KritzelBrushTool, l as KritzelCursorHelper, h as KritzelEraserTool, d as KritzelGroup, b as KritzelImage, i as KritzelImageTool, c as KritzelLine, g as KritzelLineTool, a as KritzelPath, m as KritzelSelectionTool, e as KritzelShape, k as KritzelShapeTool, K as KritzelText, j as KritzelTextTool, p as KritzelThemeManager, n as KritzelWorkspace, S as ShapeType, W as WORKSPACE_EXPORT_VERSION, x as WORKSPACE_MIGRATIONS, t as darkTheme, s as lightTheme, w as runMigrations } from './workspace.migrations-D6whgl7G.js';
1
+ export { A as APP_STATE_MIGRATIONS, C as CURRENT_APP_STATE_SCHEMA_VERSION, v as CURRENT_WORKSPACE_SCHEMA_VERSION, D as DEFAULT_BRUSH_CONFIG, r as DEFAULT_LINE_TOOL_CONFIG, q as DEFAULT_TEXT_CONFIG, H as HocuspocusSyncProvider, I as IndexedDBSyncProvider, u as KritzelAlignment, o as KritzelAnchorManager, f as KritzelBrushTool, l as KritzelCursorHelper, h as KritzelEraserTool, d as KritzelGroup, b as KritzelImage, i as KritzelImageTool, c as KritzelLine, g as KritzelLineTool, a as KritzelPath, m as KritzelSelectionTool, e as KritzelShape, k as KritzelShapeTool, K as KritzelText, j as KritzelTextTool, p as KritzelThemeManager, n as KritzelWorkspace, S as ShapeType, W as WORKSPACE_EXPORT_VERSION, x as WORKSPACE_MIGRATIONS, t as darkTheme, s as lightTheme, w as runMigrations } from './workspace.migrations-NhRgr2_H.js';
2
2
  import * as Y from 'yjs';
3
3
  import { WebsocketProvider } from 'y-websocket';
4
4
  import 'y-indexeddb';
@@ -1,5 +1,5 @@
1
- import { r as registerInstance, h, H as Host, c as createEvent, g as getElement } from './index-MV-81ybv.js';
2
- import { a as KritzelPath, c as KritzelLine, y as KritzelColorHelper, m as KritzelSelectionTool, f as KritzelBrushTool, g as KritzelLineTool, k as KritzelShapeTool, j as KritzelTextTool, z as KritzelDevicesHelper, B as KritzelMouseButton, E as DEFAULT_COLOR_PALETTE, S as ShapeType, D as DEFAULT_BRUSH_CONFIG, h as KritzelEraserTool, r as DEFAULT_LINE_TOOL_CONFIG, q as DEFAULT_TEXT_CONFIG, i as KritzelImageTool, u as KritzelAlignment, H as HocuspocusSyncProvider, I as IndexedDBSyncProvider, F as KritzelSelectionGroup, G as KritzelSelectionBox, J as KritzelIconRegistry, L as KritzelKeyboardHelper, M as KritzelBaseHandler, N as KritzelToolRegistry, O as KritzelBaseObject, n as KritzelWorkspace, d as KritzelGroup, b as KritzelImage, e as KritzelShape, K as KritzelText, w as runMigrations, v as CURRENT_WORKSPACE_SCHEMA_VERSION, x as WORKSPACE_MIGRATIONS, C as CURRENT_APP_STATE_SCHEMA_VERSION, A as APP_STATE_MIGRATIONS, P as ObjectHelper, l as KritzelCursorHelper, o as KritzelAnchorManager, p as KritzelThemeManager, Q as KritzelClassHelper, R as KritzelEventHelper, T as KritzelBaseTool, W as WORKSPACE_EXPORT_VERSION } from './workspace.migrations-D6whgl7G.js';
1
+ import { r as registerInstance, h, H as Host, c as createEvent, g as getElement } from './index-BbOHefEf.js';
2
+ import { a as KritzelPath, c as KritzelLine, y as KritzelColorHelper, m as KritzelSelectionTool, f as KritzelBrushTool, g as KritzelLineTool, k as KritzelShapeTool, j as KritzelTextTool, z as KritzelDevicesHelper, B as KritzelMouseButton, E as DEFAULT_COLOR_PALETTE, S as ShapeType, D as DEFAULT_BRUSH_CONFIG, h as KritzelEraserTool, r as DEFAULT_LINE_TOOL_CONFIG, q as DEFAULT_TEXT_CONFIG, i as KritzelImageTool, u as KritzelAlignment, H as HocuspocusSyncProvider, I as IndexedDBSyncProvider, F as KritzelSelectionGroup, G as KritzelSelectionBox, J as KritzelIconRegistry, L as KritzelKeyboardHelper, M as KritzelBaseHandler, N as KritzelToolRegistry, O as KritzelBaseObject, n as KritzelWorkspace, d as KritzelGroup, b as KritzelImage, e as KritzelShape, K as KritzelText, w as runMigrations, v as CURRENT_WORKSPACE_SCHEMA_VERSION, x as WORKSPACE_MIGRATIONS, C as CURRENT_APP_STATE_SCHEMA_VERSION, A as APP_STATE_MIGRATIONS, P as ObjectHelper, l as KritzelCursorHelper, o as KritzelAnchorManager, p as KritzelThemeManager, Q as KritzelClassHelper, R as KritzelEventHelper, T as KritzelBaseTool, W as WORKSPACE_EXPORT_VERSION } from './workspace.migrations-NhRgr2_H.js';
3
3
  import * as Y from 'yjs';
4
4
  import 'y-websocket';
5
5
  import 'y-indexeddb';
@@ -1869,11 +1869,7 @@ const KritzelEditor = class {
1869
1869
  showSyncProviderInfo: true,
1870
1870
  showMigrationInfo: true,
1871
1871
  };
1872
- user = {
1873
- id: `guest-1`,
1874
- displayName: 'Guest',
1875
- isGuest: false,
1876
- };
1872
+ user;
1877
1873
  activeUsers;
1878
1874
  controls = [
1879
1875
  {
@@ -2022,7 +2018,15 @@ const KritzelEditor = class {
2022
2018
  providers: [HocuspocusSyncProvider, IndexedDBSyncProvider]
2023
2019
  };
2024
2020
  /** Optional login configuration. When provided, a "Sign in" button is shown that opens a login dialog with the configured providers. */
2025
- loginConfig;
2021
+ loginConfig = {
2022
+ providers: [
2023
+ {
2024
+ label: 'Sign in with Google',
2025
+ icon: 'google',
2026
+ name: 'Google',
2027
+ }
2028
+ ]
2029
+ };
2026
2030
  /** Optional unique identifier for namespacing storage keys across multiple editor instances. */
2027
2031
  editorId;
2028
2032
  /** Optional workspace ID to set as active. If provided, the editor will automatically activate the workspace with this ID. */
@@ -2536,7 +2540,7 @@ const KritzelEditor = class {
2536
2540
  const isLoggedIn = this.isLoggedIn;
2537
2541
  const shouldShowCurrentUser = isLoggedIn;
2538
2542
  const shouldShowLoginButton = !!this.loginConfig && !isLoggedIn;
2539
- return (h(Host, { key: 'b52c23bf28392a0061034c0909aadb7abf4d86a7' }, h("div", { key: '7bf75101bef73a2c8481258060e3236a8ca939b4', class: "top-left-buttons" }, h("kritzel-workspace-manager", { key: '69adc1756e00ed56c9980e78929543ad4ecc7b0e', workspaces: this.workspaces, activeWorkspace: this.activeWorkspace, onWorkspaceChange: event => (this.activeWorkspace = event.detail), onIsWorkspaceManagerReady: () => (this.isWorkspaceManagerReady = true) }), h("kritzel-back-to-content", { key: 'd802fe454738919d9108a807eb379b2f31e94ab6', visible: this.isBackToContentButtonVisible, onBackToContent: () => this.backToContent() })), h("kritzel-engine", { key: '2d3ce8937285956d978f3947ffa86872e156b04d', ref: el => (this.engineRef = el), workspace: this.activeWorkspace, activeWorkspaceId: this.activeWorkspaceId, editorId: this.editorId, syncConfig: this.syncConfig, user: this.user, scaleMax: this.scaleMax, lockDrawingScale: this.lockDrawingScale, scaleMin: this.scaleMin, viewportBoundaryLeft: this.viewportBoundaryLeft, viewportBoundaryRight: this.viewportBoundaryRight, viewportBoundaryTop: this.viewportBoundaryTop, viewportBoundaryBottom: this.viewportBoundaryBottom, wheelEnabled: this.wheelEnabled, theme: this.currentTheme, 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) }), h("kritzel-controls", { key: '6d9b0640b205143c7dc21572616624ef707cfe06', class: { 'keyboard-open': this.isVirtualKeyboardOpen }, style: { display: this.isControlsVisible ? 'flex' : 'none' }, ref: el => (this.controlsRef = el), controls: this.controls, isUtilityPanelVisible: this.isUtilityPanelVisible, undoState: this.undoState, theme: this.currentTheme, onIsControlsReady: () => (this.isControlsReady = true) }), h("div", { key: 'c65f16c40d78d8e3eb585e870e414f496e816e82', class: "top-right-buttons" }, h("kritzel-settings", { key: 'a84d5de344011a32be1b4178acc3a5fff246d702', ref: el => (this.settingsRef = el), shortcuts: this.shortcuts, editorId: this.editorId, onSettingsChange: event => this.handleSettingsChange(event) }), h("kritzel-export", { key: '67748d0376f4e7ac39edfc61c1c2cd639664ad78', ref: el => (this.exportRef = el), workspaceName: this.activeWorkspace?.name || 'workspace', onExportPng: () => this.engineRef.exportViewportAsPng(), onExportSvg: () => this.engineRef.exportViewportAsSvg(), onExportJson: event => this.engineRef.downloadAsJson(event.detail) }), h("kritzel-active-users", { key: '1155b8784de2353ae208a2910844bad1e945a891', users: this.activeUsers }), shouldShowCurrentUser && h("kritzel-current-user", { key: 'fb8951eed7f7f5c9117bb0027e9af1aae95088ed', user: this.user }), shouldShowLoginButton && h("kritzel-button", { key: 'd4288b1577082c207696331de4d9fcb1e749fa2a', onButtonClick: () => this.loginDialogRef?.open() }, "Sign in"), h("kritzel-more-menu", { key: '66f0990868bf034a172e6e8db3162a1af0637cf8', items: this.moreMenuItems }), h("kritzel-share-dialog", { key: 'ce3ab2b6db71bf0a4998c16f04521ee39c1715b7', ref: el => (this.shareDialogRef = el), isPublic: this.currentIsPublic, workspaceId: this.activeWorkspace?.id, onToggleIsPublic: this.handleToggleIsPublic }), this.loginConfig && (h("kritzel-login-dialog", { key: 'd3ec7461c2e6a8fcdac4ce13a51f80835888cb44', ref: el => (this.loginDialogRef = el), providers: this.loginConfig.providers, dialogTitle: this.loginConfig.title, subtitle: this.loginConfig.subtitle, onProviderLogin: this.handleProviderLogin })))));
2543
+ return (h(Host, { key: '6dbc3a8c64dd097ba82e46341b3fb97cbd0194db' }, h("div", { key: '26ceb62f59ad830fd651a1712f57e5d711e7c6f4', class: "top-left-buttons" }, h("kritzel-workspace-manager", { key: 'afb4f5b87c5dc0a673444fb27930e43994df4e02', workspaces: this.workspaces, activeWorkspace: this.activeWorkspace, onWorkspaceChange: event => (this.activeWorkspace = event.detail), onIsWorkspaceManagerReady: () => (this.isWorkspaceManagerReady = true) }), h("kritzel-back-to-content", { key: 'f3c0f31841cb819917c3277852bc9b5ce291c09a', visible: this.isBackToContentButtonVisible, onBackToContent: () => this.backToContent() })), h("kritzel-engine", { key: '8a9e57132e6b74ec812ee516dc7f0d5fc6c8a2e1', ref: el => (this.engineRef = el), workspace: this.activeWorkspace, activeWorkspaceId: this.activeWorkspaceId, editorId: this.editorId, syncConfig: this.syncConfig, user: this.user, scaleMax: this.scaleMax, lockDrawingScale: this.lockDrawingScale, scaleMin: this.scaleMin, viewportBoundaryLeft: this.viewportBoundaryLeft, viewportBoundaryRight: this.viewportBoundaryRight, viewportBoundaryTop: this.viewportBoundaryTop, viewportBoundaryBottom: this.viewportBoundaryBottom, wheelEnabled: this.wheelEnabled, theme: this.currentTheme, 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) }), h("kritzel-controls", { key: '6caadf512a0208fecdb18b6d68b17daa522161a3', class: { 'keyboard-open': this.isVirtualKeyboardOpen }, style: { display: this.isControlsVisible ? 'flex' : 'none' }, ref: el => (this.controlsRef = el), controls: this.controls, isUtilityPanelVisible: this.isUtilityPanelVisible, undoState: this.undoState, theme: this.currentTheme, onIsControlsReady: () => (this.isControlsReady = true) }), h("div", { key: 'e27e5f3965be2fd15c83b91470ef87c4031dd7a2', class: "top-right-buttons" }, h("kritzel-settings", { key: '57f8e75287402aecbb7740d46dfa15839de2169f', ref: el => (this.settingsRef = el), shortcuts: this.shortcuts, editorId: this.editorId, onSettingsChange: event => this.handleSettingsChange(event) }), h("kritzel-export", { key: '5ccf176d4fe1221c5d7597bd1c8537cf3324d3ee', ref: el => (this.exportRef = el), workspaceName: this.activeWorkspace?.name || 'workspace', onExportPng: () => this.engineRef.exportViewportAsPng(), onExportSvg: () => this.engineRef.exportViewportAsSvg(), onExportJson: event => this.engineRef.downloadAsJson(event.detail) }), h("kritzel-active-users", { key: '44a334b808706e11163e89b91074ca4ea8ab4b18', users: this.activeUsers }), shouldShowCurrentUser && h("kritzel-current-user", { key: 'bcb3c966e630b1a8fc4ccd438fc8fbb11cd2b167', user: this.user }), shouldShowLoginButton && h("kritzel-button", { key: 'f1957e56257b7c565311e41b770579f7e2bb910d', onButtonClick: () => this.loginDialogRef?.open() }, "Sign in"), h("kritzel-more-menu", { key: 'd8c1d1b51cf87725d68aaf4457b88828986a40dc', items: this.moreMenuItems }), h("kritzel-share-dialog", { key: 'f5840e7f56cf6897ec28b0f28d9b204037bf3348', ref: el => (this.shareDialogRef = el), isPublic: this.currentIsPublic, workspaceId: this.activeWorkspace?.id, onToggleIsPublic: this.handleToggleIsPublic }), this.loginConfig && (h("kritzel-login-dialog", { key: 'cfdcc3d5e7a5e29b0a352f0d4423ae79195dbf69', ref: el => (this.loginDialogRef = el), providers: this.loginConfig.providers, dialogTitle: this.loginConfig.title, subtitle: this.loginConfig.subtitle, onProviderLogin: this.handleProviderLogin })))));
2540
2544
  }
2541
2545
  static get watchers() { return {
2542
2546
  "isEngineReady": [{
@@ -2585,7 +2589,7 @@ function requireLodash () {
2585
2589
  var undefined$1;
2586
2590
 
2587
2591
  /** Used as the semantic version number. */
2588
- var VERSION = '4.17.23';
2592
+ var VERSION = '4.18.1';
2589
2593
 
2590
2594
  /** Used as the size to enable large array optimizations. */
2591
2595
  var LARGE_ARRAY_SIZE = 200;
@@ -2593,7 +2597,8 @@ function requireLodash () {
2593
2597
  /** Error message constants. */
2594
2598
  var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
2595
2599
  FUNC_ERROR_TEXT = 'Expected a function',
2596
- INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`';
2600
+ INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`',
2601
+ INVALID_TEMPL_IMPORTS_ERROR_TEXT = 'Invalid `imports` option passed into `_.template`';
2597
2602
 
2598
2603
  /** Used to stand-in for `undefined` hash values. */
2599
2604
  var HASH_UNDEFINED = '__lodash_hash_undefined__';
@@ -4325,6 +4330,10 @@ function requireLodash () {
4325
4330
  * embedded Ruby (ERB) as well as ES2015 template strings. Change the
4326
4331
  * following template settings to use alternative delimiters.
4327
4332
  *
4333
+ * **Security:** See
4334
+ * [threat model](https://github.com/lodash/lodash/blob/main/threat-model.md)
4335
+ * — `_.template` is insecure and will be removed in v5.
4336
+ *
4328
4337
  * @static
4329
4338
  * @memberOf _
4330
4339
  * @type {Object}
@@ -4873,7 +4882,7 @@ function requireLodash () {
4873
4882
  * @name has
4874
4883
  * @memberOf SetCache
4875
4884
  * @param {*} value The value to search for.
4876
- * @returns {number} Returns `true` if `value` is found, else `false`.
4885
+ * @returns {boolean} Returns `true` if `value` is found, else `false`.
4877
4886
  */
4878
4887
  function setCacheHas(value) {
4879
4888
  return this.__data__.has(value);
@@ -6944,7 +6953,9 @@ function requireLodash () {
6944
6953
  function baseUnset(object, path) {
6945
6954
  path = castPath(path, object);
6946
6955
 
6947
- // Prevent prototype pollution, see: https://github.com/lodash/lodash/security/advisories/GHSA-xxjr-mmjv-4gpg
6956
+ // Prevent prototype pollution:
6957
+ // https://github.com/lodash/lodash/security/advisories/GHSA-xxjr-mmjv-4gpg
6958
+ // https://github.com/lodash/lodash/security/advisories/GHSA-f23m-r3pf-42rh
6948
6959
  var index = -1,
6949
6960
  length = path.length;
6950
6961
 
@@ -6952,32 +6963,17 @@ function requireLodash () {
6952
6963
  return true;
6953
6964
  }
6954
6965
 
6955
- var isRootPrimitive = object == null || (typeof object !== 'object' && typeof object !== 'function');
6956
-
6957
6966
  while (++index < length) {
6958
- var key = path[index];
6959
-
6960
- // skip non-string keys (e.g., Symbols, numbers)
6961
- if (typeof key !== 'string') {
6962
- continue;
6963
- }
6967
+ var key = toKey(path[index]);
6964
6968
 
6965
6969
  // Always block "__proto__" anywhere in the path if it's not expected
6966
6970
  if (key === '__proto__' && !hasOwnProperty.call(object, '__proto__')) {
6967
6971
  return false;
6968
6972
  }
6969
6973
 
6970
- // Block "constructor.prototype" chains
6971
- if (key === 'constructor' &&
6972
- (index + 1) < length &&
6973
- typeof path[index + 1] === 'string' &&
6974
- path[index + 1] === 'prototype') {
6975
-
6976
- // Allow ONLY when the path starts at a primitive root, e.g., _.unset(0, 'constructor.prototype.a')
6977
- if (isRootPrimitive && index === 0) {
6978
- continue;
6979
- }
6980
-
6974
+ // Block constructor/prototype as non-terminal traversal keys to prevent
6975
+ // escaping the object graph into built-in constructors and prototypes.
6976
+ if ((key === 'constructor' || key === 'prototype') && index < length - 1) {
6981
6977
  return false;
6982
6978
  }
6983
6979
  }
@@ -9534,7 +9530,7 @@ function requireLodash () {
9534
9530
 
9535
9531
  /**
9536
9532
  * Creates an array with all falsey values removed. The values `false`, `null`,
9537
- * `0`, `""`, `undefined`, and `NaN` are falsey.
9533
+ * `0`, `-0`, `0n`, `""`, `undefined`, and `NaN` are falsy.
9538
9534
  *
9539
9535
  * @static
9540
9536
  * @memberOf _
@@ -10073,7 +10069,7 @@ function requireLodash () {
10073
10069
 
10074
10070
  while (++index < length) {
10075
10071
  var pair = pairs[index];
10076
- result[pair[0]] = pair[1];
10072
+ baseAssignValue(result, pair[0], pair[1]);
10077
10073
  }
10078
10074
  return result;
10079
10075
  }
@@ -16733,6 +16729,8 @@ function requireLodash () {
16733
16729
  * **Note:** JavaScript follows the IEEE-754 standard for resolving
16734
16730
  * floating-point values which can produce unexpected results.
16735
16731
  *
16732
+ * **Note:** If `lower` is greater than `upper`, the values are swapped.
16733
+ *
16736
16734
  * @static
16737
16735
  * @memberOf _
16738
16736
  * @since 0.7.0
@@ -16746,9 +16744,16 @@ function requireLodash () {
16746
16744
  * _.random(0, 5);
16747
16745
  * // => an integer between 0 and 5
16748
16746
  *
16747
+ * // when lower is greater than upper the values are swapped
16748
+ * _.random(5, 0);
16749
+ * // => an integer between 0 and 5
16750
+ *
16749
16751
  * _.random(5);
16750
16752
  * // => also an integer between 0 and 5
16751
16753
  *
16754
+ * _.random(-5);
16755
+ * // => an integer between -5 and 0
16756
+ *
16752
16757
  * _.random(5, true);
16753
16758
  * // => a floating-point number between 0 and 5
16754
16759
  *
@@ -17350,6 +17355,10 @@ function requireLodash () {
17350
17355
  * properties may be accessed as free variables in the template. If a setting
17351
17356
  * object is given, it takes precedence over `_.templateSettings` values.
17352
17357
  *
17358
+ * **Security:** `_.template` is insecure and should not be used. It will be
17359
+ * removed in Lodash v5. Avoid untrusted input. See
17360
+ * [threat model](https://github.com/lodash/lodash/blob/main/threat-model.md).
17361
+ *
17353
17362
  * **Note:** In the development build `_.template` utilizes
17354
17363
  * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
17355
17364
  * for easier debugging.
@@ -17457,12 +17466,18 @@ function requireLodash () {
17457
17466
  options = undefined$1;
17458
17467
  }
17459
17468
  string = toString(string);
17460
- options = assignInWith({}, options, settings, customDefaultsAssignIn);
17469
+ options = assignWith({}, options, settings, customDefaultsAssignIn);
17461
17470
 
17462
- var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
17471
+ var imports = assignWith({}, options.imports, settings.imports, customDefaultsAssignIn),
17463
17472
  importsKeys = keys(imports),
17464
17473
  importsValues = baseValues(imports, importsKeys);
17465
17474
 
17475
+ arrayEach(importsKeys, function(key) {
17476
+ if (reForbiddenIdentifierChars.test(key)) {
17477
+ throw new Error(INVALID_TEMPL_IMPORTS_ERROR_TEXT);
17478
+ }
17479
+ });
17480
+
17466
17481
  var isEscaping,
17467
17482
  isEvaluating,
17468
17483
  index = 0,
@@ -20889,6 +20904,7 @@ const DEFAULT_ENGINE_CONFIG = {
20889
20904
  isDrawing: false,
20890
20905
  isErasing: false,
20891
20906
  isWriting: false,
20907
+ isWorkspaceLoading: false,
20892
20908
  isCtrlKeyPressed: false,
20893
20909
  isContextMenuVisible: false,
20894
20910
  contextMenuItems: [],
@@ -25468,7 +25484,7 @@ async function toPng(node, options = {}) {
25468
25484
  return canvas.toDataURL();
25469
25485
  }
25470
25486
 
25471
- 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}`;
25487
+ 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;background-color:var(--kritzel-loading-overlay-background, rgba(255, 255, 255, 0.6));color:var(--kritzel-loading-overlay-color, #333);font-size:1.25rem;pointer-events:all;animation:workspace-loading-fade-in var(--kritzel-loading-overlay-delay, 300ms) ease-out forwards;opacity:0}@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}`;
25472
25488
 
25473
25489
  const KritzelEngine = class {
25474
25490
  get host() { return getElement(this); }
@@ -26780,6 +26796,7 @@ const KritzelEngine = class {
26780
26796
  await this._workspaceInitializationPromise;
26781
26797
  return;
26782
26798
  }
26799
+ this.core.store.state.isWorkspaceLoading = true;
26783
26800
  const initializationPromise = this.core.initializeWorkspace(workspace, options);
26784
26801
  this._workspaceInitializationPromise = initializationPromise;
26785
26802
  this._workspaceInitializationTargetKey = targetKey;
@@ -26791,6 +26808,7 @@ const KritzelEngine = class {
26791
26808
  this._workspaceInitializationPromise = null;
26792
26809
  this._workspaceInitializationTargetKey = null;
26793
26810
  }
26811
+ this.core.store.state.isWorkspaceLoading = false;
26794
26812
  }
26795
26813
  }
26796
26814
  emitObjectsChange() {
@@ -26858,7 +26876,7 @@ const KritzelEngine = class {
26858
26876
  this.emitObjectsInViewportChange();
26859
26877
  }
26860
26878
  }
26861
- return (h(Host, null, this.core.store.state.debugInfo.showViewportInfo && (h("div", { class: "debug-panel" }, h("div", null, "ActiveWorkspaceId: ", this.core.store.state?.activeWorkspace?.id), h("div", null, "ActiveWorkspaceName: ", this.core.store.state?.activeWorkspace?.name), h("div", null, "TranslateX: ", this.core.store.state?.translateX), h("div", null, "TranslateY: ", this.core.store.state?.translateY), h("div", null, "ViewportWidth: ", this.core.store.state?.viewportWidth), h("div", null, "ViewportHeight: ", this.core.store.state?.viewportHeight), h("div", null, "PointerCount: ", this.core.store.state.pointers.size), h("div", null, "Scale: ", this.core.store.state?.scale), h("div", null, "ActiveTool: ", this.core.store.state?.activeTool?.name), h("div", null, "HasViewportChanged: ", this.core.store.state?.hasViewportChanged ? 'true' : 'false'), h("div", null, "IsEnabled: ", this.core.store.state?.isEnabled ? 'true' : 'false'), h("div", null, "IsScaling: ", this.core.store.state?.isScaling ? 'true' : 'false'), h("div", null, "IsPanning: ", this.core.store.state?.isPanning ? 'true' : 'false'), h("div", null, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), h("div", null, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), h("div", null, "IsResizeHandleSelected: ", this.core.store.state.isResizeHandleSelected ? 'true' : 'false'), h("div", null, "IsRotationHandleSelected: ", this.core.store.state.isRotationHandleSelected ? 'true' : 'false'), h("div", null, "IsRotationHandleHovered: ", this.core.store.state.isRotationHandleHovered ? 'true' : 'false'), h("div", null, "IsDrawing: ", this.core.store.state.isDrawing ? 'true' : 'false'), h("div", null, "IsWriting: ", this.core.store.state.isWriting ? 'true' : 'false'), h("div", null, "IsPointerDown: ", this.core.store.isPointerDown ? 'true' : 'false'), h("div", null, "PointerX: ", this.core.store.state?.pointerX), h("div", null, "PointerY: ", this.core.store.state?.pointerY), h("div", null, "TotalObjects: ", this.core.store.totalObjectCount), h("div", null, "ObjectsInViewport: ", this.core.store.objectsInViewport.length), h("div", null, "SelectedObjects: ", this.core.store.selectionGroup?.objects.length || 0), h("div", null, "ViewportCenter: (", viewportCenterX.toFixed(2), ", ", viewportCenterY.toFixed(2), ")"))), h("div", { id: "origin", class: "origin", style: {
26879
+ return (h(Host, null, this.core.store.state.isWorkspaceLoading && (h("div", { class: "workspace-loading-overlay" }, "Loading...")), this.core.store.state.debugInfo.showViewportInfo && (h("div", { class: "debug-panel" }, h("div", null, "ActiveWorkspaceId: ", this.core.store.state?.activeWorkspace?.id), h("div", null, "ActiveWorkspaceName: ", this.core.store.state?.activeWorkspace?.name), h("div", null, "TranslateX: ", this.core.store.state?.translateX), h("div", null, "TranslateY: ", this.core.store.state?.translateY), h("div", null, "ViewportWidth: ", this.core.store.state?.viewportWidth), h("div", null, "ViewportHeight: ", this.core.store.state?.viewportHeight), h("div", null, "PointerCount: ", this.core.store.state.pointers.size), h("div", null, "Scale: ", this.core.store.state?.scale), h("div", null, "ActiveTool: ", this.core.store.state?.activeTool?.name), h("div", null, "HasViewportChanged: ", this.core.store.state?.hasViewportChanged ? 'true' : 'false'), h("div", null, "IsEnabled: ", this.core.store.state?.isEnabled ? 'true' : 'false'), h("div", null, "IsScaling: ", this.core.store.state?.isScaling ? 'true' : 'false'), h("div", null, "IsPanning: ", this.core.store.state?.isPanning ? 'true' : 'false'), h("div", null, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), h("div", null, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), h("div", null, "IsResizeHandleSelected: ", this.core.store.state.isResizeHandleSelected ? 'true' : 'false'), h("div", null, "IsRotationHandleSelected: ", this.core.store.state.isRotationHandleSelected ? 'true' : 'false'), h("div", null, "IsRotationHandleHovered: ", this.core.store.state.isRotationHandleHovered ? 'true' : 'false'), h("div", null, "IsDrawing: ", this.core.store.state.isDrawing ? 'true' : 'false'), h("div", null, "IsWriting: ", this.core.store.state.isWriting ? 'true' : 'false'), h("div", null, "IsPointerDown: ", this.core.store.isPointerDown ? 'true' : 'false'), h("div", null, "PointerX: ", this.core.store.state?.pointerX), h("div", null, "PointerY: ", this.core.store.state?.pointerY), h("div", null, "TotalObjects: ", this.core.store.totalObjectCount), h("div", null, "ObjectsInViewport: ", this.core.store.objectsInViewport.length), h("div", null, "SelectedObjects: ", this.core.store.selectionGroup?.objects.length || 0), h("div", null, "ViewportCenter: (", viewportCenterX.toFixed(2), ", ", viewportCenterY.toFixed(2), ")"))), h("div", { id: "origin", class: "origin", style: {
26862
26880
  transform: `matrix(${this.core.store.state?.scale}, 0, 0, ${this.core.store.state?.scale}, ${this.core.store.state?.translateX}, ${this.core.store.state?.translateY})`,
26863
26881
  } }, visibleObjects?.map(object => {
26864
26882
  return (h("div", { key: object.id, id: object.id, class: "object", style: {
@@ -27009,14 +27027,16 @@ const KritzelEngine = class {
27009
27027
  (() => {
27010
27028
  const isSelectionGroup = KritzelClassHelper.isInstanceOf(object, 'KritzelSelectionGroup');
27011
27029
  const localClientId = this.core.store.state.objects?.localClientId;
27030
+ const awarenessStates = this.core.store.state.objects?.awareness?.getStates();
27012
27031
  const isRemoteSelection = isSelectionGroup && (
27013
27032
  // Different user
27014
27033
  (object.userId != null && this.core.user?.id != null && object.userId !== this.core.user.id) ||
27015
- // Same user but different client (e.g. same account in two browser tabs)
27016
- (object.clientId != null && localClientId != null && object.clientId !== localClientId));
27034
+ // Same user but different client that is still actively connected (e.g. same account on another device)
27035
+ (object.userId != null && this.core.user?.id != null && object.userId === this.core.user.id &&
27036
+ object.clientId != null && localClientId != null && object.clientId !== localClientId &&
27037
+ awarenessStates?.has(object.clientId) === true));
27017
27038
  let remoteUserColor;
27018
27039
  if (isRemoteSelection) {
27019
- const awarenessStates = this.core.store.state.objects?.awareness?.getStates();
27020
27040
  if (awarenessStates) {
27021
27041
  // Try direct lookup by clientId first (most precise)
27022
27042
  if (isSelectionGroup && object.clientId != null) {
@@ -27619,7 +27639,7 @@ const KritzelLineEndings = class {
27619
27639
  };
27620
27640
  KritzelLineEndings.style = kritzelLineEndingsCss();
27621
27641
 
27622
- 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;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}`;
27642
+ 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}`;
27623
27643
 
27624
27644
  const KritzelLoginDialog = class {
27625
27645
  constructor(hostRef) {
@@ -28517,7 +28537,7 @@ const KritzelPortal = class {
28517
28537
  * This file is auto-generated by the version bump scripts.
28518
28538
  * Do not modify manually.
28519
28539
  */
28520
- const KRITZEL_VERSION = '0.1.77';
28540
+ const KRITZEL_VERSION = '0.1.78';
28521
28541
 
28522
28542
  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)}`;
28523
28543
 
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, c as createEvent, h, H as Host } from './index-MV-81ybv.js';
1
+ import { r as registerInstance, c as createEvent, h, H as Host } from './index-BbOHefEf.js';
2
2
 
3
3
  const kritzelBrushStyleCss = () => `:host{display:flex;align-items:flex-start;gap:8px;padding:8px;box-sizing:border-box;width:100%}.brush-style-button{display:flex;justify-content:center;align-items:center;width:42px;height:32px;padding:0;border:none;outline:none;background:none;border-radius:0;color:var(--control-text-color);font-weight:bold;-webkit-tap-highlight-color:transparent}.font-style-button:not(:last-child){border-right:1px solid #333333}.font-style-button:hover{background-color:var(--control-hover-bg)}.font-style-button:active{background-color:var(--control-active-bg)}.font-style-button.selected,.font-style-button.selected:hover,.font-style-button.selected:active{background-color:var(--control-selected-bg);color:var(--control-selected-color)}`;
4
4
 
@@ -1,5 +1,5 @@
1
- import { b as bootstrapLazy } from './index-MV-81ybv.js';
2
- export { s as setNonce } from './index-MV-81ybv.js';
1
+ import { b as bootstrapLazy } from './index-BbOHefEf.js';
2
+ export { s as setNonce } from './index-BbOHefEf.js';
3
3
  import { g as globalScripts } from './app-globals-DQuL1Twl.js';
4
4
 
5
5
  const defineCustomElements = async (win, options) => {
@@ -1,9 +1,9 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-MV-81ybv.js';
2
- export { s as setNonce } from './index-MV-81ybv.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-BbOHefEf.js';
2
+ export { s as setNonce } from './index-BbOHefEf.js';
3
3
  import { g as globalScripts } from './app-globals-DQuL1Twl.js';
4
4
 
5
5
  /*
6
- Stencil Client Patch Browser v4.43.2 | MIT Licensed | https://stenciljs.com
6
+ Stencil Client Patch Browser v4.43.3 | MIT Licensed | https://stenciljs.com
7
7
  */
8
8
 
9
9
  var patchBrowser = () => {
@@ -5032,7 +5032,8 @@ class ReplaceStep extends Step {
5032
5032
  return new ReplaceStep(this.from, this.from + this.slice.size, doc.slice(this.from, this.to));
5033
5033
  }
5034
5034
  map(mapping) {
5035
- let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
5035
+ let to = mapping.mapResult(this.to, -1);
5036
+ let from = this.from == this.to && ReplaceStep.MAP_BIAS < 0 ? to : mapping.mapResult(this.from, 1);
5036
5037
  if (from.deletedAcross && to.deletedAcross)
5037
5038
  return null;
5038
5039
  return new ReplaceStep(from.pos, Math.max(from.pos, to.pos), this.slice, this.structure);
@@ -5071,6 +5072,15 @@ class ReplaceStep extends Step {
5071
5072
  return new ReplaceStep(json.from, json.to, Slice.fromJSON(schema, json.slice), !!json.structure);
5072
5073
  }
5073
5074
  }
5075
+ /**
5076
+ By default, for backwards compatibility, an inserting step
5077
+ mapped over an insertion at that same position fill move after
5078
+ the inserted content. In a collaborative editing situation, that
5079
+ can make redone insertions appear in unexpected places. You can
5080
+ set this to -1 to make such mapping keep the step before the
5081
+ insertion instead.
5082
+ */
5083
+ ReplaceStep.MAP_BIAS = 1;
5074
5084
  Step.jsonID("replace", ReplaceStep);
5075
5085
  /**
5076
5086
  Replace a part of the document with a slice of content, but
@@ -5988,6 +5998,26 @@ function replaceRangeWith(tr, from, to, node) {
5988
5998
  }
5989
5999
  function deleteRange(tr, from, to) {
5990
6000
  let $from = tr.doc.resolve(from), $to = tr.doc.resolve(to);
6001
+ // When the deleted range spans from the start of one textblock to
6002
+ // the start of another one, move out of the start of both blocks.
6003
+ if ($from.parent.isTextblock && $to.parent.isTextblock && $from.start() != $to.start() &&
6004
+ $from.parentOffset == 0 && $to.parentOffset == 0) {
6005
+ let shared = $from.sharedDepth(to), isolated = false;
6006
+ for (let d = $from.depth; d > shared; d--)
6007
+ if ($from.node(d).type.spec.isolating)
6008
+ isolated = true;
6009
+ for (let d = $to.depth; d > shared; d--)
6010
+ if ($to.node(d).type.spec.isolating)
6011
+ isolated = true;
6012
+ if (!isolated) {
6013
+ for (let d = $from.depth; d > 0 && from == $from.start(d); d--)
6014
+ from = $from.before(d);
6015
+ for (let d = $to.depth; d > 0 && to == $to.start(d); d--)
6016
+ to = $to.before(d);
6017
+ $from = tr.doc.resolve(from);
6018
+ $to = tr.doc.resolve(to);
6019
+ }
6020
+ }
5991
6021
  let covered = coveredDepths($from, $to);
5992
6022
  for (let i = 0; i < covered.length; i++) {
5993
6023
  let depth = covered[i], last = i == covered.length - 1;
@@ -10756,8 +10786,8 @@ class MouseDown {
10756
10786
  this.target = targetDesc && targetDesc.nodeDOM.nodeType == 1 ? targetDesc.nodeDOM : null;
10757
10787
  let { selection } = view.state;
10758
10788
  if (event.button == 0 &&
10759
- targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false ||
10760
- selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos)
10789
+ (targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false ||
10790
+ selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos))
10761
10791
  this.mightDrag = {
10762
10792
  node: targetNode,
10763
10793
  pos: targetPos,
@@ -11106,8 +11136,9 @@ class Dragging {
11106
11136
  }
11107
11137
  const dragCopyModifier = mac$3 ? "altKey" : "ctrlKey";
11108
11138
  function dragMoves(view, event) {
11109
- let moves = view.someProp("dragCopies", test => !test(event));
11110
- return moves != null ? moves : !event[dragCopyModifier];
11139
+ let copy;
11140
+ view.someProp("dragCopies", test => { copy = copy || test(event); });
11141
+ return copy != null ? !copy : !event[dragCopyModifier];
11111
11142
  }
11112
11143
  handlers.dragstart = (view, _event) => {
11113
11144
  let event = _event;
@@ -11134,7 +11165,7 @@ handlers.dragstart = (view, _event) => {
11134
11165
  if (!event.dataTransfer.files.length || !chrome || chrome_version > 120)
11135
11166
  event.dataTransfer.clearData();
11136
11167
  event.dataTransfer.setData(brokenClipboardAPI ? "Text" : "text/html", dom.innerHTML);
11137
- // See https://github.com/ProseMirror/prosemirror/issues/1156
11168
+ // See https://code.haverbeke.berlin/prosemirror/prosemirror/issues/1156
11138
11169
  event.dataTransfer.effectAllowed = "copyMove";
11139
11170
  if (!brokenClipboardAPI)
11140
11171
  event.dataTransfer.setData("text/plain", text);
@@ -12133,8 +12164,13 @@ class DOMObserver {
12133
12164
  for (let node of added)
12134
12165
  if (node.nodeName == "BR" && node.parentNode) {
12135
12166
  let after = node.nextSibling;
12136
- if (after && after.nodeType == 1 && after.contentEditable == "false")
12137
- node.parentNode.removeChild(node);
12167
+ while (after && after.nodeType == 1) {
12168
+ if (after.contentEditable == "false") {
12169
+ node.parentNode.removeChild(node);
12170
+ break;
12171
+ }
12172
+ after = after.firstChild;
12173
+ }
12138
12174
  }
12139
12175
  }
12140
12176
  else if (gecko && added.length) {
@@ -12754,7 +12790,7 @@ class EditorView {
12754
12790
  this.pluginViews = [];
12755
12791
  /**
12756
12792
  Holds `true` when a hack node is needed in Firefox to prevent the
12757
- [space is eaten issue](https://github.com/ProseMirror/prosemirror/issues/651)
12793
+ [space is eaten issue](https://code.haverbeke.berlin/prosemirror/prosemirror/issues/651)
12758
12794
  @internal
12759
12795
  */
12760
12796
  this.requiresGeckoHackNode = false;
@@ -12972,12 +13008,12 @@ class EditorView {
12972
13008
  }
12973
13009
  updateDraggedNode(dragging, prev) {
12974
13010
  let sel = dragging.node, found = -1;
12975
- if (this.state.doc.nodeAt(sel.from) == sel.node) {
13011
+ if (sel.from < this.state.doc.content.size && this.state.doc.nodeAt(sel.from) == sel.node) {
12976
13012
  found = sel.from;
12977
13013
  }
12978
13014
  else {
12979
13015
  let movedPos = sel.from + (this.state.doc.content.size - prev.doc.content.size);
12980
- let moved = movedPos > 0 && this.state.doc.nodeAt(movedPos);
13016
+ let moved = movedPos > 0 && movedPos < this.state.doc.content.size && this.state.doc.nodeAt(movedPos);
12981
13017
  if (moved == sel.node)
12982
13018
  found = movedPos;
12983
13019
  }
@@ -1 +1 @@
1
- export{A as APP_STATE_MIGRATIONS,C as CURRENT_APP_STATE_SCHEMA_VERSION,v as CURRENT_WORKSPACE_SCHEMA_VERSION,D as DEFAULT_BRUSH_CONFIG,r as DEFAULT_LINE_TOOL_CONFIG,q as DEFAULT_TEXT_CONFIG,H as HocuspocusSyncProvider,I as IndexedDBSyncProvider,u as KritzelAlignment,o as KritzelAnchorManager,f as KritzelBrushTool,l as KritzelCursorHelper,h as KritzelEraserTool,d as KritzelGroup,b as KritzelImage,i as KritzelImageTool,c as KritzelLine,g as KritzelLineTool,a as KritzelPath,m as KritzelSelectionTool,e as KritzelShape,k as KritzelShapeTool,K as KritzelText,j as KritzelTextTool,p as KritzelThemeManager,n as KritzelWorkspace,S as ShapeType,W as WORKSPACE_EXPORT_VERSION,x as WORKSPACE_MIGRATIONS,t as darkTheme,s as lightTheme,w as runMigrations}from"./p-D6whgl7G.js";import*as T from"yjs";import{WebsocketProvider as y}from"y-websocket";import"y-indexeddb";const E=Math.floor,_=127,z=Number.MAX_SAFE_INTEGER;class P{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const R=()=>new P,U=t=>{const s=new Uint8Array((t=>{let s=t.cpos;for(let e=0;e<t.bufs.length;e++)s+=t.bufs[e].length;return s})(t));let e=0;for(let i=0;i<t.bufs.length;i++){const n=t.bufs[i];s.set(n,e),e+=n.length}return s.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),e),s},O=(t,s)=>{const e=t.cbuf.length;t.cpos===e&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(2*e),t.cpos=0),t.cbuf[t.cpos++]=s},N=(t,s)=>{for(;s>_;)O(t,128|_&s),s=E(s/128);O(t,_&s)},M=(t,s)=>{N(t,s.byteLength),((t,s)=>{const e=t.cbuf.length,i=t.cpos,n=((t,s)=>t<s?t:s)(e-i,s.length),r=s.length-n;t.cbuf.set(s.subarray(0,n),i),t.cpos+=n,r>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(((t,s)=>t>s?t:s)(2*e,r)),t.cbuf.set(s.subarray(n)),t.cpos=r)})(t,s)},L=t=>new Error(t),B=L("Unexpected end of array"),G=L("Integer out of Range");class F{constructor(t){this.arr=t,this.pos=0}}const V=t=>((t,s)=>{const e=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,s);return t.pos+=s,e})(t,$(t)),$=t=>{let s=0,e=1;const i=t.arr.length;for(;t.pos<i;){const i=t.arr[t.pos++];if(s+=(i&_)*e,e*=128,i<128)return s;if(s>z)throw G}throw B};class X{type="local";doc;channel;_synced=!1;constructor(t,s,e){this.doc=s,this.channel=new BroadcastChannel(t),this.channel.onmessage=t=>{this.handleMessage(t.data)},this.doc.on("update",this.handleDocUpdate),this.broadcastSync(),setTimeout((()=>{this._synced=!0}),100),e?.quiet||console.info(`BroadcastChannel Provider initialized: ${t}`)}handleDocUpdate=(t,s)=>{if(s!==this){const s=R();N(s,0),M(s,t),this.channel.postMessage(U(s))}};handleMessage(t){const s=(e=new Uint8Array(t),new F(e));var e;switch($(s)){case 0:const t=V(s);T.applyUpdate(this.doc,t,this);break;case 1:this.broadcastSync();break;case 2:const e=V(s),i=T.encodeStateAsUpdate(this.doc,e);if(i.length>0){const t=R();N(t,0),M(t,i),this.channel.postMessage(U(t))}}}broadcastSync(){const t=R();N(t,2),M(t,T.encodeStateVector(this.doc)),this.channel.postMessage(U(t))}async connect(){if(!this._synced)return new Promise((t=>{const s=()=>{this._synced?t():setTimeout(s,50)};s()}))}disconnect(){}async reconnect(){return this.disconnect(),this.connect()}destroy(){this.doc.off("update",this.handleDocUpdate),this.channel.close()}}class J{type="network";provider;isConnected=!1;_quiet=!1;get awareness(){return this.provider.awareness}constructor(t,s,e){const i=e?.url||"ws://localhost:1234",n=e?.roomName||t;this.provider=new y(i,n,s,{params:e?.params,protocols:e?.protocols,WebSocketPolyfill:e?.WebSocketPolyfill,awareness:e?.awareness,maxBackoffTime:e?.maxBackoffTime,disableBc:!0}),this._quiet=e?.quiet??!1,this.setupEventListeners(),this._quiet||console.info(`WebSocket Provider initialized: ${i}/${n}`)}static with(t){return{create:(s,e,i)=>{const n=i?{...t,...i}:t;return new J(s,e,n)}}}setupEventListeners(){this.provider.on("status",(({status:t})=>{"connected"===t?(this.isConnected=!0,this._quiet||console.info("WebSocket connected")):"disconnected"===t&&(this.isConnected=!1,this._quiet||console.info("WebSocket disconnected"))})),this.provider.on("sync",(t=>{t&&!this._quiet&&console.info("WebSocket synced")}))}async connect(){if(!this.isConnected)return new Promise(((t,s)=>{const e=setTimeout((()=>{s(new Error("WebSocket connection timeout"))}),1e4),i=({status:s})=>{"connected"===s&&(clearTimeout(e),this.provider.off("status",i),this.isConnected=!0,t())};this.provider.on("status",i),this.provider.wsconnected&&(clearTimeout(e),this.provider.off("status",i),this.isConnected=!0,t())}))}disconnect(){this.provider&&this.provider.disconnect(),this.isConnected=!1}async reconnect(){return this.disconnect(),this.connect()}destroy(){this.provider&&this.provider.destroy(),this.isConnected=!1}}export{X as BroadcastSyncProvider,J as WebSocketSyncProvider}
1
+ export{A as APP_STATE_MIGRATIONS,C as CURRENT_APP_STATE_SCHEMA_VERSION,v as CURRENT_WORKSPACE_SCHEMA_VERSION,D as DEFAULT_BRUSH_CONFIG,r as DEFAULT_LINE_TOOL_CONFIG,q as DEFAULT_TEXT_CONFIG,H as HocuspocusSyncProvider,I as IndexedDBSyncProvider,u as KritzelAlignment,o as KritzelAnchorManager,f as KritzelBrushTool,l as KritzelCursorHelper,h as KritzelEraserTool,d as KritzelGroup,b as KritzelImage,i as KritzelImageTool,c as KritzelLine,g as KritzelLineTool,a as KritzelPath,m as KritzelSelectionTool,e as KritzelShape,k as KritzelShapeTool,K as KritzelText,j as KritzelTextTool,p as KritzelThemeManager,n as KritzelWorkspace,S as ShapeType,W as WORKSPACE_EXPORT_VERSION,x as WORKSPACE_MIGRATIONS,t as darkTheme,s as lightTheme,w as runMigrations}from"./p-NhRgr2_H.js";import*as T from"yjs";import{WebsocketProvider as y}from"y-websocket";import"y-indexeddb";const E=Math.floor,_=127,z=Number.MAX_SAFE_INTEGER;class P{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const R=()=>new P,U=t=>{const s=new Uint8Array((t=>{let s=t.cpos;for(let e=0;e<t.bufs.length;e++)s+=t.bufs[e].length;return s})(t));let e=0;for(let i=0;i<t.bufs.length;i++){const r=t.bufs[i];s.set(r,e),e+=r.length}return s.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),e),s},O=(t,s)=>{const e=t.cbuf.length;t.cpos===e&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(2*e),t.cpos=0),t.cbuf[t.cpos++]=s},N=(t,s)=>{for(;s>_;)O(t,128|_&s),s=E(s/128);O(t,_&s)},M=(t,s)=>{N(t,s.byteLength),((t,s)=>{const e=t.cbuf.length,i=t.cpos,r=((t,s)=>t<s?t:s)(e-i,s.length),n=s.length-r;t.cbuf.set(s.subarray(0,r),i),t.cpos+=r,n>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(((t,s)=>t>s?t:s)(2*e,n)),t.cbuf.set(s.subarray(r)),t.cpos=n)})(t,s)},L=t=>new Error(t),B=L("Unexpected end of array"),F=L("Integer out of Range");class G{constructor(t){this.arr=t,this.pos=0}}const V=t=>((t,s)=>{const e=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,s);return t.pos+=s,e})(t,$(t)),$=t=>{let s=0,e=1;const i=t.arr.length;for(;t.pos<i;){const i=t.arr[t.pos++];if(s+=(i&_)*e,e*=128,i<128)return s;if(s>z)throw F}throw B};class X{type="local";doc;channel;_synced=!1;constructor(t,s,e){this.doc=s,this.channel=new BroadcastChannel(t),this.channel.onmessage=t=>{this.handleMessage(t.data)},this.doc.on("update",this.handleDocUpdate),this.broadcastSync(),setTimeout((()=>{this._synced=!0}),100),e?.quiet||console.info(`BroadcastChannel Provider initialized: ${t}`)}handleDocUpdate=(t,s)=>{if(s!==this){const s=R();N(s,0),M(s,t),this.channel.postMessage(U(s))}};handleMessage(t){const s=(e=new Uint8Array(t),new G(e));var e;switch($(s)){case 0:const t=V(s);T.applyUpdate(this.doc,t,this);break;case 1:this.broadcastSync();break;case 2:const e=V(s),i=T.encodeStateAsUpdate(this.doc,e);if(i.length>0){const t=R();N(t,0),M(t,i),this.channel.postMessage(U(t))}}}broadcastSync(){const t=R();N(t,2),M(t,T.encodeStateVector(this.doc)),this.channel.postMessage(U(t))}async connect(){if(!this._synced)return new Promise((t=>{const s=()=>{this._synced?t():setTimeout(s,50)};s()}))}disconnect(){}async reconnect(){return this.disconnect(),this.connect()}destroy(){this.doc.off("update",this.handleDocUpdate),this.channel.close()}}class J{type="network";provider;isConnected=!1;_quiet=!1;get awareness(){return this.provider.awareness}constructor(t,s,e){const i=e?.url||"ws://localhost:1234",r=e?.roomName||t;this.provider=new y(i,r,s,{params:e?.params,protocols:e?.protocols,WebSocketPolyfill:e?.WebSocketPolyfill,awareness:e?.awareness,maxBackoffTime:e?.maxBackoffTime,disableBc:!0}),this._quiet=e?.quiet??!1,this.setupEventListeners(),this._quiet||console.info(`WebSocket Provider initialized: ${i}/${r}`)}static with(t){return{create:(s,e,i)=>{const r=i?{...t,...i}:t;return new J(s,e,r)}}}setupEventListeners(){this.provider.on("status",(({status:t})=>{"connected"===t?(this.isConnected=!0,this._quiet||console.info("WebSocket connected")):"disconnected"===t&&(this.isConnected=!1,this._quiet||console.info("WebSocket disconnected"))})),this.provider.on("sync",(t=>{t&&!this._quiet&&console.info("WebSocket synced")}))}async connect(){if(!this.isConnected)return new Promise(((t,s)=>{const e=setTimeout((()=>{s(new Error("WebSocket connection timeout"))}),1e4),i=({status:s})=>{"connected"===s&&(clearTimeout(e),this.provider.off("status",i),this.isConnected=!0,t())};this.provider.on("status",i),this.provider.wsconnected&&(clearTimeout(e),this.provider.off("status",i),this.isConnected=!0,t())}))}disconnect(){this.provider&&this.provider.disconnect(),this.isConnected=!1}async reconnect(){return this.disconnect(),this.connect()}destroy(){this.provider&&this.provider.destroy(),this.isConnected=!1}}export{X as BroadcastSyncProvider,J as WebSocketSyncProvider}