react-tiptap-base-editor 1.2.1 → 1.2.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/index.cjs CHANGED
@@ -26,7 +26,7 @@
26
26
  `))),0,0),t.someProp("transformPasted",f=>{l=f(l,t,!0)}),l;let d=t.someProp("clipboardTextParser",f=>f(e,o,r,t));if(d)l=d;else{let f=o.marks(),{schema:h}=t.state,p=Ln.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let v=s.appendChild(document.createElement("p"));m&&v.appendChild(p.serializeNode(h.text(m,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),s=jy(n),Yr&&By(s);let c=s&&s.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||Qt.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||u),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Ly.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=_y(Uu(l,+u[1],+u[2]),u[4]);else if(l=D.maxOpen(Dy(l.content,o),!0),l.openStart||l.openEnd){let d=0,f=0;for(let h=l.content.firstChild;d<l.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=l.content.lastChild;f<l.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);l=Uu(l,d,f)}return t.someProp("transformPasted",d=>{l=d(l,t,a)}),l}const Ly=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Dy(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.index(n)),i,s=[];if(t.forEach(l=>{if(!s)return;let a=o.findWrapping(l.type),c;if(!a)return s=null;if(c=s.length&&i.length&&jh(a,i,l,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=Bh(s[s.length-1],i.length));let u=Ph(l,a);s.push(u),o=o.matchType(u.type),i=a}}),s)return A.from(s)}return t}function Ph(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,A.from(t));return t}function jh(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let i=jh(t,e,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(A.from(Ph(n,t,o+1))))}}function Bh(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Bh(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(A.empty,!0);return t.copy(n.append(r))}function Dl(t,e,n,r,o,i){let s=e<0?t.firstChild:t.lastChild,l=s.content;return t.childCount>1&&(i=0),o<r-1&&(l=Dl(l,e,n,r,o+1,i)),o>=n&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=o).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(A.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(l))}function Uu(t,e,n){return e<t.openStart&&(t=new D(Dl(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new D(Dl(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const _h={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Wu=null;function Hh(){return Wu||(Wu=document.implementation.createHTMLDocument("title"))}let Ls=null;function Py(t){let e=window.trustedTypes;return e?(Ls||(Ls=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Ls.createHTML(t)):t}function jy(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Hh().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&_h[r[1].toLowerCase()])&&(t=o.map(i=>"<"+i+">").join("")+t+o.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=Py(t),o)for(let i=0;i<o.length;i++)n=n.querySelector(o[i])||n;return n}function By(t){let e=t.querySelectorAll(Re?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function _y(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:o,openStart:i,openEnd:s}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;o=A.from(a.create(r[l+1],o)),i++,s++}return new D(o,i,s)}const De={},Pe={},Hy={touchstart:!0,touchmove:!0};class Fy{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function $y(t){for(let e in De){let n=De[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{zy(t,r)&&!Ra(t,r)&&(t.editable||!(r.type in Pe))&&n(t,r)},Hy[e]?{passive:!0}:void 0)}Le&&t.dom.addEventListener("input",()=>null),Pl(t)}function Yt(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Vy(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Pl(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Ra(t,r))})}function Ra(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function zy(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function Uy(t,e){!Ra(t,e)&&De[e.type]&&(t.editable||!(e.type in Pe))&&De[e.type](t,e)}Pe.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!$h(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(At&&Re&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),or&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",o=>o(t,gn(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||Iy(t,n)?n.preventDefault():Yt(t,"key")};Pe.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Pe.keypress=(t,e)=>{let n=e;if($h(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Ze&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof V)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,o,i))&&t.dispatch(i()),n.preventDefault()}};function Ki(t){return{left:t.clientX,top:t.clientY}}function Wy(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Oa(t,e,n,r,o){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,l=>s>i.depth?l(t,n,i.nodeAfter,i.before(s),o,!0):l(t,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function Xn(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function Ky(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&B.isSelectable(r)?(Xn(t,new B(n)),!0):!1}function qy(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof B&&(r=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(B.isSelectable(l)){r&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?o=i.before(n.$from.depth):o=i.before(s);break}}return o!=null?(Xn(t,B.create(t.state.doc,o)),!0):!1}function Gy(t,e,n,r,o){return Oa(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(o?qy(t,n):Ky(t,n))}function Jy(t,e,n,r){return Oa(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function Zy(t,e,n,r){return Oa(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||Yy(t,n,r)}function Yy(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Xn(t,V.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),l=o.before(i);if(s.inlineContent)Xn(t,V.create(r,l+1,l+1+s.content.size));else if(B.isSelectable(s))Xn(t,B.create(r,l));else continue;return!0}}function Na(t){return Zo(t)}const Fh=Ze?"metaKey":"ctrlKey";De.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Na(t),o=Date.now(),i="singleClick";o-t.input.lastClick.time<500&&Wy(n,t.input.lastClick)&&!n[Fh]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=t.posAtCoords(Ki(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new Xy(t,s,n,!!r)):(i=="doubleClick"?Jy:Zy)(t,s.pos,s.inside,n)?n.preventDefault():Yt(t,"pointer"))};class Xy{constructor(e,n,r,o){this.view=e,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Fh],this.allowDefault=r.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let u=e.state.doc.resolve(n.pos);i=u.parent,s=u.depth?u.before():0}const l=o?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:c}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof B&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Xe&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Yt(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Nt(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Ki(e))),this.updateAllowDefault(e),this.allowDefault||!n?Yt(this.view,"pointer"):Gy(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Le&&this.mightDrag&&!this.mightDrag.node.isAtom||Re&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Xn(this.view,q.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Yt(this.view,"pointer")}move(e){this.updateAllowDefault(e),Yt(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}De.touchstart=t=>{t.input.lastTouch=Date.now(),Na(t),Yt(t,"pointer")};De.touchmove=t=>{t.input.lastTouch=Date.now(),Yt(t,"pointer")};De.contextmenu=t=>Na(t);function $h(t,e){return t.composing?!0:Le&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Qy=At?5e3:-1;Pe.compositionstart=Pe.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof V&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),Zo(t,!0),t.markCursor=null;else if(Zo(t,!e.selection.empty),Xe&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){let l=t.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else o=s,i=-1}}t.input.composing=!0}Vh(t,Qy)};Pe.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Vh(t,20))};function Vh(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Zo(t),e))}function zh(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=tv());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function ev(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=K2(e.focusNode,e.focusOffset),r=q2(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function tv(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Zo(t,e=!1){if(!(At&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),zh(t),e||t.docView&&t.docView.dirty){let n=Ma(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function nv(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Pr=He&&en<15||or&&X2<604;De.copy=Pe.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let i=Pr?null:n.clipboardData,s=r.content(),{dom:l,text:a}=Aa(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):nv(t,l),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function rv(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function ov(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?jr(t,r.value,null,o,e):jr(t,r.textContent,r.innerHTML,o,e)},50)}function jr(t,e,n,r,o){let i=Dh(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,o,i||D.empty)))return!0;if(!i)return!1;let s=rv(i),l=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(i);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Uh(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Pe.paste=(t,e)=>{let n=e;if(t.composing&&!At)return;let r=Pr?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&jr(t,Uh(r),r.getData("text/html"),o,n)?n.preventDefault():ov(t,n)};class Wh{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const iv=Ze?"altKey":"ctrlKey";function Kh(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[iv]}De.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,i=o.empty?null:t.posAtCoords(Ki(n)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof B?o.to-1:o.to))){if(r&&r.mightDrag)s=B.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(s=B.create(t.state.doc,d.posBefore))}}let l=(s||t.state.selection).content(),{dom:a,text:c,slice:u}=Aa(t,l);(!n.dataTransfer.files.length||!Re||vh>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Pr?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",Pr||n.dataTransfer.setData("text/plain",c),t.dragging=new Wh(u,Kh(t,n),s)};De.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Pe.dragover=Pe.dragenter=(t,e)=>e.preventDefault();Pe.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let o=t.posAtCoords(Ki(n));if(!o)return;let i=t.state.doc.resolve(o.pos),s=r&&r.slice;s?t.someProp("transformPasted",p=>{s=p(s,t,!1)}):s=Dh(t,Uh(n.dataTransfer),Pr?null:n.dataTransfer.getData("text/html"),!1,i);let l=!!(r&&Kh(t,n));if(t.someProp("handleDrop",p=>p(t,n,s||D.empty,l))){n.preventDefault();return}if(!s)return;n.preventDefault();let a=s?Yf(t.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let c=t.state.tr;if(l){let{node:p}=r;p?p.replace(c):c.deleteSelection()}let u=c.mapping.map(a),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,f=c.doc;if(d?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(f))return;let h=c.doc.resolve(u);if(d&&B.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new B(h));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,v,b,C)=>p=C),c.setSelection(Ta(t,h,c.doc.resolve(p)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))};De.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Nt(t)},20))};De.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};De.beforeinput=(t,e)=>{if(Re&&At&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,gn(8,"Backspace")))))return;let{$cursor:o}=t.state.selection;o&&o.pos>0&&t.dispatch(t.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let t in Pe)De[t]=Pe[t];function Br(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Yo{constructor(e,n){this.toDOM=e,this.spec=n||Sn,this.side=this.spec.side||0}map(e,n,r,o){let{pos:i,deleted:s}=e.mapResult(n.from+o,this.side<0?-1:1);return s?null:new Ie(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Yo&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Br(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class nn{constructor(e,n){this.attrs=e,this.spec=n||Sn}map(e,n,r,o){let i=e.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new Ie(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof nn&&Br(this.attrs,e.attrs)&&Br(this.spec,e.spec)}static is(e){return e.type instanceof nn}destroy(){}}class Ia{constructor(e,n){this.attrs=e,this.spec=n||Sn}map(e,n,r,o){let i=e.mapResult(n.from+o,1);if(i.deleted)return null;let s=e.mapResult(n.to+o,-1);return s.deleted||s.pos<=i.pos?null:new Ie(i.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:o}=e.content.findIndex(n.from),i;return o==n.from&&!(i=e.child(r)).isText&&o+i.nodeSize==n.to}eq(e){return this==e||e instanceof Ia&&Br(this.attrs,e.attrs)&&Br(this.spec,e.spec)}destroy(){}}class Ie{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Ie(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Ie(e,e,new Yo(n,r))}static inline(e,n,r,o){return new Ie(e,n,new nn(r,o))}static node(e,n,r,o){return new Ie(e,n,new Ia(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof nn}get widget(){return this.type instanceof Yo}}const Wn=[],Sn={};class ae{constructor(e,n){this.local=e.length?e:Wn,this.children=n.length?n:Wn}static create(e,n){return n.length?Xo(n,e,0,Sn):Ae}find(e,n,r){let o=[];return this.findInner(e??0,n??1e9,o,0,r),o}findInner(e,n,r,o,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=n&&l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+o,l.to+o))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,n-l,r,o+l,i)}}map(e,n,r){return this==Ae||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Sn)}mapInner(e,n,r,o,i){let s;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,o);a&&a.type.valid(n,a)?(s||(s=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?sv(this.children,s||[],e,n,r,o,i):s?new ae(s.sort(kn),Wn):Ae}add(e,n){return n.length?this==Ae?ae.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let o,i=0;e.forEach((l,a)=>{let c=a+r,u;if(u=Gh(n,l,c)){for(o||(o=this.children.slice());i<o.length&&o[i]<a;)i+=3;o[i]==a?o[i+2]=o[i+2].addInner(l,u,c+1):o.splice(i,0,a,a+l.nodeSize,Xo(u,l,c+1,Sn)),i+=3}});let s=qh(i?Jh(n):n,-r);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new ae(s.length?this.local.concat(s).sort(kn):this.local,o||this.children)}remove(e){return e.length==0||this==Ae?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let s,l=r[i]+n,a=r[i+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>l&&d.to<a&&(e[u]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(s,l+1);c!=Ae?r[i+2]=c:(r.splice(i,3),i-=3)}if(o.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let l=0;l<o.length;l++)o[l].eq(s,n)&&(o==this.local&&(o=this.local.slice()),o.splice(l--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new ae(o,r):Ae}forChild(e,n){if(this==Ae)return this;if(n.isLeaf)return ae.empty;let r,o;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let i=e+1,s=i+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>i&&a.type instanceof nn){let c=Math.max(i,a.from)-i,u=Math.min(s,a.to)-i;c<u&&(o||(o=[])).push(a.copy(c,u))}}if(o){let l=new ae(o.sort(kn),Wn);return r?new qt([l,r]):l}return r||Ae}eq(e){if(this==e)return!0;if(!(e instanceof ae)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return La(this.localsInner(e))}localsInner(e){if(this==Ae)return Wn;if(e.inlineContent||!this.local.some(nn.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof nn||n.push(this.local[r]);return n}forEachSet(e){e(this)}}ae.empty=new ae([],[]);ae.removeOverlap=La;const Ae=ae.empty;class qt{constructor(e){this.members=e}map(e,n){const r=this.members.map(o=>o.map(e,n,Sn));return qt.from(r)}forChild(e,n){if(n.isLeaf)return ae.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(e,n);i!=Ae&&(i instanceof qt?r=r.concat(i.members):r.push(i))}return qt.from(r)}eq(e){if(!(e instanceof qt)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let o=0;o<this.members.length;o++){let i=this.members[o].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?La(r?n:n.sort(kn)):Wn}static from(e){switch(e.length){case 0:return Ae;case 1:return e[0];default:return new qt(e.every(n=>n instanceof ae)?e:e.reduce((n,r)=>n.concat(r instanceof ae?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function sv(t,e,n,r,o,i,s){let l=t.slice();for(let c=0,u=i;c<n.maps.length;c++){let d=0;n.maps[c].forEach((f,h,p,m)=>{let v=m-p-(h-f);for(let b=0;b<l.length;b+=3){let C=l[b+1];if(C<0||f>C+u-d)continue;let x=l[b]+u-d;h>=x?l[b+1]=f<=x?-2:-1:f>=u&&v&&(l[b]+=v,l[b+1]+=v)}d+=v}),u=n.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=n.map(t[c]+i),d=u-o;if(d<0||d>=r.content.size){a=!0;continue}let f=n.map(t[c+1]+i,-1),h=f-o,{index:p,offset:m}=r.content.findIndex(d),v=r.maybeChild(p);if(v&&m==d&&m+v.nodeSize==h){let b=l[c+2].mapInner(n,v,u+1,t[c]+i+1,s);b!=Ae?(l[c]=d,l[c+1]=h,l[c+2]=b):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=lv(l,t,e,n,o,i,s),u=Xo(c,r,0,s);e=u.local;for(let d=0;d<l.length;d+=3)l[d+1]<0&&(l.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<l.length&&l[f]<h;)f+=3;l.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new ae(e.sort(kn),l)}function qh(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let o=t[r];n.push(new Ie(o.from+e,o.to+e,o.type))}return n}function lv(t,e,n,r,o,i,s){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,o,c);d?n.push(d):s.onRemove&&s.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+i+1);return n}function Gh(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let i=0,s;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),t[i]=null);return o}function Jh(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Xo(t,e,n,r){let o=[],i=!1;e.forEach((l,a)=>{let c=Gh(t,l,a+n);if(c){i=!0;let u=Xo(c,l,n+a+1,r);u!=Ae&&o.push(a,a+l.nodeSize,u)}});let s=qh(i?Jh(t):t,-n).sort(kn);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(r.onRemove&&r.onRemove(s[l].spec),s.splice(l--,1));return s.length||o.length?new ae(s,o):Ae}function kn(t,e){return t.from-e.from||t.to-e.to}function La(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let o=n+1;o<e.length;o++){let i=e[o];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[o]=i.copy(i.from,r.to),Ku(e,o+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),Ku(e,o,r.copy(i.from,r.to)));break}}}return e}function Ku(t,e,n){for(;e<t.length&&kn(n,t[e])>0;)e++;t.splice(e,0,n)}function Ds(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Ae&&e.push(r)}),t.cursorWrapper&&e.push(ae.create(t.state.doc,[t.cursorWrapper.deco])),qt.from(e)}const av={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},cv=He&&en<=11;class uv{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class dv{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new uv,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);He&&en<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),cv&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,av)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(_u(this.view)){if(this.suppressingSelectionUpdates)return Nt(this.view);if(He&&en<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&An(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=rr(i))n.add(i);for(let i=e.anchorNode;i;i=rr(i))if(n.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&_u(e)&&!this.ignoreSelectionChange(r),i=-1,s=-1,l=!1,a=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],a);d&&(i=i<0?d.from:Math.min(d.from,i),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(l=!0))}if(Xe&&a.length){let u=a.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||pv(e,d)!=h)&&f.remove()}}}let c=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ui(r)&&(c=Ma(e))&&c.eq(q.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Nt(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||o)&&(i>-1&&(e.docView.markDirty(i,s),fv(e)),this.handleDOMChange(i,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Nt(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let o=e.previousSibling,i=e.nextSibling;if(He&&en<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(o=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let s=o&&o.parentNode==e.target?ke(o)+1:0,l=r.localPosFromDOM(e.target,s,-1),a=i&&i.parentNode==e.target?ke(i):e.target.childNodes.length,c=r.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let qu=new WeakMap,Gu=!1;function fv(t){if(!qu.has(t)&&(qu.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Xe,Gu)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Gu=!0}}function Ju(t,e){let n=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return An(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function hv(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return Ju(t,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Ju(t,n):null}function pv(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function mv(t,e,n){let{node:r,fromOffset:o,toOffset:i,from:s,to:l}=t.docView.parseRange(e,n),a=t.domSelectionRange(),c,u=a.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:a.anchorOffset}],Ui(a)||c.push({node:a.focusNode,offset:a.focusOffset})),Re&&t.input.lastKeyCode===8)for(let v=i;v>o;v--){let b=r.childNodes[v-1],C=b.pmViewDesc;if(b.nodeName=="BR"&&!C){i=v;break}if(!C||C.size)break}let d=t.state.doc,f=t.someProp("domParser")||Qt.fromSchema(t.state.schema),h=d.resolve(s),p=null,m=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:o,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:gv,context:h});if(c&&c[0].pos!=null){let v=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=v),p={anchor:v+s,head:b+s}}return{doc:m,sel:p,from:s,to:l}}function gv(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Le&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Le&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const yv=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function vv(t,e,n,r,o){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let S=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,M=Ma(t,S);if(M&&!t.state.selection.eq(M)){if(Re&&At&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",P=>P(t,gn(13,"Enter"))))return;let N=t.state.tr.setSelection(M);S=="pointer"?N.setMeta("pointer",!0):S=="key"&&N.scrollIntoView(),i&&N.setMeta("composition",i),t.dispatch(N)}return}let s=t.state.doc.resolve(e),l=s.sharedDepth(n);e=s.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a=t.state.selection,c=mv(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),f,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,h="end"):(f=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let p=xv(d.content,c.doc.content,c.from,f,h);if(p&&t.input.domChangeCount++,(or&&t.input.lastIOSEnter>Date.now()-225||At)&&o.some(S=>S.nodeType==1&&!yv.test(S.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",S=>S(t,gn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof V&&!a.empty&&a.$head.sameParent(a.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let S=Zu(t,t.state.doc,c.sel);if(S&&!S.eq(t.state.selection)){let M=t.state.tr.setSelection(S);i&&M.setMeta("composition",i),t.dispatch(M)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof V&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),He&&en<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),v=c.doc.resolveNoCache(p.endB-c.from),b=u.resolve(p.start),C=m.sameParent(v)&&m.parent.inlineContent&&b.end()>=p.endA;if((or&&t.input.lastIOSEnter>Date.now()-225&&(!C||o.some(S=>S.nodeName=="DIV"||S.nodeName=="P"))||!C&&m.pos<c.doc.content.size&&(!m.sameParent(v)||!m.parent.inlineContent)&&m.pos<v.pos&&!/\S/.test(c.doc.textBetween(m.pos,v.pos,"","")))&&t.someProp("handleKeyDown",S=>S(t,gn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&Cv(u,p.start,p.endA,m,v)&&t.someProp("handleKeyDown",S=>S(t,gn(8,"Backspace")))){At&&Re&&t.domObserver.suppressSelectionUpdates();return}Re&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),At&&!C&&m.start()!=v.start()&&v.parentOffset==0&&m.depth==v.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,v=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(S){return S(t,gn(13,"Enter"))})},20));let x=p.start,w=p.endA,E=S=>{let M=S||t.state.tr.replace(x,w,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let N=Zu(t,M.doc,c.sel);N&&!(Re&&t.composing&&N.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(N.head==x||N.head==M.mapping.map(w)-1)||He&&N.empty&&N.head==x)&&M.setSelection(N)}return i&&M.setMeta("composition",i),M.scrollIntoView()},k;if(C)if(m.pos==v.pos){He&&en<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Nt(t),20));let S=E(t.state.tr.delete(x,w)),M=u.resolve(p.start).marksAcross(u.resolve(p.endA));M&&S.ensureMarks(M),t.dispatch(S)}else if(p.endA==p.endB&&(k=bv(m.parent.content.cut(m.parentOffset,v.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start())))){let S=E(t.state.tr);k.type=="add"?S.addMark(x,w,k.mark):S.removeMark(x,w,k.mark),t.dispatch(S)}else if(m.parent.child(m.index()).isText&&m.index()==v.index()-(v.textOffset?0:1)){let S=m.parent.textBetween(m.parentOffset,v.parentOffset),M=()=>E(t.state.tr.insertText(S,x,w));t.someProp("handleTextInput",N=>N(t,x,w,S,M))||t.dispatch(M())}else t.dispatch(E());else t.dispatch(E())}function Zu(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Ta(t,e.resolve(n.anchor),e.resolve(n.head))}function bv(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,o=n,i=r,s,l,a;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(o.length==1&&i.length==0)l=o[0],s="add",a=u=>u.mark(l.addToSet(u.marks));else if(o.length==0&&i.length==1)l=i[0],s="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(a(e.child(u)));if(A.from(c).eq(t))return{mark:l,type:s}}function Cv(t,e,n,r,o){if(n-e<=o.pos-r.pos||Ps(r,!0,!1)<o.pos)return!1;let i=t.resolve(e);if(!r.parent.isTextblock){let l=i.nodeAfter;return l!=null&&n==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=t.resolve(Ps(i,!0,!0));return!s.parent.isTextblock||s.pos>n||Ps(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Ps(t,e,n){let r=t.depth,o=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function xv(t,e,n,r,o){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:s,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(o=="end"){let a=Math.max(0,i-Math.min(s,l));r-=s+a-i}if(s<i&&t.size<e.size){let a=r<=i&&r>=s?i-r:0;i-=a,i&&i<e.size&&Yu(e.textBetween(i-1,i+1))&&(i+=a?1:-1),l=i+(l-s),s=i}else if(l<i){let a=r<=i&&r>=l?i-r:0;i-=a,i&&i<t.size&&Yu(t.textBetween(i-1,i+1))&&(i+=a?1:-1),s=i+(s-l),l=i}return{start:i,endA:s,endB:l}}function Yu(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class Zh{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Fy,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(nd),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=ed(this),Qu(this),this.nodeViews=td(this),this.docView=Iu(this.state.doc,Xu(this),Ds(this),this.dom,this),this.domObserver=new dv(this,(r,o,i,s)=>vv(this,r,o,i,s)),this.domObserver.start(),$y(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Pl(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(nd),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let o=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(zh(this),s=!0),this.state=e;let l=o.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=td(this);Sv(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Pl(this),this.editable=ed(this),Qu(this);let a=Ds(this),c=Xu(this),u=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(o.selection))&&(s=!0);let f=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&ty(this);if(s){this.domObserver.stop();let h=d&&(He||Re)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&wv(o.selection,e.selection);if(d){let p=Re?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=ev(this)),(i||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Iu(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Ey(this))?Nt(this,h):(Nh(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&ny(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof B){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Mu(this,n.getBoundingClientRect(),e)}else Mu(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new Wh(e.slice,e.move,o<0?void 0:B.create(this.state.doc,o))}someProp(e,n){let r=this._props&&this._props[e],o;if(r!=null&&(o=n?n(r):r))return o;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(o=n?n(l):l))return o}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let l=i[s].props[e];if(l!=null&&(o=n?n(l):l))return o}}hasFocus(){if(He){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&ry(this.dom),Nt(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return ay(this,e)}coordsAtPos(e,n=1){return Sh(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let o=this.docView.posFromDOM(e,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,n){return hy(this,n||this.state,e)}pasteHTML(e,n){return jr(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return jr(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Aa(this,e)}destroy(){this.docView&&(Vy(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ds(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,U2())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Uy(this,e)}domSelectionRange(){let e=this.domSelection();return e?Le&&this.root.nodeType===11&&J2(this.dom.ownerDocument)==this.dom&&hv(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Zh.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Xu(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Ie.node(0,t.state.doc.content.size,e)]}function Qu(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Ie.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function ed(t){return!t.someProp("editable",e=>e(t.state)===!1)}function wv(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function td(t){let e=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function Sv(t,e){let n=0,r=0;for(let o in t){if(t[o]!=e[o])return!0;n++}for(let o in e)r++;return n!=r}function nd(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var sn={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Qo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},kv=typeof navigator<"u"&&/Mac/.test(navigator.platform),Ev=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ee=0;Ee<10;Ee++)sn[48+Ee]=sn[96+Ee]=String(Ee);for(var Ee=1;Ee<=24;Ee++)sn[Ee+111]="F"+Ee;for(var Ee=65;Ee<=90;Ee++)sn[Ee]=String.fromCharCode(Ee+32),Qo[Ee]=String.fromCharCode(Ee);for(var js in sn)Qo.hasOwnProperty(js)||(Qo[js]=sn[js]);function Mv(t){var e=kv&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Ev&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Qo:sn)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const Tv=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Av=typeof navigator<"u"&&/Win/.test(navigator.platform);function Rv(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,o,i,s;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))o=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))Tv?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function Ov(t){let e=Object.create(null);for(let n in t)e[Rv(n)]=t[n];return e}function Bs(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function Nv(t){return new ce({props:{handleKeyDown:Yh(t)}})}function Yh(t){let e=Ov(t);return function(n,r){let o=Mv(r),i,s=e[Bs(o,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let l=e[Bs(o,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Av&&r.ctrlKey&&r.altKey)&&(i=sn[r.keyCode])&&i!=o){let l=e[Bs(i,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var Iv=Object.defineProperty,Da=(t,e)=>{for(var n in e)Iv(t,n,{get:e[n],enumerable:!0})};function qi(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:o}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}var Gi=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([s,l])=>[s,(...c)=>{const u=l(...c)(i);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(o),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s=[],l=!!t,a=t||o.tr,c=()=>(!l&&e&&!a.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(a),s.every(d=>d===!0)),u={...Object.fromEntries(Object.entries(n).map(([d,f])=>[d,(...p)=>{const m=this.buildProps(a,e),v=f(...p)(m);return s.push(v),u}])),run:c};return u}createCan(t){const{rawCommands:e,state:n}=this,r=!1,o=t||n.tr,i=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...c)=>a(...c)({...i,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s={tr:t,editor:r,view:i,state:qi({state:o,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([l,a])=>[l,(...c)=>a(...c)(s)]))}};return s}},Xh={};Da(Xh,{blur:()=>Lv,clearContent:()=>Dv,clearNodes:()=>Pv,command:()=>jv,createParagraphNear:()=>Bv,cut:()=>_v,deleteCurrentNode:()=>Hv,deleteNode:()=>Fv,deleteRange:()=>$v,deleteSelection:()=>Vv,enter:()=>zv,exitCode:()=>Uv,extendMarkRange:()=>Wv,first:()=>Kv,focus:()=>qv,forEach:()=>Gv,insertContent:()=>Jv,insertContentAt:()=>Xv,joinBackward:()=>tb,joinDown:()=>eb,joinForward:()=>nb,joinItemBackward:()=>rb,joinItemForward:()=>ob,joinTextblockBackward:()=>ib,joinTextblockForward:()=>sb,joinUp:()=>Qv,keyboardShortcut:()=>ab,lift:()=>cb,liftEmptyBlock:()=>ub,liftListItem:()=>db,newlineInCode:()=>fb,resetAttributes:()=>hb,scrollIntoView:()=>pb,selectAll:()=>mb,selectNodeBackward:()=>gb,selectNodeForward:()=>yb,selectParentNode:()=>vb,selectTextblockEnd:()=>bb,selectTextblockStart:()=>Cb,setContent:()=>xb,setMark:()=>Hb,setMeta:()=>Fb,setNode:()=>$b,setNodeSelection:()=>Vb,setTextSelection:()=>zb,sinkListItem:()=>Ub,splitBlock:()=>Wb,splitListItem:()=>Kb,toggleList:()=>qb,toggleMark:()=>Gb,toggleNode:()=>Jb,toggleWrap:()=>Zb,undoInputRule:()=>Yb,unsetAllMarks:()=>Xb,unsetMark:()=>Qb,updateAttributes:()=>eC,wrapIn:()=>tC,wrapInList:()=>nC});var Lv=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),Dv=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),Pv=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:o}=r;return n&&o.forEach(({$from:i,$to:s})=>{t.doc.nodesBetween(i.pos,s.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(a)),f=c.resolve(u.map(a+l.nodeSize)),h=d.blockRange(f);if(!h)return;const p=ar(h);if(l.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},jv=t=>e=>t(e),Bv=()=>({state:t,dispatch:e})=>hh(t,e),_v=(t,e)=>({editor:n,tr:r})=>{const{state:o}=n,i=o.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const s=r.mapping.map(e);return r.insert(s,i.content),r.setSelection(new V(r.doc.resolve(Math.max(s-1,0)))),!0},Hv=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const o=t.selection.$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===r.type){if(e){const l=o.before(i),a=o.after(i);t.delete(l,a).scrollIntoView()}return!0}return!1};function me(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var Fv=t=>({tr:e,state:n,dispatch:r})=>{const o=me(t,n.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===o){if(r){const a=i.before(s),c=i.after(s);e.delete(a,c).scrollIntoView()}return!0}return!1},$v=t=>({tr:e,dispatch:n})=>{const{from:r,to:o}=t;return n&&e.delete(r,o),!0},Vv=()=>({state:t,dispatch:e})=>Ca(t,e),zv=()=>({commands:t})=>t.keyboardShortcut("Enter"),Uv=()=>({state:t,dispatch:e})=>R2(t,e);function Pa(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function ei(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:Pa(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function Qh(t,e,n={}){return t.find(r=>r.type===e&&ei(Object.fromEntries(Object.keys(n).map(o=>[o,r.attrs[o]])),n))}function rd(t,e,n={}){return!!Qh(t,e,n)}function ja(t,e,n){var r;if(!t||!e)return;let o=t.parent.childAfter(t.parentOffset);if((!o.node||!o.node.marks.some(u=>u.type===e))&&(o=t.parent.childBefore(t.parentOffset)),!o.node||!o.node.marks.some(u=>u.type===e)||(n=n||((r=o.node.marks[0])==null?void 0:r.attrs),!Qh([...o.node.marks],e,n)))return;let s=o.index,l=t.start()+o.offset,a=s+1,c=l+o.node.nodeSize;for(;s>0&&rd([...t.parent.child(s-1).marks],e,n);)s-=1,l-=t.parent.child(s).nodeSize;for(;a<t.parent.childCount&&rd([...t.parent.child(a).marks],e,n);)c+=t.parent.child(a).nodeSize,a+=1;return{from:l,to:c}}function Bt(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var Wv=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const i=Bt(t,r.schema),{doc:s,selection:l}=n,{$from:a,from:c,to:u}=l;if(o){const d=ja(a,i,e);if(d&&d.from<=c&&d.to>=u){const f=V.create(s,d.from,d.to);n.setSelection(f)}}return!0},Kv=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function ep(t){return t instanceof V}function bn(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function tp(t,e=null){if(!e)return null;const n=q.atStart(t),r=q.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const o=n.from,i=r.to;return e==="all"?V.create(t,bn(0,o,i),bn(t.content.size,o,i)):V.create(t,bn(e,o,i),bn(e,o,i))}function np(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Ji(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var qv=(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(Ji()||np())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(i&&t===null&&!ep(n.state.selection))return s(),!0;const l=tp(o.doc,t)||n.state.selection,a=n.state.selection.eq(l);return i&&(a||o.setSelection(l),a&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},Gv=(t,e)=>n=>t.every((r,o)=>e(r,{...n,index:o})),Jv=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),rp=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&rp(r)}return t};function mo(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return rp(n)}function _r(t,e,n){if(t instanceof Xt||t instanceof A)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,o=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return A.fromArray(t.map(l=>e.nodeFromJSON(l)));const s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),_r("",e,n)}if(o){if(n.errorOnInvalidContent){let s=!1,l="";const a=new Ff({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(s=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?Qt.fromSchema(a).parseSlice(mo(t),n.parseOptions):Qt.fromSchema(a).parse(mo(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=Qt.fromSchema(e);return n.slice?i.parseSlice(mo(t),n.parseOptions).content:i.parse(mo(t),n.parseOptions)}return _r("",e,n)}function Zv(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof ve||o instanceof be))return;const i=t.mapping.maps[r];let s=0;i.forEach((l,a,c,u)=>{s===0&&(s=u)}),t.setSelection(q.near(t.doc.resolve(s),n))}var Yv=t=>!("type"in t),Xv=(t,e,n)=>({tr:r,dispatch:o,editor:i})=>{var s;if(o){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const a=v=>{i.emit("contentError",{editor:i,error:v,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{_r(e,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(v){a(v)}try{l=_r(e,i.schema,{parseOptions:c,errorOnInvalidContent:(s=n.errorOnInvalidContent)!=null?s:i.options.enableContentCheck})}catch(v){return a(v),!1}let{from:u,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,h=!0;if((Yv(l)?l:[l]).forEach(v=>{v.check(),f=f?v.isText&&v.marks.length===0:!1,h=h?v.isBlock:!1}),u===d&&h){const{parent:v}=r.doc.resolve(u);v.isTextblock&&!v.type.spec.code&&!v.childCount&&(u-=1,d+=1)}let m;if(f){if(Array.isArray(e))m=e.map(v=>v.text||"").join("");else if(e instanceof A){let v="";e.forEach(b=>{b.text&&(v+=b.text)}),m=v}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,u,d)}else{m=l;const v=r.doc.resolve(u),b=v.node(),C=v.parentOffset===0,x=b.isText||b.isTextblock,w=b.content.size>0;C&&x&&w&&(u=Math.max(0,u-1)),r.replaceWith(u,d,m)}n.updateSelection&&Zv(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:m})}return!0},Qv=()=>({state:t,dispatch:e})=>M2(t,e),eb=()=>({state:t,dispatch:e})=>T2(t,e),tb=()=>({state:t,dispatch:e})=>sh(t,e),nb=()=>({state:t,dispatch:e})=>uh(t,e),rb=()=>({state:t,dispatch:e,tr:n})=>{try{const r=$i(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},ob=()=>({state:t,dispatch:e,tr:n})=>{try{const r=$i(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},ib=()=>({state:t,dispatch:e})=>k2(t,e),sb=()=>({state:t,dispatch:e})=>E2(t,e);function op(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function lb(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,o,i,s;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))o=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))Ji()||op()?s=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(n=`Alt-${n}`),o&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var ab=t=>({editor:e,view:n,tr:r,dispatch:o})=>{const i=lb(t).split(/-(?!$)/),s=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,l))});return a?.steps.forEach(c=>{const u=c.map(r.mapping);u&&o&&r.maybeStep(u)}),!0};function ln(t,e,n={}){const{from:r,to:o,empty:i}=t.selection,s=e?me(e,t.schema):null,l=[];t.doc.nodesBetween(r,o,(d,f)=>{if(d.isText)return;const h=Math.max(r,f),p=Math.min(o,f+d.nodeSize);l.push({node:d,from:h,to:p})});const a=o-r,c=l.filter(d=>s?s.name===d.node.type.name:!0).filter(d=>ei(d.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=a}var cb=(t,e={})=>({state:n,dispatch:r})=>{const o=me(t,n.schema);return ln(n,o,e)?A2(n,r):!1},ub=()=>({state:t,dispatch:e})=>ph(t,e),db=t=>({state:e,dispatch:n})=>{const r=me(t,e.schema);return F2(r)(e,n)},fb=()=>({state:t,dispatch:e})=>fh(t,e);function Zi(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function od(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,o)=>(n.includes(o)||(r[o]=t[o]),r),{})}var hb=(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const l=Zi(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(i=me(t,r.schema)),l==="mark"&&(s=Bt(t,r.schema)),o&&n.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.$from.pos,a.$to.pos,(c,u)=>{i&&i===c.type&&n.setNodeMarkup(u,void 0,od(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(d=>{s===d.type&&n.addMark(u,u+c.nodeSize,s.create(od(d.attrs,e)))})})}),!0):!1},pb=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),mb=()=>({tr:t,dispatch:e})=>{if(e){const n=new ze(t.doc);t.setSelection(n)}return!0},gb=()=>({state:t,dispatch:e})=>ah(t,e),yb=()=>({state:t,dispatch:e})=>dh(t,e),vb=()=>({state:t,dispatch:e})=>I2(t,e),bb=()=>({state:t,dispatch:e})=>P2(t,e),Cb=()=>({state:t,dispatch:e})=>D2(t,e);function jl(t,e,n={},r={}){return _r(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var xb=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:i,dispatch:s,commands:l})=>{const{doc:a}=i;if(r.preserveWhitespace!=="full"){const c=jl(t,o.schema,r,{errorOnInvalidContent:e??o.options.enableContentCheck});return s&&i.replaceWith(0,a.content.size,c).setMeta("preventUpdate",!n),!0}return s&&i.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:a.content.size},t,{parseOptions:r,errorOnInvalidContent:e??o.options.enableContentCheck})};function ip(t,e){const n=Bt(e,t.schema),{from:r,to:o,empty:i}=t.selection,s=[];i?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,o,a=>{s.push(...a.marks)});const l=s.find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function Ba(t,e){const n=new nh(t);return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function wb(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Sb(t,e){const n=[];return t.descendants((r,o)=>{e(r)&&n.push({node:r,pos:o})}),n}function sp(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(o,i)=>{n(o)&&r.push({node:o,pos:i})}),r}function kb(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Yi(t){return e=>kb(e.$from,t)}function $(t,e,n){return t.config[e]===void 0&&t.parent?$(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?$(t.parent,e,n):null}):t.config[e]}function _a(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=$(e,"addExtensions",n);return r?[e,..._a(r())]:e}).flat(10)}function Ha(t,e){const n=Ln.fromSchema(e).serializeFragment(t),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}function lp(t){return typeof t=="function"}function X(t,e=void 0,...n){return lp(t)?e?t.bind(e)(...n):t(...n):t}function Eb(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Hr(t){const e=t.filter(o=>o.type==="extension"),n=t.filter(o=>o.type==="node"),r=t.filter(o=>o.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function ap(t){const e=[],{nodeExtensions:n,markExtensions:r}=Hr(t),o=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage,extensions:o},a=$(s,"addGlobalAttributes",l);if(!a)return;a().forEach(u=>{u.types.forEach(d=>{Object.entries(u.attributes).forEach(([f,h])=>{e.push({type:d,name:f,attribute:{...i,...h}})})})})}),o.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage},a=$(s,"addAttributes",l);if(!a)return;const c=a();Object.entries(c).forEach(([u,d])=>{const f={...i,...d};typeof f?.default=="function"&&(f.default=f.default()),f?.isRequired&&f?.default===void 0&&delete f.default,e.push({type:s.name,name:u,attribute:f})})}),e}function re(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([o,i])=>{if(!r[o]){r[o]=i;return}if(o==="class"){const l=i?String(i).split(" "):[],a=r[o]?r[o].split(" "):[],c=l.filter(u=>!a.includes(u));r[o]=[...a,...c].join(" ")}else if(o==="style"){const l=i?i.split(";").map(u=>u.trim()).filter(Boolean):[],a=r[o]?r[o].split(";").map(u=>u.trim()).filter(Boolean):[],c=new Map;a.forEach(u=>{const[d,f]=u.split(":").map(h=>h.trim());c.set(d,f)}),l.forEach(u=>{const[d,f]=u.split(":").map(h=>h.trim());c.set(d,f)}),r[o]=Array.from(c.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else r[o]=i}),r},{})}function Fr(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>re(n,r),{})}function Mb(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function id(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const o=e.reduce((i,s)=>{const l=s.attribute.parseHTML?s.attribute.parseHTML(n):Mb(n.getAttribute(s.name));return l==null?i:{...i,[s.name]:l}},{});return{...r,...o}}}}function sd(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&Eb(n)?!1:n!=null))}function Tb(t,e){var n;const r=ap(t),{nodeExtensions:o,markExtensions:i}=Hr(t),s=(n=o.find(c=>$(c,"topNode")))==null?void 0:n.name,l=Object.fromEntries(o.map(c=>{const u=r.filter(b=>b.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((b,C)=>{const x=$(C,"extendNodeSchema",d);return{...b,...x?x(c):{}}},{}),h=sd({...f,content:X($(c,"content",d)),marks:X($(c,"marks",d)),group:X($(c,"group",d)),inline:X($(c,"inline",d)),atom:X($(c,"atom",d)),selectable:X($(c,"selectable",d)),draggable:X($(c,"draggable",d)),code:X($(c,"code",d)),whitespace:X($(c,"whitespace",d)),linebreakReplacement:X($(c,"linebreakReplacement",d)),defining:X($(c,"defining",d)),isolating:X($(c,"isolating",d)),attrs:Object.fromEntries(u.map(b=>{var C,x;return[b.name,{default:(C=b?.attribute)==null?void 0:C.default,validate:(x=b?.attribute)==null?void 0:x.validate}]}))}),p=X($(c,"parseHTML",d));p&&(h.parseDOM=p.map(b=>id(b,u)));const m=$(c,"renderHTML",d);m&&(h.toDOM=b=>m({node:b,HTMLAttributes:Fr(b,u)}));const v=$(c,"renderText",d);return v&&(h.toText=v),[c.name,h]})),a=Object.fromEntries(i.map(c=>{const u=r.filter(v=>v.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((v,b)=>{const C=$(b,"extendMarkSchema",d);return{...v,...C?C(c):{}}},{}),h=sd({...f,inclusive:X($(c,"inclusive",d)),excludes:X($(c,"excludes",d)),group:X($(c,"group",d)),spanning:X($(c,"spanning",d)),code:X($(c,"code",d)),attrs:Object.fromEntries(u.map(v=>{var b,C;return[v.name,{default:(b=v?.attribute)==null?void 0:b.default,validate:(C=v?.attribute)==null?void 0:C.validate}]}))}),p=X($(c,"parseHTML",d));p&&(h.parseDOM=p.map(v=>id(v,u)));const m=$(c,"renderHTML",d);return m&&(h.toDOM=v=>m({mark:v,HTMLAttributes:Fr(v,u)})),[c.name,h]}));return new Ff({topNode:s,nodes:l,marks:a})}function Ab(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Fa(t){return t.sort((n,r)=>{const o=$(n,"priority")||100,i=$(r,"priority")||100;return o>i?-1:o<i?1:0})}function cp(t){const e=Fa(_a(t)),n=Ab(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function up(t,e,n){const{from:r,to:o}=e,{blockSeparator:i=`
27
27
 
28
28
  `,textSerializers:s={}}=n||{};let l="";return t.nodesBetween(r,o,(a,c,u,d)=>{var f;a.isBlock&&c>r&&(l+=i);const h=s?.[a.type.name];if(h)return u&&(l+=h({node:a,pos:c,parent:u,index:d,range:e})),!1;a.isText&&(l+=(f=a?.text)==null?void 0:f.slice(Math.max(r,c)-c,o-c))}),l}function Rb(t,e){const n={from:0,to:t.content.size};return up(t,n,e)}function dp(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function Ob(t,e){const n=me(e,t.schema),{from:r,to:o}=t.selection,i=[];t.doc.nodesBetween(r,o,l=>{i.push(l)});const s=i.reverse().find(l=>l.type.name===n.name);return s?{...s.attrs}:{}}function fp(t,e){const n=Zi(typeof e=="string"?e:e.name,t.schema);return n==="node"?Ob(t,e):n==="mark"?ip(t,e):{}}function Nb(t,e=JSON.stringify){const n={};return t.filter(r=>{const o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function Ib(t){const e=Nb(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,s)=>s!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function $a(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((o,i)=>{const s=[];if(o.ranges.length)o.forEach((l,a)=>{s.push({from:l,to:a})});else{const{from:l,to:a}=n[i];if(l===void 0||a===void 0)return;s.push({from:l,to:a})}s.forEach(({from:l,to:a})=>{const c=e.slice(i).map(l,-1),u=e.slice(i).map(a),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),Ib(r)}function Va(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(o=>{const i=n.resolve(t),s=ja(i,o.type);s&&r.push({mark:o,...s})}):n.nodesBetween(t,e,(o,i)=>{!o||o?.nodeSize===void 0||r.push(...o.marks.map(s=>({from:i,to:i+o.nodeSize,mark:s})))}),r}var Lb=(t,e,n,r=20)=>{const o=t.doc.resolve(n);let i=r,s=null;for(;i>0&&s===null;){const l=o.node(i);l?.type.name===e?s=l:i-=1}return[s,i]};function _s(t,e){return e.nodes[t]||e.marks[t]||null}function Po(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const o=t.find(i=>i.type===e&&i.name===r);return o?o.attribute.keepOnSplit:!1}))}var Db=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(o,i,s,l)=>{var a,c;const u=((c=(a=o.type.spec).toText)==null?void 0:c.call(a,{node:o,pos:i,parent:s,index:l}))||o.textContent||"%leaf%";n+=o.isAtom&&!o.isText?u:u.slice(0,Math.max(0,r-i))}),n};function Bl(t,e,n={}){const{empty:r,ranges:o}=t.selection,i=e?Bt(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>ei(d.attrs,n,{strict:!1}));let s=0;const l=[];if(o.forEach(({$from:d,$to:f})=>{const h=d.pos,p=f.pos;t.doc.nodesBetween(h,p,(m,v)=>{if(!m.isText&&!m.marks.length)return;const b=Math.max(h,v),C=Math.min(p,v+m.nodeSize),x=C-b;s+=x,l.push(...m.marks.map(w=>({mark:w,from:b,to:C})))})}),s===0)return!1;const a=l.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>ei(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=l.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,f)=>d+f.to-f.from,0);return(a>0?a+c:a)>=s}function Pb(t,e,n={}){if(!e)return ln(t,null,n)||Bl(t,null,n);const r=Zi(e,t.schema);return r==="node"?ln(t,e,n):r==="mark"?Bl(t,e,n):!1}var jb=(t,e)=>{const{$from:n,$to:r,$anchor:o}=t.selection;if(e){const i=Yi(l=>l.type.name===e)(t.selection);if(!i)return!1;const s=t.doc.resolve(i.pos+1);return o.pos+1===s.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},Bb=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function ld(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function ad(t,e){const{nodeExtensions:n}=Hr(e),r=n.find(s=>s.name===t);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},i=X($(r,"group",o));return typeof i!="string"?!1:i.split(" ").includes("list")}function Xi(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let o=!0;return t.content.forEach(i=>{o!==!1&&(Xi(i,{ignoreWhitespace:n,checkChildren:e})||(o=!1))}),o}return!1}function hp(t){return t instanceof B}function _b(t,e,n){var r;const{selection:o}=e;let i=null;if(ep(o)&&(i=o.$cursor),i){const l=(r=t.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(c=>c.type.excludes(n)))}const{ranges:s}=o;return s.some(({$from:l,$to:a})=>{let c=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,a.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){const h=!f||f.type.allowsMarkType(n),p=!!n.isInSet(u.marks)||!u.marks.some(m=>m.type.excludes(n));c=h&&p}return!c}),c})}var Hb=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:l}=i,a=Bt(t,r.schema);if(o)if(s){const c=ip(r,a);n.addStoredMark(a.create({...c,...e}))}else l.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,h)=>{const p=Math.max(h,u),m=Math.min(h+f.nodeSize,d);f.marks.find(b=>b.type===a)?f.marks.forEach(b=>{a===b.type&&n.addMark(p,m,a.create({...b.attrs,...e}))}):n.addMark(p,m,a.create(e))})});return _b(r,n,a)},Fb=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),$b=(t,e={})=>({state:n,dispatch:r,chain:o})=>{const i=me(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?o().command(({commands:l})=>Su(i,{...s,...e})(n)?!0:l.clearNodes()).command(({state:l})=>Su(i,{...s,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Vb=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,o=bn(t,0,r.content.size),i=B.create(r,o);e.setSelection(i)}return!0},zb=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:o,to:i}=typeof t=="number"?{from:t,to:t}:t,s=V.atStart(r).from,l=V.atEnd(r).to,a=bn(o,s,l),c=bn(i,s,l),u=V.create(r,a,c);e.setSelection(u)}return!0},Ub=t=>({state:e,dispatch:n})=>{const r=me(t,e.schema);return z2(r)(e,n)};function cd(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(o=>e?.includes(o.type.name));t.tr.ensureMarks(r)}}var Wb=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{const{selection:i,doc:s}=e,{$from:l,$to:a}=i,c=o.extensionManager.attributes,u=Po(c,l.node().type.name,l.node().attrs);if(i instanceof B&&i.node.isBlock)return!l.parentOffset||!Ot(s,l.pos)?!1:(r&&(t&&cd(n,o.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const d=a.parentOffset===a.parent.content.size,f=l.depth===0?void 0:wb(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=Ot(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&Ot(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:u}]:void 0),r){if(p&&(i instanceof V&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),f&&!d&&!l.parentOffset&&l.parent.type!==f)){const m=e.mapping.map(l.before()),v=e.doc.resolve(m);l.node(-1).canReplaceWith(v.index(),v.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}t&&cd(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return p},Kb=(t,e={})=>({tr:n,state:r,dispatch:o,editor:i})=>{var s;const l=me(t,r.schema),{$from:a,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||a.depth<2||!a.sameParent(c))return!1;const d=a.node(-1);if(d.type!==l)return!1;const f=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(o){let b=A.empty;const C=a.index(-1)?1:a.index(-2)?2:3;for(let M=a.depth-C;M>=a.depth-3;M-=1)b=A.from(a.node(M).copy(b));const x=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,w={...Po(f,a.node().type.name,a.node().attrs),...e},E=((s=l.contentMatch.defaultType)==null?void 0:s.createAndFill(w))||void 0;b=b.append(A.from(l.createAndFill(null,E)||void 0));const k=a.before(a.depth-(C-1));n.replace(k,a.after(-x),new D(b,4-C,0));let S=-1;n.doc.nodesBetween(k,n.doc.content.size,(M,N)=>{if(S>-1)return!1;M.isTextblock&&M.content.size===0&&(S=N+1)}),S>-1&&n.setSelection(V.near(n.doc.resolve(S))),n.scrollIntoView()}return!0}const h=c.pos===a.end()?d.contentMatchAt(0).defaultType:null,p={...Po(f,d.type.name,d.attrs),...e},m={...Po(f,a.node().type.name,a.node().attrs),...e};n.delete(a.pos,c.pos);const v=h?[{type:l,attrs:p},{type:h,attrs:m}]:[{type:l,attrs:p}];if(!Ot(n.doc,a.pos,2))return!1;if(o){const{selection:b,storedMarks:C}=r,{splittableMarks:x}=i.extensionManager,w=C||b.$to.parentOffset&&b.$from.marks();if(n.split(a.pos,2,v).scrollIntoView(),!w||!o)return!0;const E=w.filter(k=>x.includes(k.type.name));n.ensureMarks(E)}return!0},Hs=(t,e)=>{const n=Yi(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===o?.type&&dn(t.doc,n.pos)&&t.join(n.pos),!0},Fs=(t,e)=>{const n=Yi(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===o?.type&&dn(t.doc,r)&&t.join(r),!0},qb=(t,e,n,r={})=>({editor:o,tr:i,state:s,dispatch:l,chain:a,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=o.extensionManager,h=me(t,s.schema),p=me(e,s.schema),{selection:m,storedMarks:v}=s,{$from:b,$to:C}=m,x=b.blockRange(C),w=v||m.$to.parentOffset&&m.$from.marks();if(!x)return!1;const E=Yi(k=>ad(k.type.name,d))(m);if(x.depth>=1&&E&&x.depth-E.depth<=1){if(E.node.type===h)return c.liftListItem(p);if(ad(E.node.type.name,d)&&h.validContent(E.node.content)&&l)return a().command(()=>(i.setNodeMarkup(E.pos,h),!0)).command(()=>Hs(i,h)).command(()=>Fs(i,h)).run()}return!n||!w||!l?a().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>Hs(i,h)).command(()=>Fs(i,h)).run():a().command(()=>{const k=u().wrapInList(h,r),S=w.filter(M=>f.includes(M.type.name));return i.ensureMarks(S),k?!0:c.clearNodes()}).wrapInList(h,r).command(()=>Hs(i,h)).command(()=>Fs(i,h)).run()},Gb=(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=Bt(t,r.schema);return Bl(r,s,e)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,e)},Jb=(t,e,n={})=>({state:r,commands:o})=>{const i=me(t,r.schema),s=me(e,r.schema),l=ln(r,i,n);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?o.setNode(s,a):o.setNode(i,{...a,...n})},Zb=(t,e={})=>({state:n,commands:r})=>{const o=me(t,n.schema);return ln(n,o,e)?r.lift(o):r.wrapIn(o,e)},Yb=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let i;if(o.spec.isInputRules&&(i=o.getState(t))){if(e){const s=t.tr,l=i.transform;for(let a=l.steps.length-1;a>=0;a-=1)s.step(l.steps[a].invert(l.docs[a]));if(i.text){const a=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,a))}else s.delete(i.from,i.to)}return!0}}return!1},Xb=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:o}=n;return r||e&&o.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},Qb=(t,e={})=>({tr:n,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=n,a=Bt(t,r.schema),{$from:c,empty:u,ranges:d}=l;if(!o)return!0;if(u&&s){let{from:f,to:h}=l;const p=(i=c.marks().find(v=>v.type===a))==null?void 0:i.attrs,m=ja(c,a,p);m&&(f=m.from,h=m.to),n.removeMark(f,h,a)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,a)});return n.removeStoredMark(a),!0},eC=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const l=Zi(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(i=me(t,r.schema)),l==="mark"&&(s=Bt(t,r.schema)),o&&n.selection.ranges.forEach(a=>{const c=a.$from.pos,u=a.$to.pos;let d,f,h,p;n.selection.empty?r.doc.nodesBetween(c,u,(m,v)=>{i&&i===m.type&&(h=Math.max(v,c),p=Math.min(v+m.nodeSize,u),d=v,f=m)}):r.doc.nodesBetween(c,u,(m,v)=>{v<c&&i&&i===m.type&&(h=Math.max(v,c),p=Math.min(v+m.nodeSize,u),d=v,f=m),v>=c&&v<=u&&(i&&i===m.type&&n.setNodeMarkup(v,void 0,{...m.attrs,...e}),s&&m.marks.length&&m.marks.forEach(b=>{if(s===b.type){const C=Math.max(v,c),x=Math.min(v+m.nodeSize,u);n.addMark(C,x,s.create({...b.attrs,...e}))}}))}),f&&(d!==void 0&&n.setNodeMarkup(d,void 0,{...f.attrs,...e}),s&&f.marks.length&&f.marks.forEach(m=>{s===m.type&&n.addMark(h,p,s.create({...m.attrs,...e}))}))}),!0):!1},tC=(t,e={})=>({state:n,dispatch:r})=>{const o=me(t,n.schema);return j2(o,e)(n,r)},nC=(t,e={})=>({state:n,dispatch:r})=>{const o=me(t,n.schema);return B2(o,e)(n,r)},rC=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},Qr=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},oC=(t,e)=>{if(Pa(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function go(t){var e;const{editor:n,from:r,to:o,text:i,rules:s,plugin:l}=t,{view:a}=n;if(a.composing)return!1;const c=a.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1;const d=Db(c)+i;return s.forEach(f=>{if(u)return;const h=oC(d,f.find);if(!h)return;const p=a.state.tr,m=qi({state:a.state,transaction:p}),v={from:r-(h[0].length-i.length),to:o},{commands:b,chain:C,can:x}=new Gi({editor:n,state:m});f.handler({state:m,range:v,match:h,commands:b,chain:C,can:x})===null||!p.steps.length||(f.undoable&&p.setMeta(l,{transform:p,from:r,to:o,text:i}),a.dispatch(p),u=!0)}),u}function iC(t){const{editor:e,rules:n}=t,r=new ce({state:{init(){return null},apply(o,i,s){const l=o.getMeta(r);if(l)return l;const a=o.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:u}=a;typeof u=="string"?u=u:u=Ha(A.from(u),s.schema);const{from:d}=a,f=d+u.length;go({editor:e,from:d,to:f,text:u,rules:n,plugin:r})}),o.selectionSet||o.docChanged?null:i}},props:{handleTextInput(o,i,s,l){return go({editor:e,from:i,to:s,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:i}=o.state.selection;i&&go({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(o,i){if(i.key!=="Enter")return!1;const{$cursor:s}=o.state.selection;return s?go({editor:e,from:s.pos,to:s.pos,text:`
29
- `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function sC(t){return Object.prototype.toString.call(t).slice(8,-1)}function yo(t){return sC(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function pp(t,e){const n={...t};return yo(t)&&yo(e)&&Object.keys(e).forEach(r=>{yo(e[r])&&yo(t[r])?n[r]=pp(t[r],e[r]):n[r]=e[r]}),n}var za=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...X($(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...X($(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>pp(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},it=class mp extends za{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new mp(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){const s=o.marks();if(!!!s.find(c=>c?.type.name===n.name))return!1;const a=s.find(c=>c?.type.name===n.name);return a&&r.removeStoredMark(a),r.insertText(" ",o.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function lC(t){return typeof t=="number"}var aC=class{constructor(t){this.find=t.find,this.handler=t.handler}},cC=(t,e,n)=>{if(Pa(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(o=>{const i=[o.text];return i.index=o.index,i.input=t,i.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(o.replaceWith)),i}):[]};function uC(t){const{editor:e,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:l}=t,{commands:a,chain:c,can:u}=new Gi({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,o,(h,p)=>{var m,v,b,C,x;if((v=(m=h.type)==null?void 0:m.spec)!=null&&v.code||!(h.isText||h.isTextblock||h.isInline))return;const w=(x=(C=(b=h.content)==null?void 0:b.size)!=null?C:h.nodeSize)!=null?x:0,E=Math.max(r,p),k=Math.min(o,p+w);if(E>=k)return;const S=h.isText?h.text||"":h.textBetween(E-p,k-p,void 0,"");cC(S,i.find,s).forEach(N=>{if(N.index===void 0)return;const P=E+N.index+1,W=P+N[0].length,z={from:n.tr.mapping.map(P),to:n.tr.mapping.map(W)},H=i.handler({state:n,range:z,match:N,commands:a,chain:c,can:u,pasteEvent:s,dropEvent:l});d.push(H)})}),d.every(h=>h!==null)}var vo=null,dC=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function fC(t){const{editor:e,rules:n}=t;let r=null,o=!1,i=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:u,from:d,to:f,rule:h,pasteEvt:p})=>{const m=u.tr,v=qi({state:u,transaction:m});if(!(!uC({editor:e,state:v,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:l})||!m.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(u=>new ce({view(d){const f=p=>{var m;r=(m=d.dom.parentElement)!=null&&m.contains(p.target)?d.dom.parentElement:null,r&&(vo=e)},h=()=>{vo&&(vo=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(i=r===d.dom.parentElement,l=f,!i){const h=vo;h?.isEditable&&setTimeout(()=>{const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,f)=>{var h;const p=(h=f.clipboardData)==null?void 0:h.getData("text/html");return s=f,o=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(d,f,h)=>{const p=d[0],m=p.getMeta("uiEvent")==="paste"&&!o,v=p.getMeta("uiEvent")==="drop"&&!i,b=p.getMeta("applyPasteRules"),C=!!b;if(!m&&!v&&!C)return;if(C){let{text:E}=b;typeof E=="string"?E=E:E=Ha(A.from(E),h.schema);const{from:k}=b,S=k+E.length,M=dC(E);return a({rule:u,state:h,from:k,to:{b:S},pasteEvt:M})}const x=f.doc.content.findDiffStart(h.doc.content),w=f.doc.content.findDiffEnd(h.doc.content);if(!(!lC(x)||!w||x===w.b))return a({rule:u,state:h,from:x,to:w,pasteEvt:s})}}))}var Qi=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=cp(t),this.schema=Tb(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:_s(e.name,this.schema)},r=$(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return Fa([...this.extensions].reverse()).flatMap(r=>{const o={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:_s(r.name,this.schema)},i=[],s=$(r,"addKeyboardShortcuts",o);let l={};if(r.type==="mark"&&$(r,"exitable",o)&&(l.ArrowRight=()=>it.handleExit({editor:t,mark:r})),s){const f=Object.fromEntries(Object.entries(s()).map(([h,p])=>[h,()=>p({editor:t})]));l={...l,...f}}const a=Nv(l);i.push(a);const c=$(r,"addInputRules",o);if(ld(r,t.options.enableInputRules)&&c){const f=c();if(f&&f.length){const h=iC({editor:t,rules:f}),p=Array.isArray(h)?h:[h];i.push(...p)}}const u=$(r,"addPasteRules",o);if(ld(r,t.options.enablePasteRules)&&u){const f=u();if(f&&f.length){const h=fC({editor:t,rules:f});i.push(...h)}}const d=$(r,"addProseMirrorPlugins",o);if(d){const f=d();i.push(...f)}return i})}get attributes(){return ap(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Hr(this.extensions);return Object.fromEntries(e.filter(n=>!!$(n,"addNodeView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:me(n.name,this.schema)},i=$(n,"addNodeView",o);if(!i)return[];const s=(l,a,c,u,d)=>{const f=Fr(l,r);return i()({node:l,view:a,getPos:c,decorations:u,innerDecorations:d,editor:t,extension:n,HTMLAttributes:f})};return[n.name,s]}))}get markViews(){const{editor:t}=this,{markExtensions:e}=Hr(this.extensions);return Object.fromEntries(e.filter(n=>!!$(n,"addMarkView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Bt(n.name,this.schema)},i=$(n,"addMarkView",o);if(!i)return[];const s=(l,a,c)=>{const u=Fr(l,r);return i()({mark:l,view:a,inline:c,editor:t,extension:n,HTMLAttributes:u,updateAttributes:d=>{MC(l,t,d)}})};return[n.name,s]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:_s(e.name,this.schema)};e.type==="mark"&&((n=X($(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const o=$(e,"onBeforeCreate",r),i=$(e,"onCreate",r),s=$(e,"onUpdate",r),l=$(e,"onSelectionUpdate",r),a=$(e,"onTransaction",r),c=$(e,"onFocus",r),u=$(e,"onBlur",r),d=$(e,"onDestroy",r);o&&this.editor.on("beforeCreate",o),i&&this.editor.on("create",i),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}};Qi.resolve=cp;Qi.sort=Fa;Qi.flatten=_a;var hC={};Da(hC,{ClipboardTextSerializer:()=>yp,Commands:()=>vp,Delete:()=>bp,Drop:()=>Cp,Editable:()=>xp,FocusEvents:()=>Sp,Keymap:()=>kp,Paste:()=>Ep,Tabindex:()=>Mp,focusEventsPluginKey:()=>wp});var Q=class gp extends za{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new gp(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},yp=Q.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ce({key:new ye("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:o}=e,{ranges:i}=o,s=Math.min(...i.map(u=>u.$from.pos)),l=Math.max(...i.map(u=>u.$to.pos)),a=dp(n);return up(r,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),vp=Q.create({name:"commands",addCommands(){return{...Xh}}}),bp=Q.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,o;const i=()=>{var s,l,a,c;if((c=(a=(l=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:l.filterTransaction)==null?void 0:a.call(l,t))!=null?c:t.getMeta("y-sync$"))return;const u=Ba(t.before,[t,...e]);$a(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(p,m)=>{const v=m+p.nodeSize-2,b=h.oldRange.from<=m&&v<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:m,to:v,newFrom:u.mapping.map(m),newTo:u.mapping.map(v),deletedRange:h.oldRange,newRange:h.newRange,partial:!b,editor:this.editor,transaction:t,combinedTransform:u})})});const f=u.mapping;u.steps.forEach((h,p)=>{var m,v;if(h instanceof rt){const b=f.slice(p).map(h.from,-1),C=f.slice(p).map(h.to),x=f.invert().map(b,-1),w=f.invert().map(C),E=(m=u.doc.nodeAt(b-1))==null?void 0:m.marks.some(S=>S.eq(h.mark)),k=(v=u.doc.nodeAt(C))==null?void 0:v.marks.some(S=>S.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:x,to:w},newRange:{from:b,to:C},partial:!!(k||E),editor:this.editor,transaction:t,combinedTransform:u})}})};(o=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||o?setTimeout(i,0):i()}}),Cp=Q.create({name:"drop",addProseMirrorPlugins(){return[new ce({key:new ye("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),xp=Q.create({name:"editable",addProseMirrorPlugins(){return[new ce({key:new ye("editable"),props:{editable:()=>this.editor.options.editable}})]}}),wp=new ye("focusEvents"),Sp=Q.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new ce({key:wp,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),kp=Q.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{const{selection:a,doc:c}=l,{empty:u,$anchor:d}=a,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?l.doc.resolve(f-1):d,m=p.parent.type.spec.isolating,v=d.pos-d.parentOffset,b=m&&p.parent.childCount===1?v===d.pos:q.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!b||b&&d.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...r},i={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Ji()||op()?i:o},addProseMirrorPlugins(){return[new ce({key:new ye("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(m=>m.getMeta("composition")))return;const r=t.some(m=>m.docChanged)&&!e.doc.eq(n.doc),o=t.some(m=>m.getMeta("preventClearDocument"));if(!r||o)return;const{empty:i,from:s,to:l}=e.selection,a=q.atStart(e.doc).from,c=q.atEnd(e.doc).to;if(i||!(s===a&&l===c)||!Xi(n.doc))return;const f=n.tr,h=qi({state:n,transaction:f}),{commands:p}=new Gi({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),Ep=Q.create({name:"paste",addProseMirrorPlugins(){return[new ce({key:new ye("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),Mp=Q.create({name:"tabindex",addProseMirrorPlugins(){return[new ce({key:new ye("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),pC=class Kn{constructor(e,n,r=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=o}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Kn(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Kn(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Kn(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const o=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=this.pos+r+(i?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(s);if(!o&&l.depth<=this.depth)return;const a=new Kn(l,this.editor,o,o?n:null);o&&(a.actualDepth=this.depth+1),e.push(new Kn(l,this.editor,o,o?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,o=this.parent;for(;o&&!r;){if(o.node.type.name===e)if(Object.keys(n).length>0){const i=o.node.attrs,s=Object.keys(n);for(let l=0;l<s.length;l+=1){const a=s[l];if(i[a]!==n[a])break}}else r=o;o=o.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let o=[];if(!this.children||this.children.length===0)return o;const i=Object.keys(n);return this.children.forEach(s=>{r&&o.length>0||(s.node.type.name===e&&i.every(a=>n[a]===s.node.attrs[a])&&o.push(s),!(r&&o.length>0)&&(o=o.concat(s.querySelectorAll(e,n,r))))}),o}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},mC=`.ProseMirror {
29
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function sC(t){return Object.prototype.toString.call(t).slice(8,-1)}function yo(t){return sC(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function pp(t,e){const n={...t};return yo(t)&&yo(e)&&Object.keys(e).forEach(r=>{yo(e[r])&&yo(t[r])?n[r]=pp(t[r],e[r]):n[r]=e[r]}),n}var za=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...X($(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...X($(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>pp(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},it=class mp extends za{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new mp(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){const s=o.marks();if(!!!s.find(c=>c?.type.name===n.name))return!1;const a=s.find(c=>c?.type.name===n.name);return a&&r.removeStoredMark(a),r.insertText(" ",o.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function lC(t){return typeof t=="number"}var aC=class{constructor(t){this.find=t.find,this.handler=t.handler}},cC=(t,e,n)=>{if(Pa(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(o=>{const i=[o.text];return i.index=o.index,i.input=t,i.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(o.replaceWith)),i}):[]};function uC(t){const{editor:e,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:l}=t,{commands:a,chain:c,can:u}=new Gi({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,o,(h,p)=>{var m,v,b,C,x;if((v=(m=h.type)==null?void 0:m.spec)!=null&&v.code||!(h.isText||h.isTextblock||h.isInline))return;const w=(x=(C=(b=h.content)==null?void 0:b.size)!=null?C:h.nodeSize)!=null?x:0,E=Math.max(r,p),k=Math.min(o,p+w);if(E>=k)return;const S=h.isText?h.text||"":h.textBetween(E-p,k-p,void 0,"");cC(S,i.find,s).forEach(N=>{if(N.index===void 0)return;const P=E+N.index+1,z=P+N[0].length,U={from:n.tr.mapping.map(P),to:n.tr.mapping.map(z)},H=i.handler({state:n,range:U,match:N,commands:a,chain:c,can:u,pasteEvent:s,dropEvent:l});d.push(H)})}),d.every(h=>h!==null)}var vo=null,dC=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function fC(t){const{editor:e,rules:n}=t;let r=null,o=!1,i=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:u,from:d,to:f,rule:h,pasteEvt:p})=>{const m=u.tr,v=qi({state:u,transaction:m});if(!(!uC({editor:e,state:v,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:l})||!m.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(u=>new ce({view(d){const f=p=>{var m;r=(m=d.dom.parentElement)!=null&&m.contains(p.target)?d.dom.parentElement:null,r&&(vo=e)},h=()=>{vo&&(vo=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(i=r===d.dom.parentElement,l=f,!i){const h=vo;h?.isEditable&&setTimeout(()=>{const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,f)=>{var h;const p=(h=f.clipboardData)==null?void 0:h.getData("text/html");return s=f,o=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(d,f,h)=>{const p=d[0],m=p.getMeta("uiEvent")==="paste"&&!o,v=p.getMeta("uiEvent")==="drop"&&!i,b=p.getMeta("applyPasteRules"),C=!!b;if(!m&&!v&&!C)return;if(C){let{text:E}=b;typeof E=="string"?E=E:E=Ha(A.from(E),h.schema);const{from:k}=b,S=k+E.length,M=dC(E);return a({rule:u,state:h,from:k,to:{b:S},pasteEvt:M})}const x=f.doc.content.findDiffStart(h.doc.content),w=f.doc.content.findDiffEnd(h.doc.content);if(!(!lC(x)||!w||x===w.b))return a({rule:u,state:h,from:x,to:w,pasteEvt:s})}}))}var Qi=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=cp(t),this.schema=Tb(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:_s(e.name,this.schema)},r=$(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return Fa([...this.extensions].reverse()).flatMap(r=>{const o={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:_s(r.name,this.schema)},i=[],s=$(r,"addKeyboardShortcuts",o);let l={};if(r.type==="mark"&&$(r,"exitable",o)&&(l.ArrowRight=()=>it.handleExit({editor:t,mark:r})),s){const f=Object.fromEntries(Object.entries(s()).map(([h,p])=>[h,()=>p({editor:t})]));l={...l,...f}}const a=Nv(l);i.push(a);const c=$(r,"addInputRules",o);if(ld(r,t.options.enableInputRules)&&c){const f=c();if(f&&f.length){const h=iC({editor:t,rules:f}),p=Array.isArray(h)?h:[h];i.push(...p)}}const u=$(r,"addPasteRules",o);if(ld(r,t.options.enablePasteRules)&&u){const f=u();if(f&&f.length){const h=fC({editor:t,rules:f});i.push(...h)}}const d=$(r,"addProseMirrorPlugins",o);if(d){const f=d();i.push(...f)}return i})}get attributes(){return ap(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Hr(this.extensions);return Object.fromEntries(e.filter(n=>!!$(n,"addNodeView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:me(n.name,this.schema)},i=$(n,"addNodeView",o);if(!i)return[];const s=(l,a,c,u,d)=>{const f=Fr(l,r);return i()({node:l,view:a,getPos:c,decorations:u,innerDecorations:d,editor:t,extension:n,HTMLAttributes:f})};return[n.name,s]}))}get markViews(){const{editor:t}=this,{markExtensions:e}=Hr(this.extensions);return Object.fromEntries(e.filter(n=>!!$(n,"addMarkView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Bt(n.name,this.schema)},i=$(n,"addMarkView",o);if(!i)return[];const s=(l,a,c)=>{const u=Fr(l,r);return i()({mark:l,view:a,inline:c,editor:t,extension:n,HTMLAttributes:u,updateAttributes:d=>{MC(l,t,d)}})};return[n.name,s]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:_s(e.name,this.schema)};e.type==="mark"&&((n=X($(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const o=$(e,"onBeforeCreate",r),i=$(e,"onCreate",r),s=$(e,"onUpdate",r),l=$(e,"onSelectionUpdate",r),a=$(e,"onTransaction",r),c=$(e,"onFocus",r),u=$(e,"onBlur",r),d=$(e,"onDestroy",r);o&&this.editor.on("beforeCreate",o),i&&this.editor.on("create",i),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}};Qi.resolve=cp;Qi.sort=Fa;Qi.flatten=_a;var hC={};Da(hC,{ClipboardTextSerializer:()=>yp,Commands:()=>vp,Delete:()=>bp,Drop:()=>Cp,Editable:()=>xp,FocusEvents:()=>Sp,Keymap:()=>kp,Paste:()=>Ep,Tabindex:()=>Mp,focusEventsPluginKey:()=>wp});var Q=class gp extends za{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new gp(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},yp=Q.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ce({key:new ye("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:o}=e,{ranges:i}=o,s=Math.min(...i.map(u=>u.$from.pos)),l=Math.max(...i.map(u=>u.$to.pos)),a=dp(n);return up(r,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),vp=Q.create({name:"commands",addCommands(){return{...Xh}}}),bp=Q.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,o;const i=()=>{var s,l,a,c;if((c=(a=(l=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:l.filterTransaction)==null?void 0:a.call(l,t))!=null?c:t.getMeta("y-sync$"))return;const u=Ba(t.before,[t,...e]);$a(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(p,m)=>{const v=m+p.nodeSize-2,b=h.oldRange.from<=m&&v<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:m,to:v,newFrom:u.mapping.map(m),newTo:u.mapping.map(v),deletedRange:h.oldRange,newRange:h.newRange,partial:!b,editor:this.editor,transaction:t,combinedTransform:u})})});const f=u.mapping;u.steps.forEach((h,p)=>{var m,v;if(h instanceof rt){const b=f.slice(p).map(h.from,-1),C=f.slice(p).map(h.to),x=f.invert().map(b,-1),w=f.invert().map(C),E=(m=u.doc.nodeAt(b-1))==null?void 0:m.marks.some(S=>S.eq(h.mark)),k=(v=u.doc.nodeAt(C))==null?void 0:v.marks.some(S=>S.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:x,to:w},newRange:{from:b,to:C},partial:!!(k||E),editor:this.editor,transaction:t,combinedTransform:u})}})};(o=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||o?setTimeout(i,0):i()}}),Cp=Q.create({name:"drop",addProseMirrorPlugins(){return[new ce({key:new ye("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),xp=Q.create({name:"editable",addProseMirrorPlugins(){return[new ce({key:new ye("editable"),props:{editable:()=>this.editor.options.editable}})]}}),wp=new ye("focusEvents"),Sp=Q.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new ce({key:wp,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),kp=Q.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{const{selection:a,doc:c}=l,{empty:u,$anchor:d}=a,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?l.doc.resolve(f-1):d,m=p.parent.type.spec.isolating,v=d.pos-d.parentOffset,b=m&&p.parent.childCount===1?v===d.pos:q.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!b||b&&d.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...r},i={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Ji()||op()?i:o},addProseMirrorPlugins(){return[new ce({key:new ye("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(m=>m.getMeta("composition")))return;const r=t.some(m=>m.docChanged)&&!e.doc.eq(n.doc),o=t.some(m=>m.getMeta("preventClearDocument"));if(!r||o)return;const{empty:i,from:s,to:l}=e.selection,a=q.atStart(e.doc).from,c=q.atEnd(e.doc).to;if(i||!(s===a&&l===c)||!Xi(n.doc))return;const f=n.tr,h=qi({state:n,transaction:f}),{commands:p}=new Gi({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),Ep=Q.create({name:"paste",addProseMirrorPlugins(){return[new ce({key:new ye("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),Mp=Q.create({name:"tabindex",addProseMirrorPlugins(){return[new ce({key:new ye("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),pC=class Kn{constructor(e,n,r=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=o}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Kn(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Kn(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Kn(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const o=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=this.pos+r+(i?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(s);if(!o&&l.depth<=this.depth)return;const a=new Kn(l,this.editor,o,o?n:null);o&&(a.actualDepth=this.depth+1),e.push(new Kn(l,this.editor,o,o?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,o=this.parent;for(;o&&!r;){if(o.node.type.name===e)if(Object.keys(n).length>0){const i=o.node.attrs,s=Object.keys(n);for(let l=0;l<s.length;l+=1){const a=s[l];if(i[a]!==n[a])break}}else r=o;o=o.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let o=[];if(!this.children||this.children.length===0)return o;const i=Object.keys(n);return this.children.forEach(s=>{r&&o.length>0||(s.node.type.name===e&&i.every(a=>n[a]===s.node.attrs[a])&&o.push(s),!(r&&o.length>0)&&(o=o.concat(s.querySelectorAll(e,n,r))))}),o}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},mC=`.ProseMirror {
30
30
  position: relative;
31
31
  }
32
32
 
@@ -98,7 +98,7 @@ img.ProseMirror-separator {
98
98
  display: block;
99
99
  }`;function gC(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const o=document.createElement("style");return e&&o.setAttribute("nonce",e),o.setAttribute("data-tiptap-style",""),o.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(o),o}var yC=class extends rC{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:o,moved:i})=>this.options.onDrop(r,o,i)),this.on("paste",({event:r,slice:o})=>this.options.onPaste(r,o)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=tp(e,this.options.autofocus);this.editorState=Jn.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t?.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=gC(mC,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=lp(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(o=>{const i=typeof o=="string"?`${o}$`:o.key;n=n.filter(s=>!s.key.startsWith(i))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[xp,yp.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),vp,Sp,kp,Mp,Cp,Ep,bp].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o?.type));this.extensionManager=new Qi(r,this)}createCommandManager(){this.commandManager=new Gi({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=jl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=jl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){var e;this.editorView=new Zh(t,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)==null?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.prependClass(),this.injectCSS();const r=this.view.dom;r.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(c=>{var u;return(u=this.capturedTransaction)==null?void 0:u.step(c)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),o=n.includes(t),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!o)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const s=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),l=s?.getMeta("focus"),a=s?.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:s}),a&&this.emit("blur",{editor:this,event:a.event,transaction:s}),!(t.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return fp(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return Pb(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Ha(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
100
100
 
101
- `,textSerializers:n={}}=t||{};return Rb(this.state.doc,{blockSeparator:e,textSerializers:{...dp(this.schema),...n}})}get isEmpty(){return Xi(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new pC(e,this)}get $doc(){return this.$pos(0)}};function On(t){return new Qr({find:t.find,handler:({state:e,range:n,match:r})=>{const o=X(t.getAttributes,void 0,r);if(o===!1||o===null)return null;const{tr:i}=e,s=r[r.length-1],l=r[0];if(s){const a=l.search(/\S/),c=n.from+l.indexOf(s),u=c+s.length;if(Va(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===t.type&&m!==h.mark.type)).filter(h=>h.to>c).length)return null;u<n.to&&i.delete(u,n.to),c>n.from&&i.delete(n.from+a,c);const f=n.from+a+s.length;i.addMark(n.from+a,f,t.type.create(o||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function vC(t){return new Qr({find:t.find,handler:({state:e,range:n,match:r})=>{const o=X(t.getAttributes,void 0,r)||{},{tr:i}=e,s=n.from;let l=n.to;const a=t.type.create(o);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=s+c;u>l?u=l:l=u+r[1].length;const d=r[0][r[0].length-1];i.insertText(d,s+r[0].length-1),i.replaceWith(u,l,a)}else if(r[0]){const c=t.type.isInline?s:s-1;i.insert(c,t.type.create(o)).delete(i.mapping.map(s),i.mapping.map(l))}i.scrollIntoView()},undoable:t.undoable})}function _l(t){return new Qr({find:t.find,handler:({state:e,range:n,match:r})=>{const o=e.doc.resolve(n.from),i=X(t.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)},undoable:t.undoable})}function he(t){return new Qr({find:t.find,handler:({state:e,range:n,match:r})=>{let o=t.replace,i=n.from;const s=n.to;if(r[1]){const l=r[0].lastIndexOf(r[1]);o+=r[0].slice(l+r[1].length),i+=l;const a=i-s;a>0&&(o=r[0].slice(l-a,l)+o,i=s)}e.tr.insertText(o,i,s)},undoable:t.undoable})}function ir(t){return new Qr({find:t.find,handler:({state:e,range:n,match:r,chain:o})=>{const i=X(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),c=a&&va(a,t.type,i);if(!c)return null;if(s.wrap(a,c),t.keepMarks&&t.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:h}=t.editor.extensionManager,p=f||d.$to.parentOffset&&d.$from.marks();if(p){const m=p.filter(v=>h.includes(v.type.name));s.ensureMarks(m)}}if(t.keepAttributes){const d=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(d,i).run()}const u=s.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&dn(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&s.join(n.from-1)},undoable:t.undoable})}function bC(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof B){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let o=r.depth;for(;o>=0;){const i=r.index(o);if(r.node(o).contentMatchAt(i).matchType(e))return!0;o-=1}return!1}var CC={};Da(CC,{createAtomBlockMarkdownSpec:()=>xC,createBlockMarkdownSpec:()=>wC,createInlineMarkdownSpec:()=>EC,parseAttributes:()=>Ua,parseIndentedBlocks:()=>Hl,renderNestedMarkdownContent:()=>Ka,serializeAttributes:()=>Wa});function Ua(t){if(!t?.trim())return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,c=>(n.push(c),`__QUOTED_${n.length-1}__`)),o=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){const c=o.map(u=>u.trim().slice(1));e.class=c.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const s=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(s)).forEach(([,c,u])=>{var d;const f=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),h=n[f];h&&(e[c]=h.slice(1,-1))});const a=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return a&&a.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function Wa(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function xC(t){const{nodeName:e,name:n,parseAttributes:r=Ua,serializeAttributes:o=Wa,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:l}=t,a=n||e,c=u=>{if(!l)return u;const d={};return l.forEach(f=>{f in u&&(d[f]=u[f])}),d};return{parseMarkdown:(u,d)=>{const f={...i,...u.attributes};return d.createNode(e,f,[])},markdownTokenizer:{name:e,level:"block",start(u){var d;const f=new RegExp(`^:::${a}(?:\\s|$)`,"m"),h=(d=u.match(f))==null?void 0:d.index;return h!==void 0?h:-1},tokenize(u,d,f){const h=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=u.match(h);if(!p)return;const m=p[1]||"",v=r(m);if(!s.find(C=>!(C in v)))return{type:e,raw:p[0],attributes:v}}},renderMarkdown:u=>{const d=c(u.attrs||{}),f=o(d),h=f?` {${f}}`:"";return`:::${a}${h} :::`}}}function wC(t){const{nodeName:e,name:n,getContent:r,parseAttributes:o=Ua,serializeAttributes:i=Wa,defaultAttributes:s={},content:l="block",allowedAttributes:a}=t,c=n||e,u=d=>{if(!a)return d;const f={};return a.forEach(h=>{h in d&&(f[h]=d[h])}),f};return{parseMarkdown:(d,f)=>{let h;if(r){const m=r(d);h=typeof m=="string"?[{type:"text",text:m}]:m}else l==="block"?h=f.parseChildren(d.tokens||[]):h=f.parseInline(d.tokens||[]);const p={...s,...d.attributes};return f.createNode(e,p,h)},markdownTokenizer:{name:e,level:"block",start(d){var f;const h=new RegExp(`^:::${c}`,"m"),p=(f=d.match(h))==null?void 0:f.index;return p!==void 0?p:-1},tokenize(d,f,h){var p;const m=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),v=d.match(m);if(!v)return;const[b,C=""]=v,x=o(C);let w=1;const E=b.length;let k="";const S=/^:::([\w-]*)(\s.*)?/gm,M=d.slice(E);for(S.lastIndex=0;;){const N=S.exec(M);if(N===null)break;const P=N.index,W=N[1];if(!((p=N[2])!=null&&p.endsWith(":::"))){if(W)w+=1;else if(w-=1,w===0){const z=M.slice(0,P);k=z.trim();const H=d.slice(0,E+P+N[0].length);let I=[];if(k)if(l==="block")for(I=h.blockTokens(z),I.forEach(_=>{_.text&&(!_.tokens||_.tokens.length===0)&&(_.tokens=h.inlineTokens(_.text))});I.length>0;){const _=I[I.length-1];if(_.type==="paragraph"&&(!_.text||_.text.trim()===""))I.pop();else break}else I=h.inlineTokens(k);return{type:e,raw:H,attributes:x,content:k,tokens:I}}}}}},renderMarkdown:(d,f)=>{const h=u(d.attrs||{}),p=i(h),m=p?` {${p}}`:"",v=f.renderChildren(d.content||[],`
101
+ `,textSerializers:n={}}=t||{};return Rb(this.state.doc,{blockSeparator:e,textSerializers:{...dp(this.schema),...n}})}get isEmpty(){return Xi(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new pC(e,this)}get $doc(){return this.$pos(0)}};function On(t){return new Qr({find:t.find,handler:({state:e,range:n,match:r})=>{const o=X(t.getAttributes,void 0,r);if(o===!1||o===null)return null;const{tr:i}=e,s=r[r.length-1],l=r[0];if(s){const a=l.search(/\S/),c=n.from+l.indexOf(s),u=c+s.length;if(Va(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===t.type&&m!==h.mark.type)).filter(h=>h.to>c).length)return null;u<n.to&&i.delete(u,n.to),c>n.from&&i.delete(n.from+a,c);const f=n.from+a+s.length;i.addMark(n.from+a,f,t.type.create(o||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function vC(t){return new Qr({find:t.find,handler:({state:e,range:n,match:r})=>{const o=X(t.getAttributes,void 0,r)||{},{tr:i}=e,s=n.from;let l=n.to;const a=t.type.create(o);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=s+c;u>l?u=l:l=u+r[1].length;const d=r[0][r[0].length-1];i.insertText(d,s+r[0].length-1),i.replaceWith(u,l,a)}else if(r[0]){const c=t.type.isInline?s:s-1;i.insert(c,t.type.create(o)).delete(i.mapping.map(s),i.mapping.map(l))}i.scrollIntoView()},undoable:t.undoable})}function _l(t){return new Qr({find:t.find,handler:({state:e,range:n,match:r})=>{const o=e.doc.resolve(n.from),i=X(t.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)},undoable:t.undoable})}function he(t){return new Qr({find:t.find,handler:({state:e,range:n,match:r})=>{let o=t.replace,i=n.from;const s=n.to;if(r[1]){const l=r[0].lastIndexOf(r[1]);o+=r[0].slice(l+r[1].length),i+=l;const a=i-s;a>0&&(o=r[0].slice(l-a,l)+o,i=s)}e.tr.insertText(o,i,s)},undoable:t.undoable})}function ir(t){return new Qr({find:t.find,handler:({state:e,range:n,match:r,chain:o})=>{const i=X(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),c=a&&va(a,t.type,i);if(!c)return null;if(s.wrap(a,c),t.keepMarks&&t.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:h}=t.editor.extensionManager,p=f||d.$to.parentOffset&&d.$from.marks();if(p){const m=p.filter(v=>h.includes(v.type.name));s.ensureMarks(m)}}if(t.keepAttributes){const d=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(d,i).run()}const u=s.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&dn(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&s.join(n.from-1)},undoable:t.undoable})}function bC(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof B){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let o=r.depth;for(;o>=0;){const i=r.index(o);if(r.node(o).contentMatchAt(i).matchType(e))return!0;o-=1}return!1}var CC={};Da(CC,{createAtomBlockMarkdownSpec:()=>xC,createBlockMarkdownSpec:()=>wC,createInlineMarkdownSpec:()=>EC,parseAttributes:()=>Ua,parseIndentedBlocks:()=>Hl,renderNestedMarkdownContent:()=>Ka,serializeAttributes:()=>Wa});function Ua(t){if(!t?.trim())return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,c=>(n.push(c),`__QUOTED_${n.length-1}__`)),o=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){const c=o.map(u=>u.trim().slice(1));e.class=c.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const s=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(s)).forEach(([,c,u])=>{var d;const f=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),h=n[f];h&&(e[c]=h.slice(1,-1))});const a=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return a&&a.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function Wa(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function xC(t){const{nodeName:e,name:n,parseAttributes:r=Ua,serializeAttributes:o=Wa,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:l}=t,a=n||e,c=u=>{if(!l)return u;const d={};return l.forEach(f=>{f in u&&(d[f]=u[f])}),d};return{parseMarkdown:(u,d)=>{const f={...i,...u.attributes};return d.createNode(e,f,[])},markdownTokenizer:{name:e,level:"block",start(u){var d;const f=new RegExp(`^:::${a}(?:\\s|$)`,"m"),h=(d=u.match(f))==null?void 0:d.index;return h!==void 0?h:-1},tokenize(u,d,f){const h=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=u.match(h);if(!p)return;const m=p[1]||"",v=r(m);if(!s.find(C=>!(C in v)))return{type:e,raw:p[0],attributes:v}}},renderMarkdown:u=>{const d=c(u.attrs||{}),f=o(d),h=f?` {${f}}`:"";return`:::${a}${h} :::`}}}function wC(t){const{nodeName:e,name:n,getContent:r,parseAttributes:o=Ua,serializeAttributes:i=Wa,defaultAttributes:s={},content:l="block",allowedAttributes:a}=t,c=n||e,u=d=>{if(!a)return d;const f={};return a.forEach(h=>{h in d&&(f[h]=d[h])}),f};return{parseMarkdown:(d,f)=>{let h;if(r){const m=r(d);h=typeof m=="string"?[{type:"text",text:m}]:m}else l==="block"?h=f.parseChildren(d.tokens||[]):h=f.parseInline(d.tokens||[]);const p={...s,...d.attributes};return f.createNode(e,p,h)},markdownTokenizer:{name:e,level:"block",start(d){var f;const h=new RegExp(`^:::${c}`,"m"),p=(f=d.match(h))==null?void 0:f.index;return p!==void 0?p:-1},tokenize(d,f,h){var p;const m=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),v=d.match(m);if(!v)return;const[b,C=""]=v,x=o(C);let w=1;const E=b.length;let k="";const S=/^:::([\w-]*)(\s.*)?/gm,M=d.slice(E);for(S.lastIndex=0;;){const N=S.exec(M);if(N===null)break;const P=N.index,z=N[1];if(!((p=N[2])!=null&&p.endsWith(":::"))){if(z)w+=1;else if(w-=1,w===0){const U=M.slice(0,P);k=U.trim();const H=d.slice(0,E+P+N[0].length);let I=[];if(k)if(l==="block")for(I=h.blockTokens(U),I.forEach(_=>{_.text&&(!_.tokens||_.tokens.length===0)&&(_.tokens=h.inlineTokens(_.text))});I.length>0;){const _=I[I.length-1];if(_.type==="paragraph"&&(!_.text||_.text.trim()===""))I.pop();else break}else I=h.inlineTokens(k);return{type:e,raw:H,attributes:x,content:k,tokens:I}}}}}},renderMarkdown:(d,f)=>{const h=u(d.attrs||{}),p=i(h),m=p?` {${p}}`:"",v=f.renderChildren(d.content||[],`
102
102
 
103
103
  `);return`:::${c}${m}
104
104
 
@@ -153,7 +153,7 @@ ${v}
153
153
  `):""}),bx=je.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",re(this.options.HTMLAttributes,t)]},renderText(){return`
154
154
  `},renderMarkdown:(t,e)=>e.indent(`
155
155
  `),parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:o,storedMarks:i}=n;if(o.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:l}=r.extensionManager,a=i||o.$to.parentOffset&&o.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&s){const d=a.filter(f=>l.includes(f.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Cx=je.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,re(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,o="#".repeat(r);return t.content?`${o} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>_l({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),Lp=je.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",re(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!bC(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,o=t();return hp(n)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({state:i,tr:s,dispatch:l})=>{if(l){const{$to:a}=s.selection,c=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?s.setSelection(V.create(s.doc,a.pos+1)):a.nodeAfter.isBlock?s.setSelection(B.create(s.doc,a.pos)):s.setSelection(V.create(s.doc,a.pos));else{const u=i.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,d=u?.create();d&&(s.insert(c,d),s.setSelection(V.create(s.doc,c+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[vC({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),xx=Lp,wx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Sx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,kx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Ex=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Mx=it.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",re(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[On({find:wx,type:this.type}),On({find:kx,type:this.type})]},addPasteRules(){return[an({find:Sx,type:this.type}),an({find:Ex,type:this.type})]}});const Tx="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Ax="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",$l="numeric",Vl="ascii",zl="alpha",Er="asciinumeric",br="alphanumeric",Ul="domain",Dp="emoji",Rx="scheme",Ox="slashscheme",Ks="whitespace";function Nx(t,e){return t in e||(e[t]=[]),e[t]}function Cn(t,e,n){e[$l]&&(e[Er]=!0,e[br]=!0),e[Vl]&&(e[Er]=!0,e[zl]=!0),e[Er]&&(e[br]=!0),e[zl]&&(e[br]=!0),e[br]&&(e[Ul]=!0),e[Dp]&&(e[Ul]=!0);for(const r in e){const o=Nx(r,n);o.indexOf(t)<0&&o.push(t)}}function Ix(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function _e(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}_e.groups={};_e.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const o=e.jr[r][0],i=e.jr[r][1];if(i&&o.test(t))return i}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let o=0;o<t.length;o++)this.tt(t[o],e,n,r)},tr(t,e,n,r){r=r||_e.groups;let o;return e&&e.j?o=e:(o=new _e(e),n&&r&&Cn(e,n,r)),this.jr.push([t,o]),o},ts(t,e,n,r){let o=this;const i=t.length;if(!i)return o;for(let s=0;s<i-1;s++)o=o.tt(t[s]);return o.tt(t[i-1],e,n,r)},tt(t,e,n,r){r=r||_e.groups;const o=this;if(e&&e.j)return o.j[t]=e,e;const i=e;let s,l=o.go(t);if(l?(s=new _e,Object.assign(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new _e,i){if(r)if(s.t&&typeof s.t=="string"){const a=Object.assign(Ix(s.t,r),n);Cn(i,a,r)}else n&&Cn(i,n,r);s.t=i}return o.j[t]=s,s}};const G=(t,e,n,r,o)=>t.ta(e,n,r,o),ue=(t,e,n,r,o)=>t.tr(e,n,r,o),vd=(t,e,n,r,o)=>t.ts(e,n,r,o),O=(t,e,n,r,o)=>t.tt(e,n,r,o),St="WORD",Wl="UWORD",Pp="ASCIINUMERICAL",jp="ALPHANUMERICAL",$r="LOCALHOST",Kl="TLD",ql="UTLD",jo="SCHEME",qn="SLASH_SCHEME",Ga="NUM",Gl="WS",Ja="NL",Mr="OPENBRACE",Tr="CLOSEBRACE",ni="OPENBRACKET",ri="CLOSEBRACKET",oi="OPENPAREN",ii="CLOSEPAREN",si="OPENANGLEBRACKET",li="CLOSEANGLEBRACKET",ai="FULLWIDTHLEFTPAREN",ci="FULLWIDTHRIGHTPAREN",ui="LEFTCORNERBRACKET",di="RIGHTCORNERBRACKET",fi="LEFTWHITECORNERBRACKET",hi="RIGHTWHITECORNERBRACKET",pi="FULLWIDTHLESSTHAN",mi="FULLWIDTHGREATERTHAN",gi="AMPERSAND",yi="APOSTROPHE",vi="ASTERISK",Wt="AT",bi="BACKSLASH",Ci="BACKTICK",xi="CARET",Gt="COLON",Za="COMMA",wi="DOLLAR",st="DOT",Si="EQUALS",Ya="EXCLAMATION",Je="HYPHEN",Ar="PERCENT",ki="PIPE",Ei="PLUS",Mi="POUND",Rr="QUERY",Xa="QUOTE",Bp="FULLWIDTHMIDDLEDOT",Qa="SEMI",lt="SLASH",Or="TILDE",Ti="UNDERSCORE",_p="EMOJI",Ai="SYM";var Hp=Object.freeze({__proto__:null,ALPHANUMERICAL:jp,AMPERSAND:gi,APOSTROPHE:yi,ASCIINUMERICAL:Pp,ASTERISK:vi,AT:Wt,BACKSLASH:bi,BACKTICK:Ci,CARET:xi,CLOSEANGLEBRACKET:li,CLOSEBRACE:Tr,CLOSEBRACKET:ri,CLOSEPAREN:ii,COLON:Gt,COMMA:Za,DOLLAR:wi,DOT:st,EMOJI:_p,EQUALS:Si,EXCLAMATION:Ya,FULLWIDTHGREATERTHAN:mi,FULLWIDTHLEFTPAREN:ai,FULLWIDTHLESSTHAN:pi,FULLWIDTHMIDDLEDOT:Bp,FULLWIDTHRIGHTPAREN:ci,HYPHEN:Je,LEFTCORNERBRACKET:ui,LEFTWHITECORNERBRACKET:fi,LOCALHOST:$r,NL:Ja,NUM:Ga,OPENANGLEBRACKET:si,OPENBRACE:Mr,OPENBRACKET:ni,OPENPAREN:oi,PERCENT:Ar,PIPE:ki,PLUS:Ei,POUND:Mi,QUERY:Rr,QUOTE:Xa,RIGHTCORNERBRACKET:di,RIGHTWHITECORNERBRACKET:hi,SCHEME:jo,SEMI:Qa,SLASH:lt,SLASH_SCHEME:qn,SYM:Ai,TILDE:Or,TLD:Kl,UNDERSCORE:Ti,UTLD:ql,UWORD:Wl,WORD:St,WS:Gl});const xt=/[a-z]/,mr=new RegExp("\\p{L}","u"),qs=new RegExp("\\p{Emoji}","u"),wt=/\d/,Gs=/\s/,bd="\r",Js=`
156
- `,Lx="️",Dx="‍",Zs="";let Co=null,xo=null;function Px(t=[]){const e={};_e.groups=e;const n=new _e;Co==null&&(Co=Cd(Tx)),xo==null&&(xo=Cd(Ax)),O(n,"'",yi),O(n,"{",Mr),O(n,"}",Tr),O(n,"[",ni),O(n,"]",ri),O(n,"(",oi),O(n,")",ii),O(n,"<",si),O(n,">",li),O(n,"(",ai),O(n,")",ci),O(n,"「",ui),O(n,"」",di),O(n,"『",fi),O(n,"』",hi),O(n,"<",pi),O(n,">",mi),O(n,"&",gi),O(n,"*",vi),O(n,"@",Wt),O(n,"`",Ci),O(n,"^",xi),O(n,":",Gt),O(n,",",Za),O(n,"$",wi),O(n,".",st),O(n,"=",Si),O(n,"!",Ya),O(n,"-",Je),O(n,"%",Ar),O(n,"|",ki),O(n,"+",Ei),O(n,"#",Mi),O(n,"?",Rr),O(n,'"',Xa),O(n,"/",lt),O(n,";",Qa),O(n,"~",Or),O(n,"_",Ti),O(n,"\\",bi),O(n,"・",Bp);const r=ue(n,wt,Ga,{[$l]:!0});ue(r,wt,r);const o=ue(r,xt,Pp,{[Er]:!0}),i=ue(r,mr,jp,{[br]:!0}),s=ue(n,xt,St,{[Vl]:!0});ue(s,wt,o),ue(s,xt,s),ue(o,wt,o),ue(o,xt,o);const l=ue(n,mr,Wl,{[zl]:!0});ue(l,xt),ue(l,wt,i),ue(l,mr,l),ue(i,wt,i),ue(i,xt),ue(i,mr,i);const a=O(n,Js,Ja,{[Ks]:!0}),c=O(n,bd,Gl,{[Ks]:!0}),u=ue(n,Gs,Gl,{[Ks]:!0});O(n,Zs,u),O(c,Js,a),O(c,Zs,u),ue(c,Gs,u),O(u,bd),O(u,Js),ue(u,Gs,u),O(u,Zs,u);const d=ue(n,qs,_p,{[Dp]:!0});O(d,"#"),ue(d,qs,d),O(d,Lx,d);const f=O(d,Dx);O(f,"#"),ue(f,qs,d);const h=[[xt,s],[wt,o]],p=[[xt,null],[mr,l],[wt,i]];for(let m=0;m<Co.length;m++)Ft(n,Co[m],Kl,St,h);for(let m=0;m<xo.length;m++)Ft(n,xo[m],ql,Wl,p);Cn(Kl,{tld:!0,ascii:!0},e),Cn(ql,{utld:!0,alpha:!0},e),Ft(n,"file",jo,St,h),Ft(n,"mailto",jo,St,h),Ft(n,"http",qn,St,h),Ft(n,"https",qn,St,h),Ft(n,"ftp",qn,St,h),Ft(n,"ftps",qn,St,h),Cn(jo,{scheme:!0,ascii:!0},e),Cn(qn,{slashscheme:!0,ascii:!0},e),t=t.sort((m,v)=>m[0]>v[0]?1:-1);for(let m=0;m<t.length;m++){const v=t[m][0],C=t[m][1]?{[Rx]:!0}:{[Ox]:!0};v.indexOf("-")>=0?C[Ul]=!0:xt.test(v)?wt.test(v)?C[Er]=!0:C[Vl]=!0:C[$l]=!0,vd(n,v,v,C)}return vd(n,"localhost",$r,{ascii:!0}),n.jd=new _e(Ai),{start:n,tokens:Object.assign({groups:e},Hp)}}function Fp(t,e){const n=jx(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,o=[];let i=0,s=0;for(;s<r;){let l=t,a=null,c=0,u=null,d=-1,f=-1;for(;s<r&&(a=l.go(n[s]));)l=a,l.accepts()?(d=0,f=0,u=l):d>=0&&(d+=n[s].length,f++),c+=n[s].length,i+=n[s].length,s++;i-=d,s-=f,c-=d,o.push({t:u.t,v:e.slice(i-c,i),s:i-c,e:i})}return o}function jx(t){const e=[],n=t.length;let r=0;for(;r<n;){let o=t.charCodeAt(r),i,s=o<55296||o>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function Ft(t,e,n,r,o){let i;const s=e.length;for(let l=0;l<s-1;l++){const a=e[l];t.j[a]?i=t.j[a]:(i=new _e(r),i.jr=o.slice(),t.j[a]=i),t=i}return i=new _e(n),i.jr=o.slice(),t.j[e[s-1]]=i,i}function Cd(t){const e=[],n=[];let r=0,o="0123456789";for(;r<t.length;){let i=0;for(;o.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+i),10);s>0;s--)n.pop();r+=i}else n.push(t[r]),r++}return e}const Vr={defaultProtocol:"http",events:null,format:xd,formatHref:xd,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function ec(t,e=null){let n=Object.assign({},Vr);t&&(n=Object.assign(n,t instanceof ec?t.o:t));const r=n.ignoreTags,o=[];for(let i=0;i<r.length;i++)o.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=o}ec.prototype={o:Vr,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let o=this.o[t];return o&&(typeof o=="object"?(o=n.t in o?o[n.t]:Vr[t],typeof o=="function"&&r&&(o=o(e,n))):typeof o=="function"&&r&&(o=o(e,n.t,n)),o)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function xd(t){return t}function $p(t,e){this.t="token",this.v=t,this.tk=e}$p.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Vr.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),o=t.get("tagName",n,e),i=this.toFormattedString(t),s={},l=t.get("className",n,e),a=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return s.href=r,l&&(s.class=l),a&&(s.target=a),c&&(s.rel=c),u&&Object.assign(s,u),{tagName:o,attributes:s,content:i,eventListeners:d}}};function es(t,e){class n extends $p{constructor(o,i){super(o,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const wd=es("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Sd=es("text"),Bx=es("nl"),wo=es("url",{isLink:!0,toHref(t=Vr.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==$r&&t[1].t===Gt}}),qe=t=>new _e(t);function _x({groups:t}){const e=t.domain.concat([gi,vi,Wt,bi,Ci,xi,wi,Si,Je,Ga,Ar,ki,Ei,Mi,lt,Ai,Or,Ti]),n=[yi,Gt,Za,st,Ya,Ar,Rr,Xa,Qa,si,li,Mr,Tr,ri,ni,oi,ii,ai,ci,ui,di,fi,hi,pi,mi],r=[gi,yi,vi,bi,Ci,xi,wi,Si,Je,Mr,Tr,Ar,ki,Ei,Mi,Rr,lt,Ai,Or,Ti],o=qe(),i=O(o,Or);G(i,r,i),G(i,t.domain,i);const s=qe(),l=qe(),a=qe();G(o,t.domain,s),G(o,t.scheme,l),G(o,t.slashscheme,a),G(s,r,i),G(s,t.domain,s);const c=O(s,Wt);O(i,Wt,c),O(l,Wt,c),O(a,Wt,c);const u=O(i,st);G(u,r,i),G(u,t.domain,i);const d=qe();G(c,t.domain,d),G(d,t.domain,d);const f=O(d,st);G(f,t.domain,d);const h=qe(wd);G(f,t.tld,h),G(f,t.utld,h),O(c,$r,h);const p=O(d,Je);O(p,Je,p),G(p,t.domain,d),G(h,t.domain,d),O(h,st,f),O(h,Je,p);const m=O(h,Gt);G(m,t.numeric,wd);const v=O(s,Je),b=O(s,st);O(v,Je,v),G(v,t.domain,s),G(b,r,i),G(b,t.domain,s);const C=qe(wo);G(b,t.tld,C),G(b,t.utld,C),G(C,t.domain,s),G(C,r,i),O(C,st,b),O(C,Je,v),O(C,Wt,c);const x=O(C,Gt),w=qe(wo);G(x,t.numeric,w);const E=qe(wo),k=qe();G(E,e,E),G(E,n,k),G(k,e,E),G(k,n,k),O(C,lt,E),O(w,lt,E);const S=O(l,Gt),M=O(a,Gt),N=O(M,lt),P=O(N,lt);G(l,t.domain,s),O(l,st,b),O(l,Je,v),G(a,t.domain,s),O(a,st,b),O(a,Je,v),G(S,t.domain,E),O(S,lt,E),O(S,Rr,E),G(P,t.domain,E),G(P,e,E),O(P,lt,E);const W=[[Mr,Tr],[ni,ri],[oi,ii],[si,li],[ai,ci],[ui,di],[fi,hi],[pi,mi]];for(let z=0;z<W.length;z++){const[H,I]=W[z],_=O(E,H);O(k,H,_),O(_,I,E);const F=qe(wo);G(_,e,F);const L=qe();G(_,n),G(F,e,F),G(F,n,L),G(L,e,F),G(L,n,L),O(F,I,E),O(L,I,E)}return O(o,$r,C),O(o,Ja,Bx),{start:o,tokens:Hp}}function Hx(t,e,n){let r=n.length,o=0,i=[],s=[];for(;o<r;){let l=t,a=null,c=null,u=0,d=null,f=-1;for(;o<r&&!(a=l.go(n[o].t));)s.push(n[o++]);for(;o<r&&(c=a||l.go(n[o].t));)a=null,l=c,l.accepts()?(f=0,d=l):f>=0&&f++,o++,u++;if(f<0)o-=u,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(Ys(Sd,e,s)),s=[]),o-=f,u-=f;const h=d.t,p=n.slice(o-u,o);i.push(Ys(h,e,p))}}return s.length>0&&i.push(Ys(Sd,e,s)),i}function Ys(t,e,n){const r=n[0].s,o=n[n.length-1].e,i=e.slice(r,o);return new t(i,n)}const Fx=typeof console<"u"&&console&&console.warn||(()=>{}),$x="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",se={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Vx(){return _e.groups={},se.scanner=null,se.parser=null,se.tokenQueue=[],se.pluginQueue=[],se.customSchemes=[],se.initialized=!1,se}function kd(t,e=!1){if(se.initialized&&Fx(`linkifyjs: already initialized - will not register custom scheme "${t}" ${$x}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
156
+ `,Lx="️",Dx="‍",Zs="";let Co=null,xo=null;function Px(t=[]){const e={};_e.groups=e;const n=new _e;Co==null&&(Co=Cd(Tx)),xo==null&&(xo=Cd(Ax)),O(n,"'",yi),O(n,"{",Mr),O(n,"}",Tr),O(n,"[",ni),O(n,"]",ri),O(n,"(",oi),O(n,")",ii),O(n,"<",si),O(n,">",li),O(n,"(",ai),O(n,")",ci),O(n,"「",ui),O(n,"」",di),O(n,"『",fi),O(n,"』",hi),O(n,"<",pi),O(n,">",mi),O(n,"&",gi),O(n,"*",vi),O(n,"@",Wt),O(n,"`",Ci),O(n,"^",xi),O(n,":",Gt),O(n,",",Za),O(n,"$",wi),O(n,".",st),O(n,"=",Si),O(n,"!",Ya),O(n,"-",Je),O(n,"%",Ar),O(n,"|",ki),O(n,"+",Ei),O(n,"#",Mi),O(n,"?",Rr),O(n,'"',Xa),O(n,"/",lt),O(n,";",Qa),O(n,"~",Or),O(n,"_",Ti),O(n,"\\",bi),O(n,"・",Bp);const r=ue(n,wt,Ga,{[$l]:!0});ue(r,wt,r);const o=ue(r,xt,Pp,{[Er]:!0}),i=ue(r,mr,jp,{[br]:!0}),s=ue(n,xt,St,{[Vl]:!0});ue(s,wt,o),ue(s,xt,s),ue(o,wt,o),ue(o,xt,o);const l=ue(n,mr,Wl,{[zl]:!0});ue(l,xt),ue(l,wt,i),ue(l,mr,l),ue(i,wt,i),ue(i,xt),ue(i,mr,i);const a=O(n,Js,Ja,{[Ks]:!0}),c=O(n,bd,Gl,{[Ks]:!0}),u=ue(n,Gs,Gl,{[Ks]:!0});O(n,Zs,u),O(c,Js,a),O(c,Zs,u),ue(c,Gs,u),O(u,bd),O(u,Js),ue(u,Gs,u),O(u,Zs,u);const d=ue(n,qs,_p,{[Dp]:!0});O(d,"#"),ue(d,qs,d),O(d,Lx,d);const f=O(d,Dx);O(f,"#"),ue(f,qs,d);const h=[[xt,s],[wt,o]],p=[[xt,null],[mr,l],[wt,i]];for(let m=0;m<Co.length;m++)Ft(n,Co[m],Kl,St,h);for(let m=0;m<xo.length;m++)Ft(n,xo[m],ql,Wl,p);Cn(Kl,{tld:!0,ascii:!0},e),Cn(ql,{utld:!0,alpha:!0},e),Ft(n,"file",jo,St,h),Ft(n,"mailto",jo,St,h),Ft(n,"http",qn,St,h),Ft(n,"https",qn,St,h),Ft(n,"ftp",qn,St,h),Ft(n,"ftps",qn,St,h),Cn(jo,{scheme:!0,ascii:!0},e),Cn(qn,{slashscheme:!0,ascii:!0},e),t=t.sort((m,v)=>m[0]>v[0]?1:-1);for(let m=0;m<t.length;m++){const v=t[m][0],C=t[m][1]?{[Rx]:!0}:{[Ox]:!0};v.indexOf("-")>=0?C[Ul]=!0:xt.test(v)?wt.test(v)?C[Er]=!0:C[Vl]=!0:C[$l]=!0,vd(n,v,v,C)}return vd(n,"localhost",$r,{ascii:!0}),n.jd=new _e(Ai),{start:n,tokens:Object.assign({groups:e},Hp)}}function Fp(t,e){const n=jx(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,o=[];let i=0,s=0;for(;s<r;){let l=t,a=null,c=0,u=null,d=-1,f=-1;for(;s<r&&(a=l.go(n[s]));)l=a,l.accepts()?(d=0,f=0,u=l):d>=0&&(d+=n[s].length,f++),c+=n[s].length,i+=n[s].length,s++;i-=d,s-=f,c-=d,o.push({t:u.t,v:e.slice(i-c,i),s:i-c,e:i})}return o}function jx(t){const e=[],n=t.length;let r=0;for(;r<n;){let o=t.charCodeAt(r),i,s=o<55296||o>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function Ft(t,e,n,r,o){let i;const s=e.length;for(let l=0;l<s-1;l++){const a=e[l];t.j[a]?i=t.j[a]:(i=new _e(r),i.jr=o.slice(),t.j[a]=i),t=i}return i=new _e(n),i.jr=o.slice(),t.j[e[s-1]]=i,i}function Cd(t){const e=[],n=[];let r=0,o="0123456789";for(;r<t.length;){let i=0;for(;o.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+i),10);s>0;s--)n.pop();r+=i}else n.push(t[r]),r++}return e}const Vr={defaultProtocol:"http",events:null,format:xd,formatHref:xd,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function ec(t,e=null){let n=Object.assign({},Vr);t&&(n=Object.assign(n,t instanceof ec?t.o:t));const r=n.ignoreTags,o=[];for(let i=0;i<r.length;i++)o.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=o}ec.prototype={o:Vr,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let o=this.o[t];return o&&(typeof o=="object"?(o=n.t in o?o[n.t]:Vr[t],typeof o=="function"&&r&&(o=o(e,n))):typeof o=="function"&&r&&(o=o(e,n.t,n)),o)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function xd(t){return t}function $p(t,e){this.t="token",this.v=t,this.tk=e}$p.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Vr.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),o=t.get("tagName",n,e),i=this.toFormattedString(t),s={},l=t.get("className",n,e),a=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return s.href=r,l&&(s.class=l),a&&(s.target=a),c&&(s.rel=c),u&&Object.assign(s,u),{tagName:o,attributes:s,content:i,eventListeners:d}}};function es(t,e){class n extends $p{constructor(o,i){super(o,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const wd=es("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Sd=es("text"),Bx=es("nl"),wo=es("url",{isLink:!0,toHref(t=Vr.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==$r&&t[1].t===Gt}}),qe=t=>new _e(t);function _x({groups:t}){const e=t.domain.concat([gi,vi,Wt,bi,Ci,xi,wi,Si,Je,Ga,Ar,ki,Ei,Mi,lt,Ai,Or,Ti]),n=[yi,Gt,Za,st,Ya,Ar,Rr,Xa,Qa,si,li,Mr,Tr,ri,ni,oi,ii,ai,ci,ui,di,fi,hi,pi,mi],r=[gi,yi,vi,bi,Ci,xi,wi,Si,Je,Mr,Tr,Ar,ki,Ei,Mi,Rr,lt,Ai,Or,Ti],o=qe(),i=O(o,Or);G(i,r,i),G(i,t.domain,i);const s=qe(),l=qe(),a=qe();G(o,t.domain,s),G(o,t.scheme,l),G(o,t.slashscheme,a),G(s,r,i),G(s,t.domain,s);const c=O(s,Wt);O(i,Wt,c),O(l,Wt,c),O(a,Wt,c);const u=O(i,st);G(u,r,i),G(u,t.domain,i);const d=qe();G(c,t.domain,d),G(d,t.domain,d);const f=O(d,st);G(f,t.domain,d);const h=qe(wd);G(f,t.tld,h),G(f,t.utld,h),O(c,$r,h);const p=O(d,Je);O(p,Je,p),G(p,t.domain,d),G(h,t.domain,d),O(h,st,f),O(h,Je,p);const m=O(h,Gt);G(m,t.numeric,wd);const v=O(s,Je),b=O(s,st);O(v,Je,v),G(v,t.domain,s),G(b,r,i),G(b,t.domain,s);const C=qe(wo);G(b,t.tld,C),G(b,t.utld,C),G(C,t.domain,s),G(C,r,i),O(C,st,b),O(C,Je,v),O(C,Wt,c);const x=O(C,Gt),w=qe(wo);G(x,t.numeric,w);const E=qe(wo),k=qe();G(E,e,E),G(E,n,k),G(k,e,E),G(k,n,k),O(C,lt,E),O(w,lt,E);const S=O(l,Gt),M=O(a,Gt),N=O(M,lt),P=O(N,lt);G(l,t.domain,s),O(l,st,b),O(l,Je,v),G(a,t.domain,s),O(a,st,b),O(a,Je,v),G(S,t.domain,E),O(S,lt,E),O(S,Rr,E),G(P,t.domain,E),G(P,e,E),O(P,lt,E);const z=[[Mr,Tr],[ni,ri],[oi,ii],[si,li],[ai,ci],[ui,di],[fi,hi],[pi,mi]];for(let U=0;U<z.length;U++){const[H,I]=z[U],_=O(E,H);O(k,H,_),O(_,I,E);const F=qe(wo);G(_,e,F);const L=qe();G(_,n),G(F,e,F),G(F,n,L),G(L,e,F),G(L,n,L),O(F,I,E),O(L,I,E)}return O(o,$r,C),O(o,Ja,Bx),{start:o,tokens:Hp}}function Hx(t,e,n){let r=n.length,o=0,i=[],s=[];for(;o<r;){let l=t,a=null,c=null,u=0,d=null,f=-1;for(;o<r&&!(a=l.go(n[o].t));)s.push(n[o++]);for(;o<r&&(c=a||l.go(n[o].t));)a=null,l=c,l.accepts()?(f=0,d=l):f>=0&&f++,o++,u++;if(f<0)o-=u,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(Ys(Sd,e,s)),s=[]),o-=f,u-=f;const h=d.t,p=n.slice(o-u,o);i.push(Ys(h,e,p))}}return s.length>0&&i.push(Ys(Sd,e,s)),i}function Ys(t,e,n){const r=n[0].s,o=n[n.length-1].e,i=e.slice(r,o);return new t(i,n)}const Fx=typeof console<"u"&&console&&console.warn||(()=>{}),$x="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",se={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Vx(){return _e.groups={},se.scanner=null,se.parser=null,se.tokenQueue=[],se.pluginQueue=[],se.customSchemes=[],se.initialized=!1,se}function kd(t,e=!1){if(se.initialized&&Fx(`linkifyjs: already initialized - will not register custom scheme "${t}" ${$x}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
157
157
  1. Must only contain digits, lowercase ASCII letters or "-"
158
158
  2. Cannot start or end with "-"
159
159
  3. "-" cannot repeat`);se.customSchemes.push([t,e])}function zx(){se.scanner=Px(se.customSchemes);for(let t=0;t<se.tokenQueue.length;t++)se.tokenQueue[t][1]({scanner:se.scanner});se.parser=_x(se.scanner.tokens);for(let t=0;t<se.pluginQueue.length;t++)se.pluginQueue[t][1]({scanner:se.scanner,parser:se.parser});return se.initialized=!0,se}function tc(t){return se.initialized||zx(),Hx(se.parser.start,t,Fp(se.scanner.start,t))}tc.scan=Fp;function Vp(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new ec(n),o=tc(t),i=[];for(let s=0;s<o.length;s++){const l=o[s];l.isLink&&(!e||l.t===e)&&r.check(l)&&i.push(l.toFormattedObject(r))}return i}var nc="[\0-   ᠎ -\u2029  ]",Ux=new RegExp(nc),Wx=new RegExp(`${nc}$`),Kx=new RegExp(nc,"g");function qx(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Gx(t){return new ce({key:new ye("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=r,l=Ba(n.doc,[...e]);if($a(l).forEach(({newRange:c})=>{const u=sp(r.doc,c,h=>h.isTextblock);let d,f;if(u.length>1)d=u[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const h=r.doc.textBetween(c.from,c.to," "," ");if(!Wx.test(h))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const h=f.split(Ux).filter(Boolean);if(h.length<=0)return!1;const p=h[h.length-1],m=d.pos+f.lastIndexOf(p);if(!p)return!1;const v=tc(p).map(b=>b.toObject(t.defaultProtocol));if(!qx(v))return!1;v.filter(b=>b.isLink).map(b=>({...b,from:m+b.start+1,to:m+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>t.validate(b.value)).filter(b=>t.shouldAutoLink(b.value)).forEach(b=>{Va(b.from,b.to,r.doc).some(C=>C.mark.type===t.type)||s.addMark(b.from,b.to,t.type.create({href:b.href}))})}}),!!s.steps.length)return s}})}function Jx(t){return new ce({key:new ye("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,i;if(r.button!==0||!e.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{let u=r.target;const d=[];for(;u.nodeName!=="DIV";)d.push(u),u=u.parentNode;s=d.find(f=>f.nodeName==="A")}if(!s)return!1;const l=fp(e.state,t.type.name),a=(o=s?.href)!=null?o:l.href,c=(i=s?.target)!=null?i:l.target;return t.enableClickSelection&&t.editor.commands.extendMarkRange(t.type.name),s&&a?(window.open(a,c),!0):!1}}})}function Zx(t){return new ce({key:new ye("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:o}=t,{state:i}=e,{selection:s}=i,{empty:l}=s;if(l)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const c=Vp(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!c||o!==void 0&&!o(c.href)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function mn(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!t||t.replace(Kx,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Yx=it.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){kd(t);return}kd(t.scheme,t.optionalSlashes)})},onDestroy(){Vx()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!mn(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!mn(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!mn(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",re(this.options.HTMLAttributes,t),0]:["a",re(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n;const r=((n=t.attrs)==null?void 0:n.href)||"";return`[${e.renderChildren(t)}](${r})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!mn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!mn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[an({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=Vp(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!mn(s,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(Gx({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!mn(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(Jx({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(Zx({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),Xx=Object.defineProperty,Qx=(t,e)=>{for(var n in e)Xx(t,n,{get:e[n],enumerable:!0})},ew="listItem",Ed="textStyle",Md=/^\s*([-+*])\s$/,zp=je.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",re(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
@@ -167,10 +167,10 @@ ${h.slice(c+2)}`,d+=1;else break}e.push({indent:c,number:parseInt(l,10),content:
167
167
  `):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e?.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const o=t.split(`
168
168
  `),[i,s]=ow(o);if(i.length===0)return;const l=Yp(i,0,n);return l.length===0?void 0:{type:"list",ordered:!0,start:((r=i[0])==null?void 0:r.number)||1,items:l,raw:o.slice(0,s).join(`
169
169
  `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(sw,this.editor.getAttributes(Ad)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=ir({find:Rd,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=ir({find:Rd,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Ad)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),lw=/^\s*(\[([( |x])?\])\s$/,Qp=je.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",re(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const o=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return Ka(t,e,o)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),c=u=>{var d,f;l.ariaLabel=((f=(d=this.options.a11y)==null?void 0:d.checkboxLabel)==null?void 0:f.call(d,u,l.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`};return c(t),i.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",u=>u.preventDefault()),l.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:d}=u.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const h=n();if(typeof h!="number")return!1;const p=f.doc.nodeAt(h);return f.setNodeMarkup(h,void 0,{...p?.attrs,checked:d}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,d)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,d])=>{o.setAttribute(u,d)}),o.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,i.append(l,s),o.append(i,a),Object.entries(e).forEach(([u,d])=>{o.setAttribute(u,d)}),{dom:o,contentDOM:a,update:u=>u.type!==this.type?!1:(o.dataset.checked=u.attrs.checked,l.checked=u.attrs.checked,c(u),!0)}}},addInputRules(){return[ir({find:lw,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),em=je.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",re(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
170
- `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=i=>{const s=Hl(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},n);return s?[{type:"taskList",raw:s.raw,items:s.items}]:n.blockTokens(i)},o=Hl(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,s)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:s}),customNestedParser:r},n);if(o)return{type:"taskList",raw:o.raw,items:o.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Q.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(zp.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(Up.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(Zp.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(Xp.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(Qp.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(em.configure(this.options.taskList)),t}});var aw=je.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",re(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];return n.length===1&&n[0].type==="image"?e.parseChildren([n[0]]):e.createNode("paragraph",void 0,e.parseInline(n))},renderMarkdown:(t,e)=>!t||!Array.isArray(t.content)?"":e.renderChildren(t.content),addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),cw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,uw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,dw=it.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",re(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[On({find:cw,type:this.type})]},addPasteRules(){return[an({find:uw,type:this.type})]}}),fw=je.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),hw=it.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",re(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const o=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!o)return;const i=o[2].trim();return{type:"underline",raw:o[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function pw(t={}){return new ce({view(e){return new mw(e,t)}})}class mw{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return e.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,o=this.editorView.dom,i=o.getBoundingClientRect(),s=i.width/o.offsetWidth,l=i.height/o.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let p=h.getBoundingClientRect(),m=d?p.bottom:p.top;d&&f&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let v=this.width/2*l;r={left:p.left,right:p.right,top:m-v,bottom:m+v}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*s;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=a.getBoundingClientRect(),f=d.width/a.offsetWidth,h=d.height/a.offsetHeight;c=d.left-a.scrollLeft*f,u=d.top-a.scrollTop*h}this.element.style.left=(r.left-c)/s+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,n,e):o;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Yf(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class de extends q{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return de.valid(r)?new de(r):q.near(r)}content(){return D.empty}eq(e){return e instanceof de&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new de(e.resolve(n.pos))}getBookmark(){return new oc(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!gw(e)||!yw(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&de.valid(e))return e;let o=e.pos,i=null;for(let s=e.depth;;s--){let l=e.node(s);if(n>0?e.indexAfter(s)<l.childCount:e.index(s)>0){i=l.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;o+=n;let a=e.doc.resolve(o);if(de.valid(a))return a}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!B.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*n),r=!1;continue e}break}i=s,o+=n;let l=e.doc.resolve(o);if(de.valid(l))return l}return null}}}de.prototype.visible=!1;de.findFrom=de.findGapCursorFrom;q.jsonID("gapcursor",de);class oc{constructor(e){this.pos=e}map(e){return new oc(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return de.valid(n)?new de(n):q.near(n)}}function tm(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function gw(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||tm(o.type))return!0;if(o.inlineContent)return!1}}return!0}function yw(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||tm(o.type))return!0;if(o.inlineContent)return!1}}return!0}function vw(){return new ce({props:{decorations:ww,createSelectionBetween(t,e,n){return e.pos==n.pos&&de.valid(n)?new de(n):null},handleClick:Cw,handleKeyDown:bw,handleDOMEvents:{beforeinput:xw}}})}const bw=Yh({ArrowLeft:So("horiz",-1),ArrowRight:So("horiz",1),ArrowUp:So("vert",-1),ArrowDown:So("vert",1)});function So(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,i){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof V){if(!i.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=de.findGapCursorFrom(l,e,a);return c?(o&&o(r.tr.setSelection(new de(c))),!0):!1}}function Cw(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!de.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&B.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new de(r))),!0)}function xw(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof de))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let o=A.empty;for(let s=r.length-1;s>=0;s--)o=A.from(r[s].createAndFill(null,o));let i=t.state.tr.replace(n.pos,n.pos,new D(o,0,0));return i.setSelection(V.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function ww(t){if(!(t.selection instanceof de))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ae.create(t.doc,[Ie.widget(t.selection.head,e,{key:"gapcursor"})])}var Ri=200,Ce=function(){};Ce.prototype.append=function(e){return e.length?(e=Ce.from(e),!this.length&&e||e.length<Ri&&this.leafAppend(e)||this.length<Ri&&e.leafPrepend(this)||this.appendInner(e)):this};Ce.prototype.prepend=function(e){return e.length?Ce.from(e).append(this):this};Ce.prototype.appendInner=function(e){return new Sw(this,e)};Ce.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Ce.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Ce.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Ce.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Ce.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(e(i,s))},n,r),o};Ce.from=function(e){return e instanceof Ce?e:e&&e.length?new nm(e):Ce.empty};var nm=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,s,l){for(var a=i;a<s;a++)if(o(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(o,i,s,l){for(var a=i-1;a>=s;a--)if(o(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=Ri)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=Ri)return new e(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Ce);Ce.empty=new nm([]);var Sw=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,o,i,s){var l=this.left.length;if(o<l&&this.left.forEachInner(r,o,Math.min(i,l),s)===!1||i>l&&this.right.forEachInner(r,Math.max(o-l,0),Math.min(this.length,i)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,s){var l=this.left.length;if(o>l&&this.right.forEachInvertedInner(r,o-l,Math.max(i,l)-l,s+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(o,l),i,s)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(Ce);const kw=500;class nt{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new $t(d.map));let h=d.step.map(o.slice(i)),p;h&&s.maybeStep(h).doc&&(p=s.mapping.maps[s.mapping.maps.length-1],c.push(new $t(p,void 0,void 0,c.length+u.length))),i--,p&&o.appendMap(p,i)}else s.maybeStep(d.step);if(d.selection)return l=o?d.selection.map(o.slice(i)):d.selection,a=new nt(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,n,r,o){let i=[],s=this.eventCount,l=this.items,a=!o&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new $t(e.mapping.maps[u],d,n),h;(h=a&&a.merge(f))&&(f=h,u?i.pop():l=l.slice(0,l.length-1)),i.push(f),n&&(s++,n=void 0),o||(a=f)}let c=s-r.depth;return c>Mw&&(l=Ew(l,c),s-=c),new nt(l.append(i),s)}remapping(e,n){let r=new Lr;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new nt(this.items.append(e.map(n=>new $t(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),i=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},o);let a=n;this.items.forEach(f=>{let h=i.getMirror(--a);if(h==null)return;s=Math.min(s,h);let p=i.maps[h];if(f.step){let m=e.steps[h].invert(e.docs[h]),v=f.selection&&f.selection.map(i.slice(a+1,h));v&&l++,r.push(new $t(p,m,v))}else r.push(new $t(p))},o);let c=[];for(let f=n;f<s;f++)c.push(new $t(i.maps[f]));let u=this.items.slice(0,o).append(c).append(r),d=new nt(u,l);return d.emptyItemCount()>kw&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,o=[],i=0;return this.items.forEach((s,l)=>{if(l>=e)o.push(s),s.selection&&i++;else if(s.step){let a=s.step.map(n.slice(r)),c=a&&a.getMap();if(r--,c&&n.appendMap(c,r),a){let u=s.selection&&s.selection.map(n.slice(r));u&&i++;let d=new $t(c.invert(),a,u),f,h=o.length-1;(f=o.length&&o[h].merge(d))?o[h]=f:o.push(d)}}else s.map&&r--},this.items.length,0),new nt(Ce.from(o.reverse()),i)}}nt.empty=new nt(Ce.empty,0);function Ew(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}let $t=class rm{constructor(e,n,r,o){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new rm(n.getMap().invert(),n,this.selection)}}};class Kt{constructor(e,n,r,o,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const Mw=20;function Tw(t,e,n,r){let o=n.getMeta(En),i;if(o)return o.historyState;n.getMeta(Ow)&&(t=new Kt(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(En))return s.getMeta(En).redo?new Kt(t.done.addTransform(n,void 0,r,Bo(e)),t.undone,Od(n.mapping.maps),t.prevTime,t.prevComposition):new Kt(t.done,t.undone.addTransform(n,void 0,r,Bo(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!s&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!Aw(n,t.prevRanges)),c=s?Xs(t.prevRanges,n.mapping):Od(n.mapping.maps);return new Kt(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,Bo(e)),nt.empty,c,n.time,l??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Kt(t.done.rebased(n,i),t.undone.rebased(n,i),Xs(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Kt(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Xs(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Aw(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&o>=e[i]&&(n=!0)}),n}function Od(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,o,i,s)=>e.push(i,s));return e}function Xs(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function Rw(t,e,n){let r=Bo(e),o=En.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),l=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),o,r),a=new Kt(n?l:i.remaining,n?i.remaining:l,null,0,-1);return i.transform.setSelection(s).setMeta(En,{redo:n,historyState:a})}let Qs=!1,Nd=null;function Bo(t){let e=t.plugins;if(Nd!=e){Qs=!1,Nd=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Qs=!0;break}}return Qs}const En=new ye("history"),Ow=new ye("closeHistory");function Nw(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new ce({key:En,state:{init(){return new Kt(nt.empty,nt.empty,null,0,-1)},apply(e,n,r){return Tw(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?im:r=="historyRedo"?sm:null;return o?(n.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function om(t,e){return(n,r)=>{let o=En.getState(n);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(r){let i=Rw(o,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const im=om(!1,!0),sm=om(!0,!0);Q.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new ce({key:new ye("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const o=this.options.limit;if(o==null||o===0){t=!0;return}const i=this.storage.characters({node:r.doc});if(i>o){const s=i-o,l=0,a=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(l,a);return t=!0,c}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const o=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||o>r&&i>r&&i<=o)return!0;if(o>r&&i>r&&i>o||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=i-r,c=l-a,u=l;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>r)}})]}});var Iw=Q.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[pw(this.options)]}});Q.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new ce({key:new ye("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=e,i=[];if(!n||!r)return ae.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((a,c)=>{if(a.isText)return;if(!(o>=c&&o<=c+a.nodeSize-1))return!1;s+=1});let l=0;return t.descendants((a,c)=>{if(a.isText||!(o>=c&&o<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";i.push(Ie.node(c,c+a.nodeSize,{class:this.options.className}))}),ae.create(t,i)}}})]}});var Lw=Q.create({name:"gapCursor",addProseMirrorPlugins(){return[vw()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=X($(t,"allowGapCursor",n)))!=null?e:null}}});Q.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new ce({key:new ye("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,o=[];if(!n)return null;const i=this.editor.isEmpty;return t.descendants((s,l)=>{const a=r>=l&&r<=l+s.nodeSize,c=!s.isLeaf&&Xi(s);if((a||!this.options.showOnlyCurrent)&&c){const u=[this.options.emptyNodeClass];i&&u.push(this.options.emptyEditorClass);const d=Ie.node(l,l+s.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:l,hasAnchor:a}):this.options.placeholder});o.push(d)}return this.options.includeChildren}),ae.create(t,o)}}})]}});var Dw=Q.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new ce({key:new ye("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||hp(n.selection)||t.view.dragging?null:ae.create(n.doc,[Ie.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Id({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var Pw=Q.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new ye(this.name),n=((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||this.options.node||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,o])=>o).filter(o=>(this.options.notAfter||[]).concat(n).includes(o.name));return[new ce({key:e,appendTransaction:(o,i,s)=>{const{doc:l,tr:a,schema:c}=s,u=e.getState(s),d=l.content.size,f=c.nodes[n];if(u)return a.insert(d,f.create())},state:{init:(o,i)=>{const s=i.tr.doc.lastChild;return!Id({node:s,types:r})},apply:(o,i)=>{if(!o.docChanged)return i;const s=o.doc.lastChild;return!Id({node:s,types:r})}}})]}}),jw=Q.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>im(t,e),redo:()=>({state:t,dispatch:e})=>sm(t,e)}},addProseMirrorPlugins(){return[Nw(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Bw=Q.create({name:"starterKit",addExtensions(){var t,e,n,r;const o=[];return this.options.bold!==!1&&o.push(dx.configure(this.options.bold)),this.options.blockquote!==!1&&o.push(sx.configure(this.options.blockquote)),this.options.bulletList!==!1&&o.push(zp.configure(this.options.bulletList)),this.options.code!==!1&&o.push(px.configure(this.options.code)),this.options.codeBlock!==!1&&o.push(yx.configure(this.options.codeBlock)),this.options.document!==!1&&o.push(vx.configure(this.options.document)),this.options.dropcursor!==!1&&o.push(Iw.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&o.push(Lw.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&o.push(bx.configure(this.options.hardBreak)),this.options.heading!==!1&&o.push(Cx.configure(this.options.heading)),this.options.undoRedo!==!1&&o.push(jw.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&o.push(Lp.configure(this.options.horizontalRule)),this.options.italic!==!1&&o.push(Mx.configure(this.options.italic)),this.options.listItem!==!1&&o.push(Up.configure(this.options.listItem)),this.options.listKeymap!==!1&&o.push(Zp.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&o.push(Yx.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&o.push(Xp.configure(this.options.orderedList)),this.options.paragraph!==!1&&o.push(aw.configure(this.options.paragraph)),this.options.strike!==!1&&o.push(dw.configure(this.options.strike)),this.options.text!==!1&&o.push(fw.configure(this.options.text)),this.options.underline!==!1&&o.push(hw.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&o.push(Pw.configure((r=this.options)==null?void 0:r.trailingNode)),o}}),_w=Q.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),Hw=t=>he({find:/--$/,replace:t??"—"}),Fw=t=>he({find:/\.\.\.$/,replace:t??"…"}),$w=t=>he({find:/(?:^|[\s{[(<'"\u2018\u201C])(")$/,replace:t??"“"}),Vw=t=>he({find:/"$/,replace:t??"”"}),zw=t=>he({find:/(?:^|[\s{[(<'"\u2018\u201C])(')$/,replace:t??"‘"}),Uw=t=>he({find:/'$/,replace:t??"’"}),Ww=t=>he({find:/<-$/,replace:t??"←"}),Kw=t=>he({find:/->$/,replace:t??"→"}),qw=t=>he({find:/\(c\)$/,replace:t??"©"}),Gw=t=>he({find:/\(tm\)$/,replace:t??"™"}),Jw=t=>he({find:/\(sm\)$/,replace:t??"℠"}),Zw=t=>he({find:/\(r\)$/,replace:t??"®"}),Yw=t=>he({find:/(?:^|\s)(1\/2)\s$/,replace:t??"½"}),Xw=t=>he({find:/\+\/-$/,replace:t??"±"}),Qw=t=>he({find:/!=$/,replace:t??"≠"}),e7=t=>he({find:/<<$/,replace:t??"«"}),t7=t=>he({find:/>>$/,replace:t??"»"}),n7=t=>he({find:/\d+\s?([*x])\s?\d+$/,replace:t??"×"}),r7=t=>he({find:/\^2$/,replace:t??"²"}),o7=t=>he({find:/\^3$/,replace:t??"³"}),i7=t=>he({find:/(?:^|\s)(1\/4)\s$/,replace:t??"¼"}),s7=t=>he({find:/(?:^|\s)(3\/4)\s$/,replace:t??"¾"}),l7=Q.create({name:"typography",addOptions(){return{closeDoubleQuote:"”",closeSingleQuote:"’",copyright:"©",ellipsis:"…",emDash:"—",laquo:"«",leftArrow:"←",multiplication:"×",notEqual:"≠",oneHalf:"½",oneQuarter:"¼",openDoubleQuote:"“",openSingleQuote:"‘",plusMinus:"±",raquo:"»",registeredTrademark:"®",rightArrow:"→",servicemark:"℠",superscriptThree:"³",superscriptTwo:"²",threeQuarters:"¾",trademark:"™"}},addInputRules(){const t=[];return this.options.emDash!==!1&&t.push(Hw(this.options.emDash)),this.options.ellipsis!==!1&&t.push(Fw(this.options.ellipsis)),this.options.openDoubleQuote!==!1&&t.push($w(this.options.openDoubleQuote)),this.options.closeDoubleQuote!==!1&&t.push(Vw(this.options.closeDoubleQuote)),this.options.openSingleQuote!==!1&&t.push(zw(this.options.openSingleQuote)),this.options.closeSingleQuote!==!1&&t.push(Uw(this.options.closeSingleQuote)),this.options.leftArrow!==!1&&t.push(Ww(this.options.leftArrow)),this.options.rightArrow!==!1&&t.push(Kw(this.options.rightArrow)),this.options.copyright!==!1&&t.push(qw(this.options.copyright)),this.options.trademark!==!1&&t.push(Gw(this.options.trademark)),this.options.servicemark!==!1&&t.push(Jw(this.options.servicemark)),this.options.registeredTrademark!==!1&&t.push(Zw(this.options.registeredTrademark)),this.options.oneHalf!==!1&&t.push(Yw(this.options.oneHalf)),this.options.plusMinus!==!1&&t.push(Xw(this.options.plusMinus)),this.options.notEqual!==!1&&t.push(Qw(this.options.notEqual)),this.options.laquo!==!1&&t.push(e7(this.options.laquo)),this.options.raquo!==!1&&t.push(t7(this.options.raquo)),this.options.multiplication!==!1&&t.push(n7(this.options.multiplication)),this.options.superscriptTwo!==!1&&t.push(r7(this.options.superscriptTwo)),this.options.superscriptThree!==!1&&t.push(o7(this.options.superscriptThree)),this.options.oneQuarter!==!1&&t.push(i7(this.options.oneQuarter)),this.options.threeQuarters!==!1&&t.push(s7(this.options.threeQuarters)),t}}),a7=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,c7=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,u7=it.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",re(this.options.HTMLAttributes,t),0]},renderMarkdown:(t,e)=>`==${e.renderChildren(t)}==`,parseMarkdown:(t,e)=>e.applyMark("highlight",e.parseInline(t.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:t=>t.indexOf("=="),tokenize(t,e,n){const o=/^(==)([^=]+)(==)/.exec(t);if(o){const i=o[2].trim(),s=n.inlineTokens(i);return{type:"highlight",raw:o[0],text:i,tokens:s}}}},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[On({find:a7,type:this.type})]},addPasteRules(){return[an({find:c7,type:this.type})]}}),d7=it.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",re(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),f7=it.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",re(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),we=[];for(var el=0;el<256;++el)we.push((el+256).toString(16).slice(1));function h7(t,e=0){return(we[t[e+0]]+we[t[e+1]]+we[t[e+2]]+we[t[e+3]]+"-"+we[t[e+4]]+we[t[e+5]]+"-"+we[t[e+6]]+we[t[e+7]]+"-"+we[t[e+8]]+we[t[e+9]]+"-"+we[t[e+10]]+we[t[e+11]]+we[t[e+12]]+we[t[e+13]]+we[t[e+14]]+we[t[e+15]]).toLowerCase()}var ko,p7=new Uint8Array(16);function m7(){if(!ko&&(ko=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ko))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ko(p7)}var g7=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Ld={randomUUID:g7};function y7(t,e,n){if(Ld.randomUUID&&!t)return Ld.randomUUID();t=t||{};var r=t.random||(t.rng||m7)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,h7(r)}function v7(t,e=JSON.stringify){const n={};return t.filter(r=>{const o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function b7(t){const e=t.filter((r,o)=>t.indexOf(r)!==o);return v7(e)}var C7=Q.create({name:"uniqueID",priority:1e4,addOptions(){return{attributeName:"id",types:[],generateID:()=>y7(),filterTransaction:null,updateDocument:!0}},addGlobalAttributes(){return[{types:this.options.types,attributes:{[this.options.attributeName]:{default:null,parseHTML:t=>t.getAttribute(`data-${this.options.attributeName}`),renderHTML:t=>t[this.options.attributeName]?{[`data-${this.options.attributeName}`]:t[this.options.attributeName]}:{}}}}]},onCreate(){var t;if(!this.options.updateDocument)return;const e=this.editor.extensionManager.extensions.find(l=>l.name==="collaboration"),n=this.editor.extensionManager.extensions.find(l=>l.name==="collaborationCaret"),o=[e,n].filter(Boolean).find(l=>{var a;return(a=l?.options)==null?void 0:a.provider}),i=(t=o?.options)==null?void 0:t.provider,s=()=>{const{view:l,state:a}=this.editor,{tr:c,doc:u}=a,{types:d,attributeName:f,generateID:h}=this.options;Sb(u,m=>d.includes(m.type.name)&&m.attrs[f]===null).forEach(({node:m,pos:v})=>{c.setNodeMarkup(v,void 0,{...m.attrs,[f]:h({node:m,pos:v})})}),c.setMeta("addToHistory",!1),l.dispatch(c),i&&i.off("synced",s)};if(o){if(!i)return s();i.on("synced",s)}else return s()},addProseMirrorPlugins(){if(!this.options.updateDocument)return[];let t=null,e=!1;return[new ce({key:new ye("uniqueID"),appendTransaction:(n,r,o)=>{const i=n.some(m=>m.docChanged)&&!r.doc.eq(o.doc),s=this.options.filterTransaction&&n.some(m=>{var v,b;return!((b=(v=this.options).filterTransaction)!=null&&b.call(v,m))});if(n.find(m=>m.getMeta("y-sync$"))||!i||s)return;const{tr:a}=o,{types:c,attributeName:u,generateID:d}=this.options,f=Ba(r.doc,n),{mapping:h}=f;if($a(f).forEach(({newRange:m})=>{const v=sp(o.doc,m,C=>c.includes(C.type.name)),b=v.map(({node:C})=>C.attrs[u]).filter(C=>C!==null);v.forEach(({node:C,pos:x},w)=>{var E;const k=(E=a.doc.nodeAt(x))==null?void 0:E.attrs[u];if(k===null){a.setNodeMarkup(x,void 0,{...C.attrs,[u]:d({node:C,pos:x})});return}const S=v[w+1];if(S&&C.content.size===0){if(a.setNodeMarkup(S.pos,void 0,{...S.node.attrs,[u]:k}),b[w+1]=k,S.node.attrs[u])return;const W=d({node:C,pos:x});return a.setNodeMarkup(x,void 0,{...C.attrs,[u]:W}),b[w]=W,a}const M=b7(b),{deleted:N}=h.invert().mapResult(x);N&&M.includes(k)&&a.setNodeMarkup(x,void 0,{...C.attrs,[u]:d({node:C,pos:x})})})}),!!a.steps.length)return a.setStoredMarks(o.tr.storedMarks),a},view(n){const r=o=>{var i;t=(i=n.dom.parentElement)!=null&&i.contains(o.target)?n.dom.parentElement:null};return window.addEventListener("dragstart",r),{destroy(){window.removeEventListener("dragstart",r)}}},props:{handleDOMEvents:{drop:(n,r)=>{var o,i;return(t!==n.dom.parentElement||((o=r.dataTransfer)==null?void 0:o.effectAllowed)==="copyMove"||((i=r.dataTransfer)==null?void 0:i.effectAllowed)==="copy")&&(t=null,e=!0),!1},paste:()=>(e=!0,!1)},transformPasted:n=>{if(!e)return n;const{types:r,attributeName:o}=this.options,i=s=>{const l=[];return s.forEach(a=>{if(a.isText){l.push(a);return}if(!r.includes(a.type.name)){l.push(a.copy(i(a.content)));return}const c=a.type.create({...a.attrs,[o]:null},i(a.content),a.marks);l.push(c)}),A.from(l)};return e=!1,new D(i(n.content),n.openStart,n.openEnd)}}})]}}),x7=C7,w7=20,lm=(t,e=0)=>{const n=[];return!t.children.length||e>w7||Array.from(t.children).forEach(r=>{r.tagName==="SPAN"?n.push(r):r.children.length&&n.push(...lm(r,e+1))}),n},S7=t=>{if(!t.children.length)return;const e=lm(t);e&&e.forEach(n=>{var r,o;const i=n.getAttribute("style"),s=(o=(r=n.parentElement)==null?void 0:r.closest("span"))==null?void 0:o.getAttribute("style");n.setAttribute("style",`${s};${i}`)})},am=it.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&S7(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",re(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,r)=>{if(n.isTextblock)return!0;n.marks.filter(o=>o.type===this.type).some(o=>Object.values(o.attrs).some(i=>!!i))||t.removeMark(r,r+n.nodeSize,this.type)}),!0}}}}),k7=Q.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const n=t.getAttribute("style");if(n){const r=n.split(";").map(o=>o.trim()).filter(Boolean);for(let o=r.length-1;o>=0;o-=1){const i=r[o].split(":");if(i.length>=2){const s=i[0].trim().toLowerCase(),l=i.slice(1).join(":").trim();if(s==="background-color")return l.replace(/['"]+/g,"")}}}return(e=t.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),cm=Q.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const n=t.getAttribute("style");if(n){const r=n.split(";").map(o=>o.trim()).filter(Boolean);for(let o=r.length-1;o>=0;o-=1){const i=r[o].split(":");if(i.length>=2){const s=i[0].trim().toLowerCase(),l=i.slice(1).join(":").trim();if(s==="color")return l.replace(/['"]+/g,"")}}}return(e=t.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),E7=Q.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),M7=Q.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize,renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),T7=Q.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight,renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});Q.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(k7.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(cm.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(E7.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(M7.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(T7.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(am.configure(this.options.textStyle)),t}});function ts(){return typeof window<"u"}function cr(t){return ic(t)?(t.nodeName||"").toLowerCase():"#document"}function Fe(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function mt(t){var e;return(e=(ic(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function ic(t){return ts()?t instanceof Node||t instanceof Fe(t).Node:!1}function oe(t){return ts()?t instanceof Element||t instanceof Fe(t).Element:!1}function Ue(t){return ts()?t instanceof HTMLElement||t instanceof Fe(t).HTMLElement:!1}function Yl(t){return!ts()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Fe(t).ShadowRoot}const A7=new Set(["inline","contents"]);function to(t){const{overflow:e,overflowX:n,overflowY:r,display:o}=tt(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!A7.has(o)}const R7=new Set(["table","td","th"]);function O7(t){return R7.has(cr(t))}const N7=[":popover-open",":modal"];function ns(t){return N7.some(e=>{try{return t.matches(e)}catch{return!1}})}const I7=["transform","translate","scale","rotate","perspective"],L7=["transform","translate","scale","rotate","perspective","filter"],D7=["paint","layout","strict","content"];function sc(t){const e=rs(),n=oe(t)?tt(t):t;return I7.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||L7.some(r=>(n.willChange||"").includes(r))||D7.some(r=>(n.contain||"").includes(r))}function P7(t){let e=Lt(t);for(;Ue(e)&&!It(e);){if(sc(e))return e;if(ns(e))return null;e=Lt(e)}return null}function rs(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const j7=new Set(["html","body","#document"]);function It(t){return j7.has(cr(t))}function tt(t){return Fe(t).getComputedStyle(t)}function is(t){return oe(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Lt(t){if(cr(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Yl(t)&&t.host||mt(t);return Yl(e)?e.host:e}function um(t){const e=Lt(t);return It(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ue(e)&&to(e)?e:um(e)}function rn(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=um(t),i=o===((r=t.ownerDocument)==null?void 0:r.body),s=Fe(o);if(i){const l=Xl(s);return e.concat(s,s.visualViewport||[],to(o)?o:[],l&&n?rn(l):[])}return e.concat(o,rn(o,[],n))}function Xl(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const B7=["top","right","bottom","left"],cn=Math.min,$e=Math.max,Oi=Math.round,Eo=Math.floor,ft=t=>({x:t,y:t}),_7={left:"right",right:"left",bottom:"top",top:"bottom"},H7={start:"end",end:"start"};function Ql(t,e,n){return $e(t,cn(e,n))}function Dt(t,e){return typeof t=="function"?t(e):t}function Pt(t){return t.split("-")[0]}function ur(t){return t.split("-")[1]}function lc(t){return t==="x"?"y":"x"}function ac(t){return t==="y"?"height":"width"}const F7=new Set(["top","bottom"]);function ut(t){return F7.has(Pt(t))?"y":"x"}function cc(t){return lc(ut(t))}function $7(t,e,n){n===void 0&&(n=!1);const r=ur(t),o=cc(t),i=ac(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=Ni(s)),[s,Ni(s)]}function V7(t){const e=Ni(t);return[ea(t),e,ea(e)]}function ea(t){return t.replace(/start|end/g,e=>H7[e])}const Dd=["left","right"],Pd=["right","left"],z7=["top","bottom"],U7=["bottom","top"];function W7(t,e,n){switch(t){case"top":case"bottom":return n?e?Pd:Dd:e?Dd:Pd;case"left":case"right":return e?z7:U7;default:return[]}}function K7(t,e,n,r){const o=ur(t);let i=W7(Pt(t),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),e&&(i=i.concat(i.map(ea)))),i}function Ni(t){return t.replace(/left|right|bottom|top/g,e=>_7[e])}function q7(t){return{top:0,right:0,bottom:0,left:0,...t}}function dm(t){return typeof t!="number"?q7(t):{top:t,right:t,bottom:t,left:t}}function Ii(t){const{x:e,y:n,width:r,height:o}=t;return{width:r,height:o,top:n,left:e,right:e+r,bottom:n+o,x:e,y:n}}/*!
170
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=i=>{const s=Hl(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},n);return s?[{type:"taskList",raw:s.raw,items:s.items}]:n.blockTokens(i)},o=Hl(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,s)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:s}),customNestedParser:r},n);if(o)return{type:"taskList",raw:o.raw,items:o.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Q.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(zp.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(Up.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(Zp.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(Xp.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(Qp.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(em.configure(this.options.taskList)),t}});var aw=je.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",re(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];return n.length===1&&n[0].type==="image"?e.parseChildren([n[0]]):e.createNode("paragraph",void 0,e.parseInline(n))},renderMarkdown:(t,e)=>!t||!Array.isArray(t.content)?"":e.renderChildren(t.content),addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),cw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,uw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,dw=it.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",re(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[On({find:cw,type:this.type})]},addPasteRules(){return[an({find:uw,type:this.type})]}}),fw=je.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),hw=it.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",re(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const o=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!o)return;const i=o[2].trim();return{type:"underline",raw:o[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function pw(t={}){return new ce({view(e){return new mw(e,t)}})}class mw{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return e.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,o=this.editorView.dom,i=o.getBoundingClientRect(),s=i.width/o.offsetWidth,l=i.height/o.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let p=h.getBoundingClientRect(),m=d?p.bottom:p.top;d&&f&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let v=this.width/2*l;r={left:p.left,right:p.right,top:m-v,bottom:m+v}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*s;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=a.getBoundingClientRect(),f=d.width/a.offsetWidth,h=d.height/a.offsetHeight;c=d.left-a.scrollLeft*f,u=d.top-a.scrollTop*h}this.element.style.left=(r.left-c)/s+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,n,e):o;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Yf(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class de extends q{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return de.valid(r)?new de(r):q.near(r)}content(){return D.empty}eq(e){return e instanceof de&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new de(e.resolve(n.pos))}getBookmark(){return new oc(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!gw(e)||!yw(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&de.valid(e))return e;let o=e.pos,i=null;for(let s=e.depth;;s--){let l=e.node(s);if(n>0?e.indexAfter(s)<l.childCount:e.index(s)>0){i=l.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;o+=n;let a=e.doc.resolve(o);if(de.valid(a))return a}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!B.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*n),r=!1;continue e}break}i=s,o+=n;let l=e.doc.resolve(o);if(de.valid(l))return l}return null}}}de.prototype.visible=!1;de.findFrom=de.findGapCursorFrom;q.jsonID("gapcursor",de);class oc{constructor(e){this.pos=e}map(e){return new oc(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return de.valid(n)?new de(n):q.near(n)}}function tm(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function gw(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||tm(o.type))return!0;if(o.inlineContent)return!1}}return!0}function yw(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||tm(o.type))return!0;if(o.inlineContent)return!1}}return!0}function vw(){return new ce({props:{decorations:ww,createSelectionBetween(t,e,n){return e.pos==n.pos&&de.valid(n)?new de(n):null},handleClick:Cw,handleKeyDown:bw,handleDOMEvents:{beforeinput:xw}}})}const bw=Yh({ArrowLeft:So("horiz",-1),ArrowRight:So("horiz",1),ArrowUp:So("vert",-1),ArrowDown:So("vert",1)});function So(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,i){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof V){if(!i.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=de.findGapCursorFrom(l,e,a);return c?(o&&o(r.tr.setSelection(new de(c))),!0):!1}}function Cw(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!de.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&B.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new de(r))),!0)}function xw(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof de))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let o=A.empty;for(let s=r.length-1;s>=0;s--)o=A.from(r[s].createAndFill(null,o));let i=t.state.tr.replace(n.pos,n.pos,new D(o,0,0));return i.setSelection(V.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function ww(t){if(!(t.selection instanceof de))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ae.create(t.doc,[Ie.widget(t.selection.head,e,{key:"gapcursor"})])}var Ri=200,Ce=function(){};Ce.prototype.append=function(e){return e.length?(e=Ce.from(e),!this.length&&e||e.length<Ri&&this.leafAppend(e)||this.length<Ri&&e.leafPrepend(this)||this.appendInner(e)):this};Ce.prototype.prepend=function(e){return e.length?Ce.from(e).append(this):this};Ce.prototype.appendInner=function(e){return new Sw(this,e)};Ce.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Ce.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Ce.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Ce.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Ce.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(e(i,s))},n,r),o};Ce.from=function(e){return e instanceof Ce?e:e&&e.length?new nm(e):Ce.empty};var nm=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,s,l){for(var a=i;a<s;a++)if(o(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(o,i,s,l){for(var a=i-1;a>=s;a--)if(o(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=Ri)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=Ri)return new e(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Ce);Ce.empty=new nm([]);var Sw=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,o,i,s){var l=this.left.length;if(o<l&&this.left.forEachInner(r,o,Math.min(i,l),s)===!1||i>l&&this.right.forEachInner(r,Math.max(o-l,0),Math.min(this.length,i)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,s){var l=this.left.length;if(o>l&&this.right.forEachInvertedInner(r,o-l,Math.max(i,l)-l,s+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(o,l),i,s)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(Ce);const kw=500;class nt{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new $t(d.map));let h=d.step.map(o.slice(i)),p;h&&s.maybeStep(h).doc&&(p=s.mapping.maps[s.mapping.maps.length-1],c.push(new $t(p,void 0,void 0,c.length+u.length))),i--,p&&o.appendMap(p,i)}else s.maybeStep(d.step);if(d.selection)return l=o?d.selection.map(o.slice(i)):d.selection,a=new nt(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,n,r,o){let i=[],s=this.eventCount,l=this.items,a=!o&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new $t(e.mapping.maps[u],d,n),h;(h=a&&a.merge(f))&&(f=h,u?i.pop():l=l.slice(0,l.length-1)),i.push(f),n&&(s++,n=void 0),o||(a=f)}let c=s-r.depth;return c>Mw&&(l=Ew(l,c),s-=c),new nt(l.append(i),s)}remapping(e,n){let r=new Lr;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new nt(this.items.append(e.map(n=>new $t(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),i=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},o);let a=n;this.items.forEach(f=>{let h=i.getMirror(--a);if(h==null)return;s=Math.min(s,h);let p=i.maps[h];if(f.step){let m=e.steps[h].invert(e.docs[h]),v=f.selection&&f.selection.map(i.slice(a+1,h));v&&l++,r.push(new $t(p,m,v))}else r.push(new $t(p))},o);let c=[];for(let f=n;f<s;f++)c.push(new $t(i.maps[f]));let u=this.items.slice(0,o).append(c).append(r),d=new nt(u,l);return d.emptyItemCount()>kw&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,o=[],i=0;return this.items.forEach((s,l)=>{if(l>=e)o.push(s),s.selection&&i++;else if(s.step){let a=s.step.map(n.slice(r)),c=a&&a.getMap();if(r--,c&&n.appendMap(c,r),a){let u=s.selection&&s.selection.map(n.slice(r));u&&i++;let d=new $t(c.invert(),a,u),f,h=o.length-1;(f=o.length&&o[h].merge(d))?o[h]=f:o.push(d)}}else s.map&&r--},this.items.length,0),new nt(Ce.from(o.reverse()),i)}}nt.empty=new nt(Ce.empty,0);function Ew(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}let $t=class rm{constructor(e,n,r,o){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new rm(n.getMap().invert(),n,this.selection)}}};class Kt{constructor(e,n,r,o,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const Mw=20;function Tw(t,e,n,r){let o=n.getMeta(En),i;if(o)return o.historyState;n.getMeta(Ow)&&(t=new Kt(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(En))return s.getMeta(En).redo?new Kt(t.done.addTransform(n,void 0,r,Bo(e)),t.undone,Od(n.mapping.maps),t.prevTime,t.prevComposition):new Kt(t.done,t.undone.addTransform(n,void 0,r,Bo(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!s&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!Aw(n,t.prevRanges)),c=s?Xs(t.prevRanges,n.mapping):Od(n.mapping.maps);return new Kt(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,Bo(e)),nt.empty,c,n.time,l??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Kt(t.done.rebased(n,i),t.undone.rebased(n,i),Xs(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Kt(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Xs(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Aw(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&o>=e[i]&&(n=!0)}),n}function Od(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,o,i,s)=>e.push(i,s));return e}function Xs(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function Rw(t,e,n){let r=Bo(e),o=En.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),l=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),o,r),a=new Kt(n?l:i.remaining,n?i.remaining:l,null,0,-1);return i.transform.setSelection(s).setMeta(En,{redo:n,historyState:a})}let Qs=!1,Nd=null;function Bo(t){let e=t.plugins;if(Nd!=e){Qs=!1,Nd=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Qs=!0;break}}return Qs}const En=new ye("history"),Ow=new ye("closeHistory");function Nw(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new ce({key:En,state:{init(){return new Kt(nt.empty,nt.empty,null,0,-1)},apply(e,n,r){return Tw(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?im:r=="historyRedo"?sm:null;return o?(n.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function om(t,e){return(n,r)=>{let o=En.getState(n);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(r){let i=Rw(o,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const im=om(!1,!0),sm=om(!0,!0);Q.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new ce({key:new ye("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const o=this.options.limit;if(o==null||o===0){t=!0;return}const i=this.storage.characters({node:r.doc});if(i>o){const s=i-o,l=0,a=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(l,a);return t=!0,c}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const o=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||o>r&&i>r&&i<=o)return!0;if(o>r&&i>r&&i>o||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=i-r,c=l-a,u=l;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>r)}})]}});var Iw=Q.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[pw(this.options)]}});Q.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new ce({key:new ye("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=e,i=[];if(!n||!r)return ae.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((a,c)=>{if(a.isText)return;if(!(o>=c&&o<=c+a.nodeSize-1))return!1;s+=1});let l=0;return t.descendants((a,c)=>{if(a.isText||!(o>=c&&o<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";i.push(Ie.node(c,c+a.nodeSize,{class:this.options.className}))}),ae.create(t,i)}}})]}});var Lw=Q.create({name:"gapCursor",addProseMirrorPlugins(){return[vw()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=X($(t,"allowGapCursor",n)))!=null?e:null}}});Q.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new ce({key:new ye("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,o=[];if(!n)return null;const i=this.editor.isEmpty;return t.descendants((s,l)=>{const a=r>=l&&r<=l+s.nodeSize,c=!s.isLeaf&&Xi(s);if((a||!this.options.showOnlyCurrent)&&c){const u=[this.options.emptyNodeClass];i&&u.push(this.options.emptyEditorClass);const d=Ie.node(l,l+s.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:l,hasAnchor:a}):this.options.placeholder});o.push(d)}return this.options.includeChildren}),ae.create(t,o)}}})]}});var Dw=Q.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new ce({key:new ye("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||hp(n.selection)||t.view.dragging?null:ae.create(n.doc,[Ie.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Id({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var Pw=Q.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new ye(this.name),n=((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||this.options.node||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,o])=>o).filter(o=>(this.options.notAfter||[]).concat(n).includes(o.name));return[new ce({key:e,appendTransaction:(o,i,s)=>{const{doc:l,tr:a,schema:c}=s,u=e.getState(s),d=l.content.size,f=c.nodes[n];if(u)return a.insert(d,f.create())},state:{init:(o,i)=>{const s=i.tr.doc.lastChild;return!Id({node:s,types:r})},apply:(o,i)=>{if(!o.docChanged)return i;const s=o.doc.lastChild;return!Id({node:s,types:r})}}})]}}),jw=Q.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>im(t,e),redo:()=>({state:t,dispatch:e})=>sm(t,e)}},addProseMirrorPlugins(){return[Nw(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Bw=Q.create({name:"starterKit",addExtensions(){var t,e,n,r;const o=[];return this.options.bold!==!1&&o.push(dx.configure(this.options.bold)),this.options.blockquote!==!1&&o.push(sx.configure(this.options.blockquote)),this.options.bulletList!==!1&&o.push(zp.configure(this.options.bulletList)),this.options.code!==!1&&o.push(px.configure(this.options.code)),this.options.codeBlock!==!1&&o.push(yx.configure(this.options.codeBlock)),this.options.document!==!1&&o.push(vx.configure(this.options.document)),this.options.dropcursor!==!1&&o.push(Iw.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&o.push(Lw.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&o.push(bx.configure(this.options.hardBreak)),this.options.heading!==!1&&o.push(Cx.configure(this.options.heading)),this.options.undoRedo!==!1&&o.push(jw.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&o.push(Lp.configure(this.options.horizontalRule)),this.options.italic!==!1&&o.push(Mx.configure(this.options.italic)),this.options.listItem!==!1&&o.push(Up.configure(this.options.listItem)),this.options.listKeymap!==!1&&o.push(Zp.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&o.push(Yx.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&o.push(Xp.configure(this.options.orderedList)),this.options.paragraph!==!1&&o.push(aw.configure(this.options.paragraph)),this.options.strike!==!1&&o.push(dw.configure(this.options.strike)),this.options.text!==!1&&o.push(fw.configure(this.options.text)),this.options.underline!==!1&&o.push(hw.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&o.push(Pw.configure((r=this.options)==null?void 0:r.trailingNode)),o}}),_w=Q.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),Hw=t=>he({find:/--$/,replace:t??"—"}),Fw=t=>he({find:/\.\.\.$/,replace:t??"…"}),$w=t=>he({find:/(?:^|[\s{[(<'"\u2018\u201C])(")$/,replace:t??"“"}),Vw=t=>he({find:/"$/,replace:t??"”"}),zw=t=>he({find:/(?:^|[\s{[(<'"\u2018\u201C])(')$/,replace:t??"‘"}),Uw=t=>he({find:/'$/,replace:t??"’"}),Ww=t=>he({find:/<-$/,replace:t??"←"}),Kw=t=>he({find:/->$/,replace:t??"→"}),qw=t=>he({find:/\(c\)$/,replace:t??"©"}),Gw=t=>he({find:/\(tm\)$/,replace:t??"™"}),Jw=t=>he({find:/\(sm\)$/,replace:t??"℠"}),Zw=t=>he({find:/\(r\)$/,replace:t??"®"}),Yw=t=>he({find:/(?:^|\s)(1\/2)\s$/,replace:t??"½"}),Xw=t=>he({find:/\+\/-$/,replace:t??"±"}),Qw=t=>he({find:/!=$/,replace:t??"≠"}),e7=t=>he({find:/<<$/,replace:t??"«"}),t7=t=>he({find:/>>$/,replace:t??"»"}),n7=t=>he({find:/\d+\s?([*x])\s?\d+$/,replace:t??"×"}),r7=t=>he({find:/\^2$/,replace:t??"²"}),o7=t=>he({find:/\^3$/,replace:t??"³"}),i7=t=>he({find:/(?:^|\s)(1\/4)\s$/,replace:t??"¼"}),s7=t=>he({find:/(?:^|\s)(3\/4)\s$/,replace:t??"¾"}),l7=Q.create({name:"typography",addOptions(){return{closeDoubleQuote:"”",closeSingleQuote:"’",copyright:"©",ellipsis:"…",emDash:"—",laquo:"«",leftArrow:"←",multiplication:"×",notEqual:"≠",oneHalf:"½",oneQuarter:"¼",openDoubleQuote:"“",openSingleQuote:"‘",plusMinus:"±",raquo:"»",registeredTrademark:"®",rightArrow:"→",servicemark:"℠",superscriptThree:"³",superscriptTwo:"²",threeQuarters:"¾",trademark:"™"}},addInputRules(){const t=[];return this.options.emDash!==!1&&t.push(Hw(this.options.emDash)),this.options.ellipsis!==!1&&t.push(Fw(this.options.ellipsis)),this.options.openDoubleQuote!==!1&&t.push($w(this.options.openDoubleQuote)),this.options.closeDoubleQuote!==!1&&t.push(Vw(this.options.closeDoubleQuote)),this.options.openSingleQuote!==!1&&t.push(zw(this.options.openSingleQuote)),this.options.closeSingleQuote!==!1&&t.push(Uw(this.options.closeSingleQuote)),this.options.leftArrow!==!1&&t.push(Ww(this.options.leftArrow)),this.options.rightArrow!==!1&&t.push(Kw(this.options.rightArrow)),this.options.copyright!==!1&&t.push(qw(this.options.copyright)),this.options.trademark!==!1&&t.push(Gw(this.options.trademark)),this.options.servicemark!==!1&&t.push(Jw(this.options.servicemark)),this.options.registeredTrademark!==!1&&t.push(Zw(this.options.registeredTrademark)),this.options.oneHalf!==!1&&t.push(Yw(this.options.oneHalf)),this.options.plusMinus!==!1&&t.push(Xw(this.options.plusMinus)),this.options.notEqual!==!1&&t.push(Qw(this.options.notEqual)),this.options.laquo!==!1&&t.push(e7(this.options.laquo)),this.options.raquo!==!1&&t.push(t7(this.options.raquo)),this.options.multiplication!==!1&&t.push(n7(this.options.multiplication)),this.options.superscriptTwo!==!1&&t.push(r7(this.options.superscriptTwo)),this.options.superscriptThree!==!1&&t.push(o7(this.options.superscriptThree)),this.options.oneQuarter!==!1&&t.push(i7(this.options.oneQuarter)),this.options.threeQuarters!==!1&&t.push(s7(this.options.threeQuarters)),t}}),a7=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,c7=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,u7=it.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",re(this.options.HTMLAttributes,t),0]},renderMarkdown:(t,e)=>`==${e.renderChildren(t)}==`,parseMarkdown:(t,e)=>e.applyMark("highlight",e.parseInline(t.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:t=>t.indexOf("=="),tokenize(t,e,n){const o=/^(==)([^=]+)(==)/.exec(t);if(o){const i=o[2].trim(),s=n.inlineTokens(i);return{type:"highlight",raw:o[0],text:i,tokens:s}}}},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[On({find:a7,type:this.type})]},addPasteRules(){return[an({find:c7,type:this.type})]}}),d7=it.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",re(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),f7=it.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",re(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),we=[];for(var el=0;el<256;++el)we.push((el+256).toString(16).slice(1));function h7(t,e=0){return(we[t[e+0]]+we[t[e+1]]+we[t[e+2]]+we[t[e+3]]+"-"+we[t[e+4]]+we[t[e+5]]+"-"+we[t[e+6]]+we[t[e+7]]+"-"+we[t[e+8]]+we[t[e+9]]+"-"+we[t[e+10]]+we[t[e+11]]+we[t[e+12]]+we[t[e+13]]+we[t[e+14]]+we[t[e+15]]).toLowerCase()}var ko,p7=new Uint8Array(16);function m7(){if(!ko&&(ko=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ko))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ko(p7)}var g7=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Ld={randomUUID:g7};function y7(t,e,n){if(Ld.randomUUID&&!t)return Ld.randomUUID();t=t||{};var r=t.random||(t.rng||m7)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,h7(r)}function v7(t,e=JSON.stringify){const n={};return t.filter(r=>{const o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function b7(t){const e=t.filter((r,o)=>t.indexOf(r)!==o);return v7(e)}var C7=Q.create({name:"uniqueID",priority:1e4,addOptions(){return{attributeName:"id",types:[],generateID:()=>y7(),filterTransaction:null,updateDocument:!0}},addGlobalAttributes(){return[{types:this.options.types,attributes:{[this.options.attributeName]:{default:null,parseHTML:t=>t.getAttribute(`data-${this.options.attributeName}`),renderHTML:t=>t[this.options.attributeName]?{[`data-${this.options.attributeName}`]:t[this.options.attributeName]}:{}}}}]},onCreate(){var t;if(!this.options.updateDocument)return;const e=this.editor.extensionManager.extensions.find(l=>l.name==="collaboration"),n=this.editor.extensionManager.extensions.find(l=>l.name==="collaborationCaret"),o=[e,n].filter(Boolean).find(l=>{var a;return(a=l?.options)==null?void 0:a.provider}),i=(t=o?.options)==null?void 0:t.provider,s=()=>{const{view:l,state:a}=this.editor,{tr:c,doc:u}=a,{types:d,attributeName:f,generateID:h}=this.options;Sb(u,m=>d.includes(m.type.name)&&m.attrs[f]===null).forEach(({node:m,pos:v})=>{c.setNodeMarkup(v,void 0,{...m.attrs,[f]:h({node:m,pos:v})})}),c.setMeta("addToHistory",!1),l.dispatch(c),i&&i.off("synced",s)};if(o){if(!i)return s();i.on("synced",s)}else return s()},addProseMirrorPlugins(){if(!this.options.updateDocument)return[];let t=null,e=!1;return[new ce({key:new ye("uniqueID"),appendTransaction:(n,r,o)=>{const i=n.some(m=>m.docChanged)&&!r.doc.eq(o.doc),s=this.options.filterTransaction&&n.some(m=>{var v,b;return!((b=(v=this.options).filterTransaction)!=null&&b.call(v,m))});if(n.find(m=>m.getMeta("y-sync$"))||!i||s)return;const{tr:a}=o,{types:c,attributeName:u,generateID:d}=this.options,f=Ba(r.doc,n),{mapping:h}=f;if($a(f).forEach(({newRange:m})=>{const v=sp(o.doc,m,C=>c.includes(C.type.name)),b=v.map(({node:C})=>C.attrs[u]).filter(C=>C!==null);v.forEach(({node:C,pos:x},w)=>{var E;const k=(E=a.doc.nodeAt(x))==null?void 0:E.attrs[u];if(k===null){a.setNodeMarkup(x,void 0,{...C.attrs,[u]:d({node:C,pos:x})});return}const S=v[w+1];if(S&&C.content.size===0){if(a.setNodeMarkup(S.pos,void 0,{...S.node.attrs,[u]:k}),b[w+1]=k,S.node.attrs[u])return;const z=d({node:C,pos:x});return a.setNodeMarkup(x,void 0,{...C.attrs,[u]:z}),b[w]=z,a}const M=b7(b),{deleted:N}=h.invert().mapResult(x);N&&M.includes(k)&&a.setNodeMarkup(x,void 0,{...C.attrs,[u]:d({node:C,pos:x})})})}),!!a.steps.length)return a.setStoredMarks(o.tr.storedMarks),a},view(n){const r=o=>{var i;t=(i=n.dom.parentElement)!=null&&i.contains(o.target)?n.dom.parentElement:null};return window.addEventListener("dragstart",r),{destroy(){window.removeEventListener("dragstart",r)}}},props:{handleDOMEvents:{drop:(n,r)=>{var o,i;return(t!==n.dom.parentElement||((o=r.dataTransfer)==null?void 0:o.effectAllowed)==="copyMove"||((i=r.dataTransfer)==null?void 0:i.effectAllowed)==="copy")&&(t=null,e=!0),!1},paste:()=>(e=!0,!1)},transformPasted:n=>{if(!e)return n;const{types:r,attributeName:o}=this.options,i=s=>{const l=[];return s.forEach(a=>{if(a.isText){l.push(a);return}if(!r.includes(a.type.name)){l.push(a.copy(i(a.content)));return}const c=a.type.create({...a.attrs,[o]:null},i(a.content),a.marks);l.push(c)}),A.from(l)};return e=!1,new D(i(n.content),n.openStart,n.openEnd)}}})]}}),x7=C7,w7=20,lm=(t,e=0)=>{const n=[];return!t.children.length||e>w7||Array.from(t.children).forEach(r=>{r.tagName==="SPAN"?n.push(r):r.children.length&&n.push(...lm(r,e+1))}),n},S7=t=>{if(!t.children.length)return;const e=lm(t);e&&e.forEach(n=>{var r,o;const i=n.getAttribute("style"),s=(o=(r=n.parentElement)==null?void 0:r.closest("span"))==null?void 0:o.getAttribute("style");n.setAttribute("style",`${s};${i}`)})},am=it.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&S7(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",re(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,r)=>{if(n.isTextblock)return!0;n.marks.filter(o=>o.type===this.type).some(o=>Object.values(o.attrs).some(i=>!!i))||t.removeMark(r,r+n.nodeSize,this.type)}),!0}}}}),k7=Q.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const n=t.getAttribute("style");if(n){const r=n.split(";").map(o=>o.trim()).filter(Boolean);for(let o=r.length-1;o>=0;o-=1){const i=r[o].split(":");if(i.length>=2){const s=i[0].trim().toLowerCase(),l=i.slice(1).join(":").trim();if(s==="background-color")return l.replace(/['"]+/g,"")}}}return(e=t.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),cm=Q.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const n=t.getAttribute("style");if(n){const r=n.split(";").map(o=>o.trim()).filter(Boolean);for(let o=r.length-1;o>=0;o-=1){const i=r[o].split(":");if(i.length>=2){const s=i[0].trim().toLowerCase(),l=i.slice(1).join(":").trim();if(s==="color")return l.replace(/['"]+/g,"")}}}return(e=t.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),E7=Q.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),M7=Q.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize,renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),T7=Q.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight,renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});Q.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(k7.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(cm.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(E7.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(M7.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(T7.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(am.configure(this.options.textStyle)),t}});function ts(){return typeof window<"u"}function cr(t){return ic(t)?(t.nodeName||"").toLowerCase():"#document"}function Fe(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function mt(t){var e;return(e=(ic(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function ic(t){return ts()?t instanceof Node||t instanceof Fe(t).Node:!1}function oe(t){return ts()?t instanceof Element||t instanceof Fe(t).Element:!1}function Ue(t){return ts()?t instanceof HTMLElement||t instanceof Fe(t).HTMLElement:!1}function Yl(t){return!ts()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Fe(t).ShadowRoot}const A7=new Set(["inline","contents"]);function to(t){const{overflow:e,overflowX:n,overflowY:r,display:o}=tt(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!A7.has(o)}const R7=new Set(["table","td","th"]);function O7(t){return R7.has(cr(t))}const N7=[":popover-open",":modal"];function ns(t){return N7.some(e=>{try{return t.matches(e)}catch{return!1}})}const I7=["transform","translate","scale","rotate","perspective"],L7=["transform","translate","scale","rotate","perspective","filter"],D7=["paint","layout","strict","content"];function sc(t){const e=rs(),n=oe(t)?tt(t):t;return I7.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||L7.some(r=>(n.willChange||"").includes(r))||D7.some(r=>(n.contain||"").includes(r))}function P7(t){let e=Lt(t);for(;Ue(e)&&!It(e);){if(sc(e))return e;if(ns(e))return null;e=Lt(e)}return null}function rs(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const j7=new Set(["html","body","#document"]);function It(t){return j7.has(cr(t))}function tt(t){return Fe(t).getComputedStyle(t)}function is(t){return oe(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Lt(t){if(cr(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Yl(t)&&t.host||mt(t);return Yl(e)?e.host:e}function um(t){const e=Lt(t);return It(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ue(e)&&to(e)?e:um(e)}function rn(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=um(t),i=o===((r=t.ownerDocument)==null?void 0:r.body),s=Fe(o);if(i){const l=Xl(s);return e.concat(s,s.visualViewport||[],to(o)?o:[],l&&n?rn(l):[])}return e.concat(o,rn(o,[],n))}function Xl(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const B7=["top","right","bottom","left"],cn=Math.min,$e=Math.max,Oi=Math.round,Eo=Math.floor,ft=t=>({x:t,y:t}),_7={left:"right",right:"left",bottom:"top",top:"bottom"},H7={start:"end",end:"start"};function Ql(t,e,n){return $e(t,cn(e,n))}function Dt(t,e){return typeof t=="function"?t(e):t}function Pt(t){return t.split("-")[0]}function ur(t){return t.split("-")[1]}function lc(t){return t==="x"?"y":"x"}function ac(t){return t==="y"?"height":"width"}const F7=new Set(["top","bottom"]);function ut(t){return F7.has(Pt(t))?"y":"x"}function cc(t){return lc(ut(t))}function $7(t,e,n){n===void 0&&(n=!1);const r=ur(t),o=cc(t),i=ac(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=Ni(s)),[s,Ni(s)]}function V7(t){const e=Ni(t);return[ea(t),e,ea(e)]}function ea(t){return t.replace(/start|end/g,e=>H7[e])}const Dd=["left","right"],Pd=["right","left"],z7=["top","bottom"],U7=["bottom","top"];function W7(t,e,n){switch(t){case"top":case"bottom":return n?e?Pd:Dd:e?Dd:Pd;case"left":case"right":return e?z7:U7;default:return[]}}function K7(t,e,n,r){const o=ur(t);let i=W7(Pt(t),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),e&&(i=i.concat(i.map(ea)))),i}function Ni(t){return t.replace(/left|right|bottom|top/g,e=>_7[e])}function q7(t){return{top:0,right:0,bottom:0,left:0,...t}}function dm(t){return typeof t!="number"?q7(t):{top:t,right:t,bottom:t,left:t}}function Ii(t){const{x:e,y:n,width:r,height:o}=t;return{width:r,height:o,top:n,left:e,right:e+r,bottom:n+o,x:e,y:n}}/*!
171
171
  * tabbable 6.3.0
172
172
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
173
- */var G7=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],ta=G7.join(","),fm=typeof Element>"u",zr=fm?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Li=!fm&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},Ur=function(e,n){var r;n===void 0&&(n=!0);var o=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),i=o===""||o==="true",s=i||n&&e&&Ur(e.parentNode);return s},J7=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},Z7=function(e,n,r){if(Ur(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(ta));return n&&zr.call(e,ta)&&o.unshift(e),o=o.filter(r),o},na=function(e,n,r){for(var o=[],i=Array.from(e);i.length;){var s=i.shift();if(!Ur(s,!1))if(s.tagName==="SLOT"){var l=s.assignedElements(),a=l.length?l:s.children,c=na(a,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:s,candidates:c})}else{var u=zr.call(s,ta);u&&r.filter(s)&&(n||!e.includes(s))&&o.push(s);var d=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),f=!Ur(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(d&&f){var h=na(d===!0?s.children:d.children,!0,r);r.flatten?o.push.apply(o,h):o.push({scopeParent:s,candidates:h})}else i.unshift.apply(i,s.children)}}return o},hm=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},pm=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||J7(e))&&!hm(e)?0:e.tabIndex},Y7=function(e,n){var r=pm(e);return r<0&&n&&!hm(e)?0:r},X7=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},mm=function(e){return e.tagName==="INPUT"},Q7=function(e){return mm(e)&&e.type==="hidden"},e4=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},t4=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},n4=function(e){if(!e.name)return!0;var n=e.form||Li(e),r=function(l){return n.querySelectorAll('input[type="radio"][name="'+l+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(e.name));else try{o=r(e.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var i=t4(o,e.form);return!i||i===e},r4=function(e){return mm(e)&&e.type==="radio"},o4=function(e){return r4(e)&&!n4(e)},i4=function(e){var n,r=e&&Li(e),o=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==e){var s,l,a;for(i=!!((s=o)!==null&&s!==void 0&&(l=s.ownerDocument)!==null&&l!==void 0&&l.contains(o)||e!=null&&(a=e.ownerDocument)!==null&&a!==void 0&&a.contains(e));!i&&o;){var c,u,d;r=Li(o),o=(c=r)===null||c===void 0?void 0:c.host,i=!!((u=o)!==null&&u!==void 0&&(d=u.ownerDocument)!==null&&d!==void 0&&d.contains(o))}}return i},jd=function(e){var n=e.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},s4=function(e,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in e){var i=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!i}if(getComputedStyle(e).visibility==="hidden")return!0;var s=zr.call(e,"details>summary:first-of-type"),l=s?e.parentElement:e;if(zr.call(l,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var a=e;e;){var c=e.parentElement,u=Li(e);if(c&&!c.shadowRoot&&o(c)===!0)return jd(e);e.assignedSlot?e=e.assignedSlot:!c&&u!==e.ownerDocument?e=u.host:e=c}e=a}if(i4(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return jd(e);return!1},l4=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return zr.call(n,"fieldset[disabled] *")?!0:!o.contains(e)}return!0}n=n.parentElement}return!1},a4=function(e,n){return!(n.disabled||Ur(n)||Q7(n)||s4(n,e)||e4(n)||l4(n))},Bd=function(e,n){return!(o4(n)||pm(n)<0||!a4(e,n))},c4=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},gm=function(e){var n=[],r=[];return e.forEach(function(o,i){var s=!!o.scopeParent,l=s?o.scopeParent:o,a=Y7(l,s),c=s?gm(o.candidates):l;a===0?s?n.push.apply(n,c):n.push(l):r.push({documentOrder:i,tabIndex:a,item:o,isScope:s,content:c})}),r.sort(X7).reduce(function(o,i){return i.isScope?o.push.apply(o,i.content):o.push(i.content),o},[]).concat(n)},ym=function(e,n){n=n||{};var r;return n.getShadowRoot?r=na([e],n.includeContainer,{filter:Bd.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:c4}):r=Z7(e,n.includeContainer,Bd.bind(null,n)),gm(r)};function u4(){const t=navigator.userAgentData;return t!=null&&t.platform?t.platform:navigator.platform}function d4(){const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(e=>{let{brand:n,version:r}=e;return n+"/"+r}).join(" "):navigator.userAgent}function vm(){return/apple/i.test(navigator.vendor)}function f4(){return u4().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function h4(){return d4().includes("jsdom/")}const _d="data-floating-ui-focusable",p4="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function ra(t){let e=t.activeElement;for(;((n=e)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;e=e.shadowRoot.activeElement}return e}function sr(t,e){if(!t||!e)return!1;const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&Yl(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function Gn(t){return"composedPath"in t?t.composedPath()[0]:t.target}function tl(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const n=t;return n.target!=null&&e.contains(n.target)}function m4(t){return t.matches("html,body")}function dt(t){return t?.ownerDocument||document}function g4(t){return Ue(t)&&t.matches(p4)}function y4(t){if(!t||h4())return!0;try{return t.matches(":focus-visible")}catch{return!0}}function v4(t){return t?t.hasAttribute(_d)?t:t.querySelector("["+_d+"]")||t:null}function _o(t,e,n){return n===void 0&&(n=!0),t.filter(o=>{var i;return o.parentId===e&&(!n||((i=o.context)==null?void 0:i.open))}).flatMap(o=>[o,..._o(t,o.id,n)])}function b4(t){return"nativeEvent"in t}function oa(t,e){const n=["mouse","pen"];return n.push("",void 0),n.includes(t)}var C4=typeof document<"u",x4=function(){},ot=C4?j.useLayoutEffect:x4;const w4={...y};function Mo(t){const e=y.useRef(t);return ot(()=>{e.current=t}),e}const S4=w4.useInsertionEffect,k4=S4||(t=>t());function at(t){const e=y.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return k4(()=>{e.current=t}),y.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.current==null?void 0:e.current(...r)},[])}const bm=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Cm(t,e){const n=ym(t,bm()),r=n.length;if(r===0)return;const o=ra(dt(t)),i=n.indexOf(o),s=i===-1?e===1?0:r-1:i+e;return n[s]}function E4(t){return Cm(dt(t).body,1)||t}function M4(t){return Cm(dt(t).body,-1)||t}function nl(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!sr(n,r)}function T4(t){ym(t,bm()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Hd(t){t.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function Fd(t,e,n){let{reference:r,floating:o}=t;const i=ut(e),s=cc(e),l=ac(s),a=Pt(e),c=i==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[l]/2-o[l]/2;let h;switch(a){case"top":h={x:u,y:r.y-o.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-o.width,y:d};break;default:h={x:r.x,y:r.y}}switch(ur(e)){case"start":h[s]-=f*(n&&c?-1:1);break;case"end":h[s]+=f*(n&&c?-1:1);break}return h}const A4=async(t,e,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,l=i.filter(Boolean),a=await(s.isRTL==null?void 0:s.isRTL(e));let c=await s.getElementRects({reference:t,floating:e,strategy:o}),{x:u,y:d}=Fd(c,r,a),f=r,h={},p=0;for(let m=0;m<l.length;m++){const{name:v,fn:b}=l[m],{x:C,y:x,data:w,reset:E}=await b({x:u,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:h,rects:c,platform:s,elements:{reference:t,floating:e}});u=C??u,d=x??d,h={...h,[v]:{...h[v],...w}},E&&p<=50&&(p++,typeof E=="object"&&(E.placement&&(f=E.placement),E.rects&&(c=E.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:o}):E.rects),{x:u,y:d}=Fd(c,f,a)),m=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:h}};async function Wr(t,e){var n;e===void 0&&(e={});const{x:r,y:o,platform:i,rects:s,elements:l,strategy:a}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=Dt(e,t),p=dm(h),v=l[f?d==="floating"?"reference":"floating":d],b=Ii(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),C=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),w=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},E=Ii(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:C,offsetParent:x,strategy:a}):C);return{top:(b.top-E.top+p.top)/w.y,bottom:(E.bottom-b.bottom+p.bottom)/w.y,left:(b.left-E.left+p.left)/w.x,right:(E.right-b.right+p.right)/w.x}}const R4=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:o,rects:i,platform:s,elements:l,middlewareData:a}=e,{element:c,padding:u=0}=Dt(t,e)||{};if(c==null)return{};const d=dm(u),f={x:n,y:r},h=cc(o),p=ac(h),m=await s.getDimensions(c),v=h==="y",b=v?"top":"left",C=v?"bottom":"right",x=v?"clientHeight":"clientWidth",w=i.reference[p]+i.reference[h]-f[h]-i.floating[p],E=f[h]-i.reference[h],k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let S=k?k[x]:0;(!S||!await(s.isElement==null?void 0:s.isElement(k)))&&(S=l.floating[x]||i.floating[p]);const M=w/2-E/2,N=S/2-m[p]/2-1,P=cn(d[b],N),W=cn(d[C],N),z=P,H=S-m[p]-W,I=S/2-m[p]/2+M,_=Ql(z,I,H),F=!a.arrow&&ur(o)!=null&&I!==_&&i.reference[p]/2-(I<z?P:W)-m[p]/2<0,L=F?I<z?I-z:I-H:0;return{[h]:f[h]+L,data:{[h]:_,centerOffset:I-_-L,...F&&{alignmentOffset:L}},reset:F}}}),O4=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:l,platform:a,elements:c}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...v}=Dt(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=Pt(o),C=ut(l),x=Pt(l)===l,w=await(a.isRTL==null?void 0:a.isRTL(c.floating)),E=f||(x||!m?[Ni(l)]:V7(l)),k=p!=="none";!f&&k&&E.push(...K7(l,m,p,w));const S=[l,...E],M=await Wr(e,v),N=[];let P=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&N.push(M[b]),d){const I=$7(o,s,w);N.push(M[I[0]],M[I[1]])}if(P=[...P,{placement:o,overflows:N}],!N.every(I=>I<=0)){var W,z;const I=(((W=i.flip)==null?void 0:W.index)||0)+1,_=S[I];if(_&&(!(d==="alignment"?C!==ut(_):!1)||P.every(T=>ut(T.placement)===C?T.overflows[0]>0:!0)))return{data:{index:I,overflows:P},reset:{placement:_}};let F=(z=P.filter(L=>L.overflows[0]<=0).sort((L,T)=>L.overflows[1]-T.overflows[1])[0])==null?void 0:z.placement;if(!F)switch(h){case"bestFit":{var H;const L=(H=P.filter(T=>{if(k){const R=ut(T.placement);return R===C||R==="y"}return!0}).map(T=>[T.placement,T.overflows.filter(R=>R>0).reduce((R,U)=>R+U,0)]).sort((T,R)=>T[1]-R[1])[0])==null?void 0:H[0];L&&(F=L);break}case"initialPlacement":F=l;break}if(o!==F)return{reset:{placement:F}}}return{}}}};function $d(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Vd(t){return B7.some(e=>t[e]>=0)}const N4=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...o}=Dt(t,e);switch(r){case"referenceHidden":{const i=await Wr(e,{...o,elementContext:"reference"}),s=$d(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:Vd(s)}}}case"escaped":{const i=await Wr(e,{...o,altBoundary:!0}),s=$d(i,n.floating);return{data:{escapedOffsets:s,escaped:Vd(s)}}}default:return{}}}}},xm=new Set(["left","top"]);async function I4(t,e){const{placement:n,platform:r,elements:o}=t,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=Pt(n),l=ur(n),a=ut(n)==="y",c=xm.has(s)?-1:1,u=i&&a?-1:1,d=Dt(e,t);let{mainAxis:f,crossAxis:h,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof p=="number"&&(h=l==="end"?p*-1:p),a?{x:h*u,y:f*c}:{x:f*c,y:h*u}}const L4=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:o,y:i,placement:s,middlewareData:l}=e,a=await I4(e,t);return s===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:i+a.y,data:{...a,placement:s}}}}},D4=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:o}=e,{mainAxis:i=!0,crossAxis:s=!1,limiter:l={fn:v=>{let{x:b,y:C}=v;return{x:b,y:C}}},...a}=Dt(t,e),c={x:n,y:r},u=await Wr(e,a),d=ut(Pt(o)),f=lc(d);let h=c[f],p=c[d];if(i){const v=f==="y"?"top":"left",b=f==="y"?"bottom":"right",C=h+u[v],x=h-u[b];h=Ql(C,h,x)}if(s){const v=d==="y"?"top":"left",b=d==="y"?"bottom":"right",C=p+u[v],x=p-u[b];p=Ql(C,p,x)}const m=l.fn({...e,[f]:h,[d]:p});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[f]:i,[d]:s}}}}}},P4=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=e,{offset:l=0,mainAxis:a=!0,crossAxis:c=!0}=Dt(t,e),u={x:n,y:r},d=ut(o),f=lc(d);let h=u[f],p=u[d];const m=Dt(l,e),v=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(a){const x=f==="y"?"height":"width",w=i.reference[f]-i.floating[x]+v.mainAxis,E=i.reference[f]+i.reference[x]-v.mainAxis;h<w?h=w:h>E&&(h=E)}if(c){var b,C;const x=f==="y"?"width":"height",w=xm.has(Pt(o)),E=i.reference[d]-i.floating[x]+(w&&((b=s.offset)==null?void 0:b[d])||0)+(w?0:v.crossAxis),k=i.reference[d]+i.reference[x]+(w?0:((C=s.offset)==null?void 0:C[d])||0)-(w?v.crossAxis:0);p<E?p=E:p>k&&(p=k)}return{[f]:h,[d]:p}}}},j4=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:o,rects:i,platform:s,elements:l}=e,{apply:a=()=>{},...c}=Dt(t,e),u=await Wr(e,c),d=Pt(o),f=ur(o),h=ut(o)==="y",{width:p,height:m}=i.floating;let v,b;d==="top"||d==="bottom"?(v=d,b=f===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(b=d,v=f==="end"?"top":"bottom");const C=m-u.top-u.bottom,x=p-u.left-u.right,w=cn(m-u[v],C),E=cn(p-u[b],x),k=!e.middlewareData.shift;let S=w,M=E;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(M=x),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(S=C),k&&!f){const P=$e(u.left,0),W=$e(u.right,0),z=$e(u.top,0),H=$e(u.bottom,0);h?M=p-2*(P!==0||W!==0?P+W:$e(u.left,u.right)):S=m-2*(z!==0||H!==0?z+H:$e(u.top,u.bottom))}await a({...e,availableWidth:M,availableHeight:S});const N=await s.getDimensions(l.floating);return p!==N.width||m!==N.height?{reset:{rects:!0}}:{}}}};function wm(t){const e=tt(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const o=Ue(t),i=o?t.offsetWidth:n,s=o?t.offsetHeight:r,l=Oi(n)!==i||Oi(r)!==s;return l&&(n=i,r=s),{width:n,height:r,$:l}}function uc(t){return oe(t)?t:t.contextElement}function Qn(t){const e=uc(t);if(!Ue(e))return ft(1);const n=e.getBoundingClientRect(),{width:r,height:o,$:i}=wm(e);let s=(i?Oi(n.width):n.width)/r,l=(i?Oi(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const B4=ft(0);function Sm(t){const e=Fe(t);return!rs()||!e.visualViewport?B4:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function _4(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Fe(t)?!1:e}function Nn(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const o=t.getBoundingClientRect(),i=uc(t);let s=ft(1);e&&(r?oe(r)&&(s=Qn(r)):s=Qn(t));const l=_4(i,n,r)?Sm(i):ft(0);let a=(o.left+l.x)/s.x,c=(o.top+l.y)/s.y,u=o.width/s.x,d=o.height/s.y;if(i){const f=Fe(i),h=r&&oe(r)?Fe(r):r;let p=f,m=Xl(p);for(;m&&r&&h!==p;){const v=Qn(m),b=m.getBoundingClientRect(),C=tt(m),x=b.left+(m.clientLeft+parseFloat(C.paddingLeft))*v.x,w=b.top+(m.clientTop+parseFloat(C.paddingTop))*v.y;a*=v.x,c*=v.y,u*=v.x,d*=v.y,a+=x,c+=w,p=Fe(m),m=Xl(p)}}return Ii({width:u,height:d,x:a,y:c})}function ss(t,e){const n=is(t).scrollLeft;return e?e.left+n:Nn(mt(t)).left+n}function km(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-ss(t,n),o=n.top+e.scrollTop;return{x:r,y:o}}function H4(t){let{elements:e,rect:n,offsetParent:r,strategy:o}=t;const i=o==="fixed",s=mt(r),l=e?ns(e.floating):!1;if(r===s||l&&i)return n;let a={scrollLeft:0,scrollTop:0},c=ft(1);const u=ft(0),d=Ue(r);if((d||!d&&!i)&&((cr(r)!=="body"||to(s))&&(a=is(r)),Ue(r))){const h=Nn(r);c=Qn(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const f=s&&!d&&!i?km(s,a):ft(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-a.scrollTop*c.y+u.y+f.y}}function F4(t){return Array.from(t.getClientRects())}function $4(t){const e=mt(t),n=is(t),r=t.ownerDocument.body,o=$e(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=$e(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+ss(t);const l=-n.scrollTop;return tt(r).direction==="rtl"&&(s+=$e(e.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:l}}const zd=25;function V4(t,e){const n=Fe(t),r=mt(t),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,l=0,a=0;if(o){i=o.width,s=o.height;const u=rs();(!u||u&&e==="fixed")&&(l=o.offsetLeft,a=o.offsetTop)}const c=ss(r);if(c<=0){const u=r.ownerDocument,d=u.body,f=getComputedStyle(d),h=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,p=Math.abs(r.clientWidth-d.clientWidth-h);p<=zd&&(i-=p)}else c<=zd&&(i+=c);return{width:i,height:s,x:l,y:a}}const z4=new Set(["absolute","fixed"]);function U4(t,e){const n=Nn(t,!0,e==="fixed"),r=n.top+t.clientTop,o=n.left+t.clientLeft,i=Ue(t)?Qn(t):ft(1),s=t.clientWidth*i.x,l=t.clientHeight*i.y,a=o*i.x,c=r*i.y;return{width:s,height:l,x:a,y:c}}function Ud(t,e,n){let r;if(e==="viewport")r=V4(t,n);else if(e==="document")r=$4(mt(t));else if(oe(e))r=U4(e,n);else{const o=Sm(t);r={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return Ii(r)}function Em(t,e){const n=Lt(t);return n===e||!oe(n)||It(n)?!1:tt(n).position==="fixed"||Em(n,e)}function W4(t,e){const n=e.get(t);if(n)return n;let r=rn(t,[],!1).filter(l=>oe(l)&&cr(l)!=="body"),o=null;const i=tt(t).position==="fixed";let s=i?Lt(t):t;for(;oe(s)&&!It(s);){const l=tt(s),a=sc(s);!a&&l.position==="fixed"&&(o=null),(i?!a&&!o:!a&&l.position==="static"&&!!o&&z4.has(o.position)||to(s)&&!a&&Em(t,s))?r=r.filter(u=>u!==s):o=l,s=Lt(s)}return e.set(t,r),r}function K4(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t;const s=[...n==="clippingAncestors"?ns(e)?[]:W4(e,this._c):[].concat(n),r],l=s[0],a=s.reduce((c,u)=>{const d=Ud(e,u,o);return c.top=$e(d.top,c.top),c.right=cn(d.right,c.right),c.bottom=cn(d.bottom,c.bottom),c.left=$e(d.left,c.left),c},Ud(e,l,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function q4(t){const{width:e,height:n}=wm(t);return{width:e,height:n}}function G4(t,e,n){const r=Ue(e),o=mt(e),i=n==="fixed",s=Nn(t,!0,i,e);let l={scrollLeft:0,scrollTop:0};const a=ft(0);function c(){a.x=ss(o)}if(r||!r&&!i)if((cr(e)!=="body"||to(o))&&(l=is(e)),r){const h=Nn(e,!0,i,e);a.x=h.x+e.clientLeft,a.y=h.y+e.clientTop}else o&&c();i&&!r&&o&&c();const u=o&&!r&&!i?km(o,l):ft(0),d=s.left+l.scrollLeft-a.x-u.x,f=s.top+l.scrollTop-a.y-u.y;return{x:d,y:f,width:s.width,height:s.height}}function rl(t){return tt(t).position==="static"}function Wd(t,e){if(!Ue(t)||tt(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return mt(t)===n&&(n=n.ownerDocument.body),n}function Mm(t,e){const n=Fe(t);if(ns(t))return n;if(!Ue(t)){let o=Lt(t);for(;o&&!It(o);){if(oe(o)&&!rl(o))return o;o=Lt(o)}return n}let r=Wd(t,e);for(;r&&O7(r)&&rl(r);)r=Wd(r,e);return r&&It(r)&&rl(r)&&!sc(r)?n:r||P7(t)||n}const J4=async function(t){const e=this.getOffsetParent||Mm,n=this.getDimensions,r=await n(t.floating);return{reference:G4(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Z4(t){return tt(t).direction==="rtl"}const Y4={convertOffsetParentRelativeRectToViewportRelativeRect:H4,getDocumentElement:mt,getClippingRect:K4,getOffsetParent:Mm,getElementRects:J4,getClientRects:F4,getDimensions:q4,getScale:Qn,isElement:oe,isRTL:Z4};function Tm(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function X4(t,e){let n=null,r;const o=mt(t);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function s(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),i();const c=t.getBoundingClientRect(),{left:u,top:d,width:f,height:h}=c;if(l||e(),!f||!h)return;const p=Eo(d),m=Eo(o.clientWidth-(u+f)),v=Eo(o.clientHeight-(d+h)),b=Eo(u),x={rootMargin:-p+"px "+-m+"px "+-v+"px "+-b+"px",threshold:$e(0,cn(1,a))||1};let w=!0;function E(k){const S=k[0].intersectionRatio;if(S!==a){if(!w)return s();S?s(!1,S):r=setTimeout(()=>{s(!1,1e-7)},1e3)}S===1&&!Tm(c,t.getBoundingClientRect())&&s(),w=!1}try{n=new IntersectionObserver(E,{...x,root:o.ownerDocument})}catch{n=new IntersectionObserver(E,x)}n.observe(t)}return s(!0),i}function Am(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,c=uc(t),u=o||i?[...c?rn(c):[],...rn(e)]:[];u.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const d=c&&l?X4(c,n):null;let f=-1,h=null;s&&(h=new ResizeObserver(b=>{let[C]=b;C&&C.target===c&&h&&(h.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var x;(x=h)==null||x.observe(e)})),n()}),c&&!a&&h.observe(c),h.observe(e));let p,m=a?Nn(t):null;a&&v();function v(){const b=Nn(t);m&&!Tm(m,b)&&n(),m=b,p=requestAnimationFrame(v)}return n(),()=>{var b;u.forEach(C=>{o&&C.removeEventListener("scroll",n),i&&C.removeEventListener("resize",n)}),d?.(),(b=h)==null||b.disconnect(),h=null,a&&cancelAnimationFrame(p)}}const Q4=L4,e5=D4,t5=O4,n5=j4,r5=N4,Kd=R4,o5=P4,i5=(t,e,n)=>{const r=new Map,o={platform:Y4,...n},i={...o.platform,_c:r};return A4(t,e,{...o,platform:i})};var s5=typeof document<"u",l5=function(){},Ho=s5?j.useLayoutEffect:l5;function Di(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,o;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Di(t[r],e[r]))return!1;return!0}if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&t.$$typeof)&&!Di(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function Rm(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function qd(t,e){const n=Rm(t);return Math.round(e*n)/n}function ol(t){const e=y.useRef(t);return Ho(()=>{e.current=t}),e}function Om(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:l=!0,whileElementsMounted:a,open:c}=t,[u,d]=y.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[f,h]=y.useState(r);Di(f,r)||h(r);const[p,m]=y.useState(null),[v,b]=y.useState(null),C=y.useCallback(T=>{T!==k.current&&(k.current=T,m(T))},[]),x=y.useCallback(T=>{T!==S.current&&(S.current=T,b(T))},[]),w=i||p,E=s||v,k=y.useRef(null),S=y.useRef(null),M=y.useRef(u),N=a!=null,P=ol(a),W=ol(o),z=ol(c),H=y.useCallback(()=>{if(!k.current||!S.current)return;const T={placement:e,strategy:n,middleware:f};W.current&&(T.platform=W.current),i5(k.current,S.current,T).then(R=>{const U={...R,isPositioned:z.current!==!1};I.current&&!Di(M.current,U)&&(M.current=U,pa.flushSync(()=>{d(U)}))})},[f,e,n,W,z]);Ho(()=>{c===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,d(T=>({...T,isPositioned:!1})))},[c]);const I=y.useRef(!1);Ho(()=>(I.current=!0,()=>{I.current=!1}),[]),Ho(()=>{if(w&&(k.current=w),E&&(S.current=E),w&&E){if(P.current)return P.current(w,E,H);H()}},[w,E,H,P,N]);const _=y.useMemo(()=>({reference:k,floating:S,setReference:C,setFloating:x}),[C,x]),F=y.useMemo(()=>({reference:w,floating:E}),[w,E]),L=y.useMemo(()=>{const T={position:n,left:0,top:0};if(!F.floating)return T;const R=qd(F.floating,u.x),U=qd(F.floating,u.y);return l?{...T,transform:"translate("+R+"px, "+U+"px)",...Rm(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:R,top:U}},[n,l,F.floating,u.x,u.y]);return y.useMemo(()=>({...u,update:H,refs:_,elements:F,floatingStyles:L}),[u,H,_,F,L])}const a5=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:o}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?Kd({element:r.current,padding:o}).fn(n):{}:r?Kd({element:r,padding:o}).fn(n):{}}}},Nm=(t,e)=>({...Q4(t),options:[t,e]}),Im=(t,e)=>({...e5(t),options:[t,e]}),c5=(t,e)=>({...o5(t),options:[t,e]}),Lm=(t,e)=>({...t5(t),options:[t,e]}),u5=(t,e)=>({...n5(t),options:[t,e]}),d5=(t,e)=>({...r5(t),options:[t,e]}),f5=(t,e)=>({...a5(t),options:[t,e]});function Dm(t){const e=y.useRef(void 0),n=y.useCallback(r=>{const o=t.map(i=>{if(i!=null){if(typeof i=="function"){const s=i,l=s(r);return typeof l=="function"?l:()=>{s(null)}}return i.current=r,()=>{i.current=null}}});return()=>{o.forEach(i=>i?.())}},t);return y.useMemo(()=>t.every(r=>r==null)?null:r=>{e.current&&(e.current(),e.current=void 0),r!=null&&(e.current=n(r))},t)}const h5="data-floating-ui-focusable",Gd="active",Jd="selected",p5={...y};let Zd=!1,m5=0;const Yd=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+m5++;function g5(){const[t,e]=y.useState(()=>Zd?Yd():void 0);return ot(()=>{t==null&&e(Yd())},[]),y.useEffect(()=>{Zd=!0},[]),t}const y5=p5.useId,dc=y5||g5;let ia;process.env.NODE_ENV!=="production"&&(ia=new Set);function v5(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((t=ia)!=null&&t.has(o))){var i;(i=ia)==null||i.add(o),console.error(o)}}function b5(){const t=new Map;return{emit(e,n){var r;(r=t.get(e))==null||r.forEach(o=>o(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var r;(r=t.get(e))==null||r.delete(n)}}}const C5=y.createContext(null),x5=y.createContext(null),fc=()=>{var t;return((t=y.useContext(C5))==null?void 0:t.id)||null},hc=()=>y.useContext(x5);function no(t){return"data-floating-ui-"+t}function Ge(t){t.current!==-1&&(clearTimeout(t.current),t.current=-1)}const Xd=no("safe-polygon");function il(t,e,n){if(n&&!oa(n))return 0;if(typeof t=="number")return t;if(typeof t=="function"){const r=t();return typeof r=="number"?r:r?.[e]}return t?.[e]}function sl(t){return typeof t=="function"?t():t}function w5(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:s}=t,{enabled:l=!0,delay:a=0,handleClose:c=null,mouseOnly:u=!1,restMs:d=0,move:f=!0}=e,h=hc(),p=fc(),m=Mo(c),v=Mo(a),b=Mo(n),C=Mo(d),x=y.useRef(),w=y.useRef(-1),E=y.useRef(),k=y.useRef(-1),S=y.useRef(!0),M=y.useRef(!1),N=y.useRef(()=>{}),P=y.useRef(!1),W=at(()=>{var L;const T=(L=o.current.openEvent)==null?void 0:L.type;return T?.includes("mouse")&&T!=="mousedown"});y.useEffect(()=>{if(!l)return;function L(T){let{open:R}=T;R||(Ge(w),Ge(k),S.current=!0,P.current=!1)}return i.on("openchange",L),()=>{i.off("openchange",L)}},[l,i]),y.useEffect(()=>{if(!l||!m.current||!n)return;function L(R){W()&&r(!1,R,"hover")}const T=dt(s.floating).documentElement;return T.addEventListener("mouseleave",L),()=>{T.removeEventListener("mouseleave",L)}},[s.floating,n,r,l,m,W]);const z=y.useCallback(function(L,T,R){T===void 0&&(T=!0),R===void 0&&(R="hover");const U=il(v.current,"close",x.current);U&&!E.current?(Ge(w),w.current=window.setTimeout(()=>r(!1,L,R),U)):T&&(Ge(w),r(!1,L,R))},[v,r]),H=at(()=>{N.current(),E.current=void 0}),I=at(()=>{if(M.current){const L=dt(s.floating).body;L.style.pointerEvents="",L.removeAttribute(Xd),M.current=!1}}),_=at(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);y.useEffect(()=>{if(!l)return;function L(K){if(Ge(w),S.current=!1,u&&!oa(x.current)||sl(C.current)>0&&!il(v.current,"open"))return;const Z=il(v.current,"open",x.current);Z?w.current=window.setTimeout(()=>{b.current||r(!0,K,"hover")},Z):n||r(!0,K,"hover")}function T(K){if(_()){I();return}N.current();const Z=dt(s.floating);if(Ge(k),P.current=!1,m.current&&o.current.floatingContext){n||Ge(w),E.current=m.current({...o.current.floatingContext,tree:h,x:K.clientX,y:K.clientY,onClose(){I(),H(),_()||z(K,!0,"safe-polygon")}});const le=E.current;Z.addEventListener("mousemove",le),N.current=()=>{Z.removeEventListener("mousemove",le)};return}(x.current==="touch"?!sr(s.floating,K.relatedTarget):!0)&&z(K)}function R(K){_()||o.current.floatingContext&&(m.current==null||m.current({...o.current.floatingContext,tree:h,x:K.clientX,y:K.clientY,onClose(){I(),H(),_()||z(K)}})(K))}function U(){Ge(w)}function ee(K){_()||z(K,!1)}if(oe(s.domReference)){const K=s.domReference,Z=s.floating;return n&&K.addEventListener("mouseleave",R),f&&K.addEventListener("mousemove",L,{once:!0}),K.addEventListener("mouseenter",L),K.addEventListener("mouseleave",T),Z&&(Z.addEventListener("mouseleave",R),Z.addEventListener("mouseenter",U),Z.addEventListener("mouseleave",ee)),()=>{n&&K.removeEventListener("mouseleave",R),f&&K.removeEventListener("mousemove",L),K.removeEventListener("mouseenter",L),K.removeEventListener("mouseleave",T),Z&&(Z.removeEventListener("mouseleave",R),Z.removeEventListener("mouseenter",U),Z.removeEventListener("mouseleave",ee))}}},[s,l,t,u,f,z,H,I,r,n,b,h,v,m,o,_,C]),ot(()=>{var L;if(l&&n&&(L=m.current)!=null&&(L=L.__options)!=null&&L.blockPointerEvents&&W()){M.current=!0;const R=s.floating;if(oe(s.domReference)&&R){var T;const U=dt(s.floating).body;U.setAttribute(Xd,"");const ee=s.domReference,K=h==null||(T=h.nodesRef.current.find(Z=>Z.id===p))==null||(T=T.context)==null?void 0:T.elements.floating;return K&&(K.style.pointerEvents=""),U.style.pointerEvents="none",ee.style.pointerEvents="auto",R.style.pointerEvents="auto",()=>{U.style.pointerEvents="",ee.style.pointerEvents="",R.style.pointerEvents=""}}}},[l,n,p,s,h,m,W]),ot(()=>{n||(x.current=void 0,P.current=!1,H(),I())},[n,H,I]),y.useEffect(()=>()=>{H(),Ge(w),Ge(k),I()},[l,s.domReference,H,I]);const F=y.useMemo(()=>{function L(T){x.current=T.pointerType}return{onPointerDown:L,onPointerEnter:L,onMouseMove(T){const{nativeEvent:R}=T;function U(){!S.current&&!b.current&&r(!0,R,"hover")}u&&!oa(x.current)||n||sl(C.current)===0||P.current&&T.movementX**2+T.movementY**2<2||(Ge(k),x.current==="touch"?U():(P.current=!0,k.current=window.setTimeout(U,sl(C.current))))}}},[u,r,n,b,C]);return y.useMemo(()=>l?{reference:F}:{},[l,F])}const Qd=()=>{},S5=y.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:Qd,setState:Qd,isInstantPhase:!1});function k5(t){const{children:e,delay:n,timeoutMs:r=0}=t,[o,i]=y.useReducer((a,c)=>({...a,...c}),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),s=y.useRef(null),l=y.useCallback(a=>{i({currentId:a})},[]);return ot(()=>{o.currentId?s.current===null?s.current=o.currentId:o.isInstantPhase||i({isInstantPhase:!0}):(o.isInstantPhase&&i({isInstantPhase:!1}),s.current=null)},[o.currentId,o.isInstantPhase]),g.jsx(S5.Provider,{value:y.useMemo(()=>({...o,setState:i,setCurrentId:l}),[o,l]),children:e})}const Pm={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},ef=y.forwardRef(function(e,n){const[r,o]=y.useState();ot(()=>{vm()&&o("button")},[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[no("focus-guard")]:"",style:Pm};return g.jsx("span",{...e,...i})}),jm=y.createContext(null),tf=no("portal");function E5(t){t===void 0&&(t={});const{id:e,root:n}=t,r=dc(),o=T5(),[i,s]=y.useState(null),l=y.useRef(null);return ot(()=>()=>{i?.remove(),queueMicrotask(()=>{l.current=null})},[i]),ot(()=>{if(!r||l.current)return;const a=e?document.getElementById(e):null;if(!a)return;const c=document.createElement("div");c.id=r,c.setAttribute(tf,""),a.appendChild(c),l.current=c,s(c)},[e,r]),ot(()=>{if(n===null||!r||l.current)return;let a=n||o?.portalNode;a&&!ic(a)&&(a=a.current),a=a||document.body;let c=null;e&&(c=document.createElement("div"),c.id=e,a.appendChild(c));const u=document.createElement("div");u.id=r,u.setAttribute(tf,""),a=c||a,a.appendChild(u),l.current=u,s(u)},[e,n,r,o]),i}function M5(t){const{children:e,id:n,root:r,preserveTabOrder:o=!0}=t,i=E5({id:n,root:r}),[s,l]=y.useState(null),a=y.useRef(null),c=y.useRef(null),u=y.useRef(null),d=y.useRef(null),f=s?.modal,h=s?.open,p=!!s&&!s.modal&&s.open&&o&&!!(r||i);return y.useEffect(()=>{if(!i||!o||f)return;function m(v){i&&nl(v)&&(v.type==="focusin"?Hd:T4)(i)}return i.addEventListener("focusin",m,!0),i.addEventListener("focusout",m,!0),()=>{i.removeEventListener("focusin",m,!0),i.removeEventListener("focusout",m,!0)}},[i,o,f]),y.useEffect(()=>{i&&(h||Hd(i))},[h,i]),g.jsxs(jm.Provider,{value:y.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:c,beforeInsideRef:u,afterInsideRef:d,portalNode:i,setFocusManagerState:l}),[o,i]),children:[p&&i&&g.jsx(ef,{"data-type":"outside",ref:a,onFocus:m=>{if(nl(m,i)){var v;(v=u.current)==null||v.focus()}else{const b=s?s.domReference:null,C=M4(b);C?.focus()}}}),p&&i&&g.jsx("span",{"aria-owns":i.id,style:Pm}),i&&pa.createPortal(e,i),p&&i&&g.jsx(ef,{"data-type":"outside",ref:c,onFocus:m=>{if(nl(m,i)){var v;(v=d.current)==null||v.focus()}else{const b=s?s.domReference:null,C=E4(b);C?.focus(),s?.closeOnFocusOut&&s?.onOpenChange(!1,m.nativeEvent,"focus-out")}}})]})}const T5=()=>y.useContext(jm),A5={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},R5={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},nf=t=>{var e,n;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(n=t?.outsidePress)!=null?n:!0}};function O5(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,elements:o,dataRef:i}=t,{enabled:s=!0,escapeKey:l=!0,outsidePress:a=!0,outsidePressEvent:c="pointerdown",referencePress:u=!1,referencePressEvent:d="pointerdown",ancestorScroll:f=!1,bubbles:h,capture:p}=e,m=hc(),v=at(typeof a=="function"?a:()=>!1),b=typeof a=="function"?v:a,C=y.useRef(!1),{escapeKey:x,outsidePress:w}=nf(h),{escapeKey:E,outsidePress:k}=nf(p),S=y.useRef(!1),M=at(I=>{var _;if(!n||!s||!l||I.key!=="Escape"||S.current)return;const F=(_=i.current.floatingContext)==null?void 0:_.nodeId,L=m?_o(m.nodesRef.current,F):[];if(!x&&(I.stopPropagation(),L.length>0)){let T=!0;if(L.forEach(R=>{var U;if((U=R.context)!=null&&U.open&&!R.context.dataRef.current.__escapeKeyBubbles){T=!1;return}}),!T)return}r(!1,b4(I)?I.nativeEvent:I,"escape-key")}),N=at(I=>{var _;const F=()=>{var L;M(I),(L=Gn(I))==null||L.removeEventListener("keydown",F)};(_=Gn(I))==null||_.addEventListener("keydown",F)}),P=at(I=>{var _;const F=i.current.insideReactTree;i.current.insideReactTree=!1;const L=C.current;if(C.current=!1,c==="click"&&L||F||typeof b=="function"&&!b(I))return;const T=Gn(I),R="["+no("inert")+"]",U=dt(o.floating).querySelectorAll(R);let ee=oe(T)?T:null;for(;ee&&!It(ee);){const le=Lt(ee);if(It(le)||!oe(le))break;ee=le}if(U.length&&oe(T)&&!m4(T)&&!sr(T,o.floating)&&Array.from(U).every(le=>!sr(ee,le)))return;if(Ue(T)&&H){const le=It(T),ge=tt(T),Y=/auto|scroll/,te=le||Y.test(ge.overflowX),Ke=le||Y.test(ge.overflowY),bt=te&&T.clientWidth>0&&T.scrollWidth>T.clientWidth,Bn=Ke&&T.clientHeight>0&&T.scrollHeight>T.clientHeight,Cs=ge.direction==="rtl",_n=Bn&&(Cs?I.offsetX<=T.offsetWidth-T.clientWidth:I.offsetX>T.clientWidth),M0=bt&&I.offsetY>T.clientHeight;if(_n||M0)return}const K=(_=i.current.floatingContext)==null?void 0:_.nodeId,Z=m&&_o(m.nodesRef.current,K).some(le=>{var ge;return tl(I,(ge=le.context)==null?void 0:ge.elements.floating)});if(tl(I,o.floating)||tl(I,o.domReference)||Z)return;const We=m?_o(m.nodesRef.current,K):[];if(We.length>0){let le=!0;if(We.forEach(ge=>{var Y;if((Y=ge.context)!=null&&Y.open&&!ge.context.dataRef.current.__outsidePressBubbles){le=!1;return}}),!le)return}r(!1,I,"outside-press")}),W=at(I=>{var _;const F=()=>{var L;P(I),(L=Gn(I))==null||L.removeEventListener(c,F)};(_=Gn(I))==null||_.addEventListener(c,F)});y.useEffect(()=>{if(!n||!s)return;i.current.__escapeKeyBubbles=x,i.current.__outsidePressBubbles=w;let I=-1;function _(U){r(!1,U,"ancestor-scroll")}function F(){window.clearTimeout(I),S.current=!0}function L(){I=window.setTimeout(()=>{S.current=!1},rs()?5:0)}const T=dt(o.floating);l&&(T.addEventListener("keydown",E?N:M,E),T.addEventListener("compositionstart",F),T.addEventListener("compositionend",L)),b&&T.addEventListener(c,k?W:P,k);let R=[];return f&&(oe(o.domReference)&&(R=rn(o.domReference)),oe(o.floating)&&(R=R.concat(rn(o.floating))),!oe(o.reference)&&o.reference&&o.reference.contextElement&&(R=R.concat(rn(o.reference.contextElement)))),R=R.filter(U=>{var ee;return U!==((ee=T.defaultView)==null?void 0:ee.visualViewport)}),R.forEach(U=>{U.addEventListener("scroll",_,{passive:!0})}),()=>{l&&(T.removeEventListener("keydown",E?N:M,E),T.removeEventListener("compositionstart",F),T.removeEventListener("compositionend",L)),b&&T.removeEventListener(c,k?W:P,k),R.forEach(U=>{U.removeEventListener("scroll",_)}),window.clearTimeout(I)}},[i,o,l,b,c,n,r,f,s,x,w,M,E,N,P,k,W]),y.useEffect(()=>{i.current.insideReactTree=!1},[i,b,c]);const z=y.useMemo(()=>({onKeyDown:M,...u&&{[A5[d]]:I=>{r(!1,I.nativeEvent,"reference-press")},...d!=="click"&&{onClick(I){r(!1,I.nativeEvent,"reference-press")}}}}),[M,r,u,d]),H=y.useMemo(()=>({onKeyDown:M,onMouseDown(){C.current=!0},onMouseUp(){C.current=!0},[R5[c]]:()=>{i.current.insideReactTree=!0}}),[M,c,i]);return y.useMemo(()=>s?{reference:z,floating:H}:{},[s,z,H])}function N5(t){const{open:e=!1,onOpenChange:n,elements:r}=t,o=dc(),i=y.useRef({}),[s]=y.useState(()=>b5()),l=fc()!=null;if(process.env.NODE_ENV!=="production"){const h=r.reference;h&&!oe(h)&&v5("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,c]=y.useState(r.reference),u=at((h,p,m)=>{i.current.openEvent=h?p:void 0,s.emit("openchange",{open:h,event:p,reason:m,nested:l}),n?.(h,p,m)}),d=y.useMemo(()=>({setPositionReference:c}),[]),f=y.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return y.useMemo(()=>({dataRef:i,open:e,onOpenChange:u,elements:f,events:s,floatingId:o,refs:d}),[e,u,f,s,o,d])}function I5(t){t===void 0&&(t={});const{nodeId:e}=t,n=N5({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,o=r.elements,[i,s]=y.useState(null),[l,a]=y.useState(null),u=o?.domReference||i,d=y.useRef(null),f=hc();ot(()=>{u&&(d.current=u)},[u]);const h=Om({...t,elements:{...o,...l&&{reference:l}}}),p=y.useCallback(x=>{const w=oe(x)?{getBoundingClientRect:()=>x.getBoundingClientRect(),getClientRects:()=>x.getClientRects(),contextElement:x}:x;a(w),h.refs.setReference(w)},[h.refs]),m=y.useCallback(x=>{(oe(x)||x===null)&&(d.current=x,s(x)),(oe(h.refs.reference.current)||h.refs.reference.current===null||x!==null&&!oe(x))&&h.refs.setReference(x)},[h.refs]),v=y.useMemo(()=>({...h.refs,setReference:m,setPositionReference:p,domReference:d}),[h.refs,m,p]),b=y.useMemo(()=>({...h.elements,domReference:u}),[h.elements,u]),C=y.useMemo(()=>({...h,...r,refs:v,elements:b,nodeId:e}),[h,v,b,e,r]);return ot(()=>{r.dataRef.current.floatingContext=C;const x=f?.nodesRef.current.find(w=>w.id===e);x&&(x.context=C)}),y.useMemo(()=>({...h,context:C,refs:v,elements:b}),[h,v,b,C])}function ll(){return f4()&&vm()}function L5(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,events:o,dataRef:i,elements:s}=t,{enabled:l=!0,visibleOnly:a=!0}=e,c=y.useRef(!1),u=y.useRef(-1),d=y.useRef(!0);y.useEffect(()=>{if(!l)return;const h=Fe(s.domReference);function p(){!n&&Ue(s.domReference)&&s.domReference===ra(dt(s.domReference))&&(c.current=!0)}function m(){d.current=!0}function v(){d.current=!1}return h.addEventListener("blur",p),ll()&&(h.addEventListener("keydown",m,!0),h.addEventListener("pointerdown",v,!0)),()=>{h.removeEventListener("blur",p),ll()&&(h.removeEventListener("keydown",m,!0),h.removeEventListener("pointerdown",v,!0))}},[s.domReference,n,l]),y.useEffect(()=>{if(!l)return;function h(p){let{reason:m}=p;(m==="reference-press"||m==="escape-key")&&(c.current=!0)}return o.on("openchange",h),()=>{o.off("openchange",h)}},[o,l]),y.useEffect(()=>()=>{Ge(u)},[]);const f=y.useMemo(()=>({onMouseLeave(){c.current=!1},onFocus(h){if(c.current)return;const p=Gn(h.nativeEvent);if(a&&oe(p)){if(ll()&&!h.relatedTarget){if(!d.current&&!g4(p))return}else if(!y4(p))return}r(!0,h.nativeEvent,"focus")},onBlur(h){c.current=!1;const p=h.relatedTarget,m=h.nativeEvent,v=oe(p)&&p.hasAttribute(no("focus-guard"))&&p.getAttribute("data-type")==="outside";u.current=window.setTimeout(()=>{var b;const C=ra(s.domReference?s.domReference.ownerDocument:document);!p&&C===s.domReference||sr((b=i.current.floatingContext)==null?void 0:b.refs.floating.current,C)||sr(s.domReference,C)||v||r(!1,m,"focus")})}}),[i,s.domReference,r,a]);return y.useMemo(()=>l?{reference:f}:{},[l,f])}function al(t,e,n){const r=new Map,o=n==="item";let i=t;if(o&&t){const{[Gd]:s,[Jd]:l,...a}=t;i=a}return{...n==="floating"&&{tabIndex:-1,[h5]:""},...i,...e.map(s=>{const l=s?s[n]:null;return typeof l=="function"?t?l(t):null:l}).concat(t).reduce((s,l)=>(l&&Object.entries(l).forEach(a=>{let[c,u]=a;if(!(o&&[Gd,Jd].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof u=="function"){var d;(d=r.get(c))==null||d.push(u),s[c]=function(){for(var f,h=arguments.length,p=new Array(h),m=0;m<h;m++)p[m]=arguments[m];return(f=r.get(c))==null?void 0:f.map(v=>v(...p)).find(v=>v!==void 0)}}}else s[c]=u}),s),{})}}function D5(t){t===void 0&&(t=[]);const e=t.map(l=>l?.reference),n=t.map(l=>l?.floating),r=t.map(l=>l?.item),o=y.useCallback(l=>al(l,t,"reference"),e),i=y.useCallback(l=>al(l,t,"floating"),n),s=y.useCallback(l=>al(l,t,"item"),r);return y.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:s}),[o,i,s])}const P5=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function j5(t,e){var n,r;e===void 0&&(e={});const{open:o,elements:i,floatingId:s}=t,{enabled:l=!0,role:a="dialog"}=e,c=dc(),u=((n=i.domReference)==null?void 0:n.id)||c,d=y.useMemo(()=>{var C;return((C=v4(i.floating))==null?void 0:C.id)||s},[i.floating,s]),f=(r=P5.get(a))!=null?r:a,p=fc()!=null,m=y.useMemo(()=>f==="tooltip"||a==="label"?{["aria-"+(a==="label"?"labelledby":"describedby")]:o?d:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":f==="alertdialog"?"dialog":f,"aria-controls":o?d:void 0,...f==="listbox"&&{role:"combobox"},...f==="menu"&&{id:u},...f==="menu"&&p&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[f,d,p,o,u,a]),v=y.useMemo(()=>{const C={id:d,...f&&{role:f}};return f==="tooltip"||a==="label"?C:{...C,...f==="menu"&&{"aria-labelledby":u}}},[f,d,u,a]),b=y.useCallback(C=>{let{active:x,selected:w}=C;const E={role:"option",...x&&{id:d+"-fui-option"}};switch(a){case"select":case"combobox":return{...E,"aria-selected":w}}return{}},[d,a]);return y.useMemo(()=>l?{reference:m,floating:v,item:b}:{},[l,m,v,b])}function B5({initialOpen:t=!1,placement:e="top",open:n,onOpenChange:r,delay:o=600,closeDelay:i=0}={}){const[s,l]=y.useState(t),a=n??s,c=r??l,u=I5({placement:e,open:a,onOpenChange:c,whileElementsMounted:Am,middleware:[Nm(4),Lm({crossAxis:e.includes("-"),fallbackAxisSideDirection:"start",padding:4}),Im({padding:4})]}),d=u.context,f=w5(d,{mouseOnly:!0,move:!1,restMs:o,enabled:n==null,delay:{close:i}}),h=L5(d,{enabled:n==null}),p=O5(d),m=j5(d,{role:"tooltip"}),v=D5([f,h,p,m]);return y.useMemo(()=>({open:a,setOpen:c,...v,...u}),[a,c,v,u])}const sa=y.createContext(null);function Bm(){const t=y.useContext(sa);if(t==null)throw new Error("Tooltip components must be wrapped in <TooltipProvider />");return t}function _m({children:t,...e}){const n=B5(e);return e.useDelayGroup?g.jsx(k5,{delay:{open:e.delay??0,close:e.closeDelay??0},timeoutMs:e.timeout,children:g.jsx(sa.Provider,{value:n,children:t})}):g.jsx(sa.Provider,{value:n,children:t})}const Hm=y.forwardRef(function({children:e,asChild:n=!1,...r},o){const i=Bm(),s=y.isValidElement(e)?parseInt(y.version,10)>=19?e.props.ref:e.ref:void 0,l=Dm([i.refs.setReference,o,s]);if(n&&y.isValidElement(e)){const a={"data-tooltip-state":i.open?"open":"closed"};return y.cloneElement(e,i.getReferenceProps({ref:l,...r,...typeof e.props=="object"?e.props:{},...a}))}return g.jsx("button",{ref:l,"data-tooltip-state":i.open?"open":"closed",...i.getReferenceProps(r),children:e})}),Fm=y.forwardRef(function({style:e,children:n,portal:r=!0,portalProps:o={},...i},s){const l=Bm(),a=Dm([l.refs.setFloating,s]);if(!l.open)return null;const c=g.jsx("div",{ref:a,style:{...l.floatingStyles,...e},...l.getFloatingProps(i),className:"tiptap-tooltip",children:n});return r?g.jsx(M5,{...o,children:c}):c});_m.displayName="Tooltip";Hm.displayName="TooltipTrigger";Fm.displayName="TooltipContent";const la=5*1024*1024,_5={mod:"⌘",command:"⌘",meta:"⌘",ctrl:"⌃",control:"⌃",alt:"⌥",option:"⌥",shift:"⇧",backspace:"Del",delete:"⌦",enter:"⏎",escape:"⎋",capslock:"⇪"};function Me(...t){return t.filter(Boolean).join(" ")}function H5(){return typeof navigator<"u"&&navigator.platform.toLowerCase().includes("mac")}const F5=(t,e,n=!0)=>{if(e){const r=t.toLowerCase();return _5[r]||(n?t.toUpperCase():t)}return n?t.charAt(0).toUpperCase()+t.slice(1):t},gt=t=>{const{shortcutKeys:e,delimiter:n="+",capitalize:r=!0}=t;return e?e.split(n).map(o=>o.trim()).map(o=>F5(o,H5(),r)):[]},ro=(t,e)=>e?.schema?e.schema.spec.marks.get(t)!==void 0:!1,_t=(t,e)=>e?.schema?e.schema.spec.nodes.get(t)!==void 0:!1;function $5(t){const{state:e,view:n}=t,{doc:r,selection:o}=e,i=q.findFrom(o.$to,1,!0);if(i)return n.dispatch(e.tr.setSelection(i).scrollIntoView()),!0;const s=e.schema.nodes.paragraph;if(!s)return console.warn("No paragraph node type found in schema."),!1;const l=r.content.size,a=s.create();let c=e.tr.insert(l,a);const u=c.doc.resolve(l+1);return c=c.setSelection(V.near(u)).scrollIntoView(),n.dispatch(c),!0}function yt(t){return typeof t=="number"&&t>=0}function ls(t,e){if(!t)return!1;const n=Array.isArray(e)?e:[e],r=n.some(o=>t.extensionManager.extensions.some(i=>i.name===o));return r||console.warn(`None of the extensions [${n.join(", ")}] were found in the editor schema. Ensure they are included in the editor configuration.`),r}function V5(t,e){try{const n=t.state.doc.nodeAt(e);return n||(console.warn(`No node found at position ${e}`),null)}catch(n){return console.error(`Error getting node at position ${e}:`,n),null}}function hn(t){const{editor:e,node:n,nodePos:r}=t;if(!e||!e.state?.doc)return null;const o=n!=null,i=yt(r);if(!o&&!i)return null;if(o){let s=-1,l=null;if(e.state.doc.descendants((a,c)=>a===n?(s=c,l=a,!1):!0),s!==-1&&l!==null)return{pos:s,node:l}}if(i){const s=V5(e,r);if(s)return{pos:r,node:s}}return null}function Ht(t,e=[]){if(!t||!t.state.selection)return!1;const{state:n}=t,{selection:r}=n;if(r.empty)return!1;if(r instanceof B){const o=r.node;return o?e.includes(o.type.name):!1}return!1}const z5=async(t,e,n)=>{if(!t)throw new Error("No file provided");if(t.size>la)throw new Error(`File size exceeds maximum allowed (${la/(1024*1024)}MB)`);for(let r=0;r<=100;r+=10){if(n?.aborted)throw new Error("Upload cancelled");await new Promise(o=>setTimeout(o,500)),e?.({progress:r})}return"/images/tiptap-ui-placeholder-image.jpg"},U5=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function W5(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return!t||t.replace(U5,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}function K5(t,e,n){try{const r=new URL(t,e);if(W5(r.href,n))return r.href}catch{}return"#"}const q5=({shortcuts:t})=>t.length===0?null:g.jsx("div",{children:t.map((e,n)=>g.jsxs(y.Fragment,{children:[n>0&&g.jsx("kbd",{children:"+"}),g.jsx("kbd",{children:e})]},n))}),fe=y.forwardRef(({className:t,children:e,tooltip:n,showTooltip:r=!0,shortcutKeys:o,"aria-label":i,...s},l)=>{const a=y.useMemo(()=>gt({shortcutKeys:o}),[o]);return!n||!r?g.jsx("button",{className:Me("tiptap-button",t),ref:l,"aria-label":i,...s,children:e}):g.jsxs(_m,{delay:200,children:[g.jsx(Hm,{className:Me("tiptap-button",t),ref:l,"aria-label":i,...s,children:e}),g.jsxs(Fm,{children:[n,g.jsx(q5,{shortcuts:a})]})]})});fe.displayName="Button";const In=y.forwardRef(({className:t,children:e,orientation:n="vertical",...r},o)=>g.jsx("div",{ref:o,className:Me("tiptap-button-group",t),"data-orientation":n,role:"group",...r,children:e}));In.displayName="ButtonGroup";function rf({orientation:t="horizontal",size:e,style:n={},...r}){const o={...n,...t==="horizontal"&&!e&&{flex:1},...e&&{width:t==="vertical"?"1px":e,height:t==="horizontal"?"1px":e}};return g.jsx("div",{...r,style:o})}const as=y.forwardRef(({decorative:t,orientation:e="vertical",className:n,...r},o)=>{const s=t?{role:"none"}:{"aria-orientation":e==="vertical"?e:void 0,role:"separator"};return g.jsx("div",{className:Me("tiptap-separator",n),"data-orientation":e,...s,...r,ref:o})});as.displayName="Separator";function $m({editor:t,containerRef:e,query:n,items:r,onSelect:o,onClose:i,orientation:s="vertical",autoSelectFirstItem:l=!0}){const[a,c]=y.useState(l?0:-1);return y.useEffect(()=>{const u=f=>{if(!r.length)return!1;const h=()=>c(m=>m===-1?0:(m+1)%r.length),p=()=>c(m=>m===-1?r.length-1:(m-1+r.length)%r.length);switch(f.key){case"ArrowUp":return s==="horizontal"?!1:(f.preventDefault(),p(),!0);case"ArrowDown":return s==="horizontal"?!1:(f.preventDefault(),h(),!0);case"ArrowLeft":return s==="vertical"?!1:(f.preventDefault(),p(),!0);case"ArrowRight":return s==="vertical"?!1:(f.preventDefault(),h(),!0);case"Tab":return f.preventDefault(),f.shiftKey?p():h(),!0;case"Home":return f.preventDefault(),c(0),!0;case"End":return f.preventDefault(),c(r.length-1),!0;case"Enter":return f.isComposing?!1:(f.preventDefault(),a!==-1&&r[a]&&o?.(r[a]),!0);case"Escape":return f.preventDefault(),i?.(),!0;default:return!1}};let d=null;if(t?d=t.view.dom:e?.current&&(d=e.current),d)return d.addEventListener("keydown",u,!0),()=>{d?.removeEventListener("keydown",u,!0)}},[t,e,r,a,o,i,s]),y.useEffect(()=>{n&&c(l?0:-1)},[n,l]),{selectedIndex:r.length?a:void 0,setSelectedIndex:c}}const of=(t,e)=>{typeof t=="function"?t(e):t&&typeof t=="object"&&"current"in t&&(t.current=e)},G5=(t,e)=>{const n=y.useRef(null);return y.useCallback(r=>{t&&"current"in t&&(t.current=r),n.current&&of(n.current,null),n.current=e,e&&of(e,r)},[t,e])},J5=t=>{const[e,n]=y.useState([]),r=y.useCallback(()=>t.current?Array.from(t.current.querySelectorAll('button:not([disabled]), [role="button"]:not([disabled]), [tabindex="0"]:not([disabled])')):[],[t]);y.useEffect(()=>{const i=t.current;if(!i)return;const s=()=>n(r());s();const l=new MutationObserver(s);return l.observe(i,{childList:!0,subtree:!0}),()=>l.disconnect()},[r,t]);const{selectedIndex:o}=$m({containerRef:t,items:e,orientation:"horizontal",onSelect:i=>i.click(),autoSelectFirstItem:!1});y.useEffect(()=>{const i=t.current;if(!i)return;const s=a=>{const c=a.target;i.contains(c)&&c.setAttribute("data-focus-visible","true")},l=a=>{const c=a.target;i.contains(c)&&c.removeAttribute("data-focus-visible")};return i.addEventListener("focus",s,!0),i.addEventListener("blur",l,!0),()=>{i.removeEventListener("focus",s,!0),i.removeEventListener("blur",l,!0)}},[t]),y.useEffect(()=>{o!==void 0&&e[o]&&e[o].focus()},[o,e])},pc=y.forwardRef(({children:t,className:e,variant:n="fixed",...r},o)=>{const i=y.useRef(null),s=G5(i,o);return J5(i),g.jsx("div",{ref:s,role:"toolbar","aria-label":"toolbar","data-variant":n,className:Me("tiptap-toolbar",e),...r,children:t})});pc.displayName="Toolbar";const Mt=y.forwardRef(({children:t,className:e,...n},r)=>g.jsx("div",{ref:r,role:"group",className:Me("tiptap-toolbar-group",e),...n,children:t}));Mt.displayName="ToolbarGroup";const Tt=y.forwardRef(({...t},e)=>g.jsx(as,{ref:e,orientation:"vertical",decorative:!0,...t}));Tt.displayName="ToolbarSeparator";const Vm=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{d:"M18.7071 6.70711C19.0976 6.31658 19.0976 5.68342 18.7071 5.29289C18.3166 4.90237 17.6834 4.90237 17.2929 5.29289L12 10.5858L6.70711 5.29289C6.31658 4.90237 5.68342 4.90237 5.29289 5.29289C4.90237 5.68342 4.90237 6.31658 5.29289 6.70711L10.5858 12L5.29289 17.2929C4.90237 17.6834 4.90237 18.3166 5.29289 18.7071C5.68342 19.0976 6.31658 19.0976 6.70711 18.7071L12 13.4142L17.2929 18.7071C17.6834 19.0976 18.3166 19.0976 18.7071 18.7071C19.0976 18.3166 19.0976 17.6834 18.7071 17.2929L13.4142 12L18.7071 6.70711Z",fill:"currentColor"})}));Vm.displayName="CloseIcon";function Z5(t){const[e,n]=y.useState([]),r=async l=>{if(l.size>t.maxSize){const d=new Error(`File size exceeds maximum allowed (${t.maxSize/1024/1024}MB)`);return t.onError?.(d),null}const a=new AbortController,c=crypto.randomUUID(),u={id:c,file:l,progress:0,status:"uploading",abortController:a};n(d=>[...d,u]);try{if(!t.upload)throw new Error("Upload function is not defined");const d=await t.upload(l,f=>{n(h=>h.map(p=>p.id===c?{...p,progress:f.progress}:p))},a.signal);if(!d)throw new Error("Upload failed: No URL returned");return a.signal.aborted?null:(n(f=>f.map(h=>h.id===c?{...h,status:"success",url:d,progress:100}:h)),t.onSuccess?.(d),d)}catch(d){return a.signal.aborted||(n(f=>f.map(h=>h.id===c?{...h,status:"error",progress:0}:h)),t.onError?.(d instanceof Error?d:new Error("Upload failed"))),null}};return{fileItems:e,uploadFiles:async l=>{if(!l||l.length===0)return t.onError?.(new Error("No files to upload")),[];if(t.limit&&l.length>t.limit)return t.onError?.(new Error(`Maximum ${t.limit} file${t.limit===1?"":"s"} allowed`)),[];const a=l.map(u=>r(u));return(await Promise.all(a)).filter(u=>u!==null)},removeFileItem:l=>{n(a=>{const c=a.find(u=>u.id===l);return c?.abortController&&c.abortController.abort(),c?.url&&URL.revokeObjectURL(c.url),a.filter(u=>u.id!==l)})},clearAllFiles:()=>{e.forEach(l=>{l.abortController&&l.abortController.abort(),l.url&&URL.revokeObjectURL(l.url)}),n([])}}}const zm=()=>g.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",className:"tiptap-image-upload-icon",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[g.jsx("path",{d:"M11.1953 4.41771C10.3478 4.08499 9.43578 3.94949 8.5282 4.02147C7.62062 4.09345 6.74133 4.37102 5.95691 4.83316C5.1725 5.2953 4.50354 5.92989 4.00071 6.68886C3.49788 7.44783 3.17436 8.31128 3.05465 9.2138C2.93495 10.1163 3.0222 11.0343 3.3098 11.8981C3.5974 12.7619 4.07781 13.5489 4.71463 14.1995C5.10094 14.5942 5.09414 15.2274 4.69945 15.6137C4.30476 16 3.67163 15.9932 3.28532 15.5985C2.43622 14.731 1.79568 13.6816 1.41221 12.5299C1.02875 11.3781 0.91241 10.1542 1.07201 8.95084C1.23162 7.74748 1.66298 6.59621 2.33343 5.58425C3.00387 4.57229 3.89581 3.72617 4.9417 3.10998C5.98758 2.4938 7.15998 2.1237 8.37008 2.02773C9.58018 1.93176 10.7963 2.11243 11.9262 2.55605C13.0561 2.99968 14.0703 3.69462 14.8919 4.58825C15.5423 5.29573 16.0585 6.11304 16.4177 7.00002H17.4999C18.6799 6.99991 19.8288 7.37933 20.7766 8.08222C21.7245 8.78515 22.4212 9.7743 22.7637 10.9036C23.1062 12.0328 23.0765 13.2423 22.6788 14.3534C22.2812 15.4644 21.5367 16.4181 20.5554 17.0736C20.0962 17.3803 19.4752 17.2567 19.1684 16.7975C18.8617 16.3382 18.9853 15.7172 19.4445 15.4105C20.069 14.9934 20.5427 14.3865 20.7958 13.6794C21.0488 12.9724 21.0678 12.2027 20.8498 11.4841C20.6318 10.7655 20.1885 10.136 19.5853 9.6887C18.9821 9.24138 18.251 8.99993 17.5001 9.00002H15.71C15.2679 9.00002 14.8783 8.70973 14.7518 8.28611C14.4913 7.41374 14.0357 6.61208 13.4195 5.94186C12.8034 5.27164 12.0427 4.75043 11.1953 4.41771Z",fill:"currentColor"}),g.jsx("path",{d:"M11 14.4142V21C11 21.5523 11.4477 22 12 22C12.5523 22 13 21.5523 13 21V14.4142L15.2929 16.7071C15.6834 17.0976 16.3166 17.0976 16.7071 16.7071C17.0976 16.3166 17.0976 15.6834 16.7071 15.2929L12.7078 11.2936C12.7054 11.2912 12.703 11.2888 12.7005 11.2864C12.5208 11.1099 12.2746 11.0008 12.003 11L12 11L11.997 11C11.8625 11.0004 11.7343 11.0273 11.6172 11.0759C11.502 11.1236 11.3938 11.1937 11.2995 11.2864C11.297 11.2888 11.2946 11.2912 11.2922 11.2936L7.29289 15.2929C6.90237 15.6834 6.90237 16.3166 7.29289 16.7071C7.68342 17.0976 8.31658 17.0976 8.70711 16.7071L11 14.4142Z",fill:"currentColor"})]}),Y5=()=>g.jsx("svg",{width:"43",height:"57",viewBox:"0 0 43 57",fill:"currentColor",className:"tiptap-image-upload-dropzone-rect-primary",xmlns:"http://www.w3.org/2000/svg",children:g.jsx("path",{d:"M0.75 10.75C0.75 5.64137 4.89137 1.5 10 1.5H32.3431C33.2051 1.5 34.0317 1.84241 34.6412 2.4519L40.2981 8.10876C40.9076 8.71825 41.25 9.5449 41.25 10.4069V46.75C41.25 51.8586 37.1086 56 32 56H10C4.89137 56 0.75 51.8586 0.75 46.75V10.75Z",fill:"currentColor",fillOpacity:"0.11",stroke:"currentColor",strokeWidth:"1.5"})}),X5=()=>g.jsx("svg",{width:"10",height:"10",className:"tiptap-image-upload-dropzone-rect-secondary",viewBox:"0 0 10 10",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:g.jsx("path",{d:"M0 0.75H0.343146C1.40401 0.75 2.42143 1.17143 3.17157 1.92157L8.82843 7.57843C9.57857 8.32857 10 9.34599 10 10.4069V10.75H4C1.79086 10.75 0 8.95914 0 6.75V0.75Z",fill:"currentColor"})}),Q5=({onFile:t,children:e})=>{const[n,r]=y.useState(!1),[o,i]=y.useState(!1),s=u=>{u.preventDefault(),u.stopPropagation(),i(!0)},l=u=>{u.preventDefault(),u.stopPropagation(),u.currentTarget.contains(u.relatedTarget)||(i(!1),r(!1))},a=u=>{u.preventDefault(),u.stopPropagation(),r(!0)},c=u=>{u.preventDefault(),u.stopPropagation(),i(!1),r(!1);const d=Array.from(u.dataTransfer.files);d.length>0&&t(d)};return g.jsx("div",{className:`tiptap-image-upload-drag-area ${o?"drag-active":""} ${n?"drag-over":""}`,onDragEnter:s,onDragLeave:l,onDragOver:a,onDrop:c,children:e})},e3=({fileItem:t,onRemove:e})=>{const n=r=>{if(r===0)return"0 Bytes";const o=1024,i=["Bytes","KB","MB","GB"],s=Math.floor(Math.log(r)/Math.log(o));return`${parseFloat((r/Math.pow(o,s)).toFixed(2))} ${i[s]}`};return g.jsxs("div",{className:"tiptap-image-upload-preview",children:[t.status==="uploading"&&g.jsx("div",{className:"tiptap-image-upload-progress",style:{width:`${t.progress}%`}}),g.jsxs("div",{className:"tiptap-image-upload-preview-content",children:[g.jsxs("div",{className:"tiptap-image-upload-file-info",children:[g.jsx("div",{className:"tiptap-image-upload-file-icon",children:g.jsx(zm,{})}),g.jsxs("div",{className:"tiptap-image-upload-details",children:[g.jsx("span",{className:"tiptap-image-upload-text",children:t.file.name}),g.jsx("span",{className:"tiptap-image-upload-subtext",children:n(t.file.size)})]})]}),g.jsxs("div",{className:"tiptap-image-upload-actions",children:[t.status==="uploading"&&g.jsxs("span",{className:"tiptap-image-upload-progress-text",children:[t.progress,"%"]}),g.jsx(fe,{type:"button","data-style":"ghost",onClick:r=>{r.stopPropagation(),e()},children:g.jsx(Vm,{className:"tiptap-button-icon"})})]})]})]})},t3=({maxSize:t,limit:e})=>g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"tiptap-image-upload-dropzone",children:[g.jsx(Y5,{}),g.jsx(X5,{}),g.jsx("div",{className:"tiptap-image-upload-icon-container",children:g.jsx(zm,{})})]}),g.jsxs("div",{className:"tiptap-image-upload-content",children:[g.jsxs("span",{className:"tiptap-image-upload-text",children:[g.jsx("em",{children:"Click to upload"})," or drag and drop"]}),g.jsxs("span",{className:"tiptap-image-upload-subtext",children:["Maximum ",e," file",e===1?"":"s",", ",t/1024/1024,"MB each."]})]})]}),n3=t=>{const{accept:e,limit:n,maxSize:r}=t.node.attrs,o=y.useRef(null),i=t.extension,s={maxSize:r,limit:n,accept:e,upload:i.options.upload,onSuccess:i.options.onSuccess,onError:i.options.onError},{fileItems:l,uploadFiles:a,removeFileItem:c,clearAllFiles:u}=Z5(s),d=async m=>{const v=await a(m);if(v.length>0){const b=t.getPos();if(yt(b)){const C=v.map((x,w)=>{const E=m[w]?.name.replace(/\.[^/.]+$/,"")||"unknown";return{type:i.options.type,attrs:{...i.options,src:x,alt:E,title:E}}});t.editor.chain().focus().deleteRange({from:b,to:b+t.node.nodeSize}).insertContentAt(b,C).run(),$5(t.editor)}}},f=m=>{const v=m.target.files;if(!v||v.length===0){i.options.onError?.(new Error("No file selected"));return}d(Array.from(v))},h=()=>{o.current&&l.length===0&&(o.current.value="",o.current.click())},p=l.length>0;return g.jsxs(Np,{className:"tiptap-image-upload",tabIndex:0,onClick:h,children:[!p&&g.jsx(Q5,{onFile:d,children:g.jsx(t3,{maxSize:r,limit:n})}),p&&g.jsxs("div",{className:"tiptap-image-upload-previews",children:[l.length>1&&g.jsxs("div",{className:"tiptap-image-upload-header",children:[g.jsxs("span",{children:["Uploading ",l.length," files"]}),g.jsx(fe,{type:"button","data-style":"ghost",onClick:m=>{m.stopPropagation(),u()},children:"Clear All"})]}),l.map(m=>g.jsx(e3,{fileItem:m,onRemove:()=>c(m.id)},m.id))]}),g.jsx("input",{ref:o,name:"file",accept:e,type:"file",multiple:n>1,onChange:f,onClick:m=>m.stopPropagation()})]})},r3=je.create({name:"imageUpload",group:"block",draggable:!0,atom:!0,addOptions(){return{type:"image",accept:"image/*",limit:1,maxSize:0,upload:void 0,onError:void 0,onSuccess:void 0,HTMLAttributes:{}}},addAttributes(){return{accept:{default:this.options.accept},limit:{default:this.options.limit},maxSize:{default:this.options.maxSize}}},parseHTML(){return[{tag:'div[data-type="image-upload"]'}]},renderHTML({HTMLAttributes:t}){return["div",re({"data-type":"image-upload"},t)]},addNodeView(){return Ip(n3)},addCommands(){return{setImageUploadNode:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addKeyboardShortcuts(){return{Enter:({editor:t})=>{const{selection:e}=t.state,{nodeAfter:n}=e.$from;if(n&&n.type.name==="imageUpload"&&t.isActive("imageUpload")){const r=t.view.nodeDOM(e.$from.pos);if(r&&r instanceof HTMLElement){const o=r.firstChild;if(o&&o instanceof HTMLElement)return o.click(),!0}}return!1}}}}),o3=xx.extend({renderHTML(){return["div",re(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]}}),i3=({node:t,updateAttributes:e,selected:n})=>{const[r,o]=j.useState(!1),[i,s]=j.useState({width:t.attrs.width||300,height:t.attrs.height||"auto"}),l=j.useRef(null),a=j.useRef(null),c=j.useRef(t.attrs.width||300),u=t.attrs.imageId||`img-${Date.now()}`;j.useEffect(()=>{s({width:t.attrs.width||300,height:t.attrs.height||"auto"})},[t.attrs.width,t.attrs.height]);const d=j.useCallback(v=>{v.preventDefault(),v.stopPropagation(),o(!0);const b=v.clientX,C=typeof i.width=="number"?i.width:300,x=l.current;let w=1;x&&x.naturalWidth&&x.naturalHeight&&(w=x.naturalWidth/x.naturalHeight);const E=S=>{const M=S.clientX-b,N=Math.max(50,C+M);c.current=N;const P=i.height==="auto"?"auto":Math.max(30,N/w);s({width:N,height:P}),a.current&&(a.current.style.width=`${N}px`,P!=="auto"&&(a.current.style.height=`${P}px`))},k=()=>{o(!1);const S=Math.round(c.current);e({width:S}),document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",k)};document.addEventListener("mousemove",E),document.addEventListener("mouseup",k)},[i,e]),f=j.useCallback(()=>{i.height==="auto"&&l.current&&s(v=>({...v,height:"auto"}))},[i.width,i.height]),h={position:"relative",display:"inline-block",width:i.width,height:i.height==="auto"?"auto":i.height,maxWidth:"100%",userSelect:r?"none":"auto",outline:n?"2px solid #007bff":"none",outlineOffset:"2px"},p={width:"100%",height:i.height==="auto"?"auto":"100%",display:"block",objectFit:"contain"},m={position:"absolute",bottom:-5,right:-5,width:12,height:12,background:"#007bff",border:"2px solid white",borderRadius:"50%",cursor:"nw-resize",opacity:n||r?1:0,transition:"opacity 0.2s ease",zIndex:10,boxShadow:"0 2px 4px rgba(0,0,0,0.2)"};return g.jsx(Np,{className:"resizable-image-wrapper","data-drag-handle":"",children:g.jsxs("div",{ref:a,id:`resizable-image-${u}`,style:h,onMouseEnter:()=>{if(a.current){const v=a.current.querySelector(".resize-handle");v&&(v.style.opacity="1")}},onMouseLeave:()=>{if(!r&&!n&&a.current){const v=a.current.querySelector(".resize-handle");v&&(v.style.opacity="0")}},children:[g.jsx("img",{ref:l,src:t.attrs.src,alt:t.attrs.alt||"",title:t.attrs.title||"",style:p,onLoad:f,draggable:!1}),g.jsx("div",{className:"resize-handle",style:m,onMouseDown:d,title:"拖拽調整圖片大小"}),(n||r)&&g.jsxs("div",{style:{position:"absolute",top:-25,left:0,background:"rgba(0, 0, 0, 0.8)",color:"white",padding:"2px 6px",borderRadius:"3px",fontSize:"12px",whiteSpace:"nowrap",zIndex:11},children:[typeof i.width=="number"?Math.round(i.width):i.width," ","×"," ",i.height==="auto"?"auto":typeof i.height=="number"?Math.round(i.height):i.height]})]})})},s3=je.create({name:"resizableImage",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null,parseHTML:t=>{const e=t.getAttribute("width");return e?parseInt(e):null},renderHTML:t=>t.width?{width:t.width,height:"auto"}:{}},imageId:{default:null,parseHTML:t=>t.getAttribute("data-image-id"),renderHTML:t=>t.imageId?{"data-image-id":t.imageId}:{}}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])',getAttrs:t=>{const e=t,n=e.getAttribute("width"),r=e.getAttribute("data-image-id");return{src:e.getAttribute("src"),alt:e.getAttribute("alt"),title:e.getAttribute("title"),width:n?parseInt(n):300,imageId:r||`img-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}}}]},renderHTML({HTMLAttributes:t}){return["img",re(this.options.HTMLAttributes,t)]},addCommands(){return{setResizableImage:t=>({commands:e})=>{const n=`img-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return e.insertContent({type:this.name,attrs:{...t,imageId:n,width:t.width||300}})},setImageSize:t=>({commands:e})=>e.updateAttributes(this.name,t)}},addNodeView(){return Ip(i3)}}),mc=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.29289 8.29289C5.68342 7.90237 6.31658 7.90237 6.70711 8.29289L12 13.5858L17.2929 8.29289C17.6834 7.90237 18.3166 7.90237 18.7071 8.29289C19.0976 8.68342 19.0976 9.31658 18.7071 9.70711L12.7071 15.7071C12.3166 16.0976 11.6834 16.0976 11.2929 15.7071L5.29289 9.70711C4.90237 9.31658 4.90237 8.68342 5.29289 8.29289Z",fill:"currentColor"})}));mc.displayName="ChevronDownIcon";function ie(t){const{editor:e}=KC(),n=y.useMemo(()=>t||e,[t,e]);return Ap({editor:n,selector(o){return o.editor?{editor:o.editor,editorState:o.editor.state,canCommand:o.editor.can}:{editor:null,editorState:void 0,canCommand:void 0}}})||{editor:null}}const vt=y.forwardRef(({variant:t,size:e="default",appearance:n="default",trimText:r=!1,className:o,children:i,...s},l)=>g.jsx("div",{ref:l,className:`tiptap-badge ${o||""}`,"data-style":t,"data-size":e,"data-appearance":n,"data-text-trim":r?"on":"off",...s,children:i}));vt.displayName="Badge";function l3({level:t,shortcutKeys:e=Xm[t]}){return g.jsx(vt,{children:gt({shortcutKeys:e})})}const Um=y.forwardRef(({editor:t,level:e,text:n,hideWhenUnavailable:r=!1,onToggled:o,showShortcut:i=!1,onClick:s,children:l,...a},c)=>{const{editor:u}=ie(t),{isVisible:d,canToggle:f,isActive:h,handleToggle:p,label:m,Icon:v,shortcutKeys:b}=c3({editor:u,level:e,hideWhenUnavailable:r,onToggled:o}),C=y.useCallback(x=>{s?.(x),!x.defaultPrevented&&p()},[p,s]);return d?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":h?"on":"off",role:"button",tabIndex:-1,disabled:!f,"data-disabled":!f,"aria-label":m,"aria-pressed":h,tooltip:m,onClick:C,...a,ref:c,children:l??g.jsxs(g.Fragment,{children:[g.jsx(v,{className:"tiptap-button-icon"}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(l3,{level:e,shortcutKeys:b})]})}):null});Um.displayName="HeadingButton";const Wm=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),g.jsx("path",{d:"M21.0001 10C21.0001 9.63121 20.7971 9.29235 20.472 9.11833C20.1468 8.94431 19.7523 8.96338 19.4454 9.16795L16.4454 11.168C15.9859 11.4743 15.8617 12.0952 16.1681 12.5547C16.4744 13.0142 17.0953 13.1384 17.5548 12.8321L19.0001 11.8685V18C19.0001 18.5523 19.4478 19 20.0001 19C20.5524 19 21.0001 18.5523 21.0001 18V10Z",fill:"currentColor"})]}));Wm.displayName="HeadingOneIcon";const Km=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),g.jsx("path",{d:"M22.0001 12C22.0001 10.7611 21.1663 9.79297 20.0663 9.42632C18.9547 9.05578 17.6171 9.28724 16.4001 10.2C15.9582 10.5314 15.8687 11.1582 16.2001 11.6C16.5314 12.0418 17.1582 12.1314 17.6001 11.8C18.383 11.2128 19.0455 11.1942 19.4338 11.3237C19.8339 11.457 20.0001 11.7389 20.0001 12C20.0001 12.4839 19.8554 12.7379 19.6537 12.9481C19.4275 13.1837 19.1378 13.363 18.7055 13.6307C18.6313 13.6767 18.553 13.7252 18.4701 13.777C17.9572 14.0975 17.3128 14.5261 16.8163 15.2087C16.3007 15.9177 16.0001 16.8183 16.0001 18C16.0001 18.5523 16.4478 19 17.0001 19H21.0001C21.5523 19 22.0001 18.5523 22.0001 18C22.0001 17.4477 21.5523 17 21.0001 17H18.131C18.21 16.742 18.3176 16.5448 18.4338 16.385C18.6873 16.0364 19.0429 15.7775 19.5301 15.473C19.5898 15.4357 19.6536 15.3966 19.7205 15.3556C20.139 15.0992 20.6783 14.7687 21.0964 14.3332C21.6447 13.7621 22.0001 13.0161 22.0001 12Z",fill:"currentColor"})]}));Km.displayName="HeadingTwoIcon";const qm=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M4 5C4.55228 5 5 5.44772 5 6V11H11V6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V13H5V18C5 18.5523 4.55228 19 4 19C3.44772 19 3 18.5523 3 18V6C3 5.44772 3.44772 5 4 5Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.4608 11.2169C19.1135 11.0531 18.5876 11.0204 18.0069 11.3619C17.5309 11.642 16.918 11.4831 16.638 11.007C16.358 10.531 16.5169 9.91809 16.9929 9.63807C18.1123 8.97962 19.3364 8.94691 20.314 9.40808C21.2839 9.86558 21.9999 10.818 21.9999 12C21.9999 12.7957 21.6838 13.5587 21.1212 14.1213C20.5586 14.6839 19.7956 15 18.9999 15C18.4476 15 17.9999 14.5523 17.9999 14C17.9999 13.4477 18.4476 13 18.9999 13C19.2651 13 19.5195 12.8947 19.707 12.7071C19.8946 12.5196 19.9999 12.2652 19.9999 12C19.9999 11.6821 19.8159 11.3844 19.4608 11.2169Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.0001 14C18.0001 13.4477 18.4478 13 19.0001 13C19.7957 13 20.5588 13.3161 21.1214 13.8787C21.684 14.4413 22.0001 15.2043 22.0001 16C22.0001 17.2853 21.2767 18.3971 20.1604 18.8994C19.0257 19.41 17.642 19.2315 16.4001 18.3C15.9582 17.9686 15.8687 17.3418 16.2001 16.9C16.5314 16.4582 17.1582 16.3686 17.6001 16.7C18.3581 17.2685 18.9744 17.24 19.3397 17.0756C19.7234 16.9029 20.0001 16.5147 20.0001 16C20.0001 15.7348 19.8947 15.4804 19.7072 15.2929C19.5196 15.1054 19.2653 15 19.0001 15C18.4478 15 18.0001 14.5523 18.0001 14Z",fill:"currentColor"})]}));qm.displayName="HeadingThreeIcon";const Gm=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M4 5C4.55228 5 5 5.44772 5 6V11H11V6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V13H5V18C5 18.5523 4.55228 19 4 19C3.44772 19 3 18.5523 3 18V6C3 5.44772 3.44772 5 4 5Z",fill:"currentColor"}),g.jsx("path",{d:"M17 9C17.5523 9 18 9.44772 18 10V13H20V10C20 9.44772 20.4477 9 21 9C21.5523 9 22 9.44772 22 10V18C22 18.5523 21.5523 19 21 19C20.4477 19 20 18.5523 20 18V15H17C16.4477 15 16 14.5523 16 14V10C16 9.44772 16.4477 9 17 9Z",fill:"currentColor"})]}));Gm.displayName="HeadingFourIcon";const Jm=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),g.jsx("path",{d:"M16 10C16 9.44772 16.4477 9 17 9H21C21.5523 9 22 9.44772 22 10C22 10.5523 21.5523 11 21 11H18V12H18.3C20.2754 12 22 13.4739 22 15.5C22 17.5261 20.2754 19 18.3 19C17.6457 19 17.0925 18.8643 16.5528 18.5944C16.0588 18.3474 15.8586 17.7468 16.1055 17.2528C16.3525 16.7588 16.9532 16.5586 17.4472 16.8056C17.7074 16.9357 17.9542 17 18.3 17C19.3246 17 20 16.2739 20 15.5C20 14.7261 19.3246 14 18.3 14H17C16.4477 14 16 13.5523 16 13L16 12.9928V10Z",fill:"currentColor"})]}));Jm.displayName="HeadingFiveIcon";const Zm=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20.7071 9.29289C21.0976 9.68342 21.0976 10.3166 20.7071 10.7071C19.8392 11.575 19.2179 12.2949 18.7889 13.0073C18.8587 13.0025 18.929 13 19 13C20.6569 13 22 14.3431 22 16C22 17.6569 20.6569 19 19 19C17.3431 19 16 17.6569 16 16C16 14.6007 16.2837 13.4368 16.8676 12.3419C17.4384 11.2717 18.2728 10.3129 19.2929 9.29289C19.6834 8.90237 20.3166 8.90237 20.7071 9.29289ZM19 17C18.4477 17 18 16.5523 18 16C18 15.4477 18.4477 15 19 15C19.5523 15 20 15.4477 20 16C20 16.5523 19.5523 17 19 17Z",fill:"currentColor"})]}));Zm.displayName="HeadingSixIcon";const Ym={1:Wm,2:Km,3:qm,4:Gm,5:Jm,6:Zm},Xm={1:"ctrl+alt+1",2:"ctrl+alt+2",3:"ctrl+alt+3",4:"ctrl+alt+4",5:"ctrl+alt+5",6:"ctrl+alt+6"};function Kr(t,e,n=!0){if(!t||!t.isEditable||!_t("heading",t)||Ht(t,["image"]))return!1;if(!n)return e?t.can().setNode("heading",{level:e}):t.can().setNode("heading");try{const o=t.view.state,i=o.selection;if(i.empty||i instanceof V){const s=hn({editor:t,node:o.selection.$anchor.node(1)})?.pos;if(!yt(s))return!1}return!0}catch{return!1}}function gc(t,e){return!t||!t.isEditable?!1:Array.isArray(e)?e.some(n=>t.isActive("heading",{level:n})):e?t.isActive("heading",{level:e}):t.isActive("heading")}function a3(t,e){if(!t||!t.isEditable)return!1;const n=Array.isArray(e)?e:[e],r=n.find(o=>Kr(t,o));if(!r)return!1;try{const o=t.view;let i=o.state,s=i.tr;if(i.selection.empty||i.selection instanceof V){const d=hn({editor:t,node:i.selection.$anchor.node(1)})?.pos;if(!yt(d))return!1;s=s.setSelection(B.create(i.doc,d)),o.dispatch(s),i=o.state}const l=i.selection;let a=t.chain().focus();if(l instanceof B){const d=l.node.firstChild?.firstChild,f=l.node.lastChild?.lastChild,h=d?l.from+d.nodeSize:l.from+1,p=f?l.to-f.nodeSize:l.to-1;a=a.setTextSelection({from:h,to:p}).clearNodes()}return(n.some(d=>t.isActive("heading",{level:d}))?a.setNode("paragraph"):a.setNode("heading",{level:r})).run(),t.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function Qm(t){const{editor:e,level:n,hideWhenUnavailable:r}=t;return!e||!e.isEditable||!_t("heading",e)?!1:r&&!e.isActive("code")?Array.isArray(n)?n.some(o=>Kr(e,o)):Kr(e,n):!0}function c3(t){const{editor:e,level:n,hideWhenUnavailable:r=!1,onToggled:o}=t,{editor:i}=ie(e),[s,l]=y.useState(!0),a=Kr(i,n),c=gc(i,n);y.useEffect(()=>{if(!i)return;const d=()=>{l(Qm({editor:i,level:n,hideWhenUnavailable:r}))};return d(),i.on("selectionUpdate",d),()=>{i.off("selectionUpdate",d)}},[i,n,r]);const u=y.useCallback(()=>{if(!i)return!1;const d=a3(i,n);return d&&o?.(),d},[i,n,o]);return{isVisible:s,isActive:c,handleToggle:u,canToggle:a,label:`Heading ${n}`,shortcutKeys:Xm[n],Icon:Ym[n]}}function J(t,e,{checkForDefaultPrevented:n=!0}={}){return function(o){if(t?.(o),n===!1||!o.defaultPrevented)return e?.(o)}}function sf(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function cs(...t){return e=>{let n=!1;const r=t.map(o=>{const i=sf(o,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():sf(t[o],null)}}}}function Oe(...t){return y.useCallback(cs(...t),t)}function dr(t,e=[]){let n=[];function r(i,s){const l=y.createContext(s),a=n.length;n=[...n,s];const c=d=>{const{scope:f,children:h,...p}=d,m=f?.[t]?.[a]||l,v=y.useMemo(()=>p,Object.values(p));return g.jsx(m.Provider,{value:v,children:h})};c.displayName=i+"Provider";function u(d,f){const h=f?.[t]?.[a]||l,p=y.useContext(h);if(p)return p;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[c,u]}const o=()=>{const i=n.map(s=>y.createContext(s));return function(l){const a=l?.[t]||i;return y.useMemo(()=>({[`__scope${t}`]:{...l,[t]:a}}),[l,a])}};return o.scopeName=t,[r,u3(o,...e)]}function u3(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((l,{useScope:a,scopeName:c})=>{const d=a(i)[`__scope${c}`];return{...l,...d}},{});return y.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}var un=globalThis?.document?y.useLayoutEffect:()=>{},d3=y[" useInsertionEffect ".trim().toString()]||un;function yc({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[o,i,s]=f3({defaultProp:e,onChange:n}),l=t!==void 0,a=l?t:o;{const u=y.useRef(t!==void 0);y.useEffect(()=>{const d=u.current;d!==l&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=l},[l,r])}const c=y.useCallback(u=>{if(l){const d=h3(u)?u(t):u;d!==t&&s.current?.(d)}else i(u)},[l,t,i,s]);return[a,c]}function f3({defaultProp:t,onChange:e}){const[n,r]=y.useState(t),o=y.useRef(n),i=y.useRef(e);return d3(()=>{i.current=e},[e]),y.useEffect(()=>{o.current!==n&&(i.current?.(n),o.current=n)},[n,o]),[n,r,i]}function h3(t){return typeof t=="function"}function qr(t){const e=p3(t),n=y.forwardRef((r,o)=>{const{children:i,...s}=r,l=y.Children.toArray(i),a=l.find(g3);if(a){const c=a.props.children,u=l.map(d=>d===a?y.Children.count(c)>1?y.Children.only(null):y.isValidElement(c)?c.props.children:null:d);return g.jsx(e,{...s,ref:o,children:y.isValidElement(c)?y.cloneElement(c,void 0,u):null})}return g.jsx(e,{...s,ref:o,children:i})});return n.displayName=`${t}.Slot`,n}function p3(t){const e=y.forwardRef((n,r)=>{const{children:o,...i}=n;if(y.isValidElement(o)){const s=v3(o),l=y3(i,o.props);return o.type!==y.Fragment&&(l.ref=r?cs(r,s):s),y.cloneElement(o,l)}return y.Children.count(o)>1?y.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var m3=Symbol("radix.slottable");function g3(t){return y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===m3}function y3(t,e){const n={...e};for(const r in e){const o=t[r],i=e[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...l)=>{const a=i(...l);return o(...l),a}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...t,...n}}function v3(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var b3=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Te=b3.reduce((t,e)=>{const n=qr(`Primitive.${e}`),r=y.forwardRef((o,i)=>{const{asChild:s,...l}=o,a=s?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),g.jsx(a,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function e1(t,e){t&&pa.flushSync(()=>t.dispatchEvent(e))}function t1(t){const e=t+"CollectionProvider",[n,r]=dr(e),[o,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=m=>{const{scope:v,children:b}=m,C=j.useRef(null),x=j.useRef(new Map).current;return g.jsx(o,{scope:v,itemMap:x,collectionRef:C,children:b})};s.displayName=e;const l=t+"CollectionSlot",a=qr(l),c=j.forwardRef((m,v)=>{const{scope:b,children:C}=m,x=i(l,b),w=Oe(v,x.collectionRef);return g.jsx(a,{ref:w,children:C})});c.displayName=l;const u=t+"CollectionItemSlot",d="data-radix-collection-item",f=qr(u),h=j.forwardRef((m,v)=>{const{scope:b,children:C,...x}=m,w=j.useRef(null),E=Oe(v,w),k=i(u,b);return j.useEffect(()=>(k.itemMap.set(w,{ref:w,...x}),()=>void k.itemMap.delete(w))),g.jsx(f,{[d]:"",ref:E,children:C})});h.displayName=u;function p(m){const v=i(t+"CollectionConsumer",m);return j.useCallback(()=>{const C=v.collectionRef.current;if(!C)return[];const x=Array.from(C.querySelectorAll(`[${d}]`));return Array.from(v.itemMap.values()).sort((k,S)=>x.indexOf(k.ref.current)-x.indexOf(S.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:s,Slot:c,ItemSlot:h},p,r]}var C3=y.createContext(void 0);function n1(t){const e=y.useContext(C3);return t||e||"ltr"}function jt(t){const e=y.useRef(t);return y.useEffect(()=>{e.current=t}),y.useMemo(()=>(...n)=>e.current?.(...n),[])}function x3(t,e=globalThis?.document){const n=jt(t);y.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var w3="DismissableLayer",aa="dismissableLayer.update",S3="dismissableLayer.pointerDownOutside",k3="dismissableLayer.focusOutside",lf,r1=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),vc=y.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:l,...a}=t,c=y.useContext(r1),[u,d]=y.useState(null),f=u?.ownerDocument??globalThis?.document,[,h]=y.useState({}),p=Oe(e,S=>d(S)),m=Array.from(c.layers),[v]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),b=m.indexOf(v),C=u?m.indexOf(u):-1,x=c.layersWithOutsidePointerEventsDisabled.size>0,w=C>=b,E=T3(S=>{const M=S.target,N=[...c.branches].some(P=>P.contains(M));!w||N||(o?.(S),s?.(S),S.defaultPrevented||l?.())},f),k=A3(S=>{const M=S.target;[...c.branches].some(P=>P.contains(M))||(i?.(S),s?.(S),S.defaultPrevented||l?.())},f);return x3(S=>{C===c.layers.size-1&&(r?.(S),!S.defaultPrevented&&l&&(S.preventDefault(),l()))},f),y.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(lf=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),af(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=lf)}},[u,f,n,c]),y.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),af())},[u,c]),y.useEffect(()=>{const S=()=>h({});return document.addEventListener(aa,S),()=>document.removeEventListener(aa,S)},[]),g.jsx(Te.div,{...a,ref:p,style:{pointerEvents:x?w?"auto":"none":void 0,...t.style},onFocusCapture:J(t.onFocusCapture,k.onFocusCapture),onBlurCapture:J(t.onBlurCapture,k.onBlurCapture),onPointerDownCapture:J(t.onPointerDownCapture,E.onPointerDownCapture)})});vc.displayName=w3;var E3="DismissableLayerBranch",M3=y.forwardRef((t,e)=>{const n=y.useContext(r1),r=y.useRef(null),o=Oe(e,r);return y.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),g.jsx(Te.div,{...t,ref:o})});M3.displayName=E3;function T3(t,e=globalThis?.document){const n=jt(t),r=y.useRef(!1),o=y.useRef(()=>{});return y.useEffect(()=>{const i=l=>{if(l.target&&!r.current){let a=function(){o1(S3,n,c,{discrete:!0})};const c={originalEvent:l};l.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=a,e.addEventListener("click",o.current,{once:!0})):a()}else e.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),e.removeEventListener("pointerdown",i),e.removeEventListener("click",o.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function A3(t,e=globalThis?.document){const n=jt(t),r=y.useRef(!1);return y.useEffect(()=>{const o=i=>{i.target&&!r.current&&o1(k3,n,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function af(){const t=new CustomEvent(aa);document.dispatchEvent(t)}function o1(t,e,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),r?e1(o,i):o.dispatchEvent(i)}var cl=0;function i1(){y.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??cf()),document.body.insertAdjacentElement("beforeend",t[1]??cf()),cl++,()=>{cl===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),cl--}},[])}function cf(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var ul="focusScope.autoFocusOnMount",dl="focusScope.autoFocusOnUnmount",uf={bubbles:!1,cancelable:!0},R3="FocusScope",bc=y.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=t,[l,a]=y.useState(null),c=jt(o),u=jt(i),d=y.useRef(null),f=Oe(e,m=>a(m)),h=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let m=function(x){if(h.paused||!l)return;const w=x.target;l.contains(w)?d.current=w:zt(d.current,{select:!0})},v=function(x){if(h.paused||!l)return;const w=x.relatedTarget;w!==null&&(l.contains(w)||zt(d.current,{select:!0}))},b=function(x){if(document.activeElement===document.body)for(const E of x)E.removedNodes.length>0&&zt(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",v);const C=new MutationObserver(b);return l&&C.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",v),C.disconnect()}}},[r,l,h.paused]),y.useEffect(()=>{if(l){ff.add(h);const m=document.activeElement;if(!l.contains(m)){const b=new CustomEvent(ul,uf);l.addEventListener(ul,c),l.dispatchEvent(b),b.defaultPrevented||(O3(P3(s1(l)),{select:!0}),document.activeElement===m&&zt(l))}return()=>{l.removeEventListener(ul,c),setTimeout(()=>{const b=new CustomEvent(dl,uf);l.addEventListener(dl,u),l.dispatchEvent(b),b.defaultPrevented||zt(m??document.body,{select:!0}),l.removeEventListener(dl,u),ff.remove(h)},0)}}},[l,c,u,h]);const p=y.useCallback(m=>{if(!n&&!r||h.paused)return;const v=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(v&&b){const C=m.currentTarget,[x,w]=N3(C);x&&w?!m.shiftKey&&b===w?(m.preventDefault(),n&&zt(x,{select:!0})):m.shiftKey&&b===x&&(m.preventDefault(),n&&zt(w,{select:!0})):b===C&&m.preventDefault()}},[n,r,h.paused]);return g.jsx(Te.div,{tabIndex:-1,...s,ref:f,onKeyDown:p})});bc.displayName=R3;function O3(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(zt(r,{select:e}),document.activeElement!==n)return}function N3(t){const e=s1(t),n=df(e,t),r=df(e.reverse(),t);return[n,r]}function s1(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function df(t,e){for(const n of t)if(!I3(n,{upTo:e}))return n}function I3(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function L3(t){return t instanceof HTMLInputElement&&"select"in t}function zt(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&L3(t)&&e&&t.select()}}var ff=D3();function D3(){let t=[];return{add(e){const n=t[0];e!==n&&n?.pause(),t=hf(t,e),t.unshift(e)},remove(e){t=hf(t,e),t[0]?.resume()}}}function hf(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function P3(t){return t.filter(e=>e.tagName!=="A")}var j3=y[" useId ".trim().toString()]||(()=>{}),B3=0;function Pi(t){const[e,n]=y.useState(j3());return un(()=>{n(r=>r??String(B3++))},[t]),t||(e?`radix-${e}`:"")}var _3="Arrow",l1=y.forwardRef((t,e)=>{const{children:n,width:r=10,height:o=5,...i}=t;return g.jsx(Te.svg,{...i,ref:e,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:g.jsx("polygon",{points:"0,0 30,0 15,10"})})});l1.displayName=_3;var H3=l1;function F3(t){const[e,n]=y.useState(void 0);return un(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,l;if("borderBoxSize"in i){const a=i.borderBoxSize,c=Array.isArray(a)?a[0]:a;s=c.inlineSize,l=c.blockSize}else s=t.offsetWidth,l=t.offsetHeight;n({width:s,height:l})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var Cc="Popper",[a1,us]=dr(Cc),[$3,c1]=a1(Cc),u1=t=>{const{__scopePopper:e,children:n}=t,[r,o]=y.useState(null);return g.jsx($3,{scope:e,anchor:r,onAnchorChange:o,children:n})};u1.displayName=Cc;var d1="PopperAnchor",f1=y.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...o}=t,i=c1(d1,n),s=y.useRef(null),l=Oe(e,s),a=y.useRef(null);return y.useEffect(()=>{const c=a.current;a.current=r?.current||s.current,c!==a.current&&i.onAnchorChange(a.current)}),r?null:g.jsx(Te.div,{...o,ref:l})});f1.displayName=d1;var xc="PopperContent",[V3,z3]=a1(xc),h1=y.forwardRef((t,e)=>{const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:s=0,arrowPadding:l=0,avoidCollisions:a=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:h="optimized",onPlaced:p,...m}=t,v=c1(xc,n),[b,C]=y.useState(null),x=Oe(e,Y=>C(Y)),[w,E]=y.useState(null),k=F3(w),S=k?.width??0,M=k?.height??0,N=r+(i!=="center"?"-"+i:""),P=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},W=Array.isArray(c)?c:[c],z=W.length>0,H={padding:P,boundary:W.filter(W3),altBoundary:z},{refs:I,floatingStyles:_,placement:F,isPositioned:L,middlewareData:T}=Om({strategy:"fixed",placement:N,whileElementsMounted:(...Y)=>Am(...Y,{animationFrame:h==="always"}),elements:{reference:v.anchor},middleware:[Nm({mainAxis:o+M,alignmentAxis:s}),a&&Im({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?c5():void 0,...H}),a&&Lm({...H}),u5({...H,apply:({elements:Y,rects:te,availableWidth:Ke,availableHeight:bt})=>{const{width:Bn,height:Cs}=te.reference,_n=Y.floating.style;_n.setProperty("--radix-popper-available-width",`${Ke}px`),_n.setProperty("--radix-popper-available-height",`${bt}px`),_n.setProperty("--radix-popper-anchor-width",`${Bn}px`),_n.setProperty("--radix-popper-anchor-height",`${Cs}px`)}}),w&&f5({element:w,padding:l}),K3({arrowWidth:S,arrowHeight:M}),f&&d5({strategy:"referenceHidden",...H})]}),[R,U]=g1(F),ee=jt(p);un(()=>{L&&ee?.()},[L,ee]);const K=T.arrow?.x,Z=T.arrow?.y,We=T.arrow?.centerOffset!==0,[le,ge]=y.useState();return un(()=>{b&&ge(window.getComputedStyle(b).zIndex)},[b]),g.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{..._,transform:L?_.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:le,"--radix-popper-transform-origin":[T.transformOrigin?.x,T.transformOrigin?.y].join(" "),...T.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:g.jsx(V3,{scope:n,placedSide:R,onArrowChange:E,arrowX:K,arrowY:Z,shouldHideArrow:We,children:g.jsx(Te.div,{"data-side":R,"data-align":U,...m,ref:x,style:{...m.style,animation:L?void 0:"none"}})})})});h1.displayName=xc;var p1="PopperArrow",U3={top:"bottom",right:"left",bottom:"top",left:"right"},m1=y.forwardRef(function(e,n){const{__scopePopper:r,...o}=e,i=z3(p1,r),s=U3[i.placedSide];return g.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:g.jsx(H3,{...o,ref:n,style:{...o.style,display:"block"}})})});m1.displayName=p1;function W3(t){return t!==null}var K3=t=>({name:"transformOrigin",options:t,fn(e){const{placement:n,rects:r,middlewareData:o}=e,s=o.arrow?.centerOffset!==0,l=s?0:t.arrowWidth,a=s?0:t.arrowHeight,[c,u]=g1(n),d={start:"0%",center:"50%",end:"100%"}[u],f=(o.arrow?.x??0)+l/2,h=(o.arrow?.y??0)+a/2;let p="",m="";return c==="bottom"?(p=s?d:`${f}px`,m=`${-a}px`):c==="top"?(p=s?d:`${f}px`,m=`${r.floating.height+a}px`):c==="right"?(p=`${-a}px`,m=s?d:`${h}px`):c==="left"&&(p=`${r.floating.width+a}px`,m=s?d:`${h}px`),{data:{x:p,y:m}}}});function g1(t){const[e,n="center"]=t.split("-");return[e,n]}var y1=u1,wc=f1,v1=h1,b1=m1,q3="Portal",Sc=y.forwardRef((t,e)=>{const{container:n,...r}=t,[o,i]=y.useState(!1);un(()=>i(!0),[]);const s=n||o&&globalThis?.document?.body;return s?Hi.createPortal(g.jsx(Te.div,{...r,ref:e}),s):null});Sc.displayName=q3;function G3(t,e){return y.useReducer((n,r)=>e[n][r]??n,t)}var Dn=t=>{const{present:e,children:n}=t,r=J3(e),o=typeof n=="function"?n({present:r.isPresent}):y.Children.only(n),i=Oe(r.ref,Z3(o));return typeof n=="function"||r.isPresent?y.cloneElement(o,{ref:i}):null};Dn.displayName="Presence";function J3(t){const[e,n]=y.useState(),r=y.useRef(null),o=y.useRef(t),i=y.useRef("none"),s=t?"mounted":"unmounted",[l,a]=G3(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const c=To(r.current);i.current=l==="mounted"?c:"none"},[l]),un(()=>{const c=r.current,u=o.current;if(u!==t){const f=i.current,h=To(c);t?a("MOUNT"):h==="none"||c?.display==="none"?a("UNMOUNT"):a(u&&f!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,a]),un(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=h=>{const m=To(r.current).includes(CSS.escape(h.animationName));if(h.target===e&&m&&(a("ANIMATION_END"),!o.current)){const v=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=v)})}},f=h=>{h.target===e&&(i.current=To(r.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else a("ANIMATION_END")},[e,a]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:y.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function To(t){return t?.animationName||"none"}function Z3(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var fl="rovingFocusGroup.onEntryFocus",Y3={bubbles:!1,cancelable:!0},oo="RovingFocusGroup",[ca,C1,X3]=t1(oo),[Q3,x1]=dr(oo,[X3]),[eS,tS]=Q3(oo),w1=y.forwardRef((t,e)=>g.jsx(ca.Provider,{scope:t.__scopeRovingFocusGroup,children:g.jsx(ca.Slot,{scope:t.__scopeRovingFocusGroup,children:g.jsx(nS,{...t,ref:e})})}));w1.displayName=oo;var nS=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:a,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=t,f=y.useRef(null),h=Oe(e,f),p=n1(i),[m,v]=yc({prop:s,defaultProp:l??null,onChange:a,caller:oo}),[b,C]=y.useState(!1),x=jt(c),w=C1(n),E=y.useRef(!1),[k,S]=y.useState(0);return y.useEffect(()=>{const M=f.current;if(M)return M.addEventListener(fl,x),()=>M.removeEventListener(fl,x)},[x]),g.jsx(eS,{scope:n,orientation:r,dir:p,loop:o,currentTabStopId:m,onItemFocus:y.useCallback(M=>v(M),[v]),onItemShiftTab:y.useCallback(()=>C(!0),[]),onFocusableItemAdd:y.useCallback(()=>S(M=>M+1),[]),onFocusableItemRemove:y.useCallback(()=>S(M=>M-1),[]),children:g.jsx(Te.div,{tabIndex:b||k===0?-1:0,"data-orientation":r,...d,ref:h,style:{outline:"none",...t.style},onMouseDown:J(t.onMouseDown,()=>{E.current=!0}),onFocus:J(t.onFocus,M=>{const N=!E.current;if(M.target===M.currentTarget&&N&&!b){const P=new CustomEvent(fl,Y3);if(M.currentTarget.dispatchEvent(P),!P.defaultPrevented){const W=w().filter(F=>F.focusable),z=W.find(F=>F.active),H=W.find(F=>F.id===m),_=[z,H,...W].filter(Boolean).map(F=>F.ref.current);E1(_,u)}}E.current=!1}),onBlur:J(t.onBlur,()=>C(!1))})})}),S1="RovingFocusGroupItem",k1=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...l}=t,a=Pi(),c=i||a,u=tS(S1,n),d=u.currentTabStopId===c,f=C1(n),{onFocusableItemAdd:h,onFocusableItemRemove:p,currentTabStopId:m}=u;return y.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),g.jsx(ca.ItemSlot,{scope:n,id:c,focusable:r,active:o,children:g.jsx(Te.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...l,ref:e,onMouseDown:J(t.onMouseDown,v=>{r?u.onItemFocus(c):v.preventDefault()}),onFocus:J(t.onFocus,()=>u.onItemFocus(c)),onKeyDown:J(t.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){u.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const b=iS(v,u.orientation,u.dir);if(b!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let x=f().filter(w=>w.focusable).map(w=>w.ref.current);if(b==="last")x.reverse();else if(b==="prev"||b==="next"){b==="prev"&&x.reverse();const w=x.indexOf(v.currentTarget);x=u.loop?sS(x,w+1):x.slice(w+1)}setTimeout(()=>E1(x))}}),children:typeof s=="function"?s({isCurrentTabStop:d,hasTabStop:m!=null}):s})})});k1.displayName=S1;var rS={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function oS(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function iS(t,e,n){const r=oS(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return rS[r]}function E1(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function sS(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var lS=w1,aS=k1,cS=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},$n=new WeakMap,Ao=new WeakMap,Ro={},hl=0,M1=function(t){return t&&(t.host||M1(t.parentNode))},uS=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=M1(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},dS=function(t,e,n,r){var o=uS(e,Array.isArray(t)?t:[t]);Ro[n]||(Ro[n]=new WeakMap);var i=Ro[n],s=[],l=new Set,a=new Set(o),c=function(d){!d||l.has(d)||(l.add(d),c(d.parentNode))};o.forEach(c);var u=function(d){!d||a.has(d)||Array.prototype.forEach.call(d.children,function(f){if(l.has(f))u(f);else try{var h=f.getAttribute(r),p=h!==null&&h!=="false",m=($n.get(f)||0)+1,v=(i.get(f)||0)+1;$n.set(f,m),i.set(f,v),s.push(f),m===1&&p&&Ao.set(f,!0),v===1&&f.setAttribute(n,"true"),p||f.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",f,b)}})};return u(e),l.clear(),hl++,function(){s.forEach(function(d){var f=$n.get(d)-1,h=i.get(d)-1;$n.set(d,f),i.set(d,h),f||(Ao.has(d)||d.removeAttribute(r),Ao.delete(d)),h||d.removeAttribute(n)}),hl--,hl||($n=new WeakMap,$n=new WeakMap,Ao=new WeakMap,Ro={})}},T1=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),o=cS(t);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),dS(r,o,n,"aria-hidden")):function(){return null}},ct=function(){return ct=Object.assign||function(e){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},ct.apply(this,arguments)};function A1(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n}function fS(t,e,n){if(n||arguments.length===2)for(var r=0,o=e.length,i;r<o;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}var Fo="right-scroll-bar-position",$o="width-before-scroll-bar",hS="with-scroll-bars-hidden",pS="--removed-body-scroll-bar-size";function pl(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function mS(t,e){var n=j.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=e,n.facade}var gS=typeof window<"u"?y.useLayoutEffect:y.useEffect,pf=new WeakMap;function yS(t,e){var n=mS(null,function(r){return t.forEach(function(o){return pl(o,r)})});return gS(function(){var r=pf.get(n);if(r){var o=new Set(r),i=new Set(t),s=n.current;o.forEach(function(l){i.has(l)||pl(l,null)}),i.forEach(function(l){o.has(l)||pl(l,s)})}pf.set(n,t)},[t]),n}function vS(t){return t}function bS(t,e){e===void 0&&(e=vS);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(i){var s=e(i,r);return n.push(s),function(){n=n.filter(function(l){return l!==s})}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){r=!0;var s=[];if(n.length){var l=n;n=[],l.forEach(i),s=n}var a=function(){var u=s;s=[],u.forEach(i)},c=function(){return Promise.resolve().then(a)};c(),n={push:function(u){s.push(u),c()},filter:function(u){return s=s.filter(u),n}}}};return o}function CS(t){t===void 0&&(t={});var e=bS(null);return e.options=ct({async:!0,ssr:!1},t),e}var R1=function(t){var e=t.sideCar,n=A1(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return y.createElement(r,ct({},n))};R1.isSideCarExport=!0;function xS(t,e){return t.useMedium(e),R1}var O1=CS(),ml=function(){},ds=y.forwardRef(function(t,e){var n=y.useRef(null),r=y.useState({onScrollCapture:ml,onWheelCapture:ml,onTouchMoveCapture:ml}),o=r[0],i=r[1],s=t.forwardProps,l=t.children,a=t.className,c=t.removeScrollBar,u=t.enabled,d=t.shards,f=t.sideCar,h=t.noRelative,p=t.noIsolation,m=t.inert,v=t.allowPinchZoom,b=t.as,C=b===void 0?"div":b,x=t.gapMode,w=A1(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=f,k=yS([n,e]),S=ct(ct({},w),o);return y.createElement(y.Fragment,null,u&&y.createElement(E,{sideCar:O1,removeScrollBar:c,shards:d,noRelative:h,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!v,lockRef:n,gapMode:x}),s?y.cloneElement(y.Children.only(l),ct(ct({},S),{ref:k})):y.createElement(C,ct({},S,{className:a,ref:k}),l))});ds.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ds.classNames={fullWidth:$o,zeroRight:Fo};var wS=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function SS(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=wS();return e&&t.setAttribute("nonce",e),t}function kS(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function ES(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var MS=function(){var t=0,e=null;return{add:function(n){t==0&&(e=SS())&&(kS(e,n),ES(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},TS=function(){var t=MS();return function(e,n){y.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},N1=function(){var t=TS(),e=function(n){var r=n.styles,o=n.dynamic;return t(r,o),null};return e},AS={left:0,top:0,right:0,gap:0},gl=function(t){return parseInt(t||"",10)||0},RS=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],o=e[t==="padding"?"paddingRight":"marginRight"];return[gl(n),gl(r),gl(o)]},OS=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return AS;var e=RS(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},NS=N1(),er="data-scroll-locked",IS=function(t,e,n,r){var o=t.left,i=t.top,s=t.right,l=t.gap;return n===void 0&&(n="margin"),`
173
+ */var G7=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],ta=G7.join(","),fm=typeof Element>"u",zr=fm?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Li=!fm&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},Ur=function(e,n){var r;n===void 0&&(n=!0);var o=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),i=o===""||o==="true",s=i||n&&e&&Ur(e.parentNode);return s},J7=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},Z7=function(e,n,r){if(Ur(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(ta));return n&&zr.call(e,ta)&&o.unshift(e),o=o.filter(r),o},na=function(e,n,r){for(var o=[],i=Array.from(e);i.length;){var s=i.shift();if(!Ur(s,!1))if(s.tagName==="SLOT"){var l=s.assignedElements(),a=l.length?l:s.children,c=na(a,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:s,candidates:c})}else{var u=zr.call(s,ta);u&&r.filter(s)&&(n||!e.includes(s))&&o.push(s);var d=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),f=!Ur(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(d&&f){var h=na(d===!0?s.children:d.children,!0,r);r.flatten?o.push.apply(o,h):o.push({scopeParent:s,candidates:h})}else i.unshift.apply(i,s.children)}}return o},hm=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},pm=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||J7(e))&&!hm(e)?0:e.tabIndex},Y7=function(e,n){var r=pm(e);return r<0&&n&&!hm(e)?0:r},X7=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},mm=function(e){return e.tagName==="INPUT"},Q7=function(e){return mm(e)&&e.type==="hidden"},e4=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},t4=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},n4=function(e){if(!e.name)return!0;var n=e.form||Li(e),r=function(l){return n.querySelectorAll('input[type="radio"][name="'+l+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(e.name));else try{o=r(e.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var i=t4(o,e.form);return!i||i===e},r4=function(e){return mm(e)&&e.type==="radio"},o4=function(e){return r4(e)&&!n4(e)},i4=function(e){var n,r=e&&Li(e),o=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==e){var s,l,a;for(i=!!((s=o)!==null&&s!==void 0&&(l=s.ownerDocument)!==null&&l!==void 0&&l.contains(o)||e!=null&&(a=e.ownerDocument)!==null&&a!==void 0&&a.contains(e));!i&&o;){var c,u,d;r=Li(o),o=(c=r)===null||c===void 0?void 0:c.host,i=!!((u=o)!==null&&u!==void 0&&(d=u.ownerDocument)!==null&&d!==void 0&&d.contains(o))}}return i},jd=function(e){var n=e.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},s4=function(e,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in e){var i=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!i}if(getComputedStyle(e).visibility==="hidden")return!0;var s=zr.call(e,"details>summary:first-of-type"),l=s?e.parentElement:e;if(zr.call(l,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var a=e;e;){var c=e.parentElement,u=Li(e);if(c&&!c.shadowRoot&&o(c)===!0)return jd(e);e.assignedSlot?e=e.assignedSlot:!c&&u!==e.ownerDocument?e=u.host:e=c}e=a}if(i4(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return jd(e);return!1},l4=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return zr.call(n,"fieldset[disabled] *")?!0:!o.contains(e)}return!0}n=n.parentElement}return!1},a4=function(e,n){return!(n.disabled||Ur(n)||Q7(n)||s4(n,e)||e4(n)||l4(n))},Bd=function(e,n){return!(o4(n)||pm(n)<0||!a4(e,n))},c4=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},gm=function(e){var n=[],r=[];return e.forEach(function(o,i){var s=!!o.scopeParent,l=s?o.scopeParent:o,a=Y7(l,s),c=s?gm(o.candidates):l;a===0?s?n.push.apply(n,c):n.push(l):r.push({documentOrder:i,tabIndex:a,item:o,isScope:s,content:c})}),r.sort(X7).reduce(function(o,i){return i.isScope?o.push.apply(o,i.content):o.push(i.content),o},[]).concat(n)},ym=function(e,n){n=n||{};var r;return n.getShadowRoot?r=na([e],n.includeContainer,{filter:Bd.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:c4}):r=Z7(e,n.includeContainer,Bd.bind(null,n)),gm(r)};function u4(){const t=navigator.userAgentData;return t!=null&&t.platform?t.platform:navigator.platform}function d4(){const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(e=>{let{brand:n,version:r}=e;return n+"/"+r}).join(" "):navigator.userAgent}function vm(){return/apple/i.test(navigator.vendor)}function f4(){return u4().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function h4(){return d4().includes("jsdom/")}const _d="data-floating-ui-focusable",p4="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function ra(t){let e=t.activeElement;for(;((n=e)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;e=e.shadowRoot.activeElement}return e}function sr(t,e){if(!t||!e)return!1;const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&Yl(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function Gn(t){return"composedPath"in t?t.composedPath()[0]:t.target}function tl(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const n=t;return n.target!=null&&e.contains(n.target)}function m4(t){return t.matches("html,body")}function dt(t){return t?.ownerDocument||document}function g4(t){return Ue(t)&&t.matches(p4)}function y4(t){if(!t||h4())return!0;try{return t.matches(":focus-visible")}catch{return!0}}function v4(t){return t?t.hasAttribute(_d)?t:t.querySelector("["+_d+"]")||t:null}function _o(t,e,n){return n===void 0&&(n=!0),t.filter(o=>{var i;return o.parentId===e&&(!n||((i=o.context)==null?void 0:i.open))}).flatMap(o=>[o,..._o(t,o.id,n)])}function b4(t){return"nativeEvent"in t}function oa(t,e){const n=["mouse","pen"];return n.push("",void 0),n.includes(t)}var C4=typeof document<"u",x4=function(){},ot=C4?j.useLayoutEffect:x4;const w4={...y};function Mo(t){const e=y.useRef(t);return ot(()=>{e.current=t}),e}const S4=w4.useInsertionEffect,k4=S4||(t=>t());function at(t){const e=y.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return k4(()=>{e.current=t}),y.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.current==null?void 0:e.current(...r)},[])}const bm=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Cm(t,e){const n=ym(t,bm()),r=n.length;if(r===0)return;const o=ra(dt(t)),i=n.indexOf(o),s=i===-1?e===1?0:r-1:i+e;return n[s]}function E4(t){return Cm(dt(t).body,1)||t}function M4(t){return Cm(dt(t).body,-1)||t}function nl(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!sr(n,r)}function T4(t){ym(t,bm()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Hd(t){t.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function Fd(t,e,n){let{reference:r,floating:o}=t;const i=ut(e),s=cc(e),l=ac(s),a=Pt(e),c=i==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[l]/2-o[l]/2;let h;switch(a){case"top":h={x:u,y:r.y-o.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-o.width,y:d};break;default:h={x:r.x,y:r.y}}switch(ur(e)){case"start":h[s]-=f*(n&&c?-1:1);break;case"end":h[s]+=f*(n&&c?-1:1);break}return h}const A4=async(t,e,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,l=i.filter(Boolean),a=await(s.isRTL==null?void 0:s.isRTL(e));let c=await s.getElementRects({reference:t,floating:e,strategy:o}),{x:u,y:d}=Fd(c,r,a),f=r,h={},p=0;for(let m=0;m<l.length;m++){const{name:v,fn:b}=l[m],{x:C,y:x,data:w,reset:E}=await b({x:u,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:h,rects:c,platform:s,elements:{reference:t,floating:e}});u=C??u,d=x??d,h={...h,[v]:{...h[v],...w}},E&&p<=50&&(p++,typeof E=="object"&&(E.placement&&(f=E.placement),E.rects&&(c=E.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:o}):E.rects),{x:u,y:d}=Fd(c,f,a)),m=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:h}};async function Wr(t,e){var n;e===void 0&&(e={});const{x:r,y:o,platform:i,rects:s,elements:l,strategy:a}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=Dt(e,t),p=dm(h),v=l[f?d==="floating"?"reference":"floating":d],b=Ii(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),C=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),w=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},E=Ii(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:C,offsetParent:x,strategy:a}):C);return{top:(b.top-E.top+p.top)/w.y,bottom:(E.bottom-b.bottom+p.bottom)/w.y,left:(b.left-E.left+p.left)/w.x,right:(E.right-b.right+p.right)/w.x}}const R4=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:o,rects:i,platform:s,elements:l,middlewareData:a}=e,{element:c,padding:u=0}=Dt(t,e)||{};if(c==null)return{};const d=dm(u),f={x:n,y:r},h=cc(o),p=ac(h),m=await s.getDimensions(c),v=h==="y",b=v?"top":"left",C=v?"bottom":"right",x=v?"clientHeight":"clientWidth",w=i.reference[p]+i.reference[h]-f[h]-i.floating[p],E=f[h]-i.reference[h],k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let S=k?k[x]:0;(!S||!await(s.isElement==null?void 0:s.isElement(k)))&&(S=l.floating[x]||i.floating[p]);const M=w/2-E/2,N=S/2-m[p]/2-1,P=cn(d[b],N),z=cn(d[C],N),U=P,H=S-m[p]-z,I=S/2-m[p]/2+M,_=Ql(U,I,H),F=!a.arrow&&ur(o)!=null&&I!==_&&i.reference[p]/2-(I<U?P:z)-m[p]/2<0,L=F?I<U?I-U:I-H:0;return{[h]:f[h]+L,data:{[h]:_,centerOffset:I-_-L,...F&&{alignmentOffset:L}},reset:F}}}),O4=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:l,platform:a,elements:c}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...v}=Dt(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=Pt(o),C=ut(l),x=Pt(l)===l,w=await(a.isRTL==null?void 0:a.isRTL(c.floating)),E=f||(x||!m?[Ni(l)]:V7(l)),k=p!=="none";!f&&k&&E.push(...K7(l,m,p,w));const S=[l,...E],M=await Wr(e,v),N=[];let P=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&N.push(M[b]),d){const I=$7(o,s,w);N.push(M[I[0]],M[I[1]])}if(P=[...P,{placement:o,overflows:N}],!N.every(I=>I<=0)){var z,U;const I=(((z=i.flip)==null?void 0:z.index)||0)+1,_=S[I];if(_&&(!(d==="alignment"?C!==ut(_):!1)||P.every(T=>ut(T.placement)===C?T.overflows[0]>0:!0)))return{data:{index:I,overflows:P},reset:{placement:_}};let F=(U=P.filter(L=>L.overflows[0]<=0).sort((L,T)=>L.overflows[1]-T.overflows[1])[0])==null?void 0:U.placement;if(!F)switch(h){case"bestFit":{var H;const L=(H=P.filter(T=>{if(k){const R=ut(T.placement);return R===C||R==="y"}return!0}).map(T=>[T.placement,T.overflows.filter(R=>R>0).reduce((R,W)=>R+W,0)]).sort((T,R)=>T[1]-R[1])[0])==null?void 0:H[0];L&&(F=L);break}case"initialPlacement":F=l;break}if(o!==F)return{reset:{placement:F}}}return{}}}};function $d(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Vd(t){return B7.some(e=>t[e]>=0)}const N4=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...o}=Dt(t,e);switch(r){case"referenceHidden":{const i=await Wr(e,{...o,elementContext:"reference"}),s=$d(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:Vd(s)}}}case"escaped":{const i=await Wr(e,{...o,altBoundary:!0}),s=$d(i,n.floating);return{data:{escapedOffsets:s,escaped:Vd(s)}}}default:return{}}}}},xm=new Set(["left","top"]);async function I4(t,e){const{placement:n,platform:r,elements:o}=t,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=Pt(n),l=ur(n),a=ut(n)==="y",c=xm.has(s)?-1:1,u=i&&a?-1:1,d=Dt(e,t);let{mainAxis:f,crossAxis:h,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof p=="number"&&(h=l==="end"?p*-1:p),a?{x:h*u,y:f*c}:{x:f*c,y:h*u}}const L4=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:o,y:i,placement:s,middlewareData:l}=e,a=await I4(e,t);return s===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:i+a.y,data:{...a,placement:s}}}}},D4=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:o}=e,{mainAxis:i=!0,crossAxis:s=!1,limiter:l={fn:v=>{let{x:b,y:C}=v;return{x:b,y:C}}},...a}=Dt(t,e),c={x:n,y:r},u=await Wr(e,a),d=ut(Pt(o)),f=lc(d);let h=c[f],p=c[d];if(i){const v=f==="y"?"top":"left",b=f==="y"?"bottom":"right",C=h+u[v],x=h-u[b];h=Ql(C,h,x)}if(s){const v=d==="y"?"top":"left",b=d==="y"?"bottom":"right",C=p+u[v],x=p-u[b];p=Ql(C,p,x)}const m=l.fn({...e,[f]:h,[d]:p});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[f]:i,[d]:s}}}}}},P4=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=e,{offset:l=0,mainAxis:a=!0,crossAxis:c=!0}=Dt(t,e),u={x:n,y:r},d=ut(o),f=lc(d);let h=u[f],p=u[d];const m=Dt(l,e),v=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(a){const x=f==="y"?"height":"width",w=i.reference[f]-i.floating[x]+v.mainAxis,E=i.reference[f]+i.reference[x]-v.mainAxis;h<w?h=w:h>E&&(h=E)}if(c){var b,C;const x=f==="y"?"width":"height",w=xm.has(Pt(o)),E=i.reference[d]-i.floating[x]+(w&&((b=s.offset)==null?void 0:b[d])||0)+(w?0:v.crossAxis),k=i.reference[d]+i.reference[x]+(w?0:((C=s.offset)==null?void 0:C[d])||0)-(w?v.crossAxis:0);p<E?p=E:p>k&&(p=k)}return{[f]:h,[d]:p}}}},j4=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:o,rects:i,platform:s,elements:l}=e,{apply:a=()=>{},...c}=Dt(t,e),u=await Wr(e,c),d=Pt(o),f=ur(o),h=ut(o)==="y",{width:p,height:m}=i.floating;let v,b;d==="top"||d==="bottom"?(v=d,b=f===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(b=d,v=f==="end"?"top":"bottom");const C=m-u.top-u.bottom,x=p-u.left-u.right,w=cn(m-u[v],C),E=cn(p-u[b],x),k=!e.middlewareData.shift;let S=w,M=E;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(M=x),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(S=C),k&&!f){const P=$e(u.left,0),z=$e(u.right,0),U=$e(u.top,0),H=$e(u.bottom,0);h?M=p-2*(P!==0||z!==0?P+z:$e(u.left,u.right)):S=m-2*(U!==0||H!==0?U+H:$e(u.top,u.bottom))}await a({...e,availableWidth:M,availableHeight:S});const N=await s.getDimensions(l.floating);return p!==N.width||m!==N.height?{reset:{rects:!0}}:{}}}};function wm(t){const e=tt(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const o=Ue(t),i=o?t.offsetWidth:n,s=o?t.offsetHeight:r,l=Oi(n)!==i||Oi(r)!==s;return l&&(n=i,r=s),{width:n,height:r,$:l}}function uc(t){return oe(t)?t:t.contextElement}function Qn(t){const e=uc(t);if(!Ue(e))return ft(1);const n=e.getBoundingClientRect(),{width:r,height:o,$:i}=wm(e);let s=(i?Oi(n.width):n.width)/r,l=(i?Oi(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const B4=ft(0);function Sm(t){const e=Fe(t);return!rs()||!e.visualViewport?B4:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function _4(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Fe(t)?!1:e}function Nn(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const o=t.getBoundingClientRect(),i=uc(t);let s=ft(1);e&&(r?oe(r)&&(s=Qn(r)):s=Qn(t));const l=_4(i,n,r)?Sm(i):ft(0);let a=(o.left+l.x)/s.x,c=(o.top+l.y)/s.y,u=o.width/s.x,d=o.height/s.y;if(i){const f=Fe(i),h=r&&oe(r)?Fe(r):r;let p=f,m=Xl(p);for(;m&&r&&h!==p;){const v=Qn(m),b=m.getBoundingClientRect(),C=tt(m),x=b.left+(m.clientLeft+parseFloat(C.paddingLeft))*v.x,w=b.top+(m.clientTop+parseFloat(C.paddingTop))*v.y;a*=v.x,c*=v.y,u*=v.x,d*=v.y,a+=x,c+=w,p=Fe(m),m=Xl(p)}}return Ii({width:u,height:d,x:a,y:c})}function ss(t,e){const n=is(t).scrollLeft;return e?e.left+n:Nn(mt(t)).left+n}function km(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-ss(t,n),o=n.top+e.scrollTop;return{x:r,y:o}}function H4(t){let{elements:e,rect:n,offsetParent:r,strategy:o}=t;const i=o==="fixed",s=mt(r),l=e?ns(e.floating):!1;if(r===s||l&&i)return n;let a={scrollLeft:0,scrollTop:0},c=ft(1);const u=ft(0),d=Ue(r);if((d||!d&&!i)&&((cr(r)!=="body"||to(s))&&(a=is(r)),Ue(r))){const h=Nn(r);c=Qn(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const f=s&&!d&&!i?km(s,a):ft(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-a.scrollTop*c.y+u.y+f.y}}function F4(t){return Array.from(t.getClientRects())}function $4(t){const e=mt(t),n=is(t),r=t.ownerDocument.body,o=$e(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=$e(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+ss(t);const l=-n.scrollTop;return tt(r).direction==="rtl"&&(s+=$e(e.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:l}}const zd=25;function V4(t,e){const n=Fe(t),r=mt(t),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,l=0,a=0;if(o){i=o.width,s=o.height;const u=rs();(!u||u&&e==="fixed")&&(l=o.offsetLeft,a=o.offsetTop)}const c=ss(r);if(c<=0){const u=r.ownerDocument,d=u.body,f=getComputedStyle(d),h=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,p=Math.abs(r.clientWidth-d.clientWidth-h);p<=zd&&(i-=p)}else c<=zd&&(i+=c);return{width:i,height:s,x:l,y:a}}const z4=new Set(["absolute","fixed"]);function U4(t,e){const n=Nn(t,!0,e==="fixed"),r=n.top+t.clientTop,o=n.left+t.clientLeft,i=Ue(t)?Qn(t):ft(1),s=t.clientWidth*i.x,l=t.clientHeight*i.y,a=o*i.x,c=r*i.y;return{width:s,height:l,x:a,y:c}}function Ud(t,e,n){let r;if(e==="viewport")r=V4(t,n);else if(e==="document")r=$4(mt(t));else if(oe(e))r=U4(e,n);else{const o=Sm(t);r={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return Ii(r)}function Em(t,e){const n=Lt(t);return n===e||!oe(n)||It(n)?!1:tt(n).position==="fixed"||Em(n,e)}function W4(t,e){const n=e.get(t);if(n)return n;let r=rn(t,[],!1).filter(l=>oe(l)&&cr(l)!=="body"),o=null;const i=tt(t).position==="fixed";let s=i?Lt(t):t;for(;oe(s)&&!It(s);){const l=tt(s),a=sc(s);!a&&l.position==="fixed"&&(o=null),(i?!a&&!o:!a&&l.position==="static"&&!!o&&z4.has(o.position)||to(s)&&!a&&Em(t,s))?r=r.filter(u=>u!==s):o=l,s=Lt(s)}return e.set(t,r),r}function K4(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t;const s=[...n==="clippingAncestors"?ns(e)?[]:W4(e,this._c):[].concat(n),r],l=s[0],a=s.reduce((c,u)=>{const d=Ud(e,u,o);return c.top=$e(d.top,c.top),c.right=cn(d.right,c.right),c.bottom=cn(d.bottom,c.bottom),c.left=$e(d.left,c.left),c},Ud(e,l,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function q4(t){const{width:e,height:n}=wm(t);return{width:e,height:n}}function G4(t,e,n){const r=Ue(e),o=mt(e),i=n==="fixed",s=Nn(t,!0,i,e);let l={scrollLeft:0,scrollTop:0};const a=ft(0);function c(){a.x=ss(o)}if(r||!r&&!i)if((cr(e)!=="body"||to(o))&&(l=is(e)),r){const h=Nn(e,!0,i,e);a.x=h.x+e.clientLeft,a.y=h.y+e.clientTop}else o&&c();i&&!r&&o&&c();const u=o&&!r&&!i?km(o,l):ft(0),d=s.left+l.scrollLeft-a.x-u.x,f=s.top+l.scrollTop-a.y-u.y;return{x:d,y:f,width:s.width,height:s.height}}function rl(t){return tt(t).position==="static"}function Wd(t,e){if(!Ue(t)||tt(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return mt(t)===n&&(n=n.ownerDocument.body),n}function Mm(t,e){const n=Fe(t);if(ns(t))return n;if(!Ue(t)){let o=Lt(t);for(;o&&!It(o);){if(oe(o)&&!rl(o))return o;o=Lt(o)}return n}let r=Wd(t,e);for(;r&&O7(r)&&rl(r);)r=Wd(r,e);return r&&It(r)&&rl(r)&&!sc(r)?n:r||P7(t)||n}const J4=async function(t){const e=this.getOffsetParent||Mm,n=this.getDimensions,r=await n(t.floating);return{reference:G4(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Z4(t){return tt(t).direction==="rtl"}const Y4={convertOffsetParentRelativeRectToViewportRelativeRect:H4,getDocumentElement:mt,getClippingRect:K4,getOffsetParent:Mm,getElementRects:J4,getClientRects:F4,getDimensions:q4,getScale:Qn,isElement:oe,isRTL:Z4};function Tm(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function X4(t,e){let n=null,r;const o=mt(t);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function s(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),i();const c=t.getBoundingClientRect(),{left:u,top:d,width:f,height:h}=c;if(l||e(),!f||!h)return;const p=Eo(d),m=Eo(o.clientWidth-(u+f)),v=Eo(o.clientHeight-(d+h)),b=Eo(u),x={rootMargin:-p+"px "+-m+"px "+-v+"px "+-b+"px",threshold:$e(0,cn(1,a))||1};let w=!0;function E(k){const S=k[0].intersectionRatio;if(S!==a){if(!w)return s();S?s(!1,S):r=setTimeout(()=>{s(!1,1e-7)},1e3)}S===1&&!Tm(c,t.getBoundingClientRect())&&s(),w=!1}try{n=new IntersectionObserver(E,{...x,root:o.ownerDocument})}catch{n=new IntersectionObserver(E,x)}n.observe(t)}return s(!0),i}function Am(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,c=uc(t),u=o||i?[...c?rn(c):[],...rn(e)]:[];u.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const d=c&&l?X4(c,n):null;let f=-1,h=null;s&&(h=new ResizeObserver(b=>{let[C]=b;C&&C.target===c&&h&&(h.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var x;(x=h)==null||x.observe(e)})),n()}),c&&!a&&h.observe(c),h.observe(e));let p,m=a?Nn(t):null;a&&v();function v(){const b=Nn(t);m&&!Tm(m,b)&&n(),m=b,p=requestAnimationFrame(v)}return n(),()=>{var b;u.forEach(C=>{o&&C.removeEventListener("scroll",n),i&&C.removeEventListener("resize",n)}),d?.(),(b=h)==null||b.disconnect(),h=null,a&&cancelAnimationFrame(p)}}const Q4=L4,e5=D4,t5=O4,n5=j4,r5=N4,Kd=R4,o5=P4,i5=(t,e,n)=>{const r=new Map,o={platform:Y4,...n},i={...o.platform,_c:r};return A4(t,e,{...o,platform:i})};var s5=typeof document<"u",l5=function(){},Ho=s5?j.useLayoutEffect:l5;function Di(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,o;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Di(t[r],e[r]))return!1;return!0}if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&t.$$typeof)&&!Di(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function Rm(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function qd(t,e){const n=Rm(t);return Math.round(e*n)/n}function ol(t){const e=y.useRef(t);return Ho(()=>{e.current=t}),e}function Om(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:l=!0,whileElementsMounted:a,open:c}=t,[u,d]=y.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[f,h]=y.useState(r);Di(f,r)||h(r);const[p,m]=y.useState(null),[v,b]=y.useState(null),C=y.useCallback(T=>{T!==k.current&&(k.current=T,m(T))},[]),x=y.useCallback(T=>{T!==S.current&&(S.current=T,b(T))},[]),w=i||p,E=s||v,k=y.useRef(null),S=y.useRef(null),M=y.useRef(u),N=a!=null,P=ol(a),z=ol(o),U=ol(c),H=y.useCallback(()=>{if(!k.current||!S.current)return;const T={placement:e,strategy:n,middleware:f};z.current&&(T.platform=z.current),i5(k.current,S.current,T).then(R=>{const W={...R,isPositioned:U.current!==!1};I.current&&!Di(M.current,W)&&(M.current=W,pa.flushSync(()=>{d(W)}))})},[f,e,n,z,U]);Ho(()=>{c===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,d(T=>({...T,isPositioned:!1})))},[c]);const I=y.useRef(!1);Ho(()=>(I.current=!0,()=>{I.current=!1}),[]),Ho(()=>{if(w&&(k.current=w),E&&(S.current=E),w&&E){if(P.current)return P.current(w,E,H);H()}},[w,E,H,P,N]);const _=y.useMemo(()=>({reference:k,floating:S,setReference:C,setFloating:x}),[C,x]),F=y.useMemo(()=>({reference:w,floating:E}),[w,E]),L=y.useMemo(()=>{const T={position:n,left:0,top:0};if(!F.floating)return T;const R=qd(F.floating,u.x),W=qd(F.floating,u.y);return l?{...T,transform:"translate("+R+"px, "+W+"px)",...Rm(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:R,top:W}},[n,l,F.floating,u.x,u.y]);return y.useMemo(()=>({...u,update:H,refs:_,elements:F,floatingStyles:L}),[u,H,_,F,L])}const a5=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:o}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?Kd({element:r.current,padding:o}).fn(n):{}:r?Kd({element:r,padding:o}).fn(n):{}}}},Nm=(t,e)=>({...Q4(t),options:[t,e]}),Im=(t,e)=>({...e5(t),options:[t,e]}),c5=(t,e)=>({...o5(t),options:[t,e]}),Lm=(t,e)=>({...t5(t),options:[t,e]}),u5=(t,e)=>({...n5(t),options:[t,e]}),d5=(t,e)=>({...r5(t),options:[t,e]}),f5=(t,e)=>({...a5(t),options:[t,e]});function Dm(t){const e=y.useRef(void 0),n=y.useCallback(r=>{const o=t.map(i=>{if(i!=null){if(typeof i=="function"){const s=i,l=s(r);return typeof l=="function"?l:()=>{s(null)}}return i.current=r,()=>{i.current=null}}});return()=>{o.forEach(i=>i?.())}},t);return y.useMemo(()=>t.every(r=>r==null)?null:r=>{e.current&&(e.current(),e.current=void 0),r!=null&&(e.current=n(r))},t)}const h5="data-floating-ui-focusable",Gd="active",Jd="selected",p5={...y};let Zd=!1,m5=0;const Yd=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+m5++;function g5(){const[t,e]=y.useState(()=>Zd?Yd():void 0);return ot(()=>{t==null&&e(Yd())},[]),y.useEffect(()=>{Zd=!0},[]),t}const y5=p5.useId,dc=y5||g5;let ia;process.env.NODE_ENV!=="production"&&(ia=new Set);function v5(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((t=ia)!=null&&t.has(o))){var i;(i=ia)==null||i.add(o),console.error(o)}}function b5(){const t=new Map;return{emit(e,n){var r;(r=t.get(e))==null||r.forEach(o=>o(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var r;(r=t.get(e))==null||r.delete(n)}}}const C5=y.createContext(null),x5=y.createContext(null),fc=()=>{var t;return((t=y.useContext(C5))==null?void 0:t.id)||null},hc=()=>y.useContext(x5);function no(t){return"data-floating-ui-"+t}function Ge(t){t.current!==-1&&(clearTimeout(t.current),t.current=-1)}const Xd=no("safe-polygon");function il(t,e,n){if(n&&!oa(n))return 0;if(typeof t=="number")return t;if(typeof t=="function"){const r=t();return typeof r=="number"?r:r?.[e]}return t?.[e]}function sl(t){return typeof t=="function"?t():t}function w5(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:s}=t,{enabled:l=!0,delay:a=0,handleClose:c=null,mouseOnly:u=!1,restMs:d=0,move:f=!0}=e,h=hc(),p=fc(),m=Mo(c),v=Mo(a),b=Mo(n),C=Mo(d),x=y.useRef(),w=y.useRef(-1),E=y.useRef(),k=y.useRef(-1),S=y.useRef(!0),M=y.useRef(!1),N=y.useRef(()=>{}),P=y.useRef(!1),z=at(()=>{var L;const T=(L=o.current.openEvent)==null?void 0:L.type;return T?.includes("mouse")&&T!=="mousedown"});y.useEffect(()=>{if(!l)return;function L(T){let{open:R}=T;R||(Ge(w),Ge(k),S.current=!0,P.current=!1)}return i.on("openchange",L),()=>{i.off("openchange",L)}},[l,i]),y.useEffect(()=>{if(!l||!m.current||!n)return;function L(R){z()&&r(!1,R,"hover")}const T=dt(s.floating).documentElement;return T.addEventListener("mouseleave",L),()=>{T.removeEventListener("mouseleave",L)}},[s.floating,n,r,l,m,z]);const U=y.useCallback(function(L,T,R){T===void 0&&(T=!0),R===void 0&&(R="hover");const W=il(v.current,"close",x.current);W&&!E.current?(Ge(w),w.current=window.setTimeout(()=>r(!1,L,R),W)):T&&(Ge(w),r(!1,L,R))},[v,r]),H=at(()=>{N.current(),E.current=void 0}),I=at(()=>{if(M.current){const L=dt(s.floating).body;L.style.pointerEvents="",L.removeAttribute(Xd),M.current=!1}}),_=at(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);y.useEffect(()=>{if(!l)return;function L(K){if(Ge(w),S.current=!1,u&&!oa(x.current)||sl(C.current)>0&&!il(v.current,"open"))return;const Z=il(v.current,"open",x.current);Z?w.current=window.setTimeout(()=>{b.current||r(!0,K,"hover")},Z):n||r(!0,K,"hover")}function T(K){if(_()){I();return}N.current();const Z=dt(s.floating);if(Ge(k),P.current=!1,m.current&&o.current.floatingContext){n||Ge(w),E.current=m.current({...o.current.floatingContext,tree:h,x:K.clientX,y:K.clientY,onClose(){I(),H(),_()||U(K,!0,"safe-polygon")}});const le=E.current;Z.addEventListener("mousemove",le),N.current=()=>{Z.removeEventListener("mousemove",le)};return}(x.current==="touch"?!sr(s.floating,K.relatedTarget):!0)&&U(K)}function R(K){_()||o.current.floatingContext&&(m.current==null||m.current({...o.current.floatingContext,tree:h,x:K.clientX,y:K.clientY,onClose(){I(),H(),_()||U(K)}})(K))}function W(){Ge(w)}function ee(K){_()||U(K,!1)}if(oe(s.domReference)){const K=s.domReference,Z=s.floating;return n&&K.addEventListener("mouseleave",R),f&&K.addEventListener("mousemove",L,{once:!0}),K.addEventListener("mouseenter",L),K.addEventListener("mouseleave",T),Z&&(Z.addEventListener("mouseleave",R),Z.addEventListener("mouseenter",W),Z.addEventListener("mouseleave",ee)),()=>{n&&K.removeEventListener("mouseleave",R),f&&K.removeEventListener("mousemove",L),K.removeEventListener("mouseenter",L),K.removeEventListener("mouseleave",T),Z&&(Z.removeEventListener("mouseleave",R),Z.removeEventListener("mouseenter",W),Z.removeEventListener("mouseleave",ee))}}},[s,l,t,u,f,U,H,I,r,n,b,h,v,m,o,_,C]),ot(()=>{var L;if(l&&n&&(L=m.current)!=null&&(L=L.__options)!=null&&L.blockPointerEvents&&z()){M.current=!0;const R=s.floating;if(oe(s.domReference)&&R){var T;const W=dt(s.floating).body;W.setAttribute(Xd,"");const ee=s.domReference,K=h==null||(T=h.nodesRef.current.find(Z=>Z.id===p))==null||(T=T.context)==null?void 0:T.elements.floating;return K&&(K.style.pointerEvents=""),W.style.pointerEvents="none",ee.style.pointerEvents="auto",R.style.pointerEvents="auto",()=>{W.style.pointerEvents="",ee.style.pointerEvents="",R.style.pointerEvents=""}}}},[l,n,p,s,h,m,z]),ot(()=>{n||(x.current=void 0,P.current=!1,H(),I())},[n,H,I]),y.useEffect(()=>()=>{H(),Ge(w),Ge(k),I()},[l,s.domReference,H,I]);const F=y.useMemo(()=>{function L(T){x.current=T.pointerType}return{onPointerDown:L,onPointerEnter:L,onMouseMove(T){const{nativeEvent:R}=T;function W(){!S.current&&!b.current&&r(!0,R,"hover")}u&&!oa(x.current)||n||sl(C.current)===0||P.current&&T.movementX**2+T.movementY**2<2||(Ge(k),x.current==="touch"?W():(P.current=!0,k.current=window.setTimeout(W,sl(C.current))))}}},[u,r,n,b,C]);return y.useMemo(()=>l?{reference:F}:{},[l,F])}const Qd=()=>{},S5=y.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:Qd,setState:Qd,isInstantPhase:!1});function k5(t){const{children:e,delay:n,timeoutMs:r=0}=t,[o,i]=y.useReducer((a,c)=>({...a,...c}),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),s=y.useRef(null),l=y.useCallback(a=>{i({currentId:a})},[]);return ot(()=>{o.currentId?s.current===null?s.current=o.currentId:o.isInstantPhase||i({isInstantPhase:!0}):(o.isInstantPhase&&i({isInstantPhase:!1}),s.current=null)},[o.currentId,o.isInstantPhase]),g.jsx(S5.Provider,{value:y.useMemo(()=>({...o,setState:i,setCurrentId:l}),[o,l]),children:e})}const Pm={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},ef=y.forwardRef(function(e,n){const[r,o]=y.useState();ot(()=>{vm()&&o("button")},[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[no("focus-guard")]:"",style:Pm};return g.jsx("span",{...e,...i})}),jm=y.createContext(null),tf=no("portal");function E5(t){t===void 0&&(t={});const{id:e,root:n}=t,r=dc(),o=T5(),[i,s]=y.useState(null),l=y.useRef(null);return ot(()=>()=>{i?.remove(),queueMicrotask(()=>{l.current=null})},[i]),ot(()=>{if(!r||l.current)return;const a=e?document.getElementById(e):null;if(!a)return;const c=document.createElement("div");c.id=r,c.setAttribute(tf,""),a.appendChild(c),l.current=c,s(c)},[e,r]),ot(()=>{if(n===null||!r||l.current)return;let a=n||o?.portalNode;a&&!ic(a)&&(a=a.current),a=a||document.body;let c=null;e&&(c=document.createElement("div"),c.id=e,a.appendChild(c));const u=document.createElement("div");u.id=r,u.setAttribute(tf,""),a=c||a,a.appendChild(u),l.current=u,s(u)},[e,n,r,o]),i}function M5(t){const{children:e,id:n,root:r,preserveTabOrder:o=!0}=t,i=E5({id:n,root:r}),[s,l]=y.useState(null),a=y.useRef(null),c=y.useRef(null),u=y.useRef(null),d=y.useRef(null),f=s?.modal,h=s?.open,p=!!s&&!s.modal&&s.open&&o&&!!(r||i);return y.useEffect(()=>{if(!i||!o||f)return;function m(v){i&&nl(v)&&(v.type==="focusin"?Hd:T4)(i)}return i.addEventListener("focusin",m,!0),i.addEventListener("focusout",m,!0),()=>{i.removeEventListener("focusin",m,!0),i.removeEventListener("focusout",m,!0)}},[i,o,f]),y.useEffect(()=>{i&&(h||Hd(i))},[h,i]),g.jsxs(jm.Provider,{value:y.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:c,beforeInsideRef:u,afterInsideRef:d,portalNode:i,setFocusManagerState:l}),[o,i]),children:[p&&i&&g.jsx(ef,{"data-type":"outside",ref:a,onFocus:m=>{if(nl(m,i)){var v;(v=u.current)==null||v.focus()}else{const b=s?s.domReference:null,C=M4(b);C?.focus()}}}),p&&i&&g.jsx("span",{"aria-owns":i.id,style:Pm}),i&&pa.createPortal(e,i),p&&i&&g.jsx(ef,{"data-type":"outside",ref:c,onFocus:m=>{if(nl(m,i)){var v;(v=d.current)==null||v.focus()}else{const b=s?s.domReference:null,C=E4(b);C?.focus(),s?.closeOnFocusOut&&s?.onOpenChange(!1,m.nativeEvent,"focus-out")}}})]})}const T5=()=>y.useContext(jm),A5={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},R5={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},nf=t=>{var e,n;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(n=t?.outsidePress)!=null?n:!0}};function O5(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,elements:o,dataRef:i}=t,{enabled:s=!0,escapeKey:l=!0,outsidePress:a=!0,outsidePressEvent:c="pointerdown",referencePress:u=!1,referencePressEvent:d="pointerdown",ancestorScroll:f=!1,bubbles:h,capture:p}=e,m=hc(),v=at(typeof a=="function"?a:()=>!1),b=typeof a=="function"?v:a,C=y.useRef(!1),{escapeKey:x,outsidePress:w}=nf(h),{escapeKey:E,outsidePress:k}=nf(p),S=y.useRef(!1),M=at(I=>{var _;if(!n||!s||!l||I.key!=="Escape"||S.current)return;const F=(_=i.current.floatingContext)==null?void 0:_.nodeId,L=m?_o(m.nodesRef.current,F):[];if(!x&&(I.stopPropagation(),L.length>0)){let T=!0;if(L.forEach(R=>{var W;if((W=R.context)!=null&&W.open&&!R.context.dataRef.current.__escapeKeyBubbles){T=!1;return}}),!T)return}r(!1,b4(I)?I.nativeEvent:I,"escape-key")}),N=at(I=>{var _;const F=()=>{var L;M(I),(L=Gn(I))==null||L.removeEventListener("keydown",F)};(_=Gn(I))==null||_.addEventListener("keydown",F)}),P=at(I=>{var _;const F=i.current.insideReactTree;i.current.insideReactTree=!1;const L=C.current;if(C.current=!1,c==="click"&&L||F||typeof b=="function"&&!b(I))return;const T=Gn(I),R="["+no("inert")+"]",W=dt(o.floating).querySelectorAll(R);let ee=oe(T)?T:null;for(;ee&&!It(ee);){const le=Lt(ee);if(It(le)||!oe(le))break;ee=le}if(W.length&&oe(T)&&!m4(T)&&!sr(T,o.floating)&&Array.from(W).every(le=>!sr(ee,le)))return;if(Ue(T)&&H){const le=It(T),ge=tt(T),Y=/auto|scroll/,te=le||Y.test(ge.overflowX),Ke=le||Y.test(ge.overflowY),bt=te&&T.clientWidth>0&&T.scrollWidth>T.clientWidth,Bn=Ke&&T.clientHeight>0&&T.scrollHeight>T.clientHeight,Cs=ge.direction==="rtl",_n=Bn&&(Cs?I.offsetX<=T.offsetWidth-T.clientWidth:I.offsetX>T.clientWidth),M0=bt&&I.offsetY>T.clientHeight;if(_n||M0)return}const K=(_=i.current.floatingContext)==null?void 0:_.nodeId,Z=m&&_o(m.nodesRef.current,K).some(le=>{var ge;return tl(I,(ge=le.context)==null?void 0:ge.elements.floating)});if(tl(I,o.floating)||tl(I,o.domReference)||Z)return;const We=m?_o(m.nodesRef.current,K):[];if(We.length>0){let le=!0;if(We.forEach(ge=>{var Y;if((Y=ge.context)!=null&&Y.open&&!ge.context.dataRef.current.__outsidePressBubbles){le=!1;return}}),!le)return}r(!1,I,"outside-press")}),z=at(I=>{var _;const F=()=>{var L;P(I),(L=Gn(I))==null||L.removeEventListener(c,F)};(_=Gn(I))==null||_.addEventListener(c,F)});y.useEffect(()=>{if(!n||!s)return;i.current.__escapeKeyBubbles=x,i.current.__outsidePressBubbles=w;let I=-1;function _(W){r(!1,W,"ancestor-scroll")}function F(){window.clearTimeout(I),S.current=!0}function L(){I=window.setTimeout(()=>{S.current=!1},rs()?5:0)}const T=dt(o.floating);l&&(T.addEventListener("keydown",E?N:M,E),T.addEventListener("compositionstart",F),T.addEventListener("compositionend",L)),b&&T.addEventListener(c,k?z:P,k);let R=[];return f&&(oe(o.domReference)&&(R=rn(o.domReference)),oe(o.floating)&&(R=R.concat(rn(o.floating))),!oe(o.reference)&&o.reference&&o.reference.contextElement&&(R=R.concat(rn(o.reference.contextElement)))),R=R.filter(W=>{var ee;return W!==((ee=T.defaultView)==null?void 0:ee.visualViewport)}),R.forEach(W=>{W.addEventListener("scroll",_,{passive:!0})}),()=>{l&&(T.removeEventListener("keydown",E?N:M,E),T.removeEventListener("compositionstart",F),T.removeEventListener("compositionend",L)),b&&T.removeEventListener(c,k?z:P,k),R.forEach(W=>{W.removeEventListener("scroll",_)}),window.clearTimeout(I)}},[i,o,l,b,c,n,r,f,s,x,w,M,E,N,P,k,z]),y.useEffect(()=>{i.current.insideReactTree=!1},[i,b,c]);const U=y.useMemo(()=>({onKeyDown:M,...u&&{[A5[d]]:I=>{r(!1,I.nativeEvent,"reference-press")},...d!=="click"&&{onClick(I){r(!1,I.nativeEvent,"reference-press")}}}}),[M,r,u,d]),H=y.useMemo(()=>({onKeyDown:M,onMouseDown(){C.current=!0},onMouseUp(){C.current=!0},[R5[c]]:()=>{i.current.insideReactTree=!0}}),[M,c,i]);return y.useMemo(()=>s?{reference:U,floating:H}:{},[s,U,H])}function N5(t){const{open:e=!1,onOpenChange:n,elements:r}=t,o=dc(),i=y.useRef({}),[s]=y.useState(()=>b5()),l=fc()!=null;if(process.env.NODE_ENV!=="production"){const h=r.reference;h&&!oe(h)&&v5("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,c]=y.useState(r.reference),u=at((h,p,m)=>{i.current.openEvent=h?p:void 0,s.emit("openchange",{open:h,event:p,reason:m,nested:l}),n?.(h,p,m)}),d=y.useMemo(()=>({setPositionReference:c}),[]),f=y.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return y.useMemo(()=>({dataRef:i,open:e,onOpenChange:u,elements:f,events:s,floatingId:o,refs:d}),[e,u,f,s,o,d])}function I5(t){t===void 0&&(t={});const{nodeId:e}=t,n=N5({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,o=r.elements,[i,s]=y.useState(null),[l,a]=y.useState(null),u=o?.domReference||i,d=y.useRef(null),f=hc();ot(()=>{u&&(d.current=u)},[u]);const h=Om({...t,elements:{...o,...l&&{reference:l}}}),p=y.useCallback(x=>{const w=oe(x)?{getBoundingClientRect:()=>x.getBoundingClientRect(),getClientRects:()=>x.getClientRects(),contextElement:x}:x;a(w),h.refs.setReference(w)},[h.refs]),m=y.useCallback(x=>{(oe(x)||x===null)&&(d.current=x,s(x)),(oe(h.refs.reference.current)||h.refs.reference.current===null||x!==null&&!oe(x))&&h.refs.setReference(x)},[h.refs]),v=y.useMemo(()=>({...h.refs,setReference:m,setPositionReference:p,domReference:d}),[h.refs,m,p]),b=y.useMemo(()=>({...h.elements,domReference:u}),[h.elements,u]),C=y.useMemo(()=>({...h,...r,refs:v,elements:b,nodeId:e}),[h,v,b,e,r]);return ot(()=>{r.dataRef.current.floatingContext=C;const x=f?.nodesRef.current.find(w=>w.id===e);x&&(x.context=C)}),y.useMemo(()=>({...h,context:C,refs:v,elements:b}),[h,v,b,C])}function ll(){return f4()&&vm()}function L5(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,events:o,dataRef:i,elements:s}=t,{enabled:l=!0,visibleOnly:a=!0}=e,c=y.useRef(!1),u=y.useRef(-1),d=y.useRef(!0);y.useEffect(()=>{if(!l)return;const h=Fe(s.domReference);function p(){!n&&Ue(s.domReference)&&s.domReference===ra(dt(s.domReference))&&(c.current=!0)}function m(){d.current=!0}function v(){d.current=!1}return h.addEventListener("blur",p),ll()&&(h.addEventListener("keydown",m,!0),h.addEventListener("pointerdown",v,!0)),()=>{h.removeEventListener("blur",p),ll()&&(h.removeEventListener("keydown",m,!0),h.removeEventListener("pointerdown",v,!0))}},[s.domReference,n,l]),y.useEffect(()=>{if(!l)return;function h(p){let{reason:m}=p;(m==="reference-press"||m==="escape-key")&&(c.current=!0)}return o.on("openchange",h),()=>{o.off("openchange",h)}},[o,l]),y.useEffect(()=>()=>{Ge(u)},[]);const f=y.useMemo(()=>({onMouseLeave(){c.current=!1},onFocus(h){if(c.current)return;const p=Gn(h.nativeEvent);if(a&&oe(p)){if(ll()&&!h.relatedTarget){if(!d.current&&!g4(p))return}else if(!y4(p))return}r(!0,h.nativeEvent,"focus")},onBlur(h){c.current=!1;const p=h.relatedTarget,m=h.nativeEvent,v=oe(p)&&p.hasAttribute(no("focus-guard"))&&p.getAttribute("data-type")==="outside";u.current=window.setTimeout(()=>{var b;const C=ra(s.domReference?s.domReference.ownerDocument:document);!p&&C===s.domReference||sr((b=i.current.floatingContext)==null?void 0:b.refs.floating.current,C)||sr(s.domReference,C)||v||r(!1,m,"focus")})}}),[i,s.domReference,r,a]);return y.useMemo(()=>l?{reference:f}:{},[l,f])}function al(t,e,n){const r=new Map,o=n==="item";let i=t;if(o&&t){const{[Gd]:s,[Jd]:l,...a}=t;i=a}return{...n==="floating"&&{tabIndex:-1,[h5]:""},...i,...e.map(s=>{const l=s?s[n]:null;return typeof l=="function"?t?l(t):null:l}).concat(t).reduce((s,l)=>(l&&Object.entries(l).forEach(a=>{let[c,u]=a;if(!(o&&[Gd,Jd].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof u=="function"){var d;(d=r.get(c))==null||d.push(u),s[c]=function(){for(var f,h=arguments.length,p=new Array(h),m=0;m<h;m++)p[m]=arguments[m];return(f=r.get(c))==null?void 0:f.map(v=>v(...p)).find(v=>v!==void 0)}}}else s[c]=u}),s),{})}}function D5(t){t===void 0&&(t=[]);const e=t.map(l=>l?.reference),n=t.map(l=>l?.floating),r=t.map(l=>l?.item),o=y.useCallback(l=>al(l,t,"reference"),e),i=y.useCallback(l=>al(l,t,"floating"),n),s=y.useCallback(l=>al(l,t,"item"),r);return y.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:s}),[o,i,s])}const P5=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function j5(t,e){var n,r;e===void 0&&(e={});const{open:o,elements:i,floatingId:s}=t,{enabled:l=!0,role:a="dialog"}=e,c=dc(),u=((n=i.domReference)==null?void 0:n.id)||c,d=y.useMemo(()=>{var C;return((C=v4(i.floating))==null?void 0:C.id)||s},[i.floating,s]),f=(r=P5.get(a))!=null?r:a,p=fc()!=null,m=y.useMemo(()=>f==="tooltip"||a==="label"?{["aria-"+(a==="label"?"labelledby":"describedby")]:o?d:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":f==="alertdialog"?"dialog":f,"aria-controls":o?d:void 0,...f==="listbox"&&{role:"combobox"},...f==="menu"&&{id:u},...f==="menu"&&p&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[f,d,p,o,u,a]),v=y.useMemo(()=>{const C={id:d,...f&&{role:f}};return f==="tooltip"||a==="label"?C:{...C,...f==="menu"&&{"aria-labelledby":u}}},[f,d,u,a]),b=y.useCallback(C=>{let{active:x,selected:w}=C;const E={role:"option",...x&&{id:d+"-fui-option"}};switch(a){case"select":case"combobox":return{...E,"aria-selected":w}}return{}},[d,a]);return y.useMemo(()=>l?{reference:m,floating:v,item:b}:{},[l,m,v,b])}function B5({initialOpen:t=!1,placement:e="top",open:n,onOpenChange:r,delay:o=600,closeDelay:i=0}={}){const[s,l]=y.useState(t),a=n??s,c=r??l,u=I5({placement:e,open:a,onOpenChange:c,whileElementsMounted:Am,middleware:[Nm(4),Lm({crossAxis:e.includes("-"),fallbackAxisSideDirection:"start",padding:4}),Im({padding:4})]}),d=u.context,f=w5(d,{mouseOnly:!0,move:!1,restMs:o,enabled:n==null,delay:{close:i}}),h=L5(d,{enabled:n==null}),p=O5(d),m=j5(d,{role:"tooltip"}),v=D5([f,h,p,m]);return y.useMemo(()=>({open:a,setOpen:c,...v,...u}),[a,c,v,u])}const sa=y.createContext(null);function Bm(){const t=y.useContext(sa);if(t==null)throw new Error("Tooltip components must be wrapped in <TooltipProvider />");return t}function _m({children:t,...e}){const n=B5(e);return e.useDelayGroup?g.jsx(k5,{delay:{open:e.delay??0,close:e.closeDelay??0},timeoutMs:e.timeout,children:g.jsx(sa.Provider,{value:n,children:t})}):g.jsx(sa.Provider,{value:n,children:t})}const Hm=y.forwardRef(function({children:e,asChild:n=!1,...r},o){const i=Bm(),s=y.isValidElement(e)?parseInt(y.version,10)>=19?e.props.ref:e.ref:void 0,l=Dm([i.refs.setReference,o,s]);if(n&&y.isValidElement(e)){const a={"data-tooltip-state":i.open?"open":"closed"};return y.cloneElement(e,i.getReferenceProps({ref:l,...r,...typeof e.props=="object"?e.props:{},...a}))}return g.jsx("button",{ref:l,"data-tooltip-state":i.open?"open":"closed",...i.getReferenceProps(r),children:e})}),Fm=y.forwardRef(function({style:e,children:n,portal:r=!0,portalProps:o={},...i},s){const l=Bm(),a=Dm([l.refs.setFloating,s]);if(!l.open)return null;const c=g.jsx("div",{ref:a,style:{...l.floatingStyles,...e},...l.getFloatingProps(i),className:"tiptap-tooltip",children:n});return r?g.jsx(M5,{...o,children:c}):c});_m.displayName="Tooltip";Hm.displayName="TooltipTrigger";Fm.displayName="TooltipContent";const la=5*1024*1024,_5={mod:"⌘",command:"⌘",meta:"⌘",ctrl:"⌃",control:"⌃",alt:"⌥",option:"⌥",shift:"⇧",backspace:"Del",delete:"⌦",enter:"⏎",escape:"⎋",capslock:"⇪"};function Me(...t){return t.filter(Boolean).join(" ")}function H5(){return typeof navigator<"u"&&navigator.platform.toLowerCase().includes("mac")}const F5=(t,e,n=!0)=>{if(e){const r=t.toLowerCase();return _5[r]||(n?t.toUpperCase():t)}return n?t.charAt(0).toUpperCase()+t.slice(1):t},gt=t=>{const{shortcutKeys:e,delimiter:n="+",capitalize:r=!0}=t;return e?e.split(n).map(o=>o.trim()).map(o=>F5(o,H5(),r)):[]},ro=(t,e)=>e?.schema?e.schema.spec.marks.get(t)!==void 0:!1,_t=(t,e)=>e?.schema?e.schema.spec.nodes.get(t)!==void 0:!1;function $5(t){const{state:e,view:n}=t,{doc:r,selection:o}=e,i=q.findFrom(o.$to,1,!0);if(i)return n.dispatch(e.tr.setSelection(i).scrollIntoView()),!0;const s=e.schema.nodes.paragraph;if(!s)return console.warn("No paragraph node type found in schema."),!1;const l=r.content.size,a=s.create();let c=e.tr.insert(l,a);const u=c.doc.resolve(l+1);return c=c.setSelection(V.near(u)).scrollIntoView(),n.dispatch(c),!0}function yt(t){return typeof t=="number"&&t>=0}function ls(t,e){if(!t)return!1;const n=Array.isArray(e)?e:[e],r=n.some(o=>t.extensionManager.extensions.some(i=>i.name===o));return r||console.warn(`None of the extensions [${n.join(", ")}] were found in the editor schema. Ensure they are included in the editor configuration.`),r}function V5(t,e){try{const n=t.state.doc.nodeAt(e);return n||(console.warn(`No node found at position ${e}`),null)}catch(n){return console.error(`Error getting node at position ${e}:`,n),null}}function hn(t){const{editor:e,node:n,nodePos:r}=t;if(!e||!e.state?.doc)return null;const o=n!=null,i=yt(r);if(!o&&!i)return null;if(o){let s=-1,l=null;if(e.state.doc.descendants((a,c)=>a===n?(s=c,l=a,!1):!0),s!==-1&&l!==null)return{pos:s,node:l}}if(i){const s=V5(e,r);if(s)return{pos:r,node:s}}return null}function Ht(t,e=[]){if(!t||!t.state.selection)return!1;const{state:n}=t,{selection:r}=n;if(r.empty)return!1;if(r instanceof B){const o=r.node;return o?e.includes(o.type.name):!1}return!1}const z5=async(t,e,n)=>{if(!t)throw new Error("No file provided");if(t.size>la)throw new Error(`File size exceeds maximum allowed (${la/(1024*1024)}MB)`);for(let r=0;r<=100;r+=10){if(n?.aborted)throw new Error("Upload cancelled");await new Promise(o=>setTimeout(o,500)),e?.({progress:r})}return"/images/tiptap-ui-placeholder-image.jpg"},U5=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function W5(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return!t||t.replace(U5,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}function K5(t,e,n){try{const r=new URL(t,e);if(W5(r.href,n))return r.href}catch{}return"#"}const q5=({shortcuts:t})=>t.length===0?null:g.jsx("div",{children:t.map((e,n)=>g.jsxs(y.Fragment,{children:[n>0&&g.jsx("kbd",{children:"+"}),g.jsx("kbd",{children:e})]},n))}),fe=y.forwardRef(({className:t,children:e,tooltip:n,showTooltip:r=!0,shortcutKeys:o,"aria-label":i,...s},l)=>{const a=y.useMemo(()=>gt({shortcutKeys:o}),[o]);return!n||!r?g.jsx("button",{className:Me("tiptap-button",t),ref:l,"aria-label":i,...s,children:e}):g.jsxs(_m,{delay:200,children:[g.jsx(Hm,{className:Me("tiptap-button",t),ref:l,"aria-label":i,...s,children:e}),g.jsxs(Fm,{children:[n,g.jsx(q5,{shortcuts:a})]})]})});fe.displayName="Button";const In=y.forwardRef(({className:t,children:e,orientation:n="vertical",...r},o)=>g.jsx("div",{ref:o,className:Me("tiptap-button-group",t),"data-orientation":n,role:"group",...r,children:e}));In.displayName="ButtonGroup";function rf({orientation:t="horizontal",size:e,style:n={},...r}){const o={...n,...t==="horizontal"&&!e&&{flex:1},...e&&{width:t==="vertical"?"1px":e,height:t==="horizontal"?"1px":e}};return g.jsx("div",{...r,style:o})}const as=y.forwardRef(({decorative:t,orientation:e="vertical",className:n,...r},o)=>{const s=t?{role:"none"}:{"aria-orientation":e==="vertical"?e:void 0,role:"separator"};return g.jsx("div",{className:Me("tiptap-separator",n),"data-orientation":e,...s,...r,ref:o})});as.displayName="Separator";function $m({editor:t,containerRef:e,query:n,items:r,onSelect:o,onClose:i,orientation:s="vertical",autoSelectFirstItem:l=!0}){const[a,c]=y.useState(l?0:-1);return y.useEffect(()=>{const u=f=>{if(!r.length)return!1;const h=()=>c(m=>m===-1?0:(m+1)%r.length),p=()=>c(m=>m===-1?r.length-1:(m-1+r.length)%r.length);switch(f.key){case"ArrowUp":return s==="horizontal"?!1:(f.preventDefault(),p(),!0);case"ArrowDown":return s==="horizontal"?!1:(f.preventDefault(),h(),!0);case"ArrowLeft":return s==="vertical"?!1:(f.preventDefault(),p(),!0);case"ArrowRight":return s==="vertical"?!1:(f.preventDefault(),h(),!0);case"Tab":return f.preventDefault(),f.shiftKey?p():h(),!0;case"Home":return f.preventDefault(),c(0),!0;case"End":return f.preventDefault(),c(r.length-1),!0;case"Enter":return f.isComposing?!1:(f.preventDefault(),a!==-1&&r[a]&&o?.(r[a]),!0);case"Escape":return f.preventDefault(),i?.(),!0;default:return!1}};let d=null;if(t?d=t.view.dom:e?.current&&(d=e.current),d)return d.addEventListener("keydown",u,!0),()=>{d?.removeEventListener("keydown",u,!0)}},[t,e,r,a,o,i,s]),y.useEffect(()=>{n&&c(l?0:-1)},[n,l]),{selectedIndex:r.length?a:void 0,setSelectedIndex:c}}const of=(t,e)=>{typeof t=="function"?t(e):t&&typeof t=="object"&&"current"in t&&(t.current=e)},G5=(t,e)=>{const n=y.useRef(null);return y.useCallback(r=>{t&&"current"in t&&(t.current=r),n.current&&of(n.current,null),n.current=e,e&&of(e,r)},[t,e])},J5=t=>{const[e,n]=y.useState([]),r=y.useCallback(()=>t.current?Array.from(t.current.querySelectorAll('button:not([disabled]), [role="button"]:not([disabled]), [tabindex="0"]:not([disabled])')):[],[t]);y.useEffect(()=>{const i=t.current;if(!i)return;const s=()=>n(r());s();const l=new MutationObserver(s);return l.observe(i,{childList:!0,subtree:!0}),()=>l.disconnect()},[r,t]);const{selectedIndex:o}=$m({containerRef:t,items:e,orientation:"horizontal",onSelect:i=>i.click(),autoSelectFirstItem:!1});y.useEffect(()=>{const i=t.current;if(!i)return;const s=a=>{const c=a.target;i.contains(c)&&c.setAttribute("data-focus-visible","true")},l=a=>{const c=a.target;i.contains(c)&&c.removeAttribute("data-focus-visible")};return i.addEventListener("focus",s,!0),i.addEventListener("blur",l,!0),()=>{i.removeEventListener("focus",s,!0),i.removeEventListener("blur",l,!0)}},[t]),y.useEffect(()=>{o!==void 0&&e[o]&&e[o].focus()},[o,e])},pc=y.forwardRef(({children:t,className:e,variant:n="fixed",...r},o)=>{const i=y.useRef(null),s=G5(i,o);return J5(i),g.jsx("div",{ref:s,role:"toolbar","aria-label":"toolbar","data-variant":n,className:Me("tiptap-toolbar",e),...r,children:t})});pc.displayName="Toolbar";const Mt=y.forwardRef(({children:t,className:e,...n},r)=>g.jsx("div",{ref:r,role:"group",className:Me("tiptap-toolbar-group",e),...n,children:t}));Mt.displayName="ToolbarGroup";const Tt=y.forwardRef(({...t},e)=>g.jsx(as,{ref:e,orientation:"vertical",decorative:!0,...t}));Tt.displayName="ToolbarSeparator";const Vm=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{d:"M18.7071 6.70711C19.0976 6.31658 19.0976 5.68342 18.7071 5.29289C18.3166 4.90237 17.6834 4.90237 17.2929 5.29289L12 10.5858L6.70711 5.29289C6.31658 4.90237 5.68342 4.90237 5.29289 5.29289C4.90237 5.68342 4.90237 6.31658 5.29289 6.70711L10.5858 12L5.29289 17.2929C4.90237 17.6834 4.90237 18.3166 5.29289 18.7071C5.68342 19.0976 6.31658 19.0976 6.70711 18.7071L12 13.4142L17.2929 18.7071C17.6834 19.0976 18.3166 19.0976 18.7071 18.7071C19.0976 18.3166 19.0976 17.6834 18.7071 17.2929L13.4142 12L18.7071 6.70711Z",fill:"currentColor"})}));Vm.displayName="CloseIcon";function Z5(t){const[e,n]=y.useState([]),r=async l=>{if(l.size>t.maxSize){const d=new Error(`File size exceeds maximum allowed (${t.maxSize/1024/1024}MB)`);return t.onError?.(d),null}const a=new AbortController,c=crypto.randomUUID(),u={id:c,file:l,progress:0,status:"uploading",abortController:a};n(d=>[...d,u]);try{if(!t.upload)throw new Error("Upload function is not defined");const d=await t.upload(l,f=>{n(h=>h.map(p=>p.id===c?{...p,progress:f.progress}:p))},a.signal);if(!d)throw new Error("Upload failed: No URL returned");return a.signal.aborted?null:(n(f=>f.map(h=>h.id===c?{...h,status:"success",url:d,progress:100}:h)),t.onSuccess?.(d),d)}catch(d){return a.signal.aborted||(n(f=>f.map(h=>h.id===c?{...h,status:"error",progress:0}:h)),t.onError?.(d instanceof Error?d:new Error("Upload failed"))),null}};return{fileItems:e,uploadFiles:async l=>{if(!l||l.length===0)return t.onError?.(new Error("No files to upload")),[];if(t.limit&&l.length>t.limit)return t.onError?.(new Error(`Maximum ${t.limit} file${t.limit===1?"":"s"} allowed`)),[];const a=l.map(u=>r(u));return(await Promise.all(a)).filter(u=>u!==null)},removeFileItem:l=>{n(a=>{const c=a.find(u=>u.id===l);return c?.abortController&&c.abortController.abort(),c?.url&&URL.revokeObjectURL(c.url),a.filter(u=>u.id!==l)})},clearAllFiles:()=>{e.forEach(l=>{l.abortController&&l.abortController.abort(),l.url&&URL.revokeObjectURL(l.url)}),n([])}}}const zm=()=>g.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",className:"tiptap-image-upload-icon",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[g.jsx("path",{d:"M11.1953 4.41771C10.3478 4.08499 9.43578 3.94949 8.5282 4.02147C7.62062 4.09345 6.74133 4.37102 5.95691 4.83316C5.1725 5.2953 4.50354 5.92989 4.00071 6.68886C3.49788 7.44783 3.17436 8.31128 3.05465 9.2138C2.93495 10.1163 3.0222 11.0343 3.3098 11.8981C3.5974 12.7619 4.07781 13.5489 4.71463 14.1995C5.10094 14.5942 5.09414 15.2274 4.69945 15.6137C4.30476 16 3.67163 15.9932 3.28532 15.5985C2.43622 14.731 1.79568 13.6816 1.41221 12.5299C1.02875 11.3781 0.91241 10.1542 1.07201 8.95084C1.23162 7.74748 1.66298 6.59621 2.33343 5.58425C3.00387 4.57229 3.89581 3.72617 4.9417 3.10998C5.98758 2.4938 7.15998 2.1237 8.37008 2.02773C9.58018 1.93176 10.7963 2.11243 11.9262 2.55605C13.0561 2.99968 14.0703 3.69462 14.8919 4.58825C15.5423 5.29573 16.0585 6.11304 16.4177 7.00002H17.4999C18.6799 6.99991 19.8288 7.37933 20.7766 8.08222C21.7245 8.78515 22.4212 9.7743 22.7637 10.9036C23.1062 12.0328 23.0765 13.2423 22.6788 14.3534C22.2812 15.4644 21.5367 16.4181 20.5554 17.0736C20.0962 17.3803 19.4752 17.2567 19.1684 16.7975C18.8617 16.3382 18.9853 15.7172 19.4445 15.4105C20.069 14.9934 20.5427 14.3865 20.7958 13.6794C21.0488 12.9724 21.0678 12.2027 20.8498 11.4841C20.6318 10.7655 20.1885 10.136 19.5853 9.6887C18.9821 9.24138 18.251 8.99993 17.5001 9.00002H15.71C15.2679 9.00002 14.8783 8.70973 14.7518 8.28611C14.4913 7.41374 14.0357 6.61208 13.4195 5.94186C12.8034 5.27164 12.0427 4.75043 11.1953 4.41771Z",fill:"currentColor"}),g.jsx("path",{d:"M11 14.4142V21C11 21.5523 11.4477 22 12 22C12.5523 22 13 21.5523 13 21V14.4142L15.2929 16.7071C15.6834 17.0976 16.3166 17.0976 16.7071 16.7071C17.0976 16.3166 17.0976 15.6834 16.7071 15.2929L12.7078 11.2936C12.7054 11.2912 12.703 11.2888 12.7005 11.2864C12.5208 11.1099 12.2746 11.0008 12.003 11L12 11L11.997 11C11.8625 11.0004 11.7343 11.0273 11.6172 11.0759C11.502 11.1236 11.3938 11.1937 11.2995 11.2864C11.297 11.2888 11.2946 11.2912 11.2922 11.2936L7.29289 15.2929C6.90237 15.6834 6.90237 16.3166 7.29289 16.7071C7.68342 17.0976 8.31658 17.0976 8.70711 16.7071L11 14.4142Z",fill:"currentColor"})]}),Y5=()=>g.jsx("svg",{width:"43",height:"57",viewBox:"0 0 43 57",fill:"currentColor",className:"tiptap-image-upload-dropzone-rect-primary",xmlns:"http://www.w3.org/2000/svg",children:g.jsx("path",{d:"M0.75 10.75C0.75 5.64137 4.89137 1.5 10 1.5H32.3431C33.2051 1.5 34.0317 1.84241 34.6412 2.4519L40.2981 8.10876C40.9076 8.71825 41.25 9.5449 41.25 10.4069V46.75C41.25 51.8586 37.1086 56 32 56H10C4.89137 56 0.75 51.8586 0.75 46.75V10.75Z",fill:"currentColor",fillOpacity:"0.11",stroke:"currentColor",strokeWidth:"1.5"})}),X5=()=>g.jsx("svg",{width:"10",height:"10",className:"tiptap-image-upload-dropzone-rect-secondary",viewBox:"0 0 10 10",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:g.jsx("path",{d:"M0 0.75H0.343146C1.40401 0.75 2.42143 1.17143 3.17157 1.92157L8.82843 7.57843C9.57857 8.32857 10 9.34599 10 10.4069V10.75H4C1.79086 10.75 0 8.95914 0 6.75V0.75Z",fill:"currentColor"})}),Q5=({onFile:t,children:e})=>{const[n,r]=y.useState(!1),[o,i]=y.useState(!1),s=u=>{u.preventDefault(),u.stopPropagation(),i(!0)},l=u=>{u.preventDefault(),u.stopPropagation(),u.currentTarget.contains(u.relatedTarget)||(i(!1),r(!1))},a=u=>{u.preventDefault(),u.stopPropagation(),r(!0)},c=u=>{u.preventDefault(),u.stopPropagation(),i(!1),r(!1);const d=Array.from(u.dataTransfer.files);d.length>0&&t(d)};return g.jsx("div",{className:`tiptap-image-upload-drag-area ${o?"drag-active":""} ${n?"drag-over":""}`,onDragEnter:s,onDragLeave:l,onDragOver:a,onDrop:c,children:e})},e3=({fileItem:t,onRemove:e})=>{const n=r=>{if(r===0)return"0 Bytes";const o=1024,i=["Bytes","KB","MB","GB"],s=Math.floor(Math.log(r)/Math.log(o));return`${parseFloat((r/Math.pow(o,s)).toFixed(2))} ${i[s]}`};return g.jsxs("div",{className:"tiptap-image-upload-preview",children:[t.status==="uploading"&&g.jsx("div",{className:"tiptap-image-upload-progress",style:{width:`${t.progress}%`}}),g.jsxs("div",{className:"tiptap-image-upload-preview-content",children:[g.jsxs("div",{className:"tiptap-image-upload-file-info",children:[g.jsx("div",{className:"tiptap-image-upload-file-icon",children:g.jsx(zm,{})}),g.jsxs("div",{className:"tiptap-image-upload-details",children:[g.jsx("span",{className:"tiptap-image-upload-text",children:t.file.name}),g.jsx("span",{className:"tiptap-image-upload-subtext",children:n(t.file.size)})]})]}),g.jsxs("div",{className:"tiptap-image-upload-actions",children:[t.status==="uploading"&&g.jsxs("span",{className:"tiptap-image-upload-progress-text",children:[t.progress,"%"]}),g.jsx(fe,{type:"button","data-style":"ghost",onClick:r=>{r.stopPropagation(),e()},children:g.jsx(Vm,{className:"tiptap-button-icon"})})]})]})]})},t3=({maxSize:t,limit:e})=>g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"tiptap-image-upload-dropzone",children:[g.jsx(Y5,{}),g.jsx(X5,{}),g.jsx("div",{className:"tiptap-image-upload-icon-container",children:g.jsx(zm,{})})]}),g.jsxs("div",{className:"tiptap-image-upload-content",children:[g.jsxs("span",{className:"tiptap-image-upload-text",children:[g.jsx("em",{children:"Click to upload"})," or drag and drop"]}),g.jsxs("span",{className:"tiptap-image-upload-subtext",children:["Maximum ",e," file",e===1?"":"s",", ",t/1024/1024,"MB each."]})]})]}),n3=t=>{const{accept:e,limit:n,maxSize:r}=t.node.attrs,o=y.useRef(null),i=t.extension,s={maxSize:r,limit:n,accept:e,upload:i.options.upload,onSuccess:i.options.onSuccess,onError:i.options.onError},{fileItems:l,uploadFiles:a,removeFileItem:c,clearAllFiles:u}=Z5(s),d=async m=>{const v=await a(m);if(v.length>0){const b=t.getPos();if(yt(b)){const C=v.map((x,w)=>{const E=m[w]?.name.replace(/\.[^/.]+$/,"")||"unknown";return{type:i.options.type,attrs:{...i.options,src:x,alt:E,title:E}}});t.editor.chain().focus().deleteRange({from:b,to:b+t.node.nodeSize}).insertContentAt(b,C).run(),$5(t.editor)}}},f=m=>{const v=m.target.files;if(!v||v.length===0){i.options.onError?.(new Error("No file selected"));return}d(Array.from(v))},h=()=>{o.current&&l.length===0&&(o.current.value="",o.current.click())},p=l.length>0;return g.jsxs(Np,{className:"tiptap-image-upload",tabIndex:0,onClick:h,children:[!p&&g.jsx(Q5,{onFile:d,children:g.jsx(t3,{maxSize:r,limit:n})}),p&&g.jsxs("div",{className:"tiptap-image-upload-previews",children:[l.length>1&&g.jsxs("div",{className:"tiptap-image-upload-header",children:[g.jsxs("span",{children:["Uploading ",l.length," files"]}),g.jsx(fe,{type:"button","data-style":"ghost",onClick:m=>{m.stopPropagation(),u()},children:"Clear All"})]}),l.map(m=>g.jsx(e3,{fileItem:m,onRemove:()=>c(m.id)},m.id))]}),g.jsx("input",{ref:o,name:"file",accept:e,type:"file",multiple:n>1,onChange:f,onClick:m=>m.stopPropagation()})]})},r3=je.create({name:"imageUpload",group:"block",draggable:!0,atom:!0,addOptions(){return{type:"image",accept:"image/*",limit:1,maxSize:0,upload:void 0,onError:void 0,onSuccess:void 0,HTMLAttributes:{}}},addAttributes(){return{accept:{default:this.options.accept},limit:{default:this.options.limit},maxSize:{default:this.options.maxSize}}},parseHTML(){return[{tag:'div[data-type="image-upload"]'}]},renderHTML({HTMLAttributes:t}){return["div",re({"data-type":"image-upload"},t)]},addNodeView(){return Ip(n3)},addCommands(){return{setImageUploadNode:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addKeyboardShortcuts(){return{Enter:({editor:t})=>{const{selection:e}=t.state,{nodeAfter:n}=e.$from;if(n&&n.type.name==="imageUpload"&&t.isActive("imageUpload")){const r=t.view.nodeDOM(e.$from.pos);if(r&&r instanceof HTMLElement){const o=r.firstChild;if(o&&o instanceof HTMLElement)return o.click(),!0}}return!1}}}}),o3=xx.extend({renderHTML(){return["div",re(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]}}),i3=({node:t,updateAttributes:e,selected:n})=>{const[r,o]=j.useState(!1),[i,s]=j.useState({width:t.attrs.width||300,height:t.attrs.height||"auto"}),l=j.useRef(null),a=j.useRef(null),c=j.useRef(t.attrs.width||300),u=t.attrs.imageId||`img-${Date.now()}`;j.useEffect(()=>{s({width:t.attrs.width||300,height:t.attrs.height||"auto"})},[t.attrs.width,t.attrs.height]);const d=j.useCallback(C=>{C.preventDefault(),C.stopPropagation(),o(!0);const x=C.clientX,w=typeof i.width=="number"?i.width:300,E=l.current;let k=1;E&&E.naturalWidth&&E.naturalHeight&&(k=E.naturalWidth/E.naturalHeight);const S=N=>{const P=N.clientX-x,z=Math.max(50,w+P);c.current=z;const U=i.height==="auto"?"auto":Math.max(30,z/k);s({width:z,height:U}),a.current&&(a.current.style.width=`${z}px`,U!=="auto"&&(a.current.style.height=`${U}px`))},M=()=>{o(!1);const N=Math.round(c.current);e({width:N}),document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",M)};document.addEventListener("mousemove",S),document.addEventListener("mouseup",M)},[i,e]),f=j.useCallback(()=>{i.height==="auto"&&l.current&&s(C=>({...C,height:"auto"}))},[i.width,i.height]),h=t.attrs.textAlign||"left",p=h==="center"?"center":h==="right"?"flex-end":"flex-start",m={position:"relative",display:"inline-block",width:i.width,height:i.height==="auto"?"auto":i.height,maxWidth:"100%",userSelect:r?"none":"auto",outline:n?"2px solid #007bff":"none",outlineOffset:"2px"},v={width:"100%",height:i.height==="auto"?"auto":"100%",display:"block",objectFit:"contain"},b={position:"absolute",bottom:-5,right:-5,width:12,height:12,background:"#007bff",border:"2px solid white",borderRadius:"50%",cursor:"nw-resize",opacity:n||r?1:0,transition:"opacity 0.2s ease",zIndex:10,boxShadow:"0 2px 4px rgba(0,0,0,0.2)"};return g.jsx(Np,{className:"resizable-image-wrapper","data-drag-handle":"",style:{display:"flex",justifyContent:p},children:g.jsxs("div",{ref:a,id:`resizable-image-${u}`,style:m,onMouseEnter:()=>{if(a.current){const C=a.current.querySelector(".resize-handle");C&&(C.style.opacity="1")}},onMouseLeave:()=>{if(!r&&!n&&a.current){const C=a.current.querySelector(".resize-handle");C&&(C.style.opacity="0")}},children:[g.jsx("img",{ref:l,src:t.attrs.src,alt:t.attrs.alt||"",title:t.attrs.title||"",style:v,onLoad:f,draggable:!1}),g.jsx("div",{className:"resize-handle",style:b,onMouseDown:d,title:"拖拽調整圖片大小"}),(n||r)&&g.jsxs("div",{style:{position:"absolute",top:-25,left:0,background:"rgba(0, 0, 0, 0.8)",color:"white",padding:"2px 6px",borderRadius:"3px",fontSize:"12px",whiteSpace:"nowrap",zIndex:11},children:[typeof i.width=="number"?Math.round(i.width):i.width," ","×"," ",i.height==="auto"?"auto":typeof i.height=="number"?Math.round(i.height):i.height]})]})})},s3=je.create({name:"resizableImage",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null,parseHTML:t=>{const e=t.getAttribute("width");return e?parseInt(e):null},renderHTML:t=>t.width?{width:t.width,height:"auto"}:{}},textAlign:{default:"left",parseHTML:t=>t.getAttribute("data-text-align")||"left",renderHTML:t=>!t.textAlign||t.textAlign==="left"?{}:{"data-text-align":t.textAlign}},imageId:{default:null,parseHTML:t=>t.getAttribute("data-image-id"),renderHTML:t=>t.imageId?{"data-image-id":t.imageId}:{}}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])',getAttrs:t=>{const e=t,n=e.getAttribute("width"),r=e.getAttribute("data-image-id");return{src:e.getAttribute("src"),alt:e.getAttribute("alt"),title:e.getAttribute("title"),width:n?parseInt(n):300,imageId:r||`img-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}}}]},renderHTML({HTMLAttributes:t}){return["img",re(this.options.HTMLAttributes,t)]},addCommands(){return{setResizableImage:t=>({commands:e})=>{const n=`img-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return e.insertContent({type:this.name,attrs:{...t,imageId:n,width:t.width||300}})},setImageSize:t=>({commands:e})=>e.updateAttributes(this.name,t)}},addNodeView(){return Ip(i3)}}),mc=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.29289 8.29289C5.68342 7.90237 6.31658 7.90237 6.70711 8.29289L12 13.5858L17.2929 8.29289C17.6834 7.90237 18.3166 7.90237 18.7071 8.29289C19.0976 8.68342 19.0976 9.31658 18.7071 9.70711L12.7071 15.7071C12.3166 16.0976 11.6834 16.0976 11.2929 15.7071L5.29289 9.70711C4.90237 9.31658 4.90237 8.68342 5.29289 8.29289Z",fill:"currentColor"})}));mc.displayName="ChevronDownIcon";function ie(t){const{editor:e}=KC(),n=y.useMemo(()=>t||e,[t,e]);return Ap({editor:n,selector(o){return o.editor?{editor:o.editor,editorState:o.editor.state,canCommand:o.editor.can}:{editor:null,editorState:void 0,canCommand:void 0}}})||{editor:null}}const vt=y.forwardRef(({variant:t,size:e="default",appearance:n="default",trimText:r=!1,className:o,children:i,...s},l)=>g.jsx("div",{ref:l,className:`tiptap-badge ${o||""}`,"data-style":t,"data-size":e,"data-appearance":n,"data-text-trim":r?"on":"off",...s,children:i}));vt.displayName="Badge";function l3({level:t,shortcutKeys:e=Xm[t]}){return g.jsx(vt,{children:gt({shortcutKeys:e})})}const Um=y.forwardRef(({editor:t,level:e,text:n,hideWhenUnavailable:r=!1,onToggled:o,showShortcut:i=!1,onClick:s,children:l,...a},c)=>{const{editor:u}=ie(t),{isVisible:d,canToggle:f,isActive:h,handleToggle:p,label:m,Icon:v,shortcutKeys:b}=c3({editor:u,level:e,hideWhenUnavailable:r,onToggled:o}),C=y.useCallback(x=>{s?.(x),!x.defaultPrevented&&p()},[p,s]);return d?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":h?"on":"off",role:"button",tabIndex:-1,disabled:!f,"data-disabled":!f,"aria-label":m,"aria-pressed":h,tooltip:m,onClick:C,...a,ref:c,children:l??g.jsxs(g.Fragment,{children:[g.jsx(v,{className:"tiptap-button-icon"}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(l3,{level:e,shortcutKeys:b})]})}):null});Um.displayName="HeadingButton";const Wm=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),g.jsx("path",{d:"M21.0001 10C21.0001 9.63121 20.7971 9.29235 20.472 9.11833C20.1468 8.94431 19.7523 8.96338 19.4454 9.16795L16.4454 11.168C15.9859 11.4743 15.8617 12.0952 16.1681 12.5547C16.4744 13.0142 17.0953 13.1384 17.5548 12.8321L19.0001 11.8685V18C19.0001 18.5523 19.4478 19 20.0001 19C20.5524 19 21.0001 18.5523 21.0001 18V10Z",fill:"currentColor"})]}));Wm.displayName="HeadingOneIcon";const Km=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),g.jsx("path",{d:"M22.0001 12C22.0001 10.7611 21.1663 9.79297 20.0663 9.42632C18.9547 9.05578 17.6171 9.28724 16.4001 10.2C15.9582 10.5314 15.8687 11.1582 16.2001 11.6C16.5314 12.0418 17.1582 12.1314 17.6001 11.8C18.383 11.2128 19.0455 11.1942 19.4338 11.3237C19.8339 11.457 20.0001 11.7389 20.0001 12C20.0001 12.4839 19.8554 12.7379 19.6537 12.9481C19.4275 13.1837 19.1378 13.363 18.7055 13.6307C18.6313 13.6767 18.553 13.7252 18.4701 13.777C17.9572 14.0975 17.3128 14.5261 16.8163 15.2087C16.3007 15.9177 16.0001 16.8183 16.0001 18C16.0001 18.5523 16.4478 19 17.0001 19H21.0001C21.5523 19 22.0001 18.5523 22.0001 18C22.0001 17.4477 21.5523 17 21.0001 17H18.131C18.21 16.742 18.3176 16.5448 18.4338 16.385C18.6873 16.0364 19.0429 15.7775 19.5301 15.473C19.5898 15.4357 19.6536 15.3966 19.7205 15.3556C20.139 15.0992 20.6783 14.7687 21.0964 14.3332C21.6447 13.7621 22.0001 13.0161 22.0001 12Z",fill:"currentColor"})]}));Km.displayName="HeadingTwoIcon";const qm=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M4 5C4.55228 5 5 5.44772 5 6V11H11V6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V13H5V18C5 18.5523 4.55228 19 4 19C3.44772 19 3 18.5523 3 18V6C3 5.44772 3.44772 5 4 5Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.4608 11.2169C19.1135 11.0531 18.5876 11.0204 18.0069 11.3619C17.5309 11.642 16.918 11.4831 16.638 11.007C16.358 10.531 16.5169 9.91809 16.9929 9.63807C18.1123 8.97962 19.3364 8.94691 20.314 9.40808C21.2839 9.86558 21.9999 10.818 21.9999 12C21.9999 12.7957 21.6838 13.5587 21.1212 14.1213C20.5586 14.6839 19.7956 15 18.9999 15C18.4476 15 17.9999 14.5523 17.9999 14C17.9999 13.4477 18.4476 13 18.9999 13C19.2651 13 19.5195 12.8947 19.707 12.7071C19.8946 12.5196 19.9999 12.2652 19.9999 12C19.9999 11.6821 19.8159 11.3844 19.4608 11.2169Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.0001 14C18.0001 13.4477 18.4478 13 19.0001 13C19.7957 13 20.5588 13.3161 21.1214 13.8787C21.684 14.4413 22.0001 15.2043 22.0001 16C22.0001 17.2853 21.2767 18.3971 20.1604 18.8994C19.0257 19.41 17.642 19.2315 16.4001 18.3C15.9582 17.9686 15.8687 17.3418 16.2001 16.9C16.5314 16.4582 17.1582 16.3686 17.6001 16.7C18.3581 17.2685 18.9744 17.24 19.3397 17.0756C19.7234 16.9029 20.0001 16.5147 20.0001 16C20.0001 15.7348 19.8947 15.4804 19.7072 15.2929C19.5196 15.1054 19.2653 15 19.0001 15C18.4478 15 18.0001 14.5523 18.0001 14Z",fill:"currentColor"})]}));qm.displayName="HeadingThreeIcon";const Gm=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M4 5C4.55228 5 5 5.44772 5 6V11H11V6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V13H5V18C5 18.5523 4.55228 19 4 19C3.44772 19 3 18.5523 3 18V6C3 5.44772 3.44772 5 4 5Z",fill:"currentColor"}),g.jsx("path",{d:"M17 9C17.5523 9 18 9.44772 18 10V13H20V10C20 9.44772 20.4477 9 21 9C21.5523 9 22 9.44772 22 10V18C22 18.5523 21.5523 19 21 19C20.4477 19 20 18.5523 20 18V15H17C16.4477 15 16 14.5523 16 14V10C16 9.44772 16.4477 9 17 9Z",fill:"currentColor"})]}));Gm.displayName="HeadingFourIcon";const Jm=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),g.jsx("path",{d:"M16 10C16 9.44772 16.4477 9 17 9H21C21.5523 9 22 9.44772 22 10C22 10.5523 21.5523 11 21 11H18V12H18.3C20.2754 12 22 13.4739 22 15.5C22 17.5261 20.2754 19 18.3 19C17.6457 19 17.0925 18.8643 16.5528 18.5944C16.0588 18.3474 15.8586 17.7468 16.1055 17.2528C16.3525 16.7588 16.9532 16.5586 17.4472 16.8056C17.7074 16.9357 17.9542 17 18.3 17C19.3246 17 20 16.2739 20 15.5C20 14.7261 19.3246 14 18.3 14H17C16.4477 14 16 13.5523 16 13L16 12.9928V10Z",fill:"currentColor"})]}));Jm.displayName="HeadingFiveIcon";const Zm=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20.7071 9.29289C21.0976 9.68342 21.0976 10.3166 20.7071 10.7071C19.8392 11.575 19.2179 12.2949 18.7889 13.0073C18.8587 13.0025 18.929 13 19 13C20.6569 13 22 14.3431 22 16C22 17.6569 20.6569 19 19 19C17.3431 19 16 17.6569 16 16C16 14.6007 16.2837 13.4368 16.8676 12.3419C17.4384 11.2717 18.2728 10.3129 19.2929 9.29289C19.6834 8.90237 20.3166 8.90237 20.7071 9.29289ZM19 17C18.4477 17 18 16.5523 18 16C18 15.4477 18.4477 15 19 15C19.5523 15 20 15.4477 20 16C20 16.5523 19.5523 17 19 17Z",fill:"currentColor"})]}));Zm.displayName="HeadingSixIcon";const Ym={1:Wm,2:Km,3:qm,4:Gm,5:Jm,6:Zm},Xm={1:"ctrl+alt+1",2:"ctrl+alt+2",3:"ctrl+alt+3",4:"ctrl+alt+4",5:"ctrl+alt+5",6:"ctrl+alt+6"};function Kr(t,e,n=!0){if(!t||!t.isEditable||!_t("heading",t)||Ht(t,["image"]))return!1;if(!n)return e?t.can().setNode("heading",{level:e}):t.can().setNode("heading");try{const o=t.view.state,i=o.selection;if(i.empty||i instanceof V){const s=hn({editor:t,node:o.selection.$anchor.node(1)})?.pos;if(!yt(s))return!1}return!0}catch{return!1}}function gc(t,e){return!t||!t.isEditable?!1:Array.isArray(e)?e.some(n=>t.isActive("heading",{level:n})):e?t.isActive("heading",{level:e}):t.isActive("heading")}function a3(t,e){if(!t||!t.isEditable)return!1;const n=Array.isArray(e)?e:[e],r=n.find(o=>Kr(t,o));if(!r)return!1;try{const o=t.view;let i=o.state,s=i.tr;if(i.selection.empty||i.selection instanceof V){const d=hn({editor:t,node:i.selection.$anchor.node(1)})?.pos;if(!yt(d))return!1;s=s.setSelection(B.create(i.doc,d)),o.dispatch(s),i=o.state}const l=i.selection;let a=t.chain().focus();if(l instanceof B){const d=l.node.firstChild?.firstChild,f=l.node.lastChild?.lastChild,h=d?l.from+d.nodeSize:l.from+1,p=f?l.to-f.nodeSize:l.to-1;a=a.setTextSelection({from:h,to:p}).clearNodes()}return(n.some(d=>t.isActive("heading",{level:d}))?a.setNode("paragraph"):a.setNode("heading",{level:r})).run(),t.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function Qm(t){const{editor:e,level:n,hideWhenUnavailable:r}=t;return!e||!e.isEditable||!_t("heading",e)?!1:r&&!e.isActive("code")?Array.isArray(n)?n.some(o=>Kr(e,o)):Kr(e,n):!0}function c3(t){const{editor:e,level:n,hideWhenUnavailable:r=!1,onToggled:o}=t,{editor:i}=ie(e),[s,l]=y.useState(!0),a=Kr(i,n),c=gc(i,n);y.useEffect(()=>{if(!i)return;const d=()=>{l(Qm({editor:i,level:n,hideWhenUnavailable:r}))};return d(),i.on("selectionUpdate",d),()=>{i.off("selectionUpdate",d)}},[i,n,r]);const u=y.useCallback(()=>{if(!i)return!1;const d=a3(i,n);return d&&o?.(),d},[i,n,o]);return{isVisible:s,isActive:c,handleToggle:u,canToggle:a,label:`Heading ${n}`,shortcutKeys:Xm[n],Icon:Ym[n]}}function J(t,e,{checkForDefaultPrevented:n=!0}={}){return function(o){if(t?.(o),n===!1||!o.defaultPrevented)return e?.(o)}}function sf(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function cs(...t){return e=>{let n=!1;const r=t.map(o=>{const i=sf(o,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():sf(t[o],null)}}}}function Oe(...t){return y.useCallback(cs(...t),t)}function dr(t,e=[]){let n=[];function r(i,s){const l=y.createContext(s),a=n.length;n=[...n,s];const c=d=>{const{scope:f,children:h,...p}=d,m=f?.[t]?.[a]||l,v=y.useMemo(()=>p,Object.values(p));return g.jsx(m.Provider,{value:v,children:h})};c.displayName=i+"Provider";function u(d,f){const h=f?.[t]?.[a]||l,p=y.useContext(h);if(p)return p;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[c,u]}const o=()=>{const i=n.map(s=>y.createContext(s));return function(l){const a=l?.[t]||i;return y.useMemo(()=>({[`__scope${t}`]:{...l,[t]:a}}),[l,a])}};return o.scopeName=t,[r,u3(o,...e)]}function u3(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((l,{useScope:a,scopeName:c})=>{const d=a(i)[`__scope${c}`];return{...l,...d}},{});return y.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}var un=globalThis?.document?y.useLayoutEffect:()=>{},d3=y[" useInsertionEffect ".trim().toString()]||un;function yc({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[o,i,s]=f3({defaultProp:e,onChange:n}),l=t!==void 0,a=l?t:o;{const u=y.useRef(t!==void 0);y.useEffect(()=>{const d=u.current;d!==l&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=l},[l,r])}const c=y.useCallback(u=>{if(l){const d=h3(u)?u(t):u;d!==t&&s.current?.(d)}else i(u)},[l,t,i,s]);return[a,c]}function f3({defaultProp:t,onChange:e}){const[n,r]=y.useState(t),o=y.useRef(n),i=y.useRef(e);return d3(()=>{i.current=e},[e]),y.useEffect(()=>{o.current!==n&&(i.current?.(n),o.current=n)},[n,o]),[n,r,i]}function h3(t){return typeof t=="function"}function qr(t){const e=p3(t),n=y.forwardRef((r,o)=>{const{children:i,...s}=r,l=y.Children.toArray(i),a=l.find(g3);if(a){const c=a.props.children,u=l.map(d=>d===a?y.Children.count(c)>1?y.Children.only(null):y.isValidElement(c)?c.props.children:null:d);return g.jsx(e,{...s,ref:o,children:y.isValidElement(c)?y.cloneElement(c,void 0,u):null})}return g.jsx(e,{...s,ref:o,children:i})});return n.displayName=`${t}.Slot`,n}function p3(t){const e=y.forwardRef((n,r)=>{const{children:o,...i}=n;if(y.isValidElement(o)){const s=v3(o),l=y3(i,o.props);return o.type!==y.Fragment&&(l.ref=r?cs(r,s):s),y.cloneElement(o,l)}return y.Children.count(o)>1?y.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var m3=Symbol("radix.slottable");function g3(t){return y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===m3}function y3(t,e){const n={...e};for(const r in e){const o=t[r],i=e[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...l)=>{const a=i(...l);return o(...l),a}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...t,...n}}function v3(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var b3=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Te=b3.reduce((t,e)=>{const n=qr(`Primitive.${e}`),r=y.forwardRef((o,i)=>{const{asChild:s,...l}=o,a=s?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),g.jsx(a,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function e1(t,e){t&&pa.flushSync(()=>t.dispatchEvent(e))}function t1(t){const e=t+"CollectionProvider",[n,r]=dr(e),[o,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=m=>{const{scope:v,children:b}=m,C=j.useRef(null),x=j.useRef(new Map).current;return g.jsx(o,{scope:v,itemMap:x,collectionRef:C,children:b})};s.displayName=e;const l=t+"CollectionSlot",a=qr(l),c=j.forwardRef((m,v)=>{const{scope:b,children:C}=m,x=i(l,b),w=Oe(v,x.collectionRef);return g.jsx(a,{ref:w,children:C})});c.displayName=l;const u=t+"CollectionItemSlot",d="data-radix-collection-item",f=qr(u),h=j.forwardRef((m,v)=>{const{scope:b,children:C,...x}=m,w=j.useRef(null),E=Oe(v,w),k=i(u,b);return j.useEffect(()=>(k.itemMap.set(w,{ref:w,...x}),()=>void k.itemMap.delete(w))),g.jsx(f,{[d]:"",ref:E,children:C})});h.displayName=u;function p(m){const v=i(t+"CollectionConsumer",m);return j.useCallback(()=>{const C=v.collectionRef.current;if(!C)return[];const x=Array.from(C.querySelectorAll(`[${d}]`));return Array.from(v.itemMap.values()).sort((k,S)=>x.indexOf(k.ref.current)-x.indexOf(S.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:s,Slot:c,ItemSlot:h},p,r]}var C3=y.createContext(void 0);function n1(t){const e=y.useContext(C3);return t||e||"ltr"}function jt(t){const e=y.useRef(t);return y.useEffect(()=>{e.current=t}),y.useMemo(()=>(...n)=>e.current?.(...n),[])}function x3(t,e=globalThis?.document){const n=jt(t);y.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var w3="DismissableLayer",aa="dismissableLayer.update",S3="dismissableLayer.pointerDownOutside",k3="dismissableLayer.focusOutside",lf,r1=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),vc=y.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:l,...a}=t,c=y.useContext(r1),[u,d]=y.useState(null),f=u?.ownerDocument??globalThis?.document,[,h]=y.useState({}),p=Oe(e,S=>d(S)),m=Array.from(c.layers),[v]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),b=m.indexOf(v),C=u?m.indexOf(u):-1,x=c.layersWithOutsidePointerEventsDisabled.size>0,w=C>=b,E=T3(S=>{const M=S.target,N=[...c.branches].some(P=>P.contains(M));!w||N||(o?.(S),s?.(S),S.defaultPrevented||l?.())},f),k=A3(S=>{const M=S.target;[...c.branches].some(P=>P.contains(M))||(i?.(S),s?.(S),S.defaultPrevented||l?.())},f);return x3(S=>{C===c.layers.size-1&&(r?.(S),!S.defaultPrevented&&l&&(S.preventDefault(),l()))},f),y.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(lf=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),af(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=lf)}},[u,f,n,c]),y.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),af())},[u,c]),y.useEffect(()=>{const S=()=>h({});return document.addEventListener(aa,S),()=>document.removeEventListener(aa,S)},[]),g.jsx(Te.div,{...a,ref:p,style:{pointerEvents:x?w?"auto":"none":void 0,...t.style},onFocusCapture:J(t.onFocusCapture,k.onFocusCapture),onBlurCapture:J(t.onBlurCapture,k.onBlurCapture),onPointerDownCapture:J(t.onPointerDownCapture,E.onPointerDownCapture)})});vc.displayName=w3;var E3="DismissableLayerBranch",M3=y.forwardRef((t,e)=>{const n=y.useContext(r1),r=y.useRef(null),o=Oe(e,r);return y.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),g.jsx(Te.div,{...t,ref:o})});M3.displayName=E3;function T3(t,e=globalThis?.document){const n=jt(t),r=y.useRef(!1),o=y.useRef(()=>{});return y.useEffect(()=>{const i=l=>{if(l.target&&!r.current){let a=function(){o1(S3,n,c,{discrete:!0})};const c={originalEvent:l};l.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=a,e.addEventListener("click",o.current,{once:!0})):a()}else e.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),e.removeEventListener("pointerdown",i),e.removeEventListener("click",o.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function A3(t,e=globalThis?.document){const n=jt(t),r=y.useRef(!1);return y.useEffect(()=>{const o=i=>{i.target&&!r.current&&o1(k3,n,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function af(){const t=new CustomEvent(aa);document.dispatchEvent(t)}function o1(t,e,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),r?e1(o,i):o.dispatchEvent(i)}var cl=0;function i1(){y.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??cf()),document.body.insertAdjacentElement("beforeend",t[1]??cf()),cl++,()=>{cl===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),cl--}},[])}function cf(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var ul="focusScope.autoFocusOnMount",dl="focusScope.autoFocusOnUnmount",uf={bubbles:!1,cancelable:!0},R3="FocusScope",bc=y.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=t,[l,a]=y.useState(null),c=jt(o),u=jt(i),d=y.useRef(null),f=Oe(e,m=>a(m)),h=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let m=function(x){if(h.paused||!l)return;const w=x.target;l.contains(w)?d.current=w:zt(d.current,{select:!0})},v=function(x){if(h.paused||!l)return;const w=x.relatedTarget;w!==null&&(l.contains(w)||zt(d.current,{select:!0}))},b=function(x){if(document.activeElement===document.body)for(const E of x)E.removedNodes.length>0&&zt(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",v);const C=new MutationObserver(b);return l&&C.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",v),C.disconnect()}}},[r,l,h.paused]),y.useEffect(()=>{if(l){ff.add(h);const m=document.activeElement;if(!l.contains(m)){const b=new CustomEvent(ul,uf);l.addEventListener(ul,c),l.dispatchEvent(b),b.defaultPrevented||(O3(P3(s1(l)),{select:!0}),document.activeElement===m&&zt(l))}return()=>{l.removeEventListener(ul,c),setTimeout(()=>{const b=new CustomEvent(dl,uf);l.addEventListener(dl,u),l.dispatchEvent(b),b.defaultPrevented||zt(m??document.body,{select:!0}),l.removeEventListener(dl,u),ff.remove(h)},0)}}},[l,c,u,h]);const p=y.useCallback(m=>{if(!n&&!r||h.paused)return;const v=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(v&&b){const C=m.currentTarget,[x,w]=N3(C);x&&w?!m.shiftKey&&b===w?(m.preventDefault(),n&&zt(x,{select:!0})):m.shiftKey&&b===x&&(m.preventDefault(),n&&zt(w,{select:!0})):b===C&&m.preventDefault()}},[n,r,h.paused]);return g.jsx(Te.div,{tabIndex:-1,...s,ref:f,onKeyDown:p})});bc.displayName=R3;function O3(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(zt(r,{select:e}),document.activeElement!==n)return}function N3(t){const e=s1(t),n=df(e,t),r=df(e.reverse(),t);return[n,r]}function s1(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function df(t,e){for(const n of t)if(!I3(n,{upTo:e}))return n}function I3(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function L3(t){return t instanceof HTMLInputElement&&"select"in t}function zt(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&L3(t)&&e&&t.select()}}var ff=D3();function D3(){let t=[];return{add(e){const n=t[0];e!==n&&n?.pause(),t=hf(t,e),t.unshift(e)},remove(e){t=hf(t,e),t[0]?.resume()}}}function hf(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function P3(t){return t.filter(e=>e.tagName!=="A")}var j3=y[" useId ".trim().toString()]||(()=>{}),B3=0;function Pi(t){const[e,n]=y.useState(j3());return un(()=>{n(r=>r??String(B3++))},[t]),t||(e?`radix-${e}`:"")}var _3="Arrow",l1=y.forwardRef((t,e)=>{const{children:n,width:r=10,height:o=5,...i}=t;return g.jsx(Te.svg,{...i,ref:e,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:g.jsx("polygon",{points:"0,0 30,0 15,10"})})});l1.displayName=_3;var H3=l1;function F3(t){const[e,n]=y.useState(void 0);return un(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,l;if("borderBoxSize"in i){const a=i.borderBoxSize,c=Array.isArray(a)?a[0]:a;s=c.inlineSize,l=c.blockSize}else s=t.offsetWidth,l=t.offsetHeight;n({width:s,height:l})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var Cc="Popper",[a1,us]=dr(Cc),[$3,c1]=a1(Cc),u1=t=>{const{__scopePopper:e,children:n}=t,[r,o]=y.useState(null);return g.jsx($3,{scope:e,anchor:r,onAnchorChange:o,children:n})};u1.displayName=Cc;var d1="PopperAnchor",f1=y.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...o}=t,i=c1(d1,n),s=y.useRef(null),l=Oe(e,s),a=y.useRef(null);return y.useEffect(()=>{const c=a.current;a.current=r?.current||s.current,c!==a.current&&i.onAnchorChange(a.current)}),r?null:g.jsx(Te.div,{...o,ref:l})});f1.displayName=d1;var xc="PopperContent",[V3,z3]=a1(xc),h1=y.forwardRef((t,e)=>{const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:s=0,arrowPadding:l=0,avoidCollisions:a=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:h="optimized",onPlaced:p,...m}=t,v=c1(xc,n),[b,C]=y.useState(null),x=Oe(e,Y=>C(Y)),[w,E]=y.useState(null),k=F3(w),S=k?.width??0,M=k?.height??0,N=r+(i!=="center"?"-"+i:""),P=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},z=Array.isArray(c)?c:[c],U=z.length>0,H={padding:P,boundary:z.filter(W3),altBoundary:U},{refs:I,floatingStyles:_,placement:F,isPositioned:L,middlewareData:T}=Om({strategy:"fixed",placement:N,whileElementsMounted:(...Y)=>Am(...Y,{animationFrame:h==="always"}),elements:{reference:v.anchor},middleware:[Nm({mainAxis:o+M,alignmentAxis:s}),a&&Im({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?c5():void 0,...H}),a&&Lm({...H}),u5({...H,apply:({elements:Y,rects:te,availableWidth:Ke,availableHeight:bt})=>{const{width:Bn,height:Cs}=te.reference,_n=Y.floating.style;_n.setProperty("--radix-popper-available-width",`${Ke}px`),_n.setProperty("--radix-popper-available-height",`${bt}px`),_n.setProperty("--radix-popper-anchor-width",`${Bn}px`),_n.setProperty("--radix-popper-anchor-height",`${Cs}px`)}}),w&&f5({element:w,padding:l}),K3({arrowWidth:S,arrowHeight:M}),f&&d5({strategy:"referenceHidden",...H})]}),[R,W]=g1(F),ee=jt(p);un(()=>{L&&ee?.()},[L,ee]);const K=T.arrow?.x,Z=T.arrow?.y,We=T.arrow?.centerOffset!==0,[le,ge]=y.useState();return un(()=>{b&&ge(window.getComputedStyle(b).zIndex)},[b]),g.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{..._,transform:L?_.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:le,"--radix-popper-transform-origin":[T.transformOrigin?.x,T.transformOrigin?.y].join(" "),...T.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:g.jsx(V3,{scope:n,placedSide:R,onArrowChange:E,arrowX:K,arrowY:Z,shouldHideArrow:We,children:g.jsx(Te.div,{"data-side":R,"data-align":W,...m,ref:x,style:{...m.style,animation:L?void 0:"none"}})})})});h1.displayName=xc;var p1="PopperArrow",U3={top:"bottom",right:"left",bottom:"top",left:"right"},m1=y.forwardRef(function(e,n){const{__scopePopper:r,...o}=e,i=z3(p1,r),s=U3[i.placedSide];return g.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:g.jsx(H3,{...o,ref:n,style:{...o.style,display:"block"}})})});m1.displayName=p1;function W3(t){return t!==null}var K3=t=>({name:"transformOrigin",options:t,fn(e){const{placement:n,rects:r,middlewareData:o}=e,s=o.arrow?.centerOffset!==0,l=s?0:t.arrowWidth,a=s?0:t.arrowHeight,[c,u]=g1(n),d={start:"0%",center:"50%",end:"100%"}[u],f=(o.arrow?.x??0)+l/2,h=(o.arrow?.y??0)+a/2;let p="",m="";return c==="bottom"?(p=s?d:`${f}px`,m=`${-a}px`):c==="top"?(p=s?d:`${f}px`,m=`${r.floating.height+a}px`):c==="right"?(p=`${-a}px`,m=s?d:`${h}px`):c==="left"&&(p=`${r.floating.width+a}px`,m=s?d:`${h}px`),{data:{x:p,y:m}}}});function g1(t){const[e,n="center"]=t.split("-");return[e,n]}var y1=u1,wc=f1,v1=h1,b1=m1,q3="Portal",Sc=y.forwardRef((t,e)=>{const{container:n,...r}=t,[o,i]=y.useState(!1);un(()=>i(!0),[]);const s=n||o&&globalThis?.document?.body;return s?Hi.createPortal(g.jsx(Te.div,{...r,ref:e}),s):null});Sc.displayName=q3;function G3(t,e){return y.useReducer((n,r)=>e[n][r]??n,t)}var Dn=t=>{const{present:e,children:n}=t,r=J3(e),o=typeof n=="function"?n({present:r.isPresent}):y.Children.only(n),i=Oe(r.ref,Z3(o));return typeof n=="function"||r.isPresent?y.cloneElement(o,{ref:i}):null};Dn.displayName="Presence";function J3(t){const[e,n]=y.useState(),r=y.useRef(null),o=y.useRef(t),i=y.useRef("none"),s=t?"mounted":"unmounted",[l,a]=G3(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const c=To(r.current);i.current=l==="mounted"?c:"none"},[l]),un(()=>{const c=r.current,u=o.current;if(u!==t){const f=i.current,h=To(c);t?a("MOUNT"):h==="none"||c?.display==="none"?a("UNMOUNT"):a(u&&f!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,a]),un(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=h=>{const m=To(r.current).includes(CSS.escape(h.animationName));if(h.target===e&&m&&(a("ANIMATION_END"),!o.current)){const v=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=v)})}},f=h=>{h.target===e&&(i.current=To(r.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else a("ANIMATION_END")},[e,a]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:y.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function To(t){return t?.animationName||"none"}function Z3(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var fl="rovingFocusGroup.onEntryFocus",Y3={bubbles:!1,cancelable:!0},oo="RovingFocusGroup",[ca,C1,X3]=t1(oo),[Q3,x1]=dr(oo,[X3]),[eS,tS]=Q3(oo),w1=y.forwardRef((t,e)=>g.jsx(ca.Provider,{scope:t.__scopeRovingFocusGroup,children:g.jsx(ca.Slot,{scope:t.__scopeRovingFocusGroup,children:g.jsx(nS,{...t,ref:e})})}));w1.displayName=oo;var nS=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:a,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=t,f=y.useRef(null),h=Oe(e,f),p=n1(i),[m,v]=yc({prop:s,defaultProp:l??null,onChange:a,caller:oo}),[b,C]=y.useState(!1),x=jt(c),w=C1(n),E=y.useRef(!1),[k,S]=y.useState(0);return y.useEffect(()=>{const M=f.current;if(M)return M.addEventListener(fl,x),()=>M.removeEventListener(fl,x)},[x]),g.jsx(eS,{scope:n,orientation:r,dir:p,loop:o,currentTabStopId:m,onItemFocus:y.useCallback(M=>v(M),[v]),onItemShiftTab:y.useCallback(()=>C(!0),[]),onFocusableItemAdd:y.useCallback(()=>S(M=>M+1),[]),onFocusableItemRemove:y.useCallback(()=>S(M=>M-1),[]),children:g.jsx(Te.div,{tabIndex:b||k===0?-1:0,"data-orientation":r,...d,ref:h,style:{outline:"none",...t.style},onMouseDown:J(t.onMouseDown,()=>{E.current=!0}),onFocus:J(t.onFocus,M=>{const N=!E.current;if(M.target===M.currentTarget&&N&&!b){const P=new CustomEvent(fl,Y3);if(M.currentTarget.dispatchEvent(P),!P.defaultPrevented){const z=w().filter(F=>F.focusable),U=z.find(F=>F.active),H=z.find(F=>F.id===m),_=[U,H,...z].filter(Boolean).map(F=>F.ref.current);E1(_,u)}}E.current=!1}),onBlur:J(t.onBlur,()=>C(!1))})})}),S1="RovingFocusGroupItem",k1=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...l}=t,a=Pi(),c=i||a,u=tS(S1,n),d=u.currentTabStopId===c,f=C1(n),{onFocusableItemAdd:h,onFocusableItemRemove:p,currentTabStopId:m}=u;return y.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),g.jsx(ca.ItemSlot,{scope:n,id:c,focusable:r,active:o,children:g.jsx(Te.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...l,ref:e,onMouseDown:J(t.onMouseDown,v=>{r?u.onItemFocus(c):v.preventDefault()}),onFocus:J(t.onFocus,()=>u.onItemFocus(c)),onKeyDown:J(t.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){u.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const b=iS(v,u.orientation,u.dir);if(b!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let x=f().filter(w=>w.focusable).map(w=>w.ref.current);if(b==="last")x.reverse();else if(b==="prev"||b==="next"){b==="prev"&&x.reverse();const w=x.indexOf(v.currentTarget);x=u.loop?sS(x,w+1):x.slice(w+1)}setTimeout(()=>E1(x))}}),children:typeof s=="function"?s({isCurrentTabStop:d,hasTabStop:m!=null}):s})})});k1.displayName=S1;var rS={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function oS(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function iS(t,e,n){const r=oS(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return rS[r]}function E1(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function sS(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var lS=w1,aS=k1,cS=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},$n=new WeakMap,Ao=new WeakMap,Ro={},hl=0,M1=function(t){return t&&(t.host||M1(t.parentNode))},uS=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=M1(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},dS=function(t,e,n,r){var o=uS(e,Array.isArray(t)?t:[t]);Ro[n]||(Ro[n]=new WeakMap);var i=Ro[n],s=[],l=new Set,a=new Set(o),c=function(d){!d||l.has(d)||(l.add(d),c(d.parentNode))};o.forEach(c);var u=function(d){!d||a.has(d)||Array.prototype.forEach.call(d.children,function(f){if(l.has(f))u(f);else try{var h=f.getAttribute(r),p=h!==null&&h!=="false",m=($n.get(f)||0)+1,v=(i.get(f)||0)+1;$n.set(f,m),i.set(f,v),s.push(f),m===1&&p&&Ao.set(f,!0),v===1&&f.setAttribute(n,"true"),p||f.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",f,b)}})};return u(e),l.clear(),hl++,function(){s.forEach(function(d){var f=$n.get(d)-1,h=i.get(d)-1;$n.set(d,f),i.set(d,h),f||(Ao.has(d)||d.removeAttribute(r),Ao.delete(d)),h||d.removeAttribute(n)}),hl--,hl||($n=new WeakMap,$n=new WeakMap,Ao=new WeakMap,Ro={})}},T1=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),o=cS(t);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),dS(r,o,n,"aria-hidden")):function(){return null}},ct=function(){return ct=Object.assign||function(e){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},ct.apply(this,arguments)};function A1(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n}function fS(t,e,n){if(n||arguments.length===2)for(var r=0,o=e.length,i;r<o;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}var Fo="right-scroll-bar-position",$o="width-before-scroll-bar",hS="with-scroll-bars-hidden",pS="--removed-body-scroll-bar-size";function pl(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function mS(t,e){var n=j.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=e,n.facade}var gS=typeof window<"u"?y.useLayoutEffect:y.useEffect,pf=new WeakMap;function yS(t,e){var n=mS(null,function(r){return t.forEach(function(o){return pl(o,r)})});return gS(function(){var r=pf.get(n);if(r){var o=new Set(r),i=new Set(t),s=n.current;o.forEach(function(l){i.has(l)||pl(l,null)}),i.forEach(function(l){o.has(l)||pl(l,s)})}pf.set(n,t)},[t]),n}function vS(t){return t}function bS(t,e){e===void 0&&(e=vS);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(i){var s=e(i,r);return n.push(s),function(){n=n.filter(function(l){return l!==s})}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){r=!0;var s=[];if(n.length){var l=n;n=[],l.forEach(i),s=n}var a=function(){var u=s;s=[],u.forEach(i)},c=function(){return Promise.resolve().then(a)};c(),n={push:function(u){s.push(u),c()},filter:function(u){return s=s.filter(u),n}}}};return o}function CS(t){t===void 0&&(t={});var e=bS(null);return e.options=ct({async:!0,ssr:!1},t),e}var R1=function(t){var e=t.sideCar,n=A1(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return y.createElement(r,ct({},n))};R1.isSideCarExport=!0;function xS(t,e){return t.useMedium(e),R1}var O1=CS(),ml=function(){},ds=y.forwardRef(function(t,e){var n=y.useRef(null),r=y.useState({onScrollCapture:ml,onWheelCapture:ml,onTouchMoveCapture:ml}),o=r[0],i=r[1],s=t.forwardProps,l=t.children,a=t.className,c=t.removeScrollBar,u=t.enabled,d=t.shards,f=t.sideCar,h=t.noRelative,p=t.noIsolation,m=t.inert,v=t.allowPinchZoom,b=t.as,C=b===void 0?"div":b,x=t.gapMode,w=A1(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=f,k=yS([n,e]),S=ct(ct({},w),o);return y.createElement(y.Fragment,null,u&&y.createElement(E,{sideCar:O1,removeScrollBar:c,shards:d,noRelative:h,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!v,lockRef:n,gapMode:x}),s?y.cloneElement(y.Children.only(l),ct(ct({},S),{ref:k})):y.createElement(C,ct({},S,{className:a,ref:k}),l))});ds.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ds.classNames={fullWidth:$o,zeroRight:Fo};var wS=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function SS(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=wS();return e&&t.setAttribute("nonce",e),t}function kS(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function ES(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var MS=function(){var t=0,e=null;return{add:function(n){t==0&&(e=SS())&&(kS(e,n),ES(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},TS=function(){var t=MS();return function(e,n){y.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},N1=function(){var t=TS(),e=function(n){var r=n.styles,o=n.dynamic;return t(r,o),null};return e},AS={left:0,top:0,right:0,gap:0},gl=function(t){return parseInt(t||"",10)||0},RS=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],o=e[t==="padding"?"paddingRight":"marginRight"];return[gl(n),gl(r),gl(o)]},OS=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return AS;var e=RS(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},NS=N1(),er="data-scroll-locked",IS=function(t,e,n,r){var o=t.left,i=t.top,s=t.right,l=t.gap;return n===void 0&&(n="margin"),`
174
174
  .`.concat(hS,` {
175
175
  overflow: hidden `).concat(r,`;
176
176
  padding-right: `).concat(l,"px ").concat(r,`;
@@ -210,5 +210,5 @@ ${h.slice(c+2)}`,d+=1;else break}e.push({indent:c,number:parseInt(l,10),content:
210
210
  `)},mf=function(){var t=parseInt(document.body.getAttribute(er)||"0",10);return isFinite(t)?t:0},LS=function(){y.useEffect(function(){return document.body.setAttribute(er,(mf()+1).toString()),function(){var t=mf()-1;t<=0?document.body.removeAttribute(er):document.body.setAttribute(er,t.toString())}},[])},DS=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,o=r===void 0?"margin":r;LS();var i=y.useMemo(function(){return OS(o)},[o]);return y.createElement(NS,{styles:IS(i,!e,o,n?"":"!important")})},ua=!1;if(typeof window<"u")try{var Oo=Object.defineProperty({},"passive",{get:function(){return ua=!0,!0}});window.addEventListener("test",Oo,Oo),window.removeEventListener("test",Oo,Oo)}catch{ua=!1}var Vn=ua?{passive:!1}:!1,PS=function(t){return t.tagName==="TEXTAREA"},I1=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!PS(t)&&n[e]==="visible")},jS=function(t){return I1(t,"overflowY")},BS=function(t){return I1(t,"overflowX")},gf=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=L1(t,r);if(o){var i=D1(t,r),s=i[1],l=i[2];if(s>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},_S=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},HS=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},L1=function(t,e){return t==="v"?jS(e):BS(e)},D1=function(t,e){return t==="v"?_S(e):HS(e)},FS=function(t,e){return t==="h"&&e==="rtl"?-1:1},$S=function(t,e,n,r,o){var i=FS(t,window.getComputedStyle(e).direction),s=i*r,l=n.target,a=e.contains(l),c=!1,u=s>0,d=0,f=0;do{if(!l)break;var h=D1(t,l),p=h[0],m=h[1],v=h[2],b=m-v-i*p;(p||b)&&L1(t,l)&&(d+=b,f+=p);var C=l.parentNode;l=C&&C.nodeType===Node.DOCUMENT_FRAGMENT_NODE?C.host:C}while(!a&&l!==document.body||a&&(e.contains(l)||e===l));return(u&&Math.abs(d)<1||!u&&Math.abs(f)<1)&&(c=!0),c},No=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},yf=function(t){return[t.deltaX,t.deltaY]},vf=function(t){return t&&"current"in t?t.current:t},VS=function(t,e){return t[0]===e[0]&&t[1]===e[1]},zS=function(t){return`
211
211
  .block-interactivity-`.concat(t,` {pointer-events: none;}
212
212
  .allow-interactivity-`).concat(t,` {pointer-events: all;}
213
- `)},US=0,zn=[];function WS(t){var e=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),o=y.useState(US++)[0],i=y.useState(N1)[0],s=y.useRef(t);y.useEffect(function(){s.current=t},[t]),y.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var m=fS([t.lockRef.current],(t.shards||[]).map(vf),!0).filter(Boolean);return m.forEach(function(v){return v.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var l=y.useCallback(function(m,v){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!s.current.allowPinchZoom;var b=No(m),C=n.current,x="deltaX"in m?m.deltaX:C[0]-b[0],w="deltaY"in m?m.deltaY:C[1]-b[1],E,k=m.target,S=Math.abs(x)>Math.abs(w)?"h":"v";if("touches"in m&&S==="h"&&k.type==="range")return!1;var M=gf(S,k);if(!M)return!0;if(M?E=S:(E=S==="v"?"h":"v",M=gf(S,k)),!M)return!1;if(!r.current&&"changedTouches"in m&&(x||w)&&(r.current=E),!E)return!0;var N=r.current||E;return $S(N,v,m,N==="h"?x:w)},[]),a=y.useCallback(function(m){var v=m;if(!(!zn.length||zn[zn.length-1]!==i)){var b="deltaY"in v?yf(v):No(v),C=e.current.filter(function(E){return E.name===v.type&&(E.target===v.target||v.target===E.shadowParent)&&VS(E.delta,b)})[0];if(C&&C.should){v.cancelable&&v.preventDefault();return}if(!C){var x=(s.current.shards||[]).map(vf).filter(Boolean).filter(function(E){return E.contains(v.target)}),w=x.length>0?l(v,x[0]):!s.current.noIsolation;w&&v.cancelable&&v.preventDefault()}}},[]),c=y.useCallback(function(m,v,b,C){var x={name:m,delta:v,target:b,should:C,shadowParent:KS(b)};e.current.push(x),setTimeout(function(){e.current=e.current.filter(function(w){return w!==x})},1)},[]),u=y.useCallback(function(m){n.current=No(m),r.current=void 0},[]),d=y.useCallback(function(m){c(m.type,yf(m),m.target,l(m,t.lockRef.current))},[]),f=y.useCallback(function(m){c(m.type,No(m),m.target,l(m,t.lockRef.current))},[]);y.useEffect(function(){return zn.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",a,Vn),document.addEventListener("touchmove",a,Vn),document.addEventListener("touchstart",u,Vn),function(){zn=zn.filter(function(m){return m!==i}),document.removeEventListener("wheel",a,Vn),document.removeEventListener("touchmove",a,Vn),document.removeEventListener("touchstart",u,Vn)}},[]);var h=t.removeScrollBar,p=t.inert;return y.createElement(y.Fragment,null,p?y.createElement(i,{styles:zS(o)}):null,h?y.createElement(DS,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function KS(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const qS=xS(O1,WS);var kc=y.forwardRef(function(t,e){return y.createElement(ds,ct({},t,{ref:e,sideCar:qS}))});kc.classNames=ds.classNames;var da=["Enter"," "],GS=["ArrowDown","PageUp","Home"],P1=["ArrowUp","PageDown","End"],JS=[...GS,...P1],ZS={ltr:[...da,"ArrowRight"],rtl:[...da,"ArrowLeft"]},YS={ltr:["ArrowLeft"],rtl:["ArrowRight"]},io="Menu",[Gr,XS,QS]=t1(io),[Pn,j1]=dr(io,[QS,us,x1]),fs=us(),B1=x1(),[ek,jn]=Pn(io),[tk,so]=Pn(io),_1=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=t,l=fs(e),[a,c]=y.useState(null),u=y.useRef(!1),d=jt(i),f=n1(o);return y.useEffect(()=>{const h=()=>{u.current=!0,document.addEventListener("pointerdown",p,{capture:!0,once:!0}),document.addEventListener("pointermove",p,{capture:!0,once:!0})},p=()=>u.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",p,{capture:!0}),document.removeEventListener("pointermove",p,{capture:!0})}},[]),g.jsx(y1,{...l,children:g.jsx(ek,{scope:e,open:n,onOpenChange:d,content:a,onContentChange:c,children:g.jsx(tk,{scope:e,onClose:y.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:s,children:r})})})};_1.displayName=io;var nk="MenuAnchor",Ec=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,o=fs(n);return g.jsx(wc,{...o,...r,ref:e})});Ec.displayName=nk;var Mc="MenuPortal",[rk,H1]=Pn(Mc,{forceMount:void 0}),F1=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:o}=t,i=jn(Mc,e);return g.jsx(rk,{scope:e,forceMount:n,children:g.jsx(Dn,{present:n||i.open,children:g.jsx(Sc,{asChild:!0,container:o,children:r})})})};F1.displayName=Mc;var et="MenuContent",[ok,Tc]=Pn(et),$1=y.forwardRef((t,e)=>{const n=H1(et,t.__scopeMenu),{forceMount:r=n.forceMount,...o}=t,i=jn(et,t.__scopeMenu),s=so(et,t.__scopeMenu);return g.jsx(Gr.Provider,{scope:t.__scopeMenu,children:g.jsx(Dn,{present:r||i.open,children:g.jsx(Gr.Slot,{scope:t.__scopeMenu,children:s.modal?g.jsx(ik,{...o,ref:e}):g.jsx(sk,{...o,ref:e})})})})}),ik=y.forwardRef((t,e)=>{const n=jn(et,t.__scopeMenu),r=y.useRef(null),o=Oe(e,r);return y.useEffect(()=>{const i=r.current;if(i)return T1(i)},[]),g.jsx(Ac,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:J(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),sk=y.forwardRef((t,e)=>{const n=jn(et,t.__scopeMenu);return g.jsx(Ac,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),lk=qr("MenuContent.ScrollLock"),Ac=y.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEntryFocus:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:h,disableOutsideScroll:p,...m}=t,v=jn(et,n),b=so(et,n),C=fs(n),x=B1(n),w=XS(n),[E,k]=y.useState(null),S=y.useRef(null),M=Oe(e,S,v.onContentChange),N=y.useRef(0),P=y.useRef(""),W=y.useRef(0),z=y.useRef(null),H=y.useRef("right"),I=y.useRef(0),_=p?kc:y.Fragment,F=p?{as:lk,allowPinchZoom:!0}:void 0,L=R=>{const U=P.current+R,ee=w().filter(Y=>!Y.disabled),K=document.activeElement,Z=ee.find(Y=>Y.ref.current===K)?.textValue,We=ee.map(Y=>Y.textValue),le=bk(We,U,Z),ge=ee.find(Y=>Y.textValue===le)?.ref.current;(function Y(te){P.current=te,window.clearTimeout(N.current),te!==""&&(N.current=window.setTimeout(()=>Y(""),1e3))})(U),ge&&setTimeout(()=>ge.focus())};y.useEffect(()=>()=>window.clearTimeout(N.current),[]),i1();const T=y.useCallback(R=>H.current===z.current?.side&&xk(R,z.current?.area),[]);return g.jsx(ok,{scope:n,searchRef:P,onItemEnter:y.useCallback(R=>{T(R)&&R.preventDefault()},[T]),onItemLeave:y.useCallback(R=>{T(R)||(S.current?.focus(),k(null))},[T]),onTriggerLeave:y.useCallback(R=>{T(R)&&R.preventDefault()},[T]),pointerGraceTimerRef:W,onPointerGraceIntentChange:y.useCallback(R=>{z.current=R},[]),children:g.jsx(_,{...F,children:g.jsx(bc,{asChild:!0,trapped:o,onMountAutoFocus:J(i,R=>{R.preventDefault(),S.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:g.jsx(vc,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:h,children:g.jsx(lS,{asChild:!0,...x,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:E,onCurrentTabStopIdChange:k,onEntryFocus:J(a,R=>{b.isUsingKeyboardRef.current||R.preventDefault()}),preventScrollOnEntryFocus:!0,children:g.jsx(v1,{role:"menu","aria-orientation":"vertical","data-state":rg(v.open),"data-radix-menu-content":"",dir:b.dir,...C,...m,ref:M,style:{outline:"none",...m.style},onKeyDown:J(m.onKeyDown,R=>{const ee=R.target.closest("[data-radix-menu-content]")===R.currentTarget,K=R.ctrlKey||R.altKey||R.metaKey,Z=R.key.length===1;ee&&(R.key==="Tab"&&R.preventDefault(),!K&&Z&&L(R.key));const We=S.current;if(R.target!==We||!JS.includes(R.key))return;R.preventDefault();const ge=w().filter(Y=>!Y.disabled).map(Y=>Y.ref.current);P1.includes(R.key)&&ge.reverse(),yk(ge)}),onBlur:J(t.onBlur,R=>{R.currentTarget.contains(R.target)||(window.clearTimeout(N.current),P.current="")}),onPointerMove:J(t.onPointerMove,Jr(R=>{const U=R.target,ee=I.current!==R.clientX;if(R.currentTarget.contains(U)&&ee){const K=R.clientX>I.current?"right":"left";H.current=K,I.current=R.clientX}}))})})})})})})});$1.displayName=et;var ak="MenuGroup",Rc=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return g.jsx(Te.div,{role:"group",...r,ref:e})});Rc.displayName=ak;var ck="MenuLabel",V1=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return g.jsx(Te.div,{...r,ref:e})});V1.displayName=ck;var ji="MenuItem",bf="menu.itemSelect",hs=y.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...o}=t,i=y.useRef(null),s=so(ji,t.__scopeMenu),l=Tc(ji,t.__scopeMenu),a=Oe(e,i),c=y.useRef(!1),u=()=>{const d=i.current;if(!n&&d){const f=new CustomEvent(bf,{bubbles:!0,cancelable:!0});d.addEventListener(bf,h=>r?.(h),{once:!0}),e1(d,f),f.defaultPrevented?c.current=!1:s.onClose()}};return g.jsx(z1,{...o,ref:a,disabled:n,onClick:J(t.onClick,u),onPointerDown:d=>{t.onPointerDown?.(d),c.current=!0},onPointerUp:J(t.onPointerUp,d=>{c.current||d.currentTarget?.click()}),onKeyDown:J(t.onKeyDown,d=>{const f=l.searchRef.current!=="";n||f&&d.key===" "||da.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});hs.displayName=ji;var z1=y.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=t,s=Tc(ji,n),l=B1(n),a=y.useRef(null),c=Oe(e,a),[u,d]=y.useState(!1),[f,h]=y.useState("");return y.useEffect(()=>{const p=a.current;p&&h((p.textContent??"").trim())},[i.children]),g.jsx(Gr.ItemSlot,{scope:n,disabled:r,textValue:o??f,children:g.jsx(aS,{asChild:!0,...l,focusable:!r,children:g.jsx(Te.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:c,onPointerMove:J(t.onPointerMove,Jr(p=>{r?s.onItemLeave(p):(s.onItemEnter(p),p.defaultPrevented||p.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:J(t.onPointerLeave,Jr(p=>s.onItemLeave(p))),onFocus:J(t.onFocus,()=>d(!0)),onBlur:J(t.onBlur,()=>d(!1))})})})}),uk="MenuCheckboxItem",U1=y.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...o}=t;return g.jsx(J1,{scope:t.__scopeMenu,checked:n,children:g.jsx(hs,{role:"menuitemcheckbox","aria-checked":Bi(n)?"mixed":n,...o,ref:e,"data-state":Nc(n),onSelect:J(o.onSelect,()=>r?.(Bi(n)?!0:!n),{checkForDefaultPrevented:!1})})})});U1.displayName=uk;var W1="MenuRadioGroup",[dk,fk]=Pn(W1,{value:void 0,onValueChange:()=>{}}),K1=y.forwardRef((t,e)=>{const{value:n,onValueChange:r,...o}=t,i=jt(r);return g.jsx(dk,{scope:t.__scopeMenu,value:n,onValueChange:i,children:g.jsx(Rc,{...o,ref:e})})});K1.displayName=W1;var q1="MenuRadioItem",G1=y.forwardRef((t,e)=>{const{value:n,...r}=t,o=fk(q1,t.__scopeMenu),i=n===o.value;return g.jsx(J1,{scope:t.__scopeMenu,checked:i,children:g.jsx(hs,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":Nc(i),onSelect:J(r.onSelect,()=>o.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});G1.displayName=q1;var Oc="MenuItemIndicator",[J1,hk]=Pn(Oc,{checked:!1}),Z1=y.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...o}=t,i=hk(Oc,n);return g.jsx(Dn,{present:r||Bi(i.checked)||i.checked===!0,children:g.jsx(Te.span,{...o,ref:e,"data-state":Nc(i.checked)})})});Z1.displayName=Oc;var pk="MenuSeparator",Y1=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return g.jsx(Te.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});Y1.displayName=pk;var mk="MenuArrow",X1=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,o=fs(n);return g.jsx(b1,{...o,...r,ref:e})});X1.displayName=mk;var gk="MenuSub",[lM,Q1]=Pn(gk),Cr="MenuSubTrigger",eg=y.forwardRef((t,e)=>{const n=jn(Cr,t.__scopeMenu),r=so(Cr,t.__scopeMenu),o=Q1(Cr,t.__scopeMenu),i=Tc(Cr,t.__scopeMenu),s=y.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:a}=i,c={__scopeMenu:t.__scopeMenu},u=y.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return y.useEffect(()=>u,[u]),y.useEffect(()=>{const d=l.current;return()=>{window.clearTimeout(d),a(null)}},[l,a]),g.jsx(Ec,{asChild:!0,...c,children:g.jsx(z1,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":rg(n.open),...t,ref:cs(e,o.onTriggerChange),onClick:d=>{t.onClick?.(d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:J(t.onPointerMove,Jr(d=>{i.onItemEnter(d),!d.defaultPrevented&&!t.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:J(t.onPointerLeave,Jr(d=>{u();const f=n.content?.getBoundingClientRect();if(f){const h=n.content?.dataset.side,p=h==="right",m=p?-5:5,v=f[p?"left":"right"],b=f[p?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+m,y:d.clientY},{x:v,y:f.top},{x:b,y:f.top},{x:b,y:f.bottom},{x:v,y:f.bottom}],side:h}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(d),d.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:J(t.onKeyDown,d=>{const f=i.searchRef.current!=="";t.disabled||f&&d.key===" "||ZS[r.dir].includes(d.key)&&(n.onOpenChange(!0),n.content?.focus(),d.preventDefault())})})})});eg.displayName=Cr;var tg="MenuSubContent",ng=y.forwardRef((t,e)=>{const n=H1(et,t.__scopeMenu),{forceMount:r=n.forceMount,...o}=t,i=jn(et,t.__scopeMenu),s=so(et,t.__scopeMenu),l=Q1(tg,t.__scopeMenu),a=y.useRef(null),c=Oe(e,a);return g.jsx(Gr.Provider,{scope:t.__scopeMenu,children:g.jsx(Dn,{present:r||i.open,children:g.jsx(Gr.Slot,{scope:t.__scopeMenu,children:g.jsx(Ac,{id:l.contentId,"aria-labelledby":l.triggerId,...o,ref:c,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{s.isUsingKeyboardRef.current&&a.current?.focus(),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:J(t.onFocusOutside,u=>{u.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:J(t.onEscapeKeyDown,u=>{s.onClose(),u.preventDefault()}),onKeyDown:J(t.onKeyDown,u=>{const d=u.currentTarget.contains(u.target),f=YS[s.dir].includes(u.key);d&&f&&(i.onOpenChange(!1),l.trigger?.focus(),u.preventDefault())})})})})})});ng.displayName=tg;function rg(t){return t?"open":"closed"}function Bi(t){return t==="indeterminate"}function Nc(t){return Bi(t)?"indeterminate":t?"checked":"unchecked"}function yk(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function vk(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function bk(t,e,n){const o=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let s=vk(t,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const a=s.find(c=>c.toLowerCase().startsWith(o.toLowerCase()));return a!==n?a:void 0}function Ck(t,e){const{x:n,y:r}=t;let o=!1;for(let i=0,s=e.length-1;i<e.length;s=i++){const l=e[i],a=e[s],c=l.x,u=l.y,d=a.x,f=a.y;u>r!=f>r&&n<(d-c)*(r-u)/(f-u)+c&&(o=!o)}return o}function xk(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return Ck(n,e)}function Jr(t){return e=>e.pointerType==="mouse"?t(e):void 0}var wk=_1,Sk=Ec,kk=F1,Ek=$1,Mk=Rc,Tk=V1,Ak=hs,Rk=U1,Ok=K1,Nk=G1,Ik=Z1,Lk=Y1,Dk=X1,Pk=eg,jk=ng,ps="DropdownMenu",[Bk]=dr(ps,[j1]),Be=j1(),[_k,og]=Bk(ps),ig=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:s,modal:l=!0}=t,a=Be(e),c=y.useRef(null),[u,d]=yc({prop:o,defaultProp:i??!1,onChange:s,caller:ps});return g.jsx(_k,{scope:e,triggerId:Pi(),triggerRef:c,contentId:Pi(),open:u,onOpenChange:d,onOpenToggle:y.useCallback(()=>d(f=>!f),[d]),modal:l,children:g.jsx(wk,{...a,open:u,onOpenChange:d,dir:r,modal:l,children:n})})};ig.displayName=ps;var sg="DropdownMenuTrigger",lg=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=t,i=og(sg,n),s=Be(n);return g.jsx(Sk,{asChild:!0,...s,children:g.jsx(Te.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:cs(e,i.triggerRef),onPointerDown:J(t.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:J(t.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});lg.displayName=sg;var Hk="DropdownMenuPortal",ag=t=>{const{__scopeDropdownMenu:e,...n}=t,r=Be(e);return g.jsx(kk,{...r,...n})};ag.displayName=Hk;var cg="DropdownMenuContent",ug=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=og(cg,n),i=Be(n),s=y.useRef(!1);return g.jsx(Ek,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...r,ref:e,onCloseAutoFocus:J(t.onCloseAutoFocus,l=>{s.current||o.triggerRef.current?.focus(),s.current=!1,l.preventDefault()}),onInteractOutside:J(t.onInteractOutside,l=>{const a=l.detail.originalEvent,c=a.button===0&&a.ctrlKey===!0,u=a.button===2||c;(!o.modal||u)&&(s.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ug.displayName=cg;var Fk="DropdownMenuGroup",$k=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Mk,{...o,...r,ref:e})});$k.displayName=Fk;var Vk="DropdownMenuLabel",zk=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Tk,{...o,...r,ref:e})});zk.displayName=Vk;var Uk="DropdownMenuItem",dg=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Ak,{...o,...r,ref:e})});dg.displayName=Uk;var Wk="DropdownMenuCheckboxItem",Kk=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Rk,{...o,...r,ref:e})});Kk.displayName=Wk;var qk="DropdownMenuRadioGroup",Gk=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Ok,{...o,...r,ref:e})});Gk.displayName=qk;var Jk="DropdownMenuRadioItem",Zk=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Nk,{...o,...r,ref:e})});Zk.displayName=Jk;var Yk="DropdownMenuItemIndicator",Xk=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Ik,{...o,...r,ref:e})});Xk.displayName=Yk;var Qk="DropdownMenuSeparator",e9=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Lk,{...o,...r,ref:e})});e9.displayName=Qk;var t9="DropdownMenuArrow",n9=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Dk,{...o,...r,ref:e})});n9.displayName=t9;var r9="DropdownMenuSubTrigger",o9=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Pk,{...o,...r,ref:e})});o9.displayName=r9;var i9="DropdownMenuSubContent",fg=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(jk,{...o,...r,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});fg.displayName=i9;var s9=ig,hg=lg,l9=ag,pg=ug,a9=dg,mg=fg;function gg({...t}){return g.jsx(s9,{modal:!1,...t})}function yg({...t}){return g.jsx(l9,{...t})}const Ic=y.forwardRef(({...t},e)=>g.jsx(hg,{ref:e,...t}));Ic.displayName=hg.displayName;const vg=a9,c9=y.forwardRef(({className:t,portal:e=!0,...n},r)=>{const o=g.jsx(mg,{ref:r,className:Me("tiptap-dropdown-menu",t),...n});return e?g.jsx(yg,{...typeof e=="object"?e:{},children:o}):o});c9.displayName=mg.displayName;const Lc=y.forwardRef(({className:t,sideOffset:e=4,portal:n=!1,...r},o)=>{const i=g.jsx(pg,{ref:o,sideOffset:e,onCloseAutoFocus:s=>s.preventDefault(),className:Me("tiptap-dropdown-menu",t),...r});return n?g.jsx(yg,{...typeof n=="object"?n:{},children:i}):i});Lc.displayName=pg.displayName;const fr=y.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:Me("tiptap-card",t),...e}));fr.displayName="Card";const u9=y.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:Me("tiptap-card-header",t),...e}));u9.displayName="CardHeader";const lo=y.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:Me("tiptap-card-body",t),...e}));lo.displayName="CardBody";const Dc=y.forwardRef(({className:t,orientation:e="vertical",...n},r)=>g.jsx("div",{ref:r,"data-orientation":e,className:Me("tiptap-card-item-group",t),...n}));Dc.displayName="CardItemGroup";const d9=y.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:Me("tiptap-card-group-label",t),...e}));d9.displayName="CardGroupLabel";const f9=y.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:Me("tiptap-card-footer",t),...e}));f9.displayName="CardFooter";const Pc=y.forwardRef(({editor:t,levels:e=[1,2,3,4,5,6],hideWhenUnavailable:n=!1,portal:r=!1,onOpenChange:o,...i},s)=>{const{editor:l}=ie(t),[a,c]=y.useState(!1),{isVisible:u,isActive:d,canToggle:f,Icon:h}=p9({editor:l,levels:e,hideWhenUnavailable:n}),p=y.useCallback(m=>{!l||!f||(c(m),o?.(m))},[f,l,o]);return u?g.jsxs(gg,{modal:!0,open:a,onOpenChange:p,children:[g.jsx(Ic,{asChild:!0,children:g.jsxs(fe,{type:"button","data-style":"ghost","data-active-state":d?"on":"off",role:"button",tabIndex:-1,disabled:!f,"data-disabled":!f,"aria-label":"Format text as heading","aria-pressed":d,tooltip:"Heading",...i,ref:s,children:[g.jsx(h,{className:"tiptap-button-icon"}),g.jsx(mc,{className:"tiptap-button-dropdown-small"})]})}),g.jsx(Lc,{align:"start",portal:r,children:g.jsx(fr,{children:g.jsx(lo,{children:g.jsx(In,{children:e.map(m=>g.jsx(vg,{asChild:!0,children:g.jsx(Um,{editor:l,level:m,text:`Heading ${m}`,showTooltip:!1})},`heading-${m}`))})})})})]}):null});Pc.displayName="HeadingDropdownMenu";const bg=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{d:"M6 3C6.55228 3 7 3.44772 7 4V11H17V4C17 3.44772 17.4477 3 18 3C18.5523 3 19 3.44772 19 4V20C19 20.5523 18.5523 21 18 21C17.4477 21 17 20.5523 17 20V13H7V20C7 20.5523 6.55228 21 6 21C5.44772 21 5 20.5523 5 20V4C5 3.44772 5.44772 3 6 3Z",fill:"currentColor"})}));bg.displayName="HeadingIcon";function h9(t,e=[1,2,3,4,5,6]){if(!(!t||!t.isEditable))return e.find(n=>gc(t,n))}function p9(t){const{editor:e,levels:n=[1,2,3,4,5,6],hideWhenUnavailable:r=!1}=t||{},{editor:o}=ie(e),[i,s]=y.useState(!0),l=h9(o,n),a=gc(o),c=Kr(o);return y.useEffect(()=>{if(!o)return;const u=()=>{s(Qm({editor:o,hideWhenUnavailable:r,level:n}))};return u(),o.on("selectionUpdate",u),()=>{o.off("selectionUpdate",u)}},[o,r,n]),{isVisible:i,activeLevel:l,isActive:a,canToggle:c,levels:n,label:"Heading",Icon:l?Ym[l]:bg}}function m9({shortcutKeys:t=fa}){return g.jsx(vt,{children:gt({shortcutKeys:t})})}const jc=y.forwardRef(({editor:t,text:e,hideWhenUnavailable:n=!1,onInserted:r,showShortcut:o=!1,onClick:i,children:s,...l},a)=>{const{editor:c}=ie(t),{isVisible:u,canInsert:d,handleImage:f,label:h,isActive:p,shortcutKeys:m,Icon:v}=D9({editor:c,hideWhenUnavailable:n,onInserted:r}),b=y.useCallback(C=>{i?.(C),!C.defaultPrevented&&f()},[f,i]);return u?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":p?"on":"off",role:"button",tabIndex:-1,disabled:!d,"data-disabled":!d,"aria-label":h,"aria-pressed":p,tooltip:h,onClick:b,...l,ref:a,children:s??g.jsxs(g.Fragment,{children:[g.jsx(v,{className:"tiptap-button-icon"}),e&&g.jsx("span",{className:"tiptap-button-text",children:e}),o&&g.jsx(m9,{shortcutKeys:m})]})}):null});jc.displayName="ImageUploadButton";const Cg=["shift","alt","meta","mod","ctrl","control"],g9={esc:"escape",return:"enter",left:"arrowleft",right:"arrowright",up:"arrowup",down:"arrowdown",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function on(t){return(g9[t.trim()]||t.trim()).toLowerCase().replace(/key|digit|numpad/,"")}function xg(t){return Cg.includes(t)}function yl(t,e=","){return t.toLowerCase().split(e)}function vl(t,e="+",n=">",r=!1,o){let i=[],s=!1;t=t.trim(),t.includes(n)?(s=!0,i=t.toLocaleLowerCase().split(n).map(c=>on(c))):i=t.toLocaleLowerCase().split(e).map(c=>on(c));const l={alt:i.includes("alt"),ctrl:i.includes("ctrl")||i.includes("control"),shift:i.includes("shift"),meta:i.includes("meta"),mod:i.includes("mod"),useKey:r},a=i.filter(c=>!Cg.includes(c));return{...l,keys:a,description:o,isSequence:s,hotkey:t}}typeof document<"u"&&(document.addEventListener("keydown",t=>{t.code!==void 0&&wg([on(t.code)])}),document.addEventListener("keyup",t=>{t.code!==void 0&&Sg([on(t.code)])})),typeof window<"u"&&(window.addEventListener("blur",()=>{Rt.clear()}),window.addEventListener("contextmenu",()=>{setTimeout(()=>{Rt.clear()},0)}));const Rt=new Set;function Bc(t){return Array.isArray(t)}function y9(t,e=","){return(Bc(t)?t:t.split(e)).every(n=>Rt.has(n.trim().toLowerCase()))}function wg(t){const e=Array.isArray(t)?t:[t];Rt.has("meta")&&Rt.forEach(n=>!xg(n)&&Rt.delete(n.toLowerCase())),e.forEach(n=>Rt.add(n.toLowerCase()))}function Sg(t){const e=Array.isArray(t)?t:[t];t==="meta"?Rt.clear():e.forEach(n=>Rt.delete(n.toLowerCase()))}function v9(t,e,n){(typeof n=="function"&&n(t,e)||n===!0)&&t.preventDefault()}function b9(t,e,n){return typeof n=="function"?n(t,e):n===!0||n===void 0}const C9=["input","textarea","select","searchbox","slider","spinbutton","menuitem","menuitemcheckbox","menuitemradio","option","radio","textbox"];function x9(t){return kg(t,C9)}function kg(t,e=!1){const{target:n,composed:r}=t;let o,i;return w9(n)&&r?(o=t.composedPath()[0]&&t.composedPath()[0].tagName,i=t.composedPath()[0]&&t.composedPath()[0].role):(o=n&&n.tagName,i=n&&n.role),Bc(e)?!!(o&&e&&e.some(s=>s.toLowerCase()===o.toLowerCase()||s===i)):!!(o&&e&&e)}function w9(t){return!!t.tagName&&!t.tagName.startsWith("-")&&t.tagName.includes("-")}function S9(t,e){return t.length===0&&e?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):e?t.some(n=>e.includes(n))||t.includes("*"):!0}const k9=(t,e,n=!1)=>{const{alt:r,meta:o,mod:i,shift:s,ctrl:l,keys:a,useKey:c}=e,{code:u,key:d,ctrlKey:f,metaKey:h,shiftKey:p,altKey:m}=t,v=on(u);if(c&&a?.length===1&&a.includes(d))return!0;if(!a?.includes(v)&&!["ctrl","control","unknown","meta","alt","shift","os"].includes(v))return!1;if(!n){if(r!==m&&v!=="alt"||s!==p&&v!=="shift")return!1;if(i){if(!h&&!f)return!1}else if(o!==h&&v!=="meta"&&v!=="os"||l!==f&&v!=="ctrl"&&v!=="control")return!1}return a&&a.length===1&&a.includes(v)?!0:a?y9(a):!a},E9=j.createContext(void 0),M9=()=>j.useContext(E9);function Eg(t,e){return t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(t).length===Object.keys(e).length&&Object.keys(t).reduce((n,r)=>n&&Eg(t[r],e[r]),!0):t===e}const T9=j.createContext({hotkeys:[],activeScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),A9=()=>j.useContext(T9);function R9(t){const e=j.useRef(void 0);return Eg(e.current,t)||(e.current=t),e.current}const Cf=t=>{t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},O9=typeof window<"u"?j.useLayoutEffect:j.useEffect;function Mg(t,e,n,r){const o=j.useRef(null),i=j.useRef(!1),s=Array.isArray(n)?Array.isArray(r)?void 0:r:n,l=Bc(t)?t.join(s?.delimiter):t,a=Array.isArray(n)?n:Array.isArray(r)?r:void 0,c=j.useCallback(e,a??[]),u=j.useRef(c);a?u.current=c:u.current=e;const d=R9(s),{activeScopes:f}=A9(),h=M9();return O9(()=>{if(d?.enabled===!1||!S9(f,d?.scopes))return;let p=[],m;const v=(w,E=!1)=>{if(!(x9(w)&&!kg(w,d?.enableOnFormTags))){if(o.current!==null){const k=o.current.getRootNode();if((k instanceof Document||k instanceof ShadowRoot)&&k.activeElement!==o.current&&!o.current.contains(k.activeElement)){Cf(w);return}}w.target?.isContentEditable&&!d?.enableOnContentEditable||yl(l,d?.delimiter).forEach(k=>{if(k.includes(d?.splitKey??"+")&&k.includes(d?.sequenceSplitKey??">")){console.warn(`Hotkey ${k} contains both ${d?.splitKey??"+"} and ${d?.sequenceSplitKey??">"} which is not supported.`);return}const S=vl(k,d?.splitKey,d?.sequenceSplitKey,d?.useKey,d?.description);if(S.isSequence){m=setTimeout(()=>{p=[]},d?.sequenceTimeoutMs??1e3);const M=S.useKey?w.key:on(w.code);if(xg(M.toLowerCase()))return;p.push(M);const N=S.keys?.[p.length-1];if(M!==N){p=[],m&&clearTimeout(m);return}p.length===S.keys?.length&&(u.current(w,S),m&&clearTimeout(m),p=[])}else if(k9(w,S,d?.ignoreModifiers)||S.keys?.includes("*")){if(d?.ignoreEventWhen?.(w)||E&&i.current)return;if(v9(w,S,d?.preventDefault),!b9(w,S,d?.enabled)){Cf(w);return}u.current(w,S),E||(i.current=!0)}})}},b=w=>{w.code!==void 0&&(wg(on(w.code)),(d?.keydown===void 0&&d?.keyup!==!0||d?.keydown)&&v(w))},C=w=>{w.code!==void 0&&(Sg(on(w.code)),i.current=!1,d?.keyup&&v(w,!0))},x=o.current||s?.document||document;return x.addEventListener("keyup",C,s?.eventListenerOptions),x.addEventListener("keydown",b,s?.eventListenerOptions),h&&yl(l,d?.delimiter).forEach(w=>h.addHotkey(vl(w,d?.splitKey,d?.sequenceSplitKey,d?.useKey,d?.description))),()=>{x.removeEventListener("keyup",C,s?.eventListenerOptions),x.removeEventListener("keydown",b,s?.eventListenerOptions),h&&yl(l,d?.delimiter).forEach(w=>h.removeHotkey(vl(w,d?.splitKey,d?.sequenceSplitKey,d?.useKey,d?.description))),p=[],m&&clearTimeout(m)}},[l,d,f]),o}function hr(t=768){const[e,n]=y.useState(void 0);return y.useEffect(()=>{const r=window.matchMedia(`(max-width: ${t-1}px)`),o=()=>{n(window.innerWidth<t)};return r.addEventListener("change",o),n(window.innerWidth<t),()=>r.removeEventListener("change",o)},[t]),!!e}const Tg=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 2C20 1.44772 19.5523 1 19 1C18.4477 1 18 1.44772 18 2V4H16C15.4477 4 15 4.44772 15 5C15 5.55228 15.4477 6 16 6H18V8C18 8.55228 18.4477 9 19 9C19.5523 9 20 8.55228 20 8V6H22C22.5523 6 23 5.55228 23 5C23 4.44772 22.5523 4 22 4H20V2ZM5 4C4.73478 4 4.48043 4.10536 4.29289 4.29289C4.10536 4.48043 4 4.73478 4 5V19C4 19.2652 4.10536 19.5196 4.29289 19.7071C4.48043 19.8946 4.73478 20 5 20H5.58579L14.379 11.2068C14.9416 10.6444 15.7045 10.3284 16.5 10.3284C17.2955 10.3284 18.0584 10.6444 18.621 11.2068L20 12.5858V12C20 11.4477 20.4477 11 21 11C21.5523 11 22 11.4477 22 12V14.998C22 14.9994 22 15.0007 22 15.002V19C22 19.7957 21.6839 20.5587 21.1213 21.1213C20.5587 21.6839 19.7957 22 19 22H6.00219C6.00073 22 5.99927 22 5.99781 22H5C4.20435 22 3.44129 21.6839 2.87868 21.1213C2.31607 20.5587 2 19.7957 2 19V5C2 4.20435 2.31607 3.44129 2.87868 2.87868C3.44129 2.31607 4.20435 2 5 2H12C12.5523 2 13 2.44772 13 3C13 3.55228 12.5523 4 12 4H5ZM8.41422 20H19C19.2652 20 19.5196 19.8946 19.7071 19.7071C19.8946 19.5196 20 19.2652 20 19V15.4142L17.207 12.6212C17.0195 12.4338 16.7651 12.3284 16.5 12.3284C16.2349 12.3284 15.9806 12.4337 15.7931 12.6211L8.41422 20ZM6.87868 6.87868C7.44129 6.31607 8.20435 6 9 6C9.79565 6 10.5587 6.31607 11.1213 6.87868C11.6839 7.44129 12 8.20435 12 9C12 9.79565 11.6839 10.5587 11.1213 11.1213C10.5587 11.6839 9.79565 12 9 12C8.20435 12 7.44129 11.6839 6.87868 11.1213C6.31607 10.5587 6 9.79565 6 9C6 8.20435 6.31607 7.44129 6.87868 6.87868ZM9 8C8.73478 8 8.48043 8.10536 8.29289 8.29289C8.10536 8.48043 8 8.73478 8 9C8 9.26522 8.10536 9.51957 8.29289 9.70711C8.48043 9.89464 8.73478 10 9 10C9.26522 10 9.51957 9.89464 9.70711 9.70711C9.89464 9.51957 10 9.26522 10 9C10 8.73478 9.89464 8.48043 9.70711 8.29289C9.51957 8.10536 9.26522 8 9 8Z",fill:"currentColor"})}));Tg.displayName="ImagePlusIcon";const fa="mod+shift+i";function _c(t){return!t||!t.isEditable||!ls(t,"imageUpload")||Ht(t,["image"])?!1:t.can().insertContent({type:"imageUpload"})}function N9(t){return!t||!t.isEditable?!1:t.isActive("imageUpload")}function I9(t){if(!t||!t.isEditable||!_c(t))return!1;try{return t.chain().focus().insertContent({type:"imageUpload"}).run()}catch{return!1}}function L9(t){const{editor:e,hideWhenUnavailable:n}=t;return!e||!e.isEditable||!ls(e,"imageUpload")?!1:n&&!e.isActive("code")?_c(e):!0}function D9(t){const{editor:e,hideWhenUnavailable:n=!1,onInserted:r}=t||{},{editor:o}=ie(e),i=hr(),[s,l]=y.useState(!0),a=_c(o),c=N9(o);y.useEffect(()=>{if(!o)return;const d=()=>{l(L9({editor:o,hideWhenUnavailable:n}))};return d(),o.on("selectionUpdate",d),()=>{o.off("selectionUpdate",d)}},[o,n]);const u=y.useCallback(()=>{if(!o)return!1;const d=I9(o);return d&&r?.(),d},[o,r]);return Mg(fa,d=>{d.preventDefault(),u()},{enabled:s&&a,enableOnContentEditable:!i,enableOnFormTags:!0}),{isVisible:s,isActive:c,handleImage:u,canInsert:a,label:"Add image",shortcutKeys:fa,Icon:Tg}}function P9({type:t,shortcutKeys:e=Og[t]}){return g.jsx(vt,{children:gt({shortcutKeys:e})})}const Ag=y.forwardRef(({editor:t,type:e,text:n,hideWhenUnavailable:r=!1,onToggled:o,showShortcut:i=!1,onClick:s,children:l,...a},c)=>{const{editor:u}=ie(t),{isVisible:d,canToggle:f,isActive:h,handleToggle:p,label:m,shortcutKeys:v,Icon:b}=H9({editor:u,type:e,hideWhenUnavailable:r,onToggled:o}),C=y.useCallback(x=>{s?.(x),!x.defaultPrevented&&p()},[p,s]);return d?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":h?"on":"off",role:"button",tabIndex:-1,disabled:!f,"data-disabled":!f,"aria-label":m,"aria-pressed":h,tooltip:m,onClick:C,...a,ref:c,children:l??g.jsxs(g.Fragment,{children:[g.jsx(b,{className:"tiptap-button-icon"}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(P9,{type:e,shortcutKeys:v})]})}):null});Ag.displayName="ListButton";const ms=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 6C7 5.44772 7.44772 5 8 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H8C7.44772 7 7 6.55228 7 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 12C7 11.4477 7.44772 11 8 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H8C7.44772 13 7 12.5523 7 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 18C7 17.4477 7.44772 17 8 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H8C7.44772 19 7 18.5523 7 18Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H3.01C3.56228 5 4.01 5.44772 4.01 6C4.01 6.55228 3.56228 7 3.01 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H3.01C3.56228 11 4.01 11.4477 4.01 12C4.01 12.5523 3.56228 13 3.01 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H3.01C3.56228 17 4.01 17.4477 4.01 18C4.01 18.5523 3.56228 19 3.01 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]}));ms.displayName="ListIcon";const Hc=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 6C9 5.44772 9.44772 5 10 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H10C9.44772 7 9 6.55228 9 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 12C9 11.4477 9.44772 11 10 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H10C9.44772 13 9 12.5523 9 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 18C9 17.4477 9.44772 17 10 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H10C9.44772 19 9 18.5523 9 18Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 6C3 5.44772 3.44772 5 4 5H5C5.55228 5 6 5.44772 6 6V10C6 10.5523 5.55228 11 5 11C4.44772 11 4 10.5523 4 10V7C3.44772 7 3 6.55228 3 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 10C3 9.44772 3.44772 9 4 9H6C6.55228 9 7 9.44772 7 10C7 10.5523 6.55228 11 6 11H4C3.44772 11 3 10.5523 3 10Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.82219 13.0431C6.54543 13.4047 6.99997 14.1319 6.99997 15C6.99997 15.5763 6.71806 16.0426 6.48747 16.35C6.31395 16.5814 6.1052 16.8044 5.91309 17H5.99997C6.55226 17 6.99997 17.4477 6.99997 18C6.99997 18.5523 6.55226 19 5.99997 19H3.99997C3.44769 19 2.99997 18.5523 2.99997 18C2.99997 17.4237 3.28189 16.9575 3.51247 16.65C3.74323 16.3424 4.03626 16.0494 4.26965 15.8161C4.27745 15.8083 4.2852 15.8006 4.29287 15.7929C4.55594 15.5298 4.75095 15.3321 4.88748 15.15C4.96287 15.0495 4.99021 14.9922 4.99911 14.9714C4.99535 14.9112 4.9803 14.882 4.9739 14.8715C4.96613 14.8588 4.95382 14.845 4.92776 14.8319C4.87723 14.8067 4.71156 14.7623 4.44719 14.8944C3.95321 15.1414 3.35254 14.9412 3.10555 14.4472C2.85856 13.9533 3.05878 13.3526 3.55276 13.1056C4.28839 12.7378 5.12272 12.6934 5.82219 13.0431Z",fill:"currentColor"})]}));Hc.displayName="ListOrderedIcon";const Fc=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 4.89543 2.89543 4 4 4H8C9.10457 4 10 4.89543 10 6V10C10 11.1046 9.10457 12 8 12H4C2.89543 12 2 11.1046 2 10V6ZM8 6H4V10H8V6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.70711 14.2929C10.0976 14.6834 10.0976 15.3166 9.70711 15.7071L5.70711 19.7071C5.31658 20.0976 4.68342 20.0976 4.29289 19.7071L2.29289 17.7071C1.90237 17.3166 1.90237 16.6834 2.29289 16.2929C2.68342 15.9024 3.31658 15.9024 3.70711 16.2929L5 17.5858L8.29289 14.2929C8.68342 13.9024 9.31658 13.9024 9.70711 14.2929Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 6C12 5.44772 12.4477 5 13 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H13C12.4477 7 12 6.55228 12 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 12C12 11.4477 12.4477 11 13 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H13C12.4477 13 12 12.5523 12 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18C12 17.4477 12.4477 17 13 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H13C12.4477 19 12 18.5523 12 18Z",fill:"currentColor"})]}));Fc.displayName="ListTodoIcon";const Rg={bulletList:ms,orderedList:Hc,taskList:Fc},j9={bulletList:"Bullet List",orderedList:"Ordered List",taskList:"Task List"},Og={bulletList:"mod+shift+8",orderedList:"mod+shift+7",taskList:"mod+shift+9"};function gs(t,e,n=!0){if(!t||!t.isEditable||!_t(e,t)||Ht(t,["image"]))return!1;if(!n)switch(e){case"bulletList":return t.can().toggleBulletList();case"orderedList":return t.can().toggleOrderedList();case"taskList":return t.can().toggleList("taskList","taskItem");default:return!1}try{const o=t.view.state,i=o.selection;if(i.empty||i instanceof V){const s=hn({editor:t,node:o.selection.$anchor.node(1)})?.pos;if(!yt(s))return!1}return!0}catch{return!1}}function $c(t,e){if(!t||!t.isEditable)return!1;switch(e){case"bulletList":return t.isActive("bulletList");case"orderedList":return t.isActive("orderedList");case"taskList":return t.isActive("taskList");default:return!1}}function B9(t,e){if(!t||!t.isEditable||!gs(t,e))return!1;try{const n=t.view;let r=n.state,o=r.tr;if(r.selection.empty||r.selection instanceof V){const l=hn({editor:t,node:r.selection.$anchor.node(1)})?.pos;if(!yt(l))return!1;o=o.setSelection(B.create(r.doc,l)),n.dispatch(o),r=n.state}const i=r.selection;let s=t.chain().focus();if(i instanceof B){const l=i.node.firstChild?.firstChild,a=i.node.lastChild?.lastChild,c=l?i.from+l.nodeSize:i.from+1,u=a?i.to-a.nodeSize:i.to-1;s=s.setTextSelection({from:c,to:u}).clearNodes()}if(t.isActive(e))s.liftListItem("listItem").lift("bulletList").lift("orderedList").lift("taskList").run();else{const a={bulletList:()=>s.toggleBulletList(),orderedList:()=>s.toggleOrderedList(),taskList:()=>s.toggleList("taskList","taskItem")}[e];if(!a)return!1;a().run()}return t.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function _9(t){const{editor:e,type:n,hideWhenUnavailable:r}=t;return!e||!e.isEditable||!_t(n,e)?!1:r&&!e.isActive("code")?gs(e,n):!0}function H9(t){const{editor:e,type:n,hideWhenUnavailable:r=!1,onToggled:o}=t,{editor:i}=ie(e),[s,l]=y.useState(!0),a=gs(i,n),c=$c(i,n);y.useEffect(()=>{if(!i)return;const d=()=>{l(_9({editor:i,type:n,hideWhenUnavailable:r}))};return d(),i.on("selectionUpdate",d),()=>{i.off("selectionUpdate",d)}},[i,n,r]);const u=y.useCallback(()=>{if(!i)return!1;const d=B9(i,n);return d&&o?.(),d},[i,n,o]);return{isVisible:s,isActive:c,handleToggle:u,canToggle:a,label:j9[n],shortcutKeys:Og[n],Icon:Rg[n]}}const F9=[{label:"Bullet List",type:"bulletList",icon:ms},{label:"Ordered List",type:"orderedList",icon:Hc},{label:"Task List",type:"taskList",icon:Fc}];function $9(t,e){return!t||!t.isEditable?!1:e.some(n=>gs(t,n))}function V9(t,e){return!t||!t.isEditable?!1:e.some(n=>$c(t,n))}function z9(t){return F9.filter(e=>!e.type||t.includes(e.type))}function U9(t){const{editor:e,hideWhenUnavailable:n,listInSchema:r,canToggleAny:o}=t;return!r||!e?!1:n&&!e.isActive("code")?o:!0}function W9(t,e){if(!(!t||!t.isEditable))return e.find(n=>$c(t,n))}function K9(t){const{editor:e,types:n=["bulletList","orderedList","taskList"],hideWhenUnavailable:r=!1}=t||{},{editor:o}=ie(e),[i,s]=y.useState(!1),l=n.some(h=>_t(h,o)),a=y.useMemo(()=>z9(n),[n]),c=$9(o,n),u=V9(o,n),d=W9(o,n),f=a.find(h=>h.type===d);return y.useEffect(()=>{if(!o)return;const h=()=>{s(U9({editor:o,hideWhenUnavailable:r,listInSchema:l,canToggleAny:c}))};return h(),o.on("selectionUpdate",h),()=>{o.off("selectionUpdate",h)}},[c,o,r,l,n]),{isVisible:i,activeType:d,isActive:u,canToggle:c,types:n,filteredLists:a,label:"List",Icon:f?Rg[f.type]:ms}}function Ng({editor:t,types:e=["bulletList","orderedList","taskList"],hideWhenUnavailable:n=!1,onOpenChange:r,portal:o=!1,...i}){const{editor:s}=ie(t),[l,a]=y.useState(!1),{filteredLists:c,canToggle:u,isActive:d,isVisible:f,Icon:h}=K9({editor:s,types:e,hideWhenUnavailable:n}),p=y.useCallback(m=>{a(m),r?.(m)},[r]);return!f||!s||!s.isEditable?null:g.jsxs(gg,{open:l,onOpenChange:p,children:[g.jsx(Ic,{asChild:!0,children:g.jsxs(fe,{type:"button","data-style":"ghost","data-active-state":d?"on":"off",role:"button",tabIndex:-1,disabled:!u,"data-disabled":!u,"aria-label":"List options",tooltip:"List",...i,children:[g.jsx(h,{className:"tiptap-button-icon"}),g.jsx(mc,{className:"tiptap-button-dropdown-small"})]})}),g.jsx(Lc,{align:"start",portal:o,children:g.jsx(fr,{children:g.jsx(lo,{children:g.jsx(In,{children:c.map(m=>g.jsx(vg,{asChild:!0,children:g.jsx(Ag,{editor:s,type:m.type,text:m.label,showTooltip:!1})},m.type))})})})})]})}function q9({shortcutKeys:t=Lg}){return g.jsx(vt,{children:gt({shortcutKeys:t})})}const Vc=y.forwardRef(({editor:t,text:e,hideWhenUnavailable:n=!1,onToggled:r,showShortcut:o=!1,onClick:i,children:s,...l},a)=>{const{editor:c}=ie(t),{isVisible:u,canToggle:d,isActive:f,handleToggle:h,label:p,shortcutKeys:m,Icon:v}=Z9({editor:c,hideWhenUnavailable:n,onToggled:r}),b=y.useCallback(C=>{i?.(C),!C.defaultPrevented&&h()},[h,i]);return u?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":f?"on":"off",role:"button",tabIndex:-1,disabled:!d,"data-disabled":!d,"aria-label":p,"aria-pressed":f,tooltip:"Blockquote",onClick:b,...l,ref:a,children:s??g.jsxs(g.Fragment,{children:[g.jsx(v,{className:"tiptap-button-icon"}),e&&g.jsx("span",{className:"tiptap-button-text",children:e}),o&&g.jsx(q9,{shortcutKeys:m})]})}):null});Vc.displayName="BlockquoteButton";const Ig=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 6C8 5.44772 8.44772 5 9 5H16C16.5523 5 17 5.44772 17 6C17 6.55228 16.5523 7 16 7H9C8.44772 7 8 6.55228 8 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 3C4.55228 3 5 3.44772 5 4L5 20C5 20.5523 4.55229 21 4 21C3.44772 21 3 20.5523 3 20L3 4C3 3.44772 3.44772 3 4 3Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 12C8 11.4477 8.44772 11 9 11H20C20.5523 11 21 11.4477 21 12C21 12.5523 20.5523 13 20 13H9C8.44772 13 8 12.5523 8 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 18C8 17.4477 8.44772 17 9 17H16C16.5523 17 17 17.4477 17 18C17 18.5523 16.5523 19 16 19H9C8.44772 19 8 18.5523 8 18Z",fill:"currentColor"})]}));Ig.displayName="BlockquoteIcon";const Lg="mod+shift+b";function zc(t,e=!0){if(!t||!t.isEditable||!_t("blockquote",t)||Ht(t,["image"]))return!1;if(!e)return t.can().toggleWrap("blockquote");try{const r=t.view.state,o=r.selection;if(o.empty||o instanceof V){const i=hn({editor:t,node:r.selection.$anchor.node(1)})?.pos;if(!yt(i))return!1}return!0}catch{return!1}}function G9(t){if(!t||!t.isEditable||!zc(t))return!1;try{const e=t.view;let n=e.state,r=n.tr;if(n.selection.empty||n.selection instanceof V){const l=hn({editor:t,node:n.selection.$anchor.node(1)})?.pos;if(!yt(l))return!1;r=r.setSelection(B.create(n.doc,l)),e.dispatch(r),n=e.state}const o=n.selection;let i=t.chain().focus();if(o instanceof B){const l=o.node.firstChild?.firstChild,a=o.node.lastChild?.lastChild,c=l?o.from+l.nodeSize:o.from+1,u=a?o.to-a.nodeSize:o.to-1;i=i.setTextSelection({from:c,to:u}).clearNodes()}return(t.isActive("blockquote")?i.lift("blockquote"):i.wrapIn("blockquote")).run(),t.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function J9(t){const{editor:e,hideWhenUnavailable:n}=t;return!e||!e.isEditable||!_t("blockquote",e)?!1:n&&!e.isActive("code")?zc(e):!0}function Z9(t){const{editor:e,hideWhenUnavailable:n=!1,onToggled:r}=t||{},{editor:o}=ie(e),[i,s]=y.useState(!0),l=zc(o),a=o?.isActive("blockquote")||!1;y.useEffect(()=>{if(!o)return;const u=()=>{s(J9({editor:o,hideWhenUnavailable:n}))};return u(),o.on("selectionUpdate",u),()=>{o.off("selectionUpdate",u)}},[o,n]);const c=y.useCallback(()=>{if(!o)return!1;const u=G9(o);return u&&r?.(),u},[o,r]);return{isVisible:i,isActive:a,handleToggle:c,canToggle:l,label:"Blockquote",shortcutKeys:Lg,Icon:Ig}}function Y9({shortcutKeys:t=Pg}){return g.jsx(vt,{children:gt({shortcutKeys:t})})}const Uc=y.forwardRef(({editor:t,text:e,hideWhenUnavailable:n=!1,onToggled:r,showShortcut:o=!1,onClick:i,children:s,...l},a)=>{const{editor:c}=ie(t),{isVisible:u,canToggle:d,isActive:f,handleToggle:h,label:p,shortcutKeys:m,Icon:v}=eE({editor:c,hideWhenUnavailable:n,onToggled:r}),b=y.useCallback(C=>{i?.(C),!C.defaultPrevented&&h()},[h,i]);return u?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":f?"on":"off",role:"button",disabled:!d,"data-disabled":!d,tabIndex:-1,"aria-label":p,"aria-pressed":f,tooltip:"Code Block",onClick:b,...l,ref:a,children:s??g.jsxs(g.Fragment,{children:[g.jsx(v,{className:"tiptap-button-icon"}),e&&g.jsx("span",{className:"tiptap-button-text",children:e}),o&&g.jsx(Y9,{shortcutKeys:m})]})}):null});Uc.displayName="CodeBlockButton";const Dg=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.70711 2.29289C7.09763 2.68342 7.09763 3.31658 6.70711 3.70711L4.41421 6L6.70711 8.29289C7.09763 8.68342 7.09763 9.31658 6.70711 9.70711C6.31658 10.0976 5.68342 10.0976 5.29289 9.70711L2.29289 6.70711C1.90237 6.31658 1.90237 5.68342 2.29289 5.29289L5.29289 2.29289C5.68342 1.90237 6.31658 1.90237 6.70711 2.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.2929 2.29289C10.6834 1.90237 11.3166 1.90237 11.7071 2.29289L14.7071 5.29289C15.0976 5.68342 15.0976 6.31658 14.7071 6.70711L11.7071 9.70711C11.3166 10.0976 10.6834 10.0976 10.2929 9.70711C9.90237 9.31658 9.90237 8.68342 10.2929 8.29289L12.5858 6L10.2929 3.70711C9.90237 3.31658 9.90237 2.68342 10.2929 2.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17 4C17 3.44772 17.4477 3 18 3H19C20.6569 3 22 4.34315 22 6V18C22 19.6569 20.6569 21 19 21H5C3.34315 21 2 19.6569 2 18V12C2 11.4477 2.44772 11 3 11C3.55228 11 4 11.4477 4 12V18C4 18.5523 4.44772 19 5 19H19C19.5523 19 20 18.5523 20 18V6C20 5.44772 19.5523 5 19 5H18C17.4477 5 17 4.55228 17 4Z",fill:"currentColor"})]}));Dg.displayName="CodeBlockIcon";const Pg="mod+alt+c";function Wc(t,e=!0){if(!t||!t.isEditable||!_t("codeBlock",t)||Ht(t,["image"]))return!1;if(!e)return t.can().toggleNode("codeBlock","paragraph");try{const r=t.view.state,o=r.selection;if(o.empty||o instanceof V){const i=hn({editor:t,node:r.selection.$anchor.node(1)})?.pos;if(!yt(i))return!1}return!0}catch{return!1}}function X9(t){if(!t||!t.isEditable||!Wc(t))return!1;try{const e=t.view;let n=e.state,r=n.tr;if(n.selection.empty||n.selection instanceof V){const l=hn({editor:t,node:n.selection.$anchor.node(1)})?.pos;if(!yt(l))return!1;r=r.setSelection(B.create(n.doc,l)),e.dispatch(r),n=e.state}const o=n.selection;let i=t.chain().focus();if(o instanceof B){const l=o.node.firstChild?.firstChild,a=o.node.lastChild?.lastChild,c=l?o.from+l.nodeSize:o.from+1,u=a?o.to-a.nodeSize:o.to-1;i=i.setTextSelection({from:c,to:u}).clearNodes()}return(t.isActive("codeBlock")?i.setNode("paragraph"):i.toggleNode("codeBlock","paragraph")).run(),t.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function Q9(t){const{editor:e,hideWhenUnavailable:n}=t;return!e||!e.isEditable||!_t("codeBlock",e)?!1:n&&!e.isActive("code")?Wc(e):!0}function eE(t){const{editor:e,hideWhenUnavailable:n=!1,onToggled:r}=t||{},{editor:o}=ie(e),[i,s]=y.useState(!0),l=Wc(o),a=o?.isActive("codeBlock")||!1;y.useEffect(()=>{if(!o)return;const u=()=>{s(Q9({editor:o,hideWhenUnavailable:n}))};return u(),o.on("selectionUpdate",u),()=>{o.off("selectionUpdate",u)}},[o,n]);const c=y.useCallback(()=>{if(!o)return!1;const u=X9(o);return u&&r?.(),u},[o,r]);return{isVisible:i,isActive:a,handleToggle:c,canToggle:l,label:"Code Block",shortcutKeys:Pg,Icon:Dg}}const jg=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.43471 4.01458C4.34773 4.06032 4.26607 4.11977 4.19292 4.19292C4.11977 4.26607 4.06032 4.34773 4.01458 4.43471C2.14611 6.40628 1 9.0693 1 12C1 18.0751 5.92487 23 12 23C14.9306 23 17.5936 21.854 19.5651 19.9856C19.6522 19.9398 19.7339 19.8803 19.8071 19.8071C19.8803 19.7339 19.9398 19.6522 19.9856 19.5651C21.854 17.5936 23 14.9306 23 12C23 5.92487 18.0751 1 12 1C9.0693 1 6.40628 2.14611 4.43471 4.01458ZM6.38231 4.9681C7.92199 3.73647 9.87499 3 12 3C16.9706 3 21 7.02944 21 12C21 14.125 20.2635 16.078 19.0319 17.6177L6.38231 4.9681ZM17.6177 19.0319C16.078 20.2635 14.125 21 12 21C7.02944 21 3 16.9706 3 12C3 9.87499 3.73647 7.92199 4.9681 6.38231L17.6177 19.0319Z",fill:"currentColor"})}));jg.displayName="BanIcon";const ys=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.7072 4.70711C15.0977 4.31658 15.0977 3.68342 14.7072 3.29289C14.3167 2.90237 13.6835 2.90237 13.293 3.29289L8.69294 7.89286L8.68594 7.9C8.13626 8.46079 7.82837 9.21474 7.82837 10C7.82837 10.2306 7.85491 10.4584 7.90631 10.6795L2.29289 16.2929C2.10536 16.4804 2 16.7348 2 17V20C2 20.5523 2.44772 21 3 21H12C12.2652 21 12.5196 20.8946 12.7071 20.7071L15.3205 18.0937C15.5416 18.1452 15.7695 18.1717 16.0001 18.1717C16.7853 18.1717 17.5393 17.8639 18.1001 17.3142L22.7072 12.7071C23.0977 12.3166 23.0977 11.6834 22.7072 11.2929C22.3167 10.9024 21.6835 10.9024 21.293 11.2929L16.6971 15.8887C16.5105 16.0702 16.2605 16.1717 16.0001 16.1717C15.7397 16.1717 15.4897 16.0702 15.303 15.8887L10.1113 10.697C9.92992 10.5104 9.82837 10.2604 9.82837 10C9.82837 9.73963 9.92992 9.48958 10.1113 9.30297L14.7072 4.70711ZM13.5858 17L9.00004 12.4142L4 17.4142V19H11.5858L13.5858 17Z",fill:"currentColor"})}));ys.displayName="HighlighterIcon";var vs="Popover",[Bg]=dr(vs,[us]),ao=us(),[tE,pn]=Bg(vs),_g=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!1}=t,l=ao(e),a=y.useRef(null),[c,u]=y.useState(!1),[d,f]=yc({prop:r,defaultProp:o??!1,onChange:i,caller:vs});return g.jsx(y1,{...l,children:g.jsx(tE,{scope:e,contentId:Pi(),triggerRef:a,open:d,onOpenChange:f,onOpenToggle:y.useCallback(()=>f(h=>!h),[f]),hasCustomAnchor:c,onCustomAnchorAdd:y.useCallback(()=>u(!0),[]),onCustomAnchorRemove:y.useCallback(()=>u(!1),[]),modal:s,children:n})})};_g.displayName=vs;var Hg="PopoverAnchor",nE=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=pn(Hg,n),i=ao(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:l}=o;return y.useEffect(()=>(s(),()=>l()),[s,l]),g.jsx(wc,{...i,...r,ref:e})});nE.displayName=Hg;var Fg="PopoverTrigger",$g=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=pn(Fg,n),i=ao(n),s=Oe(e,o.triggerRef),l=g.jsx(Te.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Kg(o.open),...r,ref:s,onClick:J(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?l:g.jsx(wc,{asChild:!0,...i,children:l})});$g.displayName=Fg;var Kc="PopoverPortal",[rE,oE]=Bg(Kc,{forceMount:void 0}),Vg=t=>{const{__scopePopover:e,forceMount:n,children:r,container:o}=t,i=pn(Kc,e);return g.jsx(rE,{scope:e,forceMount:n,children:g.jsx(Dn,{present:n||i.open,children:g.jsx(Sc,{asChild:!0,container:o,children:r})})})};Vg.displayName=Kc;var lr="PopoverContent",zg=y.forwardRef((t,e)=>{const n=oE(lr,t.__scopePopover),{forceMount:r=n.forceMount,...o}=t,i=pn(lr,t.__scopePopover);return g.jsx(Dn,{present:r||i.open,children:i.modal?g.jsx(sE,{...o,ref:e}):g.jsx(lE,{...o,ref:e})})});zg.displayName=lr;var iE=qr("PopoverContent.RemoveScroll"),sE=y.forwardRef((t,e)=>{const n=pn(lr,t.__scopePopover),r=y.useRef(null),o=Oe(e,r),i=y.useRef(!1);return y.useEffect(()=>{const s=r.current;if(s)return T1(s)},[]),g.jsx(kc,{as:iE,allowPinchZoom:!0,children:g.jsx(Ug,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:J(t.onCloseAutoFocus,s=>{s.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:J(t.onPointerDownOutside,s=>{const l=s.detail.originalEvent,a=l.button===0&&l.ctrlKey===!0,c=l.button===2||a;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:J(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),lE=y.forwardRef((t,e)=>{const n=pn(lr,t.__scopePopover),r=y.useRef(!1),o=y.useRef(!1);return g.jsx(Ug,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;n.triggerRef.current?.contains(s)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),Ug=y.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:c,onInteractOutside:u,...d}=t,f=pn(lr,n),h=ao(n);return i1(),g.jsx(bc,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:g.jsx(vc,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:c,onDismiss:()=>f.onOpenChange(!1),children:g.jsx(v1,{"data-state":Kg(f.open),role:"dialog",id:f.contentId,...h,...d,ref:e,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Wg="PopoverClose",aE=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=pn(Wg,n);return g.jsx(Te.button,{type:"button",...r,ref:e,onClick:J(t.onClick,()=>o.onOpenChange(!1))})});aE.displayName=Wg;var cE="PopoverArrow",uE=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=ao(n);return g.jsx(b1,{...o,...r,ref:e})});uE.displayName=cE;function Kg(t){return t?"open":"closed"}var dE=_g,fE=$g,hE=Vg,pE=zg;function qg({...t}){return g.jsx(dE,{...t})}function Gg({...t}){return g.jsx(fE,{...t})}function Jg({className:t,align:e="center",sideOffset:n=4,...r}){return g.jsx(hE,{children:g.jsx(pE,{align:e,sideOffset:n,className:Me("tiptap-popover",t),...r})})}function mE({shortcutKeys:t=ha}){return g.jsx(vt,{children:gt({shortcutKeys:t})})}const Zg=y.forwardRef(({editor:t,highlightColor:e,text:n,hideWhenUnavailable:r=!1,onApplied:o,showShortcut:i=!1,onClick:s,children:l,style:a,...c},u)=>{const{editor:d}=ie(t),{isVisible:f,canColorHighlight:h,isActive:p,handleColorHighlight:m,label:v,shortcutKeys:b}=Gc({editor:d,highlightColor:e,label:n||`Toggle highlight (${e})`,hideWhenUnavailable:r,onApplied:o}),C=y.useCallback(w=>{s?.(w),!w.defaultPrevented&&m()},[m,s]),x=y.useMemo(()=>({...a,"--highlight-color":e}),[e,a]);return f?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":p?"on":"off",role:"button",tabIndex:-1,disabled:!h,"data-disabled":!h,"aria-label":v,"aria-pressed":p,tooltip:v,onClick:C,style:x,...c,ref:u,children:l??g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"tiptap-button-highlight",style:{"--highlight-color":e}}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(mE,{shortcutKeys:b})]})}):null});Zg.displayName="ColorHighlightButton";const ha="mod+shift+h",gE=[{label:"Default background",value:"var(--tt-bg-color)",border:"var(--tt-bg-color-contrast)"},{label:"Gray background",value:"var(--tt-color-highlight-gray)",border:"var(--tt-color-highlight-gray-contrast)"},{label:"Brown background",value:"var(--tt-color-highlight-brown)",border:"var(--tt-color-highlight-brown-contrast)"},{label:"Orange background",value:"var(--tt-color-highlight-orange)",border:"var(--tt-color-highlight-orange-contrast)"},{label:"Yellow background",value:"var(--tt-color-highlight-yellow)",border:"var(--tt-color-highlight-yellow-contrast)"},{label:"Green background",value:"var(--tt-color-highlight-green)",border:"var(--tt-color-highlight-green-contrast)"},{label:"Blue background",value:"var(--tt-color-highlight-blue)",border:"var(--tt-color-highlight-blue-contrast)"},{label:"Purple background",value:"var(--tt-color-highlight-purple)",border:"var(--tt-color-highlight-purple-contrast)"},{label:"Pink background",value:"var(--tt-color-highlight-pink)",border:"var(--tt-color-highlight-pink-contrast)"},{label:"Red background",value:"var(--tt-color-highlight-red)",border:"var(--tt-color-highlight-red-contrast)"}];function Yg(t){const e=new Map(gE.map(n=>[n.value,n]));return t.map(n=>e.get(n)).filter(n=>!!n)}function qc(t){return!t||!t.isEditable||!ro("highlight",t)||Ht(t,["image"])?!1:t.can().setMark("highlight")}function yE(t,e){return!t||!t.isEditable?!1:e?t.isActive("highlight",{color:e}):t.isActive("highlight")}function vE(t){return!t||!t.isEditable||!qc(t)?!1:t.chain().focus().unsetMark("highlight").run()}function bE(t){const{editor:e,hideWhenUnavailable:n}=t;return!e||!e.isEditable||!ro("highlight",e)?!1:n&&!e.isActive("code")?qc(e):!0}function Gc(t){const{editor:e,label:n,highlightColor:r,hideWhenUnavailable:o=!1,onApplied:i}=t,{editor:s}=ie(e),l=hr(),[a,c]=y.useState(!0),u=qc(s),d=yE(s,r);y.useEffect(()=>{if(!s)return;const p=()=>{c(bE({editor:s,hideWhenUnavailable:o}))};return p(),s.on("selectionUpdate",p),()=>{s.off("selectionUpdate",p)}},[s,o]);const f=y.useCallback(()=>{if(!s||!u||!r||!n)return!1;if(s.state.storedMarks){const p=s.schema.marks.highlight;p&&s.view.dispatch(s.state.tr.removeStoredMark(p))}setTimeout(()=>{const p=s.chain().focus().toggleMark("highlight",{color:r}).run();return p&&i?.({color:r,label:n}),p},0)},[u,r,s,n,i]),h=y.useCallback(()=>{const p=vE(s);return p&&i?.({color:"",label:"Remove highlight"}),p},[s,i]);return Mg(ha,p=>{p.preventDefault(),f()},{enabled:a&&u,enableOnContentEditable:!l,enableOnFormTags:!0}),{isVisible:a,isActive:d,handleColorHighlight:f,handleRemoveHighlight:h,canColorHighlight:u,label:n||"Highlight",shortcutKeys:ha,Icon:ys}}const Jc=y.forwardRef(({className:t,children:e,...n},r)=>g.jsx(fe,{type:"button",className:t,"data-style":"ghost","data-appearance":"default",role:"button",tabIndex:-1,"aria-label":"Highlight text",tooltip:"Highlight",ref:r,...n,children:e??g.jsx(ys,{className:"tiptap-button-icon"})}));Jc.displayName="ColorHighlightPopoverButton";function Xg({editor:t,colors:e=Yg(["var(--tt-color-highlight-green)","var(--tt-color-highlight-blue)","var(--tt-color-highlight-red)","var(--tt-color-highlight-purple)","var(--tt-color-highlight-yellow)"])}){const{handleRemoveHighlight:n}=Gc({editor:t}),r=hr(),o=y.useRef(null),i=y.useMemo(()=>[...e,{label:"Remove highlight",value:"none"}],[e]),{selectedIndex:s}=$m({containerRef:o,items:i,orientation:"both",onSelect:l=>{if(!o.current)return!1;const a=o.current.querySelector('[data-highlighted="true"]');a&&a.click(),l.value==="none"&&n()},autoSelectFirstItem:!1});return g.jsx(fr,{ref:o,tabIndex:0,style:r?{boxShadow:"none",border:0}:{},children:g.jsx(lo,{style:r?{padding:0}:{},children:g.jsxs(Dc,{orientation:"horizontal",children:[g.jsx(In,{orientation:"horizontal",children:e.map((l,a)=>g.jsx(Zg,{editor:t,highlightColor:l.value,tooltip:l.label,"aria-label":`${l.label} highlight color`,tabIndex:a===s?0:-1,"data-highlighted":s===a},l.value))}),g.jsx(as,{}),g.jsx(In,{orientation:"horizontal",children:g.jsx(fe,{onClick:n,"aria-label":"Remove highlight",tooltip:"Remove highlight",tabIndex:s===e.length?0:-1,type:"button",role:"menuitem","data-style":"ghost","data-highlighted":s===e.length,children:g.jsx(jg,{className:"tiptap-button-icon"})})})]})})})}function CE({editor:t,colors:e=Yg(["var(--tt-color-highlight-green)","var(--tt-color-highlight-blue)","var(--tt-color-highlight-red)","var(--tt-color-highlight-purple)","var(--tt-color-highlight-yellow)"]),hideWhenUnavailable:n=!1,onApplied:r,...o}){const{editor:i}=ie(t),[s,l]=y.useState(!1),{isVisible:a,canColorHighlight:c,isActive:u,label:d,Icon:f}=Gc({editor:i,hideWhenUnavailable:n,onApplied:r});return a?g.jsxs(qg,{open:s,onOpenChange:l,children:[g.jsx(Gg,{asChild:!0,children:g.jsx(Jc,{disabled:!c,"data-active-state":u?"on":"off","data-disabled":!c,"aria-pressed":u,"aria-label":d,tooltip:d,...o,children:g.jsx(f,{className:"tiptap-button-icon"})})}),g.jsx(Jg,{"aria-label":"Highlight colors",children:g.jsx(Xg,{editor:i,colors:e})})]}):null}const Qg=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M21 4C21 3.44772 20.5523 3 20 3C19.4477 3 19 3.44772 19 4V11C19 11.7956 18.6839 12.5587 18.1213 13.1213C17.5587 13.6839 16.7956 14 16 14H6.41421L9.70711 10.7071C10.0976 10.3166 10.0976 9.68342 9.70711 9.29289C9.31658 8.90237 8.68342 8.90237 8.29289 9.29289L3.29289 14.2929C2.90237 14.6834 2.90237 15.3166 3.29289 15.7071L8.29289 20.7071C8.68342 21.0976 9.31658 21.0976 9.70711 20.7071C10.0976 20.3166 10.0976 19.6834 9.70711 19.2929L6.41421 16H16C17.3261 16 18.5979 15.4732 19.5355 14.5355C20.4732 13.5979 21 12.3261 21 11V4Z",fill:"currentColor"})}));Qg.displayName="CornerDownLeftIcon";const e0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M14 3C14 2.44772 14.4477 2 15 2H21C21.5523 2 22 2.44772 22 3V9C22 9.55228 21.5523 10 21 10C20.4477 10 20 9.55228 20 9V5.41421L10.7071 14.7071C10.3166 15.0976 9.68342 15.0976 9.29289 14.7071C8.90237 14.3166 8.90237 13.6834 9.29289 13.2929L18.5858 4H15C14.4477 4 14 3.55228 14 3Z",fill:"currentColor"}),g.jsx("path",{d:"M4.29289 7.29289C4.48043 7.10536 4.73478 7 5 7H11C11.5523 7 12 6.55228 12 6C12 5.44772 11.5523 5 11 5H5C4.20435 5 3.44129 5.31607 2.87868 5.87868C2.31607 6.44129 2 7.20435 2 8V19C2 19.7957 2.31607 20.5587 2.87868 21.1213C3.44129 21.6839 4.20435 22 5 22H16C16.7957 22 17.5587 21.6839 18.1213 21.1213C18.6839 20.5587 19 19.7957 19 19V13C19 12.4477 18.5523 12 18 12C17.4477 12 17 12.4477 17 13V19C17 19.2652 16.8946 19.5196 16.7071 19.7071C16.5196 19.8946 16.2652 20 16 20H5C4.73478 20 4.48043 19.8946 4.29289 19.7071C4.10536 19.5196 4 19.2652 4 19V8C4 7.73478 4.10536 7.48043 4.29289 7.29289Z",fill:"currentColor"})]}));e0.displayName="ExternalLinkIcon";const bs=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M16.9958 1.06669C15.4226 1.05302 13.907 1.65779 12.7753 2.75074L12.765 2.76086L11.045 4.47086C10.6534 4.86024 10.6515 5.49341 11.0409 5.88507C11.4303 6.27673 12.0634 6.27858 12.4551 5.88919L14.1697 4.18456C14.9236 3.45893 15.9319 3.05752 16.9784 3.06662C18.0272 3.07573 19.0304 3.49641 19.772 4.23804C20.5137 4.97967 20.9344 5.98292 20.9435 7.03171C20.9526 8.07776 20.5515 9.08563 19.8265 9.83941L16.833 12.8329C16.4274 13.2386 15.9393 13.5524 15.4019 13.7529C14.8645 13.9533 14.2903 14.0359 13.7181 13.9949C13.146 13.9539 12.5894 13.7904 12.0861 13.5154C11.5827 13.2404 11.1444 12.8604 10.8008 12.401C10.47 11.9588 9.84333 11.8685 9.40108 12.1993C8.95883 12.5301 8.86849 13.1568 9.1993 13.599C9.71464 14.288 10.3721 14.858 11.1272 15.2705C11.8822 15.683 12.7171 15.9283 13.5753 15.9898C14.4334 16.0513 15.2948 15.9274 16.1009 15.6267C16.907 15.326 17.639 14.8555 18.2473 14.247L21.2472 11.2471L21.2593 11.2347C22.3523 10.1031 22.9571 8.58751 22.9434 7.01433C22.9297 5.44115 22.2987 3.93628 21.1863 2.82383C20.0738 1.71138 18.5689 1.08036 16.9958 1.06669Z",fill:"currentColor"}),g.jsx("path",{d:"M10.4247 8.0102C9.56657 7.94874 8.70522 8.07256 7.89911 8.37326C7.09305 8.67395 6.36096 9.14458 5.75272 9.753L2.75285 12.7529L2.74067 12.7653C1.64772 13.8969 1.04295 15.4125 1.05662 16.9857C1.07029 18.5589 1.70131 20.0637 2.81376 21.1762C3.9262 22.2886 5.43108 22.9196 7.00426 22.9333C8.57744 22.947 10.0931 22.3422 11.2247 21.2493L11.2371 21.2371L12.9471 19.5271C13.3376 19.1366 13.3376 18.5034 12.9471 18.1129C12.5565 17.7223 11.9234 17.7223 11.5328 18.1129L9.82932 19.8164C9.07555 20.5414 8.06768 20.9425 7.02164 20.9334C5.97285 20.9243 4.9696 20.5036 4.22797 19.762C3.48634 19.0203 3.06566 18.0171 3.05655 16.9683C3.04746 15.9222 3.44851 14.9144 4.17355 14.1606L7.16719 11.167C7.5727 10.7613 8.06071 10.4476 8.59811 10.2471C9.13552 10.0467 9.70976 9.96412 10.2819 10.0051C10.854 10.0461 11.4106 10.2096 11.9139 10.4846C12.4173 10.7596 12.8556 11.1397 13.1992 11.599C13.53 12.0412 14.1567 12.1316 14.5989 11.8007C15.0412 11.4699 15.1315 10.8433 14.8007 10.401C14.2854 9.71205 13.6279 9.14198 12.8729 8.72948C12.1178 8.31697 11.2829 8.07166 10.4247 8.0102Z",fill:"currentColor"})]}));bs.displayName="LinkIcon";const t0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 5V4C7 3.17477 7.40255 2.43324 7.91789 1.91789C8.43324 1.40255 9.17477 1 10 1H14C14.8252 1 15.5668 1.40255 16.0821 1.91789C16.5975 2.43324 17 3.17477 17 4V5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H20V20C20 20.8252 19.5975 21.5668 19.0821 22.0821C18.5668 22.5975 17.8252 23 17 23H7C6.17477 23 5.43324 22.5975 4.91789 22.0821C4.40255 21.5668 4 20.8252 4 20V7H3C2.44772 7 2 6.55228 2 6C2 5.44772 2.44772 5 3 5H7ZM9 4C9 3.82523 9.09745 3.56676 9.33211 3.33211C9.56676 3.09745 9.82523 3 10 3H14C14.1748 3 14.4332 3.09745 14.6679 3.33211C14.9025 3.56676 15 3.82523 15 4V5H9V4ZM6 7V20C6 20.1748 6.09745 20.4332 6.33211 20.6679C6.56676 20.9025 6.82523 21 7 21H17C17.1748 21 17.4332 20.9025 17.6679 20.6679C17.9025 20.4332 18 20.1748 18 20V7H6Z",fill:"currentColor"})}));t0.displayName="TrashIcon";function xE({className:t,type:e,...n}){return g.jsx("input",{type:e,className:Me("tiptap-input",t),...n})}function wE({className:t,children:e,...n}){return g.jsx("div",{className:Me("tiptap-input-group",t),...n,children:e})}const Zc=y.forwardRef(({className:t,children:e,...n},r)=>g.jsx(fe,{type:"button",className:t,"data-style":"ghost",role:"button",tabIndex:-1,"aria-label":"Link",tooltip:"Link",ref:r,...n,children:e||g.jsx(bs,{className:"tiptap-button-icon"})}));Zc.displayName="LinkButton";const n0=({url:t,setUrl:e,setLink:n,removeLink:r,openLink:o,isActive:i})=>{const s=hr(),l=a=>{a.key==="Enter"&&(a.preventDefault(),n())};return g.jsx(fr,{style:{...s?{boxShadow:"none",border:0}:{}},children:g.jsx(lo,{style:{...s?{padding:0}:{}},children:g.jsxs(Dc,{orientation:"horizontal",children:[g.jsx(wE,{children:g.jsx(xE,{type:"url",placeholder:"Paste a link...",value:t,onChange:a=>e(a.target.value),onKeyDown:l,autoFocus:!0,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off"})}),g.jsx(In,{orientation:"horizontal",children:g.jsx(fe,{type:"button",onClick:n,title:"Apply link",disabled:!t&&!i,"data-style":"ghost",children:g.jsx(Qg,{className:"tiptap-button-icon"})})}),g.jsx(as,{}),g.jsxs(In,{orientation:"horizontal",children:[g.jsx(fe,{type:"button",onClick:o,title:"Open in new window",disabled:!t&&!i,"data-style":"ghost",children:g.jsx(e0,{className:"tiptap-button-icon"})}),g.jsx(fe,{type:"button",onClick:r,title:"Remove link",disabled:!t&&!i,"data-style":"ghost",children:g.jsx(t0,{className:"tiptap-button-icon"})})]})]})})})},SE=({editor:t})=>{const e=s0({editor:t});return g.jsx(n0,{...e})},r0=y.forwardRef(({editor:t,hideWhenUnavailable:e=!1,onSetLink:n,onOpenChange:r,autoOpenOnLinkActive:o=!0,onClick:i,children:s,...l},a)=>{const{editor:c}=ie(t),[u,d]=y.useState(!1),{isVisible:f,canSet:h,isActive:p,url:m,setUrl:v,setLink:b,removeLink:C,openLink:x,label:w,Icon:E}=s0({editor:c,hideWhenUnavailable:e,onSetLink:n}),k=y.useCallback(N=>{d(N),r?.(N)},[r]),S=y.useCallback(()=>{b(),d(!1)},[b]),M=y.useCallback(N=>{i?.(N),!N.defaultPrevented&&d(!u)},[i,u]);return y.useEffect(()=>{o&&p&&d(!0)},[o,p]),f?g.jsxs(qg,{open:u,onOpenChange:k,children:[g.jsx(Gg,{asChild:!0,children:g.jsx(Zc,{disabled:!h,"data-active-state":p?"on":"off","data-disabled":!h,"aria-label":w,"aria-pressed":p,onClick:M,...l,ref:a,children:s??g.jsx(E,{className:"tiptap-button-icon"})})}),g.jsx(Jg,{children:g.jsx(n0,{url:m,setUrl:v,setLink:S,removeLink:C,openLink:x,isActive:p})})]}):null});r0.displayName="LinkPopover";function o0(t){return!t||!t.isEditable?!1:t.can().setMark("link")}function i0(t){return!t||!t.isEditable?!1:t.isActive("link")}function kE(t){const{editor:e,hideWhenUnavailable:n}=t;return!ro("link",e)||!e?!1:n&&!e.isActive("code")?o0(e):!0}function EE(t){const{editor:e,onSetLink:n}=t,[r,o]=y.useState(null);y.useEffect(()=>{if(!e)return;const{href:a}=e.getAttributes("link");i0(e)&&r===null&&o(a||"")},[e,r]),y.useEffect(()=>{if(!e)return;const a=()=>{const{href:c}=e.getAttributes("link");o(c||"")};return e.on("selectionUpdate",a),()=>{e.off("selectionUpdate",a)}},[e]);const i=y.useCallback(()=>{if(!r||!e)return;const{selection:a}=e.state,c=a.empty;let u=e.chain().focus();u=u.extendMarkRange("link").setLink({href:r}),c&&(u=u.insertContent({type:"text",text:r})),u.run(),o(null),n?.()},[e,n,r]),s=y.useCallback(()=>{e&&(e.chain().focus().extendMarkRange("link").unsetLink().setMeta("preventAutolink",!0).run(),o(""))},[e]),l=y.useCallback((a="_blank",c="noopener,noreferrer")=>{if(!r)return;const u=K5(r,window.location.href);u!=="#"&&window.open(u,a,c)},[r]);return{url:r||"",setUrl:o,setLink:i,removeLink:s,openLink:l}}function ME(t){const{editor:e,hideWhenUnavailable:n=!1}=t,r=o0(e),o=i0(e),[i,s]=y.useState(!1);return y.useEffect(()=>{if(!e)return;const l=()=>{s(kE({editor:e,hideWhenUnavailable:n}))};return l(),e.on("selectionUpdate",l),()=>{e.off("selectionUpdate",l)}},[e,n]),{isVisible:i,canSet:r,isActive:o}}function s0(t){const{editor:e,hideWhenUnavailable:n=!1,onSetLink:r}=t||{},{editor:o}=ie(e),{isVisible:i,canSet:s,isActive:l}=ME({editor:o,hideWhenUnavailable:n}),a=EE({editor:o,onSetLink:r});return{isVisible:i,canSet:s,isActive:l,label:"Link",Icon:bs,...a}}function TE({type:t,shortcutKeys:e=p0[t]}){return g.jsx(vt,{children:gt({shortcutKeys:e})})}const Et=y.forwardRef(({editor:t,type:e,text:n,hideWhenUnavailable:r=!1,onToggled:o,showShortcut:i=!1,onClick:s,children:l,...a},c)=>{const{editor:u}=ie(t),{isVisible:d,handleMark:f,label:h,canToggle:p,isActive:m,Icon:v,shortcutKeys:b}=LE({editor:u,type:e,hideWhenUnavailable:r,onToggled:o}),C=y.useCallback(x=>{s?.(x),!x.defaultPrevented&&f()},[f,s]);return d?g.jsx(fe,{type:"button",disabled:!p,"data-style":"ghost","data-active-state":m?"on":"off","data-disabled":!p,role:"button",tabIndex:-1,"aria-label":h,"aria-pressed":m,tooltip:h,onClick:C,...a,ref:c,children:l??g.jsxs(g.Fragment,{children:[g.jsx(v,{className:"tiptap-button-icon"}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(TE,{type:e,shortcutKeys:b})]})}):null});Et.displayName="MarkButton";const l0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 2.5C5.17157 2.5 4.5 3.17157 4.5 4V20C4.5 20.8284 5.17157 21.5 6 21.5H15C16.4587 21.5 17.8576 20.9205 18.8891 19.8891C19.9205 18.8576 20.5 17.4587 20.5 16C20.5 14.5413 19.9205 13.1424 18.8891 12.1109C18.6781 11.9 18.4518 11.7079 18.2128 11.5359C19.041 10.5492 19.5 9.29829 19.5 8C19.5 6.54131 18.9205 5.14236 17.8891 4.11091C16.8576 3.07946 15.4587 2.5 14 2.5H6ZM14 10.5C14.663 10.5 15.2989 10.2366 15.7678 9.76777C16.2366 9.29893 16.5 8.66304 16.5 8C16.5 7.33696 16.2366 6.70107 15.7678 6.23223C15.2989 5.76339 14.663 5.5 14 5.5H7.5V10.5H14ZM7.5 18.5V13.5H15C15.663 13.5 16.2989 13.7634 16.7678 14.2322C17.2366 14.7011 17.5 15.337 17.5 16C17.5 16.663 17.2366 17.2989 16.7678 17.7678C16.2989 18.2366 15.663 18.5 15 18.5H7.5Z",fill:"currentColor"})}));l0.displayName="BoldIcon";const a0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M15.4545 4.2983C15.6192 3.77115 15.3254 3.21028 14.7983 3.04554C14.2712 2.88081 13.7103 3.1746 13.5455 3.70175L8.54554 19.7017C8.38081 20.2289 8.6746 20.7898 9.20175 20.9545C9.72889 21.1192 10.2898 20.8254 10.4545 20.2983L15.4545 4.2983Z",fill:"currentColor"}),g.jsx("path",{d:"M6.70711 7.29289C7.09763 7.68342 7.09763 8.31658 6.70711 8.70711L3.41421 12L6.70711 15.2929C7.09763 15.6834 7.09763 16.3166 6.70711 16.7071C6.31658 17.0976 5.68342 17.0976 5.29289 16.7071L1.29289 12.7071C0.902369 12.3166 0.902369 11.6834 1.29289 11.2929L5.29289 7.29289C5.68342 6.90237 6.31658 6.90237 6.70711 7.29289Z",fill:"currentColor"}),g.jsx("path",{d:"M17.2929 7.29289C17.6834 6.90237 18.3166 6.90237 18.7071 7.29289L22.7071 11.2929C23.0976 11.6834 23.0976 12.3166 22.7071 12.7071L18.7071 16.7071C18.3166 17.0976 17.6834 17.0976 17.2929 16.7071C16.9024 16.3166 16.9024 15.6834 17.2929 15.2929L20.5858 12L17.2929 8.70711C16.9024 8.31658 16.9024 7.68342 17.2929 7.29289Z",fill:"currentColor"})]}));a0.displayName="Code2Icon";const c0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{d:"M15.0222 3H19C19.5523 3 20 3.44772 20 4C20 4.55228 19.5523 5 19 5H15.693L10.443 19H14C14.5523 19 15 19.4477 15 20C15 20.5523 14.5523 21 14 21H9.02418C9.00802 21.0004 8.99181 21.0004 8.97557 21H5C4.44772 21 4 20.5523 4 20C4 19.4477 4.44772 19 5 19H8.30704L13.557 5H10C9.44772 5 9 4.55228 9 4C9 3.44772 9.44772 3 10 3H14.9782C14.9928 2.99968 15.0075 2.99967 15.0222 3Z",fill:"currentColor"})}));c0.displayName="ItalicIcon";const u0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M9.00039 3H16.0001C16.5524 3 17.0001 3.44772 17.0001 4C17.0001 4.55229 16.5524 5 16.0001 5H9.00011C8.68006 4.99983 8.36412 5.07648 8.07983 5.22349C7.79555 5.37051 7.55069 5.5836 7.36585 5.84487C7.181 6.10614 7.06155 6.40796 7.01754 6.72497C6.97352 7.04198 7.00623 7.36492 7.11292 7.66667C7.29701 8.18737 7.02414 8.75872 6.50344 8.94281C5.98274 9.1269 5.4114 8.85403 5.2273 8.33333C5.01393 7.72984 4.94851 7.08396 5.03654 6.44994C5.12456 5.81592 5.36346 5.21229 5.73316 4.68974C6.10285 4.1672 6.59256 3.74101 7.16113 3.44698C7.72955 3.15303 8.36047 2.99975 9.00039 3Z",fill:"currentColor"}),g.jsx("path",{d:"M18 13H20C20.5523 13 21 12.5523 21 12C21 11.4477 20.5523 11 20 11H4C3.44772 11 3 11.4477 3 12C3 12.5523 3.44772 13 4 13H14C14.7956 13 15.5587 13.3161 16.1213 13.8787C16.6839 14.4413 17 15.2044 17 16C17 16.7956 16.6839 17.5587 16.1213 18.1213C15.5587 18.6839 14.7956 19 14 19H6C5.44772 19 5 19.4477 5 20C5 20.5523 5.44772 21 6 21H14C15.3261 21 16.5979 20.4732 17.5355 19.5355C18.4732 18.5979 19 17.3261 19 16C19 14.9119 18.6453 13.8604 18 13Z",fill:"currentColor"})]}));u0.displayName="StrikeIcon";const d0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.29289 7.29289C3.68342 6.90237 4.31658 6.90237 4.70711 7.29289L12.7071 15.2929C13.0976 15.6834 13.0976 16.3166 12.7071 16.7071C12.3166 17.0976 11.6834 17.0976 11.2929 16.7071L3.29289 8.70711C2.90237 8.31658 2.90237 7.68342 3.29289 7.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.7071 7.29289C13.0976 7.68342 13.0976 8.31658 12.7071 8.70711L4.70711 16.7071C4.31658 17.0976 3.68342 17.0976 3.29289 16.7071C2.90237 16.3166 2.90237 15.6834 3.29289 15.2929L11.2929 7.29289C11.6834 6.90237 12.3166 6.90237 12.7071 7.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.4079 14.3995C18.0284 14.0487 18.7506 13.9217 19.4536 14.0397C20.1566 14.1578 20.7977 14.5138 21.2696 15.0481L21.2779 15.0574L21.2778 15.0575C21.7439 15.5988 22 16.2903 22 17C22 18.0823 21.3962 18.8401 20.7744 19.3404C20.194 19.8073 19.4858 20.141 18.9828 20.378C18.9638 20.387 18.9451 20.3958 18.9266 20.4045C18.4473 20.6306 18.2804 20.7817 18.1922 20.918C18.1773 20.9412 18.1619 20.9681 18.1467 21H21C21.5523 21 22 21.4477 22 22C22 22.5523 21.5523 23 21 23H17C16.4477 23 16 22.5523 16 22C16 21.1708 16.1176 20.4431 16.5128 19.832C16.9096 19.2184 17.4928 18.8695 18.0734 18.5956C18.6279 18.334 19.138 18.0901 19.5207 17.7821C19.8838 17.49 20 17.2477 20 17C20 16.7718 19.9176 16.5452 19.7663 16.3672C19.5983 16.1792 19.3712 16.0539 19.1224 16.0121C18.8722 15.9701 18.6152 16.015 18.3942 16.1394C18.1794 16.2628 18.0205 16.4549 17.9422 16.675C17.7572 17.1954 17.1854 17.4673 16.665 17.2822C16.1446 17.0972 15.8728 16.5254 16.0578 16.005C16.2993 15.3259 16.7797 14.7584 17.4039 14.4018L17.4079 14.3995L17.4079 14.3995Z",fill:"currentColor"})]}));d0.displayName="SubscriptIcon";const f0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.7071 7.29289C13.0976 7.68342 13.0976 8.31658 12.7071 8.70711L4.70711 16.7071C4.31658 17.0976 3.68342 17.0976 3.29289 16.7071C2.90237 16.3166 2.90237 15.6834 3.29289 15.2929L11.2929 7.29289C11.6834 6.90237 12.3166 6.90237 12.7071 7.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.29289 7.29289C3.68342 6.90237 4.31658 6.90237 4.70711 7.29289L12.7071 15.2929C13.0976 15.6834 13.0976 16.3166 12.7071 16.7071C12.3166 17.0976 11.6834 17.0976 11.2929 16.7071L3.29289 8.70711C2.90237 8.31658 2.90237 7.68342 3.29289 7.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.405 1.40657C18.0246 1.05456 18.7463 0.92634 19.4492 1.04344C20.1521 1.16054 20.7933 1.51583 21.2652 2.0497L21.2697 2.05469L21.2696 2.05471C21.7431 2.5975 22 3.28922 22 4.00203C22 5.08579 21.3952 5.84326 20.7727 6.34289C20.1966 6.80531 19.4941 7.13675 18.9941 7.37261C18.9714 7.38332 18.9491 7.39383 18.9273 7.40415C18.4487 7.63034 18.2814 7.78152 18.1927 7.91844C18.1778 7.94155 18.1625 7.96834 18.1473 8.00003H21C21.5523 8.00003 22 8.44774 22 9.00003C22 9.55231 21.5523 10 21 10H17C16.4477 10 16 9.55231 16 9.00003C16 8.17007 16.1183 7.44255 16.5138 6.83161C16.9107 6.21854 17.4934 5.86971 18.0728 5.59591C18.6281 5.33347 19.1376 5.09075 19.5208 4.78316C19.8838 4.49179 20 4.25026 20 4.00203C20 3.77192 19.9178 3.54865 19.7646 3.37182C19.5968 3.18324 19.3696 3.05774 19.1205 3.01625C18.8705 2.97459 18.6137 3.02017 18.3933 3.14533C18.1762 3.26898 18.0191 3.45826 17.9406 3.67557C17.7531 4.19504 17.18 4.46414 16.6605 4.27662C16.141 4.0891 15.8719 3.51596 16.0594 2.99649C16.303 2.3219 16.7817 1.76125 17.4045 1.40689L17.405 1.40657Z",fill:"currentColor"})]}));f0.displayName="SuperscriptIcon";const h0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 4C7 3.44772 6.55228 3 6 3C5.44772 3 5 3.44772 5 4V10C5 11.8565 5.7375 13.637 7.05025 14.9497C8.36301 16.2625 10.1435 17 12 17C13.8565 17 15.637 16.2625 16.9497 14.9497C18.2625 13.637 19 11.8565 19 10V4C19 3.44772 18.5523 3 18 3C17.4477 3 17 3.44772 17 4V10C17 11.3261 16.4732 12.5979 15.5355 13.5355C14.5979 14.4732 13.3261 15 12 15C10.6739 15 9.40215 14.4732 8.46447 13.5355C7.52678 12.5979 7 11.3261 7 10V4ZM4 19C3.44772 19 3 19.4477 3 20C3 20.5523 3.44772 21 4 21H20C20.5523 21 21 20.5523 21 20C21 19.4477 20.5523 19 20 19H4Z",fill:"currentColor"})}));h0.displayName="UnderlineIcon";const AE={bold:l0,italic:c0,underline:h0,strike:u0,code:a0,superscript:f0,subscript:d0},p0={bold:"mod+b",italic:"mod+i",underline:"mod+u",strike:"mod+shift+s",code:"mod+e",superscript:"mod+.",subscript:"mod+,"};function Yc(t,e){return!t||!t.isEditable||!ro(e,t)||Ht(t,["image"])?!1:t.can().toggleMark(e)}function RE(t,e){return!t||!t.isEditable?!1:t.isActive(e)}function OE(t,e){return!t||!t.isEditable||!Yc(t,e)?!1:t.chain().focus().toggleMark(e).run()}function NE(t){const{editor:e,type:n,hideWhenUnavailable:r}=t;return!e||!e.isEditable||!ro(n,e)?!1:r&&!e.isActive("code")?Yc(e,n):!0}function IE(t){return t.charAt(0).toUpperCase()+t.slice(1)}function LE(t){const{editor:e,type:n,hideWhenUnavailable:r=!1,onToggled:o}=t,{editor:i}=ie(e),[s,l]=y.useState(!0),a=Yc(i,n),c=RE(i,n);y.useEffect(()=>{if(!i)return;const d=()=>{l(NE({editor:i,type:n,hideWhenUnavailable:r}))};return d(),i.on("selectionUpdate",d),()=>{i.off("selectionUpdate",d)}},[i,n,r]);const u=y.useCallback(()=>{if(!i)return!1;const d=OE(i,n);return d&&o?.(),d},[i,n,o]);return{isVisible:s,isActive:c,handleMark:u,canToggle:a,label:IE(n),shortcutKeys:p0[n],Icon:AE[n]}}function DE({align:t,shortcutKeys:e=b0[t]}){return g.jsx(vt,{children:gt({shortcutKeys:e})})}const Zn=y.forwardRef(({editor:t,align:e,text:n,hideWhenUnavailable:r=!1,onAligned:o,showShortcut:i=!1,onClick:s,icon:l,children:a,...c},u)=>{const{editor:d}=ie(t),{isVisible:f,handleTextAlign:h,label:p,canAlign:m,isActive:v,Icon:b,shortcutKeys:C}=$E({editor:d,align:e,hideWhenUnavailable:r,onAligned:o}),x=y.useCallback(E=>{s?.(E),!E.defaultPrevented&&h()},[h,s]);if(!f)return null;const w=l??b;return g.jsx(fe,{type:"button",disabled:!m,"data-style":"ghost","data-active-state":v?"on":"off","data-disabled":!m,role:"button",tabIndex:-1,"aria-label":p,"aria-pressed":v,tooltip:p,onClick:x,...c,ref:u,children:a??g.jsxs(g.Fragment,{children:[g.jsx(w,{className:"tiptap-button-icon"}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(DE,{align:e,shortcutKeys:C})]})})});Zn.displayName="TextAlignButton";const m0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 12C6 11.4477 6.44772 11 7 11H17C17.5523 11 18 11.4477 18 12C18 12.5523 17.5523 13 17 13H7C6.44772 13 6 12.5523 6 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 18C4 17.4477 4.44772 17 5 17H19C19.5523 17 20 17.4477 20 18C20 18.5523 19.5523 19 19 19H5C4.44772 19 4 18.5523 4 18Z",fill:"currentColor"})]}));m0.displayName="AlignCenterIcon";const g0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]}));g0.displayName="AlignJustifyIcon";const y0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H15C15.5523 11 16 11.4477 16 12C16 12.5523 15.5523 13 15 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H17C17.5523 17 18 17.4477 18 18C18 18.5523 17.5523 19 17 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]}));y0.displayName="AlignLeftIcon";const v0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 12C8 11.4477 8.44772 11 9 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H9C8.44772 13 8 12.5523 8 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 18C6 17.4477 6.44772 17 7 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H7C6.44772 19 6 18.5523 6 18Z",fill:"currentColor"})]}));v0.displayName="AlignRightIcon";const b0={left:"mod+shift+l",center:"mod+shift+e",right:"mod+shift+r",justify:"mod+shift+j"},PE={left:y0,center:m0,right:v0,justify:g0},jE={left:"Align left",center:"Align center",right:"Align right",justify:"Align justify"};function Xc(t,e){return!t||!t.isEditable||!ls(t,"textAlign")||Ht(t,["image"])?!1:t.can().setTextAlign(e)}function BE(t){return"setTextAlign"in t}function _E(t,e){return!t||!t.isEditable?!1:t.isActive({textAlign:e})}function HE(t,e){if(!t||!t.isEditable||!Xc(t,e))return!1;const n=t.chain().focus();return BE(n)?n.setTextAlign(e).run():!1}function FE(t){const{editor:e,hideWhenUnavailable:n,align:r}=t;return!e||!e.isEditable||!ls(e,"textAlign")?!1:n&&!e.isActive("code")?Xc(e,r):!0}function $E(t){const{editor:e,align:n,hideWhenUnavailable:r=!1,onAligned:o}=t,{editor:i}=ie(e),[s,l]=y.useState(!0),a=Xc(i,n),c=_E(i,n);y.useEffect(()=>{if(!i)return;const d=()=>{l(FE({editor:i,align:n,hideWhenUnavailable:r}))};return d(),i.on("selectionUpdate",d),()=>{i.off("selectionUpdate",d)}},[i,r,n]);const u=y.useCallback(()=>{if(!i)return!1;const d=HE(i,n);return d&&o?.(),d},[i,n,o]);return{isVisible:s,isActive:c,handleTextAlign:u,canAlign:a,label:jE[n],shortcutKeys:b0[n],Icon:PE[n]}}function VE({action:t,shortcutKeys:e=w0[t]}){return g.jsx(vt,{children:gt({shortcutKeys:e})})}const _i=y.forwardRef(({editor:t,action:e,text:n,hideWhenUnavailable:r=!1,onExecuted:o,showShortcut:i=!1,onClick:s,children:l,...a},c)=>{const{editor:u}=ie(t),{isVisible:d,handleAction:f,label:h,canExecute:p,Icon:m,shortcutKeys:v}=qE({editor:u,action:e,hideWhenUnavailable:r,onExecuted:o}),b=y.useCallback(C=>{s?.(C),!C.defaultPrevented&&f()},[f,s]);return d?g.jsx(fe,{type:"button",disabled:!p,"data-style":"ghost","data-disabled":!p,role:"button",tabIndex:-1,"aria-label":h,tooltip:h,onClick:b,...a,ref:c,children:l??g.jsxs(g.Fragment,{children:[g.jsx(m,{className:"tiptap-button-icon"}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(VE,{action:e,shortcutKeys:v})]})}):null});_i.displayName="UndoRedoButton";const C0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.7071 2.29289C15.3166 1.90237 14.6834 1.90237 14.2929 2.29289C13.9024 2.68342 13.9024 3.31658 14.2929 3.70711L17.5858 7H9.5C7.77609 7 6.12279 7.68482 4.90381 8.90381C3.68482 10.1228 3 11.7761 3 13.5C3 14.3536 3.16813 15.1988 3.49478 15.9874C3.82144 16.7761 4.30023 17.4926 4.90381 18.0962C6.12279 19.3152 7.77609 20 9.5 20H13C13.5523 20 14 19.5523 14 19C14 18.4477 13.5523 18 13 18H9.5C8.30653 18 7.16193 17.5259 6.31802 16.682C5.90016 16.2641 5.56869 15.768 5.34254 15.2221C5.1164 14.6761 5 14.0909 5 13.5C5 12.3065 5.47411 11.1619 6.31802 10.318C7.16193 9.47411 8.30653 9 9.5 9H17.5858L14.2929 12.2929C13.9024 12.6834 13.9024 13.3166 14.2929 13.7071C14.6834 14.0976 15.3166 14.0976 15.7071 13.7071L20.7071 8.70711C21.0976 8.31658 21.0976 7.68342 20.7071 7.29289L15.7071 2.29289Z",fill:"currentColor"})}));C0.displayName="Redo2Icon";const x0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.70711 3.70711C10.0976 3.31658 10.0976 2.68342 9.70711 2.29289C9.31658 1.90237 8.68342 1.90237 8.29289 2.29289L3.29289 7.29289C2.90237 7.68342 2.90237 8.31658 3.29289 8.70711L8.29289 13.7071C8.68342 14.0976 9.31658 14.0976 9.70711 13.7071C10.0976 13.3166 10.0976 12.6834 9.70711 12.2929L6.41421 9H14.5C15.0909 9 15.6761 9.1164 16.2221 9.34254C16.768 9.56869 17.2641 9.90016 17.682 10.318C18.0998 10.7359 18.4313 11.232 18.6575 11.7779C18.8836 12.3239 19 12.9091 19 13.5C19 14.0909 18.8836 14.6761 18.6575 15.2221C18.4313 15.768 18.0998 16.2641 17.682 16.682C17.2641 17.0998 16.768 17.4313 16.2221 17.6575C15.6761 17.8836 15.0909 18 14.5 18H11C10.4477 18 10 18.4477 10 19C10 19.5523 10.4477 20 11 20H14.5C15.3536 20 16.1988 19.8319 16.9874 19.5052C17.7761 19.1786 18.4926 18.6998 19.0962 18.0962C19.6998 17.4926 20.1786 16.7761 20.5052 15.9874C20.8319 15.1988 21 14.3536 21 13.5C21 12.6464 20.8319 11.8012 20.5052 11.0126C20.1786 10.2239 19.6998 9.50739 19.0962 8.90381C18.4926 8.30022 17.7761 7.82144 16.9874 7.49478C16.1988 7.16813 15.3536 7 14.5 7H6.41421L9.70711 3.70711Z",fill:"currentColor"})}));x0.displayName="Undo2Icon";const w0={undo:"mod+z",redo:"mod+shift+z"},zE={undo:"Undo",redo:"Redo"},UE={undo:x0,redo:C0};function Qc(t,e){return!t||!t.isEditable||Ht(t,["image"])?!1:e==="undo"?t.can().undo():t.can().redo()}function WE(t,e){if(!t||!t.isEditable||!Qc(t,e))return!1;const n=t.chain().focus();return e==="undo"?n.undo().run():n.redo().run()}function KE(t){const{editor:e,hideWhenUnavailable:n,action:r}=t;return!e||!e.isEditable?!1:n&&!e.isActive("code")?Qc(e,r):!0}function qE(t){const{editor:e,action:n,hideWhenUnavailable:r=!1,onExecuted:o}=t,{editor:i}=ie(e),[s,l]=y.useState(!0),a=Qc(i,n);y.useEffect(()=>{if(!i)return;const u=()=>{l(KE({editor:i,hideWhenUnavailable:r,action:n}))};return u(),i.on("transaction",u),()=>{i.off("transaction",u)}},[i,r,n]);const c=y.useCallback(()=>{if(!i)return!1;const u=WE(i,n);return u&&o?.(),u},[i,n,o]);return{isVisible:s,handleAction:c,canExecute:a,label:zE[n],shortcutKeys:w0[n],Icon:UE[n]}}const S0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{d:"M12.7071 5.70711C13.0976 5.31658 13.0976 4.68342 12.7071 4.29289C12.3166 3.90237 11.6834 3.90237 11.2929 4.29289L4.29289 11.2929C3.90237 11.6834 3.90237 12.3166 4.29289 12.7071L11.2929 19.7071C11.6834 20.0976 12.3166 20.0976 12.7071 19.7071C13.0976 19.3166 13.0976 18.6834 12.7071 18.2929L7.41421 13L19 13C19.5523 13 20 12.5523 20 12C20 11.4477 19.5523 11 19 11L7.41421 11L12.7071 5.70711Z",fill:"currentColor"})}));S0.displayName="ArrowLeftIcon";var bl,xf;function GE(){if(xf)return bl;xf=1;var t="Expected a function",e=NaN,n="[object Symbol]",r=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,s=/^0o[0-7]+$/i,l=parseInt,a=typeof co=="object"&&co&&co.Object===Object&&co,c=typeof self=="object"&&self&&self.Object===Object&&self,u=a||c||Function("return this")(),d=Object.prototype,f=d.toString,h=Math.max,p=Math.min,m=function(){return u.Date.now()};function v(k,S,M){var N,P,W,z,H,I,_=0,F=!1,L=!1,T=!0;if(typeof k!="function")throw new TypeError(t);S=E(S)||0,C(M)&&(F=!!M.leading,L="maxWait"in M,W=L?h(E(M.maxWait)||0,S):W,T="trailing"in M?!!M.trailing:T);function R(te){var Ke=N,bt=P;return N=P=void 0,_=te,z=k.apply(bt,Ke),z}function U(te){return _=te,H=setTimeout(Z,S),F?R(te):z}function ee(te){var Ke=te-I,bt=te-_,Bn=S-Ke;return L?p(Bn,W-bt):Bn}function K(te){var Ke=te-I,bt=te-_;return I===void 0||Ke>=S||Ke<0||L&&bt>=W}function Z(){var te=m();if(K(te))return We(te);H=setTimeout(Z,ee(te))}function We(te){return H=void 0,T&&N?R(te):(N=P=void 0,z)}function le(){H!==void 0&&clearTimeout(H),_=0,N=I=P=H=void 0}function ge(){return H===void 0?z:We(m())}function Y(){var te=m(),Ke=K(te);if(N=arguments,P=this,I=te,Ke){if(H===void 0)return U(I);if(L)return H=setTimeout(Z,S),R(I)}return H===void 0&&(H=setTimeout(Z,S)),z}return Y.cancel=le,Y.flush=ge,Y}function b(k,S,M){var N=!0,P=!0;if(typeof k!="function")throw new TypeError(t);return C(M)&&(N="leading"in M?!!M.leading:N,P="trailing"in M?!!M.trailing:P),v(k,S,{leading:N,maxWait:S,trailing:P})}function C(k){var S=typeof k;return!!k&&(S=="object"||S=="function")}function x(k){return!!k&&typeof k=="object"}function w(k){return typeof k=="symbol"||x(k)&&f.call(k)==n}function E(k){if(typeof k=="number")return k;if(w(k))return e;if(C(k)){var S=typeof k.valueOf=="function"?k.valueOf():k;k=C(S)?S+"":S}if(typeof k!="string")return k===0?k:+k;k=k.replace(r,"");var M=i.test(k);return M||s.test(k)?l(k.slice(2),M?2:8):o.test(k)?e:+k}return bl=b,bl}var JE=GE();const ZE=Sf(JE),YE=t=>{const e=j.useRef(t);e.current=t,j.useEffect(()=>()=>{e.current()},[])},XE={leading:!1,trailing:!0};function k0(t,e=250,n=[],r=XE){const o=y.useMemo(()=>ZE(t,e,r),n);return YE(()=>{o.cancel()}),o}function eu(){const[t,e]=y.useState({width:0,height:0,offsetTop:0,offsetLeft:0,scale:0}),n=k0(()=>{if(typeof window>"u")return;const r=window.visualViewport;if(!r)return;const{width:o=0,height:i=0,offsetTop:s=0,offsetLeft:l=0,scale:a=0}=r;e(c=>o===c.width&&i===c.height&&s===c.offsetTop&&l===c.offsetLeft&&a===c.scale?c:{width:o,height:i,offsetTop:s,offsetLeft:l,scale:a})},200);return y.useEffect(()=>{const r=window.visualViewport;if(r)return r.addEventListener("resize",n),n(),()=>{r.removeEventListener("resize",n)}},[n]),t}const Io={x:0,y:0,width:0,height:0,top:0,right:0,bottom:0,left:0},E0=typeof window>"u",QE=!E0&&typeof ResizeObserver<"u",Vo=()=>!E0;function eM({element:t,enabled:e=!0,throttleMs:n=100,useResizeObserver:r=!0}={}){const[o,i]=y.useState(Io),s=y.useCallback(()=>!e||!Vo()?null:t?typeof t=="string"?document.querySelector(t):"current"in t?t.current:t:document.body,[t,e]),l=k0(()=>{if(!e||!Vo())return;const a=s();if(!a){i(Io);return}const c=a.getBoundingClientRect();i({x:c.x,y:c.y,width:c.width,height:c.height,top:c.top,right:c.right,bottom:c.bottom,left:c.left})},n,[e,s],{leading:!0,trailing:!0});return y.useEffect(()=>{if(!e||!Vo()){i(Io);return}const a=s();if(!a)return;l();const c=[];if(r&&QE){const d=new ResizeObserver(()=>{window.requestAnimationFrame(l)});d.observe(a),c.push(()=>d.disconnect())}const u=()=>l();return window.addEventListener("scroll",u,{passive:!0}),window.addEventListener("resize",u,{passive:!0}),c.push(()=>{window.removeEventListener("scroll",u),window.removeEventListener("resize",u)}),()=>{c.forEach(d=>d()),i(Io)}},[e,s,l,r]),o}function tM(t={}){return eM({...t,element:Vo()?document.body:null})}function nM({editor:t,overlayHeight:e=0}){const{height:n}=eu(),r=tM({enabled:!0,throttleMs:100,useResizeObserver:!0});return y.useEffect(()=>{(()=>{if(!t)return;const{state:i,view:s}=t;if(!s.hasFocus())return;const{from:l}=i.selection,a=s.coordsAtPos(l);if(n<r.height&&a&&n-a.top<e){const u=Math.max(n/2,e),d=window.scrollY,h=a.top+d-u;window.scrollTo({top:Math.max(0,h),behavior:"smooth"})}})()},[t,e,n,r.height]),r}const rM=({onHighlighterClick:t,onLinkClick:e,isMobile:n})=>g.jsxs(g.Fragment,{children:[g.jsx(rf,{}),g.jsxs(Mt,{children:[g.jsx(_i,{action:"undo"}),g.jsx(_i,{action:"redo"})]}),g.jsx(Tt,{}),g.jsxs(Mt,{children:[g.jsx(Pc,{levels:[1,2,3,4],portal:n}),g.jsx(Ng,{types:["bulletList","orderedList","taskList"],portal:n}),g.jsx(Vc,{}),g.jsx(Uc,{})]}),g.jsx(Tt,{}),g.jsxs(Mt,{children:[g.jsx(Et,{type:"bold"}),g.jsx(Et,{type:"italic"}),g.jsx(Et,{type:"strike"}),g.jsx(Et,{type:"code"}),g.jsx(Et,{type:"underline"}),n?g.jsx(Jc,{onClick:t}):g.jsx(CE,{}),n?g.jsx(Zc,{onClick:e}):g.jsx(r0,{})]}),g.jsx(Tt,{}),g.jsxs(Mt,{children:[g.jsx(Et,{type:"superscript"}),g.jsx(Et,{type:"subscript"})]}),g.jsx(Tt,{}),g.jsxs(Mt,{children:[g.jsx(Zn,{align:"left"}),g.jsx(Zn,{align:"center"}),g.jsx(Zn,{align:"right"}),g.jsx(Zn,{align:"justify"})]}),g.jsx(Tt,{}),g.jsx(Mt,{children:g.jsx(jc,{text:"Add"})}),g.jsx(rf,{}),n&&g.jsx(Tt,{})]}),oM=({type:t,onBack:e})=>g.jsxs(g.Fragment,{children:[g.jsx(Mt,{children:g.jsxs(fe,{"data-style":"ghost",onClick:e,children:[g.jsx(S0,{className:"tiptap-button-icon"}),t==="highlighter"?g.jsx(ys,{className:"tiptap-button-icon"}):g.jsx(bs,{className:"tiptap-button-icon"})]})}),g.jsx(Tt,{}),t==="highlighter"?g.jsx(Xg,{}):g.jsx(SE,{})]});function iM(t){const e=hr(),{height:n}=eu(),[r,o]=j.useState("main"),i=j.useRef(null),s=WC({content:t.value,immediatelyRender:!1,shouldRerenderOnTransaction:!1,onUpdate:({editor:a})=>{a&&t.onChange(a.getHTML())},editorProps:{attributes:{autocomplete:"off",autocorrect:"off",autocapitalize:"off","aria-label":"Main content area, start typing to enter text.",class:"simple-editor"}},extensions:[s3,r3.configure({type:"resizableImage",accept:"image/*",maxSize:1*1024*1024*1024,upload:(a,c,u)=>Promise.resolve(t.onUploadImage?.(a,c,u)||"")}),cm,am,Bw.configure({horizontalRule:!1,link:{openOnClick:!1,enableClickSelection:!0}}),o3,_w.configure({types:["heading","paragraph"]}),em,Qp.configure({nested:!0}),u7.configure({multicolor:!0}),l7,f7,d7,Dw,x7.configure({attributeName:"id",generateID:()=>`tiptap-editor-${t.id||ox()}`})]}),l=nM({editor:s,overlayHeight:i.current?.getBoundingClientRect().height??0});return j.useEffect(()=>{!e&&r!=="main"&&o("main")},[e,r]),j.useEffect(()=>()=>{s&&s.commands.clearContent()},[s]),g.jsx("div",{className:"simple-editor-wrapper",children:g.jsxs(qa.Provider,{value:{editor:s},children:[g.jsx(pc,{ref:i,style:{...e?{bottom:`calc(100% - ${n-l.y}px)`}:{}},children:r==="main"?g.jsx(rM,{onHighlighterClick:()=>o("highlighter"),onLinkClick:()=>o("link"),isMobile:e}):g.jsx(oM,{type:r==="highlighter"?"highlighter":"link",onBack:()=>o("main")})}),g.jsx(FC,{editor:s,className:"simple-editor-content"})]})})}exports.BlockquoteButton=Vc;exports.Button=fe;exports.Card=fr;exports.CodeBlockButton=Uc;exports.HeadingDropdownMenu=Pc;exports.ImageUploadButton=jc;exports.ListDropdownMenu=Ng;exports.MAX_FILE_SIZE=la;exports.MarkButton=Et;exports.TextAlignButton=Zn;exports.TiptapEditor=iM;exports.Toolbar=pc;exports.ToolbarGroup=Mt;exports.ToolbarSeparator=Tt;exports.UndoRedoButton=_i;exports.onUploadImage=z5;exports.useIsMobile=hr;exports.useTiptapEditor=ie;exports.useWindowSize=eu;
213
+ `)},US=0,zn=[];function WS(t){var e=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),o=y.useState(US++)[0],i=y.useState(N1)[0],s=y.useRef(t);y.useEffect(function(){s.current=t},[t]),y.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var m=fS([t.lockRef.current],(t.shards||[]).map(vf),!0).filter(Boolean);return m.forEach(function(v){return v.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var l=y.useCallback(function(m,v){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!s.current.allowPinchZoom;var b=No(m),C=n.current,x="deltaX"in m?m.deltaX:C[0]-b[0],w="deltaY"in m?m.deltaY:C[1]-b[1],E,k=m.target,S=Math.abs(x)>Math.abs(w)?"h":"v";if("touches"in m&&S==="h"&&k.type==="range")return!1;var M=gf(S,k);if(!M)return!0;if(M?E=S:(E=S==="v"?"h":"v",M=gf(S,k)),!M)return!1;if(!r.current&&"changedTouches"in m&&(x||w)&&(r.current=E),!E)return!0;var N=r.current||E;return $S(N,v,m,N==="h"?x:w)},[]),a=y.useCallback(function(m){var v=m;if(!(!zn.length||zn[zn.length-1]!==i)){var b="deltaY"in v?yf(v):No(v),C=e.current.filter(function(E){return E.name===v.type&&(E.target===v.target||v.target===E.shadowParent)&&VS(E.delta,b)})[0];if(C&&C.should){v.cancelable&&v.preventDefault();return}if(!C){var x=(s.current.shards||[]).map(vf).filter(Boolean).filter(function(E){return E.contains(v.target)}),w=x.length>0?l(v,x[0]):!s.current.noIsolation;w&&v.cancelable&&v.preventDefault()}}},[]),c=y.useCallback(function(m,v,b,C){var x={name:m,delta:v,target:b,should:C,shadowParent:KS(b)};e.current.push(x),setTimeout(function(){e.current=e.current.filter(function(w){return w!==x})},1)},[]),u=y.useCallback(function(m){n.current=No(m),r.current=void 0},[]),d=y.useCallback(function(m){c(m.type,yf(m),m.target,l(m,t.lockRef.current))},[]),f=y.useCallback(function(m){c(m.type,No(m),m.target,l(m,t.lockRef.current))},[]);y.useEffect(function(){return zn.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",a,Vn),document.addEventListener("touchmove",a,Vn),document.addEventListener("touchstart",u,Vn),function(){zn=zn.filter(function(m){return m!==i}),document.removeEventListener("wheel",a,Vn),document.removeEventListener("touchmove",a,Vn),document.removeEventListener("touchstart",u,Vn)}},[]);var h=t.removeScrollBar,p=t.inert;return y.createElement(y.Fragment,null,p?y.createElement(i,{styles:zS(o)}):null,h?y.createElement(DS,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function KS(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const qS=xS(O1,WS);var kc=y.forwardRef(function(t,e){return y.createElement(ds,ct({},t,{ref:e,sideCar:qS}))});kc.classNames=ds.classNames;var da=["Enter"," "],GS=["ArrowDown","PageUp","Home"],P1=["ArrowUp","PageDown","End"],JS=[...GS,...P1],ZS={ltr:[...da,"ArrowRight"],rtl:[...da,"ArrowLeft"]},YS={ltr:["ArrowLeft"],rtl:["ArrowRight"]},io="Menu",[Gr,XS,QS]=t1(io),[Pn,j1]=dr(io,[QS,us,x1]),fs=us(),B1=x1(),[ek,jn]=Pn(io),[tk,so]=Pn(io),_1=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=t,l=fs(e),[a,c]=y.useState(null),u=y.useRef(!1),d=jt(i),f=n1(o);return y.useEffect(()=>{const h=()=>{u.current=!0,document.addEventListener("pointerdown",p,{capture:!0,once:!0}),document.addEventListener("pointermove",p,{capture:!0,once:!0})},p=()=>u.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",p,{capture:!0}),document.removeEventListener("pointermove",p,{capture:!0})}},[]),g.jsx(y1,{...l,children:g.jsx(ek,{scope:e,open:n,onOpenChange:d,content:a,onContentChange:c,children:g.jsx(tk,{scope:e,onClose:y.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:s,children:r})})})};_1.displayName=io;var nk="MenuAnchor",Ec=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,o=fs(n);return g.jsx(wc,{...o,...r,ref:e})});Ec.displayName=nk;var Mc="MenuPortal",[rk,H1]=Pn(Mc,{forceMount:void 0}),F1=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:o}=t,i=jn(Mc,e);return g.jsx(rk,{scope:e,forceMount:n,children:g.jsx(Dn,{present:n||i.open,children:g.jsx(Sc,{asChild:!0,container:o,children:r})})})};F1.displayName=Mc;var et="MenuContent",[ok,Tc]=Pn(et),$1=y.forwardRef((t,e)=>{const n=H1(et,t.__scopeMenu),{forceMount:r=n.forceMount,...o}=t,i=jn(et,t.__scopeMenu),s=so(et,t.__scopeMenu);return g.jsx(Gr.Provider,{scope:t.__scopeMenu,children:g.jsx(Dn,{present:r||i.open,children:g.jsx(Gr.Slot,{scope:t.__scopeMenu,children:s.modal?g.jsx(ik,{...o,ref:e}):g.jsx(sk,{...o,ref:e})})})})}),ik=y.forwardRef((t,e)=>{const n=jn(et,t.__scopeMenu),r=y.useRef(null),o=Oe(e,r);return y.useEffect(()=>{const i=r.current;if(i)return T1(i)},[]),g.jsx(Ac,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:J(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),sk=y.forwardRef((t,e)=>{const n=jn(et,t.__scopeMenu);return g.jsx(Ac,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),lk=qr("MenuContent.ScrollLock"),Ac=y.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEntryFocus:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:h,disableOutsideScroll:p,...m}=t,v=jn(et,n),b=so(et,n),C=fs(n),x=B1(n),w=XS(n),[E,k]=y.useState(null),S=y.useRef(null),M=Oe(e,S,v.onContentChange),N=y.useRef(0),P=y.useRef(""),z=y.useRef(0),U=y.useRef(null),H=y.useRef("right"),I=y.useRef(0),_=p?kc:y.Fragment,F=p?{as:lk,allowPinchZoom:!0}:void 0,L=R=>{const W=P.current+R,ee=w().filter(Y=>!Y.disabled),K=document.activeElement,Z=ee.find(Y=>Y.ref.current===K)?.textValue,We=ee.map(Y=>Y.textValue),le=bk(We,W,Z),ge=ee.find(Y=>Y.textValue===le)?.ref.current;(function Y(te){P.current=te,window.clearTimeout(N.current),te!==""&&(N.current=window.setTimeout(()=>Y(""),1e3))})(W),ge&&setTimeout(()=>ge.focus())};y.useEffect(()=>()=>window.clearTimeout(N.current),[]),i1();const T=y.useCallback(R=>H.current===U.current?.side&&xk(R,U.current?.area),[]);return g.jsx(ok,{scope:n,searchRef:P,onItemEnter:y.useCallback(R=>{T(R)&&R.preventDefault()},[T]),onItemLeave:y.useCallback(R=>{T(R)||(S.current?.focus(),k(null))},[T]),onTriggerLeave:y.useCallback(R=>{T(R)&&R.preventDefault()},[T]),pointerGraceTimerRef:z,onPointerGraceIntentChange:y.useCallback(R=>{U.current=R},[]),children:g.jsx(_,{...F,children:g.jsx(bc,{asChild:!0,trapped:o,onMountAutoFocus:J(i,R=>{R.preventDefault(),S.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:g.jsx(vc,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:h,children:g.jsx(lS,{asChild:!0,...x,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:E,onCurrentTabStopIdChange:k,onEntryFocus:J(a,R=>{b.isUsingKeyboardRef.current||R.preventDefault()}),preventScrollOnEntryFocus:!0,children:g.jsx(v1,{role:"menu","aria-orientation":"vertical","data-state":rg(v.open),"data-radix-menu-content":"",dir:b.dir,...C,...m,ref:M,style:{outline:"none",...m.style},onKeyDown:J(m.onKeyDown,R=>{const ee=R.target.closest("[data-radix-menu-content]")===R.currentTarget,K=R.ctrlKey||R.altKey||R.metaKey,Z=R.key.length===1;ee&&(R.key==="Tab"&&R.preventDefault(),!K&&Z&&L(R.key));const We=S.current;if(R.target!==We||!JS.includes(R.key))return;R.preventDefault();const ge=w().filter(Y=>!Y.disabled).map(Y=>Y.ref.current);P1.includes(R.key)&&ge.reverse(),yk(ge)}),onBlur:J(t.onBlur,R=>{R.currentTarget.contains(R.target)||(window.clearTimeout(N.current),P.current="")}),onPointerMove:J(t.onPointerMove,Jr(R=>{const W=R.target,ee=I.current!==R.clientX;if(R.currentTarget.contains(W)&&ee){const K=R.clientX>I.current?"right":"left";H.current=K,I.current=R.clientX}}))})})})})})})});$1.displayName=et;var ak="MenuGroup",Rc=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return g.jsx(Te.div,{role:"group",...r,ref:e})});Rc.displayName=ak;var ck="MenuLabel",V1=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return g.jsx(Te.div,{...r,ref:e})});V1.displayName=ck;var ji="MenuItem",bf="menu.itemSelect",hs=y.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...o}=t,i=y.useRef(null),s=so(ji,t.__scopeMenu),l=Tc(ji,t.__scopeMenu),a=Oe(e,i),c=y.useRef(!1),u=()=>{const d=i.current;if(!n&&d){const f=new CustomEvent(bf,{bubbles:!0,cancelable:!0});d.addEventListener(bf,h=>r?.(h),{once:!0}),e1(d,f),f.defaultPrevented?c.current=!1:s.onClose()}};return g.jsx(z1,{...o,ref:a,disabled:n,onClick:J(t.onClick,u),onPointerDown:d=>{t.onPointerDown?.(d),c.current=!0},onPointerUp:J(t.onPointerUp,d=>{c.current||d.currentTarget?.click()}),onKeyDown:J(t.onKeyDown,d=>{const f=l.searchRef.current!=="";n||f&&d.key===" "||da.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});hs.displayName=ji;var z1=y.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=t,s=Tc(ji,n),l=B1(n),a=y.useRef(null),c=Oe(e,a),[u,d]=y.useState(!1),[f,h]=y.useState("");return y.useEffect(()=>{const p=a.current;p&&h((p.textContent??"").trim())},[i.children]),g.jsx(Gr.ItemSlot,{scope:n,disabled:r,textValue:o??f,children:g.jsx(aS,{asChild:!0,...l,focusable:!r,children:g.jsx(Te.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:c,onPointerMove:J(t.onPointerMove,Jr(p=>{r?s.onItemLeave(p):(s.onItemEnter(p),p.defaultPrevented||p.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:J(t.onPointerLeave,Jr(p=>s.onItemLeave(p))),onFocus:J(t.onFocus,()=>d(!0)),onBlur:J(t.onBlur,()=>d(!1))})})})}),uk="MenuCheckboxItem",U1=y.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...o}=t;return g.jsx(J1,{scope:t.__scopeMenu,checked:n,children:g.jsx(hs,{role:"menuitemcheckbox","aria-checked":Bi(n)?"mixed":n,...o,ref:e,"data-state":Nc(n),onSelect:J(o.onSelect,()=>r?.(Bi(n)?!0:!n),{checkForDefaultPrevented:!1})})})});U1.displayName=uk;var W1="MenuRadioGroup",[dk,fk]=Pn(W1,{value:void 0,onValueChange:()=>{}}),K1=y.forwardRef((t,e)=>{const{value:n,onValueChange:r,...o}=t,i=jt(r);return g.jsx(dk,{scope:t.__scopeMenu,value:n,onValueChange:i,children:g.jsx(Rc,{...o,ref:e})})});K1.displayName=W1;var q1="MenuRadioItem",G1=y.forwardRef((t,e)=>{const{value:n,...r}=t,o=fk(q1,t.__scopeMenu),i=n===o.value;return g.jsx(J1,{scope:t.__scopeMenu,checked:i,children:g.jsx(hs,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":Nc(i),onSelect:J(r.onSelect,()=>o.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});G1.displayName=q1;var Oc="MenuItemIndicator",[J1,hk]=Pn(Oc,{checked:!1}),Z1=y.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...o}=t,i=hk(Oc,n);return g.jsx(Dn,{present:r||Bi(i.checked)||i.checked===!0,children:g.jsx(Te.span,{...o,ref:e,"data-state":Nc(i.checked)})})});Z1.displayName=Oc;var pk="MenuSeparator",Y1=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return g.jsx(Te.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});Y1.displayName=pk;var mk="MenuArrow",X1=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,o=fs(n);return g.jsx(b1,{...o,...r,ref:e})});X1.displayName=mk;var gk="MenuSub",[lM,Q1]=Pn(gk),Cr="MenuSubTrigger",eg=y.forwardRef((t,e)=>{const n=jn(Cr,t.__scopeMenu),r=so(Cr,t.__scopeMenu),o=Q1(Cr,t.__scopeMenu),i=Tc(Cr,t.__scopeMenu),s=y.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:a}=i,c={__scopeMenu:t.__scopeMenu},u=y.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return y.useEffect(()=>u,[u]),y.useEffect(()=>{const d=l.current;return()=>{window.clearTimeout(d),a(null)}},[l,a]),g.jsx(Ec,{asChild:!0,...c,children:g.jsx(z1,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":rg(n.open),...t,ref:cs(e,o.onTriggerChange),onClick:d=>{t.onClick?.(d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:J(t.onPointerMove,Jr(d=>{i.onItemEnter(d),!d.defaultPrevented&&!t.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:J(t.onPointerLeave,Jr(d=>{u();const f=n.content?.getBoundingClientRect();if(f){const h=n.content?.dataset.side,p=h==="right",m=p?-5:5,v=f[p?"left":"right"],b=f[p?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+m,y:d.clientY},{x:v,y:f.top},{x:b,y:f.top},{x:b,y:f.bottom},{x:v,y:f.bottom}],side:h}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(d),d.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:J(t.onKeyDown,d=>{const f=i.searchRef.current!=="";t.disabled||f&&d.key===" "||ZS[r.dir].includes(d.key)&&(n.onOpenChange(!0),n.content?.focus(),d.preventDefault())})})})});eg.displayName=Cr;var tg="MenuSubContent",ng=y.forwardRef((t,e)=>{const n=H1(et,t.__scopeMenu),{forceMount:r=n.forceMount,...o}=t,i=jn(et,t.__scopeMenu),s=so(et,t.__scopeMenu),l=Q1(tg,t.__scopeMenu),a=y.useRef(null),c=Oe(e,a);return g.jsx(Gr.Provider,{scope:t.__scopeMenu,children:g.jsx(Dn,{present:r||i.open,children:g.jsx(Gr.Slot,{scope:t.__scopeMenu,children:g.jsx(Ac,{id:l.contentId,"aria-labelledby":l.triggerId,...o,ref:c,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{s.isUsingKeyboardRef.current&&a.current?.focus(),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:J(t.onFocusOutside,u=>{u.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:J(t.onEscapeKeyDown,u=>{s.onClose(),u.preventDefault()}),onKeyDown:J(t.onKeyDown,u=>{const d=u.currentTarget.contains(u.target),f=YS[s.dir].includes(u.key);d&&f&&(i.onOpenChange(!1),l.trigger?.focus(),u.preventDefault())})})})})})});ng.displayName=tg;function rg(t){return t?"open":"closed"}function Bi(t){return t==="indeterminate"}function Nc(t){return Bi(t)?"indeterminate":t?"checked":"unchecked"}function yk(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function vk(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function bk(t,e,n){const o=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let s=vk(t,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const a=s.find(c=>c.toLowerCase().startsWith(o.toLowerCase()));return a!==n?a:void 0}function Ck(t,e){const{x:n,y:r}=t;let o=!1;for(let i=0,s=e.length-1;i<e.length;s=i++){const l=e[i],a=e[s],c=l.x,u=l.y,d=a.x,f=a.y;u>r!=f>r&&n<(d-c)*(r-u)/(f-u)+c&&(o=!o)}return o}function xk(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return Ck(n,e)}function Jr(t){return e=>e.pointerType==="mouse"?t(e):void 0}var wk=_1,Sk=Ec,kk=F1,Ek=$1,Mk=Rc,Tk=V1,Ak=hs,Rk=U1,Ok=K1,Nk=G1,Ik=Z1,Lk=Y1,Dk=X1,Pk=eg,jk=ng,ps="DropdownMenu",[Bk]=dr(ps,[j1]),Be=j1(),[_k,og]=Bk(ps),ig=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:s,modal:l=!0}=t,a=Be(e),c=y.useRef(null),[u,d]=yc({prop:o,defaultProp:i??!1,onChange:s,caller:ps});return g.jsx(_k,{scope:e,triggerId:Pi(),triggerRef:c,contentId:Pi(),open:u,onOpenChange:d,onOpenToggle:y.useCallback(()=>d(f=>!f),[d]),modal:l,children:g.jsx(wk,{...a,open:u,onOpenChange:d,dir:r,modal:l,children:n})})};ig.displayName=ps;var sg="DropdownMenuTrigger",lg=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=t,i=og(sg,n),s=Be(n);return g.jsx(Sk,{asChild:!0,...s,children:g.jsx(Te.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:cs(e,i.triggerRef),onPointerDown:J(t.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:J(t.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});lg.displayName=sg;var Hk="DropdownMenuPortal",ag=t=>{const{__scopeDropdownMenu:e,...n}=t,r=Be(e);return g.jsx(kk,{...r,...n})};ag.displayName=Hk;var cg="DropdownMenuContent",ug=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=og(cg,n),i=Be(n),s=y.useRef(!1);return g.jsx(Ek,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...r,ref:e,onCloseAutoFocus:J(t.onCloseAutoFocus,l=>{s.current||o.triggerRef.current?.focus(),s.current=!1,l.preventDefault()}),onInteractOutside:J(t.onInteractOutside,l=>{const a=l.detail.originalEvent,c=a.button===0&&a.ctrlKey===!0,u=a.button===2||c;(!o.modal||u)&&(s.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ug.displayName=cg;var Fk="DropdownMenuGroup",$k=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Mk,{...o,...r,ref:e})});$k.displayName=Fk;var Vk="DropdownMenuLabel",zk=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Tk,{...o,...r,ref:e})});zk.displayName=Vk;var Uk="DropdownMenuItem",dg=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Ak,{...o,...r,ref:e})});dg.displayName=Uk;var Wk="DropdownMenuCheckboxItem",Kk=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Rk,{...o,...r,ref:e})});Kk.displayName=Wk;var qk="DropdownMenuRadioGroup",Gk=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Ok,{...o,...r,ref:e})});Gk.displayName=qk;var Jk="DropdownMenuRadioItem",Zk=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Nk,{...o,...r,ref:e})});Zk.displayName=Jk;var Yk="DropdownMenuItemIndicator",Xk=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Ik,{...o,...r,ref:e})});Xk.displayName=Yk;var Qk="DropdownMenuSeparator",e9=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Lk,{...o,...r,ref:e})});e9.displayName=Qk;var t9="DropdownMenuArrow",n9=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Dk,{...o,...r,ref:e})});n9.displayName=t9;var r9="DropdownMenuSubTrigger",o9=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Pk,{...o,...r,ref:e})});o9.displayName=r9;var i9="DropdownMenuSubContent",fg=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(jk,{...o,...r,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});fg.displayName=i9;var s9=ig,hg=lg,l9=ag,pg=ug,a9=dg,mg=fg;function gg({...t}){return g.jsx(s9,{modal:!1,...t})}function yg({...t}){return g.jsx(l9,{...t})}const Ic=y.forwardRef(({...t},e)=>g.jsx(hg,{ref:e,...t}));Ic.displayName=hg.displayName;const vg=a9,c9=y.forwardRef(({className:t,portal:e=!0,...n},r)=>{const o=g.jsx(mg,{ref:r,className:Me("tiptap-dropdown-menu",t),...n});return e?g.jsx(yg,{...typeof e=="object"?e:{},children:o}):o});c9.displayName=mg.displayName;const Lc=y.forwardRef(({className:t,sideOffset:e=4,portal:n=!1,...r},o)=>{const i=g.jsx(pg,{ref:o,sideOffset:e,onCloseAutoFocus:s=>s.preventDefault(),className:Me("tiptap-dropdown-menu",t),...r});return n?g.jsx(yg,{...typeof n=="object"?n:{},children:i}):i});Lc.displayName=pg.displayName;const fr=y.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:Me("tiptap-card",t),...e}));fr.displayName="Card";const u9=y.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:Me("tiptap-card-header",t),...e}));u9.displayName="CardHeader";const lo=y.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:Me("tiptap-card-body",t),...e}));lo.displayName="CardBody";const Dc=y.forwardRef(({className:t,orientation:e="vertical",...n},r)=>g.jsx("div",{ref:r,"data-orientation":e,className:Me("tiptap-card-item-group",t),...n}));Dc.displayName="CardItemGroup";const d9=y.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:Me("tiptap-card-group-label",t),...e}));d9.displayName="CardGroupLabel";const f9=y.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:Me("tiptap-card-footer",t),...e}));f9.displayName="CardFooter";const Pc=y.forwardRef(({editor:t,levels:e=[1,2,3,4,5,6],hideWhenUnavailable:n=!1,portal:r=!1,onOpenChange:o,...i},s)=>{const{editor:l}=ie(t),[a,c]=y.useState(!1),{isVisible:u,isActive:d,canToggle:f,Icon:h}=p9({editor:l,levels:e,hideWhenUnavailable:n}),p=y.useCallback(m=>{!l||!f||(c(m),o?.(m))},[f,l,o]);return u?g.jsxs(gg,{modal:!0,open:a,onOpenChange:p,children:[g.jsx(Ic,{asChild:!0,children:g.jsxs(fe,{type:"button","data-style":"ghost","data-active-state":d?"on":"off",role:"button",tabIndex:-1,disabled:!f,"data-disabled":!f,"aria-label":"Format text as heading","aria-pressed":d,tooltip:"Heading",...i,ref:s,children:[g.jsx(h,{className:"tiptap-button-icon"}),g.jsx(mc,{className:"tiptap-button-dropdown-small"})]})}),g.jsx(Lc,{align:"start",portal:r,children:g.jsx(fr,{children:g.jsx(lo,{children:g.jsx(In,{children:e.map(m=>g.jsx(vg,{asChild:!0,children:g.jsx(Um,{editor:l,level:m,text:`Heading ${m}`,showTooltip:!1})},`heading-${m}`))})})})})]}):null});Pc.displayName="HeadingDropdownMenu";const bg=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{d:"M6 3C6.55228 3 7 3.44772 7 4V11H17V4C17 3.44772 17.4477 3 18 3C18.5523 3 19 3.44772 19 4V20C19 20.5523 18.5523 21 18 21C17.4477 21 17 20.5523 17 20V13H7V20C7 20.5523 6.55228 21 6 21C5.44772 21 5 20.5523 5 20V4C5 3.44772 5.44772 3 6 3Z",fill:"currentColor"})}));bg.displayName="HeadingIcon";function h9(t,e=[1,2,3,4,5,6]){if(!(!t||!t.isEditable))return e.find(n=>gc(t,n))}function p9(t){const{editor:e,levels:n=[1,2,3,4,5,6],hideWhenUnavailable:r=!1}=t||{},{editor:o}=ie(e),[i,s]=y.useState(!0),l=h9(o,n),a=gc(o),c=Kr(o);return y.useEffect(()=>{if(!o)return;const u=()=>{s(Qm({editor:o,hideWhenUnavailable:r,level:n}))};return u(),o.on("selectionUpdate",u),()=>{o.off("selectionUpdate",u)}},[o,r,n]),{isVisible:i,activeLevel:l,isActive:a,canToggle:c,levels:n,label:"Heading",Icon:l?Ym[l]:bg}}function m9({shortcutKeys:t=fa}){return g.jsx(vt,{children:gt({shortcutKeys:t})})}const jc=y.forwardRef(({editor:t,text:e,hideWhenUnavailable:n=!1,onInserted:r,showShortcut:o=!1,onClick:i,children:s,...l},a)=>{const{editor:c}=ie(t),{isVisible:u,canInsert:d,handleImage:f,label:h,isActive:p,shortcutKeys:m,Icon:v}=D9({editor:c,hideWhenUnavailable:n,onInserted:r}),b=y.useCallback(C=>{i?.(C),!C.defaultPrevented&&f()},[f,i]);return u?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":p?"on":"off",role:"button",tabIndex:-1,disabled:!d,"data-disabled":!d,"aria-label":h,"aria-pressed":p,tooltip:h,onClick:b,...l,ref:a,children:s??g.jsxs(g.Fragment,{children:[g.jsx(v,{className:"tiptap-button-icon"}),e&&g.jsx("span",{className:"tiptap-button-text",children:e}),o&&g.jsx(m9,{shortcutKeys:m})]})}):null});jc.displayName="ImageUploadButton";const Cg=["shift","alt","meta","mod","ctrl","control"],g9={esc:"escape",return:"enter",left:"arrowleft",right:"arrowright",up:"arrowup",down:"arrowdown",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function on(t){return(g9[t.trim()]||t.trim()).toLowerCase().replace(/key|digit|numpad/,"")}function xg(t){return Cg.includes(t)}function yl(t,e=","){return t.toLowerCase().split(e)}function vl(t,e="+",n=">",r=!1,o){let i=[],s=!1;t=t.trim(),t.includes(n)?(s=!0,i=t.toLocaleLowerCase().split(n).map(c=>on(c))):i=t.toLocaleLowerCase().split(e).map(c=>on(c));const l={alt:i.includes("alt"),ctrl:i.includes("ctrl")||i.includes("control"),shift:i.includes("shift"),meta:i.includes("meta"),mod:i.includes("mod"),useKey:r},a=i.filter(c=>!Cg.includes(c));return{...l,keys:a,description:o,isSequence:s,hotkey:t}}typeof document<"u"&&(document.addEventListener("keydown",t=>{t.code!==void 0&&wg([on(t.code)])}),document.addEventListener("keyup",t=>{t.code!==void 0&&Sg([on(t.code)])})),typeof window<"u"&&(window.addEventListener("blur",()=>{Rt.clear()}),window.addEventListener("contextmenu",()=>{setTimeout(()=>{Rt.clear()},0)}));const Rt=new Set;function Bc(t){return Array.isArray(t)}function y9(t,e=","){return(Bc(t)?t:t.split(e)).every(n=>Rt.has(n.trim().toLowerCase()))}function wg(t){const e=Array.isArray(t)?t:[t];Rt.has("meta")&&Rt.forEach(n=>!xg(n)&&Rt.delete(n.toLowerCase())),e.forEach(n=>Rt.add(n.toLowerCase()))}function Sg(t){const e=Array.isArray(t)?t:[t];t==="meta"?Rt.clear():e.forEach(n=>Rt.delete(n.toLowerCase()))}function v9(t,e,n){(typeof n=="function"&&n(t,e)||n===!0)&&t.preventDefault()}function b9(t,e,n){return typeof n=="function"?n(t,e):n===!0||n===void 0}const C9=["input","textarea","select","searchbox","slider","spinbutton","menuitem","menuitemcheckbox","menuitemradio","option","radio","textbox"];function x9(t){return kg(t,C9)}function kg(t,e=!1){const{target:n,composed:r}=t;let o,i;return w9(n)&&r?(o=t.composedPath()[0]&&t.composedPath()[0].tagName,i=t.composedPath()[0]&&t.composedPath()[0].role):(o=n&&n.tagName,i=n&&n.role),Bc(e)?!!(o&&e&&e.some(s=>s.toLowerCase()===o.toLowerCase()||s===i)):!!(o&&e&&e)}function w9(t){return!!t.tagName&&!t.tagName.startsWith("-")&&t.tagName.includes("-")}function S9(t,e){return t.length===0&&e?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):e?t.some(n=>e.includes(n))||t.includes("*"):!0}const k9=(t,e,n=!1)=>{const{alt:r,meta:o,mod:i,shift:s,ctrl:l,keys:a,useKey:c}=e,{code:u,key:d,ctrlKey:f,metaKey:h,shiftKey:p,altKey:m}=t,v=on(u);if(c&&a?.length===1&&a.includes(d))return!0;if(!a?.includes(v)&&!["ctrl","control","unknown","meta","alt","shift","os"].includes(v))return!1;if(!n){if(r!==m&&v!=="alt"||s!==p&&v!=="shift")return!1;if(i){if(!h&&!f)return!1}else if(o!==h&&v!=="meta"&&v!=="os"||l!==f&&v!=="ctrl"&&v!=="control")return!1}return a&&a.length===1&&a.includes(v)?!0:a?y9(a):!a},E9=j.createContext(void 0),M9=()=>j.useContext(E9);function Eg(t,e){return t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(t).length===Object.keys(e).length&&Object.keys(t).reduce((n,r)=>n&&Eg(t[r],e[r]),!0):t===e}const T9=j.createContext({hotkeys:[],activeScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),A9=()=>j.useContext(T9);function R9(t){const e=j.useRef(void 0);return Eg(e.current,t)||(e.current=t),e.current}const Cf=t=>{t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},O9=typeof window<"u"?j.useLayoutEffect:j.useEffect;function Mg(t,e,n,r){const o=j.useRef(null),i=j.useRef(!1),s=Array.isArray(n)?Array.isArray(r)?void 0:r:n,l=Bc(t)?t.join(s?.delimiter):t,a=Array.isArray(n)?n:Array.isArray(r)?r:void 0,c=j.useCallback(e,a??[]),u=j.useRef(c);a?u.current=c:u.current=e;const d=R9(s),{activeScopes:f}=A9(),h=M9();return O9(()=>{if(d?.enabled===!1||!S9(f,d?.scopes))return;let p=[],m;const v=(w,E=!1)=>{if(!(x9(w)&&!kg(w,d?.enableOnFormTags))){if(o.current!==null){const k=o.current.getRootNode();if((k instanceof Document||k instanceof ShadowRoot)&&k.activeElement!==o.current&&!o.current.contains(k.activeElement)){Cf(w);return}}w.target?.isContentEditable&&!d?.enableOnContentEditable||yl(l,d?.delimiter).forEach(k=>{if(k.includes(d?.splitKey??"+")&&k.includes(d?.sequenceSplitKey??">")){console.warn(`Hotkey ${k} contains both ${d?.splitKey??"+"} and ${d?.sequenceSplitKey??">"} which is not supported.`);return}const S=vl(k,d?.splitKey,d?.sequenceSplitKey,d?.useKey,d?.description);if(S.isSequence){m=setTimeout(()=>{p=[]},d?.sequenceTimeoutMs??1e3);const M=S.useKey?w.key:on(w.code);if(xg(M.toLowerCase()))return;p.push(M);const N=S.keys?.[p.length-1];if(M!==N){p=[],m&&clearTimeout(m);return}p.length===S.keys?.length&&(u.current(w,S),m&&clearTimeout(m),p=[])}else if(k9(w,S,d?.ignoreModifiers)||S.keys?.includes("*")){if(d?.ignoreEventWhen?.(w)||E&&i.current)return;if(v9(w,S,d?.preventDefault),!b9(w,S,d?.enabled)){Cf(w);return}u.current(w,S),E||(i.current=!0)}})}},b=w=>{w.code!==void 0&&(wg(on(w.code)),(d?.keydown===void 0&&d?.keyup!==!0||d?.keydown)&&v(w))},C=w=>{w.code!==void 0&&(Sg(on(w.code)),i.current=!1,d?.keyup&&v(w,!0))},x=o.current||s?.document||document;return x.addEventListener("keyup",C,s?.eventListenerOptions),x.addEventListener("keydown",b,s?.eventListenerOptions),h&&yl(l,d?.delimiter).forEach(w=>h.addHotkey(vl(w,d?.splitKey,d?.sequenceSplitKey,d?.useKey,d?.description))),()=>{x.removeEventListener("keyup",C,s?.eventListenerOptions),x.removeEventListener("keydown",b,s?.eventListenerOptions),h&&yl(l,d?.delimiter).forEach(w=>h.removeHotkey(vl(w,d?.splitKey,d?.sequenceSplitKey,d?.useKey,d?.description))),p=[],m&&clearTimeout(m)}},[l,d,f]),o}function hr(t=768){const[e,n]=y.useState(void 0);return y.useEffect(()=>{const r=window.matchMedia(`(max-width: ${t-1}px)`),o=()=>{n(window.innerWidth<t)};return r.addEventListener("change",o),n(window.innerWidth<t),()=>r.removeEventListener("change",o)},[t]),!!e}const Tg=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 2C20 1.44772 19.5523 1 19 1C18.4477 1 18 1.44772 18 2V4H16C15.4477 4 15 4.44772 15 5C15 5.55228 15.4477 6 16 6H18V8C18 8.55228 18.4477 9 19 9C19.5523 9 20 8.55228 20 8V6H22C22.5523 6 23 5.55228 23 5C23 4.44772 22.5523 4 22 4H20V2ZM5 4C4.73478 4 4.48043 4.10536 4.29289 4.29289C4.10536 4.48043 4 4.73478 4 5V19C4 19.2652 4.10536 19.5196 4.29289 19.7071C4.48043 19.8946 4.73478 20 5 20H5.58579L14.379 11.2068C14.9416 10.6444 15.7045 10.3284 16.5 10.3284C17.2955 10.3284 18.0584 10.6444 18.621 11.2068L20 12.5858V12C20 11.4477 20.4477 11 21 11C21.5523 11 22 11.4477 22 12V14.998C22 14.9994 22 15.0007 22 15.002V19C22 19.7957 21.6839 20.5587 21.1213 21.1213C20.5587 21.6839 19.7957 22 19 22H6.00219C6.00073 22 5.99927 22 5.99781 22H5C4.20435 22 3.44129 21.6839 2.87868 21.1213C2.31607 20.5587 2 19.7957 2 19V5C2 4.20435 2.31607 3.44129 2.87868 2.87868C3.44129 2.31607 4.20435 2 5 2H12C12.5523 2 13 2.44772 13 3C13 3.55228 12.5523 4 12 4H5ZM8.41422 20H19C19.2652 20 19.5196 19.8946 19.7071 19.7071C19.8946 19.5196 20 19.2652 20 19V15.4142L17.207 12.6212C17.0195 12.4338 16.7651 12.3284 16.5 12.3284C16.2349 12.3284 15.9806 12.4337 15.7931 12.6211L8.41422 20ZM6.87868 6.87868C7.44129 6.31607 8.20435 6 9 6C9.79565 6 10.5587 6.31607 11.1213 6.87868C11.6839 7.44129 12 8.20435 12 9C12 9.79565 11.6839 10.5587 11.1213 11.1213C10.5587 11.6839 9.79565 12 9 12C8.20435 12 7.44129 11.6839 6.87868 11.1213C6.31607 10.5587 6 9.79565 6 9C6 8.20435 6.31607 7.44129 6.87868 6.87868ZM9 8C8.73478 8 8.48043 8.10536 8.29289 8.29289C8.10536 8.48043 8 8.73478 8 9C8 9.26522 8.10536 9.51957 8.29289 9.70711C8.48043 9.89464 8.73478 10 9 10C9.26522 10 9.51957 9.89464 9.70711 9.70711C9.89464 9.51957 10 9.26522 10 9C10 8.73478 9.89464 8.48043 9.70711 8.29289C9.51957 8.10536 9.26522 8 9 8Z",fill:"currentColor"})}));Tg.displayName="ImagePlusIcon";const fa="mod+shift+i";function _c(t){return!t||!t.isEditable||!ls(t,"imageUpload")||Ht(t,["image"])?!1:t.can().insertContent({type:"imageUpload"})}function N9(t){return!t||!t.isEditable?!1:t.isActive("imageUpload")}function I9(t){if(!t||!t.isEditable||!_c(t))return!1;try{return t.chain().focus().insertContent({type:"imageUpload"}).run()}catch{return!1}}function L9(t){const{editor:e,hideWhenUnavailable:n}=t;return!e||!e.isEditable||!ls(e,"imageUpload")?!1:n&&!e.isActive("code")?_c(e):!0}function D9(t){const{editor:e,hideWhenUnavailable:n=!1,onInserted:r}=t||{},{editor:o}=ie(e),i=hr(),[s,l]=y.useState(!0),a=_c(o),c=N9(o);y.useEffect(()=>{if(!o)return;const d=()=>{l(L9({editor:o,hideWhenUnavailable:n}))};return d(),o.on("selectionUpdate",d),()=>{o.off("selectionUpdate",d)}},[o,n]);const u=y.useCallback(()=>{if(!o)return!1;const d=I9(o);return d&&r?.(),d},[o,r]);return Mg(fa,d=>{d.preventDefault(),u()},{enabled:s&&a,enableOnContentEditable:!i,enableOnFormTags:!0}),{isVisible:s,isActive:c,handleImage:u,canInsert:a,label:"Add image",shortcutKeys:fa,Icon:Tg}}function P9({type:t,shortcutKeys:e=Og[t]}){return g.jsx(vt,{children:gt({shortcutKeys:e})})}const Ag=y.forwardRef(({editor:t,type:e,text:n,hideWhenUnavailable:r=!1,onToggled:o,showShortcut:i=!1,onClick:s,children:l,...a},c)=>{const{editor:u}=ie(t),{isVisible:d,canToggle:f,isActive:h,handleToggle:p,label:m,shortcutKeys:v,Icon:b}=H9({editor:u,type:e,hideWhenUnavailable:r,onToggled:o}),C=y.useCallback(x=>{s?.(x),!x.defaultPrevented&&p()},[p,s]);return d?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":h?"on":"off",role:"button",tabIndex:-1,disabled:!f,"data-disabled":!f,"aria-label":m,"aria-pressed":h,tooltip:m,onClick:C,...a,ref:c,children:l??g.jsxs(g.Fragment,{children:[g.jsx(b,{className:"tiptap-button-icon"}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(P9,{type:e,shortcutKeys:v})]})}):null});Ag.displayName="ListButton";const ms=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 6C7 5.44772 7.44772 5 8 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H8C7.44772 7 7 6.55228 7 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 12C7 11.4477 7.44772 11 8 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H8C7.44772 13 7 12.5523 7 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 18C7 17.4477 7.44772 17 8 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H8C7.44772 19 7 18.5523 7 18Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H3.01C3.56228 5 4.01 5.44772 4.01 6C4.01 6.55228 3.56228 7 3.01 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H3.01C3.56228 11 4.01 11.4477 4.01 12C4.01 12.5523 3.56228 13 3.01 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H3.01C3.56228 17 4.01 17.4477 4.01 18C4.01 18.5523 3.56228 19 3.01 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]}));ms.displayName="ListIcon";const Hc=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 6C9 5.44772 9.44772 5 10 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H10C9.44772 7 9 6.55228 9 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 12C9 11.4477 9.44772 11 10 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H10C9.44772 13 9 12.5523 9 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 18C9 17.4477 9.44772 17 10 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H10C9.44772 19 9 18.5523 9 18Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 6C3 5.44772 3.44772 5 4 5H5C5.55228 5 6 5.44772 6 6V10C6 10.5523 5.55228 11 5 11C4.44772 11 4 10.5523 4 10V7C3.44772 7 3 6.55228 3 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 10C3 9.44772 3.44772 9 4 9H6C6.55228 9 7 9.44772 7 10C7 10.5523 6.55228 11 6 11H4C3.44772 11 3 10.5523 3 10Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.82219 13.0431C6.54543 13.4047 6.99997 14.1319 6.99997 15C6.99997 15.5763 6.71806 16.0426 6.48747 16.35C6.31395 16.5814 6.1052 16.8044 5.91309 17H5.99997C6.55226 17 6.99997 17.4477 6.99997 18C6.99997 18.5523 6.55226 19 5.99997 19H3.99997C3.44769 19 2.99997 18.5523 2.99997 18C2.99997 17.4237 3.28189 16.9575 3.51247 16.65C3.74323 16.3424 4.03626 16.0494 4.26965 15.8161C4.27745 15.8083 4.2852 15.8006 4.29287 15.7929C4.55594 15.5298 4.75095 15.3321 4.88748 15.15C4.96287 15.0495 4.99021 14.9922 4.99911 14.9714C4.99535 14.9112 4.9803 14.882 4.9739 14.8715C4.96613 14.8588 4.95382 14.845 4.92776 14.8319C4.87723 14.8067 4.71156 14.7623 4.44719 14.8944C3.95321 15.1414 3.35254 14.9412 3.10555 14.4472C2.85856 13.9533 3.05878 13.3526 3.55276 13.1056C4.28839 12.7378 5.12272 12.6934 5.82219 13.0431Z",fill:"currentColor"})]}));Hc.displayName="ListOrderedIcon";const Fc=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 4.89543 2.89543 4 4 4H8C9.10457 4 10 4.89543 10 6V10C10 11.1046 9.10457 12 8 12H4C2.89543 12 2 11.1046 2 10V6ZM8 6H4V10H8V6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.70711 14.2929C10.0976 14.6834 10.0976 15.3166 9.70711 15.7071L5.70711 19.7071C5.31658 20.0976 4.68342 20.0976 4.29289 19.7071L2.29289 17.7071C1.90237 17.3166 1.90237 16.6834 2.29289 16.2929C2.68342 15.9024 3.31658 15.9024 3.70711 16.2929L5 17.5858L8.29289 14.2929C8.68342 13.9024 9.31658 13.9024 9.70711 14.2929Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 6C12 5.44772 12.4477 5 13 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H13C12.4477 7 12 6.55228 12 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 12C12 11.4477 12.4477 11 13 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H13C12.4477 13 12 12.5523 12 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18C12 17.4477 12.4477 17 13 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H13C12.4477 19 12 18.5523 12 18Z",fill:"currentColor"})]}));Fc.displayName="ListTodoIcon";const Rg={bulletList:ms,orderedList:Hc,taskList:Fc},j9={bulletList:"Bullet List",orderedList:"Ordered List",taskList:"Task List"},Og={bulletList:"mod+shift+8",orderedList:"mod+shift+7",taskList:"mod+shift+9"};function gs(t,e,n=!0){if(!t||!t.isEditable||!_t(e,t)||Ht(t,["image"]))return!1;if(!n)switch(e){case"bulletList":return t.can().toggleBulletList();case"orderedList":return t.can().toggleOrderedList();case"taskList":return t.can().toggleList("taskList","taskItem");default:return!1}try{const o=t.view.state,i=o.selection;if(i.empty||i instanceof V){const s=hn({editor:t,node:o.selection.$anchor.node(1)})?.pos;if(!yt(s))return!1}return!0}catch{return!1}}function $c(t,e){if(!t||!t.isEditable)return!1;switch(e){case"bulletList":return t.isActive("bulletList");case"orderedList":return t.isActive("orderedList");case"taskList":return t.isActive("taskList");default:return!1}}function B9(t,e){if(!t||!t.isEditable||!gs(t,e))return!1;try{const n=t.view;let r=n.state,o=r.tr;if(r.selection.empty||r.selection instanceof V){const l=hn({editor:t,node:r.selection.$anchor.node(1)})?.pos;if(!yt(l))return!1;o=o.setSelection(B.create(r.doc,l)),n.dispatch(o),r=n.state}const i=r.selection;let s=t.chain().focus();if(i instanceof B){const l=i.node.firstChild?.firstChild,a=i.node.lastChild?.lastChild,c=l?i.from+l.nodeSize:i.from+1,u=a?i.to-a.nodeSize:i.to-1;s=s.setTextSelection({from:c,to:u}).clearNodes()}if(t.isActive(e))s.liftListItem("listItem").lift("bulletList").lift("orderedList").lift("taskList").run();else{const a={bulletList:()=>s.toggleBulletList(),orderedList:()=>s.toggleOrderedList(),taskList:()=>s.toggleList("taskList","taskItem")}[e];if(!a)return!1;a().run()}return t.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function _9(t){const{editor:e,type:n,hideWhenUnavailable:r}=t;return!e||!e.isEditable||!_t(n,e)?!1:r&&!e.isActive("code")?gs(e,n):!0}function H9(t){const{editor:e,type:n,hideWhenUnavailable:r=!1,onToggled:o}=t,{editor:i}=ie(e),[s,l]=y.useState(!0),a=gs(i,n),c=$c(i,n);y.useEffect(()=>{if(!i)return;const d=()=>{l(_9({editor:i,type:n,hideWhenUnavailable:r}))};return d(),i.on("selectionUpdate",d),()=>{i.off("selectionUpdate",d)}},[i,n,r]);const u=y.useCallback(()=>{if(!i)return!1;const d=B9(i,n);return d&&o?.(),d},[i,n,o]);return{isVisible:s,isActive:c,handleToggle:u,canToggle:a,label:j9[n],shortcutKeys:Og[n],Icon:Rg[n]}}const F9=[{label:"Bullet List",type:"bulletList",icon:ms},{label:"Ordered List",type:"orderedList",icon:Hc},{label:"Task List",type:"taskList",icon:Fc}];function $9(t,e){return!t||!t.isEditable?!1:e.some(n=>gs(t,n))}function V9(t,e){return!t||!t.isEditable?!1:e.some(n=>$c(t,n))}function z9(t){return F9.filter(e=>!e.type||t.includes(e.type))}function U9(t){const{editor:e,hideWhenUnavailable:n,listInSchema:r,canToggleAny:o}=t;return!r||!e?!1:n&&!e.isActive("code")?o:!0}function W9(t,e){if(!(!t||!t.isEditable))return e.find(n=>$c(t,n))}function K9(t){const{editor:e,types:n=["bulletList","orderedList","taskList"],hideWhenUnavailable:r=!1}=t||{},{editor:o}=ie(e),[i,s]=y.useState(!1),l=n.some(h=>_t(h,o)),a=y.useMemo(()=>z9(n),[n]),c=$9(o,n),u=V9(o,n),d=W9(o,n),f=a.find(h=>h.type===d);return y.useEffect(()=>{if(!o)return;const h=()=>{s(U9({editor:o,hideWhenUnavailable:r,listInSchema:l,canToggleAny:c}))};return h(),o.on("selectionUpdate",h),()=>{o.off("selectionUpdate",h)}},[c,o,r,l,n]),{isVisible:i,activeType:d,isActive:u,canToggle:c,types:n,filteredLists:a,label:"List",Icon:f?Rg[f.type]:ms}}function Ng({editor:t,types:e=["bulletList","orderedList","taskList"],hideWhenUnavailable:n=!1,onOpenChange:r,portal:o=!1,...i}){const{editor:s}=ie(t),[l,a]=y.useState(!1),{filteredLists:c,canToggle:u,isActive:d,isVisible:f,Icon:h}=K9({editor:s,types:e,hideWhenUnavailable:n}),p=y.useCallback(m=>{a(m),r?.(m)},[r]);return!f||!s||!s.isEditable?null:g.jsxs(gg,{open:l,onOpenChange:p,children:[g.jsx(Ic,{asChild:!0,children:g.jsxs(fe,{type:"button","data-style":"ghost","data-active-state":d?"on":"off",role:"button",tabIndex:-1,disabled:!u,"data-disabled":!u,"aria-label":"List options",tooltip:"List",...i,children:[g.jsx(h,{className:"tiptap-button-icon"}),g.jsx(mc,{className:"tiptap-button-dropdown-small"})]})}),g.jsx(Lc,{align:"start",portal:o,children:g.jsx(fr,{children:g.jsx(lo,{children:g.jsx(In,{children:c.map(m=>g.jsx(vg,{asChild:!0,children:g.jsx(Ag,{editor:s,type:m.type,text:m.label,showTooltip:!1})},m.type))})})})})]})}function q9({shortcutKeys:t=Lg}){return g.jsx(vt,{children:gt({shortcutKeys:t})})}const Vc=y.forwardRef(({editor:t,text:e,hideWhenUnavailable:n=!1,onToggled:r,showShortcut:o=!1,onClick:i,children:s,...l},a)=>{const{editor:c}=ie(t),{isVisible:u,canToggle:d,isActive:f,handleToggle:h,label:p,shortcutKeys:m,Icon:v}=Z9({editor:c,hideWhenUnavailable:n,onToggled:r}),b=y.useCallback(C=>{i?.(C),!C.defaultPrevented&&h()},[h,i]);return u?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":f?"on":"off",role:"button",tabIndex:-1,disabled:!d,"data-disabled":!d,"aria-label":p,"aria-pressed":f,tooltip:"Blockquote",onClick:b,...l,ref:a,children:s??g.jsxs(g.Fragment,{children:[g.jsx(v,{className:"tiptap-button-icon"}),e&&g.jsx("span",{className:"tiptap-button-text",children:e}),o&&g.jsx(q9,{shortcutKeys:m})]})}):null});Vc.displayName="BlockquoteButton";const Ig=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 6C8 5.44772 8.44772 5 9 5H16C16.5523 5 17 5.44772 17 6C17 6.55228 16.5523 7 16 7H9C8.44772 7 8 6.55228 8 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 3C4.55228 3 5 3.44772 5 4L5 20C5 20.5523 4.55229 21 4 21C3.44772 21 3 20.5523 3 20L3 4C3 3.44772 3.44772 3 4 3Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 12C8 11.4477 8.44772 11 9 11H20C20.5523 11 21 11.4477 21 12C21 12.5523 20.5523 13 20 13H9C8.44772 13 8 12.5523 8 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 18C8 17.4477 8.44772 17 9 17H16C16.5523 17 17 17.4477 17 18C17 18.5523 16.5523 19 16 19H9C8.44772 19 8 18.5523 8 18Z",fill:"currentColor"})]}));Ig.displayName="BlockquoteIcon";const Lg="mod+shift+b";function zc(t,e=!0){if(!t||!t.isEditable||!_t("blockquote",t)||Ht(t,["image"]))return!1;if(!e)return t.can().toggleWrap("blockquote");try{const r=t.view.state,o=r.selection;if(o.empty||o instanceof V){const i=hn({editor:t,node:r.selection.$anchor.node(1)})?.pos;if(!yt(i))return!1}return!0}catch{return!1}}function G9(t){if(!t||!t.isEditable||!zc(t))return!1;try{const e=t.view;let n=e.state,r=n.tr;if(n.selection.empty||n.selection instanceof V){const l=hn({editor:t,node:n.selection.$anchor.node(1)})?.pos;if(!yt(l))return!1;r=r.setSelection(B.create(n.doc,l)),e.dispatch(r),n=e.state}const o=n.selection;let i=t.chain().focus();if(o instanceof B){const l=o.node.firstChild?.firstChild,a=o.node.lastChild?.lastChild,c=l?o.from+l.nodeSize:o.from+1,u=a?o.to-a.nodeSize:o.to-1;i=i.setTextSelection({from:c,to:u}).clearNodes()}return(t.isActive("blockquote")?i.lift("blockquote"):i.wrapIn("blockquote")).run(),t.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function J9(t){const{editor:e,hideWhenUnavailable:n}=t;return!e||!e.isEditable||!_t("blockquote",e)?!1:n&&!e.isActive("code")?zc(e):!0}function Z9(t){const{editor:e,hideWhenUnavailable:n=!1,onToggled:r}=t||{},{editor:o}=ie(e),[i,s]=y.useState(!0),l=zc(o),a=o?.isActive("blockquote")||!1;y.useEffect(()=>{if(!o)return;const u=()=>{s(J9({editor:o,hideWhenUnavailable:n}))};return u(),o.on("selectionUpdate",u),()=>{o.off("selectionUpdate",u)}},[o,n]);const c=y.useCallback(()=>{if(!o)return!1;const u=G9(o);return u&&r?.(),u},[o,r]);return{isVisible:i,isActive:a,handleToggle:c,canToggle:l,label:"Blockquote",shortcutKeys:Lg,Icon:Ig}}function Y9({shortcutKeys:t=Pg}){return g.jsx(vt,{children:gt({shortcutKeys:t})})}const Uc=y.forwardRef(({editor:t,text:e,hideWhenUnavailable:n=!1,onToggled:r,showShortcut:o=!1,onClick:i,children:s,...l},a)=>{const{editor:c}=ie(t),{isVisible:u,canToggle:d,isActive:f,handleToggle:h,label:p,shortcutKeys:m,Icon:v}=eE({editor:c,hideWhenUnavailable:n,onToggled:r}),b=y.useCallback(C=>{i?.(C),!C.defaultPrevented&&h()},[h,i]);return u?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":f?"on":"off",role:"button",disabled:!d,"data-disabled":!d,tabIndex:-1,"aria-label":p,"aria-pressed":f,tooltip:"Code Block",onClick:b,...l,ref:a,children:s??g.jsxs(g.Fragment,{children:[g.jsx(v,{className:"tiptap-button-icon"}),e&&g.jsx("span",{className:"tiptap-button-text",children:e}),o&&g.jsx(Y9,{shortcutKeys:m})]})}):null});Uc.displayName="CodeBlockButton";const Dg=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.70711 2.29289C7.09763 2.68342 7.09763 3.31658 6.70711 3.70711L4.41421 6L6.70711 8.29289C7.09763 8.68342 7.09763 9.31658 6.70711 9.70711C6.31658 10.0976 5.68342 10.0976 5.29289 9.70711L2.29289 6.70711C1.90237 6.31658 1.90237 5.68342 2.29289 5.29289L5.29289 2.29289C5.68342 1.90237 6.31658 1.90237 6.70711 2.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.2929 2.29289C10.6834 1.90237 11.3166 1.90237 11.7071 2.29289L14.7071 5.29289C15.0976 5.68342 15.0976 6.31658 14.7071 6.70711L11.7071 9.70711C11.3166 10.0976 10.6834 10.0976 10.2929 9.70711C9.90237 9.31658 9.90237 8.68342 10.2929 8.29289L12.5858 6L10.2929 3.70711C9.90237 3.31658 9.90237 2.68342 10.2929 2.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17 4C17 3.44772 17.4477 3 18 3H19C20.6569 3 22 4.34315 22 6V18C22 19.6569 20.6569 21 19 21H5C3.34315 21 2 19.6569 2 18V12C2 11.4477 2.44772 11 3 11C3.55228 11 4 11.4477 4 12V18C4 18.5523 4.44772 19 5 19H19C19.5523 19 20 18.5523 20 18V6C20 5.44772 19.5523 5 19 5H18C17.4477 5 17 4.55228 17 4Z",fill:"currentColor"})]}));Dg.displayName="CodeBlockIcon";const Pg="mod+alt+c";function Wc(t,e=!0){if(!t||!t.isEditable||!_t("codeBlock",t)||Ht(t,["image"]))return!1;if(!e)return t.can().toggleNode("codeBlock","paragraph");try{const r=t.view.state,o=r.selection;if(o.empty||o instanceof V){const i=hn({editor:t,node:r.selection.$anchor.node(1)})?.pos;if(!yt(i))return!1}return!0}catch{return!1}}function X9(t){if(!t||!t.isEditable||!Wc(t))return!1;try{const e=t.view;let n=e.state,r=n.tr;if(n.selection.empty||n.selection instanceof V){const l=hn({editor:t,node:n.selection.$anchor.node(1)})?.pos;if(!yt(l))return!1;r=r.setSelection(B.create(n.doc,l)),e.dispatch(r),n=e.state}const o=n.selection;let i=t.chain().focus();if(o instanceof B){const l=o.node.firstChild?.firstChild,a=o.node.lastChild?.lastChild,c=l?o.from+l.nodeSize:o.from+1,u=a?o.to-a.nodeSize:o.to-1;i=i.setTextSelection({from:c,to:u}).clearNodes()}return(t.isActive("codeBlock")?i.setNode("paragraph"):i.toggleNode("codeBlock","paragraph")).run(),t.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function Q9(t){const{editor:e,hideWhenUnavailable:n}=t;return!e||!e.isEditable||!_t("codeBlock",e)?!1:n&&!e.isActive("code")?Wc(e):!0}function eE(t){const{editor:e,hideWhenUnavailable:n=!1,onToggled:r}=t||{},{editor:o}=ie(e),[i,s]=y.useState(!0),l=Wc(o),a=o?.isActive("codeBlock")||!1;y.useEffect(()=>{if(!o)return;const u=()=>{s(Q9({editor:o,hideWhenUnavailable:n}))};return u(),o.on("selectionUpdate",u),()=>{o.off("selectionUpdate",u)}},[o,n]);const c=y.useCallback(()=>{if(!o)return!1;const u=X9(o);return u&&r?.(),u},[o,r]);return{isVisible:i,isActive:a,handleToggle:c,canToggle:l,label:"Code Block",shortcutKeys:Pg,Icon:Dg}}const jg=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.43471 4.01458C4.34773 4.06032 4.26607 4.11977 4.19292 4.19292C4.11977 4.26607 4.06032 4.34773 4.01458 4.43471C2.14611 6.40628 1 9.0693 1 12C1 18.0751 5.92487 23 12 23C14.9306 23 17.5936 21.854 19.5651 19.9856C19.6522 19.9398 19.7339 19.8803 19.8071 19.8071C19.8803 19.7339 19.9398 19.6522 19.9856 19.5651C21.854 17.5936 23 14.9306 23 12C23 5.92487 18.0751 1 12 1C9.0693 1 6.40628 2.14611 4.43471 4.01458ZM6.38231 4.9681C7.92199 3.73647 9.87499 3 12 3C16.9706 3 21 7.02944 21 12C21 14.125 20.2635 16.078 19.0319 17.6177L6.38231 4.9681ZM17.6177 19.0319C16.078 20.2635 14.125 21 12 21C7.02944 21 3 16.9706 3 12C3 9.87499 3.73647 7.92199 4.9681 6.38231L17.6177 19.0319Z",fill:"currentColor"})}));jg.displayName="BanIcon";const ys=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.7072 4.70711C15.0977 4.31658 15.0977 3.68342 14.7072 3.29289C14.3167 2.90237 13.6835 2.90237 13.293 3.29289L8.69294 7.89286L8.68594 7.9C8.13626 8.46079 7.82837 9.21474 7.82837 10C7.82837 10.2306 7.85491 10.4584 7.90631 10.6795L2.29289 16.2929C2.10536 16.4804 2 16.7348 2 17V20C2 20.5523 2.44772 21 3 21H12C12.2652 21 12.5196 20.8946 12.7071 20.7071L15.3205 18.0937C15.5416 18.1452 15.7695 18.1717 16.0001 18.1717C16.7853 18.1717 17.5393 17.8639 18.1001 17.3142L22.7072 12.7071C23.0977 12.3166 23.0977 11.6834 22.7072 11.2929C22.3167 10.9024 21.6835 10.9024 21.293 11.2929L16.6971 15.8887C16.5105 16.0702 16.2605 16.1717 16.0001 16.1717C15.7397 16.1717 15.4897 16.0702 15.303 15.8887L10.1113 10.697C9.92992 10.5104 9.82837 10.2604 9.82837 10C9.82837 9.73963 9.92992 9.48958 10.1113 9.30297L14.7072 4.70711ZM13.5858 17L9.00004 12.4142L4 17.4142V19H11.5858L13.5858 17Z",fill:"currentColor"})}));ys.displayName="HighlighterIcon";var vs="Popover",[Bg]=dr(vs,[us]),ao=us(),[tE,pn]=Bg(vs),_g=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!1}=t,l=ao(e),a=y.useRef(null),[c,u]=y.useState(!1),[d,f]=yc({prop:r,defaultProp:o??!1,onChange:i,caller:vs});return g.jsx(y1,{...l,children:g.jsx(tE,{scope:e,contentId:Pi(),triggerRef:a,open:d,onOpenChange:f,onOpenToggle:y.useCallback(()=>f(h=>!h),[f]),hasCustomAnchor:c,onCustomAnchorAdd:y.useCallback(()=>u(!0),[]),onCustomAnchorRemove:y.useCallback(()=>u(!1),[]),modal:s,children:n})})};_g.displayName=vs;var Hg="PopoverAnchor",nE=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=pn(Hg,n),i=ao(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:l}=o;return y.useEffect(()=>(s(),()=>l()),[s,l]),g.jsx(wc,{...i,...r,ref:e})});nE.displayName=Hg;var Fg="PopoverTrigger",$g=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=pn(Fg,n),i=ao(n),s=Oe(e,o.triggerRef),l=g.jsx(Te.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Kg(o.open),...r,ref:s,onClick:J(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?l:g.jsx(wc,{asChild:!0,...i,children:l})});$g.displayName=Fg;var Kc="PopoverPortal",[rE,oE]=Bg(Kc,{forceMount:void 0}),Vg=t=>{const{__scopePopover:e,forceMount:n,children:r,container:o}=t,i=pn(Kc,e);return g.jsx(rE,{scope:e,forceMount:n,children:g.jsx(Dn,{present:n||i.open,children:g.jsx(Sc,{asChild:!0,container:o,children:r})})})};Vg.displayName=Kc;var lr="PopoverContent",zg=y.forwardRef((t,e)=>{const n=oE(lr,t.__scopePopover),{forceMount:r=n.forceMount,...o}=t,i=pn(lr,t.__scopePopover);return g.jsx(Dn,{present:r||i.open,children:i.modal?g.jsx(sE,{...o,ref:e}):g.jsx(lE,{...o,ref:e})})});zg.displayName=lr;var iE=qr("PopoverContent.RemoveScroll"),sE=y.forwardRef((t,e)=>{const n=pn(lr,t.__scopePopover),r=y.useRef(null),o=Oe(e,r),i=y.useRef(!1);return y.useEffect(()=>{const s=r.current;if(s)return T1(s)},[]),g.jsx(kc,{as:iE,allowPinchZoom:!0,children:g.jsx(Ug,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:J(t.onCloseAutoFocus,s=>{s.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:J(t.onPointerDownOutside,s=>{const l=s.detail.originalEvent,a=l.button===0&&l.ctrlKey===!0,c=l.button===2||a;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:J(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),lE=y.forwardRef((t,e)=>{const n=pn(lr,t.__scopePopover),r=y.useRef(!1),o=y.useRef(!1);return g.jsx(Ug,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;n.triggerRef.current?.contains(s)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),Ug=y.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:c,onInteractOutside:u,...d}=t,f=pn(lr,n),h=ao(n);return i1(),g.jsx(bc,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:g.jsx(vc,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:c,onDismiss:()=>f.onOpenChange(!1),children:g.jsx(v1,{"data-state":Kg(f.open),role:"dialog",id:f.contentId,...h,...d,ref:e,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Wg="PopoverClose",aE=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=pn(Wg,n);return g.jsx(Te.button,{type:"button",...r,ref:e,onClick:J(t.onClick,()=>o.onOpenChange(!1))})});aE.displayName=Wg;var cE="PopoverArrow",uE=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=ao(n);return g.jsx(b1,{...o,...r,ref:e})});uE.displayName=cE;function Kg(t){return t?"open":"closed"}var dE=_g,fE=$g,hE=Vg,pE=zg;function qg({...t}){return g.jsx(dE,{...t})}function Gg({...t}){return g.jsx(fE,{...t})}function Jg({className:t,align:e="center",sideOffset:n=4,...r}){return g.jsx(hE,{children:g.jsx(pE,{align:e,sideOffset:n,className:Me("tiptap-popover",t),...r})})}function mE({shortcutKeys:t=ha}){return g.jsx(vt,{children:gt({shortcutKeys:t})})}const Zg=y.forwardRef(({editor:t,highlightColor:e,text:n,hideWhenUnavailable:r=!1,onApplied:o,showShortcut:i=!1,onClick:s,children:l,style:a,...c},u)=>{const{editor:d}=ie(t),{isVisible:f,canColorHighlight:h,isActive:p,handleColorHighlight:m,label:v,shortcutKeys:b}=Gc({editor:d,highlightColor:e,label:n||`Toggle highlight (${e})`,hideWhenUnavailable:r,onApplied:o}),C=y.useCallback(w=>{s?.(w),!w.defaultPrevented&&m()},[m,s]),x=y.useMemo(()=>({...a,"--highlight-color":e}),[e,a]);return f?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":p?"on":"off",role:"button",tabIndex:-1,disabled:!h,"data-disabled":!h,"aria-label":v,"aria-pressed":p,tooltip:v,onClick:C,style:x,...c,ref:u,children:l??g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"tiptap-button-highlight",style:{"--highlight-color":e}}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(mE,{shortcutKeys:b})]})}):null});Zg.displayName="ColorHighlightButton";const ha="mod+shift+h",gE=[{label:"Default background",value:"var(--tt-bg-color)",border:"var(--tt-bg-color-contrast)"},{label:"Gray background",value:"var(--tt-color-highlight-gray)",border:"var(--tt-color-highlight-gray-contrast)"},{label:"Brown background",value:"var(--tt-color-highlight-brown)",border:"var(--tt-color-highlight-brown-contrast)"},{label:"Orange background",value:"var(--tt-color-highlight-orange)",border:"var(--tt-color-highlight-orange-contrast)"},{label:"Yellow background",value:"var(--tt-color-highlight-yellow)",border:"var(--tt-color-highlight-yellow-contrast)"},{label:"Green background",value:"var(--tt-color-highlight-green)",border:"var(--tt-color-highlight-green-contrast)"},{label:"Blue background",value:"var(--tt-color-highlight-blue)",border:"var(--tt-color-highlight-blue-contrast)"},{label:"Purple background",value:"var(--tt-color-highlight-purple)",border:"var(--tt-color-highlight-purple-contrast)"},{label:"Pink background",value:"var(--tt-color-highlight-pink)",border:"var(--tt-color-highlight-pink-contrast)"},{label:"Red background",value:"var(--tt-color-highlight-red)",border:"var(--tt-color-highlight-red-contrast)"}];function Yg(t){const e=new Map(gE.map(n=>[n.value,n]));return t.map(n=>e.get(n)).filter(n=>!!n)}function qc(t){return!t||!t.isEditable||!ro("highlight",t)||Ht(t,["image"])?!1:t.can().setMark("highlight")}function yE(t,e){return!t||!t.isEditable?!1:e?t.isActive("highlight",{color:e}):t.isActive("highlight")}function vE(t){return!t||!t.isEditable||!qc(t)?!1:t.chain().focus().unsetMark("highlight").run()}function bE(t){const{editor:e,hideWhenUnavailable:n}=t;return!e||!e.isEditable||!ro("highlight",e)?!1:n&&!e.isActive("code")?qc(e):!0}function Gc(t){const{editor:e,label:n,highlightColor:r,hideWhenUnavailable:o=!1,onApplied:i}=t,{editor:s}=ie(e),l=hr(),[a,c]=y.useState(!0),u=qc(s),d=yE(s,r);y.useEffect(()=>{if(!s)return;const p=()=>{c(bE({editor:s,hideWhenUnavailable:o}))};return p(),s.on("selectionUpdate",p),()=>{s.off("selectionUpdate",p)}},[s,o]);const f=y.useCallback(()=>{if(!s||!u||!r||!n)return!1;if(s.state.storedMarks){const p=s.schema.marks.highlight;p&&s.view.dispatch(s.state.tr.removeStoredMark(p))}setTimeout(()=>{const p=s.chain().focus().toggleMark("highlight",{color:r}).run();return p&&i?.({color:r,label:n}),p},0)},[u,r,s,n,i]),h=y.useCallback(()=>{const p=vE(s);return p&&i?.({color:"",label:"Remove highlight"}),p},[s,i]);return Mg(ha,p=>{p.preventDefault(),f()},{enabled:a&&u,enableOnContentEditable:!l,enableOnFormTags:!0}),{isVisible:a,isActive:d,handleColorHighlight:f,handleRemoveHighlight:h,canColorHighlight:u,label:n||"Highlight",shortcutKeys:ha,Icon:ys}}const Jc=y.forwardRef(({className:t,children:e,...n},r)=>g.jsx(fe,{type:"button",className:t,"data-style":"ghost","data-appearance":"default",role:"button",tabIndex:-1,"aria-label":"Highlight text",tooltip:"Highlight",ref:r,...n,children:e??g.jsx(ys,{className:"tiptap-button-icon"})}));Jc.displayName="ColorHighlightPopoverButton";function Xg({editor:t,colors:e=Yg(["var(--tt-color-highlight-green)","var(--tt-color-highlight-blue)","var(--tt-color-highlight-red)","var(--tt-color-highlight-purple)","var(--tt-color-highlight-yellow)"])}){const{handleRemoveHighlight:n}=Gc({editor:t}),r=hr(),o=y.useRef(null),i=y.useMemo(()=>[...e,{label:"Remove highlight",value:"none"}],[e]),{selectedIndex:s}=$m({containerRef:o,items:i,orientation:"both",onSelect:l=>{if(!o.current)return!1;const a=o.current.querySelector('[data-highlighted="true"]');a&&a.click(),l.value==="none"&&n()},autoSelectFirstItem:!1});return g.jsx(fr,{ref:o,tabIndex:0,style:r?{boxShadow:"none",border:0}:{},children:g.jsx(lo,{style:r?{padding:0}:{},children:g.jsxs(Dc,{orientation:"horizontal",children:[g.jsx(In,{orientation:"horizontal",children:e.map((l,a)=>g.jsx(Zg,{editor:t,highlightColor:l.value,tooltip:l.label,"aria-label":`${l.label} highlight color`,tabIndex:a===s?0:-1,"data-highlighted":s===a},l.value))}),g.jsx(as,{}),g.jsx(In,{orientation:"horizontal",children:g.jsx(fe,{onClick:n,"aria-label":"Remove highlight",tooltip:"Remove highlight",tabIndex:s===e.length?0:-1,type:"button",role:"menuitem","data-style":"ghost","data-highlighted":s===e.length,children:g.jsx(jg,{className:"tiptap-button-icon"})})})]})})})}function CE({editor:t,colors:e=Yg(["var(--tt-color-highlight-green)","var(--tt-color-highlight-blue)","var(--tt-color-highlight-red)","var(--tt-color-highlight-purple)","var(--tt-color-highlight-yellow)"]),hideWhenUnavailable:n=!1,onApplied:r,...o}){const{editor:i}=ie(t),[s,l]=y.useState(!1),{isVisible:a,canColorHighlight:c,isActive:u,label:d,Icon:f}=Gc({editor:i,hideWhenUnavailable:n,onApplied:r});return a?g.jsxs(qg,{open:s,onOpenChange:l,children:[g.jsx(Gg,{asChild:!0,children:g.jsx(Jc,{disabled:!c,"data-active-state":u?"on":"off","data-disabled":!c,"aria-pressed":u,"aria-label":d,tooltip:d,...o,children:g.jsx(f,{className:"tiptap-button-icon"})})}),g.jsx(Jg,{"aria-label":"Highlight colors",children:g.jsx(Xg,{editor:i,colors:e})})]}):null}const Qg=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M21 4C21 3.44772 20.5523 3 20 3C19.4477 3 19 3.44772 19 4V11C19 11.7956 18.6839 12.5587 18.1213 13.1213C17.5587 13.6839 16.7956 14 16 14H6.41421L9.70711 10.7071C10.0976 10.3166 10.0976 9.68342 9.70711 9.29289C9.31658 8.90237 8.68342 8.90237 8.29289 9.29289L3.29289 14.2929C2.90237 14.6834 2.90237 15.3166 3.29289 15.7071L8.29289 20.7071C8.68342 21.0976 9.31658 21.0976 9.70711 20.7071C10.0976 20.3166 10.0976 19.6834 9.70711 19.2929L6.41421 16H16C17.3261 16 18.5979 15.4732 19.5355 14.5355C20.4732 13.5979 21 12.3261 21 11V4Z",fill:"currentColor"})}));Qg.displayName="CornerDownLeftIcon";const e0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M14 3C14 2.44772 14.4477 2 15 2H21C21.5523 2 22 2.44772 22 3V9C22 9.55228 21.5523 10 21 10C20.4477 10 20 9.55228 20 9V5.41421L10.7071 14.7071C10.3166 15.0976 9.68342 15.0976 9.29289 14.7071C8.90237 14.3166 8.90237 13.6834 9.29289 13.2929L18.5858 4H15C14.4477 4 14 3.55228 14 3Z",fill:"currentColor"}),g.jsx("path",{d:"M4.29289 7.29289C4.48043 7.10536 4.73478 7 5 7H11C11.5523 7 12 6.55228 12 6C12 5.44772 11.5523 5 11 5H5C4.20435 5 3.44129 5.31607 2.87868 5.87868C2.31607 6.44129 2 7.20435 2 8V19C2 19.7957 2.31607 20.5587 2.87868 21.1213C3.44129 21.6839 4.20435 22 5 22H16C16.7957 22 17.5587 21.6839 18.1213 21.1213C18.6839 20.5587 19 19.7957 19 19V13C19 12.4477 18.5523 12 18 12C17.4477 12 17 12.4477 17 13V19C17 19.2652 16.8946 19.5196 16.7071 19.7071C16.5196 19.8946 16.2652 20 16 20H5C4.73478 20 4.48043 19.8946 4.29289 19.7071C4.10536 19.5196 4 19.2652 4 19V8C4 7.73478 4.10536 7.48043 4.29289 7.29289Z",fill:"currentColor"})]}));e0.displayName="ExternalLinkIcon";const bs=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M16.9958 1.06669C15.4226 1.05302 13.907 1.65779 12.7753 2.75074L12.765 2.76086L11.045 4.47086C10.6534 4.86024 10.6515 5.49341 11.0409 5.88507C11.4303 6.27673 12.0634 6.27858 12.4551 5.88919L14.1697 4.18456C14.9236 3.45893 15.9319 3.05752 16.9784 3.06662C18.0272 3.07573 19.0304 3.49641 19.772 4.23804C20.5137 4.97967 20.9344 5.98292 20.9435 7.03171C20.9526 8.07776 20.5515 9.08563 19.8265 9.83941L16.833 12.8329C16.4274 13.2386 15.9393 13.5524 15.4019 13.7529C14.8645 13.9533 14.2903 14.0359 13.7181 13.9949C13.146 13.9539 12.5894 13.7904 12.0861 13.5154C11.5827 13.2404 11.1444 12.8604 10.8008 12.401C10.47 11.9588 9.84333 11.8685 9.40108 12.1993C8.95883 12.5301 8.86849 13.1568 9.1993 13.599C9.71464 14.288 10.3721 14.858 11.1272 15.2705C11.8822 15.683 12.7171 15.9283 13.5753 15.9898C14.4334 16.0513 15.2948 15.9274 16.1009 15.6267C16.907 15.326 17.639 14.8555 18.2473 14.247L21.2472 11.2471L21.2593 11.2347C22.3523 10.1031 22.9571 8.58751 22.9434 7.01433C22.9297 5.44115 22.2987 3.93628 21.1863 2.82383C20.0738 1.71138 18.5689 1.08036 16.9958 1.06669Z",fill:"currentColor"}),g.jsx("path",{d:"M10.4247 8.0102C9.56657 7.94874 8.70522 8.07256 7.89911 8.37326C7.09305 8.67395 6.36096 9.14458 5.75272 9.753L2.75285 12.7529L2.74067 12.7653C1.64772 13.8969 1.04295 15.4125 1.05662 16.9857C1.07029 18.5589 1.70131 20.0637 2.81376 21.1762C3.9262 22.2886 5.43108 22.9196 7.00426 22.9333C8.57744 22.947 10.0931 22.3422 11.2247 21.2493L11.2371 21.2371L12.9471 19.5271C13.3376 19.1366 13.3376 18.5034 12.9471 18.1129C12.5565 17.7223 11.9234 17.7223 11.5328 18.1129L9.82932 19.8164C9.07555 20.5414 8.06768 20.9425 7.02164 20.9334C5.97285 20.9243 4.9696 20.5036 4.22797 19.762C3.48634 19.0203 3.06566 18.0171 3.05655 16.9683C3.04746 15.9222 3.44851 14.9144 4.17355 14.1606L7.16719 11.167C7.5727 10.7613 8.06071 10.4476 8.59811 10.2471C9.13552 10.0467 9.70976 9.96412 10.2819 10.0051C10.854 10.0461 11.4106 10.2096 11.9139 10.4846C12.4173 10.7596 12.8556 11.1397 13.1992 11.599C13.53 12.0412 14.1567 12.1316 14.5989 11.8007C15.0412 11.4699 15.1315 10.8433 14.8007 10.401C14.2854 9.71205 13.6279 9.14198 12.8729 8.72948C12.1178 8.31697 11.2829 8.07166 10.4247 8.0102Z",fill:"currentColor"})]}));bs.displayName="LinkIcon";const t0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 5V4C7 3.17477 7.40255 2.43324 7.91789 1.91789C8.43324 1.40255 9.17477 1 10 1H14C14.8252 1 15.5668 1.40255 16.0821 1.91789C16.5975 2.43324 17 3.17477 17 4V5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H20V20C20 20.8252 19.5975 21.5668 19.0821 22.0821C18.5668 22.5975 17.8252 23 17 23H7C6.17477 23 5.43324 22.5975 4.91789 22.0821C4.40255 21.5668 4 20.8252 4 20V7H3C2.44772 7 2 6.55228 2 6C2 5.44772 2.44772 5 3 5H7ZM9 4C9 3.82523 9.09745 3.56676 9.33211 3.33211C9.56676 3.09745 9.82523 3 10 3H14C14.1748 3 14.4332 3.09745 14.6679 3.33211C14.9025 3.56676 15 3.82523 15 4V5H9V4ZM6 7V20C6 20.1748 6.09745 20.4332 6.33211 20.6679C6.56676 20.9025 6.82523 21 7 21H17C17.1748 21 17.4332 20.9025 17.6679 20.6679C17.9025 20.4332 18 20.1748 18 20V7H6Z",fill:"currentColor"})}));t0.displayName="TrashIcon";function xE({className:t,type:e,...n}){return g.jsx("input",{type:e,className:Me("tiptap-input",t),...n})}function wE({className:t,children:e,...n}){return g.jsx("div",{className:Me("tiptap-input-group",t),...n,children:e})}const Zc=y.forwardRef(({className:t,children:e,...n},r)=>g.jsx(fe,{type:"button",className:t,"data-style":"ghost",role:"button",tabIndex:-1,"aria-label":"Link",tooltip:"Link",ref:r,...n,children:e||g.jsx(bs,{className:"tiptap-button-icon"})}));Zc.displayName="LinkButton";const n0=({url:t,setUrl:e,setLink:n,removeLink:r,openLink:o,isActive:i})=>{const s=hr(),l=a=>{a.key==="Enter"&&(a.preventDefault(),n())};return g.jsx(fr,{style:{...s?{boxShadow:"none",border:0}:{}},children:g.jsx(lo,{style:{...s?{padding:0}:{}},children:g.jsxs(Dc,{orientation:"horizontal",children:[g.jsx(wE,{children:g.jsx(xE,{type:"url",placeholder:"Paste a link...",value:t,onChange:a=>e(a.target.value),onKeyDown:l,autoFocus:!0,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off"})}),g.jsx(In,{orientation:"horizontal",children:g.jsx(fe,{type:"button",onClick:n,title:"Apply link",disabled:!t&&!i,"data-style":"ghost",children:g.jsx(Qg,{className:"tiptap-button-icon"})})}),g.jsx(as,{}),g.jsxs(In,{orientation:"horizontal",children:[g.jsx(fe,{type:"button",onClick:o,title:"Open in new window",disabled:!t&&!i,"data-style":"ghost",children:g.jsx(e0,{className:"tiptap-button-icon"})}),g.jsx(fe,{type:"button",onClick:r,title:"Remove link",disabled:!t&&!i,"data-style":"ghost",children:g.jsx(t0,{className:"tiptap-button-icon"})})]})]})})})},SE=({editor:t})=>{const e=s0({editor:t});return g.jsx(n0,{...e})},r0=y.forwardRef(({editor:t,hideWhenUnavailable:e=!1,onSetLink:n,onOpenChange:r,autoOpenOnLinkActive:o=!0,onClick:i,children:s,...l},a)=>{const{editor:c}=ie(t),[u,d]=y.useState(!1),{isVisible:f,canSet:h,isActive:p,url:m,setUrl:v,setLink:b,removeLink:C,openLink:x,label:w,Icon:E}=s0({editor:c,hideWhenUnavailable:e,onSetLink:n}),k=y.useCallback(N=>{d(N),r?.(N)},[r]),S=y.useCallback(()=>{b(),d(!1)},[b]),M=y.useCallback(N=>{i?.(N),!N.defaultPrevented&&d(!u)},[i,u]);return y.useEffect(()=>{o&&p&&d(!0)},[o,p]),f?g.jsxs(qg,{open:u,onOpenChange:k,children:[g.jsx(Gg,{asChild:!0,children:g.jsx(Zc,{disabled:!h,"data-active-state":p?"on":"off","data-disabled":!h,"aria-label":w,"aria-pressed":p,onClick:M,...l,ref:a,children:s??g.jsx(E,{className:"tiptap-button-icon"})})}),g.jsx(Jg,{children:g.jsx(n0,{url:m,setUrl:v,setLink:S,removeLink:C,openLink:x,isActive:p})})]}):null});r0.displayName="LinkPopover";function o0(t){return!t||!t.isEditable?!1:t.can().setMark("link")}function i0(t){return!t||!t.isEditable?!1:t.isActive("link")}function kE(t){const{editor:e,hideWhenUnavailable:n}=t;return!ro("link",e)||!e?!1:n&&!e.isActive("code")?o0(e):!0}function EE(t){const{editor:e,onSetLink:n}=t,[r,o]=y.useState(null);y.useEffect(()=>{if(!e)return;const{href:a}=e.getAttributes("link");i0(e)&&r===null&&o(a||"")},[e,r]),y.useEffect(()=>{if(!e)return;const a=()=>{const{href:c}=e.getAttributes("link");o(c||"")};return e.on("selectionUpdate",a),()=>{e.off("selectionUpdate",a)}},[e]);const i=y.useCallback(()=>{if(!r||!e)return;const{selection:a}=e.state,c=a.empty;let u=e.chain().focus();u=u.extendMarkRange("link").setLink({href:r}),c&&(u=u.insertContent({type:"text",text:r})),u.run(),o(null),n?.()},[e,n,r]),s=y.useCallback(()=>{e&&(e.chain().focus().extendMarkRange("link").unsetLink().setMeta("preventAutolink",!0).run(),o(""))},[e]),l=y.useCallback((a="_blank",c="noopener,noreferrer")=>{if(!r)return;const u=K5(r,window.location.href);u!=="#"&&window.open(u,a,c)},[r]);return{url:r||"",setUrl:o,setLink:i,removeLink:s,openLink:l}}function ME(t){const{editor:e,hideWhenUnavailable:n=!1}=t,r=o0(e),o=i0(e),[i,s]=y.useState(!1);return y.useEffect(()=>{if(!e)return;const l=()=>{s(kE({editor:e,hideWhenUnavailable:n}))};return l(),e.on("selectionUpdate",l),()=>{e.off("selectionUpdate",l)}},[e,n]),{isVisible:i,canSet:r,isActive:o}}function s0(t){const{editor:e,hideWhenUnavailable:n=!1,onSetLink:r}=t||{},{editor:o}=ie(e),{isVisible:i,canSet:s,isActive:l}=ME({editor:o,hideWhenUnavailable:n}),a=EE({editor:o,onSetLink:r});return{isVisible:i,canSet:s,isActive:l,label:"Link",Icon:bs,...a}}function TE({type:t,shortcutKeys:e=p0[t]}){return g.jsx(vt,{children:gt({shortcutKeys:e})})}const Et=y.forwardRef(({editor:t,type:e,text:n,hideWhenUnavailable:r=!1,onToggled:o,showShortcut:i=!1,onClick:s,children:l,...a},c)=>{const{editor:u}=ie(t),{isVisible:d,handleMark:f,label:h,canToggle:p,isActive:m,Icon:v,shortcutKeys:b}=LE({editor:u,type:e,hideWhenUnavailable:r,onToggled:o}),C=y.useCallback(x=>{s?.(x),!x.defaultPrevented&&f()},[f,s]);return d?g.jsx(fe,{type:"button",disabled:!p,"data-style":"ghost","data-active-state":m?"on":"off","data-disabled":!p,role:"button",tabIndex:-1,"aria-label":h,"aria-pressed":m,tooltip:h,onClick:C,...a,ref:c,children:l??g.jsxs(g.Fragment,{children:[g.jsx(v,{className:"tiptap-button-icon"}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(TE,{type:e,shortcutKeys:b})]})}):null});Et.displayName="MarkButton";const l0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 2.5C5.17157 2.5 4.5 3.17157 4.5 4V20C4.5 20.8284 5.17157 21.5 6 21.5H15C16.4587 21.5 17.8576 20.9205 18.8891 19.8891C19.9205 18.8576 20.5 17.4587 20.5 16C20.5 14.5413 19.9205 13.1424 18.8891 12.1109C18.6781 11.9 18.4518 11.7079 18.2128 11.5359C19.041 10.5492 19.5 9.29829 19.5 8C19.5 6.54131 18.9205 5.14236 17.8891 4.11091C16.8576 3.07946 15.4587 2.5 14 2.5H6ZM14 10.5C14.663 10.5 15.2989 10.2366 15.7678 9.76777C16.2366 9.29893 16.5 8.66304 16.5 8C16.5 7.33696 16.2366 6.70107 15.7678 6.23223C15.2989 5.76339 14.663 5.5 14 5.5H7.5V10.5H14ZM7.5 18.5V13.5H15C15.663 13.5 16.2989 13.7634 16.7678 14.2322C17.2366 14.7011 17.5 15.337 17.5 16C17.5 16.663 17.2366 17.2989 16.7678 17.7678C16.2989 18.2366 15.663 18.5 15 18.5H7.5Z",fill:"currentColor"})}));l0.displayName="BoldIcon";const a0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M15.4545 4.2983C15.6192 3.77115 15.3254 3.21028 14.7983 3.04554C14.2712 2.88081 13.7103 3.1746 13.5455 3.70175L8.54554 19.7017C8.38081 20.2289 8.6746 20.7898 9.20175 20.9545C9.72889 21.1192 10.2898 20.8254 10.4545 20.2983L15.4545 4.2983Z",fill:"currentColor"}),g.jsx("path",{d:"M6.70711 7.29289C7.09763 7.68342 7.09763 8.31658 6.70711 8.70711L3.41421 12L6.70711 15.2929C7.09763 15.6834 7.09763 16.3166 6.70711 16.7071C6.31658 17.0976 5.68342 17.0976 5.29289 16.7071L1.29289 12.7071C0.902369 12.3166 0.902369 11.6834 1.29289 11.2929L5.29289 7.29289C5.68342 6.90237 6.31658 6.90237 6.70711 7.29289Z",fill:"currentColor"}),g.jsx("path",{d:"M17.2929 7.29289C17.6834 6.90237 18.3166 6.90237 18.7071 7.29289L22.7071 11.2929C23.0976 11.6834 23.0976 12.3166 22.7071 12.7071L18.7071 16.7071C18.3166 17.0976 17.6834 17.0976 17.2929 16.7071C16.9024 16.3166 16.9024 15.6834 17.2929 15.2929L20.5858 12L17.2929 8.70711C16.9024 8.31658 16.9024 7.68342 17.2929 7.29289Z",fill:"currentColor"})]}));a0.displayName="Code2Icon";const c0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{d:"M15.0222 3H19C19.5523 3 20 3.44772 20 4C20 4.55228 19.5523 5 19 5H15.693L10.443 19H14C14.5523 19 15 19.4477 15 20C15 20.5523 14.5523 21 14 21H9.02418C9.00802 21.0004 8.99181 21.0004 8.97557 21H5C4.44772 21 4 20.5523 4 20C4 19.4477 4.44772 19 5 19H8.30704L13.557 5H10C9.44772 5 9 4.55228 9 4C9 3.44772 9.44772 3 10 3H14.9782C14.9928 2.99968 15.0075 2.99967 15.0222 3Z",fill:"currentColor"})}));c0.displayName="ItalicIcon";const u0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M9.00039 3H16.0001C16.5524 3 17.0001 3.44772 17.0001 4C17.0001 4.55229 16.5524 5 16.0001 5H9.00011C8.68006 4.99983 8.36412 5.07648 8.07983 5.22349C7.79555 5.37051 7.55069 5.5836 7.36585 5.84487C7.181 6.10614 7.06155 6.40796 7.01754 6.72497C6.97352 7.04198 7.00623 7.36492 7.11292 7.66667C7.29701 8.18737 7.02414 8.75872 6.50344 8.94281C5.98274 9.1269 5.4114 8.85403 5.2273 8.33333C5.01393 7.72984 4.94851 7.08396 5.03654 6.44994C5.12456 5.81592 5.36346 5.21229 5.73316 4.68974C6.10285 4.1672 6.59256 3.74101 7.16113 3.44698C7.72955 3.15303 8.36047 2.99975 9.00039 3Z",fill:"currentColor"}),g.jsx("path",{d:"M18 13H20C20.5523 13 21 12.5523 21 12C21 11.4477 20.5523 11 20 11H4C3.44772 11 3 11.4477 3 12C3 12.5523 3.44772 13 4 13H14C14.7956 13 15.5587 13.3161 16.1213 13.8787C16.6839 14.4413 17 15.2044 17 16C17 16.7956 16.6839 17.5587 16.1213 18.1213C15.5587 18.6839 14.7956 19 14 19H6C5.44772 19 5 19.4477 5 20C5 20.5523 5.44772 21 6 21H14C15.3261 21 16.5979 20.4732 17.5355 19.5355C18.4732 18.5979 19 17.3261 19 16C19 14.9119 18.6453 13.8604 18 13Z",fill:"currentColor"})]}));u0.displayName="StrikeIcon";const d0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.29289 7.29289C3.68342 6.90237 4.31658 6.90237 4.70711 7.29289L12.7071 15.2929C13.0976 15.6834 13.0976 16.3166 12.7071 16.7071C12.3166 17.0976 11.6834 17.0976 11.2929 16.7071L3.29289 8.70711C2.90237 8.31658 2.90237 7.68342 3.29289 7.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.7071 7.29289C13.0976 7.68342 13.0976 8.31658 12.7071 8.70711L4.70711 16.7071C4.31658 17.0976 3.68342 17.0976 3.29289 16.7071C2.90237 16.3166 2.90237 15.6834 3.29289 15.2929L11.2929 7.29289C11.6834 6.90237 12.3166 6.90237 12.7071 7.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.4079 14.3995C18.0284 14.0487 18.7506 13.9217 19.4536 14.0397C20.1566 14.1578 20.7977 14.5138 21.2696 15.0481L21.2779 15.0574L21.2778 15.0575C21.7439 15.5988 22 16.2903 22 17C22 18.0823 21.3962 18.8401 20.7744 19.3404C20.194 19.8073 19.4858 20.141 18.9828 20.378C18.9638 20.387 18.9451 20.3958 18.9266 20.4045C18.4473 20.6306 18.2804 20.7817 18.1922 20.918C18.1773 20.9412 18.1619 20.9681 18.1467 21H21C21.5523 21 22 21.4477 22 22C22 22.5523 21.5523 23 21 23H17C16.4477 23 16 22.5523 16 22C16 21.1708 16.1176 20.4431 16.5128 19.832C16.9096 19.2184 17.4928 18.8695 18.0734 18.5956C18.6279 18.334 19.138 18.0901 19.5207 17.7821C19.8838 17.49 20 17.2477 20 17C20 16.7718 19.9176 16.5452 19.7663 16.3672C19.5983 16.1792 19.3712 16.0539 19.1224 16.0121C18.8722 15.9701 18.6152 16.015 18.3942 16.1394C18.1794 16.2628 18.0205 16.4549 17.9422 16.675C17.7572 17.1954 17.1854 17.4673 16.665 17.2822C16.1446 17.0972 15.8728 16.5254 16.0578 16.005C16.2993 15.3259 16.7797 14.7584 17.4039 14.4018L17.4079 14.3995L17.4079 14.3995Z",fill:"currentColor"})]}));d0.displayName="SubscriptIcon";const f0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.7071 7.29289C13.0976 7.68342 13.0976 8.31658 12.7071 8.70711L4.70711 16.7071C4.31658 17.0976 3.68342 17.0976 3.29289 16.7071C2.90237 16.3166 2.90237 15.6834 3.29289 15.2929L11.2929 7.29289C11.6834 6.90237 12.3166 6.90237 12.7071 7.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.29289 7.29289C3.68342 6.90237 4.31658 6.90237 4.70711 7.29289L12.7071 15.2929C13.0976 15.6834 13.0976 16.3166 12.7071 16.7071C12.3166 17.0976 11.6834 17.0976 11.2929 16.7071L3.29289 8.70711C2.90237 8.31658 2.90237 7.68342 3.29289 7.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.405 1.40657C18.0246 1.05456 18.7463 0.92634 19.4492 1.04344C20.1521 1.16054 20.7933 1.51583 21.2652 2.0497L21.2697 2.05469L21.2696 2.05471C21.7431 2.5975 22 3.28922 22 4.00203C22 5.08579 21.3952 5.84326 20.7727 6.34289C20.1966 6.80531 19.4941 7.13675 18.9941 7.37261C18.9714 7.38332 18.9491 7.39383 18.9273 7.40415C18.4487 7.63034 18.2814 7.78152 18.1927 7.91844C18.1778 7.94155 18.1625 7.96834 18.1473 8.00003H21C21.5523 8.00003 22 8.44774 22 9.00003C22 9.55231 21.5523 10 21 10H17C16.4477 10 16 9.55231 16 9.00003C16 8.17007 16.1183 7.44255 16.5138 6.83161C16.9107 6.21854 17.4934 5.86971 18.0728 5.59591C18.6281 5.33347 19.1376 5.09075 19.5208 4.78316C19.8838 4.49179 20 4.25026 20 4.00203C20 3.77192 19.9178 3.54865 19.7646 3.37182C19.5968 3.18324 19.3696 3.05774 19.1205 3.01625C18.8705 2.97459 18.6137 3.02017 18.3933 3.14533C18.1762 3.26898 18.0191 3.45826 17.9406 3.67557C17.7531 4.19504 17.18 4.46414 16.6605 4.27662C16.141 4.0891 15.8719 3.51596 16.0594 2.99649C16.303 2.3219 16.7817 1.76125 17.4045 1.40689L17.405 1.40657Z",fill:"currentColor"})]}));f0.displayName="SuperscriptIcon";const h0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 4C7 3.44772 6.55228 3 6 3C5.44772 3 5 3.44772 5 4V10C5 11.8565 5.7375 13.637 7.05025 14.9497C8.36301 16.2625 10.1435 17 12 17C13.8565 17 15.637 16.2625 16.9497 14.9497C18.2625 13.637 19 11.8565 19 10V4C19 3.44772 18.5523 3 18 3C17.4477 3 17 3.44772 17 4V10C17 11.3261 16.4732 12.5979 15.5355 13.5355C14.5979 14.4732 13.3261 15 12 15C10.6739 15 9.40215 14.4732 8.46447 13.5355C7.52678 12.5979 7 11.3261 7 10V4ZM4 19C3.44772 19 3 19.4477 3 20C3 20.5523 3.44772 21 4 21H20C20.5523 21 21 20.5523 21 20C21 19.4477 20.5523 19 20 19H4Z",fill:"currentColor"})}));h0.displayName="UnderlineIcon";const AE={bold:l0,italic:c0,underline:h0,strike:u0,code:a0,superscript:f0,subscript:d0},p0={bold:"mod+b",italic:"mod+i",underline:"mod+u",strike:"mod+shift+s",code:"mod+e",superscript:"mod+.",subscript:"mod+,"};function Yc(t,e){return!t||!t.isEditable||!ro(e,t)||Ht(t,["image"])?!1:t.can().toggleMark(e)}function RE(t,e){return!t||!t.isEditable?!1:t.isActive(e)}function OE(t,e){return!t||!t.isEditable||!Yc(t,e)?!1:t.chain().focus().toggleMark(e).run()}function NE(t){const{editor:e,type:n,hideWhenUnavailable:r}=t;return!e||!e.isEditable||!ro(n,e)?!1:r&&!e.isActive("code")?Yc(e,n):!0}function IE(t){return t.charAt(0).toUpperCase()+t.slice(1)}function LE(t){const{editor:e,type:n,hideWhenUnavailable:r=!1,onToggled:o}=t,{editor:i}=ie(e),[s,l]=y.useState(!0),a=Yc(i,n),c=RE(i,n);y.useEffect(()=>{if(!i)return;const d=()=>{l(NE({editor:i,type:n,hideWhenUnavailable:r}))};return d(),i.on("selectionUpdate",d),()=>{i.off("selectionUpdate",d)}},[i,n,r]);const u=y.useCallback(()=>{if(!i)return!1;const d=OE(i,n);return d&&o?.(),d},[i,n,o]);return{isVisible:s,isActive:c,handleMark:u,canToggle:a,label:IE(n),shortcutKeys:p0[n],Icon:AE[n]}}function DE({align:t,shortcutKeys:e=b0[t]}){return g.jsx(vt,{children:gt({shortcutKeys:e})})}const Zn=y.forwardRef(({editor:t,align:e,text:n,hideWhenUnavailable:r=!1,onAligned:o,showShortcut:i=!1,onClick:s,icon:l,children:a,...c},u)=>{const{editor:d}=ie(t),{isVisible:f,handleTextAlign:h,label:p,canAlign:m,isActive:v,Icon:b,shortcutKeys:C}=$E({editor:d,align:e,hideWhenUnavailable:r,onAligned:o}),x=y.useCallback(E=>{s?.(E),!E.defaultPrevented&&h()},[h,s]);if(!f)return null;const w=l??b;return g.jsx(fe,{type:"button",disabled:!m,"data-style":"ghost","data-active-state":v?"on":"off","data-disabled":!m,role:"button",tabIndex:-1,"aria-label":p,"aria-pressed":v,tooltip:p,onClick:x,...c,ref:u,children:a??g.jsxs(g.Fragment,{children:[g.jsx(w,{className:"tiptap-button-icon"}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(DE,{align:e,shortcutKeys:C})]})})});Zn.displayName="TextAlignButton";const m0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 12C6 11.4477 6.44772 11 7 11H17C17.5523 11 18 11.4477 18 12C18 12.5523 17.5523 13 17 13H7C6.44772 13 6 12.5523 6 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 18C4 17.4477 4.44772 17 5 17H19C19.5523 17 20 17.4477 20 18C20 18.5523 19.5523 19 19 19H5C4.44772 19 4 18.5523 4 18Z",fill:"currentColor"})]}));m0.displayName="AlignCenterIcon";const g0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]}));g0.displayName="AlignJustifyIcon";const y0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H15C15.5523 11 16 11.4477 16 12C16 12.5523 15.5523 13 15 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H17C17.5523 17 18 17.4477 18 18C18 18.5523 17.5523 19 17 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]}));y0.displayName="AlignLeftIcon";const v0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 12C8 11.4477 8.44772 11 9 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H9C8.44772 13 8 12.5523 8 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 18C6 17.4477 6.44772 17 7 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H7C6.44772 19 6 18.5523 6 18Z",fill:"currentColor"})]}));v0.displayName="AlignRightIcon";const b0={left:"mod+shift+l",center:"mod+shift+e",right:"mod+shift+r",justify:"mod+shift+j"},PE={left:y0,center:m0,right:v0,justify:g0},jE={left:"Align left",center:"Align center",right:"Align right",justify:"Align justify"};function Xc(t,e){return!t||!t.isEditable||!ls(t,"textAlign")||Ht(t,["image"])?!1:t.can().setTextAlign(e)}function BE(t){return"setTextAlign"in t}function _E(t,e){return!t||!t.isEditable?!1:t.isActive({textAlign:e})}function HE(t,e){if(!t||!t.isEditable||!Xc(t,e))return!1;const n=t.chain().focus();return BE(n)?n.setTextAlign(e).run():!1}function FE(t){const{editor:e,hideWhenUnavailable:n,align:r}=t;return!e||!e.isEditable||!ls(e,"textAlign")?!1:n&&!e.isActive("code")?Xc(e,r):!0}function $E(t){const{editor:e,align:n,hideWhenUnavailable:r=!1,onAligned:o}=t,{editor:i}=ie(e),[s,l]=y.useState(!0),a=Xc(i,n),c=_E(i,n);y.useEffect(()=>{if(!i)return;const d=()=>{l(FE({editor:i,align:n,hideWhenUnavailable:r}))};return d(),i.on("selectionUpdate",d),()=>{i.off("selectionUpdate",d)}},[i,r,n]);const u=y.useCallback(()=>{if(!i)return!1;const d=HE(i,n);return d&&o?.(),d},[i,n,o]);return{isVisible:s,isActive:c,handleTextAlign:u,canAlign:a,label:jE[n],shortcutKeys:b0[n],Icon:PE[n]}}function VE({action:t,shortcutKeys:e=w0[t]}){return g.jsx(vt,{children:gt({shortcutKeys:e})})}const _i=y.forwardRef(({editor:t,action:e,text:n,hideWhenUnavailable:r=!1,onExecuted:o,showShortcut:i=!1,onClick:s,children:l,...a},c)=>{const{editor:u}=ie(t),{isVisible:d,handleAction:f,label:h,canExecute:p,Icon:m,shortcutKeys:v}=qE({editor:u,action:e,hideWhenUnavailable:r,onExecuted:o}),b=y.useCallback(C=>{s?.(C),!C.defaultPrevented&&f()},[f,s]);return d?g.jsx(fe,{type:"button",disabled:!p,"data-style":"ghost","data-disabled":!p,role:"button",tabIndex:-1,"aria-label":h,tooltip:h,onClick:b,...a,ref:c,children:l??g.jsxs(g.Fragment,{children:[g.jsx(m,{className:"tiptap-button-icon"}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(VE,{action:e,shortcutKeys:v})]})}):null});_i.displayName="UndoRedoButton";const C0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.7071 2.29289C15.3166 1.90237 14.6834 1.90237 14.2929 2.29289C13.9024 2.68342 13.9024 3.31658 14.2929 3.70711L17.5858 7H9.5C7.77609 7 6.12279 7.68482 4.90381 8.90381C3.68482 10.1228 3 11.7761 3 13.5C3 14.3536 3.16813 15.1988 3.49478 15.9874C3.82144 16.7761 4.30023 17.4926 4.90381 18.0962C6.12279 19.3152 7.77609 20 9.5 20H13C13.5523 20 14 19.5523 14 19C14 18.4477 13.5523 18 13 18H9.5C8.30653 18 7.16193 17.5259 6.31802 16.682C5.90016 16.2641 5.56869 15.768 5.34254 15.2221C5.1164 14.6761 5 14.0909 5 13.5C5 12.3065 5.47411 11.1619 6.31802 10.318C7.16193 9.47411 8.30653 9 9.5 9H17.5858L14.2929 12.2929C13.9024 12.6834 13.9024 13.3166 14.2929 13.7071C14.6834 14.0976 15.3166 14.0976 15.7071 13.7071L20.7071 8.70711C21.0976 8.31658 21.0976 7.68342 20.7071 7.29289L15.7071 2.29289Z",fill:"currentColor"})}));C0.displayName="Redo2Icon";const x0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.70711 3.70711C10.0976 3.31658 10.0976 2.68342 9.70711 2.29289C9.31658 1.90237 8.68342 1.90237 8.29289 2.29289L3.29289 7.29289C2.90237 7.68342 2.90237 8.31658 3.29289 8.70711L8.29289 13.7071C8.68342 14.0976 9.31658 14.0976 9.70711 13.7071C10.0976 13.3166 10.0976 12.6834 9.70711 12.2929L6.41421 9H14.5C15.0909 9 15.6761 9.1164 16.2221 9.34254C16.768 9.56869 17.2641 9.90016 17.682 10.318C18.0998 10.7359 18.4313 11.232 18.6575 11.7779C18.8836 12.3239 19 12.9091 19 13.5C19 14.0909 18.8836 14.6761 18.6575 15.2221C18.4313 15.768 18.0998 16.2641 17.682 16.682C17.2641 17.0998 16.768 17.4313 16.2221 17.6575C15.6761 17.8836 15.0909 18 14.5 18H11C10.4477 18 10 18.4477 10 19C10 19.5523 10.4477 20 11 20H14.5C15.3536 20 16.1988 19.8319 16.9874 19.5052C17.7761 19.1786 18.4926 18.6998 19.0962 18.0962C19.6998 17.4926 20.1786 16.7761 20.5052 15.9874C20.8319 15.1988 21 14.3536 21 13.5C21 12.6464 20.8319 11.8012 20.5052 11.0126C20.1786 10.2239 19.6998 9.50739 19.0962 8.90381C18.4926 8.30022 17.7761 7.82144 16.9874 7.49478C16.1988 7.16813 15.3536 7 14.5 7H6.41421L9.70711 3.70711Z",fill:"currentColor"})}));x0.displayName="Undo2Icon";const w0={undo:"mod+z",redo:"mod+shift+z"},zE={undo:"Undo",redo:"Redo"},UE={undo:x0,redo:C0};function Qc(t,e){return!t||!t.isEditable||Ht(t,["image"])?!1:e==="undo"?t.can().undo():t.can().redo()}function WE(t,e){if(!t||!t.isEditable||!Qc(t,e))return!1;const n=t.chain().focus();return e==="undo"?n.undo().run():n.redo().run()}function KE(t){const{editor:e,hideWhenUnavailable:n,action:r}=t;return!e||!e.isEditable?!1:n&&!e.isActive("code")?Qc(e,r):!0}function qE(t){const{editor:e,action:n,hideWhenUnavailable:r=!1,onExecuted:o}=t,{editor:i}=ie(e),[s,l]=y.useState(!0),a=Qc(i,n);y.useEffect(()=>{if(!i)return;const u=()=>{l(KE({editor:i,hideWhenUnavailable:r,action:n}))};return u(),i.on("transaction",u),()=>{i.off("transaction",u)}},[i,r,n]);const c=y.useCallback(()=>{if(!i)return!1;const u=WE(i,n);return u&&o?.(),u},[i,n,o]);return{isVisible:s,handleAction:c,canExecute:a,label:zE[n],shortcutKeys:w0[n],Icon:UE[n]}}const S0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{d:"M12.7071 5.70711C13.0976 5.31658 13.0976 4.68342 12.7071 4.29289C12.3166 3.90237 11.6834 3.90237 11.2929 4.29289L4.29289 11.2929C3.90237 11.6834 3.90237 12.3166 4.29289 12.7071L11.2929 19.7071C11.6834 20.0976 12.3166 20.0976 12.7071 19.7071C13.0976 19.3166 13.0976 18.6834 12.7071 18.2929L7.41421 13L19 13C19.5523 13 20 12.5523 20 12C20 11.4477 19.5523 11 19 11L7.41421 11L12.7071 5.70711Z",fill:"currentColor"})}));S0.displayName="ArrowLeftIcon";var bl,xf;function GE(){if(xf)return bl;xf=1;var t="Expected a function",e=NaN,n="[object Symbol]",r=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,s=/^0o[0-7]+$/i,l=parseInt,a=typeof co=="object"&&co&&co.Object===Object&&co,c=typeof self=="object"&&self&&self.Object===Object&&self,u=a||c||Function("return this")(),d=Object.prototype,f=d.toString,h=Math.max,p=Math.min,m=function(){return u.Date.now()};function v(k,S,M){var N,P,z,U,H,I,_=0,F=!1,L=!1,T=!0;if(typeof k!="function")throw new TypeError(t);S=E(S)||0,C(M)&&(F=!!M.leading,L="maxWait"in M,z=L?h(E(M.maxWait)||0,S):z,T="trailing"in M?!!M.trailing:T);function R(te){var Ke=N,bt=P;return N=P=void 0,_=te,U=k.apply(bt,Ke),U}function W(te){return _=te,H=setTimeout(Z,S),F?R(te):U}function ee(te){var Ke=te-I,bt=te-_,Bn=S-Ke;return L?p(Bn,z-bt):Bn}function K(te){var Ke=te-I,bt=te-_;return I===void 0||Ke>=S||Ke<0||L&&bt>=z}function Z(){var te=m();if(K(te))return We(te);H=setTimeout(Z,ee(te))}function We(te){return H=void 0,T&&N?R(te):(N=P=void 0,U)}function le(){H!==void 0&&clearTimeout(H),_=0,N=I=P=H=void 0}function ge(){return H===void 0?U:We(m())}function Y(){var te=m(),Ke=K(te);if(N=arguments,P=this,I=te,Ke){if(H===void 0)return W(I);if(L)return H=setTimeout(Z,S),R(I)}return H===void 0&&(H=setTimeout(Z,S)),U}return Y.cancel=le,Y.flush=ge,Y}function b(k,S,M){var N=!0,P=!0;if(typeof k!="function")throw new TypeError(t);return C(M)&&(N="leading"in M?!!M.leading:N,P="trailing"in M?!!M.trailing:P),v(k,S,{leading:N,maxWait:S,trailing:P})}function C(k){var S=typeof k;return!!k&&(S=="object"||S=="function")}function x(k){return!!k&&typeof k=="object"}function w(k){return typeof k=="symbol"||x(k)&&f.call(k)==n}function E(k){if(typeof k=="number")return k;if(w(k))return e;if(C(k)){var S=typeof k.valueOf=="function"?k.valueOf():k;k=C(S)?S+"":S}if(typeof k!="string")return k===0?k:+k;k=k.replace(r,"");var M=i.test(k);return M||s.test(k)?l(k.slice(2),M?2:8):o.test(k)?e:+k}return bl=b,bl}var JE=GE();const ZE=Sf(JE),YE=t=>{const e=j.useRef(t);e.current=t,j.useEffect(()=>()=>{e.current()},[])},XE={leading:!1,trailing:!0};function k0(t,e=250,n=[],r=XE){const o=y.useMemo(()=>ZE(t,e,r),n);return YE(()=>{o.cancel()}),o}function eu(){const[t,e]=y.useState({width:0,height:0,offsetTop:0,offsetLeft:0,scale:0}),n=k0(()=>{if(typeof window>"u")return;const r=window.visualViewport;if(!r)return;const{width:o=0,height:i=0,offsetTop:s=0,offsetLeft:l=0,scale:a=0}=r;e(c=>o===c.width&&i===c.height&&s===c.offsetTop&&l===c.offsetLeft&&a===c.scale?c:{width:o,height:i,offsetTop:s,offsetLeft:l,scale:a})},200);return y.useEffect(()=>{const r=window.visualViewport;if(r)return r.addEventListener("resize",n),n(),()=>{r.removeEventListener("resize",n)}},[n]),t}const Io={x:0,y:0,width:0,height:0,top:0,right:0,bottom:0,left:0},E0=typeof window>"u",QE=!E0&&typeof ResizeObserver<"u",Vo=()=>!E0;function eM({element:t,enabled:e=!0,throttleMs:n=100,useResizeObserver:r=!0}={}){const[o,i]=y.useState(Io),s=y.useCallback(()=>!e||!Vo()?null:t?typeof t=="string"?document.querySelector(t):"current"in t?t.current:t:document.body,[t,e]),l=k0(()=>{if(!e||!Vo())return;const a=s();if(!a){i(Io);return}const c=a.getBoundingClientRect();i({x:c.x,y:c.y,width:c.width,height:c.height,top:c.top,right:c.right,bottom:c.bottom,left:c.left})},n,[e,s],{leading:!0,trailing:!0});return y.useEffect(()=>{if(!e||!Vo()){i(Io);return}const a=s();if(!a)return;l();const c=[];if(r&&QE){const d=new ResizeObserver(()=>{window.requestAnimationFrame(l)});d.observe(a),c.push(()=>d.disconnect())}const u=()=>l();return window.addEventListener("scroll",u,{passive:!0}),window.addEventListener("resize",u,{passive:!0}),c.push(()=>{window.removeEventListener("scroll",u),window.removeEventListener("resize",u)}),()=>{c.forEach(d=>d()),i(Io)}},[e,s,l,r]),o}function tM(t={}){return eM({...t,element:Vo()?document.body:null})}function nM({editor:t,overlayHeight:e=0}){const{height:n}=eu(),r=tM({enabled:!0,throttleMs:100,useResizeObserver:!0});return y.useEffect(()=>{(()=>{if(!t)return;const{state:i,view:s}=t;if(!s.hasFocus())return;const{from:l}=i.selection,a=s.coordsAtPos(l);if(n<r.height&&a&&n-a.top<e){const u=Math.max(n/2,e),d=window.scrollY,h=a.top+d-u;window.scrollTo({top:Math.max(0,h),behavior:"smooth"})}})()},[t,e,n,r.height]),r}const rM=({onHighlighterClick:t,onLinkClick:e,isMobile:n})=>g.jsxs(g.Fragment,{children:[g.jsx(rf,{}),g.jsxs(Mt,{children:[g.jsx(_i,{action:"undo"}),g.jsx(_i,{action:"redo"})]}),g.jsx(Tt,{}),g.jsxs(Mt,{children:[g.jsx(Pc,{levels:[1,2,3,4],portal:n}),g.jsx(Ng,{types:["bulletList","orderedList","taskList"],portal:n}),g.jsx(Vc,{}),g.jsx(Uc,{})]}),g.jsx(Tt,{}),g.jsxs(Mt,{children:[g.jsx(Et,{type:"bold"}),g.jsx(Et,{type:"italic"}),g.jsx(Et,{type:"strike"}),g.jsx(Et,{type:"code"}),g.jsx(Et,{type:"underline"}),n?g.jsx(Jc,{onClick:t}):g.jsx(CE,{}),n?g.jsx(Zc,{onClick:e}):g.jsx(r0,{})]}),g.jsx(Tt,{}),g.jsxs(Mt,{children:[g.jsx(Et,{type:"superscript"}),g.jsx(Et,{type:"subscript"})]}),g.jsx(Tt,{}),g.jsxs(Mt,{children:[g.jsx(Zn,{align:"left"}),g.jsx(Zn,{align:"center"}),g.jsx(Zn,{align:"right"}),g.jsx(Zn,{align:"justify"})]}),g.jsx(Tt,{}),g.jsx(Mt,{children:g.jsx(jc,{text:"Add"})}),g.jsx(rf,{}),n&&g.jsx(Tt,{})]}),oM=({type:t,onBack:e})=>g.jsxs(g.Fragment,{children:[g.jsx(Mt,{children:g.jsxs(fe,{"data-style":"ghost",onClick:e,children:[g.jsx(S0,{className:"tiptap-button-icon"}),t==="highlighter"?g.jsx(ys,{className:"tiptap-button-icon"}):g.jsx(bs,{className:"tiptap-button-icon"})]})}),g.jsx(Tt,{}),t==="highlighter"?g.jsx(Xg,{}):g.jsx(SE,{})]});function iM(t){const e=hr(),{height:n}=eu(),[r,o]=j.useState("main"),i=j.useRef(null),s=WC({content:t.value,immediatelyRender:!1,shouldRerenderOnTransaction:!1,onUpdate:({editor:a})=>{a&&t.onChange(a.getHTML())},editorProps:{attributes:{autocomplete:"off",autocorrect:"off",autocapitalize:"off","aria-label":"Main content area, start typing to enter text.",class:"simple-editor"}},extensions:[s3,r3.configure({type:"resizableImage",accept:"image/*",maxSize:1*1024*1024*1024,upload:(a,c,u)=>Promise.resolve(t.onUploadImage?.(a,c,u)||"")}),cm,am,Bw.configure({horizontalRule:!1,link:{openOnClick:!1,enableClickSelection:!0}}),o3,_w.configure({types:["heading","paragraph","resizableImage"]}),em,Qp.configure({nested:!0}),u7.configure({multicolor:!0}),l7,f7,d7,Dw,x7.configure({attributeName:"id",generateID:()=>`tiptap-editor-${t.id||ox()}`})]}),l=nM({editor:s,overlayHeight:i.current?.getBoundingClientRect().height??0});return j.useEffect(()=>{!e&&r!=="main"&&o("main")},[e,r]),j.useEffect(()=>()=>{s&&s.commands.clearContent()},[s]),g.jsx("div",{className:"simple-editor-wrapper",children:g.jsxs(qa.Provider,{value:{editor:s},children:[g.jsx(pc,{ref:i,style:{...e?{bottom:`calc(100% - ${n-l.y}px)`}:{}},children:r==="main"?g.jsx(rM,{onHighlighterClick:()=>o("highlighter"),onLinkClick:()=>o("link"),isMobile:e}):g.jsx(oM,{type:r==="highlighter"?"highlighter":"link",onBack:()=>o("main")})}),g.jsx(FC,{editor:s,className:"simple-editor-content"})]})})}exports.BlockquoteButton=Vc;exports.Button=fe;exports.Card=fr;exports.CodeBlockButton=Uc;exports.HeadingDropdownMenu=Pc;exports.ImageUploadButton=jc;exports.ListDropdownMenu=Ng;exports.MAX_FILE_SIZE=la;exports.MarkButton=Et;exports.TextAlignButton=Zn;exports.TiptapEditor=iM;exports.Toolbar=pc;exports.ToolbarGroup=Mt;exports.ToolbarSeparator=Tt;exports.UndoRedoButton=_i;exports.onUploadImage=z5;exports.useIsMobile=hr;exports.useTiptapEditor=ie;exports.useWindowSize=eu;
214
214
  //# sourceMappingURL=index.cjs.map