@arkitektbedriftene/fe-lib 0.4.8 → 0.4.10

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,212 +1,216 @@
1
- import { createHeadlessEditor as zt } from "@lexical/headless";
2
- import { $generateHtmlFromNodes as Rt } from "@lexical/html";
3
- import { $getRoot as H, ParagraphNode as _t, $createParagraphNode as W, $createTextNode as q, $setSelection as ct, SELECTION_CHANGE_COMMAND as A, $getSelection as T, COMMAND_PRIORITY_CRITICAL as X, $isRangeSelection as y, $isRootOrShadowRoot as $t, DEPRECATED_$isGridSelection as U, FORMAT_TEXT_COMMAND as O, COMMAND_PRIORITY_LOW as w, KEY_ARROW_DOWN_COMMAND as Ot, KEY_ARROW_UP_COMMAND as Pt, KEY_ESCAPE_COMMAND as ht, KEY_SPACE_COMMAND as At, $getNearestNodeFromDOMNode as Q, KEY_ARROW_LEFT_COMMAND as Bt, $isElementNode as Dt, COMMAND_PRIORITY_NORMAL as Ft, $isParagraphNode as Ht, COMMAND_PRIORITY_HIGH as Wt } from "lexical";
4
- import { trimTextContentFromAnchor as jt, $setBlocksType as K, $isAtNodeEnd as rt } from "@lexical/selection";
5
- import { AutoLinkNode as Ut, LinkNode as Kt, $isLinkNode as P, TOGGLE_LINK_COMMAND as Y, $isAutoLinkNode as Yt } from "@lexical/link";
6
- import { ListNode as ut, ListItemNode as Gt, $isListNode as V, INSERT_UNORDERED_LIST_COMMAND as qt, INSERT_ORDERED_LIST_COMMAND as Xt, INSERT_CHECK_LIST_COMMAND as pt, insertList as Qt, $isListItemNode as _ } from "@lexical/list";
7
- import { HeadingNode as Vt, QuoteNode as Jt, $isHeadingNode as Zt, $createHeadingNode as te, $createQuoteNode as ee } from "@lexical/rich-text";
8
- import { TableNode as re, TableRowNode as oe, TableCellNode as ne, $getTableCellNodeFromLexicalNode as ae, $deleteTableColumn__EXPERIMENTAL as ie, $deleteTableRow__EXPERIMENTAL as le, $insertTableColumn__EXPERIMENTAL as ot, $insertTableRow__EXPERIMENTAL as nt } from "@lexical/table";
9
- import { jsx as r, jsxs as C, Fragment as j } from "react/jsx-runtime";
10
- import { createContext as se, useState as f, useRef as J, useCallback as L, useContext as de, useEffect as E, useMemo as gt, useLayoutEffect as ce } from "react";
11
- import { c as $, s as ft, D as mt, T as he, a as b, B, b as ue, d as R, u as Z, e as kt, f as pe, g as ge, o as vt, h as fe, i as Ct, j as Mt, F as bt, O as Lt, k as me, l as ke, S as ve, m as D, n as z, p as at, q as Ce, r as Me, t as be, v as Le, w as Te, x as ye } from "./TextInput-986922b7.js";
1
+ var Ft = Object.defineProperty;
2
+ var Ht = (t, e, r) => e in t ? Ft(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
+ var at = (t, e, r) => (Ht(t, typeof e != "symbol" ? e + "" : e, r), r);
4
+ import { createHeadlessEditor as Wt } from "@lexical/headless";
5
+ import { $generateHtmlFromNodes as Ut } from "@lexical/html";
6
+ import { $getRoot as j, ParagraphNode as jt, $createParagraphNode as K, $createTextNode as A, $setSelection as mt, SELECTION_CHANGE_COMMAND as F, $getSelection as L, COMMAND_PRIORITY_CRITICAL as J, $isRangeSelection as T, $isRootOrShadowRoot as Kt, DEPRECATED_$isGridSelection as G, FORMAT_TEXT_COMMAND as B, COMMAND_PRIORITY_LOW as w, KEY_ARROW_DOWN_COMMAND as Yt, KEY_ARROW_UP_COMMAND as qt, KEY_ESCAPE_COMMAND as kt, KEY_SPACE_COMMAND as Gt, $getNearestNodeFromDOMNode as V, KEY_ARROW_LEFT_COMMAND as Xt, $isElementNode as Qt, COMMAND_PRIORITY_NORMAL as Jt, $isParagraphNode as Vt, COMMAND_PRIORITY_HIGH as Zt } from "lexical";
7
+ import { trimTextContentFromAnchor as te, $setBlocksType as X, $isAtNodeEnd as lt } from "@lexical/selection";
8
+ import { AutoLinkNode as ee, LinkNode as bt, $isLinkNode as W, TOGGLE_LINK_COMMAND as Z } from "@lexical/link";
9
+ import { ListNode as vt, ListItemNode as re, $isListNode as tt, INSERT_UNORDERED_LIST_COMMAND as ne, INSERT_ORDERED_LIST_COMMAND as oe, INSERT_CHECK_LIST_COMMAND as Ct, insertList as ie, $isListItemNode as z } from "@lexical/list";
10
+ import { HeadingNode as ae, QuoteNode as le, $isHeadingNode as se, $createHeadingNode as ce, $createQuoteNode as de } from "@lexical/rich-text";
11
+ import { TableNode as ue, TableRowNode as he, TableCellNode as pe, $getTableCellNodeFromLexicalNode as ge, $deleteTableColumn__EXPERIMENTAL as fe, $deleteTableRow__EXPERIMENTAL as me, $insertTableColumn__EXPERIMENTAL as st, $insertTableRow__EXPERIMENTAL as ct } from "@lexical/table";
12
+ import { jsx as n, jsxs as m, Fragment as Y } from "react/jsx-runtime";
13
+ import { createContext as ke, useState as b, useRef as et, useCallback as v, useContext as be, useEffect as N, useMemo as Mt, useLayoutEffect as ve } from "react";
14
+ import { c as O, s as Lt, D as Tt, T as Ce, a as M, B as P, b as Nt, d as _, u as rt, e as yt, f as Me, g as Le, o as xt, h as Te, i as Et, j as St, F as wt, O as Rt, k as Ne, l as ye, S as xe, m as $, n as I, p as dt, q as Ee, N as Se, r as ut, t as we, v as It, C as Re, w as Ie, x as _e } from "./TextInput-832f6509.js";
12
15
  import "react-select";
13
- import { LexicalComposer as Ne } from "@lexical/react/LexicalComposer.js";
14
- import { RichTextPlugin as Ee } from "@lexical/react/LexicalRichTextPlugin.js";
15
- import xe from "@lexical/react/LexicalErrorBoundary.js";
16
- import { useLexicalComposerContext as I } from "@lexical/react/LexicalComposerContext.js";
17
- import { $getNearestNodeOfType as Se, $findMatchingParent as F, mergeRegister as tt, isHTMLElement as it } from "@lexical/utils";
18
- import { G as p, f as we } from "./index.esm-b848a615.js";
19
- import { ListPlugin as Ie } from "@lexical/react/LexicalListPlugin.js";
20
- import { HistoryPlugin as ze } from "@lexical/react/LexicalHistoryPlugin.js";
21
- import { TablePlugin as Re } from "@lexical/react/LexicalTablePlugin.js";
22
- import { TabIndentationPlugin as _e } from "@lexical/react/LexicalTabIndentationPlugin.js";
16
+ import { LexicalComposer as ze } from "@lexical/react/LexicalComposer.js";
17
+ import { RichTextPlugin as $e } from "@lexical/react/LexicalRichTextPlugin.js";
18
+ import Oe from "@lexical/react/LexicalErrorBoundary.js";
19
+ import { useLexicalComposerContext as y } from "@lexical/react/LexicalComposerContext.js";
20
+ import { $getNearestNodeOfType as De, $findMatchingParent as _t, mergeRegister as nt, isHTMLElement as ht } from "@lexical/utils";
21
+ import { G as p, f as Be } from "./index.esm-b848a615.js";
22
+ import { ListPlugin as Ae } from "@lexical/react/LexicalListPlugin.js";
23
+ import { HistoryPlugin as Pe } from "@lexical/react/LexicalHistoryPlugin.js";
24
+ import { TablePlugin as Fe } from "@lexical/react/LexicalTablePlugin.js";
25
+ import { TabIndentationPlugin as He } from "@lexical/react/LexicalTabIndentationPlugin.js";
23
26
  import "react-dom";
24
27
  import "@radix-ui/react-toolbar";
28
+ import "@radix-ui/react-dialog";
25
29
  import "@radix-ui/react-dropdown-menu";
26
- const $e = ({
30
+ const We = ({
27
31
  text: t,
28
32
  maxChars: e,
29
- maxLines: o
33
+ maxLines: r
30
34
  }) => {
31
35
  if (t.length === 0)
32
36
  return 0;
33
- const n = typeof o == "number", a = typeof e == "number";
34
- if (!n && !a)
37
+ const o = typeof r == "number", i = typeof e == "number";
38
+ if (!o && !i)
35
39
  return t.length;
36
- let l = 0, i = 0;
37
- for (; i < t.length && (!n || l < o) && (!a || i < e); )
38
- t[i] === `
39
- ` && l++, i++;
40
- return t.slice(0, i).length;
41
- }, Oe = ({
40
+ let l = 0, a = 0;
41
+ for (; a < t.length && (!o || l < r) && (!i || a < e); )
42
+ t[a] === `
43
+ ` && l++, a++;
44
+ return t.slice(0, a).length;
45
+ }, Ue = ({
42
46
  editor: t,
43
47
  maxChars: e,
44
- maxLines: o
48
+ maxLines: r
45
49
  }) => {
46
- const n = H(), a = n.getTextContent(), l = $e({ text: a, maxChars: e, maxLines: o }), i = a.length - l, c = n.select().anchor;
47
- jt(t, c, i);
48
- const s = n.getLastChild();
49
- return s instanceof _t && s.getChildrenSize() === 0 && s.remove(), i;
50
- }, Tt = (t) => t[0] === "{", Pe = (t) => t !== null && typeof t == "object" && "isEmpty" in t, Ae = (t, e) => {
50
+ const o = j(), i = o.getTextContent(), l = We({ text: i, maxChars: e, maxLines: r }), a = i.length - l, d = o.select().anchor;
51
+ te(t, d, a);
52
+ const c = o.getLastChild();
53
+ return c instanceof jt && c.getChildrenSize() === 0 && c.remove(), a;
54
+ }, zt = (t) => t[0] === "{", je = (t) => t !== null && typeof t == "object" && "isEmpty" in t, Ke = (t, e) => {
51
55
  t.update(
52
56
  () => {
53
- const o = H();
54
- o.clear();
55
- const n = W();
56
- n.append(q("")), o.append(n), ct(null);
57
+ const r = j();
58
+ r.clear();
59
+ const o = K();
60
+ o.append(A("")), r.append(o), mt(null);
57
61
  },
58
62
  {
59
63
  tag: e
60
64
  }
61
65
  );
62
- }, Be = (t, e, o) => {
66
+ }, Ye = (t, e, r) => {
63
67
  e.update(
64
68
  () => {
65
- const n = H();
66
- n.clear();
67
- const a = W();
68
- a.append(q(t.trim())), n.append(a), ct(null);
69
+ const o = j();
70
+ o.clear();
71
+ const i = K();
72
+ i.append(A(t.trim())), o.append(i), mt(null);
69
73
  },
70
74
  {
71
- tag: o
75
+ tag: r
72
76
  }
73
77
  ), e.blur();
74
- }, Qr = (t, e, o) => {
75
- let n = 0;
76
- const a = zt({
78
+ }, dn = (t, e, r) => {
79
+ let o = 0;
80
+ const i = Wt({
77
81
  nodes: e,
78
82
  editable: !1
79
83
  });
80
84
  if (t)
81
85
  try {
82
- if (typeof t == "string" && !Tt(t))
83
- a.update(() => {
84
- const i = H(), d = W();
85
- d.append(q(t.trim())), i.append(d);
86
+ if (typeof t == "string" && !zt(t))
87
+ i.update(() => {
88
+ const a = j(), s = K();
89
+ s.append(A(t.trim())), a.append(s);
86
90
  });
87
91
  else {
88
- const i = a.parseEditorState(t, () => {
89
- n = Oe({
90
- editor: a,
91
- maxLines: o == null ? void 0 : o.maxLines
92
+ const a = i.parseEditorState(t, () => {
93
+ o = Ue({
94
+ editor: i,
95
+ maxLines: r == null ? void 0 : r.maxLines
92
96
  });
93
97
  });
94
- i.isEmpty() || a.setEditorState(i);
98
+ a.isEmpty() || i.setEditorState(a);
95
99
  }
96
- } catch (i) {
97
- console.error(i);
100
+ } catch (a) {
101
+ console.error(a);
98
102
  }
99
103
  let l = "";
100
- return a.update(() => {
101
- l = Rt(a);
102
- }), { html: l, trimCount: n };
103
- }, Vr = [
104
- Vt,
105
- Jt,
106
- ut,
107
- Gt,
108
- Ut,
109
- Kt,
104
+ return i.update(() => {
105
+ l = Ut(i);
106
+ }), { html: l, trimCount: o };
107
+ }, un = [
108
+ ae,
109
+ le,
110
+ vt,
110
111
  re,
111
- oe,
112
- ne
113
- ], De = $({
112
+ ee,
113
+ bt,
114
+ ue,
115
+ he,
116
+ pe
117
+ ], qe = O({
114
118
  fontWeight: "bold"
115
- }), Fe = $({
119
+ }), Ge = O({
116
120
  fontStyle: "italic"
117
- }), He = $({
121
+ }), Xe = O({
118
122
  textDecoration: "underline"
119
- }), We = $({
123
+ }), Qe = O({
120
124
  listStyleType: "none"
121
- }), je = $({
125
+ }), Je = O({
122
126
  borderLeft: "4px solid #ccc",
123
127
  color: "#666",
124
128
  fontStyle: "italic",
125
129
  margin: "1.5em 10px",
126
130
  padding: "0.5em 10px"
127
- }), Ue = {
128
- quote: je().className,
131
+ }), Ve = {
132
+ quote: Je().className,
129
133
  text: {
130
- bold: De().className,
131
- italic: Fe().className,
132
- underline: He().className
134
+ bold: qe().className,
135
+ italic: Ge().className,
136
+ underline: Xe().className
133
137
  },
134
138
  list: {
135
139
  nested: {
136
- listitem: We().className
140
+ listitem: Qe().className
137
141
  }
138
142
  }
139
- }, yt = se({ hasFocus: !1, editorRef: { current: null } }), Ke = ({ onBlur: t }) => {
140
- const [e, o] = f(!1), n = J(null), a = L(() => {
141
- o(!0), n.current && window.clearTimeout(n.current);
142
- }, []), l = L(() => {
143
- n.current = window.setTimeout(() => {
144
- o(!1), t == null || t();
143
+ }, $t = ke({ hasFocus: !1, editorRef: { current: null } }), Ze = ({ onBlur: t }) => {
144
+ const [e, r] = b(!1), o = et(null), i = v(() => {
145
+ r(!0), o.current && window.clearTimeout(o.current);
146
+ }, []), l = v(() => {
147
+ o.current = window.setTimeout(() => {
148
+ r(!1), t == null || t();
145
149
  }, 0);
146
150
  }, [t]);
147
151
  return {
148
152
  hasFocus: e,
149
153
  attributes: {
150
- onFocus: a,
154
+ onFocus: i,
151
155
  onBlur: l
152
156
  }
153
157
  };
154
- }, et = () => de(yt);
155
- function Ye(t) {
158
+ }, ot = () => be($t);
159
+ function tr(t) {
156
160
  return p({ 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
161
  }
158
- function Ge(t) {
162
+ function er(t) {
159
163
  return p({ 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
164
  }
161
- function qe(t) {
165
+ function rr(t) {
162
166
  return p({ 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
167
  }
164
- function Xe(t) {
168
+ function nr(t) {
165
169
  return p({ 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
170
  }
167
- function Qe(t) {
171
+ function or(t) {
168
172
  return p({ 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
173
  }
170
- function Ve(t) {
174
+ function ir(t) {
171
175
  return p({ 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
176
  }
173
- function Je(t) {
177
+ function ar(t) {
174
178
  return p({ 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
179
  }
176
- function Ze(t) {
180
+ function lr(t) {
177
181
  return p({ 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
182
  }
179
- function tr(t) {
183
+ function sr(t) {
180
184
  return p({ 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
185
  }
182
- function er(t) {
186
+ function cr(t) {
183
187
  return p({ 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
188
  }
185
- function rr(t) {
189
+ function dr(t) {
186
190
  return p({ 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 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5" } }, { tag: "path", attr: { d: "M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5" } }] })(t);
187
191
  }
188
- function or(t) {
192
+ function ur(t) {
189
193
  return p({ 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);
190
194
  }
191
- function nr(t) {
195
+ function hr(t) {
192
196
  return p({ 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);
193
197
  }
194
- function ar(t) {
198
+ function pr(t) {
195
199
  return p({ 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);
196
200
  }
197
- function ir(t) {
201
+ function gr(t) {
198
202
  return p({ 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);
199
203
  }
200
- function lr(t) {
204
+ function fr(t) {
201
205
  return p({ 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);
202
206
  }
203
- function sr(t) {
207
+ function mr(t) {
204
208
  return p({ 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);
205
209
  }
206
- const dr = ft("div", {
210
+ const kr = Lt("div", {
207
211
  width: "10rem",
208
212
  display: "flex"
209
- }), Nt = {
213
+ }), Ot = {
210
214
  bullet: "Punktliste",
211
215
  h1: "Overskrift 1",
212
216
  h2: "Overskrift 2",
@@ -218,24 +222,24 @@ const dr = ft("div", {
218
222
  paragraph: "Normal",
219
223
  quote: "Sitat",
220
224
  check: "Avkrysningsliste"
221
- }, cr = {
222
- bullet: /* @__PURE__ */ r(ar, { size: "1.25rem" }),
223
- h1: /* @__PURE__ */ r(qe, { size: "1.25rem" }),
224
- h2: /* @__PURE__ */ r(Xe, { size: "1.25rem" }),
225
- h3: /* @__PURE__ */ r(Qe, { size: "1.25rem" }),
226
- h4: /* @__PURE__ */ r(Ve, { size: "1.25rem" }),
227
- h5: /* @__PURE__ */ r(Je, { size: "1.25rem" }),
228
- h6: /* @__PURE__ */ r(Ze, { size: "1.25rem" }),
229
- number: /* @__PURE__ */ r(nr, { size: "1.25rem" }),
230
- check: /* @__PURE__ */ r(or, { size: "1.25rem" }),
231
- paragraph: /* @__PURE__ */ r(er, { size: "1.25rem" }),
232
- quote: /* @__PURE__ */ r(ir, { size: "1.25rem" })
233
- }, v = ({
225
+ }, br = {
226
+ bullet: /* @__PURE__ */ n(pr, { size: "1.25rem" }),
227
+ h1: /* @__PURE__ */ n(rr, { size: "1.25rem" }),
228
+ h2: /* @__PURE__ */ n(nr, { size: "1.25rem" }),
229
+ h3: /* @__PURE__ */ n(or, { size: "1.25rem" }),
230
+ h4: /* @__PURE__ */ n(ir, { size: "1.25rem" }),
231
+ h5: /* @__PURE__ */ n(ar, { size: "1.25rem" }),
232
+ h6: /* @__PURE__ */ n(lr, { size: "1.25rem" }),
233
+ number: /* @__PURE__ */ n(hr, { size: "1.25rem" }),
234
+ check: /* @__PURE__ */ n(ur, { size: "1.25rem" }),
235
+ paragraph: /* @__PURE__ */ n(cr, { size: "1.25rem" }),
236
+ quote: /* @__PURE__ */ n(gr, { size: "1.25rem" })
237
+ }, C = ({
234
238
  blockType: t
235
- }) => /* @__PURE__ */ C(j, { children: [
236
- /* @__PURE__ */ r(B, { css: { display: "flex", flex: "0 0 auto" }, children: cr[t] }),
237
- /* @__PURE__ */ r(
238
- B,
239
+ }) => /* @__PURE__ */ m(Y, { children: [
240
+ /* @__PURE__ */ n(P, { css: { display: "flex", flex: "0 0 auto" }, children: br[t] }),
241
+ /* @__PURE__ */ n(
242
+ P,
239
243
  {
240
244
  css: {
241
245
  flex: "1 1 auto",
@@ -243,299 +247,299 @@ const dr = ft("div", {
243
247
  textOverflow: "ellipsis",
244
248
  whiteSpace: "nowrap"
245
249
  },
246
- children: Nt[t]
250
+ children: Ot[t]
247
251
  }
248
252
  )
249
- ] }), hr = (t) => {
250
- if (!y(t))
253
+ ] }), vr = (t) => {
254
+ if (!T(t))
251
255
  return null;
252
256
  const e = t.anchor.getNode();
253
- let o = e.getKey() === "root" ? e : F(e, (n) => {
254
- const a = n.getParent();
255
- return a !== null && $t(a);
257
+ let r = e.getKey() === "root" ? e : _t(e, (o) => {
258
+ const i = o.getParent();
259
+ return i !== null && Kt(i);
256
260
  });
257
- return o === null && (o = e.getTopLevelElementOrThrow()), {
261
+ return r === null && (r = e.getTopLevelElementOrThrow()), {
258
262
  anchorNode: e,
259
- element: o
263
+ element: r
260
264
  };
261
- }, ur = () => {
262
- const [t] = I(), [e, o] = f("paragraph");
263
- E(() => t.registerCommand(
264
- A,
265
+ }, Cr = () => {
266
+ const [t] = y(), [e, r] = b("paragraph");
267
+ N(() => t.registerCommand(
268
+ F,
265
269
  () => {
266
- const s = T(), h = hr(s);
267
- if (!h)
270
+ const c = L(), g = vr(c);
271
+ if (!g)
268
272
  return !1;
269
- const { element: g, anchorNode: m } = h, M = g.getKey();
270
- if (t.getElementByKey(M) !== null)
271
- if (V(g)) {
272
- const k = Se(
273
- m,
274
- ut
275
- ), x = k ? k.getListType() : g.getListType();
276
- o(x);
273
+ const { element: u, anchorNode: f } = g, S = u.getKey();
274
+ if (t.getElementByKey(S) !== null)
275
+ if (tt(u)) {
276
+ const k = De(
277
+ f,
278
+ vt
279
+ ), E = k ? k.getListType() : u.getListType();
280
+ r(E);
277
281
  } else {
278
- const k = Zt(g) ? g.getTag() : g.getType();
279
- k in Nt && o(k);
282
+ const k = se(u) ? u.getTag() : u.getType();
283
+ k in Ot && r(k);
280
284
  }
281
285
  return !1;
282
286
  },
283
- X
287
+ J
284
288
  ), [t]);
285
- const n = (s) => {
286
- e !== s && t.update(() => {
287
- const h = T();
288
- (y(h) || U(h)) && (K(h, () => te(s)), o(s));
289
+ const o = (c) => {
290
+ e !== c && t.update(() => {
291
+ const g = L();
292
+ (T(g) || G(g)) && (X(g, () => ce(c)), r(c));
289
293
  });
290
294
  };
291
- return /* @__PURE__ */ r(dr, { children: /* @__PURE__ */ C(
292
- mt,
295
+ return /* @__PURE__ */ n(kr, { children: /* @__PURE__ */ m(
296
+ Tt,
293
297
  {
294
- trigger: /* @__PURE__ */ r(
295
- he,
298
+ trigger: /* @__PURE__ */ n(
299
+ Ce,
296
300
  {
297
301
  dropdown: !0,
298
302
  css: { display: "flex", width: "100%", overflow: "hidden" },
299
- children: /* @__PURE__ */ r(v, { blockType: e })
303
+ children: /* @__PURE__ */ n(C, { blockType: e })
300
304
  }
301
305
  ),
302
306
  side: "bottom",
303
307
  align: "start",
304
308
  children: [
305
- /* @__PURE__ */ r(b, { onClick: () => {
309
+ /* @__PURE__ */ n(M, { onClick: () => {
306
310
  e !== "paragraph" && t.update(() => {
307
- const s = T();
308
- (y(s) || U(s)) && (K(s, () => W()), o("paragraph"));
311
+ const c = L();
312
+ (T(c) || G(c)) && (X(c, () => K()), r("paragraph"));
309
313
  });
310
- }, children: /* @__PURE__ */ r(v, { blockType: "paragraph" }) }),
311
- /* @__PURE__ */ r(b, { onClick: () => n("h1"), children: /* @__PURE__ */ r(v, { blockType: "h1" }) }),
312
- /* @__PURE__ */ r(b, { onClick: () => n("h2"), children: /* @__PURE__ */ r(v, { blockType: "h2" }) }),
313
- /* @__PURE__ */ r(b, { onClick: () => n("h3"), children: /* @__PURE__ */ r(v, { blockType: "h3" }) }),
314
- /* @__PURE__ */ r(b, { onClick: () => n("h4"), children: /* @__PURE__ */ r(v, { blockType: "h4" }) }),
315
- /* @__PURE__ */ r(b, { onClick: () => n("h5"), children: /* @__PURE__ */ r(v, { blockType: "h5" }) }),
316
- /* @__PURE__ */ r(b, { onClick: () => n("h6"), children: /* @__PURE__ */ r(v, { blockType: "h6" }) }),
317
- /* @__PURE__ */ r(b, { onClick: () => {
318
- e !== "bullet" && (t.dispatchCommand(qt, void 0), o("bullet"));
319
- }, children: /* @__PURE__ */ r(v, { blockType: "bullet" }) }),
320
- /* @__PURE__ */ r(b, { onClick: () => {
321
- e !== "number" && (t.dispatchCommand(Xt, void 0), o("number"));
322
- }, children: /* @__PURE__ */ r(v, { blockType: "number" }) }),
323
- /* @__PURE__ */ r(b, { onClick: () => {
324
- e !== "check" && (t.dispatchCommand(pt, void 0), o("check"));
325
- }, children: /* @__PURE__ */ r(v, { blockType: "check" }) }),
326
- /* @__PURE__ */ r(b, { onClick: () => {
314
+ }, children: /* @__PURE__ */ n(C, { blockType: "paragraph" }) }),
315
+ /* @__PURE__ */ n(M, { onClick: () => o("h1"), children: /* @__PURE__ */ n(C, { blockType: "h1" }) }),
316
+ /* @__PURE__ */ n(M, { onClick: () => o("h2"), children: /* @__PURE__ */ n(C, { blockType: "h2" }) }),
317
+ /* @__PURE__ */ n(M, { onClick: () => o("h3"), children: /* @__PURE__ */ n(C, { blockType: "h3" }) }),
318
+ /* @__PURE__ */ n(M, { onClick: () => o("h4"), children: /* @__PURE__ */ n(C, { blockType: "h4" }) }),
319
+ /* @__PURE__ */ n(M, { onClick: () => o("h5"), children: /* @__PURE__ */ n(C, { blockType: "h5" }) }),
320
+ /* @__PURE__ */ n(M, { onClick: () => o("h6"), children: /* @__PURE__ */ n(C, { blockType: "h6" }) }),
321
+ /* @__PURE__ */ n(M, { onClick: () => {
322
+ e !== "bullet" && (t.dispatchCommand(ne, void 0), r("bullet"));
323
+ }, children: /* @__PURE__ */ n(C, { blockType: "bullet" }) }),
324
+ /* @__PURE__ */ n(M, { onClick: () => {
325
+ e !== "number" && (t.dispatchCommand(oe, void 0), r("number"));
326
+ }, children: /* @__PURE__ */ n(C, { blockType: "number" }) }),
327
+ /* @__PURE__ */ n(M, { onClick: () => {
328
+ e !== "check" && (t.dispatchCommand(Ct, void 0), r("check"));
329
+ }, children: /* @__PURE__ */ n(C, { blockType: "check" }) }),
330
+ /* @__PURE__ */ n(M, { onClick: () => {
327
331
  e !== "quote" && t.update(() => {
328
- const s = T();
329
- (y(s) || U(s)) && (K(s, () => ee()), o("quote"));
332
+ const c = L();
333
+ (T(c) || G(c)) && (X(c, () => de()), r("quote"));
330
334
  });
331
- }, children: /* @__PURE__ */ r(v, { blockType: "quote" }) })
335
+ }, children: /* @__PURE__ */ n(C, { blockType: "quote" }) })
332
336
  ]
333
337
  }
334
338
  ) });
335
- }, pr = () => {
336
- const [t] = I(), [e, o] = f(!1), [n, a] = f(!1), [l, i] = f(!1), [d, c] = f(!1), [s, h] = f(!1), g = L(() => {
337
- const u = T();
338
- y(u) && (o(u.hasFormat("bold")), a(u.hasFormat("italic")), i(u.hasFormat("underline")), c(u.hasFormat("code")), h(u.hasFormat("superscript")));
339
+ }, Mr = () => {
340
+ const [t] = y(), [e, r] = b(!1), [o, i] = b(!1), [l, a] = b(!1), [s, d] = b(!1), [c, g] = b(!1), u = v(() => {
341
+ const h = L();
342
+ T(h) && (r(h.hasFormat("bold")), i(h.hasFormat("italic")), a(h.hasFormat("underline")), d(h.hasFormat("code")), g(h.hasFormat("superscript")));
339
343
  }, []);
340
- E(() => tt(
344
+ N(() => nt(
341
345
  t.registerCommand(
342
- A,
343
- () => (g(), !1),
344
- X
346
+ F,
347
+ () => (u(), !1),
348
+ J
345
349
  ),
346
- t.registerUpdateListener(({ editorState: u }) => {
347
- u.read(() => {
348
- g();
350
+ t.registerUpdateListener(({ editorState: h }) => {
351
+ h.read(() => {
352
+ u();
349
353
  });
350
354
  })
351
- ), [t, g]);
352
- const m = L(
353
- () => t.dispatchCommand(O, "bold"),
355
+ ), [t, u]);
356
+ const f = v(
357
+ () => t.dispatchCommand(B, "bold"),
354
358
  [t]
355
- ), M = L(
356
- () => t.dispatchCommand(O, "italic"),
359
+ ), S = v(
360
+ () => t.dispatchCommand(B, "italic"),
357
361
  [t]
358
- ), N = L(
359
- () => t.dispatchCommand(O, "underline"),
362
+ ), x = v(
363
+ () => t.dispatchCommand(B, "underline"),
360
364
  [t]
361
- ), k = L(
362
- () => t.dispatchCommand(O, "code"),
365
+ ), k = v(
366
+ () => t.dispatchCommand(B, "code"),
363
367
  [t]
364
- ), x = L(
365
- () => t.dispatchCommand(O, "superscript"),
368
+ ), E = v(
369
+ () => t.dispatchCommand(B, "superscript"),
366
370
  [t]
367
- ), S = gt(() => {
368
- const u = [];
369
- return e && u.push("bold"), n && u.push("italic"), l && u.push("underline"), d && u.push("code"), s && u.push("superscript"), u;
370
- }, [e, n, l, d, s]);
371
- return /* @__PURE__ */ C(
372
- ue,
371
+ ), D = Mt(() => {
372
+ const h = [];
373
+ return e && h.push("bold"), o && h.push("italic"), l && h.push("underline"), s && h.push("code"), c && h.push("superscript"), h;
374
+ }, [e, o, l, s, c]);
375
+ return /* @__PURE__ */ m(
376
+ Nt,
373
377
  {
374
378
  type: "multiple",
375
379
  "aria-label": "Tekstformattering",
376
- value: S,
380
+ value: D,
377
381
  children: [
378
- /* @__PURE__ */ r(
379
- R,
382
+ /* @__PURE__ */ n(
383
+ _,
380
384
  {
381
- onClick: m,
385
+ onClick: f,
382
386
  title: "Fet tekst",
383
387
  value: "bold",
384
- children: /* @__PURE__ */ r(Ye, { size: "1.25rem" })
388
+ children: /* @__PURE__ */ n(tr, { size: "1.25rem" })
385
389
  }
386
390
  ),
387
- /* @__PURE__ */ r(
388
- R,
391
+ /* @__PURE__ */ n(
392
+ _,
389
393
  {
390
- onClick: M,
394
+ onClick: S,
391
395
  title: "Kursiv tekst",
392
396
  value: "italic",
393
- children: /* @__PURE__ */ r(tr, { size: "1.25rem" })
397
+ children: /* @__PURE__ */ n(sr, { size: "1.25rem" })
394
398
  }
395
399
  ),
396
- /* @__PURE__ */ r(
397
- R,
400
+ /* @__PURE__ */ n(
401
+ _,
398
402
  {
399
- onClick: N,
403
+ onClick: x,
400
404
  title: "Understreket tekst",
401
405
  value: "underline",
402
- children: /* @__PURE__ */ r(sr, { size: "1.25rem" })
406
+ children: /* @__PURE__ */ n(mr, { size: "1.25rem" })
403
407
  }
404
408
  ),
405
- /* @__PURE__ */ r(
406
- R,
409
+ /* @__PURE__ */ n(
410
+ _,
407
411
  {
408
412
  onClick: k,
409
413
  title: "Kode",
410
414
  value: "code",
411
- children: /* @__PURE__ */ r(Ge, { size: "1.25rem" })
415
+ children: /* @__PURE__ */ n(er, { size: "1.25rem" })
412
416
  }
413
417
  ),
414
- /* @__PURE__ */ r(
415
- R,
418
+ /* @__PURE__ */ n(
419
+ _,
416
420
  {
417
- onClick: x,
421
+ onClick: E,
418
422
  title: "Superscript",
419
423
  value: "superscript",
420
- children: /* @__PURE__ */ r(lr, { size: "1.25rem" })
424
+ children: /* @__PURE__ */ n(fr, { size: "1.25rem" })
421
425
  }
422
426
  )
423
427
  ]
424
428
  }
425
429
  );
426
- }, gr = ({ children: t }) => {
427
- const { hasFocus: e, editorRef: o } = et(), n = e, [a, l] = f(n);
428
- ce(() => {
429
- l(n);
430
- }, [n]);
431
- const { context: i, refs: d, floatingStyles: c } = Z({
430
+ }, Lr = ({ children: t }) => {
431
+ const { hasFocus: e, editorRef: r } = ot(), o = e, [i, l] = b(o);
432
+ ve(() => {
433
+ l(o);
434
+ }, [o]);
435
+ const { context: a, refs: s, floatingStyles: d } = rt({
432
436
  placement: "top",
433
- whileElementsMounted: kt,
437
+ whileElementsMounted: yt,
434
438
  middleware: [
435
- pe({
436
- apply: ({ rects: h, elements: g }) => {
437
- g.floating.style.minWidth = `${h.reference.width}px`;
439
+ Me({
440
+ apply: ({ rects: g, elements: u }) => {
441
+ u.floating.style.minWidth = `${g.reference.width}px`;
438
442
  }
439
443
  }),
440
- ge(),
441
- vt({
444
+ Le(),
445
+ xt({
442
446
  mainAxis: 8
443
447
  }),
444
- fe({
448
+ Te({
445
449
  padding: 8
446
450
  })
447
451
  ],
448
- open: a,
452
+ open: i,
449
453
  onOpenChange: l,
450
454
  elements: {
451
- reference: o.current
455
+ reference: r.current
452
456
  }
453
- }), { getFloatingProps: s } = Ct([
454
- Mt(i, {
457
+ }), { getFloatingProps: c } = Et([
458
+ St(a, {
455
459
  role: "dialog"
456
460
  })
457
461
  ]);
458
- return a ? /* @__PURE__ */ r(bt, { children: /* @__PURE__ */ r(
459
- Lt,
462
+ return i ? /* @__PURE__ */ n(wt, { children: /* @__PURE__ */ n(
463
+ Rt,
460
464
  {
461
- ref: d.setFloating,
462
- style: c,
463
- ...s,
465
+ ref: s.setFloating,
466
+ style: d,
467
+ ...c,
464
468
  css: {
465
469
  border: "1px solid $border",
466
470
  borderRadius: "$md",
467
471
  overflow: "hidden",
468
472
  boxShadow: "$md"
469
473
  },
470
- children: /* @__PURE__ */ r(fr, { children: t })
474
+ children: /* @__PURE__ */ n(Tr, { children: t })
471
475
  }
472
476
  ) }) : null;
473
- }, fr = ({
477
+ }, Tr = ({
474
478
  children: t,
475
479
  ...e
476
- }) => /* @__PURE__ */ C(me, { "aria-label": "Formattering", ...e, children: [
477
- /* @__PURE__ */ r(ur, {}),
478
- /* @__PURE__ */ r(ke, {}),
479
- /* @__PURE__ */ r(pr, {}),
480
+ }) => /* @__PURE__ */ m(Ne, { "aria-label": "Formattering", ...e, children: [
481
+ /* @__PURE__ */ n(Cr, {}),
482
+ /* @__PURE__ */ n(ye, {}),
483
+ /* @__PURE__ */ n(Mr, {}),
480
484
  t
481
485
  ] });
482
- function mr() {
483
- const [t] = I();
484
- return E(() => tt(
486
+ function Nr() {
487
+ const [t] = y();
488
+ return N(() => nt(
485
489
  t.registerCommand(
486
- pt,
487
- () => (Qt(t, "check"), !0),
490
+ Ct,
491
+ () => (ie(t, "check"), !0),
488
492
  w
489
493
  ),
490
494
  t.registerCommand(
491
- Ot,
492
- (e) => dt(e, t, !1),
495
+ Yt,
496
+ (e) => ft(e, t, !1),
493
497
  w
494
498
  ),
495
499
  t.registerCommand(
496
- Pt,
497
- (e) => dt(e, t, !0),
500
+ qt,
501
+ (e) => ft(e, t, !0),
498
502
  w
499
503
  ),
500
504
  t.registerCommand(
501
- ht,
505
+ kt,
502
506
  (e) => {
503
- if (G() != null) {
504
- const n = t.getRootElement();
505
- return n != null && n.focus(), !0;
507
+ if (Q() != null) {
508
+ const o = t.getRootElement();
509
+ return o != null && o.focus(), !0;
506
510
  }
507
511
  return !1;
508
512
  },
509
513
  w
510
514
  ),
511
515
  t.registerCommand(
512
- At,
516
+ Gt,
513
517
  (e) => {
514
- const o = G();
515
- return o != null && t.isEditable() ? (t.update(() => {
516
- const n = Q(o);
517
- _(n) && (e.preventDefault(), n.toggleChecked());
518
+ const r = Q();
519
+ return r != null && t.isEditable() ? (t.update(() => {
520
+ const o = V(r);
521
+ z(o) && (e.preventDefault(), o.toggleChecked());
518
522
  }), !0) : !1;
519
523
  },
520
524
  w
521
525
  ),
522
526
  t.registerCommand(
523
- Bt,
527
+ Xt,
524
528
  (e) => t.getEditorState().read(() => {
525
- const o = T();
526
- if (y(o) && o.isCollapsed()) {
527
- const { anchor: n } = o, a = n.type === "element";
528
- if (a || n.offset === 0) {
529
- const l = n.getNode(), i = F(
529
+ const r = L();
530
+ if (T(r) && r.isCollapsed()) {
531
+ const { anchor: o } = r, i = o.type === "element";
532
+ if (i || o.offset === 0) {
533
+ const l = o.getNode(), a = _t(
530
534
  l,
531
- (d) => Dt(d) && !d.isInline()
535
+ (s) => Qt(s) && !s.isInline()
532
536
  );
533
- if (_(i)) {
534
- const d = i.getParent();
535
- if (V(d) && d.getListType() === "check" && (a || i.getFirstDescendant() === l)) {
536
- const c = t.getElementByKey(i.__key);
537
- if (c != null && document.activeElement !== c)
538
- return c.focus(), e.preventDefault(), !0;
537
+ if (z(a)) {
538
+ const s = a.getParent();
539
+ if (tt(s) && s.getListType() === "check" && (i || a.getFirstDescendant() === l)) {
540
+ const d = t.getElementByKey(a.__key);
541
+ if (d != null && document.activeElement !== d)
542
+ return d.focus(), e.preventDefault(), !0;
539
543
  }
540
544
  }
541
545
  }
@@ -544,41 +548,41 @@ function mr() {
544
548
  }),
545
549
  w
546
550
  ),
547
- t.registerRootListener((e, o) => {
548
- e !== null && (e.addEventListener("click", lt), e.addEventListener("pointerdown", st)), o !== null && (o.removeEventListener("click", lt), o.removeEventListener("pointerdown", st));
551
+ t.registerRootListener((e, r) => {
552
+ e !== null && (e.addEventListener("click", pt), e.addEventListener("pointerdown", gt)), r !== null && (r.removeEventListener("click", pt), r.removeEventListener("pointerdown", gt));
549
553
  })
550
554
  ), [t]), null;
551
555
  }
552
- function Et(t, e) {
553
- const o = t.target;
554
- if (o === null || !it(o))
556
+ function Dt(t, e) {
557
+ const r = t.target;
558
+ if (r === null || !ht(r))
555
559
  return;
556
- const n = o.firstChild;
557
- if (n != null && it(n) && (n.tagName === "UL" || n.tagName === "OL"))
560
+ const o = r.firstChild;
561
+ if (o != null && ht(o) && (o.tagName === "UL" || o.tagName === "OL"))
558
562
  return;
559
- const a = o.parentNode;
560
- if (!a || a.__lexicalListType !== "check")
563
+ const i = r.parentNode;
564
+ if (!i || i.__lexicalListType !== "check")
561
565
  return;
562
- const l = t.pageX, i = o.getBoundingClientRect();
563
- (o.dir === "rtl" ? l < i.right && l > i.right - 20 : l > i.left && l < i.left + 20) && e();
566
+ const l = t.pageX, a = r.getBoundingClientRect();
567
+ (r.dir === "rtl" ? l < a.right && l > a.right - 20 : l > a.left && l < a.left + 20) && e();
564
568
  }
565
- function lt(t) {
566
- Et(t, () => {
567
- const e = t.target, o = kr(e);
568
- o != null && o.isEditable() && o.update(() => {
569
+ function pt(t) {
570
+ Dt(t, () => {
571
+ const e = t.target, r = yr(e);
572
+ r != null && r.isEditable() && r.update(() => {
569
573
  if (t.target) {
570
- const n = Q(e);
571
- _(n) && (e.focus(), n.toggleChecked());
574
+ const o = V(e);
575
+ z(o) && (e.focus(), o.toggleChecked());
572
576
  }
573
577
  });
574
578
  });
575
579
  }
576
- function st(t) {
577
- Et(t, () => {
580
+ function gt(t) {
581
+ Dt(t, () => {
578
582
  t.preventDefault();
579
583
  });
580
584
  }
581
- function kr(t) {
585
+ function yr(t) {
582
586
  let e = t;
583
587
  for (; e; ) {
584
588
  if (e.__lexicalEditor)
@@ -587,67 +591,67 @@ function kr(t) {
587
591
  }
588
592
  return null;
589
593
  }
590
- function G() {
594
+ function Q() {
591
595
  const t = document.activeElement;
592
596
  return t != null && t.tagName === "LI" && t.parentNode != null && // @ts-ignore internal field
593
597
  t.parentNode.__lexicalListType === "check" ? t : null;
594
598
  }
595
- function vr(t, e) {
596
- let o = e ? t.getPreviousSibling() : t.getNextSibling(), n = t;
597
- for (; o == null && _(n); )
598
- n = n.getParentOrThrow().getParent(), n != null && (o = e ? n.getPreviousSibling() : n.getNextSibling());
599
- for (; _(o); ) {
600
- const a = e ? o.getLastChild() : o.getFirstChild();
601
- if (!V(a))
602
- return o;
603
- o = e ? a.getLastChild() : a.getFirstChild();
599
+ function xr(t, e) {
600
+ let r = e ? t.getPreviousSibling() : t.getNextSibling(), o = t;
601
+ for (; r == null && z(o); )
602
+ o = o.getParentOrThrow().getParent(), o != null && (r = e ? o.getPreviousSibling() : o.getNextSibling());
603
+ for (; z(r); ) {
604
+ const i = e ? r.getLastChild() : r.getFirstChild();
605
+ if (!tt(i))
606
+ return r;
607
+ r = e ? i.getLastChild() : i.getFirstChild();
604
608
  }
605
609
  return null;
606
610
  }
607
- function dt(t, e, o) {
608
- const n = G();
609
- return n != null && e.update(() => {
610
- const a = Q(n);
611
- if (!_(a))
611
+ function ft(t, e, r) {
612
+ const o = Q();
613
+ return o != null && e.update(() => {
614
+ const i = V(o);
615
+ if (!z(i))
612
616
  return;
613
- const l = vr(a, o);
617
+ const l = xr(i, r);
614
618
  if (l != null) {
615
619
  l.selectStart();
616
- const i = e.getElementByKey(l.__key);
617
- i != null && (t.preventDefault(), setTimeout(() => {
618
- i.focus();
620
+ const a = e.getElementByKey(l.__key);
621
+ a != null && (t.preventDefault(), setTimeout(() => {
622
+ a.focus();
619
623
  }, 0));
620
624
  }
621
625
  }), !1;
622
626
  }
623
- const Cr = () => /* @__PURE__ */ C(j, { children: [
624
- /* @__PURE__ */ r(Ie, {}),
625
- /* @__PURE__ */ r(Re, {}),
626
- /* @__PURE__ */ r(ze, {}),
627
- /* @__PURE__ */ r(mr, {}),
628
- /* @__PURE__ */ r(_e, {})
629
- ] }), Mr = ({
627
+ const Er = () => /* @__PURE__ */ m(Y, { children: [
628
+ /* @__PURE__ */ n(Ae, {}),
629
+ /* @__PURE__ */ n(Fe, {}),
630
+ /* @__PURE__ */ n(Pe, {}),
631
+ /* @__PURE__ */ n(Nr, {}),
632
+ /* @__PURE__ */ n(He, {})
633
+ ] }), Sr = ({
630
634
  state: t
631
635
  }) => {
632
- const [e] = I();
633
- return E(() => {
636
+ const [e] = y();
637
+ return N(() => {
634
638
  if (t)
635
639
  try {
636
- if (Pe(t)) {
637
- t.isEmpty() ? Ae(e) : e.setEditorState(t);
640
+ if (je(t)) {
641
+ t.isEmpty() ? Ke(e) : e.setEditorState(t);
638
642
  return;
639
643
  }
640
- if (typeof t == "string" && !Tt(t)) {
641
- Be(t, e);
644
+ if (typeof t == "string" && !zt(t)) {
645
+ Ye(t, e);
642
646
  return;
643
647
  }
644
- const o = e.parseEditorState(t);
645
- o.isEmpty() || e.setEditorState(o);
646
- } catch (o) {
647
- console.error("Could not parse"), console.error(o);
648
+ const r = e.parseEditorState(t);
649
+ r.isEmpty() || e.setEditorState(r);
650
+ } catch (r) {
651
+ console.error("Could not parse"), console.error(r);
648
652
  }
649
653
  }, []), null;
650
- }, br = ft("div", {
654
+ }, wr = Lt("div", {
651
655
  border: "1px solid $borderDarker",
652
656
  borderRadius: "$md",
653
657
  position: "relative",
@@ -684,10 +688,10 @@ const Cr = () => /* @__PURE__ */ C(j, { children: [
684
688
  }
685
689
  }
686
690
  ]
687
- }), Lr = ({
691
+ }), Rr = ({
688
692
  isLoading: t
689
- }) => /* @__PURE__ */ r(
690
- B,
693
+ }) => /* @__PURE__ */ n(
694
+ P,
691
695
  {
692
696
  css: {
693
697
  visibility: t ? "visible" : "hidden",
@@ -696,52 +700,52 @@ const Cr = () => /* @__PURE__ */ C(j, { children: [
696
700
  right: "1rem",
697
701
  display: "flex"
698
702
  },
699
- children: /* @__PURE__ */ r(ve, {})
703
+ children: /* @__PURE__ */ n(xe, {})
700
704
  }
701
- ), Jr = ({
705
+ ), hn = ({
702
706
  isLoading: t,
703
707
  children: e,
704
- placeholderText: o,
705
- nodes: n,
706
- plugins: a,
708
+ placeholderText: r,
709
+ nodes: o,
710
+ plugins: i,
707
711
  toolbar: l,
708
- toolbarContent: i,
709
- content: d,
710
- hideBorder: c,
711
- onBlur: s,
712
- defaultState: h,
713
- css: g
712
+ toolbarContent: a,
713
+ content: s,
714
+ hideBorder: d,
715
+ onBlur: c,
716
+ defaultState: g,
717
+ css: u
714
718
  }) => {
715
- const { hasFocus: m, attributes: M } = Ke({ onBlur: s }), N = J(null), k = gt(() => ({ hasFocus: m, editorRef: N }), [m]);
716
- return /* @__PURE__ */ r(yt.Provider, { value: k, children: /* @__PURE__ */ C(
717
- Ne,
719
+ const { hasFocus: f, attributes: S } = Ze({ onBlur: c }), x = et(null), k = Mt(() => ({ hasFocus: f, editorRef: x }), [f]);
720
+ return /* @__PURE__ */ n($t.Provider, { value: k, children: /* @__PURE__ */ m(
721
+ ze,
718
722
  {
719
723
  initialConfig: {
720
724
  namespace: "CommentEditor",
721
- onError: (x) => {
722
- console.error(x);
725
+ onError: (E) => {
726
+ console.error(E);
723
727
  },
724
- theme: Ue,
725
- nodes: n,
728
+ theme: Ve,
729
+ nodes: o,
726
730
  editable: !0
727
731
  },
728
732
  children: [
729
- /* @__PURE__ */ C(
730
- br,
733
+ /* @__PURE__ */ m(
734
+ wr,
731
735
  {
732
- ref: N,
733
- hasFocus: m,
734
- hideBorder: c,
735
- css: g,
736
- ...M,
736
+ ref: x,
737
+ hasFocus: f,
738
+ hideBorder: d,
739
+ css: u,
740
+ ...S,
737
741
  children: [
738
742
  l,
739
- /* @__PURE__ */ r(
740
- Ee,
743
+ /* @__PURE__ */ n(
744
+ $e,
741
745
  {
742
- contentEditable: d,
743
- placeholder: o ? /* @__PURE__ */ r(
744
- B,
746
+ contentEditable: s,
747
+ placeholder: r ? /* @__PURE__ */ n(
748
+ P,
745
749
  {
746
750
  css: {
747
751
  position: "absolute",
@@ -751,25 +755,25 @@ const Cr = () => /* @__PURE__ */ C(j, { children: [
751
755
  pointerEvents: "none",
752
756
  fontSize: "$sm"
753
757
  },
754
- children: o
758
+ children: r
755
759
  }
756
760
  ) : null,
757
- ErrorBoundary: xe
761
+ ErrorBoundary: Oe
758
762
  }
759
763
  ),
760
- /* @__PURE__ */ r(Cr, {}),
761
- a,
762
- /* @__PURE__ */ r(Lr, { isLoading: t }),
763
- !l && /* @__PURE__ */ r(gr, { children: i })
764
+ /* @__PURE__ */ n(Er, {}),
765
+ i,
766
+ /* @__PURE__ */ n(Rr, { isLoading: t }),
767
+ !l && /* @__PURE__ */ n(Lr, { children: a })
764
768
  ]
765
769
  }
766
770
  ),
767
- /* @__PURE__ */ r(Mr, { state: h }),
768
- /* @__PURE__ */ r(j, { children: e })
771
+ /* @__PURE__ */ n(Sr, { state: g }),
772
+ /* @__PURE__ */ n(Y, { children: e })
769
773
  ]
770
774
  }
771
775
  ) });
772
- }, Zr = $({
776
+ }, pn = O({
773
777
  fontSize: "1rem",
774
778
  lineHeight: "1.5",
775
779
  "h1, h2, h3, h4, h5, h6": {
@@ -893,6 +897,16 @@ const Cr = () => /* @__PURE__ */ C(j, { children: [
893
897
  padding: "$2"
894
898
  }
895
899
  },
900
+ a: {
901
+ color: "#0D6EFD",
902
+ textDecoration: "underline",
903
+ "&.rutine-link": {
904
+ background: "#7D6B89",
905
+ color: "white",
906
+ padding: "1px 2px",
907
+ borderRadius: "$sm"
908
+ }
909
+ },
896
910
  variants: {
897
911
  size: {
898
912
  xs: {
@@ -931,254 +945,355 @@ const Cr = () => /* @__PURE__ */ C(j, { children: [
931
945
  size: "md"
932
946
  }
933
947
  });
934
- function Tr(t) {
948
+ function Ir(t) {
935
949
  return p({ 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);
936
950
  }
937
- const to = () => {
938
- const [t] = I(), [e, o] = f(null), { hasFocus: n } = et();
939
- E(() => {
940
- !n && e && o(null);
941
- }, [n, e]);
942
- const { refs: a, floatingStyles: l } = Z({
951
+ const gn = () => {
952
+ const [t] = y(), [e, r] = b(null), { hasFocus: o } = ot();
953
+ N(() => {
954
+ !o && e && r(null);
955
+ }, [o, e]);
956
+ const { refs: i, floatingStyles: l } = rt({
943
957
  placement: "top-end",
944
958
  open: !!e,
945
959
  elements: {
946
960
  reference: e
947
961
  },
948
- middleware: [vt({ mainAxis: -20, crossAxis: -2 })]
962
+ middleware: [xt({ mainAxis: -20, crossAxis: -2 })]
949
963
  });
950
- E(() => t.registerCommand(
951
- A,
964
+ N(() => t.registerCommand(
965
+ F,
952
966
  () => {
953
- const d = T();
954
- if (y(d)) {
955
- const c = d.anchor.getNode(), s = ae(c);
956
- o(s ? t.getElementByKey(s.getKey()) : null);
967
+ const s = L();
968
+ if (T(s)) {
969
+ const d = s.anchor.getNode(), c = ge(d);
970
+ r(c ? t.getElementByKey(c.getKey()) : null);
957
971
  }
958
972
  return !1;
959
973
  },
960
- Ft
974
+ Jt
961
975
  ), [t]);
962
- const i = (d) => () => {
976
+ const a = (s) => () => {
963
977
  t.update(() => {
964
- switch (d) {
978
+ switch (s) {
965
979
  case "add-row-over":
966
- nt(!1);
980
+ ct(!1);
967
981
  break;
968
982
  case "add-row-under":
969
- nt(!0);
983
+ ct(!0);
970
984
  break;
971
985
  case "add-column-left":
972
- ot(!1);
986
+ st(!1);
973
987
  break;
974
988
  case "add-column-right":
975
- ot(!0);
989
+ st(!0);
976
990
  break;
977
991
  case "delete-row":
978
- le();
992
+ me();
979
993
  break;
980
994
  case "delete-column":
981
- ie();
995
+ fe();
982
996
  break;
983
997
  }
984
998
  });
985
999
  };
986
- return e ? /* @__PURE__ */ C(
987
- mt,
1000
+ return e ? /* @__PURE__ */ m(
1001
+ Tt,
988
1002
  {
989
- trigger: /* @__PURE__ */ r(
990
- D,
1003
+ trigger: /* @__PURE__ */ n(
1004
+ $,
991
1005
  {
992
1006
  icon: !0,
993
1007
  variant: "primary",
994
1008
  color: "secondary",
995
- ref: a.setFloating,
1009
+ ref: i.setFloating,
996
1010
  style: l,
997
1011
  css: { padding: "2px", width: "18px", height: "18px" },
998
- children: /* @__PURE__ */ r(Tr, {})
1012
+ children: /* @__PURE__ */ n(Ir, {})
999
1013
  }
1000
1014
  ),
1001
1015
  children: [
1002
- /* @__PURE__ */ r(z, { onClick: i("add-row-over"), children: "Legg til rad over" }),
1003
- /* @__PURE__ */ r(z, { onClick: i("add-row-under"), children: "Legg til rad under" }),
1004
- /* @__PURE__ */ r(at, {}),
1005
- /* @__PURE__ */ r(z, { onClick: i("add-column-left"), children: "Legg til kolumne venstre" }),
1006
- /* @__PURE__ */ r(z, { onClick: i("add-column-right"), children: "Legg til kolumne høyre" }),
1007
- /* @__PURE__ */ r(at, {}),
1008
- /* @__PURE__ */ r(z, { onClick: i("delete-row"), children: "Fjern rad" }),
1009
- /* @__PURE__ */ r(z, { onClick: i("delete-column"), children: "Fjern kolumne" })
1016
+ /* @__PURE__ */ n(I, { onClick: a("add-row-over"), children: "Legg til rad over" }),
1017
+ /* @__PURE__ */ n(I, { onClick: a("add-row-under"), children: "Legg til rad under" }),
1018
+ /* @__PURE__ */ n(dt, {}),
1019
+ /* @__PURE__ */ n(I, { onClick: a("add-column-left"), children: "Legg til kolumne venstre" }),
1020
+ /* @__PURE__ */ n(I, { onClick: a("add-column-right"), children: "Legg til kolumne høyre" }),
1021
+ /* @__PURE__ */ n(dt, {}),
1022
+ /* @__PURE__ */ n(I, { onClick: a("delete-row"), children: "Fjern rad" }),
1023
+ /* @__PURE__ */ n(I, { onClick: a("delete-column"), children: "Fjern kolumne" })
1010
1024
  ]
1011
1025
  }
1012
1026
  ) : null;
1013
1027
  };
1014
- function xt(t) {
1028
+ function Bt(t) {
1015
1029
  let e = t;
1016
- const o = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi, n = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
1017
- return e = String(e).trim(), e.match(o) || e.match(n) ? e : "https://";
1030
+ const r = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi, o = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
1031
+ return e = String(e).trim(), e.match(r) || e.match(o) ? e : "https://";
1018
1032
  }
1019
- function St(t) {
1020
- const e = t.anchor, o = t.focus, n = t.anchor.getNode(), a = t.focus.getNode();
1021
- return n === a ? n : t.isBackward() ? rt(o) ? n : a : rt(e) ? n : a;
1033
+ function At(t) {
1034
+ const e = t.anchor, r = t.focus, o = t.anchor.getNode(), i = t.focus.getNode();
1035
+ return o === i ? o : t.isBackward() ? lt(r) ? o : i : lt(e) ? o : i;
1022
1036
  }
1023
- const yr = ({
1024
- isOpen: t,
1025
- onSave: e,
1026
- onCancel: o
1027
- }) => {
1028
- const n = J(null);
1029
- return /* @__PURE__ */ C(Ce, { open: t, onOpenChange: o, children: [
1030
- /* @__PURE__ */ r(Me, { children: "Opprett lenke" }),
1031
- /* @__PURE__ */ r(be, { label: "URL", ref: n }),
1032
- /* @__PURE__ */ C(Le, { children: [
1033
- /* @__PURE__ */ r(D, { onClick: o, children: "Avbryt" }),
1034
- /* @__PURE__ */ r(
1035
- D,
1037
+ const fn = (t) => (R.baseURL = t, R), U = class extends bt {
1038
+ static getType() {
1039
+ return "rutine_link";
1040
+ }
1041
+ static clone(e) {
1042
+ return new U(e.url);
1043
+ }
1044
+ createDOM(e) {
1045
+ const r = super.createDOM(e);
1046
+ return r.setAttribute("href", this.getURL()), r.classList.add("rutine-link"), r;
1047
+ }
1048
+ static importJSON(e) {
1049
+ return Pt(e.url);
1050
+ }
1051
+ exportJSON() {
1052
+ return {
1053
+ ...super.exportJSON(),
1054
+ type: "rutine_link",
1055
+ url: this.__url,
1056
+ version: 1
1057
+ };
1058
+ }
1059
+ getURL() {
1060
+ try {
1061
+ return new URL(this.__url, U.baseURL).toString();
1062
+ } catch {
1063
+ return "";
1064
+ }
1065
+ }
1066
+ };
1067
+ let R = U;
1068
+ at(R, "baseURL", "");
1069
+ function Pt(t) {
1070
+ return new R(t);
1071
+ }
1072
+ function _r(t) {
1073
+ return t instanceof R;
1074
+ }
1075
+ const zr = ({ onClose: t }) => {
1076
+ const [e] = y(), r = v(
1077
+ (i) => {
1078
+ e.update(() => {
1079
+ const l = L();
1080
+ if (T(l) && l.isCollapsed()) {
1081
+ const a = l.getNodes();
1082
+ if (a.length === 1) {
1083
+ const s = a[0];
1084
+ Vt(s) && s.getChildren().length === 0 && l.insertText(i);
1085
+ }
1086
+ }
1087
+ }), e.dispatchCommand(Z, Bt(i));
1088
+ },
1089
+ [e]
1090
+ );
1091
+ return /* @__PURE__ */ m("form", { onSubmit: (i) => {
1092
+ r(i.target.url.value), t();
1093
+ }, children: [
1094
+ /* @__PURE__ */ n(we, { name: "url", label: "URL", type: "url", required: !0 }),
1095
+ /* @__PURE__ */ m(It, { children: [
1096
+ /* @__PURE__ */ n($, { onClick: t, children: "Avbryt" }),
1097
+ /* @__PURE__ */ n($, { type: "submit", variant: "primary", children: "Lagre" })
1098
+ ] })
1099
+ ] });
1100
+ }, $r = ({ onClose: t, getDocs: e }) => {
1101
+ const [r] = y(), [o, i] = b([]), l = e(), a = v(
1102
+ (s) => {
1103
+ r.update(() => {
1104
+ const d = L();
1105
+ if (T(d)) {
1106
+ const c = [];
1107
+ for (const [g, u] of s.entries()) {
1108
+ const f = Pt(u.value);
1109
+ f.append(A(u.label)), c.push(f), g !== s.length - 1 && c.push(A(" "));
1110
+ }
1111
+ d.insertNodes(c);
1112
+ }
1113
+ });
1114
+ },
1115
+ [r]
1116
+ );
1117
+ return /* @__PURE__ */ m(Y, { children: [
1118
+ /* @__PURE__ */ n(Re, { multi: !0, options: l, onChange: i }),
1119
+ /* @__PURE__ */ m(It, { children: [
1120
+ /* @__PURE__ */ n($, { onClick: t, children: "Avbryt" }),
1121
+ /* @__PURE__ */ n(
1122
+ $,
1036
1123
  {
1037
1124
  variant: "primary",
1038
1125
  onClick: () => {
1039
- var a;
1040
- e(((a = n.current) == null ? void 0 : a.value) || "");
1126
+ a(o), t();
1041
1127
  },
1042
1128
  children: "Lagre"
1043
1129
  }
1044
1130
  )
1045
1131
  ] })
1046
1132
  ] });
1047
- }, eo = () => {
1048
- const [t] = I(), [e, o] = f(!1), [n, a] = f(!1), l = L(() => {
1049
- const d = T();
1050
- if (y(d)) {
1051
- const c = St(d), s = c.getParent();
1052
- o(P(s) || P(c));
1133
+ }, Or = ({
1134
+ open: t,
1135
+ onOpenChange: e,
1136
+ getDocs: r
1137
+ }) => {
1138
+ const [o, i] = b("url"), l = () => {
1139
+ e(!1);
1140
+ };
1141
+ return /* @__PURE__ */ m(Ee, { open: t, onOpenChange: e, css: { width: "600px" }, children: [
1142
+ /* @__PURE__ */ m(Se, { css: { marginBottom: "$8" }, children: [
1143
+ /* @__PURE__ */ n(ut, { active: o === "url", onClick: () => i("url"), children: "URL" }),
1144
+ /* @__PURE__ */ n(ut, { active: o === "rutine", onClick: () => i("rutine"), children: "Rutine" })
1145
+ ] }),
1146
+ o === "url" && /* @__PURE__ */ n(zr, { onClose: l }),
1147
+ o === "rutine" && /* @__PURE__ */ n($r, { onClose: l, getDocs: r })
1148
+ ] });
1149
+ }, mn = ({ getDocs: t }) => {
1150
+ const [e] = y(), [r, o] = b(!1), [i, l] = b(!1), a = v(() => {
1151
+ const s = L();
1152
+ if (T(s)) {
1153
+ const d = At(s), c = d.getParent();
1154
+ o(W(c) || W(d));
1053
1155
  }
1054
1156
  }, []);
1055
- E(() => t.registerCommand(
1056
- A,
1057
- () => (l(), !1),
1058
- X
1059
- ), [t, l]);
1060
- const i = L(
1061
- (d) => {
1062
- t.update(() => {
1063
- const c = T();
1064
- if (y(c) && c.isCollapsed()) {
1065
- const s = c.getNodes();
1066
- if (s.length === 1) {
1067
- const h = s[0];
1068
- Ht(h) && h.getChildren().length === 0 && c.insertText(d);
1069
- }
1070
- }
1071
- }), t.dispatchCommand(Y, xt(d));
1072
- },
1073
- [t]
1074
- );
1075
- return /* @__PURE__ */ C(j, { children: [
1076
- /* @__PURE__ */ r(
1077
- R,
1157
+ return N(() => e.registerCommand(
1158
+ F,
1159
+ () => (a(), !1),
1160
+ J
1161
+ ), [e, a]), /* @__PURE__ */ m(Nt, { type: "single", value: r ? "link" : "", children: [
1162
+ /* @__PURE__ */ n(
1163
+ _,
1078
1164
  {
1079
1165
  onClick: () => {
1080
- e ? t.dispatchCommand(Y, null) : a(!0);
1166
+ r ? e.dispatchCommand(Z, null) : l(!0);
1081
1167
  },
1082
1168
  title: "Lenke",
1083
1169
  value: "link",
1084
- children: /* @__PURE__ */ r(rr, { size: "1.25rem" })
1170
+ children: /* @__PURE__ */ n(dr, { size: "1.25rem" })
1085
1171
  }
1086
1172
  ),
1087
- /* @__PURE__ */ r(
1088
- yr,
1173
+ /* @__PURE__ */ n(
1174
+ Or,
1089
1175
  {
1090
- isOpen: n,
1091
- onCancel: () => a(!1),
1092
- onSave: (d) => {
1093
- i(d), a(!1);
1094
- }
1176
+ open: i,
1177
+ onOpenChange: l,
1178
+ getDocs: t
1095
1179
  }
1096
1180
  )
1097
1181
  ] });
1098
- }, ro = () => {
1099
- const [t] = I(), [e, o] = f(), [n, a] = f(!1), [l, i] = f(""), { hasFocus: d } = et(), { refs: c, floatingStyles: s, context: h } = Z({
1182
+ }, kn = () => {
1183
+ const [t] = y(), e = et(null), [r, o] = b(null), [i, l] = b(""), { hasFocus: a } = ot();
1184
+ N(() => {
1185
+ r ? t.update(() => {
1186
+ l(r.getURL());
1187
+ }) : l("");
1188
+ }, [t, r]);
1189
+ const s = !!(r && i && a), { refs: d, floatingStyles: c, context: g } = rt({
1100
1190
  placement: "top",
1101
1191
  strategy: "fixed",
1102
- open: !!e,
1103
- whileElementsMounted: kt,
1192
+ open: s,
1193
+ whileElementsMounted: yt,
1104
1194
  elements: {
1105
- reference: e
1195
+ reference: e.current
1106
1196
  },
1107
- middleware: [ye()]
1108
- }), { getFloatingProps: g } = Ct([
1109
- Mt(h),
1110
- Te(h)
1111
- ]), m = L(() => {
1112
- var x;
1113
- const M = T();
1114
- if (y(M)) {
1115
- const S = St(M), u = S.getParent(), wt = F(S, P), It = F(S, Yt);
1116
- a(wt !== null && It === null), P(u) ? i(u.getURL()) : P(S) ? i(S.getURL()) : i("");
1197
+ middleware: [Ie()]
1198
+ }), { getFloatingProps: u } = Et([
1199
+ St(g),
1200
+ _e(g)
1201
+ ]), f = v(() => {
1202
+ var E;
1203
+ const k = L();
1204
+ if (T(k)) {
1205
+ const D = At(k), h = D.getParent();
1206
+ let H = null;
1207
+ if (W(h) ? H = h : W(D) && (H = D), H) {
1208
+ const q = window.getSelection(), it = t.getRootElement();
1209
+ k !== null && q !== null && it !== null && it.contains(q.anchorNode) && t.isEditable() && (e.current = ((E = q.focusNode) == null ? void 0 : E.parentElement) ?? null);
1210
+ }
1211
+ o(H);
1117
1212
  }
1118
- const N = window.getSelection(), k = t.getRootElement();
1119
- M !== null && N !== null && k !== null && k.contains(N.anchorNode) && t.isEditable() && o(((x = N.focusNode) == null ? void 0 : x.parentElement) ?? void 0);
1120
- }, [t]);
1121
- return E(() => {
1213
+ }, [t]), S = v(() => {
1214
+ r && _r(r) && t.update(() => {
1215
+ r.remove();
1216
+ }), t.dispatchCommand(Z, null);
1217
+ }, [t, r]);
1218
+ if (N(() => {
1122
1219
  t.getEditorState().read(() => {
1123
- m();
1220
+ f();
1124
1221
  });
1125
- }, [t, m]), E(() => tt(
1126
- t.registerUpdateListener(({ editorState: M }) => {
1127
- M.read(() => {
1128
- m();
1222
+ }, [t, f]), N(() => nt(
1223
+ t.registerUpdateListener(({ editorState: k }) => {
1224
+ k.read(() => {
1225
+ f();
1129
1226
  });
1130
1227
  }),
1131
1228
  t.registerCommand(
1132
- A,
1133
- () => (m(), !0),
1229
+ F,
1230
+ () => (f(), !0),
1134
1231
  w
1135
1232
  ),
1136
1233
  t.registerCommand(
1137
- ht,
1138
- () => n ? (a(!1), !0) : !1,
1139
- Wt
1234
+ kt,
1235
+ () => r ? (o(null), !0) : !1,
1236
+ Zt
1140
1237
  )
1141
- ), [t, m, n]), n && d ? /* @__PURE__ */ r(bt, { children: /* @__PURE__ */ C(
1142
- Lt,
1238
+ ), [t, f, r]), !s)
1239
+ return null;
1240
+ const x = Bt(i);
1241
+ return /* @__PURE__ */ n(wt, { children: /* @__PURE__ */ m(
1242
+ Rt,
1143
1243
  {
1144
- ref: c.setFloating,
1244
+ ref: d.setFloating,
1145
1245
  css: {
1146
1246
  padding: "$2 $4",
1147
1247
  // Make sure this renders above the toolbar
1148
- zIndex: "calc(var(--zIndices-overlayCard) + 1)"
1248
+ zIndex: "calc(var(--zIndices-overlayCard) + 1)",
1249
+ display: "flex",
1250
+ alignItems: "center"
1149
1251
  },
1150
- style: s,
1151
- ...g(),
1252
+ style: c,
1253
+ ...u(),
1152
1254
  children: [
1153
- /* @__PURE__ */ r("a", { href: xt(l), target: "_blank", rel: "noreferrer", children: l }),
1154
- /* @__PURE__ */ r(
1155
- D,
1255
+ /* @__PURE__ */ n(
1256
+ P,
1156
1257
  {
1157
- onClick: () => {
1158
- t.dispatchCommand(Y, null);
1258
+ as: "a",
1259
+ css: {
1260
+ display: "inline-block",
1261
+ maxWidth: "300px",
1262
+ overflow: "hidden",
1263
+ textOverflow: "ellipsis",
1264
+ marginRight: "$4"
1159
1265
  },
1160
- children: /* @__PURE__ */ r(we, {})
1266
+ href: x,
1267
+ title: x,
1268
+ target: "_blank",
1269
+ rel: "noreferrer",
1270
+ children: i
1161
1271
  }
1162
- )
1272
+ ),
1273
+ /* @__PURE__ */ n($, { color: "danger", icon: !0, size: "sm", onClick: S, children: /* @__PURE__ */ n(Be, { size: 24 }) })
1163
1274
  ]
1164
1275
  }
1165
- ) }) : null;
1276
+ ) });
1166
1277
  };
1167
1278
  export {
1168
- gr as FloatingToolbar,
1169
- ro as LinkEditPlugin,
1170
- eo as LinkToolbarButton,
1171
- Jr as RichTextEditor,
1172
- fr as RichTextToolbar,
1173
- to as TableEditPlugin,
1174
- Ae as clearEditorState,
1175
- Vr as defaultNodes,
1176
- Pe as isEditorState,
1177
- Tt as isJSON,
1178
- yt as richTextContext,
1179
- Zr as richTextCss,
1180
- Be as setStateFromPlainText,
1181
- Qr as stateToHTML,
1182
- Ke as useHasFocusWithin,
1183
- et as useRichTextContext
1279
+ Pt as $createRutineLinkNode,
1280
+ _r as $isRutineLinkNode,
1281
+ Lr as FloatingToolbar,
1282
+ kn as LinkEditPlugin,
1283
+ mn as LinkToolbarButton,
1284
+ hn as RichTextEditor,
1285
+ Tr as RichTextToolbar,
1286
+ R as RutineLinkNode,
1287
+ fn as RutineLinkNodeInit,
1288
+ gn as TableEditPlugin,
1289
+ Ke as clearEditorState,
1290
+ un as defaultNodes,
1291
+ je as isEditorState,
1292
+ zt as isJSON,
1293
+ $t as richTextContext,
1294
+ pn as richTextCss,
1295
+ Ye as setStateFromPlainText,
1296
+ dn as stateToHTML,
1297
+ Ze as useHasFocusWithin,
1298
+ ot as useRichTextContext
1184
1299
  };