(function(v,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("react"),require("@blocknote/core"),require("@mantine/core"),require("@tiptap/react"),require("use-prefers-color-scheme"),require("lodash"),require("@tippyjs/react"),require("tippy.js")):typeof define=="function"&&define.amd?define(["exports","react","@blocknote/core","@mantine/core","@tiptap/react","use-prefers-color-scheme","lodash","@tippyjs/react","tippy.js"],l):(v=typeof globalThis<"u"?globalThis:v||self,l(v["blocknote-react"]={},v.React,v.core,v.core$1,v.react,v.usePrefersColorScheme,v._,v.Tippy,v.tippy_js))})(this,function(v,l,M,h,oe,Wt,qt,ge,Yt){"use strict";const he=e=>e&&typeof e=="object"&&"default"in e?e:{default:e};function Gt(e){if(e&&typeof e=="object"&&"default"in e)return e;const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(o,r,i.get?i:{enumerable:!0,get:()=>e[r]})}}return o.default=e,Object.freeze(o)}const A=he(l),Kt=he(Wt),_=Gt(qt),U=he(ge);var ve={exports:{}},J={};/**
 * @license React
 * react-jsx-runtime.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var He;function Jt(){if(He)return J;He=1;var e=A.default,o=Symbol.for("react.element"),r=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,d=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function f(g,a,p){var m,T={},E=null,w=null;p!==void 0&&(E=""+p),a.key!==void 0&&(E=""+a.key),a.ref!==void 0&&(w=a.ref);for(m in a)i.call(a,m)&&!c.hasOwnProperty(m)&&(T[m]=a[m]);if(g&&g.defaultProps)for(m in a=g.defaultProps,a)T[m]===void 0&&(T[m]=a[m]);return{$$typeof:o,type:g,key:E,ref:w,props:T,_owner:d.current}}return J.Fragment=r,J.jsx=f,J.jsxs=f,J}var X={};/**
 * @license React
 * react-jsx-runtime.development.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Ie;function Xt(){return Ie||(Ie=1,process.env.NODE_ENV!=="production"&&function(){var e=A.default,o=Symbol.for("react.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),d=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),f=Symbol.for("react.provider"),g=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),E=Symbol.for("react.lazy"),w=Symbol.for("react.offscreen"),O=Symbol.iterator,le="@@iterator";function Nn(t){if(t===null||typeof t!="object")return null;var s=O&&t[O]||t[le];return typeof s=="function"?s:null}var Y=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function H(t){{for(var s=arguments.length,u=new Array(s>1?s-1:0),b=1;b<s;b++)u[b-1]=arguments[b];Wn("error",t,u)}}function Wn(t,s,u){{var b=Y.ReactDebugCurrentFrame,C=b.getStackAddendum();C!==""&&(s+="%s",u=u.concat([C]));var j=u.map(function(k){return String(k)});j.unshift("Warning: "+s),Function.prototype.apply.call(console[t],console,j)}}var qn=!1,Yn=!1,Gn=!1,Kn=!1,Jn=!1,yt;yt=Symbol.for("react.module.reference");function Xn(t){return!!(typeof t=="string"||typeof t=="function"||t===i||t===c||Jn||t===d||t===p||t===m||Kn||t===w||qn||Yn||Gn||typeof t=="object"&&t!==null&&(t.$$typeof===E||t.$$typeof===T||t.$$typeof===f||t.$$typeof===g||t.$$typeof===a||t.$$typeof===yt||t.getModuleId!==void 0))}function Zn(t,s,u){var b=t.displayName;if(b)return b;var C=s.displayName||s.name||"";return C!==""?u+"("+C+")":u}function Ct(t){return t.displayName||"Context"}function L(t){if(t==null)return null;if(typeof t.tag=="number"&&H("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case i:return"Fragment";case r:return"Portal";case c:return"Profiler";case d:return"StrictMode";case p:return"Suspense";case m:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case g:var s=t;return Ct(s)+".Consumer";case f:var u=t;return Ct(u._context)+".Provider";case a:return Zn(t,t.render,"ForwardRef");case T:var b=t.displayName||null;return b!==null?b:L(t.type)||"Memo";case E:{var C=t,j=C._payload,k=C._init;try{return L(k(j))}catch{return null}}}return null}var q=Object.assign,te=0,pt,St,Tt,jt,Mt,wt,Et;function zt(){}zt.__reactDisabledLog=!0;function Qn(){{if(te===0){pt=console.log,St=console.info,Tt=console.warn,jt=console.error,Mt=console.group,wt=console.groupCollapsed,Et=console.groupEnd;var t={configurable:!0,enumerable:!0,value:zt,writable:!0};Object.defineProperties(console,{info:t,log:t,warn:t,error:t,group:t,groupCollapsed:t,groupEnd:t})}te++}}function $n(){{if(te--,te===0){var t={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:q({},t,{value:pt}),info:q({},t,{value:St}),warn:q({},t,{value:Tt}),error:q({},t,{value:jt}),group:q({},t,{value:Mt}),groupCollapsed:q({},t,{value:wt}),groupEnd:q({},t,{value:Et})})}te<0&&H("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Se=Y.ReactCurrentDispatcher,Te;function se(t,s,u){{if(Te===void 0)try{throw Error()}catch(C){var b=C.stack.trim().match(/\n( *(at )?)/);Te=b&&b[1]||""}return`
`+Te+t}}var je=!1,ce;{var eo=typeof WeakMap=="function"?WeakMap:Map;ce=new eo}function Bt(t,s){if(!t||je)return"";{var u=ce.get(t);if(u!==void 0)return u}var b;je=!0;var C=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var j;j=Se.current,Se.current=null,Qn();try{if(s){var k=function(){throw Error()};if(Object.defineProperty(k.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(k,[])}catch(V){b=V}Reflect.construct(t,[],k)}else{try{k.call()}catch(V){b=V}t.call(k.prototype)}}else{try{throw Error()}catch(V){b=V}t()}}catch(V){if(V&&b&&typeof V.stack=="string"){for(var x=V.stack.split(`
`),I=b.stack.split(`
`),z=x.length-1,B=I.length-1;z>=1&&B>=0&&x[z]!==I[B];)B--;for(;z>=1&&B>=0;z--,B--)if(x[z]!==I[B]){if(z!==1||B!==1)do if(z--,B--,B<0||x[z]!==I[B]){var P=`
`+x[z].replace(" at new "," at ");return t.displayName&&P.includes("<anonymous>")&&(P=P.replace("<anonymous>",t.displayName)),typeof t=="function"&&ce.set(t,P),P}while(z>=1&&B>=0);break}}}finally{je=!1,Se.current=j,$n(),Error.prepareStackTrace=C}var K=t?t.displayName||t.name:"",Nt=K?se(K):"";return typeof t=="function"&&ce.set(t,Nt),Nt}function to(t,s,u){return Bt(t,!1)}function no(t){var s=t.prototype;return!!(s&&s.isReactComponent)}function de(t,s,u){if(t==null)return"";if(typeof t=="function")return Bt(t,no(t));if(typeof t=="string")return se(t);switch(t){case p:return se("Suspense");case m:return se("SuspenseList")}if(typeof t=="object")switch(t.$$typeof){case a:return to(t.render);case T:return de(t.type,s,u);case E:{var b=t,C=b._payload,j=b._init;try{return de(j(C),s,u)}catch{}}}return""}var ue=Object.prototype.hasOwnProperty,Ht={},It=Y.ReactDebugCurrentFrame;function fe(t){if(t){var s=t._owner,u=de(t.type,t._source,s?s.type:null);It.setExtraStackFrame(u)}else It.setExtraStackFrame(null)}function oo(t,s,u,b,C){{var j=Function.call.bind(ue);for(var k in t)if(j(t,k)){var x=void 0;try{if(typeof t[k]!="function"){var I=Error((b||"React class")+": "+u+" type `"+k+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof t[k]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw I.name="Invariant Violation",I}x=t[k](s,k,b,u,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(z){x=z}x&&!(x instanceof Error)&&(fe(C),H("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",b||"React class",u,k,typeof x),fe(null)),x instanceof Error&&!(x.message in Ht)&&(Ht[x.message]=!0,fe(C),H("Failed %s type: %s",u,x.message),fe(null))}}}var ro=Array.isArray;function Me(t){return ro(t)}function io(t){{var s=typeof Symbol=="function"&&Symbol.toStringTag,u=s&&t[Symbol.toStringTag]||t.constructor.name||"Object";return u}}function ao(t){try{return _t(t),!1}catch{return!0}}function _t(t){return""+t}function Dt(t){if(ao(t))return H("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",io(t)),_t(t)}var ne=Y.ReactCurrentOwner,lo={key:!0,ref:!0,__self:!0,__source:!0},Pt,Ot,we;we={};function so(t){if(ue.call(t,"ref")){var s=Object.getOwnPropertyDescriptor(t,"ref").get;if(s&&s.isReactWarning)return!1}return t.ref!==void 0}function co(t){if(ue.call(t,"key")){var s=Object.getOwnPropertyDescriptor(t,"key").get;if(s&&s.isReactWarning)return!1}return t.key!==void 0}function uo(t,s){if(typeof t.ref=="string"&&ne.current&&s&&ne.current.stateNode!==s){var u=L(ne.current.type);we[u]||(H('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',L(ne.current.type),t.ref),we[u]=!0)}}function fo(t,s){{var u=function(){Pt||(Pt=!0,H("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",s))};u.isReactWarning=!0,Object.defineProperty(t,"key",{get:u,configurable:!0})}}function go(t,s){{var u=function(){Ot||(Ot=!0,H("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",s))};u.isReactWarning=!0,Object.defineProperty(t,"ref",{get:u,configurable:!0})}}var ho=function(t,s,u,b,C,j,k){var x={$$typeof:o,type:t,key:s,ref:u,props:k,_owner:j};return x._store={},Object.defineProperty(x._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(x,"_self",{configurable:!1,enumerable:!1,writable:!1,value:b}),Object.defineProperty(x,"_source",{configurable:!1,enumerable:!1,writable:!1,value:C}),Object.freeze&&(Object.freeze(x.props),Object.freeze(x)),x};function vo(t,s,u,b,C){{var j,k={},x=null,I=null;u!==void 0&&(Dt(u),x=""+u),co(s)&&(Dt(s.key),x=""+s.key),so(s)&&(I=s.ref,uo(s,C));for(j in s)ue.call(s,j)&&!lo.hasOwnProperty(j)&&(k[j]=s[j]);if(t&&t.defaultProps){var z=t.defaultProps;for(j in z)k[j]===void 0&&(k[j]=z[j])}if(x||I){var B=typeof t=="function"?t.displayName||t.name||"Unknown":t;x&&fo(k,B),I&&go(k,B)}return ho(t,x,I,C,b,ne.current,k)}}var Ee=Y.ReactCurrentOwner,Ft=Y.ReactDebugCurrentFrame;function G(t){if(t){var s=t._owner,u=de(t.type,t._source,s?s.type:null);Ft.setExtraStackFrame(u)}else Ft.setExtraStackFrame(null)}var ze;ze=!1;function Be(t){return typeof t=="object"&&t!==null&&t.$$typeof===o}function At(){{if(Ee.current){var t=L(Ee.current.type);if(t)return`

Check the render method of \``+t+"`."}return""}}function bo(t){{if(t!==void 0){var s=t.fileName.replace(/^.*[\\\/]/,""),u=t.lineNumber;return`

Check your code at `+s+":"+u+"."}return""}}var Rt={};function mo(t){{var s=At();if(!s){var u=typeof t=="string"?t:t.displayName||t.name;u&&(s=`

Check the top-level render call using <`+u+">.")}return s}}function Lt(t,s){{if(!t._store||t._store.validated||t.key!=null)return;t._store.validated=!0;var u=mo(s);if(Rt[u])return;Rt[u]=!0;var b="";t&&t._owner&&t._owner!==Ee.current&&(b=" It was passed a child from "+L(t._owner.type)+"."),G(t),H('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',u,b),G(null)}}function Vt(t,s){{if(typeof t!="object")return;if(Me(t))for(var u=0;u<t.length;u++){var b=t[u];Be(b)&&Lt(b,s)}else if(Be(t))t._store&&(t._store.validated=!0);else if(t){var C=Nn(t);if(typeof C=="function"&&C!==t.entries)for(var j=C.call(t),k;!(k=j.next()).done;)Be(k.value)&&Lt(k.value,s)}}}function xo(t){{var s=t.type;if(s==null||typeof s=="string")return;var u;if(typeof s=="function")u=s.propTypes;else if(typeof s=="object"&&(s.$$typeof===a||s.$$typeof===T))u=s.propTypes;else return;if(u){var b=L(s);oo(u,t.props,"prop",b,t)}else if(s.PropTypes!==void 0&&!ze){ze=!0;var C=L(s);H("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",C||"Unknown")}typeof s.getDefaultProps=="function"&&!s.getDefaultProps.isReactClassApproved&&H("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ko(t){{for(var s=Object.keys(t.props),u=0;u<s.length;u++){var b=s[u];if(b!=="children"&&b!=="key"){G(t),H("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",b),G(null);break}}t.ref!==null&&(G(t),H("Invalid attribute `ref` supplied to `React.Fragment`."),G(null))}}function Ut(t,s,u,b,C,j){{var k=Xn(t);if(!k){var x="";(t===void 0||typeof t=="object"&&t!==null&&Object.keys(t).length===0)&&(x+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var I=bo(C);I?x+=I:x+=At();var z;t===null?z="null":Me(t)?z="array":t!==void 0&&t.$$typeof===o?(z="<"+(L(t.type)||"Unknown")+" />",x=" Did you accidentally export a JSX literal instead of a component?"):z=typeof t,H("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",z,x)}var B=vo(t,s,u,C,j);if(B==null)return B;if(k){var P=s.children;if(P!==void 0)if(b)if(Me(P)){for(var K=0;K<P.length;K++)Vt(P[K],t);Object.freeze&&Object.freeze(P)}else H("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Vt(P,t)}return t===i?ko(B):xo(B),B}}function yo(t,s,u){return Ut(t,s,u,!0)}function Co(t,s,u){return Ut(t,s,u,!1)}var po=Co,So=yo;X.Fragment=i,X.jsx=po,X.jsxs=So}()),X}process.env.NODE_ENV==="production"?ve.exports=Jt():ve.exports=Xt();var n=ve.exports;const Z=e=>{const o=`0 4px 12px ${e.colors.shadow}`,r=`1px solid ${e.colors.border}`,i={default:e.colors.editor.text,gray:e.colors.highlightColors.gray.text,brown:e.colors.highlightColors.brown.text,red:e.colors.highlightColors.red.text,orange:e.colors.highlightColors.orange.text,yellow:e.colors.highlightColors.yellow.text,green:e.colors.highlightColors.green.text,blue:e.colors.highlightColors.blue.text,purple:e.colors.highlightColors.purple.text,pink:e.colors.highlightColors.pink.text},d={default:e.colors.editor.background,gray:e.colors.highlightColors.gray.background,brown:e.colors.highlightColors.brown.background,red:e.colors.highlightColors.red.background,orange:e.colors.highlightColors.orange.background,yellow:e.colors.highlightColors.yellow.background,green:e.colors.highlightColors.green.background,blue:e.colors.highlightColors.blue.background,purple:e.colors.highlightColors.purple.background,pink:e.colors.highlightColors.pink.background},c=`${Math.max(e.borderRadius+2,1)}px`,f=`${e.borderRadius}px`,g=`${Math.max(e.borderRadius-2,1)}px`;return{activeStyles:{transform:"none"},components:{Menu:{styles:()=>{var a;return{dropdown:_.default.merge({backgroundColor:e.colors.menu.background,border:r,borderRadius:f,boxShadow:o,color:e.colors.menu.text,padding:"2px",overflowY:"scroll",".mantine-Menu-label":{backgroundColor:e.colors.menu.background,color:e.colors.menu.text},".mantine-Menu-item":{backgroundColor:e.colors.menu.background,border:"none",borderRadius:g,color:e.colors.menu.text},".mantine-Menu-item[data-hovered]":{backgroundColor:e.colors.hovered.background,border:"none",color:e.colors.hovered.text}},((a=e.componentStyles)==null?void 0:a.call(e,e).Menu)||{})}}},Tabs:{styles:()=>{var a;return{root:_.default.merge({width:"100%",backgroundColor:e.colors.menu.background},((a=e.componentStyles)==null?void 0:a.call(e,e).Tabs)||{}),tabsList:{borderColor:e.colors.hovered.background},tab:{color:e.colors.menu.text,borderColor:e.colors.hovered.background,"&:hover":{color:e.colors.hovered.text,backgroundColor:e.colors.hovered.background,borderColor:e.colors.hovered.background},"&[data-active], &[data-active]&:hover":{color:e.colors.menu.text,borderColor:e.colors.menu.text}},panel:{padding:"8px",".mantine-UnstyledButton-root":{width:"60%",border:`solid ${e.colors.border} 1px`,borderRadius:"4px",height:"32px"},".mantine-UnstyledButton-root:hover":{color:e.colors.hovered.text,backgroundColor:e.colors.hovered.background}}}}},FileInput:{styles:()=>{var a;return{root:((a=e.componentStyles)==null?void 0:a.call(e,e).FileInput)||{},input:{color:e.colors.menu.text,backgroundColor:e.colors.menu.background,display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",border:"none",borderRadius:"4px","&:hover":{backgroundColor:e.colors.hovered.background}},wrapper:{border:`solid ${e.colors.border} 1px`,borderRadius:"4px"},placeholder:{color:`${e.colors.menu.text} !important`,fontWeight:600}}}},TextInput:{styles:()=>{var a;return{root:((a=e.componentStyles)==null?void 0:a.call(e,e).TextInput)||{},input:{color:e.colors.menu.text,backgroundColor:e.colors.menu.background,border:`solid ${e.colors.border} 1px`,borderRadius:"4px",height:"32px"}}}},ColorIcon:{styles:()=>{var a;return{root:_.default.merge({border:r,borderRadius:g},((a=e.componentStyles)==null?void 0:a.call(e,e).ColorIcon)||{})}}},DragHandleMenu:{styles:()=>{var a;return{root:_.default.merge({".mantine-Menu-item":{fontSize:"12px",height:"30px"}},((a=e.componentStyles)==null?void 0:a.call(e,e).DragHandleMenu)||{})}}},Editor:{styles:()=>{var a;return{root:_.default.merge({".ProseMirror":{backgroundColor:e.colors.editor.background,borderRadius:c,color:e.colors.editor.text,fontFamily:e.fontFamily},[`.${M.blockStyles.isEmpty} .${M.blockStyles.inlineContent}:before, .${M.blockStyles.isFilter} .${M.blockStyles.inlineContent}:before`]:{color:e.colors.sideMenu},[`.${M.blockStyles.blockGroup}`]:{[`.${M.blockStyles.blockGroup}`]:{[`.${M.blockStyles.blockOuter}:not([data-prev-depth-changed])::before`]:{borderLeft:`1px solid ${e.colors.sideMenu}`}}},...Object.fromEntries(Object.entries(i).map(([p,m])=>[`[data-text-color="${p}"]`,{color:m}])),...Object.fromEntries(Object.entries(d).map(([p,m])=>[`[data-background-color="${p}"]`,{backgroundColor:m}]))},((a=e.componentStyles)==null?void 0:a.call(e,e).Editor)||{})}}},Toolbar:{styles:()=>{var a;return{root:_.default.merge({backgroundColor:e.colors.menu.background,boxShadow:o,border:r,borderRadius:f,flexWrap:"nowrap",gap:"2px",padding:"2px",width:"fit-content",".mantine-Button-root, .mantine-ActionIcon-root":{backgroundColor:e.colors.menu.background,border:"none",borderRadius:g,color:e.colors.menu.text},".mantine-Button-root:hover, .mantine-ActionIcon-root:hover":{backgroundColor:e.colors.hovered.background,border:"none",color:e.colors.hovered.text},".mantine-Button-root[data-selected], .mantine-ActionIcon-root[data-selected]":{backgroundColor:e.colors.selected.background,border:"none",color:e.colors.selected.text},".mantine-Button-root[data-disabled], .mantine-ActionIcon-root[data-disabled]":{backgroundColor:e.colors.disabled.background,border:"none",color:e.colors.disabled.text},".mantine-Menu-dropdown":{".mantine-Menu-item":{fontSize:"12px",height:"30px",".mantine-Menu-itemRightSection":{paddingLeft:"5px"}},".mantine-Menu-item:hover":{backgroundColor:e.colors.hovered.background}}},((a=e.componentStyles)==null?void 0:a.call(e,e).Toolbar)||{})}}},ToolbarInputDropdown:{styles:()=>{var a;return{root:_.default.merge({backgroundColor:e.colors.menu.background,border:r,borderRadius:f,boxShadow:o,color:e.colors.menu.text,gap:"4px",minWidth:"145px",padding:"2px",".mantine-Group-root":{flexWrap:"nowrap",".mantine-TextInput-root, .mantine-FileInput-root":{width:"300px",".mantine-TextInput-wrapper:hover":{backgroundColor:e.colors.hovered.background},".mantine-TextInput-wrapper, .mantine-FileInput-wrapper":{padding:0,borderRadius:"4px",".mantine-FileInput-icon":{color:e.colors.menu.text},".mantine-TextInput-input, .mantine-FileInput-input":{border:"none",fontSize:"12px",".mantine-FileInput-placeholder":{color:e.colors.menu.text}},".mantine-FileInput-input:hover":{backgroundColor:e.colors.hovered.background}}}}},((a=e.componentStyles)==null?void 0:a.call(e,e).EditHyperlinkMenu)||{})}}},Tooltip:{styles:()=>{var a;return{root:_.default.merge({backgroundColor:e.colors.tooltip.background,border:r,borderRadius:f,boxShadow:o,color:e.colors.tooltip.text,padding:"4px 10px",textAlign:"center","div ~ div":{color:e.colors.tooltip.text}},((a=e.componentStyles)==null?void 0:a.call(e,e).Tooltip)||{})}}},SlashMenu:{styles:()=>{var a;return{root:_.default.merge({position:"relative",".mantine-Menu-item":{".mantine-Menu-itemIcon":{backgroundColor:e.colors.tooltip.background,borderRadius:g,color:e.colors.tooltip.text,padding:"8px"},".mantine-Menu-itemLabel":{paddingRight:"16px",".mantine-Stack-root":{gap:"0"}},".mantine-Menu-itemRightSection":{".mantine-Badge-root":{backgroundColor:e.colors.tooltip.background,color:e.colors.tooltip.text}}}},((a=e.componentStyles)==null?void 0:a.call(e,e).SlashMenu)||{})}}},SideMenu:{styles:()=>{var a;return{root:_.default.merge({backgroundColor:"transparent",".mantine-UnstyledButton-root":{backgroundColor:"transparent",color:e.colors.sideMenu},".mantine-UnstyledButton-root:hover":{backgroundColor:e.colors.hovered.background}},((a=e.componentStyles)==null?void 0:a.call(e,e).SideMenu)||{})}}}},fontFamily:e.fontFamily,other:{textColors:i,backgroundColors:d}}},re=l.forwardRef((e,o)=>{const{classes:r}=h.createStyles({root:{}})(void 0,{name:"Toolbar"});return n.jsx(h.Group,{className:e.className?`${r.root} ${e.className}`:r.root,ref:o,...e,children:e.children})});var _e={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},De=A.default.createContext&&A.default.createContext(_e),N=globalThis&&globalThis.__assign||function(){return N=Object.assign||function(e){for(var o,r=1,i=arguments.length;r<i;r++){o=arguments[r];for(var d in o)Object.prototype.hasOwnProperty.call(o,d)&&(e[d]=o[d])}return e},N.apply(this,arguments)},Zt=globalThis&&globalThis.__rest||function(e,o){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&o.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var d=0,i=Object.getOwnPropertySymbols(e);d<i.length;d++)o.indexOf(i[d])<0&&Object.prototype.propertyIsEnumerable.call(e,i[d])&&(r[i[d]]=e[i[d]]);return r};function Pe(e){return e&&e.map(function(o,r){return A.default.createElement(o.tag,N({key:r},o.attr),Pe(o.child))})}function S(e){return function(o){return A.default.createElement(Qt,N({attr:N({},e.attr)},o),Pe(e.child))}}function Qt(e){var o=function(r){var i=e.attr,d=e.size,c=e.title,f=Zt(e,["attr","size","title"]),g=d||r.size||"1em",a;return r.className&&(a=r.className),e.className&&(a=(a?a+" ":"")+e.className),A.default.createElement("svg",N({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,i,f,{className:a,style:N(N({color:e.color||r.color},r.style),e.style),height:g,width:g,xmlns:"http://www.w3.org/2000/svg"}),c&&A.default.createElement("title",null,c),e.children)};return De!==void 0?A.default.createElement(De.Consumer,null,function(r){return o(r)}):o(_e)}function $t(e){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M23 12l-7.071 7.071-1.414-1.414L20.172 12l-5.657-5.657 1.414-1.414L23 12zM3.828 12l5.657 5.657-1.414 1.414L1 12l7.071-7.071 1.414 1.414L3.828 12z"}}]}]})(e)}function en(e){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M3 4h18v2H3V4zm2 15h14v2H5v-2zm-2-5h18v2H3v-2zm2-5h14v2H5V9z"}}]}]})(e)}function tn(e){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M3 4h18v2H3V4zm0 15h18v2H3v-2zm0-5h18v2H3v-2zm0-5h18v2H3V9z"}}]}]})(e)}function nn(e){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M3 4h18v2H3V4zm0 15h14v2H3v-2zm0-5h18v2H3v-2zm0-5h14v2H3V9z"}}]}]})(e)}function on(e){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M3 4h18v2H3V4zm4 15h14v2H7v-2zm-4-5h18v2H3v-2zm4-5h14v2H7V9z"}}]}]})(e)}function rn(e){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M8 11h4.5a2.5 2.5 0 1 0 0-5H8v5zm10 4.5a4.5 4.5 0 0 1-4.5 4.5H6V4h6.5a4.5 4.5 0 0 1 3.256 7.606A4.498 4.498 0 0 1 18 15.5zM8 13v5h5.5a2.5 2.5 0 1 0 0-5H8z"}}]}]})(e)}function Oe(e){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0H24V24H0z"}},{tag:"path",attr:{d:"M13 20h-2v-7H4v7H2V4h2v7h7V4h2v16zm8-12v12h-2v-9.796l-2 .536V8.67L19.5 8H21z"}}]}]})(e)}function Fe(e){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0H24V24H0z"}},{tag:"path",attr:{d:"M4 4v7h7V4h2v16h-2v-7H4v7H2V4h2zm14.5 4c2.071 0 3.75 1.679 3.75 3.75 0 .857-.288 1.648-.772 2.28l-.148.18L18.034 18H22v2h-7v-1.556l4.82-5.546c.268-.307.43-.709.43-1.148 0-.966-.784-1.75-1.75-1.75-.918 0-1.671.707-1.744 1.606l-.006.144h-2C14.75 9.679 16.429 8 18.5 8z"}}]}]})(e)}function Ae(e){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0H24V24H0z"}},{tag:"path",attr:{d:"M22 8l-.002 2-2.505 2.883c1.59.435 2.757 1.89 2.757 3.617 0 2.071-1.679 3.75-3.75 3.75-1.826 0-3.347-1.305-3.682-3.033l1.964-.382c.156.806.866 1.415 1.718 1.415.966 0 1.75-.784 1.75-1.75s-.784-1.75-1.75-1.75c-.286 0-.556.069-.794.19l-1.307-1.547L19.35 10H15V8h7zM4 4v7h7V4h2v16h-2v-7H4v7H2V4h2z"}}]}]})(e)}function an(e){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M3 4h18v2H3V4zm0 15h18v2H3v-2zm8-5h10v2H11v-2zm0-5h10v2H11V9zm-8 3.5L7 9v7l-4-3.5z"}}]}]})(e)}function ln(e){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M3 4h18v2H3V4zm0 15h18v2H3v-2zm8-5h10v2H11v-2zm0-5h10v2H11V9zm-4 3.5L3 16V9l4 3.5z"}}]}]})(e)}function sn(e){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M15 20H7v-2h2.927l2.116-12H9V4h8v2h-2.927l-2.116 12H15z"}}]}]})(e)}function cn(e){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M17 17h5v2h-3v3h-2v-5zM7 7H2V5h3V2h2v5zm11.364 8.536L16.95 14.12l1.414-1.414a5 5 0 1 0-7.071-7.071L9.879 7.05 8.464 5.636 9.88 4.222a7 7 0 0 1 9.9 9.9l-1.415 1.414zm-2.828 2.828l-1.415 1.414a7 7 0 0 1-9.9-9.9l1.415-1.414L7.05 9.88l-1.414 1.414a5 5 0 1 0 7.071 7.071l1.414-1.414 1.415 1.414zm-.708-10.607l1.415 1.415-7.071 7.07-1.415-1.414 7.071-7.07z"}}]}]})(e)}function Re(e){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M18.364 15.536L16.95 14.12l1.414-1.414a5 5 0 1 0-7.071-7.071L9.879 7.05 8.464 5.636 9.88 4.222a7 7 0 0 1 9.9 9.9l-1.415 1.414zm-2.828 2.828l-1.415 1.414a7 7 0 0 1-9.9-9.9l1.415-1.414L7.05 9.88l-1.414 1.414a5 5 0 1 0 7.071 7.071l1.414-1.414 1.415 1.414zm-.708-10.607l1.415 1.415-7.071 7.07-1.415-1.414 7.071-7.07z"}}]}]})(e)}function Le(e){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M8 4h13v2H8V4zM5 3v3h1v1H3V6h1V4H3V3h2zM3 14v-2.5h2V11H3v-1h3v2.5H4v.5h2v1H3zm2 5.5H3v-1h2V18H3v-1h3v4H3v-1h2v-.5zM8 11h13v2H8v-2zm0 7h13v2H8v-2z"}}]}]})(e)}function Ve(e){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M8 4h13v2H8V4zM4.5 6.5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm0 7a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm0 6.9a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zM8 11h13v2H8v-2zm0 7h13v2H8v-2z"}}]}]})(e)}function dn(e){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M17.154 14c.23.516.346 1.09.346 1.72 0 1.342-.524 2.392-1.571 3.147C14.88 19.622 13.433 20 11.586 20c-1.64 0-3.263-.381-4.87-1.144V16.6c1.52.877 3.075 1.316 4.666 1.316 2.551 0 3.83-.732 3.839-2.197a2.21 2.21 0 0 0-.648-1.603l-.12-.117H3v-2h18v2h-3.846zm-4.078-3H7.629a4.086 4.086 0 0 1-.481-.522C6.716 9.92 6.5 9.246 6.5 8.452c0-1.236.466-2.287 1.397-3.153C8.83 4.433 10.271 4 12.222 4c1.471 0 2.879.328 4.222.984v2.152c-1.2-.687-2.515-1.03-3.946-1.03-2.48 0-3.719.782-3.719 2.346 0 .42.218.786.654 1.099.436.313.974.562 1.613.75.62.18 1.297.414 2.03.699z"}}]}]})(e)}function Q(e){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M13 6v15h-2V6H5V4h14v2z"}}]}]})(e)}function un(e){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M8 3v9a4 4 0 1 0 8 0V3h2v9a6 6 0 1 1-12 0V3h2zM4 20h16v2H4v-2z"}}]}]})(e)}function fn(e){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M5 11.1l2-2 5.5 5.5 3.5-3.5 3 3V5H5v6.1zM4 3h16a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm11.5 7a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z"}}]}]})(e)}function gn(e){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0H24V24H0z"}},{tag:"path",attr:{d:"M20 3c.552 0 1 .448 1 1v1.757l-2 2V5H5v8.1l4-4 4.328 4.329-1.327 1.327-.006 4.239 4.246.006 1.33-1.33L18.899 19H19v-2.758l2-2V20c0 .552-.448 1-1 1H4c-.552 0-1-.448-1-1V4c0-.552.448-1 1-1h16zm1.778 4.808l1.414 1.414L15.414 17l-1.416-.002.002-1.412 7.778-7.778zM15.5 7c.828 0 1.5.672 1.5 1.5s-.672 1.5-1.5 1.5S14 9.328 14 8.5 14.672 7 15.5 7z"}}]}]})(e)}function hn(e){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M10 6v2H5v11h11v-5h2v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h6zm11-3v9l-3.794-3.793-5.999 6-1.414-1.414 5.999-6L12 3h9z"}}]}]})(e)}function be(e){return S({tag:"svg",attr:{version:"1.2",baseProfile:"tiny",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M16.972 6.251c-.967-.538-2.185-.188-2.72.777l-3.713 6.682-2.125-2.125c-.781-.781-2.047-.781-2.828 0-.781.781-.781 2.047 0 2.828l4 4c.378.379.888.587 1.414.587l.277-.02c.621-.087 1.166-.46 1.471-1.009l5-9c.537-.966.189-2.183-.776-2.72z"}}]})(e)}function vn(e){const o=e.icon;return n.jsx(h.Menu.Item,{onClick:e.onClick,icon:o&&n.jsx(o,{size:16}),rightSection:e.isSelected?n.jsx(be,{size:16}):n.jsx("div",{style:{width:"16px",padding:"0"}}),disabled:e.isDisabled,children:e.text},e.text)}function bn(e){return S({tag:"svg",attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",clipRule:"evenodd"}}]})(e)}function mn(e){return S({tag:"svg",attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"}}]})(e)}const xn=l.forwardRef((e,o)=>{const r=e.icon;return n.jsx(h.Button,{leftIcon:r&&n.jsx(r,{size:16}),rightIcon:n.jsx(bn,{}),size:"xs",variant:"subtle",disabled:e.isDisabled,onClick:e.onClick,ref:o,children:e.text})});function ie(){const e=l.useRef(null);return{ref:e,updateMaxHeight:()=>{setTimeout(()=>{if(e.current&&e.current.childElementCount>0){e.current.firstElementChild.style.maxHeight="none";const o=e.current.firstElementChild.getBoundingClientRect();e.current.firstElementChild.style.maxHeight=`${Math.min(o.top>=0?window.innerHeight-o.top-20:o.bottom-20)}px`}},10)}}}function Ue(e){const o=e.items.filter(d=>d.isSelected)[0],{ref:r,updateMaxHeight:i}=ie();return o?n.jsxs(h.Menu,{exitTransitionDuration:0,disabled:e.isDisabled,onOpen:i,children:[n.jsx(h.Menu.Target,{children:n.jsx(xn,{text:o.text,icon:o.icon,isDisabled:o.isDisabled})}),n.jsx("div",{ref:r,children:n.jsx(h.Menu.Dropdown,{children:e.items.map(d=>n.jsx(vn,{...d},d.text))})})]}):null}function Ne(e,o){l.useEffect(()=>(e._tiptapEditor.on("update",o),()=>{e._tiptapEditor.off("update",o)}),[o,e._tiptapEditor])}function We(e,o){l.useEffect(()=>(e._tiptapEditor.on("selectionUpdate",o),()=>{e._tiptapEditor.off("selectionUpdate",o)}),[o,e._tiptapEditor])}function R(e,o){Ne(e,o),We(e,o)}function W(e){const[o,r]=l.useState(()=>{var i;return((i=e.getSelection())==null?void 0:i.blocks)||[e.getTextCursorPosition().block]});return R(e,()=>{var i;return r(((i=e.getSelection())==null?void 0:i.blocks)||[e.getTextCursorPosition().block])}),o}const qe=[{name:"Paragraph",type:"paragraph",icon:Q,isSelected:e=>e.type==="paragraph"},{name:"Heading 1",type:"heading",props:{level:1},icon:Oe,isSelected:e=>e.type==="heading"&&"level"in e.props&&e.props.level===1},{name:"Heading 2",type:"heading",props:{level:2},icon:Fe,isSelected:e=>e.type==="heading"&&"level"in e.props&&e.props.level===2},{name:"Heading 3",type:"heading",props:{level:3},icon:Ae,isSelected:e=>e.type==="heading"&&"level"in e.props&&e.props.level===3},{name:"Bullet List",type:"bulletListItem",icon:Ve,isSelected:e=>e.type==="bulletListItem"},{name:"Numbered List",type:"numberedListItem",icon:Le,isSelected:e=>e.type==="numberedListItem"}],Ye=e=>{const o=W(e.editor),[r,i]=l.useState(e.editor.getTextCursorPosition().block),d=l.useMemo(()=>(e.items||qe).filter(g=>{if(!(g.type in e.editor.schema))return!1;for(const[a,p]of Object.entries(g.props||{})){const m=e.editor.schema[g.type].propSchema;if(!(a in m)||m[a].values!==void 0&&!m[a].values.includes(p))return!1}return!0}),[e.editor,e.items]),c=l.useMemo(()=>d.find(g=>g.type===r.type)!==void 0,[r.type,d]),f=l.useMemo(()=>{const g=a=>{e.editor.focus();for(const p of o)e.editor.updateBlock(p,{type:a.type,props:a.props})};return d.map(a=>({text:a.name,icon:a.icon,onClick:()=>g(a),isSelected:a.isSelected(r)}))},[r,d,e.editor,o]);return R(e.editor,()=>{i(e.editor.getTextCursorPosition().block)}),c?n.jsx(Ue,{items:f}):null},kn=e=>{const{classes:o}=h.createStyles({root:{}})(void 0,{name:"Tooltip"});return n.jsxs(h.Stack,{spacing:0,className:o.root,children:[n.jsx(h.Text,{size:"sm",children:e.mainTooltip}),e.secondaryTooltip&&n.jsx(h.Text,{size:"xs",children:e.secondaryTooltip})]})},D=l.forwardRef((e,o)=>{const r=e.icon;return n.jsx(U.default,{content:n.jsx(kn,{mainTooltip:e.mainTooltip,secondaryTooltip:e.secondaryTooltip}),trigger:"mouseenter",children:e.children?n.jsxs(h.Button,{onClick:e.onClick,"data-selected":e.isSelected?"true":void 0,"data-test":e.mainTooltip.slice(0,1).toLowerCase()+e.mainTooltip.replace(/\s+/g,"").slice(1),size:"xs",disabled:e.isDisabled||!1,ref:o,children:[r&&n.jsx(r,{}),e.children]}):n.jsx(h.ActionIcon,{onClick:e.onClick,"data-selected":e.isSelected?"true":void 0,"data-test":e.mainTooltip.slice(0,1).toLowerCase()+e.mainTooltip.replace(/\s+/g,"").slice(1),size:30,disabled:e.isDisabled||!1,ref:o,children:r&&n.jsx(r,{})})})}),yn=()=>typeof navigator<"u"&&(/Mac/.test(navigator.platform)||/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent));function F(e){return yn()?e.replace("Mod","⌘"):e.replace("Mod","Ctrl")}const Cn={bold:"Mod+B",italic:"Mod+I",underline:"Mod+U",strike:"Mod+Shift+X",code:""},pn={bold:rn,italic:sn,underline:un,strike:dn,code:$t},$=e=>{const o=W(e.editor),[r,i]=l.useState(e.toggledStyle in e.editor.getActiveStyles());R(e.editor,()=>{i(e.toggledStyle in e.editor.getActiveStyles())});const d=f=>{e.editor.focus(),e.editor.toggleStyles({[f]:!0})};return l.useMemo(()=>!!o.find(f=>f.content!==void 0),[o])?n.jsx(D,{onClick:()=>d(e.toggledStyle),isSelected:r,mainTooltip:e.toggledStyle.slice(0,1).toUpperCase()+e.toggledStyle.slice(1),secondaryTooltip:F(Cn[e.toggledStyle]),icon:pn[e.toggledStyle]}):null},Sn={left:nn,center:en,right:on,justify:tn},ae=e=>{const o=W(e.editor),r=l.useMemo(()=>{const c=o[0];if("textAlignment"in c.props)return c.props.textAlignment},[o]),i=l.useCallback(c=>{e.editor.focus();for(const f of o)e.editor.updateBlock(f,{props:{textAlignment:c}})},[e.editor,o]);return l.useMemo(()=>!!o.find(c=>"textAlignment"in c.props),[o])?n.jsx(D,{onClick:()=>i(e.textAlignment),isSelected:r===e.textAlignment,mainTooltip:e.textAlignment==="justify"?"Justify Text":"Align Text "+e.textAlignment.slice(0,1).toUpperCase()+e.textAlignment.slice(1),icon:Sn[e.textAlignment]}):null},me=e=>{const{classes:o}=h.createStyles({root:{}})(void 0,{name:"ColorIcon"}),r=e.textColor||"default",i=e.backgroundColor||"default",d=e.size||16;return n.jsx(h.Box,{className:o.root,sx:c=>({pointerEvents:"none",backgroundColor:c.other.backgroundColors[i],color:c.other.textColors[r],fontSize:(d*.75).toString()+"px",height:d.toString()+"px",lineHeight:d.toString()+"px",textAlign:"center",width:d.toString()+"px"}),children:"A"})},Ge=e=>{const o=()=>e.text?n.jsxs(n.Fragment,{children:[n.jsx(h.Menu.Label,{children:"Text"}),["default","gray","brown","red","orange","yellow","green","blue","purple","pink"].map(i=>n.jsx(h.Menu.Item,{onClick:()=>{e.onClick&&e.onClick(),e.text.setColor(i)},component:"div","data-test":"text-color-"+i,icon:n.jsx(me,{textColor:i,size:e.iconSize}),rightSection:e.text.color===i?n.jsx(be,{size:16,style:{paddingLeft:"8px"}}):n.jsx("div",{style:{width:"24px",padding:"0"}}),children:i.charAt(0).toUpperCase()+i.slice(1)},"text-color-"+i))]}):null,r=()=>e.background?n.jsxs(n.Fragment,{children:[n.jsx(h.Menu.Label,{children:"Background"}),["default","gray","brown","red","orange","yellow","green","blue","purple","pink"].map(i=>n.jsx(h.Menu.Item,{onClick:()=>{e.onClick&&e.onClick(),e.background.setColor(i)},component:"div","data-test":"background-color-"+i,icon:n.jsx(me,{backgroundColor:i,size:e.iconSize}),rightSection:e.background.color===i?n.jsx(be,{size:16,style:{paddingLeft:"8px"}}):n.jsx("div",{style:{width:"24px",padding:"0"}}),children:i.charAt(0).toUpperCase()+i.slice(1)},"background-color-"+i))]}):null;return n.jsxs(n.Fragment,{children:[n.jsx(o,{}),n.jsx(r,{})]})},Ke=e=>{const o=W(e.editor),[r,i]=l.useState(e.editor.getActiveStyles().textColor||"default"),[d,c]=l.useState(e.editor.getActiveStyles().backgroundColor||"default");R(e.editor,()=>{i(e.editor.getActiveStyles().textColor||"default"),c(e.editor.getActiveStyles().backgroundColor||"default")});const{ref:f,updateMaxHeight:g}=ie(),a=l.useCallback(T=>{e.editor.focus(),T==="default"?e.editor.removeStyles({textColor:T}):e.editor.addStyles({textColor:T})},[e.editor]),p=l.useCallback(T=>{e.editor.focus(),T==="default"?e.editor.removeStyles({backgroundColor:T}):e.editor.addStyles({backgroundColor:T})},[e.editor]);return l.useMemo(()=>{for(const T of o)if(T.content!==void 0)return!0;return!1},[o])?n.jsxs(h.Menu,{onOpen:g,children:[n.jsx(h.Menu.Target,{children:n.jsx(D,{mainTooltip:"Colors",icon:()=>n.jsx(me,{textColor:r,backgroundColor:d,size:20})})}),n.jsx("div",{ref:f,children:n.jsx(h.Menu.Dropdown,{children:n.jsx(Ge,{text:{color:r,setColor:a},background:{color:d,setColor:p}})})})]}):null},Je=e=>{const[o,r]=l.useState();R(e.editor,()=>{r(e.editor.canNestBlock())});const i=l.useCallback(()=>{e.editor.focus(),e.editor.nestBlock()},[e.editor]);return n.jsx(D,{onClick:i,isDisabled:!o,mainTooltip:"Nest Block",secondaryTooltip:F("Tab"),icon:ln})},Xe=e=>{const[o,r]=l.useState();R(e.editor,()=>{r(e.editor.canUnnestBlock())});const i=l.useCallback(()=>{e.editor.focus(),e.editor.unnestBlock()},[e]);return n.jsx(D,{onClick:i,isDisabled:!o,mainTooltip:"Unnest Block",secondaryTooltip:F("Shift+Tab"),icon:an})},Ze=e=>{const[o,r]=l.useState(!1),i=l.useCallback(()=>{r(!1)},[]),d=l.useCallback(()=>{r(!0)},[]);return n.jsx(U.default,{onShow:c=>{var f;d(),(f=e.onShow)==null||f.call(e,c)},onHidden:c=>{var f;i(),(f=e.onShow)==null||f.call(e,c)},content:o?e.children[1]:null,trigger:e.visible===void 0?"click":void 0,interactive:!0,maxWidth:500,zIndex:9e3,...e,children:e.children[0]})},Qe=l.forwardRef(({className:e,...o},r)=>{const{classes:i}=h.createStyles({root:{}})(void 0,{name:"ToolbarInputDropdown"});return n.jsx(h.Stack,{...o,className:M.mergeCSSClasses(i.root,e||""),ref:r,children:o.children})}),Tn={text:h.TextInput,file:h.FileInput},xe=e=>{const o=e.icon,r=Tn[e.type];return n.jsx(h.Group,{children:n.jsx(r,{size:"xs",icon:n.jsx(o,{}),...e.inputProps})})},$e=l.forwardRef(({url:e,text:o,update:r,...i},d)=>{const[c,f]=l.useState(e),[g,a]=l.useState(o);l.useEffect(()=>{f(e),a(o)},[o,e]);const p=l.useCallback(w=>{w.key==="Enter"&&(w.preventDefault(),r(c,g))},[r,c,g]),m=l.useCallback(w=>f(w.currentTarget.value),[]),T=l.useCallback(w=>a(w.currentTarget.value),[]),E=l.useCallback(()=>r(c,g),[r,c,g]);return n.jsxs(Qe,{...i,ref:d,children:[n.jsx(xe,{type:"text",icon:Re,inputProps:{autoFocus:!0,placeholder:"Edit URL",value:c,onKeyDown:p,onChange:m,onSubmit:E}}),n.jsx(xe,{type:"text",icon:Q,inputProps:{placeholder:"Edit Title",value:g,onKeyDown:p,onChange:T,onSubmit:E}})]})}),et=e=>{const o=W(e.editor),[r,i]=l.useState(e.editor.getSelectedLinkUrl()||""),[d,c]=l.useState(e.editor.getSelectedText());R(e.editor,()=>{c(e.editor.getSelectedText()||""),i(e.editor.getSelectedLinkUrl()||"")});const f=l.useCallback((a,p)=>{e.editor.createLink(a,p),e.editor.focus()},[e.editor]);return l.useMemo(()=>{for(const a of o)if(a.content===void 0)return!1;return!0},[o])?n.jsxs(Ze,{children:[n.jsx(D,{mainTooltip:"Create Link",secondaryTooltip:F("Mod+K"),icon:Re}),n.jsx($e,{url:r,text:d,update:f})]}):null},ke=e=>{const[o,r]=l.useState(e.editor.uploadFile!==void 0?"upload":"embed"),[i,d]=l.useState(!1),[c,f]=l.useState(!1);l.useEffect(()=>{c&&setTimeout(()=>{f(!1)},3e3)},[c]);const g=l.useCallback(async w=>{if(d(!0),e.editor.uploadFile!==void 0)try{const O=await e.editor.uploadFile(w);e.editor.updateBlock(e.block,{type:"image",props:{url:O}})}catch{f(!0)}finally{d(!1)}},[e.block,e.editor]),[a,p]=l.useState(""),m=l.useCallback(w=>{p(w.currentTarget.value)},[]),T=l.useCallback(w=>{w.key==="Enter"&&(w.preventDefault(),e.editor.updateBlock(e.block,{type:"image",props:{url:a}}))},[a,e.block,e.editor]),E=l.useCallback(()=>{e.editor.updateBlock(e.block,{type:"image",props:{url:a}})},[a,e.block,e.editor]);return n.jsx(re,{style:{width:"500px"},children:n.jsxs(h.Tabs,{value:o,onTabChange:r,children:[i&&n.jsx(h.LoadingOverlay,{visible:i}),n.jsxs(h.Tabs.List,{children:[e.editor.uploadFile!==void 0&&n.jsx(h.Tabs.Tab,{value:"upload","data-test":"upload-tab",children:"Upload"}),n.jsx(h.Tabs.Tab,{value:"embed","data-test":"embed-tab",children:"Embed"})]}),e.editor.uploadFile!==void 0&&n.jsx(h.Tabs.Panel,{value:"upload",children:n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch",gap:"8px"},children:[n.jsx(h.FileInput,{placeholder:"Upload Image",size:"xs",value:null,onChange:g,"data-test":"upload-input"}),c&&n.jsx(h.Text,{color:"red",size:12,style:{textAlign:"center"},children:"Error: Upload failed"})]})}),n.jsx(h.Tabs.Panel,{value:"embed",children:n.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"},children:[n.jsx(h.TextInput,{size:"xs",placeholder:"Enter URL",value:a,onChange:m,onKeyDown:T,style:{width:"100%"},"data-test":"embed-input"}),n.jsx(h.Button,{onClick:E,size:"xs","data-test":"embed-input-button",children:"Embed Image"})]})})]})})},jn=e=>{const o=W(e.editor),[r,i]=l.useState(!1);return l.useEffect(()=>{i(!1)},[o]),o.length===1&&o[0].type==="image"?n.jsx(U.default,{visible:r,interactive:!0,content:n.jsx(ke,{block:o[0],editor:e.editor}),children:n.jsx(D,{onClick:()=>i(!r),isSelected:r,mainTooltip:"Replace Image",icon:gn})}):null},Mn=e=>{const o=W(e.editor),r=l.useMemo(()=>o.length===1&&o[0].type==="image"&&"caption"in e.editor.schema.image.propSchema&&typeof e.editor.schema.image.propSchema.caption.default=="string"&&e.editor.schema.image.propSchema.caption.values===void 0&&"src"in e.editor.schema.image.propSchema&&typeof e.editor.schema.image.propSchema.src.default=="string"&&e.editor.schema.image.propSchema.src.values===void 0&&o[0].props.src!=="",[e.editor.schema,o]),[i,d]=l.useState(r?o[0].props.caption:"");l.useEffect(()=>d(r?o[0].props.caption:""),[o,r]);const c=l.useCallback(g=>{g.key==="Enter"&&(g.preventDefault(),e.editor.updateBlock(o[0],{type:"image",props:{caption:i}}))},[i,e.editor,o]),f=l.useCallback(g=>d(g.currentTarget.value),[]);return r?n.jsxs(Ze,{children:[n.jsx(D,{mainTooltip:"Edit Caption",icon:Q,isSelected:o[0].props.caption!==""}),n.jsx(Qe,{children:n.jsx(xe,{type:"text",icon:Q,inputProps:{autoFocus:!0,placeholder:"Edit Caption",value:i,onKeyDown:c,onChange:f}})})]}):null},tt=e=>n.jsxs(re,{children:[n.jsx(Ye,{...e,items:e.blockTypeDropdownItems}),n.jsx(Mn,{editor:e.editor}),n.jsx(jn,{editor:e.editor}),n.jsx($,{editor:e.editor,toggledStyle:"bold"}),n.jsx($,{editor:e.editor,toggledStyle:"italic"}),n.jsx($,{editor:e.editor,toggledStyle:"underline"}),n.jsx($,{editor:e.editor,toggledStyle:"strike"}),n.jsx(ae,{editor:e.editor,textAlignment:"left"}),n.jsx(ae,{editor:e.editor,textAlignment:"center"}),n.jsx(ae,{editor:e.editor,textAlignment:"right"}),n.jsx(Ke,{editor:e.editor}),n.jsx(Je,{editor:e.editor}),n.jsx(Xe,{editor:e.editor}),n.jsx(et,{editor:e.editor})]}),nt=e=>{switch(e){case"left":return"top-start";case"center":return"top";case"right":return"top-end";default:return"top-start"}},ot=e=>{const[o,r]=l.useState(!1),[i,d]=l.useState(()=>{const a=e.editor.getTextCursorPosition().block;return"textAlignment"in a.props?nt(a.props.textAlignment):"top-start"}),c=l.useRef();l.useEffect(()=>(ge.tippy.setDefaultProps({maxWidth:""}),e.editor.formattingToolbar.onUpdate(a=>{r(a.show),c.current=a.referencePos})),[e.editor]),R(e.editor,()=>{const a=e.editor.getTextCursorPosition().block;"textAlignment"in a.props?d(nt(a.props.textAlignment)):d("top-start")});const f=l.useMemo(()=>{if(c)return()=>c.current},[c.current]),g=l.useMemo(()=>{const a=e.formattingToolbar||tt;return n.jsx(a,{editor:e.editor})},[e.editor,e.formattingToolbar]);return n.jsx(U.default,{appendTo:e.editor.domElement.parentElement,content:g,getReferenceClientRect:f,interactive:!0,visible:o,animation:"fade",placement:i,sticky:!0,plugins:wn,zIndex:3e3})},wn=[Yt.sticky],En=e=>{const[o,r]=l.useState(!1),i=l.useRef(null);return o?n.jsx($e,{url:e.url,text:e.text,update:e.editHyperlink,onBlur:d=>setTimeout(()=>{var c;(c=i.current)!=null&&c.contains(d.relatedTarget)||r(!1)},500),ref:i}):n.jsxs(re,{onMouseEnter:e.stopHideTimer,onMouseLeave:e.startHideTimer,children:[n.jsx(D,{mainTooltip:"Edit",isSelected:!1,onClick:()=>r(!0),children:"Edit Link"}),n.jsx(D,{mainTooltip:"Open in new tab",isSelected:!1,onClick:()=>{window.open(e.url,"_blank")},icon:hn}),n.jsx(D,{mainTooltip:"Remove link",isSelected:!1,onClick:e.deleteHyperlink,icon:cn})]})},rt=e=>{const[o,r]=l.useState(!1),[i,d]=l.useState(),[c,f]=l.useState(),g=l.useRef();l.useEffect(()=>e.editor.hyperlinkToolbar.on("update",m=>{r(m.show),d(m.url),f(m.text),g.current=m.referencePos}),[e.editor]);const a=l.useMemo(()=>{if(g.current)return()=>g.current},[g.current]),p=l.useMemo(()=>{if(!i||!c)return null;const m=e.hyperlinkToolbar||En;return n.jsx(m,{url:i,text:c,editHyperlink:e.editor.hyperlinkToolbar.editHyperlink,deleteHyperlink:e.editor.hyperlinkToolbar.deleteHyperlink,startHideTimer:e.editor.hyperlinkToolbar.startHideTimer,stopHideTimer:e.editor.hyperlinkToolbar.stopHideTimer})},[e.hyperlinkToolbar,e.editor,c,i]);return n.jsx(U.default,{appendTo:e.editor.domElement.parentElement,content:p,getReferenceClientRect:a,interactive:!0,visible:o,animation:"fade",placement:"top-start",zIndex:4e3})},it=e=>{const{classes:o}=h.createStyles({root:{}})(void 0,{name:"SideMenu"});return n.jsx(h.Group,{className:o.root,spacing:0,children:e.children})};function zn(e){return S({tag:"svg",attr:{t:"1551322312294",style:"",viewBox:"0 0 1024 1024",version:"1.1"},child:[{tag:"defs",attr:{},child:[]},{tag:"path",attr:{d:"M474 152m8 0l60 0q8 0 8 8l0 704q0 8-8 8l-60 0q-8 0-8-8l0-704q0-8 8-8Z"}},{tag:"path",attr:{d:"M168 474m8 0l672 0q8 0 8 8l0 60q0 8-8 8l-672 0q-8 0-8-8l0-60q0-8 8-8Z"}}]})(e)}const ye=e=>n.jsx(h.ActionIcon,{size:24,children:e.children}),at=e=>n.jsx(ye,{children:n.jsx(zn,{size:24,onClick:e.addBlock,"data-test":"dragHandleAdd"})});function Bn(e){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}}]})(e)}const lt=e=>{const{classes:o}=h.createStyles({root:{}})(void 0,{name:"DragHandleMenu"});return n.jsx(h.Menu.Dropdown,{className:o.root,style:{overflow:"visible"},children:e.children})},Ce=e=>{const{children:o,...r}=e;return n.jsx(h.Menu.Item,{...r,children:o})},st=e=>n.jsx(Ce,{onClick:()=>e.editor.removeBlocks([e.block]),children:e.children}),ct=e=>{const[o,r]=l.useState(!1),{ref:i,updateMaxHeight:d}=ie(),c=l.useRef(),f=l.useCallback(()=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{r(!1)},250)},[]),g=l.useCallback(()=>{c.current&&clearTimeout(c.current),o||d(),r(!0)},[o,d]);return!("textColor"in e.block.props)&&!("backgroundColor"in e.block.props)?null:n.jsx(Ce,{onMouseLeave:f,onMouseOver:g,children:n.jsxs(h.Menu,{opened:o,position:"right",children:[n.jsx(h.Menu.Target,{children:n.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[n.jsx("div",{style:{flex:1},children:e.children}),n.jsx(h.Box,{style:{display:"flex",alignItems:"center"},children:n.jsx(mn,{size:15})})]})}),n.jsx("div",{ref:i,children:n.jsx(h.Menu.Dropdown,{onMouseLeave:f,onMouseOver:g,style:{marginLeft:"5px"},children:n.jsx(Ge,{iconSize:18,text:"textColor"in e.block.props&&typeof e.block.props.textColor=="string"?{color:e.block.props.textColor,setColor:a=>e.editor.updateBlock(e.block,{props:{textColor:a}})}:void 0,background:"backgroundColor"in e.block.props&&typeof e.block.props.backgroundColor=="string"?{color:e.block.props.backgroundColor,setColor:a=>e.editor.updateBlock(e.block,{props:{backgroundColor:a}})}:void 0})})})]})})},dt=e=>n.jsxs(lt,{children:[n.jsx(st,{...e,children:"Delete"}),n.jsx(ct,{...e,children:"Colors"})]}),ut=e=>{const o=e.dragHandleMenu||dt;return n.jsxs(h.Menu,{trigger:"click",onOpen:e.freezeMenu,onClose:e.unfreezeMenu,width:100,position:"left",children:[n.jsx(h.Menu.Target,{children:n.jsx("div",{draggable:"true",onDragStart:e.blockDragStart,onDragEnd:e.blockDragEnd,children:n.jsx(ye,{children:n.jsx(Bn,{size:24,"data-test":"dragHandle"})})})}),n.jsx(o,{editor:e.editor,block:e.block})]})},ft=e=>n.jsxs(it,{children:[n.jsx(at,{...e}),n.jsx(ut,{...e})]}),gt=e=>{const[o,r]=l.useState(!1),[i,d]=l.useState(),c=l.useRef();l.useEffect(()=>e.editor.sideMenu.onUpdate(a=>{r(a.show),d(a.block),c.current=a.referencePos}),[e.editor]);const f=l.useMemo(()=>{if(c.current)return()=>c.current},[c.current]),g=l.useMemo(()=>{if(!i)return null;const a=e.sideMenu||ft;return n.jsx(a,{block:i,editor:e.editor,blockDragStart:e.editor.sideMenu.blockDragStart,blockDragEnd:e.editor.sideMenu.blockDragEnd,addBlock:e.editor.sideMenu.addBlock,freezeMenu:e.editor.sideMenu.freezeMenu,unfreezeMenu:e.editor.sideMenu.unfreezeMenu})},[i,e.editor,e.sideMenu]);return n.jsx(U.default,{appendTo:e.editor.domElement.parentElement,content:g,getReferenceClientRect:f,interactive:!0,visible:o,animation:"fade",offset:Hn,placement:"left",popperOptions:In,zIndex:1e3})},Hn=[0,0],In={modifiers:[{name:"flip",options:{fallbackPlacements:[]}},{name:"preventOverflow",options:{mainAxis:!1,altAxis:!1}}]},_n=5;function ht(e){const o=l.useRef(null),{classes:r}=h.createStyles({root:{}})(void 0,{name:"SuggestionListItem"});function i(){var g;const c=e.isSelected,f=(g=o.current)==null?void 0:g.matches(":hover");return c||f}function d(){var c,f;i()?(c=o.current)==null||c.setAttribute("data-hovered","true"):(f=o.current)==null||f.removeAttribute("data-hovered")}return l.useEffect(()=>{d(),i()&&o.current&&o.current.getBoundingClientRect().left>_n&&o.current.scrollIntoView({behavior:"smooth",block:"nearest"})}),n.jsx(h.Menu.Item,{className:r.root,icon:e.icon,onClick:e.set,closeMenuOnClick:!1,onMouseLeave:()=>{setTimeout(()=>{d()},1)},ref:o,rightSection:e.shortcut&&n.jsx(h.Badge,{size:"xs",children:e.shortcut}),children:n.jsxs(h.Stack,{children:[n.jsx(h.Text,{size:14,weight:500,children:e.name}),n.jsx(h.Text,{size:10,children:e.hint})]})})}function vt(e){const{classes:o}=h.createStyles({root:{}})(void 0,{name:"SlashMenu"}),r=[];let i=0;const d=_.groupBy(e.filteredItems,c=>c.group);return _.forEach(d,c=>{r.push(n.jsx(h.Menu.Label,{children:c[0].group},c[0].group));for(const f of c)r.push(n.jsx(ht,{name:f.name,icon:f.icon,hint:f.hint,shortcut:f.shortcut,isSelected:e.keyboardHoveredItemIndex===i,set:()=>e.itemCallback(f)},f.name)),i++}),n.jsx(h.Menu,{defaultOpened:!0,trigger:"hover",closeDelay:1e7,children:n.jsx(h.Menu.Dropdown,{onMouseDown:c=>c.preventDefault(),className:o.root,children:r.length>0?r:n.jsx(h.Menu.Item,{children:"No match found"})})})}const bt=e=>{const[o,r]=l.useState(!1),[i,d]=l.useState(),[c,f]=l.useState(),g=l.useRef();l.useEffect(()=>e.editor.slashMenu.onUpdate(E=>{r(E.show),d(E.filteredItems),f(E.keyboardHoveredItemIndex),g.current=E.referencePos}),[e.editor]);const a=l.useMemo(()=>{if(g.current)return()=>g.current},[g.current]),{ref:p,updateMaxHeight:m}=ie(),T=l.useMemo(()=>{if(!i||c===void 0)return null;const E=e.slashMenu||vt;return n.jsx("div",{ref:p,children:n.jsx(E,{filteredItems:i,itemCallback:w=>e.editor.slashMenu.itemCallback(w),keyboardHoveredItemIndex:c})})},[i,c,e.editor.slashMenu,e.slashMenu,p]);return n.jsx(U.default,{onShow:m,appendTo:e.editor.domElement.parentElement,content:T,getReferenceClientRect:a,interactive:!0,visible:o,animation:"fade",placement:"bottom-start",zIndex:2e3})},y=["#FFFFFF","#EFEFEF","#CFCFCF","#AFAFAF","#7F7F7F","#3F3F3F","#1F1F1F","#161616","#0F0F0F","#000000"],ee={colors:{editor:{text:y[5],background:y[0]},menu:{text:y[5],background:y[0]},tooltip:{text:y[5],background:y[1]},hovered:{text:y[5],background:y[1]},selected:{text:y[0],background:y[5]},disabled:{text:y[3],background:y[1]},shadow:y[2],border:y[1],sideMenu:y[2],highlightColors:{gray:{text:"#9b9a97",background:"#ebeced"},brown:{text:"#64473a",background:"#e9e5e3"},red:{text:"#e03e3e",background:"#fbe4e4"},orange:{text:"#d9730d",background:"#f6e9d9"},yellow:{text:"#dfab01",background:"#fbf3db"},green:{text:"#4d6461",background:"#ddedea"},blue:{text:"#0b6e99",background:"#ddebf1"},purple:{text:"#6940a5",background:"#eae4f2"},pink:{text:"#ad1a72",background:"#f4dfeb"}}},borderRadius:6,fontFamily:'"Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Open Sans", "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif'},pe={colors:{editor:{text:y[2],background:y[6]},menu:{text:y[2],background:y[6]},tooltip:{text:y[2],background:y[7]},hovered:{text:y[2],background:y[7]},selected:{text:y[2],background:y[8]},disabled:{text:y[5],background:y[7]},shadow:y[8],border:y[7],sideMenu:y[4],highlightColors:{gray:{text:"#bebdb8",background:"#9b9a97"},brown:{text:"#8e6552",background:"#64473a"},red:{text:"#ec4040",background:"#be3434"},orange:{text:"#e3790d",background:"#b7600a"},yellow:{text:"#dfab01",background:"#b58b00"},green:{text:"#6b8b87",background:"#4d6461"},blue:{text:"#0e87bc",background:"#0b6e99"},purple:{text:"#8552d7",background:"#6940a5"},pink:{text:"#da208f",background:"#ad1a72"}}},borderRadius:ee.borderRadius,fontFamily:ee.fontFamily},mt=e=>{const[o,r]=l.useState(!1),[i,d]=l.useState(),c=l.useRef();l.useEffect(()=>(ge.tippy.setDefaultProps({maxWidth:""}),e.editor.imageToolbar.onUpdate(a=>{r(a.show),d(a.block),c.current=a.referencePos})),[e.editor]);const f=l.useMemo(()=>{if(c)return()=>c.current},[c.current]),g=l.useMemo(()=>{const a=e.imageToolbar||ke;return n.jsx(a,{editor:e.editor,block:i})},[i,e.editor,e.imageToolbar]);return n.jsx(U.default,{appendTo:e.editor.domElement.parentElement,content:g,getReferenceClientRect:f,interactive:!0,visible:o,animation:"fade",placement:"bottom",zIndex:5e3})};function Dn(e){var f;const{classes:o}=h.createStyles({root:{}})(void 0,{name:"Editor"}),{editor:r,children:i,className:d,...c}=e;return n.jsx(oe.EditorContent,{editor:(f=e.editor)==null?void 0:f._tiptapEditor,className:M.mergeCSSClasses(o.root,e.className||""),...c,children:e.children||n.jsxs(n.Fragment,{children:[n.jsx(ot,{editor:e.editor}),n.jsx(rt,{editor:e.editor}),n.jsx(bt,{editor:e.editor}),n.jsx(gt,{editor:e.editor}),n.jsx(mt,{editor:e.editor})]})})}function Pn(e){const{theme:o={light:ee,dark:pe},...r}=e,i=Kt.default(),d=l.useMemo(()=>o==="light"?Z(ee):o==="dark"?Z(pe):"light"in o&&"dark"in o?Z(o[i==="dark"?"dark":"light"]):Z(o),[i,o]);return n.jsx(h.MantineProvider,{theme:d,children:n.jsx(Dn,{...r})})}const On={Heading:{group:"Headings",icon:n.jsx(Oe,{size:18}),hint:"Used for a top-level heading",shortcut:F("Mod-Alt-1")},"Heading 2":{group:"Headings",icon:n.jsx(Fe,{size:18}),hint:"Used for key sections",shortcut:F("Mod-Alt-2")},"Heading 3":{group:"Headings",icon:n.jsx(Ae,{size:18}),hint:"Used for subsections and group headings",shortcut:F("Mod-Alt-3")},"Numbered List":{group:"Basic blocks",icon:n.jsx(Le,{size:18}),hint:"Used to display a numbered list",shortcut:F("Mod-Alt-7")},"Bullet List":{group:"Basic blocks",icon:n.jsx(Ve,{size:18}),hint:"Used to display an unordered list",shortcut:F("Mod-Alt-9")},Paragraph:{group:"Basic blocks",icon:n.jsx(Q,{size:18}),hint:"Used for the body of your document",shortcut:F("Mod-Alt-0")},Image:{group:"Media",icon:n.jsx(fn,{}),hint:"Insert an image"}};function xt(e=M.defaultBlockSchema){return M.getDefaultSlashMenuItems(e).map(r=>({...r,...On[r.name]}))}const Fn=e=>new M.BlockNoteEditor({slashMenuItems:xt(e.blockSchema||M.defaultBlockSchema),...e}),An=(e={},o=[])=>{const r=l.useRef();return l.useMemo(()=>(r.current&&r.current._tiptapEditor.destroy(),r.current=Fn(e),r.current),o)};function Rn(){const[,e]=l.useState(0);return()=>e(o=>o+1)}const Ln=e=>{const o=Rn();l.useEffect(()=>{const r=()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{o()})})};return e.on("transaction",r),()=>{e.off("transaction",r)}},[e])},kt=l.createContext({}),Vn=e=>{const o=l.useContext(kt).inlineContent||{},r=M.mergeCSSClasses(e.className||"",M.blockStyles.inlineContent,o.class);return n.jsx(oe.NodeViewContent,{...Object.fromEntries(Object.entries(o).filter(([i])=>i!=="class")),...e,className:r})};function Un(e){return{node:M.createTipTapBlock({name:e.type,content:e.containsInlineContent?"inline*":"",selectable:!0,addAttributes(){return M.propsToAttributes(e)},parseHTML(){return M.parse(e)},renderHTML({HTMLAttributes:r}){return M.render(e,r)},addNodeView(){const r=i=>{var w;const d=e.render,c=((w=this.options.domAttributes)==null?void 0:w.blockContent)||{},f={};for(const[O,le]of Object.entries(i.node.attrs))O in e.propSchema&&le!==e.propSchema[O].default&&(f[M.camelToDataKebab(O)]=le);const g=this.options.editor,a=typeof i.getPos=="function"?i.getPos():void 0,T=g._tiptapEditor.state.doc.resolve(a).node().attrs.id,E=g.getBlock(T);if(E.type!==e.type)throw new Error("Block type does not match");return n.jsx(oe.NodeViewWrapper,{...Object.fromEntries(Object.entries(c).filter(([O])=>O!=="class")),className:M.mergeCSSClasses(M.blockStyles.blockContent,c.class),"data-content-type":e.type,...f,children:n.jsx(kt.Provider,{value:this.options.domAttributes||{},children:n.jsx(d,{block:E,editor:g})})})};return oe.ReactNodeViewRenderer(r,{className:M.blockStyles.reactNodeViewRenderer})}}),propSchema:e.propSchema}}v.AddBlockButton=at,v.BlockColorsButton=ct,v.BlockNoteView=Pn,v.BlockTypeDropdown=Ye,v.ColorStyleButton=Ke,v.CreateLinkButton=et,v.DefaultDragHandleMenu=dt,v.DefaultFormattingToolbar=tt,v.DefaultImageToolbar=ke,v.DefaultSideMenu=ft,v.DefaultSlashMenu=vt,v.DragHandle=ut,v.DragHandleMenu=lt,v.DragHandleMenuItem=Ce,v.FormattingToolbarPositioner=ot,v.HyperlinkToolbarPositioner=rt,v.ImageToolbarPositioner=mt,v.InlineContent=Vn,v.NestBlockButton=Je,v.RemoveBlockButton=st,v.SideMenu=it,v.SideMenuButton=ye,v.SideMenuPositioner=gt,v.SlashMenuItem=ht,v.SlashMenuPositioner=bt,v.TextAlignButton=ae,v.ToggledStyleButton=$,v.Toolbar=re,v.ToolbarButton=D,v.ToolbarDropdown=Ue,v.UnnestBlockButton=Xe,v.blockNoteToMantineTheme=Z,v.createReactBlockSpec=Un,v.darkDefaultTheme=pe,v.defaultBlockTypeDropdownItems=qe,v.defaultColorScheme=y,v.getDefaultReactSlashMenuItems=xt,v.lightDefaultTheme=ee,v.useBlockNote=An,v.useEditorChange=R,v.useEditorContentChange=Ne,v.useEditorForceUpdate=Ln,v.useEditorSelectionChange=We,v.useSelectedBlocks=W,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});
//# sourceMappingURL=blocknote-react.umd.cjs.map
