reactjs-tiptap-editor 1.0.6 → 1.0.7
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.
- package/lib/{ActionMenuButton-htJNI0Fa.js → ActionMenuButton-fTe9ka2F.js} +10 -13
- package/lib/ActionMenuButton-wU6jxKJv.cjs +1 -0
- package/lib/Attachment.cjs +2 -2
- package/lib/Attachment.js +23 -25
- package/lib/Blockquote.cjs +2 -2
- package/lib/Blockquote.js +5 -6
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +5 -6
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +11 -12
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +3 -3
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +9 -10
- package/lib/CodeBlock.cjs +39 -39
- package/lib/CodeBlock.js +837 -946
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +8 -9
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +20 -21
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +5 -6
- package/lib/Drawer-BGSwHoka.cjs +1 -0
- package/lib/{Drawer-1211urKj.js → Drawer-DmtILKW4.js} +16 -17
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +3 -3
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +15 -16
- package/lib/Excalidraw-BG2U9i30.cjs +1 -0
- package/lib/{Excalidraw-Du3hBR8t.js → Excalidraw-CrG8fW-7.js} +31 -32
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +2 -2
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.js +17 -18
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +5 -6
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +5 -5
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +5 -5
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +15 -15
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +10 -11
- package/lib/History.cjs +1 -1
- package/lib/History.js +8 -10
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +5 -6
- package/lib/Icon-C3j4ls73.cjs +1 -0
- package/lib/{Icon-C-qYUAS1.js → Icon-CysGlJkv.js} +3 -4
- package/lib/{Iframe-DTYTLQE6.js → Iframe-BmqguWbj.js} +13 -14
- package/lib/Iframe-CXDghI6m.cjs +1 -0
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +2 -2
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +48 -49
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +22 -23
- package/lib/ImportWord.cjs +2 -2
- package/lib/ImportWord.js +10 -11
- package/lib/Indent-B1glTHHl.cjs +1 -0
- package/lib/{Indent-jOPn3eUM.js → Indent-BhnGkEaY.js} +24 -25
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +2 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +10 -11
- package/lib/Katex-BKL_6NWF.cjs +4 -0
- package/lib/{Katex-CERSrcTP.js → Katex-D4eBjS34.js} +21 -22
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +2 -2
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +15 -16
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +2 -2
- package/lib/{LinkEditBlock-B5SdhOfa.js → LinkEditBlock-D1eSM0kn.js} +55 -56
- package/lib/{LinkEditBlock-DaxljgJC.cjs → LinkEditBlock-DW17TyCA.cjs} +2 -2
- package/lib/Mention.js +2 -2
- package/lib/Mermaid.cjs +2 -2
- package/lib/Mermaid.js +20 -20
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +19 -21
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +5 -6
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +22 -23
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +14 -14
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +5 -6
- package/lib/{Table-39OkCQbu.js → Table-BIZppoiY.js} +7 -8
- package/lib/Table-CIzgfvr9.cjs +9 -0
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +13 -14
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +17 -19
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +17 -19
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +5 -6
- package/lib/{Twitter-D7PhLycr.js → Twitter-DhczYjbR.js} +21 -22
- package/lib/Twitter-DwWVNAV5.cjs +1 -0
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +2 -2
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +24 -25
- package/lib/bubble.cjs +4 -4
- package/lib/bubble.js +419 -421
- package/lib/button-B6ukqDUf.cjs +1 -0
- package/lib/{button-Crm67hfl.js → button-C81t4pb1.js} +3 -4
- package/lib/{checkbox-DViVmgJ6.js → checkbox-CUE9ex4D.js} +1 -1
- package/lib/{checkbox-NQC2MdGT.cjs → checkbox-ZdxysUFa.cjs} +1 -1
- package/lib/{dialog-DaHBd2zw.cjs → dialog-Cfx8yjkr.cjs} +1 -1
- package/lib/{dialog-Ce9Cjfft.js → dialog-DMJStzBb.js} +1 -1
- package/lib/{dropdown-menu-CQykJhBs.js → dropdown-menu-B8iyTZcP.js} +1 -1
- package/lib/{dropdown-menu-CSCDQtq0.cjs → dropdown-menu-Busg3FNn.cjs} +1 -1
- package/lib/{index-DuZCJJSp.js → index--knBGB61.js} +1118 -504
- package/lib/{index-nFjllrEl.js → index-BvYjBPF9.js} +7 -7
- package/lib/index-D42xFOzI.cjs +7 -0
- package/lib/{index-D-FhWysc.js → index-Dwt9--mS.js} +1 -1
- package/lib/{index-BeUrdBxf.js → index-RKufd2EL.js} +1 -1
- package/lib/{index-prphFVsp.js → index-ccgHvIfu.js} +1 -1
- package/lib/index.cjs +2 -2
- package/lib/index.js +8 -9
- package/lib/{input-tU3H__39.cjs → input-BxzQAIRv.cjs} +1 -1
- package/lib/{input-DfqFAyKo.js → input-DR_5pbuA.js} +1 -1
- package/lib/{isNumber-CTm1pIvN.js → isNumber-1y3eeW-y.js} +1 -1
- package/lib/label-BfWfLggp.cjs +1 -0
- package/lib/label-D-0oXKCn.js +18 -0
- package/lib/{popover-CoepUobG.js → popover-D3spkemr.js} +1 -1
- package/lib/{popover-CZWSQZ0q.cjs → popover-sP8CwbV-.cjs} +1 -1
- package/lib/{separator-6SnwzytZ.js → separator-rM48NeAo.js} +18 -18
- package/lib/{separator-DCQD8P6s.cjs → separator-yycaNdlI.cjs} +1 -1
- package/lib/{store-726Zjszt.cjs → store-BajRl43v.cjs} +1 -1
- package/lib/{store-ibARMQ3h.js → store-NKeQOve_.js} +1 -1
- package/lib/{tabs-DrkJL_C2.js → tabs-Cb6Bmpbb.js} +1 -1
- package/lib/{tabs-B_ArrG09.cjs → tabs-D2nCIOVL.cjs} +1 -1
- package/lib/{textarea-CIs52G8B.js → textarea-BYZu1lUC.js} +1 -1
- package/lib/{textarea-CmZVZKOo.cjs → textarea-Cbwi_h4h.cjs} +1 -1
- package/lib/{throttle-CGM5M2yG.js → throttle-CjwXmkIY.js} +1 -1
- package/lib/{updatePosition-DpMKxYdN.js → updatePosition-BAGpT34H.js} +1 -1
- package/lib/{useButtonProps-D0SrPzuG.js → useButtonProps-BIH_9bXT.js} +35 -47
- package/lib/useButtonProps-TfmRCM9r.cjs +1 -0
- package/package.json +5 -1
- package/lib/ActionMenuButton-DYT5chmX.cjs +0 -1
- package/lib/Drawer-DUFUd5BW.cjs +0 -1
- package/lib/Excalidraw-CajgZDjU.cjs +0 -1
- package/lib/Icon-BjR_or8V.cjs +0 -1
- package/lib/Iframe-CM6mRQmv.cjs +0 -1
- package/lib/Indent-BmhiEb0S.cjs +0 -1
- package/lib/Katex-CUd3LxLh.cjs +0 -4
- package/lib/Table-3VstSlg4.cjs +0 -9
- package/lib/Twitter-DuHPeVW1.cjs +0 -1
- package/lib/button-xNppt_aK.cjs +0 -1
- package/lib/index-BQ17A_37.js +0 -393
- package/lib/index-CNzHZDls.cjs +0 -7
- package/lib/index-DmOTQudI.cjs +0 -1
- package/lib/label-DC33TZy_.js +0 -19
- package/lib/label-DkDE77kc.cjs +0 -1
- package/lib/toggle-DVCNvcqp.cjs +0 -1
- package/lib/toggle-xchtz-Kf.js +0 -92
- package/lib/tooltip-BTFcHrd9.js +0 -24
- package/lib/tooltip-DFjcKu9a.cjs +0 -1
- package/lib/useButtonProps-bei1vI37.cjs +0 -1
|
@@ -1,24 +1,14 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { useState as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { u as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return l === void 0 && (l = navigator.platform.includes("Mac")), l;
|
|
9
|
-
}
|
|
10
|
-
function x(t) {
|
|
11
|
-
return `${t}`.toLowerCase() === "mod" ? p() ? "⌘" : "Ctrl" : `${t}`.toLowerCase() === "alt" ? p() ? "⌥" : "Alt" : `${t}`.toLowerCase() === "shift" ? p() ? "⇧" : "Shift" : t;
|
|
12
|
-
}
|
|
13
|
-
function F(t) {
|
|
14
|
-
return t.map(x).join(" ");
|
|
15
|
-
}
|
|
16
|
-
function D(t) {
|
|
17
|
-
const { editor: n } = h(), r = E.useMemo(
|
|
1
|
+
import * as S from "react";
|
|
2
|
+
import { useState as l, useEffect as p, useMemo as a } from "react";
|
|
3
|
+
import { k as m } from "./index--knBGB61.js";
|
|
4
|
+
import { H as E, I as g } from "./index-BvYjBPF9.js";
|
|
5
|
+
import { u as x } from "./index-0OnGZkVF.js";
|
|
6
|
+
function y(t) {
|
|
7
|
+
const { editor: n } = E(), r = S.useMemo(
|
|
18
8
|
() => n,
|
|
19
9
|
[t, n]
|
|
20
10
|
);
|
|
21
|
-
return
|
|
11
|
+
return g({
|
|
22
12
|
editor: r,
|
|
23
13
|
selector(e) {
|
|
24
14
|
return e.editor ? {
|
|
@@ -34,15 +24,15 @@ function D(t) {
|
|
|
34
24
|
}) || { editor: null };
|
|
35
25
|
}
|
|
36
26
|
function f() {
|
|
37
|
-
return
|
|
27
|
+
return y().editor;
|
|
38
28
|
}
|
|
39
|
-
const
|
|
40
|
-
function
|
|
41
|
-
const n =
|
|
29
|
+
const b = () => !1;
|
|
30
|
+
function I(t = b) {
|
|
31
|
+
const n = m(), [r, o] = l(() => {
|
|
42
32
|
const s = t();
|
|
43
33
|
return typeof s == "boolean" ? !s : s;
|
|
44
34
|
}), e = f();
|
|
45
|
-
|
|
35
|
+
p(() => {
|
|
46
36
|
if (!e || !t) return;
|
|
47
37
|
const s = () => {
|
|
48
38
|
const c = t();
|
|
@@ -61,9 +51,9 @@ function K(t = g) {
|
|
|
61
51
|
editorDisabled: i
|
|
62
52
|
};
|
|
63
53
|
}
|
|
64
|
-
function
|
|
65
|
-
const n =
|
|
66
|
-
|
|
54
|
+
function T(t = b) {
|
|
55
|
+
const n = m(), [r, o] = l({}), [e, u] = l(t()), i = f();
|
|
56
|
+
p(() => {
|
|
67
57
|
if (!i || !t) return;
|
|
68
58
|
const d = () => {
|
|
69
59
|
u(t());
|
|
@@ -83,38 +73,38 @@ function O(t = g) {
|
|
|
83
73
|
// force update
|
|
84
74
|
};
|
|
85
75
|
}
|
|
86
|
-
function
|
|
76
|
+
function D(t) {
|
|
87
77
|
const n = f();
|
|
88
78
|
return a(() => n ? n.extensionManager.extensions.find((o) => o.name === t) : null, [n, t]);
|
|
89
79
|
}
|
|
90
|
-
function
|
|
80
|
+
function V(t, n, r) {
|
|
91
81
|
return t < n ? n : t > r ? r : t;
|
|
92
82
|
}
|
|
93
|
-
const
|
|
94
|
-
function
|
|
83
|
+
const U = (t) => typeof t == "number", h = (t) => typeof t == "string", M = (t) => typeof t == "function";
|
|
84
|
+
function k(t, n = "px") {
|
|
95
85
|
if (!t)
|
|
96
86
|
return t;
|
|
97
|
-
const r =
|
|
87
|
+
const r = U(t) ? String(t) : t, o = Number.parseFloat(r), e = r.match(/[%a-z]+$/i), u = e ? e[0] : n;
|
|
98
88
|
return Number.isNaN(o) ? t : o + u;
|
|
99
89
|
}
|
|
100
|
-
function
|
|
90
|
+
function z(t, n) {
|
|
101
91
|
if (!t)
|
|
102
92
|
return !1;
|
|
103
93
|
const { extensions: r = [] } = (t == null ? void 0 : t.extensionManager) ?? {};
|
|
104
94
|
return !!r.find((e) => e.name === n);
|
|
105
95
|
}
|
|
106
|
-
function z(t) {
|
|
107
|
-
return t.map((n) => N(n) ? { value: n, name: n } : n);
|
|
108
|
-
}
|
|
109
96
|
function B(t) {
|
|
110
|
-
|
|
97
|
+
return t.map((n) => h(n) ? { value: n, name: n } : n);
|
|
98
|
+
}
|
|
99
|
+
function H(t) {
|
|
100
|
+
const n = f(), r = D(t), { t: o } = x();
|
|
111
101
|
return a(() => {
|
|
112
102
|
if (!n || !r)
|
|
113
103
|
return null;
|
|
114
104
|
const {
|
|
115
105
|
button: e
|
|
116
106
|
} = r.options;
|
|
117
|
-
return !e || !
|
|
107
|
+
return !e || !M(e) ? null : e({
|
|
118
108
|
editor: n,
|
|
119
109
|
extension: r,
|
|
120
110
|
t: o
|
|
@@ -122,15 +112,13 @@ function B(t) {
|
|
|
122
112
|
}, [n, r, o]);
|
|
123
113
|
}
|
|
124
114
|
export {
|
|
125
|
-
|
|
126
|
-
|
|
115
|
+
T as a,
|
|
116
|
+
I as b,
|
|
127
117
|
f as c,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
V as j,
|
|
135
|
-
B as u
|
|
118
|
+
D as d,
|
|
119
|
+
B as e,
|
|
120
|
+
V as f,
|
|
121
|
+
k as g,
|
|
122
|
+
z as h,
|
|
123
|
+
H as u
|
|
136
124
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const s=require("react"),p=require("./index-D42xFOzI.cjs"),l=require("./index-DLqogznp.cjs"),g=require("./index-FSRjMsxW.cjs");function E(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const S=E(s);function M(t){const{editor:e}=l.useCurrentEditor(),n=S.useMemo(()=>e,[t,e]);return l.useEditorState({editor:n,selector(o){return o.editor?{editor:o.editor,editorState:o.editor.state,canCommand:o.editor.can}:{editor:null,editorState:void 0,canCommand:void 0}}})||{editor:null}}function f(){return M().editor}const b=()=>!1;function x(t=b){const e=p.useEditableEditor(),[n,r]=s.useState(()=>{const u=t();return typeof u=="boolean"?!u:u}),o=f();s.useEffect(()=>{if(!o||!t)return;const u=()=>{const c=t();r(typeof c=="boolean"?!c:c)};return u(),o.on("selectionUpdate",u),o.on("transaction",u),()=>{o.off("selectionUpdate",u),o.off("transaction",u)}},[o,t]);const a=s.useMemo(()=>!e||!o?!0:typeof n=="boolean"?n:!1,[e,o,n]),i=s.useMemo(()=>!e||!o,[e,o]);return{disabled:a,dataState:n,editorDisabled:i}}function y(t=b){const e=p.useEditableEditor(),[n,r]=s.useState({}),[o,a]=s.useState(t()),i=f();s.useEffect(()=>{if(!i||!t)return;const d=()=>{a(t())};return d(),i.on("selectionUpdate",d),()=>{i.off("selectionUpdate",d)}},[n,i,t]);const u=s.useMemo(()=>!e||!i,[e,i]),c=s.useMemo(()=>!e||!i,[e,i]);return{disabled:u,dataState:o,editorDisabled:c,update:()=>r({})}}function m(t){const e=f();return s.useMemo(()=>e?e.extensionManager.extensions.find(r=>r.name===t):null,[e,t])}function D(t,e,n){return t<e?e:t>n?n:t}const N=t=>typeof t=="number",O=t=>typeof t=="string",U=t=>typeof t=="function";function h(t,e="px"){if(!t)return t;const n=N(t)?String(t):t,r=Number.parseFloat(n),o=n.match(/[%a-z]+$/i),a=o?o[0]:e;return Number.isNaN(r)?t:r+a}function P(t,e){if(!t)return!1;const{extensions:n=[]}=(t==null?void 0:t.extensionManager)??{};return!!n.find(o=>o.name===e)}function C(t){return t.map(e=>O(e)?{value:e,name:e}:e)}function j(t){const e=f(),n=m(t),{t:r}=g.useLocale();return s.useMemo(()=>{if(!e||!n)return null;const{button:o}=n.options;return!o||!U(o)?null:o({editor:e,extension:n,t:r})},[e,n,r])}exports.clamp=D;exports.ensureNameValueOptions=C;exports.getCssUnitWithDefault=h;exports.hasExtension=P;exports.useActive=x;exports.useButtonProps=j;exports.useEditorInstance=f;exports.useExtension=m;exports.useToggleActive=y;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reactjs-tiptap-editor",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.7",
|
|
5
5
|
"packageManager": "pnpm@8.15.9",
|
|
6
6
|
"description": "A modern WYSIWYG rich text editor based on tiptap and shadcn ui for React",
|
|
7
7
|
"license": "MIT",
|
|
@@ -33,6 +33,10 @@
|
|
|
33
33
|
"types": "./lib/index.d.ts",
|
|
34
34
|
"pnpm": {
|
|
35
35
|
"overrides": {
|
|
36
|
+
"@excalidraw/mermaid-to-excalidraw": "2.0.0",
|
|
37
|
+
"@excalidraw/mermaid-to-excalidraw>nanoid": "5.1.6",
|
|
38
|
+
"@excalidraw/excalidraw>nanoid": "3.3.11",
|
|
39
|
+
"esbuild": "0.25.12",
|
|
36
40
|
"prosemirror-view": "1.41.1"
|
|
37
41
|
}
|
|
38
42
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),a=require("react"),s=require("@radix-ui/react-slot");require("./index-CNzHZDls.cjs");const d=require("./useButtonProps-bei1vI37.cjs"),u=require("./button-xNppt_aK.cjs"),m=require("./index-DmOTQudI.cjs"),c=require("./tooltip-DFjcKu9a.cjs"),f=a.forwardRef(({asChild:h=!1,tooltip:i,...t},r)=>{var x;const n=m.icons[t.icon],l=h?s.Slot:u.Button;return e.jsxs(c.Tooltip,{children:[e.jsx(c.TooltipTrigger,{asChild:!0,children:e.jsx(l,{className:"richtext-h-[32px] richtext-min-w-24 richtext-overflow-hidden richtext-px-[5px] richtext-py-0","data-state":t!=null&&t.dataState?"on":"off",disabled:t==null?void 0:t.disabled,ref:r,variant:"ghost",...t,children:e.jsxs("div",{className:"richtext-flex richtext-h-full richtext-items-center richtext-font-normal",children:[(t==null?void 0:t.title)&&e.jsx("div",{className:"richtext-grow richtext-truncate richtext-text-left richtext-text-sm",children:t==null?void 0:t.title}),n&&e.jsx(n,{className:"richtext-ml-1 richtext-size-3 richtext-shrink-0 richtext-text-zinc-500"})]})})}),i&&e.jsx(c.TooltipContent,{children:e.jsxs("div",{className:"richtext-flex richtext-max-w-24 richtext-flex-col richtext-items-center richtext-text-center",children:[i&&e.jsx("div",{children:i}),e.jsx("div",{className:"richtext-flex",children:!!((x=t==null?void 0:t.shortcutKeys)!=null&&x.length)&&e.jsx("span",{children:d.getShortcutKeys(t==null?void 0:t.shortcutKeys)})})]})})]})});exports.ActionMenuButton=f;
|
package/lib/Drawer-DUFUd5BW.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const I=require("./index-DLqogznp.cjs"),G=require("./throttle-DXN-aiH5.cjs"),e=require("react/jsx-runtime"),g=require("react"),B=require("./index-FSRjMsxW.cjs"),F=require("./useButtonProps-bei1vI37.cjs"),d=require("easydrawer"),Z=require("./shortId-Bfj8TyNr.cjs"),J=require("./toggle-DVCNvcqp.cjs"),P=require("./dialog-DaHBd2zw.cjs"),m=require("./index-CNzHZDls.cjs"),ee=require("./file-i7e4nQY2.cjs"),te=require("./button-xNppt_aK.cjs"),W={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function oe({editor:t,node:o,updateAttributes:r,getPos:s,selected:f}){const[M,H]=g.useState({width:B.IMAGE_MAX_SIZE,height:B.IMAGE_MAX_SIZE}),[w,h]=g.useState({width:0,height:0}),[L]=g.useState([W.TOP_LEFT,W.TOP_RIGHT,W.BOTTOM_LEFT,W.BOTTOM_RIGHT]),[j,_]=g.useState(!1),[a,c]=g.useState({x:0,y:0,w:0,h:0,dir:""}),{align:T}=o==null?void 0:o.attrs,C=g.useMemo(()=>{const{src:u,alt:y,width:S,height:N}=o==null?void 0:o.attrs,z=I.isNumber(S)?`${S}px`:S,v=I.isNumber(N)?`${N}px`:N;return{src:u||void 0,alt:y||void 0,style:{width:z||void 0,height:v||void 0}}},[o==null?void 0:o.attrs]),n=g.useMemo(()=>{const{style:{width:u}}=C;return{width:u==="100%"?u:void 0}},[C]);function O(u){h({width:u.target.width,height:u.target.height})}function A(){t.commands.setNodeSelection(s())}const D=g.useCallback(G.throttle(()=>{const{width:u}=getComputedStyle(t.view.dom);H(y=>({...y,width:Number.parseInt(u,10)}))},B.IMAGE_THROTTLE_WAIT_TIME),[t]);function V(u,y){u.preventDefault(),u.stopPropagation();const S=w.width,N=w.height,z=S/N;let v=Number(o.attrs.width),E=Number(o.attrs.height);const b=M.width;v&&!E?(v=v>b?b:v,E=Math.round(v/z)):E&&!v?(v=Math.round(E*z),v=v>b?b:v):!v&&!E?(v=S>b?b:S,E=Math.round(v/z)):v=v>b?b:v,_(!0),c({x:u.clientX,y:u.clientY,w:v,h:E,dir:y})}const x=g.useCallback(G.throttle(u=>{if(u.preventDefault(),u.stopPropagation(),!j)return;const{x:y,w:S,dir:N}=a,z=(u.clientX-y)*(/l/.test(N)?-1:1),{width:v,height:E}=o==null?void 0:o.attrs,b=v/E,U=F.clamp(S+z,B.IMAGE_MIN_SIZE,M.width),Y=Math.round(U/b);r({width:U,height:Y})},B.IMAGE_THROTTLE_WAIT_TIME),[j,a,M,r,o==null?void 0:o.attrs]),i=g.useCallback(u=>{u.preventDefault(),u.stopPropagation(),j&&(c({x:0,y:0,w:0,h:0,dir:""}),_(!1),A())},[j,A]),p=g.useCallback(()=>{document==null||document.addEventListener("mousemove",x,!0),document==null||document.addEventListener("mouseup",i,!0)},[x,i]),k=g.useCallback(()=>{document==null||document.removeEventListener("mousemove",x,!0),document==null||document.removeEventListener("mouseup",i,!0)},[x,i]);g.useEffect(()=>(j?p():k(),()=>{k()}),[j,p,k]);const q=g.useMemo(()=>new ResizeObserver(()=>D()),[D]);return g.useEffect(()=>(q.observe(t.view.dom),()=>{q.disconnect()}),[t.view.dom,q]),e.jsx(I.NodeViewWrapper,{className:"image-view",style:{...n,width:"100%",textAlign:T},children:e.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:{...n,background:"#fff"},className:`image-view__body ${f?"image-view__body--focused":""} ${j?"image-view__body--resizing":""}`,children:[e.jsx("img",{alt:C.alt,className:"image-view__body__image block",height:"auto",onClick:A,onLoad:O,src:C.src,style:C.style}),t.view.editable&&(f||j)&&e.jsx("div",{className:"image-resizer",children:L==null?void 0:L.map(u=>e.jsx("span",{className:`image-resizer__handler image-resizer__handler--${u}`,onMouseDown:y=>V(y,u)},`image-dir-${u}`))})]})})}const re="_wrapper_rraz2_1",le="_tool_rraz2_17",ne="_active_rraz2_37",se="_pen_rraz2_41",ie="_line_rraz2_48",ae="_options_rraz2_56",ce="_colorWrap_rraz2_66",he="_color_rraz2_66",ue="_colorActive_rraz2_83",l={wrapper:re,tool:le,active:ne,pen:se,line:ie,options:ae,colorWrap:ce,color:he,colorActive:ue};function de(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{color:"currentColor",d:"M2 9.2v3.6M12.8 2H9.2M7.5 20H9M20 7.5V9M2.133 4.699c.155-.727.415-1.274.854-1.712c.426-.426.954-.684 1.652-.84m15.228 2.552c-.155-.727-.415-1.274-.854-1.712c-.417-.417-.932-.673-1.608-.83M4.64 19.853c-.698-.156-1.226-.414-1.652-.84c-.43-.43-.69-.965-.845-1.673m11.638 3.626c-1.812.125-3.607-8.326-2.374-9.559s9.684.561 9.559 2.373c-.087 1.187-2.095 1.656-2.037 2.711c.018.309.408.59 1.188 1.154c.543.39 1.096.77 1.629 1.175a.66.66 0 0 1 .234.687a3.35 3.35 0 0 1-2.472 2.473a.66.66 0 0 1-.688-.235c-.404-.533-.784-1.086-1.175-1.628c-.563-.78-.844-1.17-1.153-1.188c-1.055-.059-1.524 1.95-2.71 2.037",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})})}function ge(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M20.06 18a4 4 0 0 1-.2-.89c-.67.7-1.48 1.05-2.41 1.05c-.83 0-1.52-.24-2.05-.71c-.53-.45-.8-1.06-.8-1.79c0-.88.33-1.56 1-2.05s1.61-.73 2.83-.73h1.4v-.64q0-.735-.45-1.17c-.3-.29-.75-.43-1.33-.43c-.52 0-.95.12-1.3.36c-.35.25-.52.54-.52.89h-1.46c0-.43.15-.84.45-1.24c.28-.4.71-.71 1.22-.94c.51-.21 1.06-.35 1.69-.35c.98 0 1.74.24 2.29.73s.84 1.16.86 2.02V16c0 .8.1 1.42.3 1.88V18zm-2.4-1.12c.45 0 .88-.11 1.29-.32c.4-.21.7-.49.88-.83v-1.57H18.7c-1.77 0-2.66.47-2.66 1.41c0 .43.15.73.46.96c.3.23.68.35 1.16.35m-12.2-3.17h4.07L7.5 8.29zM6.64 6h1.72l4.71 12h-1.93l-.97-2.57H4.82L3.86 18H1.93z",fill:"currentColor"})})}function me(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M3 21v-4.25L16.2 3.575q.3-.275.663-.425t.762-.15t.775.15t.65.45L20.425 5q.3.275.438.65T21 6.4q0 .4-.137.763t-.438.662L7.25 21zM17.6 7.8L19 6.4L17.6 5l-1.4 1.4z",fill:"currentColor"})})}function xe(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 256 256",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M253.66 106.34a8 8 0 0 0-11.32 0L192 156.69L107.31 72l50.35-50.34a8 8 0 1 0-11.32-11.32L96 60.69a16 16 0 0 0-2.82 18.81L72 100.69a16 16 0 0 0 0 22.62l4.69 4.69l-58.35 58.34a8 8 0 0 0 3.13 13.25l72 24A7.9 7.9 0 0 0 96 224a8 8 0 0 0 5.66-2.34L136 187.31l4.69 4.69a16 16 0 0 0 22.62 0l21.19-21.18a16 16 0 0 0 18.81-2.82l50.35-50.34a8 8 0 0 0 0-11.32M93.84 206.85l-55-18.35L88 139.31L124.69 176ZM152 180.69L83.31 112L104 91.31L172.69 160Z",fill:"currentColor"})})}function pe(t){return e.jsxs("svg",{height:"1em",viewBox:"0 0 16 16",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:[e.jsx("path",{d:"m2.648 9.937l7.29-7.288a2.21 2.21 0 0 1 3.124 0l2.29 2.288a2.21 2.21 0 0 1 0 3.126L10.413 13H12.5a.5.5 0 0 1 0 1H4.501a2.2 2.2 0 0 1-1.563-.647l.707-.707c.227.226.535.354.856.354h4.005a1.2 1.2 0 0 0 .848-.354l1.292-1.293l-4-4l-3.29 3.291a1.21 1.21 0 0 0 0 1.712l.29.29l-.708.707l-.29-.29a2.21 2.21 0 0 1 0-3.126M8 6h6.89a1.2 1.2 0 0 0-.246-.356L14 5H9zm2-2h3l-.645-.644a1.21 1.21 0 0 0-1.71 0zm4.89 3H7.708l1 1H14l.644-.644A1.2 1.2 0 0 0 14.891 7zM9.708 9l1.646 1.646L13 9z",fill:"currentColor"}),e.jsx("path",{d:"M14 11.5a.5.5 0 1 1-1 0a.5.5 0 0 1 1 0m1.5-.5a.5.5 0 1 0 0-1a.5.5 0 0 0 0 1m-1 2a.5.5 0 0 0 0 1h1a.5.5 0 0 0 0-1z",fill:"currentColor"})]})}function we(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M3 3h18v18H3zm2 2v14h14V5z",fill:"currentColor"})})}function ve(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M2 20V4h20v16zm2-2h16V6H4zm0 0V6z",fill:"currentColor"})})}function Ce(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M12 22q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22m0-2q3.35 0 5.675-2.325T20 12t-2.325-5.675T12 4T6.325 6.325T4 12t2.325 5.675T12 20m0-8",fill:"currentColor"})})}function fe(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M10.363 3.591L2.257 17.125a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636-2.87L13.637 3.59a1.914 1.914 0 0 0-3.274 0z",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})})}function Te(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"m6.8 21l-5.2-9l5.2-9h10.4l5.2 9l-5.2 9zm1.15-2h8.1l4.025-7l-4.025-7h-8.1L3.9 12zM12 12",fill:"currentColor"})})}function je(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsxs("g",{fill:"none",fillRule:"evenodd",children:[e.jsx("path",{d:"m12.594 23.258l-.012.002l-.071.035l-.02.004l-.014-.004l-.071-.036q-.016-.004-.024.006l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.016-.018m.264-.113l-.014.002l-.184.093l-.01.01l-.003.011l.018.43l.005.012l.008.008l.201.092q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.003-.011l.018-.43l-.003-.012l-.01-.01z"}),e.jsx("path",{d:"M10.586 2.807a2 2 0 0 1 2.828 0l7.778 7.779a2 2 0 0 1 0 2.828l-7.778 7.778a2 2 0 0 1-2.828 0l-7.778-7.778a2 2 0 0 1 0-2.828zM12 4.222L4.222 12L12 19.778L19.778 12z",fill:"currentColor"})]})})}function be(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M16.01 11H4v2h12.01v3L20 12l-3.99-4z",fill:"currentColor"})})}function Me(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{clipRule:"evenodd",d:"M7.53 3.47a.75.75 0 0 1 0 1.06L5.81 6.25H15a5.75 5.75 0 0 1 0 11.5H8a.75.75 0 0 1 0-1.5h7a4.25 4.25 0 0 0 0-8.5H5.81l1.72 1.72a.75.75 0 1 1-1.06 1.06l-3-3a.75.75 0 0 1 0-1.06l3-3a.75.75 0 0 1 1.06 0",fill:"currentColor",fillRule:"evenodd"})})}function ye(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{clipRule:"evenodd",d:"M16.47 3.47a.75.75 0 0 1 1.06 0l3 3a.75.75 0 0 1 0 1.06l-3 3a.75.75 0 1 1-1.06-1.06l1.72-1.72H9a4.25 4.25 0 0 0 0 8.5h7a.75.75 0 0 1 0 1.5H9a5.75 5.75 0 0 1 0-11.5h9.19l-1.72-1.72a.75.75 0 0 1 0-1.06",fill:"currentColor",fillRule:"evenodd"})})}function Se(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M7 21q-.825 0-1.412-.587T5 19V6H4V4h5V3h6v1h5v2h-1v13q0 .825-.587 1.413T17 21zm2-4h2V8H9zm4 0h2V8h-2z",fill:"currentColor"})})}function Ee(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 256 256",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M211.81 83.79a28 28 0 0 1-33.12 4.83l-90.07 90.07a28 28 0 1 1-44.43-6.48a28 28 0 0 1 33.12-4.83l90.07-90.07a28 28 0 1 1 44.43 6.48",fill:"currentColor"})})}function He(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M12 20.325q-.35 0-.712-.125t-.638-.4l-1.725-1.575q-2.65-2.425-4.788-4.812T2 8.15Q2 5.8 3.575 4.225T7.5 2.65q1.325 0 2.5.562t2 1.538q.825-.975 2-1.537t2.5-.563q2.35 0 3.925 1.575T22 8.15q0 2.875-2.125 5.275T15.05 18.25l-1.7 1.55q-.275.275-.637.4t-.713.125M11.05 6.75q-.725-1.025-1.55-1.563t-2-.537q-1.5 0-2.5 1t-1 2.5q0 1.3.925 2.763t2.213 2.837t2.65 2.575T12 18.3q.85-.775 2.213-1.975t2.65-2.575t2.212-2.837T20 8.15q0-1.5-1-2.5t-2.5-1q-1.175 0-2 .538T12.95 6.75q-.175.25-.425.375T12 7.25t-.525-.125t-.425-.375m.95 4.725",fill:"currentColor"})})}function Le(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"m7.625 6.4l2.8-3.625q.3-.4.713-.587T12 2t.863.188t.712.587l2.8 3.625l4.25 1.425q.65.2 1.025.738t.375 1.187q0 .3-.088.6t-.287.575l-2.75 3.9l.1 4.1q.025.875-.575 1.475t-1.4.6q-.05 0-.55-.075L12 19.675l-4.475 1.25q-.125.05-.275.063T6.975 21q-.8 0-1.4-.6T5 18.925l.1-4.125l-2.725-3.875q-.2-.275-.288-.575T2 9.75q0-.625.363-1.162t1.012-.763zM8.85 8.125L4 9.725L7.1 14.2L7 18.975l5-1.375l5 1.4l-.1-4.8L20 9.775l-4.85-1.65L12 4zM12 11.5",fill:"currentColor"})})}function ke(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M12.01 6c2.61 0 4.89 1.86 5.4 4.43l.3 1.5l1.52.11c1.56.11 2.78 1.41 2.78 2.96c0 1.65-1.35 3-3 3h-13c-2.21 0-4-1.79-4-4c0-2.05 1.53-3.76 3.56-3.97l1.07-.11l.5-.95A5.46 5.46 0 0 1 12.01 6m0-2C9.12 4 6.6 5.64 5.35 8.04C2.35 8.36.01 10.91.01 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5c0-2.64-2.05-4.78-4.64-4.96C18.68 6.59 15.65 4 12.01 4",fill:"currentColor"})})}function Ne(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M5.586 6.45A2 2 0 0 1 7.509 5h11.84a2 2 0 0 1 1.923 2.55l-2.858 10A2 2 0 0 1 16.491 19H4.651a2 2 0 0 1-1.923-2.55z",fill:"none",stroke:"currentColor",strokeWidth:"2"})})}const ze=[d.Color4.blackHighlight,d.Color4.ofRGBA(166/255,81/255,167/255,.3),d.Color4.ofRGBA(247/255,78/255,158/255,.3),d.Color4.ofRGBA(166/255,83/255,88/255,.3),d.Color4.ofRGBA(246/255,130/255,28/255,.3),d.Color4.ofRGBA(166/255,198/255,0,.3),d.Color4.ofRGBA(98/255,186/255,70/255,.3)],X=[d.Color4.black,d.Color4.fromHex("#007AFF"),d.Color4.fromHex("#A651A7"),d.Color4.fromHex("#F74E9E"),d.Color4.fromHex("#FF5358"),d.Color4.fromHex("#F6821C"),d.Color4.fromHex("#FFC600"),d.Color4.fromHex("#62BA46"),d.Color4.fromHex("#E6BFE8"),d.Color4.fromHex("#FEA3D2"),d.Color4.fromHex("#FFA0A3"),d.Color4.fromHex("#FBC276"),d.Color4.fromHex("#FFFB85"),d.Color4.fromHex("#AADC99")];function _e({onChange:t}){const[o,r]=g.useState(d.Color4.blackHighlight);return e.jsx("div",{className:l.colorWrap,children:ze.map((s,f)=>e.jsx("button",{style:{backgroundColor:s.toHexString()},className:m.cn(l.color,{[l.colorActive]:o.toHexString()===s.toHexString()}),onClick:()=>{r(s),t(s)}},f))})}function $({onChange:t}){const[o,r]=g.useState(d.Color4.black);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:l.colorWrap,children:X.slice(0,7).map((s,f)=>e.jsx("button",{style:{backgroundColor:s.toHexString()},className:m.cn(l.color,{[l.colorActive]:o.toHexString()===s.toHexString()}),onClick:()=>{r(s),t(s)}},f))}),e.jsx("div",{className:l.colorWrap,children:X.slice(7).map((s,f)=>e.jsx("button",{style:{backgroundColor:s.toHexString()},className:m.cn(l.color,{[l.colorActive]:o.toHexString()===s.toHexString()}),onClick:()=>{r(s),t(s)}},f))})]})}function Ae({setColorPen:t,setThicknessPen:o}){const[r,s]=g.useState(2);return e.jsxs("div",{className:l.options,children:[e.jsx("div",{children:e.jsx($,{onChange:f=>t(f)})}),e.jsx("div",{className:l.line}),e.jsx("div",{children:e.jsx("input",{max:10,min:1,step:.1,type:"range",value:r,onChange:f=>{o(Number.parseFloat(f.target.value)),s(Number.parseFloat(f.target.value))}})})]})}function qe({setColorHighlight:t}){return e.jsx("div",{className:l.options,children:e.jsx(_e,{onChange:o=>t(o)})})}function Be({changeColorShape:t,changeBorderColorShape:o,onThicknessChange:r}){return e.jsxs("div",{className:l.options,children:[e.jsx("div",{children:e.jsx($,{onChange:s=>t(s)})}),e.jsx("div",{className:l.line}),e.jsx("div",{children:e.jsx($,{onChange:s=>o(s)})}),e.jsx("div",{className:l.line}),e.jsx("div",{children:e.jsx("input",{defaultValue:0,max:20,min:0,step:1,type:"range",onChange:s=>{r(Number.parseFloat(s.target.value))}})})]})}function K(t){const{setColorPen:o,refEditor:r,setThicknessPen:s,setColorHighlight:f,changeBorderColorShape:M,onUndo:H,changeColorShape:w,changeShape:h,onThicknessChange:L,onRedo:j,onClear:_}=t,[a,c]=g.useState(null),[T,C]=g.useState(0);return e.jsx(e.Fragment,{children:e.jsxs("div",{className:l.wrapper,children:[e.jsxs("div",{className:l.pen,children:[e.jsx("button",{className:m.cn(l.tool,{[l.active]:a==="select"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(a==="select"){c(null),n[0].setEnabled(!1);return}c("select"),n[0].setEnabled(!0)},children:e.jsx(de,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:m.cn(l.tool,{[l.active]:a==="text"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(r.current.toolController.setToolEnabled(n[1]),a==="text"){n[1].setEnabled(!1),c(null);return}c("text"),n[1].setEnabled(!0)},children:e.jsx(ge,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:m.cn(l.tool,{[l.active]:a==="pencil"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(a==="pencil"){c(null),n[2].setEnabled(!1);return}c("pencil"),n[2].setEnabled(!0)},children:e.jsx(me,{})}),e.jsx("button",{className:m.cn(l.tool,{[l.active]:a==="highlighter"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(a==="highlighter"){c(null),n[3].setEnabled(!1);return}c("highlighter"),n[3].setEnabled(!0)},children:e.jsx(xe,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:m.cn(l.tool,{[l.active]:a==="eraser"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(a==="eraser"){c(null),n[4].setEnabled(!1);return}c("eraser"),n[4].setEnabled(!0)},children:e.jsx(pe,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:m.cn(l.tool,{[l.active]:a==="shapes"&&T===0}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),c("shapes"),n[5].setEnabled(!0),h(0),C(0)},children:e.jsx(we,{})}),e.jsx("button",{className:m.cn(l.tool,{[l.active]:a==="shapes"&&T===1}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),c("shapes"),n[5].setEnabled(!0),h(1),C(1)},children:e.jsx(ve,{})}),e.jsx("button",{className:m.cn(l.tool,{[l.active]:a==="shapes"&&T===2}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),c("shapes"),n[5].setEnabled(!0),h(2),C(2)},children:e.jsx(Ce,{})}),e.jsx("button",{className:m.cn(l.tool,{[l.active]:a==="shapes"&&T===3}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),c("shapes"),n[5].setEnabled(!0),h(3),C(3)},children:e.jsx(fe,{})}),e.jsx("button",{className:m.cn(l.tool,{[l.active]:a==="shapes"&&T===4}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),c("shapes"),n[5].setEnabled(!0),h(4),C(4)},children:e.jsx(Te,{})}),e.jsx("button",{className:m.cn(l.tool,{[l.active]:a==="shapes"&&T===5}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),c("shapes"),n[5].setEnabled(!0),h(5),C(5)},children:e.jsx(je,{})}),e.jsx("button",{className:m.cn(l.tool,{[l.active]:a==="shapes"&&T===6}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),c("shapes"),n[5].setEnabled(!0),h(6),C(6)},children:e.jsx(be,{})}),e.jsx("button",{className:m.cn(l.tool,{[l.active]:a==="shapes"&&T===7}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),c("shapes"),n[5].setEnabled(!0),h(7),C(7)},children:e.jsx(Ee,{})}),e.jsx("button",{className:m.cn(l.tool,{[l.active]:a==="shapes"&&T===8}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),c("shapes"),n[5].setEnabled(!0),h(8),C(8)},children:e.jsx(He,{})}),e.jsx("button",{className:m.cn(l.tool,{[l.active]:a==="shapes"&&T===9}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),c("shapes"),n[5].setEnabled(!0),h(9),C(9)},children:e.jsx(Le,{})}),e.jsx("button",{className:m.cn(l.tool,{[l.active]:a==="shapes"&&T===10}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),c("shapes"),n[5].setEnabled(!0),h(10),C(10)},children:e.jsx(ke,{})}),e.jsx("button",{className:m.cn(l.tool,{[l.active]:a==="shapes"&&T===11}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),c("shapes"),n[5].setEnabled(!0),h(11),C(11)},children:e.jsx(Ne,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:m.cn(l.tool),onClick:H,children:e.jsx(Me,{})}),e.jsx("button",{className:m.cn(l.tool),onClick:j,children:e.jsx(ye,{})}),e.jsx("button",{className:m.cn(l.tool),onClick:_,children:e.jsx(Se,{})})]}),e.jsxs("div",{className:l.optionsWrap,children:[a==="pencil"&&e.jsx(Ae,{setColorPen:o,setThicknessPen:s}),a==="highlighter"&&e.jsx(qe,{setColorHighlight:f}),a==="shapes"&&e.jsx(Be,{changeBorderColorShape:M,changeColorShape:w,changeShape:h,onThicknessChange:L})]})]})})}let R=!1;function Pe(){const t=F.useEditorInstance(),o=F.useButtonProps(Q.name),{isActive:r=void 0,upload:s}=(o==null?void 0:o.componentProps)??{},{editorDisabled:f}=F.useToggleActive(r),[M,H]=g.useState(!1),w=g.useRef(null),h=g.useRef(null),L=()=>{(async()=>{const i=document.querySelector("#easydrawer");i&&(w.current=new d.Editor(i,{wheelEventsEnabled:!1,disableZoom:!0}),h.current=d.makeDropdownToolbar(w.current),h.current.addDefaultToolWidgets())})()};g.useEffect(()=>{M&&setTimeout(()=>{L()},200)},[M]);const j=async()=>{if(w.current){const x=w.current.toSVG(),i=x.outerHTML,p=`drawer-${Z.shortId()}.svg`;let k=Z.i(x.outerHTML);if(s){const q=ee.dataURLtoFile(k,p);k=await s(q)}t==null||t.chain().focus().setDrawer({type:"drawer",src:k,alt:encodeURIComponent(i),width:426,height:212},!!i).run()}H(!1)},_=x=>{const i=w.current.toolController.getPrimaryTools()[2],p=h.current.getWidgetById("pen-1");i&&p&&(i.setColor(x),p.serializeState())},a=x=>{const i=w.current.toolController.getPrimaryTools()[2],p=h.current.getWidgetById("pen-1");i&&p&&(i.setThickness(x),p.serializeState())},c=x=>{const i=w.current.toolController.getPrimaryTools()[3],p=h.current.getWidgetById("pen-2");i&&p&&(i.setColor(x),p.serializeState())},T=x=>{const i=h.current.getWidgetById("shape");i&&i.setShapeType(x)},C=x=>{const i=w.current.toolController.getPrimaryTools()[5],p=h.current.getWidgetById("shape");i&&p&&(i.setColor(x),p.serializeState())},n=x=>{const i=w.current.toolController.getPrimaryTools()[5],p=h.current.getWidgetById("shape");i&&p&&(i.setThickness(x),p.serializeState())},O=x=>{const i=w.current.toolController.getPrimaryTools()[5],p=h.current.getWidgetById("shape");i&&p&&(i.setBorderColor(x),p.serializeState())},A=()=>{if(R){for(;w.current.history.redoStackSize>0;)w.current.history.redo();R=!1;return}w.current.history.undo()},D=()=>{R||w.current.history.redo()},V=()=>{if(!R){for(;w.current.history.undoStackSize>0;)A();R=!0}};return o?e.jsxs(P.Dialog,{onOpenChange:H,open:M,children:[e.jsx(P.DialogTrigger,{asChild:!0,children:e.jsx(J.ActionButton,{disabled:f,action:()=>{f||H(!0)},icon:"PencilRuler",tooltip:"Drawer"})}),e.jsxs(P.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[e.jsx(P.DialogTitle,{children:"Drawer"}),e.jsxs("div",{style:{height:"600px",width:"100%",borderWidth:1,background:"white",position:"relative"},children:[e.jsx("div",{className:"richtext-size-full",id:"easydrawer"}),e.jsx(K,{changeBorderColorShape:O,changeColorShape:C,changeShape:T,onClear:V,onRedo:D,onThicknessChange:n,onUndo:A,refEditor:w,setColorHighlight:c,setColorPen:_,setThicknessPen:a})]}),e.jsx(P.DialogFooter,{children:e.jsx(te.Button,{onClick:j,type:"button",children:"Save changes"})})]})]}):e.jsx(e.Fragment,{})}const Q=G.index_default.extend({name:"richTextDrawer",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),inline:!1,content:"",marks:"",group:"block",draggable:!1,selectable:!0,atom:!0,HTMLAttributes:{class:"drawer"},button:({t:o,extension:r})=>{var s;return{componentProps:{action:()=>!0,isActive:()=>!1,disabled:!1,icon:"PencilRuler",tooltip:o("editor.drawer.tooltip"),upload:(s=r==null?void 0:r.options)==null?void 0:s.upload}}}}},addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),width:{default:null,parseHTML:o=>{const r=o.querySelector("img"),s=r==null?void 0:r.getAttribute("width");return s?Number.parseInt(s,10):320},renderHTML:o=>({width:o.width})},height:{default:null,parseHTML:o=>{const r=o.querySelector("img"),s=r==null?void 0:r.getAttribute("height");return s?Number.parseInt(s,10):212},renderHTML:o=>({height:o.height})},align:{default:"center",parseHTML:o=>o.getAttribute("align"),renderHTML:o=>({align:o.align})}}},addNodeView(){return I.ReactNodeViewRenderer(oe)},addCommands(){return{setDrawer:(t,o)=>({commands:r,editor:s})=>o?r.insertContent({type:this.name,attrs:t}):r.insertContentAt(s.state.selection.anchor,{type:this.name,attrs:t}),setAlignImageDrawer:t=>({commands:o})=>o.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:t}){const{align:o}=t;return["div",{style:o?`text-align: ${o};`:"",class:"imageDrawer"},["img",I.mergeAttributes(this.options.HTMLAttributes,t)]]},parseHTML(){return[{tag:"div[class=imageDrawer]",getAttrs:t=>{const o=t.querySelector("img"),r=o==null?void 0:o.getAttribute("width"),s=o==null?void 0:o.getAttribute("height");return{src:o==null?void 0:o.getAttribute("src"),alt:o==null?void 0:o.getAttribute("alt"),width:r?Number.parseInt(r,10):null,height:s?Number.parseInt(s,10):null,align:(o==null?void 0:o.getAttribute("align"))||t.style.textAlign||null}}}]}});exports.ControlDrawer=K;exports.Drawer=Q;exports.RichTextDrawer=Pe;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var B=Object.create;var H=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var U=Object.getPrototypeOf,X=Object.prototype.hasOwnProperty;var F=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of V(t))!X.call(e,a)&&a!==r&&H(e,a,{get:()=>t[a],enumerable:!(n=$(t,a))||n.enumerable});return e};var q=(e,t,r)=>(r=e!=null?B(U(e)):{},F(t||!e||!e.__esModule?H(r,"default",{value:e,enumerable:!0}):r,e));const E=require("./index-DLqogznp.cjs"),s=require("react/jsx-runtime"),i=require("react"),C=require("./toggle-DVCNvcqp.cjs"),A=require("./dialog-DaHBd2zw.cjs"),T=require("./useButtonProps-bei1vI37.cjs"),G=require("re-resizable"),Y=require("./index-CNzHZDls.cjs"),I=require("./dom-dataset-BqoJhJXt.cjs"),J=require("./button-xNppt_aK.cjs");function K(e){return e=e||new Map,{all:e,on(t,r){const n=e.get(t);n?n.push(r):e.set(t,[r])},off(t,r){const n=e.get(t);n&&(r?n.splice(n.indexOf(r)>>>0,1):e.set(t,[]))},emit(t,r){let n=e.get(t);n&&[...n].map(a=>{a(r)}),n=e.get("*"),n&&[...n].map(a=>{a(t,r)})}}}let O;function W(){try{return O||(O=K()),O}catch{throw new Error("Error EventEmitter")}}const R="OPEN_EXCALIDRAW_SETTING_MODAL";function Q(e,t){W().on(e,t)}function ee(e,t){W().off(e,t)}function te(e){W().emit(R,e)}function re(){const e=T.useEditorInstance(),t=T.useButtonProps(L.name),r=T.useExtension(L.name),{tooltipOptions:n={},isActive:a=void 0}=(t==null?void 0:t.componentProps)??{},{editorDisabled:f}=T.useToggleActive(a),u=i.useMemo(()=>(r==null?void 0:r.options)||{},[r]),[c,_]=i.useState(null),[x,M]=i.useState({}),[b,y]=i.useState({elements:[],appState:{isLoading:!1},files:null}),[d,h]=i.useState(!1),[v,j]=i.useState(!0),[m,N]=i.useState(null),o=i.useCallback(p=>{p&&import("@excalidraw/excalidraw").then(g=>{_(g.Excalidraw)}).catch(N).finally(()=>j(!1))},[j]),l=i.useCallback(p=>{setTimeout(()=>{p.refresh()})},[]),w=i.useCallback((p,g,z)=>{M({elements:p,appState:{isLoading:!1},files:z})},[]),D=i.useCallback(()=>{if(!c){h(!1);return}e.chain().focus().setExcalidraw({data:x}).run(),h(!1)},[c,e,x,h]);return i.useEffect(()=>{const p=g=>{(g==null?void 0:g.editor)===e&&(h(!0),g&&y(g.data))};return Q(R,p),()=>{ee(R,p)}},[e,h]),i.useEffect(()=>{!v&&c&&d&&setTimeout(()=>{window.dispatchEvent(new Event("resize"))},400)},[v,c,d]),s.jsxs(A.Dialog,{onOpenChange:h,open:d,children:[s.jsx(A.DialogTrigger,{asChild:!0,children:s.jsx(C.ActionButton,{disabled:f,icon:"Excalidraw",tooltip:"Excalidraw",tooltipOptions:n,action:()=>{f||h(!0)}})}),s.jsxs(A.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[s.jsx(A.DialogTitle,{children:"Excalidraw"}),s.jsxs("div",{style:{height:"100%",borderWidth:1},children:[v&&s.jsx("p",{children:"Loading..."}),m&&s.jsx("p",{children:m&&m.message||"Error"}),s.jsx("div",{ref:o,style:{width:"100%",height:600},children:!v&&!m&&c?s.jsx(c,{initialData:b,langCode:"en",onChange:w,ref:l,...u.excalidrawProps}):null})]}),s.jsx(A.DialogFooter,{children:s.jsx(J.Button,{disabled:!c,onClick:D,type:"button",children:"Save changes"})})]})]})}const ne="_wrap_dra8y_1",se="_renderWrap_dra8y_7",ie="_handlerWrap_dra8y_30",ae="_disabled_dra8y_40",S={wrap:ne,renderWrap:se,handlerWrap:ie,disabled:ae},oe=10,ce=200,k=15,P={width:"100%",height:"100%",maxWidth:"100%"};function de({editor:e,node:t,updateAttributes:r}){const n=i.useRef(null),a=Y.useEditableEditor(),f=e.isActive(L.name),{data:u,width:c,height:_}=t.attrs,[x,M]=i.useState(null),[b,y]=i.useState(!0),[d,h]=i.useState(null),[v,j]=i.useState(100),m=i.useCallback(o=>()=>{j(l=>T.clamp(o==="minus"?l-k:l+k,oe,ce))},[]);i.useEffect(()=>{let o=!1;return import("@excalidraw/excalidraw").then(l=>{o||(n.current=l.exportToSvg)}).catch(l=>!o&&h(l)).finally(()=>!o&&y(!1)),()=>{o=!0}},[u]),i.useEffect(()=>{let o=!1;return(async()=>{if(!n.current||o||b||d||!u)return;const w=await n.current(u);o||(w.setAttribute("width","100%"),w.setAttribute("height","100%"),w.setAttribute("display","block"),M(w))})(),()=>{o=!0}},[u,b,d]);const N=o=>{r({width:o.width,height:o.height})};return s.jsx(E.NodeViewWrapper,{className:E.clsx(S.wrap,{[S.active]:f,[S.disabled]:!a}),children:s.jsx(G.Resizable,{size:{width:Number.parseInt(c),height:Number.parseInt(_)},onResizeStop:(o,l,w,D)=>{N({width:Number.parseInt(c)+D.width,height:Number.parseInt(_)+D.height})},children:s.jsxs("div",{className:E.clsx(S.renderWrap,"render-wrapper"),style:{...P,overflow:"hidden"},children:[d&&s.jsx("div",{style:P,children:s.jsx("p",{children:d.message||d})}),b&&s.jsx("p",{children:"Loading..."}),!b&&!d&&x&&s.jsx("div",{dangerouslySetInnerHTML:{__html:(x==null?void 0:x.outerHTML)??""},style:{height:"100%",maxHeight:"100%",padding:24,overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",transform:`scale(${v/100})`,transition:"all ease-in-out .3s"}}),s.jsxs("div",{className:S.handlerWrap,children:[s.jsx(C.ActionButton,{action:m("minus"),disabled:!a,icon:"ZoomOut",tooltip:"Zoom Out"}),s.jsx(C.ActionButton,{action:m("plus"),disabled:!a,icon:"ZoomIn",tooltip:"Zoom In"})]})]})})})}const Z={elements:[]},L=E.Node3.create({name:"excalidraw",group:"block",selectable:!0,atom:!0,draggable:!0,inline:!1,addAttributes(){return{defaultShowPicker:{default:!1},createUser:{default:null},width:{default:"100%",parseHTML:I.getDatasetAttribute("width")},height:{default:240,parseHTML:I.getDatasetAttribute("height")},data:{default:Z,parseHTML:I.getDatasetAttribute("data",!0)}}},addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"excalidraw"},excalidrawProps:{},button:()=>({componentProps:{}})}},parseHTML(){return[{tag:"div[class=excalidraw]"}]},renderHTML({HTMLAttributes:e,node:t}){return["div",E.mergeAttributes(this.options.HTMLAttributes,e,I.nodeAttrsToDataset(t))]},addCommands(){return{setExcalidraw:e=>({tr:t,commands:r,chain:n})=>{var a,f,u;return e=e||{},e.data=e.data||Z,((u=(f=(a=t.selection)==null?void 0:a.node)==null?void 0:f.type)==null?void 0:u.name)==this.name?r.updateAttributes(this.name,e):n().insertContent({type:this.name,attrs:e}).run()}}},addNodeView(){return E.ReactNodeViewRenderer(de)},addInputRules(){return[E.nodeInputRule({find:/^\$excalidraw\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]}});exports.Excalidraw=L;exports.RichTextExcalidraw=re;exports.triggerOpenExcalidrawSettingModal=te;
|
package/lib/Icon-BjR_or8V.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const c=require("react/jsx-runtime");require("react");require("./index-CNzHZDls.cjs");const t=require("./index-DmOTQudI.cjs");function i(n){const e=t.icons[n.name];return e?c.jsx(e,{onClick:n==null?void 0:n.onClick,className:`richtext-w-4 richtext-h-4 ${(n==null?void 0:n.className)||""}`}):null}exports.IconComponent=i;
|
package/lib/Iframe-CM6mRQmv.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const u=require("./index-DLqogznp.cjs"),s=require("react/jsx-runtime"),b=require("react"),y=require("re-resizable"),h=require("./dom-dataset-BqoJhJXt.cjs"),S=require("./toggle-DVCNvcqp.cjs"),I=require("./index-CNzHZDls.cjs"),g=require("./useButtonProps-bei1vI37.cjs"),P=require("./input-tU3H__39.cjs"),R=require("./button-xNppt_aK.cjs"),m={youtube:{example:"https://www.youtube.com/watch?v=I4sMhHbHYXM",src:"https://www.youtube.com/embed/I4sMhHbHYXM",srcPrefix:"https://www.youtube.com/embed",linkRule:[/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\s/]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[&?]v=)|youtu\.be\/)([\w-]{11})/]},youku:{example:"https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html?spm=a2h0c.8166622.PhoneSokuUgc_4.dtitle",src:"https://player.youku.com/embed/XNDM0NDM4MTcy",srcPrefix:"https://player.youku.com/embed",linkRule:[String.raw`v.youku.com\/v_show\/id_\w+\=*`],idRule:String.raw`id_\w+\=*`},bilibili:{example:"https://www.bilibili.com/video/BV1EJ411u7DN",src:"https://player.bilibili.com/player.html?bvid=BV1EJ411u7DN",srcPrefix:"https://player.bilibili.com/player.html?bvid",linkRule:[String.raw`www.bilibili.com\/video\/\w+`]},qqvideo:{example:"https://v.qq.com/x/cover/mzc0020006aw1mn/u0033nvzb5v.html",src:"https://v.qq.com/txp/iframe/player.html?vid=u0033nvzb5v",srcPrefix:"https://v.qq.com/txp/iframe/player.html?vid",linkRule:[String.raw`v.qq.com\/x\/cover\/\w+\/\w+`]},amap:{example:"https://ditu.amap.com/",src:"https://www.amap.com/place/B000A45467",srcPrefix:"",linkRule:[String.raw`\.amap\.com`]},baidu_map:{example:"https://j.map.baidu.com/15/fo",src:"https://j.map.baidu.com/15/fo",srcPrefix:"",linkRule:[String.raw`map\.baidu\.com`]},modao:{example:"https://free.modao.cc/app/2cd26580a6717a147454df7470e7ec464093cba3/embed/v2#screen=sk71k6d1dfxulzx",src:"https://free.modao.cc/app/6UkpAxcGE3nPz52GLqhnOZgC7MATBSy/embed/v2",srcPrefix:"",linkRule:[String.raw`https:\/\/\w+.modao.cc\/app\/\w+\/embed\/v2`],tips:"Modao > More > Share > Embed > COPY"},lanhu:{example:"https://lanhuapp.com/link/#/invite?sid=evP7L",src:"https://lanhuapp.com/url/evP7L",srcPrefix:"",linkRule:[String.raw`https:\/\/lanhuapp.com\/url\/\w+`],tips:"Lanhu > Project > Share > Copy Link"},figma:{example:"https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1",src:"https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1",srcPrefix:"https://www.figma.com/embed?embed_host=share&url",linkRule:[String.raw`https:\/\/www.figma.com\/file\/\w+`]},canva:{example:"https://www.canva.cn/design/DAD61-t29UI/view",src:"https://www.canva.cn/design/DAD61-t29UI/view",srcPrefix:"",linkRule:[String.raw`https:\/\/www.canva.cn\/design\/.+\/view`]},processon:{example:"https://www.processon.com/embed/5ea99d8607912948b0e6fe78",src:"https://www.processon.com/embed/5ea99d8607912948b0e6fe78",srcPrefix:"",linkRule:[String.raw`https:\/\/www.processon.com\/embed\/\w+`]},codepen:{example:"https://codepen.io/mekery/embed/YzyrKOJ",src:"https://codepen.io/mekery/embed/YzyrKOJ",srcPrefix:"",linkRule:[String.raw`https:\/\/codepen.io\/.+\/embed\/\w+`]},jinshuju:{example:"https://jinshuju.net/f/q9YvVf",src:"https://jinshuju.net/f/q9YvVf",srcPrefix:"",linkRule:[String.raw`https:\/\/jinshuju.net\/f\/\w+`]},iframe:{example:"https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html",src:"https://player.youku.com/embed/XNDM0NDM4MTcy",srcPrefix:"",linkRule:[".+"]},googlemaps:{example:"https://goo.gl/maps/8Ys8b4K1ZJY2",src:"https://www.google.com/maps/embed?pb=https://goo.gl/maps/8Ys8b4K1ZJY2",srcPrefix:"",linkRule:[String.raw`https:\/\/goo.gl\/maps\/\w+`]}};function j(e){const t=m.youtube,i=e.matchedUrl;e.validLink=!0;const r=i.split("="),n=r.length;if(n>0){const c=r[n-1];e.src=`${t.srcPrefix}/${c}`,e.validId=!0}return e}function M(e){const t=m.youku,i=e.matchedUrl,r=t.idRule,n=new RegExp(r),c=i.match(n);if(c&&c.length>0){const o=c[0].slice(3);e.validId=!0,e.src=`${t.srcPrefix}/${o}`}else e.validId=!1;return e}function q(e){const t=m.bilibili,r=e.matchedUrl.split("/"),n=r.length;if(n>0){const c=r[n-1];e.src=`${t.srcPrefix}=${c}`,e.validId=!0}return e}function N(e){const t=m.qqvideo,r=e.matchedUrl.split("/"),n=r.length;if(n>0){const c=r[n-1];e.src=`${t.srcPrefix}=${c}`,e.validId=!0}return e}function U(e,t){return t.src=e,t.validId=!0,t}function A(e,t){return t.src=e,t.validId=!0,t}function D(e,t){return t.src=e,t.validId=!0,t.originalLink=e,t}function L(e){return e.src=e.matchedUrl,e.validId=!0,e.originalLink=e.src,e}function $(e){return e.src=e.matchedUrl,e.validId=!0,e.originalLink=e.src,e}function _(e){const t=m.figma;return e.src=`${t.srcPrefix}=${encodeURIComponent(e.matchedUrl)}`,e.validId=!0,e.originalLink=e.matchedUrl,e}function T(e,t){return t.src=`${t.matchedUrl}?embed`,t.validId=!0,t.originalLink=e,t}function z(e,t){return t.src=`${t.matchedUrl}`,t.validId=!0,t.originalLink=e,t}function Y(e){return e.src=`${e.matchedUrl}`,e.validId=!0,e.originalLink=e.src,e}function C(e,t){return t.src=`${t.matchedUrl}?background=white&banner=show&embedded=true`,t.validId=!0,t.originalLink=e,t}function E(e,t){return t.src=`${t.matchedUrl}`,t.validId=!0,t.originalLink=e,t}function H(e,t,i){if(e==="googlemaps")return i.validLink=!0,i.matchedUrl=t,i;const n=m[e].linkRule;for(const c of n){const o=new RegExp(c),a=t.match(o);if(a&&a.length>0)return i.validLink=!0,i.matchedUrl=e==="youtube"?a[1]:a[0],i}return i}function B(e){var i,r;let t="iframe";return((i=e.includes)!=null&&i.call(e,"youtube")||(r=e.includes)!=null&&r.call(e,"youtu.be"))&&(t="youtube"),e.includes("youku")&&(t="youku"),e.includes("bilibili")&&(t="bilibili"),e.includes("qq")&&(t="qqvideo"),e.includes("amap")&&(t="amap"),e.includes("map.baidu")&&(t="baidu_map"),(e.includes("google.com/maps")||e.includes("maps.app.goo.gl"))&&(t="googlemaps"),e.includes("modao")&&(t="modao"),e.includes("lanhuapp")&&(t="lanhu"),e.includes("figma")&&(t="figma"),e.includes("canva")&&(t="canva"),e.includes("processon")&&(t="processon"),e.includes("codepen")&&(t="codepen"),e.includes("jinshuju")&&(t="jinshuju"),e.includes("iframe")&&(t="iframe"),t}function x(e){let t={validLink:!1,validId:!1,matchedUrl:"",originalLink:e,src:""};const i=B(e);if(t=H(i,e,t),!t.validLink)return t;switch(i){case"youtube":return j(t);case"youku":return M(t);case"bilibili":return q(t);case"qqvideo":return N(t);case"amap":return U(e,t);case"baidu_map":return A(e,t);case"googlemaps":return D(e,t);case"modao":return L(t);case"lanhu":return $(t);case"figma":return _(t);case"canva":return T(e,t);case"processon":return z(e,t);case"codepen":return Y(t);case"jinshuju":return C(e,t);case"iframe":return E(e,t);default:return e}}const V="_wrap_5y04w_1",K="_innerWrap_5y04w_15",v={wrap:V,innerWrap:K};function O({editor:e,node:t,updateAttributes:i}){const r=I.useEditableEditor(),{src:n,width:c,height:o}=t.attrs,[a,p]=b.useState("");function l(){if(!a)return;const d=x(a);e.chain().updateAttributes(f.name,{src:(d==null?void 0:d.src)||a}).setNodeSelection(e.state.selection.from).focus().run()}const k=b.useCallback(d=>{i({width:d.width,height:d.height})},[i]);return s.jsxs(u.NodeViewWrapper,{children:[!n&&s.jsxs("div",{className:"richtext-mx-auto richtext-my-[12px] richtext-flex richtext-max-w-[600px] richtext-items-center richtext-justify-center richtext-gap-[10px] richtext-rounded-[12px] richtext-border richtext-border-solid richtext-border-border richtext-p-[10px]",children:[s.jsx(P.Input,{autoFocus:!0,className:"richtext-flex-1",onInput:d=>p(d.target.value),placeholder:"Enter link",type:"url",value:a}),s.jsx(R.Button,{className:"richtext-w-[60px]",onClick:l,children:"OK"})]}),n&&s.jsx(y.Resizable,{size:{width:Number.parseInt(c),height:Number.parseInt(o)},onResizeStop:(d,J,W,w)=>{k({width:Number.parseInt(c)+w.width,height:Number.parseInt(o)+w.height})},children:s.jsx("div",{className:u.clsx(v.wrap,"render-wrapper"),children:s.jsx("div",{className:v.innerWrap,style:{pointerEvents:r?"none":"auto"},children:s.jsx("iframe",{className:"richtext-my-[12px] ",src:n})})})})]})}function X(){const e=g.useButtonProps(f.name),{icon:t=void 0,tooltip:i=void 0,shortcutKeys:r=void 0,tooltipOptions:n={},action:c=void 0,isActive:o=void 0}=(e==null?void 0:e.componentProps)??{},{editorDisabled:a,update:p}=g.useToggleActive(o),l=()=>{a||c&&(c(),p())};return e?s.jsx(S.ActionButton,{action:l,disabled:a,icon:t,shortcutKeys:r,tooltip:i,tooltipOptions:n}):s.jsx(s.Fragment,{})}const f=u.Node3.create({name:"iframe",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"iframe"},button:({editor:t,extension:i,t:r})=>({componentProps:{action:n=>t.commands.setIframe(n),upload:i.options.upload,icon:"Iframe",tooltip:r("editor.iframe.tooltip")}})}},addAttributes(){return{width:{default:600,parseHTML:h.getDatasetAttribute("width")},height:{default:300,parseHTML:h.getDatasetAttribute("height")},src:{default:null,parseHTML:h.getDatasetAttribute("src")},defaultShowPicker:{default:!1},frameborder:{default:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:e}){return["iframe",u.mergeAttributes(this.options.HTMLAttributes,e)]},addCommands(){return{setIframe:e=>({tr:t,commands:i,chain:r})=>{var c,o,a;if(((a=(o=(c=t.selection)==null?void 0:c.node)==null?void 0:o.type)==null?void 0:a.name)==this.name)return i.updateAttributes(this.name,e);const n=e||{url:""};return r().insertContent({type:this.name,attrs:n}).run()}}},addInputRules(){return[u.nodeInputRule({find:/^\$iframe\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]},addNodeView(){return u.ReactNodeViewRenderer(O)}});exports.Iframe=f;exports.RichTextIframe=X;exports.getServiceSrc=x;
|
package/lib/Indent-BmhiEb0S.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const h=require("./index-DLqogznp.cjs"),m=require("@tiptap/pm/state"),c=require("react/jsx-runtime"),l=require("./toggle-DVCNvcqp.cjs");require("react");require("./index-CNzHZDls.cjs");const p=require("./useButtonProps-bei1vI37.cjs");var a=(t=>(t[t.max=7]="max",t[t.min=0]="min",t[t.more=1]="more",t[t.less=-1]="less",t))(a||{});function T(t,e,n){return t<e?e:t>n?n:t}function g(t,e,n,o){const{doc:s,selection:r}=t;if(!s||!r||!(r instanceof m.TextSelection||r instanceof m.AllSelection))return t;const{from:i,to:u}=r;return s.nodesBetween(i,u,(d,I)=>{const b=d.type;return n.includes(b.name)?(t=y(t,I,e),!1):!h.isList(d.type.name,o.extensionManager.extensions)}),t}function y(t,e,n){if(!t.doc)return t;const o=t.doc.nodeAt(e);if(!o)return t;const i=T((o.attrs.indent||0)+n,0,7);if(i===o.attrs.indent)return t;const u={...o.attrs,indent:i};return t.setNodeMarkup(e,o.type,u,o.marks)}function f({delta:t,types:e}){return({state:n,dispatch:o,editor:s})=>{const{selection:r}=n;let{tr:i}=n;return i=i.setSelection(r),i=g(i,t,e,s),i.docChanged?(o&&o(i),!0):!1}}function A(){const t=p.useButtonProps(x.name),{indent:e,outdent:n}=(t==null?void 0:t.componentProps)??{},{editorDisabled:o}=p.useToggleActive(),s=()=>{o||e!=null&&e.action&&(e==null||e.action())},r=()=>{o||n!=null&&n.action&&(n==null||n.action())};return t?c.jsxs(c.Fragment,{children:[c.jsx(l.ActionButton,{action:s,disabled:o,icon:e==null?void 0:e.icon,shortcutKeys:e==null?void 0:e.shortcutKeys,tooltip:e==null?void 0:e.tooltip}),c.jsx(l.ActionButton,{action:r,disabled:o,icon:n==null?void 0:n.icon,shortcutKeys:n==null?void 0:n.shortcutKeys,tooltip:n==null?void 0:n.tooltip})]}):c.jsx(c.Fragment,{})}const x=h.Extension.create({name:"richtextIndentOutdent",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["paragraph","heading","blockquote"],minIndent:a.min,maxIndent:a.max,button({editor:e,t:n,extension:o}){var s,r;return{componentProps:{indent:{action:()=>{e.commands.indent()},shortcutKeys:((s=o.options.shortcutKeys)==null?void 0:s[0])??["Tab"],icon:"IndentIncrease",tooltip:n("editor.indent.tooltip")},outdent:{action:()=>{e.commands.outdent()},shortcutKeys:((r=o.options.shortcutKeys)==null?void 0:r[1])??["Shift","Tab"],icon:"IndentDecrease",tooltip:n("editor.outdent.tooltip")}}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{indent:{default:0,parseHTML:t=>{const e=t.dataset.indent;return(e?Number.parseInt(e,10):0)||0},renderHTML:t=>t.indent?{"data-indent":t.indent}:{}}}}]},addCommands(){return{indent:()=>f({delta:a.more,types:this.options.types}),outdent:()=>f({delta:a.less,types:this.options.types})}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.indent(),"Shift-Tab":()=>this.editor.commands.outdent()}}});exports.Indent=x;exports.IndentProps=a;exports.RichTextIndent=A;exports.setNodeIndentMarkup=y;
|
package/lib/Katex-CUd3LxLh.cjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
"use strict";const Fr=require("./index-DLqogznp.cjs"),er=require("react/jsx-runtime"),ur=require("react"),Ja=require("katex"),qo=require("./toggle-DVCNvcqp.cjs");require("./index-CNzHZDls.cjs");const Dr=require("./dialog-DaHBd2zw.cjs"),wo=require("./textarea-CmZVZKOo.cjs"),oe=require("./useButtonProps-bei1vI37.cjs"),Br=require("./_commonjsHelpers-BTDuMlIz.cjs"),Po=require("./index-FSRjMsxW.cjs"),Io=require("./button-xNppt_aK.cjs");var ie,sn;function Ya(){if(sn)return ie;sn=1;var r=Object.prototype.toString;return ie=function(n){var o=r.call(n),t=o==="[object Arguments]";return t||(t=o!=="[object Array]"&&n!==null&&typeof n=="object"&&typeof n.length=="number"&&n.length>=0&&r.call(n.callee)==="[object Function]"),t},ie}var ue,ln;function $o(){if(ln)return ue;ln=1;var r;if(!Object.keys){var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,o=Ya(),t=Object.prototype.propertyIsEnumerable,f=!t.call({toString:null},"toString"),i=t.call(function(){},"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],u=function(y){var h=y.constructor;return h&&h.prototype===y},c={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},v=(function(){if(typeof window>"u")return!1;for(var y in window)try{if(!c["$"+y]&&e.call(window,y)&&window[y]!==null&&typeof window[y]=="object")try{u(window[y])}catch{return!0}}catch{return!0}return!1})(),p=function(y){if(typeof window>"u"||!v)return u(y);try{return u(y)}catch{return!1}};r=function(h){var m=h!==null&&typeof h=="object",B=n.call(h)==="[object Function]",q=o(h),w=m&&n.call(h)==="[object String]",O=[];if(!m&&!B&&!q)throw new TypeError("Object.keys called on a non-object");var b=i&&B;if(w&&h.length>0&&!e.call(h,0))for(var T=0;T<h.length;++T)O.push(String(T));if(q&&h.length>0)for(var X=0;X<h.length;++X)O.push(String(X));else for(var G in h)!(b&&G==="prototype")&&e.call(h,G)&&O.push(String(G));if(f)for(var F=p(h),C=0;C<a.length;++C)!(F&&a[C]==="constructor")&&e.call(h,a[C])&&O.push(a[C]);return O}}return ue=r,ue}var fe,cn;function Lt(){if(cn)return fe;cn=1;var r=Array.prototype.slice,e=Ya(),n=Object.keys,o=n?function(i){return n(i)}:$o(),t=Object.keys;return o.shim=function(){if(Object.keys){var i=(function(){var a=Object.keys(arguments);return a&&a.length===arguments.length})(1,2);i||(Object.keys=function(u){return e(u)?t(r.call(u)):t(u)})}else Object.keys=o;return Object.keys||o},fe=o,fe}var se,pn;function Vr(){if(pn)return se;pn=1;var r=Object.defineProperty||!1;if(r)try{r({},"a",{value:1})}catch{r=!1}return se=r,se}var le,yn;function Ht(){return yn||(yn=1,le=SyntaxError),le}var ce,vn;function nr(){return vn||(vn=1,ce=TypeError),ce}var pe,gn;function Ro(){return gn||(gn=1,pe=Object.getOwnPropertyDescriptor),pe}var ye,hn;function qr(){if(hn)return ye;hn=1;var r=Ro();if(r)try{r([],"length")}catch{r=null}return ye=r,ye}var ve,dn;function Gt(){if(dn)return ve;dn=1;var r=Vr(),e=Ht(),n=nr(),o=qr();return ve=function(f,i,a){if(!f||typeof f!="object"&&typeof f!="function")throw new n("`obj` must be an object or a function`");if(typeof i!="string"&&typeof i!="symbol")throw new n("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new n("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new n("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new n("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new n("`loose`, if provided, must be a boolean");var u=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,v=arguments.length>5?arguments[5]:null,p=arguments.length>6?arguments[6]:!1,y=!!o&&o(f,i);if(r)r(f,i,{configurable:v===null&&y?y.configurable:!v,enumerable:u===null&&y?y.enumerable:!u,value:a,writable:c===null&&y?y.writable:!c});else if(p||!u&&!c&&!v)f[i]=a;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},ve}var ge,mn;function Ut(){if(mn)return ge;mn=1;var r=Vr(),e=function(){return!!r};return e.hasArrayLengthDefineBug=function(){if(!r)return null;try{return r([],"length",{value:1}).length!==1}catch{return!0}},ge=e,ge}var he,Sn;function wr(){if(Sn)return he;Sn=1;var r=Lt(),e=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",n=Object.prototype.toString,o=Array.prototype.concat,t=Gt(),f=function(c){return typeof c=="function"&&n.call(c)==="[object Function]"},i=Ut()(),a=function(c,v,p,y){if(v in c){if(y===!0){if(c[v]===p)return}else if(!f(y)||!y())return}i?t(c,v,p,!0):t(c,v,p)},u=function(c,v){var p=arguments.length>2?arguments[2]:{},y=r(v);e&&(y=o.call(y,Object.getOwnPropertySymbols(v)));for(var h=0;h<y.length;h+=1)a(c,y[h],v[y[h]],p[y[h]])};return u.supportsDescriptors=!!i,he=u,he}var de={exports:{}},me,bn;function zt(){return bn||(bn=1,me=Object),me}var Se,An;function Xa(){return An||(An=1,Se=Error),Se}var be,On;function xo(){return On||(On=1,be=EvalError),be}var Ae,qn;function Eo(){return qn||(qn=1,Ae=RangeError),Ae}var Oe,wn;function Bo(){return wn||(wn=1,Oe=ReferenceError),Oe}var qe,Pn;function jo(){return Pn||(Pn=1,qe=URIError),qe}var we,In;function To(){return In||(In=1,we=Math.abs),we}var Pe,$n;function Mo(){return $n||($n=1,Pe=Math.floor),Pe}var Ie,Rn;function Do(){return Rn||(Rn=1,Ie=Math.max),Ie}var $e,xn;function Co(){return xn||(xn=1,$e=Math.min),$e}var Re,En;function Fo(){return En||(En=1,Re=Math.pow),Re}var xe,Bn;function _o(){return Bn||(Bn=1,xe=Math.round),xe}var Ee,jn;function No(){return jn||(jn=1,Ee=Number.isNaN||function(e){return e!==e}),Ee}var Be,Tn;function Wo(){if(Tn)return Be;Tn=1;var r=No();return Be=function(n){return r(n)||n===0?n:n<0?-1:1},Be}var je,Mn;function Kr(){return Mn||(Mn=1,je=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},n=Symbol("test"),o=Object(n);if(typeof n=="string"||Object.prototype.toString.call(n)!=="[object Symbol]"||Object.prototype.toString.call(o)!=="[object Symbol]")return!1;var t=42;e[n]=t;for(var f in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var i=Object.getOwnPropertySymbols(e);if(i.length!==1||i[0]!==n||!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,n);if(a.value!==t||a.enumerable!==!0)return!1}return!0}),je}var Te,Dn;function Vt(){if(Dn)return Te;Dn=1;var r=typeof Symbol<"u"&&Symbol,e=Kr();return Te=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},Te}var Me,Cn;function Qa(){return Cn||(Cn=1,Me=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Me}var De,Fn;function Za(){if(Fn)return De;Fn=1;var r=zt();return De=r.getPrototypeOf||null,De}var Ce,_n;function ko(){if(_n)return Ce;_n=1;var r="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,n=Math.max,o="[object Function]",t=function(u,c){for(var v=[],p=0;p<u.length;p+=1)v[p]=u[p];for(var y=0;y<c.length;y+=1)v[y+u.length]=c[y];return v},f=function(u,c){for(var v=[],p=c,y=0;p<u.length;p+=1,y+=1)v[y]=u[p];return v},i=function(a,u){for(var c="",v=0;v<a.length;v+=1)c+=a[v],v+1<a.length&&(c+=u);return c};return Ce=function(u){var c=this;if(typeof c!="function"||e.apply(c)!==o)throw new TypeError(r+c);for(var v=f(arguments,1),p,y=function(){if(this instanceof p){var w=c.apply(this,t(v,arguments));return Object(w)===w?w:this}return c.apply(u,t(v,arguments))},h=n(0,c.length-v.length),m=[],B=0;B<h;B++)m[B]="$"+B;if(p=Function("binder","return function ("+i(m,",")+"){ return binder.apply(this,arguments); }")(y),c.prototype){var q=function(){};q.prototype=c.prototype,p.prototype=new q,q.prototype=null}return p},Ce}var Fe,Nn;function _r(){if(Nn)return Fe;Nn=1;var r=ko();return Fe=Function.prototype.bind||r,Fe}var _e,Wn;function Kt(){return Wn||(Wn=1,_e=Function.prototype.call),_e}var Ne,kn;function Jt(){return kn||(kn=1,Ne=Function.prototype.apply),Ne}var We,Ln;function Lo(){return Ln||(Ln=1,We=typeof Reflect<"u"&&Reflect&&Reflect.apply),We}var ke,Hn;function ro(){if(Hn)return ke;Hn=1;var r=_r(),e=Jt(),n=Kt(),o=Lo();return ke=o||r.call(n,e),ke}var Le,Gn;function Yt(){if(Gn)return Le;Gn=1;var r=_r(),e=nr(),n=Kt(),o=ro();return Le=function(f){if(f.length<1||typeof f[0]!="function")throw new e("a function is required");return o(r,n,f)},Le}var He,Un;function Ho(){if(Un)return He;Un=1;var r=Yt(),e=qr(),n;try{n=[].__proto__===Array.prototype}catch(i){if(!i||typeof i!="object"||!("code"in i)||i.code!=="ERR_PROTO_ACCESS")throw i}var o=!!n&&e&&e(Object.prototype,"__proto__"),t=Object,f=t.getPrototypeOf;return He=o&&typeof o.get=="function"?r([o.get]):typeof f=="function"?function(a){return f(a==null?a:t(a))}:!1,He}var Ge,zn;function Xt(){if(zn)return Ge;zn=1;var r=Qa(),e=Za(),n=Ho();return Ge=r?function(t){return r(t)}:e?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return e(t)}:n?function(t){return n(t)}:null,Ge}var Ue,Vn;function Qt(){if(Vn)return Ue;Vn=1;var r=Function.prototype.call,e=Object.prototype.hasOwnProperty,n=_r();return Ue=n.call(r,e),Ue}var ze,Kn;function yr(){if(Kn)return ze;Kn=1;var r,e=zt(),n=Xa(),o=xo(),t=Eo(),f=Bo(),i=Ht(),a=nr(),u=jo(),c=To(),v=Mo(),p=Do(),y=Co(),h=Fo(),m=_o(),B=Wo(),q=Function,w=function(M){try{return q('"use strict"; return ('+M+").constructor;")()}catch{}},O=qr(),b=Vr(),T=function(){throw new a},X=O?(function(){try{return arguments.callee,T}catch{try{return O(arguments,"callee").get}catch{return T}}})():T,G=Vt()(),F=Xt(),C=Za(),P=Qa(),_=Jt(),L=Kt(),N={},H=typeof Uint8Array>"u"||!F?r:F(Uint8Array),V={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?r:ArrayBuffer,"%ArrayIteratorPrototype%":G&&F?F([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":N,"%AsyncGenerator%":N,"%AsyncGeneratorFunction%":N,"%AsyncIteratorPrototype%":N,"%Atomics%":typeof Atomics>"u"?r:Atomics,"%BigInt%":typeof BigInt>"u"?r:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?r:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?r:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":n,"%eval%":eval,"%EvalError%":o,"%Float16Array%":typeof Float16Array>"u"?r:Float16Array,"%Float32Array%":typeof Float32Array>"u"?r:Float32Array,"%Float64Array%":typeof Float64Array>"u"?r:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?r:FinalizationRegistry,"%Function%":q,"%GeneratorFunction%":N,"%Int8Array%":typeof Int8Array>"u"?r:Int8Array,"%Int16Array%":typeof Int16Array>"u"?r:Int16Array,"%Int32Array%":typeof Int32Array>"u"?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":G&&F?F(F([][Symbol.iterator]())):r,"%JSON%":typeof JSON=="object"?JSON:r,"%Map%":typeof Map>"u"?r:Map,"%MapIteratorPrototype%":typeof Map>"u"||!G||!F?r:F(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":e,"%Object.getOwnPropertyDescriptor%":O,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?r:Promise,"%Proxy%":typeof Proxy>"u"?r:Proxy,"%RangeError%":t,"%ReferenceError%":f,"%Reflect%":typeof Reflect>"u"?r:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?r:Set,"%SetIteratorPrototype%":typeof Set>"u"||!G||!F?r:F(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":G&&F?F(""[Symbol.iterator]()):r,"%Symbol%":G?Symbol:r,"%SyntaxError%":i,"%ThrowTypeError%":X,"%TypedArray%":H,"%TypeError%":a,"%Uint8Array%":typeof Uint8Array>"u"?r:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?r:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?r:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?r:Uint32Array,"%URIError%":u,"%WeakMap%":typeof WeakMap>"u"?r:WeakMap,"%WeakRef%":typeof WeakRef>"u"?r:WeakRef,"%WeakSet%":typeof WeakSet>"u"?r:WeakSet,"%Function.prototype.call%":L,"%Function.prototype.apply%":_,"%Object.defineProperty%":b,"%Object.getPrototypeOf%":C,"%Math.abs%":c,"%Math.floor%":v,"%Math.max%":p,"%Math.min%":y,"%Math.pow%":h,"%Math.round%":m,"%Math.sign%":B,"%Reflect.getPrototypeOf%":P};if(F)try{null.error}catch(M){var fr=F(F(M));V["%Error.prototype%"]=fr}var Ir=function M(A){var I;if(A==="%AsyncFunction%")I=w("async function () {}");else if(A==="%GeneratorFunction%")I=w("function* () {}");else if(A==="%AsyncGeneratorFunction%")I=w("async function* () {}");else if(A==="%AsyncGenerator%"){var S=M("%AsyncGeneratorFunction%");S&&(I=S.prototype)}else if(A==="%AsyncIteratorPrototype%"){var x=M("%AsyncGenerator%");x&&F&&(I=F(x.prototype))}return V[A]=I,I},Sr={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ar=_r(),U=Qt(),br=ar.call(L,Array.prototype.concat),$r=ar.call(_,Array.prototype.splice),Ar=ar.call(L,String.prototype.replace),vr=ar.call(L,String.prototype.slice),g=ar.call(L,RegExp.prototype.exec),d=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,R=/\\(\\)?/g,$=function(A){var I=vr(A,0,1),S=vr(A,-1);if(I==="%"&&S!=="%")throw new i("invalid intrinsic syntax, expected closing `%`");if(S==="%"&&I!=="%")throw new i("invalid intrinsic syntax, expected opening `%`");var x=[];return Ar(A,d,function(z,K,J,Y){x[x.length]=J?Ar(Y,R,"$1"):K||z}),x},j=function(A,I){var S=A,x;if(U(Sr,S)&&(x=Sr[S],S="%"+x[0]+"%"),U(V,S)){var z=V[S];if(z===N&&(z=Ir(S)),typeof z>"u"&&!I)throw new a("intrinsic "+A+" exists, but is not available. Please file an issue!");return{alias:x,name:S,value:z}}throw new i("intrinsic "+A+" does not exist!")};return ze=function(A,I){if(typeof A!="string"||A.length===0)throw new a("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof I!="boolean")throw new a('"allowMissing" argument must be a boolean');if(g(/^%?[^%]*%?$/,A)===null)throw new i("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var S=$(A),x=S.length>0?S[0]:"",z=j("%"+x+"%",I),K=z.name,J=z.value,Y=!1,Z=z.alias;Z&&(x=Z[0],$r(S,br([0,1],Z)));for(var sr=1,or=!0;sr<S.length;sr+=1){var rr=S[sr],lr=vr(rr,0,1),cr=vr(rr,-1);if((lr==='"'||lr==="'"||lr==="`"||cr==='"'||cr==="'"||cr==="`")&&lr!==cr)throw new i("property names with quotes must have matching quotes");if((rr==="constructor"||!or)&&(Y=!0),x+="."+rr,K="%"+x+"%",U(V,K))J=V[K];else if(J!=null){if(!(rr in J)){if(!I)throw new a("base intrinsic for "+A+" exists, but the property is not available.");return}if(O&&sr+1>=S.length){var pr=O(J,rr);or=!!pr,or&&"get"in pr&&!("originalValue"in pr.get)?J=pr.get:J=J[rr]}else or=U(J,rr),J=J[rr];or&&!Y&&(V[K]=J)}}return J},ze}var Ve,Jn;function Go(){if(Jn)return Ve;Jn=1;var r=yr(),e=Gt(),n=Ut()(),o=qr(),t=nr(),f=r("%Math.floor%");return Ve=function(a,u){if(typeof a!="function")throw new t("`fn` is not a function");if(typeof u!="number"||u<0||u>4294967295||f(u)!==u)throw new t("`length` must be a positive 32-bit integer");var c=arguments.length>2&&!!arguments[2],v=!0,p=!0;if("length"in a&&o){var y=o(a,"length");y&&!y.configurable&&(v=!1),y&&!y.writable&&(p=!1)}return(v||p||!c)&&(n?e(a,"length",u,!0,!0):e(a,"length",u)),a},Ve}var Ke,Yn;function Uo(){if(Yn)return Ke;Yn=1;var r=_r(),e=Jt(),n=ro();return Ke=function(){return n(r,e,arguments)},Ke}var Xn;function jr(){return Xn||(Xn=1,(function(r){var e=Go(),n=Vr(),o=Yt(),t=Uo();r.exports=function(i){var a=o(arguments),u=i.length-(arguments.length-1);return e(a,1+(u>0?u:0),!0)},n?n(r.exports,"apply",{value:t}):r.exports.apply=t})(de)),de.exports}var Je,Qn;function Q(){if(Qn)return Je;Qn=1;var r=yr(),e=Yt(),n=e([r("%String.prototype.indexOf%")]);return Je=function(t,f){var i=r(t,!!f);return typeof i=="function"&&n(t,".prototype.")>-1?e([i]):i},Je}var Ye,Zn;function eo(){if(Zn)return Ye;Zn=1;var r=Lt(),e=Kr()(),n=Q(),o=zt(),t=n("Array.prototype.push"),f=n("Object.prototype.propertyIsEnumerable"),i=e?o.getOwnPropertySymbols:null;return Ye=function(u,c){if(u==null)throw new TypeError("target must be an object");var v=o(u);if(arguments.length===1)return v;for(var p=1;p<arguments.length;++p){var y=o(arguments[p]),h=r(y),m=e&&(o.getOwnPropertySymbols||i);if(m)for(var B=m(y),q=0;q<B.length;++q){var w=B[q];f(y,w)&&t(h,w)}for(var O=0;O<h.length;++O){var b=h[O];if(f(y,b)){var T=y[b];v[b]=T}}}return v},Ye}var Xe,ra;function to(){if(ra)return Xe;ra=1;var r=eo(),e=function(){if(!Object.assign)return!1;for(var o="abcdefghijklmnopqrst",t=o.split(""),f={},i=0;i<t.length;++i)f[t[i]]=t[i];var a=Object.assign({},f),u="";for(var c in a)u+=c;return o!==u},n=function(){if(!Object.assign||!Object.preventExtensions)return!1;var o=Object.preventExtensions({1:2});try{Object.assign(o,"xy")}catch{return o[1]==="y"}return!1};return Xe=function(){return!Object.assign||e()||n()?r:Object.assign},Xe}var Qe,ea;function zo(){if(ea)return Qe;ea=1;var r=wr(),e=to();return Qe=function(){var o=e();return r(Object,{assign:o},{assign:function(){return Object.assign!==o}}),o},Qe}var Ze,ta;function Vo(){if(ta)return Ze;ta=1;var r=wr(),e=jr(),n=eo(),o=to(),t=zo(),f=e.apply(o()),i=function(u,c){return f(Object,arguments)};return r(i,{getPolyfill:o,implementation:n,shim:t}),Ze=i,Ze}var rt,na;function no(){if(na)return rt;na=1;var r=yr(),e=jr(),n=e(r("String.prototype.indexOf"));return rt=function(t,f){var i=r(t,!!f);return typeof i=="function"&&n(t,".prototype.")>-1?e(i):i},rt}var et,aa;function Ko(){if(aa)return et;aa=1;var r=function(){return typeof(function(){}).name=="string"},e=Object.getOwnPropertyDescriptor;if(e)try{e([],"length")}catch{e=null}r.functionsHaveConfigurableNames=function(){if(!r()||!e)return!1;var t=e(function(){},"name");return!!t&&!!t.configurable};var n=Function.prototype.bind;return r.boundFunctionsHaveNames=function(){return r()&&typeof n=="function"&&(function(){}).bind().name!==""},et=r,et}var tt,oa;function Jo(){if(oa)return tt;oa=1;var r=Gt(),e=Ut()(),n=Ko().functionsHaveConfigurableNames(),o=nr();return tt=function(f,i){if(typeof f!="function")throw new o("`fn` is not a function");var a=arguments.length>2&&!!arguments[2];return(!a||n)&&(e?r(f,"name",i,!0,!0):r(f,"name",i)),f},tt}var nt,ia;function ao(){if(ia)return nt;ia=1;var r=Jo(),e=nr(),n=Object;return nt=r(function(){if(this==null||this!==n(this))throw new e("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t},"get flags",!0),nt}var at,ua;function oo(){if(ua)return at;ua=1;var r=ao(),e=wr().supportsDescriptors,n=Object.getOwnPropertyDescriptor;return at=function(){if(e&&/a/mig.flags==="gim"){var t=n(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var f="",i={};if(Object.defineProperty(i,"hasIndices",{get:function(){f+="d"}}),Object.defineProperty(i,"sticky",{get:function(){f+="y"}}),t.get.call(i),f==="dy")return t.get}}return r},at}var ot,fa;function Yo(){if(fa)return ot;fa=1;var r=wr().supportsDescriptors,e=oo(),n=qr(),o=Object.defineProperty,t=Xa(),f=Xt(),i=/a/;return ot=function(){if(!r||!f)throw new t("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var u=e(),c=f(i),v=n(c,"flags");return(!v||v.get!==u)&&o(c,"flags",{configurable:!0,enumerable:!1,get:u}),u},ot}var it,sa;function Xo(){if(sa)return it;sa=1;var r=wr(),e=jr(),n=ao(),o=oo(),t=Yo(),f=e(o());return r(f,{getPolyfill:o,implementation:n,shim:t}),it=f,it}var Cr={exports:{}},ut,la;function Pr(){if(la)return ut;la=1;var r=Kr();return ut=function(){return r()&&!!Symbol.toStringTag},ut}var ft,ca;function io(){if(ca)return ft;ca=1;var r=Pr()(),e=Q(),n=e("Object.prototype.toString"),o=function(a){return r&&a&&typeof a=="object"&&Symbol.toStringTag in a?!1:n(a)==="[object Arguments]"},t=function(a){return o(a)?!0:a!==null&&typeof a=="object"&&"length"in a&&typeof a.length=="number"&&a.length>=0&&n(a)!=="[object Array]"&&"callee"in a&&n(a.callee)==="[object Function]"},f=(function(){return o(arguments)})();return o.isLegacyArguments=t,ft=f?o:t,ft}const Qo={},Zo=Object.freeze(Object.defineProperty({__proto__:null,default:Qo},Symbol.toStringTag,{value:"Module"})),ri=Br.getAugmentedNamespace(Zo);var st,pa;function Jr(){if(pa)return st;pa=1;var r=typeof Map=="function"&&Map.prototype,e=Object.getOwnPropertyDescriptor&&r?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,n=r&&e&&typeof e.get=="function"?e.get:null,o=r&&Map.prototype.forEach,t=typeof Set=="function"&&Set.prototype,f=Object.getOwnPropertyDescriptor&&t?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,i=t&&f&&typeof f.get=="function"?f.get:null,a=t&&Set.prototype.forEach,u=typeof WeakMap=="function"&&WeakMap.prototype,c=u?WeakMap.prototype.has:null,v=typeof WeakSet=="function"&&WeakSet.prototype,p=v?WeakSet.prototype.has:null,y=typeof WeakRef=="function"&&WeakRef.prototype,h=y?WeakRef.prototype.deref:null,m=Boolean.prototype.valueOf,B=Object.prototype.toString,q=Function.prototype.toString,w=String.prototype.match,O=String.prototype.slice,b=String.prototype.replace,T=String.prototype.toUpperCase,X=String.prototype.toLowerCase,G=RegExp.prototype.test,F=Array.prototype.concat,C=Array.prototype.join,P=Array.prototype.slice,_=Math.floor,L=typeof BigInt=="function"?BigInt.prototype.valueOf:null,N=Object.getOwnPropertySymbols,H=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,V=typeof Symbol=="function"&&typeof Symbol.iterator=="object",fr=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===V||!0)?Symbol.toStringTag:null,Ir=Object.prototype.propertyIsEnumerable,Sr=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(s){return s.__proto__}:null);function ar(s,l){if(s===1/0||s===-1/0||s!==s||s&&s>-1e3&&s<1e3||G.call(/e/,l))return l;var D=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof s=="number"){var W=s<0?-_(-s):_(s);if(W!==s){var k=String(W),E=O.call(l,k.length+1);return b.call(k,D,"$&_")+"."+b.call(b.call(E,/([0-9]{3})/g,"$&_"),/_$/,"")}}return b.call(l,D,"$&_")}var U=ri,br=U.custom,$r=z(br)?br:null,Ar={__proto__:null,double:'"',single:"'"},vr={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};st=function s(l,D,W,k){var E=D||{};if(Y(E,"quoteStyle")&&!Y(Ar,E.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Y(E,"maxStringLength")&&(typeof E.maxStringLength=="number"?E.maxStringLength<0&&E.maxStringLength!==1/0:E.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var dr=Y(E,"customInspect")?E.customInspect:!0;if(typeof dr!="boolean"&&dr!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Y(E,"indent")&&E.indent!==null&&E.indent!==" "&&!(parseInt(E.indent,10)===E.indent&&E.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Y(E,"numericSeparator")&&typeof E.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var Or=E.numericSeparator;if(typeof l>"u")return"undefined";if(l===null)return"null";if(typeof l=="boolean")return l?"true":"false";if(typeof l=="string")return Rr(l,E);if(typeof l=="number"){if(l===0)return 1/0/l>0?"0":"-0";var tr=String(l);return Or?ar(l,tr):tr}if(typeof l=="bigint"){var mr=String(l)+"n";return Or?ar(l,mr):mr}var Qr=typeof E.depth>"u"?5:E.depth;if(typeof W>"u"&&(W=0),W>=Qr&&Qr>0&&typeof l=="object")return $(l)?"[Array]":"[Object]";var xr=bo(E,W);if(typeof k>"u")k=[];else if(or(k,l)>=0)return"[Circular]";function ir(Er,Lr,Oo){if(Lr&&(k=P.call(k),k.push(Lr)),Oo){var fn={depth:E.depth};return Y(E,"quoteStyle")&&(fn.quoteStyle=E.quoteStyle),s(Er,fn,W+1,k)}return s(Er,E,W+1,k)}if(typeof l=="function"&&!M(l)){var rn=sr(l),en=Wr(l,ir);return"[Function"+(rn?": "+rn:" (anonymous)")+"]"+(en.length>0?" { "+C.call(en,", ")+" }":"")}if(z(l)){var tn=V?b.call(String(l),/^(Symbol\(.*\))_[^)]*$/,"$1"):H.call(l);return typeof l=="object"&&!V?hr(tn):tn}if(gr(l)){for(var Mr="<"+X.call(String(l.nodeName)),Zr=l.attributes||[],kr=0;kr<Zr.length;kr++)Mr+=" "+Zr[kr].name+"="+g(d(Zr[kr].value),"double",E);return Mr+=">",l.childNodes&&l.childNodes.length&&(Mr+="..."),Mr+="</"+X.call(String(l.nodeName))+">",Mr}if($(l)){if(l.length===0)return"[]";var re=Wr(l,ir);return xr&&!So(re)?"["+Xr(re,xr)+"]":"[ "+C.call(re,", ")+" ]"}if(A(l)){var ee=Wr(l,ir);return!("cause"in Error.prototype)&&"cause"in l&&!Ir.call(l,"cause")?"{ ["+String(l)+"] "+C.call(F.call("[cause]: "+ir(l.cause),ee),", ")+" }":ee.length===0?"["+String(l)+"]":"{ ["+String(l)+"] "+C.call(ee,", ")+" }"}if(typeof l=="object"&&dr){if($r&&typeof l[$r]=="function"&&U)return U(l,{depth:Qr-W});if(dr!=="symbol"&&typeof l.inspect=="function")return l.inspect()}if(rr(l)){var nn=[];return o&&o.call(l,function(Er,Lr){nn.push(ir(Lr,l,!0)+" => "+ir(Er,l))}),Zt("Map",n.call(l),nn,xr)}if(pr(l)){var an=[];return a&&a.call(l,function(Er){an.push(ir(Er,l))}),Zt("Set",i.call(l),an,xr)}if(lr(l))return Yr("WeakMap");if(Nr(l))return Yr("WeakSet");if(cr(l))return Yr("WeakRef");if(S(l))return hr(ir(Number(l)));if(K(l))return hr(ir(L.call(l)));if(x(l))return hr(m.call(l));if(I(l))return hr(ir(String(l)));if(typeof window<"u"&&l===window)return"{ [object Window] }";if(typeof globalThis<"u"&&l===globalThis||typeof Br.commonjsGlobal<"u"&&l===Br.commonjsGlobal)return"{ [object globalThis] }";if(!j(l)&&!M(l)){var te=Wr(l,ir),on=Sr?Sr(l)===Object.prototype:l instanceof Object||l.constructor===Object,ne=l instanceof Object?"":"null prototype",un=!on&&fr&&Object(l)===l&&fr in l?O.call(Z(l),8,-1):ne?"Object":"",Ao=on||typeof l.constructor!="function"?"":l.constructor.name?l.constructor.name+" ":"",ae=Ao+(un||ne?"["+C.call(F.call([],un||[],ne||[]),": ")+"] ":"");return te.length===0?ae+"{}":xr?ae+"{"+Xr(te,xr)+"}":ae+"{ "+C.call(te,", ")+" }"}return String(l)};function g(s,l,D){var W=D.quoteStyle||l,k=Ar[W];return k+s+k}function d(s){return b.call(String(s),/"/g,""")}function R(s){return!fr||!(typeof s=="object"&&(fr in s||typeof s[fr]<"u"))}function $(s){return Z(s)==="[object Array]"&&R(s)}function j(s){return Z(s)==="[object Date]"&&R(s)}function M(s){return Z(s)==="[object RegExp]"&&R(s)}function A(s){return Z(s)==="[object Error]"&&R(s)}function I(s){return Z(s)==="[object String]"&&R(s)}function S(s){return Z(s)==="[object Number]"&&R(s)}function x(s){return Z(s)==="[object Boolean]"&&R(s)}function z(s){if(V)return s&&typeof s=="object"&&s instanceof Symbol;if(typeof s=="symbol")return!0;if(!s||typeof s!="object"||!H)return!1;try{return H.call(s),!0}catch{}return!1}function K(s){if(!s||typeof s!="object"||!L)return!1;try{return L.call(s),!0}catch{}return!1}var J=Object.prototype.hasOwnProperty||function(s){return s in this};function Y(s,l){return J.call(s,l)}function Z(s){return B.call(s)}function sr(s){if(s.name)return s.name;var l=w.call(q.call(s),/^function\s*([\w$]+)/);return l?l[1]:null}function or(s,l){if(s.indexOf)return s.indexOf(l);for(var D=0,W=s.length;D<W;D++)if(s[D]===l)return D;return-1}function rr(s){if(!n||!s||typeof s!="object")return!1;try{n.call(s);try{i.call(s)}catch{return!0}return s instanceof Map}catch{}return!1}function lr(s){if(!c||!s||typeof s!="object")return!1;try{c.call(s,c);try{p.call(s,p)}catch{return!0}return s instanceof WeakMap}catch{}return!1}function cr(s){if(!h||!s||typeof s!="object")return!1;try{return h.call(s),!0}catch{}return!1}function pr(s){if(!i||!s||typeof s!="object")return!1;try{i.call(s);try{n.call(s)}catch{return!0}return s instanceof Set}catch{}return!1}function Nr(s){if(!p||!s||typeof s!="object")return!1;try{p.call(s,p);try{c.call(s,c)}catch{return!0}return s instanceof WeakSet}catch{}return!1}function gr(s){return!s||typeof s!="object"?!1:typeof HTMLElement<"u"&&s instanceof HTMLElement?!0:typeof s.nodeName=="string"&&typeof s.getAttribute=="function"}function Rr(s,l){if(s.length>l.maxStringLength){var D=s.length-l.maxStringLength,W="... "+D+" more character"+(D>1?"s":"");return Rr(O.call(s,0,l.maxStringLength),l)+W}var k=vr[l.quoteStyle||"single"];k.lastIndex=0;var E=b.call(b.call(s,k,"\\$1"),/[\x00-\x1f]/g,Tr);return g(E,"single",l)}function Tr(s){var l=s.charCodeAt(0),D={8:"b",9:"t",10:"n",12:"f",13:"r"}[l];return D?"\\"+D:"\\x"+(l<16?"0":"")+T.call(l.toString(16))}function hr(s){return"Object("+s+")"}function Yr(s){return s+" { ? }"}function Zt(s,l,D,W){var k=W?Xr(D,W):C.call(D,", ");return s+" ("+l+") {"+k+"}"}function So(s){for(var l=0;l<s.length;l++)if(or(s[l],`
|
|
2
|
-
`)>=0)return!1;return!0}function bo(s,l){var D;if(s.indent===" ")D=" ";else if(typeof s.indent=="number"&&s.indent>0)D=C.call(Array(s.indent+1)," ");else return null;return{base:D,prev:C.call(Array(l+1),D)}}function Xr(s,l){if(s.length===0)return"";var D=`
|
|
3
|
-
`+l.prev+l.base;return D+C.call(s,","+D)+`
|
|
4
|
-
`+l.prev}function Wr(s,l){var D=$(s),W=[];if(D){W.length=s.length;for(var k=0;k<s.length;k++)W[k]=Y(s,k)?l(s[k],s):""}var E=typeof N=="function"?N(s):[],dr;if(V){dr={};for(var Or=0;Or<E.length;Or++)dr["$"+E[Or]]=E[Or]}for(var tr in s)Y(s,tr)&&(D&&String(Number(tr))===tr&&tr<s.length||V&&dr["$"+tr]instanceof Symbol||(G.call(/[^\w$]/,tr)?W.push(l(tr,s)+": "+l(s[tr],s)):W.push(tr+": "+l(s[tr],s))));if(typeof N=="function")for(var mr=0;mr<E.length;mr++)Ir.call(s,E[mr])&&W.push("["+l(E[mr])+"]: "+l(s[E[mr]],s));return W}return st}var lt,ya;function ei(){if(ya)return lt;ya=1;var r=Jr(),e=nr(),n=function(a,u,c){for(var v=a,p;(p=v.next)!=null;v=p)if(p.key===u)return v.next=p.next,c||(p.next=a.next,a.next=p),p},o=function(a,u){if(a){var c=n(a,u);return c&&c.value}},t=function(a,u,c){var v=n(a,u);v?v.value=c:a.next={key:u,next:a.next,value:c}},f=function(a,u){return a?!!n(a,u):!1},i=function(a,u){if(a)return n(a,u,!0)};return lt=function(){var u,c={assert:function(v){if(!c.has(v))throw new e("Side channel does not contain "+r(v))},delete:function(v){var p=u&&u.next,y=i(u,v);return y&&p&&p===y&&(u=void 0),!!y},get:function(v){return o(u,v)},has:function(v){return f(u,v)},set:function(v,p){u||(u={next:void 0}),t(u,v,p)}};return c},lt}var ct,va;function uo(){if(va)return ct;va=1;var r=yr(),e=Q(),n=Jr(),o=nr(),t=r("%Map%",!0),f=e("Map.prototype.get",!0),i=e("Map.prototype.set",!0),a=e("Map.prototype.has",!0),u=e("Map.prototype.delete",!0),c=e("Map.prototype.size",!0);return ct=!!t&&function(){var p,y={assert:function(h){if(!y.has(h))throw new o("Side channel does not contain "+n(h))},delete:function(h){if(p){var m=u(p,h);return c(p)===0&&(p=void 0),m}return!1},get:function(h){if(p)return f(p,h)},has:function(h){return p?a(p,h):!1},set:function(h,m){p||(p=new t),i(p,h,m)}};return y},ct}var pt,ga;function ti(){if(ga)return pt;ga=1;var r=yr(),e=Q(),n=Jr(),o=uo(),t=nr(),f=r("%WeakMap%",!0),i=e("WeakMap.prototype.get",!0),a=e("WeakMap.prototype.set",!0),u=e("WeakMap.prototype.has",!0),c=e("WeakMap.prototype.delete",!0);return pt=f?function(){var p,y,h={assert:function(m){if(!h.has(m))throw new t("Side channel does not contain "+n(m))},delete:function(m){if(f&&m&&(typeof m=="object"||typeof m=="function")){if(p)return c(p,m)}else if(o&&y)return y.delete(m);return!1},get:function(m){return f&&m&&(typeof m=="object"||typeof m=="function")&&p?i(p,m):y&&y.get(m)},has:function(m){return f&&m&&(typeof m=="object"||typeof m=="function")&&p?u(p,m):!!y&&y.has(m)},set:function(m,B){f&&m&&(typeof m=="object"||typeof m=="function")?(p||(p=new f),a(p,m,B)):o&&(y||(y=o()),y.set(m,B))}};return h}:o,pt}var yt,ha;function fo(){if(ha)return yt;ha=1;var r=nr(),e=Jr(),n=ei(),o=uo(),t=ti(),f=t||o||n;return yt=function(){var a,u={assert:function(c){if(!u.has(c))throw new r("Side channel does not contain "+e(c))},delete:function(c){return!!a&&a.delete(c)},get:function(c){return a&&a.get(c)},has:function(c){return!!a&&a.has(c)},set:function(c,v){a||(a=f()),a.set(c,v)}};return u},yt}var vt,da;function ni(){if(da)return vt;da=1;var r=Qt(),e=fo()(),n=nr(),o={assert:function(t,f){if(!t||typeof t!="object"&&typeof t!="function")throw new n("`O` is not an object");if(typeof f!="string")throw new n("`slot` must be a string");if(e.assert(t),!o.has(t,f))throw new n("`"+f+"` is not present on `O`")},get:function(t,f){if(!t||typeof t!="object"&&typeof t!="function")throw new n("`O` is not an object");if(typeof f!="string")throw new n("`slot` must be a string");var i=e.get(t);return i&&i["$"+f]},has:function(t,f){if(!t||typeof t!="object"&&typeof t!="function")throw new n("`O` is not an object");if(typeof f!="string")throw new n("`slot` must be a string");var i=e.get(t);return!!i&&r(i,"$"+f)},set:function(t,f,i){if(!t||typeof t!="object"&&typeof t!="function")throw new n("`O` is not an object");if(typeof f!="string")throw new n("`slot` must be a string");var a=e.get(t);a||(a={},e.set(t,a)),a["$"+f]=i}};return Object.freeze&&Object.freeze(o),vt=o,vt}var gt,ma;function ai(){if(ma)return gt;ma=1;var r=ni(),e=Ht(),n=typeof StopIteration=="object"?StopIteration:null;return gt=function(t){if(!n)throw new e("this environment lacks StopIteration");r.set(t,"[[Done]]",!1);var f={next:function(){var a=r.get(this,"[[Iterator]]"),u=!!r.get(a,"[[Done]]");try{return{done:u,value:u?void 0:a.next()}}catch(c){if(r.set(a,"[[Done]]",!0),c!==n)throw c;return{done:!0,value:void 0}}}};return r.set(f,"[[Iterator]]",t),f},gt}var ht,Sa;function so(){if(Sa)return ht;Sa=1;var r={}.toString;return ht=Array.isArray||function(e){return r.call(e)=="[object Array]"},ht}var dt,ba;function lo(){if(ba)return dt;ba=1;var r=Q(),e=r("String.prototype.valueOf"),n=function(a){try{return e(a),!0}catch{return!1}},o=r("Object.prototype.toString"),t="[object String]",f=Pr()();return dt=function(a){return typeof a=="string"?!0:!a||typeof a!="object"?!1:f?n(a):o(a)===t},dt}var mt,Aa;function co(){if(Aa)return mt;Aa=1;var r=typeof Map=="function"&&Map.prototype?Map:null,e=typeof Set=="function"&&Set.prototype?Set:null,n;r||(n=function(i){return!1});var o=r?Map.prototype.has:null,t=e?Set.prototype.has:null;return!n&&!o&&(n=function(i){return!1}),mt=n||function(i){if(!i||typeof i!="object")return!1;try{if(o.call(i),t)try{t.call(i)}catch{return!0}return i instanceof r}catch{}return!1},mt}var St,Oa;function po(){if(Oa)return St;Oa=1;var r=typeof Map=="function"&&Map.prototype?Map:null,e=typeof Set=="function"&&Set.prototype?Set:null,n;e||(n=function(i){return!1});var o=r?Map.prototype.has:null,t=e?Set.prototype.has:null;return!n&&!t&&(n=function(i){return!1}),St=n||function(i){if(!i||typeof i!="object")return!1;try{if(t.call(i),o)try{o.call(i)}catch{return!0}return i instanceof e}catch{}return!1},St}var qa;function oi(){if(qa)return Cr.exports;qa=1;var r=io(),e=ai();if(Vt()()||Kr()()){var n=Symbol.iterator;Cr.exports=function(P){if(P!=null&&typeof P[n]<"u")return P[n]();if(r(P))return Array.prototype[n].call(P)}}else{var o=so(),t=lo(),f=yr(),i=f("%Map%",!0),a=f("%Set%",!0),u=no(),c=u("Array.prototype.push"),v=u("String.prototype.charCodeAt"),p=u("String.prototype.slice"),y=function(P,_){var L=P.length;if(_+1>=L)return _+1;var N=v(P,_);if(N<55296||N>56319)return _+1;var H=v(P,_+1);return H<56320||H>57343?_+1:_+2},h=function(P){var _=0;return{next:function(){var N=_>=P.length,H;return N||(H=P[_],_+=1),{done:N,value:H}}}},m=function(P,_){if(o(P)||r(P))return h(P);if(t(P)){var L=0;return{next:function(){var H=y(P,L),V=p(P,L,H);return L=H,{done:H>P.length,value:V}}}}if(_&&typeof P["_es6-shim iterator_"]<"u")return P["_es6-shim iterator_"]()};if(!i&&!a)Cr.exports=function(P){if(P!=null)return m(P,!0)};else{var B=co(),q=po(),w=u("Map.prototype.forEach",!0),O=u("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var b=u("Map.prototype.iterator",!0),T=u("Set.prototype.iterator",!0);var X=u("Map.prototype.@@iterator",!0)||u("Map.prototype._es6-shim iterator_",!0),G=u("Set.prototype.@@iterator",!0)||u("Set.prototype._es6-shim iterator_",!0),F=function(P){if(B(P)){if(b)return e(b(P));if(X)return X(P);if(w){var _=[];return w(P,function(N,H){c(_,[H,N])}),h(_)}}if(q(P)){if(T)return e(T(P));if(G)return G(P);if(O){var L=[];return O(P,function(N){c(L,N)}),h(L)}}};Cr.exports=function(P){return F(P)||m(P)}}}return Cr.exports}var bt,wa;function yo(){if(wa)return bt;wa=1;var r=function(e){return e!==e};return bt=function(n,o){return n===0&&o===0?1/n===1/o:!!(n===o||r(n)&&r(o))},bt}var At,Pa;function vo(){if(Pa)return At;Pa=1;var r=yo();return At=function(){return typeof Object.is=="function"?Object.is:r},At}var Ot,Ia;function ii(){if(Ia)return Ot;Ia=1;var r=vo(),e=wr();return Ot=function(){var o=r();return e(Object,{is:o},{is:function(){return Object.is!==o}}),o},Ot}var qt,$a;function ui(){if($a)return qt;$a=1;var r=wr(),e=jr(),n=yo(),o=vo(),t=ii(),f=e(o(),Object);return r(f,{getPolyfill:o,implementation:n,shim:t}),qt=f,qt}var wt,Ra;function go(){if(Ra)return wt;Ra=1;var r=jr(),e=Q(),n=yr(),o=n("%ArrayBuffer%",!0),t=e("ArrayBuffer.prototype.byteLength",!0),f=e("Object.prototype.toString"),i=!!o&&!t&&new o(0).slice,a=!!i&&r(i);return wt=t||a?function(c){if(!c||typeof c!="object")return!1;try{return t?t(c):a(c,0),!0}catch{return!1}}:o?function(c){return f(c)==="[object ArrayBuffer]"}:function(c){return!1},wt}var Pt,xa;function fi(){if(xa)return Pt;xa=1;var r=Q(),e=r("Date.prototype.getDay"),n=function(a){try{return e(a),!0}catch{return!1}},o=r("Object.prototype.toString"),t="[object Date]",f=Pr()();return Pt=function(a){return typeof a!="object"||a===null?!1:f?n(a):o(a)===t},Pt}var It,Ea;function ho(){if(Ea)return It;Ea=1;var r=Q(),e=Pr()(),n=Qt(),o=qr(),t;if(e){var f=r("RegExp.prototype.exec"),i={},a=function(){throw i},u={toString:a,valueOf:a};typeof Symbol.toPrimitive=="symbol"&&(u[Symbol.toPrimitive]=a),t=function(y){if(!y||typeof y!="object")return!1;var h=o(y,"lastIndex"),m=h&&n(h,"value");if(!m)return!1;try{f(y,u)}catch(B){return B===i}}}else{var c=r("Object.prototype.toString"),v="[object RegExp]";t=function(y){return!y||typeof y!="object"&&typeof y!="function"?!1:c(y)===v}}return It=t,It}var $t,Ba;function si(){if(Ba)return $t;Ba=1;var r=Q(),e=r("SharedArrayBuffer.prototype.byteLength",!0);return $t=e?function(o){if(!o||typeof o!="object")return!1;try{return e(o),!0}catch{return!1}}:function(o){return!1},$t}var Rt,ja;function li(){if(ja)return Rt;ja=1;var r=Q(),e=r("Number.prototype.toString"),n=function(a){try{return e(a),!0}catch{return!1}},o=r("Object.prototype.toString"),t="[object Number]",f=Pr()();return Rt=function(a){return typeof a=="number"?!0:!a||typeof a!="object"?!1:f?n(a):o(a)===t},Rt}var xt,Ta;function ci(){if(Ta)return xt;Ta=1;var r=Q(),e=r("Boolean.prototype.toString"),n=r("Object.prototype.toString"),o=function(a){try{return e(a),!0}catch{return!1}},t="[object Boolean]",f=Pr()();return xt=function(a){return typeof a=="boolean"?!0:a===null||typeof a!="object"?!1:f?o(a):n(a)===t},xt}var Hr={exports:{}},Et,Ma;function pi(){if(Ma)return Et;Ma=1;var r=Q(),e=ho(),n=r("RegExp.prototype.exec"),o=nr();return Et=function(f){if(!e(f))throw new o("`regex` must be a RegExp");return function(a){return n(f,a)!==null}},Et}var Da;function yi(){if(Da)return Hr.exports;Da=1;var r=Q(),e=r("Object.prototype.toString"),n=Vt()(),o=pi();if(n){var t=r("Symbol.prototype.toString"),f=o(/^Symbol\(.*\)$/),i=function(u){return typeof u.valueOf()!="symbol"?!1:f(t(u))};Hr.exports=function(u){if(typeof u=="symbol")return!0;if(!u||typeof u!="object"||e(u)!=="[object Symbol]")return!1;try{return i(u)}catch{return!1}}}else Hr.exports=function(u){return!1};return Hr.exports}var Gr={exports:{}},Bt,Ca;function vi(){if(Ca)return Bt;Ca=1;var r=typeof BigInt<"u"&&BigInt;return Bt=function(){return typeof r=="function"&&typeof BigInt=="function"&&typeof r(42)=="bigint"&&typeof BigInt(42)=="bigint"},Bt}var Fa;function gi(){if(Fa)return Gr.exports;Fa=1;var r=vi()();if(r){var e=BigInt.prototype.valueOf,n=function(t){try{return e.call(t),!0}catch{}return!1};Gr.exports=function(t){return t===null||typeof t>"u"||typeof t=="boolean"||typeof t=="string"||typeof t=="number"||typeof t=="symbol"||typeof t=="function"?!1:typeof t=="bigint"?!0:n(t)}}else Gr.exports=function(t){return!1};return Gr.exports}var jt,_a;function hi(){if(_a)return jt;_a=1;var r=lo(),e=li(),n=ci(),o=yi(),t=gi();return jt=function(i){if(i==null||typeof i!="object"&&typeof i!="function")return null;if(r(i))return"String";if(e(i))return"Number";if(n(i))return"Boolean";if(o(i))return"Symbol";if(t(i))return"BigInt"},jt}var Tt,Na;function di(){if(Na)return Tt;Na=1;var r=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,e=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,n;r||(n=function(i){return!1});var o=r?r.prototype.has:null,t=e?e.prototype.has:null;return!n&&!o&&(n=function(i){return!1}),Tt=n||function(i){if(!i||typeof i!="object")return!1;try{if(o.call(i,o),t)try{t.call(i,t)}catch{return!0}return i instanceof r}catch{}return!1},Tt}var Ur={exports:{}},Wa;function mi(){if(Wa)return Ur.exports;Wa=1;var r=yr(),e=Q(),n=r("%WeakSet%",!0),o=e("WeakSet.prototype.has",!0);if(o){var t=e("WeakMap.prototype.has",!0);Ur.exports=function(i){if(!i||typeof i!="object")return!1;try{if(o(i,o),t)try{t(i,t)}catch{return!0}return i instanceof n}catch{}return!1}}else Ur.exports=function(i){return!1};return Ur.exports}var Mt,ka;function Si(){if(ka)return Mt;ka=1;var r=co(),e=po(),n=di(),o=mi();return Mt=function(f){if(f&&typeof f=="object"){if(r(f))return"Map";if(e(f))return"Set";if(n(f))return"WeakMap";if(o(f))return"WeakSet"}return!1},Mt}var Dt,La;function bi(){if(La)return Dt;La=1;var r=Function.prototype.toString,e=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,n,o;if(typeof e=="function"&&typeof Object.defineProperty=="function")try{n=Object.defineProperty({},"length",{get:function(){throw o}}),o={},e(function(){throw 42},null,n)}catch(O){O!==o&&(e=null)}else e=null;var t=/^\s*class\b/,f=function(b){try{var T=r.call(b);return t.test(T)}catch{return!1}},i=function(b){try{return f(b)?!1:(r.call(b),!0)}catch{return!1}},a=Object.prototype.toString,u="[object Object]",c="[object Function]",v="[object GeneratorFunction]",p="[object HTMLAllCollection]",y="[object HTML document.all class]",h="[object HTMLCollection]",m=typeof Symbol=="function"&&!!Symbol.toStringTag,B=!(0 in[,]),q=function(){return!1};if(typeof document=="object"){var w=document.all;a.call(w)===a.call(document.all)&&(q=function(b){if((B||!b)&&(typeof b>"u"||typeof b=="object"))try{var T=a.call(b);return(T===p||T===y||T===h||T===u)&&b("")==null}catch{}return!1})}return Dt=e?function(b){if(q(b))return!0;if(!b||typeof b!="function"&&typeof b!="object")return!1;try{e(b,null,n)}catch(T){if(T!==o)return!1}return!f(b)&&i(b)}:function(b){if(q(b))return!0;if(!b||typeof b!="function"&&typeof b!="object")return!1;if(m)return i(b);if(f(b))return!1;var T=a.call(b);return T!==c&&T!==v&&!/^\[object HTML/.test(T)?!1:i(b)},Dt}var Ct,Ha;function Ai(){if(Ha)return Ct;Ha=1;var r=bi(),e=Object.prototype.toString,n=Object.prototype.hasOwnProperty,o=function(u,c,v){for(var p=0,y=u.length;p<y;p++)n.call(u,p)&&(v==null?c(u[p],p,u):c.call(v,u[p],p,u))},t=function(u,c,v){for(var p=0,y=u.length;p<y;p++)v==null?c(u.charAt(p),p,u):c.call(v,u.charAt(p),p,u)},f=function(u,c,v){for(var p in u)n.call(u,p)&&(v==null?c(u[p],p,u):c.call(v,u[p],p,u))};function i(a){return e.call(a)==="[object Array]"}return Ct=function(u,c,v){if(!r(c))throw new TypeError("iterator must be a function");var p;arguments.length>=3&&(p=v),i(u)?o(u,c,p):typeof u=="string"?t(u,c,p):f(u,c,p)},Ct}var Ft,Ga;function Oi(){return Ga||(Ga=1,Ft=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),Ft}var _t,Ua;function qi(){if(Ua)return _t;Ua=1;var r=Oi(),e=typeof globalThis>"u"?Br.commonjsGlobal:globalThis;return _t=function(){for(var o=[],t=0;t<r.length;t++)typeof e[r[t]]=="function"&&(o[o.length]=r[t]);return o},_t}var Nt,za;function wi(){if(za)return Nt;za=1;var r=Ai(),e=qi(),n=jr(),o=Q(),t=qr(),f=Xt(),i=o("Object.prototype.toString"),a=Pr()(),u=typeof globalThis>"u"?Br.commonjsGlobal:globalThis,c=e(),v=o("String.prototype.slice"),p=o("Array.prototype.indexOf",!0)||function(q,w){for(var O=0;O<q.length;O+=1)if(q[O]===w)return O;return-1},y={__proto__:null};a&&t&&f?r(c,function(B){var q=new u[B];if(Symbol.toStringTag in q&&f){var w=f(q),O=t(w,Symbol.toStringTag);if(!O&&w){var b=f(w);O=t(b,Symbol.toStringTag)}y["$"+B]=n(O.get)}}):r(c,function(B){var q=new u[B],w=q.slice||q.set;w&&(y["$"+B]=n(w))});var h=function(q){var w=!1;return r(y,function(O,b){if(!w)try{"$"+O(q)===b&&(w=v(b,1))}catch{}}),w},m=function(q){var w=!1;return r(y,function(O,b){if(!w)try{O(q),w=v(b,1)}catch{}}),w};return Nt=function(q){if(!q||typeof q!="object")return!1;if(!a){var w=v(i(q),8,-1);return p(c,w)>-1?w:w!=="Object"?!1:m(q)}return t?h(q):null},Nt}var Wt,Va;function Pi(){if(Va)return Wt;Va=1;var r=Q(),e=r("ArrayBuffer.prototype.byteLength",!0),n=go();return Wt=function(t){return n(t)?e?e(t):t.byteLength:NaN},Wt}var kt,Ka;function Ii(){if(Ka)return kt;Ka=1;var r=Vo(),e=no(),n=Xo(),o=yr(),t=oi(),f=fo(),i=ui(),a=io(),u=so(),c=go(),v=fi(),p=ho(),y=si(),h=Lt(),m=hi(),B=Si(),q=wi(),w=Pi(),O=e("SharedArrayBuffer.prototype.byteLength",!0),b=e("Date.prototype.getTime"),T=Object.getPrototypeOf,X=e("Object.prototype.toString"),G=o("%Set%",!0),F=e("Map.prototype.has",!0),C=e("Map.prototype.get",!0),P=e("Map.prototype.size",!0),_=e("Set.prototype.add",!0),L=e("Set.prototype.delete",!0),N=e("Set.prototype.has",!0),H=e("Set.prototype.size",!0);function V(g,d,R,$){for(var j=t(g),M;(M=j.next())&&!M.done;)if(U(d,M.value,R,$))return L(g,M.value),!0;return!1}function fr(g){if(typeof g>"u")return null;if(typeof g!="object")return typeof g=="symbol"?!1:typeof g=="string"||typeof g=="number"?+g==+g:!0}function Ir(g,d,R,$,j,M){var A=fr(R);if(A!=null)return A;var I=C(d,A),S=r({},j,{strict:!1});return typeof I>"u"&&!F(d,A)||!U($,I,S,M)?!1:!F(g,A)&&U($,I,S,M)}function Sr(g,d,R){var $=fr(R);return $??(N(d,$)&&!N(g,$))}function ar(g,d,R,$,j,M){for(var A=t(g),I,S;(I=A.next())&&!I.done;)if(S=I.value,U(R,S,j,M)&&U($,C(d,S),j,M))return L(g,S),!0;return!1}function U(g,d,R,$){var j=R||{};if(j.strict?i(g,d):g===d)return!0;var M=m(g),A=m(d);if(M!==A)return!1;if(!g||!d||typeof g!="object"&&typeof d!="object")return j.strict?i(g,d):g==d;var I=$.has(g),S=$.has(d),x;if(I&&S){if($.get(g)===$.get(d))return!0}else x={};return I||$.set(g,x),S||$.set(d,x),vr(g,d,j,$)}function br(g){return!g||typeof g!="object"||typeof g.length!="number"||typeof g.copy!="function"||typeof g.slice!="function"||g.length>0&&typeof g[0]!="number"?!1:!!(g.constructor&&g.constructor.isBuffer&&g.constructor.isBuffer(g))}function $r(g,d,R,$){if(H(g)!==H(d))return!1;for(var j=t(g),M=t(d),A,I,S;(A=j.next())&&!A.done;)if(A.value&&typeof A.value=="object")S||(S=new G),_(S,A.value);else if(!N(d,A.value)){if(R.strict||!Sr(g,d,A.value))return!1;S||(S=new G),_(S,A.value)}if(S){for(;(I=M.next())&&!I.done;)if(I.value&&typeof I.value=="object"){if(!V(S,I.value,R.strict,$))return!1}else if(!R.strict&&!N(g,I.value)&&!V(S,I.value,R.strict,$))return!1;return H(S)===0}return!0}function Ar(g,d,R,$){if(P(g)!==P(d))return!1;for(var j=t(g),M=t(d),A,I,S,x,z,K;(A=j.next())&&!A.done;)if(x=A.value[0],z=A.value[1],x&&typeof x=="object")S||(S=new G),_(S,x);else if(K=C(d,x),typeof K>"u"&&!F(d,x)||!U(z,K,R,$)){if(R.strict||!Ir(g,d,x,z,R,$))return!1;S||(S=new G),_(S,x)}if(S){for(;(I=M.next())&&!I.done;)if(x=I.value[0],K=I.value[1],x&&typeof x=="object"){if(!ar(S,g,x,K,R,$))return!1}else if(!R.strict&&(!g.has(x)||!U(C(g,x),K,R,$))&&!ar(S,g,x,K,r({},R,{strict:!1}),$))return!1;return H(S)===0}return!0}function vr(g,d,R,$){var j,M;if(typeof g!=typeof d||g==null||d==null||X(g)!==X(d)||a(g)!==a(d))return!1;var A=u(g),I=u(d);if(A!==I)return!1;var S=g instanceof Error,x=d instanceof Error;if(S!==x||(S||x)&&(g.name!==d.name||g.message!==d.message))return!1;var z=p(g),K=p(d);if(z!==K||(z||K)&&(g.source!==d.source||n(g)!==n(d)))return!1;var J=v(g),Y=v(d);if(J!==Y||(J||Y)&&b(g)!==b(d)||R.strict&&T&&T(g)!==T(d))return!1;var Z=q(g),sr=q(d);if(Z!==sr)return!1;if(Z||sr){if(g.length!==d.length)return!1;for(j=0;j<g.length;j++)if(g[j]!==d[j])return!1;return!0}var or=br(g),rr=br(d);if(or!==rr)return!1;if(or||rr){if(g.length!==d.length)return!1;for(j=0;j<g.length;j++)if(g[j]!==d[j])return!1;return!0}var lr=c(g),cr=c(d);if(lr!==cr)return!1;if(lr||cr)return w(g)!==w(d)?!1:typeof Uint8Array=="function"&&U(new Uint8Array(g),new Uint8Array(d),R,$);var pr=y(g),Nr=y(d);if(pr!==Nr)return!1;if(pr||Nr)return O(g)!==O(d)?!1:typeof Uint8Array=="function"&&U(new Uint8Array(g),new Uint8Array(d),R,$);if(typeof g!=typeof d)return!1;var gr=h(g),Rr=h(d);if(gr.length!==Rr.length)return!1;for(gr.sort(),Rr.sort(),j=gr.length-1;j>=0;j--)if(gr[j]!=Rr[j])return!1;for(j=gr.length-1;j>=0;j--)if(M=gr[j],!U(g[M],d[M],R,$))return!1;var Tr=B(g),hr=B(d);return Tr!==hr?!1:Tr==="Set"||hr==="Set"?$r(g,d,R,$):Tr==="Map"?Ar(g,d,R,$):!0}return kt=function(d,R,$){return U(d,R,$,f())},kt}var $i=Ii();const Ri=Br.getDefaultExportFromCjs($i);function xi(r){return r}function mo(r,e,n,o){const t=xi,[f,i]=ur.useState(t(n)),a=ur.useRef(f);return ur.useEffect(()=>{const u=()=>{const c={...n,...r.getAttributes(e)};Object.keys(c).forEach(p=>{(c[p]===null||c[p]===void 0)&&(c[p]=n?n[p]:null)});const v=t(c);Ri(a.current,v)||(i(v),a.current=v)};return r.on("selectionUpdate",u),r.on("transaction",u),()=>{r.off("selectionUpdate",u),r.off("transaction",u)}},[r,n,e,t]),f}function Ei({node:r}){const{text:e}=r.attrs,n=ur.useMemo(()=>{try{return Ja.renderToString(`${e}`)}catch{return e}},[e]),o=ur.useMemo(()=>e.trim()?er.jsx("span",{contentEditable:!1,dangerouslySetInnerHTML:{__html:n}}):er.jsx("span",{contentEditable:!1,children:"Not enter a formula"}),[e,n]);return er.jsx(Fr.NodeViewWrapper,{as:"span",style:{display:"inline-block"},children:o})}function Bi(){const{t:r}=Po.useLocale(),[e,n]=ur.useState(!1),o=oe.useButtonProps(zr.name),{icon:t=void 0,tooltip:f=void 0,tooltipOptions:i={},isActive:a=void 0}=(o==null?void 0:o.componentProps)??{},{editorDisabled:u}=oe.useToggleActive(a),c=oe.useEditorInstance(),v=mo(c,zr.name,{text:"",defaultShowPicker:!1}),{text:p,defaultShowPicker:y}=v,[h,m]=ur.useState(p||""),B=ur.useCallback(()=>{c.chain().focus().setKatex({text:h}).run(),m(""),n(!1)},[c,h]);ur.useEffect(()=>{y&&c.chain().updateAttributes(zr.name,{defaultShowPicker:!1}).focus().run()},[c,y]);const q=ur.useMemo(()=>{try{return Ja.renderToString(`${h}`)}catch{return h}},[h]),w=ur.useMemo(()=>`${h}`.trim()?q:null,[h,q]);return er.jsxs(Dr.Dialog,{onOpenChange:n,open:e,children:[er.jsx(Dr.DialogTrigger,{asChild:!0,disabled:u,children:er.jsx(qo.ActionButton,{disabled:u,icon:t,tooltip:f,tooltipOptions:i,action:()=>{u||n(!0)}})}),er.jsxs(Dr.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[er.jsx(Dr.DialogTitle,{children:r("editor.formula.dialog.text")}),er.jsx("div",{style:{height:"100%",border:"1px solid hsl(var(--border))"},children:er.jsxs("div",{className:"richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]",children:[er.jsx(wo.Textarea,{autoFocus:!0,className:"richtext-flex-1",onChange:O=>m(O.target.value),placeholder:"Text",required:!0,rows:10,value:h,style:{color:"hsl(var(--foreground))"}}),er.jsx("div",{className:"richtext-flex richtext-flex-1 richtext-items-center richtext-justify-center richtext-rounded-[10px] richtext-p-[10px]",dangerouslySetInnerHTML:{__html:w||""},style:{height:"100%",borderWidth:1,minHeight:500,background:"#fff"}})]})}),er.jsx(Dr.DialogFooter,{children:er.jsx(Io.Button,{onClick:B,type:"button",children:"Save changes"})})]})]})}function ji(r){return e=>e.getAttribute(r)}const zr=Fr.Node3.create({name:"katex",group:"inline",inline:!0,defining:!0,draggable:!0,selectable:!0,addOptions(){return{HTMLAttributes:{class:"katex"},button:({t:r})=>({componentProps:{action:()=>!0,isActive:()=>!1,disabled:!1,icon:"KatexIcon",tooltip:r("editor.katex.tooltip")}})}},addAttributes(){return{text:{default:"",parseHTML:ji("text")},defaultShowPicker:{default:!1}}},parseHTML(){return[{tag:"span.katex"}]},renderHTML({HTMLAttributes:r}){return["span",Fr.mergeAttributes(this.options&&this.options.HTMLAttributes||{},r)]},addCommands(){return{setKatex:r=>({commands:e})=>e.insertContent({type:this.name,attrs:r})}},addInputRules(){return[Fr.nodeInputRule({find:/^\$katex\$$/,type:this.type,getAttributes:()=>({defaultShowPicker:!0})})]},addNodeView(){return Fr.ReactNodeViewRenderer(Ei)}});exports.Katex=zr;exports.RichTextKatex=Bi;exports.useAttributes=mo;
|
package/lib/Table-3VstSlg4.cjs
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";const g=require("./index-DLqogznp.cjs"),_e=require("@tiptap/pm/state"),D=require("./index-DCJheRBq.cjs"),A=require("react/jsx-runtime"),Ie=require("./toggle-DVCNvcqp.cjs"),W=require("react");require("./index-CNzHZDls.cjs");const v=require("./index-FSRjMsxW.cjs"),X=require("./popover-CZWSQZ0q.cjs"),Z=require("./useButtonProps-bei1vI37.cjs");let J,Y;if(typeof WeakMap<"u"){let t=new WeakMap;J=e=>t.get(e),Y=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;J=o=>{for(let l=0;l<t.length;l+=2)if(t[l]==o)return t[l+1]},Y=(o,l)=>(n==10&&(n=0),t[n++]=o,t[n++]=l)}var y=class{constructor(t,e,n,o){this.width=t,this.height=e,this.map=n,this.problems=o}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const o=e%this.width,l=e/this.width|0;let r=o+1,s=l+1;for(let i=1;r<this.width&&this.map[e+i]==n;i++)r++;for(let i=1;s<this.height&&this.map[e+this.width*i]==n;i++)s++;return{left:o,top:l,right:r,bottom:s}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:o,right:l,top:r,bottom:s}=this.findCell(t);return e=="horiz"?(n<0?o==0:l==this.width)?null:this.map[r*this.width+(n<0?o-1:l)]:(n<0?r==0:s==this.height)?null:this.map[o+this.width*(n<0?r-1:s)]}rectBetween(t,e){const{left:n,right:o,top:l,bottom:r}=this.findCell(t),{left:s,right:i,top:c,bottom:a}=this.findCell(e);return{left:Math.min(n,s),top:Math.min(l,c),right:Math.max(o,i),bottom:Math.max(r,a)}}cellsInRect(t){const e=[],n={};for(let o=t.top;o<t.bottom;o++)for(let l=t.left;l<t.right;l++){const r=o*this.width+l,s=this.map[r];n[s]||(n[s]=!0,!(l==t.left&&l&&this.map[r-1]==s||o==t.top&&o&&this.map[r-this.width]==s)&&e.push(s))}return e}positionAt(t,e,n){for(let o=0,l=0;;o++){const r=l+n.child(o).nodeSize;if(o==t){let s=e+t*this.width;const i=(t+1)*this.width;for(;s<i&&this.map[s]<l;)s++;return s==i?r-1:this.map[s]}l=r}}static get(t){return J(t)||Y(t,Be(t))}};function Be(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=$e(t),n=t.childCount,o=[];let l=0,r=null;const s=[];for(let a=0,d=e*n;a<d;a++)o[a]=0;for(let a=0,d=0;a<n;a++){const u=t.child(a);d++;for(let p=0;;p++){for(;l<o.length&&o[l]!=0;)l++;if(p==u.childCount)break;const m=u.child(p),{colspan:b,rowspan:w,colwidth:x}=m.attrs;for(let R=0;R<w;R++){if(R+a>=n){(r||(r=[])).push({type:"overlong_rowspan",pos:d,n:w-R});break}const L=l+R*e;for(let M=0;M<b;M++){o[L+M]==0?o[L+M]=d:(r||(r=[])).push({type:"collision",row:a,pos:d,n:b-M});const $=x&&x[M];if($){const I=(L+M)%e*2,K=s[I];K==null||K!=$&&s[I+1]==1?(s[I]=$,s[I+1]=1):K==$&&s[I+1]++}}}l+=b,d+=m.nodeSize}const f=(a+1)*e;let h=0;for(;l<f;)o[l++]==0&&h++;h&&(r||(r=[])).push({type:"missing",row:a,n:h}),d++}(e===0||n===0)&&(r||(r=[])).push({type:"zero_sized"});const i=new y(e,n,o,r);let c=!1;for(let a=0;!c&&a<s.length;a+=2)s[a]!=null&&s[a+1]<n&&(c=!0);return c&&We(i,s,t),i}function $e(t){let e=-1,n=!1;for(let o=0;o<t.childCount;o++){const l=t.child(o);let r=0;if(n)for(let s=0;s<o;s++){const i=t.child(s);for(let c=0;c<i.childCount;c++){const a=i.child(c);s+a.attrs.rowspan>o&&(r+=a.attrs.colspan)}}for(let s=0;s<l.childCount;s++){const i=l.child(s);r+=i.attrs.colspan,i.attrs.rowspan>1&&(n=!0)}e==-1?e=r:e!=r&&(e=Math.max(e,r))}return e}function We(t,e,n){t.problems||(t.problems=[]);const o={};for(let l=0;l<t.map.length;l++){const r=t.map[l];if(o[r])continue;o[r]=!0;const s=n.nodeAt(r);if(!s)throw new RangeError(`No cell with offset ${r} found`);let i=null;const c=s.attrs;for(let a=0;a<c.colspan;a++){const d=e[(l+a)%t.width*2];d!=null&&(!c.colwidth||c.colwidth[a]!=d)&&((i||(i=Fe(c)))[a]=d)}i&&t.problems.unshift({type:"colwidth mismatch",pos:r,colwidth:i})}}function Fe(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function S(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const o=t.nodes[n],l=o.spec.tableRole;l&&(e[l]=o)}}return e}const z=new g.PluginKey("selectingCells");function _(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function Pe(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function E(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function q(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=_(e.$head)||je(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function je(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Q(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function Oe(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function oe(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Se(t,e,n){const o=t.node(-1),l=y.get(o),r=t.start(-1),s=l.nextCell(t.pos-r,e,n);return s==null?null:t.node(0).resolve(r+s)}function H(t,e,n=1){const o={...t,colspan:t.colspan-n};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(e,n),o.colwidth.some(l=>l>0)||(o.colwidth=null)),o}function xe(t,e,n=1){const o={...t,colspan:t.colspan+n};if(o.colwidth){o.colwidth=o.colwidth.slice();for(let l=0;l<n;l++)o.colwidth.splice(e,0,0)}return o}function Ge(t,e,n){const o=S(e.type.schema).header_cell;for(let l=0;l<t.height;l++)if(e.nodeAt(t.map[n+l*t.width]).type!=o)return!1;return!0}var C=class k extends g.Selection{constructor(e,n=e){const o=e.node(-1),l=y.get(o),r=e.start(-1),s=l.rectBetween(e.pos-r,n.pos-r),i=e.node(0),c=l.cellsInRect(s).filter(d=>d!=n.pos-r);c.unshift(n.pos-r);const a=c.map(d=>{const u=o.nodeAt(d);if(!u)throw new RangeError(`No cell with offset ${d} found`);const f=r+d+1;return new g.SelectionRange(i.resolve(f),i.resolve(f+u.content.size))});super(a[0].$from,a[0].$to,a),this.$anchorCell=e,this.$headCell=n}map(e,n){const o=e.resolve(n.map(this.$anchorCell.pos)),l=e.resolve(n.map(this.$headCell.pos));if(Q(o)&&Q(l)&&oe(o,l)){const r=this.$anchorCell.node(-1)!=o.node(-1);return r&&this.isRowSelection()?k.rowSelection(o,l):r&&this.isColSelection()?k.colSelection(o,l):new k(o,l)}return g.TextSelection.between(o,l)}content(){const e=this.$anchorCell.node(-1),n=y.get(e),o=this.$anchorCell.start(-1),l=n.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o),r={},s=[];for(let c=l.top;c<l.bottom;c++){const a=[];for(let d=c*n.width+l.left,u=l.left;u<l.right;u++,d++){const f=n.map[d];if(r[f])continue;r[f]=!0;const h=n.findCell(f);let p=e.nodeAt(f);if(!p)throw new RangeError(`No cell with offset ${f} found`);const m=l.left-h.left,b=h.right-l.right;if(m>0||b>0){let w=p.attrs;if(m>0&&(w=H(w,0,m)),b>0&&(w=H(w,w.colspan-b,b)),h.left<l.left){if(p=p.type.createAndFill(w),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(w)}`)}else p=p.type.create(w,p.content)}if(h.top<l.top||h.bottom>l.bottom){const w={...p.attrs,rowspan:Math.min(h.bottom,l.bottom)-Math.max(h.top,l.top)};h.top<l.top?p=p.type.createAndFill(w):p=p.type.create(w,p.content)}a.push(p)}s.push(e.child(c).copy(g.Fragment.from(a)))}const i=this.isColSelection()&&this.isRowSelection()?e:s;return new g.Slice(g.Fragment.from(i),1,1)}replace(e,n=g.Slice.empty){const o=e.steps.length,l=this.ranges;for(let s=0;s<l.length;s++){const{$from:i,$to:c}=l[s],a=e.mapping.slice(o);e.replace(a.map(i.pos),a.map(c.pos),s?g.Slice.empty:n)}const r=g.Selection.findFrom(e.doc.resolve(e.mapping.slice(o).map(this.to)),-1);r&&e.setSelection(r)}replaceWith(e,n){this.replace(e,new g.Slice(g.Fragment.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),o=y.get(n),l=this.$anchorCell.start(-1),r=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-l,this.$headCell.pos-l));for(let s=0;s<r.length;s++)e(n.nodeAt(r[s]),l+r[s])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const o=e+this.$anchorCell.nodeAfter.attrs.rowspan,l=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,l)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const o=e.node(-1),l=y.get(o),r=e.start(-1),s=l.findCell(e.pos-r),i=l.findCell(n.pos-r),c=e.node(0);return s.top<=i.top?(s.top>0&&(e=c.resolve(r+l.map[s.left])),i.bottom<l.height&&(n=c.resolve(r+l.map[l.width*(l.height-1)+i.right-1]))):(i.top>0&&(n=c.resolve(r+l.map[i.left])),s.bottom<l.height&&(e=c.resolve(r+l.map[l.width*(l.height-1)+s.right-1]))),new k(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=y.get(e),o=this.$anchorCell.start(-1),l=n.colCount(this.$anchorCell.pos-o),r=n.colCount(this.$headCell.pos-o);if(Math.min(l,r)>0)return!1;const s=l+this.$anchorCell.nodeAfter.attrs.colspan,i=r+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,i)==n.width}eq(e){return e instanceof k&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const o=e.node(-1),l=y.get(o),r=e.start(-1),s=l.findCell(e.pos-r),i=l.findCell(n.pos-r),c=e.node(0);return s.left<=i.left?(s.left>0&&(e=c.resolve(r+l.map[s.top*l.width])),i.right<l.width&&(n=c.resolve(r+l.map[l.width*(i.top+1)-1]))):(i.left>0&&(n=c.resolve(r+l.map[i.top*l.width])),s.right<l.width&&(e=c.resolve(r+l.map[l.width*(s.top+1)-1]))),new k(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new k(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,o=n){return new k(e.resolve(n),e.resolve(o))}getBookmark(){return new Ve(this.$anchorCell.pos,this.$headCell.pos)}};C.prototype.visible=!1;g.Selection.jsonID("cell",C);var Ve=class Ae{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Ae(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),o=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&o.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&o.index()<o.parent.childCount&&oe(n,o)?new C(n,o):g.Selection.near(o,1)}};function qe(t){if(!(t.selection instanceof C))return null;const e=[];return t.selection.forEachCell((n,o)=>{e.push(D.Decoration.node(o,o+n.nodeSize,{class:"selectedCell"}))}),D.DecorationSet.create(t.doc,e)}function Ke({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,o=e.pos,l=t.depth;for(;l>=0&&!(t.after(l+1)<t.end(l));l--,n++);for(let r=e.depth;r>=0&&!(e.before(r+1)>e.start(r));r--,o--);return n==o&&/row|table/.test(t.node(l).type.spec.tableRole)}function Xe({$from:t,$to:e}){let n,o;for(let l=t.depth;l>0;l--){const r=t.node(l);if(r.type.spec.tableRole==="cell"||r.type.spec.tableRole==="header_cell"){n=r;break}}for(let l=e.depth;l>0;l--){const r=e.node(l);if(r.type.spec.tableRole==="cell"||r.type.spec.tableRole==="header_cell"){o=r;break}}return n!==o&&e.parentOffset===0}function Ze(t,e,n){const o=(e||t).selection,l=(e||t).doc;let r,s;if(o instanceof g.NodeSelection&&(s=o.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")r=C.create(l,o.from);else if(s=="row"){const i=l.resolve(o.from+1);r=C.rowSelection(i,i)}else if(!n){const i=y.get(o.node),c=o.from+1,a=c+i.map[i.width*i.height-1];r=C.create(l,c+1,a)}}else o instanceof g.TextSelection&&Ke(o)?r=g.TextSelection.create(l,o.from):o instanceof g.TextSelection&&Xe(o)&&(r=g.TextSelection.create(l,o.$from.start(),o.$from.end()));return r&&(e||(e=t.tr)).setSelection(r),e}const Ue=new g.PluginKey("fix-tables");function Te(t,e,n,o){const l=t.childCount,r=e.childCount;e:for(let s=0,i=0;s<r;s++){const c=e.child(s);for(let a=i,d=Math.min(l,s+3);a<d;a++)if(t.child(a)==c){i=a+1,n+=c.nodeSize;continue e}o(c,n),i<l&&t.child(i).sameMarkup(c)?Te(t.child(i),c,n+1,o):c.nodesBetween(0,c.content.size,o,n+1),n+=c.nodeSize}}function Re(t,e){let n;const o=(l,r)=>{l.type.spec.tableRole=="table"&&(n=Je(t,l,r,n))};return e?e.doc!=t.doc&&Te(e.doc,t.doc,0,o):t.doc.descendants(o),n}function Je(t,e,n,o){const l=y.get(e);if(!l.problems)return o;o||(o=t.tr);const r=[];for(let c=0;c<l.height;c++)r.push(0);for(let c=0;c<l.problems.length;c++){const a=l.problems[c];if(a.type=="collision"){const d=e.nodeAt(a.pos);if(!d)continue;const u=d.attrs;for(let f=0;f<u.rowspan;f++)r[a.row+f]+=a.n;o.setNodeMarkup(o.mapping.map(n+1+a.pos),null,H(u,u.colspan-a.n,a.n))}else if(a.type=="missing")r[a.row]+=a.n;else if(a.type=="overlong_rowspan"){const d=e.nodeAt(a.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(n+1+a.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-a.n})}else if(a.type=="colwidth mismatch"){const d=e.nodeAt(a.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(n+1+a.pos),null,{...d.attrs,colwidth:a.colwidth})}else if(a.type=="zero_sized"){const d=o.mapping.map(n);o.delete(d,d+e.nodeSize)}}let s,i;for(let c=0;c<r.length;c++)r[c]&&(s==null&&(s=c),i=c);for(let c=0,a=n+1;c<l.height;c++){const d=e.child(c),u=a+d.nodeSize,f=r[c];if(f>0){let h="cell";d.firstChild&&(h=d.firstChild.type.spec.tableRole);const p=[];for(let b=0;b<f;b++){const w=S(t.schema)[h].createAndFill();w&&p.push(w)}const m=(c==0||s==c-1)&&i==c?a+1:u-1;o.insert(o.mapping.map(m),p)}a=u}return o.setMeta(Ue,{fixTables:!0})}function N(t){const e=t.selection,n=q(t),o=n.node(-1),l=n.start(-1),r=y.get(o);return{...e instanceof C?r.rectBetween(e.$anchorCell.pos-l,e.$headCell.pos-l):r.findCell(n.pos-l),tableStart:l,map:r,table:o}}function ve(t,{map:e,tableStart:n,table:o},l){let r=l>0?-1:0;Ge(e,o,l+r)&&(r=l==0||l==e.width?null:0);for(let s=0;s<e.height;s++){const i=s*e.width+l;if(l>0&&l<e.width&&e.map[i-1]==e.map[i]){const c=e.map[i],a=o.nodeAt(c);t.setNodeMarkup(t.mapping.map(n+c),null,xe(a.attrs,l-e.colCount(c))),s+=a.attrs.rowspan-1}else{const c=r==null?S(o.type.schema).cell:o.nodeAt(e.map[i+r]).type,a=e.positionAt(s,l,o);t.insert(t.mapping.map(n+a),c.createAndFill())}}return t}function Ye(t,e){if(!E(t))return!1;if(e){const n=N(t);e(ve(t.tr,n,n.left))}return!0}function Qe(t,e){if(!E(t))return!1;if(e){const n=N(t);e(ve(t.tr,n,n.right))}return!0}function et(t,{map:e,table:n,tableStart:o},l){const r=t.mapping.maps.length;for(let s=0;s<e.height;){const i=s*e.width+l,c=e.map[i],a=n.nodeAt(c),d=a.attrs;if(l>0&&e.map[i-1]==c||l<e.width-1&&e.map[i+1]==c)t.setNodeMarkup(t.mapping.slice(r).map(o+c),null,H(d,l-e.colCount(c)));else{const u=t.mapping.slice(r).map(o+c);t.delete(u,u+a.nodeSize)}s+=d.rowspan}}function tt(t,e){if(!E(t))return!1;if(e){const n=N(t),o=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let l=n.right-1;et(o,n,l),l!=n.left;l--){const r=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!r)throw new RangeError("No table found");n.table=r,n.map=y.get(r)}e(o)}return!0}function nt(t,e,n){var o;const l=S(e.type.schema).header_cell;for(let r=0;r<t.width;r++)if(((o=e.nodeAt(t.map[r+n*t.width]))===null||o===void 0?void 0:o.type)!=l)return!1;return!0}function Me(t,{map:e,tableStart:n,table:o},l){let r=n;for(let a=0;a<l;a++)r+=o.child(a).nodeSize;const s=[];let i=l>0?-1:0;nt(e,o,l+i)&&(i=l==0||l==e.height?null:0);for(let a=0,d=e.width*l;a<e.width;a++,d++)if(l>0&&l<e.height&&e.map[d]==e.map[d-e.width]){const u=e.map[d],f=o.nodeAt(u).attrs;t.setNodeMarkup(n+u,null,{...f,rowspan:f.rowspan+1}),a+=f.colspan-1}else{var c;const u=i==null?S(o.type.schema).cell:(c=o.nodeAt(e.map[d+i*e.width]))===null||c===void 0?void 0:c.type,f=u==null?void 0:u.createAndFill();f&&s.push(f)}return t.insert(r,S(o.type.schema).row.create(null,s)),t}function ot(t,e){if(!E(t))return!1;if(e){const n=N(t);e(Me(t.tr,n,n.top))}return!0}function lt(t,e){if(!E(t))return!1;if(e){const n=N(t);e(Me(t.tr,n,n.bottom))}return!0}function rt(t,{map:e,table:n,tableStart:o},l){let r=0;for(let a=0;a<l;a++)r+=n.child(a).nodeSize;const s=r+n.child(l).nodeSize,i=t.mapping.maps.length;t.delete(r+o,s+o);const c=new Set;for(let a=0,d=l*e.width;a<e.width;a++,d++){const u=e.map[d];if(!c.has(u)){if(c.add(u),l>0&&u==e.map[d-e.width]){const f=n.nodeAt(u).attrs;t.setNodeMarkup(t.mapping.slice(i).map(u+o),null,{...f,rowspan:f.rowspan-1}),a+=f.colspan-1}else if(l<e.height&&u==e.map[d+e.width]){const f=n.nodeAt(u),h=f.attrs,p=f.type.create({...h,rowspan:f.attrs.rowspan-1},f.content),m=e.positionAt(l+1,a,n);t.insert(t.mapping.slice(i).map(o+m),p),a+=h.colspan-1}}}}function st(t,e){if(!E(t))return!1;if(e){const n=N(t),o=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let l=n.bottom-1;rt(o,n,l),l!=n.top;l--){const r=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!r)throw new RangeError("No table found");n.table=r,n.map=y.get(n.table)}e(o)}return!0}function le(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function it({width:t,height:e,map:n},o){let l=o.top*t+o.left,r=l,s=(o.bottom-1)*t+o.left,i=l+(o.right-o.left-1);for(let c=o.top;c<o.bottom;c++){if(o.left>0&&n[r]==n[r-1]||o.right<t&&n[i]==n[i+1])return!0;r+=t,i+=t}for(let c=o.left;c<o.right;c++){if(o.top>0&&n[l]==n[l-t]||o.bottom<e&&n[s]==n[s+t])return!0;l++,s++}return!1}function re(t,e){const n=t.selection;if(!(n instanceof C)||n.$anchorCell.pos==n.$headCell.pos)return!1;const o=N(t),{map:l}=o;if(it(l,o))return!1;if(e){const r=t.tr,s={};let i=g.Fragment.empty,c,a;for(let d=o.top;d<o.bottom;d++)for(let u=o.left;u<o.right;u++){const f=l.map[d*l.width+u],h=o.table.nodeAt(f);if(!(s[f]||!h))if(s[f]=!0,c==null)c=f,a=h;else{le(h)||(i=i.append(h.content));const p=r.mapping.map(f+o.tableStart);r.delete(p,p+h.nodeSize)}}if(c==null||a==null)return!0;if(r.setNodeMarkup(c+o.tableStart,null,{...xe(a.attrs,a.attrs.colspan,o.right-o.left-a.attrs.colspan),rowspan:o.bottom-o.top}),i.size>0){const d=c+1+a.content.size,u=le(a)?c+1:d;r.replaceWith(u+o.tableStart,d+o.tableStart,i)}r.setSelection(new C(r.doc.resolve(c+o.tableStart))),e(r)}return!0}function se(t,e){const n=S(t.schema);return ct(({node:o})=>n[o.type.spec.tableRole])(t,e)}function ct(t){return(e,n)=>{const o=e.selection;let l,r;if(o instanceof C){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;l=o.$anchorCell.nodeAfter,r=o.$anchorCell.pos}else{var s;if(l=Pe(o.$from),!l)return!1;r=(s=_(o.$from))===null||s===void 0?void 0:s.pos}if(l==null||r==null||l.attrs.colspan==1&&l.attrs.rowspan==1)return!1;if(n){let i=l.attrs;const c=[],a=i.colwidth;i.rowspan>1&&(i={...i,rowspan:1}),i.colspan>1&&(i={...i,colspan:1});const d=N(e),u=e.tr;for(let h=0;h<d.right-d.left;h++)c.push(a?{...i,colwidth:a&&a[h]?[a[h]]:null}:i);let f;for(let h=d.top;h<d.bottom;h++){let p=d.map.positionAt(h,d.left,d.table);h==d.top&&(p+=l.nodeSize);for(let m=d.left,b=0;m<d.right;m++,b++)m==d.left&&h==d.top||u.insert(f=u.mapping.map(p+d.tableStart,1),t({node:l,row:h,col:m}).createAndFill(c[b]))}u.setNodeMarkup(r,t({node:l,row:d.top,col:d.left}),c[0]),o instanceof C&&u.setSelection(new C(u.doc.resolve(o.$anchorCell.pos),f?u.doc.resolve(f):void 0)),n(u)}return!0}}function at(t,e){return function(n,o){if(!E(n))return!1;const l=q(n);if(l.nodeAfter.attrs[t]===e)return!1;if(o){const r=n.tr;n.selection instanceof C?n.selection.forEachCell((s,i)=>{s.attrs[t]!==e&&r.setNodeMarkup(i,null,{...s.attrs,[t]:e})}):r.setNodeMarkup(l.pos,null,{...l.nodeAfter.attrs,[t]:e}),o(r)}return!0}}function dt(t){return function(e,n){if(!E(e))return!1;if(n){const o=S(e.schema),l=N(e),r=e.tr,s=l.map.cellsInRect(t=="column"?{left:l.left,top:0,right:l.right,bottom:l.map.height}:t=="row"?{left:0,top:l.top,right:l.map.width,bottom:l.bottom}:l),i=s.map(c=>l.table.nodeAt(c));for(let c=0;c<s.length;c++)i[c].type==o.header_cell&&r.setNodeMarkup(l.tableStart+s[c],o.cell,i[c].attrs);if(r.steps.length===0)for(let c=0;c<s.length;c++)r.setNodeMarkup(l.tableStart+s[c],o.header_cell,i[c].attrs);n(r)}return!0}}function ie(t,e,n){const o=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let l=0;l<o.length;l++){const r=e.table.nodeAt(o[l]);if(r&&r.type!==n.header_cell)return!1}return!0}function B(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?dt(t):function(n,o){if(!E(n))return!1;if(o){const l=S(n.schema),r=N(n),s=n.tr,i=ie("row",r,l),c=ie("column",r,l),a=(t==="column"?i:t==="row"&&c)?1:0,d=t=="column"?{left:0,top:a,right:1,bottom:r.map.height}:t=="row"?{left:a,top:0,right:r.map.width,bottom:1}:r,u=t=="column"?c?l.cell:l.header_cell:t=="row"?i?l.cell:l.header_cell:l.cell;r.map.cellsInRect(d).forEach(f=>{const h=f+r.tableStart,p=s.doc.nodeAt(h);p&&s.setNodeMarkup(h,u,p.attrs)}),o(s)}return!0}}B("row",{useDeprecatedLogic:!0});B("column",{useDeprecatedLogic:!0});const ut=B("cell",{useDeprecatedLogic:!0});function ft(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let o=t.index(-1)-1,l=t.before();o>=0;o--){const r=t.node(-1).child(o),s=r.lastChild;if(s)return l-1-s.nodeSize;l-=r.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let o=t.indexAfter(-1),l=t.after();o<n.childCount;o++){const r=n.child(o);if(r.childCount)return l+1;l+=r.nodeSize}}return null}function ce(t){return function(e,n){if(!E(e))return!1;const o=ft(q(e),t);if(o==null)return!1;if(n){const l=e.doc.resolve(o);n(e.tr.setSelection(g.TextSelection.between(l,Oe(l))).scrollIntoView())}return!0}}function ht(t,e){const n=t.selection.$anchor;for(let o=n.depth;o>0;o--)if(n.node(o).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(o),n.after(o)).scrollIntoView()),!0;return!1}function F(t,e){const n=t.selection;if(!(n instanceof C))return!1;if(e){const o=t.tr,l=S(t.schema).cell.createAndFill().content;n.forEachCell((r,s)=>{r.content.eq(l)||o.replace(o.mapping.map(s+1),o.mapping.map(s+r.nodeSize-1),new g.Slice(l,0,0))}),o.docChanged&&e(o)}return!0}function pt(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:o}=t;for(;e.childCount==1&&(n>0&&o>0||e.child(0).type.spec.tableRole=="table");)n--,o--,e=e.child(0).content;const l=e.child(0),r=l.type.spec.tableRole,s=l.type.schema,i=[];if(r=="row")for(let c=0;c<e.childCount;c++){let a=e.child(c).content;const d=c?0:Math.max(0,n-1),u=c<e.childCount-1?0:Math.max(0,o-1);(d||u)&&(a=ee(S(s).row,new g.Slice(a,d,u)).content),i.push(a)}else if(r=="cell"||r=="header_cell")i.push(n||o?ee(S(s).row,new g.Slice(e,n,o)).content:e);else return null;return mt(s,i)}function mt(t,e){const n=[];for(let l=0;l<e.length;l++){const r=e[l];for(let s=r.childCount-1;s>=0;s--){const{rowspan:i,colspan:c}=r.child(s).attrs;for(let a=l;a<l+i;a++)n[a]=(n[a]||0)+c}}let o=0;for(let l=0;l<n.length;l++)o=Math.max(o,n[l]);for(let l=0;l<n.length;l++)if(l>=e.length&&e.push(g.Fragment.empty),n[l]<o){const r=S(t).cell.createAndFill(),s=[];for(let i=n[l];i<o;i++)s.push(r);e[l]=e[l].append(g.Fragment.from(s))}return{height:e.length,width:o,rows:e}}function ee(t,e){const n=t.createAndFill();return new g.Transform(n).replace(0,n.content.size,e).doc}function gt({width:t,height:e,rows:n},o,l){if(t!=o){const r=[],s=[];for(let i=0;i<n.length;i++){const c=n[i],a=[];for(let d=r[i]||0,u=0;d<o;u++){let f=c.child(u%c.childCount);d+f.attrs.colspan>o&&(f=f.type.createChecked(H(f.attrs,f.attrs.colspan,d+f.attrs.colspan-o),f.content)),a.push(f),d+=f.attrs.colspan;for(let h=1;h<f.attrs.rowspan;h++)r[i+h]=(r[i+h]||0)+f.attrs.colspan}s.push(g.Fragment.from(a))}n=s,t=o}if(e!=l){const r=[];for(let s=0,i=0;s<l;s++,i++){const c=[],a=n[i%e];for(let d=0;d<a.childCount;d++){let u=a.child(d);s+u.attrs.rowspan>l&&(u=u.type.create({...u.attrs,rowspan:Math.max(1,l-u.attrs.rowspan)},u.content)),c.push(u)}r.push(g.Fragment.from(c))}n=r,e=l}return{width:t,height:e,rows:n}}function bt(t,e,n,o,l,r,s){const i=t.doc.type.schema,c=S(i);let a,d;if(l>e.width)for(let u=0,f=0;u<e.height;u++){const h=n.child(u);f+=h.nodeSize;const p=[];let m;h.lastChild==null||h.lastChild.type==c.cell?m=a||(a=c.cell.createAndFill()):m=d||(d=c.header_cell.createAndFill());for(let b=e.width;b<l;b++)p.push(m);t.insert(t.mapping.slice(s).map(f-1+o),p)}if(r>e.height){const u=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,l);p++){const b=p>=e.width?!1:n.nodeAt(e.map[m+p]).type==c.header_cell;u.push(b?d||(d=c.header_cell.createAndFill()):a||(a=c.cell.createAndFill()))}const f=c.row.create(null,g.Fragment.from(u)),h=[];for(let p=e.height;p<r;p++)h.push(f);t.insert(t.mapping.slice(s).map(o+n.nodeSize-2),h)}return!!(a||d)}function ae(t,e,n,o,l,r,s,i){if(s==0||s==e.height)return!1;let c=!1;for(let a=l;a<r;a++){const d=s*e.width+a,u=e.map[d];if(e.map[d-e.width]==u){c=!0;const f=n.nodeAt(u),{top:h,left:p}=e.findCell(u);t.setNodeMarkup(t.mapping.slice(i).map(u+o),null,{...f.attrs,rowspan:s-h}),t.insert(t.mapping.slice(i).map(e.positionAt(s,p,n)),f.type.createAndFill({...f.attrs,rowspan:h+f.attrs.rowspan-s})),a+=f.attrs.colspan-1}}return c}function de(t,e,n,o,l,r,s,i){if(s==0||s==e.width)return!1;let c=!1;for(let a=l;a<r;a++){const d=a*e.width+s,u=e.map[d];if(e.map[d-1]==u){c=!0;const f=n.nodeAt(u),h=e.colCount(u),p=t.mapping.slice(i).map(u+o);t.setNodeMarkup(p,null,H(f.attrs,s-h,f.attrs.colspan-(s-h))),t.insert(p+f.nodeSize,f.type.createAndFill(H(f.attrs,0,s-h))),a+=f.attrs.rowspan-1}}return c}function ue(t,e,n,o,l){let r=n?t.doc.nodeAt(n-1):t.doc;if(!r)throw new Error("No table found");let s=y.get(r);const{top:i,left:c}=o,a=c+l.width,d=i+l.height,u=t.tr;let f=0;function h(){if(r=n?u.doc.nodeAt(n-1):u.doc,!r)throw new Error("No table found");s=y.get(r),f=u.mapping.maps.length}bt(u,s,r,n,a,d,f)&&h(),ae(u,s,r,n,c,a,i,f)&&h(),ae(u,s,r,n,c,a,d,f)&&h(),de(u,s,r,n,i,d,c,f)&&h(),de(u,s,r,n,i,d,a,f)&&h();for(let p=i;p<d;p++){const m=s.positionAt(p,c,r),b=s.positionAt(p,a,r);u.replace(u.mapping.slice(f).map(m+n),u.mapping.slice(f).map(b+n),new g.Slice(l.rows[p-i],0,0))}h(),u.setSelection(new C(u.doc.resolve(n+s.positionAt(i,c,r)),u.doc.resolve(n+s.positionAt(d-1,a-1,r)))),e(u)}const wt=D.keydownHandler({ArrowLeft:P("horiz",-1),ArrowRight:P("horiz",1),ArrowUp:P("vert",-1),ArrowDown:P("vert",1),"Shift-ArrowLeft":j("horiz",-1),"Shift-ArrowRight":j("horiz",1),"Shift-ArrowUp":j("vert",-1),"Shift-ArrowDown":j("vert",1),Backspace:F,"Mod-Backspace":F,Delete:F,"Mod-Delete":F});function G(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function P(t,e){return(n,o,l)=>{if(!l)return!1;const r=n.selection;if(r instanceof C)return G(n,o,g.Selection.near(r.$headCell,e));if(t!="horiz"&&!r.empty)return!1;const s=Ee(l,t,e);if(s==null)return!1;if(t=="horiz")return G(n,o,g.Selection.near(n.doc.resolve(r.head+e),e));{const i=n.doc.resolve(s),c=Se(i,t,e);let a;return c?a=g.Selection.near(c,1):e<0?a=g.Selection.near(n.doc.resolve(i.before(-1)),-1):a=g.Selection.near(n.doc.resolve(i.after(-1)),1),G(n,o,a)}}}function j(t,e){return(n,o,l)=>{if(!l)return!1;const r=n.selection;let s;if(r instanceof C)s=r;else{const c=Ee(l,t,e);if(c==null)return!1;s=new C(n.doc.resolve(c))}const i=Se(s.$headCell,t,e);return i?G(n,o,new C(s.$anchorCell,i)):!1}}function Ct(t,e){const n=t.state.doc,o=_(n.resolve(e));return o?(t.dispatch(t.state.tr.setSelection(new C(o))),!0):!1}function yt(t,e,n){if(!E(t.state))return!1;let o=pt(n);const l=t.state.selection;if(l instanceof C){o||(o={width:1,height:1,rows:[g.Fragment.from(ee(S(t.state.schema).cell,n))]});const r=l.$anchorCell.node(-1),s=l.$anchorCell.start(-1),i=y.get(r).rectBetween(l.$anchorCell.pos-s,l.$headCell.pos-s);return o=gt(o,i.right-i.left,i.bottom-i.top),ue(t.state,t.dispatch,s,i,o),!0}else if(o){const r=q(t.state),s=r.start(-1);return ue(t.state,t.dispatch,s,y.get(r.node(-1)).findCell(r.pos-s),o),!0}else return!1}function St(t,e){var n;if(e.ctrlKey||e.metaKey)return;const o=fe(t,e.target);let l;if(e.shiftKey&&t.state.selection instanceof C)r(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&o&&(l=_(t.state.selection.$anchor))!=null&&((n=U(t,e))===null||n===void 0?void 0:n.pos)!=l.pos)r(l,e),e.preventDefault();else if(!o)return;function r(c,a){let d=U(t,a);const u=z.getState(t.state)==null;if(!d||!oe(c,d))if(u)d=c;else return;const f=new C(c,d);if(u||!t.state.selection.eq(f)){const h=t.state.tr.setSelection(f);u&&h.setMeta(z,c.pos),t.dispatch(h)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",i),z.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(z,-1))}function i(c){const a=c,d=z.getState(t.state);let u;if(d!=null)u=t.state.doc.resolve(d);else if(fe(t,a.target)!=o&&(u=U(t,e),!u))return s();u&&r(u,a)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",i)}function Ee(t,e,n){if(!(t.state.selection instanceof g.TextSelection))return null;const{$head:o}=t.state.selection;for(let l=o.depth-1;l>=0;l--){const r=o.node(l);if((n<0?o.index(l):o.indexAfter(l))!=(n<0?0:r.childCount))return null;if(r.type.spec.tableRole=="cell"||r.type.spec.tableRole=="header_cell"){const s=o.before(l),i=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(i)?s:null}}return null}function fe(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function U(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;const o=n.inside>=0?n.inside:n.pos;return _(t.state.doc.resolve(o))}var xt=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),te(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,te(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function te(t,e,n,o,l,r){let s=0,i=!0,c=e.firstChild;const a=t.firstChild;if(a){for(let u=0,f=0;u<a.childCount;u++){const{colspan:h,colwidth:p}=a.child(u).attrs;for(let m=0;m<h;m++,f++){const b=l==f?r:p&&p[m],w=b?b+"px":"";if(s+=b||o,b||(i=!1),c)c.style.width!=w&&(c.style.width=w),c=c.nextSibling;else{const x=document.createElement("col");x.style.width=w,e.appendChild(x)}}}for(;c;){var d;const u=c.nextSibling;(d=c.parentNode)===null||d===void 0||d.removeChild(c),c=u}i?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}}const T=new g.PluginKey("tableColumnResizing");function At({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:o=xt,lastColumnResizable:l=!0}={}){const r=new g.Plugin({key:T,state:{init(s,i){var c;const a=(c=r.spec)===null||c===void 0||(c=c.props)===null||c===void 0?void 0:c.nodeViews,d=S(i.schema).table.name;return o&&a&&(a[d]=(u,f)=>new o(u,n,f)),new Tt(-1,!1)},apply(s,i){return i.apply(s)}},props:{attributes:s=>{const i=T.getState(s);return i&&i.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,i)=>{Rt(s,i,t,l)},mouseleave:s=>{vt(s)},mousedown:(s,i)=>{Mt(s,i,e,n)}},decorations:s=>{const i=T.getState(s);if(i&&i.activeHandle>-1)return zt(s,i.activeHandle)},nodeViews:{}}});return r}var Tt=class V{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,o=e.getMeta(T);if(o&&o.setHandle!=null)return new V(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new V(n.activeHandle,o.setDragging);if(n.activeHandle>-1&&e.docChanged){let l=e.mapping.map(n.activeHandle,-1);return Q(e.doc.resolve(l))||(l=-1),new V(l,n.dragging)}return n}};function Rt(t,e,n,o){if(!t.editable)return;const l=T.getState(t.state);if(l&&!l.dragging){const r=Nt(e.target);let s=-1;if(r){const{left:i,right:c}=r.getBoundingClientRect();e.clientX-i<=n?s=he(t,e,"left",n):c-e.clientX<=n&&(s=he(t,e,"right",n))}if(s!=l.activeHandle){if(!o&&s!==-1){const i=t.state.doc.resolve(s),c=i.node(-1),a=y.get(c),d=i.start(-1);if(a.colCount(i.pos-d)+i.nodeAfter.attrs.colspan-1==a.width-1)return}Ne(t,s)}}}function vt(t){if(!t.editable)return;const e=T.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Ne(t,-1)}function Mt(t,e,n,o){var l;if(!t.editable)return!1;const r=(l=t.dom.ownerDocument.defaultView)!==null&&l!==void 0?l:window,s=T.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const i=t.state.doc.nodeAt(s.activeHandle),c=Et(t,s.activeHandle,i.attrs);t.dispatch(t.state.tr.setMeta(T,{setDragging:{startX:e.clientX,startWidth:c}}));function a(u){r.removeEventListener("mouseup",a),r.removeEventListener("mousemove",d);const f=T.getState(t.state);f!=null&&f.dragging&&(kt(t,f.activeHandle,pe(f.dragging,u,n)),t.dispatch(t.state.tr.setMeta(T,{setDragging:null})))}function d(u){if(!u.which)return a(u);const f=T.getState(t.state);if(f&&f.dragging){const h=pe(f.dragging,u,n);me(t,f.activeHandle,h,o)}}return me(t,s.activeHandle,c,o),r.addEventListener("mouseup",a),r.addEventListener("mousemove",d),e.preventDefault(),!0}function Et(t,e,{colspan:n,colwidth:o}){const l=o&&o[o.length-1];if(l)return l;const r=t.domAtPos(e);let s=r.node.childNodes[r.offset].offsetWidth,i=n;if(o)for(let c=0;c<n;c++)o[c]&&(s-=o[c],i--);return s/i}function Nt(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function he(t,e,n,o){const l=n=="right"?-o:o,r=t.posAtCoords({left:e.clientX+l,top:e.clientY});if(!r)return-1;const{pos:s}=r,i=_(t.state.doc.resolve(s));if(!i)return-1;if(n=="right")return i.pos;const c=y.get(i.node(-1)),a=i.start(-1),d=c.map.indexOf(i.pos-a);return d%c.width==0?-1:a+c.map[d-1]}function pe(t,e,n){const o=e.clientX-t.startX;return Math.max(n,t.startWidth+o)}function Ne(t,e){t.dispatch(t.state.tr.setMeta(T,{setHandle:e}))}function kt(t,e,n){const o=t.state.doc.resolve(e),l=o.node(-1),r=y.get(l),s=o.start(-1),i=r.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,c=t.state.tr;for(let a=0;a<r.height;a++){const d=a*r.width+i;if(a&&r.map[d]==r.map[d-r.width])continue;const u=r.map[d],f=l.nodeAt(u).attrs,h=f.colspan==1?0:i-r.colCount(u);if(f.colwidth&&f.colwidth[h]==n)continue;const p=f.colwidth?f.colwidth.slice():Lt(f.colspan);p[h]=n,c.setNodeMarkup(s+u,null,{...f,colwidth:p})}c.docChanged&&t.dispatch(c)}function me(t,e,n,o){const l=t.state.doc.resolve(e),r=l.node(-1),s=l.start(-1),i=y.get(r).colCount(l.pos-s)+l.nodeAfter.attrs.colspan-1;let c=t.domAtPos(l.start(-1)).node;for(;c&&c.nodeName!="TABLE";)c=c.parentNode;c&&te(r,c.firstChild,c,o,i,n)}function Lt(t){return Array(t).fill(0)}function zt(t,e){const n=[],o=t.doc.resolve(e),l=o.node(-1);if(!l)return D.DecorationSet.empty;const r=y.get(l),s=o.start(-1),i=r.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;for(let a=0;a<r.height;a++){const d=i+a*r.width;if((i==r.width-1||r.map[d]!=r.map[d+1])&&(a==0||r.map[d]!=r.map[d-r.width])){var c;const u=r.map[d],f=s+u+l.nodeAt(u).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((c=T.getState(t))===null||c===void 0)&&c.dragging&&n.push(D.Decoration.node(s+u,s+u+l.nodeAt(u).nodeSize,{class:"column-resize-dragging"})),n.push(D.Decoration.widget(f,h))}}return D.DecorationSet.create(t.doc,n)}function Dt({allowTableNodeSelection:t=!1}={}){return new g.Plugin({key:z,state:{init(){return null},apply(e,n){const o=e.getMeta(z);if(o!=null)return o==-1?null:o;if(n==null||!e.docChanged)return n;const{deleted:l,pos:r}=e.mapping.mapResult(n);return l?null:r}},props:{decorations:qe,handleDOMEvents:{mousedown:St},createSelectionBetween(e){return z.getState(e.state)!=null?e.state.selection:null},handleTripleClick:Ct,handleKeyDown:wt,handlePaste:yt},appendTransaction(e,n,o){return Ze(o,Re(o,n),t)}})}var ke=g.Node3.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{var e,n;const o=t.getAttribute("colwidth"),l=o?o.split(",").map(r=>parseInt(r,10)):null;if(!l){const r=(e=t.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),s=Array.from(((n=t.parentElement)==null?void 0:n.children)||[]).indexOf(t);if(s&&s>-1&&r&&r[s]){const i=r[s].getAttribute("width");return i?[parseInt(i,10)]:null}}return l}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",g.mergeAttributes(this.options.HTMLAttributes,t),0]}}),Le=g.Node3.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(o=>parseInt(o,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",g.mergeAttributes(this.options.HTMLAttributes,t),0]}}),ze=g.Node3.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",g.mergeAttributes(this.options.HTMLAttributes,t),0]}});function ne(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function ge(t,e,n,o,l,r){var s;let i=0,c=!0,a=e.firstChild;const d=t.firstChild;if(d!==null)for(let f=0,h=0;f<d.childCount;f+=1){const{colspan:p,colwidth:m}=d.child(f).attrs;for(let b=0;b<p;b+=1,h+=1){const w=l===h?r:m&&m[b],x=w?`${w}px`:"";if(i+=w||o,w||(c=!1),a){if(a.style.width!==x){const[R,L]=ne(o,w);a.style.setProperty(R,L)}a=a.nextSibling}else{const R=document.createElement("col"),[L,M]=ne(o,w);R.style.setProperty(L,M),e.appendChild(R)}}}for(;a;){const f=a.nextSibling;(s=a.parentNode)==null||s.removeChild(a),a=f}const u=t.attrs.style&&typeof t.attrs.style=="string"&&/\bwidth\s*:/i.test(t.attrs.style);c&&!u?(n.style.width=`${i}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${i}px`)}var Ht=class{constructor(t,e){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),t.attrs.style&&(this.table.style.cssText=t.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ge(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!==this.node.type?!1:(this.node=t,ge(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){const e=t.target,n=this.dom.contains(e),o=this.contentDOM.contains(e);return!!(n&&!o&&(t.type==="attributes"||t.type==="childList"||t.type==="characterData"))}};function _t(t,e,n,o){let l=0,r=!0;const s=[],i=t.firstChild;if(!i)return{};for(let u=0,f=0;u<i.childCount;u+=1){const{colspan:h,colwidth:p}=i.child(u).attrs;for(let m=0;m<h;m+=1,f+=1){const b=n===f?o:p&&p[m];l+=b||e,b||(r=!1);const[w,x]=ne(e,b);s.push(["col",{style:`${w}: ${x}`}])}}const c=r?`${l}px`:"",a=r?"":`${l}px`;return{colgroup:["colgroup",{},...s],tableWidth:c,tableMinWidth:a}}function be(t,e){return t.createAndFill()}function It(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const o=t.nodes[n];o.spec.tableRole&&(e[o.spec.tableRole]=o)}),t.cached.tableNodeTypes=e,e}function Bt(t,e,n,o,l){const r=It(t),s=[],i=[];for(let a=0;a<n;a+=1){const d=be(r.cell);if(d&&i.push(d),o){const u=be(r.header_cell);u&&s.push(u)}}const c=[];for(let a=0;a<e;a+=1)c.push(r.row.createChecked(null,o&&a===0?s:i));return r.table.createChecked(null,c)}function $t(t){return t instanceof C}var O=({editor:t})=>{const{selection:e}=t.state;if(!$t(e))return!1;let n=0;const o=g.findParentNodeClosestToPos(e.ranges[0].$from,r=>r.type.name==="table");return o==null||o.node.descendants(r=>{if(r.type.name==="table")return!1;["tableCell","tableHeader"].includes(r.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},Wt="";function Ft(t){return(t||"").replace(/\s+/g," ").trim()}function Pt(t,e,n={}){var o;const l=(o=n.cellLineSeparator)!=null?o:Wt;if(!t||!t.content||t.content.length===0)return"";const r=[];t.content.forEach(p=>{const m=[];p.content&&p.content.forEach(b=>{let w="";b.content&&Array.isArray(b.content)&&b.content.length>1?w=b.content.map(M=>e.renderChildren(M)).join(l):w=b.content?e.renderChildren(b.content):"";const x=Ft(w),R=b.type==="tableHeader";m.push({text:x,isHeader:R})}),r.push(m)});const s=r.reduce((p,m)=>Math.max(p,m.length),0);if(s===0)return"";const i=new Array(s).fill(0);r.forEach(p=>{var m;for(let b=0;b<s;b+=1){const x=(((m=p[b])==null?void 0:m.text)||"").length;x>i[b]&&(i[b]=x),i[b]<3&&(i[b]=3)}});const c=(p,m)=>p+" ".repeat(Math.max(0,m-p.length)),a=r[0],d=a.some(p=>p.isHeader);let u=`
|
|
2
|
-
`;const f=new Array(s).fill(0).map((p,m)=>d&&a[m]&&a[m].text||"");return u+=`| ${f.map((p,m)=>c(p,i[m])).join(" | ")} |
|
|
3
|
-
`,u+=`| ${i.map(p=>"-".repeat(Math.max(3,p))).join(" | ")} |
|
|
4
|
-
`,(d?r.slice(1):r).forEach(p=>{u+=`| ${new Array(s).fill(0).map((m,b)=>c(p[b]&&p[b].text||"",i[b])).join(" | ")} |
|
|
5
|
-
`}),u}var jt=Pt,De=g.Node3.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:Ht,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:o,tableMinWidth:l}=_t(t,this.options.cellMinWidth),r=e.style;function s(){return r||(o?`width: ${o}`:`min-width: ${l}`)}const i=["table",g.mergeAttributes(this.options.HTMLAttributes,e,{style:s()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},i]:i},parseMarkdown:(t,e)=>{const n=[];if(t.header){const o=[];t.header.forEach(l=>{o.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(l.tokens)}]))}),n.push(e.createNode("tableRow",{},o))}return t.rows&&t.rows.forEach(o=>{const l=[];o.forEach(r=>{l.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(r.tokens)}]))}),n.push(e.createNode("tableRow",{},l))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>jt(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:o,dispatch:l,editor:r})=>{const s=Bt(r.schema,t,e,n);if(l){const i=o.selection.from+1;o.replaceSelectionWith(s).scrollIntoView().setSelection(_e.TextSelection.near(o.doc.resolve(i)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>Ye(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>Qe(t,e),deleteColumn:()=>({state:t,dispatch:e})=>tt(t,e),addRowBefore:()=>({state:t,dispatch:e})=>ot(t,e),addRowAfter:()=>({state:t,dispatch:e})=>lt(t,e),deleteRow:()=>({state:t,dispatch:e})=>st(t,e),deleteTable:()=>({state:t,dispatch:e})=>ht(t,e),mergeCells:()=>({state:t,dispatch:e})=>re(t,e),splitCell:()=>({state:t,dispatch:e})=>se(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>B("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>B("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>ut(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>re(t,e)?!0:se(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:o})=>at(t,e)(n,o),goToNextCell:()=>({state:t,dispatch:e})=>ce(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>ce(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&Re(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const o=C.create(e.doc,t.anchorCell,t.headCell);e.setSelection(o)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:O,"Mod-Backspace":O,Delete:O,"Mod-Delete":O}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[At({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Dt({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:g.callOrReturn(g.getExtensionField(t,"tableRole",e))}}});g.Extension.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(De.configure(this.options.table)),this.options.tableCell!==!1&&t.push(ke.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(Le.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(ze.configure(this.options.tableRow)),t}});function Ot(t,e,n){if(!t.doc)return t;const o=t.doc.nodeAt(e);if(!o||n===o.attrs.backgroundColor)return t;const l={...o.attrs,backgroundColor:n};return t.setNodeMarkup(e,o.type,l,o.marks)}function Gt(t,e,n){const{doc:o,selection:l}=t;return!o||!l||!(l instanceof C)||l.forEachCell((r,s)=>{t=Ot(t,s,n)}),t}function we(t,e){return({tr:n,state:o,dispatch:l})=>{const{selection:r}=o;return n=n.setSelection(r),n=Gt(n,e,t),n.docChanged?(l==null||l(n),!0):!1}}const Vt=g.Extension.create({name:"tableCellBackground",addOptions(){return{types:["tableCell"],HTMLAttributes:{}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{parseHTML:t=>t.style.backgroundColor||"",renderHTML:t=>!t.backgroundColor||t.backgroundColor===""?{}:{style:`background-color: ${t.backgroundColor}`}}}}]},addCommands(){return{setTableCellBackground:t=>we(t,this.options),unsetTableCellBackground:()=>we("",this.options)}}}),qt=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,Kt=/CrOS/,Xt=/android|ipad|playbook|silk/i;function Ce(t={}){let e=t.ua||typeof navigator<"u"&&navigator.userAgent;return e&&typeof e=="object"&&e.headers&&typeof e.headers["user-agent"]=="string"&&(e=e.headers["user-agent"]),typeof e!="string"?!1:!!(qt.test(e)&&!Kt.test(e)||t.tablet&&Xt.test(e)||t.tablet&&t.featureDetect&&navigator&&navigator.maxTouchPoints>1&&e.includes("Macintosh")&&e.includes("Safari"))}const ye=t=>Array.from({length:t}).map((e,n)=>n+1);function Zt(t){var f;const[e,n]=W.useState(!1),[o,l]=W.useState(!0),[r,s]=W.useState({rows:Ce()?v.TABLE_MAX_GRID_SIZE:v.TABLE_INIT_GRID_SIZE,cols:Ce()?v.TABLE_MAX_GRID_SIZE:v.TABLE_INIT_GRID_SIZE}),[i,c]=W.useState({rows:v.TABLE_DEFAULT_SELECTED_GRID_SIZE,cols:v.TABLE_DEFAULT_SELECTED_GRID_SIZE});function a(h,p){h===r.rows&&s(m=>({...m,rows:Math.min(h+1,v.TABLE_MAX_GRID_SIZE)})),p===r.cols&&s(m=>({...m,cols:Math.min(p+1,v.TABLE_MAX_GRID_SIZE)})),c({rows:h,cols:p})}function d(h,p){t==null||t.createTable({rows:h,cols:p,withHeaderRow:o}),u(),n(!1)}function u(){l(!1),s({rows:v.TABLE_INIT_GRID_SIZE,cols:v.TABLE_INIT_GRID_SIZE}),c({rows:v.TABLE_DEFAULT_SELECTED_GRID_SIZE,cols:v.TABLE_DEFAULT_SELECTED_GRID_SIZE})}return A.jsxs(X.Popover,{modal:!0,onOpenChange:n,open:e,children:[A.jsx(X.PopoverTrigger,{asChild:!0,"data-state":t!=null&&t.dataState?"on":"off",children:t==null?void 0:t.children}),A.jsx(X.PopoverContent,{align:"start",className:"richtext-w-full !richtext-p-2",side:"bottom",children:A.jsxs("div",{className:"table-grid-size-editor richtext-p-0",children:[A.jsx("div",{className:"richtext-flex richtext-flex-col richtext-flex-wrap richtext-justify-between richtext-gap-1",children:(f=ye(r==null?void 0:r.rows))==null?void 0:f.map(h=>{var p;return A.jsx("div",{className:"richtext-flex richtext-gap-1",children:(p=ye(r==null?void 0:r.cols))==null?void 0:p.map(m=>A.jsx("div",{onMouseDown:()=>d(h,m),onMouseOver:()=>a(h,m),className:`richtext-cursor-pointer richtext-border-border ${m<=i.cols&&h<=i.rows&&"tableCellActive !richtext-bg-foreground"}`,children:A.jsx("div",{className:"richtext-box-border richtext-size-4 richtext-rounded-[2px] !richtext-border richtext-border-solid !richtext-border-border richtext-p-1"})},`richtext-table-col-${m}`))},`richtext-table-row-${h}`)})}),A.jsxs("div",{className:"richtext-mt-2 richtext-text-center richtext-text-sm richtext-text-foreground",children:[i.rows,"x",i.cols]})]})})]})}function Ut(){const t=Z.useEditorInstance(),e=Z.useButtonProps(He.name),{icon:n=void 0,tooltip:o=void 0,action:l=void 0,isActive:r=void 0,color:s}=(e==null?void 0:e.componentProps)??{},{dataState:i,disabled:c}=Z.useToggleActive(r);if(!e)return A.jsx(A.Fragment,{});function a(d){t.chain().focus().insertTable({...d,withHeaderRow:!1}).run()}return A.jsx(Zt,{createTable:a,dataState:i,children:A.jsx(Ie.ActionButton,{action:l,color:s,dataState:i,icon:n,isActive:r,tooltip:o,disabled:c})})}const He=De.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{style:`
|
|
6
|
-
border: 1px solid #000;
|
|
7
|
-
border-collapse: collapse;
|
|
8
|
-
width: 100%;
|
|
9
|
-
`},resizable:!0,lastColumnResizable:!0,allowTableNodeSelection:!1,button:({editor:e,t:n})=>({componentProps:{isActive:()=>e.isActive("table"),icon:"Table",tooltip:n("editor.table.tooltip")}})}},addExtensions(){return[ze.configure(this.options.tableRow),Le.configure(this.options.tableHeader),ke.configure(this.options.tableCell),Vt.configure(this.options.tableCellBackground)]}});exports.CellSelection=C;exports.RichTextTable=Ut;exports.Table=He;
|