@blocknote/core 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/blocknote.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(P,A){typeof exports=="object"&&typeof module<"u"?A(exports,require("@tiptap/core"),require("@tiptap/extension-bold"),require("@tiptap/extension-code"),require("@tiptap/extension-dropcursor"),require("@tiptap/extension-gapcursor"),require("@tiptap/extension-hard-break"),require("@tiptap/extension-history"),require("@tiptap/extension-italic"),require("@tiptap/extension-strike"),require("@tiptap/extension-text"),require("@tiptap/extension-underline"),require("prosemirror-state"),require("prosemirror-model"),require("prosemirror-view"),require("react"),require("@mantine/core"),require("react-dom"),require("@tippyjs/react"),require("lodash"),require("@tiptap/react"),require("@tiptap/extension-link"),require("@tiptap/extension-paragraph"),require("uuid")):typeof define=="function"&&define.amd?define(["exports","@tiptap/core","@tiptap/extension-bold","@tiptap/extension-code","@tiptap/extension-dropcursor","@tiptap/extension-gapcursor","@tiptap/extension-hard-break","@tiptap/extension-history","@tiptap/extension-italic","@tiptap/extension-strike","@tiptap/extension-text","@tiptap/extension-underline","prosemirror-state","prosemirror-model","prosemirror-view","react","@mantine/core","react-dom","@tippyjs/react","lodash","@tiptap/react","@tiptap/extension-link","@tiptap/extension-paragraph","uuid"],A):(P=typeof globalThis<"u"?globalThis:P||self,A(P.blocknote={},P.core,P.Bold,P.Code,P.DropCursor,P.GapCursor,P.HardBreak,P.extensionHistory,P.Italic,P.Strike,P.Text,P.Underline,P.prosemirrorState,P.prosemirrorModel,P.pv,P.React,P.core$1,P.ReactDOM,P.Tippy,P.lodash,P.react,P.extensionLink,P.Paragraph,P.uuid))})(this,function(P,A,lt,Oi,Si,Ci,Ai,Ri,Ii,Di,Ni,Mi,V,D,Ve,ae,L,Pi,ji,yn,bn,Li,Bi,_i){"use strict";var ul=Object.defineProperty;var dl=(P,A,lt)=>A in P?ul(P,A,{enumerable:!0,configurable:!0,writable:!0,value:lt}):P[A]=lt;var oe=(P,A,lt)=>(dl(P,typeof A!="symbol"?A+"":A,lt),lt);const he=e=>e&&typeof e=="object"&&"default"in e?e:{default:e};function Hi(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const Fi=he(lt),zi=he(Oi),Vi=he(Si),qi=he(Ci),Ui=he(Ai),Wi=he(Ii),$i=he(Di),Ji=he(Ni),Yi=he(Mi),Gi=Hi(Ve),qe=he(ae),Ke=he(Pi),Ht=he(ji),Ki=he(Bi),fl="",or=65535,ar=Math.pow(2,16);function Xi(e,t){return e+t*ar}function sr(e){return e&or}function Zi(e){return(e-(e&or))/ar}const lr=1,cr=2,sn=4,ur=8;class dr{constructor(t,n,r){this.pos=t,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&ur)>0}get deletedBefore(){return(this.delInfo&(lr|sn))>0}get deletedAfter(){return(this.delInfo&(cr|sn))>0}get deletedAcross(){return(this.delInfo&sn)>0}}class Te{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&Te.empty)return Te.empty}recover(t){let n=0,r=sr(t);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+Zi(t)}mapResult(t,n=1){return this._map(t,n,!1)}map(t,n=1){return this._map(t,n,!0)}_map(t,n,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>t)break;let d=this.ranges[a+o],u=this.ranges[a+s],p=l+d;if(t<=p){let m=d?t==l?-1:t==p?1:n:n,y=l+i+(m<0?0:u);if(r)return y;let x=t==(n<0?l:p)?null:Xi(a/3,t-l),b=t==l?cr:t==p?lr:sn;return(n<0?t!=l:t!=p)&&(b|=ur),new dr(y,b,x)}i+=u-d}return r?t+i:new dr(t+i,0,null)}touches(t,n){let r=0,i=sr(n),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>t)break;let d=this.ranges[a+o],u=l+d;if(t<=u&&a==i*3)return!0;r+=this.ranges[a+s]-d}return!1}forEach(t){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],a=s-(this.inverted?o:0),l=s+(this.inverted?0:o),d=this.ranges[i+n],u=this.ranges[i+r];t(a,a+d,l,l+u),o+=u-d}}invert(){return new Te(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?Te.empty:new Te(t<0?[0,-t,0]:[0,0,t])}}Te.empty=new Te([]);const xn=Object.create(null);class ue{getMap(){return Te.empty}merge(t){return null}static fromJSON(t,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=xn[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in xn)throw new RangeError("Duplicate use of step JSON ID "+t);return xn[t]=n,n.prototype.jsonID=t,n}}class Q{constructor(t,n){this.doc=t,this.failed=n}static ok(t){return new Q(t,null)}static fail(t){return new Q(null,t)}static fromReplace(t,n,r,i){try{return Q.ok(t.replace(n,r,i))}catch(o){if(o instanceof D.ReplaceError)return Q.fail(o.message);throw o}}}function wn(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let o=e.child(i);o.content.size&&(o=o.copy(wn(o.content,t,o))),o.isInline&&(o=t(o,n,i)),r.push(o)}return D.Fragment.fromArray(r)}class ct extends ue{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=t.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new D.Slice(wn(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return Q.fromReplace(t,this.from,this.to,o)}invert(){return new ut(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new ct(n.pos,r.pos,this.mark)}merge(t){return t instanceof ct&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new ct(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ct(n.from,n.to,t.markFromJSON(n.mark))}}ue.jsonID("addMark",ct);class ut extends ue{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=new D.Slice(wn(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),n.openStart,n.openEnd);return Q.fromReplace(t,this.from,this.to,r)}invert(){return new ct(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new ut(n.pos,r.pos,this.mark)}merge(t){return t instanceof ut&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new ut(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ut(n.from,n.to,t.markFromJSON(n.mark))}}ue.jsonID("removeMark",ut);class dt extends ue{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return Q.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Q.fromReplace(t,this.pos,this.pos+1,new D.Slice(D.Fragment.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new dt(this.pos,n.marks[i]);return new dt(this.pos,this.mark)}}return new Ft(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new dt(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new dt(n.pos,t.markFromJSON(n.mark))}}ue.jsonID("addNodeMark",dt);class Ft extends ue{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return Q.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Q.fromReplace(t,this.pos,this.pos+1,new D.Slice(D.Fragment.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new dt(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Ft(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Ft(n.pos,t.markFromJSON(n.mark))}}ue.jsonID("removeNodeMark",Ft);class Ne extends ue{constructor(t,n,r,i=!1){super(),this.from=t,this.to=n,this.slice=r,this.structure=i}apply(t){return this.structure&&En(t,this.from,this.to)?Q.fail("Structure replace would overwrite content"):Q.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new Te([this.from,this.to-this.from,this.slice.size])}invert(t){return new Ne(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Ne(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(t){if(!(t instanceof Ne)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?D.Slice.empty:new D.Slice(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new Ne(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?D.Slice.empty:new D.Slice(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new Ne(t.from,this.to,n,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ne(n.from,n.to,D.Slice.fromJSON(t,n.slice),!!n.structure)}}ue.jsonID("replace",Ne);class Xe extends ue{constructor(t,n,r,i,o,s,a=!1){super(),this.from=t,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=a}apply(t){if(this.structure&&(En(t,this.from,this.gapFrom)||En(t,this.gapTo,this.to)))return Q.fail("Structure gap-replace would overwrite content");let n=t.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Q.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Q.fromReplace(t,this.from,this.to,r):Q.fail("Content does not fit in gap")}getMap(){return new Te([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new Xe(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=t.map(this.gapFrom,-1),o=t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new Xe(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Xe(n.from,n.to,n.gapFrom,n.gapTo,D.Slice.fromJSON(t,n.slice),n.insert,!!n.structure)}}ue.jsonID("replaceAround",Xe);function En(e,t,n){let r=e.resolve(t),i=n-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function Qi(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function fr(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth;;--r){let i=e.$from.node(r),o=e.$from.index(r),s=e.$to.indexAfter(r);if(r<e.depth&&i.canReplace(o,s,n))return r;if(r==0||i.type.spec.isolating||!Qi(i,o,s))break}return null}function pr(e,t){let n=e.resolve(t),r=n.index();return eo(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function eo(e,t){return!!(e&&t&&!e.isLeaf&&e.canAppend(t))}function to(e,t,n=t,r=D.Slice.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),o=e.resolve(n);return no(i,o,r)?new Ne(t,n,r):new ro(i,o,r).fit()}function no(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}class ro{constructor(t,n,r){this.$from=t,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=D.Fragment.empty;for(let i=0;i<=t.depth;i++){let o=t.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(t.indexAfter(i))})}for(let i=t.depth;i>0;i--)this.placed=D.Fragment.from(t.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(t<0?this.$to:r.doc.resolve(t));if(!i)return null;let o=this.placed,s=r.depth,a=i.depth;for(;s&&a&&o.childCount==1;)o=o.firstChild.content,s--,a--;let l=new D.Slice(o,s,a);return t>-1?new Xe(r.pos,t,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Ne(r.pos,i.pos,l):null}findFittable(){for(let t=1;t<=2;t++)for(let n=this.unplaced.openStart;n>=0;n--){let r,i=null;n?(i=kn(this.unplaced.content,n-1).firstChild,r=i.content):r=this.unplaced.content;let o=r.firstChild;for(let s=this.depth;s>=0;s--){let{type:a,match:l}=this.frontier[s],d,u=null;if(t==1&&(o?l.matchType(o.type)||(u=l.fillBefore(D.Fragment.from(o),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:n,frontierDepth:s,parent:i,inject:u};if(t==2&&o&&(d=l.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:s,parent:i,wrap:d};if(i&&l.matchType(i.type))break}}}openMore(){let{content:t,openStart:n,openEnd:r}=this.unplaced,i=kn(t,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new D.Slice(t,n+1,Math.max(r,i.size+n>=t.size-r?n+1:0)),!0)}dropNode(){let{content:t,openStart:n,openEnd:r}=this.unplaced,i=kn(t,n);if(i.childCount<=1&&n>0){let o=t.size-n<=n+i.size;this.unplaced=new D.Slice(zt(t,n-1,1),n-1,o?n-1:r)}else this.unplaced=new D.Slice(zt(t,n,1),n,r)}placeNodes({sliceDepth:t,frontierDepth:n,parent:r,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let b=0;b<o.length;b++)this.openFrontierNode(o[b]);let s=this.unplaced,a=r?r.content:s.content,l=s.openStart-t,d=0,u=[],{match:p,type:m}=this.frontier[n];if(i){for(let b=0;b<i.childCount;b++)u.push(i.child(b));p=p.matchFragment(i)}let y=a.size+t-(s.content.size-s.openEnd);for(;d<a.childCount;){let b=a.child(d),O=p.matchType(b.type);if(!O)break;d++,(d>1||l==0||b.content.size)&&(p=O,u.push(hr(b.mark(m.allowedMarks(b.marks)),d==1?l:0,d==a.childCount?y:-1)))}let x=d==a.childCount;x||(y=-1),this.placed=Vt(this.placed,n,D.Fragment.from(u)),this.frontier[n].match=p,x&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let b=0,O=a;b<y;b++){let C=O.lastChild;this.frontier.push({type:C.type,match:C.contentMatchAt(C.childCount)}),O=C.content}this.unplaced=x?t==0?D.Slice.empty:new D.Slice(zt(s.content,t-1,1),t-1,y<0?s.openEnd:t-1):new D.Slice(zt(s.content,t,d),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t=this.frontier[this.depth],n;if(!t.type.isTextblock||!Tn(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(t){e:for(let n=Math.min(this.depth,t.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],o=n<t.depth&&t.end(n+1)==t.pos+(t.depth-(n+1)),s=Tn(t,n,i,r,o);if(!!s){for(let a=n-1;a>=0;a--){let{match:l,type:d}=this.frontier[a],u=Tn(t,a,d,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:o?t.doc.resolve(t.after(n+1)):t}}}}close(t){let n=this.findCloseLevel(t);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Vt(this.placed,n.depth,n.fit)),t=n.move;for(let r=n.depth+1;r<=t.depth;r++){let i=t.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,t.index(r));this.openFrontierNode(i.type,i.attrs,o)}return t}openFrontierNode(t,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(t),this.placed=Vt(this.placed,this.depth,D.Fragment.from(t.create(n,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(D.Fragment.empty,!0);n.childCount&&(this.placed=Vt(this.placed,this.frontier.length,n))}}function zt(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(zt(e.firstChild.content,t-1,n)))}function Vt(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Vt(e.lastChild.content,t-1,n)))}function kn(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function hr(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,hr(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(D.Fragment.empty,!0)))),e.copy(r)}function Tn(e,t,n,r,i){let o=e.node(t),s=i?e.indexAfter(t):e.index(t);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!io(n,o.content,s)?a:null}function io(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}class qt extends ue{constructor(t,n,r){super(),this.pos=t,this.attr=n,this.value=r}apply(t){let n=t.nodeAt(this.pos);if(!n)return Q.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Q.fromReplace(t,this.pos,this.pos+1,new D.Slice(D.Fragment.from(i),0,n.isLeaf?0:1))}getMap(){return Te.empty}invert(t){return new qt(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new qt(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new qt(n.pos,n.attr,n.value)}}ue.jsonID("attr",qt);let Ut=class extends Error{};Ut=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},Ut.prototype=Object.create(Error.prototype),Ut.prototype.constructor=Ut,Ut.prototype.name="TransformError";const oo=(e,t,n)=>{let{$cursor:r}=e.selection;if(!r||(n?!n.endOfTextblock("backward",e):r.parentOffset>0))return!1;let i=ao(r);if(!i){let s=r.blockRange(),a=s&&fr(s);return a===null?!1:(t&&t(e.tr.lift(s,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(!o.type.spec.isolating&&so(e,i,t))return!0;if(r.parent.content.size===0&&(ln(o,"end")||V.NodeSelection.isSelectable(o))){let s=to(e.doc,r.before(),r.after(),D.Slice.empty);if(s&&s.slice.size<s.to-s.from){if(t){let a=e.tr.step(s);a.setSelection(ln(o,"end")?V.Selection.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):V.NodeSelection.create(a.doc,i.pos-o.nodeSize)),t(a.scrollIntoView())}return!0}}return o.isAtom&&i.depth===r.depth-1?(t&&t(e.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1};function ao(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function so(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,o,s;if(r.type.spec.isolating||i.type.spec.isolating)return!1;if(lo(e,t,n))return!0;let a=t.parent.canReplace(t.index(),t.index()+1),l=V.Selection.findFrom(t,1),d=l&&l.$from.blockRange(l.$to),u=d&&fr(d);if(u!=null&&u>=t.depth)return n&&n(e.tr.lift(d,u).scrollIntoView()),!0;if(a&&ln(i,"start",!0)&&ln(r,"end")){let p=r,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let y=i,x=1;for(;!y.isTextblock;y=y.firstChild)x++;if(p.canReplace(p.childCount,p.childCount,y.content)){if(n){let b=D.Fragment.empty;for(let C=m.length-1;C>=0;C--)b=D.Fragment.from(m[C].copy(b));let O=e.tr.step(new Xe(t.pos-m.length,t.pos+i.nodeSize,t.pos+x,t.pos+i.nodeSize-x,new D.Slice(b,m.length,0),0,!0));n(O.scrollIntoView())}return!0}}if(a&&(o=(s=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&s.matchType(o[0]||i.type).validEnd){if(n){let p=t.pos+i.nodeSize,m=D.Fragment.empty;for(let b=o.length-1;b>=0;b--)m=D.Fragment.from(o[b].create(null,m));m=D.Fragment.from(r.copy(m));let y=e.tr.step(new Xe(t.pos-1,p,t.pos,p,new D.Slice(m,1,0),o.length,!0)),x=p+2*o.length;pr(y.doc,x)&&y.join(x),n(y.scrollIntoView())}return!0}return!1}function ln(e,t,n=!1){for(let r=e;r;r=t==="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!==1)return!1}return!1}function lo(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,o=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(o-1,o)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(o,o+1)||!(i.isTextblock||pr(e.doc,t.pos))?!1:(n&&n(e.tr.clearIncompatible(t.pos,r.type,r.contentMatchAt(r.childCount)).join(t.pos).scrollIntoView()),!0)}const ft=A.findParentNode(e=>e.type.name==="block");function vr(e,t,n){const r=ft(e.selection);return r?(t&&e.setNodeMarkup(r.pos,void 0,{...r.node.attrs,headingType:n}),!0):!1}const co=new V.PluginKey("ordered-list"),uo=()=>new V.Plugin({key:co,appendTransaction:(e,t,n)=>{const r=n.tr;let i=!1,o=1,s=0;return n.doc.descendants((a,l)=>{a.type.name==="block"&&!a.attrs.listType&&(o=1),s===0&&a.type.name==="block"&&a.attrs.listType==="oli"?(s=a.content.childCount,a.content.child(0).attrs.position!==`${o}.`&&(r.setNodeMarkup(l+1,void 0,{...a.attrs,position:`${o}.`}),i=!0),o++):s>0&&s--}),i?r:null}}),On={listType:"data-list-type",blockColor:"data-block-color",blockStyle:"data-block-style",headingType:"data-heading-type",id:"data-id",depth:"data-depth",depthChange:"data-depth-change"},mr=new V.PluginKey("previous-blocks"),fo=e=>e.slice(0,5)+"prev-"+e.slice(5),po=()=>new V.Plugin({key:mr,view(e){return{update:async(t,n)=>{var r;(r=this.key)!=null&&r.getState(t.state).needsUpdate&&setTimeout(()=>{t.dispatch(t.state.tr.setMeta(mr,{clearUpdate:!0}))},0)}}},state:{init(){return{prevBlockAttrs:{},needsUpdate:!1}},apply(e,t,n,r){if(t.needsUpdate=!1,t.prevBlockAttrs={},!e.docChanged||n.doc.eq(r.doc))return t;const i=A.combineTransactionSteps(n.doc,[e]);return A.getChangedRanges(i).forEach(()=>{const s=A.findChildren(n.doc,d=>d.attrs.id),a=new Map(s.map(d=>[d.node.attrs.id,d])),l=A.findChildren(r.doc,d=>d.attrs.id);for(let d of l){const u=a.get(d.node.attrs.id);if(u){const p={listType:d.node.attrs.listType,blockColor:d.node.attrs.blockColor,blockStyle:d.node.attrs.blockStyle,headingType:d.node.attrs.headingType,depth:r.doc.resolve(d.pos).depth},m={listType:u.node.attrs.listType,blockColor:u.node.attrs.blockColor,blockStyle:u.node.attrs.blockStyle,headingType:u.node.attrs.headingType,depth:n.doc.resolve(u.pos).depth};JSON.stringify(m)!==JSON.stringify(p)&&(m.depthChange=m.depth-p.depth,t.prevBlockAttrs[d.node.attrs.id]=m,t.needsUpdate=!0)}}}),t}},props:{decorations(e){const t=this.getState(e);if(!t.needsUpdate)return;const n=[];return e.doc.descendants((r,i)=>{if(!r.attrs.id)return;const o=t.prevBlockAttrs[r.attrs.id];if(!o)return;const s={};for(let[l,d]of Object.entries(o))s[fo(On[l])]=d||"none";const a=Ve.Decoration.node(i,i+r.nodeSize,{...s});n.push(a)}),Ve.DecorationSet.create(e.doc,n)}}});function Sn(e){return new A.InputRule({find:e.find,handler:({state:t,range:n,match:r})=>{const i=t.doc.resolve(n.from),o=A.callOrReturn(e.getAttributes,void 0,r)||{},s=i.node(-1);if(s.type!==e.type)return null;t.tr.setNodeMarkup(n.from-2,void 0,{...s.attrs,...o}).delete(n.from,n.to)}})}const pt={blockOuter:"_blockOuter_1houv_5",block:"_block_1houv_5",blockContent:"_blockContent_1houv_25",blockGroup:"_blockGroup_1houv_35",isEmpty:"_isEmpty_1houv_198",isFilter:"_isFilter_1houv_199",hasAnchor:"_hasAnchor_1houv_212"},ho=A.Node.create({name:"block",group:"block",addOptions(){return{HTMLAttributes:{}}},content:"content blockgroup?",defining:!0,addAttributes(){return{listType:{default:void 0},blockColor:{default:void 0},blockStyle:{default:void 0},headingType:{default:void 0,keepOnSplit:!1}}},parseHTML(){return[{tag:"div",getAttrs:e=>{if(typeof e=="string")return!1;const t={};for(let[n,r]of Object.entries(On))e.getAttribute(r)&&(t[n]=e.getAttribute(r));return e.getAttribute("data-node-type")==="block"?t:!1}},{tag:"p",priority:100},{tag:"h1",attrs:{headingType:"1"}},{tag:"h2",attrs:{headingType:"2"}},{tag:"h3",attrs:{headingType:"3"}},{tag:"li",getAttrs:e=>{if(typeof e=="string")return!1;const t=e.parentElement;return t===null?!1:t.tagName==="UL"?{listType:"li"}:t.tagName==="OL"?{listType:"oli"}:!1}}]},renderHTML({HTMLAttributes:e}){const t={};for(let[n,r]of Object.entries(On))t[r]=e[n];return["div",A.mergeAttributes(t,{class:pt.blockOuter,"data-node-type":"block-outer"}),["div",A.mergeAttributes(t,{class:pt.block,"data-node-type":"block"}),0]]},addInputRules(){return[...["1","2","3"].map(e=>Sn({find:new RegExp(`^(#{1,${e}})\\s$`),type:this.type,getAttributes:{headingType:e}})),Sn({find:/^\s*([-+*])\s$/,type:this.type,getAttributes:{listType:"li"}}),Sn({find:new RegExp(/^1.\s/),type:this.type,getAttributes:{listType:"oli"}})]},addCommands(){return{setBlockHeading:e=>({tr:t,dispatch:n})=>vr(t,n,e.level),unsetBlockHeading:()=>({tr:e,dispatch:t})=>vr(e,t,void 0),unsetList:()=>({tr:e,dispatch:t})=>{const n=e.selection.$anchor.node(-1),r=e.selection.$anchor.posAtIndex(0,-1)-1;return n.type.name==="block"&&n.attrs.listType&&t?(e.setNodeMarkup(r,void 0,{...n.attrs,listType:void 0}),!0):!1},addNewBlockAsSibling:e=>({tr:t,dispatch:n,state:r})=>{var a;const i=ft(t.selection);if(!i)return!1;if(((a=i.node.firstChild)==null?void 0:a.textContent.length)===0)return n&&t.setNodeMarkup(i.pos,void 0,e),!0;const o=i.pos+i.node.nodeSize;let s=r.schema.nodes.block.createAndFill(e);return n&&(t.insert(o,s),t.setSelection(new V.TextSelection(t.doc.resolve(o+1)))),!0},setBlockList:e=>({tr:t,dispatch:n})=>{const r=t.selection.$anchor.node(-1),i=t.selection.$anchor.posAtIndex(0,-1)-1;return r.type.name==="block"?(n&&t.setNodeMarkup(i,void 0,{...r.attrs,listType:e}),!0):!1},joinBackward:()=>({view:e,dispatch:t,state:n})=>oo(n,t,e)}},addProseMirrorPlugins(){return[po(),uo()]},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.first(({commands:n})=>[()=>n.undoInputRule(),()=>n.command(({tr:r})=>{const{selection:i,doc:o}=r,{empty:s,$anchor:a}=i,{pos:l,parent:d}=a,u=V.Selection.atStart(o).from===l;return!s||!u||!d.type.isTextblock||d.textContent.length?!1:n.clearNodes()}),()=>n.deleteSelection(),()=>n.command(({tr:r})=>{const i=r.selection.$anchor.parentOffset===0,o=r.selection.$anchor.node(-1);return i&&o.type.name==="block"?n.first([()=>n.unsetList(),()=>n.liftListItem("block")]):!1}),({chain:r})=>r().command(({tr:i,state:o,dispatch:s})=>{const a=i.selection.$anchor.parentOffset===0,l=i.selection.$anchor,d=l.node(-1);if(a&&d.type.name==="block"){if(d.childCount===2){const u=l.posAtIndex(1,-1)+1,p=l.posAtIndex(2,-1)-1,m=o.doc.resolve(u).blockRange(o.doc.resolve(p));s&&i.lift(m,l.depth-2)}return!0}return!1}).joinBackward().run(),()=>n.selectNodeBackward()]),Enter:()=>this.editor.commands.first(({commands:n})=>[()=>n.splitListItem("block"),({tr:r,dispatch:i})=>{if(r.selection.$from.depth!==3)return!1;const s=r.selection.$anchor.node(-1),a=r.selection.$anchor.posAtIndex(0,-1)-1;return s.type.name==="block"&&s.attrs.listType?(i&&r.setNodeMarkup(a,void 0,{...s.attrs,listType:void 0}),!0):!1},({tr:r,dispatch:i})=>{const o=r.selection.$from;return i&&r.split(o.pos,2).scrollIntoView(),!0}]),Tab:()=>this.editor.commands.sinkListItem("block"),"Shift-Tab":()=>this.editor.commands.liftListItem("block"),"Mod-Alt-0":()=>this.editor.chain().unsetList().unsetBlockHeading().run(),"Mod-Alt-1":()=>this.editor.commands.setBlockHeading({level:"1"}),"Mod-Alt-2":()=>this.editor.commands.setBlockHeading({level:"2"}),"Mod-Alt-3":()=>this.editor.commands.setBlockHeading({level:"3"}),"Mod-Shift-7":()=>this.editor.commands.setBlockList("li"),"Mod-Shift-8":()=>this.editor.commands.setBlockList("oli")}}}),vo=A.Node.create({name:"blockgroup",addOptions(){return{HTMLAttributes:{}}},content:"block+",parseHTML(){return[{tag:"div",getAttrs:e=>typeof e=="string"?!1:e.getAttribute("data-node-type")==="block-group"?null:!1}]},renderHTML({HTMLAttributes:e}){return["div",A.mergeAttributes(this.options.HTMLAttributes,e,{class:pt.blockGroup,"data-node-type":"block-group"}),0]}}),mo=[A.Node.create({name:"content",addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{position:{default:void 0,renderHTML:e=>({"data-position":e.position}),parseHTML:e=>e.getAttribute("data-position")}}},content:"inline*",parseHTML(){return[{tag:"div",getAttrs:e=>typeof e=="string"?!1:e.getAttribute("data-node-type")==="block-content"?null:!1}]},renderHTML({HTMLAttributes:e}){return["div",A.mergeAttributes(this.options.HTMLAttributes,e,{class:pt.blockContent,"data-node-type":"block-content"}),["div",0]]}}),ho,vo,A.Node.create({name:"doc",topNode:!0,content:"blockgroup"})];var v={exports:{}},wt={};/*
|
|
1
|
+
(function(P,A){typeof exports=="object"&&typeof module<"u"?A(exports,require("@tiptap/core"),require("@tiptap/extension-bold"),require("@tiptap/extension-code"),require("@tiptap/extension-dropcursor"),require("@tiptap/extension-gapcursor"),require("@tiptap/extension-hard-break"),require("@tiptap/extension-history"),require("@tiptap/extension-italic"),require("@tiptap/extension-strike"),require("@tiptap/extension-text"),require("@tiptap/extension-underline"),require("prosemirror-state"),require("prosemirror-model"),require("prosemirror-view"),require("react"),require("@mantine/core"),require("react-dom"),require("@tippyjs/react"),require("lodash"),require("@tiptap/react"),require("@tiptap/extension-link"),require("@tiptap/extension-paragraph"),require("uuid")):typeof define=="function"&&define.amd?define(["exports","@tiptap/core","@tiptap/extension-bold","@tiptap/extension-code","@tiptap/extension-dropcursor","@tiptap/extension-gapcursor","@tiptap/extension-hard-break","@tiptap/extension-history","@tiptap/extension-italic","@tiptap/extension-strike","@tiptap/extension-text","@tiptap/extension-underline","prosemirror-state","prosemirror-model","prosemirror-view","react","@mantine/core","react-dom","@tippyjs/react","lodash","@tiptap/react","@tiptap/extension-link","@tiptap/extension-paragraph","uuid"],A):(P=typeof globalThis<"u"?globalThis:P||self,A(P.blocknote={},P.core,P.Bold,P.Code,P.DropCursor,P.GapCursor,P.HardBreak,P.extensionHistory,P.Italic,P.Strike,P.Text,P.Underline,P.prosemirrorState,P.prosemirrorModel,P.pv,P.React,P.core$1,P.ReactDOM,P.Tippy,P.lodash,P.react,P.extensionLink,P.Paragraph,P.uuid))})(this,function(P,A,lt,Oi,Si,Ci,Ai,Ri,Ii,Di,Ni,Mi,V,D,Ve,ae,L,Pi,ji,yn,bn,Li,Bi,_i){"use strict";var ul=Object.defineProperty;var dl=(P,A,lt)=>A in P?ul(P,A,{enumerable:!0,configurable:!0,writable:!0,value:lt}):P[A]=lt;var oe=(P,A,lt)=>(dl(P,typeof A!="symbol"?A+"":A,lt),lt);const he=e=>e&&typeof e=="object"&&"default"in e?e:{default:e};function Hi(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const Fi=he(lt),zi=he(Oi),Vi=he(Si),qi=he(Ci),Ui=he(Ai),Wi=he(Ii),$i=he(Di),Ji=he(Ni),Yi=he(Mi),Gi=Hi(Ve),qe=he(ae),Ke=he(Pi),Ht=he(ji),Ki=he(Bi),fl="",or=65535,ar=Math.pow(2,16);function Xi(e,t){return e+t*ar}function sr(e){return e&or}function Zi(e){return(e-(e&or))/ar}const lr=1,cr=2,sn=4,ur=8;class dr{constructor(t,n,r){this.pos=t,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&ur)>0}get deletedBefore(){return(this.delInfo&(lr|sn))>0}get deletedAfter(){return(this.delInfo&(cr|sn))>0}get deletedAcross(){return(this.delInfo&sn)>0}}class Te{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&Te.empty)return Te.empty}recover(t){let n=0,r=sr(t);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+Zi(t)}mapResult(t,n=1){return this._map(t,n,!1)}map(t,n=1){return this._map(t,n,!0)}_map(t,n,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>t)break;let d=this.ranges[a+o],u=this.ranges[a+s],p=l+d;if(t<=p){let m=d?t==l?-1:t==p?1:n:n,y=l+i+(m<0?0:u);if(r)return y;let x=t==(n<0?l:p)?null:Xi(a/3,t-l),b=t==l?cr:t==p?lr:sn;return(n<0?t!=l:t!=p)&&(b|=ur),new dr(y,b,x)}i+=u-d}return r?t+i:new dr(t+i,0,null)}touches(t,n){let r=0,i=sr(n),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>t)break;let d=this.ranges[a+o],u=l+d;if(t<=u&&a==i*3)return!0;r+=this.ranges[a+s]-d}return!1}forEach(t){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],a=s-(this.inverted?o:0),l=s+(this.inverted?0:o),d=this.ranges[i+n],u=this.ranges[i+r];t(a,a+d,l,l+u),o+=u-d}}invert(){return new Te(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?Te.empty:new Te(t<0?[0,-t,0]:[0,0,t])}}Te.empty=new Te([]);const xn=Object.create(null);class ue{getMap(){return Te.empty}merge(t){return null}static fromJSON(t,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=xn[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in xn)throw new RangeError("Duplicate use of step JSON ID "+t);return xn[t]=n,n.prototype.jsonID=t,n}}class Q{constructor(t,n){this.doc=t,this.failed=n}static ok(t){return new Q(t,null)}static fail(t){return new Q(null,t)}static fromReplace(t,n,r,i){try{return Q.ok(t.replace(n,r,i))}catch(o){if(o instanceof D.ReplaceError)return Q.fail(o.message);throw o}}}function wn(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let o=e.child(i);o.content.size&&(o=o.copy(wn(o.content,t,o))),o.isInline&&(o=t(o,n,i)),r.push(o)}return D.Fragment.fromArray(r)}class ct extends ue{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=t.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new D.Slice(wn(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return Q.fromReplace(t,this.from,this.to,o)}invert(){return new ut(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new ct(n.pos,r.pos,this.mark)}merge(t){return t instanceof ct&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new ct(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ct(n.from,n.to,t.markFromJSON(n.mark))}}ue.jsonID("addMark",ct);class ut extends ue{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=new D.Slice(wn(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),n.openStart,n.openEnd);return Q.fromReplace(t,this.from,this.to,r)}invert(){return new ct(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new ut(n.pos,r.pos,this.mark)}merge(t){return t instanceof ut&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new ut(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ut(n.from,n.to,t.markFromJSON(n.mark))}}ue.jsonID("removeMark",ut);class dt extends ue{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return Q.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Q.fromReplace(t,this.pos,this.pos+1,new D.Slice(D.Fragment.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new dt(this.pos,n.marks[i]);return new dt(this.pos,this.mark)}}return new Ft(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new dt(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new dt(n.pos,t.markFromJSON(n.mark))}}ue.jsonID("addNodeMark",dt);class Ft extends ue{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return Q.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Q.fromReplace(t,this.pos,this.pos+1,new D.Slice(D.Fragment.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new dt(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Ft(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Ft(n.pos,t.markFromJSON(n.mark))}}ue.jsonID("removeNodeMark",Ft);class Ne extends ue{constructor(t,n,r,i=!1){super(),this.from=t,this.to=n,this.slice=r,this.structure=i}apply(t){return this.structure&&En(t,this.from,this.to)?Q.fail("Structure replace would overwrite content"):Q.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new Te([this.from,this.to-this.from,this.slice.size])}invert(t){return new Ne(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Ne(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(t){if(!(t instanceof Ne)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?D.Slice.empty:new D.Slice(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new Ne(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?D.Slice.empty:new D.Slice(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new Ne(t.from,this.to,n,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ne(n.from,n.to,D.Slice.fromJSON(t,n.slice),!!n.structure)}}ue.jsonID("replace",Ne);class Xe extends ue{constructor(t,n,r,i,o,s,a=!1){super(),this.from=t,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=a}apply(t){if(this.structure&&(En(t,this.from,this.gapFrom)||En(t,this.gapTo,this.to)))return Q.fail("Structure gap-replace would overwrite content");let n=t.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Q.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Q.fromReplace(t,this.from,this.to,r):Q.fail("Content does not fit in gap")}getMap(){return new Te([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new Xe(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=t.map(this.gapFrom,-1),o=t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new Xe(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Xe(n.from,n.to,n.gapFrom,n.gapTo,D.Slice.fromJSON(t,n.slice),n.insert,!!n.structure)}}ue.jsonID("replaceAround",Xe);function En(e,t,n){let r=e.resolve(t),i=n-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function Qi(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function fr(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth;;--r){let i=e.$from.node(r),o=e.$from.index(r),s=e.$to.indexAfter(r);if(r<e.depth&&i.canReplace(o,s,n))return r;if(r==0||i.type.spec.isolating||!Qi(i,o,s))break}return null}function pr(e,t){let n=e.resolve(t),r=n.index();return eo(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function eo(e,t){return!!(e&&t&&!e.isLeaf&&e.canAppend(t))}function to(e,t,n=t,r=D.Slice.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),o=e.resolve(n);return no(i,o,r)?new Ne(t,n,r):new ro(i,o,r).fit()}function no(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}class ro{constructor(t,n,r){this.$from=t,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=D.Fragment.empty;for(let i=0;i<=t.depth;i++){let o=t.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(t.indexAfter(i))})}for(let i=t.depth;i>0;i--)this.placed=D.Fragment.from(t.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(t<0?this.$to:r.doc.resolve(t));if(!i)return null;let o=this.placed,s=r.depth,a=i.depth;for(;s&&a&&o.childCount==1;)o=o.firstChild.content,s--,a--;let l=new D.Slice(o,s,a);return t>-1?new Xe(r.pos,t,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Ne(r.pos,i.pos,l):null}findFittable(){for(let t=1;t<=2;t++)for(let n=this.unplaced.openStart;n>=0;n--){let r,i=null;n?(i=kn(this.unplaced.content,n-1).firstChild,r=i.content):r=this.unplaced.content;let o=r.firstChild;for(let s=this.depth;s>=0;s--){let{type:a,match:l}=this.frontier[s],d,u=null;if(t==1&&(o?l.matchType(o.type)||(u=l.fillBefore(D.Fragment.from(o),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:n,frontierDepth:s,parent:i,inject:u};if(t==2&&o&&(d=l.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:s,parent:i,wrap:d};if(i&&l.matchType(i.type))break}}}openMore(){let{content:t,openStart:n,openEnd:r}=this.unplaced,i=kn(t,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new D.Slice(t,n+1,Math.max(r,i.size+n>=t.size-r?n+1:0)),!0)}dropNode(){let{content:t,openStart:n,openEnd:r}=this.unplaced,i=kn(t,n);if(i.childCount<=1&&n>0){let o=t.size-n<=n+i.size;this.unplaced=new D.Slice(zt(t,n-1,1),n-1,o?n-1:r)}else this.unplaced=new D.Slice(zt(t,n,1),n,r)}placeNodes({sliceDepth:t,frontierDepth:n,parent:r,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let b=0;b<o.length;b++)this.openFrontierNode(o[b]);let s=this.unplaced,a=r?r.content:s.content,l=s.openStart-t,d=0,u=[],{match:p,type:m}=this.frontier[n];if(i){for(let b=0;b<i.childCount;b++)u.push(i.child(b));p=p.matchFragment(i)}let y=a.size+t-(s.content.size-s.openEnd);for(;d<a.childCount;){let b=a.child(d),O=p.matchType(b.type);if(!O)break;d++,(d>1||l==0||b.content.size)&&(p=O,u.push(hr(b.mark(m.allowedMarks(b.marks)),d==1?l:0,d==a.childCount?y:-1)))}let x=d==a.childCount;x||(y=-1),this.placed=Vt(this.placed,n,D.Fragment.from(u)),this.frontier[n].match=p,x&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let b=0,O=a;b<y;b++){let C=O.lastChild;this.frontier.push({type:C.type,match:C.contentMatchAt(C.childCount)}),O=C.content}this.unplaced=x?t==0?D.Slice.empty:new D.Slice(zt(s.content,t-1,1),t-1,y<0?s.openEnd:t-1):new D.Slice(zt(s.content,t,d),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t=this.frontier[this.depth],n;if(!t.type.isTextblock||!Tn(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(t){e:for(let n=Math.min(this.depth,t.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],o=n<t.depth&&t.end(n+1)==t.pos+(t.depth-(n+1)),s=Tn(t,n,i,r,o);if(!!s){for(let a=n-1;a>=0;a--){let{match:l,type:d}=this.frontier[a],u=Tn(t,a,d,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:o?t.doc.resolve(t.after(n+1)):t}}}}close(t){let n=this.findCloseLevel(t);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Vt(this.placed,n.depth,n.fit)),t=n.move;for(let r=n.depth+1;r<=t.depth;r++){let i=t.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,t.index(r));this.openFrontierNode(i.type,i.attrs,o)}return t}openFrontierNode(t,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(t),this.placed=Vt(this.placed,this.depth,D.Fragment.from(t.create(n,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(D.Fragment.empty,!0);n.childCount&&(this.placed=Vt(this.placed,this.frontier.length,n))}}function zt(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(zt(e.firstChild.content,t-1,n)))}function Vt(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Vt(e.lastChild.content,t-1,n)))}function kn(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function hr(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,hr(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(D.Fragment.empty,!0)))),e.copy(r)}function Tn(e,t,n,r,i){let o=e.node(t),s=i?e.indexAfter(t):e.index(t);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!io(n,o.content,s)?a:null}function io(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}class qt extends ue{constructor(t,n,r){super(),this.pos=t,this.attr=n,this.value=r}apply(t){let n=t.nodeAt(this.pos);if(!n)return Q.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Q.fromReplace(t,this.pos,this.pos+1,new D.Slice(D.Fragment.from(i),0,n.isLeaf?0:1))}getMap(){return Te.empty}invert(t){return new qt(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new qt(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new qt(n.pos,n.attr,n.value)}}ue.jsonID("attr",qt);let Ut=class extends Error{};Ut=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},Ut.prototype=Object.create(Error.prototype),Ut.prototype.constructor=Ut,Ut.prototype.name="TransformError";const oo=(e,t,n)=>{let{$cursor:r}=e.selection;if(!r||(n?!n.endOfTextblock("backward",e):r.parentOffset>0))return!1;let i=ao(r);if(!i){let s=r.blockRange(),a=s&&fr(s);return a===null?!1:(t&&t(e.tr.lift(s,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(!o.type.spec.isolating&&so(e,i,t))return!0;if(r.parent.content.size===0&&(ln(o,"end")||V.NodeSelection.isSelectable(o))){let s=to(e.doc,r.before(),r.after(),D.Slice.empty);if(s&&s.slice.size<s.to-s.from){if(t){let a=e.tr.step(s);a.setSelection(ln(o,"end")?V.Selection.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):V.NodeSelection.create(a.doc,i.pos-o.nodeSize)),t(a.scrollIntoView())}return!0}}return o.isAtom&&i.depth===r.depth-1?(t&&t(e.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1};function ao(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function so(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,o,s;if(r.type.spec.isolating||i.type.spec.isolating)return!1;if(lo(e,t,n))return!0;let a=t.parent.canReplace(t.index(),t.index()+1),l=V.Selection.findFrom(t,1),d=l&&l.$from.blockRange(l.$to),u=d&&fr(d);if(u!=null&&u>=t.depth)return n&&n(e.tr.lift(d,u).scrollIntoView()),!0;if(a&&ln(i,"start",!0)&&ln(r,"end")){let p=r,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let y=i,x=1;for(;!y.isTextblock;y=y.firstChild)x++;if(p.canReplace(p.childCount,p.childCount,y.content)){if(n){let b=D.Fragment.empty;for(let C=m.length-1;C>=0;C--)b=D.Fragment.from(m[C].copy(b));let O=e.tr.step(new Xe(t.pos-m.length,t.pos+i.nodeSize,t.pos+x,t.pos+i.nodeSize-x,new D.Slice(b,m.length,0),0,!0));n(O.scrollIntoView())}return!0}}if(a&&(o=(s=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&s.matchType(o[0]||i.type).validEnd){if(n){let p=t.pos+i.nodeSize,m=D.Fragment.empty;for(let b=o.length-1;b>=0;b--)m=D.Fragment.from(o[b].create(null,m));m=D.Fragment.from(r.copy(m));let y=e.tr.step(new Xe(t.pos-1,p,t.pos,p,new D.Slice(m,1,0),o.length,!0)),x=p+2*o.length;pr(y.doc,x)&&y.join(x),n(y.scrollIntoView())}return!0}return!1}function ln(e,t,n=!1){for(let r=e;r;r=t==="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!==1)return!1}return!1}function lo(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,o=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(o-1,o)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(o,o+1)||!(i.isTextblock||pr(e.doc,t.pos))?!1:(n&&n(e.tr.clearIncompatible(t.pos,r.type,r.contentMatchAt(r.childCount)).join(t.pos).scrollIntoView()),!0)}const ft=A.findParentNode(e=>e.type.name==="block");function vr(e,t,n){const r=ft(e.selection);return r?(t&&e.setNodeMarkup(r.pos,void 0,{...r.node.attrs,headingType:n}),!0):!1}const co=new V.PluginKey("ordered-list"),uo=()=>new V.Plugin({key:co,appendTransaction:(e,t,n)=>{const r=n.tr;let i=!1,o=1,s=0;return n.doc.descendants((a,l)=>{a.type.name==="block"&&!a.attrs.listType&&(o=1),s===0&&a.type.name==="block"&&a.attrs.listType==="oli"?(s=a.content.childCount,a.content.child(0).attrs.position!==`${o}.`&&(r.setNodeMarkup(l+1,void 0,{...a.attrs,position:`${o}.`}),i=!0),o++):s>0&&s--}),i?r:null}}),On={listType:"data-list-type",blockColor:"data-block-color",blockStyle:"data-block-style",headingType:"data-heading-type",id:"data-id",depth:"data-depth",depthChange:"data-depth-change"},mr=new V.PluginKey("previous-blocks"),fo=e=>e.slice(0,5)+"prev-"+e.slice(5),po=()=>new V.Plugin({key:mr,view(e){return{update:async(t,n)=>{var r;(r=this.key)!=null&&r.getState(t.state).needsUpdate&&setTimeout(()=>{t.dispatch(t.state.tr.setMeta(mr,{clearUpdate:!0}))},0)}}},state:{init(){return{prevBlockAttrs:{},needsUpdate:!1}},apply(e,t,n,r){if(t.needsUpdate=!1,t.prevBlockAttrs={},!e.docChanged||n.doc.eq(r.doc))return t;const i=A.combineTransactionSteps(n.doc,[e]);return A.getChangedRanges(i).forEach(()=>{const s=A.findChildren(n.doc,d=>d.attrs.id),a=new Map(s.map(d=>[d.node.attrs.id,d])),l=A.findChildren(r.doc,d=>d.attrs.id);for(let d of l){const u=a.get(d.node.attrs.id);if(u){const p={listType:d.node.attrs.listType,blockColor:d.node.attrs.blockColor,blockStyle:d.node.attrs.blockStyle,headingType:d.node.attrs.headingType,depth:r.doc.resolve(d.pos).depth},m={listType:u.node.attrs.listType,blockColor:u.node.attrs.blockColor,blockStyle:u.node.attrs.blockStyle,headingType:u.node.attrs.headingType,depth:n.doc.resolve(u.pos).depth};JSON.stringify(m)!==JSON.stringify(p)&&(m.depthChange=m.depth-p.depth,t.prevBlockAttrs[d.node.attrs.id]=m,t.needsUpdate=!0)}}}),t}},props:{decorations(e){const t=this.getState(e);if(!t.needsUpdate)return;const n=[];return e.doc.descendants((r,i)=>{if(!r.attrs.id)return;const o=t.prevBlockAttrs[r.attrs.id];if(!o)return;const s={};for(let[l,d]of Object.entries(o))s[fo(On[l])]=d||"none";const a=Ve.Decoration.node(i,i+r.nodeSize,{...s});n.push(a)}),Ve.DecorationSet.create(e.doc,n)}}});function Sn(e){return new A.InputRule({find:e.find,handler:({state:t,range:n,match:r})=>{const i=t.doc.resolve(n.from),o=A.callOrReturn(e.getAttributes,void 0,r)||{},s=i.node(-1);if(s.type!==e.type)return null;t.tr.setNodeMarkup(n.from-2,void 0,{...s.attrs,...o}).delete(n.from,n.to)}})}const pt={blockOuter:"_blockOuter_1houv_5",block:"_block_1houv_5",blockContent:"_blockContent_1houv_25",blockGroup:"_blockGroup_1houv_35",isEmpty:"_isEmpty_1houv_198",isFilter:"_isFilter_1houv_199",hasAnchor:"_hasAnchor_1houv_212"},ho=A.Node.create({name:"block",group:"block",addOptions(){return{HTMLAttributes:{}}},content:"content blockgroup?",defining:!0,addAttributes(){return{listType:{default:void 0},blockColor:{default:void 0},blockStyle:{default:void 0},headingType:{default:void 0,keepOnSplit:!1}}},parseHTML(){return[{tag:"div",getAttrs:e=>{if(typeof e=="string")return!1;const t={};for(let[n,r]of Object.entries(On))e.getAttribute(r)&&(t[n]=e.getAttribute(r));return e.getAttribute("data-node-type")==="block"?t:!1}},{tag:"p",priority:100},{tag:"h1",attrs:{headingType:"1"}},{tag:"h2",attrs:{headingType:"2"}},{tag:"h3",attrs:{headingType:"3"}},{tag:"li",getAttrs:e=>{if(typeof e=="string")return!1;const t=e.parentElement;return t===null?!1:t.tagName==="UL"?{listType:"li"}:t.tagName==="OL"?{listType:"oli"}:!1}}]},renderHTML({HTMLAttributes:e}){const t={};for(let[n,r]of Object.entries(On))e[n]&&(t[r]=e[n]);return["div",A.mergeAttributes(t,{class:pt.blockOuter,"data-node-type":"block-outer"}),["div",A.mergeAttributes(t,{class:pt.block,"data-node-type":"block"}),0]]},addInputRules(){return[...["1","2","3"].map(e=>Sn({find:new RegExp(`^(#{1,${e}})\\s$`),type:this.type,getAttributes:{headingType:e}})),Sn({find:/^\s*([-+*])\s$/,type:this.type,getAttributes:{listType:"li"}}),Sn({find:new RegExp(/^1.\s/),type:this.type,getAttributes:{listType:"oli"}})]},addCommands(){return{setBlockHeading:e=>({tr:t,dispatch:n})=>vr(t,n,e.level),unsetBlockHeading:()=>({tr:e,dispatch:t})=>vr(e,t,void 0),unsetList:()=>({tr:e,dispatch:t})=>{const n=e.selection.$anchor.node(-1),r=e.selection.$anchor.posAtIndex(0,-1)-1;return n.type.name==="block"&&n.attrs.listType&&t?(e.setNodeMarkup(r,void 0,{...n.attrs,listType:void 0}),!0):!1},addNewBlockAsSibling:e=>({tr:t,dispatch:n,state:r})=>{var a;const i=ft(t.selection);if(!i)return!1;if(((a=i.node.firstChild)==null?void 0:a.textContent.length)===0)return n&&t.setNodeMarkup(i.pos,void 0,e),!0;const o=i.pos+i.node.nodeSize;let s=r.schema.nodes.block.createAndFill(e);return n&&(t.insert(o,s),t.setSelection(new V.TextSelection(t.doc.resolve(o+1)))),!0},setBlockList:e=>({tr:t,dispatch:n})=>{const r=t.selection.$anchor.node(-1),i=t.selection.$anchor.posAtIndex(0,-1)-1;return r.type.name==="block"?(n&&t.setNodeMarkup(i,void 0,{...r.attrs,listType:e}),!0):!1},joinBackward:()=>({view:e,dispatch:t,state:n})=>oo(n,t,e)}},addProseMirrorPlugins(){return[po(),uo()]},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.first(({commands:n})=>[()=>n.undoInputRule(),()=>n.command(({tr:r})=>{const{selection:i,doc:o}=r,{empty:s,$anchor:a}=i,{pos:l,parent:d}=a,u=V.Selection.atStart(o).from===l;return!s||!u||!d.type.isTextblock||d.textContent.length?!1:n.clearNodes()}),()=>n.deleteSelection(),()=>n.command(({tr:r})=>{const i=r.selection.$anchor.parentOffset===0,o=r.selection.$anchor.node(-1);return i&&o.type.name==="block"?n.first([()=>n.unsetList(),()=>n.liftListItem("block")]):!1}),({chain:r})=>r().command(({tr:i,state:o,dispatch:s})=>{const a=i.selection.$anchor.parentOffset===0,l=i.selection.$anchor,d=l.node(-1);if(a&&d.type.name==="block"){if(d.childCount===2){const u=l.posAtIndex(1,-1)+1,p=l.posAtIndex(2,-1)-1,m=o.doc.resolve(u).blockRange(o.doc.resolve(p));s&&i.lift(m,l.depth-2)}return!0}return!1}).joinBackward().run(),()=>n.selectNodeBackward()]),Enter:()=>this.editor.commands.first(({commands:n})=>[()=>n.splitListItem("block"),({tr:r,dispatch:i})=>{if(r.selection.$from.depth!==3)return!1;const s=r.selection.$anchor.node(-1),a=r.selection.$anchor.posAtIndex(0,-1)-1;return s.type.name==="block"&&s.attrs.listType?(i&&r.setNodeMarkup(a,void 0,{...s.attrs,listType:void 0}),!0):!1},({tr:r,dispatch:i})=>{const o=r.selection.$from;return i&&r.split(o.pos,2).scrollIntoView(),!0}]),Tab:()=>this.editor.commands.sinkListItem("block"),"Shift-Tab":()=>this.editor.commands.liftListItem("block"),"Mod-Alt-0":()=>this.editor.chain().unsetList().unsetBlockHeading().run(),"Mod-Alt-1":()=>this.editor.commands.setBlockHeading({level:"1"}),"Mod-Alt-2":()=>this.editor.commands.setBlockHeading({level:"2"}),"Mod-Alt-3":()=>this.editor.commands.setBlockHeading({level:"3"}),"Mod-Shift-7":()=>this.editor.commands.setBlockList("li"),"Mod-Shift-8":()=>this.editor.commands.setBlockList("oli")}}}),vo=A.Node.create({name:"blockgroup",addOptions(){return{HTMLAttributes:{}}},content:"block+",parseHTML(){return[{tag:"div",getAttrs:e=>typeof e=="string"?!1:e.getAttribute("data-node-type")==="block-group"?null:!1}]},renderHTML({HTMLAttributes:e}){return["div",A.mergeAttributes(this.options.HTMLAttributes,e,{class:pt.blockGroup,"data-node-type":"block-group"}),0]}}),mo=[A.Node.create({name:"content",addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{position:{default:void 0,renderHTML:e=>({"data-position":e.position}),parseHTML:e=>e.getAttribute("data-position")}}},content:"inline*",parseHTML(){return[{tag:"div",getAttrs:e=>typeof e=="string"?!1:e.getAttribute("data-node-type")==="block-content"?null:!1}]},renderHTML({HTMLAttributes:e}){return["div",A.mergeAttributes(this.options.HTMLAttributes,e,{class:pt.blockContent,"data-node-type":"block-content"}),["div",0]]}}),ho,vo,A.Node.create({name:"doc",topNode:!0,content:"blockgroup"})];var v={exports:{}},wt={};/*
|
|
2
2
|
object-assign
|
|
3
3
|
(c) Sindre Sorhus
|
|
4
4
|
@license MIT
|
|
@@ -50,5 +50,5 @@ Check the top-level render call using <`+E+">.")}return g}}function rn(c,g){{if(
|
|
|
50
50
|
`,"Instead, pass the .innerHTML of the element, or use a function that","returns a cloned version of the element instead.",`
|
|
51
51
|
|
|
52
52
|
`,`1) content: element.innerHTML
|
|
53
|
-
`,"2) content: () => element.cloneNode(true)"].join(" "))}var a=i.reduce(function(l,d){var u=d&&es(d,r);return u&&l.push(u),l},[]);return Qt(e)?a[0]:a}At.defaultProps=me,At.setDefaultProps=Ka,At.currentInput=Pe,Object.assign({},Tr,{effect:function(t){var n=t.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow)}}),At.setDefaultProps({render:li});class ts{constructor({editor:t,element:n,view:r,tippyOptions:i={},shouldShow:o}){oe(this,"editor");oe(this,"element");oe(this,"view");oe(this,"preventHide",!1);oe(this,"preventShow",!1);oe(this,"tippy");oe(this,"tippyOptions");oe(this,"shouldShow",({view:t,state:n,from:r,to:i})=>{const{doc:o,selection:s}=n,{empty:a}=s,l=!o.textBetween(r,i).length&&A.isTextSelection(n.selection);return!(!t.hasFocus()||a||l)});oe(this,"mousedownHandler",()=>{this.preventHide=!0});oe(this,"viewMousedownHandler",()=>{this.preventShow=!0});oe(this,"viewMouseupHandler",()=>{this.preventShow=!1,setTimeout(()=>this.update(this.editor.view))});oe(this,"dragstartHandler",()=>{this.hide()});oe(this,"focusHandler",()=>{setTimeout(()=>this.update(this.editor.view))});oe(this,"blurHandler",({event:t})=>{var n;if(this.preventHide){this.preventHide=!1;return}(t==null?void 0:t.relatedTarget)&&((n=this.element.parentNode)==null?void 0:n.contains(t.relatedTarget))||this.hide()});this.editor=t,this.element=n,this.view=r,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("mousedown",this.viewMousedownHandler),this.view.dom.addEventListener("mouseup",this.viewMouseupHandler),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:t}=this.editor.options,n=!!t.parentElement;this.tippy||!n||(this.tippy=At(t,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",r=>{this.blurHandler({event:r})}))}update(t,n){var m,y;const{state:r,composing:i}=t,{doc:o,selection:s}=r,a=n&&n.doc.eq(o)&&n.selection.eq(s);if(i||a)return;this.createTooltip();const{ranges:l}=s,d=Math.min(...l.map(x=>x.$from.pos)),u=Math.max(...l.map(x=>x.$to.pos));if(!((m=this.shouldShow)==null?void 0:m.call(this,{editor:this.editor,view:t,state:r,oldState:n,from:d,to:u}))||this.preventShow){this.hide();return}(y=this.tippy)==null||y.setProps({getReferenceClientRect:()=>{if(A.isNodeSelection(r.selection)){const x=t.nodeDOM(d);if(x)return x.getBoundingClientRect()}return A.posToDOMRect(t,d,u)}}),this.show()}show(){var t;(t=this.tippy)==null||t.show()}hide(){var t;(t=this.tippy)==null||t.hide()}destroy(){var t;(t=this.tippy)==null||t.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("mousedown",this.viewMousedownHandler),this.view.dom.removeEventListener("mouseup",this.viewMouseupHandler),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const ns=e=>new V.Plugin({key:new V.PluginKey("BubbleMenuPlugin"),view:t=>new ts({view:t,...e})});var ci={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ui=qe.default.createContext&&qe.default.createContext(ci),et=globalThis&&globalThis.__assign||function(){return et=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},et.apply(this,arguments)},rs=globalThis&&globalThis.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};function di(e){return e&&e.map(function(t,n){return qe.default.createElement(t.tag,et({key:n},t.attr),di(t.child))})}function ee(e){return function(t){return qe.default.createElement(is,et({attr:et({},e.attr)},t),di(e.child))}}function is(e){var t=function(n){var r=e.attr,i=e.size,o=e.title,s=rs(e,["attr","size","title"]),a=i||n.size||"1em",l;return n.className&&(l=n.className),e.className&&(l=(l?l+" ":"")+e.className),qe.default.createElement("svg",et({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,s,{className:l,style:et(et({color:e.color||n.color},n.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),o&&qe.default.createElement("title",null,o),e.children)};return ui!==void 0?qe.default.createElement(ui.Consumer,null,function(n){return t(n)}):t(ci)}function os(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M8 11h4.5a2.5 2.5 0 1 0 0-5H8v5zm10 4.5a4.5 4.5 0 0 1-4.5 4.5H6V4h6.5a4.5 4.5 0 0 1 3.256 7.606A4.498 4.498 0 0 1 18 15.5zM8 13v5h5.5a2.5 2.5 0 1 0 0-5H8z"}}]}]})(e)}function Jn(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0H24V24H0z"}},{tag:"path",attr:{d:"M13 20h-2v-7H4v7H2V4h2v7h7V4h2v16zm8-12v12h-2v-9.796l-2 .536V8.67L19.5 8H21z"}}]}]})(e)}function Yn(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0H24V24H0z"}},{tag:"path",attr:{d:"M4 4v7h7V4h2v16h-2v-7H4v7H2V4h2zm14.5 4c2.071 0 3.75 1.679 3.75 3.75 0 .857-.288 1.648-.772 2.28l-.148.18L18.034 18H22v2h-7v-1.556l4.82-5.546c.268-.307.43-.709.43-1.148 0-.966-.784-1.75-1.75-1.75-.918 0-1.671.707-1.744 1.606l-.006.144h-2C14.75 9.679 16.429 8 18.5 8z"}}]}]})(e)}function Gn(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0H24V24H0z"}},{tag:"path",attr:{d:"M22 8l-.002 2-2.505 2.883c1.59.435 2.757 1.89 2.757 3.617 0 2.071-1.679 3.75-3.75 3.75-1.826 0-3.347-1.305-3.682-3.033l1.964-.382c.156.806.866 1.415 1.718 1.415.966 0 1.75-.784 1.75-1.75s-.784-1.75-1.75-1.75c-.286 0-.556.069-.794.19l-1.307-1.547L19.35 10H15V8h7zM4 4v7h7V4h2v16h-2v-7H4v7H2V4h2z"}}]}]})(e)}function as(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M3 4h18v2H3V4zm0 15h18v2H3v-2zm8-5h10v2H11v-2zm0-5h10v2H11V9zm-8 3.5L7 9v7l-4-3.5z"}}]}]})(e)}function ss(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M3 4h18v2H3V4zm0 15h18v2H3v-2zm8-5h10v2H11v-2zm0-5h10v2H11V9zm-4 3.5L3 16V9l4 3.5z"}}]}]})(e)}function ls(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M15 20H7v-2h2.927l2.116-12H9V4h8v2h-2.927l-2.116 12H15z"}}]}]})(e)}function cs(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M17 17h5v2h-3v3h-2v-5zM7 7H2V5h3V2h2v5zm11.364 8.536L16.95 14.12l1.414-1.414a5 5 0 1 0-7.071-7.071L9.879 7.05 8.464 5.636 9.88 4.222a7 7 0 0 1 9.9 9.9l-1.415 1.414zm-2.828 2.828l-1.415 1.414a7 7 0 0 1-9.9-9.9l1.415-1.414L7.05 9.88l-1.414 1.414a5 5 0 1 0 7.071 7.071l1.414-1.414 1.415 1.414zm-.708-10.607l1.415 1.415-7.071 7.07-1.415-1.414 7.071-7.07z"}}]}]})(e)}function fi(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M18.364 15.536L16.95 14.12l1.414-1.414a5 5 0 1 0-7.071-7.071L9.879 7.05 8.464 5.636 9.88 4.222a7 7 0 0 1 9.9 9.9l-1.415 1.414zm-2.828 2.828l-1.415 1.414a7 7 0 0 1-9.9-9.9l1.415-1.414L7.05 9.88l-1.414 1.414a5 5 0 1 0 7.071 7.071l1.414-1.414 1.415 1.414zm-.708-10.607l1.415 1.415-7.071 7.07-1.415-1.414 7.071-7.07z"}}]}]})(e)}function Kn(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M8 4h13v2H8V4zM5 3v3h1v1H3V6h1V4H3V3h2zM3 14v-2.5h2V11H3v-1h3v2.5H4v.5h2v1H3zm2 5.5H3v-1h2V18H3v-1h3v4H3v-1h2v-.5zM8 11h13v2H8v-2zm0 7h13v2H8v-2z"}}]}]})(e)}function Xn(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M8 4h13v2H8V4zM4.5 6.5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm0 7a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm0 6.9a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zM8 11h13v2H8v-2zm0 7h13v2H8v-2z"}}]}]})(e)}function us(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M17.154 14c.23.516.346 1.09.346 1.72 0 1.342-.524 2.392-1.571 3.147C14.88 19.622 13.433 20 11.586 20c-1.64 0-3.263-.381-4.87-1.144V16.6c1.52.877 3.075 1.316 4.666 1.316 2.551 0 3.83-.732 3.839-2.197a2.21 2.21 0 0 0-.648-1.603l-.12-.117H3v-2h18v2h-3.846zm-4.078-3H7.629a4.086 4.086 0 0 1-.481-.522C6.716 9.92 6.5 9.246 6.5 8.452c0-1.236.466-2.287 1.397-3.153C8.83 4.433 10.271 4 12.222 4c1.471 0 2.879.328 4.222.984v2.152c-1.2-.687-2.515-1.03-3.946-1.03-2.48 0-3.719.782-3.719 2.346 0 .42.218.786.654 1.099.436.313.974.562 1.613.75.62.18 1.297.414 2.03.699z"}}]}]})(e)}function gn(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M13 6v15h-2V6H5V4h14v2z"}}]}]})(e)}function ds(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M8 3v9a4 4 0 1 0 8 0V3h2v9a6 6 0 1 1-12 0V3h2zM4 20h16v2H4v-2z"}}]}]})(e)}function fs(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M10 6v2H5v11h11v-5h2v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h6zm11-3v9l-3.794-3.793-5.999 6-1.414-1.414 5.999-6L12 3h9z"}}]}]})(e)}const pi={tooltip:"_tooltip_mmzq3_1",secondaryText:"_secondaryText_mmzq3_12"},hi=e=>v.exports.jsxs("div",{className:pi.tooltip,children:[v.exports.jsx("div",{children:e.mainTooltip}),e.secondaryTooltip&&v.exports.jsx("div",{className:pi.secondaryText,children:e.secondaryTooltip})]}),je=ae.forwardRef((e,t)=>{const n=e.icon;return v.exports.jsx(Ht.default,{content:v.exports.jsx(hi,{mainTooltip:e.mainTooltip,secondaryTooltip:e.secondaryTooltip}),trigger:"mouseenter",children:e.children?v.exports.jsxs(L.Button,{onClick:e.onClick,color:"brandFinal",size:"xs",variant:e.isSelected?"filled":"subtle",disabled:e.isDisabled||!1,ref:t,children:[n&&v.exports.jsx(n,{}),e.children]}):v.exports.jsx(L.ActionIcon,{onClick:e.onClick,color:"brandFinal",size:30,variant:e.isSelected?"filled":"subtle",disabled:e.isDisabled||!1,ref:t,children:n&&v.exports.jsx(n,{})})})});function ps(e){return ee({tag:"svg",attr:{viewBox:"0 0 20 20",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",clipRule:"evenodd"}}]})(e)}const hs=ae.forwardRef((e,t)=>{const{text:n,icon:r,isDisabled:i,...o}=e,s=e.icon;return v.exports.jsx(L.Button,{leftIcon:s&&v.exports.jsx(s,{size:16}),rightIcon:v.exports.jsx(ps,{}),size:"xs",variant:"subtle",disabled:e.isDisabled,ref:t,...o,children:e.text})});function vs(e){return ee({tag:"svg",attr:{version:"1.2",baseProfile:"tiny",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M16.972 6.251c-.967-.538-2.185-.188-2.72.777l-3.713 6.682-2.125-2.125c-.781-.781-2.047-.781-2.828 0-.781.781-.781 2.047 0 2.828l4 4c.378.379.888.587 1.414.587l.277-.02c.621-.087 1.166-.46 1.471-1.009l5-9c.537-.966.189-2.183-.776-2.72z"}}]})(e)}function ms(e){const t=e.icon;return v.exports.jsx(L.Menu.Item,{onClick:e.onClick,icon:t&&v.exports.jsx(t,{size:16}),rightSection:e.isSelected?v.exports.jsx(vs,{size:16}):v.exports.jsx("div",{style:{width:"16px",padding:"0"}}),disabled:e.isDisabled,children:e.text},e.text)}function gs(e){return v.exports.jsxs(L.Menu,{exitTransitionDuration:0,children:[v.exports.jsx(L.Menu.Target,{children:v.exports.jsx(hs,{...e})}),v.exports.jsx(L.Menu.Dropdown,{children:e.items.map(t=>v.exports.jsx(ms,{...t},t.text))})]})}const vi=e=>{const{classes:t}=L.createStyles({root:{}})(void 0,{name:"Toolbar"});return v.exports.jsx(L.Group,{className:t.root,children:e.children})};function ys(){const[,e]=ae.useState(0);return()=>e(t=>t+1)}const bs=e=>{const t=ys();ae.useEffect(()=>{const n=()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})};return e.on("transaction",n),()=>{e.off("transaction",n)}},[e])},xs=()=>/Mac/.test(navigator.platform)||/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent);function ge(e){return xs()?e.replace("Mod","\u2318"):e.replace("Mod","Ctrl")}function ws(e){const t=e.icon;return v.exports.jsx(Ht.default,{content:v.exports.jsx(hi,{mainTooltip:e.mainTooltip,secondaryTooltip:e.secondaryTooltip}),placement:"left",children:v.exports.jsx(L.Container,{children:v.exports.jsx(t,{size:16})})})}function Es(e){const t=ae.useRef(null);ae.useEffect(()=>{setTimeout(()=>{var r;e.autofocus&&((r=t.current)==null||r.focus())})},[e.autofocus]);function n(r){r.key==="Enter"&&(r.preventDefault(),e.onSubmit())}return v.exports.jsx(L.TextInput,{size:"xs",value:e.value,onChange:r=>e.onChange(r.currentTarget.value),onKeyDown:n,placeholder:e.placeholder,ref:t})}function mi(e){return v.exports.jsxs(L.Group,{children:[v.exports.jsx(ws,{icon:e.icon,mainTooltip:e.mainIconTooltip,secondaryTooltip:e.secondaryIconTooltip}),v.exports.jsx(Es,{autofocus:e.autofocus,placeholder:e.placeholder,value:e.value,onChange:e.onChange,onSubmit:e.onSubmit})]})}const gi=e=>{const[t,n]=ae.useState(e.url),[r,i]=ae.useState(e.text),{classes:o}=L.createStyles({root:{}})(void 0,{name:"EditHyperlinkMenu"});return v.exports.jsxs(L.Stack,{className:o.root,children:[v.exports.jsx(mi,{icon:fi,mainIconTooltip:"Edit URL",autofocus:!0,placeholder:"Edit URL",value:t,onChange:s=>n(s),onSubmit:()=>e.update(t,r)}),v.exports.jsx(mi,{icon:gn,mainIconTooltip:"Edit Title",placeholder:"Edit Title",value:r,onChange:s=>i(s),onSubmit:()=>e.update(t,r)})]})},ks=e=>{const[t,n]=ae.useState(),r=ae.useCallback(()=>{const i=(d,u)=>{if(d==="")return;const p=e.editor.schema.mark("link",{href:d});let{from:m,to:y}=e.editor.state.selection;e.editor.view.dispatch(e.editor.view.state.tr.insertText(u,m,y).addMark(m,m+u.length,p))},{from:o,to:s}=e.editor.state.selection,a=e.editor.state.doc.textBetween(o,s),l=e.editor.isActive("link")&&e.editor.getAttributes("link").href||"";n(v.exports.jsx(gi,{url:l,text:a,update:i},Math.random()+""))},[e.editor]);return v.exports.jsx(Ht.default,{content:t,trigger:"click",onShow:i=>{r()},interactive:!0,maxWidth:500,children:v.exports.jsx(je,{...e})})};function Ts(e,t){const n=["Heading 1","Heading 2","Heading 3"],r={li:"Bullet List",oli:"Numbered List"};return e?n[e-1]:t?r[t]:"Text"}const Os=e=>{bs(e.editor);const t=ft(e.editor.state.selection),n=t==null?void 0:t.node.attrs.headingType,r=t==null?void 0:t.node.attrs.listType,i=Ts(n,r),o={Text:gn,"Heading 1":Jn,"Heading 2":Yn,"Heading 3":Gn,"Bullet List":Xn,"Numbered List":Kn};return v.exports.jsxs(vi,{children:[v.exports.jsx(gs,{text:i,icon:o[i],items:[{onClick:()=>{e.editor.view.focus(),e.editor.chain().unsetBlockHeading().unsetList().run()},text:"Text",icon:gn,isSelected:i==="Text"},{onClick:()=>{e.editor.view.focus(),e.editor.chain().unsetList().setBlockHeading({level:"1"}).run()},text:"Heading 1",icon:Jn,isSelected:i==="Heading 1"},{onClick:()=>{e.editor.view.focus(),e.editor.chain().unsetList().setBlockHeading({level:"2"}).run()},text:"Heading 2",icon:Yn,isSelected:i==="Heading 2"},{onClick:()=>{e.editor.view.focus(),e.editor.chain().unsetList().setBlockHeading({level:"3"}).run()},text:"Heading 3",icon:Gn,isSelected:i==="Heading 3"},{onClick:()=>{e.editor.view.focus(),e.editor.chain().unsetBlockHeading().setBlockList("li").run()},text:"Bullet List",icon:Xn,isSelected:i==="Bullet List"},{onClick:()=>{e.editor.view.focus(),e.editor.chain().unsetBlockHeading().setBlockList("oli").run()},text:"Numbered List",icon:Kn,isSelected:i==="Numbered List"}]}),v.exports.jsx(je,{onClick:()=>{e.editor.view.focus(),e.editor.commands.toggleBold()},isSelected:e.editor.isActive("bold"),mainTooltip:"Bold",secondaryTooltip:ge("Mod+B"),icon:os}),v.exports.jsx(je,{onClick:()=>{e.editor.view.focus(),e.editor.commands.toggleItalic()},isSelected:e.editor.isActive("italic"),mainTooltip:"Italic",secondaryTooltip:ge("Mod+I"),icon:ls}),v.exports.jsx(je,{onClick:()=>{e.editor.view.focus(),e.editor.commands.toggleUnderline()},isSelected:e.editor.isActive("underline"),mainTooltip:"Underline",secondaryTooltip:ge("Mod+U"),icon:ds}),v.exports.jsx(je,{onClick:()=>{e.editor.view.focus(),e.editor.commands.toggleStrike()},isSelected:e.editor.isActive("strike"),mainTooltip:"Strike-through",secondaryTooltip:ge("Mod+Shift+X"),icon:us}),v.exports.jsx(je,{onClick:()=>{e.editor.view.focus(),e.editor.commands.sinkListItem("block")},isDisabled:!e.editor.can().sinkListItem("block"),mainTooltip:"Indent",secondaryTooltip:ge("Tab"),icon:ss}),v.exports.jsx(je,{onClick:()=>{e.editor.view.focus(),e.editor.commands.liftListItem("block")},isDisabled:!e.editor.can().command(({state:s})=>{const a=ft(s.selection);return a?a.depth>2:!1}),mainTooltip:"Decrease Indent",secondaryTooltip:ge("Shift+Tab"),icon:as}),v.exports.jsx(ks,{isSelected:e.editor.isActive("link"),mainTooltip:"Link",secondaryTooltip:ge("Mod+K"),icon:fi,editor:e.editor})]})},Ss=A.Extension.create({name:"BubbleMenuExtension",addProseMirrorPlugins(){const e=document.createElement("div");return e.className=Rn.bnRoot,Ke.default.render(v.exports.jsx(L.MantineProvider,{theme:cn,children:v.exports.jsx(Os,{editor:this.editor})}),e),[ns({editor:this.editor,element:e,pluginKey:new V.PluginKey("BubbleMenuPlugin"),tippyOptions:{appendTo:document.body}})]}});function Cs(e){return ee({tag:"svg",attr:{t:"1551322312294",style:"",viewBox:"0 0 1024 1024",version:"1.1"},child:[{tag:"defs",attr:{},child:[]},{tag:"path",attr:{d:"M474 152m8 0l60 0q8 0 8 8l0 704q0 8-8 8l-60 0q-8 0-8-8l0-704q0-8 8-8Z"}},{tag:"path",attr:{d:"M168 474m8 0l672 0q8 0 8 8l0 60q0 8-8 8l-672 0q-8 0-8-8l0-60q0-8 8-8Z"}}]})(e)}const As=5;function Rs(e){const t=ae.useRef(null),{classes:n}=L.createStyles({root:{}})(void 0,{name:"SuggestionListItem"});function r(){var l;const s=e.selectedIndex!==void 0&&e.selectedIndex===e.index,a=(l=t.current)==null?void 0:l.matches(":hover");return s||a}function i(){var s,a;r()?(s=t.current)==null||s.setAttribute("data-hovered","true"):(a=t.current)==null||a.removeAttribute("data-hovered")}ae.useEffect(()=>{i(),r()&&t.current&&t.current.getBoundingClientRect().left>As&&t.current.scrollIntoView({behavior:"smooth",block:"nearest"})});const o=e.item.icon;return v.exports.jsx(L.Menu.Item,{className:n.root,icon:o&&v.exports.jsx(o,{size:18}),onClick:()=>e.clickItem(e.item),onMouseLeave:()=>{setTimeout(()=>{i()})},ref:t,rightSection:e.item.shortcut&&v.exports.jsx(L.Badge,{size:"xs",children:e.item.shortcut}),children:v.exports.jsxs(L.Stack,{children:[v.exports.jsx(L.Text,{size:14,weight:500,children:e.item.name}),v.exports.jsx(L.Text,{size:10,children:e.item.hint})]})})}function Is(e){return v.exports.jsxs(v.exports.Fragment,{children:[v.exports.jsx(L.Menu.Label,{children:e.name}),e.items.map((t,n)=>v.exports.jsx(Rs,{item:t,index:n,selectedIndex:e.selectedIndex,clickItem:e.clickItem},n))]})}function Ds(e){const{classes:t}=L.createStyles({root:{}})(void 0,{name:"SuggestionList"}),n=[];let r=0;for(const i in e.groups){const o=e.groups[i];n.push(v.exports.jsx(Is,{name:i,items:o,selectedIndex:e.selectedIndex>=r?e.selectedIndex-r:void 0,clickItem:e.onSelectItem},i)),r+=o.length}return v.exports.jsx(L.Menu,{defaultOpened:!0,trigger:"hover",closeDelay:1e7,children:v.exports.jsx(L.Menu.Dropdown,{className:t.root,children:n.length>0?n:v.exports.jsx(L.Menu.Item,{children:"No match found"})})})}function Ns(e){let t,n,r=!0,i=0,o;const s=a=>{if(!o)throw new Error("props not set");let l=0;for(const d in o.groups){const u=o.groups[d],p=u.length;if(a<l+p)return u[a-l];l+=p}throw Error("item not found")};return{getComponent:()=>{if(!(!n||!n[0]))return n[0].reference},onStart:a=>{o=a,r=!1,i=0;const l={groups:a.groups,count:a.count,onSelectItem:a.onSelectItem,selectedIndex:i};t=new bn.ReactRenderer(d=>v.exports.jsx(L.MantineProvider,{theme:cn,children:v.exports.jsx(Ds,{...d})}),{editor:e,props:l}),n=At("body",{getReferenceClientRect:a.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"})},onUpdate:a=>{o=a,o.groups!==t.props.groups&&(i=0);const l={groups:o.groups,count:o.count,onSelectItem:o.onSelectItem,selectedIndex:i};t.updateProps(l),n[0].setProps({getReferenceClientRect:o.clientRect})},onKeyDown:a=>{if(!o)return!1;if(a.key==="ArrowUp")return i=(i+o.count-1)%o.count,t.updateProps({selectedIndex:i}),!0;if(a.key==="ArrowDown")return i=(i+1)%o.count,t.updateProps({selectedIndex:i}),!0;if(a.key==="Enter"){const l=s(i);return o.onSelectItem(l),!0}return a.key==="Escape"?(o.onClose(),!0):!1},onExit:a=>{if(r)return;r=!0;const l=n[0],d=t;l.hide(),setTimeout(()=>{l.destroy(),d.destroy()},1e3)}}}function Ms(e,t){if(!t.empty)return;const n=t.$anchor.nodeBefore;if(!n||!n.text)return;const r=new RegExp(`${yn.escapeRegExp(e)}([^${yn.escapeRegExp(e)}]*)$`),i=n.text.match(r);if(!!i)return{query:i[1],range:{from:t.$anchor.pos-i[1].length-e.length,to:t.$anchor.pos}}}function Ps({pluginKey:e,editor:t,char:n,onSelectItem:r=()=>{},items:i=()=>[]}){if(n.length!==1)throw new Error("'char' should be a single character");const o=Ns(t);return new V.Plugin({key:e,filterTransaction(s){const a=s.getMeta("blur");if(a!=null&&a.event.relatedTarget){const l=o.getComponent();if(l!=null&&l.contains(a.event.relatedTarget))return!1}return!0},view(){return{update:async(s,a)=>{var N,T,f,I,w;const l=(N=this.key)==null?void 0:N.getState(a),d=(T=this.key)==null?void 0:T.getState(s.state),u=!l.active&&d.active,p=l.active&&!d.active,m=!u&&!p&&l.query!==d.query;if(!u&&!m&&!p)return;const y=p?l:d,x=document.querySelector(`[data-decoration-id="${y.decorationId}"]`),b=yn.groupBy(y.items,"groupName"),O=()=>{s.dispatch(s.state.tr.setMeta(e,{deactivate:!0}))},C={groups:m||u?b:{},count:y.items.length,onSelectItem:M=>{O(),r({item:M,editor:t,range:y.range})},clientRect:x?()=>x.getBoundingClientRect():null,onClose:()=>{var M;O(),(M=o.onExit)==null||M.call(o,C)}};p&&((f=o.onExit)==null||f.call(o,C)),m&&((I=o.onUpdate)==null||I.call(o,C)),u&&((w=o.onStart)==null||w.call(o,C))}}},state:{init(){return{active:!1,range:{},query:null,notFoundCount:0,items:[],type:"slash",decorationId:null}},apply(s,a,l,d){var m,y,x;const{selection:u}=s,p={...a};if(u.from===u.to&&!((m=s.getMeta(e))!=null&&m.deactivate)&&!s.getMeta("focus")&&!s.getMeta("blur")&&!s.getMeta("pointer")){if(a.active&&u.from<=a.range.from)p.active=!1;else if((y=s.getMeta(e))!=null&&y.activate){const b=`id_${Math.floor(Math.random()*4294967295)}`;p.decorationId=b,p.range={from:u.from-1,to:u.to},p.query="",p.active=!0,p.type=(x=s.getMeta(e))==null?void 0:x.type}else if(a.active){const b=Ms(a.type==="slash"?n:"",u);if(!b)throw new Error("active but no match (suggestions)");p.range=b.range,p.active=!0,p.decorationId=a.decorationId,p.query=b.query}}else p.active=!1;return p.active&&(p.items=i(p.query),p.items.length?p.notFoundCount=0:p.range.to>a.range.to?p.notFoundCount=a.notFoundCount+1:p.notFoundCount=a.notFoundCount,p.notFoundCount>3&&(p.active=!1)),p.active||(p.decorationId=null,p.range={},p.query=null,p.notFoundCount=0,p.items=[]),p}},props:{handleKeyDown(s,a){var d;const{active:l}=this.getState(s.state);return l?((d=o.onKeyDown)==null?void 0:d.call(o,a))||!1:a.key===n?(s.dispatch(s.state.tr.insertText(n).scrollIntoView().setMeta(e,{activate:!0,type:"slash"})),!0):!1},decorations(s){const{active:a,range:l,decorationId:d,type:u}=this.getState(s);if(!a)return null;if(u==="drag"){const p=ft(s.selection);if(p)return Ve.DecorationSet.create(s.doc,[Ve.Decoration.node(p.pos,p.pos+p.node.nodeSize,{nodeName:"span",class:"suggestion-decorator","data-decoration-id":d})])}return Ve.DecorationSet.create(s.doc,[Ve.Decoration.inline(l.from,l.to,{nodeName:"span",class:"suggestion-decorator","data-decoration-id":d})])}}})}var yt=(e=>(e.HEADINGS="Headings",e.BASIC_BLOCKS="Basic Blocks",e.CODE="Code Blocks",e.INLINE="Inline",e.EMBED="Embed",e.PLUGIN="Plugin",e))(yt||{});class Rt{constructor(t,n,r,i=[],o,s,a){oe(this,"groupName");this.name=t,this.group=n,this.execute=r,this.aliases=i,this.icon=o,this.hint=s,this.shortcut=a,this.groupName=n}match(t){return this.name.toLowerCase().startsWith(t.toLowerCase())||this.aliases.filter(n=>n.toLowerCase().startsWith(t.toLowerCase())).length!==0}}const js={heading:new Rt("Heading",yt.HEADINGS,(e,t)=>e.chain().focus().deleteRange(t).addNewBlockAsSibling({headingType:"1"}).run(),["h","heading1","h1"],Jn,"Used for a top-level heading",ge("Mod-Alt-1")),heading2:new Rt("Heading 2",yt.HEADINGS,(e,t)=>e.chain().focus().deleteRange(t).addNewBlockAsSibling({headingType:"2"}).run(),["h2","heading2","subheading"],Yn,"Used for key sections",ge("Mod-Alt-2")),heading3:new Rt("Heading 3",yt.HEADINGS,(e,t)=>e.chain().focus().deleteRange(t).addNewBlockAsSibling({headingType:"3"}).run(),["h3","heading3","subheading"],Gn,"Used for subsections and group headings",ge("Mod-Alt-3")),numberedList:new Rt("Numbered List",yt.BASIC_BLOCKS,(e,t)=>e.chain().focus().deleteRange(t).addNewBlockAsSibling({listType:"oli"}).run(),["li","list","numberedlist","numbered list"],Kn,"Used to display a numbered list",ge("Mod-Shift-7")),bulletlist:new Rt("Bullet List",yt.BASIC_BLOCKS,(e,t)=>e.chain().focus().deleteRange(t).addNewBlockAsSibling({listType:"li"}).run(),["ul","list","bulletlist","bullet list"],Xn,"Used to display an unordered list",ge("Mod-Shift-8")),paragraph:new Rt("Paragraph",yt.BASIC_BLOCKS,(e,t)=>e.chain().focus().deleteRange(t).addNewBlockAsSibling().run(),["p"],gn,"Used for the body of your document",ge("Mod-Alt-0"))},Zn=new V.PluginKey("suggestions-slash-commands"),Ls=A.Extension.create({name:"slash-command",addOptions(){return{commands:js}},addProseMirrorPlugins(){return[Ps({pluginKey:Zn,editor:this.editor,char:"/",items:e=>{const t=[];for(const n in this.options.commands)t.push(this.options.commands[n]);return t.filter(n=>n.match(e))},onSelectItem:({item:e,editor:t,range:n})=>{e.execute(t,n)}})]}});function Bs(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}}]})(e)}const _s=e=>{const{classes:t}=L.createStyles({root:{}})(void 0,{name:"DragHandleMenu"});return v.exports.jsx(L.Menu.Dropdown,{className:t.root,children:v.exports.jsx(L.Menu.Item,{onClick:e.onDelete,children:"Delete"})})},Hs=e=>{const[t,n]=ae.useState(!1),[r,i]=ae.useState(!1),o=()=>{const a=e.view.posAtCoords(e.coords);if(!a)return;const l=ft(V.TextSelection.create(e.view.state.doc,a.pos));l&&(e.view.dispatch&&e.view.dispatch(e.view.state.tr.deleteRange(l.pos,l.pos+l.node.nodeSize)),i(!0))},s=()=>{var d;n(!0),e.onAddClicked&&e.onAddClicked();const a=e.view.posAtCoords(e.coords);if(!a)return;const l=ft(V.TextSelection.create(e.view.state.doc,a.pos));if(!!l){if(((d=l.node.firstChild)==null?void 0:d.textContent.length)!==0){const u=l.pos+l.node.nodeSize;let p=e.view.state.schema.nodes.content.createAndFill();e.view.state.tr.insert(u,p),e.view.dispatch(e.view.state.tr.insert(u,p)),e.view.dispatch(e.view.state.tr.setSelection(new V.TextSelection(e.view.state.tr.doc.resolve(u+1))))}e.view.focus(),e.view.dispatch(e.view.state.tr.scrollIntoView().setMeta(Zn,{activate:!0,type:"drag"}))}};return r||t?null:v.exports.jsxs("div",{style:{display:"flex",flexDirection:"row"},children:[v.exports.jsx(L.ActionIcon,{size:24,color:"brandFinal.3","data-test":"dragHandleAdd",children:v.exports.jsx(Cs,{size:24,onClick:s})}),v.exports.jsxs(L.Menu,{onOpen:e.onShow,onClose:e.onHide,position:"left",children:[v.exports.jsx(L.Menu.Target,{children:v.exports.jsx(L.ActionIcon,{size:24,color:"brandFinal.3","data-test":"dragHandle",children:v.exports.jsx(Bs,{size:24})})}),v.exports.jsx(_s,{onDelete:o})]})]})};class tn extends V.Selection{constructor(n,r){super(n,r);oe(this,"nodes");const i=n.node();this.nodes=[],n.doc.nodesBetween(n.pos,r.pos,(o,s,a)=>{if(a!==null&&a.eq(i))return this.nodes.push(o),!1})}static create(n,r,i=r){return new tn(n.resolve(r),n.resolve(i))}content(){return new D.Slice(D.Fragment.from(this.nodes),0,0)}eq(n){if(!(n instanceof tn)||this.nodes.length!==n.nodes.length||this.from!==n.from||this.to!==n.to)return!1;for(let r=0;r<this.nodes.length;r++)if(!this.nodes[r].eq(n.nodes[r]))return!1;return!0}map(n,r){let i=r.mapResult(this.from),o=r.mapResult(this.to);return o.deleted?V.Selection.near(n.resolve(i.pos)):i.deleted?V.Selection.near(n.resolve(o.pos)):new tn(n.resolve(i.pos),n.resolve(o.pos))}toJSON(){return{type:"node",anchor:this.anchor,head:this.head}}}const Fs=Gi.__serializeForClipboard;let Qn,It;function zs(){if(!Qn){const e=document.querySelector(".ProseMirror > [class*='blockGroup']");e&&(Qn=yi(e).left)}return Qn}function Vs(e){let t={left:e.left+document.body.scrollLeft,top:e.top+document.body.scrollTop,width:e.width,height:e.height,bottom:0,right:0};return t.bottom=t.top+t.height,t.right=t.left+t.width,t}function yi(e){return Vs(e.getBoundingClientRect())}function bi(e,t){var i;let n=t.posAtCoords(e);if(!n)return;let r=t.domAtPos(n.pos).node;if(r!==t.dom){for(;r&&r.parentNode&&r.parentNode!==t.dom&&!((i=r.hasAttribute)!=null&&i.call(r,"data-id"));)r=r.parentNode;if(!!r)return{node:r,id:r.getAttribute("data-id")}}}function qs(e,t){let n=bi(e,t);if(n&&n.node.nodeType===1){const r=t.docView;let i=r.nearestDesc(n.node,!0);return!i||i===r?null:i.posBefore}return null}function Us(e,t){let n,r;const i=t.resolve(e.from).node().type.name==="content",o=t.resolve(e.to).node().type.name==="content",s=Math.min(e.$anchor.depth,e.$head.depth);if(i&&o){const a=e.$from.start(s-1),l=e.$to.end(s-1);n=t.resolve(a-1).pos,r=t.resolve(l+1).pos}else n=e.from,r=e.to;return{from:n,to:r}}function xi(e,t,n=t){t===n&&(n+=e.state.doc.resolve(t+1).node().nodeSize);const r=e.domAtPos(t).node.cloneNode(!0),i=e.domAtPos(t).node,o=(l,d)=>Array.prototype.indexOf.call(l.children,d),s=o(i,e.domAtPos(t+1).node.parentElement),a=o(i,e.domAtPos(n-1).node.parentElement);for(let l=i.childElementCount-1;l>=0;l--)(l>a||l<s)&&r.removeChild(r.children[l]);It=r,document.body.appendChild(It)}function Ws(){It!==void 0&&(document.body.removeChild(It),It=void 0)}function $s(e,t){if(!e.dataTransfer)return;let n={left:t.dom.clientWidth/2,top:e.clientY},r=qs(n,t);if(r!=null){const i=t.state.selection,o=t.state.doc,{from:s,to:a}=Us(i,o),l=s<=r&&r<a,d=!i.$anchor.node().eq(i.$head.node());l&&d?(t.dispatch(t.state.tr.setSelection(tn.create(o,s,a))),xi(t,s,a)):(t.dispatch(t.state.tr.setSelection(V.NodeSelection.create(t.state.doc,r))),xi(t,r));let u=t.state.selection.content(),{dom:p,text:m}=Fs(t,u);e.dataTransfer.clearData(),e.dataTransfer.setData("text/html",p.innerHTML),e.dataTransfer.setData("text/plain",m),e.dataTransfer.effectAllowed="move",e.dataTransfer.setDragImage(It,0,0),t.dragging={slice:u,move:!0}}}const Js=()=>{let e,n=!1,r=!1;const i=()=>{n=!0},o=()=>{n=!1},s=()=>{r=!0};return new V.Plugin({key:new V.PluginKey("DraggableBlocksPlugin"),view(a){return e=document.createElement("div"),e.setAttribute("draggable","true"),e.style.position="absolute",e.style.height="24px",document.body.append(e),e.addEventListener("dragstart",l=>$s(l,a)),e.addEventListener("dragend",()=>Ws()),{destroy(){if(!e)throw new Error("unexpected");e.parentNode.removeChild(e),e=void 0}}},props:{handleKeyDown(a,l){if(!e)throw new Error("unexpected");return n=!1,r=!1,Ke.default.render(v.exports.jsx(v.exports.Fragment,{}),e),!1},handleDOMEvents:{mouseleave(a,l){if(!e)throw new Error("unexpected");return!0},mousedown(a,l){if(!e)throw new Error("unexpected");return n=!1,r=!1,Ke.default.render(v.exports.jsx(v.exports.Fragment,{}),e),!1},mousemove(a,l){if(!e)throw new Error("unexpected");if(n||r)return!0;const d={left:a.dom.clientWidth/2,top:l.clientY},u=bi(d,a);if(!u)return console.warn("Perhaps we should hide element?"),!0;const p=u.node.firstChild;if(!p)return!0;const m=yi(p),y=u.node.ownerDocument.defaultView,x=e.getBoundingClientRect(),b=zs()-48+y.pageXOffset;return m.top+=m.height/2-x.height/2+y.pageYOffset,e.style.left=b+"px",e.style.top=m.top+"px",Ke.default.render(v.exports.jsx(L.MantineProvider,{theme:cn,children:v.exports.jsx(Hs,{onShow:i,onHide:o,onAddClicked:s,view:a,coords:d},u.id+"")}),e),!0}}}})},Ys=A.Extension.create({name:"DraggableBlocksExtension",priority:1e3,addProseMirrorPlugins(){return[Js()]}}),Gs=e=>v.exports.jsxs(vi,{children:[v.exports.jsx(je,{mainTooltip:"Edit",isSelected:!1,onClick:e.edit,children:"Edit Link"}),v.exports.jsx(je,{mainTooltip:"Open in new tab",isSelected:!1,onClick:()=>{window.open(e.url,"_blank")},icon:fs}),v.exports.jsx(je,{mainTooltip:"Remove link",isSelected:!1,onClick:e.remove,icon:cs})]}),Ks=e=>{const[t,n]=ae.useState(!1),r=v.exports.jsx(Ht.default,{getReferenceClientRect:()=>e.pos,content:v.exports.jsx(gi,{url:e.url,text:e.text,update:e.update}),interactive:!0,interactiveBorder:30,showOnCreate:!0,trigger:"click",hideOnClick:!0,className:Rn.bnRoot,appendTo:document.body,children:v.exports.jsx("div",{})}),i=v.exports.jsx(Gs,{url:e.url,edit:()=>n(!0),remove:e.remove});return t?r:i},wi=new V.PluginKey("HyperlinkMenuPlugin"),Xs=()=>{const e=document.createElement("div");let t,n="hidden",r=0;return new V.Plugin({key:wi,view(){return{update:async(i,o)=>{const s=i.state.selection;if(s.from!==s.to){n!=="hidden"&&(n="hidden",Ke.default.render(v.exports.jsx(v.exports.Fragment,{}),e));return}let a,l,d,u=!1;if(t){a=i.posAtDOM(t.firstChild,0),l=i.state.doc.resolve(a);const T=l.parent.childAfter(l.parentOffset).node;d=T==null?void 0:T.marks.find(f=>f.type.name.startsWith("link"))}if(!d&&(i.hasFocus()||n==="cursor-based")){a=s.from,l=i.state.doc.resolve(a);const T=l.parent.childAfter(l.parentOffset).node;d=T==null?void 0:T.marks.find(f=>f.type.name.startsWith("link")),u=!0}if(!d||!a||!l){n==="cursor-based"&&(n="hidden",Ke.default.render(v.exports.jsx(v.exports.Fragment,{}),e));return}const p=A.getMarkRange(l,d.type,d.attrs);if(!p)return;const m=i.state.doc.textBetween(p.from,p.to),y=d.attrs.href,x={...i.coordsAtPos(Math.round((p.from+p.to)/2)),height:0,width:0},b=d,O=(T,f)=>{n="hidden",Ke.default.render(v.exports.jsx(v.exports.Fragment,{}),e),b.attrs={...b.attrs,href:T};const I=i.state.tr.insertText(f,p.from,p.to);I.addMark(p.from,p.from+f.length,b),i.dispatch(I)},C=()=>{i.dispatch(i.state.tr.removeMark(p.from,p.to,b.type).setMeta("preventAutolink",!0))},N=v.exports.jsx(L.MantineProvider,{theme:cn,children:v.exports.jsx(Ht.default,{getReferenceClientRect:()=>x,content:v.exports.jsx(Ks,{update:O,pos:x,remove:C,text:m,url:y}),onHide:()=>{r++,n="hidden"},aria:{expanded:!1},interactive:!0,interactiveBorder:30,triggerTarget:t,showOnCreate:u,appendTo:document.body,children:v.exports.jsx("div",{})},r+"")});Ke.default.render(N,e),n=u?"cursor-based":"mouse-based"}}},props:{handleDOMEvents:{mouseover(i,o){const s=o.target instanceof HTMLAnchorElement&&o.target.nodeName==="A"?o.target:void 0;return s!==t&&(t=s,i.dispatch(i.state.tr.setMeta(wi,{hoveredLinkChanged:!0}))),!1}}}})},Zs=Li.Link.extend({priority:500,addProseMirrorPlugins(){var e;return[...((e=this.parent)==null?void 0:e.call(this))||[],Xs()]}}),Qs=Ki.default.extend({addKeyboardShortcuts:()=>({"Mod-Alt-0":()=>!1})}),el=A.Extension.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",isFilterClass:"is-filter",hasAnchorClass:"has-anchor",placeholder:"Write something \u2026",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new V.Plugin({props:{decorations:e=>{const{doc:t,selection:n}=e,r=Zn.getState(e),i=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:o}=n,s=[];if(!!i)return t.descendants((a,l)=>{const d=o>=l&&o<=l+a.nodeSize,u=!a.isLeaf&&!a.childCount;if((d||!this.options.showOnlyCurrent)&&u){const p=[this.options.emptyNodeClass];this.editor.isEmpty&&p.push(this.options.emptyEditorClass),d&&p.push(this.options.hasAnchorClass),r.type==="drag"&&r.active&&p.push(this.options.isFilterClass);const m=Ve.Decoration.node(l,l+a.nodeSize,{class:p.join(" ")});s.push(m)}return this.options.includeChildren}),Ve.DecorationSet.create(t,s)}}})]}}),tl=A.Extension.create({name:"trailingNode",addProseMirrorPlugins(){const e=new V.PluginKey(this.name);return[new V.Plugin({key:e,appendTransaction:(t,n,r)=>{const{doc:i,tr:o,schema:s}=r,a=e.getState(r),l=i.content.size-2,d=s.nodes.block,u=s.nodes.content;if(!!a)return o.insert(l,d.create(void 0,u.create()))},state:{init:(t,n)=>{},apply:(t,n)=>{if(!t.docChanged)return n;let r=t.doc.lastChild;if(!r||r.type.name!=="blockgroup")throw new Error("Expected blockgroup");if(r=r.lastChild,!r||r.type.name!=="block")throw new Error("Expected block");return r.nodeSize>4}}})]}});function nl(e,t=JSON.stringify){const n={};return e.filter(r=>{const i=t(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function rl(e){const t=e.filter((r,i)=>e.indexOf(r)!==i);return nl(t)}const il=A.Extension.create({name:"uniqueID",priority:1e4,addOptions(){return{attributeName:"id",types:[],generateID:()=>_i.v4(),filterTransaction:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{[this.options.attributeName]:{default:null,parseHTML:e=>e.getAttribute(`data-${this.options.attributeName}`),renderHTML:e=>e[this.options.attributeName]?{[`data-${this.options.attributeName}`]:e[this.options.attributeName]}:{}}}}]},onCreate(){if(this.editor.extensionManager.extensions.find(l=>l.name==="collaboration"))return;const{view:e,state:t}=this.editor,{tr:n,doc:r}=t,{types:i,attributeName:o,generateID:s}=this.options;A.findChildren(r,l=>i.includes(l.type.name)&&l.attrs[o]===null).forEach(({node:l,pos:d})=>{n.setNodeMarkup(d,void 0,{...l.attrs,[o]:s()})}),n.setMeta("addToHistory",!1),e.dispatch(n)},addProseMirrorPlugins(){let e=null,t=!1;return[new V.Plugin({key:new V.PluginKey("uniqueID"),appendTransaction:(n,r,i)=>{console.log("appendTransaction");const o=n.some(x=>x.docChanged)&&!r.doc.eq(i.doc),s=this.options.filterTransaction&&n.some(x=>{var b,O;return!(!((O=(b=this.options).filterTransaction)===null||O===void 0)&&O.call(b,x))});if(!o||s)return;const{tr:a}=i,{types:l,attributeName:d,generateID:u}=this.options,p=A.combineTransactionSteps(r.doc,n),{mapping:m}=p;if(A.getChangedRanges(p).forEach(({newRange:x})=>{const b=A.findChildrenInRange(i.doc,x,N=>l.includes(N.type.name)),O=b.map(({node:N})=>N.attrs[d]).filter(N=>N!==null),C=rl(O);b.forEach(({node:N,pos:T})=>{var f;const I=(f=a.doc.nodeAt(T))===null||f===void 0?void 0:f.attrs[d];if(I===null){a.setNodeMarkup(T,void 0,{...N.attrs,[d]:u()});return}const{deleted:w}=m.invert().mapResult(T);w&&C.includes(I)&&a.setNodeMarkup(T,void 0,{...N.attrs,[d]:u()})})}),!!a.steps.length)return a},view(n){const r=i=>{var o;e=!((o=n.dom.parentElement)===null||o===void 0)&&o.contains(i.target)?n.dom.parentElement:null};return window.addEventListener("dragstart",r),{destroy(){window.removeEventListener("dragstart",r)}}},props:{handleDOMEvents:{drop:(n,r)=>{var i;return(e!==n.dom.parentElement||((i=r.dataTransfer)===null||i===void 0?void 0:i.effectAllowed)==="copy")&&(e=null,t=!0),!1},paste:()=>(t=!0,!1)},transformPasted:n=>{if(!t)return n;const{types:r,attributeName:i}=this.options,o=s=>{const a=[];return s.forEach(l=>{if(l.isText){a.push(l);return}if(!r.includes(l.type.name)){a.push(l.copy(o(l.content)));return}const d=l.type.create({...l.attrs,[i]:null},o(l.content),l.marks);a.push(d)}),D.Fragment.from(a)};return t=!1,new D.Slice(o(n.content),n.openStart,n.openEnd)}}})]}}),ol=A.Node.create({name:"doc",topNode:!0,content:"block+"}),Ei=()=>[A.extensions.ClipboardTextSerializer,A.extensions.Commands,A.extensions.Editable,A.extensions.FocusEvents,A.extensions.Tabindex,qi.default,el.configure({emptyNodeClass:pt.isEmpty,hasAnchorClass:pt.hasAnchor,isFilterClass:pt.isFilter,includeChildren:!0,showOnlyCurrent:!1}),il.configure({types:["block"]}),Ui.default,Ji.default,Fi.default,zi.default,Wi.default,$i.default,Yi.default,Zs,Qs,...mo,Ys,Vi.default.configure({width:5,color:"#ddeeff"}),Ss,Ri.History,Ls,tl],al={bnEditor:"_bnEditor_1bxtz_1"},ki=Ei(),sl={enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!1},ll=(e={},t=[])=>{var i,o,s;const n=e.disableHistoryExtension?ki.filter(a=>a.name!=="history"):ki,r={...sl,...e,extensions:e.enableBlockNoteExtensions===!1?e.extensions:[...e.extensions||[],...n],editorProps:{attributes:{...((i=e.editorProps)==null?void 0:i.attributes)||{},class:[al.bnEditor,Rn.bnRoot,((s=(o=e.editorProps)==null?void 0:o.attributes)==null?void 0:s.class)||""].join(" ")}}};return bn.useEditor(r,t)};Object.defineProperty(P,"EditorContent",{enumerable:!0,get:()=>bn.EditorContent}),P.Document=ol,P.getBlockNoteExtensions=Ei,P.useEditor=ll,Object.defineProperties(P,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
53
|
+
`,"2) content: () => element.cloneNode(true)"].join(" "))}var a=i.reduce(function(l,d){var u=d&&es(d,r);return u&&l.push(u),l},[]);return Qt(e)?a[0]:a}At.defaultProps=me,At.setDefaultProps=Ka,At.currentInput=Pe,Object.assign({},Tr,{effect:function(t){var n=t.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow)}}),At.setDefaultProps({render:li});class ts{constructor({editor:t,element:n,view:r,tippyOptions:i={},shouldShow:o}){oe(this,"editor");oe(this,"element");oe(this,"view");oe(this,"preventHide",!1);oe(this,"preventShow",!1);oe(this,"tippy");oe(this,"tippyOptions");oe(this,"shouldShow",({view:t,state:n,from:r,to:i})=>{const{doc:o,selection:s}=n,{empty:a}=s,l=!o.textBetween(r,i).length&&A.isTextSelection(n.selection);return!(!t.hasFocus()||a||l)});oe(this,"mousedownHandler",()=>{this.preventHide=!0});oe(this,"viewMousedownHandler",()=>{this.preventShow=!0});oe(this,"viewMouseupHandler",()=>{this.preventShow=!1,setTimeout(()=>this.update(this.editor.view))});oe(this,"dragstartHandler",()=>{this.hide()});oe(this,"focusHandler",()=>{setTimeout(()=>this.update(this.editor.view))});oe(this,"blurHandler",({event:t})=>{var n;if(this.preventHide){this.preventHide=!1;return}(t==null?void 0:t.relatedTarget)&&((n=this.element.parentNode)==null?void 0:n.contains(t.relatedTarget))||this.hide()});this.editor=t,this.element=n,this.view=r,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("mousedown",this.viewMousedownHandler),this.view.dom.addEventListener("mouseup",this.viewMouseupHandler),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:t}=this.editor.options,n=!!t.parentElement;this.tippy||!n||(this.tippy=At(t,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",r=>{this.blurHandler({event:r})}))}update(t,n){var m,y;const{state:r,composing:i}=t,{doc:o,selection:s}=r,a=n&&n.doc.eq(o)&&n.selection.eq(s);if(i||a)return;this.createTooltip();const{ranges:l}=s,d=Math.min(...l.map(x=>x.$from.pos)),u=Math.max(...l.map(x=>x.$to.pos));if(!((m=this.shouldShow)==null?void 0:m.call(this,{editor:this.editor,view:t,state:r,oldState:n,from:d,to:u}))||this.preventShow){this.hide();return}(y=this.tippy)==null||y.setProps({getReferenceClientRect:()=>{if(A.isNodeSelection(r.selection)){const x=t.nodeDOM(d);if(x)return x.getBoundingClientRect()}return A.posToDOMRect(t,d,u)}}),this.show()}show(){var t;(t=this.tippy)==null||t.show()}hide(){var t;(t=this.tippy)==null||t.hide()}destroy(){var t;(t=this.tippy)==null||t.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("mousedown",this.viewMousedownHandler),this.view.dom.removeEventListener("mouseup",this.viewMouseupHandler),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const ns=e=>new V.Plugin({key:new V.PluginKey("BubbleMenuPlugin"),view:t=>new ts({view:t,...e})});var ci={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ui=qe.default.createContext&&qe.default.createContext(ci),et=globalThis&&globalThis.__assign||function(){return et=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},et.apply(this,arguments)},rs=globalThis&&globalThis.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};function di(e){return e&&e.map(function(t,n){return qe.default.createElement(t.tag,et({key:n},t.attr),di(t.child))})}function ee(e){return function(t){return qe.default.createElement(is,et({attr:et({},e.attr)},t),di(e.child))}}function is(e){var t=function(n){var r=e.attr,i=e.size,o=e.title,s=rs(e,["attr","size","title"]),a=i||n.size||"1em",l;return n.className&&(l=n.className),e.className&&(l=(l?l+" ":"")+e.className),qe.default.createElement("svg",et({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,s,{className:l,style:et(et({color:e.color||n.color},n.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),o&&qe.default.createElement("title",null,o),e.children)};return ui!==void 0?qe.default.createElement(ui.Consumer,null,function(n){return t(n)}):t(ci)}function os(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M8 11h4.5a2.5 2.5 0 1 0 0-5H8v5zm10 4.5a4.5 4.5 0 0 1-4.5 4.5H6V4h6.5a4.5 4.5 0 0 1 3.256 7.606A4.498 4.498 0 0 1 18 15.5zM8 13v5h5.5a2.5 2.5 0 1 0 0-5H8z"}}]}]})(e)}function Jn(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0H24V24H0z"}},{tag:"path",attr:{d:"M13 20h-2v-7H4v7H2V4h2v7h7V4h2v16zm8-12v12h-2v-9.796l-2 .536V8.67L19.5 8H21z"}}]}]})(e)}function Yn(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0H24V24H0z"}},{tag:"path",attr:{d:"M4 4v7h7V4h2v16h-2v-7H4v7H2V4h2zm14.5 4c2.071 0 3.75 1.679 3.75 3.75 0 .857-.288 1.648-.772 2.28l-.148.18L18.034 18H22v2h-7v-1.556l4.82-5.546c.268-.307.43-.709.43-1.148 0-.966-.784-1.75-1.75-1.75-.918 0-1.671.707-1.744 1.606l-.006.144h-2C14.75 9.679 16.429 8 18.5 8z"}}]}]})(e)}function Gn(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0H24V24H0z"}},{tag:"path",attr:{d:"M22 8l-.002 2-2.505 2.883c1.59.435 2.757 1.89 2.757 3.617 0 2.071-1.679 3.75-3.75 3.75-1.826 0-3.347-1.305-3.682-3.033l1.964-.382c.156.806.866 1.415 1.718 1.415.966 0 1.75-.784 1.75-1.75s-.784-1.75-1.75-1.75c-.286 0-.556.069-.794.19l-1.307-1.547L19.35 10H15V8h7zM4 4v7h7V4h2v16h-2v-7H4v7H2V4h2z"}}]}]})(e)}function as(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M3 4h18v2H3V4zm0 15h18v2H3v-2zm8-5h10v2H11v-2zm0-5h10v2H11V9zm-8 3.5L7 9v7l-4-3.5z"}}]}]})(e)}function ss(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M3 4h18v2H3V4zm0 15h18v2H3v-2zm8-5h10v2H11v-2zm0-5h10v2H11V9zm-4 3.5L3 16V9l4 3.5z"}}]}]})(e)}function ls(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M15 20H7v-2h2.927l2.116-12H9V4h8v2h-2.927l-2.116 12H15z"}}]}]})(e)}function cs(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M17 17h5v2h-3v3h-2v-5zM7 7H2V5h3V2h2v5zm11.364 8.536L16.95 14.12l1.414-1.414a5 5 0 1 0-7.071-7.071L9.879 7.05 8.464 5.636 9.88 4.222a7 7 0 0 1 9.9 9.9l-1.415 1.414zm-2.828 2.828l-1.415 1.414a7 7 0 0 1-9.9-9.9l1.415-1.414L7.05 9.88l-1.414 1.414a5 5 0 1 0 7.071 7.071l1.414-1.414 1.415 1.414zm-.708-10.607l1.415 1.415-7.071 7.07-1.415-1.414 7.071-7.07z"}}]}]})(e)}function fi(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M18.364 15.536L16.95 14.12l1.414-1.414a5 5 0 1 0-7.071-7.071L9.879 7.05 8.464 5.636 9.88 4.222a7 7 0 0 1 9.9 9.9l-1.415 1.414zm-2.828 2.828l-1.415 1.414a7 7 0 0 1-9.9-9.9l1.415-1.414L7.05 9.88l-1.414 1.414a5 5 0 1 0 7.071 7.071l1.414-1.414 1.415 1.414zm-.708-10.607l1.415 1.415-7.071 7.07-1.415-1.414 7.071-7.07z"}}]}]})(e)}function Kn(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M8 4h13v2H8V4zM5 3v3h1v1H3V6h1V4H3V3h2zM3 14v-2.5h2V11H3v-1h3v2.5H4v.5h2v1H3zm2 5.5H3v-1h2V18H3v-1h3v4H3v-1h2v-.5zM8 11h13v2H8v-2zm0 7h13v2H8v-2z"}}]}]})(e)}function Xn(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M8 4h13v2H8V4zM4.5 6.5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm0 7a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm0 6.9a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zM8 11h13v2H8v-2zm0 7h13v2H8v-2z"}}]}]})(e)}function us(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M17.154 14c.23.516.346 1.09.346 1.72 0 1.342-.524 2.392-1.571 3.147C14.88 19.622 13.433 20 11.586 20c-1.64 0-3.263-.381-4.87-1.144V16.6c1.52.877 3.075 1.316 4.666 1.316 2.551 0 3.83-.732 3.839-2.197a2.21 2.21 0 0 0-.648-1.603l-.12-.117H3v-2h18v2h-3.846zm-4.078-3H7.629a4.086 4.086 0 0 1-.481-.522C6.716 9.92 6.5 9.246 6.5 8.452c0-1.236.466-2.287 1.397-3.153C8.83 4.433 10.271 4 12.222 4c1.471 0 2.879.328 4.222.984v2.152c-1.2-.687-2.515-1.03-3.946-1.03-2.48 0-3.719.782-3.719 2.346 0 .42.218.786.654 1.099.436.313.974.562 1.613.75.62.18 1.297.414 2.03.699z"}}]}]})(e)}function gn(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M13 6v15h-2V6H5V4h14v2z"}}]}]})(e)}function ds(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M8 3v9a4 4 0 1 0 8 0V3h2v9a6 6 0 1 1-12 0V3h2zM4 20h16v2H4v-2z"}}]}]})(e)}function fs(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M10 6v2H5v11h11v-5h2v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h6zm11-3v9l-3.794-3.793-5.999 6-1.414-1.414 5.999-6L12 3h9z"}}]}]})(e)}const pi={tooltip:"_tooltip_mmzq3_1",secondaryText:"_secondaryText_mmzq3_12"},hi=e=>v.exports.jsxs("div",{className:pi.tooltip,children:[v.exports.jsx("div",{children:e.mainTooltip}),e.secondaryTooltip&&v.exports.jsx("div",{className:pi.secondaryText,children:e.secondaryTooltip})]}),je=ae.forwardRef((e,t)=>{const n=e.icon;return v.exports.jsx(Ht.default,{content:v.exports.jsx(hi,{mainTooltip:e.mainTooltip,secondaryTooltip:e.secondaryTooltip}),trigger:"mouseenter",children:e.children?v.exports.jsxs(L.Button,{onClick:e.onClick,color:"brandFinal",size:"xs",variant:e.isSelected?"filled":"subtle",disabled:e.isDisabled||!1,ref:t,children:[n&&v.exports.jsx(n,{}),e.children]}):v.exports.jsx(L.ActionIcon,{onClick:e.onClick,color:"brandFinal",size:30,variant:e.isSelected?"filled":"subtle",disabled:e.isDisabled||!1,ref:t,children:n&&v.exports.jsx(n,{})})})});function ps(e){return ee({tag:"svg",attr:{viewBox:"0 0 20 20",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",clipRule:"evenodd"}}]})(e)}const hs=ae.forwardRef((e,t)=>{const{text:n,icon:r,isDisabled:i,...o}=e,s=e.icon;return v.exports.jsx(L.Button,{leftIcon:s&&v.exports.jsx(s,{size:16}),rightIcon:v.exports.jsx(ps,{}),size:"xs",variant:"subtle",disabled:e.isDisabled,ref:t,...o,children:e.text})});function vs(e){return ee({tag:"svg",attr:{version:"1.2",baseProfile:"tiny",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M16.972 6.251c-.967-.538-2.185-.188-2.72.777l-3.713 6.682-2.125-2.125c-.781-.781-2.047-.781-2.828 0-.781.781-.781 2.047 0 2.828l4 4c.378.379.888.587 1.414.587l.277-.02c.621-.087 1.166-.46 1.471-1.009l5-9c.537-.966.189-2.183-.776-2.72z"}}]})(e)}function ms(e){const t=e.icon;return v.exports.jsx(L.Menu.Item,{onClick:e.onClick,icon:t&&v.exports.jsx(t,{size:16}),rightSection:e.isSelected?v.exports.jsx(vs,{size:16}):v.exports.jsx("div",{style:{width:"16px",padding:"0"}}),disabled:e.isDisabled,children:e.text},e.text)}function gs(e){return v.exports.jsxs(L.Menu,{exitTransitionDuration:0,children:[v.exports.jsx(L.Menu.Target,{children:v.exports.jsx(hs,{...e})}),v.exports.jsx(L.Menu.Dropdown,{children:e.items.map(t=>v.exports.jsx(ms,{...t},t.text))})]})}const vi=e=>{const{classes:t}=L.createStyles({root:{}})(void 0,{name:"Toolbar"});return v.exports.jsx(L.Group,{className:t.root,children:e.children})};function ys(){const[,e]=ae.useState(0);return()=>e(t=>t+1)}const bs=e=>{const t=ys();ae.useEffect(()=>{const n=()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})};return e.on("transaction",n),()=>{e.off("transaction",n)}},[e])},xs=()=>/Mac/.test(navigator.platform)||/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent);function ge(e){return xs()?e.replace("Mod","\u2318"):e.replace("Mod","Ctrl")}function ws(e){const t=e.icon;return v.exports.jsx(Ht.default,{content:v.exports.jsx(hi,{mainTooltip:e.mainTooltip,secondaryTooltip:e.secondaryTooltip}),placement:"left",children:v.exports.jsx(L.Container,{children:v.exports.jsx(t,{size:16})})})}function Es(e){const t=ae.useRef(null);ae.useEffect(()=>{setTimeout(()=>{var r;e.autofocus&&((r=t.current)==null||r.focus())})},[e.autofocus]);function n(r){r.key==="Enter"&&(r.preventDefault(),e.onSubmit())}return v.exports.jsx(L.TextInput,{size:"xs",value:e.value,onChange:r=>e.onChange(r.currentTarget.value),onKeyDown:n,placeholder:e.placeholder,ref:t})}function mi(e){return v.exports.jsxs(L.Group,{children:[v.exports.jsx(ws,{icon:e.icon,mainTooltip:e.mainIconTooltip,secondaryTooltip:e.secondaryIconTooltip}),v.exports.jsx(Es,{autofocus:e.autofocus,placeholder:e.placeholder,value:e.value,onChange:e.onChange,onSubmit:e.onSubmit})]})}const gi=e=>{const[t,n]=ae.useState(e.url),[r,i]=ae.useState(e.text),{classes:o}=L.createStyles({root:{}})(void 0,{name:"EditHyperlinkMenu"});return v.exports.jsxs(L.Stack,{className:o.root,children:[v.exports.jsx(mi,{icon:fi,mainIconTooltip:"Edit URL",autofocus:!0,placeholder:"Edit URL",value:t,onChange:s=>n(s),onSubmit:()=>e.update(t,r)}),v.exports.jsx(mi,{icon:gn,mainIconTooltip:"Edit Title",placeholder:"Edit Title",value:r,onChange:s=>i(s),onSubmit:()=>e.update(t,r)})]})},ks=e=>{const[t,n]=ae.useState(),r=ae.useCallback(()=>{const i=(d,u)=>{if(d==="")return;const p=e.editor.schema.mark("link",{href:d});let{from:m,to:y}=e.editor.state.selection;e.editor.view.dispatch(e.editor.view.state.tr.insertText(u,m,y).addMark(m,m+u.length,p))},{from:o,to:s}=e.editor.state.selection,a=e.editor.state.doc.textBetween(o,s),l=e.editor.isActive("link")&&e.editor.getAttributes("link").href||"";n(v.exports.jsx(gi,{url:l,text:a,update:i},Math.random()+""))},[e.editor]);return v.exports.jsx(Ht.default,{content:t,trigger:"click",onShow:i=>{r()},interactive:!0,maxWidth:500,children:v.exports.jsx(je,{...e})})};function Ts(e,t){const n=["Heading 1","Heading 2","Heading 3"],r={li:"Bullet List",oli:"Numbered List"};return e?n[e-1]:t?r[t]:"Text"}const Os=e=>{bs(e.editor);const t=ft(e.editor.state.selection),n=t==null?void 0:t.node.attrs.headingType,r=t==null?void 0:t.node.attrs.listType,i=Ts(n,r),o={Text:gn,"Heading 1":Jn,"Heading 2":Yn,"Heading 3":Gn,"Bullet List":Xn,"Numbered List":Kn};return v.exports.jsxs(vi,{children:[v.exports.jsx(gs,{text:i,icon:o[i],items:[{onClick:()=>{e.editor.view.focus(),e.editor.chain().unsetBlockHeading().unsetList().run()},text:"Text",icon:gn,isSelected:i==="Text"},{onClick:()=>{e.editor.view.focus(),e.editor.chain().unsetList().setBlockHeading({level:"1"}).run()},text:"Heading 1",icon:Jn,isSelected:i==="Heading 1"},{onClick:()=>{e.editor.view.focus(),e.editor.chain().unsetList().setBlockHeading({level:"2"}).run()},text:"Heading 2",icon:Yn,isSelected:i==="Heading 2"},{onClick:()=>{e.editor.view.focus(),e.editor.chain().unsetList().setBlockHeading({level:"3"}).run()},text:"Heading 3",icon:Gn,isSelected:i==="Heading 3"},{onClick:()=>{e.editor.view.focus(),e.editor.chain().unsetBlockHeading().setBlockList("li").run()},text:"Bullet List",icon:Xn,isSelected:i==="Bullet List"},{onClick:()=>{e.editor.view.focus(),e.editor.chain().unsetBlockHeading().setBlockList("oli").run()},text:"Numbered List",icon:Kn,isSelected:i==="Numbered List"}]}),v.exports.jsx(je,{onClick:()=>{e.editor.view.focus(),e.editor.commands.toggleBold()},isSelected:e.editor.isActive("bold"),mainTooltip:"Bold",secondaryTooltip:ge("Mod+B"),icon:os}),v.exports.jsx(je,{onClick:()=>{e.editor.view.focus(),e.editor.commands.toggleItalic()},isSelected:e.editor.isActive("italic"),mainTooltip:"Italic",secondaryTooltip:ge("Mod+I"),icon:ls}),v.exports.jsx(je,{onClick:()=>{e.editor.view.focus(),e.editor.commands.toggleUnderline()},isSelected:e.editor.isActive("underline"),mainTooltip:"Underline",secondaryTooltip:ge("Mod+U"),icon:ds}),v.exports.jsx(je,{onClick:()=>{e.editor.view.focus(),e.editor.commands.toggleStrike()},isSelected:e.editor.isActive("strike"),mainTooltip:"Strike-through",secondaryTooltip:ge("Mod+Shift+X"),icon:us}),v.exports.jsx(je,{onClick:()=>{e.editor.view.focus(),e.editor.commands.sinkListItem("block")},isDisabled:!e.editor.can().sinkListItem("block"),mainTooltip:"Indent",secondaryTooltip:ge("Tab"),icon:ss}),v.exports.jsx(je,{onClick:()=>{e.editor.view.focus(),e.editor.commands.liftListItem("block")},isDisabled:!e.editor.can().command(({state:s})=>{const a=ft(s.selection);return a?a.depth>2:!1}),mainTooltip:"Decrease Indent",secondaryTooltip:ge("Shift+Tab"),icon:as}),v.exports.jsx(ks,{isSelected:e.editor.isActive("link"),mainTooltip:"Link",secondaryTooltip:ge("Mod+K"),icon:fi,editor:e.editor})]})},Ss=A.Extension.create({name:"BubbleMenuExtension",addProseMirrorPlugins(){const e=document.createElement("div");return e.className=Rn.bnRoot,Ke.default.render(v.exports.jsx(L.MantineProvider,{theme:cn,children:v.exports.jsx(Os,{editor:this.editor})}),e),[ns({editor:this.editor,element:e,pluginKey:new V.PluginKey("BubbleMenuPlugin"),tippyOptions:{appendTo:document.body}})]}});function Cs(e){return ee({tag:"svg",attr:{t:"1551322312294",style:"",viewBox:"0 0 1024 1024",version:"1.1"},child:[{tag:"defs",attr:{},child:[]},{tag:"path",attr:{d:"M474 152m8 0l60 0q8 0 8 8l0 704q0 8-8 8l-60 0q-8 0-8-8l0-704q0-8 8-8Z"}},{tag:"path",attr:{d:"M168 474m8 0l672 0q8 0 8 8l0 60q0 8-8 8l-672 0q-8 0-8-8l0-60q0-8 8-8Z"}}]})(e)}const As=5;function Rs(e){const t=ae.useRef(null),{classes:n}=L.createStyles({root:{}})(void 0,{name:"SuggestionListItem"});function r(){var l;const s=e.selectedIndex!==void 0&&e.selectedIndex===e.index,a=(l=t.current)==null?void 0:l.matches(":hover");return s||a}function i(){var s,a;r()?(s=t.current)==null||s.setAttribute("data-hovered","true"):(a=t.current)==null||a.removeAttribute("data-hovered")}ae.useEffect(()=>{i(),r()&&t.current&&t.current.getBoundingClientRect().left>As&&t.current.scrollIntoView({behavior:"smooth",block:"nearest"})});const o=e.item.icon;return v.exports.jsx(L.Menu.Item,{className:n.root,icon:o&&v.exports.jsx(o,{size:18}),onClick:()=>e.clickItem(e.item),onMouseLeave:()=>{setTimeout(()=>{i()})},ref:t,rightSection:e.item.shortcut&&v.exports.jsx(L.Badge,{size:"xs",children:e.item.shortcut}),children:v.exports.jsxs(L.Stack,{children:[v.exports.jsx(L.Text,{size:14,weight:500,children:e.item.name}),v.exports.jsx(L.Text,{size:10,children:e.item.hint})]})})}function Is(e){return v.exports.jsxs(v.exports.Fragment,{children:[v.exports.jsx(L.Menu.Label,{children:e.name}),e.items.map((t,n)=>v.exports.jsx(Rs,{item:t,index:n,selectedIndex:e.selectedIndex,clickItem:e.clickItem},n))]})}function Ds(e){const{classes:t}=L.createStyles({root:{}})(void 0,{name:"SuggestionList"}),n=[];let r=0;for(const i in e.groups){const o=e.groups[i];n.push(v.exports.jsx(Is,{name:i,items:o,selectedIndex:e.selectedIndex>=r?e.selectedIndex-r:void 0,clickItem:e.onSelectItem},i)),r+=o.length}return v.exports.jsx(L.Menu,{defaultOpened:!0,trigger:"hover",closeDelay:1e7,children:v.exports.jsx(L.Menu.Dropdown,{className:t.root,children:n.length>0?n:v.exports.jsx(L.Menu.Item,{children:"No match found"})})})}function Ns(e){let t,n,r=!0,i=0,o;const s=a=>{if(!o)throw new Error("props not set");let l=0;for(const d in o.groups){const u=o.groups[d],p=u.length;if(a<l+p)return u[a-l];l+=p}throw Error("item not found")};return{getComponent:()=>{if(!(!n||!n[0]))return n[0].reference},onStart:a=>{o=a,r=!1,i=0;const l={groups:a.groups,count:a.count,onSelectItem:a.onSelectItem,selectedIndex:i};t=new bn.ReactRenderer(d=>v.exports.jsx(L.MantineProvider,{theme:cn,children:v.exports.jsx(Ds,{...d})}),{editor:e,props:l}),n=At("body",{getReferenceClientRect:a.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"})},onUpdate:a=>{o=a,o.groups!==t.props.groups&&(i=0);const l={groups:o.groups,count:o.count,onSelectItem:o.onSelectItem,selectedIndex:i};t.updateProps(l),n[0].setProps({getReferenceClientRect:o.clientRect})},onKeyDown:a=>{if(!o)return!1;if(a.key==="ArrowUp")return i=(i+o.count-1)%o.count,t.updateProps({selectedIndex:i}),!0;if(a.key==="ArrowDown")return i=(i+1)%o.count,t.updateProps({selectedIndex:i}),!0;if(a.key==="Enter"){const l=s(i);return o.onSelectItem(l),!0}return a.key==="Escape"?(o.onClose(),!0):!1},onExit:a=>{if(r)return;r=!0;const l=n[0],d=t;l.hide(),setTimeout(()=>{l.destroy(),d.destroy()},1e3)}}}function Ms(e,t){if(!t.empty)return;const n=t.$anchor.nodeBefore;if(!n||!n.text)return;const r=new RegExp(`${yn.escapeRegExp(e)}([^${yn.escapeRegExp(e)}]*)$`),i=n.text.match(r);if(!!i)return{query:i[1],range:{from:t.$anchor.pos-i[1].length-e.length,to:t.$anchor.pos}}}function Ps({pluginKey:e,editor:t,char:n,onSelectItem:r=()=>{},items:i=()=>[]}){if(n.length!==1)throw new Error("'char' should be a single character");const o=Ns(t);return new V.Plugin({key:e,filterTransaction(s){const a=s.getMeta("blur");if(a!=null&&a.event.relatedTarget){const l=o.getComponent();if(l!=null&&l.contains(a.event.relatedTarget))return!1}return!0},view(){return{update:async(s,a)=>{var N,T,f,I,w;const l=(N=this.key)==null?void 0:N.getState(a),d=(T=this.key)==null?void 0:T.getState(s.state),u=!l.active&&d.active,p=l.active&&!d.active,m=!u&&!p&&l.query!==d.query;if(!u&&!m&&!p)return;const y=p?l:d,x=document.querySelector(`[data-decoration-id="${y.decorationId}"]`),b=yn.groupBy(y.items,"groupName"),O=()=>{s.dispatch(s.state.tr.setMeta(e,{deactivate:!0}))},C={groups:m||u?b:{},count:y.items.length,onSelectItem:M=>{O(),r({item:M,editor:t,range:y.range})},clientRect:x?()=>x.getBoundingClientRect():null,onClose:()=>{var M;O(),(M=o.onExit)==null||M.call(o,C)}};p&&((f=o.onExit)==null||f.call(o,C)),m&&((I=o.onUpdate)==null||I.call(o,C)),u&&((w=o.onStart)==null||w.call(o,C))}}},state:{init(){return{active:!1,range:{},query:null,notFoundCount:0,items:[],type:"slash",decorationId:null}},apply(s,a,l,d){var m,y,x;const{selection:u}=s,p={...a};if(u.from===u.to&&!((m=s.getMeta(e))!=null&&m.deactivate)&&!s.getMeta("focus")&&!s.getMeta("blur")&&!s.getMeta("pointer")){if(a.active&&u.from<=a.range.from)p.active=!1;else if((y=s.getMeta(e))!=null&&y.activate){const b=`id_${Math.floor(Math.random()*4294967295)}`;p.decorationId=b,p.range={from:u.from-1,to:u.to},p.query="",p.active=!0,p.type=(x=s.getMeta(e))==null?void 0:x.type}else if(a.active){const b=Ms(a.type==="slash"?n:"",u);if(!b)throw new Error("active but no match (suggestions)");p.range=b.range,p.active=!0,p.decorationId=a.decorationId,p.query=b.query}}else p.active=!1;return p.active&&(p.items=i(p.query),p.items.length?p.notFoundCount=0:p.range.to>a.range.to?p.notFoundCount=a.notFoundCount+1:p.notFoundCount=a.notFoundCount,p.notFoundCount>3&&(p.active=!1)),p.active||(p.decorationId=null,p.range={},p.query=null,p.notFoundCount=0,p.items=[]),p}},props:{handleKeyDown(s,a){var d;const{active:l}=this.getState(s.state);return l?((d=o.onKeyDown)==null?void 0:d.call(o,a))||!1:a.key===n?(s.dispatch(s.state.tr.insertText(n).scrollIntoView().setMeta(e,{activate:!0,type:"slash"})),!0):!1},decorations(s){const{active:a,range:l,decorationId:d,type:u}=this.getState(s);if(!a)return null;if(u==="drag"){const p=ft(s.selection);if(p)return Ve.DecorationSet.create(s.doc,[Ve.Decoration.node(p.pos,p.pos+p.node.nodeSize,{nodeName:"span",class:"suggestion-decorator","data-decoration-id":d})])}return Ve.DecorationSet.create(s.doc,[Ve.Decoration.inline(l.from,l.to,{nodeName:"span",class:"suggestion-decorator","data-decoration-id":d})])}}})}var yt=(e=>(e.HEADINGS="Headings",e.BASIC_BLOCKS="Basic Blocks",e.CODE="Code Blocks",e.INLINE="Inline",e.EMBED="Embed",e.PLUGIN="Plugin",e))(yt||{});class Rt{constructor(t,n,r,i=[],o,s,a){oe(this,"groupName");this.name=t,this.group=n,this.execute=r,this.aliases=i,this.icon=o,this.hint=s,this.shortcut=a,this.groupName=n}match(t){return this.name.toLowerCase().startsWith(t.toLowerCase())||this.aliases.filter(n=>n.toLowerCase().startsWith(t.toLowerCase())).length!==0}}const js={heading:new Rt("Heading",yt.HEADINGS,(e,t)=>e.chain().focus().deleteRange(t).addNewBlockAsSibling({headingType:"1"}).run(),["h","heading1","h1"],Jn,"Used for a top-level heading",ge("Mod-Alt-1")),heading2:new Rt("Heading 2",yt.HEADINGS,(e,t)=>e.chain().focus().deleteRange(t).addNewBlockAsSibling({headingType:"2"}).run(),["h2","heading2","subheading"],Yn,"Used for key sections",ge("Mod-Alt-2")),heading3:new Rt("Heading 3",yt.HEADINGS,(e,t)=>e.chain().focus().deleteRange(t).addNewBlockAsSibling({headingType:"3"}).run(),["h3","heading3","subheading"],Gn,"Used for subsections and group headings",ge("Mod-Alt-3")),numberedList:new Rt("Numbered List",yt.BASIC_BLOCKS,(e,t)=>e.chain().focus().deleteRange(t).addNewBlockAsSibling({listType:"oli"}).run(),["li","list","numberedlist","numbered list"],Kn,"Used to display a numbered list",ge("Mod-Shift-7")),bulletlist:new Rt("Bullet List",yt.BASIC_BLOCKS,(e,t)=>e.chain().focus().deleteRange(t).addNewBlockAsSibling({listType:"li"}).run(),["ul","list","bulletlist","bullet list"],Xn,"Used to display an unordered list",ge("Mod-Shift-8")),paragraph:new Rt("Paragraph",yt.BASIC_BLOCKS,(e,t)=>e.chain().focus().deleteRange(t).addNewBlockAsSibling().run(),["p"],gn,"Used for the body of your document",ge("Mod-Alt-0"))},Zn=new V.PluginKey("suggestions-slash-commands"),Ls=A.Extension.create({name:"slash-command",addOptions(){return{commands:js}},addProseMirrorPlugins(){return[Ps({pluginKey:Zn,editor:this.editor,char:"/",items:e=>{const t=[];for(const n in this.options.commands)t.push(this.options.commands[n]);return t.filter(n=>n.match(e))},onSelectItem:({item:e,editor:t,range:n})=>{e.execute(t,n)}})]}});function Bs(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}}]})(e)}const _s=e=>{const{classes:t}=L.createStyles({root:{}})(void 0,{name:"DragHandleMenu"});return v.exports.jsx(L.Menu.Dropdown,{className:t.root,children:v.exports.jsx(L.Menu.Item,{onClick:e.onDelete,children:"Delete"})})},Hs=e=>{const[t,n]=ae.useState(!1),[r,i]=ae.useState(!1),o=()=>{const a=e.view.posAtCoords(e.coords);if(!a)return;const l=ft(V.TextSelection.create(e.view.state.doc,a.pos));l&&(e.view.dispatch&&e.view.dispatch(e.view.state.tr.deleteRange(l.pos,l.pos+l.node.nodeSize)),i(!0))},s=()=>{var d;n(!0),e.onAddClicked&&e.onAddClicked();const a=e.view.posAtCoords(e.coords);if(!a)return;const l=ft(V.TextSelection.create(e.view.state.doc,a.pos));if(!!l){if(((d=l.node.firstChild)==null?void 0:d.textContent.length)!==0){const u=l.pos+l.node.nodeSize;let p=e.view.state.schema.nodes.content.createAndFill();e.view.state.tr.insert(u,p),e.view.dispatch(e.view.state.tr.insert(u,p)),e.view.dispatch(e.view.state.tr.setSelection(new V.TextSelection(e.view.state.tr.doc.resolve(u+1))))}e.view.focus(),e.view.dispatch(e.view.state.tr.scrollIntoView().setMeta(Zn,{activate:!0,type:"drag"}))}};return r||t?null:v.exports.jsxs("div",{style:{display:"flex",flexDirection:"row"},children:[v.exports.jsx(L.ActionIcon,{size:24,color:"brandFinal.3","data-test":"dragHandleAdd",children:v.exports.jsx(Cs,{size:24,onClick:s})}),v.exports.jsxs(L.Menu,{onOpen:e.onShow,onClose:e.onHide,position:"left",children:[v.exports.jsx(L.Menu.Target,{children:v.exports.jsx(L.ActionIcon,{size:24,color:"brandFinal.3","data-test":"dragHandle",children:v.exports.jsx(Bs,{size:24})})}),v.exports.jsx(_s,{onDelete:o})]})]})};class tn extends V.Selection{constructor(n,r){super(n,r);oe(this,"nodes");const i=n.node();this.nodes=[],n.doc.nodesBetween(n.pos,r.pos,(o,s,a)=>{if(a!==null&&a.eq(i))return this.nodes.push(o),!1})}static create(n,r,i=r){return new tn(n.resolve(r),n.resolve(i))}content(){return new D.Slice(D.Fragment.from(this.nodes),0,0)}eq(n){if(!(n instanceof tn)||this.nodes.length!==n.nodes.length||this.from!==n.from||this.to!==n.to)return!1;for(let r=0;r<this.nodes.length;r++)if(!this.nodes[r].eq(n.nodes[r]))return!1;return!0}map(n,r){let i=r.mapResult(this.from),o=r.mapResult(this.to);return o.deleted?V.Selection.near(n.resolve(i.pos)):i.deleted?V.Selection.near(n.resolve(o.pos)):new tn(n.resolve(i.pos),n.resolve(o.pos))}toJSON(){return{type:"node",anchor:this.anchor,head:this.head}}}const Fs=Gi.__serializeForClipboard;let Qn,It;function zs(){if(!Qn){const e=document.querySelector(".ProseMirror > [class*='blockGroup']");e&&(Qn=yi(e).left)}return Qn}function Vs(e){let t={left:e.left+document.body.scrollLeft,top:e.top+document.body.scrollTop,width:e.width,height:e.height,bottom:0,right:0};return t.bottom=t.top+t.height,t.right=t.left+t.width,t}function yi(e){return Vs(e.getBoundingClientRect())}function bi(e,t){var i;let n=t.posAtCoords(e);if(!n)return;let r=t.domAtPos(n.pos).node;if(r!==t.dom){for(;r&&r.parentNode&&r.parentNode!==t.dom&&!((i=r.hasAttribute)!=null&&i.call(r,"data-id"));)r=r.parentNode;if(!!r)return{node:r,id:r.getAttribute("data-id")}}}function qs(e,t){let n=bi(e,t);if(n&&n.node.nodeType===1){const r=t.docView;let i=r.nearestDesc(n.node,!0);return!i||i===r?null:i.posBefore}return null}function Us(e,t){let n,r;const i=t.resolve(e.from).node().type.name==="content",o=t.resolve(e.to).node().type.name==="content",s=Math.min(e.$anchor.depth,e.$head.depth);if(i&&o){const a=e.$from.start(s-1),l=e.$to.end(s-1);n=t.resolve(a-1).pos,r=t.resolve(l+1).pos}else n=e.from,r=e.to;return{from:n,to:r}}function xi(e,t,n=t){t===n&&(n+=e.state.doc.resolve(t+1).node().nodeSize);const r=e.domAtPos(t).node.cloneNode(!0),i=e.domAtPos(t).node,o=(l,d)=>Array.prototype.indexOf.call(l.children,d),s=o(i,e.domAtPos(t+1).node.parentElement),a=o(i,e.domAtPos(n-1).node.parentElement);for(let l=i.childElementCount-1;l>=0;l--)(l>a||l<s)&&r.removeChild(r.children[l]);It=r,document.body.appendChild(It)}function Ws(){It!==void 0&&(document.body.removeChild(It),It=void 0)}function $s(e,t){if(!e.dataTransfer)return;let n={left:t.dom.clientWidth/2,top:e.clientY},r=qs(n,t);if(r!=null){const i=t.state.selection,o=t.state.doc,{from:s,to:a}=Us(i,o),l=s<=r&&r<a,d=!i.$anchor.node().eq(i.$head.node());l&&d?(t.dispatch(t.state.tr.setSelection(tn.create(o,s,a))),xi(t,s,a)):(t.dispatch(t.state.tr.setSelection(V.NodeSelection.create(t.state.doc,r))),xi(t,r));let u=t.state.selection.content(),{dom:p,text:m}=Fs(t,u);e.dataTransfer.clearData(),e.dataTransfer.setData("text/html",p.innerHTML),e.dataTransfer.setData("text/plain",m),e.dataTransfer.effectAllowed="move",e.dataTransfer.setDragImage(It,0,0),t.dragging={slice:u,move:!0}}}const Js=()=>{let e,n=!1,r=!1;const i=()=>{n=!0},o=()=>{n=!1},s=()=>{r=!0};return new V.Plugin({key:new V.PluginKey("DraggableBlocksPlugin"),view(a){return e=document.createElement("div"),e.setAttribute("draggable","true"),e.style.position="absolute",e.style.height="24px",document.body.append(e),e.addEventListener("dragstart",l=>$s(l,a)),e.addEventListener("dragend",()=>Ws()),{destroy(){if(!e)throw new Error("unexpected");e.parentNode.removeChild(e),e=void 0}}},props:{handleKeyDown(a,l){if(!e)throw new Error("unexpected");return n=!1,r=!1,Ke.default.render(v.exports.jsx(v.exports.Fragment,{}),e),!1},handleDOMEvents:{mouseleave(a,l){if(!e)throw new Error("unexpected");return!0},mousedown(a,l){if(!e)throw new Error("unexpected");return n=!1,r=!1,Ke.default.render(v.exports.jsx(v.exports.Fragment,{}),e),!1},mousemove(a,l){if(!e)throw new Error("unexpected");if(n||r)return!0;const d={left:a.dom.clientWidth/2,top:l.clientY},u=bi(d,a);if(!u)return console.warn("Perhaps we should hide element?"),!0;const p=u.node.firstChild;if(!p)return!0;const m=yi(p),y=u.node.ownerDocument.defaultView,x=e.getBoundingClientRect(),b=zs()-48+y.pageXOffset;return m.top+=m.height/2-x.height/2+y.pageYOffset,e.style.left=b+"px",e.style.top=m.top+"px",Ke.default.render(v.exports.jsx(L.MantineProvider,{theme:cn,children:v.exports.jsx(Hs,{onShow:i,onHide:o,onAddClicked:s,view:a,coords:d},u.id+"")}),e),!0}}}})},Ys=A.Extension.create({name:"DraggableBlocksExtension",priority:1e3,addProseMirrorPlugins(){return[Js()]}}),Gs=e=>v.exports.jsxs(vi,{children:[v.exports.jsx(je,{mainTooltip:"Edit",isSelected:!1,onClick:e.edit,children:"Edit Link"}),v.exports.jsx(je,{mainTooltip:"Open in new tab",isSelected:!1,onClick:()=>{window.open(e.url,"_blank")},icon:fs}),v.exports.jsx(je,{mainTooltip:"Remove link",isSelected:!1,onClick:e.remove,icon:cs})]}),Ks=e=>{const[t,n]=ae.useState(!1),r=v.exports.jsx(Ht.default,{getReferenceClientRect:()=>e.pos,content:v.exports.jsx(gi,{url:e.url,text:e.text,update:e.update}),interactive:!0,interactiveBorder:30,showOnCreate:!0,trigger:"click",hideOnClick:!0,className:Rn.bnRoot,appendTo:document.body,children:v.exports.jsx("div",{})}),i=v.exports.jsx(Gs,{url:e.url,edit:()=>n(!0),remove:e.remove});return t?r:i},wi=new V.PluginKey("HyperlinkMenuPlugin"),Xs=()=>{const e=document.createElement("div");let t,n="hidden",r=0;return new V.Plugin({key:wi,view(){return{update:async(i,o)=>{const s=i.state.selection;if(s.from!==s.to){n!=="hidden"&&(n="hidden",Ke.default.render(v.exports.jsx(v.exports.Fragment,{}),e));return}let a,l,d,u=!1;if(t){a=i.posAtDOM(t.firstChild,0),l=i.state.doc.resolve(a);const T=l.parent.childAfter(l.parentOffset).node;d=T==null?void 0:T.marks.find(f=>f.type.name.startsWith("link"))}if(!d&&(i.hasFocus()||n==="cursor-based")){a=s.from,l=i.state.doc.resolve(a);const T=l.parent.childAfter(l.parentOffset).node;d=T==null?void 0:T.marks.find(f=>f.type.name.startsWith("link")),u=!0}if(!d||!a||!l){n==="cursor-based"&&(n="hidden",Ke.default.render(v.exports.jsx(v.exports.Fragment,{}),e));return}const p=A.getMarkRange(l,d.type,d.attrs);if(!p)return;const m=i.state.doc.textBetween(p.from,p.to),y=d.attrs.href,x={...i.coordsAtPos(Math.round((p.from+p.to)/2)),height:0,width:0},b=d,O=(T,f)=>{n="hidden",Ke.default.render(v.exports.jsx(v.exports.Fragment,{}),e),b.attrs={...b.attrs,href:T};const I=i.state.tr.insertText(f,p.from,p.to);I.addMark(p.from,p.from+f.length,b),i.dispatch(I)},C=()=>{i.dispatch(i.state.tr.removeMark(p.from,p.to,b.type).setMeta("preventAutolink",!0))},N=v.exports.jsx(L.MantineProvider,{theme:cn,children:v.exports.jsx(Ht.default,{getReferenceClientRect:()=>x,content:v.exports.jsx(Ks,{update:O,pos:x,remove:C,text:m,url:y}),onHide:()=>{r++,n="hidden"},aria:{expanded:!1},interactive:!0,interactiveBorder:30,triggerTarget:t,showOnCreate:u,appendTo:document.body,children:v.exports.jsx("div",{})},r+"")});Ke.default.render(N,e),n=u?"cursor-based":"mouse-based"}}},props:{handleDOMEvents:{mouseover(i,o){const s=o.target instanceof HTMLAnchorElement&&o.target.nodeName==="A"?o.target:void 0;return s!==t&&(t=s,i.dispatch(i.state.tr.setMeta(wi,{hoveredLinkChanged:!0}))),!1}}}})},Zs=Li.Link.extend({priority:500,addProseMirrorPlugins(){var e;return[...((e=this.parent)==null?void 0:e.call(this))||[],Xs()]}}),Qs=Ki.default.extend({addKeyboardShortcuts:()=>({"Mod-Alt-0":()=>!1})}),el=A.Extension.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",isFilterClass:"is-filter",hasAnchorClass:"has-anchor",placeholder:"Write something \u2026",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new V.Plugin({props:{decorations:e=>{const{doc:t,selection:n}=e,r=Zn.getState(e),i=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:o}=n,s=[];if(!!i)return t.descendants((a,l)=>{const d=o>=l&&o<=l+a.nodeSize,u=!a.isLeaf&&!a.childCount;if((d||!this.options.showOnlyCurrent)&&u){const p=[this.options.emptyNodeClass];this.editor.isEmpty&&p.push(this.options.emptyEditorClass),d&&p.push(this.options.hasAnchorClass),r.type==="drag"&&r.active&&p.push(this.options.isFilterClass);const m=Ve.Decoration.node(l,l+a.nodeSize,{class:p.join(" ")});s.push(m)}return this.options.includeChildren}),Ve.DecorationSet.create(t,s)}}})]}}),tl=A.Extension.create({name:"trailingNode",addProseMirrorPlugins(){const e=new V.PluginKey(this.name);return[new V.Plugin({key:e,appendTransaction:(t,n,r)=>{const{doc:i,tr:o,schema:s}=r,a=e.getState(r),l=i.content.size-2,d=s.nodes.block,u=s.nodes.content;if(!!a)return o.insert(l,d.create(void 0,u.create()))},state:{init:(t,n)=>{},apply:(t,n)=>{if(!t.docChanged)return n;let r=t.doc.lastChild;if(!r||r.type.name!=="blockgroup")throw new Error("Expected blockgroup");if(r=r.lastChild,!r||r.type.name!=="block")throw new Error("Expected block");return r.nodeSize>4}}})]}});function nl(e,t=JSON.stringify){const n={};return e.filter(r=>{const i=t(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function rl(e){const t=e.filter((r,i)=>e.indexOf(r)!==i);return nl(t)}const il=A.Extension.create({name:"uniqueID",priority:1e4,addOptions(){return{attributeName:"id",types:[],generateID:()=>_i.v4(),filterTransaction:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{[this.options.attributeName]:{default:null}}}]},onCreate(){if(this.editor.extensionManager.extensions.find(l=>l.name==="collaboration"))return;const{view:e,state:t}=this.editor,{tr:n,doc:r}=t,{types:i,attributeName:o,generateID:s}=this.options;A.findChildren(r,l=>i.includes(l.type.name)&&l.attrs[o]===null).forEach(({node:l,pos:d})=>{n.setNodeMarkup(d,void 0,{...l.attrs,[o]:s()})}),n.setMeta("addToHistory",!1),e.dispatch(n)},addProseMirrorPlugins(){let e=null,t=!1;return[new V.Plugin({key:new V.PluginKey("uniqueID"),appendTransaction:(n,r,i)=>{console.log("appendTransaction");const o=n.some(x=>x.docChanged)&&!r.doc.eq(i.doc),s=this.options.filterTransaction&&n.some(x=>{var b,O;return!(!((O=(b=this.options).filterTransaction)===null||O===void 0)&&O.call(b,x))});if(!o||s)return;const{tr:a}=i,{types:l,attributeName:d,generateID:u}=this.options,p=A.combineTransactionSteps(r.doc,n),{mapping:m}=p;if(A.getChangedRanges(p).forEach(({newRange:x})=>{const b=A.findChildrenInRange(i.doc,x,N=>l.includes(N.type.name)),O=b.map(({node:N})=>N.attrs[d]).filter(N=>N!==null),C=rl(O);b.forEach(({node:N,pos:T})=>{var f;const I=(f=a.doc.nodeAt(T))===null||f===void 0?void 0:f.attrs[d];if(I===null){a.setNodeMarkup(T,void 0,{...N.attrs,[d]:u()});return}const{deleted:w}=m.invert().mapResult(T);w&&C.includes(I)&&a.setNodeMarkup(T,void 0,{...N.attrs,[d]:u()})})}),!!a.steps.length)return a},view(n){const r=i=>{var o;e=!((o=n.dom.parentElement)===null||o===void 0)&&o.contains(i.target)?n.dom.parentElement:null};return window.addEventListener("dragstart",r),{destroy(){window.removeEventListener("dragstart",r)}}},props:{handleDOMEvents:{drop:(n,r)=>{var i;return(e!==n.dom.parentElement||((i=r.dataTransfer)===null||i===void 0?void 0:i.effectAllowed)==="copy")&&(e=null,t=!0),!1},paste:()=>(t=!0,!1)},transformPasted:n=>{if(!t)return n;const{types:r,attributeName:i}=this.options,o=s=>{const a=[];return s.forEach(l=>{if(l.isText){a.push(l);return}if(!r.includes(l.type.name)){a.push(l.copy(o(l.content)));return}const d=l.type.create({...l.attrs,[i]:null},o(l.content),l.marks);a.push(d)}),D.Fragment.from(a)};return t=!1,new D.Slice(o(n.content),n.openStart,n.openEnd)}}})]}}),ol=A.Node.create({name:"doc",topNode:!0,content:"block+"}),Ei=()=>[A.extensions.ClipboardTextSerializer,A.extensions.Commands,A.extensions.Editable,A.extensions.FocusEvents,A.extensions.Tabindex,qi.default,el.configure({emptyNodeClass:pt.isEmpty,hasAnchorClass:pt.hasAnchor,isFilterClass:pt.isFilter,includeChildren:!0,showOnlyCurrent:!1}),il.configure({types:["block"]}),Ui.default,Ji.default,Fi.default,zi.default,Wi.default,$i.default,Yi.default,Zs,Qs,...mo,Ys,Vi.default.configure({width:5,color:"#ddeeff"}),Ss,Ri.History,Ls,tl],al={bnEditor:"_bnEditor_1bxtz_1"},ki=Ei(),sl={enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!1},ll=(e={},t=[])=>{var i,o,s;const n=e.disableHistoryExtension?ki.filter(a=>a.name!=="history"):ki,r={...sl,...e,extensions:e.enableBlockNoteExtensions===!1?e.extensions:[...e.extensions||[],...n],editorProps:{attributes:{...((i=e.editorProps)==null?void 0:i.attributes)||{},class:[al.bnEditor,Rn.bnRoot,((s=(o=e.editorProps)==null?void 0:o.attributes)==null?void 0:s.class)||""].join(" ")}}};return bn.useEditor(r,t)};Object.defineProperty(P,"EditorContent",{enumerable:!0,get:()=>bn.EditorContent}),P.Document=ol,P.getBlockNoteExtensions=Ei,P.useEditor=ll,Object.defineProperties(P,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
54
54
|
//# sourceMappingURL=blocknote.umd.cjs.map
|