@arkitektbedriftene/fe-lib 0.4.3 → 0.4.5

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.
@@ -1,94 +1,95 @@
1
- import { createHeadlessEditor as dt } from "@lexical/headless";
2
- import { $generateHtmlFromNodes as ct } from "@lexical/html";
3
- import { $getRoot as _, ParagraphNode as ht, $createParagraphNode as R, $createTextNode as W, $setSelection as G, SELECTION_CHANGE_COMMAND as Q, $getSelection as L, COMMAND_PRIORITY_CRITICAL as V, $isRangeSelection as y, $isRootOrShadowRoot as ut, DEPRECATED_$isGridSelection as D, FORMAT_TEXT_COMMAND as z, COMMAND_PRIORITY_LOW as T, KEY_ARROW_DOWN_COMMAND as pt, KEY_ARROW_UP_COMMAND as gt, KEY_ESCAPE_COMMAND as ft, KEY_SPACE_COMMAND as mt, $getNearestNodeFromDOMNode as A, KEY_ARROW_LEFT_COMMAND as kt, $isElementNode as Mt } from "lexical";
4
- import { trimTextContentFromAnchor as vt, $setBlocksType as F } from "@lexical/selection";
5
- import { AutoLinkNode as Ct, LinkNode as bt } from "@lexical/link";
6
- import { ListNode as X, ListItemNode as Tt, $isListNode as j, INSERT_UNORDERED_LIST_COMMAND as Lt, INSERT_ORDERED_LIST_COMMAND as yt, INSERT_CHECK_LIST_COMMAND as J, insertList as xt, $isListItemNode as x } from "@lexical/list";
7
- import { HeadingNode as Nt, QuoteNode as St, $isHeadingNode as Et, $createHeadingNode as wt, $createQuoteNode as zt } from "@lexical/rich-text";
8
- import { TableNode as It, TableRowNode as Ot, TableCellNode as $t } from "@lexical/table";
9
- import { jsx as o, jsxs as b, Fragment as O } from "react/jsx-runtime";
10
- import { createContext as _t, useState as v, useRef as Z, useCallback as M, useContext as Rt, useEffect as B, useMemo as tt, useLayoutEffect as Bt } from "react";
11
- import { c as N, s as et, D as Ht, T as Dt, a as m, B as $, b as Ft, d as I, u as Pt, e as Wt, f as At, g as jt, o as Kt, h as Ut, i as Yt, j as qt, F as Gt, O as Qt, k as Vt, l as Xt, S as Jt } from "./DropdownMenu-3889bea2.js";
1
+ import { createHeadlessEditor as kt } from "@lexical/headless";
2
+ import { $generateHtmlFromNodes as Mt } from "@lexical/html";
3
+ import { $getRoot as O, ParagraphNode as bt, $createParagraphNode as B, $createTextNode as A, $setSelection as Z, SELECTION_CHANGE_COMMAND as W, $getSelection as L, COMMAND_PRIORITY_CRITICAL as tt, $isRangeSelection as x, $isRootOrShadowRoot as Ct, DEPRECATED_$isGridSelection as P, FORMAT_TEXT_COMMAND as $, COMMAND_PRIORITY_LOW as T, KEY_ARROW_DOWN_COMMAND as vt, KEY_ARROW_UP_COMMAND as Tt, KEY_ESCAPE_COMMAND as Lt, KEY_SPACE_COMMAND as xt, $getNearestNodeFromDOMNode as j, KEY_ARROW_LEFT_COMMAND as yt, $isElementNode as Et } from "lexical";
4
+ import { trimTextContentFromAnchor as Nt, $setBlocksType as H } from "@lexical/selection";
5
+ import { AutoLinkNode as St, LinkNode as wt } from "@lexical/link";
6
+ import { ListNode as et, ListItemNode as zt, $isListNode as K, INSERT_UNORDERED_LIST_COMMAND as It, INSERT_ORDERED_LIST_COMMAND as $t, INSERT_CHECK_LIST_COMMAND as rt, insertList as _t, $isListItemNode as E } from "@lexical/list";
7
+ import { HeadingNode as Rt, QuoteNode as Ot, $isHeadingNode as Bt, $createHeadingNode as Ft, $createQuoteNode as Pt } from "@lexical/rich-text";
8
+ import { TableNode as Ht, TableRowNode as Dt, TableCellNode as At, $getTableCellNodeFromLexicalNode as Wt, $deleteTableColumn__EXPERIMENTAL as jt, $deleteTableRow__EXPERIMENTAL as Kt, $insertTableColumn__EXPERIMENTAL as Y, $insertTableRow__EXPERIMENTAL as q } from "@lexical/table";
9
+ import { jsx as r, jsxs as C, Fragment as U } from "react/jsx-runtime";
10
+ import { createContext as Ut, useState as M, useRef as ot, useCallback as b, useContext as Yt, useEffect as N, useMemo as nt, useLayoutEffect as qt } from "react";
11
+ import { c as S, s as at, D as it, T as Xt, a as m, B as R, b as Gt, d as _, u as lt, e as Qt, f as Vt, g as Jt, o as st, h as Zt, i as te, j as ee, F as re, O as oe, k as ne, l as ae, S as ie, m as le, n as y, p as X } from "./TextInput-bedd6814.js";
12
12
  import "react-select";
13
- import { LexicalComposer as Zt } from "@lexical/react/LexicalComposer.js";
14
- import { RichTextPlugin as te } from "@lexical/react/LexicalRichTextPlugin.js";
15
- import ee from "@lexical/react/LexicalErrorBoundary.js";
16
- import { useLexicalComposerContext as H } from "@lexical/react/LexicalComposerContext.js";
17
- import { $getNearestNodeOfType as re, $findMatchingParent as rt, mergeRegister as ot, isHTMLElement as K } from "@lexical/utils";
18
- import { G as c } from "./index.esm-d078f232.js";
19
- import { ListPlugin as oe } from "@lexical/react/LexicalListPlugin.js";
20
- import { HistoryPlugin as ne } from "@lexical/react/LexicalHistoryPlugin.js";
21
- import { TablePlugin as ae } from "@lexical/react/LexicalTablePlugin.js";
22
- import { TabIndentationPlugin as ie } from "@lexical/react/LexicalTabIndentationPlugin.js";
13
+ import { LexicalComposer as se } from "@lexical/react/LexicalComposer.js";
14
+ import { RichTextPlugin as de } from "@lexical/react/LexicalRichTextPlugin.js";
15
+ import ce from "@lexical/react/LexicalErrorBoundary.js";
16
+ import { useLexicalComposerContext as F } from "@lexical/react/LexicalComposerContext.js";
17
+ import { $getNearestNodeOfType as he, $findMatchingParent as dt, mergeRegister as ct, isHTMLElement as G } from "@lexical/utils";
18
+ import { G as c } from "./index.esm-969855d2.js";
19
+ import { ListPlugin as ue } from "@lexical/react/LexicalListPlugin.js";
20
+ import { HistoryPlugin as pe } from "@lexical/react/LexicalHistoryPlugin.js";
21
+ import { TablePlugin as ge } from "@lexical/react/LexicalTablePlugin.js";
22
+ import { TabIndentationPlugin as fe } from "@lexical/react/LexicalTabIndentationPlugin.js";
23
+ import { useLexicalComposerContext as me } from "@lexical/react/LexicalComposerContext";
23
24
  import "react-dom";
24
25
  import "@radix-ui/react-toolbar";
25
26
  import "@radix-ui/react-dropdown-menu";
26
- const le = ({
27
+ const ke = ({
27
28
  text: t,
28
29
  maxChars: e,
29
- maxLines: r
30
+ maxLines: o
30
31
  }) => {
31
32
  if (t.length === 0)
32
33
  return 0;
33
- const n = typeof r == "number", a = typeof e == "number";
34
+ const n = typeof o == "number", a = typeof e == "number";
34
35
  if (!n && !a)
35
36
  return t.length;
36
37
  let l = 0, i = 0;
37
- for (; i < t.length && (!n || l < r) && (!a || i < e); )
38
+ for (; i < t.length && (!n || l < o) && (!a || i < e); )
38
39
  t[i] === `
39
40
  ` && l++, i++;
40
41
  return t.slice(0, i).length;
41
- }, se = ({
42
+ }, Me = ({
42
43
  editor: t,
43
44
  maxChars: e,
44
- maxLines: r
45
+ maxLines: o
45
46
  }) => {
46
- const n = _(), a = n.getTextContent(), l = le({ text: a, maxChars: e, maxLines: r }), i = a.length - l, p = n.select().anchor;
47
- vt(t, p, i);
47
+ const n = O(), a = n.getTextContent(), l = ke({ text: a, maxChars: e, maxLines: o }), i = a.length - l, h = n.select().anchor;
48
+ Nt(t, h, i);
48
49
  const s = n.getLastChild();
49
- return s instanceof ht && s.getChildrenSize() === 0 && s.remove(), i;
50
- }, nt = (t) => t[0] === "{", de = (t) => t !== null && typeof t == "object" && "isEmpty" in t, ce = (t, e) => {
50
+ return s instanceof bt && s.getChildrenSize() === 0 && s.remove(), i;
51
+ }, ht = (t) => t[0] === "{", be = (t) => t !== null && typeof t == "object" && "isEmpty" in t, Ce = (t, e) => {
51
52
  t.update(
52
53
  () => {
53
- const r = _();
54
- r.clear();
55
- const n = R();
56
- n.append(W("")), r.append(n), G(null);
54
+ const o = O();
55
+ o.clear();
56
+ const n = B();
57
+ n.append(A("")), o.append(n), Z(null);
57
58
  },
58
59
  {
59
60
  tag: e
60
61
  }
61
62
  );
62
- }, he = (t, e, r) => {
63
+ }, ve = (t, e, o) => {
63
64
  e.update(
64
65
  () => {
65
- const n = _();
66
+ const n = O();
66
67
  n.clear();
67
- const a = R();
68
- a.append(W(t.trim())), n.append(a), G(null);
68
+ const a = B();
69
+ a.append(A(t.trim())), n.append(a), Z(null);
69
70
  },
70
71
  {
71
- tag: r
72
+ tag: o
72
73
  }
73
74
  ), e.blur();
74
- }, br = (t, e, r) => {
75
+ }, $r = (t, e, o) => {
75
76
  let n = 0;
76
- const a = dt({
77
+ const a = kt({
77
78
  nodes: e,
78
79
  editable: !1
79
80
  });
80
81
  if (t)
81
82
  try {
82
- if (typeof t == "string" && !nt(t))
83
+ if (typeof t == "string" && !ht(t))
83
84
  a.update(() => {
84
- const i = _(), d = R();
85
- d.append(W(t.trim())), i.append(d);
85
+ const i = O(), d = B();
86
+ d.append(A(t.trim())), i.append(d);
86
87
  });
87
88
  else {
88
89
  const i = a.parseEditorState(t, () => {
89
- n = se({
90
+ n = Me({
90
91
  editor: a,
91
- maxLines: r == null ? void 0 : r.maxLines
92
+ maxLines: o == null ? void 0 : o.maxLines
92
93
  });
93
94
  });
94
95
  i.isEmpty() || a.setEditorState(i);
@@ -98,50 +99,50 @@ const le = ({
98
99
  }
99
100
  let l = "";
100
101
  return a.update(() => {
101
- l = ct(a);
102
+ l = Mt(a);
102
103
  }), { html: l, trimCount: n };
103
- }, Tr = [
104
- Nt,
105
- St,
106
- X,
107
- Tt,
108
- Ct,
109
- bt,
110
- It,
104
+ }, _r = [
105
+ Rt,
111
106
  Ot,
112
- $t
113
- ], ue = N({
107
+ et,
108
+ zt,
109
+ St,
110
+ wt,
111
+ Ht,
112
+ Dt,
113
+ At
114
+ ], Te = S({
114
115
  fontWeight: "bold"
115
- }), pe = N({
116
+ }), Le = S({
116
117
  fontStyle: "italic"
117
- }), ge = N({
118
+ }), xe = S({
118
119
  textDecoration: "underline"
119
- }), fe = N({
120
+ }), ye = S({
120
121
  listStyleType: "none"
121
- }), me = N({
122
+ }), Ee = S({
122
123
  borderLeft: "4px solid #ccc",
123
124
  color: "#666",
124
125
  fontStyle: "italic",
125
126
  margin: "1.5em 10px",
126
127
  padding: "0.5em 10px"
127
- }), ke = {
128
- quote: me().className,
128
+ }), Ne = {
129
+ quote: Ee().className,
129
130
  text: {
130
- bold: ue().className,
131
- italic: pe().className,
132
- underline: ge().className
131
+ bold: Te().className,
132
+ italic: Le().className,
133
+ underline: xe().className
133
134
  },
134
135
  list: {
135
136
  nested: {
136
- listitem: fe().className
137
+ listitem: ye().className
137
138
  }
138
139
  }
139
- }, at = _t({ hasFocus: !1, editorRef: { current: null } }), Me = ({ onBlur: t }) => {
140
- const [e, r] = v(!1), n = Z(null), a = M(() => {
141
- r(!0), n.current && window.clearTimeout(n.current);
142
- }, []), l = M(() => {
140
+ }, ut = Ut({ hasFocus: !1, editorRef: { current: null } }), Se = ({ onBlur: t }) => {
141
+ const [e, o] = M(!1), n = ot(null), a = b(() => {
142
+ o(!0), n.current && window.clearTimeout(n.current);
143
+ }, []), l = b(() => {
143
144
  n.current = window.setTimeout(() => {
144
- r(!1), t == null || t();
145
+ o(!1), t == null || t();
145
146
  }, 0);
146
147
  }, [t]);
147
148
  return {
@@ -151,59 +152,59 @@ const le = ({
151
152
  onBlur: l
152
153
  }
153
154
  };
154
- }, ve = () => Rt(at);
155
- function Ce(t) {
155
+ }, pt = () => Yt(ut);
156
+ function we(t) {
156
157
  return c({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M7 5h6a3.5 3.5 0 0 1 0 7h-6z" } }, { tag: "path", attr: { d: "M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7" } }] })(t);
157
158
  }
158
- function be(t) {
159
+ function ze(t) {
159
160
  return c({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M7 8l-4 4l4 4" } }, { tag: "path", attr: { d: "M17 8l4 4l-4 4" } }, { tag: "path", attr: { d: "M14 4l-4 16" } }] })(t);
160
161
  }
161
- function Te(t) {
162
+ function Ie(t) {
162
163
  return c({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M19 18v-8l-2 2" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
163
164
  }
164
- function Le(t) {
165
+ function $e(t) {
165
166
  return c({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M17 12a2 2 0 1 1 4 0c0 .591 -.417 1.318 -.816 1.858l-3.184 4.143l4 0" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
166
167
  }
167
- function ye(t) {
168
+ function _e(t) {
168
169
  return c({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M19 14a2 2 0 1 0 -2 -2" } }, { tag: "path", attr: { d: "M17 16a2 2 0 1 0 2 -2" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
169
170
  }
170
- function xe(t) {
171
+ function Re(t) {
171
172
  return c({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M20 18v-8l-4 6h5" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
172
173
  }
173
- function Ne(t) {
174
+ function Oe(t) {
174
175
  return c({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M17 18h2a2 2 0 1 0 0 -4h-2v-4h4" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
175
176
  }
176
- function Se(t) {
177
+ function Be(t) {
177
178
  return c({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M19 14a2 2 0 1 0 0 4a2 2 0 0 0 0 -4z" } }, { tag: "path", attr: { d: "M21 12a2 2 0 1 0 -4 0v4" } }, { tag: "path", attr: { d: "M4 6v12" } }, { tag: "path", attr: { d: "M12 6v12" } }, { tag: "path", attr: { d: "M11 18h2" } }, { tag: "path", attr: { d: "M3 18h2" } }, { tag: "path", attr: { d: "M4 12h8" } }, { tag: "path", attr: { d: "M3 6h2" } }, { tag: "path", attr: { d: "M11 6h2" } }] })(t);
178
179
  }
179
- function Ee(t) {
180
+ function Fe(t) {
180
181
  return c({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M11 5l6 0" } }, { tag: "path", attr: { d: "M7 19l6 0" } }, { tag: "path", attr: { d: "M14 5l-4 14" } }] })(t);
181
182
  }
182
- function we(t) {
183
+ function Pe(t) {
183
184
  return c({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M17.5 15.5m-3.5 0a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0 -7 0" } }, { tag: "path", attr: { d: "M3 19v-10.5a3.5 3.5 0 0 1 7 0v10.5" } }, { tag: "path", attr: { d: "M3 13h7" } }, { tag: "path", attr: { d: "M21 12v7" } }] })(t);
184
185
  }
185
- function ze(t) {
186
+ function He(t) {
186
187
  return c({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M3.5 5.5l1.5 1.5l2.5 -2.5" } }, { tag: "path", attr: { d: "M3.5 11.5l1.5 1.5l2.5 -2.5" } }, { tag: "path", attr: { d: "M3.5 17.5l1.5 1.5l2.5 -2.5" } }, { tag: "path", attr: { d: "M11 6l9 0" } }, { tag: "path", attr: { d: "M11 12l9 0" } }, { tag: "path", attr: { d: "M11 18l9 0" } }] })(t);
187
188
  }
188
- function Ie(t) {
189
+ function De(t) {
189
190
  return c({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M11 6h9" } }, { tag: "path", attr: { d: "M11 12h9" } }, { tag: "path", attr: { d: "M12 18h8" } }, { tag: "path", attr: { d: "M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4" } }, { tag: "path", attr: { d: "M6 10v-6l-2 2" } }] })(t);
190
191
  }
191
- function Oe(t) {
192
+ function Ae(t) {
192
193
  return c({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M9 6l11 0" } }, { tag: "path", attr: { d: "M9 12l11 0" } }, { tag: "path", attr: { d: "M9 18l11 0" } }, { tag: "path", attr: { d: "M5 6l0 .01" } }, { tag: "path", attr: { d: "M5 12l0 .01" } }, { tag: "path", attr: { d: "M5 18l0 .01" } }] })(t);
193
194
  }
194
- function $e(t) {
195
+ function We(t) {
195
196
  return c({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M10 11h-4a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v6c0 2.667 -1.333 4.333 -4 5" } }, { tag: "path", attr: { d: "M19 11h-4a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v6c0 2.667 -1.333 4.333 -4 5" } }] })(t);
196
197
  }
197
- function _e(t) {
198
+ function je(t) {
198
199
  return c({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M5 7l8 10m-8 0l8 -10" } }, { tag: "path", attr: { d: "M21 11h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2" } }] })(t);
199
200
  }
200
- function Re(t) {
201
+ function Ke(t) {
201
202
  return c({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" } }, { tag: "path", attr: { d: "M7 5v5a5 5 0 0 0 10 0v-5" } }, { tag: "path", attr: { d: "M5 19h14" } }] })(t);
202
203
  }
203
- const Be = et("div", {
204
+ const Ue = at("div", {
204
205
  width: "10rem",
205
206
  display: "flex"
206
- }), it = {
207
+ }), gt = {
207
208
  bullet: "Punktliste",
208
209
  h1: "Overskrift 1",
209
210
  h2: "Overskrift 2",
@@ -215,24 +216,24 @@ const Be = et("div", {
215
216
  paragraph: "Normal",
216
217
  quote: "Sitat",
217
218
  check: "Avkrysningsliste"
218
- }, He = {
219
- bullet: /* @__PURE__ */ o(Oe, { size: "1.25rem" }),
220
- h1: /* @__PURE__ */ o(Te, { size: "1.25rem" }),
221
- h2: /* @__PURE__ */ o(Le, { size: "1.25rem" }),
222
- h3: /* @__PURE__ */ o(ye, { size: "1.25rem" }),
223
- h4: /* @__PURE__ */ o(xe, { size: "1.25rem" }),
224
- h5: /* @__PURE__ */ o(Ne, { size: "1.25rem" }),
225
- h6: /* @__PURE__ */ o(Se, { size: "1.25rem" }),
226
- number: /* @__PURE__ */ o(Ie, { size: "1.25rem" }),
227
- check: /* @__PURE__ */ o(ze, { size: "1.25rem" }),
228
- paragraph: /* @__PURE__ */ o(we, { size: "1.25rem" }),
229
- quote: /* @__PURE__ */ o($e, { size: "1.25rem" })
219
+ }, Ye = {
220
+ bullet: /* @__PURE__ */ r(Ae, { size: "1.25rem" }),
221
+ h1: /* @__PURE__ */ r(Ie, { size: "1.25rem" }),
222
+ h2: /* @__PURE__ */ r($e, { size: "1.25rem" }),
223
+ h3: /* @__PURE__ */ r(_e, { size: "1.25rem" }),
224
+ h4: /* @__PURE__ */ r(Re, { size: "1.25rem" }),
225
+ h5: /* @__PURE__ */ r(Oe, { size: "1.25rem" }),
226
+ h6: /* @__PURE__ */ r(Be, { size: "1.25rem" }),
227
+ number: /* @__PURE__ */ r(De, { size: "1.25rem" }),
228
+ check: /* @__PURE__ */ r(He, { size: "1.25rem" }),
229
+ paragraph: /* @__PURE__ */ r(Pe, { size: "1.25rem" }),
230
+ quote: /* @__PURE__ */ r(We, { size: "1.25rem" })
230
231
  }, f = ({
231
232
  blockType: t
232
- }) => /* @__PURE__ */ b(O, { children: [
233
- /* @__PURE__ */ o($, { css: { display: "flex", flex: "0 0 auto" }, children: He[t] }),
234
- /* @__PURE__ */ o(
235
- $,
233
+ }) => /* @__PURE__ */ C(U, { children: [
234
+ /* @__PURE__ */ r(R, { css: { display: "flex", flex: "0 0 auto" }, children: Ye[t] }),
235
+ /* @__PURE__ */ r(
236
+ R,
236
237
  {
237
238
  css: {
238
239
  flex: "1 1 auto",
@@ -240,223 +241,223 @@ const Be = et("div", {
240
241
  textOverflow: "ellipsis",
241
242
  whiteSpace: "nowrap"
242
243
  },
243
- children: it[t]
244
+ children: gt[t]
244
245
  }
245
246
  )
246
- ] }), De = (t) => {
247
- if (!y(t))
247
+ ] }), qe = (t) => {
248
+ if (!x(t))
248
249
  return null;
249
250
  const e = t.anchor.getNode();
250
- let r = e.getKey() === "root" ? e : rt(e, (n) => {
251
+ let o = e.getKey() === "root" ? e : dt(e, (n) => {
251
252
  const a = n.getParent();
252
- return a !== null && ut(a);
253
+ return a !== null && Ct(a);
253
254
  });
254
- return r === null && (r = e.getTopLevelElementOrThrow()), {
255
+ return o === null && (o = e.getTopLevelElementOrThrow()), {
255
256
  anchorNode: e,
256
- element: r
257
+ element: o
257
258
  };
258
- }, Fe = () => {
259
- const [t] = H(), [e, r] = v("paragraph");
260
- B(() => t.registerCommand(
261
- Q,
259
+ }, Xe = () => {
260
+ const [t] = F(), [e, o] = M("paragraph");
261
+ N(() => t.registerCommand(
262
+ W,
262
263
  () => {
263
- const s = L(), g = De(s);
264
+ const s = L(), g = qe(s);
264
265
  if (!g)
265
266
  return !1;
266
- const { element: u, anchorNode: C } = g, S = u.getKey();
267
- if (t.getElementByKey(S) !== null)
268
- if (j(u)) {
269
- const k = re(
270
- C,
271
- X
272
- ), w = k ? k.getListType() : u.getListType();
273
- r(w);
267
+ const { element: p, anchorNode: v } = g, w = p.getKey();
268
+ if (t.getElementByKey(w) !== null)
269
+ if (K(p)) {
270
+ const k = he(
271
+ v,
272
+ et
273
+ ), I = k ? k.getListType() : p.getListType();
274
+ o(I);
274
275
  } else {
275
- const k = Et(u) ? u.getTag() : u.getType();
276
- k in it && r(k);
276
+ const k = Bt(p) ? p.getTag() : p.getType();
277
+ k in gt && o(k);
277
278
  }
278
279
  return !1;
279
280
  },
280
- V
281
+ tt
281
282
  ), [t]);
282
283
  const n = (s) => {
283
284
  e !== s && t.update(() => {
284
285
  const g = L();
285
- (y(g) || D(g)) && (F(g, () => wt(s)), r(s));
286
+ (x(g) || P(g)) && (H(g, () => Ft(s)), o(s));
286
287
  });
287
288
  };
288
- return /* @__PURE__ */ o(Be, { children: /* @__PURE__ */ b(
289
- Ht,
289
+ return /* @__PURE__ */ r(Ue, { children: /* @__PURE__ */ C(
290
+ it,
290
291
  {
291
- trigger: /* @__PURE__ */ o(
292
- Dt,
292
+ trigger: /* @__PURE__ */ r(
293
+ Xt,
293
294
  {
294
295
  dropdown: !0,
295
296
  css: { display: "flex", width: "100%", overflow: "hidden" },
296
- children: /* @__PURE__ */ o(f, { blockType: e })
297
+ children: /* @__PURE__ */ r(f, { blockType: e })
297
298
  }
298
299
  ),
299
300
  side: "bottom",
300
301
  align: "start",
301
302
  children: [
302
- /* @__PURE__ */ o(m, { onClick: () => {
303
+ /* @__PURE__ */ r(m, { onClick: () => {
303
304
  e !== "paragraph" && t.update(() => {
304
305
  const s = L();
305
- (y(s) || D(s)) && (F(s, () => R()), r("paragraph"));
306
+ (x(s) || P(s)) && (H(s, () => B()), o("paragraph"));
306
307
  });
307
- }, children: /* @__PURE__ */ o(f, { blockType: "paragraph" }) }),
308
- /* @__PURE__ */ o(m, { onClick: () => n("h1"), children: /* @__PURE__ */ o(f, { blockType: "h1" }) }),
309
- /* @__PURE__ */ o(m, { onClick: () => n("h2"), children: /* @__PURE__ */ o(f, { blockType: "h2" }) }),
310
- /* @__PURE__ */ o(m, { onClick: () => n("h3"), children: /* @__PURE__ */ o(f, { blockType: "h3" }) }),
311
- /* @__PURE__ */ o(m, { onClick: () => n("h4"), children: /* @__PURE__ */ o(f, { blockType: "h4" }) }),
312
- /* @__PURE__ */ o(m, { onClick: () => n("h5"), children: /* @__PURE__ */ o(f, { blockType: "h5" }) }),
313
- /* @__PURE__ */ o(m, { onClick: () => n("h6"), children: /* @__PURE__ */ o(f, { blockType: "h6" }) }),
314
- /* @__PURE__ */ o(m, { onClick: () => {
315
- e !== "bullet" && (t.dispatchCommand(Lt, void 0), r("bullet"));
316
- }, children: /* @__PURE__ */ o(f, { blockType: "bullet" }) }),
317
- /* @__PURE__ */ o(m, { onClick: () => {
318
- e !== "number" && (t.dispatchCommand(yt, void 0), r("number"));
319
- }, children: /* @__PURE__ */ o(f, { blockType: "number" }) }),
320
- /* @__PURE__ */ o(m, { onClick: () => {
321
- e !== "check" && (t.dispatchCommand(J, void 0), r("check"));
322
- }, children: /* @__PURE__ */ o(f, { blockType: "check" }) }),
323
- /* @__PURE__ */ o(m, { onClick: () => {
308
+ }, children: /* @__PURE__ */ r(f, { blockType: "paragraph" }) }),
309
+ /* @__PURE__ */ r(m, { onClick: () => n("h1"), children: /* @__PURE__ */ r(f, { blockType: "h1" }) }),
310
+ /* @__PURE__ */ r(m, { onClick: () => n("h2"), children: /* @__PURE__ */ r(f, { blockType: "h2" }) }),
311
+ /* @__PURE__ */ r(m, { onClick: () => n("h3"), children: /* @__PURE__ */ r(f, { blockType: "h3" }) }),
312
+ /* @__PURE__ */ r(m, { onClick: () => n("h4"), children: /* @__PURE__ */ r(f, { blockType: "h4" }) }),
313
+ /* @__PURE__ */ r(m, { onClick: () => n("h5"), children: /* @__PURE__ */ r(f, { blockType: "h5" }) }),
314
+ /* @__PURE__ */ r(m, { onClick: () => n("h6"), children: /* @__PURE__ */ r(f, { blockType: "h6" }) }),
315
+ /* @__PURE__ */ r(m, { onClick: () => {
316
+ e !== "bullet" && (t.dispatchCommand(It, void 0), o("bullet"));
317
+ }, children: /* @__PURE__ */ r(f, { blockType: "bullet" }) }),
318
+ /* @__PURE__ */ r(m, { onClick: () => {
319
+ e !== "number" && (t.dispatchCommand($t, void 0), o("number"));
320
+ }, children: /* @__PURE__ */ r(f, { blockType: "number" }) }),
321
+ /* @__PURE__ */ r(m, { onClick: () => {
322
+ e !== "check" && (t.dispatchCommand(rt, void 0), o("check"));
323
+ }, children: /* @__PURE__ */ r(f, { blockType: "check" }) }),
324
+ /* @__PURE__ */ r(m, { onClick: () => {
324
325
  e !== "quote" && t.update(() => {
325
326
  const s = L();
326
- (y(s) || D(s)) && (F(s, () => zt()), r("quote"));
327
+ (x(s) || P(s)) && (H(s, () => Pt()), o("quote"));
327
328
  });
328
- }, children: /* @__PURE__ */ o(f, { blockType: "quote" }) })
329
+ }, children: /* @__PURE__ */ r(f, { blockType: "quote" }) })
329
330
  ]
330
331
  }
331
332
  ) });
332
- }, Pe = () => {
333
- const [t] = H(), [e, r] = v(!1), [n, a] = v(!1), [l, i] = v(!1), [d, p] = v(!1), [s, g] = v(!1), u = M(() => {
334
- const h = L();
335
- y(h) && (r(h.hasFormat("bold")), a(h.hasFormat("italic")), i(h.hasFormat("underline")), p(h.hasFormat("code")), g(h.hasFormat("superscript")));
333
+ }, Ge = () => {
334
+ const [t] = F(), [e, o] = M(!1), [n, a] = M(!1), [l, i] = M(!1), [d, h] = M(!1), [s, g] = M(!1), p = b(() => {
335
+ const u = L();
336
+ x(u) && (o(u.hasFormat("bold")), a(u.hasFormat("italic")), i(u.hasFormat("underline")), h(u.hasFormat("code")), g(u.hasFormat("superscript")));
336
337
  }, []);
337
- B(() => ot(
338
+ N(() => ct(
338
339
  t.registerCommand(
339
- Q,
340
- () => (u(), !1),
341
- V
340
+ W,
341
+ () => (p(), !1),
342
+ tt
342
343
  ),
343
- t.registerUpdateListener(({ editorState: h }) => {
344
- h.read(() => {
345
- u();
344
+ t.registerUpdateListener(({ editorState: u }) => {
345
+ u.read(() => {
346
+ p();
346
347
  });
347
348
  })
348
- ), [t, u]);
349
- const C = M(
350
- () => t.dispatchCommand(z, "bold"),
349
+ ), [t, p]);
350
+ const v = b(
351
+ () => t.dispatchCommand($, "bold"),
351
352
  [t]
352
- ), S = M(
353
- () => t.dispatchCommand(z, "italic"),
353
+ ), w = b(
354
+ () => t.dispatchCommand($, "italic"),
354
355
  [t]
355
- ), E = M(
356
- () => t.dispatchCommand(z, "underline"),
356
+ ), z = b(
357
+ () => t.dispatchCommand($, "underline"),
357
358
  [t]
358
- ), k = M(
359
- () => t.dispatchCommand(z, "code"),
359
+ ), k = b(
360
+ () => t.dispatchCommand($, "code"),
360
361
  [t]
361
- ), w = M(
362
- () => t.dispatchCommand(z, "superscript"),
362
+ ), I = b(
363
+ () => t.dispatchCommand($, "superscript"),
363
364
  [t]
364
- ), st = tt(() => {
365
- const h = [];
366
- return e && h.push("bold"), n && h.push("italic"), l && h.push("underline"), d && h.push("code"), s && h.push("superscript"), h;
365
+ ), mt = nt(() => {
366
+ const u = [];
367
+ return e && u.push("bold"), n && u.push("italic"), l && u.push("underline"), d && u.push("code"), s && u.push("superscript"), u;
367
368
  }, [e, n, l, d, s]);
368
- return /* @__PURE__ */ b(
369
- Ft,
369
+ return /* @__PURE__ */ C(
370
+ Gt,
370
371
  {
371
372
  type: "multiple",
372
373
  "aria-label": "Tekstformattering",
373
- value: st,
374
+ value: mt,
374
375
  children: [
375
- /* @__PURE__ */ o(
376
- I,
376
+ /* @__PURE__ */ r(
377
+ _,
377
378
  {
378
- onClick: C,
379
+ onClick: v,
379
380
  title: "Fet tekst",
380
381
  value: "bold",
381
- children: /* @__PURE__ */ o(Ce, { size: "1.25rem" })
382
+ children: /* @__PURE__ */ r(we, { size: "1.25rem" })
382
383
  }
383
384
  ),
384
- /* @__PURE__ */ o(
385
- I,
385
+ /* @__PURE__ */ r(
386
+ _,
386
387
  {
387
- onClick: S,
388
+ onClick: w,
388
389
  title: "Kursiv tekst",
389
390
  value: "italic",
390
- children: /* @__PURE__ */ o(Ee, { size: "1.25rem" })
391
+ children: /* @__PURE__ */ r(Fe, { size: "1.25rem" })
391
392
  }
392
393
  ),
393
- /* @__PURE__ */ o(
394
- I,
394
+ /* @__PURE__ */ r(
395
+ _,
395
396
  {
396
- onClick: E,
397
+ onClick: z,
397
398
  title: "Understreket tekst",
398
399
  value: "underline",
399
- children: /* @__PURE__ */ o(Re, { size: "1.25rem" })
400
+ children: /* @__PURE__ */ r(Ke, { size: "1.25rem" })
400
401
  }
401
402
  ),
402
- /* @__PURE__ */ o(
403
- I,
403
+ /* @__PURE__ */ r(
404
+ _,
404
405
  {
405
406
  onClick: k,
406
407
  title: "Kode",
407
408
  value: "code",
408
- children: /* @__PURE__ */ o(be, { size: "1.25rem" })
409
+ children: /* @__PURE__ */ r(ze, { size: "1.25rem" })
409
410
  }
410
411
  ),
411
- /* @__PURE__ */ o(
412
- I,
412
+ /* @__PURE__ */ r(
413
+ _,
413
414
  {
414
- onClick: w,
415
+ onClick: I,
415
416
  title: "Superscript",
416
417
  value: "superscript",
417
- children: /* @__PURE__ */ o(_e, { size: "1.25rem" })
418
+ children: /* @__PURE__ */ r(je, { size: "1.25rem" })
418
419
  }
419
420
  )
420
421
  ]
421
422
  }
422
423
  );
423
- }, We = ({ children: t }) => {
424
- const { hasFocus: e, editorRef: r } = ve(), n = e, [a, l] = v(n);
425
- Bt(() => {
424
+ }, Qe = ({ children: t }) => {
425
+ const { hasFocus: e, editorRef: o } = pt(), n = e, [a, l] = M(n);
426
+ qt(() => {
426
427
  l(n);
427
428
  }, [n]);
428
- const { context: i, refs: d, floatingStyles: p } = Pt({
429
+ const { context: i, refs: d, floatingStyles: h } = lt({
429
430
  placement: "top",
430
- whileElementsMounted: Wt,
431
+ whileElementsMounted: Qt,
431
432
  middleware: [
432
- At({
433
- apply: ({ rects: g, elements: u }) => {
434
- u.floating.style.minWidth = `${g.reference.width}px`;
433
+ Vt({
434
+ apply: ({ rects: g, elements: p }) => {
435
+ p.floating.style.minWidth = `${g.reference.width}px`;
435
436
  }
436
437
  }),
437
- jt(),
438
- Kt({
438
+ Jt(),
439
+ st({
439
440
  mainAxis: 8
440
441
  }),
441
- Ut({
442
+ Zt({
442
443
  padding: 8
443
444
  })
444
445
  ],
445
446
  open: a,
446
447
  onOpenChange: l,
447
448
  elements: {
448
- reference: r.current
449
+ reference: o.current
449
450
  }
450
- }), { getFloatingProps: s } = Yt([
451
- qt(i, {
451
+ }), { getFloatingProps: s } = te([
452
+ ee(i, {
452
453
  role: "dialog"
453
454
  })
454
455
  ]);
455
- return a ? /* @__PURE__ */ o(Gt, { children: /* @__PURE__ */ o(
456
- Qt,
456
+ return a ? /* @__PURE__ */ r(re, { children: /* @__PURE__ */ r(
457
+ oe,
457
458
  {
458
459
  ref: d.setFloating,
459
- style: p,
460
+ style: h,
460
461
  ...s,
461
462
  css: {
462
463
  border: "1px solid $border",
@@ -464,40 +465,40 @@ const Be = et("div", {
464
465
  overflow: "hidden",
465
466
  boxShadow: "$md"
466
467
  },
467
- children: /* @__PURE__ */ o(Ae, { children: t })
468
+ children: /* @__PURE__ */ r(Ve, { children: t })
468
469
  }
469
470
  ) }) : null;
470
- }, Ae = ({
471
+ }, Ve = ({
471
472
  children: t,
472
473
  ...e
473
- }) => /* @__PURE__ */ b(Vt, { "aria-label": "Formattering", ...e, children: [
474
- /* @__PURE__ */ o(Fe, {}),
475
- /* @__PURE__ */ o(Xt, {}),
476
- /* @__PURE__ */ o(Pe, {}),
474
+ }) => /* @__PURE__ */ C(ne, { "aria-label": "Formattering", ...e, children: [
475
+ /* @__PURE__ */ r(Xe, {}),
476
+ /* @__PURE__ */ r(ae, {}),
477
+ /* @__PURE__ */ r(Ge, {}),
477
478
  t
478
479
  ] });
479
- function je() {
480
- const [t] = H();
481
- return B(() => ot(
480
+ function Je() {
481
+ const [t] = F();
482
+ return N(() => ct(
482
483
  t.registerCommand(
483
- J,
484
- () => (xt(t, "check"), !0),
484
+ rt,
485
+ () => (_t(t, "check"), !0),
485
486
  T
486
487
  ),
487
488
  t.registerCommand(
488
- pt,
489
- (e) => q(e, t, !1),
489
+ vt,
490
+ (e) => J(e, t, !1),
490
491
  T
491
492
  ),
492
493
  t.registerCommand(
493
- gt,
494
- (e) => q(e, t, !0),
494
+ Tt,
495
+ (e) => J(e, t, !0),
495
496
  T
496
497
  ),
497
498
  t.registerCommand(
498
- ft,
499
+ Lt,
499
500
  (e) => {
500
- if (P() != null) {
501
+ if (D() != null) {
501
502
  const n = t.getRootElement();
502
503
  return n != null && n.focus(), !0;
503
504
  }
@@ -506,33 +507,33 @@ function je() {
506
507
  T
507
508
  ),
508
509
  t.registerCommand(
509
- mt,
510
+ xt,
510
511
  (e) => {
511
- const r = P();
512
- return r != null && t.isEditable() ? (t.update(() => {
513
- const n = A(r);
514
- x(n) && (e.preventDefault(), n.toggleChecked());
512
+ const o = D();
513
+ return o != null && t.isEditable() ? (t.update(() => {
514
+ const n = j(o);
515
+ E(n) && (e.preventDefault(), n.toggleChecked());
515
516
  }), !0) : !1;
516
517
  },
517
518
  T
518
519
  ),
519
520
  t.registerCommand(
520
- kt,
521
+ yt,
521
522
  (e) => t.getEditorState().read(() => {
522
- const r = L();
523
- if (y(r) && r.isCollapsed()) {
524
- const { anchor: n } = r, a = n.type === "element";
523
+ const o = L();
524
+ if (x(o) && o.isCollapsed()) {
525
+ const { anchor: n } = o, a = n.type === "element";
525
526
  if (a || n.offset === 0) {
526
- const l = n.getNode(), i = rt(
527
+ const l = n.getNode(), i = dt(
527
528
  l,
528
- (d) => Mt(d) && !d.isInline()
529
+ (d) => Et(d) && !d.isInline()
529
530
  );
530
- if (x(i)) {
531
+ if (E(i)) {
531
532
  const d = i.getParent();
532
- if (j(d) && d.getListType() === "check" && (a || i.getFirstDescendant() === l)) {
533
- const p = t.getElementByKey(i.__key);
534
- if (p != null && document.activeElement !== p)
535
- return p.focus(), e.preventDefault(), !0;
533
+ if (K(d) && d.getListType() === "check" && (a || i.getFirstDescendant() === l)) {
534
+ const h = t.getElementByKey(i.__key);
535
+ if (h != null && document.activeElement !== h)
536
+ return h.focus(), e.preventDefault(), !0;
536
537
  }
537
538
  }
538
539
  }
@@ -541,41 +542,41 @@ function je() {
541
542
  }),
542
543
  T
543
544
  ),
544
- t.registerRootListener((e, r) => {
545
- e !== null && (e.addEventListener("click", U), e.addEventListener("pointerdown", Y)), r !== null && (r.removeEventListener("click", U), r.removeEventListener("pointerdown", Y));
545
+ t.registerRootListener((e, o) => {
546
+ e !== null && (e.addEventListener("click", Q), e.addEventListener("pointerdown", V)), o !== null && (o.removeEventListener("click", Q), o.removeEventListener("pointerdown", V));
546
547
  })
547
548
  ), [t]), null;
548
549
  }
549
- function lt(t, e) {
550
- const r = t.target;
551
- if (r === null || !K(r))
550
+ function ft(t, e) {
551
+ const o = t.target;
552
+ if (o === null || !G(o))
552
553
  return;
553
- const n = r.firstChild;
554
- if (n != null && K(n) && (n.tagName === "UL" || n.tagName === "OL"))
554
+ const n = o.firstChild;
555
+ if (n != null && G(n) && (n.tagName === "UL" || n.tagName === "OL"))
555
556
  return;
556
- const a = r.parentNode;
557
+ const a = o.parentNode;
557
558
  if (!a || a.__lexicalListType !== "check")
558
559
  return;
559
- const l = t.pageX, i = r.getBoundingClientRect();
560
- (r.dir === "rtl" ? l < i.right && l > i.right - 20 : l > i.left && l < i.left + 20) && e();
560
+ const l = t.pageX, i = o.getBoundingClientRect();
561
+ (o.dir === "rtl" ? l < i.right && l > i.right - 20 : l > i.left && l < i.left + 20) && e();
561
562
  }
562
- function U(t) {
563
- lt(t, () => {
564
- const e = t.target, r = Ke(e);
565
- r != null && r.isEditable() && r.update(() => {
563
+ function Q(t) {
564
+ ft(t, () => {
565
+ const e = t.target, o = Ze(e);
566
+ o != null && o.isEditable() && o.update(() => {
566
567
  if (t.target) {
567
- const n = A(e);
568
- x(n) && (e.focus(), n.toggleChecked());
568
+ const n = j(e);
569
+ E(n) && (e.focus(), n.toggleChecked());
569
570
  }
570
571
  });
571
572
  });
572
573
  }
573
- function Y(t) {
574
- lt(t, () => {
574
+ function V(t) {
575
+ ft(t, () => {
575
576
  t.preventDefault();
576
577
  });
577
578
  }
578
- function Ke(t) {
579
+ function Ze(t) {
579
580
  let e = t;
580
581
  for (; e; ) {
581
582
  if (e.__lexicalEditor)
@@ -584,30 +585,30 @@ function Ke(t) {
584
585
  }
585
586
  return null;
586
587
  }
587
- function P() {
588
+ function D() {
588
589
  const t = document.activeElement;
589
590
  return t != null && t.tagName === "LI" && t.parentNode != null && // @ts-ignore internal field
590
591
  t.parentNode.__lexicalListType === "check" ? t : null;
591
592
  }
592
- function Ue(t, e) {
593
- let r = e ? t.getPreviousSibling() : t.getNextSibling(), n = t;
594
- for (; r == null && x(n); )
595
- n = n.getParentOrThrow().getParent(), n != null && (r = e ? n.getPreviousSibling() : n.getNextSibling());
596
- for (; x(r); ) {
597
- const a = e ? r.getLastChild() : r.getFirstChild();
598
- if (!j(a))
599
- return r;
600
- r = e ? a.getLastChild() : a.getFirstChild();
593
+ function tr(t, e) {
594
+ let o = e ? t.getPreviousSibling() : t.getNextSibling(), n = t;
595
+ for (; o == null && E(n); )
596
+ n = n.getParentOrThrow().getParent(), n != null && (o = e ? n.getPreviousSibling() : n.getNextSibling());
597
+ for (; E(o); ) {
598
+ const a = e ? o.getLastChild() : o.getFirstChild();
599
+ if (!K(a))
600
+ return o;
601
+ o = e ? a.getLastChild() : a.getFirstChild();
601
602
  }
602
603
  return null;
603
604
  }
604
- function q(t, e, r) {
605
- const n = P();
605
+ function J(t, e, o) {
606
+ const n = D();
606
607
  return n != null && e.update(() => {
607
- const a = A(n);
608
- if (!x(a))
608
+ const a = j(n);
609
+ if (!E(a))
609
610
  return;
610
- const l = Ue(a, r);
611
+ const l = tr(a, o);
611
612
  if (l != null) {
612
613
  l.selectStart();
613
614
  const i = e.getElementByKey(l.__key);
@@ -617,34 +618,34 @@ function q(t, e, r) {
617
618
  }
618
619
  }), !1;
619
620
  }
620
- const Ye = () => /* @__PURE__ */ b(O, { children: [
621
- /* @__PURE__ */ o(oe, {}),
622
- /* @__PURE__ */ o(ae, {}),
623
- /* @__PURE__ */ o(ne, {}),
624
- /* @__PURE__ */ o(je, {}),
625
- /* @__PURE__ */ o(ie, {})
626
- ] }), qe = ({
621
+ const er = () => /* @__PURE__ */ C(U, { children: [
622
+ /* @__PURE__ */ r(ue, {}),
623
+ /* @__PURE__ */ r(ge, {}),
624
+ /* @__PURE__ */ r(pe, {}),
625
+ /* @__PURE__ */ r(Je, {}),
626
+ /* @__PURE__ */ r(fe, {})
627
+ ] }), rr = ({
627
628
  state: t
628
629
  }) => {
629
- const [e] = H();
630
- return B(() => {
630
+ const [e] = F();
631
+ return N(() => {
631
632
  if (t)
632
633
  try {
633
- if (de(t)) {
634
- t.isEmpty() ? ce(e) : e.setEditorState(t);
634
+ if (be(t)) {
635
+ t.isEmpty() ? Ce(e) : e.setEditorState(t);
635
636
  return;
636
637
  }
637
- if (typeof t == "string" && !nt(t)) {
638
- he(t, e);
638
+ if (typeof t == "string" && !ht(t)) {
639
+ ve(t, e);
639
640
  return;
640
641
  }
641
- const r = e.parseEditorState(t);
642
- r.isEmpty() || e.setEditorState(r);
643
- } catch (r) {
644
- console.error("Could not parse"), console.error(r);
642
+ const o = e.parseEditorState(t);
643
+ o.isEmpty() || e.setEditorState(o);
644
+ } catch (o) {
645
+ console.error("Could not parse"), console.error(o);
645
646
  }
646
647
  }, []), null;
647
- }, Ge = et("div", {
648
+ }, or = at("div", {
648
649
  border: "1px solid $borderDarker",
649
650
  borderRadius: "$md",
650
651
  position: "relative",
@@ -681,10 +682,10 @@ const Ye = () => /* @__PURE__ */ b(O, { children: [
681
682
  }
682
683
  }
683
684
  ]
684
- }), Qe = ({
685
+ }), nr = ({
685
686
  isLoading: t
686
- }) => /* @__PURE__ */ o(
687
- $,
687
+ }) => /* @__PURE__ */ r(
688
+ R,
688
689
  {
689
690
  css: {
690
691
  visibility: t ? "visible" : "hidden",
@@ -693,52 +694,52 @@ const Ye = () => /* @__PURE__ */ b(O, { children: [
693
694
  right: "1rem",
694
695
  display: "flex"
695
696
  },
696
- children: /* @__PURE__ */ o(Jt, {})
697
+ children: /* @__PURE__ */ r(ie, {})
697
698
  }
698
- ), Lr = ({
699
+ ), Rr = ({
699
700
  isLoading: t,
700
701
  children: e,
701
- placeholderText: r,
702
+ placeholderText: o,
702
703
  nodes: n,
703
704
  plugins: a,
704
705
  toolbar: l,
705
706
  toolbarContent: i,
706
707
  content: d,
707
- hideBorder: p,
708
+ hideBorder: h,
708
709
  onBlur: s,
709
710
  defaultState: g,
710
- css: u
711
+ css: p
711
712
  }) => {
712
- const { hasFocus: C, attributes: S } = Me({ onBlur: s }), E = Z(null), k = tt(() => ({ hasFocus: C, editorRef: E }), [C]);
713
- return /* @__PURE__ */ o(at.Provider, { value: k, children: /* @__PURE__ */ b(
714
- Zt,
713
+ const { hasFocus: v, attributes: w } = Se({ onBlur: s }), z = ot(null), k = nt(() => ({ hasFocus: v, editorRef: z }), [v]);
714
+ return /* @__PURE__ */ r(ut.Provider, { value: k, children: /* @__PURE__ */ C(
715
+ se,
715
716
  {
716
717
  initialConfig: {
717
718
  namespace: "CommentEditor",
718
- onError: (w) => {
719
- console.error(w);
719
+ onError: (I) => {
720
+ console.error(I);
720
721
  },
721
- theme: ke,
722
+ theme: Ne,
722
723
  nodes: n,
723
724
  editable: !0
724
725
  },
725
726
  children: [
726
- /* @__PURE__ */ o(O, { children: l }),
727
- /* @__PURE__ */ b(
728
- Ge,
727
+ /* @__PURE__ */ C(
728
+ or,
729
729
  {
730
- ref: E,
731
- hasFocus: C,
732
- hideBorder: p,
733
- css: u,
734
- ...S,
730
+ ref: z,
731
+ hasFocus: v,
732
+ hideBorder: h,
733
+ css: p,
734
+ ...w,
735
735
  children: [
736
- /* @__PURE__ */ o(
737
- te,
736
+ l,
737
+ /* @__PURE__ */ r(
738
+ de,
738
739
  {
739
740
  contentEditable: d,
740
- placeholder: r ? /* @__PURE__ */ o(
741
- $,
741
+ placeholder: o ? /* @__PURE__ */ r(
742
+ R,
742
743
  {
743
744
  css: {
744
745
  position: "absolute",
@@ -748,25 +749,25 @@ const Ye = () => /* @__PURE__ */ b(O, { children: [
748
749
  pointerEvents: "none",
749
750
  fontSize: "$sm"
750
751
  },
751
- children: r
752
+ children: o
752
753
  }
753
754
  ) : null,
754
- ErrorBoundary: ee
755
+ ErrorBoundary: ce
755
756
  }
756
757
  ),
757
- /* @__PURE__ */ o(Ye, {}),
758
+ /* @__PURE__ */ r(er, {}),
758
759
  a,
759
- /* @__PURE__ */ o(Qe, { isLoading: t }),
760
- !l && /* @__PURE__ */ o(We, { children: i })
760
+ /* @__PURE__ */ r(nr, { isLoading: t }),
761
+ !l && /* @__PURE__ */ r(Qe, { children: i })
761
762
  ]
762
763
  }
763
764
  ),
764
- /* @__PURE__ */ o(qe, { state: g }),
765
- /* @__PURE__ */ o(O, { children: e })
765
+ /* @__PURE__ */ r(rr, { state: g }),
766
+ /* @__PURE__ */ r(U, { children: e })
766
767
  ]
767
768
  }
768
769
  ) });
769
- }, yr = N({
770
+ }, Or = S({
770
771
  fontSize: "1rem",
771
772
  lineHeight: "1.5",
772
773
  "h1, h2, h3, h4, h5, h6": {
@@ -869,6 +870,19 @@ const Ye = () => /* @__PURE__ */ b(O, { children: [
869
870
  }
870
871
  }
871
872
  },
873
+ table: {
874
+ width: "100%",
875
+ borderCollapse: "collapse",
876
+ border: 0,
877
+ tr: {
878
+ border: 0
879
+ },
880
+ td: {
881
+ border: "1px solid $gray800",
882
+ verticalAlign: "top",
883
+ padding: "$2"
884
+ }
885
+ },
872
886
  variants: {
873
887
  size: {
874
888
  xs: {
@@ -907,18 +921,99 @@ const Ye = () => /* @__PURE__ */ b(O, { children: [
907
921
  size: "md"
908
922
  }
909
923
  });
924
+ function ar(t) {
925
+ return c({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "circle", attr: { cx: "256", cy: "256", r: "48" } }, { tag: "circle", attr: { cx: "416", cy: "256", r: "48" } }, { tag: "circle", attr: { cx: "96", cy: "256", r: "48" } }] })(t);
926
+ }
927
+ const Br = () => {
928
+ const [t] = me(), [e, o] = M(null), { hasFocus: n } = pt();
929
+ N(() => {
930
+ !n && e && o(null);
931
+ }, [n, e]);
932
+ const { refs: a, floatingStyles: l } = lt({
933
+ placement: "top-end",
934
+ open: !!e,
935
+ elements: {
936
+ reference: e
937
+ },
938
+ middleware: [st({ mainAxis: -20, crossAxis: -2 })]
939
+ });
940
+ N(() => t.registerCommand(
941
+ W,
942
+ () => {
943
+ const d = L();
944
+ if (x(d)) {
945
+ const h = d.anchor.getNode(), s = Wt(h);
946
+ o(s ? t.getElementByKey(s.getKey()) : null);
947
+ }
948
+ return !1;
949
+ },
950
+ T
951
+ ), [t]);
952
+ const i = (d) => () => {
953
+ t.update(() => {
954
+ switch (d) {
955
+ case "add-row-over":
956
+ q(!1);
957
+ break;
958
+ case "add-row-under":
959
+ q(!0);
960
+ break;
961
+ case "add-column-left":
962
+ Y(!1);
963
+ break;
964
+ case "add-column-right":
965
+ Y(!0);
966
+ break;
967
+ case "delete-row":
968
+ Kt();
969
+ break;
970
+ case "delete-column":
971
+ jt();
972
+ break;
973
+ }
974
+ });
975
+ };
976
+ return e ? /* @__PURE__ */ C(
977
+ it,
978
+ {
979
+ trigger: /* @__PURE__ */ r(
980
+ le,
981
+ {
982
+ icon: !0,
983
+ variant: "primary",
984
+ color: "secondary",
985
+ ref: a.setFloating,
986
+ style: l,
987
+ css: { padding: "2px", width: "18px", height: "18px" },
988
+ children: /* @__PURE__ */ r(ar, {})
989
+ }
990
+ ),
991
+ children: [
992
+ /* @__PURE__ */ r(y, { onClick: i("add-row-over"), children: "Legg til rad over" }),
993
+ /* @__PURE__ */ r(y, { onClick: i("add-row-under"), children: "Legg til rad under" }),
994
+ /* @__PURE__ */ r(X, {}),
995
+ /* @__PURE__ */ r(y, { onClick: i("add-column-left"), children: "Legg til kolumne venstre" }),
996
+ /* @__PURE__ */ r(y, { onClick: i("add-column-right"), children: "Legg til kolumne høyre" }),
997
+ /* @__PURE__ */ r(X, {}),
998
+ /* @__PURE__ */ r(y, { onClick: i("delete-row"), children: "Fjern rad" }),
999
+ /* @__PURE__ */ r(y, { onClick: i("delete-column"), children: "Fjern kolumne" })
1000
+ ]
1001
+ }
1002
+ ) : null;
1003
+ };
910
1004
  export {
911
- We as FloatingToolbar,
912
- Lr as RichTextEditor,
913
- Ae as RichTextToolbar,
914
- ce as clearEditorState,
915
- Tr as defaultNodes,
916
- de as isEditorState,
917
- nt as isJSON,
918
- at as richTextContext,
919
- yr as richTextCss,
920
- he as setStateFromPlainText,
921
- br as stateToHTML,
922
- Me as useHasFocusWithin,
923
- ve as useRichTextContext
1005
+ Qe as FloatingToolbar,
1006
+ Rr as RichTextEditor,
1007
+ Ve as RichTextToolbar,
1008
+ Br as TableEditPlugin,
1009
+ Ce as clearEditorState,
1010
+ _r as defaultNodes,
1011
+ be as isEditorState,
1012
+ ht as isJSON,
1013
+ ut as richTextContext,
1014
+ Or as richTextCss,
1015
+ ve as setStateFromPlainText,
1016
+ $r as stateToHTML,
1017
+ Se as useHasFocusWithin,
1018
+ pt as useRichTextContext
924
1019
  };