@sovann72-dev/lynqify-ui 1.0.2 → 1.0.3

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.
@@ -15,31 +15,31 @@ import Yr from "@tiptap/extension-heading";
15
15
  import { default as Ji } from "@tiptap/extension-heading";
16
16
  import Xr from "@tiptap/extension-highlight";
17
17
  import { default as Hi } from "@tiptap/extension-highlight";
18
- import Gr from "@tiptap/extension-image";
19
- import { default as ji } from "@tiptap/extension-image";
20
18
  import Mt from "@tiptap/extension-italic";
21
- import { default as qi } from "@tiptap/extension-italic";
22
- import Zr from "@tiptap/extension-link";
23
- import { default as Yi } from "@tiptap/extension-link";
24
- import { BulletList as Pt, ListItem as Dt, OrderedList as _t, TaskItem as $t, ListKeymap as Qr, TaskList as en } from "@tiptap/extension-list";
25
- import { BulletList as Gi, ListItem as Zi, ListKeymap as Qi, OrderedList as es, TaskItem as ts, TaskList as rs } from "@tiptap/extension-list";
26
- import tn from "@tiptap/extension-mention";
27
- import { default as is } from "@tiptap/extension-mention";
19
+ import { default as ji } from "@tiptap/extension-italic";
20
+ import { BulletList as Pt, ListItem as Dt, OrderedList as _t, TaskItem as $t, ListKeymap as Gr, TaskList as Zr } from "@tiptap/extension-list";
21
+ import { BulletList as qi, ListItem as Ki, ListKeymap as Yi, OrderedList as Xi, TaskItem as Gi, TaskList as Zi } from "@tiptap/extension-list";
22
+ import Qr from "@tiptap/extension-mention";
23
+ import { default as es } from "@tiptap/extension-mention";
28
24
  import Bt from "@tiptap/extension-paragraph";
29
- import { default as os } from "@tiptap/extension-paragraph";
30
- import { Table as rn, TableCell as nn, TableHeader as sn, TableRow as on } from "@tiptap/extension-table";
31
- import { Table as ls, TableCell as cs, TableHeader as ds, TableRow as us } from "@tiptap/extension-table";
25
+ import { default as rs } from "@tiptap/extension-paragraph";
26
+ import { Table as en, TableCell as tn, TableHeader as rn, TableRow as nn } from "@tiptap/extension-table";
27
+ import { Table as is, TableCell as ss, TableHeader as os, TableRow as as } from "@tiptap/extension-table";
32
28
  import Ft from "@tiptap/extension-text";
33
- import { default as hs } from "@tiptap/extension-text";
29
+ import { default as cs } from "@tiptap/extension-text";
34
30
  import Jt from "@tiptap/extension-text-align";
35
- import { default as ms } from "@tiptap/extension-text-align";
31
+ import { default as us } from "@tiptap/extension-text-align";
36
32
  import { TextStyle as Wt } from "@tiptap/extension-text-style";
37
- import { TextStyle as ys } from "@tiptap/extension-text-style";
33
+ import { TextStyle as hs } from "@tiptap/extension-text-style";
38
34
  import Ht from "@tiptap/extension-underline";
39
- import { default as ws } from "@tiptap/extension-underline";
40
- import { UndoRedo as Vt, CharacterCount as an, Placeholder as ln } from "@tiptap/extensions";
41
- import { CharacterCount as Is, UndoRedo as Ss, Placeholder as Es } from "@tiptap/extensions";
42
- import { Extension as ge, Node as cn } from "@tiptap/core";
35
+ import { default as ms } from "@tiptap/extension-underline";
36
+ import { UndoRedo as Vt, CharacterCount as sn, Placeholder as on } from "@tiptap/extensions";
37
+ import { CharacterCount as ys, UndoRedo as vs, Placeholder as ws } from "@tiptap/extensions";
38
+ import an from "@tiptap/extension-link";
39
+ import { default as Is } from "@tiptap/extension-link";
40
+ import { Extension as ge, Node as ln } from "@tiptap/core";
41
+ import cn from "@tiptap/extension-image";
42
+ import { default as Es } from "@tiptap/extension-image";
43
43
  import { Extension as dn } from "@tiptap/react";
44
44
  import { Editor as Ts, EditorContent as Rs, useEditor as Cs } from "@tiptap/react";
45
45
  import * as De from "react";
@@ -1576,7 +1576,7 @@ class vn {
1576
1576
  return e[this.key];
1577
1577
  }
1578
1578
  }
1579
- const sr = Zr.extend({
1579
+ const sr = an.extend({
1580
1580
  addAttributes() {
1581
1581
  var n;
1582
1582
  return {
@@ -2013,7 +2013,7 @@ class bn {
2013
2013
  window.removeEventListener("resize", this.handleResize), this.resizeTimeout && clearTimeout(this.resizeTimeout), this.rafId && cancelAnimationFrame(this.rafId);
2014
2014
  }
2015
2015
  }
2016
- const ar = Gr.extend({
2016
+ const ar = cn.extend({
2017
2017
  name: "imageResize",
2018
2018
  addOptions() {
2019
2019
  var n;
@@ -2660,7 +2660,7 @@ const Vn = Jn.extend({
2660
2660
  }
2661
2661
  }), Ti = [
2662
2662
  Nt,
2663
- an,
2663
+ sn,
2664
2664
  Lt,
2665
2665
  At,
2666
2666
  Kr,
@@ -2669,16 +2669,16 @@ const Vn = Jn.extend({
2669
2669
  ar,
2670
2670
  sr,
2671
2671
  Dt,
2672
+ Gr,
2672
2673
  Qr,
2673
- tn,
2674
2674
  _t,
2675
- ln,
2675
+ on,
2676
+ en,
2677
+ tn,
2676
2678
  rn,
2677
2679
  nn,
2678
- sn,
2679
- on,
2680
2680
  $t,
2681
- en,
2681
+ Zr,
2682
2682
  Jt,
2683
2683
  Wt,
2684
2684
  Ht,
@@ -3453,7 +3453,7 @@ const ei = ({
3453
3453
  }
3454
3454
  );
3455
3455
  let fe = null;
3456
- const ki = cn.create({
3456
+ const ki = ln.create({
3457
3457
  name: "batchSegmentImages",
3458
3458
  group: "block",
3459
3459
  inline: !1,
@@ -3760,8 +3760,8 @@ export {
3760
3760
  Ri as BASE_EXTENSIONS,
3761
3761
  ki as BatchSegmentImagesExtension,
3762
3762
  Li as Bold,
3763
- Gi as BulletList,
3764
- Is as CharacterCount,
3763
+ qi as BulletList,
3764
+ ys as CharacterCount,
3765
3765
  zi as Color,
3766
3766
  Vn as CustomBulletList,
3767
3767
  sr as CustomLink,
@@ -3777,30 +3777,30 @@ export {
3777
3777
  Bi as HardBreak,
3778
3778
  Ji as Heading,
3779
3779
  Hi as Highlight,
3780
- Ss as History,
3781
- ji as Image,
3780
+ vs as History,
3781
+ Es as Image,
3782
3782
  ar as ImageResize,
3783
3783
  Fn as IndentExtension,
3784
- qi as Italic,
3784
+ ji as Italic,
3785
3785
  ur as LineHeight,
3786
- Yi as Link,
3786
+ Is as Link,
3787
3787
  Kn as ListIndentIntegration,
3788
- Zi as ListItem,
3789
- Qi as ListKeymap,
3790
- is as Mention,
3788
+ Ki as ListItem,
3789
+ Yi as ListKeymap,
3790
+ es as Mention,
3791
3791
  Ci as MentionStorage,
3792
- es as OrderedList,
3793
- os as Paragraph,
3794
- Es as Placeholder,
3795
- ls as Table,
3796
- cs as TableCell,
3797
- ds as TableHeader,
3798
- us as TableRow,
3799
- ts as TaskItem,
3800
- rs as TaskList,
3801
- hs as Text,
3802
- ms as TextAlign,
3803
- ys as TextStyle,
3804
- ws as Underline,
3792
+ Xi as OrderedList,
3793
+ rs as Paragraph,
3794
+ ws as Placeholder,
3795
+ is as Table,
3796
+ ss as TableCell,
3797
+ os as TableHeader,
3798
+ as as TableRow,
3799
+ Gi as TaskItem,
3800
+ Zi as TaskList,
3801
+ cs as Text,
3802
+ us as TextAlign,
3803
+ hs as TextStyle,
3804
+ ms as Underline,
3805
3805
  Cs as useEditor
3806
3806
  };
@@ -1,4 +1,4 @@
1
- (function(h,$){typeof exports=="object"&&typeof module<"u"?$(exports,require("@tiptap/extension-bold"),require("@tiptap/extension-color"),require("@tiptap/extension-document"),require("@tiptap/extension-file-handler"),require("@tiptap/extension-hard-break"),require("@tiptap/extension-heading"),require("@tiptap/extension-highlight"),require("@tiptap/extension-image"),require("@tiptap/extension-italic"),require("@tiptap/extension-link"),require("@tiptap/extension-list"),require("@tiptap/extension-mention"),require("@tiptap/extension-paragraph"),require("@tiptap/extension-table"),require("@tiptap/extension-text"),require("@tiptap/extension-text-align"),require("@tiptap/extension-text-style"),require("@tiptap/extension-underline"),require("@tiptap/extensions"),require("@tiptap/core"),require("@tiptap/react"),require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","@tiptap/extension-bold","@tiptap/extension-color","@tiptap/extension-document","@tiptap/extension-file-handler","@tiptap/extension-hard-break","@tiptap/extension-heading","@tiptap/extension-highlight","@tiptap/extension-image","@tiptap/extension-italic","@tiptap/extension-link","@tiptap/extension-list","@tiptap/extension-mention","@tiptap/extension-paragraph","@tiptap/extension-table","@tiptap/extension-text","@tiptap/extension-text-align","@tiptap/extension-text-style","@tiptap/extension-underline","@tiptap/extensions","@tiptap/core","@tiptap/react","react","react-dom"],$):(h=typeof globalThis<"u"?globalThis:h||self,$(h.LynqifyUI={},h.Bold,h.Color,h.Document,h.FileHandler,h.HardBreak,h.Heading,h.Highlight,h.Image,h.Italic,h.Link,h.extensionList,h.Mention,h.Paragraph,h.extensionTable,h.Text,h.TextAlign,h.extensionTextStyle,h.Underline,h.extensions,h.TipTapCore,h.TipTapReact,h.React,h.ReactDOM))})(this,(function(h,$,X,Pe,gt,De,yt,vt,wt,_e,St,D,It,Be,Y,$e,Fe,Je,We,Z,se,Ee,He,xn){"use strict";var Kr=Object.defineProperty;var Xr=(h,$,X)=>$ in h?Kr(h,$,{enumerable:!0,configurable:!0,writable:!0,value:X}):h[$]=X;var R=(h,$,X)=>Xr(h,typeof $!="symbol"?$+"":$,X);function Tn(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const je=Tn(He);function bt(r,e,t){for(let n=0;;n++){if(n==r.childCount||n==e.childCount)return r.childCount==e.childCount?null:t;let i=r.child(n),s=e.child(n);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let l=0;i.text[l]==s.text[l];l++)t++;return t}if(i.content.size||s.content.size){let l=bt(i.content,s.content,t+1);if(l!=null)return l}t+=i.nodeSize}}function Et(r,e,t,n){for(let i=r.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:n};let l=r.child(--i),a=e.child(--s),c=l.nodeSize;if(l==a){t-=c,n-=c;continue}if(!l.sameMarkup(a))return{a:t,b:n};if(l.isText&&l.text!=a.text){let f=0,u=Math.min(l.text.length,a.text.length);for(;f<u&&l.text[l.text.length-f-1]==a.text[a.text.length-f-1];)f++,t--,n--;return{a:t,b:n}}if(l.content.size||a.content.size){let f=Et(l.content,a.content,t-1,n-1);if(f)return f}t-=c,n-=c}}class O{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,i=0,s){for(let l=0,a=0;a<t;l++){let c=this.content[l],f=a+c.nodeSize;if(f>e&&n(c,i+a,s||null,l)!==!1&&c.content.size){let u=a+1;c.nodesBetween(Math.max(0,e-u),Math.min(c.content.size,t-u),n,i+u)}a=f}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,i){let s="",l=!0;return this.nodesBetween(e,t,(a,c)=>{let f=a.isText?a.text.slice(Math.max(e,c)-c,t-c):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&f||a.isTextblock)&&n&&(l?l=!1:s+=n),s+=f},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(n)&&(i[i.length-1]=t.withText(t.text+n.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new O(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let n=[],i=0;if(t>e)for(let s=0,l=0;l<t;s++){let a=this.content[s],c=l+a.nodeSize;c>e&&((l<e||c>t)&&(a.isText?a=a.cut(Math.max(0,e-l),Math.min(a.text.length,t-l)):a=a.cut(Math.max(0,e-l-1),Math.min(a.content.size,t-l-1))),n.push(a),i+=a.nodeSize),l=c}return new O(n,i)}cutByIndex(e,t){return e==t?O.empty:e==0&&t==this.content.length?this:new O(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-n.nodeSize;return i[e]=t,new O(i,s)}addToStart(e){return new O([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new O(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))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 t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let i=this.content[t];e(i,n,t),n+=i.nodeSize}}findDiffStart(e,t=0){return bt(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Et(this,e,t,n)}findIndex(e){if(e==0)return xe(0,e);if(e==this.size)return xe(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let i=this.child(t),s=n+i.nodeSize;if(s>=e)return s==e?xe(t+1,s):xe(t,n);n=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return O.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new O(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return O.empty;let t,n=0;for(let i=0;i<e.length;i++){let s=e[i];n+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new O(t||e,n)}static from(e){if(!e)return O.empty;if(e instanceof O)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new O([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}O.empty=new O([],0);const qe={index:0,offset:0};function xe(r,e){return qe.index=r,qe.offset=e,qe}class Rn extends Error{}class T{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=Tt(this.content,e+this.openStart,t);return n&&new T(n,this.openStart,this.openEnd)}removeBetween(e,t){return new T(xt(this.content,e+this.openStart,t+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,t){if(!t)return T.empty;let n=t.openStart||0,i=t.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new T(O.fromJSON(e,t.content),n,i)}static maxOpen(e,t=!0){let n=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)n++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new T(e,n,i)}}T.empty=new T(O.empty,0,0);function xt(r,e,t){let{index:n,offset:i}=r.findIndex(e),s=r.maybeChild(n),{index:l,offset:a}=r.findIndex(t);if(i==e||s.isText){if(a!=t&&!r.child(l).isText)throw new RangeError("Removing non-flat range");return r.cut(0,e).append(r.cut(t))}if(n!=l)throw new RangeError("Removing non-flat range");return r.replaceChild(n,s.copy(xt(s.content,e-i-1,t-i-1)))}function Tt(r,e,t,n){let{index:i,offset:s}=r.findIndex(e),l=r.maybeChild(i);if(s==e||l.isText)return n&&!n.canReplace(i,i,t)?null:r.cut(0,e).append(t).append(r.cut(e));let a=Tt(l.content,e-s-1,t,l);return a&&r.replaceChild(i,l.copy(a))}class Rt{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Ot=65535,Ct=Math.pow(2,16);function On(r,e){return r+e*Ct}function kt(r){return r&Ot}function Cn(r){return(r-(r&Ot))/Ct}const Nt=1,Lt=2,Te=4,At=8;class zt{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&At)>0}get deletedBefore(){return(this.delInfo&(Nt|Te))>0}get deletedAfter(){return(this.delInfo&(Lt|Te))>0}get deletedAcross(){return(this.delInfo&Te)>0}}class j{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&j.empty)return j.empty}recover(e){let t=0,n=kt(e);if(!this.inverted)for(let i=0;i<n;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[n*3]+t+Cn(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let i=0,s=this.inverted?2:1,l=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?i:0);if(c>e)break;let f=this.ranges[a+s],u=this.ranges[a+l],p=c+f;if(e<=p){let y=f?e==c?-1:e==p?1:t:t,w=c+i+(y<0?0:u);if(n)return w;let g=e==(t<0?c:p)?null:On(a/3,e-c),b=e==c?Lt:e==p?Nt:Te;return(t<0?e!=c:e!=p)&&(b|=At),new zt(w,b,g)}i+=u-f}return n?e+i:new zt(e+i,0,null)}touches(e,t){let n=0,i=kt(t),s=this.inverted?2:1,l=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?n:0);if(c>e)break;let f=this.ranges[a+s],u=c+f;if(e<=u&&a==i*3)return!0;n+=this.ranges[a+l]-f}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let l=this.ranges[i],a=l-(this.inverted?s:0),c=l+(this.inverted?0:s),f=this.ranges[i+t],u=this.ranges[i+n];e(a,a+f,c,c+u),s+=u-f}}invert(){return new j(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?j.empty:new j(e<0?[0,-e,0]:[0,0,e])}}j.empty=new j([]);const Ve=Object.create(null);class _{getMap(){return j.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=Ve[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Ve)throw new RangeError("Duplicate use of step JSON ID "+e);return Ve[e]=t,t.prototype.jsonID=e,t}}class N{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new N(e,null)}static fail(e){return new N(null,e)}static fromReplace(e,t,n,i){try{return N.ok(e.replace(t,n,i))}catch(s){if(s instanceof Rn)return N.fail(s.message);throw s}}}function Ue(r,e,t){let n=[];for(let i=0;i<r.childCount;i++){let s=r.child(i);s.content.size&&(s=s.copy(Ue(s.content,e,s))),s.isInline&&(s=e(s,t,i)),n.push(s)}return O.fromArray(n)}class Q extends _{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),i=n.node(n.sharedDepth(this.to)),s=new T(Ue(t.content,(l,a)=>!l.isAtom||!a.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),i),t.openStart,t.openEnd);return N.fromReplace(e,this.from,this.to,s)}invert(){return new ee(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Q(t.pos,n.pos,this.mark)}merge(e){return e instanceof Q&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Q(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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Q(t.from,t.to,e.markFromJSON(t.mark))}}_.jsonID("addMark",Q);class ee extends _{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new T(Ue(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return N.fromReplace(e,this.from,this.to,n)}invert(){return new Q(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new ee(t.pos,n.pos,this.mark)}merge(e){return e instanceof ee&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ee(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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ee(t.from,t.to,e.markFromJSON(t.mark))}}_.jsonID("removeMark",ee);class te extends _{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return N.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return N.fromReplace(e,this.pos,this.pos+1,new T(O.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let n=this.mark.addToSet(t.marks);if(n.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(n))return new te(this.pos,t.marks[i]);return new te(this.pos,this.mark)}}return new he(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new te(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new te(t.pos,e.markFromJSON(t.mark))}}_.jsonID("addNodeMark",te);class he extends _{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return N.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return N.fromReplace(e,this.pos,this.pos+1,new T(O.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new te(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new he(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new he(t.pos,e.markFromJSON(t.mark))}}_.jsonID("removeNodeMark",he);class V extends _{constructor(e,t,n,i=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=i}apply(e){return this.structure&&Ke(e,this.from,this.to)?N.fail("Structure replace would overwrite content"):N.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new j([this.from,this.to-this.from,this.slice.size])}invert(e){return new V(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),n=this.from==this.to&&V.MAP_BIAS<0?t:e.mapResult(this.from,1);return n.deletedAcross&&t.deletedAcross?null:new V(n.pos,Math.max(n.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof V)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?T.empty:new T(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new V(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?T.empty:new T(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new V(e.from,this.to,t,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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new V(t.from,t.to,T.fromJSON(e,t.slice),!!t.structure)}}V.MAP_BIAS=1,_.jsonID("replace",V);class oe extends _{constructor(e,t,n,i,s,l,a=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=i,this.slice=s,this.insert=l,this.structure=a}apply(e){if(this.structure&&(Ke(e,this.from,this.gapFrom)||Ke(e,this.gapTo,this.to)))return N.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return N.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?N.fromReplace(e,this.from,this.to,n):N.fail("Content does not fit in gap")}getMap(){return new j([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new oe(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||i<t.pos||s>n.pos?null:new oe(t.pos,n.pos,i,s,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,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new oe(t.from,t.to,t.gapFrom,t.gapTo,T.fromJSON(e,t.slice),t.insert,!!t.structure)}}_.jsonID("replaceAround",oe);function Ke(r,e,t){let n=r.resolve(e),i=t-e,s=n.depth;for(;i>0&&s>0&&n.indexAfter(s)==n.node(s).childCount;)s--,i--;if(i>0){let l=n.node(s).maybeChild(n.indexAfter(s));for(;i>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,i--}}return!1}function kn(r,e,t){return(e==0||r.canReplace(e,r.childCount))&&(t==r.childCount||r.canReplace(0,t))}function Mt(r){let t=r.parent.content.cutByIndex(r.startIndex,r.endIndex);for(let n=r.depth,i=0,s=0;;--n){let l=r.$from.node(n),a=r.$from.index(n)+i,c=r.$to.indexAfter(n)-s;if(n<r.depth&&l.canReplace(a,c,t))return n;if(n==0||l.type.spec.isolating||!kn(l,a,c))break;a&&(i=1),c<l.childCount&&(s=1)}return null}class pe extends _{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return N.fail("No node at attribute step's position");let n=Object.create(null);for(let s in t.attrs)n[s]=t.attrs[s];n[this.attr]=this.value;let i=t.type.create(n,null,t.marks);return N.fromReplace(e,this.pos,this.pos+1,new T(O.from(i),0,t.isLeaf?0:1))}getMap(){return j.empty}invert(e){return new pe(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new pe(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new pe(t.pos,t.attr,t.value)}}_.jsonID("attr",pe);class Re extends _{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return N.ok(n)}getMap(){return j.empty}invert(e){return new Re(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Re(t.attr,t.value)}}_.jsonID("docAttr",Re);let me=class extends Error{};me=function r(e){let t=Error.call(this,e);return t.__proto__=r.prototype,t},me.prototype=Object.create(Error.prototype),me.prototype.constructor=me,me.prototype.name="TransformError";const Xe=Object.create(null);class z{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Nn(e.min(t),e.max(t))]}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 t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=T.empty){let n=t.content.lastChild,i=null;for(let a=0;a<t.openEnd;a++)i=n,n=n.lastChild;let s=e.steps.length,l=this.ranges;for(let a=0;a<l.length;a++){let{$from:c,$to:f}=l[a],u=e.mapping.slice(s);e.replaceRange(u.map(c.pos),u.map(f.pos),a?T.empty:t),a==0&&_t(e,s,(n?n.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:l,$to:a}=i[s],c=e.mapping.slice(n),f=c.map(l.pos),u=c.map(a.pos);s?e.deleteRange(f,u):(e.replaceRangeWith(f,u,t),_t(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let i=e.parent.inlineContent?new F(e):ae(e.node(0),e.parent,e.pos,e.index(),t,n);if(i)return i;for(let s=e.depth-1;s>=0;s--){let l=t<0?ae(e.node(0),e.node(s),e.before(s+1),e.index(s),t,n):ae(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,n);if(l)return l}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new K(e.node(0))}static atStart(e){return ae(e,e,0,0,1)||new K(e)}static atEnd(e){return ae(e,e,e.content.size,e.childCount,-1)||new K(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=Xe[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Xe)throw new RangeError("Duplicate use of selection JSON ID "+e);return Xe[e]=t,t.prototype.jsonID=e,t}getBookmark(){return F.between(this.$anchor,this.$head).getBookmark()}}z.prototype.visible=!0;class Nn{constructor(e,t){this.$from=e,this.$to=t}}let Pt=!1;function Dt(r){!Pt&&!r.parent.inlineContent&&(Pt=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+r.parent.type.name+")"))}class F extends z{constructor(e,t=e){Dt(e),Dt(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return z.near(n);let i=e.resolve(t.map(this.anchor));return new F(i.parent.inlineContent?i:n,n)}replace(e,t=T.empty){if(super.replace(e,t),t==T.empty){let n=this.$from.marksAcross(this.$to);n&&e.ensureMarks(n)}}eq(e){return e instanceof F&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Oe(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new F(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let i=e.resolve(t);return new this(i,n==t?i:e.resolve(n))}static between(e,t,n){let i=e.pos-t.pos;if((!n||i)&&(n=i>=0?1:-1),!t.parent.inlineContent){let s=z.findFrom(t,n,!0)||z.findFrom(t,-n,!0);if(s)t=s.$head;else return z.near(t,n)}return e.parent.inlineContent||(i==0?e=t:(e=(z.findFrom(e,-n,!0)||z.findFrom(e,n,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new F(e,t)}}z.jsonID("text",F);class Oe{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Oe(e.map(this.anchor),e.map(this.head))}resolve(e){return F.between(e.resolve(this.anchor),e.resolve(this.head))}}class B extends z{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:i}=t.mapResult(this.anchor),s=e.resolve(i);return n?z.near(s):new B(s)}content(){return new T(O.from(this.node),0,0)}eq(e){return e instanceof B&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Ye(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new B(e.resolve(t.anchor))}static create(e,t){return new B(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}B.prototype.visible=!1,z.jsonID("node",B);class Ye{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new Oe(n,n):new Ye(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&B.isSelectable(n)?new B(t):z.near(t)}}class K extends z{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=T.empty){if(t==T.empty){e.delete(0,e.doc.content.size);let n=z.atStart(e.doc);n.eq(e.selection)||e.setSelection(n)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new K(e)}map(e){return new K(e)}eq(e){return e instanceof K}getBookmark(){return Ln}}z.jsonID("all",K);const Ln={map(){return this},resolve(r){return new K(r)}};function ae(r,e,t,n,i,s=!1){if(e.inlineContent)return F.create(r,t);for(let l=n-(i>0?0:1);i>0?l<e.childCount:l>=0;l+=i){let a=e.child(l);if(a.isAtom){if(!s&&B.isSelectable(a))return B.create(r,t-(i<0?a.nodeSize:0))}else{let c=ae(r,a,t+i,i<0?a.childCount:0,i,s);if(c)return c}t+=a.nodeSize*i}return null}function _t(r,e,t){let n=r.steps.length-1;if(n<e)return;let i=r.steps[n];if(!(i instanceof V||i instanceof oe))return;let s=r.mapping.maps[n],l;s.forEach((a,c,f,u)=>{l==null&&(l=u)}),r.setSelection(z.near(r.doc.resolve(l),t))}function Bt(r,e){return!e||!r?r:r.bind(e)}class Ce{constructor(e,t,n){this.name=e,this.init=Bt(t.init,n),this.apply=Bt(t.apply,n)}}new Ce("doc",{init(r){return r.doc||r.schema.topNodeType.createAndFill()},apply(r){return r.doc}}),new Ce("selection",{init(r,e){return r.selection||z.atStart(e.doc)},apply(r){return r.selection}}),new Ce("storedMarks",{init(r){return r.storedMarks||null},apply(r,e,t,n){return n.selection.$cursor?r.storedMarks:null}}),new Ce("scrollToSelection",{init(){return 0},apply(r,e){return r.scrolledIntoView?e+1:e}});function $t(r,e,t){for(let n in r){let i=r[n];i instanceof Function?i=i.bind(e):n=="handleDOMEvents"&&(i=$t(i,e,{})),t[n]=i}return t}class le{constructor(e){this.spec=e,this.props={},e.props&&$t(e.props,this,this.props),this.key=e.key?e.key.key:Ft("plugin")}getState(e){return e[this.key]}}const Ge=Object.create(null);function Ft(r){return r in Ge?r+"$"+ ++Ge[r]:(Ge[r]=0,r+"$")}class An{constructor(e="key"){this.key=Ft(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Ze=St.extend({addAttributes(){var r;return{...(r=this.parent)==null?void 0:r.call(this),"data-note-file-id":{default:null,parseHTML:e=>e.getAttribute("data-note-file-id"),renderHTML:e=>e["data-note-file-id"]?{"data-note-file-id":e["data-note-file-id"]}:{}}}},addProseMirrorPlugins(){return[new le({appendTransaction(r,e,t){if(!r.some(p=>p.docChanged))return null;const{selection:n}=t;if(!n.empty)return null;const{$from:i}=n;if(i.parent.type.name!=="paragraph"||i.parent.content.size!==0)return null;const s=i.before(i.depth),l=e.selection.$from;if(l.depth<1)return null;const a=l.before(l.depth);if(s!==a)return null;const c=e.doc.nodeAt(s);if(!c||c.type.name!=="paragraph")return null;let f=!1;if(c.forEach(p=>{p.marks.some(y=>y.type.name==="link")&&(f=!0)}),!f)return null;const u=t.tr;try{u.join(s)}catch{}return u.setStoredMarks([])}})]}}),Jt=Be.extend({addNodeView(){return({node:r})=>{const e=r.attrs.indent||0,t=document.createElement("p");return t.setAttribute("data-indent",String(e)),e>0&&(t.style.paddingLeft=`${e*20}px`),{dom:t,contentDOM:t}}},addAttributes(){var r;return{...(r=this.parent)==null?void 0:r.call(this),indent:{default:0,parseHTML:e=>parseInt(e.getAttribute("data-indent")||"0"),renderHTML:e=>e.indent?{"data-indent":e.indent,style:`--indent-level: ${e.indent};`}:{}}}}}),P={MOBILE_BREAKPOINT:768,ICON_SIZE:"24px",CONTROLLER_HEIGHT:"25px",DOT_SIZE:{MOBILE:16,DESKTOP:9},DOT_POSITION:{MOBILE:"-8px",DESKTOP:"-4px"},COLORS:{BORDER:"#6C6C6C",BACKGROUND:"rgba(255, 255, 255, 1)"},ICONS:{LEFT:"https://fonts.gstatic.com/s/i/short-term/release/materialsymbolsoutlined/format_align_left/default/20px.svg",CENTER:"https://fonts.gstatic.com/s/i/short-term/release/materialsymbolsoutlined/format_align_center/default/20px.svg",RIGHT:"https://fonts.gstatic.com/s/i/short-term/release/materialsymbolsoutlined/format_align_right/default/20px.svg"}},ne={isMobile(){return document.documentElement.clientWidth<P.MOBILE_BREAKPOINT},getDotPosition(){return ne.isMobile()?P.DOT_POSITION.MOBILE:P.DOT_POSITION.DESKTOP},getDotSize(){return ne.isMobile()?P.DOT_SIZE.MOBILE:P.DOT_SIZE.DESKTOP},clearContainerBorder(r){const e=r.getAttribute("style"),t=e==null?void 0:e.replace("border: 1px dashed #6C6C6C;","").replace("border: 1px dashed rgb(108, 108, 108)","");r.setAttribute("style",t)},removeResizeElements(r){if(r.childElementCount>3)for(let e=0;e<5;e++)r.removeChild(r.lastChild)}};class Qe{static parseImageAttributes(e,t){Object.entries(e).forEach(([n,i])=>{if(!(i==null||n==="wrapperStyle")){if(n==="containerStyle"){const s=i.match(/width:\s*([0-9.]+)px/);s&&t.setAttribute("width",s[1]);return}t.setAttribute(n,i)}})}static extractWidthFromStyle(e){const t=e.match(/width:\s*([0-9.]+)px/);return t?(t==null?void 0:t.at(1))??null:null}}function et(r,e){const{minWidth:t,maxWidth:n}=e,i=t!==void 0?Math.max(0,t):0;let s=Math.max(i,r);return n!==void 0&&s>n&&(s=n),s}class ce{static getContainerStyle(e,t){return`${`width: ${t&&t!=="0px"&&t!=="0"?t:"100%"}; height: auto; cursor: pointer;`} ${e?"display: inline-block;":""}`}static getWrapperStyle(e){return e?"display: inline-block; float: left; padding-right: 8px;":"display: flex"}static getPositionControllerStyle(e){return`
1
+ (function(h,$){typeof exports=="object"&&typeof module<"u"?$(exports,require("@tiptap/extension-bold"),require("@tiptap/extension-color"),require("@tiptap/extension-document"),require("@tiptap/extension-file-handler"),require("@tiptap/extension-hard-break"),require("@tiptap/extension-heading"),require("@tiptap/extension-highlight"),require("@tiptap/extension-italic"),require("@tiptap/extension-list"),require("@tiptap/extension-mention"),require("@tiptap/extension-paragraph"),require("@tiptap/extension-table"),require("@tiptap/extension-text"),require("@tiptap/extension-text-align"),require("@tiptap/extension-text-style"),require("@tiptap/extension-underline"),require("@tiptap/extensions"),require("@tiptap/extension-link"),require("@tiptap/core"),require("@tiptap/extension-image"),require("@tiptap/react"),require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","@tiptap/extension-bold","@tiptap/extension-color","@tiptap/extension-document","@tiptap/extension-file-handler","@tiptap/extension-hard-break","@tiptap/extension-heading","@tiptap/extension-highlight","@tiptap/extension-italic","@tiptap/extension-list","@tiptap/extension-mention","@tiptap/extension-paragraph","@tiptap/extension-table","@tiptap/extension-text","@tiptap/extension-text-align","@tiptap/extension-text-style","@tiptap/extension-underline","@tiptap/extensions","@tiptap/extension-link","@tiptap/core","@tiptap/extension-image","@tiptap/react","react","react-dom"],$):(h=typeof globalThis<"u"?globalThis:h||self,$(h.LynqifyUI={},h.Bold,h.Color,h.Document,h.FileHandler,h.HardBreak,h.Heading,h.Highlight,h.Italic,h.extensionList,h.Mention,h.Paragraph,h.extensionTable,h.Text,h.TextAlign,h.extensionTextStyle,h.Underline,h.extensions,h.Link,h.TipTapCore,h.Image,h.TipTapReact,h.React,h.ReactDOM))})(this,(function(h,$,X,Pe,gt,De,yt,vt,_e,D,wt,Be,Y,$e,Fe,Je,We,Z,St,se,It,Ee,He,xn){"use strict";var Kr=Object.defineProperty;var Xr=(h,$,X)=>$ in h?Kr(h,$,{enumerable:!0,configurable:!0,writable:!0,value:X}):h[$]=X;var R=(h,$,X)=>Xr(h,typeof $!="symbol"?$+"":$,X);function Tn(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const je=Tn(He);function bt(r,e,t){for(let n=0;;n++){if(n==r.childCount||n==e.childCount)return r.childCount==e.childCount?null:t;let i=r.child(n),s=e.child(n);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let l=0;i.text[l]==s.text[l];l++)t++;return t}if(i.content.size||s.content.size){let l=bt(i.content,s.content,t+1);if(l!=null)return l}t+=i.nodeSize}}function Et(r,e,t,n){for(let i=r.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:n};let l=r.child(--i),a=e.child(--s),c=l.nodeSize;if(l==a){t-=c,n-=c;continue}if(!l.sameMarkup(a))return{a:t,b:n};if(l.isText&&l.text!=a.text){let f=0,u=Math.min(l.text.length,a.text.length);for(;f<u&&l.text[l.text.length-f-1]==a.text[a.text.length-f-1];)f++,t--,n--;return{a:t,b:n}}if(l.content.size||a.content.size){let f=Et(l.content,a.content,t-1,n-1);if(f)return f}t-=c,n-=c}}class O{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,i=0,s){for(let l=0,a=0;a<t;l++){let c=this.content[l],f=a+c.nodeSize;if(f>e&&n(c,i+a,s||null,l)!==!1&&c.content.size){let u=a+1;c.nodesBetween(Math.max(0,e-u),Math.min(c.content.size,t-u),n,i+u)}a=f}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,i){let s="",l=!0;return this.nodesBetween(e,t,(a,c)=>{let f=a.isText?a.text.slice(Math.max(e,c)-c,t-c):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&f||a.isTextblock)&&n&&(l?l=!1:s+=n),s+=f},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(n)&&(i[i.length-1]=t.withText(t.text+n.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new O(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let n=[],i=0;if(t>e)for(let s=0,l=0;l<t;s++){let a=this.content[s],c=l+a.nodeSize;c>e&&((l<e||c>t)&&(a.isText?a=a.cut(Math.max(0,e-l),Math.min(a.text.length,t-l)):a=a.cut(Math.max(0,e-l-1),Math.min(a.content.size,t-l-1))),n.push(a),i+=a.nodeSize),l=c}return new O(n,i)}cutByIndex(e,t){return e==t?O.empty:e==0&&t==this.content.length?this:new O(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-n.nodeSize;return i[e]=t,new O(i,s)}addToStart(e){return new O([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new O(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))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 t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let i=this.content[t];e(i,n,t),n+=i.nodeSize}}findDiffStart(e,t=0){return bt(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Et(this,e,t,n)}findIndex(e){if(e==0)return xe(0,e);if(e==this.size)return xe(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let i=this.child(t),s=n+i.nodeSize;if(s>=e)return s==e?xe(t+1,s):xe(t,n);n=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return O.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new O(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return O.empty;let t,n=0;for(let i=0;i<e.length;i++){let s=e[i];n+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new O(t||e,n)}static from(e){if(!e)return O.empty;if(e instanceof O)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new O([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}O.empty=new O([],0);const qe={index:0,offset:0};function xe(r,e){return qe.index=r,qe.offset=e,qe}class Rn extends Error{}class T{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=Tt(this.content,e+this.openStart,t);return n&&new T(n,this.openStart,this.openEnd)}removeBetween(e,t){return new T(xt(this.content,e+this.openStart,t+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,t){if(!t)return T.empty;let n=t.openStart||0,i=t.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new T(O.fromJSON(e,t.content),n,i)}static maxOpen(e,t=!0){let n=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)n++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new T(e,n,i)}}T.empty=new T(O.empty,0,0);function xt(r,e,t){let{index:n,offset:i}=r.findIndex(e),s=r.maybeChild(n),{index:l,offset:a}=r.findIndex(t);if(i==e||s.isText){if(a!=t&&!r.child(l).isText)throw new RangeError("Removing non-flat range");return r.cut(0,e).append(r.cut(t))}if(n!=l)throw new RangeError("Removing non-flat range");return r.replaceChild(n,s.copy(xt(s.content,e-i-1,t-i-1)))}function Tt(r,e,t,n){let{index:i,offset:s}=r.findIndex(e),l=r.maybeChild(i);if(s==e||l.isText)return n&&!n.canReplace(i,i,t)?null:r.cut(0,e).append(t).append(r.cut(e));let a=Tt(l.content,e-s-1,t,l);return a&&r.replaceChild(i,l.copy(a))}class Rt{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Ot=65535,Ct=Math.pow(2,16);function On(r,e){return r+e*Ct}function kt(r){return r&Ot}function Cn(r){return(r-(r&Ot))/Ct}const Nt=1,Lt=2,Te=4,At=8;class zt{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&At)>0}get deletedBefore(){return(this.delInfo&(Nt|Te))>0}get deletedAfter(){return(this.delInfo&(Lt|Te))>0}get deletedAcross(){return(this.delInfo&Te)>0}}class j{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&j.empty)return j.empty}recover(e){let t=0,n=kt(e);if(!this.inverted)for(let i=0;i<n;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[n*3]+t+Cn(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let i=0,s=this.inverted?2:1,l=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?i:0);if(c>e)break;let f=this.ranges[a+s],u=this.ranges[a+l],p=c+f;if(e<=p){let y=f?e==c?-1:e==p?1:t:t,w=c+i+(y<0?0:u);if(n)return w;let g=e==(t<0?c:p)?null:On(a/3,e-c),b=e==c?Lt:e==p?Nt:Te;return(t<0?e!=c:e!=p)&&(b|=At),new zt(w,b,g)}i+=u-f}return n?e+i:new zt(e+i,0,null)}touches(e,t){let n=0,i=kt(t),s=this.inverted?2:1,l=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?n:0);if(c>e)break;let f=this.ranges[a+s],u=c+f;if(e<=u&&a==i*3)return!0;n+=this.ranges[a+l]-f}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let l=this.ranges[i],a=l-(this.inverted?s:0),c=l+(this.inverted?0:s),f=this.ranges[i+t],u=this.ranges[i+n];e(a,a+f,c,c+u),s+=u-f}}invert(){return new j(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?j.empty:new j(e<0?[0,-e,0]:[0,0,e])}}j.empty=new j([]);const Ve=Object.create(null);class _{getMap(){return j.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=Ve[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Ve)throw new RangeError("Duplicate use of step JSON ID "+e);return Ve[e]=t,t.prototype.jsonID=e,t}}class N{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new N(e,null)}static fail(e){return new N(null,e)}static fromReplace(e,t,n,i){try{return N.ok(e.replace(t,n,i))}catch(s){if(s instanceof Rn)return N.fail(s.message);throw s}}}function Ue(r,e,t){let n=[];for(let i=0;i<r.childCount;i++){let s=r.child(i);s.content.size&&(s=s.copy(Ue(s.content,e,s))),s.isInline&&(s=e(s,t,i)),n.push(s)}return O.fromArray(n)}class Q extends _{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),i=n.node(n.sharedDepth(this.to)),s=new T(Ue(t.content,(l,a)=>!l.isAtom||!a.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),i),t.openStart,t.openEnd);return N.fromReplace(e,this.from,this.to,s)}invert(){return new ee(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Q(t.pos,n.pos,this.mark)}merge(e){return e instanceof Q&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Q(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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Q(t.from,t.to,e.markFromJSON(t.mark))}}_.jsonID("addMark",Q);class ee extends _{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new T(Ue(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return N.fromReplace(e,this.from,this.to,n)}invert(){return new Q(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new ee(t.pos,n.pos,this.mark)}merge(e){return e instanceof ee&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ee(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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ee(t.from,t.to,e.markFromJSON(t.mark))}}_.jsonID("removeMark",ee);class te extends _{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return N.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return N.fromReplace(e,this.pos,this.pos+1,new T(O.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let n=this.mark.addToSet(t.marks);if(n.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(n))return new te(this.pos,t.marks[i]);return new te(this.pos,this.mark)}}return new he(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new te(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new te(t.pos,e.markFromJSON(t.mark))}}_.jsonID("addNodeMark",te);class he extends _{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return N.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return N.fromReplace(e,this.pos,this.pos+1,new T(O.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new te(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new he(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new he(t.pos,e.markFromJSON(t.mark))}}_.jsonID("removeNodeMark",he);class V extends _{constructor(e,t,n,i=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=i}apply(e){return this.structure&&Ke(e,this.from,this.to)?N.fail("Structure replace would overwrite content"):N.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new j([this.from,this.to-this.from,this.slice.size])}invert(e){return new V(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),n=this.from==this.to&&V.MAP_BIAS<0?t:e.mapResult(this.from,1);return n.deletedAcross&&t.deletedAcross?null:new V(n.pos,Math.max(n.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof V)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?T.empty:new T(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new V(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?T.empty:new T(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new V(e.from,this.to,t,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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new V(t.from,t.to,T.fromJSON(e,t.slice),!!t.structure)}}V.MAP_BIAS=1,_.jsonID("replace",V);class oe extends _{constructor(e,t,n,i,s,l,a=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=i,this.slice=s,this.insert=l,this.structure=a}apply(e){if(this.structure&&(Ke(e,this.from,this.gapFrom)||Ke(e,this.gapTo,this.to)))return N.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return N.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?N.fromReplace(e,this.from,this.to,n):N.fail("Content does not fit in gap")}getMap(){return new j([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new oe(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||i<t.pos||s>n.pos?null:new oe(t.pos,n.pos,i,s,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,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new oe(t.from,t.to,t.gapFrom,t.gapTo,T.fromJSON(e,t.slice),t.insert,!!t.structure)}}_.jsonID("replaceAround",oe);function Ke(r,e,t){let n=r.resolve(e),i=t-e,s=n.depth;for(;i>0&&s>0&&n.indexAfter(s)==n.node(s).childCount;)s--,i--;if(i>0){let l=n.node(s).maybeChild(n.indexAfter(s));for(;i>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,i--}}return!1}function kn(r,e,t){return(e==0||r.canReplace(e,r.childCount))&&(t==r.childCount||r.canReplace(0,t))}function Mt(r){let t=r.parent.content.cutByIndex(r.startIndex,r.endIndex);for(let n=r.depth,i=0,s=0;;--n){let l=r.$from.node(n),a=r.$from.index(n)+i,c=r.$to.indexAfter(n)-s;if(n<r.depth&&l.canReplace(a,c,t))return n;if(n==0||l.type.spec.isolating||!kn(l,a,c))break;a&&(i=1),c<l.childCount&&(s=1)}return null}class pe extends _{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return N.fail("No node at attribute step's position");let n=Object.create(null);for(let s in t.attrs)n[s]=t.attrs[s];n[this.attr]=this.value;let i=t.type.create(n,null,t.marks);return N.fromReplace(e,this.pos,this.pos+1,new T(O.from(i),0,t.isLeaf?0:1))}getMap(){return j.empty}invert(e){return new pe(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new pe(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new pe(t.pos,t.attr,t.value)}}_.jsonID("attr",pe);class Re extends _{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return N.ok(n)}getMap(){return j.empty}invert(e){return new Re(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Re(t.attr,t.value)}}_.jsonID("docAttr",Re);let me=class extends Error{};me=function r(e){let t=Error.call(this,e);return t.__proto__=r.prototype,t},me.prototype=Object.create(Error.prototype),me.prototype.constructor=me,me.prototype.name="TransformError";const Xe=Object.create(null);class z{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Nn(e.min(t),e.max(t))]}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 t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=T.empty){let n=t.content.lastChild,i=null;for(let a=0;a<t.openEnd;a++)i=n,n=n.lastChild;let s=e.steps.length,l=this.ranges;for(let a=0;a<l.length;a++){let{$from:c,$to:f}=l[a],u=e.mapping.slice(s);e.replaceRange(u.map(c.pos),u.map(f.pos),a?T.empty:t),a==0&&_t(e,s,(n?n.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:l,$to:a}=i[s],c=e.mapping.slice(n),f=c.map(l.pos),u=c.map(a.pos);s?e.deleteRange(f,u):(e.replaceRangeWith(f,u,t),_t(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let i=e.parent.inlineContent?new F(e):ae(e.node(0),e.parent,e.pos,e.index(),t,n);if(i)return i;for(let s=e.depth-1;s>=0;s--){let l=t<0?ae(e.node(0),e.node(s),e.before(s+1),e.index(s),t,n):ae(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,n);if(l)return l}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new K(e.node(0))}static atStart(e){return ae(e,e,0,0,1)||new K(e)}static atEnd(e){return ae(e,e,e.content.size,e.childCount,-1)||new K(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=Xe[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Xe)throw new RangeError("Duplicate use of selection JSON ID "+e);return Xe[e]=t,t.prototype.jsonID=e,t}getBookmark(){return F.between(this.$anchor,this.$head).getBookmark()}}z.prototype.visible=!0;class Nn{constructor(e,t){this.$from=e,this.$to=t}}let Pt=!1;function Dt(r){!Pt&&!r.parent.inlineContent&&(Pt=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+r.parent.type.name+")"))}class F extends z{constructor(e,t=e){Dt(e),Dt(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return z.near(n);let i=e.resolve(t.map(this.anchor));return new F(i.parent.inlineContent?i:n,n)}replace(e,t=T.empty){if(super.replace(e,t),t==T.empty){let n=this.$from.marksAcross(this.$to);n&&e.ensureMarks(n)}}eq(e){return e instanceof F&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Oe(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new F(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let i=e.resolve(t);return new this(i,n==t?i:e.resolve(n))}static between(e,t,n){let i=e.pos-t.pos;if((!n||i)&&(n=i>=0?1:-1),!t.parent.inlineContent){let s=z.findFrom(t,n,!0)||z.findFrom(t,-n,!0);if(s)t=s.$head;else return z.near(t,n)}return e.parent.inlineContent||(i==0?e=t:(e=(z.findFrom(e,-n,!0)||z.findFrom(e,n,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new F(e,t)}}z.jsonID("text",F);class Oe{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Oe(e.map(this.anchor),e.map(this.head))}resolve(e){return F.between(e.resolve(this.anchor),e.resolve(this.head))}}class B extends z{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:i}=t.mapResult(this.anchor),s=e.resolve(i);return n?z.near(s):new B(s)}content(){return new T(O.from(this.node),0,0)}eq(e){return e instanceof B&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Ye(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new B(e.resolve(t.anchor))}static create(e,t){return new B(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}B.prototype.visible=!1,z.jsonID("node",B);class Ye{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new Oe(n,n):new Ye(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&B.isSelectable(n)?new B(t):z.near(t)}}class K extends z{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=T.empty){if(t==T.empty){e.delete(0,e.doc.content.size);let n=z.atStart(e.doc);n.eq(e.selection)||e.setSelection(n)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new K(e)}map(e){return new K(e)}eq(e){return e instanceof K}getBookmark(){return Ln}}z.jsonID("all",K);const Ln={map(){return this},resolve(r){return new K(r)}};function ae(r,e,t,n,i,s=!1){if(e.inlineContent)return F.create(r,t);for(let l=n-(i>0?0:1);i>0?l<e.childCount:l>=0;l+=i){let a=e.child(l);if(a.isAtom){if(!s&&B.isSelectable(a))return B.create(r,t-(i<0?a.nodeSize:0))}else{let c=ae(r,a,t+i,i<0?a.childCount:0,i,s);if(c)return c}t+=a.nodeSize*i}return null}function _t(r,e,t){let n=r.steps.length-1;if(n<e)return;let i=r.steps[n];if(!(i instanceof V||i instanceof oe))return;let s=r.mapping.maps[n],l;s.forEach((a,c,f,u)=>{l==null&&(l=u)}),r.setSelection(z.near(r.doc.resolve(l),t))}function Bt(r,e){return!e||!r?r:r.bind(e)}class Ce{constructor(e,t,n){this.name=e,this.init=Bt(t.init,n),this.apply=Bt(t.apply,n)}}new Ce("doc",{init(r){return r.doc||r.schema.topNodeType.createAndFill()},apply(r){return r.doc}}),new Ce("selection",{init(r,e){return r.selection||z.atStart(e.doc)},apply(r){return r.selection}}),new Ce("storedMarks",{init(r){return r.storedMarks||null},apply(r,e,t,n){return n.selection.$cursor?r.storedMarks:null}}),new Ce("scrollToSelection",{init(){return 0},apply(r,e){return r.scrolledIntoView?e+1:e}});function $t(r,e,t){for(let n in r){let i=r[n];i instanceof Function?i=i.bind(e):n=="handleDOMEvents"&&(i=$t(i,e,{})),t[n]=i}return t}class le{constructor(e){this.spec=e,this.props={},e.props&&$t(e.props,this,this.props),this.key=e.key?e.key.key:Ft("plugin")}getState(e){return e[this.key]}}const Ge=Object.create(null);function Ft(r){return r in Ge?r+"$"+ ++Ge[r]:(Ge[r]=0,r+"$")}class An{constructor(e="key"){this.key=Ft(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Ze=St.extend({addAttributes(){var r;return{...(r=this.parent)==null?void 0:r.call(this),"data-note-file-id":{default:null,parseHTML:e=>e.getAttribute("data-note-file-id"),renderHTML:e=>e["data-note-file-id"]?{"data-note-file-id":e["data-note-file-id"]}:{}}}},addProseMirrorPlugins(){return[new le({appendTransaction(r,e,t){if(!r.some(p=>p.docChanged))return null;const{selection:n}=t;if(!n.empty)return null;const{$from:i}=n;if(i.parent.type.name!=="paragraph"||i.parent.content.size!==0)return null;const s=i.before(i.depth),l=e.selection.$from;if(l.depth<1)return null;const a=l.before(l.depth);if(s!==a)return null;const c=e.doc.nodeAt(s);if(!c||c.type.name!=="paragraph")return null;let f=!1;if(c.forEach(p=>{p.marks.some(y=>y.type.name==="link")&&(f=!0)}),!f)return null;const u=t.tr;try{u.join(s)}catch{}return u.setStoredMarks([])}})]}}),Jt=Be.extend({addNodeView(){return({node:r})=>{const e=r.attrs.indent||0,t=document.createElement("p");return t.setAttribute("data-indent",String(e)),e>0&&(t.style.paddingLeft=`${e*20}px`),{dom:t,contentDOM:t}}},addAttributes(){var r;return{...(r=this.parent)==null?void 0:r.call(this),indent:{default:0,parseHTML:e=>parseInt(e.getAttribute("data-indent")||"0"),renderHTML:e=>e.indent?{"data-indent":e.indent,style:`--indent-level: ${e.indent};`}:{}}}}}),P={MOBILE_BREAKPOINT:768,ICON_SIZE:"24px",CONTROLLER_HEIGHT:"25px",DOT_SIZE:{MOBILE:16,DESKTOP:9},DOT_POSITION:{MOBILE:"-8px",DESKTOP:"-4px"},COLORS:{BORDER:"#6C6C6C",BACKGROUND:"rgba(255, 255, 255, 1)"},ICONS:{LEFT:"https://fonts.gstatic.com/s/i/short-term/release/materialsymbolsoutlined/format_align_left/default/20px.svg",CENTER:"https://fonts.gstatic.com/s/i/short-term/release/materialsymbolsoutlined/format_align_center/default/20px.svg",RIGHT:"https://fonts.gstatic.com/s/i/short-term/release/materialsymbolsoutlined/format_align_right/default/20px.svg"}},ne={isMobile(){return document.documentElement.clientWidth<P.MOBILE_BREAKPOINT},getDotPosition(){return ne.isMobile()?P.DOT_POSITION.MOBILE:P.DOT_POSITION.DESKTOP},getDotSize(){return ne.isMobile()?P.DOT_SIZE.MOBILE:P.DOT_SIZE.DESKTOP},clearContainerBorder(r){const e=r.getAttribute("style"),t=e==null?void 0:e.replace("border: 1px dashed #6C6C6C;","").replace("border: 1px dashed rgb(108, 108, 108)","");r.setAttribute("style",t)},removeResizeElements(r){if(r.childElementCount>3)for(let e=0;e<5;e++)r.removeChild(r.lastChild)}};class Qe{static parseImageAttributes(e,t){Object.entries(e).forEach(([n,i])=>{if(!(i==null||n==="wrapperStyle")){if(n==="containerStyle"){const s=i.match(/width:\s*([0-9.]+)px/);s&&t.setAttribute("width",s[1]);return}t.setAttribute(n,i)}})}static extractWidthFromStyle(e){const t=e.match(/width:\s*([0-9.]+)px/);return t?(t==null?void 0:t.at(1))??null:null}}function et(r,e){const{minWidth:t,maxWidth:n}=e,i=t!==void 0?Math.max(0,t):0;let s=Math.max(i,r);return n!==void 0&&s>n&&(s=n),s}class ce{static getContainerStyle(e,t){return`${`width: ${t&&t!=="0px"&&t!=="0"?t:"100%"}; height: auto; cursor: pointer;`} ${e?"display: inline-block;":""}`}static getWrapperStyle(e){return e?"display: inline-block; float: left; padding-right: 8px;":"display: flex"}static getPositionControllerStyle(e){return`
2
2
  position: absolute;
3
3
  top: 0%;
4
4
  left: 50%;
@@ -21,7 +21,7 @@
21
21
  border: 1.5px solid ${P.COLORS.BORDER};
22
22
  border-radius: 50%;
23
23
  ${i[e]}
24
- `.replace(/\s+/g," ").trim()}}class zn{constructor(e,t,n){R(this,"elements");R(this,"inline");R(this,"dispatchNodeView");this.elements=e,this.inline=t,this.dispatchNodeView=n}createControllerIcon(e){const t=document.createElement("img");return t.setAttribute("src",e),t.setAttribute("style",`width: ${P.ICON_SIZE}; height: ${P.ICON_SIZE}; cursor: pointer;`),t.addEventListener("mouseover",n=>{n.target.style.opacity="0.6"}),t.addEventListener("mouseout",n=>{n.target.style.opacity="1"}),t}handleLeftClick(){if(!this.inline)this.elements.container.setAttribute("style",`${this.elements.container.style.cssText} margin: 0 auto 0 0;`);else{const e="display: inline-block; float: left; padding-right: 8px;";this.elements.wrapper.setAttribute("style",e),this.elements.container.setAttribute("style",e)}this.dispatchNodeView()}handleCenterClick(){this.elements.container.setAttribute("style",`${this.elements.container.style.cssText} margin: 0 auto;`),this.dispatchNodeView()}handleRightClick(){if(!this.inline)this.elements.container.setAttribute("style",`${this.elements.container.style.cssText} margin: 0 0 0 auto;`);else{const e="display: inline-block; float: right; padding-left: 8px;";this.elements.wrapper.setAttribute("style",e),this.elements.container.setAttribute("style",e)}this.dispatchNodeView()}createPositionControls(){const e=document.createElement("div");e.setAttribute("style",ce.getPositionControllerStyle(this.inline));const t=this.createControllerIcon(P.ICONS.LEFT);if(t.addEventListener("click",()=>this.handleLeftClick()),e.appendChild(t),!this.inline){const i=this.createControllerIcon(P.ICONS.CENTER);i.addEventListener("click",()=>this.handleCenterClick()),e.appendChild(i)}const n=this.createControllerIcon(P.ICONS.RIGHT);return n.addEventListener("click",()=>this.handleRightClick()),e.appendChild(n),this.elements.container.appendChild(e),this}}class Mn{constructor(e,t,n=()=>({})){R(this,"elements");R(this,"dispatchNodeView");R(this,"getResizeLimits");R(this,"state",{isResizing:!1,startX:0,startWidth:0});R(this,"handleMouseMove",(e,t)=>{if(!this.state.isResizing)return;const n=t%2===0?-(e.clientX-this.state.startX):e.clientX-this.state.startX,i=et(this.state.startWidth+n,this.getResizeLimits());this.elements.container.style.width=i+"px",this.elements.img.style.width=i+"px"});R(this,"handleMouseUp",()=>{this.state.isResizing&&(this.state.isResizing=!1),this.dispatchNodeView()});R(this,"handleTouchMove",(e,t)=>{if(!this.state.isResizing)return;const n=t%2===0?-(e.touches[0].clientX-this.state.startX):e.touches[0].clientX-this.state.startX,i=et(this.state.startWidth+n,this.getResizeLimits());this.elements.container.style.width=i+"px",this.elements.img.style.width=i+"px"});R(this,"handleTouchEnd",()=>{this.state.isResizing&&(this.state.isResizing=!1),this.dispatchNodeView()});this.elements=e,this.dispatchNodeView=t,this.getResizeLimits=n}createResizeHandle(e){const t=document.createElement("div");return t.setAttribute("style",ce.getDotStyle(e)),t.addEventListener("mousedown",n=>{n.preventDefault(),this.state.isResizing=!0,this.state.startX=n.clientX,this.state.startWidth=this.elements.container.offsetWidth;const i=l=>this.handleMouseMove(l,e),s=()=>{this.handleMouseUp(),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)};document.addEventListener("mousemove",i),document.addEventListener("mouseup",s)}),t.addEventListener("touchstart",n=>{n.cancelable&&n.preventDefault(),this.state.isResizing=!0,this.state.startX=n.touches[0].clientX,this.state.startWidth=this.elements.container.offsetWidth;const i=l=>this.handleTouchMove(l,e),s=()=>{this.handleTouchEnd(),document.removeEventListener("touchmove",i),document.removeEventListener("touchend",s)};document.addEventListener("touchmove",i),document.addEventListener("touchend",s)},{passive:!1}),t}}class Pn{constructor(e={}){R(this,"limits");this.limits=e}update(e){this.limits={...this.limits,...e}}get(){return this.limits}}class Dn{constructor(e,t,n={},i){R(this,"context");R(this,"elements");R(this,"inline");R(this,"resizeLimitsRef");R(this,"resizeEventName");R(this,"handleResizeEvent");R(this,"clearContainerBorder",()=>{ne.clearContainerBorder(this.elements.container)});R(this,"dispatchNodeView",()=>{const{view:e,getPos:t}=this.context;if(typeof t=="function"){this.clearContainerBorder();const n={...this.context.node.attrs,width:Qe.extractWidthFromStyle(this.elements.container.style.cssText)??this.context.node.attrs.width,containerStyle:`${this.elements.container.style.cssText}`,wrapperStyle:`${this.elements.wrapper.style.cssText}`};e.dispatch(e.state.tr.setNodeMarkup(t(),null,n))}});R(this,"removeResizeElements",()=>{ne.removeResizeElements(this.elements.container)});this.context=e,this.inline=t,this.resizeLimitsRef=new Pn(n),this.resizeEventName=i,this.elements=this.createElements(),i&&(this.handleResizeEvent=(s=>{const l=s;l.detail&&this.updateResizeLimits({maxWidth:l.detail.maxWidth})}),window.addEventListener(i,this.handleResizeEvent))}destroy(){this.resizeEventName&&this.handleResizeEvent&&window.removeEventListener(this.resizeEventName,this.handleResizeEvent)}updateResizeLimits(e){this.resizeLimitsRef.update(e)}createElements(){return{wrapper:document.createElement("div"),container:document.createElement("div"),img:document.createElement("img")}}setupImageAttributes(){Qe.parseImageAttributes(this.context.node.attrs,this.elements.img)}setupDOMStructure(){const{wrapperStyle:e,containerStyle:t}=this.context.node.attrs;this.elements.wrapper.setAttribute("style",e),this.elements.wrapper.appendChild(this.elements.container),this.elements.container.setAttribute("style",t),this.elements.container.appendChild(this.elements.img)}applyResizeLimits(){const e=this.resizeLimitsRef.get();let t=Qe.extractWidthFromStyle(this.elements.container.style.cssText);if(t===null){const l=e.maxWidth;if(!l)return;t=l.toString()}const n=Number(t);if(Number.isNaN(n))return;const i=et(n,e),s=`${i}px`;this.elements.container.style.width=s,this.elements.img.style.width=s,this.elements.img.setAttribute("width",String(i))}createPositionController(){new zn(this.elements,this.inline,this.dispatchNodeView).createPositionControls()}createResizeHandler(){const e=new Mn(this.elements,this.dispatchNodeView,()=>this.resizeLimitsRef.get());Array.from({length:4},(t,n)=>{const i=e.createResizeHandle(n);this.elements.container.appendChild(i)})}setupContainerClick(){this.elements.container.addEventListener("click",()=>{var t;ne.isMobile()&&((t=document.querySelector(".ProseMirror-focused"))==null||t.blur()),this.removeResizeElements(),this.createPositionController(),this.elements.container.setAttribute("style",`position: relative; border: 1px dashed ${P.COLORS.BORDER}; ${this.context.node.attrs.containerStyle}`),this.applyResizeLimits(),this.createResizeHandler()})}setupContentClick(){document.addEventListener("click",e=>{const t=e.target;this.elements.container.contains(t)||t.style.cssText===`width: ${P.ICON_SIZE}; height: ${P.ICON_SIZE}; cursor: pointer;`||(this.clearContainerBorder(),this.removeResizeElements())})}initialize(){this.setupDOMStructure(),this.setupImageAttributes(),this.applyResizeLimits();const{editable:e}=this.context.editor.options;return e?(this.setupContainerClick(),this.setupContentClick(),{dom:this.elements.wrapper,destroy:()=>this.destroy()}):{dom:this.elements.container,destroy:()=>this.destroy()}}}const Wt="image-resize-limit-update";class _n{constructor(e){R(this,"currentMaxWidth");R(this,"resizeTimeout");R(this,"rafId");R(this,"handleResize",()=>{this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(()=>{const e=this.measureContainerWidth();if(e!==this.currentMaxWidth){this.currentMaxWidth=e;const t=new CustomEvent(Wt,{detail:{maxWidth:e}});window.dispatchEvent(t)}})},150)});this.editorElement=e,this.currentMaxWidth=this.measureContainerWidth(),window.addEventListener("resize",this.handleResize)}measureContainerWidth(){return this.editorElement.clientWidth}getCurrentMaxWidth(){return this.currentMaxWidth}destroy(){window.removeEventListener("resize",this.handleResize),this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.rafId&&cancelAnimationFrame(this.rafId)}}const tt=wt.extend({name:"imageResize",addOptions(){var r;return{...(r=this.parent)==null?void 0:r.call(this),inline:!1,minWidth:void 0,maxWidth:void 0,allowBase64:!1}},onCreate(){const r=new _n(this.editor.view.dom);return this.resizeHandler=r,()=>{r.destroy()}},renderHTML({HTMLAttributes:r}){const e={...r};if(r!=null&&r.id&&(e["data-id"]=r.id),!(r!=null&&r.wrapperStyle))return["img",e];const t=(r==null?void 0:r.width)??this.options.maxWidth??0,n=this.options.inline,i=(r==null?void 0:r.containerStyle)??ce.getContainerStyle(n,`${t}px`),s=(r==null?void 0:r.wrapperStyle)??ce.getWrapperStyle(n);return["div",{style:i},["div",{style:s},["img",e]]]},addAttributes(){var e;const r=this.options.inline;return{...(e=this.parent)==null?void 0:e.call(this),id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id,style:"margin-block: 10px;"}:{}},width:{renderHTML:t=>t.width?{width:t.width}:{}},containerStyle:{default:null,parseHTML:t=>{const n=t.getAttribute("containerstyle");if(n)return n;const i=t.getAttribute("width");return i?ce.getContainerStyle(r,`${i}px`):`${t.style.cssText}`},renderHTML:t=>t.width?{width:t.width}:{}},wrapperStyle:{default:ce.getWrapperStyle(r)}}},addNodeView(){return({node:r,editor:e,getPos:t})=>{var u;if(r.type.name!=="imageResize"){const p=document.createElement("img");return p.src=r.attrs.src,p.alt=r.attrs.alt||"",r.attrs.width&&(p.width=r.attrs.width),r.attrs.height&&(p.height=r.attrs.height),{dom:p}}const{inline:n,minWidth:i,maxWidth:s}=this.options,l={node:r,editor:e,view:e.view,getPos:typeof t=="function"?t:void 0},a={minWidth:i,maxWidth:s??((u=this.resizeHandler)==null?void 0:u.getCurrentMaxWidth())},f=new Dn(l,n,a,Wt).initialize();return f.dom.addEventListener("click",p=>{p.preventDefault();const y=t();if(y!==void 0){const{state:w,view:g}=e,b=w.tr.setSelection(B.create(w.doc,y));g.dispatch(b)}}),f}},addCommands(){var r;return{...(r=this.parent)==null?void 0:r.call(this),setResizableImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addKeyboardShortcuts(){return{Backspace:()=>Bn(this.editor)}}}),Bn=r=>{var t,n;const e=[];return r.state.doc.nodesBetween(r.state.selection.$from.pos,r.state.selection.$to.pos,i=>{e==null||e.push(i)}),e.length!==1||((n=(t=e.at(0))==null?void 0:t.type)==null?void 0:n.name)!=="imageResize"?(console.log("trace 1: handled?"),!1):(r.commands.deleteSelection(),!0)},U=r=>r==="bulletList"||r==="orderedList",ke=r=>r==="listItem",J=r=>r==="paragraph"||r==="heading";function nt(r,e){for(const t of r)if(t(e))return!0;return!1}function $n(r,e){for(const t of r)if(t(e))return!0;return!1}const Fn=({editor:r,$from:e,currentNode:t})=>{const n=e.pos===e.start(),i=t.attrs.indent>0;return J(t.type.name)&&i&&n?r.commands.outdent():!1},Jn=({state:r,view:e,$from:t,currentNode:n})=>{const i=n.content.size===0,s=n.attrs.indent>0;if(!(J(n.type.name)&&s&&i))return!1;const a=t.before(t.depth),c=r.tr;return c.delete(a,a+n.nodeSize),e.dispatch(c),!0},Wn=({state:r,view:e,$from:t,currentNode:n})=>{const i=t.pos===t.start(),s=n.content.size===0,l=n.attrs.indent>0,a=t.before(t.depth),c=r.doc.resolve(a).nodeBefore,f=c!=null&&U(c.type.name);if(J(n.type.name)&&!l&&s&&i&&f){const p=r.tr;return p.delete(a,a+n.nodeSize),e.dispatch(p),!0}return!1},Hn=r=>{const{tr:e,state:t,dispatch:n}=r,{selection:i}=t,{$from:s,$to:l}=i;if(i.empty)return!1;let a=0;if(t.doc.nodesBetween(s.pos,l.pos,u=>{(U(u.type.name)||J(u.type.name))&&a++}),a<=1)return!1;const c=new Set;let f=!1;return t.doc.nodesBetween(s.pos,l.pos,(u,p)=>{var w;return!(U(u.type.name)||J(u.type.name))||c.has(p)?!0:(c.add(p),e.setNodeAttribute(p,"indent",(((w=u.attrs)==null?void 0:w.indent)??0)+1),f=!0,!1)}),f?(e.setMeta("addToHistory",!0),n==null||n(e),!0):!1},jn=r=>{var f;const{tr:e,state:t,dispatch:n}=r,{selection:i}=t,{$from:s}=i;let l=null,a=null;for(let u=s.depth;u>0;u--){const p=s.node(u);if(U(p.type.name)){l={...p,pos:s.before(u)},a={...s.node(u+1),pos:s.before(u+1)};break}}if(!l||!a)return!1;if(((f=l.content)==null?void 0:f.childCount)===1&&i instanceof F){const u=l.attrs.indent??0;return e.setNodeAttribute(l.pos,"indent",u+1),e.setMeta("addToHistory",!1),n==null||n(e),!0}return r.chain().focus().sinkListItem("listItem").updateAttributes("bulletList",{indent:1}).updateAttributes("orderedList",{indent:1}).run(),!0},qn=r=>{const{tr:e,state:t,dispatch:n}=r,{selection:i}=t,{$from:s}=i,l=s.node();if(!(J(l.type.name)&&i instanceof F))return!1;const c=l.attrs.indent??0;return e.setNodeAttribute(s.before(s.depth),"indent",c+1),e.setMeta("addToHistory",!1),n==null||n(e),!0},Ht=({state:r,view:e,$from:t,$to:n,selectionIsEmpty:i})=>{if(i)return!1;let s=0;if(r.doc.nodesBetween(t.pos,n.pos,p=>{(ke(p.type.name)||J(p.type.name))&&s++}),!(s>1))return!1;const{tr:a,doc:c}=r;let f=!1;const u=new Set;return c.nodesBetween(t.pos,n.pos,(p,y)=>{if(U(p.type.name)&&(p.attrs.indent??0)>0){if(!u.has(y)){u.add(y);const w=p.attrs.indent??0;a.setNodeAttribute(y,"indent",Math.max(0,w-1)),f=!0;const g=r.doc.resolve(y),b=r.doc.resolve(y+p.nodeSize),M=new Rt(g,b,g.depth),A=Mt(M);A!=null&&(a.lift(M,A),f=!0)}return!1}if(J(p.type.name)&&(p.attrs.indent??0)>0){const w=p.attrs.indent??0;a.setNodeAttribute(y,"indent",Math.max(0,w-1)),f=!0}return!0}),f?(a.setMeta("addToHistory",!0),e.dispatch(a),!0):!1},Vn=({state:r,view:e,$from:t,$to:n,selectionIsEmpty:i})=>{if(i)return!1;let s=0;if(r.doc.nodesBetween(t.pos,n.pos,p=>{(ke(p.type.name)||J(p.type.name))&&s++}),!(s>1))return!1;const{tr:a,doc:c}=r;let f=!1;const u=new Set;return c.nodesBetween(t.pos,n.pos,(p,y)=>{if(U(p.type.name)&&(p.attrs.indent??0)>0){if(!u.has(y)){u.add(y);const w=p.attrs.indent??0;a.setNodeAttribute(y,"indent",Math.max(0,w-1)),f=!0;const g=r.doc.resolve(y),b=r.doc.resolve(y+p.nodeSize),M=new Rt(g,b,g.depth),A=Mt(M);A!=null&&(a.lift(M,A),f=!0)}return!1}if(J(p.type.name)&&(p.attrs.indent??0)>0){const w=p.attrs.indent??0;a.setNodeAttribute(y,"indent",Math.max(0,w-1)),f=!0}return!0}),f?(a.setMeta("addToHistory",!0),e.dispatch(a),!0):!1},Un=({$from:r,selectionIsEmpty:e})=>{var l;if(!e)return!1;let t=!1,n=!1,i=0;for(let a=r.depth;a>0;a--){const c=r.node(a);if(U(c.type.name))if(!t)t=!0,i=((l=c.attrs)==null?void 0:l.indent)??0;else{n=!0;break}}return t&&!n?i===0:!1},Kn=({state:r,view:e,$from:t,currentNode:n,selectionIsEmpty:i})=>{if(!i||!(n.type.name==="paragraph"&&n.content.size===0))return!1;const l=t.before(t.depth),a=r.doc.resolve(l).nodeBefore;if(!(a!=null&&U(a.type.name)))return!1;const f=r.doc.resolve(l-1),u=r.tr.setSelection(F.near(f,-1));return e.dispatch(u),!0},Xn=({state:r,view:e,$from:t,$to:n,selectionIsEmpty:i})=>{if(i)return!1;let s=0;if(r.doc.nodesBetween(t.pos,n.pos,p=>{(ke(p.type.name)||J(p.type.name))&&s++}),!(s>1))return!1;const{tr:a,doc:c}=r;let f=!1;const u=new Set;return c.nodesBetween(t.pos,n.pos,(p,y)=>{if((U(p.type.name)||J(p.type.name))&&!u.has(y)){u.add(y);const g=p.attrs.indent??0;return a.setNodeAttribute(y,"indent",g+1),f=!0,!1}return!0}),f?(a.setMeta("addToHistory",!0),e.dispatch(a),!0):!1},Yn=({state:r,view:e,$from:t,selectionIsEmpty:n})=>n||t.path.some(s=>{var l;return((l=s==null?void 0:s.type)==null?void 0:l.name)==="listItem"})?!1:(e.dispatch(r.tr.insertText(" ")),!0),Gn=({editor:r,currentNode:e,$from:t})=>{const n=e.content.size===0,i=t.node(t.depth-1);return i&&ke(i.type.name)&&!n?(r.chain().focus().indent().focus().run(),!0):!1},Zn=({state:r,view:e,$from:t,currentNode:n})=>{const i=t.pos===t.start(),s=n.content.size===0;return!i&&!s?(e.dispatch(r.tr.insertText(" ")),!0):!1};function rt(r){const{state:e,view:t}=r,{$from:n,$to:i,empty:s}=e.selection;return{editor:r,state:e,view:t,$from:n,$to:i,selectionIsEmpty:s,currentNode:n.node()}}const jt=Ee.Extension.create({name:"indent",addKeyboardShortcuts(){return{Enter:()=>this.editor.commands._handleEnterKeyDown(),Tab:()=>{const r=rt(this.editor);return nt([Xn,Yn,Gn,Zn],r)||this.editor.commands.indent()},Backspace:()=>{const r=rt(this.editor);return nt([Fn,Jn,Wn],r)},"Shift-Tab":()=>{const r=rt(this.editor);return nt([Vn,Kn,Un],r)||this.editor.chain().outdentShiftTab().run()},Space:()=>this.editor.commands._handleSpaceKeyDown()}},addProseMirrorPlugins(){return[new le({appendTransaction:(r,e,t)=>{if(!r.some(s=>s.docChanged))return null;let i=null;return t.doc.descendants((s,l)=>{var y;if(!(J(s.type.name)&&(((y=s==null?void 0:s.attrs)==null?void 0:y.indent)??0)>0))return;const c=t.doc.resolve(l);if(!(c.parent.type.name==="listItem"))return;let u=null;for(let w=c.depth-1;w>0;w--)if(U(c.node(w).type.name)){u=c.start(w)-1;break}if(u===null||u<0)return;i||(i=t.tr);const p=s.attrs.indent;i.setNodeAttribute(l,"indent",0),i.setNodeAttribute(u,"indent",p)}),i}})]},addGlobalAttributes(){return[{types:this.options.types??["orderedList","bulletList","paragraph","heading"],attributes:{indent:{default:1,parseHTML:r=>parseInt(r.getAttribute("data-indent")||"1",10),renderHTML:r=>r!=null&&r.indent?{style:`padding-left: ${r.indent*20}px`}:{}}}}]},addCommands(){return{_handleEnterKeyDown:()=>r=>{var c;const{tr:e,state:t,dispatch:n}=r,{$from:i}=t.selection,s=i.node();if(!(((c=s==null?void 0:s.type)==null?void 0:c.name)==="paragraph"&&s.attrs.indent))return!1;const a=s.attrs.indent;return e.split(i.pos),e.setNodeAttribute(e.selection.$from.before(),"indent",a),e.scrollIntoView(),e.setMeta("addToHistory",!1),n==null||n(e),!0},_handleSpaceKeyDown:()=>()=>!1,indent:()=>r=>$n([Hn,jn,qn],r),outdent:()=>r=>{const{state:e,view:t,tr:n,dispatch:i}=r,{$from:s,$to:l,empty:a}=e.selection,c={editor:r.editor,state:e,view:t,$from:s,$to:l,selectionIsEmpty:a,currentNode:s.node()};if(Ht(c))return!0;const f=s.node();if(!(J(f.type.name)&&f.attrs.indent>0)||!(s.pos===s.start()))return!1;const y=Math.max(0,f.attrs.indent-1);return n.setNodeAttribute(s.before(s.depth),"indent",y),n.setMeta("addToHistory",!1),i==null||i(n),!0},outdentShiftTab:()=>r=>{const{state:e,tr:t,dispatch:n}=r,{$from:i}=e.selection,s=i.node();if(!(J(s.type.name)&&s.attrs.indent>0))return!1;const a=Math.max(0,s.attrs.indent-1);return t.setNodeAttribute(i.before(i.depth),"indent",a),t.setMeta("addToHistory",!1),n==null||n(t),!0},increaseIndent:()=>({commands:r})=>r.indent(),decreaseIndent:()=>r=>{const{state:e,view:t}=r,{$from:n,$to:i,empty:s}=e.selection,l={editor:r.editor,state:e,view:t,$from:n,$to:i,selectionIsEmpty:s,currentNode:n.node()};return Ht(l)?!0:r.chain().outdentShiftTab().run()}}}});var Qn=D.BulletList,er=D.ListItem,tr=D.OrderedList;const qt=Qn.extend({addAttributes(){var r;return{...(r=this.parent)==null?void 0:r.call(this),indent:{default:0,parseHTML:e=>parseInt(e.getAttribute("data-indent")||"0",10),renderHTML:e=>e.indent?{"data-indent":e.indent}:{}}}},addNodeView(){return({node:r})=>{const e=r.attrs.indent||0,t=document.createElement("ul");return t.setAttribute("data-indent",String(e)),e>0&&(t.style.paddingLeft=`${e*20}px`),{dom:t,contentDOM:t}}}}),Vt=tr.extend({addAttributes(){var r;return{...(r=this.parent)==null?void 0:r.call(this),indent:{default:0,parseHTML:e=>parseInt(e.getAttribute("data-indent")||"0",10),renderHTML:e=>e.indent?{"data-indent":e.indent}:{}}}},addNodeView(){return({node:r})=>{const e=r.attrs.indent||0,t=document.createElement("ol");return t.setAttribute("data-indent",String(e)),e>0&&(t.style.paddingLeft=`${e*20}px`),{dom:t,contentDOM:t}}}}),it=er.extend({addAttributes(){var r;return{...(r=this.parent)==null?void 0:r.call(this),class:{default:null,parseHTML:e=>e.getAttribute("class"),renderHTML:e=>e.class?{class:e.class,...e}:{}},indent:{default:0,parseHTML:e=>parseInt(e.getAttribute("data-indent")||"0",10),renderHTML:e=>e.indent?{"data-indent":e.indent}:{}}}}}),st=se.Extension.create({name:"dynamicBulletStyling",addProseMirrorPlugins(){return[new le({key:new An("dynamicBulletStyling"),appendTransaction:(r,e,t)=>{const n=t.tr;let i=!1;return t.doc.descendants((s,l)=>{if(s.type.name==="listItem"){let a=0;const c=t.doc.resolve(l);for(let f=c.depth;f>0;f--)if(c.node(f).type.name==="bulletList"){a=1;break}a>0&&(n.setNodeAttribute(c.pos,"[data-style]","line-height: inherit"),i=!0)}}),i?n:null}})]}}),nr=r=>r==="bulletList"||r==="orderedList",rr=r=>r==="paragraph"||r==="heading",Ut=se.Extension.create({name:"listIndentIntegration",addProseMirrorPlugins(){return[new le({appendTransaction:(r,e,t)=>{if(!r.find(i=>i.docChanged))return null;let n=null;return t.doc.descendants((i,s)=>{var l;if(rr(i.type.name)&&(((l=i==null?void 0:i.attrs)==null?void 0:l.indent)??0)>0){const a=t.doc.resolve(s);if(a.parent.type.name==="listItem"){let f=null;for(let u=a.depth-1;u>0;u--){const p=a.node(u);if(nr(p.type.name)){f=a.start(u)-1;break}}if(f!==null&&f>=0){n||(n=t.tr);const u=i.attrs.indent;n.setNodeAttribute(s,"indent",0),n.setNodeAttribute(f,"indent",u)}}}}),n}}),new le({props:{transformPastedHTML(r){const e=/<p[^>]*style="[^"]*(?:padding|margin)-left:\s*(\d+)(?:px|pt|em)[^"]*"[^>]*>/gi;r=r.replace(e,(i,s)=>`<p data-indent="${Math.floor(parseInt(s,10)/40)}">`);const t=/<ol[^>]*style="[^"]*list-style-type:\s*(upper-roman|lower-roman|upper-alpha|lower-alpha)[^"]*"[^>]*>/gi;r=r.replace(t,()=>"<ol>");const n=/<li[^>]*style="[^"]*list-style-type:\s*[^;"\s]+[^"]*"[^>]*>/gi;return r=r.replace(n,i=>i.replace(/list-style-type:\s*[^;"\s]+;?/gi,"")),r}}})]}}),ot=se.Extension.create({name:"fontSize",addOptions(){return{types:["textStyle"],getStyle:r=>`font-size: ${r}`}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:r=>r.style.fontSize.replace(/['"]+/g,""),renderHTML:r=>r.fontSize?{style:this.options.getStyle(r.fontSize)}:{}}}}]},addCommands(){return{setFontSize:r=>({chain:e})=>e().setMark("textStyle",{fontSize:r}).run(),unsetFontSize:()=>({chain:r})=>r().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),at=se.Extension.create({name:"lineHeight",addOptions(){return{types:["textStyle"],getStyle:r=>`line-height: ${r};`}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:r=>r.style.lineHeight.replace(/['"]+/g,""),renderHTML:r=>r.lineHeight?{style:this.options.getStyle(r.lineHeight)}:{}}}}]},addCommands(){return{setLineHeight:r=>({chain:e})=>e().setMark("textStyle",{lineHeight:r}).run(),unsetLineHeight:()=>({chain:r})=>r().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}}),ir=[$,Z.CharacterCount,X,Pe,gt,yt,vt,tt,Ze,D.ListItem,D.ListKeymap,It,D.OrderedList,Z.Placeholder,Y.Table,Y.TableCell,Y.TableHeader,Y.TableRow,D.TaskItem,D.TaskList,Fe,Je.TextStyle,We,Be,$e,_e,De,Z.UndoRedo,it,ot,at,D.BulletList,st],sr=[Jt,Je.TextStyle,X,Z.UndoRedo.configure({newGroupDelay:500,depth:100}),De,We,$,_e,D.TaskItem,it,Pe,$e,ot,at,qt,st,tt,Ut,Fe.configure({types:["heading","paragraph"]}),Vt.configure({itemTypeName:"listItem",keepMarks:!0,keepAttributes:!0}),Ze,jt],or=se.Extension.create({name:"MentionStorage",addStorage(){return{suggestions:[]}}});var ue={},Kt;function ar(){if(Kt)return ue;Kt=1;var r=xn;if(process.env.NODE_ENV==="production")ue.createRoot=r.createRoot,ue.hydrateRoot=r.hydrateRoot;else{var e=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;ue.createRoot=function(t,n){e.usingClientEntryPoint=!0;try{return r.createRoot(t,n)}finally{e.usingClientEntryPoint=!1}},ue.hydrateRoot=function(t,n,i){e.usingClientEntryPoint=!0;try{return r.hydrateRoot(t,n,i)}finally{e.usingClientEntryPoint=!1}}}return ue}var lr=ar(),Ne={exports:{}},ge={};/**
24
+ `.replace(/\s+/g," ").trim()}}class zn{constructor(e,t,n){R(this,"elements");R(this,"inline");R(this,"dispatchNodeView");this.elements=e,this.inline=t,this.dispatchNodeView=n}createControllerIcon(e){const t=document.createElement("img");return t.setAttribute("src",e),t.setAttribute("style",`width: ${P.ICON_SIZE}; height: ${P.ICON_SIZE}; cursor: pointer;`),t.addEventListener("mouseover",n=>{n.target.style.opacity="0.6"}),t.addEventListener("mouseout",n=>{n.target.style.opacity="1"}),t}handleLeftClick(){if(!this.inline)this.elements.container.setAttribute("style",`${this.elements.container.style.cssText} margin: 0 auto 0 0;`);else{const e="display: inline-block; float: left; padding-right: 8px;";this.elements.wrapper.setAttribute("style",e),this.elements.container.setAttribute("style",e)}this.dispatchNodeView()}handleCenterClick(){this.elements.container.setAttribute("style",`${this.elements.container.style.cssText} margin: 0 auto;`),this.dispatchNodeView()}handleRightClick(){if(!this.inline)this.elements.container.setAttribute("style",`${this.elements.container.style.cssText} margin: 0 0 0 auto;`);else{const e="display: inline-block; float: right; padding-left: 8px;";this.elements.wrapper.setAttribute("style",e),this.elements.container.setAttribute("style",e)}this.dispatchNodeView()}createPositionControls(){const e=document.createElement("div");e.setAttribute("style",ce.getPositionControllerStyle(this.inline));const t=this.createControllerIcon(P.ICONS.LEFT);if(t.addEventListener("click",()=>this.handleLeftClick()),e.appendChild(t),!this.inline){const i=this.createControllerIcon(P.ICONS.CENTER);i.addEventListener("click",()=>this.handleCenterClick()),e.appendChild(i)}const n=this.createControllerIcon(P.ICONS.RIGHT);return n.addEventListener("click",()=>this.handleRightClick()),e.appendChild(n),this.elements.container.appendChild(e),this}}class Mn{constructor(e,t,n=()=>({})){R(this,"elements");R(this,"dispatchNodeView");R(this,"getResizeLimits");R(this,"state",{isResizing:!1,startX:0,startWidth:0});R(this,"handleMouseMove",(e,t)=>{if(!this.state.isResizing)return;const n=t%2===0?-(e.clientX-this.state.startX):e.clientX-this.state.startX,i=et(this.state.startWidth+n,this.getResizeLimits());this.elements.container.style.width=i+"px",this.elements.img.style.width=i+"px"});R(this,"handleMouseUp",()=>{this.state.isResizing&&(this.state.isResizing=!1),this.dispatchNodeView()});R(this,"handleTouchMove",(e,t)=>{if(!this.state.isResizing)return;const n=t%2===0?-(e.touches[0].clientX-this.state.startX):e.touches[0].clientX-this.state.startX,i=et(this.state.startWidth+n,this.getResizeLimits());this.elements.container.style.width=i+"px",this.elements.img.style.width=i+"px"});R(this,"handleTouchEnd",()=>{this.state.isResizing&&(this.state.isResizing=!1),this.dispatchNodeView()});this.elements=e,this.dispatchNodeView=t,this.getResizeLimits=n}createResizeHandle(e){const t=document.createElement("div");return t.setAttribute("style",ce.getDotStyle(e)),t.addEventListener("mousedown",n=>{n.preventDefault(),this.state.isResizing=!0,this.state.startX=n.clientX,this.state.startWidth=this.elements.container.offsetWidth;const i=l=>this.handleMouseMove(l,e),s=()=>{this.handleMouseUp(),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)};document.addEventListener("mousemove",i),document.addEventListener("mouseup",s)}),t.addEventListener("touchstart",n=>{n.cancelable&&n.preventDefault(),this.state.isResizing=!0,this.state.startX=n.touches[0].clientX,this.state.startWidth=this.elements.container.offsetWidth;const i=l=>this.handleTouchMove(l,e),s=()=>{this.handleTouchEnd(),document.removeEventListener("touchmove",i),document.removeEventListener("touchend",s)};document.addEventListener("touchmove",i),document.addEventListener("touchend",s)},{passive:!1}),t}}class Pn{constructor(e={}){R(this,"limits");this.limits=e}update(e){this.limits={...this.limits,...e}}get(){return this.limits}}class Dn{constructor(e,t,n={},i){R(this,"context");R(this,"elements");R(this,"inline");R(this,"resizeLimitsRef");R(this,"resizeEventName");R(this,"handleResizeEvent");R(this,"clearContainerBorder",()=>{ne.clearContainerBorder(this.elements.container)});R(this,"dispatchNodeView",()=>{const{view:e,getPos:t}=this.context;if(typeof t=="function"){this.clearContainerBorder();const n={...this.context.node.attrs,width:Qe.extractWidthFromStyle(this.elements.container.style.cssText)??this.context.node.attrs.width,containerStyle:`${this.elements.container.style.cssText}`,wrapperStyle:`${this.elements.wrapper.style.cssText}`};e.dispatch(e.state.tr.setNodeMarkup(t(),null,n))}});R(this,"removeResizeElements",()=>{ne.removeResizeElements(this.elements.container)});this.context=e,this.inline=t,this.resizeLimitsRef=new Pn(n),this.resizeEventName=i,this.elements=this.createElements(),i&&(this.handleResizeEvent=(s=>{const l=s;l.detail&&this.updateResizeLimits({maxWidth:l.detail.maxWidth})}),window.addEventListener(i,this.handleResizeEvent))}destroy(){this.resizeEventName&&this.handleResizeEvent&&window.removeEventListener(this.resizeEventName,this.handleResizeEvent)}updateResizeLimits(e){this.resizeLimitsRef.update(e)}createElements(){return{wrapper:document.createElement("div"),container:document.createElement("div"),img:document.createElement("img")}}setupImageAttributes(){Qe.parseImageAttributes(this.context.node.attrs,this.elements.img)}setupDOMStructure(){const{wrapperStyle:e,containerStyle:t}=this.context.node.attrs;this.elements.wrapper.setAttribute("style",e),this.elements.wrapper.appendChild(this.elements.container),this.elements.container.setAttribute("style",t),this.elements.container.appendChild(this.elements.img)}applyResizeLimits(){const e=this.resizeLimitsRef.get();let t=Qe.extractWidthFromStyle(this.elements.container.style.cssText);if(t===null){const l=e.maxWidth;if(!l)return;t=l.toString()}const n=Number(t);if(Number.isNaN(n))return;const i=et(n,e),s=`${i}px`;this.elements.container.style.width=s,this.elements.img.style.width=s,this.elements.img.setAttribute("width",String(i))}createPositionController(){new zn(this.elements,this.inline,this.dispatchNodeView).createPositionControls()}createResizeHandler(){const e=new Mn(this.elements,this.dispatchNodeView,()=>this.resizeLimitsRef.get());Array.from({length:4},(t,n)=>{const i=e.createResizeHandle(n);this.elements.container.appendChild(i)})}setupContainerClick(){this.elements.container.addEventListener("click",()=>{var t;ne.isMobile()&&((t=document.querySelector(".ProseMirror-focused"))==null||t.blur()),this.removeResizeElements(),this.createPositionController(),this.elements.container.setAttribute("style",`position: relative; border: 1px dashed ${P.COLORS.BORDER}; ${this.context.node.attrs.containerStyle}`),this.applyResizeLimits(),this.createResizeHandler()})}setupContentClick(){document.addEventListener("click",e=>{const t=e.target;this.elements.container.contains(t)||t.style.cssText===`width: ${P.ICON_SIZE}; height: ${P.ICON_SIZE}; cursor: pointer;`||(this.clearContainerBorder(),this.removeResizeElements())})}initialize(){this.setupDOMStructure(),this.setupImageAttributes(),this.applyResizeLimits();const{editable:e}=this.context.editor.options;return e?(this.setupContainerClick(),this.setupContentClick(),{dom:this.elements.wrapper,destroy:()=>this.destroy()}):{dom:this.elements.container,destroy:()=>this.destroy()}}}const Wt="image-resize-limit-update";class _n{constructor(e){R(this,"currentMaxWidth");R(this,"resizeTimeout");R(this,"rafId");R(this,"handleResize",()=>{this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(()=>{const e=this.measureContainerWidth();if(e!==this.currentMaxWidth){this.currentMaxWidth=e;const t=new CustomEvent(Wt,{detail:{maxWidth:e}});window.dispatchEvent(t)}})},150)});this.editorElement=e,this.currentMaxWidth=this.measureContainerWidth(),window.addEventListener("resize",this.handleResize)}measureContainerWidth(){return this.editorElement.clientWidth}getCurrentMaxWidth(){return this.currentMaxWidth}destroy(){window.removeEventListener("resize",this.handleResize),this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.rafId&&cancelAnimationFrame(this.rafId)}}const tt=It.extend({name:"imageResize",addOptions(){var r;return{...(r=this.parent)==null?void 0:r.call(this),inline:!1,minWidth:void 0,maxWidth:void 0,allowBase64:!1}},onCreate(){const r=new _n(this.editor.view.dom);return this.resizeHandler=r,()=>{r.destroy()}},renderHTML({HTMLAttributes:r}){const e={...r};if(r!=null&&r.id&&(e["data-id"]=r.id),!(r!=null&&r.wrapperStyle))return["img",e];const t=(r==null?void 0:r.width)??this.options.maxWidth??0,n=this.options.inline,i=(r==null?void 0:r.containerStyle)??ce.getContainerStyle(n,`${t}px`),s=(r==null?void 0:r.wrapperStyle)??ce.getWrapperStyle(n);return["div",{style:i},["div",{style:s},["img",e]]]},addAttributes(){var e;const r=this.options.inline;return{...(e=this.parent)==null?void 0:e.call(this),id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id,style:"margin-block: 10px;"}:{}},width:{renderHTML:t=>t.width?{width:t.width}:{}},containerStyle:{default:null,parseHTML:t=>{const n=t.getAttribute("containerstyle");if(n)return n;const i=t.getAttribute("width");return i?ce.getContainerStyle(r,`${i}px`):`${t.style.cssText}`},renderHTML:t=>t.width?{width:t.width}:{}},wrapperStyle:{default:ce.getWrapperStyle(r)}}},addNodeView(){return({node:r,editor:e,getPos:t})=>{var u;if(r.type.name!=="imageResize"){const p=document.createElement("img");return p.src=r.attrs.src,p.alt=r.attrs.alt||"",r.attrs.width&&(p.width=r.attrs.width),r.attrs.height&&(p.height=r.attrs.height),{dom:p}}const{inline:n,minWidth:i,maxWidth:s}=this.options,l={node:r,editor:e,view:e.view,getPos:typeof t=="function"?t:void 0},a={minWidth:i,maxWidth:s??((u=this.resizeHandler)==null?void 0:u.getCurrentMaxWidth())},f=new Dn(l,n,a,Wt).initialize();return f.dom.addEventListener("click",p=>{p.preventDefault();const y=t();if(y!==void 0){const{state:w,view:g}=e,b=w.tr.setSelection(B.create(w.doc,y));g.dispatch(b)}}),f}},addCommands(){var r;return{...(r=this.parent)==null?void 0:r.call(this),setResizableImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addKeyboardShortcuts(){return{Backspace:()=>Bn(this.editor)}}}),Bn=r=>{var t,n;const e=[];return r.state.doc.nodesBetween(r.state.selection.$from.pos,r.state.selection.$to.pos,i=>{e==null||e.push(i)}),e.length!==1||((n=(t=e.at(0))==null?void 0:t.type)==null?void 0:n.name)!=="imageResize"?(console.log("trace 1: handled?"),!1):(r.commands.deleteSelection(),!0)},U=r=>r==="bulletList"||r==="orderedList",ke=r=>r==="listItem",J=r=>r==="paragraph"||r==="heading";function nt(r,e){for(const t of r)if(t(e))return!0;return!1}function $n(r,e){for(const t of r)if(t(e))return!0;return!1}const Fn=({editor:r,$from:e,currentNode:t})=>{const n=e.pos===e.start(),i=t.attrs.indent>0;return J(t.type.name)&&i&&n?r.commands.outdent():!1},Jn=({state:r,view:e,$from:t,currentNode:n})=>{const i=n.content.size===0,s=n.attrs.indent>0;if(!(J(n.type.name)&&s&&i))return!1;const a=t.before(t.depth),c=r.tr;return c.delete(a,a+n.nodeSize),e.dispatch(c),!0},Wn=({state:r,view:e,$from:t,currentNode:n})=>{const i=t.pos===t.start(),s=n.content.size===0,l=n.attrs.indent>0,a=t.before(t.depth),c=r.doc.resolve(a).nodeBefore,f=c!=null&&U(c.type.name);if(J(n.type.name)&&!l&&s&&i&&f){const p=r.tr;return p.delete(a,a+n.nodeSize),e.dispatch(p),!0}return!1},Hn=r=>{const{tr:e,state:t,dispatch:n}=r,{selection:i}=t,{$from:s,$to:l}=i;if(i.empty)return!1;let a=0;if(t.doc.nodesBetween(s.pos,l.pos,u=>{(U(u.type.name)||J(u.type.name))&&a++}),a<=1)return!1;const c=new Set;let f=!1;return t.doc.nodesBetween(s.pos,l.pos,(u,p)=>{var w;return!(U(u.type.name)||J(u.type.name))||c.has(p)?!0:(c.add(p),e.setNodeAttribute(p,"indent",(((w=u.attrs)==null?void 0:w.indent)??0)+1),f=!0,!1)}),f?(e.setMeta("addToHistory",!0),n==null||n(e),!0):!1},jn=r=>{var f;const{tr:e,state:t,dispatch:n}=r,{selection:i}=t,{$from:s}=i;let l=null,a=null;for(let u=s.depth;u>0;u--){const p=s.node(u);if(U(p.type.name)){l={...p,pos:s.before(u)},a={...s.node(u+1),pos:s.before(u+1)};break}}if(!l||!a)return!1;if(((f=l.content)==null?void 0:f.childCount)===1&&i instanceof F){const u=l.attrs.indent??0;return e.setNodeAttribute(l.pos,"indent",u+1),e.setMeta("addToHistory",!1),n==null||n(e),!0}return r.chain().focus().sinkListItem("listItem").updateAttributes("bulletList",{indent:1}).updateAttributes("orderedList",{indent:1}).run(),!0},qn=r=>{const{tr:e,state:t,dispatch:n}=r,{selection:i}=t,{$from:s}=i,l=s.node();if(!(J(l.type.name)&&i instanceof F))return!1;const c=l.attrs.indent??0;return e.setNodeAttribute(s.before(s.depth),"indent",c+1),e.setMeta("addToHistory",!1),n==null||n(e),!0},Ht=({state:r,view:e,$from:t,$to:n,selectionIsEmpty:i})=>{if(i)return!1;let s=0;if(r.doc.nodesBetween(t.pos,n.pos,p=>{(ke(p.type.name)||J(p.type.name))&&s++}),!(s>1))return!1;const{tr:a,doc:c}=r;let f=!1;const u=new Set;return c.nodesBetween(t.pos,n.pos,(p,y)=>{if(U(p.type.name)&&(p.attrs.indent??0)>0){if(!u.has(y)){u.add(y);const w=p.attrs.indent??0;a.setNodeAttribute(y,"indent",Math.max(0,w-1)),f=!0;const g=r.doc.resolve(y),b=r.doc.resolve(y+p.nodeSize),M=new Rt(g,b,g.depth),A=Mt(M);A!=null&&(a.lift(M,A),f=!0)}return!1}if(J(p.type.name)&&(p.attrs.indent??0)>0){const w=p.attrs.indent??0;a.setNodeAttribute(y,"indent",Math.max(0,w-1)),f=!0}return!0}),f?(a.setMeta("addToHistory",!0),e.dispatch(a),!0):!1},Vn=({state:r,view:e,$from:t,$to:n,selectionIsEmpty:i})=>{if(i)return!1;let s=0;if(r.doc.nodesBetween(t.pos,n.pos,p=>{(ke(p.type.name)||J(p.type.name))&&s++}),!(s>1))return!1;const{tr:a,doc:c}=r;let f=!1;const u=new Set;return c.nodesBetween(t.pos,n.pos,(p,y)=>{if(U(p.type.name)&&(p.attrs.indent??0)>0){if(!u.has(y)){u.add(y);const w=p.attrs.indent??0;a.setNodeAttribute(y,"indent",Math.max(0,w-1)),f=!0;const g=r.doc.resolve(y),b=r.doc.resolve(y+p.nodeSize),M=new Rt(g,b,g.depth),A=Mt(M);A!=null&&(a.lift(M,A),f=!0)}return!1}if(J(p.type.name)&&(p.attrs.indent??0)>0){const w=p.attrs.indent??0;a.setNodeAttribute(y,"indent",Math.max(0,w-1)),f=!0}return!0}),f?(a.setMeta("addToHistory",!0),e.dispatch(a),!0):!1},Un=({$from:r,selectionIsEmpty:e})=>{var l;if(!e)return!1;let t=!1,n=!1,i=0;for(let a=r.depth;a>0;a--){const c=r.node(a);if(U(c.type.name))if(!t)t=!0,i=((l=c.attrs)==null?void 0:l.indent)??0;else{n=!0;break}}return t&&!n?i===0:!1},Kn=({state:r,view:e,$from:t,currentNode:n,selectionIsEmpty:i})=>{if(!i||!(n.type.name==="paragraph"&&n.content.size===0))return!1;const l=t.before(t.depth),a=r.doc.resolve(l).nodeBefore;if(!(a!=null&&U(a.type.name)))return!1;const f=r.doc.resolve(l-1),u=r.tr.setSelection(F.near(f,-1));return e.dispatch(u),!0},Xn=({state:r,view:e,$from:t,$to:n,selectionIsEmpty:i})=>{if(i)return!1;let s=0;if(r.doc.nodesBetween(t.pos,n.pos,p=>{(ke(p.type.name)||J(p.type.name))&&s++}),!(s>1))return!1;const{tr:a,doc:c}=r;let f=!1;const u=new Set;return c.nodesBetween(t.pos,n.pos,(p,y)=>{if((U(p.type.name)||J(p.type.name))&&!u.has(y)){u.add(y);const g=p.attrs.indent??0;return a.setNodeAttribute(y,"indent",g+1),f=!0,!1}return!0}),f?(a.setMeta("addToHistory",!0),e.dispatch(a),!0):!1},Yn=({state:r,view:e,$from:t,selectionIsEmpty:n})=>n||t.path.some(s=>{var l;return((l=s==null?void 0:s.type)==null?void 0:l.name)==="listItem"})?!1:(e.dispatch(r.tr.insertText(" ")),!0),Gn=({editor:r,currentNode:e,$from:t})=>{const n=e.content.size===0,i=t.node(t.depth-1);return i&&ke(i.type.name)&&!n?(r.chain().focus().indent().focus().run(),!0):!1},Zn=({state:r,view:e,$from:t,currentNode:n})=>{const i=t.pos===t.start(),s=n.content.size===0;return!i&&!s?(e.dispatch(r.tr.insertText(" ")),!0):!1};function rt(r){const{state:e,view:t}=r,{$from:n,$to:i,empty:s}=e.selection;return{editor:r,state:e,view:t,$from:n,$to:i,selectionIsEmpty:s,currentNode:n.node()}}const jt=Ee.Extension.create({name:"indent",addKeyboardShortcuts(){return{Enter:()=>this.editor.commands._handleEnterKeyDown(),Tab:()=>{const r=rt(this.editor);return nt([Xn,Yn,Gn,Zn],r)||this.editor.commands.indent()},Backspace:()=>{const r=rt(this.editor);return nt([Fn,Jn,Wn],r)},"Shift-Tab":()=>{const r=rt(this.editor);return nt([Vn,Kn,Un],r)||this.editor.chain().outdentShiftTab().run()},Space:()=>this.editor.commands._handleSpaceKeyDown()}},addProseMirrorPlugins(){return[new le({appendTransaction:(r,e,t)=>{if(!r.some(s=>s.docChanged))return null;let i=null;return t.doc.descendants((s,l)=>{var y;if(!(J(s.type.name)&&(((y=s==null?void 0:s.attrs)==null?void 0:y.indent)??0)>0))return;const c=t.doc.resolve(l);if(!(c.parent.type.name==="listItem"))return;let u=null;for(let w=c.depth-1;w>0;w--)if(U(c.node(w).type.name)){u=c.start(w)-1;break}if(u===null||u<0)return;i||(i=t.tr);const p=s.attrs.indent;i.setNodeAttribute(l,"indent",0),i.setNodeAttribute(u,"indent",p)}),i}})]},addGlobalAttributes(){return[{types:this.options.types??["orderedList","bulletList","paragraph","heading"],attributes:{indent:{default:1,parseHTML:r=>parseInt(r.getAttribute("data-indent")||"1",10),renderHTML:r=>r!=null&&r.indent?{style:`padding-left: ${r.indent*20}px`}:{}}}}]},addCommands(){return{_handleEnterKeyDown:()=>r=>{var c;const{tr:e,state:t,dispatch:n}=r,{$from:i}=t.selection,s=i.node();if(!(((c=s==null?void 0:s.type)==null?void 0:c.name)==="paragraph"&&s.attrs.indent))return!1;const a=s.attrs.indent;return e.split(i.pos),e.setNodeAttribute(e.selection.$from.before(),"indent",a),e.scrollIntoView(),e.setMeta("addToHistory",!1),n==null||n(e),!0},_handleSpaceKeyDown:()=>()=>!1,indent:()=>r=>$n([Hn,jn,qn],r),outdent:()=>r=>{const{state:e,view:t,tr:n,dispatch:i}=r,{$from:s,$to:l,empty:a}=e.selection,c={editor:r.editor,state:e,view:t,$from:s,$to:l,selectionIsEmpty:a,currentNode:s.node()};if(Ht(c))return!0;const f=s.node();if(!(J(f.type.name)&&f.attrs.indent>0)||!(s.pos===s.start()))return!1;const y=Math.max(0,f.attrs.indent-1);return n.setNodeAttribute(s.before(s.depth),"indent",y),n.setMeta("addToHistory",!1),i==null||i(n),!0},outdentShiftTab:()=>r=>{const{state:e,tr:t,dispatch:n}=r,{$from:i}=e.selection,s=i.node();if(!(J(s.type.name)&&s.attrs.indent>0))return!1;const a=Math.max(0,s.attrs.indent-1);return t.setNodeAttribute(i.before(i.depth),"indent",a),t.setMeta("addToHistory",!1),n==null||n(t),!0},increaseIndent:()=>({commands:r})=>r.indent(),decreaseIndent:()=>r=>{const{state:e,view:t}=r,{$from:n,$to:i,empty:s}=e.selection,l={editor:r.editor,state:e,view:t,$from:n,$to:i,selectionIsEmpty:s,currentNode:n.node()};return Ht(l)?!0:r.chain().outdentShiftTab().run()}}}});var Qn=D.BulletList,er=D.ListItem,tr=D.OrderedList;const qt=Qn.extend({addAttributes(){var r;return{...(r=this.parent)==null?void 0:r.call(this),indent:{default:0,parseHTML:e=>parseInt(e.getAttribute("data-indent")||"0",10),renderHTML:e=>e.indent?{"data-indent":e.indent}:{}}}},addNodeView(){return({node:r})=>{const e=r.attrs.indent||0,t=document.createElement("ul");return t.setAttribute("data-indent",String(e)),e>0&&(t.style.paddingLeft=`${e*20}px`),{dom:t,contentDOM:t}}}}),Vt=tr.extend({addAttributes(){var r;return{...(r=this.parent)==null?void 0:r.call(this),indent:{default:0,parseHTML:e=>parseInt(e.getAttribute("data-indent")||"0",10),renderHTML:e=>e.indent?{"data-indent":e.indent}:{}}}},addNodeView(){return({node:r})=>{const e=r.attrs.indent||0,t=document.createElement("ol");return t.setAttribute("data-indent",String(e)),e>0&&(t.style.paddingLeft=`${e*20}px`),{dom:t,contentDOM:t}}}}),it=er.extend({addAttributes(){var r;return{...(r=this.parent)==null?void 0:r.call(this),class:{default:null,parseHTML:e=>e.getAttribute("class"),renderHTML:e=>e.class?{class:e.class,...e}:{}},indent:{default:0,parseHTML:e=>parseInt(e.getAttribute("data-indent")||"0",10),renderHTML:e=>e.indent?{"data-indent":e.indent}:{}}}}}),st=se.Extension.create({name:"dynamicBulletStyling",addProseMirrorPlugins(){return[new le({key:new An("dynamicBulletStyling"),appendTransaction:(r,e,t)=>{const n=t.tr;let i=!1;return t.doc.descendants((s,l)=>{if(s.type.name==="listItem"){let a=0;const c=t.doc.resolve(l);for(let f=c.depth;f>0;f--)if(c.node(f).type.name==="bulletList"){a=1;break}a>0&&(n.setNodeAttribute(c.pos,"[data-style]","line-height: inherit"),i=!0)}}),i?n:null}})]}}),nr=r=>r==="bulletList"||r==="orderedList",rr=r=>r==="paragraph"||r==="heading",Ut=se.Extension.create({name:"listIndentIntegration",addProseMirrorPlugins(){return[new le({appendTransaction:(r,e,t)=>{if(!r.find(i=>i.docChanged))return null;let n=null;return t.doc.descendants((i,s)=>{var l;if(rr(i.type.name)&&(((l=i==null?void 0:i.attrs)==null?void 0:l.indent)??0)>0){const a=t.doc.resolve(s);if(a.parent.type.name==="listItem"){let f=null;for(let u=a.depth-1;u>0;u--){const p=a.node(u);if(nr(p.type.name)){f=a.start(u)-1;break}}if(f!==null&&f>=0){n||(n=t.tr);const u=i.attrs.indent;n.setNodeAttribute(s,"indent",0),n.setNodeAttribute(f,"indent",u)}}}}),n}}),new le({props:{transformPastedHTML(r){const e=/<p[^>]*style="[^"]*(?:padding|margin)-left:\s*(\d+)(?:px|pt|em)[^"]*"[^>]*>/gi;r=r.replace(e,(i,s)=>`<p data-indent="${Math.floor(parseInt(s,10)/40)}">`);const t=/<ol[^>]*style="[^"]*list-style-type:\s*(upper-roman|lower-roman|upper-alpha|lower-alpha)[^"]*"[^>]*>/gi;r=r.replace(t,()=>"<ol>");const n=/<li[^>]*style="[^"]*list-style-type:\s*[^;"\s]+[^"]*"[^>]*>/gi;return r=r.replace(n,i=>i.replace(/list-style-type:\s*[^;"\s]+;?/gi,"")),r}}})]}}),ot=se.Extension.create({name:"fontSize",addOptions(){return{types:["textStyle"],getStyle:r=>`font-size: ${r}`}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:r=>r.style.fontSize.replace(/['"]+/g,""),renderHTML:r=>r.fontSize?{style:this.options.getStyle(r.fontSize)}:{}}}}]},addCommands(){return{setFontSize:r=>({chain:e})=>e().setMark("textStyle",{fontSize:r}).run(),unsetFontSize:()=>({chain:r})=>r().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),at=se.Extension.create({name:"lineHeight",addOptions(){return{types:["textStyle"],getStyle:r=>`line-height: ${r};`}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:r=>r.style.lineHeight.replace(/['"]+/g,""),renderHTML:r=>r.lineHeight?{style:this.options.getStyle(r.lineHeight)}:{}}}}]},addCommands(){return{setLineHeight:r=>({chain:e})=>e().setMark("textStyle",{lineHeight:r}).run(),unsetLineHeight:()=>({chain:r})=>r().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}}),ir=[$,Z.CharacterCount,X,Pe,gt,yt,vt,tt,Ze,D.ListItem,D.ListKeymap,wt,D.OrderedList,Z.Placeholder,Y.Table,Y.TableCell,Y.TableHeader,Y.TableRow,D.TaskItem,D.TaskList,Fe,Je.TextStyle,We,Be,$e,_e,De,Z.UndoRedo,it,ot,at,D.BulletList,st],sr=[Jt,Je.TextStyle,X,Z.UndoRedo.configure({newGroupDelay:500,depth:100}),De,We,$,_e,D.TaskItem,it,Pe,$e,ot,at,qt,st,tt,Ut,Fe.configure({types:["heading","paragraph"]}),Vt.configure({itemTypeName:"listItem",keepMarks:!0,keepAttributes:!0}),Ze,jt],or=se.Extension.create({name:"MentionStorage",addStorage(){return{suggestions:[]}}});var ue={},Kt;function ar(){if(Kt)return ue;Kt=1;var r=xn;if(process.env.NODE_ENV==="production")ue.createRoot=r.createRoot,ue.hydrateRoot=r.hydrateRoot;else{var e=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;ue.createRoot=function(t,n){e.usingClientEntryPoint=!0;try{return r.createRoot(t,n)}finally{e.usingClientEntryPoint=!1}},ue.hydrateRoot=function(t,n,i){e.usingClientEntryPoint=!0;try{return r.hydrateRoot(t,n,i)}finally{e.usingClientEntryPoint=!1}}}return ue}var lr=ar(),Ne={exports:{}},ge={};/**
25
25
  * @license React
26
26
  * react-jsx-runtime.production.min.js
27
27
  *
@@ -50,4 +50,4 @@ Check the top-level render call using <`+m+">.")}return d}}function Sn(o,d){{if(
50
50
  <%s {...props} />
51
51
  React keys must be passed directly to JSX without using spread:
52
52
  let props = %s;
53
- <%s key={someKey} {...props} />`,mt,ie,Vr,ie),bn[ie+mt]=!0}}return o===n?Jr(L):Fr(L),L}}function Wr(o,d,m){return En(o,d,m,!0)}function Hr(o,d,m){return En(o,d,m,!1)}var jr=Hr,qr=Wr;ye.Fragment=n,ye.jsx=jr,ye.jsxs=qr})()),ye}var Gt;function dr(){return Gt||(Gt=1,process.env.NODE_ENV==="production"?Ne.exports=cr():Ne.exports=ur()),Ne.exports}var ve=dr();const fr=({images:r,onAdd:e,onDelete:t,onImageClick:n,focusedImageIndex:i})=>ve.jsxs("div",{className:"batch-image-gallery",style:{display:"flex",gap:"8px",overflowX:"auto",padding:"8px"},children:[r.map((s,l)=>ve.jsxs("div",{style:{position:"relative",border:i===l?"2px solid blue":"2px solid transparent",cursor:"pointer"},onClick:()=>n(s),children:[ve.jsx("img",{src:s.src,alt:s.alt,style:{width:"80px",height:"80px",objectFit:"cover"}}),ve.jsx("button",{onClick:a=>{a.stopPropagation(),t(l)},style:{position:"absolute",top:0,right:0},children:"×"})]},s.id)),ve.jsx("button",{onClick:e,style:{width:"80px",height:"80px"},children:"+"})]});let we=null;const hr=se.Node.create({name:"batchSegmentImages",group:"block",inline:!1,atom:!0,addOptions(){return{maxImageAmount:void 0,height:void 0,onAdd:void 0,onRemove:void 0,onImageClick:void 0,initialImageRegistry:void 0}},addStorage(){return{imageRegistry:new Map(this.options.initialImageRegistry)}},addAttributes(){return{batchId:{default:null,parseHTML:r=>r.getAttribute("data-batch-id"),renderHTML:r=>({"data-batch-id":r.batchId})},id:{default:null,parseHTML:r=>r.getAttribute("data-id"),renderHTML:r=>({"data-id":r.id})},images:{default:[],parseHTML:r=>{const e=r.querySelectorAll("img"),t=[];return e.forEach(n=>{const i=n.getAttribute("data-id"),s=n.getAttribute("src"),l=n.getAttribute("alt"),a=n.getAttribute("title");i&&s&&t.push({id:i,src:s,alt:l??void 0,title:a??void 0})}),t},renderHTML:()=>({})},imageVersion:{default:0,parseHTML:()=>0,renderHTML:()=>({})},focusedImageIndex:{default:null,parseHTML:()=>null,renderHTML:()=>({})}}},addProseMirrorPlugins(){return[new le({props:{handleKeyDown(r,e){return e.key==="ArrowLeft"||e.key==="ArrowUp"?we="left":e.key==="ArrowRight"||e.key==="ArrowDown"?we="right":we=null,!1}}})]},addKeyboardShortcuts(){const r=(n,i)=>{const s=this.editor.state.tr.setNodeMarkup(n,void 0,{...i.attrs,focusedImageIndex:null}).setMeta("addToHistory",!1);s.setSelection(F.near(s.doc.resolve(n))),this.editor.view.dispatch(s)},e=(n,i)=>{const s=n+i.nodeSize,l=this.editor.state.tr.setNodeMarkup(n,void 0,{...i.attrs,focusedImageIndex:null}).setMeta("addToHistory",!1);l.setSelection(F.near(l.doc.resolve(s))),this.editor.view.dispatch(l)},t=n=>{var p,y;const{selection:i}=this.editor.state;if(!(i instanceof B))return!1;const s=i.node;if(s.type.name!=="batchSegmentImages")return!1;const l=((y=(p=this.editor.storage.batchSegmentImages)==null?void 0:p.imageRegistry)==null?void 0:y.get(s.attrs.batchId))??s.attrs.images;if(!l.length)return!1;const a=i.from,c=s.attrs.focusedImageIndex,f=!!this.options.onAdd;let u;if(n==="right"){if(c===null)return e(a,s),!0;if(c<l.length-1)u=c+1;else if(c===l.length-1&&f)u=null;else return e(a,s),!0}else if(c===null)u=l.length-1;else if(c>0)u=c-1;else return r(a,s),!0;if(this.editor.view.dispatch(this.editor.state.tr.setNodeMarkup(a,void 0,{...s.attrs,focusedImageIndex:u}).setMeta("addToHistory",!1)),u!==null&&u>=0&&u<l.length){const w=this.editor.view.nodeDOM(a);w instanceof HTMLElement&&requestAnimationFrame(()=>{var b;(b=w.querySelectorAll("img")[u])==null||b.scrollIntoView({block:"nearest",inline:"nearest"})})}return!0};return{ArrowLeft:()=>t("left"),ArrowRight:()=>t("right"),Space:()=>{var c,f,u,p,y,w;const{selection:n}=this.editor.state;if(!(n instanceof B))return!1;const i=n.node;if(i.type.name!=="batchSegmentImages")return!1;const s=((f=(c=this.editor.storage.batchSegmentImages)==null?void 0:c.imageRegistry)==null?void 0:f.get(i.attrs.batchId))??i.attrs.images,l=i.attrs.focusedImageIndex,a=n.from;if(l===null)return(p=(u=this.options).onAdd)==null||p.call(u,{position:"last",batchId:i.attrs.batchId,currentImages:s,getPos:()=>a,editor:this.editor}),!0;if(l>=0&&l<s.length){const g=s[l];return(w=(y=this.options).onImageClick)==null||w.call(y,{imageId:g.id,batchId:i.attrs.batchId,src:g.src,getPos:()=>a,editor:this.editor}),!0}return!1}}},renderHTML({node:r}){const e=r.attrs.images??[];return["div",{"data-batch-id":r.attrs.batchId,style:"display: flex; overflow-x: auto; gap: 10px; white-space: nowrap; padding: 10px 0;"},...e.map(t=>["img",{"data-id":t.id,src:t.src,alt:t.alt??"",title:t.title??"",style:"width: 80px; height: 80px; object-fit: cover; flex-shrink: 0;"}])]},addNodeView(){return({node:r,getPos:e,editor:t})=>{const n=this.options,i=this.storage,s=document.createElement("div");s.style.width="100%",s.classList.add("batch-segment-gallery"),i.imageRegistry.has(r.attrs.batchId)||i.imageRegistry.set(r.attrs.batchId,r.attrs.images??[]);const l=lr.createRoot(s),a={current:r};let c=null;const f=()=>{var g;(g=n.onAdd)==null||g.call(n,{position:"last",batchId:a.current.attrs.batchId,currentImages:i.imageRegistry.get(a.current.attrs.batchId)??[],getPos:e,editor:t})},u=g=>{var b,M;(M=n.onRemove)==null||M.call(n,{index:g,imageId:(b=(i.imageRegistry.get(a.current.attrs.batchId)??[])[g])==null?void 0:b.id,batchId:a.current.attrs.batchId,getPos:e,editor:t})},p=g=>{var M;const b=e();if(b!==void 0){const A=(i.imageRegistry.get(a.current.attrs.batchId)??[]).findIndex(C=>C.id===g.id);t.view.dispatch(t.state.tr.setNodeMarkup(b,void 0,{...a.current.attrs,focusedImageIndex:A}).setMeta("addToHistory",!1))}(M=n.onImageClick)==null||M.call(n,{imageId:g.id,batchId:a.current.attrs.batchId,src:g.src,getPos:e,editor:t})},y=()=>{const[g,b]=je.useState({images:i.imageRegistry.get(r.attrs.batchId)??[],focusedImageIndex:r.attrs.focusedImageIndex,batchId:r.attrs.batchId});return c=b,je.createElement(fr,{batchId:g.batchId,images:g.images,maxImageAmount:n.maxImageAmount,height:n.height,focusedImageIndex:g.focusedImageIndex,onAdd:f,onDelete:u,onImageClick:p})};l.render(je.createElement(y));let w=r;return s.addEventListener("click",()=>{const g=e();if(g!==void 0){const{state:b,view:M}=t,A=b.doc.nodeAt(g);if(!A)return;const C=b.tr.setNodeMarkup(g,void 0,{...A.attrs,focusedImageIndex:null}).setMeta("addToHistory",!1);M.dispatch(C.setSelection(B.create(C.doc,g)))}}),{dom:s,update:g=>g.type!==r.type?!1:(g===w||(w=g,a.current=g,c==null||c({images:i.imageRegistry.get(g.attrs.batchId)??[],focusedImageIndex:g.attrs.focusedImageIndex,batchId:g.attrs.batchId})),!0),selectNode:()=>{const g=we;we=null;const b=e();if(b===void 0)return;const M=t.state.doc.nodeAt(b);if(!M||M.attrs.focusedImageIndex!==null)return;const A=g==="left"?null:0;queueMicrotask(()=>{const C=e();if(C===void 0)return;const Se=t.state.doc.nodeAt(C);!Se||Se.attrs.focusedImageIndex!==null||t.state.selection instanceof B&&t.view.dispatch(t.state.tr.setNodeMarkup(C,void 0,{...Se.attrs,focusedImageIndex:A}).setMeta("addToHistory",!1))})},deselectNode:()=>{const g=e();if(g===void 0)return;const b=t.state.doc.nodeAt(g);!b||b.attrs.focusedImageIndex===null||t.view.dispatch(t.state.tr.setNodeMarkup(g,void 0,{...b.attrs,focusedImageIndex:null}).setMeta("addToHistory",!1))},destroy:()=>{i.imageRegistry.delete(r.attrs.batchId),queueMicrotask(()=>l.unmount())}}}},addCommands(){return{insertBatchImages:({batchId:r,images:e})=>t=>(t.editor.storage.batchSegmentImages.imageRegistry.set(r,e),t.chain().insertContent({type:"batchSegmentImages",attrs:{batchId:r,images:e,id:crypto.randomUUID()}}).run())}},parseHTML(){return[{tag:"div[data-batch-id]"}]}});h.Bold=$,h.Color=X,h.Document=Pe,h.FileHandler=gt,h.HardBreak=De,h.Heading=yt,h.Highlight=vt,h.Image=wt,h.Italic=_e,h.Link=St,Object.defineProperty(h,"BulletList",{enumerable:!0,get:()=>D.BulletList}),Object.defineProperty(h,"ListItem",{enumerable:!0,get:()=>D.ListItem}),Object.defineProperty(h,"ListKeymap",{enumerable:!0,get:()=>D.ListKeymap}),Object.defineProperty(h,"OrderedList",{enumerable:!0,get:()=>D.OrderedList}),Object.defineProperty(h,"TaskItem",{enumerable:!0,get:()=>D.TaskItem}),Object.defineProperty(h,"TaskList",{enumerable:!0,get:()=>D.TaskList}),h.Mention=It,h.Paragraph=Be,Object.defineProperty(h,"Table",{enumerable:!0,get:()=>Y.Table}),Object.defineProperty(h,"TableCell",{enumerable:!0,get:()=>Y.TableCell}),Object.defineProperty(h,"TableHeader",{enumerable:!0,get:()=>Y.TableHeader}),Object.defineProperty(h,"TableRow",{enumerable:!0,get:()=>Y.TableRow}),h.Text=$e,h.TextAlign=Fe,Object.defineProperty(h,"TextStyle",{enumerable:!0,get:()=>Je.TextStyle}),h.Underline=We,Object.defineProperty(h,"CharacterCount",{enumerable:!0,get:()=>Z.CharacterCount}),Object.defineProperty(h,"History",{enumerable:!0,get:()=>Z.UndoRedo}),Object.defineProperty(h,"Placeholder",{enumerable:!0,get:()=>Z.Placeholder}),Object.defineProperty(h,"Editor",{enumerable:!0,get:()=>Ee.Editor}),Object.defineProperty(h,"EditorContent",{enumerable:!0,get:()=>Ee.EditorContent}),Object.defineProperty(h,"useEditor",{enumerable:!0,get:()=>Ee.useEditor}),h.ALL_EXTENSIONS=ir,h.BASE_EXTENSIONS=sr,h.BatchSegmentImagesExtension=hr,h.CustomBulletList=qt,h.CustomLink=Ze,h.CustomListItem=it,h.CustomOrderedList=Vt,h.CustomParagraph=Jt,h.DynamicBulletStyling=st,h.FontSize=ot,h.ImageResize=tt,h.IndentExtension=jt,h.LineHeight=at,h.ListIndentIntegration=Ut,h.MentionStorage=or,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})}));
53
+ <%s key={someKey} {...props} />`,mt,ie,Vr,ie),bn[ie+mt]=!0}}return o===n?Jr(L):Fr(L),L}}function Wr(o,d,m){return En(o,d,m,!0)}function Hr(o,d,m){return En(o,d,m,!1)}var jr=Hr,qr=Wr;ye.Fragment=n,ye.jsx=jr,ye.jsxs=qr})()),ye}var Gt;function dr(){return Gt||(Gt=1,process.env.NODE_ENV==="production"?Ne.exports=cr():Ne.exports=ur()),Ne.exports}var ve=dr();const fr=({images:r,onAdd:e,onDelete:t,onImageClick:n,focusedImageIndex:i})=>ve.jsxs("div",{className:"batch-image-gallery",style:{display:"flex",gap:"8px",overflowX:"auto",padding:"8px"},children:[r.map((s,l)=>ve.jsxs("div",{style:{position:"relative",border:i===l?"2px solid blue":"2px solid transparent",cursor:"pointer"},onClick:()=>n(s),children:[ve.jsx("img",{src:s.src,alt:s.alt,style:{width:"80px",height:"80px",objectFit:"cover"}}),ve.jsx("button",{onClick:a=>{a.stopPropagation(),t(l)},style:{position:"absolute",top:0,right:0},children:"×"})]},s.id)),ve.jsx("button",{onClick:e,style:{width:"80px",height:"80px"},children:"+"})]});let we=null;const hr=se.Node.create({name:"batchSegmentImages",group:"block",inline:!1,atom:!0,addOptions(){return{maxImageAmount:void 0,height:void 0,onAdd:void 0,onRemove:void 0,onImageClick:void 0,initialImageRegistry:void 0}},addStorage(){return{imageRegistry:new Map(this.options.initialImageRegistry)}},addAttributes(){return{batchId:{default:null,parseHTML:r=>r.getAttribute("data-batch-id"),renderHTML:r=>({"data-batch-id":r.batchId})},id:{default:null,parseHTML:r=>r.getAttribute("data-id"),renderHTML:r=>({"data-id":r.id})},images:{default:[],parseHTML:r=>{const e=r.querySelectorAll("img"),t=[];return e.forEach(n=>{const i=n.getAttribute("data-id"),s=n.getAttribute("src"),l=n.getAttribute("alt"),a=n.getAttribute("title");i&&s&&t.push({id:i,src:s,alt:l??void 0,title:a??void 0})}),t},renderHTML:()=>({})},imageVersion:{default:0,parseHTML:()=>0,renderHTML:()=>({})},focusedImageIndex:{default:null,parseHTML:()=>null,renderHTML:()=>({})}}},addProseMirrorPlugins(){return[new le({props:{handleKeyDown(r,e){return e.key==="ArrowLeft"||e.key==="ArrowUp"?we="left":e.key==="ArrowRight"||e.key==="ArrowDown"?we="right":we=null,!1}}})]},addKeyboardShortcuts(){const r=(n,i)=>{const s=this.editor.state.tr.setNodeMarkup(n,void 0,{...i.attrs,focusedImageIndex:null}).setMeta("addToHistory",!1);s.setSelection(F.near(s.doc.resolve(n))),this.editor.view.dispatch(s)},e=(n,i)=>{const s=n+i.nodeSize,l=this.editor.state.tr.setNodeMarkup(n,void 0,{...i.attrs,focusedImageIndex:null}).setMeta("addToHistory",!1);l.setSelection(F.near(l.doc.resolve(s))),this.editor.view.dispatch(l)},t=n=>{var p,y;const{selection:i}=this.editor.state;if(!(i instanceof B))return!1;const s=i.node;if(s.type.name!=="batchSegmentImages")return!1;const l=((y=(p=this.editor.storage.batchSegmentImages)==null?void 0:p.imageRegistry)==null?void 0:y.get(s.attrs.batchId))??s.attrs.images;if(!l.length)return!1;const a=i.from,c=s.attrs.focusedImageIndex,f=!!this.options.onAdd;let u;if(n==="right"){if(c===null)return e(a,s),!0;if(c<l.length-1)u=c+1;else if(c===l.length-1&&f)u=null;else return e(a,s),!0}else if(c===null)u=l.length-1;else if(c>0)u=c-1;else return r(a,s),!0;if(this.editor.view.dispatch(this.editor.state.tr.setNodeMarkup(a,void 0,{...s.attrs,focusedImageIndex:u}).setMeta("addToHistory",!1)),u!==null&&u>=0&&u<l.length){const w=this.editor.view.nodeDOM(a);w instanceof HTMLElement&&requestAnimationFrame(()=>{var b;(b=w.querySelectorAll("img")[u])==null||b.scrollIntoView({block:"nearest",inline:"nearest"})})}return!0};return{ArrowLeft:()=>t("left"),ArrowRight:()=>t("right"),Space:()=>{var c,f,u,p,y,w;const{selection:n}=this.editor.state;if(!(n instanceof B))return!1;const i=n.node;if(i.type.name!=="batchSegmentImages")return!1;const s=((f=(c=this.editor.storage.batchSegmentImages)==null?void 0:c.imageRegistry)==null?void 0:f.get(i.attrs.batchId))??i.attrs.images,l=i.attrs.focusedImageIndex,a=n.from;if(l===null)return(p=(u=this.options).onAdd)==null||p.call(u,{position:"last",batchId:i.attrs.batchId,currentImages:s,getPos:()=>a,editor:this.editor}),!0;if(l>=0&&l<s.length){const g=s[l];return(w=(y=this.options).onImageClick)==null||w.call(y,{imageId:g.id,batchId:i.attrs.batchId,src:g.src,getPos:()=>a,editor:this.editor}),!0}return!1}}},renderHTML({node:r}){const e=r.attrs.images??[];return["div",{"data-batch-id":r.attrs.batchId,style:"display: flex; overflow-x: auto; gap: 10px; white-space: nowrap; padding: 10px 0;"},...e.map(t=>["img",{"data-id":t.id,src:t.src,alt:t.alt??"",title:t.title??"",style:"width: 80px; height: 80px; object-fit: cover; flex-shrink: 0;"}])]},addNodeView(){return({node:r,getPos:e,editor:t})=>{const n=this.options,i=this.storage,s=document.createElement("div");s.style.width="100%",s.classList.add("batch-segment-gallery"),i.imageRegistry.has(r.attrs.batchId)||i.imageRegistry.set(r.attrs.batchId,r.attrs.images??[]);const l=lr.createRoot(s),a={current:r};let c=null;const f=()=>{var g;(g=n.onAdd)==null||g.call(n,{position:"last",batchId:a.current.attrs.batchId,currentImages:i.imageRegistry.get(a.current.attrs.batchId)??[],getPos:e,editor:t})},u=g=>{var b,M;(M=n.onRemove)==null||M.call(n,{index:g,imageId:(b=(i.imageRegistry.get(a.current.attrs.batchId)??[])[g])==null?void 0:b.id,batchId:a.current.attrs.batchId,getPos:e,editor:t})},p=g=>{var M;const b=e();if(b!==void 0){const A=(i.imageRegistry.get(a.current.attrs.batchId)??[]).findIndex(C=>C.id===g.id);t.view.dispatch(t.state.tr.setNodeMarkup(b,void 0,{...a.current.attrs,focusedImageIndex:A}).setMeta("addToHistory",!1))}(M=n.onImageClick)==null||M.call(n,{imageId:g.id,batchId:a.current.attrs.batchId,src:g.src,getPos:e,editor:t})},y=()=>{const[g,b]=je.useState({images:i.imageRegistry.get(r.attrs.batchId)??[],focusedImageIndex:r.attrs.focusedImageIndex,batchId:r.attrs.batchId});return c=b,je.createElement(fr,{batchId:g.batchId,images:g.images,maxImageAmount:n.maxImageAmount,height:n.height,focusedImageIndex:g.focusedImageIndex,onAdd:f,onDelete:u,onImageClick:p})};l.render(je.createElement(y));let w=r;return s.addEventListener("click",()=>{const g=e();if(g!==void 0){const{state:b,view:M}=t,A=b.doc.nodeAt(g);if(!A)return;const C=b.tr.setNodeMarkup(g,void 0,{...A.attrs,focusedImageIndex:null}).setMeta("addToHistory",!1);M.dispatch(C.setSelection(B.create(C.doc,g)))}}),{dom:s,update:g=>g.type!==r.type?!1:(g===w||(w=g,a.current=g,c==null||c({images:i.imageRegistry.get(g.attrs.batchId)??[],focusedImageIndex:g.attrs.focusedImageIndex,batchId:g.attrs.batchId})),!0),selectNode:()=>{const g=we;we=null;const b=e();if(b===void 0)return;const M=t.state.doc.nodeAt(b);if(!M||M.attrs.focusedImageIndex!==null)return;const A=g==="left"?null:0;queueMicrotask(()=>{const C=e();if(C===void 0)return;const Se=t.state.doc.nodeAt(C);!Se||Se.attrs.focusedImageIndex!==null||t.state.selection instanceof B&&t.view.dispatch(t.state.tr.setNodeMarkup(C,void 0,{...Se.attrs,focusedImageIndex:A}).setMeta("addToHistory",!1))})},deselectNode:()=>{const g=e();if(g===void 0)return;const b=t.state.doc.nodeAt(g);!b||b.attrs.focusedImageIndex===null||t.view.dispatch(t.state.tr.setNodeMarkup(g,void 0,{...b.attrs,focusedImageIndex:null}).setMeta("addToHistory",!1))},destroy:()=>{i.imageRegistry.delete(r.attrs.batchId),queueMicrotask(()=>l.unmount())}}}},addCommands(){return{insertBatchImages:({batchId:r,images:e})=>t=>(t.editor.storage.batchSegmentImages.imageRegistry.set(r,e),t.chain().insertContent({type:"batchSegmentImages",attrs:{batchId:r,images:e,id:crypto.randomUUID()}}).run())}},parseHTML(){return[{tag:"div[data-batch-id]"}]}});h.Bold=$,h.Color=X,h.Document=Pe,h.FileHandler=gt,h.HardBreak=De,h.Heading=yt,h.Highlight=vt,h.Italic=_e,Object.defineProperty(h,"BulletList",{enumerable:!0,get:()=>D.BulletList}),Object.defineProperty(h,"ListItem",{enumerable:!0,get:()=>D.ListItem}),Object.defineProperty(h,"ListKeymap",{enumerable:!0,get:()=>D.ListKeymap}),Object.defineProperty(h,"OrderedList",{enumerable:!0,get:()=>D.OrderedList}),Object.defineProperty(h,"TaskItem",{enumerable:!0,get:()=>D.TaskItem}),Object.defineProperty(h,"TaskList",{enumerable:!0,get:()=>D.TaskList}),h.Mention=wt,h.Paragraph=Be,Object.defineProperty(h,"Table",{enumerable:!0,get:()=>Y.Table}),Object.defineProperty(h,"TableCell",{enumerable:!0,get:()=>Y.TableCell}),Object.defineProperty(h,"TableHeader",{enumerable:!0,get:()=>Y.TableHeader}),Object.defineProperty(h,"TableRow",{enumerable:!0,get:()=>Y.TableRow}),h.Text=$e,h.TextAlign=Fe,Object.defineProperty(h,"TextStyle",{enumerable:!0,get:()=>Je.TextStyle}),h.Underline=We,Object.defineProperty(h,"CharacterCount",{enumerable:!0,get:()=>Z.CharacterCount}),Object.defineProperty(h,"History",{enumerable:!0,get:()=>Z.UndoRedo}),Object.defineProperty(h,"Placeholder",{enumerable:!0,get:()=>Z.Placeholder}),h.Link=St,h.Image=It,Object.defineProperty(h,"Editor",{enumerable:!0,get:()=>Ee.Editor}),Object.defineProperty(h,"EditorContent",{enumerable:!0,get:()=>Ee.EditorContent}),Object.defineProperty(h,"useEditor",{enumerable:!0,get:()=>Ee.useEditor}),h.ALL_EXTENSIONS=ir,h.BASE_EXTENSIONS=sr,h.BatchSegmentImagesExtension=hr,h.CustomBulletList=qt,h.CustomLink=Ze,h.CustomListItem=it,h.CustomOrderedList=Vt,h.CustomParagraph=Jt,h.DynamicBulletStyling=st,h.FontSize=ot,h.ImageResize=tt,h.IndentExtension=jt,h.LineHeight=at,h.ListIndentIntegration=Ut,h.MentionStorage=or,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sovann72-dev/lynqify-ui",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "main": "dist/lynqify-ui.umd.cjs",
5
5
  "module": "dist/lynqify-ui.js",
6
6
  "types": "dist/index.d.ts",