@yoopta/table 4.9.9 → 6.0.0-beta.2

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 (54) hide show
  1. package/README.md +6 -1
  2. package/dist/commands/clear-contents.d.ts +8 -0
  3. package/dist/commands/clear-contents.d.ts.map +1 -0
  4. package/dist/commands/merge-cells.d.ts +11 -0
  5. package/dist/commands/merge-cells.d.ts.map +1 -0
  6. package/dist/commands/{index.d.ts → table-commands.d.ts} +24 -4
  7. package/dist/commands/table-commands.d.ts.map +1 -0
  8. package/dist/events/onKeyDown.d.ts +1 -1
  9. package/dist/events/onKeyDown.d.ts.map +1 -1
  10. package/dist/extenstions/withDelete.d.ts +1 -1
  11. package/dist/extenstions/withDelete.d.ts.map +1 -1
  12. package/dist/extenstions/withSelection.d.ts +1 -1
  13. package/dist/extenstions/withSelection.d.ts.map +1 -1
  14. package/dist/extenstions/withTable.d.ts +1 -1
  15. package/dist/extenstions/withTable.d.ts.map +1 -1
  16. package/dist/extenstions/withTableNormalize.d.ts +1 -1
  17. package/dist/extenstions/withTableNormalize.d.ts.map +1 -1
  18. package/dist/index.d.ts +5 -9
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +1 -33
  21. package/dist/parsers/email/serialize.d.ts +1 -1
  22. package/dist/parsers/email/serialize.d.ts.map +1 -1
  23. package/dist/parsers/html/deserialize.d.ts +2 -2
  24. package/dist/parsers/html/deserialize.d.ts.map +1 -1
  25. package/dist/parsers/html/serialize.d.ts +1 -1
  26. package/dist/parsers/html/serialize.d.ts.map +1 -1
  27. package/dist/parsers/markdown/serialize.d.ts.map +1 -1
  28. package/dist/plugin/{Table.d.ts → table-plugin.d.ts} +2 -2
  29. package/dist/plugin/table-plugin.d.ts.map +1 -0
  30. package/dist/types.d.ts +14 -3
  31. package/dist/types.d.ts.map +1 -1
  32. package/dist/utils/weakMaps.d.ts +3 -3
  33. package/dist/utils/weakMaps.d.ts.map +1 -1
  34. package/package.json +7 -9
  35. package/dist/commands/index.d.ts.map +0 -1
  36. package/dist/components/ResizeHandle.d.ts +0 -7
  37. package/dist/components/ResizeHandle.d.ts.map +0 -1
  38. package/dist/components/TableBlockOptions.d.ts +0 -10
  39. package/dist/components/TableBlockOptions.d.ts.map +0 -1
  40. package/dist/components/TableColumnDragButton.d.ts +0 -9
  41. package/dist/components/TableColumnDragButton.d.ts.map +0 -1
  42. package/dist/components/TableColumnOptions.d.ts +0 -17
  43. package/dist/components/TableColumnOptions.d.ts.map +0 -1
  44. package/dist/components/TableRowDragButton.d.ts +0 -9
  45. package/dist/components/TableRowDragButton.d.ts.map +0 -1
  46. package/dist/components/TableRowOptions.d.ts +0 -17
  47. package/dist/components/TableRowOptions.d.ts.map +0 -1
  48. package/dist/elements/Table.d.ts +0 -5
  49. package/dist/elements/Table.d.ts.map +0 -1
  50. package/dist/elements/TableDataCell.d.ts +0 -5
  51. package/dist/elements/TableDataCell.d.ts.map +0 -1
  52. package/dist/elements/TableRow.d.ts +0 -5
  53. package/dist/elements/TableRow.d.ts.map +0 -1
  54. package/dist/plugin/Table.d.ts.map +0 -1
package/README.md CHANGED
@@ -45,7 +45,12 @@ export type TableCommands = {
45
45
  moveTableColumn: (editor: YooEditor, blockId: string, options: MoveTableOptions) => void,
46
46
  insertTableColumn: (editor: YooEditor, blockId: string, options?: Options) => void,
47
47
  deleteTableColumn: (editor: YooEditor, blockId: string, options?: DeleteOptions) => void,
48
- updateColumnWidth: (editor: YooEditor, blockId: string, columnIndex: number, width: number) => void,
48
+ updateColumnWidth: (
49
+ editor: YooEditor,
50
+ blockId: string,
51
+ columnIndex: number,
52
+ width: number,
53
+ ) => void,
49
54
  toggleHeaderRow: (editor: YooEditor, blockId: string) => void,
50
55
  toggleHeaderColumn: (editor: YooEditor, blockId: string) => void,
51
56
  };
@@ -0,0 +1,8 @@
1
+ import type { YooEditor } from '@yoopta/editor';
2
+ import type { Path } from 'slate';
3
+ import type { TableCellElement } from '../types';
4
+ export type ClearContentsOptions = {
5
+ cells: [TableCellElement, Path][];
6
+ };
7
+ export declare const clearContents: (editor: YooEditor, blockId: string, options: ClearContentsOptions) => void;
8
+ //# sourceMappingURL=clear-contents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clear-contents.d.ts","sourceRoot":"","sources":["../../src/commands/clear-contents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAGlC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,CAAC,gBAAgB,EAAE,IAAI,CAAC,EAAE,CAAC;CACnC,CAAC;AAEF,eAAO,MAAM,aAAa,WAChB,SAAS,WACR,MAAM,WACN,oBAAoB,SA4B9B,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { YooEditor } from '@yoopta/editor';
2
+ import type { Path } from 'slate';
3
+ import type { TableCellElement } from '../types';
4
+ export type MergeCellsOptions = {
5
+ cells: [TableCellElement, Path][];
6
+ };
7
+ /**
8
+ * Merge selected cells into one
9
+ */
10
+ export declare const mergeCells: (editor: YooEditor, blockId: string, options: MergeCellsOptions) => void;
11
+ //# sourceMappingURL=merge-cells.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge-cells.d.ts","sourceRoot":"","sources":["../../src/commands/merge-cells.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAGlC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,CAAC,gBAAgB,EAAE,IAAI,CAAC,EAAE,CAAC;CACnC,CAAC;AAYF;;GAEG;AACH,eAAO,MAAM,UAAU,WAAY,SAAS,WAAW,MAAM,WAAW,iBAAiB,SAmIxF,CAAC"}
@@ -1,6 +1,9 @@
1
- import { YooEditor, YooptaPathIndex } from '@yoopta/editor';
2
- import { Path, Span } from 'slate';
3
- import { InsertTableOptions, TableElement } from '../types';
1
+ import type { YooEditor, YooptaPathIndex } from '@yoopta/editor';
2
+ import type { Span } from 'slate';
3
+ import { Path } from 'slate';
4
+ import type { InsertTableOptions, TableCellElement, TableElement } from '../types';
5
+ import type { ClearContentsOptions } from './clear-contents';
6
+ import type { MergeCellsOptions } from './merge-cells';
4
7
  type Options = {
5
8
  path?: Location | Span;
6
9
  select?: boolean;
@@ -14,6 +17,9 @@ type MoveTableOptions = {
14
17
  type InsertOptions = Partial<InsertTableOptions & {
15
18
  at: YooptaPathIndex;
16
19
  }>;
20
+ type UpdateCellsOptions = {
21
+ cells: [TableCellElement, Path][];
22
+ };
17
23
  export type TableCommands = {
18
24
  buildTableElements: (editor: YooEditor, options?: InsertOptions) => TableElement;
19
25
  insertTable: (editor: YooEditor, options?: InsertOptions) => void;
@@ -27,7 +33,21 @@ export type TableCommands = {
27
33
  updateColumnWidth: (editor: YooEditor, blockId: string, columnIndex: number, width: number) => void;
28
34
  toggleHeaderRow: (editor: YooEditor, blockId: string) => void;
29
35
  toggleHeaderColumn: (editor: YooEditor, blockId: string) => void;
36
+ clearContents: (editor: YooEditor, blockId: string, options: ClearContentsOptions) => void;
37
+ mergeCells: (editor: YooEditor, blockId: string, options: MergeCellsOptions) => void;
38
+ setCellBackgroundColor: (editor: YooEditor, blockId: string, options: UpdateCellsOptions & {
39
+ color: string;
40
+ }) => void;
41
+ setCellTextColor: (editor: YooEditor, blockId: string, options: UpdateCellsOptions & {
42
+ color: string;
43
+ }) => void;
44
+ setCellHorizontalAlign: (editor: YooEditor, blockId: string, options: UpdateCellsOptions & {
45
+ align: 'left' | 'center' | 'right' | 'justify';
46
+ }) => void;
47
+ setCellVerticalAlign: (editor: YooEditor, blockId: string, options: UpdateCellsOptions & {
48
+ align: 'top' | 'middle' | 'bottom';
49
+ }) => void;
30
50
  };
31
51
  export declare const TableCommands: TableCommands;
32
52
  export {};
33
- //# sourceMappingURL=index.d.ts.map
53
+ //# sourceMappingURL=table-commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-commands.d.ts","sourceRoot":"","sources":["../../src/commands/table-commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE/E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAmB,IAAI,EAAc,MAAM,OAAO,CAAC;AAE1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,YAAY,EAAmB,MAAM,UAAU,CAAC;AACpG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGvD,KAAK,OAAO,GAAG;IACb,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;CACjC,CAAC;AAEF,KAAK,aAAa,GAAG,IAAI,CAAC,OAAO,EAAE,YAAY,GAAG,QAAQ,CAAC,CAAC;AAE5D,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,IAAI,CAAC;IACX,EAAE,EAAE,IAAI,CAAC;CACV,CAAC;AAEF,KAAK,aAAa,GAAG,OAAO,CAC1B,kBAAkB,GAAG;IACnB,EAAE,EAAE,eAAe,CAAC;CACrB,CACF,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,KAAK,EAAE,CAAC,gBAAgB,EAAE,IAAI,CAAC,EAAE,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,kBAAkB,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,aAAa,KAAK,YAAY,CAAC;IACjF,WAAW,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;IAClE,WAAW,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1D,cAAc,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAChF,cAAc,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;IACtF,YAAY,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACtF,eAAe,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACzF,iBAAiB,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACnF,iBAAiB,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;IACzF,iBAAiB,EAAE,CACjB,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,KACV,IAAI,CAAC;IACV,eAAe,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9D,kBAAkB,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACjE,aAAa,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC3F,UAAU,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACrF,sBAAsB,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACtH,gBAAgB,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAChH,sBAAsB,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG;QAAE,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAA;KAAE,KAAK,IAAI,CAAC;IACvJ,oBAAoB,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG;QAAE,KAAK,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAA;KAAE,KAAK,IAAI,CAAC;CAC1I,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,aAwc3B,CAAC"}
@@ -1,3 +1,3 @@
1
- import { SlateEditor, YooEditor, PluginEventHandlerOptions } from '@yoopta/editor';
1
+ import type { PluginEventHandlerOptions, SlateEditor, YooEditor } from '@yoopta/editor';
2
2
  export declare function onKeyDown(editor: YooEditor, slate: SlateEditor, { hotkeys, currentBlock }: PluginEventHandlerOptions): (event: any) => void;
3
3
  //# sourceMappingURL=onKeyDown.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"onKeyDown.d.ts","sourceRoot":"","sources":["../../src/events/onKeyDown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAKnF,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,yBAAyB,wBAmKpH"}
1
+ {"version":3,"file":"onKeyDown.d.ts","sourceRoot":"","sources":["../../src/events/onKeyDown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAMxF,wBAAgB,SAAS,CACvB,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,WAAW,EAClB,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,yBAAyB,wBA6KrD"}
@@ -1,3 +1,3 @@
1
- import { SlateEditor } from '@yoopta/editor';
1
+ import type { SlateEditor } from '@yoopta/editor';
2
2
  export declare function withDelete(slate: SlateEditor): SlateEditor;
3
3
  //# sourceMappingURL=withDelete.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"withDelete.d.ts","sourceRoot":"","sources":["../../src/extenstions/withDelete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CA0C1D"}
1
+ {"version":3,"file":"withDelete.d.ts","sourceRoot":"","sources":["../../src/extenstions/withDelete.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CA0C1D"}
@@ -1,3 +1,3 @@
1
- import { SlateEditor } from '@yoopta/editor';
1
+ import type { SlateEditor } from '@yoopta/editor';
2
2
  export declare function withSelection(slate: SlateEditor): SlateEditor;
3
3
  //# sourceMappingURL=withSelection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"withSelection.d.ts","sourceRoot":"","sources":["../../src/extenstions/withSelection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,gBAAgB,CAAC;AAK3D,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CA2E7D"}
1
+ {"version":3,"file":"withSelection.d.ts","sourceRoot":"","sources":["../../src/extenstions/withSelection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAgB,MAAM,gBAAgB,CAAC;AAyFhE,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CA8F7D"}
@@ -1,3 +1,3 @@
1
- import { SlateEditor, YooEditor } from '@yoopta/editor';
1
+ import type { SlateEditor, YooEditor } from '@yoopta/editor';
2
2
  export declare function withTable(slate: SlateEditor, editor: YooEditor): import("slate-react").ReactEditor;
3
3
  //# sourceMappingURL=withTable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"withTable.d.ts","sourceRoot":"","sources":["../../src/extenstions/withTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAKxD,wBAAgB,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,qCAM9D"}
1
+ {"version":3,"file":"withTable.d.ts","sourceRoot":"","sources":["../../src/extenstions/withTable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAM7D,wBAAgB,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,qCAM9D"}
@@ -1,3 +1,3 @@
1
- import { SlateEditor, YooEditor } from '@yoopta/editor';
1
+ import type { SlateEditor, YooEditor } from '@yoopta/editor';
2
2
  export declare function withTableNormalize(slate: SlateEditor, editor: YooEditor): SlateEditor;
3
3
  //# sourceMappingURL=withTableNormalize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"withTableNormalize.d.ts","sourceRoot":"","sources":["../../src/extenstions/withTableNormalize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGpE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,GAAG,WAAW,CA6CrF"}
1
+ {"version":3,"file":"withTableNormalize.d.ts","sourceRoot":"","sources":["../../src/extenstions/withTableNormalize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAI7D,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,GAAG,WAAW,CA6CrF"}
package/dist/index.d.ts CHANGED
@@ -1,11 +1,7 @@
1
- import { TableElement, TableRowElement, TableCellElement } from './types';
2
- import './styles.css';
3
- import { Table } from './plugin/Table';
4
- declare module 'slate' {
5
- interface CustomTypes {
6
- Element: TableElement | TableRowElement | TableCellElement;
7
- }
8
- }
9
- export { TableCommands } from './commands';
1
+ import { Table } from './plugin/table-plugin';
2
+ import type { TableCellElement, TableElement, TableRowElement } from './types';
3
+ export { TABLE_CELLS_IN_SELECTION, TABLE_SLATE_TO_SELECTION_SET } from './utils/weakMaps';
4
+ export { TableCommands } from './commands/table-commands';
5
+ export type { TableCellElement, TableElement, TableRowElement };
10
6
  export default Table;
11
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,OAAO,QAAQ,OAAO,CAAC;IACrB,UAAU,WAAW;QACnB,OAAO,EAAE,YAAY,GAAG,eAAe,GAAG,gBAAgB,CAAC;KAC5D;CACF;AAED,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/E,OAAO,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,eAAe,EAAE,CAAC;AAEhE,eAAe,KAAK,CAAC"}
package/dist/index.js CHANGED
@@ -1,33 +1 @@
1
- import{generateId as e,Blocks as t,Elements as n,UI as r,useYooptaEditor as o,useBlockData as i,deserializeTextNodes as a,serializeTextNodes as s,serializeTextNodesIntoMarkdown as l,YooptaPlugin as c}from"@yoopta/editor";import{jsxs as d,jsx as u,Fragment as f}from"react/jsx-runtime";import*as p from"react";import{forwardRef as h,createElement as m,useRef as y,useEffect as b,useLayoutEffect as g,useState as v,useMemo as w}from"react";import*as x from"react-dom";function k(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".yoo-table-mr-2{margin-right:.5rem}.yoo-table-block{display:block}.yoo-table-flex{display:flex}.yoo-table-h-4{height:1rem}.yoo-table-h-\\[14px\\]{height:14px}.yoo-table-w-4{width:1rem}.yoo-table-w-\\[14px\\]{width:14px}.yoo-table-flex-shrink-0{flex-shrink:0}.yoo-table-rotate-180{--tw-rotate:180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.yoo-table-justify-between{justify-content:space-between}.yoopta-table-block{overflow-x:auto;overflow-y:hidden;padding-bottom:.5rem;padding-top:.5rem;position:relative;width:100%}.yoopta-table-block .yoopta-table-options{opacity:0;top:12px;transition:opacity .15s ease-in-out}.yoopta-table-block:hover .yoopta-table-options{opacity:1}.yoopta-table{--tw-border-spacing-x:0px;--tw-border-spacing-y:0px;border-collapse:collapse;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y);caption-side:bottom;font-size:.875rem;line-height:1.25rem;table-layout:fixed;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:auto}.yoopta-table-selecting ::-moz-selection{background:none}.yoopta-table-selecting ::selection{background:none}.yoopta-table tbody{-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-table-row{position:relative;transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.yoopta-table-row-selected{border-color:#73b6db;border-width:2px}.yoopta-table-data-cell{fill:currentColor;border-width:1px;border:1px solid #e9e9e7;color:inherit;min-height:32px;position:relative;transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);vertical-align:top}.yoopta-table-data-cell[data-cell-selected=true]{background-color:#37352f14}.yoopta-table-data-cell-head{background-color:#f7f6f3}.yoopta-table-data-cell:hover .yoopta-table-column-button,.yoopta-table-data-cell:hover .yoopta-table-row-button{opacity:1}.yoopta-table-data-cell-content{background-color:transparent;caret-color:#37352f;font-size:14px;line-height:20px;max-width:100%;overflow-wrap:break-word;padding:7px 9px;white-space:pre-wrap;width:100%}.yoopta-table-column-button{height:16px;left:calc(50% - 13px);padding:2px 4px;top:-8px;width:26px}.yoopta-table-column-button,.yoopta-table-row-button{--tw-bg-opacity:1;composes:yoopta-button;fill:rgba(55,53,47,.35);align-items:center;background-color:rgb(255 255 255/var(--tw-bg-opacity));border-radius:4px;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),hsla(0,0%,6%,.1) 0 0 0 1px,hsla(0,0%,6%,.1) 0 2px 4px;cursor:pointer;display:flex;justify-content:center;opacity:0;position:absolute;transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:4}.yoopta-table-row-button{height:26px;left:-8px;padding:4px 2px;top:calc(50% - 13px);width:16px}.yoopta-table-icons{height:1rem;margin-right:.5rem;width:1rem}.yoopta-table-resize-handle{flex-grow:0;height:100%;position:absolute;right:0;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:0;z-index:1}.yoopta-table-resize-handle-inner{background-color:#2383e200;cursor:col-resize;height:calc(100% + 2px);margin-left:-1px;margin-top:-1px;position:absolute;transition-delay:50ms;transition-duration:.15s;transition-property:background;transition-timing-function:cubic-bezier(.4,0,.2,1);-webkit-user-select:none;-moz-user-select:none;user-select:none;width:3px}.yoopta-table-resize-handle-inner:hover{background-color:#74b6db}"),"function"==typeof SuppressedError&&SuppressedError;
2
- /**
3
- * @license lucide-react v0.453.0 - ISC
4
- *
5
- * This source code is licensed under the ISC license.
6
- * See the LICENSE file in the root directory of this source tree.
7
- */
8
- const O=(...e)=>e.filter(((e,t,n)=>Boolean(e)&&n.indexOf(e)===t)).join(" ")
9
- /**
10
- * @license lucide-react v0.453.0 - ISC
11
- *
12
- * This source code is licensed under the ISC license.
13
- * See the LICENSE file in the root directory of this source tree.
14
- */;var E={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};
15
- /**
16
- * @license lucide-react v0.453.0 - ISC
17
- *
18
- * This source code is licensed under the ISC license.
19
- * See the LICENSE file in the root directory of this source tree.
20
- */const _=h((({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:a,...s},l)=>m("svg",{ref:l,...E,width:t,height:t,stroke:e,strokeWidth:r?24*Number(n)/Number(t):n,className:O("lucide",o),...s},[...a.map((([e,t])=>m(e,t))),...Array.isArray(i)?i:[i]]))),P=(e,t)=>{const n=h((({className:n,...r},o)=>{return m(_,{ref:o,iconNode:t,className:O(`lucide-${i=e,i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,n),...r});var i}));return n.displayName=`${e}`,n},j=P("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),N=P("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),S=P("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),C=P("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]),R=P("CornerUpRight",[["polyline",{points:"15 14 20 9 15 4",key:"1tbx3s"}],["path",{d:"M4 20v-7a4 4 0 0 1 4-4h12",key:"1lu4f8"}]]),T=P("MoveDown",[["path",{d:"M8 18L12 22L16 18",key:"cskvfv"}],["path",{d:"M12 2V22",key:"r89rzk"}]]),A=P("MoveLeft",[["path",{d:"M6 8L2 12L6 16",key:"kyvwex"}],["path",{d:"M2 12H22",key:"1m8cig"}]]),M=P("MoveRight",[["path",{d:"M18 8L22 12L18 16",key:"1r0oui"}],["path",{d:"M2 12H22",key:"1m8cig"}]]),z=P("MoveUp",[["path",{d:"M8 6L12 2L16 6",key:"1yvkyx"}],["path",{d:"M12 2V22",key:"r89rzk"}]]),D=P("Sheet",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["line",{x1:"3",x2:"21",y1:"9",y2:"9",key:"1vqk6q"}],["line",{x1:"3",x2:"21",y1:"15",y2:"15",key:"o2sbyz"}],["line",{x1:"9",x2:"9",y1:"9",y2:"21",key:"1ib60c"}],["line",{x1:"15",x2:"15",y1:"9",y2:"21",key:"1n26ft"}]]),L=P("TableProperties",[["path",{d:"M15 3v18",key:"14nvp0"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]),B=P("Trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]]);
21
- /**
22
- * @license lucide-react v0.453.0 - ISC
23
- *
24
- * This source code is licensed under the ISC license.
25
- * See the LICENSE file in the root directory of this source tree.
26
- */
27
- /*!
28
- * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
29
- *
30
- * Copyright (c) 2014-2017, Jon Schlinkert.
31
- * Released under the MIT License.
32
- */
33
- function H(e){return"[object Object]"===Object.prototype.toString.call(e)}function I(e){var t,n;return!1!==H(e)&&(void 0===(t=e.constructor)||!1!==H(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf"))}var $=Symbol.for("immer-nothing"),q=Symbol.for("immer-draftable"),F=Symbol.for("immer-state");function W(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var V=Object.getPrototypeOf;function K(e){return!!e&&!!e[F]}function Z(e){return!!e&&(U(e)||Array.isArray(e)||!!e[q]||!!e.constructor?.[q]||ee(e)||te(e))}var X=Object.prototype.constructor.toString();function U(e){if(!e||"object"!=typeof e)return!1;const t=V(e);if(null===t)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===X}function J(e,t){0===Y(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function Y(e){const t=e[F];return t?t.type_:Array.isArray(e)?1:ee(e)?2:te(e)?3:0}function G(e,t){return 2===Y(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Q(e,t,n){const r=Y(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function ee(e){return e instanceof Map}function te(e){return e instanceof Set}function ne(e){return e.copy_||e.base_}function re(e,t){if(ee(e))return new Map(e);if(te(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&U(e)){if(!V(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[F];let r=Reflect.ownKeys(n);for(let t=0;t<r.length;t++){const o=r[t],i=n[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(V(e),n)}function oe(e,t=!1){return ae(e)||K(e)||!Z(e)||(Y(e)>1&&(e.set=e.add=e.clear=e.delete=ie),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>oe(t,!0)))),e}function ie(){W(2)}function ae(e){return Object.isFrozen(e)}var se,le={};function ce(e){const t=le[e];return t||W(0),t}function de(){return se}function ue(e,t){t&&(ce("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function fe(e){pe(e),e.drafts_.forEach(me),e.drafts_=null}function pe(e){e===se&&(se=e.parent_)}function he(e){return se={drafts_:[],parent_:se,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function me(e){const t=e[F];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function ye(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[F].modified_&&(fe(t),W(4)),Z(e)&&(e=be(t,e),t.parent_||ve(t,e)),t.patches_&&ce("Patches").generateReplacementPatches_(n[F].base_,e,t.patches_,t.inversePatches_)):e=be(t,n,[]),fe(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==$?e:void 0}function be(e,t,n){if(ae(t))return t;const r=t[F];if(!r)return J(t,((o,i)=>ge(e,r,t,o,i,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return ve(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let o=t,i=!1;3===r.type_&&(o=new Set(t),t.clear(),i=!0),J(o,((o,a)=>ge(e,r,t,o,a,n,i))),ve(e,t,!1),n&&e.patches_&&ce("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function ge(e,t,n,r,o,i,a){if(K(o)){const a=be(e,o,i&&t&&3!==t.type_&&!G(t.assigned_,r)?i.concat(r):void 0);if(Q(n,r,a),!K(a))return;e.canAutoFreeze_=!1}else a&&n.add(o);if(Z(o)&&!ae(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;be(e,o),t&&t.scope_.parent_||"symbol"==typeof r||!Object.prototype.propertyIsEnumerable.call(n,r)||ve(e,o)}}function ve(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&oe(t,n)}var we={get(e,t){if(t===F)return e;const n=ne(e);if(!G(n,t))return function(e,t,n){const r=Oe(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!Z(r)?r:r===ke(e.base_,t)?(_e(e),e.copy_[t]=Pe(r,e)):r},has:(e,t)=>t in ne(e),ownKeys:e=>Reflect.ownKeys(ne(e)),set(e,t,n){const r=Oe(ne(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=ke(ne(e),t),a=r?.[F];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((o=n)===(i=r)?0!==o||1/o==1/i:o!=o&&i!=i)&&(void 0!==n||G(e.base_,t)))return!0;_e(e),Ee(e)}var o,i;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==ke(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,_e(e),Ee(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=ne(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){W(11)},getPrototypeOf:e=>V(e.base_),setPrototypeOf(){W(12)}},xe={};function ke(e,t){const n=e[F];return(n?ne(n):e)[t]}function Oe(e,t){if(!(t in e))return;let n=V(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=V(n)}}function Ee(e){e.modified_||(e.modified_=!0,e.parent_&&Ee(e.parent_))}function _e(e){e.copy_||(e.copy_=re(e.base_,e.scope_.immer_.useStrictShallowCopy_))}J(we,((e,t)=>{xe[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),xe.deleteProperty=function(e,t){return xe.set.call(this,e,t,void 0)},xe.set=function(e,t,n){return we.set.call(this,e[0],t,n,e[0])};function Pe(e,t){const n=ee(e)?ce("MapSet").proxyMap_(e,t):te(e)?ce("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:de(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=we;n&&(o=[r],i=xe);const{revoke:a,proxy:s}=Proxy.revocable(o,i);return r.draft_=s,r.revoke_=a,s}(e,t);return(t?t.scope_:de()).drafts_.push(n),n}function je(e){if(!Z(e)||ae(e))return e;const t=e[F];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=re(e,t.scope_.immer_.useStrictShallowCopy_)}else n=re(e,!0);return J(n,((e,t)=>{Q(n,e,je(t))})),t&&(t.finalized_=!1),n}var Ne=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const r=this;return function(e=n,...o){return r.produce(e,(e=>t.call(this,e,...o)))}}let r;if("function"!=typeof t&&W(6),void 0!==n&&"function"!=typeof n&&W(7),Z(e)){const o=he(this),i=Pe(e,void 0);let a=!0;try{r=t(i),a=!1}finally{a?fe(o):pe(o)}return ue(o,n),ye(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===$&&(r=void 0),this.autoFreeze_&&oe(r,!0),n){const t=[],o=[];ce("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}W(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,r;return[this.produce(e,t,((e,t)=>{n=e,r=t})),n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Z(e)||W(8),K(e)&&(e=function(e){K(e)||W(10);return je(e)}(e));const t=he(this),n=Pe(e,void 0);return n[F].isManual_=!0,pe(t),n}finishDraft(e,t){const n=e&&e[F];n&&n.isManual_||W(9);const{scope_:r}=n;return ue(r,t),ye(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=ce("Patches").applyPatches_;return K(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},Se=Ne.produce;Ne.produceWithPatches.bind(Ne),Ne.setAutoFreeze.bind(Ne),Ne.setUseStrictShallowCopy.bind(Ne),Ne.applyPatches.bind(Ne);var Ce=Ne.createDraft.bind(Ne),Re=Ne.finishDraft.bind(Ne),Te={ancestors(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=Te.levels(e,t);return r=n?r.slice(1):r.slice(0,-1)},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var o=e[r];if(o!==t[r])break;n.push(o)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),i=e[n],a=t[n];return Te.equals(r,o)&&i>a},endsAt(e,t){var n=e.length,r=e.slice(0,n),o=t.slice(0,n);return Te.equals(r,o)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),i=e[n],a=t[n];return Te.equals(r,o)&&i<a},equals:(e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])),hasPrevious:e=>e[e.length-1]>0,isAfter:(e,t)=>1===Te.compare(e,t),isAncestor:(e,t)=>e.length<t.length&&0===Te.compare(e,t),isBefore:(e,t)=>-1===Te.compare(e,t),isChild:(e,t)=>e.length===t.length+1&&0===Te.compare(e,t),isCommon:(e,t)=>e.length<=t.length&&0===Te.compare(e,t),isDescendant:(e,t)=>e.length>t.length&&0===Te.compare(e,t),isParent:(e,t)=>e.length+1===t.length&&0===Te.compare(e,t),isPath:e=>Array.isArray(e)&&(0===e.length||"number"==typeof e[0]),isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1);return e[e.length-1]!==t[t.length-1]&&Te.equals(n,r)},levels(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=[],o=0;o<=e.length;o++)r.push(e.slice(0,o));return n&&r.reverse(),r},next(e){if(0===e.length)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(0===e.length)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(0===e.length)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!Te.isAncestor(t,e)&&!Te.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:o="forward"}=n;if(0===e.length)return r;switch(t.type){case"insert_node":var{path:i}=t;(Te.equals(i,r)||Te.endsBefore(i,r)||Te.isAncestor(i,r))&&(r[i.length-1]+=1);break;case"remove_node":var{path:a}=t;if(Te.equals(a,r)||Te.isAncestor(a,r))return null;Te.endsBefore(a,r)&&(r[a.length-1]-=1);break;case"merge_node":var{path:s,position:l}=t;Te.equals(s,r)||Te.endsBefore(s,r)?r[s.length-1]-=1:Te.isAncestor(s,r)&&(r[s.length-1]-=1,r[s.length]+=l);break;case"split_node":var{path:c,position:d}=t;if(Te.equals(c,r)){if("forward"===o)r[r.length-1]+=1;else if("backward"!==o)return null}else Te.endsBefore(c,r)?r[c.length-1]+=1:Te.isAncestor(c,r)&&e[c.length]>=d&&(r[c.length-1]+=1,r[c.length]-=d);break;case"move_node":var{path:u,newPath:f}=t;if(Te.equals(u,f))return r;if(Te.isAncestor(u,r)||Te.equals(u,r)){var p=f.slice();return Te.endsBefore(u,f)&&u.length<f.length&&(p[u.length-1]-=1),p.concat(r.slice(u.length))}Te.isSibling(u,f)&&(Te.isAncestor(f,r)||Te.equals(f,r))?Te.endsBefore(u,r)?r[u.length-1]-=1:r[u.length-1]+=1:Te.endsBefore(f,r)||Te.equals(f,r)||Te.isAncestor(f,r)?(Te.endsBefore(u,r)&&(r[u.length-1]-=1),r[f.length-1]+=1):Te.endsBefore(u,r)&&(Te.equals(f,r)&&(r[f.length-1]+=1),r[u.length-1]-=1)}return r}};function Ae(e){return Ae="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ae(e)}function Me(e){var t=function(e,t){if("object"!==Ae(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Ae(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Ae(t)?t:String(t)}function ze(e,t,n){return(t=Me(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function De(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Le(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?De(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):De(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Be={transform(e,t){e.children=Ce(e.children);var n=e.selection&&Ce(e.selection);try{n=((e,t,n)=>{switch(n.type){case"insert_node":var{path:r,node:o}=n,i=Ye.parent(e,r),a=r[r.length-1];if(a>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(i.children.splice(a,0,o),t)for(var[s,l]of Ve.points(t))t[l]=it.transform(s,n);break;case"insert_text":var{path:c,offset:d,text:u}=n;if(0===u.length)break;var f=Ye.leaf(e,c),p=f.text.slice(0,d),h=f.text.slice(d);if(f.text=p+u+h,t)for(var[m,y]of Ve.points(t))t[y]=it.transform(m,n);break;case"merge_node":var{path:b}=n,g=Ye.get(e,b),v=Te.previous(b),w=Ye.get(e,v),x=Ye.parent(e,b),k=b[b.length-1];if(pt.isText(g)&&pt.isText(w))w.text+=g.text;else{if(pt.isText(g)||pt.isText(w))throw new Error('Cannot apply a "merge_node" operation at path ['.concat(b,"] to nodes of different interfaces: ").concat(st.stringify(g)," ").concat(st.stringify(w)));w.children.push(...g.children)}if(x.children.splice(k,1),t)for(var[O,E]of Ve.points(t))t[E]=it.transform(O,n);break;case"move_node":var{path:_,newPath:P}=n;if(Te.isAncestor(_,P))throw new Error("Cannot move a path [".concat(_,"] to new path [").concat(P,"] because the destination is inside itself."));var j=Ye.get(e,_),N=Ye.parent(e,_),S=_[_.length-1];N.children.splice(S,1);var C=Te.transform(_,n),R=Ye.get(e,Te.parent(C)),T=C[C.length-1];if(R.children.splice(T,0,j),t)for(var[A,M]of Ve.points(t))t[M]=it.transform(A,n);break;case"remove_node":var{path:z}=n,D=z[z.length-1];if(Ye.parent(e,z).children.splice(D,1),t)for(var[L,B]of Ve.points(t)){var H=it.transform(L,n);if(null!=t&&null!=H)t[B]=H;else{var I=void 0,$=void 0;for(var[q,F]of Ye.texts(e)){if(-1!==Te.compare(F,z)){$=[q,F];break}I=[q,F]}var W=!1;I&&$&&(W=Te.equals($[1],z)?!Te.hasPrevious($[1]):Te.common(I[1],z).length<Te.common($[1],z).length),I&&!W?(L.path=I[1],L.offset=I[0].text.length):$?(L.path=$[1],L.offset=0):t=null}}break;case"remove_text":var{path:V,offset:K,text:Z}=n;if(0===Z.length)break;var X=Ye.leaf(e,V),U=X.text.slice(0,K),J=X.text.slice(K+Z.length);if(X.text=U+J,t)for(var[Y,G]of Ve.points(t))t[G]=it.transform(Y,n);break;case"set_node":var{path:Q,properties:ee,newProperties:te}=n;if(0===Q.length)throw new Error("Cannot set properties on the root node!");var ne=Ye.get(e,Q);for(var re in te){if("children"===re||"text"===re)throw new Error('Cannot set the "'.concat(re,'" property of nodes!'));var oe=te[re];null==oe?delete ne[re]:ne[re]=oe}for(var ie in ee)te.hasOwnProperty(ie)||delete ne[ie];break;case"set_selection":var{newProperties:ae}=n;if(null==ae)t=ae;else{if(null==t){if(!Ve.isRange(ae))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(st.stringify(ae)," when there is no current selection."));t=Le({},ae)}for(var se in ae){var le=ae[se];if(null==le){if("anchor"===se||"focus"===se)throw new Error('Cannot remove the "'.concat(se,'" selection property'));delete t[se]}else t[se]=le}}break;case"split_node":var{path:ce,position:de,properties:ue}=n;if(0===ce.length)throw new Error('Cannot apply a "split_node" operation at path ['.concat(ce,"] because the root node cannot be split."));var fe,pe=Ye.get(e,ce),he=Ye.parent(e,ce),me=ce[ce.length-1];if(pt.isText(pe)){var ye=pe.text.slice(0,de),be=pe.text.slice(de);pe.text=ye,fe=Le(Le({},ue),{},{text:be})}else{var ge=pe.children.slice(0,de),ve=pe.children.slice(de);pe.children=ge,fe=Le(Le({},ue),{},{children:ve})}if(he.children.splice(me+1,0,fe),t)for(var[we,xe]of Ve.points(t))t[xe]=it.transform(we,n)}return t})(e,n,t)}finally{e.children=Re(e.children),e.selection=n?K(n)?Re(n):n:null}}},He={insertNodes(e,t,n){e.insertNodes(t,n)},liftNodes(e,t){e.liftNodes(t)},mergeNodes(e,t){e.mergeNodes(t)},moveNodes(e,t){e.moveNodes(t)},removeNodes(e,t){e.removeNodes(t)},setNodes(e,t,n){e.setNodes(t,n)},splitNodes(e,t){e.splitNodes(t)},unsetNodes(e,t,n){e.unsetNodes(t,n)},unwrapNodes(e,t){e.unwrapNodes(t)},wrapNodes(e,t,n){e.wrapNodes(t,n)}},Ie={collapse(e,t){e.collapse(t)},deselect(e){e.deselect()},move(e,t){e.move(t)},select(e,t){e.select(t)},setPoint(e,t,n){e.setPoint(t,n)},setSelection(e,t){e.setSelection(t)}},$e=(e,t)=>{for(var n in e){var r=e[n],o=t[n];if(I(r)&&I(o)){if(!$e(r,o))return!1}else if(Array.isArray(r)&&Array.isArray(o)){if(r.length!==o.length)return!1;for(var i=0;i<r.length;i++)if(r[i]!==o[i])return!1}else if(r!==o)return!1}for(var a in t)if(void 0===e[a]&&void 0!==t[a])return!1;return!0};function qe(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var Fe=["anchor","focus"];function We(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var Ve={edges(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:o}=e;return Ve.isBackward(e)===n?[r,o]:[o,r]},end(e){var[,t]=Ve.edges(e);return t},equals:(e,t)=>it.equals(e.anchor,t.anchor)&&it.equals(e.focus,t.focus),includes(e,t){if(Ve.isRange(t)){if(Ve.includes(e,t.anchor)||Ve.includes(e,t.focus))return!0;var[n,r]=Ve.edges(e),[o,i]=Ve.edges(t);return it.isBefore(n,o)&&it.isAfter(r,i)}var[a,s]=Ve.edges(e),l=!1,c=!1;return it.isPoint(t)?(l=it.compare(t,a)>=0,c=it.compare(t,s)<=0):(l=Te.compare(t,a.path)>=0,c=Te.compare(t,s.path)<=0),l&&c},intersection(e,t){var n=qe(e,Fe),[r,o]=Ve.edges(e),[i,a]=Ve.edges(t),s=it.isBefore(r,i)?i:r,l=it.isBefore(o,a)?o:a;return it.isBefore(l,s)?null:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?We(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):We(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({anchor:s,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return it.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return it.equals(t,n)},isExpanded:e=>!Ve.isCollapsed(e),isForward:e=>!Ve.isBackward(e),isRange:e=>I(e)&&it.isPoint(e.anchor)&&it.isPoint(e.focus),*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=Ve.edges(e);return t},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Se(e,(e=>{if(null===e)return null;var r,o,{affinity:i="inward"}=n;if("inward"===i){var a=Ve.isCollapsed(e);Ve.isForward(e)?(r="forward",o=a?r:"backward"):(r="backward",o=a?r:"forward")}else"outward"===i?Ve.isForward(e)?(r="backward",o="forward"):(r="forward",o="backward"):(r=i,o=i);var s=it.transform(e.anchor,t,{affinity:r}),l=it.transform(e.focus,t,{affinity:o});if(!s||!l)return null;e.anchor=s,e.focus=l}))}},Ke=e=>I(e)&&Ye.isNodeList(e.children)&&!nt.isEditor(e),Ze={isAncestor:e=>I(e)&&Ye.isNodeList(e.children),isElement:Ke,isElementList:e=>Array.isArray(e)&&e.every((e=>Ze.isElement(e))),isElementProps:e=>void 0!==e.children,isElementType:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"type";return Ke(e)&&e[n]===t},matches(e,t){for(var n in t)if("children"!==n&&e[n]!==t[n])return!1;return!0}},Xe=["children"],Ue=["text"],Je=new WeakMap,Ye={ancestor(e,t){var n=Ye.get(e,t);if(pt.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(st.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of Te.ancestors(t,n)){var o=[Ye.ancestor(e,r),r];yield o}}()},child(e,t){if(pt.isText(e))throw new Error("Cannot get the child of a text node: ".concat(st.stringify(e)));var n=e.children[t];if(null==n)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(st.stringify(e)));return n},children(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,o=Ye.ancestor(e,t),{children:i}=o,a=r?i.length-1:0;r?a>=0:a<i.length;){var s=Ye.child(o,a),l=t.concat(a);yield[s,l],a=r?a-1:a+1}}()},common(e,t,n){var r=Te.common(t,n);return[Ye.get(e,r),r]},descendant(e,t){var n=Ye.get(e,t);if(nt.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(st.stringify(n)));return n},descendants(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of Ye.nodes(e,t))0!==r.length&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of Ye.nodes(e,t))Ze.isElement(n)&&(yield[n,r])}()},extractProps:e=>Ze.isAncestor(e)?qe(e,Xe):qe(e,Ue),first(e,t){for(var n=t.slice(),r=Ye.get(e,n);r&&!pt.isText(r)&&0!==r.children.length;)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(pt.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(st.stringify(e)));var n=Se({children:e.children},(e=>{var[n,r]=Ve.edges(t),o=Ye.nodes(e,{reverse:!0,pass:e=>{var[,n]=e;return!Ve.includes(t,n)}});for(var[,i]of o){if(!Ve.includes(t,i)){var a=Ye.parent(e,i),s=i[i.length-1];a.children.splice(s,1)}if(Te.equals(i,r.path)){var l=Ye.leaf(e,i);l.text=l.text.slice(0,r.offset)}if(Te.equals(i,n.path)){var c=Ye.leaf(e,i);c.text=c.text.slice(n.offset)}}nt.isEditor(e)&&(e.selection=null)}));return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(pt.isText(n)||!n.children[o])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(st.stringify(e)));n=n.children[o]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(pt.isText(n)||!n.children[o])return!1;n=n.children[o]}return!0},isNode:e=>pt.isText(e)||Ze.isElement(e)||nt.isEditor(e),isNodeList(e){if(!Array.isArray(e))return!1;var t=Je.get(e);if(void 0!==t)return t;var n=e.every((e=>Ye.isNode(e)));return Je.set(e,n),n},last(e,t){for(var n=t.slice(),r=Ye.get(e,n);r&&!pt.isText(r)&&0!==r.children.length;){var o=r.children.length-1;r=r.children[o],n.push(o)}return[r,n]},leaf(e,t){var n=Ye.get(e,t);if(!pt.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(st.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of Te.levels(t,n)){var o=Ye.get(e,r);yield[o,r]}}()},matches:(e,t)=>Ze.isElement(e)&&Ze.isElementProps(t)&&Ze.matches(e,t)||pt.isText(e)&&pt.isTextProps(t)&&pt.matches(e,t),nodes(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:o=[],to:i}=t,a=new Set,s=[],l=e;!i||!(r?Te.isBefore(s,i):Te.isAfter(s,i));)if(a.has(l)||(yield[l,s]),a.has(l)||pt.isText(l)||0===l.children.length||null!=n&&!1!==n([l,s])){if(0===s.length)break;if(!r){var c=Te.next(s);if(Ye.has(e,c)){s=c,l=Ye.get(e,s);continue}}if(r&&0!==s[s.length-1])s=Te.previous(s),l=Ye.get(e,s);else s=Te.parent(s),l=Ye.get(e,s),a.add(l)}else{a.add(l);var d=r?l.children.length-1:0;Te.isAncestor(s,o)&&(d=o[s.length]),s=s.concat(d),l=Ye.get(e,s)}}()},parent(e,t){var n=Te.parent(t),r=Ye.get(e,n);if(pt.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string:e=>pt.isText(e)?e.text:e.children.map(Ye.string).join(""),texts(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of Ye.nodes(e,t))pt.isText(n)&&(yield[n,r])}()}};function Ge(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Qe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ge(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ge(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var et={isNodeOperation:e=>et.isOperation(e)&&e.type.endsWith("_node"),isOperation(e){if(!I(e))return!1;switch(e.type){case"insert_node":case"remove_node":return Te.isPath(e.path)&&Ye.isNode(e.node);case"insert_text":case"remove_text":return"number"==typeof e.offset&&"string"==typeof e.text&&Te.isPath(e.path);case"merge_node":return"number"==typeof e.position&&Te.isPath(e.path)&&I(e.properties);case"move_node":return Te.isPath(e.path)&&Te.isPath(e.newPath);case"set_node":return Te.isPath(e.path)&&I(e.properties)&&I(e.newProperties);case"set_selection":return null===e.properties&&Ve.isRange(e.newProperties)||null===e.newProperties&&Ve.isRange(e.properties)||I(e.properties)&&I(e.newProperties);case"split_node":return Te.isPath(e.path)&&"number"==typeof e.position&&I(e.properties);default:return!1}},isOperationList:e=>Array.isArray(e)&&e.every((e=>et.isOperation(e))),isSelectionOperation:e=>et.isOperation(e)&&e.type.endsWith("_selection"),isTextOperation:e=>et.isOperation(e)&&e.type.endsWith("_text"),inverse(e){switch(e.type){case"insert_node":return Qe(Qe({},e),{},{type:"remove_node"});case"insert_text":return Qe(Qe({},e),{},{type:"remove_text"});case"merge_node":return Qe(Qe({},e),{},{type:"split_node",path:Te.previous(e.path)});case"move_node":var{newPath:t,path:n}=e;if(Te.equals(t,n))return e;if(Te.isSibling(n,t))return Qe(Qe({},e),{},{path:t,newPath:n});var r=Te.transform(n,e),o=Te.transform(Te.next(n),e);return Qe(Qe({},e),{},{path:r,newPath:o});case"remove_node":return Qe(Qe({},e),{},{type:"insert_node"});case"remove_text":return Qe(Qe({},e),{},{type:"insert_text"});case"set_node":var{properties:i,newProperties:a}=e;return Qe(Qe({},e),{},{properties:a,newProperties:i});case"set_selection":var{properties:s,newProperties:l}=e;return Qe(Qe({},e),{},null==s?{properties:l,newProperties:null}:null==l?{properties:null,newProperties:s}:{properties:l,newProperties:s});case"split_node":return Qe(Qe({},e),{},{type:"merge_node",path:Te.next(e.path)})}}},tt=new WeakMap,nt={above:(e,t)=>e.above(t),addMark(e,t,n){e.addMark(t,n)},after:(e,t,n)=>e.after(t,n),before:(e,t,n)=>e.before(t,n),deleteBackward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteBackward(n)},deleteForward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteForward(n)},deleteFragment(e,t){e.deleteFragment(t)},edges:(e,t)=>e.edges(t),elementReadOnly(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.elementReadOnly(t)},end:(e,t)=>e.end(t),first:(e,t)=>e.first(t),fragment:(e,t)=>e.fragment(t),hasBlocks:(e,t)=>e.hasBlocks(t),hasInlines:(e,t)=>e.hasInlines(t),hasPath:(e,t)=>e.hasPath(t),hasTexts:(e,t)=>e.hasTexts(t),insertBreak(e){e.insertBreak()},insertFragment(e,t,n){e.insertFragment(t,n)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock:(e,t)=>e.isBlock(t),isEdge:(e,t,n)=>e.isEdge(t,n),isEditor:e=>(e=>{var t=tt.get(e);if(void 0!==t)return t;if(!I(e))return!1;var n="function"==typeof e.addMark&&"function"==typeof e.apply&&"function"==typeof e.deleteFragment&&"function"==typeof e.insertBreak&&"function"==typeof e.insertSoftBreak&&"function"==typeof e.insertFragment&&"function"==typeof e.insertNode&&"function"==typeof e.insertText&&"function"==typeof e.isElementReadOnly&&"function"==typeof e.isInline&&"function"==typeof e.isSelectable&&"function"==typeof e.isVoid&&"function"==typeof e.normalizeNode&&"function"==typeof e.onChange&&"function"==typeof e.removeMark&&"function"==typeof e.getDirtyPaths&&(null===e.marks||I(e.marks))&&(null===e.selection||Ve.isRange(e.selection))&&Ye.isNodeList(e.children)&&et.isOperationList(e.operations);return tt.set(e,n),n})(e),isElementReadOnly:(e,t)=>e.isElementReadOnly(t),isEmpty:(e,t)=>e.isEmpty(t),isEnd:(e,t,n)=>e.isEnd(t,n),isInline:(e,t)=>e.isInline(t),isNormalizing:e=>e.isNormalizing(),isSelectable:(e,t)=>e.isSelectable(t),isStart:(e,t,n)=>e.isStart(t,n),isVoid:(e,t)=>e.isVoid(t),last:(e,t)=>e.last(t),leaf:(e,t,n)=>e.leaf(t,n),levels:(e,t)=>e.levels(t),marks:e=>e.getMarks(),next:(e,t)=>e.next(t),node:(e,t,n)=>e.node(t,n),nodes:(e,t)=>e.nodes(t),normalize(e,t){e.normalize(t)},parent:(e,t,n)=>e.parent(t,n),path:(e,t,n)=>e.path(t,n),pathRef:(e,t,n)=>e.pathRef(t,n),pathRefs:e=>e.pathRefs(),point:(e,t,n)=>e.point(t,n),pointRef:(e,t,n)=>e.pointRef(t,n),pointRefs:e=>e.pointRefs(),positions:(e,t)=>e.positions(t),previous:(e,t)=>e.previous(t),range:(e,t,n)=>e.range(t,n),rangeRef:(e,t,n)=>e.rangeRef(t,n),rangeRefs:e=>e.rangeRefs(),removeMark(e,t){e.removeMark(t)},setNormalizing(e,t){e.setNormalizing(t)},start:(e,t)=>e.start(t),string:(e,t,n)=>e.string(t,n),unhangRange:(e,t,n)=>e.unhangRange(t,n),void:(e,t)=>e.void(t),withoutNormalizing(e,t){e.withoutNormalizing(t)}};function rt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ot(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?rt(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var it={compare(e,t){var n=Te.compare(e.path,t.path);return 0===n?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter:(e,t)=>1===it.compare(e,t),isBefore:(e,t)=>-1===it.compare(e,t),equals:(e,t)=>e.offset===t.offset&&Te.equals(e.path,t.path),isPoint:e=>I(e)&&"number"==typeof e.offset&&Te.isPath(e.path),transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Se(e,(e=>{if(null===e)return null;var{affinity:r="forward"}=n,{path:o,offset:i}=e;switch(t.type){case"insert_node":case"move_node":e.path=Te.transform(o,t,n);break;case"insert_text":Te.equals(t.path,o)&&(t.offset<i||t.offset===i&&"forward"===r)&&(e.offset+=t.text.length);break;case"merge_node":Te.equals(t.path,o)&&(e.offset+=t.position),e.path=Te.transform(o,t,n);break;case"remove_text":Te.equals(t.path,o)&&t.offset<=i&&(e.offset-=Math.min(i-t.offset,t.text.length));break;case"remove_node":if(Te.equals(t.path,o)||Te.isAncestor(t.path,o))return null;e.path=Te.transform(o,t,n);break;case"split_node":if(Te.equals(t.path,o)){if(t.position===i&&null==r)return null;(t.position<i||t.position===i&&"forward"===r)&&(e.offset-=t.position,e.path=Te.transform(o,t,ot(ot({},n),{},{affinity:"forward"})))}else e.path=Te.transform(o,t,n)}}))}},at=void 0,st={setScrubber(e){at=e},stringify:e=>JSON.stringify(e,at)},lt=["text"],ct=["anchor","focus"];function dt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ut(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?dt(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ft,pt={equals(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{loose:r=!1}=n;function o(e){return qe(e,lt)}return $e(r?o(e):e,r?o(t):t)},isText:e=>I(e)&&"string"==typeof e.text,isTextList:e=>Array.isArray(e)&&e.every((e=>pt.isText(e))),isTextProps:e=>void 0!==e.text,matches(e,t){for(var n in t)if("text"!==n&&(!e.hasOwnProperty(n)||e[n]!==t[n]))return!1;return!0},decorations(e,t){var n=[ut({},e)];for(var r of t){var o=qe(r,ct),[i,a]=Ve.edges(r),s=[],l=0,c=i.offset,d=a.offset;for(var u of n){var{length:f}=u.text,p=l;if(l+=f,c<=p&&l<=d)Object.assign(u,o),s.push(u);else if(c!==d&&(c===l||d===p)||c>l||d<p||d===p&&0!==p)s.push(u);else{var h=u,m=void 0,y=void 0;if(d<l){var b=d-p;y=ut(ut({},h),{},{text:h.text.slice(b)}),h=ut(ut({},h),{},{text:h.text.slice(0,b)})}if(c>p){var g=c-p;m=ut(ut({},h),{},{text:h.text.slice(0,g)}),h=ut(ut({},h),{},{text:h.text.slice(g)})}Object.assign(h,o),m&&s.push(m),s.push(h),y&&s.push(y)}}n=s}return n}},ht=e=>e.selection?e.selection:e.children.length>0?nt.end(e,[]):[0];!function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"}(ft||(ft={})),ft.L,ft.L,ft.V,ft.LV,ft.LVT,ft.LV,ft.V,ft.V,ft.T,ft.LVT,ft.T,ft.T,ft.Any,ft.Extend,ft.ZWJ,ft.Any,ft.SpacingMark,ft.Prepend,ft.Any,ft.ZWJ,ft.ExtPict,ft.RI,ft.RI;var mt={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};nt.withoutNormalizing(e,(()=>{var{voids:r=!1}=n,{at:o=ht(e)}=n;if(Te.isPath(o)&&(o=nt.range(e,o)),Ve.isRange(o))if(Ve.isCollapsed(o))o=o.anchor;else{var i=Ve.end(o);if(!r&&nt.void(e,{at:i}))return;var a=Ve.start(o),s=nt.pointRef(e,a),l=nt.pointRef(e,i);gt.delete(e,{at:o,voids:r});var c=s.unref(),d=l.unref();o=c||d,gt.setSelection(e,{anchor:o,focus:o})}if(!(!r&&nt.void(e,{at:o})||nt.elementReadOnly(e,{at:o}))){var{path:u,offset:f}=o;t.length>0&&e.apply({type:"insert_text",path:u,offset:f,text:t})}}))}};function yt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function bt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?yt(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var gt=bt(bt(bt(bt({},Be),He),Ie),mt);const vt={buildTableElements:(t,n)=>{const{rows:r=3,columns:o=3,columnWidth:i=200,headerColumn:a=!1,headerRow:s=!1}=n||{},l={id:e(),type:"table",children:[],props:{headerColumn:a,headerRow:s}};for(let t=0;t<r;t++){const n={id:e(),type:"table-row",children:[]};for(let r=0;r<o;r++){const r={id:e(),type:"table-data-cell",children:[{text:""}],props:{width:i||200,asHeader:0===t&&!!s}};n.children.push(r)}l.children.push(n)}return l},insertTable:(e,n)=>{const r=vt.buildTableElements(e,n),o=t.buildBlockData({value:[r],type:"Table"});t.insertBlock(e,o.type,Object.assign(Object.assign({},n),{blockData:o}))},deleteTable:(e,t)=>{e.deleteBlock({blockId:t})},insertTableRow:(r,o,i)=>{const a=t.getBlockSlate(r,{id:o});a&&nt.withoutNormalizing(a,(()=>{const{insertMode:t="after",path:s=a.selection,select:l=!0}=i||{},c=n.getElementEntry(r,o,{path:s,type:"table-row"});if(!c)return;const[d,u]=c,f="before"===t?u:Te.next(u),p={id:e(),type:"table-row",children:d.children.map((t=>({id:e(),type:"table-data-cell",children:[{text:""}]}))),props:{nodeType:"block"}};gt.insertNodes(a,p,{at:f}),l&&gt.select(a,[...f,0])}))},deleteTableRow:(e,r,o)=>{const i=t.getBlockSlate(e,{id:r});i&&nt.withoutNormalizing(i,(()=>{const{path:t=i.selection}=o||{},a=n.getElementEntry(e,r,{path:t,type:"table-row"});if(!a)return;const[s,l]=a,c=nt.nodes(i,{at:[0],match:e=>Ze.isElement(e)&&"table-row"===e.type,mode:"highest"});1!==Array.from(c).length&&gt.removeNodes(i,{at:l,match:e=>Ze.isElement(e)&&"table-row"===e.type})}))},moveTableRow:(e,n,{from:r,to:o})=>{const i=t.getBlockSlate(e,{id:n});i&&nt.withoutNormalizing(i,(()=>{gt.moveNodes(i,{at:r,to:o,match:e=>Ze.isElement(e)&&"table-row"===e.type})}))},moveTableColumn:(e,n,{from:r,to:o})=>{const i=t.getBlockSlate(e,{id:n});i&&nt.withoutNormalizing(i,(()=>{const e=nt.nodes(i,{at:[0],match:e=>Ze.isElement(e)&&"table-row"===e.type,mode:"all"});Array.from(e).forEach((([e,t])=>{gt.moveNodes(i,{at:t.concat(r[r.length-1]),to:[...t,o[o.length-1]],match:e=>Ze.isElement(e)})}))}))},insertTableColumn:(r,o,i)=>{const a=t.getBlockSlate(r,{id:o});a&&nt.withoutNormalizing(a,(()=>{const{insertMode:t="after",path:s=a.selection,select:l=!0}=i||{},c=n.getElementEntry(r,o,{path:s,type:"table-data-cell"});if(!c)return;const[d,u]=c,f=u[u.length-1],p="before"===t?f:Te.next(u)[u.length-1],h=nt.nodes(a,{at:[0],match:e=>Ze.isElement(e)&&"table-row"===e.type,mode:"lowest"});for(const[,t]of h){const n={id:e(),type:"table-data-cell",children:[{text:""}]};gt.insertNodes(a,n,{at:[...t,p]})}l&&gt.select(a,[0,0,p,0])}))},deleteTableColumn:(e,r,o)=>{const i=t.getBlockSlate(e,{id:r});i&&nt.withoutNormalizing(i,(()=>{const{path:t=i.selection}=o||{},a=nt.nodes(i,{at:[0],match:e=>Ze.isElement(e)&&"table-row"===e.type,mode:"all"}),s=Array.from(a);if(s[0][0].children.length<=1)return;const l=n.getElementEntry(e,r,{path:t,type:"table-data-cell"});if(!l)return;const[c,d]=l,u=d[d.length-1],f=s.map((([e,t])=>e.children[u]?[...t,u]:null));f.forEach((e=>{e&&gt.removeNodes(i,{at:e})}))}))},updateColumnWidth:(e,n,r,o)=>{const i=t.getBlockSlate(e,{id:n});i&&nt.withoutNormalizing(i,(()=>{const e=nt.nodes(i,{at:[0],match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,mode:"all"});Array.from(e).forEach((([e,t])=>{t[t.length-1]===r&&gt.setNodes(i,{props:Object.assign(Object.assign({},e.props),{width:o})},{at:t,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type})}))}))},toggleHeaderRow:(e,r)=>{const o=t.getBlockSlate(e,{id:r});o&&nt.withoutNormalizing(o,(()=>{var t;const i=n.getElement(e,r,{type:"table",path:[0]}),a=(null===(t=null==i?void 0:i.props)||void 0===t?void 0:t.headerRow)||!1,s=nt.nodes(o,{at:[0,0],match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,mode:"all"});Array.from(s).forEach((([e,t])=>{var n;gt.setNodes(o,{props:Object.assign(Object.assign({},e.props),{asHeader:!(null===(n=e.props)||void 0===n?void 0:n.asHeader)})},{at:t,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type})})),gt.setNodes(o,{props:Object.assign(Object.assign({},null==i?void 0:i.props),{headerRow:!a})},{at:[0],match:e=>Ze.isElement(e)&&"table"===e.type})}))},toggleHeaderColumn:(e,r)=>{const o=t.getBlockSlate(e,{id:r});o&&nt.withoutNormalizing(o,(()=>{var t;const i=n.getElement(e,r,{type:"table",path:[0]}),a=(null===(t=null==i?void 0:i.props)||void 0===t?void 0:t.headerColumn)||!1,s=nt.nodes(o,{at:[0],match:e=>Ze.isElement(e)&&"table-row"===e.type,mode:"all"});Array.from(s).forEach((([e,t])=>{var n;const r=e.children[0];gt.setNodes(o,{props:Object.assign(Object.assign({},r.props),{asHeader:!(null===(n=r.props)||void 0===n?void 0:n.asHeader)})},{at:t.concat(0),match:e=>Ze.isElement(e)&&"table-data-cell"===e.type})})),gt.setNodes(o,{props:Object.assign(Object.assign({},null==i?void 0:i.props),{headerColumn:!a})},{at:[0],match:e=>Ze.isElement(e)&&"table"===e.type})}))}},{ExtendedBlockActions:wt,BlockOptionsMenuGroup:xt,BlockOptionsMenuItem:kt,BlockOptionsSeparator:Ot}=r,Et=({editor:e,block:t,table:n})=>{const r=n.props,o=null==r?void 0:r.headerRow,i=null==r?void 0:r.headerColumn;return d(wt,Object.assign({onClick:()=>e.setPath({current:t.meta.order}),className:"yoopta-table-options"},{children:[u(Ot,{}),d(xt,{children:[u(kt,{children:d("button",Object.assign({type:"button",className:"yoopta-block-options-button yoo-table-justify-between",onClick:()=>{vt.toggleHeaderRow(e,t.id)}},{children:[d("span",Object.assign({className:"yoo-table-flex"},{children:[u(D,{width:16,height:16,className:"yoo-table-w-4 yoo-table-h-4 yoo-table-mr-2"}),"Header row"]})),o&&u(S,{width:16,height:16,className:"yoo-table-w-4 yoo-table-h-4"})]}))}),u(kt,{children:d("button",Object.assign({type:"button",className:"yoopta-block-options-button yoo-table-justify-between",onClick:()=>{vt.toggleHeaderColumn(e,t.id)}},{children:[d("span",Object.assign({className:"yoo-table-flex"},{children:[u(L,{width:16,height:16,className:"yoo-table-w-4 yoo-table-h-4 yoo-table-mr-2 yoo-table-rotate-180"}),"Header column"]})),i&&u(S,{width:16,height:16,className:"yoo-table-w-4 yoo-table-h-4"})]}))})]})]}))},_t=new WeakMap,Pt=new WeakMap,jt=({onResize:e,tdWidth:t,columnIndex:n})=>{const r=y(null),o=y(0),i=y(0);return b((()=>{const e=document.querySelector(".yoopta-table");if(!e)return;const t=null==e?void 0:e.offsetHeight;r.current&&(r.current.style.height=`${t}px`)}),[]),b((()=>{var n;const a=document.querySelector(".yoopta-table");if(!a)return;const s=n=>{const s=null==a?void 0:a.offsetHeight;if(!r.current)return;r.current.style.height=`${s}px`,i.current=n.clientX,o.current=t;const l=t=>{const n=t.clientX,r=o.current+(n-i.current);e(r)},c=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",c)};document.addEventListener("mousemove",l),document.addEventListener("mouseup",c)};return null===(n=r.current)||void 0===n||n.addEventListener("mousedown",s),()=>{var e;null===(e=r.current)||void 0===e||e.removeEventListener("mousedown",s)}}),[n,t]),u("div",Object.assign({ref:r,className:"yoopta-table-resize-handle",contentEditable:!1},{children:u("div",{className:"yoopta-table-resize-handle-inner",contentEditable:!1})}))};function Nt(e){return Rt(e)?(e.nodeName||"").toLowerCase():"#document"}function St(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Ct(e){var t;return null==(t=(Rt(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Rt(e){return e instanceof Node||e instanceof St(e).Node}function Tt(e){return e instanceof Element||e instanceof St(e).Element}function At(e){return e instanceof HTMLElement||e instanceof St(e).HTMLElement}function Mt(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof St(e).ShadowRoot)}function zt(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=It(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Dt(e){return["table","td","th"].includes(Nt(e))}function Lt(e){const t=Bt(),n=It(e);return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function Bt(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function Ht(e){return["html","body","#document"].includes(Nt(e))}function It(e){return St(e).getComputedStyle(e)}function $t(e){return Tt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function qt(e){if("html"===Nt(e))return e;const t=e.assignedSlot||e.parentNode||Mt(e)&&e.host||Ct(e);return Mt(t)?t.host:t}function Ft(e){const t=qt(e);return Ht(t)?e.ownerDocument?e.ownerDocument.body:e.body:At(t)&&zt(t)?t:Ft(t)}function Wt(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=Ft(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=St(o);return i?t.concat(a,a.visualViewport||[],zt(o)?o:[],a.frameElement&&n?Wt(a.frameElement):[]):t.concat(o,Wt(o,[],n))}const Vt=Math.min,Kt=Math.max,Zt=Math.round,Xt=Math.floor,Ut=e=>({x:e,y:e}),Jt={left:"right",right:"left",bottom:"top",top:"bottom"},Yt={start:"end",end:"start"};function Gt(e,t,n){return Kt(e,Vt(t,n))}function Qt(e,t){return"function"==typeof e?e(t):e}function en(e){return e.split("-")[0]}function tn(e){return e.split("-")[1]}function nn(e){return"x"===e?"y":"x"}function rn(e){return"y"===e?"height":"width"}function on(e){return["top","bottom"].includes(en(e))?"y":"x"}function an(e){return nn(on(e))}function sn(e){return e.replace(/start|end/g,(e=>Yt[e]))}function ln(e){return e.replace(/left|right|bottom|top/g,(e=>Jt[e]))}function cn(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function dn(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function un(e,t,n){let{reference:r,floating:o}=e;const i=on(t),a=an(t),s=rn(a),l=en(t),c="y"===i,d=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,f=r[s]/2-o[s]/2;let p;switch(l){case"top":p={x:d,y:r.y-o.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:u};break;case"left":p={x:r.x-o.width,y:u};break;default:p={x:r.x,y:r.y}}switch(tn(t)){case"start":p[a]-=f*(n&&c?-1:1);break;case"end":p[a]+=f*(n&&c?-1:1)}return p}async function fn(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=Qt(t,e),h=cn(p),m=s[f?"floating"===u?"reference":"floating":u],y=dn(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(m)))||n?m:m.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:d,strategy:l})),b="floating"===u?{...a.floating,x:r,y:o}:a.reference,g=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),v=await(null==i.isElement?void 0:i.isElement(g))&&await(null==i.getScale?void 0:i.getScale(g))||{x:1,y:1},w=dn(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:b,offsetParent:g,strategy:l}):b);return{top:(y.top-w.top+h.top)/v.y,bottom:(w.bottom-y.bottom+h.bottom)/v.y,left:(y.left-w.left+h.left)/v.x,right:(w.right-y.right+h.right)/v.x}}function pn(e){const t=Vt(...e.map((e=>e.left))),n=Vt(...e.map((e=>e.top)));return{x:t,y:n,width:Kt(...e.map((e=>e.right)))-t,height:Kt(...e.map((e=>e.bottom)))-n}}const hn=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:s}=t,l=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=en(n),s=tn(n),l="y"===on(n),c=["left","top"].includes(a)?-1:1,d=i&&l?-1:1,u=Qt(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:h}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...u};return s&&"number"==typeof h&&(p="end"===s?-1*h:h),l?{x:p*d,y:f*c}:{x:f*c,y:p*d}}(t,e);return a===(null==(n=s.offset)?void 0:n.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:a}}}}};function mn(e){const t=It(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=At(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,s=Zt(n)!==i||Zt(r)!==a;return s&&(n=i,r=a),{width:n,height:r,$:s}}function yn(e){return Tt(e)?e:e.contextElement}function bn(e){const t=yn(e);if(!At(t))return Ut(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=mn(t);let a=(i?Zt(n.width):n.width)/r,s=(i?Zt(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}const gn=Ut(0);function vn(e){const t=St(e);return Bt()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:gn}function wn(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=yn(e);let a=Ut(1);t&&(r?Tt(r)&&(a=bn(r)):a=bn(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==St(e))&&t}(i,n,r)?vn(i):Ut(0);let l=(o.left+s.x)/a.x,c=(o.top+s.y)/a.y,d=o.width/a.x,u=o.height/a.y;if(i){const e=St(i),t=r&&Tt(r)?St(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=bn(o),t=o.getBoundingClientRect(),r=It(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,d*=e.x,u*=e.y,l+=i,c+=a,n=St(o),o=n.frameElement}}return dn({width:d,height:u,x:l,y:c})}const xn=[":popover-open",":modal"];function kn(e){return xn.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function On(e){return wn(Ct(e)).left+$t(e).scrollLeft}function En(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=St(e),r=Ct(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,s=0,l=0;if(o){i=o.width,a=o.height;const e=Bt();(!e||e&&"fixed"===t)&&(s=o.offsetLeft,l=o.offsetTop)}return{width:i,height:a,x:s,y:l}}(e,n);else if("document"===t)r=function(e){const t=Ct(e),n=$t(e),r=e.ownerDocument.body,o=Kt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Kt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+On(e);const s=-n.scrollTop;return"rtl"===It(r).direction&&(a+=Kt(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:s}}(Ct(e));else if(Tt(t))r=function(e,t){const n=wn(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=At(e)?bn(e):Ut(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=vn(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return dn(r)}function _n(e,t){const n=qt(e);return!(n===t||!Tt(n)||Ht(n))&&("fixed"===It(n).position||_n(n,t))}function Pn(e,t,n){const r=At(t),o=Ct(t),i="fixed"===n,a=wn(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=Ut(0);if(r||!r&&!i)if(("body"!==Nt(t)||zt(o))&&(s=$t(t)),r){const e=wn(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=On(o));return{x:a.left+s.scrollLeft-l.x,y:a.top+s.scrollTop-l.y,width:a.width,height:a.height}}function jn(e,t){return At(e)&&"fixed"!==It(e).position?t?t(e):e.offsetParent:null}function Nn(e,t){const n=St(e);if(!At(e)||kn(e))return n;let r=jn(e,t);for(;r&&Dt(r)&&"static"===It(r).position;)r=jn(r,t);return r&&("html"===Nt(r)||"body"===Nt(r)&&"static"===It(r).position&&!Lt(r))?n:r||function(e){let t=qt(e);for(;At(t)&&!Ht(t);){if(Lt(t))return t;t=qt(t)}return null}(e)||n}const Sn={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=Ct(r),s=!!t&&kn(t.floating);if(r===a||s&&i)return n;let l={scrollLeft:0,scrollTop:0},c=Ut(1);const d=Ut(0),u=At(r);if((u||!u&&!i)&&(("body"!==Nt(r)||zt(a))&&(l=$t(r)),At(r))){const e=wn(r);c=bn(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x,y:n.y*c.y-l.scrollTop*c.y+d.y}},getDocumentElement:Ct,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?function(e,t){const n=t.get(e);if(n)return n;let r=Wt(e,[],!1).filter((e=>Tt(e)&&"body"!==Nt(e))),o=null;const i="fixed"===It(e).position;let a=i?qt(e):e;for(;Tt(a)&&!Ht(a);){const t=It(a),n=Lt(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||zt(a)&&!n&&_n(e,a))?r=r.filter((e=>e!==a)):o=t,a=qt(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=i[0],s=i.reduce(((e,n)=>{const r=En(t,n,o);return e.top=Kt(r.top,e.top),e.right=Vt(r.right,e.right),e.bottom=Vt(r.bottom,e.bottom),e.left=Kt(r.left,e.left),e}),En(t,a,o));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:Nn,getElementRects:async function(e){const t=this.getOffsetParent||Nn,n=this.getDimensions;return{reference:Pn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,...await n(e.floating)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=mn(e);return{width:t,height:n}},getScale:bn,isElement:Tt,isRTL:function(e){return"rtl"===It(e).direction}};function Cn(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=yn(e),d=o||i?[...c?Wt(c):[],...Wt(t)]:[];d.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const u=c&&s?function(e,t){let n,r=null;const o=Ct(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function a(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),i();const{left:c,top:d,width:u,height:f}=e.getBoundingClientRect();if(s||t(),!u||!f)return;const p={rootMargin:-Xt(d)+"px "+-Xt(o.clientWidth-(c+u))+"px "+-Xt(o.clientHeight-(d+f))+"px "+-Xt(c)+"px",threshold:Kt(0,Vt(1,l))||1};let h=!0;function m(e){const t=e[0].intersectionRatio;if(t!==l){if(!h)return a();t?a(!1,t):n=setTimeout((()=>{a(!1,1e-7)}),100)}h=!1}try{r=new IntersectionObserver(m,{...p,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(m,p)}r.observe(e)}(!0),i}(c,n):null;let f,p=-1,h=null;a&&(h=new ResizeObserver((e=>{let[r]=e;r&&r.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame((()=>{var e;null==(e=h)||e.observe(t)}))),n()})),c&&!l&&h.observe(c),h.observe(t));let m=l?wn(e):null;return l&&function t(){const r=wn(e);!m||r.x===m.x&&r.y===m.y&&r.width===m.width&&r.height===m.height||n();m=r,f=requestAnimationFrame(t)}(),n(),()=>{var e;d.forEach((e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==u||u(),null==(e=h)||e.disconnect(),h=null,l&&cancelAnimationFrame(f)}}const Rn=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Qt(e,t),c={x:n,y:r},d=await fn(t,l),u=on(en(o)),f=nn(u);let p=c[f],h=c[u];if(i){const e="y"===f?"bottom":"right";p=Gt(p+d["y"===f?"top":"left"],p,p-d[e])}if(a){const e="y"===u?"bottom":"right";h=Gt(h+d["y"===u?"top":"left"],h,h-d[e])}const m=s.fn({...t,[f]:p,[u]:h});return{...m,data:{x:m.x-n,y:m.y-r}}}}},Tn=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...y}=Qt(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const b=en(o),g=en(s)===s,v=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=f||(g||!m?[ln(s)]:function(e){const t=ln(e);return[sn(e),t,sn(t)]}(s));f||"none"===h||w.push(...function(e,t,n,r){const o=tn(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:a;default:return[]}}(en(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(sn)))),i}(s,m,h,v));const x=[s,...w],k=await fn(t,y),O=[];let E=(null==(r=i.flip)?void 0:r.overflows)||[];if(d&&O.push(k[b]),u){const e=function(e,t,n){void 0===n&&(n=!1);const r=tn(e),o=an(e),i=rn(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=ln(a)),[a,ln(a)]}(o,a,v);O.push(k[e[0]],k[e[1]])}if(E=[...E,{placement:o,overflows:O}],!O.every((e=>e<=0))){var _,P;const e=((null==(_=i.flip)?void 0:_.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:E},reset:{placement:t}};let n=null==(P=E.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:P.placement;if(!n)switch(p){case"bestFit":{var j;const e=null==(j=E.map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:j[0];e&&(n=e);break}case"initialPlacement":n=s}if(o!==n)return{reset:{placement:n}}}return{}}}},An=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:i,strategy:a}=t,{padding:s=2,x:l,y:c}=Qt(e,t),d=Array.from(await(null==i.getClientRects?void 0:i.getClientRects(r.reference))||[]),u=function(e){const t=e.slice().sort(((e,t)=>e.y-t.y)),n=[];let r=null;for(let e=0;e<t.length;e++){const o=t[e];!r||o.y-r.y>r.height/2?n.push([o]):n[n.length-1].push(o),r=o}return n.map((e=>dn(pn(e))))}(d),f=dn(pn(d)),p=cn(s);const h=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===u.length&&u[0].left>u[1].right&&null!=l&&null!=c)return u.find((e=>l>e.left-p.left&&l<e.right+p.right&&c>e.top-p.top&&c<e.bottom+p.bottom))||f;if(u.length>=2){if("y"===on(n)){const e=u[0],t=u[u.length-1],r="top"===en(n),o=e.top,i=t.bottom,a=r?e.left:t.left,s=r?e.right:t.right;return{top:o,bottom:i,left:a,right:s,width:s-a,height:i-o,x:a,y:o}}const e="left"===en(n),t=Kt(...u.map((e=>e.right))),r=Vt(...u.map((e=>e.left))),o=u.filter((n=>e?n.left===r:n.right===t)),i=o[0].top,a=o[o.length-1].bottom;return{top:i,bottom:a,left:r,right:t,width:t-r,height:a-i,x:r,y:i}}return f}},floating:r.floating,strategy:a});return o.reference.x!==h.reference.x||o.reference.y!==h.reference.y||o.reference.width!==h.reference.width||o.reference.height!==h.reference.height?{reset:{rects:h}}:{}}}},Mn=(e,t,n)=>{const r=new Map,o={platform:Sn,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,s=i.filter(Boolean),l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:u}=un(c,r,l),f=r,p={},h=0;for(let n=0;n<s.length;n++){const{name:i,fn:m}=s[n],{x:y,y:b,data:g,reset:v}=await m({x:d,y:u,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:c,platform:a,elements:{reference:e,floating:t}});d=null!=y?y:d,u=null!=b?b:u,p={...p,[i]:{...p[i],...g}},v&&h<=50&&(h++,"object"==typeof v&&(v.placement&&(f=v.placement),v.rects&&(c=!0===v.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):v.rects),({x:d,y:u}=un(c,f,l))),n=-1)}return{x:d,y:u,placement:f,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var zn="undefined"!=typeof document?g:b;function Dn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!=r--;)if(!Dn(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!Dn(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Ln(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Bn(e,t){const n=Ln(e);return Math.round(t*n)/n}function Hn(e){const t=p.useRef(e);return zn((()=>{t.current=e})),t}const In=p["useInsertionEffect".toString()]||(e=>e());var $n="undefined"!=typeof document?g:b;let qn=!1,Fn=0;const Wn=()=>"floating-ui-"+Fn++;const Vn=p["useId".toString()]||function(){const[e,t]=p.useState((()=>qn?Wn():void 0));return $n((()=>{null==e&&t(Wn())}),[]),p.useEffect((()=>{qn||(qn=!0)}),[]),e};const Kn=p.createContext(null),Zn=p.createContext(null);function Xn(e){var t;void 0===e&&(e={});const{open:n=!1,onOpenChange:r,nodeId:o}=e,[i,a]=p.useState(null),s=(null==(t=e.elements)?void 0:t.reference)||i,l=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:a}={},transform:s=!0,whileElementsMounted:l,open:c}=e,[d,u]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,h]=p.useState(r);Dn(f,r)||h(r);const[m,y]=p.useState(null),[b,g]=p.useState(null),v=p.useCallback((e=>{e!==E.current&&(E.current=e,y(e))}),[]),w=p.useCallback((e=>{e!==_.current&&(_.current=e,g(e))}),[]),k=i||m,O=a||b,E=p.useRef(null),_=p.useRef(null),P=p.useRef(d),j=null!=l,N=Hn(l),S=Hn(o),C=p.useCallback((()=>{if(!E.current||!_.current)return;const e={placement:t,strategy:n,middleware:f};S.current&&(e.platform=S.current),Mn(E.current,_.current,e).then((e=>{const t={...e,isPositioned:!0};R.current&&!Dn(P.current,t)&&(P.current=t,x.flushSync((()=>{u(t)})))}))}),[f,t,n,S]);zn((()=>{!1===c&&P.current.isPositioned&&(P.current.isPositioned=!1,u((e=>({...e,isPositioned:!1}))))}),[c]);const R=p.useRef(!1);zn((()=>(R.current=!0,()=>{R.current=!1})),[]),zn((()=>{if(k&&(E.current=k),O&&(_.current=O),k&&O){if(N.current)return N.current(k,O,C);C()}}),[k,O,C,N,j]);const T=p.useMemo((()=>({reference:E,floating:_,setReference:v,setFloating:w})),[v,w]),A=p.useMemo((()=>({reference:k,floating:O})),[k,O]),M=p.useMemo((()=>{const e={position:n,left:0,top:0};if(!A.floating)return e;const t=Bn(A.floating,d.x),r=Bn(A.floating,d.y);return s?{...e,transform:"translate("+t+"px, "+r+"px)",...Ln(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}}),[n,s,A.floating,d.x,d.y]);return p.useMemo((()=>({...d,update:C,refs:T,elements:A,floatingStyles:M})),[d,C,T,A,M])}(e),c=p.useContext(Zn),d=null!=((null==(u=p.useContext(Kn))?void 0:u.id)||null);var u;const f=function(e){const t=p.useRef((()=>{}));return In((()=>{t.current=e})),p.useCallback((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)}),[])}(((e,t,n)=>{e&&(m.current.openEvent=t),y.emit("openchange",{open:e,event:t,reason:n,nested:d}),null==r||r(e,t,n)})),h=p.useRef(null),m=p.useRef({}),y=p.useState((()=>function(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}()))[0],b=Vn(),g=p.useCallback((e=>{const t=Tt(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;l.refs.setReference(t)}),[l.refs]),v=p.useCallback((e=>{(Tt(e)||null===e)&&(h.current=e,a(e)),(Tt(l.refs.reference.current)||null===l.refs.reference.current||null!==e&&!Tt(e))&&l.refs.setReference(e)}),[l.refs]),w=p.useMemo((()=>({...l.refs,setReference:v,setPositionReference:g,domReference:h})),[l.refs,v,g]),k=p.useMemo((()=>({...l.elements,domReference:s})),[l.elements,s]),O=p.useMemo((()=>({...l,refs:w,elements:k,dataRef:m,nodeId:o,floatingId:b,events:y,open:n,onOpenChange:f})),[l,o,b,y,n,f,w,k]);return $n((()=>{const e=null==c?void 0:c.nodesRef.current.find((e=>e.id===o));e&&(e.context=O)})),p.useMemo((()=>({...l,context:O,refs:w,elements:k})),[l,w,k,O])}var Un;function Jn(){return Jn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Jn.apply(this,arguments)}var Yn=function(e){return p.createElement("svg",Jn({viewBox:"0 0 10 10",style:{width:14,height:14,display:"block",flexShrink:0,transform:"rotate(90deg)"}},e),Un||(Un=p.createElement("path",{d:"M3 2a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm4-8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"})))};const{BlockOptionsMenuGroup:Gn,BlockOptionsMenuItem:Qn,BlockOptions:er,BlockOptionsSeparator:tr}=r,nr=e=>{var{editor:t,blockId:r,element:o,onClose:i}=e,a=k(e,["editor","blockId","element","onClose"]);return u(er,Object.assign({},a,{onClose:i,actions:null},{children:d(Gn,{children:[u(Qn,{children:d("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{vt.insertTableColumn(t,r,{insertMode:"before"}),i()}},{children:[u(j,{className:"yoopta-table-icons"}),"Insert left"]}))}),u(Qn,{children:d("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{vt.insertTableColumn(t,r,{insertMode:"after"}),i()}},{children:[u(N,{className:"yoopta-table-icons"}),"Insert right"]}))}),u(tr,{}),u(Qn,{children:d("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=t.blockEditorsMap[r],o=n.getElementEntry(t,r,{type:"table-data-cell",path:e.selection});if(o){const[,n]=o,i=nt.next(e,{at:n,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type});if(!i)return;const[,a]=i;vt.moveTableColumn(t,r,{from:n,to:a})}}},{children:[u(M,{className:"yoopta-table-icons"}),"Move right"]}))}),u(Qn,{children:d("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=t.blockEditorsMap[r],o=n.getElementEntry(t,r,{type:"table-data-cell",path:e.selection});if(o){const[,n]=o,i=nt.previous(e,{at:n,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type});if(!i)return;const[,a]=i;vt.moveTableColumn(t,r,{from:n,to:a})}}},{children:[u(A,{className:"yoopta-table-icons"}),"Move left"]}))}),u(tr,{}),u(Qn,{children:d("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{let e=n.getElementPath(t,r,o);e&&(vt.deleteTableColumn(t,r,{path:e}),i())}},{children:[u(B,{className:"yoopta-table-icons"}),"Delete"]}))})]})}))},rr=({editor:e,blockId:t,tdElement:r})=>{const[o,i]=v(!1),{refs:a,floatingStyles:s}=Xn({placement:"bottom-start",open:o,onOpenChange:i,middleware:[An(),Tn(),Rn(),hn(10)],whileElementsMounted:Cn});return d(f,{children:[u(nr,{refs:a,isOpen:o,onClose:()=>{i(!1)},style:s,editor:e,blockId:t,element:r}),u("button",Object.assign({type:"button",ref:a.setReference,onClick:()=>{if(e.readOnly)return;const o=e.blockEditorsMap[t],a=n.getElementPath(e,t,r);a&&(gt.select(o,{path:a.concat([0]),offset:0}),i(!0))},contentEditable:!1,style:o?{opacity:1}:void 0,className:"yoopta-table-column-button"},{children:u(Yn,{})}))]})},{BlockOptionsMenuGroup:or,BlockOptionsMenuItem:ir,BlockOptions:ar,BlockOptionsSeparator:sr}=r,lr=e=>{var{editor:t,blockId:r,onClose:o,tdElement:i}=e,a=k(e,["editor","blockId","onClose","tdElement"]);return u(ar,Object.assign({},a,{onClose:o,actions:null},{children:d(or,{children:[u(ir,{children:d("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{vt.insertTableRow(t,r,{insertMode:"before",select:!0}),o()}},{children:[u(R,{className:"yoopta-table-icons"}),"Insert above"]}))}),u(ir,{children:d("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{vt.insertTableRow(t,r,{insertMode:"after",select:!0}),o()}},{children:[u(C,{className:"yoopta-table-icons"}),"Insert below"]}))}),u(sr,{}),u(ir,{children:d("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=n.getElementPath(t,r,i),a=n.getElement(t,r,{type:"table-row",path:e});if(!a)return;let s=n.getElementPath(t,r,a);const l=t.blockEditorsMap[r],c=nt.previous(l,{at:s,match:e=>Ze.isElement(e)&&"table-row"===e.type});if(!c)return o();vt.moveTableRow(t,r,{from:s,to:c[1]})}},{children:[u(z,{className:"yoopta-table-icons"}),"Move up"]}))}),u(ir,{children:d("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=n.getElementPath(t,r,i),a=n.getElement(t,r,{type:"table-row",path:e});if(!a)return;let s=n.getElementPath(t,r,a);const l=t.blockEditorsMap[r],c=nt.next(l,{at:s,match:e=>Ze.isElement(e)&&"table-row"===e.type});if(!c)return o();vt.moveTableRow(t,r,{from:s,to:c[1]})}},{children:[u(T,{className:"yoopta-table-icons"}),"Move down"]}))}),u(sr,{}),u(ir,{children:d("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=n.getElementPath(t,r,i),a=n.getElement(t,r,{type:"table-row",path:e});if(!a)return;let s=n.getElementPath(t,r,a);vt.deleteTableRow(t,r,{path:s}),o()}},{children:[u(B,{className:"yoopta-table-icons"}),"Delete row"]}))})]})}))},cr=({editor:e,blockId:t,tdElement:r})=>{const[o,i]=v(!1),{refs:a,floatingStyles:s}=Xn({placement:"right-start",open:o,onOpenChange:i,middleware:[An(),Tn(),Rn(),hn(10)],whileElementsMounted:Cn});return d(f,{children:[u(lr,{refs:a,isOpen:o,onClose:()=>{i(!1)},style:s,editor:e,blockId:t,tdElement:r}),u("button",Object.assign({ref:a.setReference,type:"button",onClick:()=>{if(e.readOnly)return;const o=e.blockEditorsMap[t],a=n.getElementPath(e,t,r);a&&(gt.select(o,{path:a.concat([0]),offset:0}),i(!0))},contentEditable:!1,className:"yoopta-table-row-button",style:o?{opacity:1}:void 0},{children:u(Yn,{className:"yoo-table-w-[14px] yoo-table-h-[14px] yoo-table-block yoo-table-flex-shrink-0",style:{transform:"rotate(0deg)"}})}))]})};const dr=new c({type:"Table",elements:{table:{render:({attributes:e,children:t,blockId:n,element:r,HTMLAttributes:a,extendRender:s})=>{const l=o(),c=l.blockEditorsMap[n],f=i(n),p=l.readOnly,h=Pt.get(c);if(s)return s({attributes:e,children:t,blockId:n,element:r,HTMLAttributes:a,isSelecting:h});const m=a||{},{className:y}=m,b=k(m,["className"]);return d("div",Object.assign({className:`yoopta-table-block ${y}`},{children:[u("table",Object.assign({},b,{className:"yoopta-table "+(h?" yoopta-table-selecting":"")},{children:u("tbody",Object.assign({},e,{children:t}))})),!p&&u(Et,{block:f,editor:l,table:r})]}))},asRoot:!0,children:["table-row"],props:{headerRow:!1,headerColumn:!1}},"table-row":{render:({attributes:e,children:t,element:n,blockId:r,HTMLAttributes:o,extendRender:i})=>{if(i)return i({attributes:e,children:t,blockId:r,element:n,HTMLAttributes:o});const a=o||{},{className:s=""}=a,l=k(a,["className"]);return u("tr",Object.assign({},l,{className:`yoopta-table-row ${s}`,"data-element-id":n.id},e,{children:t}))},children:["table-data-cell"]},"table-data-cell":{render:({attributes:e,children:t,element:r,blockId:i,HTMLAttributes:a,extendRender:s})=>{var l,c,f;const p=o(),h=p.blockEditorsMap[i],m=n.getElementPath(p,i,r),y=null===(l=Pt.get(h))||void 0===l?void 0:l.has(r),b=(null===(c=null==r?void 0:r.props)||void 0===c?void 0:c.asHeader)||!1,g=w((()=>{var e,t;const n=nt.above(h,{at:m,match:e=>Ze.isElement(e)&&"table"===e.type});if(!n)return null;const[r]=n,o=(null===(e=null==r?void 0:r.props)||void 0===e?void 0:e.headerRow)||!1;return{headerColumn:(null===(t=null==r?void 0:r.props)||void 0===t?void 0:t.headerColumn)||!1,headerRow:o}}),[b]),{headerRow:v,headerColumn:x}=g||{},O=(null==m?void 0:m[m.length-1])||0,E=(null===(f=null==r?void 0:r.props)||void 0===f?void 0:f.width)||200,_=0===(null==m?void 0:m[m.length-1]),P=0===(null==m?void 0:m[m.length-2]);let j=!1;P&&v&&(j=!0),_&&x&&(j=!0);const N=e=>{vt.updateColumnWidth(p,i,O,e)},S=j?"th":"td",C={maxWidth:E,minWidth:E},R=a||{},{className:T=""}=R,A=k(R,["className"]),M=j?`yoopta-table-data-cell yoopta-table-data-cell-head ${T}`:`yoopta-table-data-cell ${T}`;return s?s({attributes:e,children:t,blockId:i,element:r,HTMLAttributes:a,isDataCellAsHeader:j,onResize:N,width:E,height:E,selected:y}):d(S,Object.assign({scope:j?"col":void 0,"data-cell-selected":y,style:C,colSpan:1,rowSpan:1},A,{className:M},{children:[u("div",Object.assign({className:"yoopta-table-data-cell-content"},e,{children:t})),!p.readOnly&&P&&u(jt,{onResize:N,tdWidth:E,columnIndex:O}),!p.readOnly&&P&&u(rr,{editor:p,blockId:i,tdElement:r}),!p.readOnly&&_&&u(cr,{editor:p,blockId:i,tdElement:r})]}))},props:{asHeader:!1,width:200}}},events:{onKeyDown:function(e,t,{hotkeys:n,currentBlock:r}){return o=>{if(t.selection){if(n.isBackspace(o)){const e=Te.parent(t.selection.anchor.path),n=nt.isStart(t,t.selection.anchor,e),r=_t.get(t);if(r)return o.preventDefault(),void nt.withoutNormalizing(t,(()=>{for(const[,e]of r)for(const[n,r]of Ye.children(t,e))if(pt.isText(n)){const e=Ye.string(n).length;e>0&&gt.delete(t,{at:{anchor:{path:r,offset:0},focus:{path:r,offset:e}}})}gt.select(t,{path:r[0][1].concat(0),offset:0})}));if(n&&Ve.isCollapsed(t.selection))return void o.preventDefault()}if(n.isCmdShiftEnter(o))return o.preventDefault(),void vt.insertTableRow(e,r.id,{select:!0,insertMode:"before"});if(n.isShiftEnter(o))return o.preventDefault(),void vt.insertTableRow(e,r.id,{select:!0,insertMode:"after"});if(n.isCmdShiftRight(o))return o.preventDefault(),void vt.insertTableColumn(e,r.id,{select:!0,insertMode:"after"});if(n.isCmdShiftLeft(o))return o.preventDefault(),void vt.insertTableColumn(e,r.id,{select:!0,insertMode:"before"});if(n.isCmdShiftDelete(o))return o.preventDefault(),void vt.deleteTableRow(e,r.id);if(n.isCmdAltDelete(o))return o.preventDefault(),void vt.deleteTableColumn(e,r.id);if(n.isArrowUp(o)){o.preventDefault();const e=nt.above(t,{at:t.selection.anchor,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type});if(!e)return;const[n,r]=e;try{const e=r[r.length-1],n=Te.previous(r.slice(0,-1)).concat(e);nt.node(t,n),gt.select(t,n)}catch(e){}}else if(n.isArrowDown(o)){o.preventDefault();const e=nt.above(t,{at:t.selection.anchor,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type});if(!e)return;const[n,r]=e;try{const e=r[r.length-1],n=Te.next(r.slice(0,-1)).concat(e);nt.node(t,n),gt.select(t,n)}catch(e){}}else{if(n.isEnter(o)&&(o.preventDefault(),gt.insertText(t,"\n")),n.isSelect(o)){const n=nt.above(t,{match:e=>Ze.isElement(e)&&"table-data-cell"===e.type});if(n){o.preventDefault();const[i,a]=n,s=nt.string(t,a);if(Ve.isExpanded(t.selection)||0===s.length)return e.blur(),void e.setPath({current:null,selected:[r.meta.order]});gt.select(t,a)}}(o.metaKey||o.ctrlKey)&&o.shiftKey&&"h"===o.key&&(o.preventDefault(),vt.toggleHeaderRow(e,r.id)),(o.metaKey||o.ctrlKey)&&o.shiftKey&&"v"===o.key&&(o.preventDefault(),vt.toggleHeaderColumn(e,r.id))}}}},onBlur:(e,t)=>()=>{Pt.delete(t)},onBeforeCreate:e=>vt.buildTableElements(e,{rows:3,columns:3})},parsers:{html:{deserialize:{nodeNames:["TABLE"],parse:function(t,n){const r=t.querySelector("tbody"),o=t.querySelector("thead"),i={id:e(),type:"table",children:[],props:{headerRow:"true"===t.getAttribute("data-header-row"),headerColumn:"true"===t.getAttribute("data-header-column")}};if(!r&&!o)return;const s=null==o?void 0:o.querySelector("tr");if(s&&(i.props.headerRow=!0),s){const t={id:e(),type:"table-row",children:[]};Array.from(s.childNodes).forEach((r=>{if("TH"===r.nodeName){const o={id:e(),type:"table-data-cell",children:[{text:""}],props:{asHeader:!0,width:200}};r instanceof HTMLElement&&(null==r?void 0:r.hasAttribute("data-width"))&&(o.props.width=parseInt(r.getAttribute("data-width")||"200",10));let i=a(n,r.childNodes);o.children=i,t.children.push(o)}})),i.children.push(t)}return null==r||r.childNodes.forEach((t=>{const r=Array.from(t.childNodes).filter((e=>"TD"===e.nodeName||"TH"===e.nodeName));if(r.length>0){const t={id:e(),type:"table-row",children:[]};r.forEach((r=>{const o={id:e(),type:"table-data-cell",children:[{text:""}],props:{asHeader:!1,width:200}};if("TH"===r.nodeName&&(o.props.asHeader=!0),"TD"===r.nodeName&&(o.props.asHeader=!1),"TD"===r.nodeName||"TH"===r.nodeName){r instanceof HTMLElement&&(null==r?void 0:r.hasAttribute("data-width"))&&(o.props.width=parseInt(r.getAttribute("data-width")||"200",10));let e=a(n,r.childNodes);o.children=e,t.children.push(o)}})),i.children.push(t)}})),i}},serialize:function(e,t,n){var r,o;const i=e.children[0].children,{align:a="left",depth:l=0}=n||{};return`<table style="margin-left: ${20*l}px; text-align: ${a}" data-meta-align="${a}" data-meta-depth="${l}" data-header-row="${null===(r=e.props)||void 0===r?void 0:r.headerRow}" data-header-column="${null===(o=e.props)||void 0===o?void 0:o.headerColumn}">\n <colgroup>\n ${i.map((e=>{var t,n;return`<col style="width: ${(null===(t=e.props)||void 0===t?void 0:t.width)?`${null===(n=e.props)||void 0===n?void 0:n.width}px`:"auto"}" />`})).join("")}\n </colgroup>\n <tbody>${e.children.map((e=>`<tr>${e.children.map((e=>{var t,n,r;const o=s(e.children);return(null===(t=e.props)||void 0===t?void 0:t.asHeader)?`<th data-width="${(null===(n=e.props)||void 0===n?void 0:n.width)||200}" rowspan="1" colspan="1">${o}</th>`:`<td data-width="${(null===(r=e.props)||void 0===r?void 0:r.width)||200}" rowspan="1" colspan="1">${o}</td>`})).join("")}</tr>`)).join("")}</tbody></table>`}},markdown:{serialize:function(e,t){let n="";return e.children.forEach(((e,t)=>{const r=e.children.map((e=>` ${l(e.children)} `)).join("|");if(n+=`|${r}|\n`,0===t){const t=e.children.map((()=>" --- ")).join("|");n+=`|${t}|\n`}})),n}},email:{serialize:function(e,t,n){var r,o;const i=e.children[0].children,{align:a="left",depth:l=0}=n||{};return`\n <table style="margin-left: ${20*l}px; text-align: ${a};\n border-collapse: collapse;\n border-spacing: 0px 0px;\n caption-side: bottom;\n font-size: .875rem;\n line-height: 1.25rem;\n table-layout: fixed;\n user-select: none;\n width: auto;\n overflow-x: auto;\n overflow-y: hidden;\n padding-bottom: .5rem;\n padding-top: .5rem;\n position: relative;\n width: 100%;\n " data-meta-align="${a}" data-meta-depth="${l}" data-header-row="${null===(r=e.props)||void 0===r?void 0:r.headerRow}" data-header-column="${null===(o=e.props)||void 0===o?void 0:o.headerColumn}">\n <colgroup>\n ${i.map((e=>{var t,n;return`<col style="width: ${(null===(t=e.props)||void 0===t?void 0:t.width)?`${null===(n=e.props)||void 0===n?void 0:n.width}px`:"auto"}" />`})).join("")}\n </colgroup>\n <tbody>${e.children.map((e=>`<tr style="position: relative;">${e.children.map((e=>{var t,n,r;const o=s(e.children);return(null===(t=e.props)||void 0===t?void 0:t.asHeader)?`<th style="\n border-width: 1px;\n border: 1px solid #e9e9e7;\n color: inherit;\n min-height: 32px;\n position: relative;\n vertical-align: top;\n background-color: #f7f6f3;\n font-size: 14px;\n line-height: 20px;\n max-width: 100%;\n overflow-wrap: break-word;\n padding: 7px 9px;\n white-space: pre-wrap;\n width: 100%;" data-width="${(null===(n=e.props)||void 0===n?void 0:n.width)||200}" rowspan="1" colspan="1">${o}</th>`:`<td style="\n border-width: 1px;\n border: 1px solid #e9e9e7;\n color: inherit;\n min-height: 32px;\n position: relative;\n vertical-align: top;\n background-color: transparent;\n font-size: 14px;\n line-height: 20px;\n max-width: 100%;\n overflow-wrap: break-word;\n padding: 7px 9px;\n white-space: pre-wrap;\n width: 100%;" data-width="${(null===(r=e.props)||void 0===r?void 0:r.width)||200}" rowspan="1" colspan="1">${o}</td>`})).join("")}</tr>`)).join("")}</tbody></table>`}}},extensions:function(t,n){return t=function(e){const{deleteBackward:t}=e;return e.deleteBackward=n=>{const{selection:r}=e;if(!r||Ve.isExpanded(r))return t(n);const[o]=nt.nodes(e,{match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,at:r}),i=nt.before(e,r,{unit:n}),[a]=i?nt.nodes(e,{match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,at:i}):[void 0];if(!o&&!a)return t(n);if(!o&&a&&i)return gt.select(e,i);const[,s]=o,l=nt.start(e,s);it.equals(r.anchor,l)||t(n)},e}(t=function(t,n){const{normalizeNode:r}=t;return t.normalizeNode=(n,o)=>{const[i,a]=n;if(Ze.isElement(i)&&"table-data-cell"===i.type)for(const[e,n]of Ye.children(t,a)){if(Ze.isElement(e)&&"table"===e.type)return void gt.unwrapNodes(t,{at:n});if(Ze.isElement(e)&&"table-row"===e.type)return void gt.unwrapNodes(t,{at:n});if(Ze.isElement(e)&&"table-data-cell"===e.type)return void gt.unwrapNodes(t,{at:n})}if(Ze.isElement(i)&&"table-row"===i.type)for(const[n,r]of Ye.children(t,a))if(!Ze.isElement(n)||"table-data-cell"!==n.type)return gt.wrapNodes(t,{id:e(),type:"table-data-cell",children:[n]},{at:r});r(n,o)},t}(t=function(e){const{apply:t}=e;return e.apply=n=>{if(!et.isSelectionOperation(n)||!n.newProperties)return Pt.delete(e),_t.delete(e),t(n);const r=Object.assign(Object.assign({},e.selection),n.newProperties);if(!Ve.isRange(r))return Pt.delete(e),_t.delete(e),t(n);const[o]=nt.nodes(e,{match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,at:Ve.start(r)}),[i]=nt.nodes(e,{match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,at:Ve.end(r)});if(!o||!i)return Pt.delete(e),_t.delete(e),t(n);const[,a]=o,[,s]=i;if(Te.equals(a,s))return Pt.delete(e),_t.delete(e),t(n);const l=new WeakSet,c=nt.range(e,a,s),d=Array.from(nt.nodes(e,{at:c,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type})),u=[];for(const[e,t]of d)Ze.isElement(e)&&"table-data-cell"===e.type&&(l.add(e),u.push([e,t]));_t.set(e,u),Pt.set(e,l),t(n)},e}(t)))},options:{display:{title:"Table",description:"Add simple table"},shortcuts:["table","||","3x3"]},commands:vt});export{vt as TableCommands,dr as default};
1
+ import{jsx as e}from"react/jsx-runtime";import{Blocks as t,generateId as r,Elements as n,serializeTextNodes as o,deserializeTextNodes as a,serializeTextNodesIntoMarkdown as i,YooptaPlugin as s}from"@yoopta/editor";var l={ancestors(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:r=!1}=t,n=l.levels(e,t);return n=r?n.slice(1):n.slice(0,-1)},common(e,t){for(var r=[],n=0;n<e.length&&n<t.length;n++){var o=e[n];if(o!==t[n])break;r.push(o)}return r},compare(e,t){for(var r=Math.min(e.length,t.length),n=0;n<r;n++){if(e[n]<t[n])return-1;if(e[n]>t[n])return 1}return 0},endsAfter(e,t){var r=e.length-1,n=e.slice(0,r),o=t.slice(0,r),a=e[r],i=t[r];return l.equals(n,o)&&a>i},endsAt(e,t){var r=e.length,n=e.slice(0,r),o=t.slice(0,r);return l.equals(n,o)},endsBefore(e,t){var r=e.length-1,n=e.slice(0,r),o=t.slice(0,r),a=e[r],i=t[r];return l.equals(n,o)&&a<i},equals:(e,t)=>e.length===t.length&&e.every((e,r)=>e===t[r]),hasPrevious:e=>e[e.length-1]>0,isAfter:(e,t)=>1===l.compare(e,t),isAncestor:(e,t)=>e.length<t.length&&0===l.compare(e,t),isBefore:(e,t)=>-1===l.compare(e,t),isChild:(e,t)=>e.length===t.length+1&&0===l.compare(e,t),isCommon:(e,t)=>e.length<=t.length&&0===l.compare(e,t),isDescendant:(e,t)=>e.length>t.length&&0===l.compare(e,t),isParent:(e,t)=>e.length+1===t.length&&0===l.compare(e,t),isPath:e=>Array.isArray(e)&&(0===e.length||"number"==typeof e[0]),isSibling(e,t){if(e.length!==t.length)return!1;var r=e.slice(0,-1),n=t.slice(0,-1);return e[e.length-1]!==t[t.length-1]&&l.equals(r,n)},levels(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:r=!1}=t,n=[],o=0;o<=e.length;o++)n.push(e.slice(0,o));return r&&n.reverse(),n},next(e){if(0===e.length)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(0===e.length)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(0===e.length)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!l.isAncestor(t,e)&&!l.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return null;var n=[...e],{affinity:o="forward"}=r;if(0===e.length)return n;switch(t.type){case"insert_node":var{path:a}=t;(l.equals(a,n)||l.endsBefore(a,n)||l.isAncestor(a,n))&&(n[a.length-1]+=1);break;case"remove_node":var{path:i}=t;if(l.equals(i,n)||l.isAncestor(i,n))return null;l.endsBefore(i,n)&&(n[i.length-1]-=1);break;case"merge_node":var{path:s,position:c}=t;l.equals(s,n)||l.endsBefore(s,n)?n[s.length-1]-=1:l.isAncestor(s,n)&&(n[s.length-1]-=1,n[s.length]+=c);break;case"split_node":var{path:d,position:p}=t;if(l.equals(d,n)){if("forward"===o)n[n.length-1]+=1;else if("backward"!==o)return null}else l.endsBefore(d,n)?n[d.length-1]+=1:l.isAncestor(d,n)&&e[d.length]>=p&&(n[d.length-1]+=1,n[d.length]-=p);break;case"move_node":var{path:f,newPath:h}=t;if(l.equals(f,h))return n;if(l.isAncestor(f,n)||l.equals(f,n)){var u=h.slice();return l.endsBefore(f,h)&&f.length<h.length&&(u[f.length-1]-=1),u.concat(n.slice(f.length))}l.isSibling(f,h)&&(l.isAncestor(h,n)||l.equals(h,n))?l.endsBefore(f,n)?n[f.length-1]-=1:n[f.length-1]+=1:l.endsBefore(h,n)||l.equals(h,n)||l.isAncestor(h,n)?(l.endsBefore(f,n)&&(n[f.length-1]-=1),n[h.length-1]+=1):l.endsBefore(f,n)&&(l.equals(h,n)&&(n[h.length-1]+=1),n[f.length-1]-=1)}return n}};function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function d(e){var t=function(e,t){if("object"!==c(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==c(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===c(t)?t:String(t)}function p(e,t,r){return(t=d(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var h=["anchor","focus"];function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var g={edges(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:r=!1}=t,{anchor:n,focus:o}=e;return g.isBackward(e)===r?[n,o]:[o,n]},end(e){var[,t]=g.edges(e);return t},equals:(e,t)=>B.equals(e.anchor,t.anchor)&&B.equals(e.focus,t.focus),surrounds(e,t){var r=g.intersection(e,t);return!!r&&g.equals(r,t)},includes(e,t){if(g.isRange(t)){if(g.includes(e,t.anchor)||g.includes(e,t.focus))return!0;var[r,n]=g.edges(e),[o,a]=g.edges(t);return B.isBefore(r,o)&&B.isAfter(n,a)}var[i,s]=g.edges(e),c=!1,d=!1;return B.isPoint(t)?(c=B.compare(t,i)>=0,d=B.compare(t,s)<=0):(c=l.compare(t,i.path)>=0,d=l.compare(t,s.path)<=0),c&&d},intersection(e,t){var r=f(e,h),[n,o]=g.edges(e),[a,i]=g.edges(t),s=B.isBefore(n,a)?a:n,l=B.isBefore(o,i)?o:i;return B.isBefore(l,s)?null:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach(function(t){p(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({anchor:s,focus:l},r)},isBackward(e){var{anchor:t,focus:r}=e;return B.isAfter(t,r)},isCollapsed(e){var{anchor:t,focus:r}=e;return B.equals(t,r)},isExpanded:e=>!g.isCollapsed(e),isForward:e=>!g.isBackward(e),isRange:e=>N(e)&&B.isPoint(e.anchor)&&B.isPoint(e.focus),*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=g.edges(e);return t},transform(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null===e)return null;var n,o,{affinity:a="inward"}=r;if("inward"===a){var i=g.isCollapsed(e);g.isForward(e)?(n="forward",o=i?n:"backward"):(n="backward",o=i?n:"forward")}else"outward"===a?g.isForward(e)?(n="backward",o="forward"):(n="forward",o="backward"):(n=a,o=a);var s=B.transform(e.anchor,t,{affinity:n}),l=B.transform(e.focus,t,{affinity:o});return s&&l?{anchor:s,focus:l}:null}},v=function(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!!N(e)&&("function"!=typeof e.apply&&(t?x.isNodeList(e.children):Array.isArray(e.children)))},m={isAncestor(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return N(e)&&x.isNodeList(e.children,{deep:t})},isElement:v,isElementList(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)&&e.every(e=>m.isElement(e,{deep:t}))},isElementProps:e=>void 0!==e.children,isElementType:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"type";return v(e)&&e[r]===t},matches(e,t){for(var r in t)if("children"!==r&&e[r]!==t[r])return!1;return!0}},b=["children"],y=["text"];function w(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function O(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?w(Object(r),!0).forEach(function(t){p(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var x={ancestor(e,t){var r=x.get(e,t);if(L.isText(r))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(R.stringify(r)));return r},ancestors(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var n of l.ancestors(t,r)){var o=[x.ancestor(e,n),n];yield o}}()},child(e,t){if(L.isText(e))throw new Error("Cannot get the child of a text node: ".concat(R.stringify(e)));var r=e.children[t];if(null==r)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(R.stringify(e)));return r},children(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var{reverse:n=!1}=r,o=x.ancestor(e,t),{children:a}=o,i=n?a.length-1:0;n?i>=0:i<a.length;){var s=x.child(o,i),l=t.concat(i);yield[s,l],i=n?i-1:i+1}}()},common(e,t,r){var n=l.common(t,r);return[x.get(e,n),n]},descendant(e,t){var r=x.get(e,t);if(A.isEditor(r))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(R.stringify(r)));return r},descendants(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[r,n]of x.nodes(e,t))0!==n.length&&(yield[r,n])}()},elements(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[r,n]of x.nodes(e,t))m.isElement(r)&&(yield[r,n])}()},extractProps:e=>m.isAncestor(e)?f(e,b):f(e,y),first(e,t){for(var r=t.slice(),n=x.get(e,r);n&&!L.isText(n)&&0!==n.children.length;)n=n.children[0],r.push(0);return[n,r]},fragment(e,t){var r={children:e.children},[n,o]=g.edges(t),a=x.nodes(r,{reverse:!0,pass:e=>{var[,r]=e;return!g.includes(t,r)}}),i=function(){if(!g.includes(t,s)){var e=s[s.length-1];J(r,l.parent(s),t=>W(t,e,1))}l.equals(s,o.path)&&Z(r,s,e=>{var t=e.text.slice(0,o.offset);return O(O({},e),{},{text:t})}),l.equals(s,n.path)&&Z(r,s,e=>{var t=e.text.slice(n.offset);return O(O({},e),{},{text:t})})};for(var[,s]of a)i();return r.children},get(e,t){var r=x.getIf(e,t);if(void 0===r)throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(R.stringify(e)));return r},getIf(e,t){for(var r=e,n=0;n<t.length;n++){var o=t[n];if(L.isText(r)||!r.children[o])return;r=r.children[o]}return r},has(e,t){for(var r=e,n=0;n<t.length;n++){var o=t[n];if(L.isText(r)||!r.children[o])return!1;r=r.children[o]}return!0},isNode(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return L.isText(e)||m.isElement(e,{deep:t})||A.isEditor(e,{deep:t})},isNodeList(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)&&e.every(e=>x.isNode(e,{deep:t}))},last(e,t){for(var r=t.slice(),n=x.get(e,r);n&&!L.isText(n)&&0!==n.children.length;){var o=n.children.length-1;n=n.children[o],r.push(o)}return[n,r]},leaf(e,t){var r=x.get(e,t);if(!L.isText(r))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(R.stringify(r)));return r},levels(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var n of l.levels(t,r)){var o=x.get(e,n);yield[o,n]}}()},matches:(e,t)=>m.isElement(e)&&m.isElementProps(t)&&m.matches(e,t)||L.isText(e)&&L.isTextProps(t)&&L.matches(e,t),nodes(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var{pass:r,reverse:n=!1}=t,{from:o=[],to:a}=t,i=new Set,s=[],c=e;!a||!(n?l.isBefore(s,a):l.isAfter(s,a));)if(i.has(c)||(yield[c,s]),i.has(c)||L.isText(c)||0===c.children.length||null!=r&&!1!==r([c,s])){if(0===s.length)break;if(!n){var d=l.next(s);if(x.has(e,d)){s=d,c=x.get(e,s);continue}}if(n&&0!==s[s.length-1])s=l.previous(s),c=x.get(e,s);else s=l.parent(s),c=x.get(e,s),i.add(c)}else{i.add(c);var p=n?c.children.length-1:0;l.isAncestor(s,o)&&(p=o[s.length]),s=s.concat(p),c=x.get(e,s)}}()},parent(e,t){var r=l.parent(t),n=x.get(e,r);if(L.isText(n))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return n},string:e=>L.isText(e)?e.text:e.children.map(x.string).join(""),texts(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[r,n]of x.nodes(e,t))L.isText(r)&&(yield[r,n])}()}};function j(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function E(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?j(Object(r),!0).forEach(function(t){p(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var P,k={isNodeOperation:e=>k.isOperation(e)&&e.type.endsWith("_node"),isOperation(e){if(!N(e))return!1;switch(e.type){case"insert_node":case"remove_node":return l.isPath(e.path)&&x.isNode(e.node);case"insert_text":case"remove_text":return"number"==typeof e.offset&&"string"==typeof e.text&&l.isPath(e.path);case"merge_node":return"number"==typeof e.position&&l.isPath(e.path)&&N(e.properties);case"move_node":return l.isPath(e.path)&&l.isPath(e.newPath);case"set_node":return l.isPath(e.path)&&N(e.properties)&&N(e.newProperties);case"set_selection":return null===e.properties&&g.isRange(e.newProperties)||null===e.newProperties&&g.isRange(e.properties)||N(e.properties)&&N(e.newProperties);case"split_node":return l.isPath(e.path)&&"number"==typeof e.position&&N(e.properties);default:return!1}},isOperationList:e=>Array.isArray(e)&&e.every(e=>k.isOperation(e)),isSelectionOperation:e=>k.isOperation(e)&&e.type.endsWith("_selection"),isTextOperation:e=>k.isOperation(e)&&e.type.endsWith("_text"),inverse(e){switch(e.type){case"insert_node":return E(E({},e),{},{type:"remove_node"});case"insert_text":return E(E({},e),{},{type:"remove_text"});case"merge_node":return E(E({},e),{},{type:"split_node",path:l.previous(e.path)});case"move_node":var{newPath:t,path:r}=e;if(l.equals(t,r))return e;if(l.isSibling(r,t))return E(E({},e),{},{path:t,newPath:r});var n=l.transform(r,e),o=l.transform(l.next(r),e);return E(E({},e),{},{path:n,newPath:o});case"remove_node":return E(E({},e),{},{type:"insert_node"});case"remove_text":return E(E({},e),{},{type:"insert_text"});case"set_node":var{properties:a,newProperties:i}=e;return E(E({},e),{},{properties:i,newProperties:a});case"set_selection":var{properties:s,newProperties:c}=e;return E(E({},e),{},null==s?{properties:c,newProperties:null}:null==c?{properties:null,newProperties:s}:{properties:c,newProperties:s});case"split_node":return E(E({},e),{},{type:"merge_node",path:l.next(e.path)})}}},N=e=>"object"==typeof e&&null!==e,T=(e,t)=>{for(var r in e){var n=e[r],o=t[r];if(Array.isArray(n)&&Array.isArray(o)){if(n.length!==o.length)return!1;for(var a=0;a<n.length;a++)if(n[a]!==o[a])return!1}else if(N(n)&&N(o)){if(!T(n,o))return!1}else if(n!==o)return!1}for(var i in t)if(void 0===e[i]&&void 0!==t[i])return!1;return!0},S=e=>e.selection?e.selection:e.children.length>0?A.end(e,[]):[0];!function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"}(P||(P={})),P.L,P.L,P.V,P.LV,P.LVT,P.LV,P.V,P.V,P.T,P.LVT,P.T,P.T,P.Any,P.Extend,P.ZWJ,P.Any,P.SpacingMark,P.Prepend,P.Any,P.ZWJ,P.ExtPict,P.RI,P.RI;var A={above:(e,t)=>e.above(t),addMark(e,t,r){e.addMark(t,r)},after:(e,t,r)=>e.after(t,r),before:(e,t,r)=>e.before(t,r),deleteBackward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:r="character"}=t;e.deleteBackward(r)},deleteForward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:r="character"}=t;e.deleteForward(r)},deleteFragment(e,t){e.deleteFragment(t)},edges:(e,t)=>e.edges(t),elementReadOnly(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.elementReadOnly(t)},end:(e,t)=>e.end(t),first:(e,t)=>e.first(t),fragment:(e,t)=>e.fragment(t),hasBlocks:(e,t)=>e.hasBlocks(t),hasInlines:(e,t)=>e.hasInlines(t),hasPath:(e,t)=>e.hasPath(t),hasTexts:(e,t)=>e.hasTexts(t),insertBreak(e){e.insertBreak()},insertFragment(e,t,r){e.insertFragment(t,r)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock:(e,t)=>e.isBlock(t),isEdge:(e,t,r)=>e.isEdge(t,r),isEditor:e=>function(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!N(e))return!1;var r="function"==typeof e.addMark&&"function"==typeof e.apply&&"function"==typeof e.deleteFragment&&"function"==typeof e.insertBreak&&"function"==typeof e.insertSoftBreak&&"function"==typeof e.insertFragment&&"function"==typeof e.insertNode&&"function"==typeof e.insertText&&"function"==typeof e.isElementReadOnly&&"function"==typeof e.isInline&&"function"==typeof e.isSelectable&&"function"==typeof e.isVoid&&"function"==typeof e.normalizeNode&&"function"==typeof e.onChange&&"function"==typeof e.removeMark&&"function"==typeof e.getDirtyPaths&&(null===e.marks||N(e.marks))&&(null===e.selection||g.isRange(e.selection))&&(!t||x.isNodeList(e.children))&&k.isOperationList(e.operations);return r}(e),isElementReadOnly:(e,t)=>e.isElementReadOnly(t),isEmpty:(e,t)=>e.isEmpty(t),isEnd:(e,t,r)=>e.isEnd(t,r),isInline:(e,t)=>e.isInline(t),isNormalizing:e=>e.isNormalizing(),isSelectable:(e,t)=>e.isSelectable(t),isStart:(e,t,r)=>e.isStart(t,r),isVoid:(e,t)=>e.isVoid(t),last:(e,t)=>e.last(t),leaf:(e,t,r)=>e.leaf(t,r),levels:(e,t)=>e.levels(t),marks:e=>e.getMarks(),next:(e,t)=>e.next(t),node:(e,t,r)=>e.node(t,r),nodes:(e,t)=>e.nodes(t),normalize(e,t){e.normalize(t)},parent:(e,t,r)=>e.parent(t,r),path:(e,t,r)=>e.path(t,r),pathRef:(e,t,r)=>e.pathRef(t,r),pathRefs:e=>e.pathRefs(),point:(e,t,r)=>e.point(t,r),pointRef:(e,t,r)=>e.pointRef(t,r),pointRefs:e=>e.pointRefs(),positions:(e,t)=>e.positions(t),previous:(e,t)=>e.previous(t),range:(e,t,r)=>e.range(t,r),rangeRef:(e,t,r)=>e.rangeRef(t,r),rangeRefs:e=>e.rangeRefs(),removeMark(e,t){e.removeMark(t)},setNormalizing(e,t){e.setNormalizing(t)},start:(e,t)=>e.start(t),string:(e,t,r)=>e.string(t,r),unhangRange:(e,t,r)=>e.unhangRange(t,r),void:(e,t)=>e.void(t),withoutNormalizing(e,t){e.withoutNormalizing(t)},shouldMergeNodesRemovePrevNode:(e,t,r)=>e.shouldMergeNodesRemovePrevNode(t,r)};function C(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?C(Object(r),!0).forEach(function(t){p(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):C(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var B={compare(e,t){var r=l.compare(e.path,t.path);return 0===r?e.offset<t.offset?-1:e.offset>t.offset?1:0:r},isAfter:(e,t)=>1===B.compare(e,t),isBefore:(e,t)=>-1===B.compare(e,t),equals:(e,t)=>e.offset===t.offset&&l.equals(e.path,t.path),isPoint:e=>N(e)&&"number"==typeof e.offset&&l.isPath(e.path),transform(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null===e)return null;var{affinity:n="forward"}=r,{path:o,offset:a}=e;switch(t.type){case"insert_node":case"move_node":o=l.transform(o,t,r);break;case"insert_text":l.equals(t.path,o)&&(t.offset<a||t.offset===a&&"forward"===n)&&(a+=t.text.length);break;case"merge_node":l.equals(t.path,o)&&(a+=t.position),o=l.transform(o,t,r);break;case"remove_text":l.equals(t.path,o)&&t.offset<=a&&(a-=Math.min(a-t.offset,t.text.length));break;case"remove_node":if(l.equals(t.path,o)||l.isAncestor(t.path,o))return null;o=l.transform(o,t,r);break;case"split_node":if(l.equals(t.path,o)){if(t.position===a&&null==n)return null;(t.position<a||t.position===a&&"forward"===n)&&(a-=t.position,o=l.transform(o,t,_(_({},r),{},{affinity:"forward"})))}else o=l.transform(o,t,r);break;default:return e}return{path:o,offset:a}}},D=void 0,R={setScrubber(e){D=e},stringify:e=>JSON.stringify(e,D)},q=["text"],z=["anchor","focus","merge"];function I(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function M(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?I(Object(r),!0).forEach(function(t){p(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):I(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var L={equals(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{loose:n=!1}=r;function o(e){return f(e,q)}return T(n?o(e):e,n?o(t):t)},isText:e=>N(e)&&"string"==typeof e.text,isTextList:e=>Array.isArray(e)&&e.every(e=>L.isText(e)),isTextProps:e=>void 0!==e.text,matches(e,t){for(var r in t)if("text"!==r&&(!e.hasOwnProperty(r)||e[r]!==t[r]))return!1;return!0},decorations(e,t){var r=[{leaf:M({},e)}];for(var n of t){var{anchor:o,focus:a,merge:i}=n,s=f(n,z),[l,c]=g.edges(n),d=[],p=0,h=l.offset,u=c.offset,v=null!=i?i:Object.assign;for(var{leaf:m}of r){var{length:b}=m.text,y=p;if(p+=b,h<=y&&p<=u)v(m,s),d.push({leaf:m});else if(h!==u&&(h===p||u===y)||h>p||u<y||u===y&&0!==y)d.push({leaf:m});else{var w=m,O=void 0,x=void 0;if(u<p){var j=u-y;x={leaf:M(M({},w),{},{text:w.text.slice(j)})},w=M(M({},w),{},{text:w.text.slice(0,j)})}if(h>y){var E=h-y;O={leaf:M(M({},w),{},{text:w.text.slice(0,E)})},w=M(M({},w),{},{text:w.text.slice(E)})}v(w,s),O&&d.push(O),d.push({leaf:w}),x&&d.push(x)}}r=d}if(r.length>1){var P=0;for(var[k,N]of r.entries()){var T=P,S=T+N.leaf.text.length,A={start:T,end:S};0===k&&(A.isFirst=!0),k===r.length-1&&(A.isLast=!0),N.position=A,P=S}}return r}};function $(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function H(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$(Object(r),!0).forEach(function(t){p(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var V=function(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),o=2;o<r;o++)n[o-2]=arguments[o];return[...e.slice(0,t),...n,...e.slice(t)]},F=function(e,t,r){for(var n=arguments.length,o=new Array(n>3?n-3:0),a=3;a<n;a++)o[a-3]=arguments[a];return[...e.slice(0,t),...o,...e.slice(t+r)]},W=F,K=(e,t,r)=>{if(0===t.length)throw new Error("Cannot modify the editor");for(var n=x.get(e,t),o=t.slice(),a=r(n);o.length>1;){var i=o.pop(),s=x.get(e,o);a=H(H({},s),{},{children:F(s.children,i,1,a)})}var l=o.pop();e.children=F(e.children,l,1,a)},J=(e,t,r)=>{0===t.length?e.children=r(e.children):K(e,t,e=>{if(L.isText(e))throw new Error("Cannot get the element at path [".concat(t,"] because it refers to a leaf node: ").concat(R.stringify(e)));return H(H({},e),{},{children:r(e.children)})})},Z=(e,t,r)=>K(e,t,e=>{if(!L.isText(e))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(R.stringify(e)));return r(e)});function G(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Q(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?G(Object(r),!0).forEach(function(t){p(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):G(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var U={transform(e,t){var r=!1;switch(t.type){case"insert_node":var{path:n,node:o}=t;J(e,l.parent(n),e=>{var t=n[n.length-1];if(t>e.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(n,"] because the destination is past the end of the node."));return V(e,t,o)}),r=!0;break;case"insert_text":var{path:a,offset:i,text:s}=t;if(0===s.length)break;Z(e,a,e=>{var t=e.text.slice(0,i),r=e.text.slice(i);return Q(Q({},e),{},{text:t+s+r})}),r=!0;break;case"merge_node":var{path:c}=t,d=c[c.length-1],p=l.previous(c),f=p[p.length-1];J(e,l.parent(c),e=>{var t,r=e[d],n=e[f];if(L.isText(r)&&L.isText(n))t=Q(Q({},n),{},{text:n.text+r.text});else{if(L.isText(r)||L.isText(n))throw new Error('Cannot apply a "merge_node" operation at path ['.concat(c,"] to nodes of different interfaces: ").concat(R.stringify(r)," ").concat(R.stringify(n)));t=Q(Q({},n),{},{children:n.children.concat(r.children)})}return F(e,f,2,t)}),r=!0;break;case"move_node":var{path:h,newPath:u}=t,v=h[h.length-1];if(l.isAncestor(h,u))throw new Error("Cannot move a path [".concat(h,"] to new path [").concat(u,"] because the destination is inside itself."));var m=x.get(e,h);J(e,l.parent(h),e=>W(e,v,1));var b=l.transform(h,t),y=b[b.length-1];J(e,l.parent(b),e=>V(e,y,m)),r=!0;break;case"remove_node":var{path:w}=t,O=w[w.length-1];if(J(e,l.parent(w),e=>W(e,O,1)),e.selection){var j=Q({},e.selection);for(var[E,P]of g.points(j)){var k=B.transform(E,t);if(null!=j&&null!=k)j[P]=k;else{var N=void 0,T=void 0;for(var[S,A]of x.texts(e)){if(-1!==l.compare(A,w)){T=[S,A];break}N=[S,A]}var C=!1;N&&T&&(C=!l.isSibling(N[1],w)&&(!!l.equals(T[1],w)||l.common(N[1],w).length<l.common(T[1],w).length)),N&&!C?j[P]={path:N[1],offset:N[0].text.length}:T?j[P]={path:T[1],offset:0}:j=null}}j&&g.equals(j,e.selection)||(e.selection=j)}break;case"remove_text":var{path:_,offset:D,text:q}=t;if(0===q.length)break;Z(e,_,e=>{var t=e.text.slice(0,D),r=e.text.slice(D+q.length);return Q(Q({},e),{},{text:t+r})}),r=!0;break;case"set_node":var{path:z,properties:I,newProperties:M}=t;if(0===z.length)throw new Error("Cannot set properties on the root node!");K(e,z,e=>{var t=Q({},e);for(var r in M){if("children"===r||"text"===r)throw new Error('Cannot set the "'.concat(r,'" property of nodes!'));var n=M[r];null==n?delete t[r]:t[r]=n}for(var o in I)M.hasOwnProperty(o)||delete t[o];return t});break;case"set_selection":var{newProperties:$}=t;if(null==$){e.selection=null;break}if(null==e.selection){if(!g.isRange($))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(R.stringify($)," when there is no current selection."));e.selection=Q({},$);break}var H=Q({},e.selection);for(var G in $){var U=$[G];if(null==U){if("anchor"===G||"focus"===G)throw new Error('Cannot remove the "'.concat(G,'" selection property'));delete H[G]}else H[G]=U}e.selection=H;break;case"split_node":var{path:X,position:Y,properties:ee}=t,te=X[X.length-1];if(0===X.length)throw new Error('Cannot apply a "split_node" operation at path ['.concat(X,"] because the root node cannot be split."));J(e,l.parent(X),e=>{var t,r,n=e[te];if(L.isText(n)){var o=n.text.slice(0,Y),a=n.text.slice(Y);t=Q(Q({},n),{},{text:o}),r=Q(Q({},ee),{},{text:a})}else{var i=n.children.slice(0,Y),s=n.children.slice(Y);t=Q(Q({},n),{},{children:i}),r=Q(Q({},ee),{},{children:s})}return F(e,te,1,t,r)}),r=!0}if(r&&e.selection){var re=Q({},e.selection);for(var[ne,oe]of g.points(re))re[oe]=B.transform(ne,t);g.equals(re,e.selection)||(e.selection=re)}}},X={insertNodes(e,t,r){e.insertNodes(t,r)},liftNodes(e,t){e.liftNodes(t)},mergeNodes(e,t){e.mergeNodes(t)},moveNodes(e,t){e.moveNodes(t)},removeNodes(e,t){e.removeNodes(t)},setNodes(e,t,r){e.setNodes(t,r)},splitNodes(e,t){e.splitNodes(t)},unsetNodes(e,t,r){e.unsetNodes(t,r)},unwrapNodes(e,t){e.unwrapNodes(t)},wrapNodes(e,t,r){e.wrapNodes(t,r)}},Y={collapse(e,t){e.collapse(t)},deselect(e){e.deselect()},move(e,t){e.move(t)},select(e,t){e.select(t)},setPoint(e,t,r){e.setPoint(t,r)},setSelection(e,t){e.setSelection(t)}},ee={delete(e,t){e.delete(t)},insertFragment(e,t,r){e.insertFragment(t,r)},insertText(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};A.withoutNormalizing(e,()=>{var{voids:n=!1}=r,{at:o=S(e)}=r;if(l.isPath(o)&&(o=A.range(e,o)),g.isRange(o))if(g.isCollapsed(o))o=o.anchor;else{var a=g.end(o);if(!n&&A.void(e,{at:a}))return;var i=g.start(o),s=A.pointRef(e,i),c=A.pointRef(e,a);ne.delete(e,{at:o,voids:n});var d=s.unref(),p=c.unref();o=d||p,ne.setSelection(e,{anchor:o,focus:o})}if(!(!n&&A.void(e,{at:o})||A.elementReadOnly(e,{at:o}))){var{path:f,offset:h}=o;t.length>0&&e.apply({type:"insert_text",path:f,offset:h,text:t})}})}};function te(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function re(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?te(Object(r),!0).forEach(function(t){p(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):te(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var ne=re(re(re(re({},U),X),Y),ee);function oe(e){return{rowIndex:e[e.length-2],colIndex:e[e.length-1]}}const ae={buildTableElements:(e,t)=>{const{rows:n=3,columns:o=3,columnWidth:a=200,headerColumn:i=!1,headerRow:s=!1}=t||{},l={id:r(),type:"table",children:[],props:{headerColumn:i,headerRow:s}};for(let e=0;e<n;e+=1){const t={id:r(),type:"table-row",children:[]};for(let n=0;n<o;n+=1){const n={id:r(),type:"table-data-cell",children:[{text:""}],props:{asHeader:0===e&&!!s}};t.children.push(n)}l.children.push(t)}return l},insertTable:(e,r)=>{const n=ae.buildTableElements(e,r),o=t.buildBlockData({value:[n],type:"Table"});t.insertBlock(e,o.type,Object.assign(Object.assign({},r),{blockData:o}))},deleteTable:(e,t)=>{e.deleteBlock({blockId:t})},insertTableRow:(e,o,a)=>{const i=t.getBlockSlate(e,{id:o});i&&A.withoutNormalizing(i,()=>{var t;const{insertMode:s="after",select:c=!0}=a||{},d=n.getElementEntry(e,{blockId:o,path:null===(t=i.selection)||void 0===t?void 0:t.anchor.path,type:"table-row"});if(!d)return;const[p,f]=d,h="before"===s?f:l.next(f),u={id:r(),type:"table-row",children:p.children.map(e=>({id:r(),type:"table-data-cell",children:[{text:""}]})),props:{nodeType:"block"}};ne.insertNodes(i,u,{at:h}),c&&ne.select(i,[...h,0])})},deleteTableRow:(e,r,o)=>{const a=t.getBlockSlate(e,{id:r});a&&A.withoutNormalizing(a,()=>{var t;const o=n.getElementEntry(e,{blockId:r,path:null===(t=a.selection)||void 0===t?void 0:t.anchor.path,type:"table-row"});if(!o)return;const[,i]=o,s=A.nodes(a,{at:[0],match:e=>m.isElement(e)&&"table-row"===e.type,mode:"highest"});1!==Array.from(s).length&&ne.removeNodes(a,{at:i,match:e=>m.isElement(e)&&"table-row"===e.type})})},moveTableRow:(e,r,{from:n,to:o})=>{const a=t.getBlockSlate(e,{id:r});a&&A.withoutNormalizing(a,()=>{ne.moveNodes(a,{at:n,to:o,match:e=>m.isElement(e)&&"table-row"===e.type})})},moveTableColumn:(e,r,{from:n,to:o})=>{const a=t.getBlockSlate(e,{id:r});a&&A.withoutNormalizing(a,()=>{const e=A.nodes(a,{at:[0],match:e=>m.isElement(e)&&"table-row"===e.type,mode:"all"});Array.from(e).forEach(([e,t])=>{ne.moveNodes(a,{at:t.concat(n[n.length-1]),to:[...t,o[o.length-1]],match:e=>m.isElement(e)})})})},insertTableColumn:(e,o,a)=>{const i=t.getBlockSlate(e,{id:o});i&&A.withoutNormalizing(i,()=>{var t;const{insertMode:s="after",select:c=!0}=a||{},d=n.getElementEntry(e,{blockId:o,path:null===(t=i.selection)||void 0===t?void 0:t.anchor.path,type:"table-data-cell"});if(!d)return;const[,p]=d,f=p[p.length-1],h="before"===s?f:l.next(p)[p.length-1],u=A.nodes(i,{at:[0],match:e=>m.isElement(e)&&"table-row"===e.type,mode:"lowest"});for(const[,e]of u){const t={id:r(),type:"table-data-cell",children:[{text:""}]};ne.insertNodes(i,t,{at:[...e,h]})}c&&ne.select(i,[0,0,h,0])})},deleteTableColumn:(e,r,o)=>{const a=t.getBlockSlate(e,{id:r});a&&A.withoutNormalizing(a,()=>{var t;const o=A.nodes(a,{at:[0],match:e=>m.isElement(e)&&"table-row"===e.type,mode:"all"}),i=Array.from(o);if(i[0][0].children.length<=1)return;const s=n.getElementEntry(e,{blockId:r,path:null===(t=a.selection)||void 0===t?void 0:t.anchor.path,type:"table-data-cell"});if(!s)return;const[l,c]=s,d=c[c.length-1];i.map(([e,t])=>e.children[d]?[...t,d]:null).forEach(e=>{e&&ne.removeNodes(a,{at:e})})})},updateColumnWidth:(e,r,n,o)=>{const a=t.getBlockSlate(e,{id:r});a&&A.withoutNormalizing(a,()=>{const e=A.nodes(a,{at:[0],match:e=>m.isElement(e)&&"table-data-cell"===e.type,mode:"all"});Array.from(e).forEach(([e,t])=>{t[t.length-1]===n&&ne.setNodes(a,Object.assign(Object.assign({},e),{props:Object.assign(Object.assign({},e.props),{width:o})}),{at:t,match:e=>m.isElement(e)&&"table-data-cell"===e.type})})})},toggleHeaderRow:(e,r)=>{const o=t.getBlockSlate(e,{id:r});o&&A.withoutNormalizing(o,()=>{var t;const a=n.getElement(e,{blockId:r,type:"table",path:[0]}),i=(null===(t=null==a?void 0:a.props)||void 0===t?void 0:t.headerRow)||!1,s=A.nodes(o,{at:[0,0],match:e=>m.isElement(e)&&"table-data-cell"===e.type,mode:"all"});Array.from(s).forEach(([e,t])=>{var r;ne.setNodes(o,Object.assign(Object.assign({},e),{props:Object.assign(Object.assign({},e.props),{asHeader:!(null===(r=e.props)||void 0===r?void 0:r.asHeader)})}),{at:t,match:e=>m.isElement(e)&&"table-data-cell"===e.type})}),ne.setNodes(o,Object.assign(Object.assign({},a),{props:Object.assign(Object.assign({},null==a?void 0:a.props),{headerRow:!i})}),{at:[0],match:e=>m.isElement(e)&&"table"===e.type})})},toggleHeaderColumn:(e,r)=>{const o=t.getBlockSlate(e,{id:r});o&&A.withoutNormalizing(o,()=>{var t;const a=n.getElement(e,{blockId:r,type:"table",path:[0]}),i=(null===(t=null==a?void 0:a.props)||void 0===t?void 0:t.headerColumn)||!1,s=A.nodes(o,{at:[0],match:e=>m.isElement(e)&&"table-row"===e.type,mode:"all"});Array.from(s).forEach(([e,t])=>{var r;const n=e.children[0];ne.setNodes(o,Object.assign(Object.assign({},n),{props:Object.assign(Object.assign({},n.props),{asHeader:!(null===(r=n.props)||void 0===r?void 0:r.asHeader)})}),{at:t.concat(0),match:e=>m.isElement(e)&&"table-data-cell"===e.type})}),ne.setNodes(o,Object.assign(Object.assign({},a),{props:Object.assign(Object.assign({},null==a?void 0:a.props),{headerColumn:!i})}),{at:[0],match:e=>m.isElement(e)&&"table"===e.type})})},clearContents:(e,r,n)=>{((e,r,n)=>{const{cells:o}=n;if(!o||0===o.length)return void console.warn("No cells to clear");const a=t.getBlockSlate(e,{id:r});a&&A.withoutNormalizing(a,()=>{o.forEach(([e,t])=>{for(let r=e.children.length-1;r>=0;r--)ne.removeNodes(a,{at:[...t,r]});ne.insertNodes(a,{text:""},{at:[...t,0]})})})})(e,r,n)},mergeCells:(e,r,n)=>{((e,r,n)=>{const{cells:o}=n;if(!o||o.length<=1)return void console.warn("Need at least 2 cells to merge");const a=t.getBlockSlate(e,{id:r});if(!a)return;let i=1/0,s=-1/0,l=1/0,c=-1/0;const d=new Map;o.forEach(([e,t])=>{const{rowIndex:r,colIndex:n}=oe(t);i=Math.min(i,r),s=Math.max(s,r),l=Math.min(l,n),c=Math.max(c,n),d.set(`${r}-${n}`,[e,t])});const p=s-i+1,f=c-l+1,h=`${i}-${l}`,u=d.get(h);if(!u)return void console.warn("Anchor cell not found");const[g,v]=u,m=[];o.forEach(([e,t])=>{const{rowIndex:r,colIndex:n}=oe(t);r===i&&n===l||e.children&&e.children.length>0&&e.children.forEach(e=>{e.text&&e.text.trim()&&m.push(e)})}),A.withoutNormalizing(a,()=>{const e=[...g.children,...m.length>0?m:[]];if(ne.setNodes(a,{props:Object.assign(Object.assign({},g.props),{rowSpan:p,colSpan:f})},{at:v}),m.length>0){for(let e=g.children.length-1;e>=0;e--)ne.removeNodes(a,{at:[...v,e]});e.forEach((e,t)=>{ne.insertNodes(a,e,{at:[...v,t]})})}const t=[];for(let e=s;e>=i;e--)for(let r=c;r>=l;r--){if(e===i&&r===l)continue;const n=`${e}-${r}`,o=d.get(n);o&&t.push(o[1])}t.forEach(e=>{try{ne.removeNodes(a,{at:e})}catch(t){console.warn("Failed to remove cell at path:",e)}})})})(e,r,n)},setCellBackgroundColor:(e,r,n)=>{const{cells:o,color:a}=n;if(!o||0===o.length)return void console.warn("No cells to update");const i=t.getBlockSlate(e,{id:r});i&&A.withoutNormalizing(i,()=>{o.forEach(([e,t])=>{ne.setNodes(i,Object.assign(Object.assign({},e),{props:Object.assign(Object.assign({},e.props),{backgroundColor:"transparent"===a?void 0:a})}),{at:t,match:e=>m.isElement(e)&&"table-data-cell"===e.type})})})},setCellTextColor:(e,r,n)=>{const{cells:o,color:a}=n;if(console.log("setCellTextColor cells",o),!o||0===o.length)return void console.warn("No cells to update");const i=t.getBlockSlate(e,{id:r});i&&A.withoutNormalizing(i,()=>{o.forEach(([e,t])=>{ne.setNodes(i,Object.assign(Object.assign({},e),{props:Object.assign(Object.assign({},e.props),{color:"inherit"===a?void 0:a})}),{at:t,match:e=>m.isElement(e)&&"table-data-cell"===e.type})})})},setCellHorizontalAlign:(e,r,n)=>{const{cells:o,align:a}=n;if(!o||0===o.length)return void console.warn("No cells to update");const i=t.getBlockSlate(e,{id:r});i&&A.withoutNormalizing(i,()=>{o.forEach(([e,t])=>{ne.setNodes(i,Object.assign(Object.assign({},e),{props:Object.assign(Object.assign({},e.props),{align:a})}),{at:t,match:e=>m.isElement(e)&&"table-data-cell"===e.type})})})},setCellVerticalAlign:(e,r,n)=>{const{cells:o,align:a}=n;if(!o||0===o.length)return void console.warn("No cells to update");const i=t.getBlockSlate(e,{id:r});i&&A.withoutNormalizing(i,()=>{o.forEach(([e,t])=>{ne.setNodes(i,Object.assign(Object.assign({},e),{props:Object.assign(Object.assign({},e.props),{verticalAlign:a})}),{at:t,match:e=>m.isElement(e)&&"table-data-cell"===e.type})})})}},ie=new WeakMap,se=new WeakMap;function le(e){return{rowIndex:e[e.length-2],colIndex:e[e.length-1]}}function ce(e,t){try{const r=t.slice(0,-2),n=x.get(e,r);if(m.isElement(n)&&"table"===n.type)return[n,r]}catch(e){}return null}function de(e){const{apply:t}=e;return e.apply=r=>{if(!k.isSelectionOperation(r)||!r.newProperties)return se.delete(e),ie.delete(e),t(r);const n=Object.assign(Object.assign({},e.selection),r.newProperties);if(!g.isRange(n))return se.delete(e),ie.delete(e),t(r);const[o]=A.nodes(e,{match:e=>m.isElement(e)&&"table-data-cell"===e.type,at:g.start(n)}),[a]=A.nodes(e,{match:e=>m.isElement(e)&&"table-data-cell"===e.type,at:g.end(n)});if(!o||!a)return se.delete(e),ie.delete(e),t(r);const[,i]=o,[,s]=a;if(l.equals(i,s))return se.delete(e),ie.delete(e),t(r);const c=le(i),d=le(s),p=ce(e,i),f=ce(e,s);if(!p||!f)return se.delete(e),ie.delete(e),t(r);const[,h]=p,[,u]=f;if(!l.equals(h,u))return se.delete(e),ie.delete(e),t(r);const v=function(e,t,r,n,o,a){const i=[],s=Math.min(r,o),l=Math.max(r,o),c=Math.min(n,a),d=Math.max(n,a);for(let r=s;r<=l;r+=1){const n=[...t,r];try{const t=x.get(e,n);if(!m.isElement(t)||"table-row"!==t.type)continue;for(let t=c;t<=d;t+=1){const r=[...n,t];try{const t=x.get(e,r);m.isElement(t)&&"table-data-cell"===t.type&&i.push([t,r])}catch(e){continue}}}catch(e){continue}}return i}(e,h,c.rowIndex,c.colIndex,d.rowIndex,d.colIndex);if(0===v.length)return se.delete(e),ie.delete(e),t(r);const b=new WeakSet;v.forEach(([e])=>{b.add(e)}),ie.set(e,v),se.set(e,b),t(r)},e}const pe={asHeader:!1,verticalAlign:"top",align:"left",colSpan:1,rowSpan:1,backgroundColor:void 0,color:void 0},fe={headerRow:!1,headerColumn:!1,columnWidths:[200,150,250]},he=new s({type:"Table",elements:e("table",Object.assign({render:t=>e("table",Object.assign({},t.attributes,fe,{children:e("tbody",Object.assign({},t.attributes,{children:t.children}))})),nodeType:"block"},{children:e("table-row",Object.assign({render:t=>e("tr",Object.assign({},t.attributes,{children:t.children})),nodeType:"block"},{children:e("table-data-cell",{render:t=>e("td",Object.assign({},t.attributes,{children:t.children})),props:pe,nodeType:"block"})}))})),events:{onKeyDown:function(e,t,{hotkeys:r,currentBlock:n}){return o=>{if(t.selection){if(r.isBackspace(o)){const e=l.parent(t.selection.anchor.path),r=A.isStart(t,t.selection.anchor,e),n=ie.get(t);if(n)return o.preventDefault(),void A.withoutNormalizing(t,()=>{for(const[,e]of n)for(const[r,n]of x.children(t,e))if(L.isText(r)){const e=x.string(r).length;e>0&&ne.delete(t,{at:{anchor:{path:n,offset:0},focus:{path:n,offset:e}}})}ne.select(t,{path:n[0][1].concat(0),offset:0})});if(r&&g.isCollapsed(t.selection))return void o.preventDefault()}if(r.isCmdShiftEnter(o))return o.preventDefault(),void ae.insertTableRow(e,n.id,{select:!0,insertMode:"before"});if(r.isShiftEnter(o))return o.preventDefault(),void ae.insertTableRow(e,n.id,{select:!0,insertMode:"after"});if(r.isCmdShiftRight(o))return o.preventDefault(),void ae.insertTableColumn(e,n.id,{select:!0,insertMode:"after"});if(r.isCmdShiftLeft(o))return o.preventDefault(),void ae.insertTableColumn(e,n.id,{select:!0,insertMode:"before"});if(r.isCmdShiftDelete(o))return o.preventDefault(),void ae.deleteTableRow(e,n.id);if(r.isCmdAltDelete(o))return o.preventDefault(),void ae.deleteTableColumn(e,n.id);if(r.isEnter(o))return o.preventDefault(),void ne.insertText(t,"\n");if(r.isSelect(o)){const r=A.above(t,{match:e=>m.isElement(e)&&"table-data-cell"===e.type});if(r){o.preventDefault();const[,a]=r,i=A.string(t,a);if(g.isExpanded(t.selection)||0===i.length)return e.blur(),void e.setPath({current:null,selected:[n.meta.order]});ne.select(t,a)}}(o.metaKey||o.ctrlKey)&&o.shiftKey&&"h"===o.key&&(o.preventDefault(),ae.toggleHeaderRow(e,n.id)),(o.metaKey||o.ctrlKey)&&o.shiftKey&&"v"===o.key&&(o.preventDefault(),ae.toggleHeaderColumn(e,n.id))}}},onBlur:(e,t)=>()=>{se.delete(t),ie.delete(t)}},lifecycle:{beforeCreate:e=>ae.buildTableElements(e,{rows:3,columns:3})},parsers:{html:{deserialize:{nodeNames:["TABLE"],parse:function(e,t){const n=e.querySelector("tbody"),o=e.querySelector("thead"),i={id:r(),type:"table",children:[],props:{headerRow:"true"===e.getAttribute("data-header-row"),headerColumn:"true"===e.getAttribute("data-header-column")}};if(!n&&!o)return;const s=null==o?void 0:o.querySelector("tr");if(s&&(i.props.headerRow=!0),s){const e={id:r(),type:"table-row",children:[]};Array.from(s.childNodes).forEach(n=>{if("TH"===n.nodeName){const o={id:r(),type:"table-data-cell",children:[{text:""}],props:{asHeader:!0,width:200}};n instanceof HTMLElement&&(null==n?void 0:n.hasAttribute("data-width"))&&(o.props.width=parseInt(n.getAttribute("data-width")||"200",10));const i=a(t,n.childNodes);o.children=i,e.children.push(o)}}),i.children.push(e)}return null==n||n.childNodes.forEach(e=>{const n=Array.from(e.childNodes).filter(e=>"TD"===e.nodeName||"TH"===e.nodeName);if(n.length>0){const e={id:r(),type:"table-row",children:[]};n.forEach(n=>{const o={id:r(),type:"table-data-cell",children:[{text:""}],props:{asHeader:!1,width:200}};if("TH"===n.nodeName&&(o.props.asHeader=!0),"TD"===n.nodeName&&(o.props.asHeader=!1),"TD"===n.nodeName||"TH"===n.nodeName){n instanceof HTMLElement&&(null==n?void 0:n.hasAttribute("data-width"))&&(o.props.width=parseInt(n.getAttribute("data-width")||"200",10));const r=a(t,n.childNodes);o.children=r,e.children.push(o)}}),i.children.push(e)}}),i}}},markdown:{serialize:function(e,t){let r="";return e.children.forEach((e,t)=>{const n=e.children.map(e=>` ${i(e.children)} `).join("|");if(r+=`|${n}|\n`,0===t){const t=e.children.map(()=>" --- ").join("|");r+=`|${t}|\n`}}),r}},email:{serialize:function(e,t,r){var n,a;const i=e.children[0].children,{align:s="left",depth:l=0}=r||{};return`\n <table style="margin-left: ${20*l}px; text-align: ${s};\n border-collapse: collapse;\n border-spacing: 0px 0px;\n caption-side: bottom;\n font-size: .875rem;\n line-height: 1.25rem;\n table-layout: fixed;\n user-select: none;\n width: auto;\n overflow-x: auto;\n overflow-y: hidden;\n padding-bottom: .5rem;\n padding-top: .5rem;\n position: relative;\n width: 100%;\n " data-meta-align="${s}" data-meta-depth="${l}" data-header-row="${null===(n=e.props)||void 0===n?void 0:n.headerRow}" data-header-column="${null===(a=e.props)||void 0===a?void 0:a.headerColumn}">\n <colgroup>\n ${i.map(e=>{var t,r;return`<col style="width: ${(null===(t=e.props)||void 0===t?void 0:t.width)?`${null===(r=e.props)||void 0===r?void 0:r.width}px`:"auto"}" />`}).join("")}\n </colgroup>\n <tbody>${e.children.map(e=>`<tr style="position: relative;">${e.children.map(e=>{var t,r,n;const a=o(e.children);return(null===(t=e.props)||void 0===t?void 0:t.asHeader)?`<th style="\n border-width: 1px;\n border: 1px solid #e9e9e7;\n color: inherit;\n min-height: 32px;\n position: relative;\n vertical-align: top;\n background-color: #f7f6f3;\n font-size: 14px;\n line-height: 20px;\n max-width: 100%;\n overflow-wrap: break-word;\n padding: 7px 9px;\n white-space: pre-wrap;\n width: 100%;" data-width="${(null===(r=e.props)||void 0===r?void 0:r.width)||200}" rowspan="1" colspan="1">${a}</th>`:`<td style="\n border-width: 1px;\n border: 1px solid #e9e9e7;\n color: inherit;\n min-height: 32px;\n position: relative;\n vertical-align: top;\n background-color: transparent;\n font-size: 14px;\n line-height: 20px;\n max-width: 100%;\n overflow-wrap: break-word;\n padding: 7px 9px;\n white-space: pre-wrap;\n width: 100%;" data-width="${(null===(n=e.props)||void 0===n?void 0:n.width)||200}" rowspan="1" colspan="1">${a}</td>`}).join("")}</tr>`).join("")}</tbody></table>`}}},extensions:function(e,t){return e=function(e){const{deleteBackward:t}=e;return e.deleteBackward=r=>{const{selection:n}=e;if(!n||g.isExpanded(n))return t(r);const[o]=A.nodes(e,{match:e=>m.isElement(e)&&"table-data-cell"===e.type,at:n}),a=A.before(e,n,{unit:r}),[i]=a?A.nodes(e,{match:e=>m.isElement(e)&&"table-data-cell"===e.type,at:a}):[void 0];if(!o&&!i)return t(r);if(!o&&i&&a)return ne.select(e,a);const[,s]=o,l=A.start(e,s);B.equals(n.anchor,l)||t(r)},e}(e=function(e){const{normalizeNode:t}=e;return e.normalizeNode=(n,o)=>{const[a,i]=n;if(m.isElement(a)&&"table-data-cell"===a.type)for(const[t,r]of x.children(e,i)){if(m.isElement(t)&&"table"===t.type)return void ne.unwrapNodes(e,{at:r});if(m.isElement(t)&&"table-row"===t.type)return void ne.unwrapNodes(e,{at:r});if(m.isElement(t)&&"table-data-cell"===t.type)return void ne.unwrapNodes(e,{at:r})}if(m.isElement(a)&&"table-row"===a.type)for(const[t,n]of x.children(e,i))if(!m.isElement(t)||"table-data-cell"!==t.type)return ne.wrapNodes(e,{id:r(),type:"table-data-cell",children:[t]},{at:n});t(n,o)},e}(e=de(e)))},options:{display:{title:"Table",description:"Add simple table"},shortcuts:["table","||","3x3"]},commands:ae});export{ie as TABLE_CELLS_IN_SELECTION,se as TABLE_SLATE_TO_SELECTION_SET,ae as TableCommands,he as default};
@@ -1,3 +1,3 @@
1
- import { SlateElement, YooptaBlockData } from '@yoopta/editor';
1
+ import type { SlateElement, YooptaBlockData } from '@yoopta/editor';
2
2
  export declare function serializeTableToEmail(element: SlateElement, text: string, blockMeta?: YooptaBlockData['meta']): string;
3
3
  //# sourceMappingURL=serialize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../../src/parsers/email/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAsB,MAAM,gBAAgB,CAAC;AAEnF,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,YAAY,EACrB,IAAI,EAAE,MAAM,EACZ,SAAS,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,GAClC,MAAM,CA2ER"}
1
+ {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../../src/parsers/email/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGpE,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,YAAY,EACrB,IAAI,EAAE,MAAM,EACZ,SAAS,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,GAClC,MAAM,CA0ER"}
@@ -1,4 +1,4 @@
1
- import { YooEditor } from '@yoopta/editor';
2
- import { TableElement } from '../../types';
1
+ import type { YooEditor } from '@yoopta/editor';
2
+ import type { TableElement } from '../../types';
3
3
  export declare function deserializeTable(el: HTMLElement, editor: YooEditor): TableElement | undefined;
4
4
  //# sourceMappingURL=deserialize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deserialize.d.ts","sourceRoot":"","sources":["../../../src/parsers/html/deserialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAmB,MAAM,aAAa,CAAC;AAE5D,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,4BAoGlE"}
1
+ {"version":3,"file":"deserialize.d.ts","sourceRoot":"","sources":["../../../src/parsers/html/deserialize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,KAAK,EAAE,YAAY,EAAmB,MAAM,aAAa,CAAC;AAEjE,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,4BA4GlE"}
@@ -1,3 +1,3 @@
1
- import { SlateElement, YooptaBlockData } from '@yoopta/editor';
1
+ import type { SlateElement, YooptaBlockData } from '@yoopta/editor';
2
2
  export declare function serializeTable(element: SlateElement, text: string, blockMeta?: YooptaBlockData['meta']): string;
3
3
  //# sourceMappingURL=serialize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../../src/parsers/html/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGnF,wBAAgB,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,UAiCtG"}
1
+ {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../../src/parsers/html/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAKpE,wBAAgB,cAAc,CAC5B,OAAO,EAAE,YAAY,EACrB,IAAI,EAAE,MAAM,EACZ,SAAS,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,UAuCpC"}
@@ -1 +1 @@
1
- {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../../src/parsers/markdown/serialize.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,CAAC,OAAO,KAAA,EAAE,IAAI,KAAA,UAmB7C"}
1
+ {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../../src/parsers/markdown/serialize.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,CAAC,OAAO,KAAA,EAAE,IAAI,KAAA,UAiB7C"}
@@ -1,5 +1,5 @@
1
1
  import { YooptaPlugin } from '@yoopta/editor';
2
- import { TableElementMap } from '../types';
2
+ import type { TableElementMap } from '../types';
3
3
  declare const Table: YooptaPlugin<TableElementMap, Record<string, unknown>>;
4
4
  export { Table };
5
- //# sourceMappingURL=Table.d.ts.map
5
+ //# sourceMappingURL=table-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/table-plugin.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAQ9C,OAAO,KAAK,EAA6B,eAAe,EAAqB,MAAM,UAAU,CAAC;AAmB9F,QAAA,MAAM,KAAK,wDAuDT,CAAC;AAEH,OAAO,EAAE,KAAK,EAAE,CAAC"}
package/dist/types.d.ts CHANGED
@@ -1,12 +1,23 @@
1
- import { SlateElement } from '@yoopta/editor';
1
+ import type { SlateElement } from '@yoopta/editor';
2
2
  export type TablePluginElementKeys = 'table' | 'table-row' | 'table-data-cell';
3
3
  export type TableDataCellElementProps = {
4
- width: number;
5
- asHeader: boolean;
4
+ asHeader?: boolean;
5
+ align?: 'left' | 'center' | 'right' | 'justify';
6
+ colSpan?: number;
7
+ rowSpan?: number;
8
+ backgroundColor?: string;
9
+ color?: string;
10
+ verticalAlign?: 'top' | 'middle' | 'bottom';
11
+ minWidth?: number;
12
+ maxWidth?: number;
6
13
  };
7
14
  export type TableElementProps = {
8
15
  headerRow?: boolean;
9
16
  headerColumn?: boolean;
17
+ columnWidths?: (number | string)[];
18
+ bordered?: boolean;
19
+ striped?: boolean;
20
+ compact?: boolean;
10
21
  };
11
22
  export type TableElement = SlateElement<'table', TableElementProps>;
12
23
  export type TableCellElement = SlateElement<'table-data-cell', TableDataCellElementProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,WAAW,GAAG,iBAAiB,CAAC;AAE/E,MAAM,MAAM,yBAAyB,GAAG;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,YAAY,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;AACpE,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC,iBAAiB,EAAE,yBAAyB,CAAC,CAAC;AAC1F,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC;AAE3C,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,YAAY,CAAC;IACpB,iBAAiB,EAAE,gBAAgB,CAAC;IACpC,WAAW,EAAE,eAAe,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,WAAW,GAAG,iBAAiB,CAAC;AAE/E,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,YAAY,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;AACpE,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC,iBAAiB,EAAE,yBAAyB,CAAC,CAAC;AAC1F,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC;AAE3C,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,YAAY,CAAC;IACpB,iBAAiB,EAAE,gBAAgB,CAAC;IACpC,WAAW,EAAE,eAAe,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC"}
@@ -1,6 +1,6 @@
1
- import { NodeEntry } from 'slate';
2
- import { TableCellElement } from '../types';
1
+ import type { NodeEntry } from 'slate';
2
+ import type { TableCellElement } from '../types';
3
3
  export type SlateNodeEntry = NodeEntry<TableCellElement>;
4
- export declare const EDITOR_TO_SELECTION: WeakMap<import("slate-react").ReactEditor, SlateNodeEntry[]>;
4
+ export declare const TABLE_CELLS_IN_SELECTION: WeakMap<import("slate-react").ReactEditor, SlateNodeEntry[]>;
5
5
  export declare const TABLE_SLATE_TO_SELECTION_SET: WeakMap<import("slate-react").ReactEditor, WeakSet<TableCellElement>>;
6
6
  //# sourceMappingURL=weakMaps.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"weakMaps.d.ts","sourceRoot":"","sources":["../../src/utils/weakMaps.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAmB,MAAM,UAAU,CAAC;AAE7D,MAAM,MAAM,cAAc,GAAG,SAAS,CAAC,gBAAgB,CAAC,CAAC;AAEzD,eAAO,MAAM,mBAAmB,8DAA+C,CAAC;AAChF,eAAO,MAAM,4BAA4B,uEAAwD,CAAC"}
1
+ {"version":3,"file":"weakMaps.d.ts","sourceRoot":"","sources":["../../src/utils/weakMaps.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,MAAM,MAAM,cAAc,GAAG,SAAS,CAAC,gBAAgB,CAAC,CAAC;AAEzD,eAAO,MAAM,wBAAwB,8DAA+C,CAAC;AACrF,eAAO,MAAM,4BAA4B,uEAAwD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoopta/table",
3
- "version": "4.9.9",
3
+ "version": "6.0.0-beta.2",
4
4
  "description": "Table plugin for Yoopta Editor [IN PROGRESS]",
5
5
  "author": "Darginec05 <devopsbanda@gmail.com>",
6
6
  "homepage": "https://github.com/Darginec05/Yoopta-Editor#readme",
@@ -14,12 +14,13 @@
14
14
  "dist/"
15
15
  ],
16
16
  "peerDependencies": {
17
- "@yoopta/editor": ">=4.0.0",
18
- "react": ">=17.0.2",
19
- "react-dom": ">=17.0.2"
17
+ "@yoopta/editor": ">=4.9.9",
18
+ "react": ">=18.2.0",
19
+ "react-dom": ">=18.2.0"
20
20
  },
21
21
  "publishConfig": {
22
- "registry": "https://registry.npmjs.org"
22
+ "registry": "https://registry.npmjs.org",
23
+ "access": "public"
23
24
  },
24
25
  "repository": {
25
26
  "type": "git",
@@ -34,8 +35,5 @@
34
35
  "bugs": {
35
36
  "url": "https://github.com/Darginec05/Yoopta-Editor/issues"
36
37
  },
37
- "dependencies": {
38
- "lucide-react": "^0.436.0"
39
- },
40
- "gitHead": "e8260945d74e2b26e8c66a3ddf4da8ceb45bc74d"
38
+ "gitHead": "58d2c0e3b3b615017e0adb353b80dc493a571186"
41
39
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8C,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACxG,OAAO,EAAmB,IAAI,EAAE,IAAI,EAAc,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAoB,YAAY,EAAmB,MAAM,UAAU,CAAC;AAE/F,KAAK,OAAO,GAAG;IACb,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;CACjC,CAAC;AAEF,KAAK,aAAa,GAAG,IAAI,CAAC,OAAO,EAAE,YAAY,GAAG,QAAQ,CAAC,CAAC;AAE5D,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,IAAI,CAAC;IACX,EAAE,EAAE,IAAI,CAAC;CACV,CAAC;AAEF,KAAK,aAAa,GAAG,OAAO,CAC1B,kBAAkB,GAAG;IACnB,EAAE,EAAE,eAAe,CAAC;CACrB,CACF,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,kBAAkB,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,aAAa,KAAK,YAAY,CAAC;IACjF,WAAW,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;IAClE,WAAW,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1D,cAAc,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAChF,cAAc,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;IACtF,YAAY,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACtF,eAAe,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACzF,iBAAiB,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACnF,iBAAiB,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;IACzF,iBAAiB,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACpG,eAAe,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9D,kBAAkB,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAClE,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,aAwU3B,CAAC"}
@@ -1,7 +0,0 @@
1
- declare const ResizeHandle: ({ onResize, tdWidth, columnIndex }: {
2
- onResize: any;
3
- tdWidth: any;
4
- columnIndex: any;
5
- }) => import("react/jsx-runtime").JSX.Element;
6
- export { ResizeHandle };
7
- //# sourceMappingURL=ResizeHandle.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ResizeHandle.d.ts","sourceRoot":"","sources":["../../src/components/ResizeHandle.tsx"],"names":[],"mappings":"AAEA,QAAA,MAAM,YAAY;;;;6CAwDjB,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -1,10 +0,0 @@
1
- import { YooEditor, YooptaBlockData } from '@yoopta/editor';
2
- import { TableElement } from '../types';
3
- type Props = {
4
- editor: YooEditor;
5
- block: YooptaBlockData;
6
- table: TableElement;
7
- };
8
- declare const TableBlockOptions: ({ editor, block, table }: Props) => import("react/jsx-runtime").JSX.Element;
9
- export { TableBlockOptions };
10
- //# sourceMappingURL=TableBlockOptions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TableBlockOptions.d.ts","sourceRoot":"","sources":["../../src/components/TableBlockOptions.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAM,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGhE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAIxC,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,YAAY,CAAC;CACrB,CAAC;AAEF,QAAA,MAAM,iBAAiB,6BAA8B,KAAK,4CAsDzD,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -1,9 +0,0 @@
1
- import { SlateElement, YooEditor } from '@yoopta/editor';
2
- type TableRowProps = {
3
- editor: YooEditor;
4
- blockId: string;
5
- tdElement: SlateElement;
6
- };
7
- declare const TableColumnDragButton: ({ editor, blockId, tdElement }: TableRowProps) => import("react/jsx-runtime").JSX.Element;
8
- export { TableColumnDragButton };
9
- //# sourceMappingURL=TableColumnDragButton.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TableColumnDragButton.d.ts","sourceRoot":"","sources":["../../src/components/TableColumnDragButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAOnE,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,YAAY,CAAC;CACzB,CAAC;AAEF,QAAA,MAAM,qBAAqB,mCAAoC,aAAa,4CAgD3E,CAAC;AAEF,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
@@ -1,17 +0,0 @@
1
- import { SlateElement, YooEditor } from '@yoopta/editor';
2
- import { CSSProperties } from 'react';
3
- export type Props = {
4
- isOpen: boolean;
5
- onClose: () => void;
6
- refs: any;
7
- style: CSSProperties;
8
- children?: React.ReactNode;
9
- actions?: ['delete', 'duplicate', 'turnInto', 'copy'] | null;
10
- } & {
11
- editor: YooEditor;
12
- blockId: string;
13
- element: SlateElement;
14
- };
15
- declare const TableColumnOptions: ({ editor, blockId, element, onClose, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
16
- export { TableColumnOptions };
17
- //# sourceMappingURL=TableColumnOptions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TableColumnOptions.d.ts","sourceRoot":"","sources":["../../src/components/TableColumnOptions.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,YAAY,EAAM,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEvE,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAOtC,MAAM,MAAM,KAAK,GAAG;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CAC9D,GAAG;IACF,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,YAAY,CAAC;CACvB,CAAC;AAEF,QAAA,MAAM,kBAAkB,oDAAqD,KAAK,4CA0GjF,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
@@ -1,9 +0,0 @@
1
- import { SlateElement, YooEditor } from '@yoopta/editor';
2
- type TableRowProps = {
3
- editor: YooEditor;
4
- blockId: string;
5
- tdElement: SlateElement;
6
- };
7
- declare const TableRowDragButton: ({ editor, blockId, tdElement }: TableRowProps) => import("react/jsx-runtime").JSX.Element;
8
- export { TableRowDragButton };
9
- //# sourceMappingURL=TableRowDragButton.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TableRowDragButton.d.ts","sourceRoot":"","sources":["../../src/components/TableRowDragButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAOnE,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,YAAY,CAAC;CACzB,CAAC;AAEF,QAAA,MAAM,kBAAkB,mCAAoC,aAAa,4CAoDxE,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
@@ -1,17 +0,0 @@
1
- import { SlateElement, YooEditor } from '@yoopta/editor';
2
- import { CSSProperties } from 'react';
3
- export type Props = {
4
- isOpen: boolean;
5
- onClose: () => void;
6
- refs: any;
7
- style: CSSProperties;
8
- children?: React.ReactNode;
9
- actions?: ['delete', 'duplicate', 'turnInto', 'copy'] | null;
10
- } & {
11
- editor: YooEditor;
12
- blockId: string;
13
- tdElement: SlateElement;
14
- };
15
- declare const TableRowOptions: ({ editor, blockId, onClose, tdElement, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
16
- export { TableRowOptions };
17
- //# sourceMappingURL=TableRowOptions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TableRowOptions.d.ts","sourceRoot":"","sources":["../../src/components/TableRowOptions.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,YAAY,EAAM,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEvE,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAOtC,MAAM,MAAM,KAAK,GAAG;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CAC9D,GAAG;IACF,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,YAAY,CAAC;CACzB,CAAC;AAEF,QAAA,MAAM,eAAe,sDAAuD,KAAK,4CA8FhF,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- import { PluginElementRenderProps } from '@yoopta/editor';
3
- declare const Table: ({ attributes, children, blockId, element, HTMLAttributes, extendRender }: PluginElementRenderProps) => JSX.Element;
4
- export { Table };
5
- //# sourceMappingURL=Table.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../src/elements/Table.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,wBAAwB,EAAiC,MAAM,gBAAgB,CAAC;AAKzF,QAAA,MAAM,KAAK,6EAA8E,wBAAwB,gBAuBhH,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC"}
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- import { PluginElementRenderProps } from '@yoopta/editor';
3
- declare const TableDataCell: ({ attributes, children, element, blockId, HTMLAttributes, extendRender, }: PluginElementRenderProps) => JSX.Element;
4
- export { TableDataCell };
5
- //# sourceMappingURL=TableDataCell.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TableDataCell.d.ts","sourceRoot":"","sources":["../../src/elements/TableDataCell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAY,wBAAwB,EAAmB,MAAM,gBAAgB,CAAC;AAUrF,QAAA,MAAM,aAAa,8EAOhB,wBAAwB,gBAoG1B,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- import { PluginElementRenderProps } from '@yoopta/editor';
3
- declare const TableRow: ({ attributes, children, element, blockId, HTMLAttributes, extendRender, }: PluginElementRenderProps) => JSX.Element;
4
- export { TableRow };
5
- //# sourceMappingURL=TableRow.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TableRow.d.ts","sourceRoot":"","sources":["../../src/elements/TableRow.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,wBAAwB,EAAmB,MAAM,gBAAgB,CAAC;AAE3E,QAAA,MAAM,QAAQ,8EAOX,wBAAwB,gBAa1B,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../src/plugin/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI9C,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAW3C,QAAA,MAAM,KAAK,wDAyDT,CAAC;AAEH,OAAO,EAAE,KAAK,EAAE,CAAC"}