tiptap-editor-codeveda 0.1.7 → 0.1.8
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/README.md
CHANGED
|
@@ -86,6 +86,10 @@ import "tiptap-editor-codeveda/dist/tiptap-editor-codeveda.css"; // Import CSS d
|
|
|
86
86
|
|
|
87
87
|
**Note:** Without importing the CSS, the editor will function but won't have proper styling for extensions like tables, code blocks, accordions, etc.
|
|
88
88
|
|
|
89
|
+
## 🔧 Form Integration
|
|
90
|
+
|
|
91
|
+
The editor is designed to work seamlessly inside forms. All buttons have `type="button"` to prevent accidental form submission when clicking editor controls.
|
|
92
|
+
|
|
89
93
|
## 🔧 Basic Usage
|
|
90
94
|
|
|
91
95
|
### Simple Editor
|
|
@@ -367,6 +371,14 @@ If you get TypeScript errors about missing module declarations:
|
|
|
367
371
|
npm install
|
|
368
372
|
```
|
|
369
373
|
|
|
374
|
+
### Form Submission Issues
|
|
375
|
+
|
|
376
|
+
If the editor triggers form submission when clicking buttons:
|
|
377
|
+
|
|
378
|
+
1. **This is now fixed!** All editor buttons have `type="button"` to prevent form submission
|
|
379
|
+
2. **Update to the latest version** of the package
|
|
380
|
+
3. **If using an older version**, wrap the editor in a div with `onSubmit={(e) => e.preventDefault()}`
|
|
381
|
+
|
|
370
382
|
### Build Issues
|
|
371
383
|
|
|
372
384
|
If you encounter build issues:
|
|
@@ -2903,6 +2903,7 @@ function yi({
|
|
|
2903
2903
|
/* @__PURE__ */ c.jsx(
|
|
2904
2904
|
"button",
|
|
2905
2905
|
{
|
|
2906
|
+
type: "button",
|
|
2906
2907
|
onClick: (w) => {
|
|
2907
2908
|
w.stopPropagation(), m();
|
|
2908
2909
|
},
|
|
@@ -2943,6 +2944,7 @@ function yi({
|
|
|
2943
2944
|
u && /* @__PURE__ */ c.jsx(
|
|
2944
2945
|
"button",
|
|
2945
2946
|
{
|
|
2947
|
+
type: "button",
|
|
2946
2948
|
onClick: (w) => {
|
|
2947
2949
|
w.stopPropagation(), b();
|
|
2948
2950
|
},
|
|
@@ -3061,6 +3063,7 @@ function vi({
|
|
|
3061
3063
|
/* @__PURE__ */ c.jsx("div", { className: "flex flex-1 overflow-x-auto", children: u.map((y, N) => /* @__PURE__ */ c.jsx(
|
|
3062
3064
|
"button",
|
|
3063
3065
|
{
|
|
3066
|
+
type: "button",
|
|
3064
3067
|
onClick: () => h(N),
|
|
3065
3068
|
className: `px-4 py-2 text-sm font-medium border-b-2 border-r border-gray-200 transition-colors relative lg:px-12 cursor-pointer ${r === N ? "border-blue-500 border-r-gray-200 text-blue-600 bg-white" : "border-transparent border-r-gray-200 text-gray-500 hover:text-gray-700 hover:border-gray-300"} ${N === u.length - 1 ? "border-r-0" : ""}`,
|
|
3066
3069
|
children: i === N ? /* @__PURE__ */ c.jsx(
|
|
@@ -3092,6 +3095,7 @@ function vi({
|
|
|
3092
3095
|
f && /* @__PURE__ */ c.jsx(
|
|
3093
3096
|
"button",
|
|
3094
3097
|
{
|
|
3098
|
+
type: "button",
|
|
3095
3099
|
onClick: b,
|
|
3096
3100
|
className: "px-3 py-2 text-red-600 hover:text-red-700 hover:bg-red-50 transition-colors",
|
|
3097
3101
|
title: "Delete tabs",
|
|
@@ -3819,6 +3823,7 @@ const I = ({
|
|
|
3819
3823
|
const i = /* @__PURE__ */ c.jsx(
|
|
3820
3824
|
Y,
|
|
3821
3825
|
{
|
|
3826
|
+
type: "button",
|
|
3822
3827
|
onClick: t,
|
|
3823
3828
|
variant: e ? "default" : "outline",
|
|
3824
3829
|
size: "sm",
|
|
@@ -3851,6 +3856,7 @@ const I = ({
|
|
|
3851
3856
|
/* @__PURE__ */ c.jsx(Dt, { asChild: !0, children: /* @__PURE__ */ c.jsx(
|
|
3852
3857
|
"button",
|
|
3853
3858
|
{
|
|
3859
|
+
type: "button",
|
|
3854
3860
|
className: "w-6 h-6 rounded border border-gray-300 cursor-pointer hover:scale-110 transition-transform",
|
|
3855
3861
|
style: { backgroundColor: n },
|
|
3856
3862
|
onClick: () => t(n)
|
|
@@ -3982,6 +3988,7 @@ const I = ({
|
|
|
3982
3988
|
/* @__PURE__ */ c.jsx(
|
|
3983
3989
|
"button",
|
|
3984
3990
|
{
|
|
3991
|
+
type: "button",
|
|
3985
3992
|
onClick: () => a(!1),
|
|
3986
3993
|
className: `text-gray-400 hover:text-gray-600 ${o ? "opacity-50 cursor-not-allowed" : ""}`,
|
|
3987
3994
|
disabled: o,
|
|
@@ -4009,6 +4016,7 @@ const I = ({
|
|
|
4009
4016
|
/* @__PURE__ */ c.jsx(
|
|
4010
4017
|
Y,
|
|
4011
4018
|
{
|
|
4019
|
+
type: "button",
|
|
4012
4020
|
onClick: u,
|
|
4013
4021
|
size: "sm",
|
|
4014
4022
|
className: "px-4 py-2",
|
|
@@ -4041,6 +4049,7 @@ const I = ({
|
|
|
4041
4049
|
/* @__PURE__ */ c.jsx(
|
|
4042
4050
|
Y,
|
|
4043
4051
|
{
|
|
4052
|
+
type: "button",
|
|
4044
4053
|
onClick: n,
|
|
4045
4054
|
size: "sm",
|
|
4046
4055
|
variant: "outline",
|
|
@@ -8014,6 +8023,7 @@ const Ks = ({ editor: t, isReadOnly: e }) => {
|
|
|
8014
8023
|
/* @__PURE__ */ c.jsx(
|
|
8015
8024
|
Y,
|
|
8016
8025
|
{
|
|
8026
|
+
type: "button",
|
|
8017
8027
|
onClick: u,
|
|
8018
8028
|
size: "sm",
|
|
8019
8029
|
className: "h-8 cursor-pointer",
|
|
@@ -8208,6 +8218,7 @@ const Ks = ({ editor: t, isReadOnly: e }) => {
|
|
|
8208
8218
|
/* @__PURE__ */ c.jsxs(
|
|
8209
8219
|
Y,
|
|
8210
8220
|
{
|
|
8221
|
+
type: "button",
|
|
8211
8222
|
onClick: n,
|
|
8212
8223
|
variant: "outline",
|
|
8213
8224
|
size: "sm",
|
|
@@ -8222,6 +8233,7 @@ const Ks = ({ editor: t, isReadOnly: e }) => {
|
|
|
8222
8233
|
/* @__PURE__ */ c.jsx(
|
|
8223
8234
|
Y,
|
|
8224
8235
|
{
|
|
8236
|
+
type: "button",
|
|
8225
8237
|
onClick: () => e(!t),
|
|
8226
8238
|
variant: t ? "default" : "outline",
|
|
8227
8239
|
size: "sm",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,$,Q,De,Q),H[Q+$]=!0)}if(Q=null,D!==void 0&&(n(D),Q=""+D),s(A)&&(n(A.key),Q=""+A.key),"key"in A){D={};for(var Bt in A)Bt!=="key"&&(D[Bt]=A[Bt])}else D=A;return Q&&a(D,typeof g=="function"?g.displayName||g.name||"Unknown":g),d(g,Q,be,ke,i(),D,Dt,zt)}function f(g){typeof g=="object"&&g!==null&&g.$$typeof===m&&g._store&&(g._store.validated=1)}var h=k,m=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),y=Symbol.for("react.consumer"),S=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),x=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),T=Symbol.for("react.client.reference"),L=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=Object.prototype.hasOwnProperty,W=Array.isArray,U=console.createTask?console.createTask:function(){return null};h={react_stack_bottom_frame:function(g){return g()}};var Y,J={},K=h.react_stack_bottom_frame.bind(h,o)(),I=U(r(o)),H={};Be.Fragment=w,Be.jsx=function(g,A,D,$,ke){var be=1e4>L.recentlyCreatedOwnerStacks++;return u(g,A,D,!1,$,ke,be?Error("react-stack-top-frame"):K,be?U(r(g)):I)},Be.jsxs=function(g,A,D,$,ke){var be=1e4>L.recentlyCreatedOwnerStacks++;return u(g,A,D,!0,$,ke,be?Error("react-stack-top-frame"):K,be?U(r(g)):I)}})()),Be}var Wt;function ei(){return Wt||(Wt=1,process.env.NODE_ENV==="production"?We.exports=Xr():We.exports=Qr()),We.exports}var c=ei();const Kt=jr.configure({codeBlock:!1}),Gt=Pr.Table.configure({resizable:!0}),Yt=Dr.configure({inline:!1,allowBase64:!1,HTMLAttributes:{class:"max-w-full h-auto rounded-lg shadow-sm"}}),Zt=zr.configure({openOnClick:!1,autolink:!0,defaultProtocol:"https"}),Xt=Br.TextStyle,Qt=Ur.configure({types:["textStyle"]}),en=Hr.configure({multicolor:!0}),ti=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),ni=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],ri=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],ii=[...ni,...ri],oi=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),si=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),ai=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),li=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function ci(t){const e=t.regex,n=ti(t),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",o=/@-?\w[\w]*(-\w+)*/,s="[a-zA-Z-][a-zA-Z0-9_-]*",a=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+s,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+si.join("|")+")"},{begin:":(:)?("+ai.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+li.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...a,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:e.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:o},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:oi.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+ii.join("|")+")\\b"}]}}const tn="[A-Za-z$_][0-9A-Za-z$_]*",di=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],ui=["true","false","null","undefined","NaN","Infinity"],nn=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],rn=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],on=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],fi=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],hi=[].concat(on,nn,rn);function pi(t){const e=t.regex,n=(I,{after:H})=>{const g="</"+I[0].slice(1);return I.input.indexOf(g,H)!==-1},r=tn,i={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(I,H)=>{const g=I[0].length+I.index,A=I.input[g];if(A==="<"||A===","){H.ignoreMatch();return}A===">"&&(n(I,{after:g})||H.ignoreMatch());let D;const $=I.input.substring(g);if(D=$.match(/^\s*=/)){H.ignoreMatch();return}if((D=$.match(/^\s+extends\s+/))&&D.index===0){H.ignoreMatch();return}}},a={$pattern:tn,keyword:di,literal:ui,built_in:hi,"variable.language":fi},l="[0-9](_?[0-9])*",d=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${u})((${d})|\\.)?|(${d}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${d})\\b|\\.)?|(${d})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},m={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},b={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"css"}},w={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},p={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,h]},y={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},S=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,m,b,w,p,{match:/\$\d+/},f];h.contains=S.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(S)});const R=[].concat(y,h.contains),v=R.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(R)}]),x={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:v},N={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},C={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...nn,...rn]}},M={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[x],illegal:/%/},L={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function F(I){return e.concat("(?!",I.join("|"),")")}const W={match:e.concat(/\b/,F([...on,"super","import"].map(I=>`${I}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},U={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},Y={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},x]},J="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",K={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(J)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[x]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:v,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),M,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,m,b,w,p,y,{match:/\$\d+/},f,C,{scope:"attr",match:r+e.lookahead(":"),relevance:0},K,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[y,t.REGEXP_MODE,{className:"function",begin:J,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:v}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:o},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},T,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[x,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},U,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[x]},W,L,N,Y,{match:/\$[(.]/}]}}const Ke="[A-Za-z$_][0-9A-Za-z$_]*",sn=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],an=["true","false","null","undefined","NaN","Infinity"],ln=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],cn=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],dn=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],un=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],fn=[].concat(dn,ln,cn);function mi(t){const e=t.regex,n=(I,{after:H})=>{const g="</"+I[0].slice(1);return I.input.indexOf(g,H)!==-1},r=Ke,i={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(I,H)=>{const g=I[0].length+I.index,A=I.input[g];if(A==="<"||A===","){H.ignoreMatch();return}A===">"&&(n(I,{after:g})||H.ignoreMatch());let D;const $=I.input.substring(g);if(D=$.match(/^\s*=/)){H.ignoreMatch();return}if((D=$.match(/^\s+extends\s+/))&&D.index===0){H.ignoreMatch();return}}},a={$pattern:Ke,keyword:sn,literal:an,built_in:fn,"variable.language":un},l="[0-9](_?[0-9])*",d=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${u})((${d})|\\.)?|(${d}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${d})\\b|\\.)?|(${d})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},m={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},b={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"css"}},w={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},p={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,h]},y={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},S=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,m,b,w,p,{match:/\$\d+/},f];h.contains=S.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(S)});const R=[].concat(y,h.contains),v=R.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(R)}]),x={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:v},N={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},C={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...ln,...cn]}},M={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[x],illegal:/%/},L={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function F(I){return e.concat("(?!",I.join("|"),")")}const W={match:e.concat(/\b/,F([...dn,"super","import"].map(I=>`${I}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},U={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},Y={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},x]},J="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",K={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(J)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[x]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:v,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),M,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,m,b,w,p,y,{match:/\$\d+/},f,C,{scope:"attr",match:r+e.lookahead(":"),relevance:0},K,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[y,t.REGEXP_MODE,{className:"function",begin:J,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:v}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:o},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},T,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[x,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},U,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[x]},W,L,N,Y,{match:/\$[(.]/}]}}function gi(t){const e=t.regex,n=mi(t),r=Ke,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],o={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},s={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[n.exports.CLASS_REFERENCE]},a={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],d={$pattern:Ke,keyword:sn.concat(l),literal:an,built_in:fn.concat(i),"variable.language":un},u={className:"meta",begin:"@"+r},f=(w,p,E)=>{const y=w.contains.findIndex(S=>S.label===p);if(y===-1)throw new Error("can not find mode to replace");w.contains.splice(y,1,E)};Object.assign(n.keywords,d),n.exports.PARAMS_CONTAINS.push(u);const h=n.contains.find(w=>w.scope==="attr"),m=Object.assign({},h,{match:e.concat(r,e.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,h,m]),n.contains=n.contains.concat([u,o,s,m]),f(n,"shebang",t.SHEBANG()),f(n,"use_strict",a);const b=n.contains.find(w=>w.label==="func.def");return b.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function bi(t){const e=t.regex,n=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},o={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},s=t.inherit(o,{begin:/\(/,end:/\)/}),a=t.inherit(t.APOS_STRING_MODE,{className:"string"}),l=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),d={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[o,l,a,s,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[o,s,l,a]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[d],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[d],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(/</,e.lookahead(e.concat(n,e.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:d}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}const Ue=$t.createLowlight($t.all);Ue.register("html",bi),Ue.register("css",ci),Ue.register("js",pi),Ue.register("ts",gi);const hn=Fr.configure({lowlight:Ue}),pn=$r,mn=Jr,gn=Vr,bn=qr;function wi({node:t,updateAttributes:e,editor:n}){const[r,i]=k.useState(t.attrs?.open??!0),[o,s]=k.useState(!1),[a,l]=k.useState(t.attrs?.title||"Accordion Title"),d=k.useRef(null),u=n?.isEditable??!1;k.useEffect(()=>{o&&d.current&&(d.current.focus(),d.current.select())},[o]);const f=()=>{s(!1),e({title:a,open:r})},h=w=>{w.key==="Enter"?f():w.key==="Escape"&&(l(t.attrs?.title||"Accordion Title"),s(!1))},m=()=>{const w=!r;i(w),e({title:a,open:w})},b=()=>{u&&n&&confirm("Are you sure you want to delete this accordion?")&&n.chain().focus().deleteNode("accordion").run()};return c.jsxs(G.NodeViewWrapper,{className:"accordion border border-gray-200 rounded-lg mb-3 overflow-hidden",children:[c.jsx("div",{className:"accordion-header bg-gray-50 border-b border-gray-200",onClick:m,children:c.jsxs("div",{className:"flex items-center gap-2 px-1",children:[c.jsx("button",{onClick:w=>{w.stopPropagation(),m()},className:"flex items-center justify-center w-6 h-6 text-gray-600 hover:text-gray-800",title:r?"Collapse":"Expand",children:c.jsx("span",{className:`cursor-pointer transition-transform duration-200 ${r?"rotate-90":""}`,children:"▶"})}),o?c.jsx("input",{ref:d,type:"text",value:a,onChange:w=>l(w.target.value),onBlur:f,onKeyDown:h,className:"bg-transparent border-b border-gray-300 outline-none font-medium text-gray-800 flex-1 py-1",placeholder:"Enter accordion title..."}):c.jsx("div",{onClick:u?w=>{w.stopPropagation(),s(!0)}:void 0,className:`font-medium text-gray-800 flex-1 py-1 ${u?"cursor-text hover:text-blue-600":"cursor-pointer"}`,title:u?"Click to edit title":void 0,children:a}),u&&c.jsx("button",{onClick:w=>{w.stopPropagation(),b()},className:"px-2 py-1 text-red-600 hover:text-red-700 hover:bg-red-50 transition-colors rounded",title:"Delete accordion",children:c.jsx(O.Trash2,{className:"h-4 w-4"})})]})}),r&&c.jsx("div",{className:"accordion-content p-3 bg-white",children:c.jsx(G.NodeViewContent,{})})]})}const wn=V.Node.create({name:"accordion",group:"block",content:"accordionItem+",defining:!0,addAttributes(){return{title:{default:"Accordion Title",parseHTML:t=>t.getAttribute("data-title"),renderHTML:t=>t.title?{"data-title":t.title}:{}},open:{default:!0,parseHTML:t=>t.getAttribute("data-open")==="true",renderHTML:t=>({"data-open":t.open})}}},parseHTML(){return[{tag:'div[data-type="accordion"]'}]},renderHTML({HTMLAttributes:t}){return["div",V.mergeAttributes(t,{"data-type":"accordion"}),0]},addNodeView(){return G.ReactNodeViewRenderer(wi)},addCommands(){return{insertAccordion:()=>({commands:t})=>t.insertContent({type:this.name,content:[{type:"accordionItem",content:[{type:"paragraph",content:[{type:"text",text:"Accordion Item 1"}]}]}]})}}}),xn=V.Node.create({name:"accordionItem",group:"block",content:"block+",defining:!0,parseHTML(){return[{tag:'div[data-type="accordion-item"]'}]},renderHTML({HTMLAttributes:t}){return["div",V.mergeAttributes(t,{"data-type":"accordion-item"}),0]}});function xi({node:t,updateAttributes:e,editor:n}){const[r,i]=k.useState(t.attrs?.activeTab??0),[o,s]=k.useState(null),[a,l]=k.useState(""),d=k.useRef(null),u=t.content?.content||[],f=n?.isEditable??!1;k.useEffect(()=>{o!==null&&d.current&&(d.current.focus(),d.current.select())},[o]);const h=y=>{i(y),e({...t.attrs,activeTab:y})},m=(y,S)=>{f&&(s(y),l(S))},b=()=>{f&&n&&confirm("Are you sure you want to delete this tabs component?")&&n.chain().focus().deleteNode("tabs").run()},w=()=>{if(o!==null&&u[o]){const y=u[o];y.attrs&&(y.attrs.title=a),e({...t.attrs})}s(null),l("")},p=y=>{y.key==="Enter"?w():y.key==="Escape"&&(s(null),l(""))},E=y=>u[y]?.attrs?.title||`Tab ${y+1}`;return c.jsxs(G.NodeViewWrapper,{className:"tabs-container border border-gray-200 rounded-lg mb-4 overflow-hidden","data-active-tab":r,children:[c.jsx("div",{className:"tabs-header bg-gray-50 border-b border-gray-200",children:c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("div",{className:"flex flex-1 overflow-x-auto",children:u.map((y,S)=>c.jsx("button",{onClick:()=>h(S),className:`px-4 py-2 text-sm font-medium border-b-2 border-r border-gray-200 transition-colors relative lg:px-12 cursor-pointer ${r===S?"border-blue-500 border-r-gray-200 text-blue-600 bg-white":"border-transparent border-r-gray-200 text-gray-500 hover:text-gray-700 hover:border-gray-300"} ${S===u.length-1?"border-r-0":""}`,children:o===S?c.jsx("input",{ref:d,type:"text",value:a,onChange:R=>l(R.target.value),onBlur:w,onKeyDown:p,className:"bg-transparent border-none outline-none text-center min-w-16",onClick:R=>R.stopPropagation()}):c.jsx("span",{onClick:f?R=>{R.stopPropagation(),m(S,E(S))}:void 0,className:f?"cursor-text":"cursor-pointer",title:f?"Click to edit title":void 0,children:E(S)})},S))}),f&&c.jsx("button",{onClick:b,className:"px-3 py-2 text-red-600 hover:text-red-700 hover:bg-red-50 transition-colors",title:"Delete tabs",children:c.jsx(O.Trash2,{className:"h-4 w-4"})})]})}),c.jsx("div",{className:"tabs-content",children:c.jsx(G.NodeViewContent,{className:"tab-content-wrapper","data-active-tab":r})})]})}function yi({node:t}){const e=t.attrs?.tabIndex||0;return c.jsx(G.NodeViewWrapper,{className:"tab-item-content p-4","data-tab-index":e,children:c.jsx(G.NodeViewContent,{})})}const yn=V.Node.create({name:"tabs",group:"block",content:"tabItem+",defining:!0,addAttributes(){return{activeTab:{default:0,parseHTML:t=>parseInt(t.getAttribute("data-active-tab")||"0"),renderHTML:t=>({"data-active-tab":t.activeTab})},tabCount:{default:2,parseHTML:t=>parseInt(t.getAttribute("data-tab-count")||"2"),renderHTML:t=>({"data-tab-count":t.tabCount})}}},parseHTML(){return[{tag:'div[data-type="tabs"]'}]},renderHTML({HTMLAttributes:t}){return["div",V.mergeAttributes(t,{"data-type":"tabs"}),0]},addNodeView(){return G.ReactNodeViewRenderer(xi)},addCommands(){return{insertTabs:(t={tabCount:2})=>({commands:e})=>{const n=Math.min(Math.max(t.tabCount||2,2),6),r=Array.from({length:n},(i,o)=>({type:"tabItem",attrs:{tabIndex:o,title:`Tab ${o+1}`},content:[{type:"paragraph",content:[{type:"text",text:`Content for Tab ${o+1}. This is unique content for this tab.`}]}]}));return e.insertContent({type:this.name,attrs:{activeTab:0,tabCount:n},content:r})}}}}),vn=V.Node.create({name:"tabItem",group:"block",content:"block+",defining:!0,addAttributes(){return{tabIndex:{default:0,parseHTML:t=>parseInt(t.getAttribute("data-tab-index")||"0"),renderHTML:t=>({"data-tab-index":t.tabIndex})},title:{default:"Tab",parseHTML:t=>t.getAttribute("data-title")||"Tab",renderHTML:t=>({"data-title":t.title})}}},parseHTML(){return[{tag:'div[data-type="tab-item"]'}]},renderHTML({HTMLAttributes:t}){return["div",V.mergeAttributes(t,{"data-type":"tab-item"}),0]},addNodeView(){return G.ReactNodeViewRenderer(yi)}});function vi(...t){return Yr.twMerge(Gr.clsx(t))}const Ei=Kr.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function ee({className:t,variant:e,size:n,asChild:r=!1,...i}){const o=r?Wr.Slot:"button";return c.jsx(o,{"data-slot":"button",className:vi(Ei({variant:e,size:n,className:t})),...i})}const Si=({node:t,updateAttributes:e,deleteNode:n,editor:r})=>{const[i,o]=k.useState(!1),[s,a]=k.useState("simple"),[l,d]=k.useState(""),[u,f]=k.useState({src:t.attrs.src||"",width:t.attrs.width||"100%",height:t.attrs.height||"500px",title:t.attrs.title||"",allow:t.attrs.allow||"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",sandbox:t.attrs.sandbox||"allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-presentation",style:t.attrs.style||""}),h=x=>{const N=x.toLowerCase();return N.includes("youtube.com")||N.includes("youtu.be")?"allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-presentation allow-popups-to-escape-sandbox":N.includes("codesandbox.io")||N.includes("stackblitz.com")?"allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-presentation allow-popups-to-escape-sandbox allow-top-navigation":"allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-presentation"},m=x=>{const N=h(x);f({...u,src:x,sandbox:N})},b=()=>{p&&(e(u),o(!1))},w=()=>{f({src:t.attrs.src||"",width:t.attrs.width||"100%",height:t.attrs.height||"500px",title:t.attrs.title||"",allow:t.attrs.allow||"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",sandbox:t.attrs.sandbox||"allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-presentation",style:t.attrs.style||""}),o(!1)},[p,E]=k.useState(r?.isEditable??!1);k.useEffect(()=>{if(r){const x=()=>{E(r.isEditable)};return x(),r.on("update",x),r.on("selectionUpdate",x),()=>{r.off("update",x),r.off("selectionUpdate",x)}}},[r]);const y=()=>{p&&o(!0)},S=()=>{const x=`<iframe src="${u.src}" style="width:${u.width}; height: ${u.height}; ${u.style}" title="${u.title}" allow="${u.allow}" sandbox="${u.sandbox}"></iframe>`;navigator.clipboard.writeText(x)},R=x=>{const M=new DOMParser().parseFromString(x,"text/html").querySelector("iframe");if(M){const T=M.getAttribute("src")||"",L={src:T,width:M.getAttribute("width")||"100%",height:M.getAttribute("height")||"500px",title:M.getAttribute("title")||"",allow:M.getAttribute("allow")||"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",sandbox:M.getAttribute("sandbox")||h(T),style:M.getAttribute("style")||""};return f(L),!0}return!1},v=()=>{R(l)?(a("simple"),d("")):alert("Invalid iframe HTML code. Please check your input.")};return i?c.jsx(G.NodeViewWrapper,{className:"iframe-extension-editing",children:c.jsxs("div",{className:"border-2 border-blue-500 rounded-lg p-4 bg-blue-50",children:[c.jsxs("div",{className:"flex gap-2 mb-4",children:[c.jsx(ee,{onClick:()=>a("simple"),size:"sm",variant:s==="simple"?"default":"outline",className:"flex-1",children:"Simple Mode"}),c.jsx(ee,{onClick:()=>a("advanced"),size:"sm",variant:s==="advanced"?"default":"outline",className:"flex-1",children:"Advanced Mode"})]}),s==="simple"?c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Source URL"}),c.jsx("input",{type:"url",value:u.src,onChange:x=>m(x.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"https://example.com/embed"}),c.jsx("div",{className:"text-xs text-gray-600 mt-1",children:"Sandbox attributes are automatically configured based on the URL for optimal compatibility."})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Width"}),c.jsx("input",{type:"text",value:u.width,onChange:x=>f({...u,width:x.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"100%"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Height"}),c.jsx("input",{type:"text",value:u.height,onChange:x=>f({...u,height:x.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"500px"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Title"}),c.jsx("input",{type:"text",value:u.title,onChange:x=>f({...u,title:x.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"Embedded Content"})]})]}):c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Paste your iframe HTML code"}),c.jsx("textarea",{value:l,onChange:x=>d(x.target.value),className:"w-full h-32 px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 font-mono text-sm",placeholder:'<iframe src="https://example.com/embed" style="width:100%; height:500px; border:0; border-radius:4px; overflow:hidden;" title="Example" allow="..." sandbox="..."></iframe>'})]}),c.jsx("div",{className:"text-xs text-gray-600",children:"Paste your complete iframe HTML code here. The extension will automatically extract the attributes."}),c.jsxs("div",{className:"border-t pt-3",children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Sandbox Attributes (Advanced)"}),c.jsx("input",{type:"text",value:u.sandbox,onChange:x=>f({...u,sandbox:x.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 font-mono text-xs",placeholder:"allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-presentation"}),c.jsx("div",{className:"text-xs text-gray-600 mt-1",children:"Override automatic sandbox configuration if needed. Common values: allow-scripts, allow-same-origin, allow-forms, allow-popups"})]})]}),c.jsxs("div",{className:"flex gap-2 mt-4",children:[s==="advanced"&&c.jsx(ee,{onClick:v,size:"sm",className:"bg-green-600 hover:bg-green-700",children:"Parse & Apply"}),c.jsx(ee,{onClick:b,size:"sm",className:"bg-blue-600 hover:bg-blue-700",children:"Save"}),c.jsx(ee,{onClick:w,size:"sm",variant:"outline",children:"Cancel"})]})]})}):c.jsx(G.NodeViewWrapper,{className:"iframe-extension",children:c.jsxs("div",{className:"relative group",children:[c.jsx("iframe",{src:t.attrs.src,width:t.attrs.width,height:t.attrs.height,title:t.attrs.title,allow:t.attrs.allow,sandbox:t.attrs.sandbox,style:{...Ni(t.attrs.style),width:t.attrs.width,height:t.attrs.height},className:"rounded-lg"}),p&&c.jsx("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity duration-200 bg-white/90 backdrop-blur-sm rounded-lg p-1 shadow-lg border",children:c.jsxs("div",{className:"flex gap-1",children:[c.jsx(ee,{onClick:y,size:"sm",variant:"ghost",className:"h-8 w-8 p-0",title:"Edit iframe",children:c.jsx(O.Settings,{className:"h-4 w-4"})}),c.jsx(ee,{onClick:()=>window.open(t.attrs.src,"_blank"),size:"sm",variant:"ghost",className:"h-8 w-8 p-0",title:"Open in new tab",children:c.jsx(O.ExternalLink,{className:"h-4 w-4"})}),c.jsx(ee,{onClick:S,size:"sm",variant:"ghost",className:"h-8 w-8 p-0",title:"Copy iframe code",children:c.jsx(O.Copy,{className:"h-4 w-4"})}),c.jsx(ee,{onClick:()=>{p&&n()},size:"sm",variant:"ghost",className:"h-8 w-8 p-0 text-red-600 hover:text-red-700",title:"Delete iframe",children:c.jsx(O.Trash2,{className:"h-4 w-4"})})]})}),t.attrs.src&&c.jsxs("div",{className:"mt-2 text-xs text-gray-500 bg-gray-100 px-2 py-1 rounded",children:["Source: ",t.attrs.src]})]})})},Ni=t=>{const e={};return t&&t.split(";").forEach(n=>{const[r,i]=n.split(":").map(o=>o.trim());if(r&&i){const o=r.replace(/-([a-z])/g,s=>s[1].toUpperCase());e[o]=i}}),e},En=V.Node.create({name:"iframe",group:"block",atom:!0,addOptions(){return{readOnly:!1}},addAttributes(){return{src:{default:"",parseHTML:t=>t.getAttribute("src")||"",renderHTML:t=>({src:t.src})},width:{default:"100%",parseHTML:t=>t.getAttribute("width")||"100%",renderHTML:t=>({width:t.width})},height:{default:"500px",parseHTML:t=>t.getAttribute("height")||"500px",renderHTML:t=>({height:t.height})},title:{default:"",parseHTML:t=>t.getAttribute("title")||"",renderHTML:t=>({title:t.title})},allow:{default:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",parseHTML:t=>t.getAttribute("allow")||"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",renderHTML:t=>({allow:t.allow})},sandbox:{default:"allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-presentation",parseHTML:t=>t.getAttribute("sandbox")||"allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-presentation",renderHTML:t=>({sandbox:t.sandbox})},style:{default:"",parseHTML:t=>t.getAttribute("style")||"",renderHTML:t=>({style:t.style})}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:t}){return["iframe",V.mergeAttributes(t)]},addNodeView(){return G.ReactNodeViewRenderer(Si)},addCommands(){return{insertIframe:(t={})=>({commands:e})=>e.insertContent({type:this.name,attrs:{src:t.src||"",width:t.width||"100%",height:t.height||"500px",title:t.title||"Embedded Content",allow:t.allow||"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",sandbox:t.sandbox||"allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-presentation",style:t.style||""}})}}}),Sn=V.Node.create({name:"video",addOptions(){return{inline:!1,allowBase64:!0,HTMLAttributes:{class:"max-w-full h-auto rounded-lg shadow-sm"}}},group(){return this.options.inline?"inline":"block"},draggable:!1,addAttributes(){return{src:{default:null,parseHTML:t=>t.getAttribute("src"),renderHTML:t=>t.src?{src:t.src}:{}},type:{default:null,parseHTML:t=>t.getAttribute("type"),renderHTML:t=>t.type?{type:t.type}:{}},title:{default:null,parseHTML:t=>t.getAttribute("title"),renderHTML:t=>t.title?{title:t.title}:{}}}},parseHTML(){return[{tag:"video"}]},renderHTML({HTMLAttributes:t}){const{src:e,type:n,title:r}=t;return e?["video",V.mergeAttributes(this.options.HTMLAttributes,t,{controls:!0,preload:"metadata"}),["source",{src:e,type:n||"video/mp4"}],r||"Your browser does not support the video tag."]:["video",V.mergeAttributes(this.options.HTMLAttributes,t)]},addCommands(){return{setVideo:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}}});function Ti({initialOpen:t=!1,placement:e="top",open:n,onOpenChange:r,delay:i=600,closeDelay:o=0}={}){const[s,a]=ue.useState(t),l=n??s,d=r??a,u=ne.useFloating({placement:e,open:l,onOpenChange:d,whileElementsMounted:ne.autoUpdate,middleware:[ne.offset(4),ne.flip({crossAxis:e.includes("-"),fallbackAxisSideDirection:"start",padding:4}),ne.shift({padding:4})]}),f=u.context,h=ne.useHover(f,{mouseOnly:!0,move:!1,restMs:i,enabled:n==null,delay:{close:o}}),m=ne.useFocus(f,{enabled:n==null}),b=ne.useDismiss(f),w=ne.useRole(f,{role:"tooltip"}),p=ne.useInteractions([h,m,b,w]);return ue.useMemo(()=>({open:l,setOpen:d,...p,...u}),[l,d,p,u])}const ft=ue.createContext(null);function Nn(){const t=ue.useContext(ft);if(t==null)throw new Error("Tooltip components must be wrapped in <TooltipProvider />");return t}function ht({children:t,...e}){const n=Ti(e);return e.useDelayGroup?c.jsx(ne.FloatingDelayGroup,{delay:{open:e.delay??0,close:e.closeDelay??0},timeoutMs:e.timeout,children:c.jsx(ft.Provider,{value:n,children:t})}):c.jsx(ft.Provider,{value:n,children:t})}const pt=ue.forwardRef(function({children:e,asChild:n=!1,...r},i){const o=Nn(),s=ue.isValidElement(e)?parseInt(ue.version,10)>=19?e.props.ref:e.ref:void 0,a=ne.useMergeRefs([o.refs.setReference,i,s]);if(n&&ue.isValidElement(e)){const l={"data-tooltip-state":o.open?"open":"closed"};return ue.cloneElement(e,o.getReferenceProps({ref:a,...r,...typeof e.props=="object"?e.props:{},...l}))}return c.jsx("button",{ref:a,"data-tooltip-state":o.open?"open":"closed",...o.getReferenceProps(r),children:e})}),mt=ue.forwardRef(function({style:e,children:n,portal:r=!0,portalProps:i={},...o},s){const a=Nn(),l=ne.useMergeRefs([a.refs.setFloating,s]);if(!a.open)return null;const d=c.jsx("div",{ref:l,style:{...a.floatingStyles,...e},...a.getFloatingProps(o),className:"tiptap-tooltip",children:n});return r?c.jsx(ne.FloatingPortal,{...i,children:d}):d});ht.displayName="Tooltip",pt.displayName="TooltipTrigger",mt.displayName="TooltipContent";const _=({onClick:t,isActive:e=!1,children:n,title:r,className:i=""})=>{const o=c.jsx(ee,{onClick:t,variant:e?"default":"outline",size:"sm",className:`h-8 w-8 p-0 transition-all cursor-pointer ${e?"bg-blue-600 text-white border-blue-600 hover:bg-blue-700":"bg-white hover:bg-gray-50"} ${i}`,children:n});return r?c.jsxs(ht,{delay:500,closeDelay:0,children:[c.jsx(pt,{asChild:!0,children:o}),c.jsx(mt,{children:r})]}):o},Tn=({onColorChange:t})=>{const e=["#000000","#FF0000","#00FF00","#0000FF","#FFFF00","#FF00FF","#00FFFF","#FFA500","#800080","#008000","#000080","#800000","#808000","#FFC0CB"];return c.jsx("div",{className:"flex flex-wrap gap-1 w-32",children:e.map(n=>c.jsxs(ht,{delay:300,closeDelay:0,children:[c.jsx(pt,{asChild:!0,children:c.jsx("button",{className:"w-6 h-6 rounded border border-gray-300 cursor-pointer hover:scale-110 transition-transform",style:{backgroundColor:n},onClick:()=>t(n)})}),c.jsxs(mt,{children:["Set color to ",n]})]},n))})},ki=({editor:t,isReadOnly:e,onImageUpload:n,onVideoUpload:r,isImageUploading:i,isVideoUploading:o,showImageInput:s,setShowImageInput:a,imageUrl:l,setImageUrl:d,handleImageUrlInsert:u,imageUploadFunction:f})=>e?null:c.jsxs("div",{className:"sticky top-0 z-40 border border-gray-300 mb-4 p-4 bg-gray-50/95 flex flex-wrap gap-2 shadow-sm backdrop-blur-sm",children:[c.jsxs("div",{className:"flex gap-1 border-r border-gray-300 pr-2",children:[c.jsx(_,{onClick:()=>t.chain().focus().toggleHeading({level:1}).run(),isActive:t.isActive("heading",{level:1}),title:"Heading 1",children:c.jsx(O.Heading1,{className:"h-4 w-4"})}),c.jsx(_,{onClick:()=>t.chain().focus().toggleHeading({level:2}).run(),isActive:t.isActive("heading",{level:2}),title:"Heading 2",children:c.jsx(O.Heading2,{className:"h-4 w-4"})}),c.jsx(_,{onClick:()=>t.chain().focus().toggleHeading({level:3}).run(),isActive:t.isActive("heading",{level:3}),title:"Heading 3",children:c.jsx(O.Heading3,{className:"h-4 w-4"})}),c.jsx(_,{onClick:()=>t.chain().focus().setParagraph().run(),isActive:t.isActive("paragraph"),title:"Paragraph",children:c.jsx(O.FileText,{className:"h-4 w-4"})})]}),c.jsxs("div",{className:"flex gap-1 border-r border-gray-300 pr-2",children:[c.jsx(_,{onClick:()=>t.chain().focus().toggleBulletList().run(),isActive:t.isActive("bulletList"),title:"Bullet List",children:c.jsx(O.List,{className:"h-4 w-4"})}),c.jsx(_,{onClick:()=>t.chain().focus().toggleOrderedList().run(),isActive:t.isActive("orderedList"),title:"Numbered List",children:c.jsx(O.ListOrdered,{className:"h-4 w-4"})})]}),c.jsx("div",{className:"flex gap-1 border-r border-gray-300 pr-2",children:c.jsx(_,{onClick:()=>t.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),title:"Insert Table (3x3)",children:c.jsx(O.Table,{className:"h-4 w-4"})})}),c.jsxs("div",{className:"flex gap-1 border-r border-gray-300 pr-2",children:[c.jsx(_,{onClick:()=>t.chain().focus().toggleBlockquote().run(),isActive:t.isActive("blockquote"),title:"Block Quote",children:c.jsx(O.Quote,{className:"h-4 w-4"})}),c.jsx(_,{onClick:()=>t.chain().focus().setHorizontalRule().run(),title:"Horizontal Rule",children:c.jsx(O.Minus,{className:"h-4 w-4"})})]}),c.jsxs("div",{className:"flex gap-1 border-r border-gray-300 pr-2",children:[c.jsxs("div",{className:"relative",children:[c.jsx(_,{onClick:()=>a(!s),title:"Insert Image",className:i?"opacity-50":"",children:i?c.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-blue-600"}):c.jsx(O.Image,{className:"h-4 w-4"})}),i&&c.jsx("div",{className:"absolute -top-1 -right-1 w-3 h-3 bg-blue-600 rounded-full animate-pulse"}),s&&c.jsx("div",{className:`absolute top-full mt-1 z-10 bg-white border border-gray-300 rounded-lg p-2 shadow-lg min-w-80 image-input-container ${i?"opacity-75":""}`,children:c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("h3",{className:"text-sm font-medium text-gray-900",children:"Insert Image"}),c.jsx("button",{onClick:()=>a(!1),className:`text-gray-400 hover:text-gray-600 ${i?"opacity-50 cursor-not-allowed":""}`,disabled:i,children:"✕"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Image URL"}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("input",{type:"url",value:l,onChange:h=>d(h.target.value),placeholder:"https://example.com/image.jpg",className:`flex-1 px-3 py-2 text-sm border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 ${i?"opacity-50 cursor-not-allowed":""}`,disabled:i,onKeyDown:h=>{h.key==="Enter"&&u()}}),c.jsx(ee,{onClick:u,size:"sm",className:"px-4 py-2",disabled:!l.trim()||i,children:"Insert"})]}),l.trim()&&c.jsxs("div",{className:"mt-2 p-2 border border-gray-200 rounded bg-gray-50",children:[c.jsx("p",{className:"text-xs text-gray-600 mb-2",children:"Preview:"}),c.jsx("img",{src:l.trim(),alt:"Preview",className:"max-w-full h-auto max-h-32 rounded border",onError:h=>{const m=h.currentTarget;m.style.display="none";const b=m.nextElementSibling;b&&(b.style.display="block")}}),c.jsx("p",{className:"text-xs text-red-500 hidden",children:"Invalid image URL"})]})]}),c.jsxs("div",{className:"border-t pt-3",children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Or Upload Image"}),c.jsx(ee,{onClick:n,size:"sm",variant:"outline",className:"w-full",disabled:!f||i,children:i?c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-blue-600"}),c.jsx("span",{children:"Uploading..."})]}):f?"Choose File":"Upload not available"}),i&&c.jsxs("div",{className:"mt-2 text-xs text-blue-600 flex items-center gap-1",children:[c.jsx("div",{className:"animate-pulse",children:"⏳"}),c.jsx("span",{children:"Please wait while your image uploads..."})]}),!f&&c.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Upload function not provided"})]})]})})]}),c.jsxs("div",{className:"relative",children:[c.jsx(_,{onClick:r,title:o?"Upload Video to Firebase":"Upload Video (Base64)",className:o?"opacity-50":"",children:o?c.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-blue-600"}):c.jsx(O.Video,{className:"h-4 w-4"})}),o&&c.jsx("div",{className:"absolute -top-1 -right-1 w-3 h-3 bg-blue-600 rounded-full animate-pulse"}),!r&&c.jsx("div",{className:"absolute top-full mt-1 left-0 bg-gray-800 text-white text-xs px-2 py-1 rounded whitespace-nowrap z-50",children:"Video upload not available"})]})]}),c.jsxs("div",{className:"flex gap-1 border-r border-gray-300 pr-2",children:[c.jsx(_,{onClick:()=>t.chain().focus().toggleCodeBlock().run(),isActive:t.isActive("codeBlock"),title:"Code Block",children:c.jsx(O.Code,{className:"h-4 w-4"})}),c.jsx(_,{onClick:()=>t.chain().focus().insertAccordion().run(),title:"Insert Accordion",children:c.jsx(O.PanelTopOpen,{className:"h-4 w-4 cursor-pointer"})})]}),c.jsxs("div",{className:"flex gap-1 border-r border-gray-300 pr-2",children:[c.jsx(_,{onClick:()=>t.chain().focus().insertTabs({tabCount:2}).run(),title:"Insert 2 Tabs",children:c.jsx("span",{className:"text-xs font-mono",children:"2T"})}),c.jsx(_,{onClick:()=>t.chain().focus().insertTabs({tabCount:3}).run(),title:"Insert 3 Tabs",children:c.jsx("span",{className:"text-xs font-mono",children:"3T"})}),c.jsx(_,{onClick:()=>t.chain().focus().insertTabs({tabCount:4}).run(),title:"Insert 4 Tabs",children:c.jsx("span",{className:"text-xs font-mono",children:"4T"})}),c.jsx(_,{onClick:()=>t.chain().focus().insertTabs({tabCount:5}).run(),title:"Insert 5 Tabs",children:c.jsx("span",{className:"text-xs font-mono",children:"5T"})}),c.jsx(_,{onClick:()=>t.chain().focus().insertTabs({tabCount:6}).run(),title:"Insert 6 Tabs",children:c.jsx("span",{className:"text-xs font-mono",children:"6T"})})]}),c.jsx("div",{className:"flex gap-1 border-r border-gray-300 pr-2",children:c.jsx(_,{onClick:()=>{const h=prompt("Enter the URL for your iframe:","https://example.com/embed");h&&t.chain().focus().insertIframe({src:h,width:"100%",height:"500px",title:"Embedded Content"}).run()},title:"Insert iframe",children:c.jsx(O.Frame,{className:"h-4 w-4"})})})]}),kn=["top","right","bottom","left"],Cn=["start","end"],An=kn.reduce((t,e)=>t.concat(e,e+"-"+Cn[0],e+"-"+Cn[1]),[]),fe=Math.min,te=Math.max,Ge=Math.round,he=t=>({x:t,y:t}),Ci={left:"right",right:"left",bottom:"top",top:"bottom"},Ai={start:"end",end:"start"};function gt(t,e,n){return te(t,fe(e,n))}function we(t,e){return typeof t=="function"?t(e):t}function oe(t){return t.split("-")[0]}function le(t){return t.split("-")[1]}function On(t){return t==="x"?"y":"x"}function bt(t){return t==="y"?"height":"width"}const Oi=new Set(["top","bottom"]);function pe(t){return Oi.has(oe(t))?"y":"x"}function wt(t){return On(pe(t))}function Rn(t,e,n){n===void 0&&(n=!1);const r=le(t),i=wt(t),o=bt(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=Ze(s)),[s,Ze(s)]}function Ri(t){const e=Ze(t);return[Ye(t),e,Ye(e)]}function Ye(t){return t.replace(/start|end/g,e=>Ai[e])}const In=["left","right"],Mn=["right","left"],Ii=["top","bottom"],Mi=["bottom","top"];function _i(t,e,n){switch(t){case"top":case"bottom":return n?e?Mn:In:e?In:Mn;case"left":case"right":return e?Ii:Mi;default:return[]}}function Li(t,e,n,r){const i=le(t);let o=_i(oe(t),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),e&&(o=o.concat(o.map(Ye)))),o}function Ze(t){return t.replace(/left|right|bottom|top/g,e=>Ci[e])}function ji(t){return{top:0,right:0,bottom:0,left:0,...t}}function xt(t){return typeof t!="number"?ji(t):{top:t,right:t,bottom:t,left:t}}function Re(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function _n(t,e,n){let{reference:r,floating:i}=t;const o=pe(e),s=wt(e),a=bt(s),l=oe(e),d=o==="y",u=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2;let m;switch(l){case"top":m={x:u,y:r.y-i.height};break;case"bottom":m={x:u,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:f};break;case"left":m={x:r.x-i.width,y:f};break;default:m={x:r.x,y:r.y}}switch(le(e)){case"start":m[s]-=h*(n&&d?-1:1);break;case"end":m[s]+=h*(n&&d?-1:1);break}return m}const Pi=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(e));let d=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:f}=_n(d,r,l),h=r,m={},b=0;for(let w=0;w<a.length;w++){const{name:p,fn:E}=a[w],{x:y,y:S,data:R,reset:v}=await E({x:u,y:f,initialPlacement:r,placement:h,strategy:i,middlewareData:m,rects:d,platform:s,elements:{reference:t,floating:e}});u=y??u,f=S??f,m={...m,[p]:{...m[p],...R}},v&&b<=50&&(b++,typeof v=="object"&&(v.placement&&(h=v.placement),v.rects&&(d=v.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:i}):v.rects),{x:u,y:f}=_n(d,h,l)),w=-1)}return{x:u,y:f,placement:h,strategy:i,middlewareData:m}};async function Ie(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=t,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:m=0}=we(e,t),b=xt(m),p=a[h?f==="floating"?"reference":"floating":f],E=Re(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(p)))==null||n?p:p.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:d,rootBoundary:u,strategy:l})),y=f==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),R=await(o.isElement==null?void 0:o.isElement(S))?await(o.getScale==null?void 0:o.getScale(S))||{x:1,y:1}:{x:1,y:1},v=Re(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:S,strategy:l}):y);return{top:(E.top-v.top+b.top)/R.y,bottom:(v.bottom-E.bottom+b.bottom)/R.y,left:(E.left-v.left+b.left)/R.x,right:(v.right-E.right+b.right)/R.x}}const Di=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:l}=e,{element:d,padding:u=0}=we(t,e)||{};if(d==null)return{};const f=xt(u),h={x:n,y:r},m=wt(i),b=bt(m),w=await s.getDimensions(d),p=m==="y",E=p?"top":"left",y=p?"bottom":"right",S=p?"clientHeight":"clientWidth",R=o.reference[b]+o.reference[m]-h[m]-o.floating[b],v=h[m]-o.reference[m],x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(d));let N=x?x[S]:0;(!N||!await(s.isElement==null?void 0:s.isElement(x)))&&(N=a.floating[S]||o.floating[b]);const C=R/2-v/2,M=N/2-w[b]/2-1,T=fe(f[E],M),L=fe(f[y],M),F=T,W=N-w[b]-L,U=N/2-w[b]/2+C,Y=gt(F,U,W),J=!l.arrow&&le(i)!=null&&U!==Y&&o.reference[b]/2-(U<F?T:L)-w[b]/2<0,K=J?U<F?U-F:U-W:0;return{[m]:h[m]+K,data:{[m]:Y,centerOffset:U-Y-K,...J&&{alignmentOffset:K}},reset:J}}});function zi(t,e,n){return(t?[...n.filter(i=>le(i)===t),...n.filter(i=>le(i)!==t)]:n.filter(i=>oe(i)===i)).filter(i=>t?le(i)===t||(e?Ye(i)!==i:!1):!0)}const Bi=function(t){return t===void 0&&(t={}),{name:"autoPlacement",options:t,async fn(e){var n,r,i;const{rects:o,middlewareData:s,placement:a,platform:l,elements:d}=e,{crossAxis:u=!1,alignment:f,allowedPlacements:h=An,autoAlignment:m=!0,...b}=we(t,e),w=f!==void 0||h===An?zi(f||null,m,h):h,p=await Ie(e,b),E=((n=s.autoPlacement)==null?void 0:n.index)||0,y=w[E];if(y==null)return{};const S=Rn(y,o,await(l.isRTL==null?void 0:l.isRTL(d.floating)));if(a!==y)return{reset:{placement:w[0]}};const R=[p[oe(y)],p[S[0]],p[S[1]]],v=[...((r=s.autoPlacement)==null?void 0:r.overflows)||[],{placement:y,overflows:R}],x=w[E+1];if(x)return{data:{index:E+1,overflows:v},reset:{placement:x}};const N=v.map(T=>{const L=le(T.placement);return[T.placement,L&&u?T.overflows.slice(0,2).reduce((F,W)=>F+W,0):T.overflows[0],T.overflows]}).sort((T,L)=>T[1]-L[1]),M=((i=N.filter(T=>T[2].slice(0,le(T[0])?2:3).every(L=>L<=0))[0])==null?void 0:i[0])||N[0][0];return M!==a?{data:{index:E+1,overflows:v},reset:{placement:M}}:{}}}},Ui=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:l,elements:d}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:w=!0,...p}=we(t,e);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const E=oe(i),y=pe(a),S=oe(a)===a,R=await(l.isRTL==null?void 0:l.isRTL(d.floating)),v=h||(S||!w?[Ze(a)]:Ri(a)),x=b!=="none";!h&&x&&v.push(...Li(a,w,b,R));const N=[a,...v],C=await Ie(e,p),M=[];let T=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&M.push(C[E]),f){const U=Rn(i,s,R);M.push(C[U[0]],C[U[1]])}if(T=[...T,{placement:i,overflows:M}],!M.every(U=>U<=0)){var L,F;const U=(((L=o.flip)==null?void 0:L.index)||0)+1,Y=N[U];if(Y&&(!(f==="alignment"?y!==pe(Y):!1)||T.every(I=>pe(I.placement)===y?I.overflows[0]>0:!0)))return{data:{index:U,overflows:T},reset:{placement:Y}};let J=(F=T.filter(K=>K.overflows[0]<=0).sort((K,I)=>K.overflows[1]-I.overflows[1])[0])==null?void 0:F.placement;if(!J)switch(m){case"bestFit":{var W;const K=(W=T.filter(I=>{if(x){const H=pe(I.placement);return H===y||H==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(H=>H>0).reduce((H,g)=>H+g,0)]).sort((I,H)=>I[1]-H[1])[0])==null?void 0:W[0];K&&(J=K);break}case"initialPlacement":J=a;break}if(i!==J)return{reset:{placement:J}}}return{}}}};function Ln(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function jn(t){return kn.some(e=>t[e]>=0)}const Hi=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...i}=we(t,e);switch(r){case"referenceHidden":{const o=await Ie(e,{...i,elementContext:"reference"}),s=Ln(o,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:jn(s)}}}case"escaped":{const o=await Ie(e,{...i,altBoundary:!0}),s=Ln(o,n.floating);return{data:{escapedOffsets:s,escaped:jn(s)}}}default:return{}}}}};function Pn(t){const e=fe(...t.map(o=>o.left)),n=fe(...t.map(o=>o.top)),r=te(...t.map(o=>o.right)),i=te(...t.map(o=>o.bottom));return{x:e,y:n,width:r-e,height:i-n}}function Fi(t){const e=t.slice().sort((i,o)=>i.y-o.y),n=[];let r=null;for(let i=0;i<e.length;i++){const o=e[i];!r||o.y-r.y>r.height/2?n.push([o]):n[n.length-1].push(o),r=o}return n.map(i=>Re(Pn(i)))}const $i=function(t){return t===void 0&&(t={}),{name:"inline",options:t,async fn(e){const{placement:n,elements:r,rects:i,platform:o,strategy:s}=e,{padding:a=2,x:l,y:d}=we(t,e),u=Array.from(await(o.getClientRects==null?void 0:o.getClientRects(r.reference))||[]),f=Fi(u),h=Re(Pn(u)),m=xt(a);function b(){if(f.length===2&&f[0].left>f[1].right&&l!=null&&d!=null)return f.find(p=>l>p.left-m.left&&l<p.right+m.right&&d>p.top-m.top&&d<p.bottom+m.bottom)||h;if(f.length>=2){if(pe(n)==="y"){const T=f[0],L=f[f.length-1],F=oe(n)==="top",W=T.top,U=L.bottom,Y=F?T.left:L.left,J=F?T.right:L.right,K=J-Y,I=U-W;return{top:W,bottom:U,left:Y,right:J,width:K,height:I,x:Y,y:W}}const p=oe(n)==="left",E=te(...f.map(T=>T.right)),y=fe(...f.map(T=>T.left)),S=f.filter(T=>p?T.left===y:T.right===E),R=S[0].top,v=S[S.length-1].bottom,x=y,N=E,C=N-x,M=v-R;return{top:R,bottom:v,left:x,right:N,width:C,height:M,x,y:R}}return h}const w=await o.getElementRects({reference:{getBoundingClientRect:b},floating:r.floating,strategy:s});return i.reference.x!==w.reference.x||i.reference.y!==w.reference.y||i.reference.width!==w.reference.width||i.reference.height!==w.reference.height?{reset:{rects:w}}:{}}}},Ji=new Set(["left","top"]);async function Vi(t,e){const{placement:n,platform:r,elements:i}=t,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=oe(n),a=le(n),l=pe(n)==="y",d=Ji.has(s)?-1:1,u=o&&l?-1:1,f=we(e,t);let{mainAxis:h,crossAxis:m,alignmentAxis:b}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof b=="number"&&(m=a==="end"?b*-1:b),l?{x:m*u,y:h*d}:{x:h*d,y:m*u}}const qi=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:o,placement:s,middlewareData:a}=e,l=await Vi(e,t);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},Wi=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:p=>{let{x:E,y}=p;return{x:E,y}}},...l}=we(t,e),d={x:n,y:r},u=await Ie(e,l),f=pe(oe(i)),h=On(f);let m=d[h],b=d[f];if(o){const p=h==="y"?"top":"left",E=h==="y"?"bottom":"right",y=m+u[p],S=m-u[E];m=gt(y,m,S)}if(s){const p=f==="y"?"top":"left",E=f==="y"?"bottom":"right",y=b+u[p],S=b-u[E];b=gt(y,b,S)}const w=a.fn({...e,[h]:m,[f]:b});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[h]:o,[f]:s}}}}}},Ki=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:o,platform:s,elements:a}=e,{apply:l=()=>{},...d}=we(t,e),u=await Ie(e,d),f=oe(i),h=le(i),m=pe(i)==="y",{width:b,height:w}=o.floating;let p,E;f==="top"||f==="bottom"?(p=f,E=h===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(E=f,p=h==="end"?"top":"bottom");const y=w-u.top-u.bottom,S=b-u.left-u.right,R=fe(w-u[p],y),v=fe(b-u[E],S),x=!e.middlewareData.shift;let N=R,C=v;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(C=S),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(N=y),x&&!h){const T=te(u.left,0),L=te(u.right,0),F=te(u.top,0),W=te(u.bottom,0);m?C=b-2*(T!==0||L!==0?T+L:te(u.left,u.right)):N=w-2*(F!==0||W!==0?F+W:te(u.top,u.bottom))}await l({...e,availableWidth:C,availableHeight:N});const M=await s.getDimensions(a.floating);return b!==M.width||w!==M.height?{reset:{rects:!0}}:{}}}};function Xe(){return typeof window<"u"}function Me(t){return Dn(t)?(t.nodeName||"").toLowerCase():"#document"}function re(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function xe(t){var e;return(e=(Dn(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Dn(t){return Xe()?t instanceof Node||t instanceof re(t).Node:!1}function ce(t){return Xe()?t instanceof Element||t instanceof re(t).Element:!1}function me(t){return Xe()?t instanceof HTMLElement||t instanceof re(t).HTMLElement:!1}function zn(t){return!Xe()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof re(t).ShadowRoot}const Gi=new Set(["inline","contents"]);function He(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=de(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!Gi.has(i)}const Yi=new Set(["table","td","th"]);function Zi(t){return Yi.has(Me(t))}const Xi=[":popover-open",":modal"];function Qe(t){return Xi.some(e=>{try{return t.matches(e)}catch{return!1}})}const Qi=["transform","translate","scale","rotate","perspective"],eo=["transform","translate","scale","rotate","perspective","filter"],to=["paint","layout","strict","content"];function yt(t){const e=vt(),n=ce(t)?de(t):t;return Qi.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||eo.some(r=>(n.willChange||"").includes(r))||to.some(r=>(n.contain||"").includes(r))}function no(t){let e=Ne(t);for(;me(e)&&!_e(e);){if(yt(e))return e;if(Qe(e))return null;e=Ne(e)}return null}function vt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const ro=new Set(["html","body","#document"]);function _e(t){return ro.has(Me(t))}function de(t){return re(t).getComputedStyle(t)}function et(t){return ce(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ne(t){if(Me(t)==="html")return t;const e=t.assignedSlot||t.parentNode||zn(t)&&t.host||xe(t);return zn(e)?e.host:e}function Bn(t){const e=Ne(t);return _e(e)?t.ownerDocument?t.ownerDocument.body:t.body:me(e)&&He(e)?e:Bn(e)}function Un(t,e,n){var r;e===void 0&&(e=[]);const i=Bn(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),s=re(i);return o?(Et(s),e.concat(s,s.visualViewport||[],He(i)?i:[],[])):e.concat(i,Un(i,[]))}function Et(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Hn(t){const e=de(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=me(t),o=i?t.offsetWidth:n,s=i?t.offsetHeight:r,a=Ge(n)!==o||Ge(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function Fn(t){return ce(t)?t:t.contextElement}function Le(t){const e=Fn(t);if(!me(e))return he(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:o}=Hn(e);let s=(o?Ge(n.width):n.width)/r,a=(o?Ge(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const io=he(0);function $n(t){const e=re(t);return!vt()||!e.visualViewport?io:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function oo(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==re(t)?!1:e}function Fe(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),o=Fn(t);let s=he(1);e&&(r?ce(r)&&(s=Le(r)):s=Le(t));const a=oo(o,n,r)?$n(o):he(0);let l=(i.left+a.x)/s.x,d=(i.top+a.y)/s.y,u=i.width/s.x,f=i.height/s.y;if(o){const h=re(o),m=r&&ce(r)?re(r):r;let b=h,w=Et(b);for(;w&&r&&m!==b;){const p=Le(w),E=w.getBoundingClientRect(),y=de(w),S=E.left+(w.clientLeft+parseFloat(y.paddingLeft))*p.x,R=E.top+(w.clientTop+parseFloat(y.paddingTop))*p.y;l*=p.x,d*=p.y,u*=p.x,f*=p.y,l+=S,d+=R,b=re(w),w=Et(b)}}return Re({width:u,height:f,x:l,y:d})}function tt(t,e){const n=et(t).scrollLeft;return e?e.left+n:Fe(xe(t)).left+n}function Jn(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-tt(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function so(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const o=i==="fixed",s=xe(r),a=e?Qe(e.floating):!1;if(r===s||a&&o)return n;let l={scrollLeft:0,scrollTop:0},d=he(1);const u=he(0),f=me(r);if((f||!f&&!o)&&((Me(r)!=="body"||He(s))&&(l=et(r)),me(r))){const m=Fe(r);d=Le(r),u.x=m.x+r.clientLeft,u.y=m.y+r.clientTop}const h=s&&!f&&!o?Jn(s,l):he(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-l.scrollLeft*d.x+u.x+h.x,y:n.y*d.y-l.scrollTop*d.y+u.y+h.y}}function ao(t){return Array.from(t.getClientRects())}function lo(t){const e=xe(t),n=et(t),r=t.ownerDocument.body,i=te(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=te(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+tt(t);const a=-n.scrollTop;return de(r).direction==="rtl"&&(s+=te(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}const Vn=25;function co(t,e){const n=re(t),r=xe(t),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;const u=vt();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const d=tt(r);if(d<=0){const u=r.ownerDocument,f=u.body,h=getComputedStyle(f),m=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,b=Math.abs(r.clientWidth-f.clientWidth-m);b<=Vn&&(o-=b)}else d<=Vn&&(o+=d);return{width:o,height:s,x:a,y:l}}const uo=new Set(["absolute","fixed"]);function fo(t,e){const n=Fe(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=me(t)?Le(t):he(1),s=t.clientWidth*o.x,a=t.clientHeight*o.y,l=i*o.x,d=r*o.y;return{width:s,height:a,x:l,y:d}}function qn(t,e,n){let r;if(e==="viewport")r=co(t,n);else if(e==="document")r=lo(xe(t));else if(ce(e))r=fo(e,n);else{const i=$n(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Re(r)}function Wn(t,e){const n=Ne(t);return n===e||!ce(n)||_e(n)?!1:de(n).position==="fixed"||Wn(n,e)}function ho(t,e){const n=e.get(t);if(n)return n;let r=Un(t,[]).filter(a=>ce(a)&&Me(a)!=="body"),i=null;const o=de(t).position==="fixed";let s=o?Ne(t):t;for(;ce(s)&&!_e(s);){const a=de(s),l=yt(s);!l&&a.position==="fixed"&&(i=null),(o?!l&&!i:!l&&a.position==="static"&&!!i&&uo.has(i.position)||He(s)&&!l&&Wn(t,s))?r=r.filter(u=>u!==s):i=a,s=Ne(s)}return e.set(t,r),r}function po(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const s=[...n==="clippingAncestors"?Qe(e)?[]:ho(e,this._c):[].concat(n),r],a=s[0],l=s.reduce((d,u)=>{const f=qn(e,u,i);return d.top=te(f.top,d.top),d.right=fe(f.right,d.right),d.bottom=fe(f.bottom,d.bottom),d.left=te(f.left,d.left),d},qn(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function mo(t){const{width:e,height:n}=Hn(t);return{width:e,height:n}}function go(t,e,n){const r=me(e),i=xe(e),o=n==="fixed",s=Fe(t,!0,o,e);let a={scrollLeft:0,scrollTop:0};const l=he(0);function d(){l.x=tt(i)}if(r||!r&&!o)if((Me(e)!=="body"||He(i))&&(a=et(e)),r){const m=Fe(e,!0,o,e);l.x=m.x+e.clientLeft,l.y=m.y+e.clientTop}else i&&d();o&&!r&&i&&d();const u=i&&!r&&!o?Jn(i,a):he(0),f=s.left+a.scrollLeft-l.x-u.x,h=s.top+a.scrollTop-l.y-u.y;return{x:f,y:h,width:s.width,height:s.height}}function St(t){return de(t).position==="static"}function Kn(t,e){if(!me(t)||de(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return xe(t)===n&&(n=n.ownerDocument.body),n}function Gn(t,e){const n=re(t);if(Qe(t))return n;if(!me(t)){let i=Ne(t);for(;i&&!_e(i);){if(ce(i)&&!St(i))return i;i=Ne(i)}return n}let r=Kn(t,e);for(;r&&Zi(r)&&St(r);)r=Kn(r,e);return r&&_e(r)&&St(r)&&!yt(r)?n:r||no(t)||n}const bo=async function(t){const e=this.getOffsetParent||Gn,n=this.getDimensions,r=await n(t.floating);return{reference:go(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function wo(t){return de(t).direction==="rtl"}const xo={convertOffsetParentRelativeRectToViewportRelativeRect:so,getDocumentElement:xe,getClippingRect:po,getOffsetParent:Gn,getElementRects:bo,getClientRects:ao,getDimensions:mo,getScale:Le,isElement:ce,isRTL:wo},Yn=qi,Zn=Bi,Xn=Wi,Qn=Ui,er=Ki,tr=Hi,nr=Di,rr=$i,ir=(t,e,n)=>{const r=new Map,i={platform:xo,...n},o={...i.platform,_c:r};return Pi(t,e,{...i,platform:o})};function or(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),o=e.child(r);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)n++;return n}if(i.content.size||o.content.size){let s=or(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function sr(t,e,n,r){for(let i=t.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:r};let s=t.child(--i),a=e.child(--o),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let d=0,u=Math.min(s.text.length,a.text.length);for(;d<u&&s.text[s.text.length-d-1]==a.text[a.text.length-d-1];)d++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let d=sr(s.content,a.content,n-1,r-1);if(d)return d}n-=l,r-=l}}class z{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,o){for(let s=0,a=0;a<n;s++){let l=this.content[s],d=a+l.nodeSize;if(d>e&&r(l,i+a,o||null,s)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,i+u)}a=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let o="",s=!0;return this.nodesBetween(e,n,(a,l)=>{let d=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&d||a.isTextblock)&&r&&(s?s=!1:o+=r),o+=d},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new z(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let o=0,s=0;s<n;o++){let a=this.content[o],l=s+a.nodeSize;l>e&&((s<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),r.push(a),i+=a.nodeSize),s=l}return new z(r,i)}cutByIndex(e,n){return e==n?z.empty:e==0&&n==this.content.length?this:new z(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new z(i,o)}addToStart(e){return new z([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new z(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return or(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return sr(this,e,n,r)}findIndex(e){if(e==0)return nt(0,e);if(e==this.size)return nt(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),o=r+i.nodeSize;if(o>=e)return o==e?nt(n+1,o):nt(n,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return z.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new z(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return z.empty;let n,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(n||(n=e.slice(0,i)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new z(n||e,r)}static from(e){if(!e)return z.empty;if(e instanceof z)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new z([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}z.empty=new z([],0);const Nt={index:0,offset:0};function nt(t,e){return Nt.index=t,Nt.offset=e,Nt}class yo extends Error{}class P{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=lr(this.content,e+this.openStart,n);return r&&new P(r,this.openStart,this.openEnd)}removeBetween(e,n){return new P(ar(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return P.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new P(z.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new P(e,r,i)}}P.empty=new P(z.empty,0,0);function ar(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(i==e||o.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(ar(o.content,e-i-1,n-i-1)))}function lr(t,e,n,r){let{index:i,offset:o}=t.findIndex(e),s=t.maybeChild(i);if(o==e||s.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=lr(s.content,e-o-1,n,s);return a&&t.replaceChild(i,s.copy(a))}const cr=65535,dr=Math.pow(2,16);function vo(t,e){return t+e*dr}function ur(t){return t&cr}function Eo(t){return(t-(t&cr))/dr}const fr=1,hr=2,rt=4,pr=8;class mr{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&pr)>0}get deletedBefore(){return(this.delInfo&(fr|rt))>0}get deletedAfter(){return(this.delInfo&(hr|rt))>0}get deletedAcross(){return(this.delInfo&rt)>0}}class ie{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&ie.empty)return ie.empty}recover(e){let n=0,r=ur(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+Eo(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let d=this.ranges[a+o],u=this.ranges[a+s],f=l+d;if(e<=f){let h=d?e==l?-1:e==f?1:n:n,m=l+i+(h<0?0:u);if(r)return m;let b=e==(n<0?l:f)?null:vo(a/3,e-l),w=e==l?hr:e==f?fr:rt;return(n<0?e!=l:e!=f)&&(w|=pr),new mr(m,w,b)}i+=u-d}return r?e+i:new mr(e+i,0,null)}touches(e,n){let r=0,i=ur(n),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let d=this.ranges[a+o],u=l+d;if(e<=u&&a==i*3)return!0;r+=this.ranges[a+s]-d}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],a=s-(this.inverted?o:0),l=s+(this.inverted?0:o),d=this.ranges[i+n],u=this.ranges[i+r];e(a,a+d,l,l+u),o+=u-d}}invert(){return new ie(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?ie.empty:new ie(e<0?[0,-e,0]:[0,0,e])}}ie.empty=new ie([]);const Tt=Object.create(null);class X{getMap(){return ie.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Tt[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Tt)throw new RangeError("Duplicate use of step JSON ID "+e);return Tt[e]=n,n.prototype.jsonID=e,n}}class q{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new q(e,null)}static fail(e){return new q(null,e)}static fromReplace(e,n,r,i){try{return q.ok(e.replace(n,r,i))}catch(o){if(o instanceof yo)return q.fail(o.message);throw o}}}function kt(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let o=t.child(i);o.content.size&&(o=o.copy(kt(o.content,e,o))),o.isInline&&(o=e(o,n,i)),r.push(o)}return z.fromArray(r)}class Ce extends X{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new P(kt(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return q.fromReplace(e,this.from,this.to,o)}invert(){return new Ae(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Ce(n.pos,r.pos,this.mark)}merge(e){return e instanceof Ce&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ce(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Ce(n.from,n.to,e.markFromJSON(n.mark))}}X.jsonID("addMark",Ce);class Ae extends X{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new P(kt(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return q.fromReplace(e,this.from,this.to,r)}invert(){return new Ce(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Ae(n.pos,r.pos,this.mark)}merge(e){return e instanceof Ae&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ae(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ae(n.from,n.to,e.markFromJSON(n.mark))}}X.jsonID("removeMark",Ae);class Oe extends X{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return q.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return q.fromReplace(e,this.pos,this.pos+1,new P(z.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Oe(this.pos,n.marks[i]);return new Oe(this.pos,this.mark)}}return new $e(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Oe(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Oe(n.pos,e.markFromJSON(n.mark))}}X.jsonID("addNodeMark",Oe);class $e extends X{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return q.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return q.fromReplace(e,this.pos,this.pos+1,new P(z.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Oe(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new $e(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new $e(n.pos,e.markFromJSON(n.mark))}}X.jsonID("removeNodeMark",$e);class ye extends X{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Ct(e,this.from,this.to)?q.fail("Structure replace would overwrite content"):q.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ie([this.from,this.to-this.from,this.slice.size])}invert(e){return new ye(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new ye(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ye)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?P.empty:new P(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ye(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?P.empty:new P(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ye(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ye(n.from,n.to,P.fromJSON(e,n.slice),!!n.structure)}}X.jsonID("replace",ye);class je extends X{constructor(e,n,r,i,o,s,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=a}apply(e){if(this.structure&&(Ct(e,this.from,this.gapFrom)||Ct(e,this.gapTo,this.to)))return q.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return q.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?q.fromReplace(e,this.from,this.to,r):q.fail("Content does not fit in gap")}getMap(){return new ie([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new je(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new je(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new je(n.from,n.to,n.gapFrom,n.gapTo,P.fromJSON(e,n.slice),n.insert,!!n.structure)}}X.jsonID("replaceAround",je);function Ct(t,e,n){let r=t.resolve(e),i=n-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}class Je extends X{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return q.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return q.fromReplace(e,this.pos,this.pos+1,new P(z.from(i),0,n.isLeaf?0:1))}getMap(){return ie.empty}invert(e){return new Je(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Je(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Je(n.pos,n.attr,n.value)}}X.jsonID("attr",Je);class it extends X{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return q.ok(r)}getMap(){return ie.empty}invert(e){return new it(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new it(n.attr,n.value)}}X.jsonID("docAttr",it);let Ve=class extends Error{};Ve=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},Ve.prototype=Object.create(Error.prototype),Ve.prototype.constructor=Ve,Ve.prototype.name="TransformError";const At=Object.create(null);class B{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new gr(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=P.empty){let r=n.content.lastChild,i=null;for(let a=0;a<n.openEnd;a++)i=r,r=r.lastChild;let o=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:d}=s[a],u=e.mapping.slice(o);e.replaceRange(u.map(l.pos),u.map(d.pos),a?P.empty:n),a==0&&xr(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:a}=i[o],l=e.mapping.slice(r),d=l.map(s.pos),u=l.map(a.pos);o?e.deleteRange(d,u):(e.replaceRangeWith(d,u,n),xr(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new se(e):Pe(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let s=n<0?Pe(e.node(0),e.node(o),e.before(o+1),e.index(o),n,r):Pe(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new ve(e.node(0))}static atStart(e){return Pe(e,e,0,0,1)||new ve(e)}static atEnd(e){return Pe(e,e,e.content.size,e.childCount,-1)||new ve(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=At[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in At)throw new RangeError("Duplicate use of selection JSON ID "+e);return At[e]=n,n.prototype.jsonID=e,n}getBookmark(){return se.between(this.$anchor,this.$head).getBookmark()}}B.prototype.visible=!0;class gr{constructor(e,n){this.$from=e,this.$to=n}}let br=!1;function wr(t){!br&&!t.parent.inlineContent&&(br=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class se extends B{constructor(e,n=e){wr(e),wr(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return B.near(r);let i=e.resolve(n.map(this.anchor));return new se(i.parent.inlineContent?i:r,r)}replace(e,n=P.empty){if(super.replace(e,n),n==P.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof se&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new ot(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new se(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let o=B.findFrom(n,r,!0)||B.findFrom(n,-r,!0);if(o)n=o.$head;else return B.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(B.findFrom(e,-r,!0)||B.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new se(e,n)}}B.jsonID("text",se);class ot{constructor(e,n){this.anchor=e,this.head=n}map(e){return new ot(e.map(this.anchor),e.map(this.head))}resolve(e){return se.between(e.resolve(this.anchor),e.resolve(this.head))}}class ae extends B{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),o=e.resolve(i);return r?B.near(o):new ae(o)}content(){return new P(z.from(this.node),0,0)}eq(e){return e instanceof ae&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Ot(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ae(e.resolve(n.anchor))}static create(e,n){return new ae(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}ae.prototype.visible=!1,B.jsonID("node",ae);class Ot{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new ot(r,r):new Ot(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&ae.isSelectable(r)?new ae(n):B.near(n)}}class ve extends B{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=P.empty){if(n==P.empty){e.delete(0,e.doc.content.size);let r=B.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new ve(e)}map(e){return new ve(e)}eq(e){return e instanceof ve}getBookmark(){return So}}B.jsonID("all",ve);const So={map(){return this},resolve(t){return new ve(t)}};function Pe(t,e,n,r,i,o=!1){if(e.inlineContent)return se.create(t,n);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let a=e.child(s);if(a.isAtom){if(!o&&ae.isSelectable(a))return ae.create(t,n-(i<0?a.nodeSize:0))}else{let l=Pe(t,a,n+i,i<0?a.childCount:0,i,o);if(l)return l}n+=a.nodeSize*i}return null}function xr(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof ye||i instanceof je))return;let o=t.mapping.maps[r],s;o.forEach((a,l,d,u)=>{s==null&&(s=u)}),t.setSelection(B.near(t.doc.resolve(s),n))}function yr(t,e){return!e||!t?t:t.bind(e)}class st{constructor(e,n,r){this.name=e,this.init=yr(n.init,r),this.apply=yr(n.apply,r)}}new st("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new st("selection",{init(t,e){return t.selection||B.atStart(e.doc)},apply(t){return t.selection}}),new st("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new st("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}});function vr(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=vr(i,e,{})),n[r]=i}return n}class Er{constructor(e){this.spec=e,this.props={},e.props&&vr(e.props,this,this.props),this.key=e.key?e.key.key:Sr("plugin")}getState(e){return e[this.key]}}const Rt=Object.create(null);function Sr(t){return t in Rt?t+"$"+ ++Rt[t]:(Rt[t]=0,t+"$")}class qe{constructor(e="key"){this.key=Sr(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}for(var Te={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},at={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},No=typeof navigator<"u"&&/Mac/.test(navigator.platform),To=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Z=0;Z<10;Z++)Te[48+Z]=Te[96+Z]=String(Z);for(var Z=1;Z<=24;Z++)Te[Z+111]="F"+Z;for(var Z=65;Z<=90;Z++)Te[Z]=String.fromCharCode(Z+32),at[Z]=String.fromCharCode(Z);for(var It in Te)at.hasOwnProperty(It)||(at[It]=Te[It]);function ko(t){var e=No&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||To&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?at:Te)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const Co=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Ao=typeof navigator<"u"&&/Win/.test(navigator.platform);function Oo(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,o,s;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))o=!0;else if(/^mod$/i.test(l))Co?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),s&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function Ro(t){let e=Object.create(null);for(let n in t)e[Oo(n)]=t[n];return e}function Mt(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function Io(t){let e=Ro(t);return function(n,r){let i=ko(r),o,s=e[Mt(i,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[Mt(i,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Ao&&r.ctrlKey&&r.altKey)&&(o=Te[r.keyCode])&&o!=i){let a=e[Mt(o,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}var _t,Lt;if(typeof WeakMap<"u"){let t=new WeakMap;_t=e=>t.get(e),Lt=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;_t=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},Lt=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var Ee=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,i=e/this.width|0;let o=r+1,s=i+1;for(let a=1;o<this.width&&this.map[e+a]==n;a++)o++;for(let a=1;s<this.height&&this.map[e+this.width*a]==n;a++)s++;return{left:r,top:i,right:o,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:r,right:i,top:o,bottom:s}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[o*this.width+(n<0?r-1:i)]:(n<0?o==0:s==this.height)?null:this.map[r+this.width*(n<0?o-1:s)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:o}=this.findCell(t),{left:s,right:a,top:l,bottom:d}=this.findCell(e);return{left:Math.min(n,s),top:Math.min(i,l),right:Math.max(r,a),bottom:Math.max(o,d)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const o=r*this.width+i,s=this.map[o];n[s]||(n[s]=!0,!(i==t.left&&i&&this.map[o-1]==s||r==t.top&&r&&this.map[o-this.width]==s)&&e.push(s))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const o=i+n.child(r).nodeSize;if(r==t){let s=e+t*this.width;const a=(t+1)*this.width;for(;s<a&&this.map[s]<i;)s++;return s==a?o-1:this.map[s]}i=o}}static get(t){return _t(t)||Lt(t,Mo(t))}};function Mo(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=_o(t),n=t.childCount,r=[];let i=0,o=null;const s=[];for(let d=0,u=e*n;d<u;d++)r[d]=0;for(let d=0,u=0;d<n;d++){const f=t.child(d);u++;for(let b=0;;b++){for(;i<r.length&&r[i]!=0;)i++;if(b==f.childCount)break;const w=f.child(b),{colspan:p,rowspan:E,colwidth:y}=w.attrs;for(let S=0;S<E;S++){if(S+d>=n){(o||(o=[])).push({type:"overlong_rowspan",pos:u,n:E-S});break}const R=i+S*e;for(let v=0;v<p;v++){r[R+v]==0?r[R+v]=u:(o||(o=[])).push({type:"collision",row:d,pos:u,n:p-v});const x=y&&y[v];if(x){const N=(R+v)%e*2,C=s[N];C==null||C!=x&&s[N+1]==1?(s[N]=x,s[N+1]=1):C==x&&s[N+1]++}}}i+=p,u+=w.nodeSize}const h=(d+1)*e;let m=0;for(;i<h;)r[i++]==0&&m++;m&&(o||(o=[])).push({type:"missing",row:d,n:m}),u++}(e===0||n===0)&&(o||(o=[])).push({type:"zero_sized"});const a=new Ee(e,n,r,o);let l=!1;for(let d=0;!l&&d<s.length;d+=2)s[d]!=null&&s[d+1]<n&&(l=!0);return l&&Lo(a,s,t),a}function _o(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let o=0;if(n)for(let s=0;s<r;s++){const a=t.child(s);for(let l=0;l<a.childCount;l++){const d=a.child(l);s+d.attrs.rowspan>r&&(o+=d.attrs.colspan)}}for(let s=0;s<i.childCount;s++){const a=i.child(s);o+=a.attrs.colspan,a.attrs.rowspan>1&&(n=!0)}e==-1?e=o:e!=o&&(e=Math.max(e,o))}return e}function Lo(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const o=t.map[i];if(r[o])continue;r[o]=!0;const s=n.nodeAt(o);if(!s)throw new RangeError(`No cell with offset ${o} found`);let a=null;const l=s.attrs;for(let d=0;d<l.colspan;d++){const u=(i+d)%t.width,f=e[u*2];f!=null&&(!l.colwidth||l.colwidth[d]!=f)&&((a||(a=jo(l)))[d]=f)}a&&t.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:a})}}function jo(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function jt(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}new qe("selectingCells");function Po(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 Nr(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 Do(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=Po(e.$head)||zo(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function zo(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Tr(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function kr(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Cr(t,e,n){const r=t.node(-1),i=Ee.get(r),o=t.start(-1),s=i.nextCell(t.pos-o,e,n);return s==null?null:t.node(0).resolve(o+s)}function Ar(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}var ge=class Se extends B{constructor(e,n=e){const r=e.node(-1),i=Ee.get(r),o=e.start(-1),s=i.rectBetween(e.pos-o,n.pos-o),a=e.node(0),l=i.cellsInRect(s).filter(u=>u!=n.pos-o);l.unshift(n.pos-o);const d=l.map(u=>{const f=r.nodeAt(u);if(!f)throw RangeError(`No cell with offset ${u} found`);const h=o+u+1;return new gr(a.resolve(h),a.resolve(h+f.content.size))});super(d[0].$from,d[0].$to,d),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(Tr(r)&&Tr(i)&&kr(r,i)){const o=this.$anchorCell.node(-1)!=r.node(-1);return o&&this.isRowSelection()?Se.rowSelection(r,i):o&&this.isColSelection()?Se.colSelection(r,i):new Se(r,i)}return se.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=Ee.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),o={},s=[];for(let l=i.top;l<i.bottom;l++){const d=[];for(let u=l*n.width+i.left,f=i.left;f<i.right;f++,u++){const h=n.map[u];if(o[h])continue;o[h]=!0;const m=n.findCell(h);let b=e.nodeAt(h);if(!b)throw RangeError(`No cell with offset ${h} found`);const w=i.left-m.left,p=m.right-i.right;if(w>0||p>0){let E=b.attrs;if(w>0&&(E=Ar(E,0,w)),p>0&&(E=Ar(E,E.colspan-p,p)),m.left<i.left){if(b=b.type.createAndFill(E),!b)throw RangeError(`Could not create cell with attrs ${JSON.stringify(E)}`)}else b=b.type.create(E,b.content)}if(m.top<i.top||m.bottom>i.bottom){const E={...b.attrs,rowspan:Math.min(m.bottom,i.bottom)-Math.max(m.top,i.top)};m.top<i.top?b=b.type.createAndFill(E):b=b.type.create(E,b.content)}d.push(b)}s.push(e.child(l).copy(z.from(d)))}const a=this.isColSelection()&&this.isRowSelection()?e:s;return new P(z.from(a),1,1)}replace(e,n=P.empty){const r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){const{$from:a,$to:l}=i[s],d=e.mapping.slice(r);e.replace(d.map(a.pos),d.map(l.pos),s?P.empty:n)}const o=B.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);o&&e.setSelection(o)}replaceWith(e,n){this.replace(e,new P(z.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=Ee.get(n),i=this.$anchorCell.start(-1),o=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let s=0;s<o.length;s++)e(n.nodeAt(o[s]),i+o[s])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=Ee.get(r),o=e.start(-1),s=i.findCell(e.pos-o),a=i.findCell(n.pos-o),l=e.node(0);return s.top<=a.top?(s.top>0&&(e=l.resolve(o+i.map[s.left])),a.bottom<i.height&&(n=l.resolve(o+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(n=l.resolve(o+i.map[a.left])),s.bottom<i.height&&(e=l.resolve(o+i.map[i.width*(i.height-1)+s.right-1]))),new Se(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=Ee.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),o=n.colCount(this.$headCell.pos-r);if(Math.min(i,o)>0)return!1;const s=i+this.$anchorCell.nodeAfter.attrs.colspan,a=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,a)==n.width}eq(e){return e instanceof Se&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=Ee.get(r),o=e.start(-1),s=i.findCell(e.pos-o),a=i.findCell(n.pos-o),l=e.node(0);return s.left<=a.left?(s.left>0&&(e=l.resolve(o+i.map[s.top*i.width])),a.right<i.width&&(n=l.resolve(o+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(n=l.resolve(o+i.map[a.top*i.width])),s.right<i.width&&(e=l.resolve(o+i.map[i.width*(s.top+1)-1]))),new Se(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Se(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Se(e.resolve(n),e.resolve(r))}getBookmark(){return new Bo(this.$anchorCell.pos,this.$headCell.pos)}};ge.prototype.visible=!1,B.jsonID("cell",ge);var Bo=class Lr{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Lr(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&kr(n,r)?new ge(n,r):B.near(r,1)}};new qe("fix-tables");function Or(t){const e=t.selection,n=Do(t),r=n.node(-1),i=n.start(-1),o=Ee.get(r);return{...e instanceof ge?o.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):o.findCell(n.pos-i),tableStart:i,map:o,table:r}}function Uo(t){return function(e,n){if(!Nr(e))return!1;if(n){const r=jt(e.schema),i=Or(e),o=e.tr,s=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=s.map(l=>i.table.nodeAt(l));for(let l=0;l<s.length;l++)a[l].type==r.header_cell&&o.setNodeMarkup(i.tableStart+s[l],r.cell,a[l].attrs);if(o.steps.length==0)for(let l=0;l<s.length;l++)o.setNodeMarkup(i.tableStart+s[l],r.header_cell,a[l].attrs);n(o)}return!0}}function Rr(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const o=e.table.nodeAt(r[i]);if(o&&o.type!==n.header_cell)return!1}return!0}function Pt(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?Uo(t):function(n,r){if(!Nr(n))return!1;if(r){const i=jt(n.schema),o=Or(n),s=n.tr,a=Rr("row",o,i),l=Rr("column",o,i),u=(t==="column"?a:t==="row"?l:!1)?1:0,f=t=="column"?{left:0,top:u,right:1,bottom:o.map.height}:t=="row"?{left:u,top:0,right:o.map.width,bottom:1}:o,h=t=="column"?l?i.cell:i.header_cell:t=="row"?a?i.cell:i.header_cell:i.cell;o.map.cellsInRect(f).forEach(m=>{const b=m+o.tableStart,w=s.doc.nodeAt(b);w&&s.setNodeMarkup(b,h,w.attrs)}),r(s)}return!0}}Pt("row",{useDeprecatedLogic:!0}),Pt("column",{useDeprecatedLogic:!0}),Pt("cell",{useDeprecatedLogic:!0});function lt(t,e){const n=t.selection;if(!(n instanceof ge))return!1;if(e){const r=t.tr,i=jt(t.schema).cell.createAndFill().content;n.forEachCell((o,s)=>{o.content.eq(i)||r.replace(r.mapping.map(s+1),r.mapping.map(s+o.nodeSize-1),new P(i,0,0))}),r.docChanged&&e(r)}return!0}Io({ArrowLeft:dt("horiz",-1),ArrowRight:dt("horiz",1),ArrowUp:dt("vert",-1),ArrowDown:dt("vert",1),"Shift-ArrowLeft":ut("horiz",-1),"Shift-ArrowRight":ut("horiz",1),"Shift-ArrowUp":ut("vert",-1),"Shift-ArrowDown":ut("vert",1),Backspace:lt,"Mod-Backspace":lt,Delete:lt,"Mod-Delete":lt});function ct(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function dt(t,e){return(n,r,i)=>{if(!i)return!1;const o=n.selection;if(o instanceof ge)return ct(n,r,B.near(o.$headCell,e));if(t!="horiz"&&!o.empty)return!1;const s=Ir(i,t,e);if(s==null)return!1;if(t=="horiz")return ct(n,r,B.near(n.doc.resolve(o.head+e),e));{const a=n.doc.resolve(s),l=Cr(a,t,e);let d;return l?d=B.near(l,1):e<0?d=B.near(n.doc.resolve(a.before(-1)),-1):d=B.near(n.doc.resolve(a.after(-1)),1),ct(n,r,d)}}}function ut(t,e){return(n,r,i)=>{if(!i)return!1;const o=n.selection;let s;if(o instanceof ge)s=o;else{const l=Ir(i,t,e);if(l==null)return!1;s=new ge(n.doc.resolve(l))}const a=Cr(s.$headCell,t,e);return a?ct(n,r,new ge(s.$anchorCell,a)):!1}}function Ir(t,e,n){if(!(t.state.selection instanceof se))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const o=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){const a=r.before(i),l=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(l)?a:null}}return null}new qe("tableColumnResizing");function Ho(t,e){const n=Math.min(t.top,e.top),r=Math.max(t.bottom,e.bottom),i=Math.min(t.left,e.left),s=Math.max(t.right,e.right)-i,a=r-n,l=i,d=n;return new DOMRect(l,d,s,a)}var Fo=class{constructor({editor:t,element:e,view:n,updateDelay:r=250,resizeDelay:i=60,shouldShow:o,appendTo:s,options:a}){this.preventHide=!1,this.isVisible=!1,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:l,state:d,from:u,to:f})=>{const{doc:h,selection:m}=d,{empty:b}=m,w=!h.textBetween(u,f).length&&V.isTextSelection(d.selection),p=this.element.contains(document.activeElement);return!(!(l.hasFocus()||p)||b||w||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:l})=>{var d;if(this.preventHide){this.preventHide=!1;return}l?.relatedTarget&&((d=this.element.parentNode)!=null&&d.contains(l.relatedTarget))||l?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(l,d)=>{const u=!d?.selection.eq(l.state.selection),f=!d?.doc.eq(l.state.doc);!u&&!f||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(l,u,f,d)},this.updateDelay))},this.updateHandler=(l,d,u,f)=>{const{composing:h}=l;if(h||!d&&!u)return;if(!this.getShouldShow(f)){this.hide();return}this.updatePosition(),this.show()},this.editor=t,this.element=e,this.view=n,this.updateDelay=r,this.resizeDelay=i,this.appendTo=s,this.floatingUIOptions={...this.floatingUIOptions,...a},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),window.addEventListener("resize",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&this.show()}get middlewares(){const t=[];return this.floatingUIOptions.flip&&t.push(Qn(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&t.push(Xn(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&t.push(Yn(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&t.push(nr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&t.push(er(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&t.push(Zn(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&t.push(tr(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&t.push(rr(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),t}updatePosition(){const{selection:t}=this.editor.state,e=V.posToDOMRect(this.view,t.from,t.to);let n={getBoundingClientRect:()=>e,getClientRects:()=>[e]};if(t instanceof ae){let r=this.view.nodeDOM(t.from);const i=r.dataset.nodeViewWrapper?r:r.querySelector("[data-node-view-wrapper]");i&&(r=i),r&&(n={getBoundingClientRect:()=>r.getBoundingClientRect(),getClientRects:()=>[r.getBoundingClientRect()]})}if(t instanceof ge){const{$anchorCell:r,$headCell:i}=t,o=r?r.pos:i.pos,s=i?i.pos:r.pos,a=this.view.nodeDOM(o),l=this.view.nodeDOM(s);if(!a||!l)return;const d=a===l?a.getBoundingClientRect():Ho(a.getBoundingClientRect(),l.getBoundingClientRect());n={getBoundingClientRect:()=>d,getClientRects:()=>[d]}}ir(n,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:r,y:i,strategy:o})=>{this.element.style.width="max-content",this.element.style.position=o,this.element.style.left=`${r}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(t,e){const{state:n}=t,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(t,e);return}const i=!e?.selection.eq(t.state.selection),o=!e?.doc.eq(t.state.doc);this.updateHandler(t,i,o,e)}getShouldShow(t){var e;const{state:n}=this.view,{selection:r}=n,{ranges:i}=r,o=Math.min(...i.map(l=>l.$from.pos)),s=Math.max(...i.map(l=>l.$to.pos));return(e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,element:this.element,view:this.view,state:n,oldState:t,from:o,to:s})}show(){var t,e;this.isVisible||(this.element.style.visibility="visible",this.element.style.opacity="1",(e=(t=this.appendTo)!=null?t:this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Mr=t=>new Er({key:typeof t.pluginKey=="string"?new qe(t.pluginKey):t.pluginKey,view:e=>new Fo({view:e,...t})});V.Extension.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Mr({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});var $o=class{constructor({editor:t,element:e,view:n,options:r,shouldShow:i}){this.preventHide=!1,this.isVisible=!1,this.shouldShow=({view:o,state:s})=>{const{selection:a}=s,{$anchor:l,empty:d}=a,u=l.depth===1,f=l.parent.isTextblock&&!l.parent.type.spec.code&&!l.parent.textContent&&l.parent.childCount===0&&!this.getTextContent(l.parent);return!(!o.hasFocus()||!d||!u||!f||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(o,s,a,l)=>{const{composing:d}=o;if(d||!s&&!a)return;if(!this.getShouldShow(l)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:o})=>{var s;if(this.preventHide){this.preventHide=!1;return}o?.relatedTarget&&((s=this.element.parentNode)!=null&&s.contains(o.relatedTarget))||o?.relatedTarget!==this.editor.view.dom&&this.hide()},this.editor=t,this.element=e,this.view=n,this.floatingUIOptions={...this.floatingUIOptions,...r},this.element.tabIndex=0,i&&(this.shouldShow=i),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.update(n,n.state),this.getShouldShow()&&this.show()}getTextContent(t){return V.getText(t,{textSerializers:V.getTextSerializersFromSchema(this.editor.schema)})}get middlewares(){const t=[];return this.floatingUIOptions.flip&&t.push(Qn(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&t.push(Xn(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&t.push(Yn(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&t.push(nr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&t.push(er(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&t.push(Zn(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&t.push(tr(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&t.push(rr(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),t}getShouldShow(t){var e;const{state:n}=this.view,{selection:r}=n,{ranges:i}=r,o=Math.min(...i.map(l=>l.$from.pos)),s=Math.max(...i.map(l=>l.$to.pos));return(e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,view:this.view,state:n,oldState:t,from:o,to:s})}updatePosition(){const{selection:t}=this.editor.state,e=V.posToDOMRect(this.view,t.from,t.to);ir({getBoundingClientRect:()=>e,getClientRects:()=>[e]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:r,y:i,strategy:o})=>{this.element.style.width="max-content",this.element.style.position=o,this.element.style.left=`${r}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(t,e){const n=!e?.selection.eq(t.state.selection),r=!e?.doc.eq(t.state.doc);this.updateHandler(t,n,r,e)}show(){var t;this.isVisible||(this.element.style.visibility="visible",this.element.style.opacity="1",(t=this.view.dom.parentElement)==null||t.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},_r=t=>new Er({key:typeof t.pluginKey=="string"?new qe(t.pluginKey):t.pluginKey,view:e=>new $o({view:e,...t})});V.Extension.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[_r({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,options:this.options.options,shouldShow:this.options.shouldShow})]:[]}});var Jo=k.forwardRef(({pluginKey:t="bubbleMenu",editor:e,updateDelay:n,resizeDelay:r,shouldShow:i=null,options:o,children:s,...a},l)=>{const d=k.useRef(document.createElement("div"));typeof l=="function"?l(d.current):l&&(l.current=d.current);const{editor:u}=G.useCurrentEditor();return k.useEffect(()=>{const f=d.current;if(f.style.visibility="hidden",f.style.position="absolute",e?.isDestroyed||u?.isDestroyed)return;const h=e||u;if(!h){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const m=Mr({updateDelay:n,resizeDelay:r,editor:h,element:f,pluginKey:t,shouldShow:i,options:o});return h.registerPlugin(m),()=>{h.unregisterPlugin(t),window.requestAnimationFrame(()=>{f.parentNode&&f.parentNode.removeChild(f)})}},[e,u]),Jt.createPortal(c.jsx("div",{...a,children:s}),d.current)}),Vo=k.forwardRef(({pluginKey:t="floatingMenu",editor:e,shouldShow:n=null,options:r,children:i,...o},s)=>{const a=k.useRef(document.createElement("div"));typeof s=="function"?s(a.current):s&&(s.current=a.current);const{editor:l}=G.useCurrentEditor();return k.useEffect(()=>{const d=a.current;if(d.style.visibility="hidden",d.style.position="absolute",e?.isDestroyed||l?.isDestroyed)return;const u=e||l;if(!u){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const f=_r({editor:u,element:d,pluginKey:t,shouldShow:n,options:r});return u.registerPlugin(f),()=>{u.unregisterPlugin(t),window.requestAnimationFrame(()=>{d.parentNode&&d.parentNode.removeChild(d)})}},[e,l]),Jt.createPortal(c.jsx("div",{...o,children:i}),a.current)});const qo=({editor:t,isReadOnly:e})=>{const[n,r]=k.useState(!1),[i,o]=k.useState(!1),[s,a]=k.useState(""),[l,d]=k.useState(!1),u=()=>{s&&(t.chain().focus().extendMarkRange("link").setLink({href:s}).run(),a(""),d(!1))};return e?null:c.jsx(Jo,{editor:t,className:"bubble-menu bg-white border border-gray-300 rounded-lg p-2 shadow-lg z-50",children:c.jsxs("div",{className:"flex gap-1 items-center",children:[c.jsx(_,{onClick:()=>t.chain().focus().toggleBold().run(),isActive:t.isActive("bold"),title:"Bold",children:c.jsx(O.Bold,{className:"h-4 w-4 cursor-pointer"})}),c.jsx(_,{onClick:()=>t.chain().focus().toggleItalic().run(),isActive:t.isActive("italic"),title:"Italic",children:c.jsx(O.Italic,{className:"h-4 w-4 cursor-pointer"})}),c.jsx(_,{onClick:()=>t.chain().focus().toggleUnderline().run(),isActive:t.isActive("underline"),title:"Underline",children:c.jsx(O.Underline,{className:"h-4 w-4 cursor-pointer"})}),c.jsx(_,{onClick:()=>t.chain().focus().toggleStrike().run(),isActive:t.isActive("strike"),title:"Strikethrough",children:c.jsx(O.Strikethrough,{className:"h-4 w-4 cursor-pointer"})}),c.jsx(_,{onClick:()=>t.chain().focus().toggleCode().run(),isActive:t.isActive("code"),title:"Inline Code",children:c.jsx(O.Code,{className:"h-4 w-4 cursor-pointer"})}),c.jsxs("div",{className:"relative",children:[c.jsx(_,{onClick:()=>r(!n),title:"Text Color",children:c.jsx(O.Type,{className:"h-4 w-4 cursor-pointer"})}),n&&c.jsx("div",{className:"absolute top-full mt-1 z-10 bg-white border border-gray-300 rounded-lg p-2 shadow-lg",children:c.jsx(Tn,{onColorChange:f=>{t.chain().focus().setColor(f).run(),r(!1)}})})]}),c.jsxs("div",{className:"relative",children:[c.jsx(_,{onClick:()=>o(!i),title:"Background Color",children:c.jsx(O.Palette,{className:"h-4 w-4 cursor-pointer"})}),i&&c.jsx("div",{className:"absolute top-full mt-1 z-10 bg-white border border-gray-300 rounded-lg p-2 shadow-lg",children:c.jsx(Tn,{onColorChange:f=>{t.chain().focus().toggleHighlight({color:f}).run(),o(!1)}})})]}),c.jsxs("div",{className:"relative",children:[c.jsx(_,{onClick:()=>d(!l),isActive:t.isActive("link"),title:"Add/Edit Link",children:c.jsx(O.Link,{className:"h-4 w-4 cursor-pointer"})}),l&&c.jsx("div",{className:"absolute top-full mt-1 z-10 bg-white border border-gray-300 rounded-lg p-2 shadow-lg",children:c.jsxs("div",{className:"flex gap-2",children:[c.jsx("input",{type:"url",placeholder:"Enter URL...",value:s,onChange:f=>a(f.target.value),className:"px-2 py-1 text-sm border border-gray-300 rounded",onKeyDown:f=>{f.key==="Enter"&&u()}}),c.jsx(ee,{onClick:u,size:"sm",className:"h-8 cursor-pointer",children:"Set"})]})})]})]})})},Wo=({editor:t,isReadOnly:e,onImageClick:n})=>e?null:c.jsxs(Vo,{editor:t,className:"floating-menu bg-white border border-gray-300 rounded-lg p-2 shadow-lg flex gap-1 z-50",children:[c.jsx(_,{onClick:()=>t.chain().focus().toggleHeading({level:1}).run(),title:"Heading 1",children:c.jsx(O.Heading1,{className:"h-4 w-4"})}),c.jsx(_,{onClick:()=>t.chain().focus().toggleHeading({level:2}).run(),title:"Heading 2",children:c.jsx(O.Heading2,{className:"h-4 w-4"})}),c.jsx(_,{onClick:()=>t.chain().focus().toggleHeading({level:3}).run(),title:"Heading 3",children:c.jsx(O.Heading3,{className:"h-4 w-4"})}),c.jsx(_,{onClick:()=>t.chain().focus().setParagraph().run(),title:"Paragraph",children:c.jsx(O.FileText,{className:"h-4 w-4"})}),c.jsx(_,{onClick:n,title:"Insert Image",children:c.jsx(O.Image,{className:"h-4 w-4"})})]}),Ko=({editor:t,isReadOnly:e,position:n})=>!n.show||e?null:c.jsxs("div",{className:"table-bubble-menu bg-white border-2 border-blue-500 rounded-lg p-2 shadow-lg",style:{position:"absolute",top:`${n.top}px`,left:`${n.left}px`,zIndex:50,backdropFilter:"blur(8px)",background:"rgba(255, 255, 255, 0.95)"},children:[c.jsxs("div",{className:"flex gap-1 items-center",children:[c.jsx(_,{onClick:()=>t.chain().focus().addRowBefore().run(),title:"Add Row Before",className:"h-8 w-auto px-2",children:c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(O.Plus,{className:"h-3 w-3"}),c.jsx("span",{className:"text-xs",children:"↑ Row"})]})}),c.jsx(_,{onClick:()=>t.chain().focus().addRowAfter().run(),title:"Add Row After",className:"h-8 w-auto px-2",children:c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(O.Plus,{className:"h-3 w-3"}),c.jsx("span",{className:"text-xs",children:"Row ↓"})]})}),c.jsx("div",{className:"h-6 w-px bg-gray-300 mx-1"}),c.jsx(_,{onClick:()=>t.chain().focus().addColumnBefore().run(),title:"Add Column Before",className:"h-8 w-auto px-2",children:c.jsxs("div",{className:"flex items-center gap-1",children:["ß",c.jsx(O.Plus,{className:"h-3 w-3"}),c.jsx("span",{className:"text-xs",children:"← Col"})]})}),c.jsx(_,{onClick:()=>t.chain().focus().addColumnAfter().run(),title:"Add Column After",className:"h-8 w-auto px-2",children:c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(O.Plus,{className:"h-3 w-3"}),c.jsx("span",{className:"text-xs",children:"Col →"})]})}),c.jsx("div",{className:"h-6 w-px bg-gray-300 mx-1"}),c.jsx(_,{onClick:()=>t.chain().focus().deleteColumn().run(),title:"Delete Column",className:"text-red-600 hover:bg-red-50 h-8 w-auto px-2",children:c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(O.Minus,{className:"h-3 w-3"}),c.jsx("span",{className:"text-xs",children:"Col"})]})}),c.jsx("div",{className:"h-6 w-px bg-gray-300 mx-1"}),c.jsx(_,{onClick:()=>t.chain().focus().deleteRow().run(),title:"Delete Row",className:"text-red-600 hover:bg-red-50 h-8 w-auto px-2",children:c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(O.Minus,{className:"h-3 w-3"}),c.jsx("span",{className:"text-xs",children:"Row"})]})}),c.jsx(_,{onClick:()=>t.chain().focus().deleteTable().run(),title:"Delete Table",className:"text-red-600 hover:bg-red-50",children:c.jsx(O.Trash2,{className:"h-4 w-4"})})]}),c.jsx("div",{className:"absolute top-full left-5 w-0 h-0 border-l-6 border-r-6 border-t-6 border-l-transparent border-r-transparent border-t-blue-500"})]}),Go=({editor:t})=>c.jsxs("div",{className:"mb-2 p-2 bg-gray-100 rounded text-xs",children:[c.jsx("strong",{children:"Debug:"})," Current position - H1:"," ",t.isActive("heading",{level:1})?"✅":"❌"," | H2:"," ",t.isActive("heading",{level:2})?"✅":"❌"," | H3:"," ",t.isActive("heading",{level:3})?"✅":"❌"," | P:"," ",t.isActive("paragraph")?"✅":"❌"," | Bold:"," ",t.isActive("bold")?"✅":"❌"," | List:"," ",t.isActive("bulletList")?"✅":"❌"," | Table:"," ",t.isActive("table")?"✅":"❌"]}),Yo=({isReadOnly:t,setIsReadOnly:e,onLogContent:n})=>c.jsxs("div",{className:"mb-4 flex justify-end gap-2",children:[c.jsxs(ee,{onClick:n,variant:"outline",size:"sm",className:"flex items-center gap-2",title:"Log content to console for backend storage",children:[c.jsx(O.Terminal,{className:"h-4 w-4"}),"Log Content"]}),c.jsx(ee,{onClick:()=>e(!t),variant:t?"default":"outline",size:"sm",className:"flex items-center gap-2",children:t?c.jsxs(c.Fragment,{children:[c.jsx(O.Lock,{className:"h-4 w-4"}),"Read Only"]}):c.jsxs(c.Fragment,{children:[c.jsx(O.LockOpen,{className:"h-4 w-4"}),"Editable"]})})]}),Zo=t=>{const e={html:t.getHTML(),json:t.getJSON(),text:t.getText(),isEmpty:t.isEmpty,characterCount:t.storage.characterCount?.characters()||t.getText().length,wordCount:t.storage.characterCount?.words()||t.getText().split(/\s+/).filter(n=>n.length>0).length,timestamp:new Date().toISOString()};return console.log("📄 Tiptap Editor Content for Backend Storage:"),console.log("================================================"),console.log("📋 HTML Output (for rendering):",e.html),console.log("📋 JSON Output (for editing):",e.json),console.log("📋 Plain Text:",e.text),console.log("📊 Stats:",{isEmpty:e.isEmpty,characters:e.characterCount,words:e.wordCount,timestamp:e.timestamp}),console.log("================================================"),e},Xo=({onImageUpload:t,onVideoUpload:e,setEditorContent:n})=>{const[r,i]=k.useState(""),[o,s]=k.useState(!1),[,a]=k.useState({}),[l,d]=k.useState(!1),[u,f]=k.useState(!1),[h,m]=k.useState(!1),[b,w]=k.useState({top:0,left:0,show:!1}),p=G.useEditor({extensions:[Kt,Gt,Ut,Ft,Ht,Yt,Zt,pn,mn,Xt,Qt,en,hn,gn,bn,wn,xn,yn,vn,En,Sn.configure({inline:!1,allowBase64:!0,HTMLAttributes:{class:"max-w-full h-auto rounded-lg shadow-sm"}})],content:`
|
|
22
|
+
<%s key={someKey} {...props} />`,$,Q,De,Q),H[Q+$]=!0)}if(Q=null,D!==void 0&&(n(D),Q=""+D),s(A)&&(n(A.key),Q=""+A.key),"key"in A){D={};for(var Bt in A)Bt!=="key"&&(D[Bt]=A[Bt])}else D=A;return Q&&a(D,typeof g=="function"?g.displayName||g.name||"Unknown":g),d(g,Q,be,ke,i(),D,Dt,zt)}function f(g){typeof g=="object"&&g!==null&&g.$$typeof===m&&g._store&&(g._store.validated=1)}var h=k,m=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),y=Symbol.for("react.consumer"),S=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),x=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),T=Symbol.for("react.client.reference"),L=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=Object.prototype.hasOwnProperty,W=Array.isArray,U=console.createTask?console.createTask:function(){return null};h={react_stack_bottom_frame:function(g){return g()}};var Y,J={},K=h.react_stack_bottom_frame.bind(h,o)(),I=U(r(o)),H={};Be.Fragment=w,Be.jsx=function(g,A,D,$,ke){var be=1e4>L.recentlyCreatedOwnerStacks++;return u(g,A,D,!1,$,ke,be?Error("react-stack-top-frame"):K,be?U(r(g)):I)},Be.jsxs=function(g,A,D,$,ke){var be=1e4>L.recentlyCreatedOwnerStacks++;return u(g,A,D,!0,$,ke,be?Error("react-stack-top-frame"):K,be?U(r(g)):I)}})()),Be}var Wt;function ei(){return Wt||(Wt=1,process.env.NODE_ENV==="production"?We.exports=Xr():We.exports=Qr()),We.exports}var c=ei();const Kt=jr.configure({codeBlock:!1}),Gt=Pr.Table.configure({resizable:!0}),Yt=Dr.configure({inline:!1,allowBase64:!1,HTMLAttributes:{class:"max-w-full h-auto rounded-lg shadow-sm"}}),Zt=zr.configure({openOnClick:!1,autolink:!0,defaultProtocol:"https"}),Xt=Br.TextStyle,Qt=Ur.configure({types:["textStyle"]}),en=Hr.configure({multicolor:!0}),ti=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),ni=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],ri=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],ii=[...ni,...ri],oi=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),si=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),ai=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),li=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function ci(t){const e=t.regex,n=ti(t),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",o=/@-?\w[\w]*(-\w+)*/,s="[a-zA-Z-][a-zA-Z0-9_-]*",a=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+s,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+si.join("|")+")"},{begin:":(:)?("+ai.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+li.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...a,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:e.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:o},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:oi.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+ii.join("|")+")\\b"}]}}const tn="[A-Za-z$_][0-9A-Za-z$_]*",di=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],ui=["true","false","null","undefined","NaN","Infinity"],nn=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],rn=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],on=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],fi=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],hi=[].concat(on,nn,rn);function pi(t){const e=t.regex,n=(I,{after:H})=>{const g="</"+I[0].slice(1);return I.input.indexOf(g,H)!==-1},r=tn,i={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(I,H)=>{const g=I[0].length+I.index,A=I.input[g];if(A==="<"||A===","){H.ignoreMatch();return}A===">"&&(n(I,{after:g})||H.ignoreMatch());let D;const $=I.input.substring(g);if(D=$.match(/^\s*=/)){H.ignoreMatch();return}if((D=$.match(/^\s+extends\s+/))&&D.index===0){H.ignoreMatch();return}}},a={$pattern:tn,keyword:di,literal:ui,built_in:hi,"variable.language":fi},l="[0-9](_?[0-9])*",d=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${u})((${d})|\\.)?|(${d}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${d})\\b|\\.)?|(${d})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},m={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},b={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"css"}},w={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},p={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,h]},y={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},S=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,m,b,w,p,{match:/\$\d+/},f];h.contains=S.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(S)});const R=[].concat(y,h.contains),v=R.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(R)}]),x={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:v},N={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},C={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...nn,...rn]}},M={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[x],illegal:/%/},L={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function F(I){return e.concat("(?!",I.join("|"),")")}const W={match:e.concat(/\b/,F([...on,"super","import"].map(I=>`${I}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},U={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},Y={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},x]},J="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",K={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(J)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[x]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:v,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),M,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,m,b,w,p,y,{match:/\$\d+/},f,C,{scope:"attr",match:r+e.lookahead(":"),relevance:0},K,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[y,t.REGEXP_MODE,{className:"function",begin:J,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:v}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:o},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},T,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[x,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},U,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[x]},W,L,N,Y,{match:/\$[(.]/}]}}const Ke="[A-Za-z$_][0-9A-Za-z$_]*",sn=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],an=["true","false","null","undefined","NaN","Infinity"],ln=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],cn=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],dn=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],un=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],fn=[].concat(dn,ln,cn);function mi(t){const e=t.regex,n=(I,{after:H})=>{const g="</"+I[0].slice(1);return I.input.indexOf(g,H)!==-1},r=Ke,i={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(I,H)=>{const g=I[0].length+I.index,A=I.input[g];if(A==="<"||A===","){H.ignoreMatch();return}A===">"&&(n(I,{after:g})||H.ignoreMatch());let D;const $=I.input.substring(g);if(D=$.match(/^\s*=/)){H.ignoreMatch();return}if((D=$.match(/^\s+extends\s+/))&&D.index===0){H.ignoreMatch();return}}},a={$pattern:Ke,keyword:sn,literal:an,built_in:fn,"variable.language":un},l="[0-9](_?[0-9])*",d=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${u})((${d})|\\.)?|(${d}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${d})\\b|\\.)?|(${d})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},m={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},b={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"css"}},w={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},p={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,h]},y={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},S=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,m,b,w,p,{match:/\$\d+/},f];h.contains=S.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(S)});const R=[].concat(y,h.contains),v=R.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(R)}]),x={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:v},N={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},C={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...ln,...cn]}},M={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[x],illegal:/%/},L={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function F(I){return e.concat("(?!",I.join("|"),")")}const W={match:e.concat(/\b/,F([...dn,"super","import"].map(I=>`${I}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},U={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},Y={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},x]},J="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",K={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(J)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[x]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:v,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),M,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,m,b,w,p,y,{match:/\$\d+/},f,C,{scope:"attr",match:r+e.lookahead(":"),relevance:0},K,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[y,t.REGEXP_MODE,{className:"function",begin:J,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:v}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:o},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},T,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[x,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},U,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[x]},W,L,N,Y,{match:/\$[(.]/}]}}function gi(t){const e=t.regex,n=mi(t),r=Ke,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],o={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},s={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[n.exports.CLASS_REFERENCE]},a={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],d={$pattern:Ke,keyword:sn.concat(l),literal:an,built_in:fn.concat(i),"variable.language":un},u={className:"meta",begin:"@"+r},f=(w,p,E)=>{const y=w.contains.findIndex(S=>S.label===p);if(y===-1)throw new Error("can not find mode to replace");w.contains.splice(y,1,E)};Object.assign(n.keywords,d),n.exports.PARAMS_CONTAINS.push(u);const h=n.contains.find(w=>w.scope==="attr"),m=Object.assign({},h,{match:e.concat(r,e.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,h,m]),n.contains=n.contains.concat([u,o,s,m]),f(n,"shebang",t.SHEBANG()),f(n,"use_strict",a);const b=n.contains.find(w=>w.label==="func.def");return b.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function bi(t){const e=t.regex,n=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},o={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},s=t.inherit(o,{begin:/\(/,end:/\)/}),a=t.inherit(t.APOS_STRING_MODE,{className:"string"}),l=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),d={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[o,l,a,s,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[o,s,l,a]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[d],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[d],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(/</,e.lookahead(e.concat(n,e.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:d}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}const Ue=$t.createLowlight($t.all);Ue.register("html",bi),Ue.register("css",ci),Ue.register("js",pi),Ue.register("ts",gi);const hn=Fr.configure({lowlight:Ue}),pn=$r,mn=Jr,gn=Vr,bn=qr;function wi({node:t,updateAttributes:e,editor:n}){const[r,i]=k.useState(t.attrs?.open??!0),[o,s]=k.useState(!1),[a,l]=k.useState(t.attrs?.title||"Accordion Title"),d=k.useRef(null),u=n?.isEditable??!1;k.useEffect(()=>{o&&d.current&&(d.current.focus(),d.current.select())},[o]);const f=()=>{s(!1),e({title:a,open:r})},h=w=>{w.key==="Enter"?f():w.key==="Escape"&&(l(t.attrs?.title||"Accordion Title"),s(!1))},m=()=>{const w=!r;i(w),e({title:a,open:w})},b=()=>{u&&n&&confirm("Are you sure you want to delete this accordion?")&&n.chain().focus().deleteNode("accordion").run()};return c.jsxs(G.NodeViewWrapper,{className:"accordion border border-gray-200 rounded-lg mb-3 overflow-hidden",children:[c.jsx("div",{className:"accordion-header bg-gray-50 border-b border-gray-200",onClick:m,children:c.jsxs("div",{className:"flex items-center gap-2 px-1",children:[c.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),m()},className:"flex items-center justify-center w-6 h-6 text-gray-600 hover:text-gray-800",title:r?"Collapse":"Expand",children:c.jsx("span",{className:`cursor-pointer transition-transform duration-200 ${r?"rotate-90":""}`,children:"▶"})}),o?c.jsx("input",{ref:d,type:"text",value:a,onChange:w=>l(w.target.value),onBlur:f,onKeyDown:h,className:"bg-transparent border-b border-gray-300 outline-none font-medium text-gray-800 flex-1 py-1",placeholder:"Enter accordion title..."}):c.jsx("div",{onClick:u?w=>{w.stopPropagation(),s(!0)}:void 0,className:`font-medium text-gray-800 flex-1 py-1 ${u?"cursor-text hover:text-blue-600":"cursor-pointer"}`,title:u?"Click to edit title":void 0,children:a}),u&&c.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),b()},className:"px-2 py-1 text-red-600 hover:text-red-700 hover:bg-red-50 transition-colors rounded",title:"Delete accordion",children:c.jsx(O.Trash2,{className:"h-4 w-4"})})]})}),r&&c.jsx("div",{className:"accordion-content p-3 bg-white",children:c.jsx(G.NodeViewContent,{})})]})}const wn=V.Node.create({name:"accordion",group:"block",content:"accordionItem+",defining:!0,addAttributes(){return{title:{default:"Accordion Title",parseHTML:t=>t.getAttribute("data-title"),renderHTML:t=>t.title?{"data-title":t.title}:{}},open:{default:!0,parseHTML:t=>t.getAttribute("data-open")==="true",renderHTML:t=>({"data-open":t.open})}}},parseHTML(){return[{tag:'div[data-type="accordion"]'}]},renderHTML({HTMLAttributes:t}){return["div",V.mergeAttributes(t,{"data-type":"accordion"}),0]},addNodeView(){return G.ReactNodeViewRenderer(wi)},addCommands(){return{insertAccordion:()=>({commands:t})=>t.insertContent({type:this.name,content:[{type:"accordionItem",content:[{type:"paragraph",content:[{type:"text",text:"Accordion Item 1"}]}]}]})}}}),xn=V.Node.create({name:"accordionItem",group:"block",content:"block+",defining:!0,parseHTML(){return[{tag:'div[data-type="accordion-item"]'}]},renderHTML({HTMLAttributes:t}){return["div",V.mergeAttributes(t,{"data-type":"accordion-item"}),0]}});function xi({node:t,updateAttributes:e,editor:n}){const[r,i]=k.useState(t.attrs?.activeTab??0),[o,s]=k.useState(null),[a,l]=k.useState(""),d=k.useRef(null),u=t.content?.content||[],f=n?.isEditable??!1;k.useEffect(()=>{o!==null&&d.current&&(d.current.focus(),d.current.select())},[o]);const h=y=>{i(y),e({...t.attrs,activeTab:y})},m=(y,S)=>{f&&(s(y),l(S))},b=()=>{f&&n&&confirm("Are you sure you want to delete this tabs component?")&&n.chain().focus().deleteNode("tabs").run()},w=()=>{if(o!==null&&u[o]){const y=u[o];y.attrs&&(y.attrs.title=a),e({...t.attrs})}s(null),l("")},p=y=>{y.key==="Enter"?w():y.key==="Escape"&&(s(null),l(""))},E=y=>u[y]?.attrs?.title||`Tab ${y+1}`;return c.jsxs(G.NodeViewWrapper,{className:"tabs-container border border-gray-200 rounded-lg mb-4 overflow-hidden","data-active-tab":r,children:[c.jsx("div",{className:"tabs-header bg-gray-50 border-b border-gray-200",children:c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("div",{className:"flex flex-1 overflow-x-auto",children:u.map((y,S)=>c.jsx("button",{type:"button",onClick:()=>h(S),className:`px-4 py-2 text-sm font-medium border-b-2 border-r border-gray-200 transition-colors relative lg:px-12 cursor-pointer ${r===S?"border-blue-500 border-r-gray-200 text-blue-600 bg-white":"border-transparent border-r-gray-200 text-gray-500 hover:text-gray-700 hover:border-gray-300"} ${S===u.length-1?"border-r-0":""}`,children:o===S?c.jsx("input",{ref:d,type:"text",value:a,onChange:R=>l(R.target.value),onBlur:w,onKeyDown:p,className:"bg-transparent border-none outline-none text-center min-w-16",onClick:R=>R.stopPropagation()}):c.jsx("span",{onClick:f?R=>{R.stopPropagation(),m(S,E(S))}:void 0,className:f?"cursor-text":"cursor-pointer",title:f?"Click to edit title":void 0,children:E(S)})},S))}),f&&c.jsx("button",{type:"button",onClick:b,className:"px-3 py-2 text-red-600 hover:text-red-700 hover:bg-red-50 transition-colors",title:"Delete tabs",children:c.jsx(O.Trash2,{className:"h-4 w-4"})})]})}),c.jsx("div",{className:"tabs-content",children:c.jsx(G.NodeViewContent,{className:"tab-content-wrapper","data-active-tab":r})})]})}function yi({node:t}){const e=t.attrs?.tabIndex||0;return c.jsx(G.NodeViewWrapper,{className:"tab-item-content p-4","data-tab-index":e,children:c.jsx(G.NodeViewContent,{})})}const yn=V.Node.create({name:"tabs",group:"block",content:"tabItem+",defining:!0,addAttributes(){return{activeTab:{default:0,parseHTML:t=>parseInt(t.getAttribute("data-active-tab")||"0"),renderHTML:t=>({"data-active-tab":t.activeTab})},tabCount:{default:2,parseHTML:t=>parseInt(t.getAttribute("data-tab-count")||"2"),renderHTML:t=>({"data-tab-count":t.tabCount})}}},parseHTML(){return[{tag:'div[data-type="tabs"]'}]},renderHTML({HTMLAttributes:t}){return["div",V.mergeAttributes(t,{"data-type":"tabs"}),0]},addNodeView(){return G.ReactNodeViewRenderer(xi)},addCommands(){return{insertTabs:(t={tabCount:2})=>({commands:e})=>{const n=Math.min(Math.max(t.tabCount||2,2),6),r=Array.from({length:n},(i,o)=>({type:"tabItem",attrs:{tabIndex:o,title:`Tab ${o+1}`},content:[{type:"paragraph",content:[{type:"text",text:`Content for Tab ${o+1}. This is unique content for this tab.`}]}]}));return e.insertContent({type:this.name,attrs:{activeTab:0,tabCount:n},content:r})}}}}),vn=V.Node.create({name:"tabItem",group:"block",content:"block+",defining:!0,addAttributes(){return{tabIndex:{default:0,parseHTML:t=>parseInt(t.getAttribute("data-tab-index")||"0"),renderHTML:t=>({"data-tab-index":t.tabIndex})},title:{default:"Tab",parseHTML:t=>t.getAttribute("data-title")||"Tab",renderHTML:t=>({"data-title":t.title})}}},parseHTML(){return[{tag:'div[data-type="tab-item"]'}]},renderHTML({HTMLAttributes:t}){return["div",V.mergeAttributes(t,{"data-type":"tab-item"}),0]},addNodeView(){return G.ReactNodeViewRenderer(yi)}});function vi(...t){return Yr.twMerge(Gr.clsx(t))}const Ei=Kr.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function ee({className:t,variant:e,size:n,asChild:r=!1,...i}){const o=r?Wr.Slot:"button";return c.jsx(o,{"data-slot":"button",className:vi(Ei({variant:e,size:n,className:t})),...i})}const Si=({node:t,updateAttributes:e,deleteNode:n,editor:r})=>{const[i,o]=k.useState(!1),[s,a]=k.useState("simple"),[l,d]=k.useState(""),[u,f]=k.useState({src:t.attrs.src||"",width:t.attrs.width||"100%",height:t.attrs.height||"500px",title:t.attrs.title||"",allow:t.attrs.allow||"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",sandbox:t.attrs.sandbox||"allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-presentation",style:t.attrs.style||""}),h=x=>{const N=x.toLowerCase();return N.includes("youtube.com")||N.includes("youtu.be")?"allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-presentation allow-popups-to-escape-sandbox":N.includes("codesandbox.io")||N.includes("stackblitz.com")?"allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-presentation allow-popups-to-escape-sandbox allow-top-navigation":"allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-presentation"},m=x=>{const N=h(x);f({...u,src:x,sandbox:N})},b=()=>{p&&(e(u),o(!1))},w=()=>{f({src:t.attrs.src||"",width:t.attrs.width||"100%",height:t.attrs.height||"500px",title:t.attrs.title||"",allow:t.attrs.allow||"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",sandbox:t.attrs.sandbox||"allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-presentation",style:t.attrs.style||""}),o(!1)},[p,E]=k.useState(r?.isEditable??!1);k.useEffect(()=>{if(r){const x=()=>{E(r.isEditable)};return x(),r.on("update",x),r.on("selectionUpdate",x),()=>{r.off("update",x),r.off("selectionUpdate",x)}}},[r]);const y=()=>{p&&o(!0)},S=()=>{const x=`<iframe src="${u.src}" style="width:${u.width}; height: ${u.height}; ${u.style}" title="${u.title}" allow="${u.allow}" sandbox="${u.sandbox}"></iframe>`;navigator.clipboard.writeText(x)},R=x=>{const M=new DOMParser().parseFromString(x,"text/html").querySelector("iframe");if(M){const T=M.getAttribute("src")||"",L={src:T,width:M.getAttribute("width")||"100%",height:M.getAttribute("height")||"500px",title:M.getAttribute("title")||"",allow:M.getAttribute("allow")||"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",sandbox:M.getAttribute("sandbox")||h(T),style:M.getAttribute("style")||""};return f(L),!0}return!1},v=()=>{R(l)?(a("simple"),d("")):alert("Invalid iframe HTML code. Please check your input.")};return i?c.jsx(G.NodeViewWrapper,{className:"iframe-extension-editing",children:c.jsxs("div",{className:"border-2 border-blue-500 rounded-lg p-4 bg-blue-50",children:[c.jsxs("div",{className:"flex gap-2 mb-4",children:[c.jsx(ee,{onClick:()=>a("simple"),size:"sm",variant:s==="simple"?"default":"outline",className:"flex-1",children:"Simple Mode"}),c.jsx(ee,{onClick:()=>a("advanced"),size:"sm",variant:s==="advanced"?"default":"outline",className:"flex-1",children:"Advanced Mode"})]}),s==="simple"?c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Source URL"}),c.jsx("input",{type:"url",value:u.src,onChange:x=>m(x.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"https://example.com/embed"}),c.jsx("div",{className:"text-xs text-gray-600 mt-1",children:"Sandbox attributes are automatically configured based on the URL for optimal compatibility."})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Width"}),c.jsx("input",{type:"text",value:u.width,onChange:x=>f({...u,width:x.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"100%"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Height"}),c.jsx("input",{type:"text",value:u.height,onChange:x=>f({...u,height:x.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"500px"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Title"}),c.jsx("input",{type:"text",value:u.title,onChange:x=>f({...u,title:x.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"Embedded Content"})]})]}):c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Paste your iframe HTML code"}),c.jsx("textarea",{value:l,onChange:x=>d(x.target.value),className:"w-full h-32 px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 font-mono text-sm",placeholder:'<iframe src="https://example.com/embed" style="width:100%; height:500px; border:0; border-radius:4px; overflow:hidden;" title="Example" allow="..." sandbox="..."></iframe>'})]}),c.jsx("div",{className:"text-xs text-gray-600",children:"Paste your complete iframe HTML code here. The extension will automatically extract the attributes."}),c.jsxs("div",{className:"border-t pt-3",children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Sandbox Attributes (Advanced)"}),c.jsx("input",{type:"text",value:u.sandbox,onChange:x=>f({...u,sandbox:x.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 font-mono text-xs",placeholder:"allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-presentation"}),c.jsx("div",{className:"text-xs text-gray-600 mt-1",children:"Override automatic sandbox configuration if needed. Common values: allow-scripts, allow-same-origin, allow-forms, allow-popups"})]})]}),c.jsxs("div",{className:"flex gap-2 mt-4",children:[s==="advanced"&&c.jsx(ee,{onClick:v,size:"sm",className:"bg-green-600 hover:bg-green-700",children:"Parse & Apply"}),c.jsx(ee,{onClick:b,size:"sm",className:"bg-blue-600 hover:bg-blue-700",children:"Save"}),c.jsx(ee,{onClick:w,size:"sm",variant:"outline",children:"Cancel"})]})]})}):c.jsx(G.NodeViewWrapper,{className:"iframe-extension",children:c.jsxs("div",{className:"relative group",children:[c.jsx("iframe",{src:t.attrs.src,width:t.attrs.width,height:t.attrs.height,title:t.attrs.title,allow:t.attrs.allow,sandbox:t.attrs.sandbox,style:{...Ni(t.attrs.style),width:t.attrs.width,height:t.attrs.height},className:"rounded-lg"}),p&&c.jsx("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity duration-200 bg-white/90 backdrop-blur-sm rounded-lg p-1 shadow-lg border",children:c.jsxs("div",{className:"flex gap-1",children:[c.jsx(ee,{onClick:y,size:"sm",variant:"ghost",className:"h-8 w-8 p-0",title:"Edit iframe",children:c.jsx(O.Settings,{className:"h-4 w-4"})}),c.jsx(ee,{onClick:()=>window.open(t.attrs.src,"_blank"),size:"sm",variant:"ghost",className:"h-8 w-8 p-0",title:"Open in new tab",children:c.jsx(O.ExternalLink,{className:"h-4 w-4"})}),c.jsx(ee,{onClick:S,size:"sm",variant:"ghost",className:"h-8 w-8 p-0",title:"Copy iframe code",children:c.jsx(O.Copy,{className:"h-4 w-4"})}),c.jsx(ee,{onClick:()=>{p&&n()},size:"sm",variant:"ghost",className:"h-8 w-8 p-0 text-red-600 hover:text-red-700",title:"Delete iframe",children:c.jsx(O.Trash2,{className:"h-4 w-4"})})]})}),t.attrs.src&&c.jsxs("div",{className:"mt-2 text-xs text-gray-500 bg-gray-100 px-2 py-1 rounded",children:["Source: ",t.attrs.src]})]})})},Ni=t=>{const e={};return t&&t.split(";").forEach(n=>{const[r,i]=n.split(":").map(o=>o.trim());if(r&&i){const o=r.replace(/-([a-z])/g,s=>s[1].toUpperCase());e[o]=i}}),e},En=V.Node.create({name:"iframe",group:"block",atom:!0,addOptions(){return{readOnly:!1}},addAttributes(){return{src:{default:"",parseHTML:t=>t.getAttribute("src")||"",renderHTML:t=>({src:t.src})},width:{default:"100%",parseHTML:t=>t.getAttribute("width")||"100%",renderHTML:t=>({width:t.width})},height:{default:"500px",parseHTML:t=>t.getAttribute("height")||"500px",renderHTML:t=>({height:t.height})},title:{default:"",parseHTML:t=>t.getAttribute("title")||"",renderHTML:t=>({title:t.title})},allow:{default:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",parseHTML:t=>t.getAttribute("allow")||"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",renderHTML:t=>({allow:t.allow})},sandbox:{default:"allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-presentation",parseHTML:t=>t.getAttribute("sandbox")||"allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-presentation",renderHTML:t=>({sandbox:t.sandbox})},style:{default:"",parseHTML:t=>t.getAttribute("style")||"",renderHTML:t=>({style:t.style})}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:t}){return["iframe",V.mergeAttributes(t)]},addNodeView(){return G.ReactNodeViewRenderer(Si)},addCommands(){return{insertIframe:(t={})=>({commands:e})=>e.insertContent({type:this.name,attrs:{src:t.src||"",width:t.width||"100%",height:t.height||"500px",title:t.title||"Embedded Content",allow:t.allow||"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",sandbox:t.sandbox||"allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-presentation",style:t.style||""}})}}}),Sn=V.Node.create({name:"video",addOptions(){return{inline:!1,allowBase64:!0,HTMLAttributes:{class:"max-w-full h-auto rounded-lg shadow-sm"}}},group(){return this.options.inline?"inline":"block"},draggable:!1,addAttributes(){return{src:{default:null,parseHTML:t=>t.getAttribute("src"),renderHTML:t=>t.src?{src:t.src}:{}},type:{default:null,parseHTML:t=>t.getAttribute("type"),renderHTML:t=>t.type?{type:t.type}:{}},title:{default:null,parseHTML:t=>t.getAttribute("title"),renderHTML:t=>t.title?{title:t.title}:{}}}},parseHTML(){return[{tag:"video"}]},renderHTML({HTMLAttributes:t}){const{src:e,type:n,title:r}=t;return e?["video",V.mergeAttributes(this.options.HTMLAttributes,t,{controls:!0,preload:"metadata"}),["source",{src:e,type:n||"video/mp4"}],r||"Your browser does not support the video tag."]:["video",V.mergeAttributes(this.options.HTMLAttributes,t)]},addCommands(){return{setVideo:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}}});function Ti({initialOpen:t=!1,placement:e="top",open:n,onOpenChange:r,delay:i=600,closeDelay:o=0}={}){const[s,a]=ue.useState(t),l=n??s,d=r??a,u=ne.useFloating({placement:e,open:l,onOpenChange:d,whileElementsMounted:ne.autoUpdate,middleware:[ne.offset(4),ne.flip({crossAxis:e.includes("-"),fallbackAxisSideDirection:"start",padding:4}),ne.shift({padding:4})]}),f=u.context,h=ne.useHover(f,{mouseOnly:!0,move:!1,restMs:i,enabled:n==null,delay:{close:o}}),m=ne.useFocus(f,{enabled:n==null}),b=ne.useDismiss(f),w=ne.useRole(f,{role:"tooltip"}),p=ne.useInteractions([h,m,b,w]);return ue.useMemo(()=>({open:l,setOpen:d,...p,...u}),[l,d,p,u])}const ft=ue.createContext(null);function Nn(){const t=ue.useContext(ft);if(t==null)throw new Error("Tooltip components must be wrapped in <TooltipProvider />");return t}function ht({children:t,...e}){const n=Ti(e);return e.useDelayGroup?c.jsx(ne.FloatingDelayGroup,{delay:{open:e.delay??0,close:e.closeDelay??0},timeoutMs:e.timeout,children:c.jsx(ft.Provider,{value:n,children:t})}):c.jsx(ft.Provider,{value:n,children:t})}const pt=ue.forwardRef(function({children:e,asChild:n=!1,...r},i){const o=Nn(),s=ue.isValidElement(e)?parseInt(ue.version,10)>=19?e.props.ref:e.ref:void 0,a=ne.useMergeRefs([o.refs.setReference,i,s]);if(n&&ue.isValidElement(e)){const l={"data-tooltip-state":o.open?"open":"closed"};return ue.cloneElement(e,o.getReferenceProps({ref:a,...r,...typeof e.props=="object"?e.props:{},...l}))}return c.jsx("button",{ref:a,"data-tooltip-state":o.open?"open":"closed",...o.getReferenceProps(r),children:e})}),mt=ue.forwardRef(function({style:e,children:n,portal:r=!0,portalProps:i={},...o},s){const a=Nn(),l=ne.useMergeRefs([a.refs.setFloating,s]);if(!a.open)return null;const d=c.jsx("div",{ref:l,style:{...a.floatingStyles,...e},...a.getFloatingProps(o),className:"tiptap-tooltip",children:n});return r?c.jsx(ne.FloatingPortal,{...i,children:d}):d});ht.displayName="Tooltip",pt.displayName="TooltipTrigger",mt.displayName="TooltipContent";const _=({onClick:t,isActive:e=!1,children:n,title:r,className:i=""})=>{const o=c.jsx(ee,{type:"button",onClick:t,variant:e?"default":"outline",size:"sm",className:`h-8 w-8 p-0 transition-all cursor-pointer ${e?"bg-blue-600 text-white border-blue-600 hover:bg-blue-700":"bg-white hover:bg-gray-50"} ${i}`,children:n});return r?c.jsxs(ht,{delay:500,closeDelay:0,children:[c.jsx(pt,{asChild:!0,children:o}),c.jsx(mt,{children:r})]}):o},Tn=({onColorChange:t})=>{const e=["#000000","#FF0000","#00FF00","#0000FF","#FFFF00","#FF00FF","#00FFFF","#FFA500","#800080","#008000","#000080","#800000","#808000","#FFC0CB"];return c.jsx("div",{className:"flex flex-wrap gap-1 w-32",children:e.map(n=>c.jsxs(ht,{delay:300,closeDelay:0,children:[c.jsx(pt,{asChild:!0,children:c.jsx("button",{type:"button",className:"w-6 h-6 rounded border border-gray-300 cursor-pointer hover:scale-110 transition-transform",style:{backgroundColor:n},onClick:()=>t(n)})}),c.jsxs(mt,{children:["Set color to ",n]})]},n))})},ki=({editor:t,isReadOnly:e,onImageUpload:n,onVideoUpload:r,isImageUploading:i,isVideoUploading:o,showImageInput:s,setShowImageInput:a,imageUrl:l,setImageUrl:d,handleImageUrlInsert:u,imageUploadFunction:f})=>e?null:c.jsxs("div",{className:"sticky top-0 z-40 border border-gray-300 mb-4 p-4 bg-gray-50/95 flex flex-wrap gap-2 shadow-sm backdrop-blur-sm",children:[c.jsxs("div",{className:"flex gap-1 border-r border-gray-300 pr-2",children:[c.jsx(_,{onClick:()=>t.chain().focus().toggleHeading({level:1}).run(),isActive:t.isActive("heading",{level:1}),title:"Heading 1",children:c.jsx(O.Heading1,{className:"h-4 w-4"})}),c.jsx(_,{onClick:()=>t.chain().focus().toggleHeading({level:2}).run(),isActive:t.isActive("heading",{level:2}),title:"Heading 2",children:c.jsx(O.Heading2,{className:"h-4 w-4"})}),c.jsx(_,{onClick:()=>t.chain().focus().toggleHeading({level:3}).run(),isActive:t.isActive("heading",{level:3}),title:"Heading 3",children:c.jsx(O.Heading3,{className:"h-4 w-4"})}),c.jsx(_,{onClick:()=>t.chain().focus().setParagraph().run(),isActive:t.isActive("paragraph"),title:"Paragraph",children:c.jsx(O.FileText,{className:"h-4 w-4"})})]}),c.jsxs("div",{className:"flex gap-1 border-r border-gray-300 pr-2",children:[c.jsx(_,{onClick:()=>t.chain().focus().toggleBulletList().run(),isActive:t.isActive("bulletList"),title:"Bullet List",children:c.jsx(O.List,{className:"h-4 w-4"})}),c.jsx(_,{onClick:()=>t.chain().focus().toggleOrderedList().run(),isActive:t.isActive("orderedList"),title:"Numbered List",children:c.jsx(O.ListOrdered,{className:"h-4 w-4"})})]}),c.jsx("div",{className:"flex gap-1 border-r border-gray-300 pr-2",children:c.jsx(_,{onClick:()=>t.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),title:"Insert Table (3x3)",children:c.jsx(O.Table,{className:"h-4 w-4"})})}),c.jsxs("div",{className:"flex gap-1 border-r border-gray-300 pr-2",children:[c.jsx(_,{onClick:()=>t.chain().focus().toggleBlockquote().run(),isActive:t.isActive("blockquote"),title:"Block Quote",children:c.jsx(O.Quote,{className:"h-4 w-4"})}),c.jsx(_,{onClick:()=>t.chain().focus().setHorizontalRule().run(),title:"Horizontal Rule",children:c.jsx(O.Minus,{className:"h-4 w-4"})})]}),c.jsxs("div",{className:"flex gap-1 border-r border-gray-300 pr-2",children:[c.jsxs("div",{className:"relative",children:[c.jsx(_,{onClick:()=>a(!s),title:"Insert Image",className:i?"opacity-50":"",children:i?c.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-blue-600"}):c.jsx(O.Image,{className:"h-4 w-4"})}),i&&c.jsx("div",{className:"absolute -top-1 -right-1 w-3 h-3 bg-blue-600 rounded-full animate-pulse"}),s&&c.jsx("div",{className:`absolute top-full mt-1 z-10 bg-white border border-gray-300 rounded-lg p-2 shadow-lg min-w-80 image-input-container ${i?"opacity-75":""}`,children:c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("h3",{className:"text-sm font-medium text-gray-900",children:"Insert Image"}),c.jsx("button",{type:"button",onClick:()=>a(!1),className:`text-gray-400 hover:text-gray-600 ${i?"opacity-50 cursor-not-allowed":""}`,disabled:i,children:"✕"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Image URL"}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("input",{type:"url",value:l,onChange:h=>d(h.target.value),placeholder:"https://example.com/image.jpg",className:`flex-1 px-3 py-2 text-sm border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 ${i?"opacity-50 cursor-not-allowed":""}`,disabled:i,onKeyDown:h=>{h.key==="Enter"&&u()}}),c.jsx(ee,{type:"button",onClick:u,size:"sm",className:"px-4 py-2",disabled:!l.trim()||i,children:"Insert"})]}),l.trim()&&c.jsxs("div",{className:"mt-2 p-2 border border-gray-200 rounded bg-gray-50",children:[c.jsx("p",{className:"text-xs text-gray-600 mb-2",children:"Preview:"}),c.jsx("img",{src:l.trim(),alt:"Preview",className:"max-w-full h-auto max-h-32 rounded border",onError:h=>{const m=h.currentTarget;m.style.display="none";const b=m.nextElementSibling;b&&(b.style.display="block")}}),c.jsx("p",{className:"text-xs text-red-500 hidden",children:"Invalid image URL"})]})]}),c.jsxs("div",{className:"border-t pt-3",children:[c.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Or Upload Image"}),c.jsx(ee,{type:"button",onClick:n,size:"sm",variant:"outline",className:"w-full",disabled:!f||i,children:i?c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-blue-600"}),c.jsx("span",{children:"Uploading..."})]}):f?"Choose File":"Upload not available"}),i&&c.jsxs("div",{className:"mt-2 text-xs text-blue-600 flex items-center gap-1",children:[c.jsx("div",{className:"animate-pulse",children:"⏳"}),c.jsx("span",{children:"Please wait while your image uploads..."})]}),!f&&c.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Upload function not provided"})]})]})})]}),c.jsxs("div",{className:"relative",children:[c.jsx(_,{onClick:r,title:o?"Upload Video to Firebase":"Upload Video (Base64)",className:o?"opacity-50":"",children:o?c.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-blue-600"}):c.jsx(O.Video,{className:"h-4 w-4"})}),o&&c.jsx("div",{className:"absolute -top-1 -right-1 w-3 h-3 bg-blue-600 rounded-full animate-pulse"}),!r&&c.jsx("div",{className:"absolute top-full mt-1 left-0 bg-gray-800 text-white text-xs px-2 py-1 rounded whitespace-nowrap z-50",children:"Video upload not available"})]})]}),c.jsxs("div",{className:"flex gap-1 border-r border-gray-300 pr-2",children:[c.jsx(_,{onClick:()=>t.chain().focus().toggleCodeBlock().run(),isActive:t.isActive("codeBlock"),title:"Code Block",children:c.jsx(O.Code,{className:"h-4 w-4"})}),c.jsx(_,{onClick:()=>t.chain().focus().insertAccordion().run(),title:"Insert Accordion",children:c.jsx(O.PanelTopOpen,{className:"h-4 w-4 cursor-pointer"})})]}),c.jsxs("div",{className:"flex gap-1 border-r border-gray-300 pr-2",children:[c.jsx(_,{onClick:()=>t.chain().focus().insertTabs({tabCount:2}).run(),title:"Insert 2 Tabs",children:c.jsx("span",{className:"text-xs font-mono",children:"2T"})}),c.jsx(_,{onClick:()=>t.chain().focus().insertTabs({tabCount:3}).run(),title:"Insert 3 Tabs",children:c.jsx("span",{className:"text-xs font-mono",children:"3T"})}),c.jsx(_,{onClick:()=>t.chain().focus().insertTabs({tabCount:4}).run(),title:"Insert 4 Tabs",children:c.jsx("span",{className:"text-xs font-mono",children:"4T"})}),c.jsx(_,{onClick:()=>t.chain().focus().insertTabs({tabCount:5}).run(),title:"Insert 5 Tabs",children:c.jsx("span",{className:"text-xs font-mono",children:"5T"})}),c.jsx(_,{onClick:()=>t.chain().focus().insertTabs({tabCount:6}).run(),title:"Insert 6 Tabs",children:c.jsx("span",{className:"text-xs font-mono",children:"6T"})})]}),c.jsx("div",{className:"flex gap-1 border-r border-gray-300 pr-2",children:c.jsx(_,{onClick:()=>{const h=prompt("Enter the URL for your iframe:","https://example.com/embed");h&&t.chain().focus().insertIframe({src:h,width:"100%",height:"500px",title:"Embedded Content"}).run()},title:"Insert iframe",children:c.jsx(O.Frame,{className:"h-4 w-4"})})})]}),kn=["top","right","bottom","left"],Cn=["start","end"],An=kn.reduce((t,e)=>t.concat(e,e+"-"+Cn[0],e+"-"+Cn[1]),[]),fe=Math.min,te=Math.max,Ge=Math.round,he=t=>({x:t,y:t}),Ci={left:"right",right:"left",bottom:"top",top:"bottom"},Ai={start:"end",end:"start"};function gt(t,e,n){return te(t,fe(e,n))}function we(t,e){return typeof t=="function"?t(e):t}function oe(t){return t.split("-")[0]}function le(t){return t.split("-")[1]}function On(t){return t==="x"?"y":"x"}function bt(t){return t==="y"?"height":"width"}const Oi=new Set(["top","bottom"]);function pe(t){return Oi.has(oe(t))?"y":"x"}function wt(t){return On(pe(t))}function Rn(t,e,n){n===void 0&&(n=!1);const r=le(t),i=wt(t),o=bt(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=Ze(s)),[s,Ze(s)]}function Ri(t){const e=Ze(t);return[Ye(t),e,Ye(e)]}function Ye(t){return t.replace(/start|end/g,e=>Ai[e])}const In=["left","right"],Mn=["right","left"],Ii=["top","bottom"],Mi=["bottom","top"];function _i(t,e,n){switch(t){case"top":case"bottom":return n?e?Mn:In:e?In:Mn;case"left":case"right":return e?Ii:Mi;default:return[]}}function Li(t,e,n,r){const i=le(t);let o=_i(oe(t),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),e&&(o=o.concat(o.map(Ye)))),o}function Ze(t){return t.replace(/left|right|bottom|top/g,e=>Ci[e])}function ji(t){return{top:0,right:0,bottom:0,left:0,...t}}function xt(t){return typeof t!="number"?ji(t):{top:t,right:t,bottom:t,left:t}}function Re(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function _n(t,e,n){let{reference:r,floating:i}=t;const o=pe(e),s=wt(e),a=bt(s),l=oe(e),d=o==="y",u=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2;let m;switch(l){case"top":m={x:u,y:r.y-i.height};break;case"bottom":m={x:u,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:f};break;case"left":m={x:r.x-i.width,y:f};break;default:m={x:r.x,y:r.y}}switch(le(e)){case"start":m[s]-=h*(n&&d?-1:1);break;case"end":m[s]+=h*(n&&d?-1:1);break}return m}const Pi=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(e));let d=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:f}=_n(d,r,l),h=r,m={},b=0;for(let w=0;w<a.length;w++){const{name:p,fn:E}=a[w],{x:y,y:S,data:R,reset:v}=await E({x:u,y:f,initialPlacement:r,placement:h,strategy:i,middlewareData:m,rects:d,platform:s,elements:{reference:t,floating:e}});u=y??u,f=S??f,m={...m,[p]:{...m[p],...R}},v&&b<=50&&(b++,typeof v=="object"&&(v.placement&&(h=v.placement),v.rects&&(d=v.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:i}):v.rects),{x:u,y:f}=_n(d,h,l)),w=-1)}return{x:u,y:f,placement:h,strategy:i,middlewareData:m}};async function Ie(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=t,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:m=0}=we(e,t),b=xt(m),p=a[h?f==="floating"?"reference":"floating":f],E=Re(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(p)))==null||n?p:p.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:d,rootBoundary:u,strategy:l})),y=f==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),R=await(o.isElement==null?void 0:o.isElement(S))?await(o.getScale==null?void 0:o.getScale(S))||{x:1,y:1}:{x:1,y:1},v=Re(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:S,strategy:l}):y);return{top:(E.top-v.top+b.top)/R.y,bottom:(v.bottom-E.bottom+b.bottom)/R.y,left:(E.left-v.left+b.left)/R.x,right:(v.right-E.right+b.right)/R.x}}const Di=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:l}=e,{element:d,padding:u=0}=we(t,e)||{};if(d==null)return{};const f=xt(u),h={x:n,y:r},m=wt(i),b=bt(m),w=await s.getDimensions(d),p=m==="y",E=p?"top":"left",y=p?"bottom":"right",S=p?"clientHeight":"clientWidth",R=o.reference[b]+o.reference[m]-h[m]-o.floating[b],v=h[m]-o.reference[m],x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(d));let N=x?x[S]:0;(!N||!await(s.isElement==null?void 0:s.isElement(x)))&&(N=a.floating[S]||o.floating[b]);const C=R/2-v/2,M=N/2-w[b]/2-1,T=fe(f[E],M),L=fe(f[y],M),F=T,W=N-w[b]-L,U=N/2-w[b]/2+C,Y=gt(F,U,W),J=!l.arrow&&le(i)!=null&&U!==Y&&o.reference[b]/2-(U<F?T:L)-w[b]/2<0,K=J?U<F?U-F:U-W:0;return{[m]:h[m]+K,data:{[m]:Y,centerOffset:U-Y-K,...J&&{alignmentOffset:K}},reset:J}}});function zi(t,e,n){return(t?[...n.filter(i=>le(i)===t),...n.filter(i=>le(i)!==t)]:n.filter(i=>oe(i)===i)).filter(i=>t?le(i)===t||(e?Ye(i)!==i:!1):!0)}const Bi=function(t){return t===void 0&&(t={}),{name:"autoPlacement",options:t,async fn(e){var n,r,i;const{rects:o,middlewareData:s,placement:a,platform:l,elements:d}=e,{crossAxis:u=!1,alignment:f,allowedPlacements:h=An,autoAlignment:m=!0,...b}=we(t,e),w=f!==void 0||h===An?zi(f||null,m,h):h,p=await Ie(e,b),E=((n=s.autoPlacement)==null?void 0:n.index)||0,y=w[E];if(y==null)return{};const S=Rn(y,o,await(l.isRTL==null?void 0:l.isRTL(d.floating)));if(a!==y)return{reset:{placement:w[0]}};const R=[p[oe(y)],p[S[0]],p[S[1]]],v=[...((r=s.autoPlacement)==null?void 0:r.overflows)||[],{placement:y,overflows:R}],x=w[E+1];if(x)return{data:{index:E+1,overflows:v},reset:{placement:x}};const N=v.map(T=>{const L=le(T.placement);return[T.placement,L&&u?T.overflows.slice(0,2).reduce((F,W)=>F+W,0):T.overflows[0],T.overflows]}).sort((T,L)=>T[1]-L[1]),M=((i=N.filter(T=>T[2].slice(0,le(T[0])?2:3).every(L=>L<=0))[0])==null?void 0:i[0])||N[0][0];return M!==a?{data:{index:E+1,overflows:v},reset:{placement:M}}:{}}}},Ui=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:l,elements:d}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:w=!0,...p}=we(t,e);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const E=oe(i),y=pe(a),S=oe(a)===a,R=await(l.isRTL==null?void 0:l.isRTL(d.floating)),v=h||(S||!w?[Ze(a)]:Ri(a)),x=b!=="none";!h&&x&&v.push(...Li(a,w,b,R));const N=[a,...v],C=await Ie(e,p),M=[];let T=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&M.push(C[E]),f){const U=Rn(i,s,R);M.push(C[U[0]],C[U[1]])}if(T=[...T,{placement:i,overflows:M}],!M.every(U=>U<=0)){var L,F;const U=(((L=o.flip)==null?void 0:L.index)||0)+1,Y=N[U];if(Y&&(!(f==="alignment"?y!==pe(Y):!1)||T.every(I=>pe(I.placement)===y?I.overflows[0]>0:!0)))return{data:{index:U,overflows:T},reset:{placement:Y}};let J=(F=T.filter(K=>K.overflows[0]<=0).sort((K,I)=>K.overflows[1]-I.overflows[1])[0])==null?void 0:F.placement;if(!J)switch(m){case"bestFit":{var W;const K=(W=T.filter(I=>{if(x){const H=pe(I.placement);return H===y||H==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(H=>H>0).reduce((H,g)=>H+g,0)]).sort((I,H)=>I[1]-H[1])[0])==null?void 0:W[0];K&&(J=K);break}case"initialPlacement":J=a;break}if(i!==J)return{reset:{placement:J}}}return{}}}};function Ln(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function jn(t){return kn.some(e=>t[e]>=0)}const Hi=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...i}=we(t,e);switch(r){case"referenceHidden":{const o=await Ie(e,{...i,elementContext:"reference"}),s=Ln(o,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:jn(s)}}}case"escaped":{const o=await Ie(e,{...i,altBoundary:!0}),s=Ln(o,n.floating);return{data:{escapedOffsets:s,escaped:jn(s)}}}default:return{}}}}};function Pn(t){const e=fe(...t.map(o=>o.left)),n=fe(...t.map(o=>o.top)),r=te(...t.map(o=>o.right)),i=te(...t.map(o=>o.bottom));return{x:e,y:n,width:r-e,height:i-n}}function Fi(t){const e=t.slice().sort((i,o)=>i.y-o.y),n=[];let r=null;for(let i=0;i<e.length;i++){const o=e[i];!r||o.y-r.y>r.height/2?n.push([o]):n[n.length-1].push(o),r=o}return n.map(i=>Re(Pn(i)))}const $i=function(t){return t===void 0&&(t={}),{name:"inline",options:t,async fn(e){const{placement:n,elements:r,rects:i,platform:o,strategy:s}=e,{padding:a=2,x:l,y:d}=we(t,e),u=Array.from(await(o.getClientRects==null?void 0:o.getClientRects(r.reference))||[]),f=Fi(u),h=Re(Pn(u)),m=xt(a);function b(){if(f.length===2&&f[0].left>f[1].right&&l!=null&&d!=null)return f.find(p=>l>p.left-m.left&&l<p.right+m.right&&d>p.top-m.top&&d<p.bottom+m.bottom)||h;if(f.length>=2){if(pe(n)==="y"){const T=f[0],L=f[f.length-1],F=oe(n)==="top",W=T.top,U=L.bottom,Y=F?T.left:L.left,J=F?T.right:L.right,K=J-Y,I=U-W;return{top:W,bottom:U,left:Y,right:J,width:K,height:I,x:Y,y:W}}const p=oe(n)==="left",E=te(...f.map(T=>T.right)),y=fe(...f.map(T=>T.left)),S=f.filter(T=>p?T.left===y:T.right===E),R=S[0].top,v=S[S.length-1].bottom,x=y,N=E,C=N-x,M=v-R;return{top:R,bottom:v,left:x,right:N,width:C,height:M,x,y:R}}return h}const w=await o.getElementRects({reference:{getBoundingClientRect:b},floating:r.floating,strategy:s});return i.reference.x!==w.reference.x||i.reference.y!==w.reference.y||i.reference.width!==w.reference.width||i.reference.height!==w.reference.height?{reset:{rects:w}}:{}}}},Ji=new Set(["left","top"]);async function Vi(t,e){const{placement:n,platform:r,elements:i}=t,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=oe(n),a=le(n),l=pe(n)==="y",d=Ji.has(s)?-1:1,u=o&&l?-1:1,f=we(e,t);let{mainAxis:h,crossAxis:m,alignmentAxis:b}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof b=="number"&&(m=a==="end"?b*-1:b),l?{x:m*u,y:h*d}:{x:h*d,y:m*u}}const qi=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:o,placement:s,middlewareData:a}=e,l=await Vi(e,t);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},Wi=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:p=>{let{x:E,y}=p;return{x:E,y}}},...l}=we(t,e),d={x:n,y:r},u=await Ie(e,l),f=pe(oe(i)),h=On(f);let m=d[h],b=d[f];if(o){const p=h==="y"?"top":"left",E=h==="y"?"bottom":"right",y=m+u[p],S=m-u[E];m=gt(y,m,S)}if(s){const p=f==="y"?"top":"left",E=f==="y"?"bottom":"right",y=b+u[p],S=b-u[E];b=gt(y,b,S)}const w=a.fn({...e,[h]:m,[f]:b});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[h]:o,[f]:s}}}}}},Ki=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:o,platform:s,elements:a}=e,{apply:l=()=>{},...d}=we(t,e),u=await Ie(e,d),f=oe(i),h=le(i),m=pe(i)==="y",{width:b,height:w}=o.floating;let p,E;f==="top"||f==="bottom"?(p=f,E=h===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(E=f,p=h==="end"?"top":"bottom");const y=w-u.top-u.bottom,S=b-u.left-u.right,R=fe(w-u[p],y),v=fe(b-u[E],S),x=!e.middlewareData.shift;let N=R,C=v;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(C=S),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(N=y),x&&!h){const T=te(u.left,0),L=te(u.right,0),F=te(u.top,0),W=te(u.bottom,0);m?C=b-2*(T!==0||L!==0?T+L:te(u.left,u.right)):N=w-2*(F!==0||W!==0?F+W:te(u.top,u.bottom))}await l({...e,availableWidth:C,availableHeight:N});const M=await s.getDimensions(a.floating);return b!==M.width||w!==M.height?{reset:{rects:!0}}:{}}}};function Xe(){return typeof window<"u"}function Me(t){return Dn(t)?(t.nodeName||"").toLowerCase():"#document"}function re(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function xe(t){var e;return(e=(Dn(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Dn(t){return Xe()?t instanceof Node||t instanceof re(t).Node:!1}function ce(t){return Xe()?t instanceof Element||t instanceof re(t).Element:!1}function me(t){return Xe()?t instanceof HTMLElement||t instanceof re(t).HTMLElement:!1}function zn(t){return!Xe()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof re(t).ShadowRoot}const Gi=new Set(["inline","contents"]);function He(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=de(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!Gi.has(i)}const Yi=new Set(["table","td","th"]);function Zi(t){return Yi.has(Me(t))}const Xi=[":popover-open",":modal"];function Qe(t){return Xi.some(e=>{try{return t.matches(e)}catch{return!1}})}const Qi=["transform","translate","scale","rotate","perspective"],eo=["transform","translate","scale","rotate","perspective","filter"],to=["paint","layout","strict","content"];function yt(t){const e=vt(),n=ce(t)?de(t):t;return Qi.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||eo.some(r=>(n.willChange||"").includes(r))||to.some(r=>(n.contain||"").includes(r))}function no(t){let e=Ne(t);for(;me(e)&&!_e(e);){if(yt(e))return e;if(Qe(e))return null;e=Ne(e)}return null}function vt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const ro=new Set(["html","body","#document"]);function _e(t){return ro.has(Me(t))}function de(t){return re(t).getComputedStyle(t)}function et(t){return ce(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ne(t){if(Me(t)==="html")return t;const e=t.assignedSlot||t.parentNode||zn(t)&&t.host||xe(t);return zn(e)?e.host:e}function Bn(t){const e=Ne(t);return _e(e)?t.ownerDocument?t.ownerDocument.body:t.body:me(e)&&He(e)?e:Bn(e)}function Un(t,e,n){var r;e===void 0&&(e=[]);const i=Bn(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),s=re(i);return o?(Et(s),e.concat(s,s.visualViewport||[],He(i)?i:[],[])):e.concat(i,Un(i,[]))}function Et(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Hn(t){const e=de(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=me(t),o=i?t.offsetWidth:n,s=i?t.offsetHeight:r,a=Ge(n)!==o||Ge(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function Fn(t){return ce(t)?t:t.contextElement}function Le(t){const e=Fn(t);if(!me(e))return he(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:o}=Hn(e);let s=(o?Ge(n.width):n.width)/r,a=(o?Ge(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const io=he(0);function $n(t){const e=re(t);return!vt()||!e.visualViewport?io:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function oo(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==re(t)?!1:e}function Fe(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),o=Fn(t);let s=he(1);e&&(r?ce(r)&&(s=Le(r)):s=Le(t));const a=oo(o,n,r)?$n(o):he(0);let l=(i.left+a.x)/s.x,d=(i.top+a.y)/s.y,u=i.width/s.x,f=i.height/s.y;if(o){const h=re(o),m=r&&ce(r)?re(r):r;let b=h,w=Et(b);for(;w&&r&&m!==b;){const p=Le(w),E=w.getBoundingClientRect(),y=de(w),S=E.left+(w.clientLeft+parseFloat(y.paddingLeft))*p.x,R=E.top+(w.clientTop+parseFloat(y.paddingTop))*p.y;l*=p.x,d*=p.y,u*=p.x,f*=p.y,l+=S,d+=R,b=re(w),w=Et(b)}}return Re({width:u,height:f,x:l,y:d})}function tt(t,e){const n=et(t).scrollLeft;return e?e.left+n:Fe(xe(t)).left+n}function Jn(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-tt(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function so(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const o=i==="fixed",s=xe(r),a=e?Qe(e.floating):!1;if(r===s||a&&o)return n;let l={scrollLeft:0,scrollTop:0},d=he(1);const u=he(0),f=me(r);if((f||!f&&!o)&&((Me(r)!=="body"||He(s))&&(l=et(r)),me(r))){const m=Fe(r);d=Le(r),u.x=m.x+r.clientLeft,u.y=m.y+r.clientTop}const h=s&&!f&&!o?Jn(s,l):he(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-l.scrollLeft*d.x+u.x+h.x,y:n.y*d.y-l.scrollTop*d.y+u.y+h.y}}function ao(t){return Array.from(t.getClientRects())}function lo(t){const e=xe(t),n=et(t),r=t.ownerDocument.body,i=te(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=te(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+tt(t);const a=-n.scrollTop;return de(r).direction==="rtl"&&(s+=te(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}const Vn=25;function co(t,e){const n=re(t),r=xe(t),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;const u=vt();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const d=tt(r);if(d<=0){const u=r.ownerDocument,f=u.body,h=getComputedStyle(f),m=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,b=Math.abs(r.clientWidth-f.clientWidth-m);b<=Vn&&(o-=b)}else d<=Vn&&(o+=d);return{width:o,height:s,x:a,y:l}}const uo=new Set(["absolute","fixed"]);function fo(t,e){const n=Fe(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=me(t)?Le(t):he(1),s=t.clientWidth*o.x,a=t.clientHeight*o.y,l=i*o.x,d=r*o.y;return{width:s,height:a,x:l,y:d}}function qn(t,e,n){let r;if(e==="viewport")r=co(t,n);else if(e==="document")r=lo(xe(t));else if(ce(e))r=fo(e,n);else{const i=$n(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Re(r)}function Wn(t,e){const n=Ne(t);return n===e||!ce(n)||_e(n)?!1:de(n).position==="fixed"||Wn(n,e)}function ho(t,e){const n=e.get(t);if(n)return n;let r=Un(t,[]).filter(a=>ce(a)&&Me(a)!=="body"),i=null;const o=de(t).position==="fixed";let s=o?Ne(t):t;for(;ce(s)&&!_e(s);){const a=de(s),l=yt(s);!l&&a.position==="fixed"&&(i=null),(o?!l&&!i:!l&&a.position==="static"&&!!i&&uo.has(i.position)||He(s)&&!l&&Wn(t,s))?r=r.filter(u=>u!==s):i=a,s=Ne(s)}return e.set(t,r),r}function po(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const s=[...n==="clippingAncestors"?Qe(e)?[]:ho(e,this._c):[].concat(n),r],a=s[0],l=s.reduce((d,u)=>{const f=qn(e,u,i);return d.top=te(f.top,d.top),d.right=fe(f.right,d.right),d.bottom=fe(f.bottom,d.bottom),d.left=te(f.left,d.left),d},qn(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function mo(t){const{width:e,height:n}=Hn(t);return{width:e,height:n}}function go(t,e,n){const r=me(e),i=xe(e),o=n==="fixed",s=Fe(t,!0,o,e);let a={scrollLeft:0,scrollTop:0};const l=he(0);function d(){l.x=tt(i)}if(r||!r&&!o)if((Me(e)!=="body"||He(i))&&(a=et(e)),r){const m=Fe(e,!0,o,e);l.x=m.x+e.clientLeft,l.y=m.y+e.clientTop}else i&&d();o&&!r&&i&&d();const u=i&&!r&&!o?Jn(i,a):he(0),f=s.left+a.scrollLeft-l.x-u.x,h=s.top+a.scrollTop-l.y-u.y;return{x:f,y:h,width:s.width,height:s.height}}function St(t){return de(t).position==="static"}function Kn(t,e){if(!me(t)||de(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return xe(t)===n&&(n=n.ownerDocument.body),n}function Gn(t,e){const n=re(t);if(Qe(t))return n;if(!me(t)){let i=Ne(t);for(;i&&!_e(i);){if(ce(i)&&!St(i))return i;i=Ne(i)}return n}let r=Kn(t,e);for(;r&&Zi(r)&&St(r);)r=Kn(r,e);return r&&_e(r)&&St(r)&&!yt(r)?n:r||no(t)||n}const bo=async function(t){const e=this.getOffsetParent||Gn,n=this.getDimensions,r=await n(t.floating);return{reference:go(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function wo(t){return de(t).direction==="rtl"}const xo={convertOffsetParentRelativeRectToViewportRelativeRect:so,getDocumentElement:xe,getClippingRect:po,getOffsetParent:Gn,getElementRects:bo,getClientRects:ao,getDimensions:mo,getScale:Le,isElement:ce,isRTL:wo},Yn=qi,Zn=Bi,Xn=Wi,Qn=Ui,er=Ki,tr=Hi,nr=Di,rr=$i,ir=(t,e,n)=>{const r=new Map,i={platform:xo,...n},o={...i.platform,_c:r};return Pi(t,e,{...i,platform:o})};function or(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),o=e.child(r);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)n++;return n}if(i.content.size||o.content.size){let s=or(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function sr(t,e,n,r){for(let i=t.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:r};let s=t.child(--i),a=e.child(--o),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let d=0,u=Math.min(s.text.length,a.text.length);for(;d<u&&s.text[s.text.length-d-1]==a.text[a.text.length-d-1];)d++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let d=sr(s.content,a.content,n-1,r-1);if(d)return d}n-=l,r-=l}}class z{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,o){for(let s=0,a=0;a<n;s++){let l=this.content[s],d=a+l.nodeSize;if(d>e&&r(l,i+a,o||null,s)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,i+u)}a=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let o="",s=!0;return this.nodesBetween(e,n,(a,l)=>{let d=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&d||a.isTextblock)&&r&&(s?s=!1:o+=r),o+=d},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new z(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let o=0,s=0;s<n;o++){let a=this.content[o],l=s+a.nodeSize;l>e&&((s<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),r.push(a),i+=a.nodeSize),s=l}return new z(r,i)}cutByIndex(e,n){return e==n?z.empty:e==0&&n==this.content.length?this:new z(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new z(i,o)}addToStart(e){return new z([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new z(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return or(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return sr(this,e,n,r)}findIndex(e){if(e==0)return nt(0,e);if(e==this.size)return nt(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),o=r+i.nodeSize;if(o>=e)return o==e?nt(n+1,o):nt(n,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return z.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new z(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return z.empty;let n,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(n||(n=e.slice(0,i)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new z(n||e,r)}static from(e){if(!e)return z.empty;if(e instanceof z)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new z([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}z.empty=new z([],0);const Nt={index:0,offset:0};function nt(t,e){return Nt.index=t,Nt.offset=e,Nt}class yo extends Error{}class P{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=lr(this.content,e+this.openStart,n);return r&&new P(r,this.openStart,this.openEnd)}removeBetween(e,n){return new P(ar(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return P.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new P(z.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new P(e,r,i)}}P.empty=new P(z.empty,0,0);function ar(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(i==e||o.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(ar(o.content,e-i-1,n-i-1)))}function lr(t,e,n,r){let{index:i,offset:o}=t.findIndex(e),s=t.maybeChild(i);if(o==e||s.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=lr(s.content,e-o-1,n,s);return a&&t.replaceChild(i,s.copy(a))}const cr=65535,dr=Math.pow(2,16);function vo(t,e){return t+e*dr}function ur(t){return t&cr}function Eo(t){return(t-(t&cr))/dr}const fr=1,hr=2,rt=4,pr=8;class mr{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&pr)>0}get deletedBefore(){return(this.delInfo&(fr|rt))>0}get deletedAfter(){return(this.delInfo&(hr|rt))>0}get deletedAcross(){return(this.delInfo&rt)>0}}class ie{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&ie.empty)return ie.empty}recover(e){let n=0,r=ur(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+Eo(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let d=this.ranges[a+o],u=this.ranges[a+s],f=l+d;if(e<=f){let h=d?e==l?-1:e==f?1:n:n,m=l+i+(h<0?0:u);if(r)return m;let b=e==(n<0?l:f)?null:vo(a/3,e-l),w=e==l?hr:e==f?fr:rt;return(n<0?e!=l:e!=f)&&(w|=pr),new mr(m,w,b)}i+=u-d}return r?e+i:new mr(e+i,0,null)}touches(e,n){let r=0,i=ur(n),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let d=this.ranges[a+o],u=l+d;if(e<=u&&a==i*3)return!0;r+=this.ranges[a+s]-d}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],a=s-(this.inverted?o:0),l=s+(this.inverted?0:o),d=this.ranges[i+n],u=this.ranges[i+r];e(a,a+d,l,l+u),o+=u-d}}invert(){return new ie(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?ie.empty:new ie(e<0?[0,-e,0]:[0,0,e])}}ie.empty=new ie([]);const Tt=Object.create(null);class X{getMap(){return ie.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Tt[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Tt)throw new RangeError("Duplicate use of step JSON ID "+e);return Tt[e]=n,n.prototype.jsonID=e,n}}class q{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new q(e,null)}static fail(e){return new q(null,e)}static fromReplace(e,n,r,i){try{return q.ok(e.replace(n,r,i))}catch(o){if(o instanceof yo)return q.fail(o.message);throw o}}}function kt(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let o=t.child(i);o.content.size&&(o=o.copy(kt(o.content,e,o))),o.isInline&&(o=e(o,n,i)),r.push(o)}return z.fromArray(r)}class Ce extends X{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new P(kt(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return q.fromReplace(e,this.from,this.to,o)}invert(){return new Ae(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Ce(n.pos,r.pos,this.mark)}merge(e){return e instanceof Ce&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ce(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Ce(n.from,n.to,e.markFromJSON(n.mark))}}X.jsonID("addMark",Ce);class Ae extends X{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new P(kt(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return q.fromReplace(e,this.from,this.to,r)}invert(){return new Ce(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Ae(n.pos,r.pos,this.mark)}merge(e){return e instanceof Ae&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ae(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ae(n.from,n.to,e.markFromJSON(n.mark))}}X.jsonID("removeMark",Ae);class Oe extends X{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return q.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return q.fromReplace(e,this.pos,this.pos+1,new P(z.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Oe(this.pos,n.marks[i]);return new Oe(this.pos,this.mark)}}return new $e(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Oe(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Oe(n.pos,e.markFromJSON(n.mark))}}X.jsonID("addNodeMark",Oe);class $e extends X{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return q.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return q.fromReplace(e,this.pos,this.pos+1,new P(z.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Oe(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new $e(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new $e(n.pos,e.markFromJSON(n.mark))}}X.jsonID("removeNodeMark",$e);class ye extends X{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Ct(e,this.from,this.to)?q.fail("Structure replace would overwrite content"):q.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ie([this.from,this.to-this.from,this.slice.size])}invert(e){return new ye(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new ye(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ye)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?P.empty:new P(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ye(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?P.empty:new P(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ye(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ye(n.from,n.to,P.fromJSON(e,n.slice),!!n.structure)}}X.jsonID("replace",ye);class je extends X{constructor(e,n,r,i,o,s,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=a}apply(e){if(this.structure&&(Ct(e,this.from,this.gapFrom)||Ct(e,this.gapTo,this.to)))return q.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return q.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?q.fromReplace(e,this.from,this.to,r):q.fail("Content does not fit in gap")}getMap(){return new ie([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new je(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new je(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new je(n.from,n.to,n.gapFrom,n.gapTo,P.fromJSON(e,n.slice),n.insert,!!n.structure)}}X.jsonID("replaceAround",je);function Ct(t,e,n){let r=t.resolve(e),i=n-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}class Je extends X{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return q.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return q.fromReplace(e,this.pos,this.pos+1,new P(z.from(i),0,n.isLeaf?0:1))}getMap(){return ie.empty}invert(e){return new Je(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Je(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Je(n.pos,n.attr,n.value)}}X.jsonID("attr",Je);class it extends X{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return q.ok(r)}getMap(){return ie.empty}invert(e){return new it(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new it(n.attr,n.value)}}X.jsonID("docAttr",it);let Ve=class extends Error{};Ve=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},Ve.prototype=Object.create(Error.prototype),Ve.prototype.constructor=Ve,Ve.prototype.name="TransformError";const At=Object.create(null);class B{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new gr(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=P.empty){let r=n.content.lastChild,i=null;for(let a=0;a<n.openEnd;a++)i=r,r=r.lastChild;let o=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:d}=s[a],u=e.mapping.slice(o);e.replaceRange(u.map(l.pos),u.map(d.pos),a?P.empty:n),a==0&&xr(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:a}=i[o],l=e.mapping.slice(r),d=l.map(s.pos),u=l.map(a.pos);o?e.deleteRange(d,u):(e.replaceRangeWith(d,u,n),xr(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new se(e):Pe(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let s=n<0?Pe(e.node(0),e.node(o),e.before(o+1),e.index(o),n,r):Pe(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new ve(e.node(0))}static atStart(e){return Pe(e,e,0,0,1)||new ve(e)}static atEnd(e){return Pe(e,e,e.content.size,e.childCount,-1)||new ve(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=At[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in At)throw new RangeError("Duplicate use of selection JSON ID "+e);return At[e]=n,n.prototype.jsonID=e,n}getBookmark(){return se.between(this.$anchor,this.$head).getBookmark()}}B.prototype.visible=!0;class gr{constructor(e,n){this.$from=e,this.$to=n}}let br=!1;function wr(t){!br&&!t.parent.inlineContent&&(br=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class se extends B{constructor(e,n=e){wr(e),wr(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return B.near(r);let i=e.resolve(n.map(this.anchor));return new se(i.parent.inlineContent?i:r,r)}replace(e,n=P.empty){if(super.replace(e,n),n==P.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof se&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new ot(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new se(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let o=B.findFrom(n,r,!0)||B.findFrom(n,-r,!0);if(o)n=o.$head;else return B.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(B.findFrom(e,-r,!0)||B.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new se(e,n)}}B.jsonID("text",se);class ot{constructor(e,n){this.anchor=e,this.head=n}map(e){return new ot(e.map(this.anchor),e.map(this.head))}resolve(e){return se.between(e.resolve(this.anchor),e.resolve(this.head))}}class ae extends B{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),o=e.resolve(i);return r?B.near(o):new ae(o)}content(){return new P(z.from(this.node),0,0)}eq(e){return e instanceof ae&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Ot(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ae(e.resolve(n.anchor))}static create(e,n){return new ae(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}ae.prototype.visible=!1,B.jsonID("node",ae);class Ot{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new ot(r,r):new Ot(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&ae.isSelectable(r)?new ae(n):B.near(n)}}class ve extends B{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=P.empty){if(n==P.empty){e.delete(0,e.doc.content.size);let r=B.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new ve(e)}map(e){return new ve(e)}eq(e){return e instanceof ve}getBookmark(){return So}}B.jsonID("all",ve);const So={map(){return this},resolve(t){return new ve(t)}};function Pe(t,e,n,r,i,o=!1){if(e.inlineContent)return se.create(t,n);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let a=e.child(s);if(a.isAtom){if(!o&&ae.isSelectable(a))return ae.create(t,n-(i<0?a.nodeSize:0))}else{let l=Pe(t,a,n+i,i<0?a.childCount:0,i,o);if(l)return l}n+=a.nodeSize*i}return null}function xr(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof ye||i instanceof je))return;let o=t.mapping.maps[r],s;o.forEach((a,l,d,u)=>{s==null&&(s=u)}),t.setSelection(B.near(t.doc.resolve(s),n))}function yr(t,e){return!e||!t?t:t.bind(e)}class st{constructor(e,n,r){this.name=e,this.init=yr(n.init,r),this.apply=yr(n.apply,r)}}new st("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new st("selection",{init(t,e){return t.selection||B.atStart(e.doc)},apply(t){return t.selection}}),new st("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new st("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}});function vr(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=vr(i,e,{})),n[r]=i}return n}class Er{constructor(e){this.spec=e,this.props={},e.props&&vr(e.props,this,this.props),this.key=e.key?e.key.key:Sr("plugin")}getState(e){return e[this.key]}}const Rt=Object.create(null);function Sr(t){return t in Rt?t+"$"+ ++Rt[t]:(Rt[t]=0,t+"$")}class qe{constructor(e="key"){this.key=Sr(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}for(var Te={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},at={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},No=typeof navigator<"u"&&/Mac/.test(navigator.platform),To=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Z=0;Z<10;Z++)Te[48+Z]=Te[96+Z]=String(Z);for(var Z=1;Z<=24;Z++)Te[Z+111]="F"+Z;for(var Z=65;Z<=90;Z++)Te[Z]=String.fromCharCode(Z+32),at[Z]=String.fromCharCode(Z);for(var It in Te)at.hasOwnProperty(It)||(at[It]=Te[It]);function ko(t){var e=No&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||To&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?at:Te)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const Co=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Ao=typeof navigator<"u"&&/Win/.test(navigator.platform);function Oo(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,o,s;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))o=!0;else if(/^mod$/i.test(l))Co?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),s&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function Ro(t){let e=Object.create(null);for(let n in t)e[Oo(n)]=t[n];return e}function Mt(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function Io(t){let e=Ro(t);return function(n,r){let i=ko(r),o,s=e[Mt(i,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[Mt(i,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Ao&&r.ctrlKey&&r.altKey)&&(o=Te[r.keyCode])&&o!=i){let a=e[Mt(o,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}var _t,Lt;if(typeof WeakMap<"u"){let t=new WeakMap;_t=e=>t.get(e),Lt=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;_t=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},Lt=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var Ee=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,i=e/this.width|0;let o=r+1,s=i+1;for(let a=1;o<this.width&&this.map[e+a]==n;a++)o++;for(let a=1;s<this.height&&this.map[e+this.width*a]==n;a++)s++;return{left:r,top:i,right:o,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:r,right:i,top:o,bottom:s}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[o*this.width+(n<0?r-1:i)]:(n<0?o==0:s==this.height)?null:this.map[r+this.width*(n<0?o-1:s)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:o}=this.findCell(t),{left:s,right:a,top:l,bottom:d}=this.findCell(e);return{left:Math.min(n,s),top:Math.min(i,l),right:Math.max(r,a),bottom:Math.max(o,d)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const o=r*this.width+i,s=this.map[o];n[s]||(n[s]=!0,!(i==t.left&&i&&this.map[o-1]==s||r==t.top&&r&&this.map[o-this.width]==s)&&e.push(s))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const o=i+n.child(r).nodeSize;if(r==t){let s=e+t*this.width;const a=(t+1)*this.width;for(;s<a&&this.map[s]<i;)s++;return s==a?o-1:this.map[s]}i=o}}static get(t){return _t(t)||Lt(t,Mo(t))}};function Mo(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=_o(t),n=t.childCount,r=[];let i=0,o=null;const s=[];for(let d=0,u=e*n;d<u;d++)r[d]=0;for(let d=0,u=0;d<n;d++){const f=t.child(d);u++;for(let b=0;;b++){for(;i<r.length&&r[i]!=0;)i++;if(b==f.childCount)break;const w=f.child(b),{colspan:p,rowspan:E,colwidth:y}=w.attrs;for(let S=0;S<E;S++){if(S+d>=n){(o||(o=[])).push({type:"overlong_rowspan",pos:u,n:E-S});break}const R=i+S*e;for(let v=0;v<p;v++){r[R+v]==0?r[R+v]=u:(o||(o=[])).push({type:"collision",row:d,pos:u,n:p-v});const x=y&&y[v];if(x){const N=(R+v)%e*2,C=s[N];C==null||C!=x&&s[N+1]==1?(s[N]=x,s[N+1]=1):C==x&&s[N+1]++}}}i+=p,u+=w.nodeSize}const h=(d+1)*e;let m=0;for(;i<h;)r[i++]==0&&m++;m&&(o||(o=[])).push({type:"missing",row:d,n:m}),u++}(e===0||n===0)&&(o||(o=[])).push({type:"zero_sized"});const a=new Ee(e,n,r,o);let l=!1;for(let d=0;!l&&d<s.length;d+=2)s[d]!=null&&s[d+1]<n&&(l=!0);return l&&Lo(a,s,t),a}function _o(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let o=0;if(n)for(let s=0;s<r;s++){const a=t.child(s);for(let l=0;l<a.childCount;l++){const d=a.child(l);s+d.attrs.rowspan>r&&(o+=d.attrs.colspan)}}for(let s=0;s<i.childCount;s++){const a=i.child(s);o+=a.attrs.colspan,a.attrs.rowspan>1&&(n=!0)}e==-1?e=o:e!=o&&(e=Math.max(e,o))}return e}function Lo(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const o=t.map[i];if(r[o])continue;r[o]=!0;const s=n.nodeAt(o);if(!s)throw new RangeError(`No cell with offset ${o} found`);let a=null;const l=s.attrs;for(let d=0;d<l.colspan;d++){const u=(i+d)%t.width,f=e[u*2];f!=null&&(!l.colwidth||l.colwidth[d]!=f)&&((a||(a=jo(l)))[d]=f)}a&&t.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:a})}}function jo(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function jt(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}new qe("selectingCells");function Po(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 Nr(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 Do(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=Po(e.$head)||zo(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function zo(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Tr(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function kr(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Cr(t,e,n){const r=t.node(-1),i=Ee.get(r),o=t.start(-1),s=i.nextCell(t.pos-o,e,n);return s==null?null:t.node(0).resolve(o+s)}function Ar(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}var ge=class Se extends B{constructor(e,n=e){const r=e.node(-1),i=Ee.get(r),o=e.start(-1),s=i.rectBetween(e.pos-o,n.pos-o),a=e.node(0),l=i.cellsInRect(s).filter(u=>u!=n.pos-o);l.unshift(n.pos-o);const d=l.map(u=>{const f=r.nodeAt(u);if(!f)throw RangeError(`No cell with offset ${u} found`);const h=o+u+1;return new gr(a.resolve(h),a.resolve(h+f.content.size))});super(d[0].$from,d[0].$to,d),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(Tr(r)&&Tr(i)&&kr(r,i)){const o=this.$anchorCell.node(-1)!=r.node(-1);return o&&this.isRowSelection()?Se.rowSelection(r,i):o&&this.isColSelection()?Se.colSelection(r,i):new Se(r,i)}return se.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=Ee.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),o={},s=[];for(let l=i.top;l<i.bottom;l++){const d=[];for(let u=l*n.width+i.left,f=i.left;f<i.right;f++,u++){const h=n.map[u];if(o[h])continue;o[h]=!0;const m=n.findCell(h);let b=e.nodeAt(h);if(!b)throw RangeError(`No cell with offset ${h} found`);const w=i.left-m.left,p=m.right-i.right;if(w>0||p>0){let E=b.attrs;if(w>0&&(E=Ar(E,0,w)),p>0&&(E=Ar(E,E.colspan-p,p)),m.left<i.left){if(b=b.type.createAndFill(E),!b)throw RangeError(`Could not create cell with attrs ${JSON.stringify(E)}`)}else b=b.type.create(E,b.content)}if(m.top<i.top||m.bottom>i.bottom){const E={...b.attrs,rowspan:Math.min(m.bottom,i.bottom)-Math.max(m.top,i.top)};m.top<i.top?b=b.type.createAndFill(E):b=b.type.create(E,b.content)}d.push(b)}s.push(e.child(l).copy(z.from(d)))}const a=this.isColSelection()&&this.isRowSelection()?e:s;return new P(z.from(a),1,1)}replace(e,n=P.empty){const r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){const{$from:a,$to:l}=i[s],d=e.mapping.slice(r);e.replace(d.map(a.pos),d.map(l.pos),s?P.empty:n)}const o=B.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);o&&e.setSelection(o)}replaceWith(e,n){this.replace(e,new P(z.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=Ee.get(n),i=this.$anchorCell.start(-1),o=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let s=0;s<o.length;s++)e(n.nodeAt(o[s]),i+o[s])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=Ee.get(r),o=e.start(-1),s=i.findCell(e.pos-o),a=i.findCell(n.pos-o),l=e.node(0);return s.top<=a.top?(s.top>0&&(e=l.resolve(o+i.map[s.left])),a.bottom<i.height&&(n=l.resolve(o+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(n=l.resolve(o+i.map[a.left])),s.bottom<i.height&&(e=l.resolve(o+i.map[i.width*(i.height-1)+s.right-1]))),new Se(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=Ee.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),o=n.colCount(this.$headCell.pos-r);if(Math.min(i,o)>0)return!1;const s=i+this.$anchorCell.nodeAfter.attrs.colspan,a=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,a)==n.width}eq(e){return e instanceof Se&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=Ee.get(r),o=e.start(-1),s=i.findCell(e.pos-o),a=i.findCell(n.pos-o),l=e.node(0);return s.left<=a.left?(s.left>0&&(e=l.resolve(o+i.map[s.top*i.width])),a.right<i.width&&(n=l.resolve(o+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(n=l.resolve(o+i.map[a.top*i.width])),s.right<i.width&&(e=l.resolve(o+i.map[i.width*(s.top+1)-1]))),new Se(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Se(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Se(e.resolve(n),e.resolve(r))}getBookmark(){return new Bo(this.$anchorCell.pos,this.$headCell.pos)}};ge.prototype.visible=!1,B.jsonID("cell",ge);var Bo=class Lr{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Lr(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&kr(n,r)?new ge(n,r):B.near(r,1)}};new qe("fix-tables");function Or(t){const e=t.selection,n=Do(t),r=n.node(-1),i=n.start(-1),o=Ee.get(r);return{...e instanceof ge?o.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):o.findCell(n.pos-i),tableStart:i,map:o,table:r}}function Uo(t){return function(e,n){if(!Nr(e))return!1;if(n){const r=jt(e.schema),i=Or(e),o=e.tr,s=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=s.map(l=>i.table.nodeAt(l));for(let l=0;l<s.length;l++)a[l].type==r.header_cell&&o.setNodeMarkup(i.tableStart+s[l],r.cell,a[l].attrs);if(o.steps.length==0)for(let l=0;l<s.length;l++)o.setNodeMarkup(i.tableStart+s[l],r.header_cell,a[l].attrs);n(o)}return!0}}function Rr(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const o=e.table.nodeAt(r[i]);if(o&&o.type!==n.header_cell)return!1}return!0}function Pt(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?Uo(t):function(n,r){if(!Nr(n))return!1;if(r){const i=jt(n.schema),o=Or(n),s=n.tr,a=Rr("row",o,i),l=Rr("column",o,i),u=(t==="column"?a:t==="row"?l:!1)?1:0,f=t=="column"?{left:0,top:u,right:1,bottom:o.map.height}:t=="row"?{left:u,top:0,right:o.map.width,bottom:1}:o,h=t=="column"?l?i.cell:i.header_cell:t=="row"?a?i.cell:i.header_cell:i.cell;o.map.cellsInRect(f).forEach(m=>{const b=m+o.tableStart,w=s.doc.nodeAt(b);w&&s.setNodeMarkup(b,h,w.attrs)}),r(s)}return!0}}Pt("row",{useDeprecatedLogic:!0}),Pt("column",{useDeprecatedLogic:!0}),Pt("cell",{useDeprecatedLogic:!0});function lt(t,e){const n=t.selection;if(!(n instanceof ge))return!1;if(e){const r=t.tr,i=jt(t.schema).cell.createAndFill().content;n.forEachCell((o,s)=>{o.content.eq(i)||r.replace(r.mapping.map(s+1),r.mapping.map(s+o.nodeSize-1),new P(i,0,0))}),r.docChanged&&e(r)}return!0}Io({ArrowLeft:dt("horiz",-1),ArrowRight:dt("horiz",1),ArrowUp:dt("vert",-1),ArrowDown:dt("vert",1),"Shift-ArrowLeft":ut("horiz",-1),"Shift-ArrowRight":ut("horiz",1),"Shift-ArrowUp":ut("vert",-1),"Shift-ArrowDown":ut("vert",1),Backspace:lt,"Mod-Backspace":lt,Delete:lt,"Mod-Delete":lt});function ct(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function dt(t,e){return(n,r,i)=>{if(!i)return!1;const o=n.selection;if(o instanceof ge)return ct(n,r,B.near(o.$headCell,e));if(t!="horiz"&&!o.empty)return!1;const s=Ir(i,t,e);if(s==null)return!1;if(t=="horiz")return ct(n,r,B.near(n.doc.resolve(o.head+e),e));{const a=n.doc.resolve(s),l=Cr(a,t,e);let d;return l?d=B.near(l,1):e<0?d=B.near(n.doc.resolve(a.before(-1)),-1):d=B.near(n.doc.resolve(a.after(-1)),1),ct(n,r,d)}}}function ut(t,e){return(n,r,i)=>{if(!i)return!1;const o=n.selection;let s;if(o instanceof ge)s=o;else{const l=Ir(i,t,e);if(l==null)return!1;s=new ge(n.doc.resolve(l))}const a=Cr(s.$headCell,t,e);return a?ct(n,r,new ge(s.$anchorCell,a)):!1}}function Ir(t,e,n){if(!(t.state.selection instanceof se))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const o=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){const a=r.before(i),l=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(l)?a:null}}return null}new qe("tableColumnResizing");function Ho(t,e){const n=Math.min(t.top,e.top),r=Math.max(t.bottom,e.bottom),i=Math.min(t.left,e.left),s=Math.max(t.right,e.right)-i,a=r-n,l=i,d=n;return new DOMRect(l,d,s,a)}var Fo=class{constructor({editor:t,element:e,view:n,updateDelay:r=250,resizeDelay:i=60,shouldShow:o,appendTo:s,options:a}){this.preventHide=!1,this.isVisible=!1,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:l,state:d,from:u,to:f})=>{const{doc:h,selection:m}=d,{empty:b}=m,w=!h.textBetween(u,f).length&&V.isTextSelection(d.selection),p=this.element.contains(document.activeElement);return!(!(l.hasFocus()||p)||b||w||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:l})=>{var d;if(this.preventHide){this.preventHide=!1;return}l?.relatedTarget&&((d=this.element.parentNode)!=null&&d.contains(l.relatedTarget))||l?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(l,d)=>{const u=!d?.selection.eq(l.state.selection),f=!d?.doc.eq(l.state.doc);!u&&!f||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(l,u,f,d)},this.updateDelay))},this.updateHandler=(l,d,u,f)=>{const{composing:h}=l;if(h||!d&&!u)return;if(!this.getShouldShow(f)){this.hide();return}this.updatePosition(),this.show()},this.editor=t,this.element=e,this.view=n,this.updateDelay=r,this.resizeDelay=i,this.appendTo=s,this.floatingUIOptions={...this.floatingUIOptions,...a},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),window.addEventListener("resize",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&this.show()}get middlewares(){const t=[];return this.floatingUIOptions.flip&&t.push(Qn(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&t.push(Xn(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&t.push(Yn(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&t.push(nr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&t.push(er(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&t.push(Zn(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&t.push(tr(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&t.push(rr(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),t}updatePosition(){const{selection:t}=this.editor.state,e=V.posToDOMRect(this.view,t.from,t.to);let n={getBoundingClientRect:()=>e,getClientRects:()=>[e]};if(t instanceof ae){let r=this.view.nodeDOM(t.from);const i=r.dataset.nodeViewWrapper?r:r.querySelector("[data-node-view-wrapper]");i&&(r=i),r&&(n={getBoundingClientRect:()=>r.getBoundingClientRect(),getClientRects:()=>[r.getBoundingClientRect()]})}if(t instanceof ge){const{$anchorCell:r,$headCell:i}=t,o=r?r.pos:i.pos,s=i?i.pos:r.pos,a=this.view.nodeDOM(o),l=this.view.nodeDOM(s);if(!a||!l)return;const d=a===l?a.getBoundingClientRect():Ho(a.getBoundingClientRect(),l.getBoundingClientRect());n={getBoundingClientRect:()=>d,getClientRects:()=>[d]}}ir(n,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:r,y:i,strategy:o})=>{this.element.style.width="max-content",this.element.style.position=o,this.element.style.left=`${r}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(t,e){const{state:n}=t,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(t,e);return}const i=!e?.selection.eq(t.state.selection),o=!e?.doc.eq(t.state.doc);this.updateHandler(t,i,o,e)}getShouldShow(t){var e;const{state:n}=this.view,{selection:r}=n,{ranges:i}=r,o=Math.min(...i.map(l=>l.$from.pos)),s=Math.max(...i.map(l=>l.$to.pos));return(e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,element:this.element,view:this.view,state:n,oldState:t,from:o,to:s})}show(){var t,e;this.isVisible||(this.element.style.visibility="visible",this.element.style.opacity="1",(e=(t=this.appendTo)!=null?t:this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Mr=t=>new Er({key:typeof t.pluginKey=="string"?new qe(t.pluginKey):t.pluginKey,view:e=>new Fo({view:e,...t})});V.Extension.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Mr({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});var $o=class{constructor({editor:t,element:e,view:n,options:r,shouldShow:i}){this.preventHide=!1,this.isVisible=!1,this.shouldShow=({view:o,state:s})=>{const{selection:a}=s,{$anchor:l,empty:d}=a,u=l.depth===1,f=l.parent.isTextblock&&!l.parent.type.spec.code&&!l.parent.textContent&&l.parent.childCount===0&&!this.getTextContent(l.parent);return!(!o.hasFocus()||!d||!u||!f||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(o,s,a,l)=>{const{composing:d}=o;if(d||!s&&!a)return;if(!this.getShouldShow(l)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:o})=>{var s;if(this.preventHide){this.preventHide=!1;return}o?.relatedTarget&&((s=this.element.parentNode)!=null&&s.contains(o.relatedTarget))||o?.relatedTarget!==this.editor.view.dom&&this.hide()},this.editor=t,this.element=e,this.view=n,this.floatingUIOptions={...this.floatingUIOptions,...r},this.element.tabIndex=0,i&&(this.shouldShow=i),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.update(n,n.state),this.getShouldShow()&&this.show()}getTextContent(t){return V.getText(t,{textSerializers:V.getTextSerializersFromSchema(this.editor.schema)})}get middlewares(){const t=[];return this.floatingUIOptions.flip&&t.push(Qn(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&t.push(Xn(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&t.push(Yn(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&t.push(nr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&t.push(er(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&t.push(Zn(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&t.push(tr(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&t.push(rr(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),t}getShouldShow(t){var e;const{state:n}=this.view,{selection:r}=n,{ranges:i}=r,o=Math.min(...i.map(l=>l.$from.pos)),s=Math.max(...i.map(l=>l.$to.pos));return(e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,view:this.view,state:n,oldState:t,from:o,to:s})}updatePosition(){const{selection:t}=this.editor.state,e=V.posToDOMRect(this.view,t.from,t.to);ir({getBoundingClientRect:()=>e,getClientRects:()=>[e]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:r,y:i,strategy:o})=>{this.element.style.width="max-content",this.element.style.position=o,this.element.style.left=`${r}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(t,e){const n=!e?.selection.eq(t.state.selection),r=!e?.doc.eq(t.state.doc);this.updateHandler(t,n,r,e)}show(){var t;this.isVisible||(this.element.style.visibility="visible",this.element.style.opacity="1",(t=this.view.dom.parentElement)==null||t.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},_r=t=>new Er({key:typeof t.pluginKey=="string"?new qe(t.pluginKey):t.pluginKey,view:e=>new $o({view:e,...t})});V.Extension.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[_r({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,options:this.options.options,shouldShow:this.options.shouldShow})]:[]}});var Jo=k.forwardRef(({pluginKey:t="bubbleMenu",editor:e,updateDelay:n,resizeDelay:r,shouldShow:i=null,options:o,children:s,...a},l)=>{const d=k.useRef(document.createElement("div"));typeof l=="function"?l(d.current):l&&(l.current=d.current);const{editor:u}=G.useCurrentEditor();return k.useEffect(()=>{const f=d.current;if(f.style.visibility="hidden",f.style.position="absolute",e?.isDestroyed||u?.isDestroyed)return;const h=e||u;if(!h){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const m=Mr({updateDelay:n,resizeDelay:r,editor:h,element:f,pluginKey:t,shouldShow:i,options:o});return h.registerPlugin(m),()=>{h.unregisterPlugin(t),window.requestAnimationFrame(()=>{f.parentNode&&f.parentNode.removeChild(f)})}},[e,u]),Jt.createPortal(c.jsx("div",{...a,children:s}),d.current)}),Vo=k.forwardRef(({pluginKey:t="floatingMenu",editor:e,shouldShow:n=null,options:r,children:i,...o},s)=>{const a=k.useRef(document.createElement("div"));typeof s=="function"?s(a.current):s&&(s.current=a.current);const{editor:l}=G.useCurrentEditor();return k.useEffect(()=>{const d=a.current;if(d.style.visibility="hidden",d.style.position="absolute",e?.isDestroyed||l?.isDestroyed)return;const u=e||l;if(!u){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const f=_r({editor:u,element:d,pluginKey:t,shouldShow:n,options:r});return u.registerPlugin(f),()=>{u.unregisterPlugin(t),window.requestAnimationFrame(()=>{d.parentNode&&d.parentNode.removeChild(d)})}},[e,l]),Jt.createPortal(c.jsx("div",{...o,children:i}),a.current)});const qo=({editor:t,isReadOnly:e})=>{const[n,r]=k.useState(!1),[i,o]=k.useState(!1),[s,a]=k.useState(""),[l,d]=k.useState(!1),u=()=>{s&&(t.chain().focus().extendMarkRange("link").setLink({href:s}).run(),a(""),d(!1))};return e?null:c.jsx(Jo,{editor:t,className:"bubble-menu bg-white border border-gray-300 rounded-lg p-2 shadow-lg z-50",children:c.jsxs("div",{className:"flex gap-1 items-center",children:[c.jsx(_,{onClick:()=>t.chain().focus().toggleBold().run(),isActive:t.isActive("bold"),title:"Bold",children:c.jsx(O.Bold,{className:"h-4 w-4 cursor-pointer"})}),c.jsx(_,{onClick:()=>t.chain().focus().toggleItalic().run(),isActive:t.isActive("italic"),title:"Italic",children:c.jsx(O.Italic,{className:"h-4 w-4 cursor-pointer"})}),c.jsx(_,{onClick:()=>t.chain().focus().toggleUnderline().run(),isActive:t.isActive("underline"),title:"Underline",children:c.jsx(O.Underline,{className:"h-4 w-4 cursor-pointer"})}),c.jsx(_,{onClick:()=>t.chain().focus().toggleStrike().run(),isActive:t.isActive("strike"),title:"Strikethrough",children:c.jsx(O.Strikethrough,{className:"h-4 w-4 cursor-pointer"})}),c.jsx(_,{onClick:()=>t.chain().focus().toggleCode().run(),isActive:t.isActive("code"),title:"Inline Code",children:c.jsx(O.Code,{className:"h-4 w-4 cursor-pointer"})}),c.jsxs("div",{className:"relative",children:[c.jsx(_,{onClick:()=>r(!n),title:"Text Color",children:c.jsx(O.Type,{className:"h-4 w-4 cursor-pointer"})}),n&&c.jsx("div",{className:"absolute top-full mt-1 z-10 bg-white border border-gray-300 rounded-lg p-2 shadow-lg",children:c.jsx(Tn,{onColorChange:f=>{t.chain().focus().setColor(f).run(),r(!1)}})})]}),c.jsxs("div",{className:"relative",children:[c.jsx(_,{onClick:()=>o(!i),title:"Background Color",children:c.jsx(O.Palette,{className:"h-4 w-4 cursor-pointer"})}),i&&c.jsx("div",{className:"absolute top-full mt-1 z-10 bg-white border border-gray-300 rounded-lg p-2 shadow-lg",children:c.jsx(Tn,{onColorChange:f=>{t.chain().focus().toggleHighlight({color:f}).run(),o(!1)}})})]}),c.jsxs("div",{className:"relative",children:[c.jsx(_,{onClick:()=>d(!l),isActive:t.isActive("link"),title:"Add/Edit Link",children:c.jsx(O.Link,{className:"h-4 w-4 cursor-pointer"})}),l&&c.jsx("div",{className:"absolute top-full mt-1 z-10 bg-white border border-gray-300 rounded-lg p-2 shadow-lg",children:c.jsxs("div",{className:"flex gap-2",children:[c.jsx("input",{type:"url",placeholder:"Enter URL...",value:s,onChange:f=>a(f.target.value),className:"px-2 py-1 text-sm border border-gray-300 rounded",onKeyDown:f=>{f.key==="Enter"&&u()}}),c.jsx(ee,{type:"button",onClick:u,size:"sm",className:"h-8 cursor-pointer",children:"Set"})]})})]})]})})},Wo=({editor:t,isReadOnly:e,onImageClick:n})=>e?null:c.jsxs(Vo,{editor:t,className:"floating-menu bg-white border border-gray-300 rounded-lg p-2 shadow-lg flex gap-1 z-50",children:[c.jsx(_,{onClick:()=>t.chain().focus().toggleHeading({level:1}).run(),title:"Heading 1",children:c.jsx(O.Heading1,{className:"h-4 w-4"})}),c.jsx(_,{onClick:()=>t.chain().focus().toggleHeading({level:2}).run(),title:"Heading 2",children:c.jsx(O.Heading2,{className:"h-4 w-4"})}),c.jsx(_,{onClick:()=>t.chain().focus().toggleHeading({level:3}).run(),title:"Heading 3",children:c.jsx(O.Heading3,{className:"h-4 w-4"})}),c.jsx(_,{onClick:()=>t.chain().focus().setParagraph().run(),title:"Paragraph",children:c.jsx(O.FileText,{className:"h-4 w-4"})}),c.jsx(_,{onClick:n,title:"Insert Image",children:c.jsx(O.Image,{className:"h-4 w-4"})})]}),Ko=({editor:t,isReadOnly:e,position:n})=>!n.show||e?null:c.jsxs("div",{className:"table-bubble-menu bg-white border-2 border-blue-500 rounded-lg p-2 shadow-lg",style:{position:"absolute",top:`${n.top}px`,left:`${n.left}px`,zIndex:50,backdropFilter:"blur(8px)",background:"rgba(255, 255, 255, 0.95)"},children:[c.jsxs("div",{className:"flex gap-1 items-center",children:[c.jsx(_,{onClick:()=>t.chain().focus().addRowBefore().run(),title:"Add Row Before",className:"h-8 w-auto px-2",children:c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(O.Plus,{className:"h-3 w-3"}),c.jsx("span",{className:"text-xs",children:"↑ Row"})]})}),c.jsx(_,{onClick:()=>t.chain().focus().addRowAfter().run(),title:"Add Row After",className:"h-8 w-auto px-2",children:c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(O.Plus,{className:"h-3 w-3"}),c.jsx("span",{className:"text-xs",children:"Row ↓"})]})}),c.jsx("div",{className:"h-6 w-px bg-gray-300 mx-1"}),c.jsx(_,{onClick:()=>t.chain().focus().addColumnBefore().run(),title:"Add Column Before",className:"h-8 w-auto px-2",children:c.jsxs("div",{className:"flex items-center gap-1",children:["ß",c.jsx(O.Plus,{className:"h-3 w-3"}),c.jsx("span",{className:"text-xs",children:"← Col"})]})}),c.jsx(_,{onClick:()=>t.chain().focus().addColumnAfter().run(),title:"Add Column After",className:"h-8 w-auto px-2",children:c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(O.Plus,{className:"h-3 w-3"}),c.jsx("span",{className:"text-xs",children:"Col →"})]})}),c.jsx("div",{className:"h-6 w-px bg-gray-300 mx-1"}),c.jsx(_,{onClick:()=>t.chain().focus().deleteColumn().run(),title:"Delete Column",className:"text-red-600 hover:bg-red-50 h-8 w-auto px-2",children:c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(O.Minus,{className:"h-3 w-3"}),c.jsx("span",{className:"text-xs",children:"Col"})]})}),c.jsx("div",{className:"h-6 w-px bg-gray-300 mx-1"}),c.jsx(_,{onClick:()=>t.chain().focus().deleteRow().run(),title:"Delete Row",className:"text-red-600 hover:bg-red-50 h-8 w-auto px-2",children:c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(O.Minus,{className:"h-3 w-3"}),c.jsx("span",{className:"text-xs",children:"Row"})]})}),c.jsx(_,{onClick:()=>t.chain().focus().deleteTable().run(),title:"Delete Table",className:"text-red-600 hover:bg-red-50",children:c.jsx(O.Trash2,{className:"h-4 w-4"})})]}),c.jsx("div",{className:"absolute top-full left-5 w-0 h-0 border-l-6 border-r-6 border-t-6 border-l-transparent border-r-transparent border-t-blue-500"})]}),Go=({editor:t})=>c.jsxs("div",{className:"mb-2 p-2 bg-gray-100 rounded text-xs",children:[c.jsx("strong",{children:"Debug:"})," Current position - H1:"," ",t.isActive("heading",{level:1})?"✅":"❌"," | H2:"," ",t.isActive("heading",{level:2})?"✅":"❌"," | H3:"," ",t.isActive("heading",{level:3})?"✅":"❌"," | P:"," ",t.isActive("paragraph")?"✅":"❌"," | Bold:"," ",t.isActive("bold")?"✅":"❌"," | List:"," ",t.isActive("bulletList")?"✅":"❌"," | Table:"," ",t.isActive("table")?"✅":"❌"]}),Yo=({isReadOnly:t,setIsReadOnly:e,onLogContent:n})=>c.jsxs("div",{className:"mb-4 flex justify-end gap-2",children:[c.jsxs(ee,{type:"button",onClick:n,variant:"outline",size:"sm",className:"flex items-center gap-2",title:"Log content to console for backend storage",children:[c.jsx(O.Terminal,{className:"h-4 w-4"}),"Log Content"]}),c.jsx(ee,{type:"button",onClick:()=>e(!t),variant:t?"default":"outline",size:"sm",className:"flex items-center gap-2",children:t?c.jsxs(c.Fragment,{children:[c.jsx(O.Lock,{className:"h-4 w-4"}),"Read Only"]}):c.jsxs(c.Fragment,{children:[c.jsx(O.LockOpen,{className:"h-4 w-4"}),"Editable"]})})]}),Zo=t=>{const e={html:t.getHTML(),json:t.getJSON(),text:t.getText(),isEmpty:t.isEmpty,characterCount:t.storage.characterCount?.characters()||t.getText().length,wordCount:t.storage.characterCount?.words()||t.getText().split(/\s+/).filter(n=>n.length>0).length,timestamp:new Date().toISOString()};return console.log("📄 Tiptap Editor Content for Backend Storage:"),console.log("================================================"),console.log("📋 HTML Output (for rendering):",e.html),console.log("📋 JSON Output (for editing):",e.json),console.log("📋 Plain Text:",e.text),console.log("📊 Stats:",{isEmpty:e.isEmpty,characters:e.characterCount,words:e.wordCount,timestamp:e.timestamp}),console.log("================================================"),e},Xo=({onImageUpload:t,onVideoUpload:e,setEditorContent:n})=>{const[r,i]=k.useState(""),[o,s]=k.useState(!1),[,a]=k.useState({}),[l,d]=k.useState(!1),[u,f]=k.useState(!1),[h,m]=k.useState(!1),[b,w]=k.useState({top:0,left:0,show:!1}),p=G.useEditor({extensions:[Kt,Gt,Ut,Ft,Ht,Yt,Zt,pn,mn,Xt,Qt,en,hn,gn,bn,wn,xn,yn,vn,En,Sn.configure({inline:!1,allowBase64:!0,HTMLAttributes:{class:"max-w-full h-auto rounded-lg shadow-sm"}})],content:`
|
|
23
23
|
<p>Welcome to the Advanced Tiptap Editor! This editor includes all the features you requested. Try them out!</p>
|
|
24
24
|
<p>You can use:</p>
|
|
25
25
|
<ul>
|
package/package.json
CHANGED