@yoopta/themes-shadcn 6.0.0-beta.11 → 6.0.0-beta.13

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.
@@ -1 +1 @@
1
- {"version":3,"file":"mention-element.d.ts","sourceRoot":"","sources":["../../../../src/mention/elements/mention/mention-element.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAiC/D,eAAO,MAAM,cAAc,UAAW,wBAAwB,4CA0L7D,CAAC"}
1
+ {"version":3,"file":"mention-element.d.ts","sourceRoot":"","sources":["../../../../src/mention/elements/mention/mention-element.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAiC/D,eAAO,MAAM,cAAc,UAAW,wBAAwB,4CAwL7D,CAAC"}
package/dist/mention.js CHANGED
@@ -10,4 +10,4 @@ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as r from
10
10
  *
11
11
  * This source code is licensed under the ISC license.
12
12
  * See the LICENSE file in the root directory of this source tree.
13
- */const _=({name:t,avatar:n,size:r="inline",className:o})=>{const a=i(()=>function(e){const t=e.trim().split(/\s+/);return 1===t.length?t[0].slice(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}(t),[t]),s=i(()=>function(e){let t=0;for(let n=0;n<e.length;n+=1)t=e.charCodeAt(n)+((t<<5)-t);const n=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"];return n[Math.abs(t)%n.length]}(t),[t]),l=L[r];return n?e("img",{src:n,alt:t,style:{width:l.width,height:l.height},className:x("rounded-full object-cover flex-shrink-0",o)}):e("div",Object.assign({style:{width:l.width,height:l.height},className:x("rounded-full flex items-center justify-center font-medium text-white flex-shrink-0",s,o)},{children:a}))},F={user:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",channel:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",page:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",custom:"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200"},q=({type:t})=>{const n="w-3.5 h-3.5";switch(t){case"user":default:return e(D,{className:n});case"channel":return e(A,{className:n});case"page":return e(C,{className:n})}},I=r=>{var o;const{attributes:i,children:s,element:l,blockId:c}=r,u=p(),[d,f]=a(!1),{id:g,name:m,avatar:v,type:y,meta:P}=l.props,C=y?null!==(o=F[y])&&void 0!==o?o:F.custom:null,T=null==P?void 0:P.url,M=null==P?void 0:P.description,D=e=>{e.preventDefault(),e.stopPropagation(),T&&window.open(T,"_blank","noopener,noreferrer")};return t(k,Object.assign({openDelay:300,closeDelay:150},{children:[e(S,Object.assign({asChild:!0},{children:e("span",Object.assign({className:x("bg-primary/10 text-primary font-medium","hover:bg-primary/15 transition-colors cursor-pointer"),style:{borderRadius:"0.25em"}},{children:t("span",Object.assign({},i,{contentEditable:!1,onClick:e=>{T&&e.metaKey&&D(e)},"data-mention-id":g,"data-mention-type":y,className:"inline-flex items-center align-baseline",style:{padding:"0.25em",margin:"0 0.15em",gap:"0.25em",fontSize:"0.85em",lineHeight:"inherit",height:0}},{children:[e(_,{name:m,avatar:v,size:"inline"}),e("span",Object.assign({style:{marginLeft:"0.15em"}},{children:m})),s]}))}))})),t(j,Object.assign({className:"w-72 p-0",side:"top",align:"start",sideOffset:8,onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation()},{children:[e("div",Object.assign({className:"p-2"},{children:t("div",Object.assign({className:"flex items-start gap-3"},{children:[e(_,{name:m,avatar:v,size:"md"}),t("div",Object.assign({className:"flex-1 min-w-0 pt-0.5"},{children:[t("div",Object.assign({className:"flex items-center gap-2"},{children:[e("h4",Object.assign({className:"font-semibold text-sm truncate"},{children:m})),y&&t("span",Object.assign({className:x("inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded-md font-medium shrink-0",C)},{children:[e(q,{type:y}),y]}))]})),M&&e("p",Object.assign({className:"text-xs text-muted-foreground line-clamp-2 leading-relaxed"},{children:M}))]}))]}))})),((null==P?void 0:P.email)||T)&&t("div",Object.assign({className:"px-2 pb-2 space-y-1"},{children:[(null==P?void 0:P.email)&&t("div",Object.assign({className:"flex items-center gap-2 text-xs text-muted-foreground"},{children:[e(B,{className:"w-3.5 h-3.5 shrink-0"}),e("span",Object.assign({className:"truncate"},{children:P.email}))]})),T&&t("div",Object.assign({className:"flex items-center gap-2 text-xs text-muted-foreground"},{children:[e(E,{className:"w-3.5 h-3.5 shrink-0"}),e("span",Object.assign({className:"truncate"},{children:T}))]}))]})),t("div",Object.assign({className:"flex items-center gap-0.5 p-1 border-t"},{children:[T&&t(O,Object.assign({variant:"ghost",size:"sm",className:"h-8 px-2 text-xs flex-1",onClick:D},{children:[e(E,{className:"w-3.5 h-3.5 mr-1.5"}),"Open"]})),e(O,Object.assign({variant:"ghost",size:"sm",className:"h-8 px-2 text-xs flex-1",onClick:e=>{e.preventDefault(),e.stopPropagation();w(null!=T?T:`@${m}`)&&(f(!0),setTimeout(()=>f(!1),1500))}},{children:t(n,d?{children:[e(N,{className:"w-3.5 h-3.5 mr-1.5 text-green-600 dark:text-green-400"}),e("span",Object.assign({className:"text-green-600 dark:text-green-400"},{children:"Copied"}))]}:{children:[e(b,{className:"w-3.5 h-3.5 mr-1.5"}),"Copy"]})})),!u.readOnly&&e(O,Object.assign({variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive hover:bg-destructive/10",onClick:e=>{if(u.readOnly)return;e.preventDefault(),e.stopPropagation();const t=h.getElementPath(u,{blockId:c,element:l});t&&h.deleteElement(u,{type:"mention",path:t,blockId:c})},title:"Delete mention"},{children:e(R,{className:"w-3.5 h-3.5"})}))]}))]}))]}))};var W={ancestors(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=W.levels(e,t);return n?r.slice(1):r.slice(0,-1)},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var o=e[r];if(o!==t[r])break;n.push(o)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),i=e[n],a=t[n];return W.equals(r,o)&&i>a},endsAt(e,t){var n=e.length,r=e.slice(0,n),o=t.slice(0,n);return W.equals(r,o)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),i=e[n],a=t[n];return W.equals(r,o)&&i<a},equals:(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),hasPrevious:e=>e[e.length-1]>0,isAfter:(e,t)=>1===W.compare(e,t),isAncestor:(e,t)=>e.length<t.length&&0===W.compare(e,t),isBefore:(e,t)=>-1===W.compare(e,t),isChild:(e,t)=>e.length===t.length+1&&0===W.compare(e,t),isCommon:(e,t)=>e.length<=t.length&&0===W.compare(e,t),isDescendant:(e,t)=>e.length>t.length&&0===W.compare(e,t),isParent:(e,t)=>e.length+1===t.length&&0===W.compare(e,t),isPath:e=>Array.isArray(e)&&(0===e.length||"number"==typeof e[0]),isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1);return e[e.length-1]!==t[t.length-1]&&W.equals(n,r)},levels(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=[],o=0;o<=e.length;o++)r.push(e.slice(0,o));return n&&r.reverse(),r},next(e){if(0===e.length)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(0===e.length)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(0===e.length)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!W.isAncestor(t,e)&&!W.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:o="forward"}=n;if(0===e.length)return r;switch(t.type){case"insert_node":var{path:i}=t;(W.equals(i,r)||W.endsBefore(i,r)||W.isAncestor(i,r))&&(r[i.length-1]+=1);break;case"remove_node":var{path:a}=t;if(W.equals(a,r)||W.isAncestor(a,r))return null;W.endsBefore(a,r)&&(r[a.length-1]-=1);break;case"merge_node":var{path:s,position:l}=t;W.equals(s,r)||W.endsBefore(s,r)?r[s.length-1]-=1:W.isAncestor(s,r)&&(r[s.length-1]-=1,r[s.length]+=l);break;case"split_node":var{path:c,position:u}=t;if(W.equals(c,r)){if("forward"===o)r[r.length-1]+=1;else if("backward"!==o)return null}else W.endsBefore(c,r)?r[c.length-1]+=1:W.isAncestor(c,r)&&e[c.length]>=u&&(r[c.length-1]+=1,r[c.length]-=u);break;case"move_node":var{path:d,newPath:f}=t;if(W.equals(d,f))return r;if(W.isAncestor(d,r)||W.equals(d,r)){var p=f.slice();return W.endsBefore(d,f)&&d.length<f.length&&(p[d.length-1]-=1),p.concat(r.slice(d.length))}W.isSibling(d,f)&&(W.isAncestor(f,r)||W.equals(f,r))?W.endsBefore(d,r)?r[d.length-1]-=1:r[d.length-1]+=1:W.endsBefore(f,r)||W.equals(f,r)||W.isAncestor(f,r)?(W.endsBefore(d,r)&&(r[d.length-1]-=1),r[f.length-1]+=1):W.endsBefore(d,r)&&(W.equals(f,r)&&(r[f.length-1]+=1),r[d.length-1]-=1)}return r}};function z(e){return z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},z(e)}function V(e,t,n){return(t=function(e){var t=function(e){if("object"!==z(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==z(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===z(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function H(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var K=["anchor","focus"];function U(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var $={edges(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:o}=e;return $.isBackward(e)===n?[r,o]:[o,r]},end(e){var[,t]=$.edges(e);return t},equals:(e,t)=>fe.equals(e.anchor,t.anchor)&&fe.equals(e.focus,t.focus),surrounds(e,t){var n=$.intersection(e,t);return!!n&&$.equals(n,t)},includes(e,t){if($.isRange(t)){if($.includes(e,t.anchor)||$.includes(e,t.focus))return!0;var[n,r]=$.edges(e),[o,i]=$.edges(t);return fe.isBefore(n,o)&&fe.isAfter(r,i)}var[a,s]=$.edges(e),l=!1,c=!1;return fe.isPoint(t)?(l=fe.compare(t,a)>=0,c=fe.compare(t,s)<=0):(l=W.compare(t,a.path)>=0,c=W.compare(t,s.path)<=0),l&&c},intersection(e,t){var n=H(e,K),[r,o]=$.edges(e),[i,a]=$.edges(t),s=fe.isBefore(r,i)?i:r,l=fe.isBefore(o,a)?o:a;return fe.isBefore(l,s)?null:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?U(Object(n),!0).forEach(function(t){V(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):U(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({anchor:s,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return fe.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return fe.equals(t,n)},isExpanded:e=>!$.isCollapsed(e),isForward:e=>!$.isBackward(e),isRange:e=>ae(e)&&fe.isPoint(e.anchor)&&fe.isPoint(e.focus),*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=$.edges(e);return t},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null===e)return null;var r,o,{affinity:i="inward"}=n;if("inward"===i){var a=$.isCollapsed(e);$.isForward(e)?(r="forward",o=a?r:"backward"):(r="backward",o=a?r:"forward")}else"outward"===i?$.isForward(e)?(r="backward",o="forward"):(r="forward",o="backward"):(r=i,o=i);var s=fe.transform(e.anchor,t,{affinity:r}),l=fe.transform(e.focus,t,{affinity:o});return s&&l?{anchor:s,focus:l}:null}},X=function(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!!ae(e)&&"function"!=typeof e.apply&&(t?ee.isNodeList(e.children):Array.isArray(e.children))},J={isAncestor(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return ae(e)&&ee.isNodeList(e.children,{deep:t})},isElement:X,isElementList(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)&&e.every(e=>J.isElement(e,{deep:t}))},isElementProps:e=>void 0!==e.children,isElementType:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"type";return X(e)&&e[n]===t},matches(e,t){for(var n in t)if("children"!==n&&e[n]!==t[n])return!1;return!0}},Q=["children"],Y=["text"];function Z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function G(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Z(Object(n),!0).forEach(function(t){V(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Z(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var ee={ancestor(e,t){var n=ee.get(e,t);if(be.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(he.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of W.ancestors(t,n)){var o=[ee.ancestor(e,r),r];yield o}}()},child(e,t){if(be.isText(e))throw new Error("Cannot get the child of a text node: ".concat(he.stringify(e)));var n=e.children[t];if(null==n)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(he.stringify(e)));return n},children(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,o=ee.ancestor(e,t),{children:i}=o,a=r?i.length-1:0;r?a>=0:a<i.length;){var s=ee.child(o,a),l=t.concat(a);yield[s,l],a=r?a-1:a+1}}()},common(e,t,n){var r=W.common(t,n);return[ee.get(e,r),r]},descendant(e,t){var n=ee.get(e,t);if(ce.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(he.stringify(n)));return n},descendants(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of ee.nodes(e,t))0!==r.length&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of ee.nodes(e,t))J.isElement(n)&&(yield[n,r])}()},extractProps:e=>J.isAncestor(e)?H(e,Q):H(e,Y),first(e,t){for(var n=t.slice(),r=ee.get(e,n);r&&!be.isText(r)&&0!==r.children.length;)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){var n={children:e.children},[r,o]=$.edges(t),i=ee.nodes(n,{reverse:!0,pass:e=>{var[,n]=e;return!$.includes(t,n)}}),a=function(){if(!$.includes(t,s)){var e=s[s.length-1];Pe(n,W.parent(s),t=>Se(t,e,1))}W.equals(s,o.path)&&Ee(n,s,e=>{var t=e.text.slice(0,o.offset);return G(G({},e),{},{text:t})}),W.equals(s,r.path)&&Ee(n,s,e=>{var t=e.text.slice(r.offset);return G(G({},e),{},{text:t})})};for(var[,s]of i)a();return n.children},get(e,t){var n=ee.getIf(e,t);if(void 0===n)throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(he.stringify(e)));return n},getIf(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(be.isText(n)||!n.children[o])return;n=n.children[o]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(be.isText(n)||!n.children[o])return!1;n=n.children[o]}return!0},isNode(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return be.isText(e)||J.isElement(e,{deep:t})||ce.isEditor(e,{deep:t})},isNodeList(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)&&e.every(e=>ee.isNode(e,{deep:t}))},last(e,t){for(var n=t.slice(),r=ee.get(e,n);r&&!be.isText(r)&&0!==r.children.length;){var o=r.children.length-1;r=r.children[o],n.push(o)}return[r,n]},leaf(e,t){var n=ee.get(e,t);if(!be.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(he.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of W.levels(t,n)){var o=ee.get(e,r);yield[o,r]}}()},matches:(e,t)=>J.isElement(e)&&J.isElementProps(t)&&J.matches(e,t)||be.isText(e)&&be.isTextProps(t)&&be.matches(e,t),nodes(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:o=[],to:i}=t,a=new Set,s=[],l=e;!i||!(r?W.isBefore(s,i):W.isAfter(s,i));)if(a.has(l)||(yield[l,s]),a.has(l)||be.isText(l)||0===l.children.length||null!=n&&!1!==n([l,s])){if(0===s.length)break;if(!r){var c=W.next(s);if(ee.has(e,c)){s=c,l=ee.get(e,s);continue}}r&&0!==s[s.length-1]?(s=W.previous(s),l=ee.get(e,s)):(s=W.parent(s),l=ee.get(e,s),a.add(l))}else{a.add(l);var u=r?l.children.length-1:0;W.isAncestor(s,o)&&(u=o[s.length]),s=s.concat(u),l=ee.get(e,s)}}()},parent(e,t){var n=W.parent(t),r=ee.get(e,n);if(be.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string:e=>be.isText(e)?e.text:e.children.map(ee.string).join(""),texts(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of ee.nodes(e,t))be.isText(n)&&(yield[n,r])}()}};function te(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ne(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?te(Object(n),!0).forEach(function(t){V(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):te(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var re,oe,ie={isNodeOperation:e=>ie.isOperation(e)&&e.type.endsWith("_node"),isOperation(e){if(!ae(e))return!1;switch(e.type){case"insert_node":case"remove_node":return W.isPath(e.path)&&ee.isNode(e.node);case"insert_text":case"remove_text":return"number"==typeof e.offset&&"string"==typeof e.text&&W.isPath(e.path);case"merge_node":return"number"==typeof e.position&&W.isPath(e.path)&&ae(e.properties);case"move_node":return W.isPath(e.path)&&W.isPath(e.newPath);case"set_node":return W.isPath(e.path)&&ae(e.properties)&&ae(e.newProperties);case"set_selection":return null===e.properties&&$.isRange(e.newProperties)||null===e.newProperties&&$.isRange(e.properties)||ae(e.properties)&&ae(e.newProperties);case"split_node":return W.isPath(e.path)&&"number"==typeof e.position&&ae(e.properties);default:return!1}},isOperationList:e=>Array.isArray(e)&&e.every(e=>ie.isOperation(e)),isSelectionOperation:e=>ie.isOperation(e)&&e.type.endsWith("_selection"),isTextOperation:e=>ie.isOperation(e)&&e.type.endsWith("_text"),inverse(e){switch(e.type){case"insert_node":return ne(ne({},e),{},{type:"remove_node"});case"insert_text":return ne(ne({},e),{},{type:"remove_text"});case"merge_node":return ne(ne({},e),{},{type:"split_node",path:W.previous(e.path)});case"move_node":var{newPath:t,path:n}=e;if(W.equals(t,n))return e;if(W.isSibling(n,t))return ne(ne({},e),{},{path:t,newPath:n});var r=W.transform(n,e),o=W.transform(W.next(n),e);return ne(ne({},e),{},{path:r,newPath:o});case"remove_node":return ne(ne({},e),{},{type:"insert_node"});case"remove_text":return ne(ne({},e),{},{type:"insert_text"});case"set_node":var{properties:i,newProperties:a}=e;return ne(ne({},e),{},{properties:a,newProperties:i});case"set_selection":var{properties:s,newProperties:l}=e;return ne(ne({},e),{},null==s?{properties:l,newProperties:null}:null==l?{properties:null,newProperties:s}:{properties:l,newProperties:s});case"split_node":return ne(ne({},e),{},{type:"merge_node",path:W.next(e.path)})}}},ae=e=>"object"==typeof e&&null!==e,se=(e,t)=>{for(var n in e){var r=e[n],o=t[n];if(Array.isArray(r)&&Array.isArray(o)){if(r.length!==o.length)return!1;for(var i=0;i<r.length;i++)if(r[i]!==o[i])return!1}else if(ae(r)&&ae(o)){if(!se(r,o))return!1}else if(r!==o)return!1}for(var a in t)if(void 0===e[a]&&void 0!==t[a])return!1;return!0},le=e=>e.selection?e.selection:e.children.length>0?ce.end(e,[]):[0];(oe=re||(re={}))[oe.None=0]="None",oe[oe.Extend=1]="Extend",oe[oe.ZWJ=2]="ZWJ",oe[oe.RI=4]="RI",oe[oe.Prepend=8]="Prepend",oe[oe.SpacingMark=16]="SpacingMark",oe[oe.L=32]="L",oe[oe.V=64]="V",oe[oe.T=128]="T",oe[oe.LV=256]="LV",oe[oe.LVT=512]="LVT",oe[oe.ExtPict=1024]="ExtPict",oe[oe.Any=2048]="Any",re.L,re.L,re.V,re.LV,re.LVT,re.LV,re.V,re.V,re.T,re.LVT,re.T,re.T,re.Any,re.Extend,re.ZWJ,re.Any,re.SpacingMark,re.Prepend,re.Any,re.ZWJ,re.ExtPict,re.RI,re.RI;var ce={above:(e,t)=>e.above(t),addMark(e,t,n){e.addMark(t,n)},after:(e,t,n)=>e.after(t,n),before:(e,t,n)=>e.before(t,n),deleteBackward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteBackward(n)},deleteForward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteForward(n)},deleteFragment(e,t){e.deleteFragment(t)},edges:(e,t)=>e.edges(t),elementReadOnly(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.elementReadOnly(t)},end:(e,t)=>e.end(t),first:(e,t)=>e.first(t),fragment:(e,t)=>e.fragment(t),hasBlocks:(e,t)=>e.hasBlocks(t),hasInlines:(e,t)=>e.hasInlines(t),hasPath:(e,t)=>e.hasPath(t),hasTexts:(e,t)=>e.hasTexts(t),insertBreak(e){e.insertBreak()},insertFragment(e,t,n){e.insertFragment(t,n)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock:(e,t)=>e.isBlock(t),isEdge:(e,t,n)=>e.isEdge(t,n),isEditor:e=>function(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!!ae(e)&&("function"==typeof e.addMark&&"function"==typeof e.apply&&"function"==typeof e.deleteFragment&&"function"==typeof e.insertBreak&&"function"==typeof e.insertSoftBreak&&"function"==typeof e.insertFragment&&"function"==typeof e.insertNode&&"function"==typeof e.insertText&&"function"==typeof e.isElementReadOnly&&"function"==typeof e.isInline&&"function"==typeof e.isSelectable&&"function"==typeof e.isVoid&&"function"==typeof e.normalizeNode&&"function"==typeof e.onChange&&"function"==typeof e.removeMark&&"function"==typeof e.getDirtyPaths&&(null===e.marks||ae(e.marks))&&(null===e.selection||$.isRange(e.selection))&&(!t||ee.isNodeList(e.children))&&ie.isOperationList(e.operations))}(e),isElementReadOnly:(e,t)=>e.isElementReadOnly(t),isEmpty:(e,t)=>e.isEmpty(t),isEnd:(e,t,n)=>e.isEnd(t,n),isInline:(e,t)=>e.isInline(t),isNormalizing:e=>e.isNormalizing(),isSelectable:(e,t)=>e.isSelectable(t),isStart:(e,t,n)=>e.isStart(t,n),isVoid:(e,t)=>e.isVoid(t),last:(e,t)=>e.last(t),leaf:(e,t,n)=>e.leaf(t,n),levels:(e,t)=>e.levels(t),marks:e=>e.getMarks(),next:(e,t)=>e.next(t),node:(e,t,n)=>e.node(t,n),nodes:(e,t)=>e.nodes(t),normalize(e,t){e.normalize(t)},parent:(e,t,n)=>e.parent(t,n),path:(e,t,n)=>e.path(t,n),pathRef:(e,t,n)=>e.pathRef(t,n),pathRefs:e=>e.pathRefs(),point:(e,t,n)=>e.point(t,n),pointRef:(e,t,n)=>e.pointRef(t,n),pointRefs:e=>e.pointRefs(),positions:(e,t)=>e.positions(t),previous:(e,t)=>e.previous(t),range:(e,t,n)=>e.range(t,n),rangeRef:(e,t,n)=>e.rangeRef(t,n),rangeRefs:e=>e.rangeRefs(),removeMark(e,t){e.removeMark(t)},setNormalizing(e,t){e.setNormalizing(t)},start:(e,t)=>e.start(t),string:(e,t,n)=>e.string(t,n),unhangRange:(e,t,n)=>e.unhangRange(t,n),void:(e,t)=>e.void(t),withoutNormalizing(e,t){e.withoutNormalizing(t)},shouldMergeNodesRemovePrevNode:(e,t,n)=>e.shouldMergeNodesRemovePrevNode(t,n)};function ue(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function de(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ue(Object(n),!0).forEach(function(t){V(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ue(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var fe={compare(e,t){var n=W.compare(e.path,t.path);return 0===n?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter:(e,t)=>1===fe.compare(e,t),isBefore:(e,t)=>-1===fe.compare(e,t),equals:(e,t)=>e.offset===t.offset&&W.equals(e.path,t.path),isPoint:e=>ae(e)&&"number"==typeof e.offset&&W.isPath(e.path),transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null===e)return null;var{affinity:r="forward"}=n,{path:o,offset:i}=e;switch(t.type){case"insert_node":case"move_node":o=W.transform(o,t,n);break;case"insert_text":W.equals(t.path,o)&&(t.offset<i||t.offset===i&&"forward"===r)&&(i+=t.text.length);break;case"merge_node":W.equals(t.path,o)&&(i+=t.position),o=W.transform(o,t,n);break;case"remove_text":W.equals(t.path,o)&&t.offset<=i&&(i-=Math.min(i-t.offset,t.text.length));break;case"remove_node":if(W.equals(t.path,o)||W.isAncestor(t.path,o))return null;o=W.transform(o,t,n);break;case"split_node":if(W.equals(t.path,o)){if(t.position===i&&null==r)return null;(t.position<i||t.position===i&&"forward"===r)&&(i-=t.position,o=W.transform(o,t,de(de({},n),{},{affinity:"forward"})))}else o=W.transform(o,t,n);break;default:return e}return{path:o,offset:i}}},pe=void 0,he={setScrubber(e){pe=e},stringify:e=>JSON.stringify(e,pe)},ge=["text"],me=["anchor","focus","merge"];function ve(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ye(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ve(Object(n),!0).forEach(function(t){V(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ve(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var be={equals(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{loose:r=!1}=n;function o(e){return H(e,ge)}return se(r?o(e):e,r?o(t):t)},isText:e=>ae(e)&&"string"==typeof e.text,isTextList:e=>Array.isArray(e)&&e.every(e=>be.isText(e)),isTextProps:e=>void 0!==e.text,matches(e,t){for(var n in t)if("text"!==n&&(!e.hasOwnProperty(n)||e[n]!==t[n]))return!1;return!0},decorations(e,t){var n=[{leaf:ye({},e)}];for(var r of t){var{anchor:o,focus:i,merge:a}=r,s=H(r,me),[l,c]=$.edges(r),u=[],d=0,f=l.offset,p=c.offset,h=null!=a?a:Object.assign;for(var{leaf:g}of n){var{length:m}=g.text,v=d;if(d+=m,f<=v&&d<=p)h(g,s),u.push({leaf:g});else if(f!==p&&(f===d||p===v)||f>d||p<v||p===v&&0!==v)u.push({leaf:g});else{var y=g,b=void 0,w=void 0;if(p<d){var x=p-v;w={leaf:ye(ye({},y),{},{text:y.text.slice(x)})},y=ye(ye({},y),{},{text:y.text.slice(0,x)})}if(f>v){var O=f-v;b={leaf:ye(ye({},y),{},{text:y.text.slice(0,O)})},y=ye(ye({},y),{},{text:y.text.slice(O)})}h(y,s),b&&u.push(b),u.push({leaf:y}),w&&u.push(w)}}n=u}if(n.length>1){var k=0;for(var[S,j]of n.entries()){var P=k,E=P+j.leaf.text.length,N={start:P,end:E};0===S&&(N.isFirst=!0),S===n.length-1&&(N.isLast=!0),j.position=N,k=E}}return n}};function we(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function xe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?we(Object(n),!0).forEach(function(t){V(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):we(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Oe=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return[...e.slice(0,t),...r,...e.slice(t)]},ke=function(e,t,n){for(var r=arguments.length,o=new Array(r>3?r-3:0),i=3;i<r;i++)o[i-3]=arguments[i];return[...e.slice(0,t),...o,...e.slice(t+n)]},Se=ke,je=(e,t,n)=>{if(0===t.length)throw new Error("Cannot modify the editor");for(var r=ee.get(e,t),o=t.slice(),i=n(r);o.length>1;){var a=o.pop(),s=ee.get(e,o);i=xe(xe({},s),{},{children:ke(s.children,a,1,i)})}var l=o.pop();e.children=ke(e.children,l,1,i)},Pe=(e,t,n)=>{0===t.length?e.children=n(e.children):je(e,t,e=>{if(be.isText(e))throw new Error("Cannot get the element at path [".concat(t,"] because it refers to a leaf node: ").concat(he.stringify(e)));return xe(xe({},e),{},{children:n(e.children)})})},Ee=(e,t,n)=>je(e,t,e=>{if(!be.isText(e))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(he.stringify(e)));return n(e)});function Ne(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ne(Object(n),!0).forEach(function(t){V(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ne(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ce={transform(e,t){var n=!1;switch(t.type){case"insert_node":var{path:r,node:o}=t;Pe(e,W.parent(r),e=>{var t=r[r.length-1];if(t>e.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));return Oe(e,t,o)}),n=!0;break;case"insert_text":var{path:i,offset:a,text:s}=t;if(0===s.length)break;Ee(e,i,e=>{var t=e.text.slice(0,a),n=e.text.slice(a);return Re(Re({},e),{},{text:t+s+n})}),n=!0;break;case"merge_node":var{path:l}=t,c=l[l.length-1],u=W.previous(l),d=u[u.length-1];Pe(e,W.parent(l),e=>{var t,n=e[c],r=e[d];if(be.isText(n)&&be.isText(r))t=Re(Re({},r),{},{text:r.text+n.text});else{if(be.isText(n)||be.isText(r))throw new Error('Cannot apply a "merge_node" operation at path ['.concat(l,"] to nodes of different interfaces: ").concat(he.stringify(n)," ").concat(he.stringify(r)));t=Re(Re({},r),{},{children:r.children.concat(n.children)})}return ke(e,d,2,t)}),n=!0;break;case"move_node":var{path:f,newPath:p}=t,h=f[f.length-1];if(W.isAncestor(f,p))throw new Error("Cannot move a path [".concat(f,"] to new path [").concat(p,"] because the destination is inside itself."));var g=ee.get(e,f);Pe(e,W.parent(f),e=>Se(e,h,1));var m=W.transform(f,t),v=m[m.length-1];Pe(e,W.parent(m),e=>Oe(e,v,g)),n=!0;break;case"remove_node":var{path:y}=t,b=y[y.length-1];if(Pe(e,W.parent(y),e=>Se(e,b,1)),e.selection){var w=Re({},e.selection);for(var[x,O]of $.points(w)){var k=fe.transform(x,t);if(null!=w&&null!=k)w[O]=k;else{var S=void 0,j=void 0;for(var[P,E]of ee.texts(e)){if(-1!==W.compare(E,y)){j=[P,E];break}S=[P,E]}var N=!1;S&&j&&(N=!W.isSibling(S[1],y)&&(!!W.equals(j[1],y)||W.common(S[1],y).length<W.common(j[1],y).length)),S&&!N?w[O]={path:S[1],offset:S[0].text.length}:j?w[O]={path:j[1],offset:0}:w=null}}w&&$.equals(w,e.selection)||(e.selection=w)}break;case"remove_text":var{path:R,offset:C,text:T}=t;if(0===T.length)break;Ee(e,R,e=>{var t=e.text.slice(0,C),n=e.text.slice(C+T.length);return Re(Re({},e),{},{text:t+n})}),n=!0;break;case"set_node":var{path:M,properties:D,newProperties:A}=t;if(0===M.length)throw new Error("Cannot set properties on the root node!");je(e,M,e=>{var t=Re({},e);for(var n in A){if("children"===n||"text"===n)throw new Error('Cannot set the "'.concat(n,'" property of nodes!'));var r=A[n];null==r?delete t[n]:t[n]=r}for(var o in D)A.hasOwnProperty(o)||delete t[o];return t});break;case"set_selection":var{newProperties:B}=t;if(null==B){e.selection=null;break}if(null==e.selection){if(!$.isRange(B))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(he.stringify(B)," when there is no current selection."));e.selection=Re({},B);break}var L=Re({},e.selection);for(var _ in B){var F=B[_];if(null==F){if("anchor"===_||"focus"===_)throw new Error('Cannot remove the "'.concat(_,'" selection property'));delete L[_]}else L[_]=F}e.selection=L;break;case"split_node":var{path:q,position:I,properties:z}=t,V=q[q.length-1];if(0===q.length)throw new Error('Cannot apply a "split_node" operation at path ['.concat(q,"] because the root node cannot be split."));Pe(e,W.parent(q),e=>{var t,n,r=e[V];if(be.isText(r)){var o=r.text.slice(0,I),i=r.text.slice(I);t=Re(Re({},r),{},{text:o}),n=Re(Re({},z),{},{text:i})}else{var a=r.children.slice(0,I),s=r.children.slice(I);t=Re(Re({},r),{},{children:a}),n=Re(Re({},z),{},{children:s})}return ke(e,V,1,t,n)}),n=!0}if(n&&e.selection){var H=Re({},e.selection);for(var[K,U]of $.points(H))H[U]=fe.transform(K,t);$.equals(H,e.selection)||(e.selection=H)}}},Te={insertNodes(e,t,n){e.insertNodes(t,n)},liftNodes(e,t){e.liftNodes(t)},mergeNodes(e,t){e.mergeNodes(t)},moveNodes(e,t){e.moveNodes(t)},removeNodes(e,t){e.removeNodes(t)},setNodes(e,t,n){e.setNodes(t,n)},splitNodes(e,t){e.splitNodes(t)},unsetNodes(e,t,n){e.unsetNodes(t,n)},unwrapNodes(e,t){e.unwrapNodes(t)},wrapNodes(e,t,n){e.wrapNodes(t,n)}},Me={collapse(e,t){e.collapse(t)},deselect(e){e.deselect()},move(e,t){e.move(t)},select(e,t){e.select(t)},setPoint(e,t,n){e.setPoint(t,n)},setSelection(e,t){e.setSelection(t)}},De={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};ce.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:o=le(e)}=n;if(W.isPath(o)&&(o=ce.range(e,o)),$.isRange(o))if($.isCollapsed(o))o=o.anchor;else{var i=$.end(o);if(!r&&ce.void(e,{at:i}))return;var a=$.start(o),s=ce.pointRef(e,a),l=ce.pointRef(e,i);Le.delete(e,{at:o,voids:r});var c=s.unref(),u=l.unref();o=c||u,Le.setSelection(e,{anchor:o,focus:o})}if(!(!r&&ce.void(e,{at:o})||ce.elementReadOnly(e,{at:o}))){var{path:d,offset:f}=o;t.length>0&&e.apply({type:"insert_text",path:d,offset:f,text:t})}})}};function Ae(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Be(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ae(Object(n),!0).forEach(function(t){V(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ae(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Le=Be(Be(Be(Be({},Ce),Te),Me),De);const _e={isOpen:!1,query:"",trigger:null,targetRect:null,triggerRange:null},Fe={buildMentionElement:(e,t)=>{const{props:n}=t;return{id:m(),type:"mention",children:[{text:""}],props:Object.assign(Object.assign({},n),{nodeType:"inlineVoid"})}},insertMention:(e,t,n={})=>{var r,o;const i=e,a=i.mentions.state;if(!a.triggerRange)return;const{blockId:s,path:l,startOffset:c}=a.triggerRange,u=v.getBlockSlate(e,{id:s});if(!u)return;const d=a.trigger,f=a.query,p=c+(null!==(r=null==d?void 0:d.char.length)&&void 0!==r?r:1)+f.length;Le.select(u,{anchor:{path:l,offset:c},focus:{path:l,offset:p}}),Le.delete(u);const h={id:m(),type:"mention",children:[{text:""}],props:{id:t.id,type:t.type,name:t.name,avatar:t.avatar,meta:t.meta,nodeType:"inlineVoid"}};Le.insertNodes(u,h);const g=null===(o=e.plugins.Mention)||void 0===o?void 0:o.options;if(!1!==(null==g?void 0:g.closeOnSelect)&&i.mentions.close("select"),(null==g?void 0:g.onSelect)&&d&&g.onSelect(t,d),n.focus){const t=v.getBlock(e,{id:s});(null==t?void 0:t.id)&&e.focusBlock(t.id)}},findMention:(e,t,n={})=>{var r;return null!==(r=Fe.findMentions(e,n).find(e=>{var n;return(null===(n=e.props)||void 0===n?void 0:n.id)===t}))&&void 0!==r?r:null},findMentions:(e,t={})=>{var n;try{const r=t.blockId?{id:t.blockId}:{at:null!==(n=t.at)&&void 0!==n?n:e.path.current},o=v.getBlockSlate(e,r);if(!o)return[];const i=[];for(const[e]of ce.nodes(o,{at:[],match:e=>J.isElement(e)&&!ce.isEditor(e)&&"mention"===e.type}))i.push(e);return i}catch(e){return[]}},findMentionsByType:(e,t,n={})=>Fe.findMentions(e,n).filter(e=>{var n;return(null===(n=e.props)||void 0===n?void 0:n.type)===t}),updateMention:(e,t,n,r={})=>{var o;const i=r.blockId?{id:r.blockId}:{at:null!==(o=r.at)&&void 0!==o?o:e.path.current},a=v.getBlockSlate(e,i);if(!a)return;const s=Array.from(ce.nodes(a,{at:[],match:e=>{var n;return J.isElement(e)&&!ce.isEditor(e)&&"mention"===e.type&&(null===(n=e.props)||void 0===n?void 0:n.id)===t}})),l=s[0];if(l){const[e,t]=l;Le.setNodes(a,{props:Object.assign(Object.assign(Object.assign({},e.props),n),{nodeType:"inlineVoid"})},{at:t})}},deleteMention:(e,t,n={})=>{var r;const o=n.blockId?{id:n.blockId}:{at:null!==(r=n.at)&&void 0!==r?r:e.path.current},i=v.getBlockSlate(e,o);if(!i)return;const a=Array.from(ce.nodes(i,{at:[],match:e=>{var n;return J.isElement(e)&&!ce.isEditor(e)&&"mention"===e.type&&(null===(n=e.props)||void 0===n?void 0:n.id)===t}})),s=a[0];if(s){const[,e]=s;Le.removeNodes(i,{at:e})}},openDropdown:(e,t)=>{e.mentions.open(t)},closeDropdown:(e,t="manual")=>{e.mentions.close(t)},getState:e=>{var t,n;return null!==(n=null===(t=e.mentions)||void 0===t?void 0:t.state)&&void 0!==n?n:_e},getQuery:e=>{var t,n;return null!==(n=null===(t=e.mentions)||void 0===t?void 0:t.state.query)&&void 0!==n?n:""},setQuery:(e,t)=>{e.mentions.setQuery(t)},getTrigger:e=>{var t,n;return null!==(n=null===(t=e.mentions)||void 0===t?void 0:t.state.trigger)&&void 0!==n?n:null},getTriggers:e=>{var t,n;const r=null===(t=e.plugins.Mention)||void 0===t?void 0:t.options;return r?r.triggers&&r.triggers.length>0?r.triggers:[{char:null!==(n=r.char)&&void 0!==n?n:"@"}]:[{char:"@"}]},getTriggerByChar:(e,t)=>Fe.getTriggers(e).find(e=>e.char===t)};var qe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ie="object"==typeof qe&&qe&&qe.Object===Object&&qe,We="object"==typeof self&&self&&self.Object===Object&&self,ze=(Ie||We||Function("return this")()).Symbol;ze&&ze.toStringTag,ze&&ze.toStringTag;var Ve={};Object.defineProperty(Ve,"__esModule",{value:!0});for(var He="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Ke={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Ue={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:He?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},$e={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},Xe=1;Xe<20;Xe++)$e["f"+Xe]=111+Xe;function Je(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(e){return Qe(e,t)}),o=function(e){return r.some(function(t){return Ye(t,e)})};return null==n?o:o(n)}function Qe(e,t){var n=t&&t.byKey,r={},o=(e=e.replace("++","+add")).split("+"),i=o.length;for(var a in Ke)r[Ke[a]]=!1;var s=!0,l=!1,c=void 0;try{for(var u,d=o[Symbol.iterator]();!(s=(u=d.next()).done);s=!0){var f=u.value,p=f.endsWith("?")&&f.length>1;p&&(f=f.slice(0,-1));var h=Ge(f),g=Ke[h];if(f.length>1&&!g&&!Ue[f]&&!$e[h])throw new TypeError('Unknown modifier: "'+f+'"');1!==i&&g||(n?r.key=h:r.which=Ze(f)),g&&(r[g]=!p||null)}}catch(e){l=!0,c=e}finally{try{!s&&d.return&&d.return()}finally{if(l)throw c}}return r}function Ye(e,t){for(var n in e){var r=e[n],o=void 0;if(null!=r&&(null!=(o="key"===n&&null!=t.key?t.key.toLowerCase():"which"===n?91===r&&93===t.which?91:t.which:t[n])||!1!==r)&&o!==r)return!1}return!0}function Ze(e){return e=Ge(e),$e[e]||e.toUpperCase().charCodeAt(0)}function Ge(e){return e=e.toLowerCase(),Ue[e]||e}Ve.default=Je;var et=Ve.isHotkey=Je;Ve.isCodeHotkey=function(e,t){return Je(e,t)},Ve.isKeyHotkey=function(e,t){return Je(e,{byKey:!0},t)},Ve.parseHotkey=Qe,Ve.compareHotkey=Ye,Ve.toKeyCode=Ze,Ve.toKeyName=Ge;var tt,nt,rt=globalThis.Node,ot=globalThis.Text,it=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,at=e=>lt(e)&&8===e.nodeType,st=e=>lt(e)&&1===e.nodeType,lt=e=>{var t=it(e);return!!t&&e instanceof t.Node},ct=e=>{var t=e&&e.anchorNode&&it(e.anchorNode);return!!t&&e instanceof t.Selection},ut=(e,t,n)=>{for(var{childNodes:r}=e,o=r[t],i=t,a=!1,s=!1;(at(o)||st(o)&&0===o.childNodes.length||st(o)&&"false"===o.getAttribute("contenteditable"))&&(!a||!s);)i>=r.length?(a=!0,i=t-1,n="backward"):i<0?(s=!0,i=t+1,n="forward"):(o=r[i],t=i,i+="forward"===n?1:-1);return[o,t]},dt=(e,t,n)=>{var[r]=ut(e,t,n);return r},ft=e=>null!=e.getSelection?e.getSelection():document.getSelection(),pt=(e,t,n)=>{var{target:r}=t;if(st(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:o}=_t.getWindow(e);if(mt(o,r))return _t.hasDOMNode(e,r,{editable:!0});var i=n.find(e=>{var{addedNodes:t,removedNodes:n}=e;for(var o of t)if(o===r||mt(o,r))return!0;for(var i of n)if(i===r||mt(i,r))return!0});return!(!i||i===t)&&pt(e,i,n)},ht=(e,t)=>Boolean(e.compareDocumentPosition(t)&rt.DOCUMENT_POSITION_PRECEDING),gt=(e,t)=>{if(!e)return null;for(var n=e;n;){if(n.matches&&n.matches(t))return n;if(n.parentElement)n=n.parentElement;else{if(!n.parentNode||!("host"in n.parentNode))return null;n=n.parentNode.host}}return null},mt=(e,t)=>{if(!e||!t)return!1;if(e.contains(t))return!0;for(var n=t;n;){if(n===e)return!0;if(!n.parentNode)return!1;n="host"in n.parentNode?n.parentNode.host:n.parentNode}return!1},vt="undefined"!=typeof navigator&&/Mac OS X/.test(navigator.userAgent),yt="undefined"!=typeof navigator&&/Android/.test(navigator.userAgent),bt="undefined"!=typeof navigator&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),wt="undefined"!=typeof navigator&&/Chrome/i.test(navigator.userAgent);function xt(e){return xt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xt(e)}"undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&/Version\/(\d+)/.test(navigator.userAgent)&&null!==(tt=navigator.userAgent.match(/Version\/(\d+)/))&&void 0!==tt&&tt[1]&&parseInt(null===(nt=navigator.userAgent.match(/Version\/(\d+)/))||void 0===nt?void 0:nt[1],10);var Ot=0;class kt{constructor(){var e,t,n;e=this,n=void 0,(t=function(e){var t=function(e){if("object"!==xt(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==xt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===xt(t)?t:String(t)}(t="id"))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,this.id="".concat(Ot++)}}var St,jt=new WeakMap,Pt=new WeakMap,Et=new WeakMap,Nt=new WeakMap,Rt=new WeakMap,Ct=new WeakMap,Tt=new WeakMap,Mt=new WeakMap,Dt=new WeakMap,At=new WeakMap,Bt=new WeakMap,Lt=new WeakMap,_t={androidPendingDiffs:e=>Lt.get(e),androidScheduleFlush:e=>{var t;null===(t=Bt.get(e))||void 0===t||t()},blur:e=>{var t=_t.toDOMNode(e,e),n=_t.findDocumentOrShadowRoot(e);Dt.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=_t.findDocumentOrShadowRoot(e),r=ft(n);r&&r.rangeCount>0&&r.removeAllRanges(),t&&Le.deselect(e)},findDocumentOrShadowRoot:e=>{var t=_t.toDOMNode(e,e),n=t.getRootNode();return n instanceof Document||n instanceof ShadowRoot?n:t.ownerDocument},findEventRange:(e,t)=>{"nativeEvent"in t&&(t=t.nativeEvent);var{clientX:n,clientY:r,target:o}=t;if(null==n||null==r)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var i,a=_t.toSlateNode(e,t.target),s=_t.findPath(e,a);if(J.isElement(a)&&ce.isVoid(e,a)){var l=o.getBoundingClientRect(),c=e.isInline(a)?n-l.left<l.left+l.width-n:r-l.top<l.top+l.height-r,u=ce.point(e,s,{edge:c?"start":"end"}),d=c?ce.before(e,u):ce.after(e,u);if(d)return ce.range(e,d)}var{document:f}=_t.getWindow(e);if(f.caretRangeFromPoint)i=f.caretRangeFromPoint(n,r);else{var p=f.caretPositionFromPoint(n,r);p&&((i=f.createRange()).setStart(p.offsetNode,p.offset),i.setEnd(p.offsetNode,p.offset))}if(!i)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));return _t.toSlateRange(e,i,{exactMatch:!1,suppressThrow:!1})},findKey:(e,t)=>{var n=Ct.get(t);return n||(n=new kt,Ct.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var o=Pt.get(r);if(null==o){if(ce.isEditor(r))return n;break}var i=jt.get(r);if(null==i)break;n.unshift(i),r=o}throw new Error("Unable to find the path for Slate node: ".concat(he.stringify(t)))},focus:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{retries:5};if(!Dt.get(e)&&Nt.get(e)){if(t.retries<=0)throw new Error("Could not set focus, editor seems stuck with pending operations");if(e.operations.length>0)setTimeout(()=>{_t.focus(e,{retries:t.retries-1})},10);else{var n=_t.toDOMNode(e,e),r=_t.findDocumentOrShadowRoot(e);if(r.activeElement!==n){if(e.selection&&r instanceof Document){var o=ft(r),i=_t.toDOMRange(e,e.selection);null==o||o.removeAllRanges(),null==o||o.addRange(i)}e.selection||Le.select(e,ce.start(e,[])),Dt.set(e,!0),n.focus({preventScroll:!0})}}}},getWindow:e=>{var t=Et.get(e);if(!t)throw new Error("Unable to find a host window element for this editor");return t},hasDOMNode:function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{editable:o=!1}=r,i=_t.toDOMNode(e,e);try{n=st(t)?t:t.parentElement}catch(e){if(e instanceof Error&&!e.message.includes('Permission denied to access property "nodeType"'))throw e}return!!n&&!(gt(n,"[data-slate-editor]")!==i||o&&!n.isContentEditable&&("boolean"!=typeof n.isContentEditable||gt(n,'[contenteditable="false"]')!==i)&&!n.getAttribute("data-slate-zero-width"))},hasEditableTarget:(e,t)=>lt(t)&&_t.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return ce.hasPath(e,n.path)&&ce.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>_t.hasEditableTarget(e,t)||_t.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>lt(t)&&_t.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!At.get(e),isFocused:e=>!!Dt.get(e),isReadOnly:e=>!!Mt.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(Mt.get(e))return!1;var n=_t.hasTarget(e,t)&&_t.toSlateNode(e,t);return J.isElement(n)&&ce.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=Tt.get(e),r=ce.isEditor(t)?Nt.get(e):null==n?void 0:n.get(_t.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(he.stringify(t)));return r},toDOMPoint:(e,t)=>{var n,[r]=ce.node(e,t.path),o=_t.toDOMNode(e,r);ce.void(e,{at:t})&&(t={path:t.path,offset:0});for(var i=Array.from(o.querySelectorAll("[data-slate-string], [data-slate-zero-width]")),a=0,s=0;s<i.length;s++){var l=i[s],c=l.childNodes[0];if(null!=c&&null!=c.textContent){var{length:u}=c.textContent,d=l.getAttribute("data-slate-length"),f=a+(null==d?u:parseInt(d,10)),p=i[s+1];if(t.offset===f&&null!=p&&p.hasAttribute("data-slate-mark-placeholder")){var h,g=p.childNodes[0];n=[g instanceof ot?g:p,null!==(h=p.textContent)&&void 0!==h&&h.startsWith("\ufeff")?1:0];break}if(t.offset<=f){n=[c,Math.min(u,Math.max(0,t.offset-a))];break}a=f}}if(!n)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(he.stringify(t)));return n},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,o=$.isBackward(t),i=_t.toDOMPoint(e,n),a=$.isCollapsed(t)?i:_t.toDOMPoint(e,r),s=_t.getWindow(e).document.createRange(),[l,c]=o?a:i,[u,d]=o?i:a,f=!!(st(l)?l:l.parentElement).getAttribute("data-slate-zero-width"),p=!!(st(u)?u:u.parentElement).getAttribute("data-slate-zero-width");return s.setStart(l,f?1:c),s.setEnd(u,p?1:d),s},toSlateNode:(e,t)=>{var n=st(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Rt.get(n):null;if(!r)throw new Error("Cannot resolve a Slate node from DOM node: ".concat(n));return r},toSlatePoint:(e,t,n)=>{var{exactMatch:r,suppressThrow:o,searchDirection:i}=n,[a,s]=r?t:(e=>{var[t,n]=e;if(st(t)&&t.childNodes.length){var r=n===t.childNodes.length,o=r?n-1:n;for([t,o]=ut(t,o,r?"backward":"forward"),r=o<n;st(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=dt(t,i,r?"backward":"forward")}n=r&&null!=t.textContent?t.textContent.length:0}return[t,n]})(t),l=a.parentNode,c=null,u=0;if(l){var d,f,p=_t.toDOMNode(e,e),h=l.closest('[data-slate-void="true"]'),g=h&&mt(p,h)?h:null,m=l.closest('[contenteditable="false"]'),v=m&&mt(p,m)?m:null,y=l.closest("[data-slate-leaf]"),b=null;if(y){if(c=y.closest('[data-slate-node="text"]')){var w=_t.getWindow(e).document.createRange();w.setStart(c,0),w.setEnd(a,s);var x=w.cloneContents();[...Array.prototype.slice.call(x.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(x.querySelectorAll("[contenteditable=false]"))].forEach(e=>{yt&&!r&&e.hasAttribute("data-slate-zero-width")&&e.textContent.length>0&&"\ufeff"!==e.textContext?e.textContent.startsWith("\ufeff")&&(e.textContent=e.textContent.slice(1)):e.parentNode.removeChild(e)}),u=x.textContent.length,b=c}}else if(g){for(var O=g.querySelectorAll("[data-slate-leaf]"),k=0;k<O.length;k++){var S=O[k];if(_t.hasDOMNode(e,S)){y=S;break}}y?(c=y.closest('[data-slate-node="text"]'),u=(b=y).textContent.length,b.querySelectorAll("[data-slate-zero-width]").forEach(e=>{u-=e.textContent.length})):u=1}else if(v){var j,P,E=e=>e?e.querySelectorAll("[data-slate-leaf]:not(:scope [data-slate-editor] [data-slate-leaf])"):[],N=v.closest('[data-slate-node="element"]');"backward"!==i&&i||(y=null!==(j=[...E(null==N?void 0:N.previousElementSibling),...E(N)].findLast(e=>ht(v,e)))&&void 0!==j?j:null),"forward"!==i&&i||(y=null!==(P=[...E(N),...E(null==N?void 0:N.nextElementSibling)].find(e=>((e,t)=>Boolean(e.compareDocumentPosition(t)&rt.DOCUMENT_POSITION_FOLLOWING))(v,e)))&&void 0!==P?P:null),y&&(c=y.closest('[data-slate-node="text"]'),b=y,"forward"===i?u=0:(u=b.textContent.length,b.querySelectorAll("[data-slate-zero-width]").forEach(e=>{u-=e.textContent.length})))}b&&u===b.textContent.length&&yt&&"z"===b.getAttribute("data-slate-zero-width")&&null!==(d=b.textContent)&&void 0!==d&&d.startsWith("\ufeff")&&(l.hasAttribute("data-slate-zero-width")||bt&&null!==(f=b.textContent)&&void 0!==f&&f.endsWith("\n\n"))&&u--}if(yt&&!c&&!r){var R=l.hasAttribute("data-slate-node")?l:l.closest("[data-slate-node]");if(R&&_t.hasDOMNode(e,R,{editable:!0})){var C=_t.toSlateNode(e,R),{path:T,offset:M}=ce.start(e,_t.findPath(e,C));return R.querySelector("[data-slate-leaf]")||(M=s),{path:T,offset:M}}}if(!c){if(o)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var D=_t.toSlateNode(e,c);return{path:_t.findPath(e,D),offset:u}},toSlateRange:(e,t,n)=>{var r,o,i,a,s,l,{exactMatch:c,suppressThrow:u}=n;if(ct(t)?t.anchorNode:t.startContainer)if(ct(t)){if(bt&&t.rangeCount>1){a=t.focusNode;var d=t.getRangeAt(0),f=t.getRangeAt(t.rangeCount-1);if(a instanceof HTMLTableRowElement&&d.startContainer instanceof HTMLTableRowElement&&f.startContainer instanceof HTMLTableRowElement){function x(e){return e.childElementCount>0?x(e.children[0]):e}var p=d.startContainer,h=f.startContainer,g=x(p.children[d.startOffset]),m=x(h.children[f.startOffset]);s=0,o=m.childNodes.length>0?m.childNodes[0]:m,a=g.childNodes.length>0?g.childNodes[0]:g,i=m instanceof HTMLElement?m.innerHTML.length:0}else d.startContainer===a?(o=f.endContainer,i=f.endOffset,s=d.startOffset):(o=d.startContainer,i=d.endOffset,s=f.startOffset)}else o=t.anchorNode,i=t.anchorOffset,a=t.focusNode,s=t.focusOffset;l=wt&&(e=>{for(var t=e&&e.parentNode;t;){if("[object ShadowRoot]"===t.toString())return!0;t=t.parentNode}return!1})(o)||bt?t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:t.isCollapsed}else o=t.startContainer,i=t.startOffset,a=t.endContainer,s=t.endOffset,l=t.collapsed;if(null==o||null==a||null==i||null==s)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t));bt&&null!==(r=a.textContent)&&void 0!==r&&r.endsWith("\n\n")&&s===a.textContent.length&&s--;var v=_t.toSlatePoint(e,[o,i],{exactMatch:c,suppressThrow:u});if(!v)return null;var y=ht(o,a)||o===a&&s<i,b=l?v:_t.toSlatePoint(e,[a,s],{exactMatch:c,suppressThrow:u,searchDirection:y?"forward":"backward"});if(!b)return null;var w={anchor:v,focus:b};return $.isExpanded(w)&&$.isForward(w)&&st(a)&&ce.void(e,{at:w.focus,mode:"highest"})&&(w=ce.unhangRange(e,w,{voids:!0})),w}},Ft={bold:"mod+b",compose:["down","left","right","up","backspace","enter"],moveBackward:"left",moveForward:"right",moveWordBackward:"ctrl+left",moveWordForward:"ctrl+right",deleteBackward:"shift?+backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",extendForward:"shift+right",italic:"mod+i",insertSoftBreak:"shift+enter",splitBlock:"enter",undo:"mod+z"},qt={moveLineBackward:"opt+up",moveLineForward:"opt+down",moveWordBackward:"opt+left",moveWordForward:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},It={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Wt=e=>{var t=Ft[e],n=qt[e],r=It[e],o=t&&et(t),i=n&&et(n),a=r&&et(r);return e=>!(!o||!o(e))||!!(vt&&i&&i(e))||!(vt||!a||!a(e))};Wt("bold"),Wt("compose"),Wt("moveBackward"),Wt("moveForward"),Wt("deleteBackward"),Wt("deleteForward"),Wt("deleteLineBackward"),Wt("deleteLineForward"),Wt("deleteWordBackward"),Wt("deleteWordForward"),Wt("extendBackward"),Wt("extendForward"),Wt("extendLineBackward"),Wt("extendLineForward"),Wt("italic"),Wt("moveLineBackward"),Wt("moveLineForward"),Wt("moveWordBackward"),Wt("moveWordForward"),Wt("redo"),Wt("insertSoftBreak"),Wt("splitBlock"),Wt("transposeCharacter"),Wt("undo"),function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"}(St||(St={}));var zt=function(e){return Object.freeze(e)},Vt=function(e,t){this.inlineSize=e,this.blockSize=t,zt(this)},Ht=function(){function e(e,t,n,r){return this.x=e,this.y=t,this.width=n,this.height=r,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,zt(this)}return e.prototype.toJSON=function(){var e=this;return{x:e.x,y:e.y,top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.width,height:e.height}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),Kt="undefined"!=typeof window?window:{};/msie|trident/i.test(Kt.navigator&&Kt.navigator.userAgent);var Ut=function(e,t,n){return void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=!1),new Vt((n?t:e)||0,(n?e:t)||0)};function $t(e){return $t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$t(e)}function Xt(e,t,n){return(t=function(e){var t=function(e){if("object"!==$t(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==$t(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===$t(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}zt({devicePixelContentBoxSize:Ut(),borderBoxSize:Ut(),contentBoxSize:Ut(),contentRect:new Ht(0,0,0,0)});var Jt=s(null),Qt=_t,Yt={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};function Zt(e,t,n){var r;const o=(null!==(r=e.allowedAfter)&&void 0!==r?r:/^$|\s/).test(t),i=""===n||/\s/.test(n);return o&&i}function Gt(e){if(!e.selection||!$.isCollapsed(e.selection))return null;try{const t=Qt.toDOMRange(e,e.selection);if(!t)return null;const n=t.getClientRects();return{domRect:t.getBoundingClientRect(),clientRects:n.length>0?n:t.getClientRects()}}catch(e){const t=window.getSelection();if(!t||0===t.rangeCount)return null;const n=t.getRangeAt(0);return{domRect:n.getBoundingClientRect(),clientRects:n.getClientRects()}}}function en(){return"undefined"!=typeof window}function tn(e){return on(e)?(e.nodeName||"").toLowerCase():"#document"}function nn(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function rn(e){var t;return null==(t=(on(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function on(e){return!!en()&&(e instanceof Node||e instanceof nn(e).Node)}function an(e){return!!en()&&(e instanceof Element||e instanceof nn(e).Element)}function sn(e){return!!en()&&(e instanceof HTMLElement||e instanceof nn(e).HTMLElement)}function ln(e){return!(!en()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof nn(e).ShadowRoot)}Xt(class extends l{constructor(){super(...arguments),Xt(this,"context",null),Xt(this,"manager",null),Xt(this,"mutationObserver",null)}observe(){var e,{node:t}=this.props;if(!t.current)throw new Error("Failed to attach MutationObserver, `node` is undefined");null===(e=this.mutationObserver)||void 0===e||e.observe(t.current,Yt)}componentDidMount(){var{receivedUserInput:e}=this.props,t=this.context;this.manager=((e,t)=>{var n=[],r=()=>{n=[]};return{registerMutations:r=>{if(t.current){var o=r.filter(t=>pt(e,t,r));n.push(...o)}},restoreDOM:function(){n.length>0&&(n.reverse().forEach(e=>{"characterData"!==e.type&&(e.removedNodes.forEach(t=>{e.target.insertBefore(t,e.nextSibling)}),e.addedNodes.forEach(t=>{e.target.removeChild(t)}))}),r())},clear:r}})(t,e),this.mutationObserver=new MutationObserver(this.manager.registerMutations),this.observe()}getSnapshotBeforeUpdate(){var e,t,n,r,o=null===(e=this.mutationObserver)||void 0===e?void 0:e.takeRecords();return null!=o&&o.length&&(null===(r=this.manager)||void 0===r||r.registerMutations(o)),null===(t=this.mutationObserver)||void 0===t||t.disconnect(),null===(n=this.manager)||void 0===n||n.restoreDOM(),null}componentDidUpdate(){var e;null===(e=this.manager)||void 0===e||e.clear(),this.observe()}componentWillUnmount(){var e;null===(e=this.mutationObserver)||void 0===e||e.disconnect()}render(){return this.props.children}},"contextType",Jt),parseInt(o.version.split(".")[0],10),new g({type:"Mention",elements:e("mention",{render:e=>{const{element:n,attributes:r,children:o}=e,{name:i}=n.props;return t("span",Object.assign({},r,{contentEditable:!1,"data-mention":!0},{children:["@",i,o]}))},props:{id:"",name:"",avatar:"",type:void 0,meta:void 0},nodeType:"inlineVoid"}),options:{display:{title:"Mention",description:"Mention a user or resource"},char:"@"},commands:Fe,parsers:{html:{deserialize:{nodeNames:["SPAN"],parse:e=>{var t,n,r,o,i;if("SPAN"===e.nodeName&&e.dataset.mentionId)return{id:m(),type:"mention",children:[{text:""}],props:{id:null!==(t=e.dataset.mentionId)&&void 0!==t?t:"",name:null!==(r=null!==(n=e.dataset.mentionName)&&void 0!==n?n:e.textContent)&&void 0!==r?r:"",avatar:null!==(o=e.dataset.mentionAvatar)&&void 0!==o?o:"",type:null!==(i=e.dataset.mentionType)&&void 0!==i?i:void 0,nodeType:"inlineVoid"}}}},serialize:e=>{var t;const{id:n,name:r,avatar:o,type:i}=null!==(t=e.props)&&void 0!==t?t:{};return`<span data-mention data-mention-id="${n}" data-mention-name="${r}" data-mention-avatar="${null!=o?o:""}" data-mention-type="${null!=i?i:""}" style="color: #2563eb; font-weight: 500;">@${r}</span>`}},markdown:{serialize:e=>{var t,n;return`@${null!==(n=null===(t=e.props)||void 0===t?void 0:t.name)&&void 0!==n?n:""}`}},email:{serialize:e=>{var t;const{name:n}=null!==(t=e.props)&&void 0!==t?t:{};return`<span style="color: #2563eb; font-weight: 500;">@${n}</span>`}}},extensions:e=>{const{markableVoid:t,isInline:n}=e;return e.markableVoid=e=>"mention"===e.type||t(e),e.isInline=e=>"mention"===e.type||n(e),e},events:{onKeyDown:(e,t,n)=>r=>{var o,i,a;const s=e,l=null===(o=e.plugins.Mention)||void 0===o?void 0:o.options,c=function(e){var t;return e?e.triggers&&e.triggers.length>0?e.triggers:[{char:null!==(t=e.char)&&void 0!==t?t:"@"}]:[{char:"@"}]}(l),u=s.mentions.state,d=n.currentBlock;for(const e of c)if(1===e.char.length&&r.key===e.char&&t.selection&&$.isCollapsed(t.selection)){const n=ee.get(t,t.selection.anchor.path);if(!be.isText(n))continue;const r=n.text,o=t.selection.anchor.offset;if(!Zt(e,null!==(i=r[o-1])&&void 0!==i?i:"",null!==(a=r[o])&&void 0!==a?a:""))continue;if(!d)continue;const l=Gt(t);if(!l)continue;return void s.mentions.open({trigger:e,targetRect:l,triggerRange:{blockId:d.id,path:t.selection.anchor.path,startOffset:o}})}if(u.isOpen){const{key:e}=r;if("Escape"===e&&!1!==(null==l?void 0:l.closeOnEscape))return r.preventDefault(),void s.mentions.close("escape");if("Backspace"===e){const e=u.query.slice(0,-1);return 0===u.query.length?void s.mentions.close("backspace"):void s.mentions.setQuery(e)}if(1===e.length&&!r.ctrlKey&&!r.metaKey&&!r.altKey){const t=u.trigger;if(" "===e&&!(null==t?void 0:t.allowSpaces))return void s.mentions.close("manual");if(t&&e===t.char)return;s.mentions.setQuery(u.query+e)}}}}}),"function"==typeof SuppressedError&&SuppressedError;const cn=new Set(["inline","contents"]);function un(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=On(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!cn.has(o)}const dn=new Set(["table","td","th"]);function fn(e){return dn.has(tn(e))}const pn=[":popover-open",":modal"];function hn(e){return pn.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const gn=["transform","translate","scale","rotate","perspective"],mn=["transform","translate","scale","rotate","perspective","filter"],vn=["paint","layout","strict","content"];function yn(e){const t=bn(),n=an(e)?On(e):e;return gn.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||mn.some(e=>(n.willChange||"").includes(e))||vn.some(e=>(n.contain||"").includes(e))}function bn(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const wn=new Set(["html","body","#document"]);function xn(e){return wn.has(tn(e))}function On(e){return nn(e).getComputedStyle(e)}function kn(e){return an(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Sn(e){if("html"===tn(e))return e;const t=e.assignedSlot||e.parentNode||ln(e)&&e.host||rn(e);return ln(t)?t.host:t}function jn(e){const t=Sn(e);return xn(t)?e.ownerDocument?e.ownerDocument.body:e.body:sn(t)&&un(t)?t:jn(t)}function Pn(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=jn(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=nn(o);if(i){const e=En(a);return t.concat(a,a.visualViewport||[],un(o)?o:[],e&&n?Pn(e):[])}return t.concat(o,Pn(o,[],n))}function En(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const Nn=Math.min,Rn=Math.max,Cn=Math.round,Tn=Math.floor,Mn=e=>({x:e,y:e}),Dn={left:"right",right:"left",bottom:"top",top:"bottom"},An={start:"end",end:"start"};function Bn(e,t,n){return Rn(e,Nn(t,n))}function Ln(e,t){return"function"==typeof e?e(t):e}function _n(e){return e.split("-")[0]}function Fn(e){return e.split("-")[1]}function qn(e){return"x"===e?"y":"x"}function In(e){return"y"===e?"height":"width"}const Wn=new Set(["top","bottom"]);function zn(e){return Wn.has(_n(e))?"y":"x"}function Vn(e){return qn(zn(e))}function Hn(e){return e.replace(/start|end/g,e=>An[e])}const Kn=["left","right"],Un=["right","left"],$n=["top","bottom"],Xn=["bottom","top"];function Jn(e){return e.replace(/left|right|bottom|top/g,e=>Dn[e])}function Qn(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function Yn(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Zn(e,t,n){let{reference:r,floating:o}=e;const i=zn(t),a=Vn(t),s=In(a),l=_n(t),c="y"===i,u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[s]/2-o[s]/2;let p;switch(l){case"top":p={x:u,y:r.y-o.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-o.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Fn(t)){case"start":p[a]-=f*(n&&c?-1:1);break;case"end":p[a]+=f*(n&&c?-1:1)}return p}async function Gn(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=Ln(t,e),h=Qn(p),g=s[f?"floating"===d?"reference":"floating":d],m=Yn(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(g)))||n?g:g.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:l})),v="floating"===d?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),b=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},w=Yn(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:y,strategy:l}):v);return{top:(m.top-w.top+h.top)/b.y,bottom:(w.bottom-m.bottom+h.bottom)/b.y,left:(m.left-w.left+h.left)/b.x,right:(w.right-m.right+h.right)/b.x}}function er(e){const t=Nn(...e.map(e=>e.left)),n=Nn(...e.map(e=>e.top));return{x:t,y:n,width:Rn(...e.map(e=>e.right))-t,height:Rn(...e.map(e=>e.bottom))-n}}const tr=new Set(["left","top"]);function nr(e){const t=On(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=sn(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,s=Cn(n)!==i||Cn(r)!==a;return s&&(n=i,r=a),{width:n,height:r,$:s}}function rr(e){return an(e)?e:e.contextElement}function or(e){const t=rr(e);if(!sn(t))return Mn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=nr(t);let a=(i?Cn(n.width):n.width)/r,s=(i?Cn(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}const ir=Mn(0);function ar(e){const t=nn(e);return bn()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:ir}function sr(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=rr(e);let a=Mn(1);t&&(r?an(r)&&(a=or(r)):a=or(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==nn(e))&&t}(i,n,r)?ar(i):Mn(0);let l=(o.left+s.x)/a.x,c=(o.top+s.y)/a.y,u=o.width/a.x,d=o.height/a.y;if(i){const e=nn(i),t=r&&an(r)?nn(r):r;let n=e,o=En(n);for(;o&&r&&t!==n;){const e=or(o),t=o.getBoundingClientRect(),r=On(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,u*=e.x,d*=e.y,l+=i,c+=a,n=nn(o),o=En(n)}}return Yn({width:u,height:d,x:l,y:c})}function lr(e,t){const n=kn(e).scrollLeft;return t?t.left+n:sr(rn(e)).left+n}function cr(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-lr(e,n),y:n.top+t.scrollTop}}const ur=new Set(["absolute","fixed"]);function dr(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=nn(e),r=rn(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,s=0,l=0;if(o){i=o.width,a=o.height;const e=bn();(!e||e&&"fixed"===t)&&(s=o.offsetLeft,l=o.offsetTop)}const c=lr(r);if(c<=0){const e=r.ownerDocument,t=e.body,n=getComputedStyle(t),o="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,a=Math.abs(r.clientWidth-t.clientWidth-o);a<=25&&(i-=a)}else c<=25&&(i+=c);return{width:i,height:a,x:s,y:l}}(e,n);else if("document"===t)r=function(e){const t=rn(e),n=kn(e),r=e.ownerDocument.body,o=Rn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Rn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+lr(e);const s=-n.scrollTop;return"rtl"===On(r).direction&&(a+=Rn(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:s}}(rn(e));else if(an(t))r=function(e,t){const n=sr(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=sn(e)?or(e):Mn(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=ar(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Yn(r)}function fr(e,t){const n=Sn(e);return!(n===t||!an(n)||xn(n))&&("fixed"===On(n).position||fr(n,t))}function pr(e,t,n){const r=sn(t),o=rn(t),i="fixed"===n,a=sr(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=Mn(0);function c(){l.x=lr(o)}if(r||!r&&!i)if(("body"!==tn(t)||un(o))&&(s=kn(t)),r){const e=sr(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&c();i&&!r&&o&&c();const u=!o||r||i?Mn(0):cr(o,s);return{x:a.left+s.scrollLeft-l.x-u.x,y:a.top+s.scrollTop-l.y-u.y,width:a.width,height:a.height}}function hr(e){return"static"===On(e).position}function gr(e,t){if(!sn(e)||"fixed"===On(e).position)return null;if(t)return t(e);let n=e.offsetParent;return rn(e)===n&&(n=n.ownerDocument.body),n}function mr(e,t){const n=nn(e);if(hn(e))return n;if(!sn(e)){let t=Sn(e);for(;t&&!xn(t);){if(an(t)&&!hr(t))return t;t=Sn(t)}return n}let r=gr(e,t);for(;r&&fn(r)&&hr(r);)r=gr(r,t);return r&&xn(r)&&hr(r)&&!yn(r)?n:r||function(e){let t=Sn(e);for(;sn(t)&&!xn(t);){if(yn(t))return t;if(hn(t))return null;t=Sn(t)}return null}(e)||n}const vr={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=rn(r),s=!!t&&hn(t.floating);if(r===a||s&&i)return n;let l={scrollLeft:0,scrollTop:0},c=Mn(1);const u=Mn(0),d=sn(r);if((d||!d&&!i)&&(("body"!==tn(r)||un(a))&&(l=kn(r)),sn(r))){const e=sr(r);c=or(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}const f=!a||d||i?Mn(0):cr(a,l);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-l.scrollTop*c.y+u.y+f.y}},getDocumentElement:rn,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?hn(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=Pn(e,[],!1).filter(e=>an(e)&&"body"!==tn(e)),o=null;const i="fixed"===On(e).position;let a=i?Sn(e):e;for(;an(a)&&!xn(a);){const t=On(a),n=yn(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&ur.has(o.position)||un(a)&&!n&&fr(e,a))?r=r.filter(e=>e!==a):o=t,a=Sn(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=i[0],s=i.reduce((e,n)=>{const r=dr(t,n,o);return e.top=Rn(r.top,e.top),e.right=Nn(r.right,e.right),e.bottom=Nn(r.bottom,e.bottom),e.left=Rn(r.left,e.left),e},dr(t,a,o));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:mr,getElementRects:async function(e){const t=this.getOffsetParent||mr,n=this.getDimensions,r=await n(e.floating);return{reference:pr(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=nr(e);return{width:t,height:n}},getScale:or,isElement:an,isRTL:function(e){return"rtl"===On(e).direction}};function yr(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function br(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=rr(e),u=o||i?[...c?Pn(c):[],...Pn(t)]:[];u.forEach(e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)});const d=c&&s?function(e,t){let n,r=null;const o=rn(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function a(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),i();const c=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=c;if(s||t(),!f||!p)return;const h={rootMargin:-Tn(d)+"px "+-Tn(o.clientWidth-(u+f))+"px "+-Tn(o.clientHeight-(d+p))+"px "+-Tn(u)+"px",threshold:Rn(0,Nn(1,l))||1};let g=!0;function m(t){const r=t[0].intersectionRatio;if(r!==l){if(!g)return a();r?a(!1,r):n=setTimeout(()=>{a(!1,1e-7)},1e3)}1!==r||yr(c,e.getBoundingClientRect())||a(),g=!1}try{r=new IntersectionObserver(m,{...h,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(m,h)}r.observe(e)}(!0),i}(c,n):null;let f,p=-1,h=null;a&&(h=new ResizeObserver(e=>{let[r]=e;r&&r.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=h)||e.observe(t)})),n()}),c&&!l&&h.observe(c),h.observe(t));let g=l?sr(e):null;return l&&function t(){const r=sr(e);g&&!yr(g,r)&&n(),g=r,f=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach(e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)}),null==d||d(),null==(e=h)||e.disconnect(),h=null,l&&cancelAnimationFrame(f)}}const wr=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:s}=t,l=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=_n(n),s=Fn(n),l="y"===zn(n),c=tr.has(a)?-1:1,u=i&&l?-1:1,d=Ln(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:h}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&"number"==typeof h&&(p="end"===s?-1*h:h),l?{x:p*u,y:f*c}:{x:f*c,y:p*u}}(t,e);return a===(null==(n=s.offset)?void 0:n.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:a}}}}},xr=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Ln(e,t),c={x:n,y:r},u=await Gn(t,l),d=zn(_n(o)),f=qn(d);let p=c[f],h=c[d];if(i){const e="y"===f?"bottom":"right";p=Bn(p+u["y"===f?"top":"left"],p,p-u[e])}if(a){const e="y"===d?"bottom":"right";h=Bn(h+u["y"===d?"top":"left"],h,h-u[e])}const g=s.fn({...t,[f]:p,[d]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[f]:i,[d]:a}}}}}},Or=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...m}=Ln(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const v=_n(o),y=zn(s),b=_n(s)===s,w=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=f||(b||!g?[Jn(s)]:function(e){const t=Jn(e);return[Hn(e),t,Hn(t)]}(s)),O="none"!==h;!f&&O&&x.push(...function(e,t,n,r){const o=Fn(e);let i=function(e,t,n){switch(e){case"top":case"bottom":return n?t?Un:Kn:t?Kn:Un;case"left":case"right":return t?$n:Xn;default:return[]}}(_n(e),"start"===n,r);return o&&(i=i.map(e=>e+"-"+o),t&&(i=i.concat(i.map(Hn)))),i}(s,g,h,w));const k=[s,...x],S=await Gn(t,m),j=[];let P=(null==(r=i.flip)?void 0:r.overflows)||[];if(u&&j.push(S[v]),d){const e=function(e,t,n){void 0===n&&(n=!1);const r=Fn(e),o=Vn(e),i=In(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=Jn(a)),[a,Jn(a)]}(o,a,w);j.push(S[e[0]],S[e[1]])}if(P=[...P,{placement:o,overflows:j}],!j.every(e=>e<=0)){var E,N;const e=((null==(E=i.flip)?void 0:E.index)||0)+1,t=k[e];if(t&&("alignment"!==d||y===zn(t)||P.every(e=>zn(e.placement)!==y||e.overflows[0]>0)))return{data:{index:e,overflows:P},reset:{placement:t}};let n=null==(N=P.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:N.placement;if(!n)switch(p){case"bestFit":{var R;const e=null==(R=P.filter(e=>{if(O){const t=zn(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:R[0];e&&(n=e);break}case"initialPlacement":n=s}if(o!==n)return{reset:{placement:n}}}return{}}}},kr=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:i,strategy:a}=t,{padding:s=2,x:l,y:c}=Ln(e,t),u=Array.from(await(null==i.getClientRects?void 0:i.getClientRects(r.reference))||[]),d=function(e){const t=e.slice().sort((e,t)=>e.y-t.y),n=[];let r=null;for(let e=0;e<t.length;e++){const o=t[e];!r||o.y-r.y>r.height/2?n.push([o]):n[n.length-1].push(o),r=o}return n.map(e=>Yn(er(e)))}(u),f=Yn(er(u)),p=Qn(s),h=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===d.length&&d[0].left>d[1].right&&null!=l&&null!=c)return d.find(e=>l>e.left-p.left&&l<e.right+p.right&&c>e.top-p.top&&c<e.bottom+p.bottom)||f;if(d.length>=2){if("y"===zn(n)){const e=d[0],t=d[d.length-1],r="top"===_n(n),o=e.top,i=t.bottom,a=r?e.left:t.left,s=r?e.right:t.right;return{top:o,bottom:i,left:a,right:s,width:s-a,height:i-o,x:a,y:o}}const e="left"===_n(n),t=Rn(...d.map(e=>e.right)),r=Nn(...d.map(e=>e.left)),o=d.filter(n=>e?n.left===r:n.right===t),i=o[0].top,a=o[o.length-1].bottom;return{top:i,bottom:a,left:r,right:t,width:t-r,height:a-i,x:r,y:i}}return f}},floating:r.floating,strategy:a});return o.reference.x!==h.reference.x||o.reference.y!==h.reference.y||o.reference.width!==h.reference.width||o.reference.height!==h.reference.height?{reset:{rects:h}}:{}}}};var Sr="undefined"!=typeof document?f:function(){};function jr(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!==r--;)if(!jr(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!==r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!==r--;){const n=o[r];if(!("_owner"===n&&e.$$typeof||jr(e[n],t[n])))return!1}return!0}return e!=e&&t!=t}function Pr(e){return"undefined"==typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Er(e,t){const n=Pr(e);return Math.round(t*n)/n}function Nr(e){const t=r.useRef(e);return Sr(()=>{t.current=e}),t}const Rr=(e,t)=>({...wr(e),options:[e,t]}),Cr=(e,t)=>({...xr(e),options:[e,t]}),Tr=(e,t)=>({...Or(e),options:[e,t]}),Mr=(e,t)=>({...kr(e),options:[e,t]}),Dr={...r},Ar=Dr.useInsertionEffect||(e=>e());var Br="undefined"!=typeof document?f:u;let Lr=!1,_r=0;const Fr=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+_r++,qr=Dr.useId||function(){const[e,t]=r.useState(()=>Lr?Fr():void 0);return Br(()=>{null==e&&t(Fr())},[]),r.useEffect(()=>{Lr=!0},[]),e},Ir=r.createContext(null),Wr=r.createContext(null);function zr(e){void 0===e&&(e={});const{nodeId:t}=e,n=function(e){const{open:t=!1,onOpenChange:n,elements:o}=e,i=qr(),a=r.useRef({}),[s]=r.useState(()=>function(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach(e=>e(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter(e=>e!==n))||[])}}}()),l=null!=((null==(c=r.useContext(Ir))?void 0:c.id)||null);var c;const[u,d]=r.useState(o.reference),f=function(e){const t=r.useRef(()=>{});return Ar(()=>{t.current=e}),r.useCallback(function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)},[])}((e,t,r)=>{a.current.openEvent=e?t:void 0,s.emit("openchange",{open:e,event:t,reason:r,nested:l}),null==n||n(e,t,r)}),p=r.useMemo(()=>({setPositionReference:d}),[]),h=r.useMemo(()=>({reference:u||o.reference||null,floating:o.floating||null,domReference:o.reference}),[u,o.reference,o.floating]);return r.useMemo(()=>({dataRef:a,open:t,onOpenChange:f,elements:h,events:s,floatingId:i,refs:p}),[t,f,h,s,i,p])}({...e,elements:{reference:null,floating:null,...e.elements}}),o=e.rootContext||n,i=o.elements,[a,s]=r.useState(null),[l,c]=r.useState(null),u=(null==i?void 0:i.domReference)||a,d=r.useRef(null),f=r.useContext(Wr);Br(()=>{u&&(d.current=u)},[u]);const p=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:i,elements:{reference:a,floating:s}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=r.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=r.useState(o);jr(p,o)||h(o);const[g,m]=r.useState(null),[v,y]=r.useState(null),b=r.useCallback(e=>{e!==k.current&&(k.current=e,m(e))},[]),w=r.useCallback(e=>{e!==S.current&&(S.current=e,y(e))},[]),x=a||g,O=s||v,k=r.useRef(null),S=r.useRef(null),j=r.useRef(d),P=null!=c,E=Nr(c),N=Nr(i),R=Nr(u),C=r.useCallback(()=>{if(!k.current||!S.current)return;const e={placement:t,strategy:n,middleware:p};N.current&&(e.platform=N.current),((e,t,n)=>{const r=new Map,o={platform:vr,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,s=i.filter(Boolean),l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=Zn(c,r,l),f=r,p={},h=0;for(let n=0;n<s.length;n++){const{name:i,fn:g}=s[n],{x:m,y:v,data:y,reset:b}=await g({x:u,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:c,platform:a,elements:{reference:e,floating:t}});u=null!=m?m:u,d=null!=v?v:d,p={...p,[i]:{...p[i],...y}},b&&h<=50&&(h++,"object"==typeof b&&(b.placement&&(f=b.placement),b.rects&&(c=!0===b.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:u,y:d}=Zn(c,f,l))),n=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})})(k.current,S.current,e).then(e=>{const t={...e,isPositioned:!1!==R.current};M.current&&!jr(j.current,t)&&(j.current=t,T.flushSync(()=>{f(t)}))})},[p,t,n,N,R]);Sr(()=>{!1===u&&j.current.isPositioned&&(j.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[u]);const M=r.useRef(!1);Sr(()=>(M.current=!0,()=>{M.current=!1}),[]),Sr(()=>{if(x&&(k.current=x),O&&(S.current=O),x&&O){if(E.current)return E.current(x,O,C);C()}},[x,O,C,E,P]);const D=r.useMemo(()=>({reference:k,floating:S,setReference:b,setFloating:w}),[b,w]),A=r.useMemo(()=>({reference:x,floating:O}),[x,O]),B=r.useMemo(()=>{const e={position:n,left:0,top:0};if(!A.floating)return e;const t=Er(A.floating,d.x),r=Er(A.floating,d.y);return l?{...e,transform:"translate("+t+"px, "+r+"px)",...Pr(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,l,A.floating,d.x,d.y]);return r.useMemo(()=>({...d,update:C,refs:D,elements:A,floatingStyles:B}),[d,C,D,A,B])}({...e,elements:{...i,...l&&{reference:l}}}),h=r.useCallback(e=>{const t=an(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;c(t),p.refs.setReference(t)},[p.refs]),g=r.useCallback(e=>{(an(e)||null===e)&&(d.current=e,s(e)),(an(p.refs.reference.current)||null===p.refs.reference.current||null!==e&&!an(e))&&p.refs.setReference(e)},[p.refs]),m=r.useMemo(()=>({...p.refs,setReference:g,setPositionReference:h,domReference:d}),[p.refs,g,h]),v=r.useMemo(()=>({...p.elements,domReference:u}),[p.elements,u]),y=r.useMemo(()=>({...p,...o,refs:m,elements:v,nodeId:t}),[p,m,v,t,o]);return Br(()=>{o.dataRef.current.floatingContext=y;const e=null==f?void 0:f.nodesRef.current.find(e=>e.id===t);e&&(e.context=y)}),r.useMemo(()=>({...p,context:y,refs:m,elements:v}),[p,m,v,y])}function Vr(e={}){var t,n,r;const o=p(),s=y("Mention"),[l,f]=a([]),[h,g]=a(!1),[m,v]=a(null),[b,w]=a(0),[x,O]=a(_e),k=c(null),S=c(""),j=null!==(n=null!==(t=e.debounceMs)&&void 0!==t?t:null==s?void 0:s.debounceMs)&&void 0!==n?n:300,P=null!==(r=null==s?void 0:s.minQueryLength)&&void 0!==r?r:0,{refs:E,floatingStyles:N}=zr({placement:"bottom-start",open:x.isOpen,middleware:[Mr(),Tr(),Cr({padding:8}),Rr(4)],whileElementsMounted:br});u(()=>{const e=()=>{O(Object.assign({},o.mentions.state)),w(0),f([]),v(null)},t=()=>{O(Object.assign({},_e)),f([]),w(0),v(null)},n=()=>{O(Object.assign({},o.mentions.state))};return o.on("mention:open",e),o.on("mention:close",t),o.on("mention:query-change",n),()=>{o.off("mention:open",e),o.off("mention:close",t),o.off("mention:query-change",n)}},[o]),u(()=>{x.targetRect&&E.setReference({getBoundingClientRect:()=>x.targetRect.domRect,getClientRects:()=>x.targetRect.clientRects})},[x.targetRect,E]),u(()=>{if(!x.isOpen||!(null==s?void 0:s.onSearch))return;const e=x.query,t=x.trigger;if(!(e===S.current&&l.length>0)){if(S.current=e,!(e.length<P))return k.current&&clearTimeout(k.current),k.current=setTimeout(()=>function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{l(r.next(e))}catch(e){i(e)}}function s(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}l((r=r.apply(e,t||[])).next())})}(this,void 0,void 0,function*(){var n;if(t){g(!0),v(null);try{const r=yield null===(n=null==s?void 0:s.onSearch)||void 0===n?void 0:n.call(s,e,t);f(r),w(0)}catch(e){v(e instanceof Error?e:new Error("Search failed")),f([])}finally{g(!1)}}}),j),()=>{k.current&&clearTimeout(k.current)};f([])}},[x.isOpen,x.query,x.trigger,s,j,P,l.length]);const R=d(e=>{Fe.insertMention(o,e,{focus:!0})},[o]),C=d((e="manual")=>{Fe.closeDropdown(o,e)},[o]);return u(()=>{if(!x.isOpen)return;const e=e=>{switch(e.key){case"ArrowDown":e.preventDefault(),w(e=>(e+1)%Math.max(l.length,1));break;case"ArrowUp":e.preventDefault(),w(e=>(e-1+Math.max(l.length,1))%Math.max(l.length,1));break;case"Enter":e.preventDefault(),l[b]&&R(l[b]);break;case"Escape":e.preventDefault(),C("escape");break;case"Tab":C("escape")}};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[x.isOpen,l,b,R,C]),u(()=>{if(!x.isOpen)return;if(!1===(null==s?void 0:s.closeOnClickOutside))return;const e=e=>{const t=E.floating.current;t&&!t.contains(e.target)&&C("click-outside")},t=setTimeout(()=>{document.addEventListener("mousedown",e)},0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[x.isOpen,E.floating,C,null==s?void 0:s.closeOnClickOutside]),i(()=>({isOpen:x.isOpen,query:x.query,trigger:x.trigger,items:l,loading:h,error:m,selectedIndex:b,setSelectedIndex:w,selectItem:R,close:C,refs:{setFloating:E.setFloating,setReference:E.setReference},floatingStyles:N}),[x.isOpen,x.query,x.trigger,l,h,m,b,R,C,E.setFloating,E.setReference,N])}const Hr=n=>{var r;const{item:o,selected:i,onSelect:a,onMouseEnter:s,showTypeBadge:l=!0}=n,c=o.type?null!==(r=F[o.type])&&void 0!==r?r:F.custom:null;return t("button",Object.assign({type:"button",onClick:a,onMouseEnter:s,className:x("w-full flex items-center gap-2 px-2 py-1.5 text-left rounded-sm transition-colors","hover:bg-accent hover:text-accent-foreground","focus:outline-none focus:bg-accent focus:text-accent-foreground",i&&"bg-accent text-accent-foreground")},{children:[e(_,{name:o.name,avatar:o.avatar,size:"sm"}),t("div",Object.assign({className:"flex-1 min-w-0"},{children:[t("div",Object.assign({className:"flex items-center gap-1.5"},{children:[e("span",Object.assign({className:"font-medium text-sm truncate"},{children:o.name})),l&&o.type&&e("span",Object.assign({className:x("text-[10px] px-1.5 py-0.5 rounded-full font-medium",c)},{children:o.type}))]})),o.meta&&"object"==typeof o.meta&&"description"in o.meta&&e("p",Object.assign({className:"text-xs text-muted-foreground truncate"},{children:String(o.meta.description)}))]}))]}))},Kr=({showTypeBadge:n=!0,maxHeight:r=280,className:o})=>{const{isOpen:i,query:a,trigger:s,items:l,loading:d,error:f,selectedIndex:p,setSelectedIndex:h,selectItem:g,refs:m,floatingStyles:v}=Vr(),y=c(null),b=c(null);return u(()=>{b.current&&y.current&&b.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[p]),i?t("div",Object.assign({ref:m.setFloating,style:v,className:x("z-50 min-w-[220px] max-w-[320px] rounded-md border bg-popover text-popover-foreground shadow-md","animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",o)},{children:[a&&e("div",Object.assign({className:"px-3 py-2 border-b"},{children:t("p",Object.assign({className:"text-xs text-muted-foreground"},{children:["Searching for “",null==s?void 0:s.char,e("span",Object.assign({className:"font-medium text-foreground"},{children:a})),"”"]}))})),d&&e("div",Object.assign({className:"p-2 space-y-1"},{children:[1,2,3].map(n=>t("div",Object.assign({className:"flex items-center gap-2 px-2 py-1.5 animate-pulse"},{children:[e("div",{className:"w-6 h-6 rounded-full bg-muted"}),t("div",Object.assign({className:"flex-1 space-y-1"},{children:[e("div",{className:"h-3 w-24 rounded bg-muted"}),e("div",{className:"h-2 w-16 rounded bg-muted"})]}))]}),n))})),f&&!d&&e("div",Object.assign({className:"px-3 py-4 text-center"},{children:e("p",Object.assign({className:"text-sm text-destructive"},{children:f.message}))})),!d&&!f&&0===l.length&&e("div",Object.assign({className:"px-3 py-4 text-center"},{children:e("p",Object.assign({className:"text-sm text-muted-foreground"},{children:a?"No results found":"Type to search..."}))})),!d&&!f&&l.length>0&&e(M,Object.assign({style:{maxHeight:r,overflowY:"auto"},className:"p-1"},{children:e("div",Object.assign({ref:y,role:"listbox","aria-label":"Mention suggestions"},{children:l.map((t,r)=>e("div",Object.assign({ref:r===p?b:void 0,role:"option","aria-selected":r===p},{children:e(Hr,{item:t,selected:r===p,onSelect:()=>g(t),onMouseEnter:()=>h(r),showTypeBadge:n})}),t.id))}))})),l.length>0&&t("div",Object.assign({className:"px-3 py-1.5 border-t text-[10px] text-muted-foreground flex items-center gap-2"},{children:[t("span",{children:[e("kbd",Object.assign({className:"px-1 py-0.5 rounded bg-muted text-[9px]"},{children:"↑↓"}))," navigate"]}),t("span",{children:[e("kbd",Object.assign({className:"px-1 py-0.5 rounded bg-muted text-[9px]"},{children:"↵"}))," select"]}),t("span",{children:[e("kbd",Object.assign({className:"px-1 py-0.5 rounded bg-muted text-[9px]"},{children:"esc"}))," close"]})]}))]})):null},Ur={mention:{render:I}};export{_ as MentionAvatar,Kr as MentionDropdown,I as MentionElement,Hr as MentionItem,Ur as MentionUI};
13
+ */const _=({name:t,avatar:n,size:r="inline",className:o})=>{const a=i(()=>function(e){const t=e.trim().split(/\s+/);return 1===t.length?t[0].slice(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}(t),[t]),s=i(()=>function(e){let t=0;for(let n=0;n<e.length;n+=1)t=e.charCodeAt(n)+((t<<5)-t);const n=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"];return n[Math.abs(t)%n.length]}(t),[t]),l=L[r];return n?e("img",{src:n,alt:t,style:{width:l.width,height:l.height},className:x("rounded-full object-cover flex-shrink-0",o)}):e("div",Object.assign({style:{width:l.width,height:l.height},className:x("rounded-full flex items-center justify-center font-medium text-white flex-shrink-0",s,o)},{children:a}))},F={user:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",channel:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",page:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",custom:"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200"},q=({type:t})=>{const n="w-3.5 h-3.5";switch(t){case"user":default:return e(D,{className:n});case"channel":return e(A,{className:n});case"page":return e(C,{className:n})}},I=r=>{var o;const{attributes:i,children:s,element:l,blockId:c}=r,u=p(),[d,f]=a(!1),{id:g,name:m,avatar:v,type:y,meta:P}=l.props,C=y?null!==(o=F[y])&&void 0!==o?o:F.custom:null,T=null==P?void 0:P.url,M=null==P?void 0:P.description,D=e=>{e.preventDefault(),e.stopPropagation(),T&&window.open(T,"_blank","noopener,noreferrer")};return t(k,Object.assign({openDelay:300,closeDelay:150},{children:[e(S,Object.assign({asChild:!0},{children:t("span",Object.assign({},i,{contentEditable:!1,onClick:e=>{T&&e.metaKey&&D(e)},"data-mention-id":g,"data-mention-type":y,className:x("inline-flex items-center align-baseline","bg-primary/10 text-primary font-medium","hover:bg-primary/15 transition-colors cursor-pointer"),style:{borderRadius:"0.25rem",padding:"0.125em 0.35em",margin:"0 0.1em",gap:"0.25em",fontSize:"0.9em",lineHeight:1.4,verticalAlign:"baseline"}},{children:[e(_,{name:m,avatar:v,size:"inline"}),e("span",{children:m}),s]}))})),t(j,Object.assign({className:"w-72 p-0",side:"top",align:"start",sideOffset:8,onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation()},{children:[e("div",Object.assign({className:"p-2"},{children:t("div",Object.assign({className:"flex items-start gap-3"},{children:[e(_,{name:m,avatar:v,size:"md"}),t("div",Object.assign({className:"flex-1 min-w-0 pt-0.5"},{children:[t("div",Object.assign({className:"flex items-center gap-2"},{children:[e("h4",Object.assign({className:"font-semibold text-sm truncate"},{children:m})),y&&t("span",Object.assign({className:x("inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded-md font-medium shrink-0",C)},{children:[e(q,{type:y}),y]}))]})),M&&e("p",Object.assign({className:"text-xs text-muted-foreground line-clamp-2 leading-relaxed"},{children:M}))]}))]}))})),((null==P?void 0:P.email)||T)&&t("div",Object.assign({className:"px-2 pb-2 space-y-1"},{children:[(null==P?void 0:P.email)&&t("div",Object.assign({className:"flex items-center gap-2 text-xs text-muted-foreground"},{children:[e(B,{className:"w-3.5 h-3.5 shrink-0"}),e("span",Object.assign({className:"truncate"},{children:P.email}))]})),T&&t("div",Object.assign({className:"flex items-center gap-2 text-xs text-muted-foreground"},{children:[e(E,{className:"w-3.5 h-3.5 shrink-0"}),e("span",Object.assign({className:"truncate"},{children:T}))]}))]})),t("div",Object.assign({className:"flex items-center gap-0.5 p-1 border-t"},{children:[T&&t(O,Object.assign({variant:"ghost",size:"sm",className:"h-8 px-2 text-xs flex-1",onClick:D},{children:[e(E,{className:"w-3.5 h-3.5 mr-1.5"}),"Open"]})),e(O,Object.assign({variant:"ghost",size:"sm",className:"h-8 px-2 text-xs flex-1",onClick:e=>{e.preventDefault(),e.stopPropagation();w(null!=T?T:`@${m}`)&&(f(!0),setTimeout(()=>f(!1),1500))}},{children:t(n,d?{children:[e(N,{className:"w-3.5 h-3.5 mr-1.5 text-green-600 dark:text-green-400"}),e("span",Object.assign({className:"text-green-600 dark:text-green-400"},{children:"Copied"}))]}:{children:[e(b,{className:"w-3.5 h-3.5 mr-1.5"}),"Copy"]})})),!u.readOnly&&e(O,Object.assign({variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive hover:bg-destructive/10",onClick:e=>{if(u.readOnly)return;e.preventDefault(),e.stopPropagation();const t=h.getElementPath(u,{blockId:c,element:l});t&&h.deleteElement(u,{type:"mention",path:t,blockId:c})},title:"Delete mention"},{children:e(R,{className:"w-3.5 h-3.5"})}))]}))]}))]}))};var W={ancestors(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=W.levels(e,t);return n?r.slice(1):r.slice(0,-1)},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var o=e[r];if(o!==t[r])break;n.push(o)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),i=e[n],a=t[n];return W.equals(r,o)&&i>a},endsAt(e,t){var n=e.length,r=e.slice(0,n),o=t.slice(0,n);return W.equals(r,o)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),i=e[n],a=t[n];return W.equals(r,o)&&i<a},equals:(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),hasPrevious:e=>e[e.length-1]>0,isAfter:(e,t)=>1===W.compare(e,t),isAncestor:(e,t)=>e.length<t.length&&0===W.compare(e,t),isBefore:(e,t)=>-1===W.compare(e,t),isChild:(e,t)=>e.length===t.length+1&&0===W.compare(e,t),isCommon:(e,t)=>e.length<=t.length&&0===W.compare(e,t),isDescendant:(e,t)=>e.length>t.length&&0===W.compare(e,t),isParent:(e,t)=>e.length+1===t.length&&0===W.compare(e,t),isPath:e=>Array.isArray(e)&&(0===e.length||"number"==typeof e[0]),isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1);return e[e.length-1]!==t[t.length-1]&&W.equals(n,r)},levels(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=[],o=0;o<=e.length;o++)r.push(e.slice(0,o));return n&&r.reverse(),r},next(e){if(0===e.length)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(0===e.length)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(0===e.length)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!W.isAncestor(t,e)&&!W.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:o="forward"}=n;if(0===e.length)return r;switch(t.type){case"insert_node":var{path:i}=t;(W.equals(i,r)||W.endsBefore(i,r)||W.isAncestor(i,r))&&(r[i.length-1]+=1);break;case"remove_node":var{path:a}=t;if(W.equals(a,r)||W.isAncestor(a,r))return null;W.endsBefore(a,r)&&(r[a.length-1]-=1);break;case"merge_node":var{path:s,position:l}=t;W.equals(s,r)||W.endsBefore(s,r)?r[s.length-1]-=1:W.isAncestor(s,r)&&(r[s.length-1]-=1,r[s.length]+=l);break;case"split_node":var{path:c,position:u}=t;if(W.equals(c,r)){if("forward"===o)r[r.length-1]+=1;else if("backward"!==o)return null}else W.endsBefore(c,r)?r[c.length-1]+=1:W.isAncestor(c,r)&&e[c.length]>=u&&(r[c.length-1]+=1,r[c.length]-=u);break;case"move_node":var{path:d,newPath:f}=t;if(W.equals(d,f))return r;if(W.isAncestor(d,r)||W.equals(d,r)){var p=f.slice();return W.endsBefore(d,f)&&d.length<f.length&&(p[d.length-1]-=1),p.concat(r.slice(d.length))}W.isSibling(d,f)&&(W.isAncestor(f,r)||W.equals(f,r))?W.endsBefore(d,r)?r[d.length-1]-=1:r[d.length-1]+=1:W.endsBefore(f,r)||W.equals(f,r)||W.isAncestor(f,r)?(W.endsBefore(d,r)&&(r[d.length-1]-=1),r[f.length-1]+=1):W.endsBefore(d,r)&&(W.equals(f,r)&&(r[f.length-1]+=1),r[d.length-1]-=1)}return r}};function z(e){return z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},z(e)}function V(e,t,n){return(t=function(e){var t=function(e){if("object"!==z(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==z(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===z(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function H(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var K=["anchor","focus"];function U(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var $={edges(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:o}=e;return $.isBackward(e)===n?[r,o]:[o,r]},end(e){var[,t]=$.edges(e);return t},equals:(e,t)=>fe.equals(e.anchor,t.anchor)&&fe.equals(e.focus,t.focus),surrounds(e,t){var n=$.intersection(e,t);return!!n&&$.equals(n,t)},includes(e,t){if($.isRange(t)){if($.includes(e,t.anchor)||$.includes(e,t.focus))return!0;var[n,r]=$.edges(e),[o,i]=$.edges(t);return fe.isBefore(n,o)&&fe.isAfter(r,i)}var[a,s]=$.edges(e),l=!1,c=!1;return fe.isPoint(t)?(l=fe.compare(t,a)>=0,c=fe.compare(t,s)<=0):(l=W.compare(t,a.path)>=0,c=W.compare(t,s.path)<=0),l&&c},intersection(e,t){var n=H(e,K),[r,o]=$.edges(e),[i,a]=$.edges(t),s=fe.isBefore(r,i)?i:r,l=fe.isBefore(o,a)?o:a;return fe.isBefore(l,s)?null:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?U(Object(n),!0).forEach(function(t){V(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):U(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({anchor:s,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return fe.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return fe.equals(t,n)},isExpanded:e=>!$.isCollapsed(e),isForward:e=>!$.isBackward(e),isRange:e=>ae(e)&&fe.isPoint(e.anchor)&&fe.isPoint(e.focus),*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=$.edges(e);return t},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null===e)return null;var r,o,{affinity:i="inward"}=n;if("inward"===i){var a=$.isCollapsed(e);$.isForward(e)?(r="forward",o=a?r:"backward"):(r="backward",o=a?r:"forward")}else"outward"===i?$.isForward(e)?(r="backward",o="forward"):(r="forward",o="backward"):(r=i,o=i);var s=fe.transform(e.anchor,t,{affinity:r}),l=fe.transform(e.focus,t,{affinity:o});return s&&l?{anchor:s,focus:l}:null}},X=function(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!!ae(e)&&"function"!=typeof e.apply&&(t?ee.isNodeList(e.children):Array.isArray(e.children))},J={isAncestor(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return ae(e)&&ee.isNodeList(e.children,{deep:t})},isElement:X,isElementList(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)&&e.every(e=>J.isElement(e,{deep:t}))},isElementProps:e=>void 0!==e.children,isElementType:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"type";return X(e)&&e[n]===t},matches(e,t){for(var n in t)if("children"!==n&&e[n]!==t[n])return!1;return!0}},Q=["children"],Y=["text"];function Z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function G(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Z(Object(n),!0).forEach(function(t){V(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Z(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var ee={ancestor(e,t){var n=ee.get(e,t);if(be.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(he.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of W.ancestors(t,n)){var o=[ee.ancestor(e,r),r];yield o}}()},child(e,t){if(be.isText(e))throw new Error("Cannot get the child of a text node: ".concat(he.stringify(e)));var n=e.children[t];if(null==n)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(he.stringify(e)));return n},children(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,o=ee.ancestor(e,t),{children:i}=o,a=r?i.length-1:0;r?a>=0:a<i.length;){var s=ee.child(o,a),l=t.concat(a);yield[s,l],a=r?a-1:a+1}}()},common(e,t,n){var r=W.common(t,n);return[ee.get(e,r),r]},descendant(e,t){var n=ee.get(e,t);if(ce.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(he.stringify(n)));return n},descendants(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of ee.nodes(e,t))0!==r.length&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of ee.nodes(e,t))J.isElement(n)&&(yield[n,r])}()},extractProps:e=>J.isAncestor(e)?H(e,Q):H(e,Y),first(e,t){for(var n=t.slice(),r=ee.get(e,n);r&&!be.isText(r)&&0!==r.children.length;)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){var n={children:e.children},[r,o]=$.edges(t),i=ee.nodes(n,{reverse:!0,pass:e=>{var[,n]=e;return!$.includes(t,n)}}),a=function(){if(!$.includes(t,s)){var e=s[s.length-1];Pe(n,W.parent(s),t=>Se(t,e,1))}W.equals(s,o.path)&&Ee(n,s,e=>{var t=e.text.slice(0,o.offset);return G(G({},e),{},{text:t})}),W.equals(s,r.path)&&Ee(n,s,e=>{var t=e.text.slice(r.offset);return G(G({},e),{},{text:t})})};for(var[,s]of i)a();return n.children},get(e,t){var n=ee.getIf(e,t);if(void 0===n)throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(he.stringify(e)));return n},getIf(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(be.isText(n)||!n.children[o])return;n=n.children[o]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(be.isText(n)||!n.children[o])return!1;n=n.children[o]}return!0},isNode(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return be.isText(e)||J.isElement(e,{deep:t})||ce.isEditor(e,{deep:t})},isNodeList(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)&&e.every(e=>ee.isNode(e,{deep:t}))},last(e,t){for(var n=t.slice(),r=ee.get(e,n);r&&!be.isText(r)&&0!==r.children.length;){var o=r.children.length-1;r=r.children[o],n.push(o)}return[r,n]},leaf(e,t){var n=ee.get(e,t);if(!be.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(he.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of W.levels(t,n)){var o=ee.get(e,r);yield[o,r]}}()},matches:(e,t)=>J.isElement(e)&&J.isElementProps(t)&&J.matches(e,t)||be.isText(e)&&be.isTextProps(t)&&be.matches(e,t),nodes(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:o=[],to:i}=t,a=new Set,s=[],l=e;!i||!(r?W.isBefore(s,i):W.isAfter(s,i));)if(a.has(l)||(yield[l,s]),a.has(l)||be.isText(l)||0===l.children.length||null!=n&&!1!==n([l,s])){if(0===s.length)break;if(!r){var c=W.next(s);if(ee.has(e,c)){s=c,l=ee.get(e,s);continue}}r&&0!==s[s.length-1]?(s=W.previous(s),l=ee.get(e,s)):(s=W.parent(s),l=ee.get(e,s),a.add(l))}else{a.add(l);var u=r?l.children.length-1:0;W.isAncestor(s,o)&&(u=o[s.length]),s=s.concat(u),l=ee.get(e,s)}}()},parent(e,t){var n=W.parent(t),r=ee.get(e,n);if(be.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string:e=>be.isText(e)?e.text:e.children.map(ee.string).join(""),texts(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of ee.nodes(e,t))be.isText(n)&&(yield[n,r])}()}};function te(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ne(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?te(Object(n),!0).forEach(function(t){V(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):te(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var re,oe,ie={isNodeOperation:e=>ie.isOperation(e)&&e.type.endsWith("_node"),isOperation(e){if(!ae(e))return!1;switch(e.type){case"insert_node":case"remove_node":return W.isPath(e.path)&&ee.isNode(e.node);case"insert_text":case"remove_text":return"number"==typeof e.offset&&"string"==typeof e.text&&W.isPath(e.path);case"merge_node":return"number"==typeof e.position&&W.isPath(e.path)&&ae(e.properties);case"move_node":return W.isPath(e.path)&&W.isPath(e.newPath);case"set_node":return W.isPath(e.path)&&ae(e.properties)&&ae(e.newProperties);case"set_selection":return null===e.properties&&$.isRange(e.newProperties)||null===e.newProperties&&$.isRange(e.properties)||ae(e.properties)&&ae(e.newProperties);case"split_node":return W.isPath(e.path)&&"number"==typeof e.position&&ae(e.properties);default:return!1}},isOperationList:e=>Array.isArray(e)&&e.every(e=>ie.isOperation(e)),isSelectionOperation:e=>ie.isOperation(e)&&e.type.endsWith("_selection"),isTextOperation:e=>ie.isOperation(e)&&e.type.endsWith("_text"),inverse(e){switch(e.type){case"insert_node":return ne(ne({},e),{},{type:"remove_node"});case"insert_text":return ne(ne({},e),{},{type:"remove_text"});case"merge_node":return ne(ne({},e),{},{type:"split_node",path:W.previous(e.path)});case"move_node":var{newPath:t,path:n}=e;if(W.equals(t,n))return e;if(W.isSibling(n,t))return ne(ne({},e),{},{path:t,newPath:n});var r=W.transform(n,e),o=W.transform(W.next(n),e);return ne(ne({},e),{},{path:r,newPath:o});case"remove_node":return ne(ne({},e),{},{type:"insert_node"});case"remove_text":return ne(ne({},e),{},{type:"insert_text"});case"set_node":var{properties:i,newProperties:a}=e;return ne(ne({},e),{},{properties:a,newProperties:i});case"set_selection":var{properties:s,newProperties:l}=e;return ne(ne({},e),{},null==s?{properties:l,newProperties:null}:null==l?{properties:null,newProperties:s}:{properties:l,newProperties:s});case"split_node":return ne(ne({},e),{},{type:"merge_node",path:W.next(e.path)})}}},ae=e=>"object"==typeof e&&null!==e,se=(e,t)=>{for(var n in e){var r=e[n],o=t[n];if(Array.isArray(r)&&Array.isArray(o)){if(r.length!==o.length)return!1;for(var i=0;i<r.length;i++)if(r[i]!==o[i])return!1}else if(ae(r)&&ae(o)){if(!se(r,o))return!1}else if(r!==o)return!1}for(var a in t)if(void 0===e[a]&&void 0!==t[a])return!1;return!0},le=e=>e.selection?e.selection:e.children.length>0?ce.end(e,[]):[0];(oe=re||(re={}))[oe.None=0]="None",oe[oe.Extend=1]="Extend",oe[oe.ZWJ=2]="ZWJ",oe[oe.RI=4]="RI",oe[oe.Prepend=8]="Prepend",oe[oe.SpacingMark=16]="SpacingMark",oe[oe.L=32]="L",oe[oe.V=64]="V",oe[oe.T=128]="T",oe[oe.LV=256]="LV",oe[oe.LVT=512]="LVT",oe[oe.ExtPict=1024]="ExtPict",oe[oe.Any=2048]="Any",re.L,re.L,re.V,re.LV,re.LVT,re.LV,re.V,re.V,re.T,re.LVT,re.T,re.T,re.Any,re.Extend,re.ZWJ,re.Any,re.SpacingMark,re.Prepend,re.Any,re.ZWJ,re.ExtPict,re.RI,re.RI;var ce={above:(e,t)=>e.above(t),addMark(e,t,n){e.addMark(t,n)},after:(e,t,n)=>e.after(t,n),before:(e,t,n)=>e.before(t,n),deleteBackward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteBackward(n)},deleteForward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteForward(n)},deleteFragment(e,t){e.deleteFragment(t)},edges:(e,t)=>e.edges(t),elementReadOnly(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.elementReadOnly(t)},end:(e,t)=>e.end(t),first:(e,t)=>e.first(t),fragment:(e,t)=>e.fragment(t),hasBlocks:(e,t)=>e.hasBlocks(t),hasInlines:(e,t)=>e.hasInlines(t),hasPath:(e,t)=>e.hasPath(t),hasTexts:(e,t)=>e.hasTexts(t),insertBreak(e){e.insertBreak()},insertFragment(e,t,n){e.insertFragment(t,n)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock:(e,t)=>e.isBlock(t),isEdge:(e,t,n)=>e.isEdge(t,n),isEditor:e=>function(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!!ae(e)&&("function"==typeof e.addMark&&"function"==typeof e.apply&&"function"==typeof e.deleteFragment&&"function"==typeof e.insertBreak&&"function"==typeof e.insertSoftBreak&&"function"==typeof e.insertFragment&&"function"==typeof e.insertNode&&"function"==typeof e.insertText&&"function"==typeof e.isElementReadOnly&&"function"==typeof e.isInline&&"function"==typeof e.isSelectable&&"function"==typeof e.isVoid&&"function"==typeof e.normalizeNode&&"function"==typeof e.onChange&&"function"==typeof e.removeMark&&"function"==typeof e.getDirtyPaths&&(null===e.marks||ae(e.marks))&&(null===e.selection||$.isRange(e.selection))&&(!t||ee.isNodeList(e.children))&&ie.isOperationList(e.operations))}(e),isElementReadOnly:(e,t)=>e.isElementReadOnly(t),isEmpty:(e,t)=>e.isEmpty(t),isEnd:(e,t,n)=>e.isEnd(t,n),isInline:(e,t)=>e.isInline(t),isNormalizing:e=>e.isNormalizing(),isSelectable:(e,t)=>e.isSelectable(t),isStart:(e,t,n)=>e.isStart(t,n),isVoid:(e,t)=>e.isVoid(t),last:(e,t)=>e.last(t),leaf:(e,t,n)=>e.leaf(t,n),levels:(e,t)=>e.levels(t),marks:e=>e.getMarks(),next:(e,t)=>e.next(t),node:(e,t,n)=>e.node(t,n),nodes:(e,t)=>e.nodes(t),normalize(e,t){e.normalize(t)},parent:(e,t,n)=>e.parent(t,n),path:(e,t,n)=>e.path(t,n),pathRef:(e,t,n)=>e.pathRef(t,n),pathRefs:e=>e.pathRefs(),point:(e,t,n)=>e.point(t,n),pointRef:(e,t,n)=>e.pointRef(t,n),pointRefs:e=>e.pointRefs(),positions:(e,t)=>e.positions(t),previous:(e,t)=>e.previous(t),range:(e,t,n)=>e.range(t,n),rangeRef:(e,t,n)=>e.rangeRef(t,n),rangeRefs:e=>e.rangeRefs(),removeMark(e,t){e.removeMark(t)},setNormalizing(e,t){e.setNormalizing(t)},start:(e,t)=>e.start(t),string:(e,t,n)=>e.string(t,n),unhangRange:(e,t,n)=>e.unhangRange(t,n),void:(e,t)=>e.void(t),withoutNormalizing(e,t){e.withoutNormalizing(t)},shouldMergeNodesRemovePrevNode:(e,t,n)=>e.shouldMergeNodesRemovePrevNode(t,n)};function ue(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function de(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ue(Object(n),!0).forEach(function(t){V(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ue(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var fe={compare(e,t){var n=W.compare(e.path,t.path);return 0===n?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter:(e,t)=>1===fe.compare(e,t),isBefore:(e,t)=>-1===fe.compare(e,t),equals:(e,t)=>e.offset===t.offset&&W.equals(e.path,t.path),isPoint:e=>ae(e)&&"number"==typeof e.offset&&W.isPath(e.path),transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null===e)return null;var{affinity:r="forward"}=n,{path:o,offset:i}=e;switch(t.type){case"insert_node":case"move_node":o=W.transform(o,t,n);break;case"insert_text":W.equals(t.path,o)&&(t.offset<i||t.offset===i&&"forward"===r)&&(i+=t.text.length);break;case"merge_node":W.equals(t.path,o)&&(i+=t.position),o=W.transform(o,t,n);break;case"remove_text":W.equals(t.path,o)&&t.offset<=i&&(i-=Math.min(i-t.offset,t.text.length));break;case"remove_node":if(W.equals(t.path,o)||W.isAncestor(t.path,o))return null;o=W.transform(o,t,n);break;case"split_node":if(W.equals(t.path,o)){if(t.position===i&&null==r)return null;(t.position<i||t.position===i&&"forward"===r)&&(i-=t.position,o=W.transform(o,t,de(de({},n),{},{affinity:"forward"})))}else o=W.transform(o,t,n);break;default:return e}return{path:o,offset:i}}},pe=void 0,he={setScrubber(e){pe=e},stringify:e=>JSON.stringify(e,pe)},ge=["text"],me=["anchor","focus","merge"];function ve(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ye(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ve(Object(n),!0).forEach(function(t){V(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ve(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var be={equals(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{loose:r=!1}=n;function o(e){return H(e,ge)}return se(r?o(e):e,r?o(t):t)},isText:e=>ae(e)&&"string"==typeof e.text,isTextList:e=>Array.isArray(e)&&e.every(e=>be.isText(e)),isTextProps:e=>void 0!==e.text,matches(e,t){for(var n in t)if("text"!==n&&(!e.hasOwnProperty(n)||e[n]!==t[n]))return!1;return!0},decorations(e,t){var n=[{leaf:ye({},e)}];for(var r of t){var{anchor:o,focus:i,merge:a}=r,s=H(r,me),[l,c]=$.edges(r),u=[],d=0,f=l.offset,p=c.offset,h=null!=a?a:Object.assign;for(var{leaf:g}of n){var{length:m}=g.text,v=d;if(d+=m,f<=v&&d<=p)h(g,s),u.push({leaf:g});else if(f!==p&&(f===d||p===v)||f>d||p<v||p===v&&0!==v)u.push({leaf:g});else{var y=g,b=void 0,w=void 0;if(p<d){var x=p-v;w={leaf:ye(ye({},y),{},{text:y.text.slice(x)})},y=ye(ye({},y),{},{text:y.text.slice(0,x)})}if(f>v){var O=f-v;b={leaf:ye(ye({},y),{},{text:y.text.slice(0,O)})},y=ye(ye({},y),{},{text:y.text.slice(O)})}h(y,s),b&&u.push(b),u.push({leaf:y}),w&&u.push(w)}}n=u}if(n.length>1){var k=0;for(var[S,j]of n.entries()){var P=k,E=P+j.leaf.text.length,N={start:P,end:E};0===S&&(N.isFirst=!0),S===n.length-1&&(N.isLast=!0),j.position=N,k=E}}return n}};function we(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function xe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?we(Object(n),!0).forEach(function(t){V(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):we(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Oe=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return[...e.slice(0,t),...r,...e.slice(t)]},ke=function(e,t,n){for(var r=arguments.length,o=new Array(r>3?r-3:0),i=3;i<r;i++)o[i-3]=arguments[i];return[...e.slice(0,t),...o,...e.slice(t+n)]},Se=ke,je=(e,t,n)=>{if(0===t.length)throw new Error("Cannot modify the editor");for(var r=ee.get(e,t),o=t.slice(),i=n(r);o.length>1;){var a=o.pop(),s=ee.get(e,o);i=xe(xe({},s),{},{children:ke(s.children,a,1,i)})}var l=o.pop();e.children=ke(e.children,l,1,i)},Pe=(e,t,n)=>{0===t.length?e.children=n(e.children):je(e,t,e=>{if(be.isText(e))throw new Error("Cannot get the element at path [".concat(t,"] because it refers to a leaf node: ").concat(he.stringify(e)));return xe(xe({},e),{},{children:n(e.children)})})},Ee=(e,t,n)=>je(e,t,e=>{if(!be.isText(e))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(he.stringify(e)));return n(e)});function Ne(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ne(Object(n),!0).forEach(function(t){V(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ne(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ce={transform(e,t){var n=!1;switch(t.type){case"insert_node":var{path:r,node:o}=t;Pe(e,W.parent(r),e=>{var t=r[r.length-1];if(t>e.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));return Oe(e,t,o)}),n=!0;break;case"insert_text":var{path:i,offset:a,text:s}=t;if(0===s.length)break;Ee(e,i,e=>{var t=e.text.slice(0,a),n=e.text.slice(a);return Re(Re({},e),{},{text:t+s+n})}),n=!0;break;case"merge_node":var{path:l}=t,c=l[l.length-1],u=W.previous(l),d=u[u.length-1];Pe(e,W.parent(l),e=>{var t,n=e[c],r=e[d];if(be.isText(n)&&be.isText(r))t=Re(Re({},r),{},{text:r.text+n.text});else{if(be.isText(n)||be.isText(r))throw new Error('Cannot apply a "merge_node" operation at path ['.concat(l,"] to nodes of different interfaces: ").concat(he.stringify(n)," ").concat(he.stringify(r)));t=Re(Re({},r),{},{children:r.children.concat(n.children)})}return ke(e,d,2,t)}),n=!0;break;case"move_node":var{path:f,newPath:p}=t,h=f[f.length-1];if(W.isAncestor(f,p))throw new Error("Cannot move a path [".concat(f,"] to new path [").concat(p,"] because the destination is inside itself."));var g=ee.get(e,f);Pe(e,W.parent(f),e=>Se(e,h,1));var m=W.transform(f,t),v=m[m.length-1];Pe(e,W.parent(m),e=>Oe(e,v,g)),n=!0;break;case"remove_node":var{path:y}=t,b=y[y.length-1];if(Pe(e,W.parent(y),e=>Se(e,b,1)),e.selection){var w=Re({},e.selection);for(var[x,O]of $.points(w)){var k=fe.transform(x,t);if(null!=w&&null!=k)w[O]=k;else{var S=void 0,j=void 0;for(var[P,E]of ee.texts(e)){if(-1!==W.compare(E,y)){j=[P,E];break}S=[P,E]}var N=!1;S&&j&&(N=!W.isSibling(S[1],y)&&(!!W.equals(j[1],y)||W.common(S[1],y).length<W.common(j[1],y).length)),S&&!N?w[O]={path:S[1],offset:S[0].text.length}:j?w[O]={path:j[1],offset:0}:w=null}}w&&$.equals(w,e.selection)||(e.selection=w)}break;case"remove_text":var{path:R,offset:C,text:T}=t;if(0===T.length)break;Ee(e,R,e=>{var t=e.text.slice(0,C),n=e.text.slice(C+T.length);return Re(Re({},e),{},{text:t+n})}),n=!0;break;case"set_node":var{path:M,properties:D,newProperties:A}=t;if(0===M.length)throw new Error("Cannot set properties on the root node!");je(e,M,e=>{var t=Re({},e);for(var n in A){if("children"===n||"text"===n)throw new Error('Cannot set the "'.concat(n,'" property of nodes!'));var r=A[n];null==r?delete t[n]:t[n]=r}for(var o in D)A.hasOwnProperty(o)||delete t[o];return t});break;case"set_selection":var{newProperties:B}=t;if(null==B){e.selection=null;break}if(null==e.selection){if(!$.isRange(B))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(he.stringify(B)," when there is no current selection."));e.selection=Re({},B);break}var L=Re({},e.selection);for(var _ in B){var F=B[_];if(null==F){if("anchor"===_||"focus"===_)throw new Error('Cannot remove the "'.concat(_,'" selection property'));delete L[_]}else L[_]=F}e.selection=L;break;case"split_node":var{path:q,position:I,properties:z}=t,V=q[q.length-1];if(0===q.length)throw new Error('Cannot apply a "split_node" operation at path ['.concat(q,"] because the root node cannot be split."));Pe(e,W.parent(q),e=>{var t,n,r=e[V];if(be.isText(r)){var o=r.text.slice(0,I),i=r.text.slice(I);t=Re(Re({},r),{},{text:o}),n=Re(Re({},z),{},{text:i})}else{var a=r.children.slice(0,I),s=r.children.slice(I);t=Re(Re({},r),{},{children:a}),n=Re(Re({},z),{},{children:s})}return ke(e,V,1,t,n)}),n=!0}if(n&&e.selection){var H=Re({},e.selection);for(var[K,U]of $.points(H))H[U]=fe.transform(K,t);$.equals(H,e.selection)||(e.selection=H)}}},Te={insertNodes(e,t,n){e.insertNodes(t,n)},liftNodes(e,t){e.liftNodes(t)},mergeNodes(e,t){e.mergeNodes(t)},moveNodes(e,t){e.moveNodes(t)},removeNodes(e,t){e.removeNodes(t)},setNodes(e,t,n){e.setNodes(t,n)},splitNodes(e,t){e.splitNodes(t)},unsetNodes(e,t,n){e.unsetNodes(t,n)},unwrapNodes(e,t){e.unwrapNodes(t)},wrapNodes(e,t,n){e.wrapNodes(t,n)}},Me={collapse(e,t){e.collapse(t)},deselect(e){e.deselect()},move(e,t){e.move(t)},select(e,t){e.select(t)},setPoint(e,t,n){e.setPoint(t,n)},setSelection(e,t){e.setSelection(t)}},De={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};ce.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:o=le(e)}=n;if(W.isPath(o)&&(o=ce.range(e,o)),$.isRange(o))if($.isCollapsed(o))o=o.anchor;else{var i=$.end(o);if(!r&&ce.void(e,{at:i}))return;var a=$.start(o),s=ce.pointRef(e,a),l=ce.pointRef(e,i);Le.delete(e,{at:o,voids:r});var c=s.unref(),u=l.unref();o=c||u,Le.setSelection(e,{anchor:o,focus:o})}if(!(!r&&ce.void(e,{at:o})||ce.elementReadOnly(e,{at:o}))){var{path:d,offset:f}=o;t.length>0&&e.apply({type:"insert_text",path:d,offset:f,text:t})}})}};function Ae(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Be(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ae(Object(n),!0).forEach(function(t){V(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ae(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Le=Be(Be(Be(Be({},Ce),Te),Me),De);const _e={isOpen:!1,query:"",trigger:null,targetRect:null,triggerRange:null},Fe={buildMentionElement:(e,t)=>{const{props:n}=t;return{id:m(),type:"mention",children:[{text:""}],props:Object.assign(Object.assign({},n),{nodeType:"inlineVoid"})}},insertMention:(e,t,n={})=>{var r,o;const i=e,a=i.mentions.state;if(!a.triggerRange)return;const{blockId:s,path:l,startOffset:c}=a.triggerRange,u=v.getBlockSlate(e,{id:s});if(!u)return;const d=a.trigger,f=a.query,p=c+(null!==(r=null==d?void 0:d.char.length)&&void 0!==r?r:1)+f.length;Le.select(u,{anchor:{path:l,offset:c},focus:{path:l,offset:p}}),Le.delete(u);const h={id:m(),type:"mention",children:[{text:""}],props:{id:t.id,type:t.type,name:t.name,avatar:t.avatar,meta:t.meta,nodeType:"inlineVoid"}};Le.insertNodes(u,h);const g=null===(o=e.plugins.Mention)||void 0===o?void 0:o.options;if(!1!==(null==g?void 0:g.closeOnSelect)&&i.mentions.close("select"),(null==g?void 0:g.onSelect)&&d&&g.onSelect(t,d),n.focus){const t=v.getBlock(e,{id:s});(null==t?void 0:t.id)&&e.focusBlock(t.id)}},findMention:(e,t,n={})=>{var r;return null!==(r=Fe.findMentions(e,n).find(e=>{var n;return(null===(n=e.props)||void 0===n?void 0:n.id)===t}))&&void 0!==r?r:null},findMentions:(e,t={})=>{var n;try{const r=t.blockId?{id:t.blockId}:{at:null!==(n=t.at)&&void 0!==n?n:e.path.current},o=v.getBlockSlate(e,r);if(!o)return[];const i=[];for(const[e]of ce.nodes(o,{at:[],match:e=>J.isElement(e)&&!ce.isEditor(e)&&"mention"===e.type}))i.push(e);return i}catch(e){return[]}},findMentionsByType:(e,t,n={})=>Fe.findMentions(e,n).filter(e=>{var n;return(null===(n=e.props)||void 0===n?void 0:n.type)===t}),updateMention:(e,t,n,r={})=>{var o;const i=r.blockId?{id:r.blockId}:{at:null!==(o=r.at)&&void 0!==o?o:e.path.current},a=v.getBlockSlate(e,i);if(!a)return;const s=Array.from(ce.nodes(a,{at:[],match:e=>{var n;return J.isElement(e)&&!ce.isEditor(e)&&"mention"===e.type&&(null===(n=e.props)||void 0===n?void 0:n.id)===t}})),l=s[0];if(l){const[e,t]=l;Le.setNodes(a,{props:Object.assign(Object.assign(Object.assign({},e.props),n),{nodeType:"inlineVoid"})},{at:t})}},deleteMention:(e,t,n={})=>{var r;const o=n.blockId?{id:n.blockId}:{at:null!==(r=n.at)&&void 0!==r?r:e.path.current},i=v.getBlockSlate(e,o);if(!i)return;const a=Array.from(ce.nodes(i,{at:[],match:e=>{var n;return J.isElement(e)&&!ce.isEditor(e)&&"mention"===e.type&&(null===(n=e.props)||void 0===n?void 0:n.id)===t}})),s=a[0];if(s){const[,e]=s;Le.removeNodes(i,{at:e})}},openDropdown:(e,t)=>{e.mentions.open(t)},closeDropdown:(e,t="manual")=>{e.mentions.close(t)},getState:e=>{var t,n;return null!==(n=null===(t=e.mentions)||void 0===t?void 0:t.state)&&void 0!==n?n:_e},getQuery:e=>{var t,n;return null!==(n=null===(t=e.mentions)||void 0===t?void 0:t.state.query)&&void 0!==n?n:""},setQuery:(e,t)=>{e.mentions.setQuery(t)},getTrigger:e=>{var t,n;return null!==(n=null===(t=e.mentions)||void 0===t?void 0:t.state.trigger)&&void 0!==n?n:null},getTriggers:e=>{var t,n;const r=null===(t=e.plugins.Mention)||void 0===t?void 0:t.options;return r?r.triggers&&r.triggers.length>0?r.triggers:[{char:null!==(n=r.char)&&void 0!==n?n:"@"}]:[{char:"@"}]},getTriggerByChar:(e,t)=>Fe.getTriggers(e).find(e=>e.char===t)};var qe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ie="object"==typeof qe&&qe&&qe.Object===Object&&qe,We="object"==typeof self&&self&&self.Object===Object&&self,ze=(Ie||We||Function("return this")()).Symbol;ze&&ze.toStringTag,ze&&ze.toStringTag;var Ve={};Object.defineProperty(Ve,"__esModule",{value:!0});for(var He="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Ke={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Ue={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:He?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},$e={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},Xe=1;Xe<20;Xe++)$e["f"+Xe]=111+Xe;function Je(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(e){return Qe(e,t)}),o=function(e){return r.some(function(t){return Ye(t,e)})};return null==n?o:o(n)}function Qe(e,t){var n=t&&t.byKey,r={},o=(e=e.replace("++","+add")).split("+"),i=o.length;for(var a in Ke)r[Ke[a]]=!1;var s=!0,l=!1,c=void 0;try{for(var u,d=o[Symbol.iterator]();!(s=(u=d.next()).done);s=!0){var f=u.value,p=f.endsWith("?")&&f.length>1;p&&(f=f.slice(0,-1));var h=Ge(f),g=Ke[h];if(f.length>1&&!g&&!Ue[f]&&!$e[h])throw new TypeError('Unknown modifier: "'+f+'"');1!==i&&g||(n?r.key=h:r.which=Ze(f)),g&&(r[g]=!p||null)}}catch(e){l=!0,c=e}finally{try{!s&&d.return&&d.return()}finally{if(l)throw c}}return r}function Ye(e,t){for(var n in e){var r=e[n],o=void 0;if(null!=r&&(null!=(o="key"===n&&null!=t.key?t.key.toLowerCase():"which"===n?91===r&&93===t.which?91:t.which:t[n])||!1!==r)&&o!==r)return!1}return!0}function Ze(e){return e=Ge(e),$e[e]||e.toUpperCase().charCodeAt(0)}function Ge(e){return e=e.toLowerCase(),Ue[e]||e}Ve.default=Je;var et=Ve.isHotkey=Je;Ve.isCodeHotkey=function(e,t){return Je(e,t)},Ve.isKeyHotkey=function(e,t){return Je(e,{byKey:!0},t)},Ve.parseHotkey=Qe,Ve.compareHotkey=Ye,Ve.toKeyCode=Ze,Ve.toKeyName=Ge;var tt,nt,rt=globalThis.Node,ot=globalThis.Text,it=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,at=e=>lt(e)&&8===e.nodeType,st=e=>lt(e)&&1===e.nodeType,lt=e=>{var t=it(e);return!!t&&e instanceof t.Node},ct=e=>{var t=e&&e.anchorNode&&it(e.anchorNode);return!!t&&e instanceof t.Selection},ut=(e,t,n)=>{for(var{childNodes:r}=e,o=r[t],i=t,a=!1,s=!1;(at(o)||st(o)&&0===o.childNodes.length||st(o)&&"false"===o.getAttribute("contenteditable"))&&(!a||!s);)i>=r.length?(a=!0,i=t-1,n="backward"):i<0?(s=!0,i=t+1,n="forward"):(o=r[i],t=i,i+="forward"===n?1:-1);return[o,t]},dt=(e,t,n)=>{var[r]=ut(e,t,n);return r},ft=e=>null!=e.getSelection?e.getSelection():document.getSelection(),pt=(e,t,n)=>{var{target:r}=t;if(st(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:o}=_t.getWindow(e);if(mt(o,r))return _t.hasDOMNode(e,r,{editable:!0});var i=n.find(e=>{var{addedNodes:t,removedNodes:n}=e;for(var o of t)if(o===r||mt(o,r))return!0;for(var i of n)if(i===r||mt(i,r))return!0});return!(!i||i===t)&&pt(e,i,n)},ht=(e,t)=>Boolean(e.compareDocumentPosition(t)&rt.DOCUMENT_POSITION_PRECEDING),gt=(e,t)=>{if(!e)return null;for(var n=e;n;){if(n.matches&&n.matches(t))return n;if(n.parentElement)n=n.parentElement;else{if(!n.parentNode||!("host"in n.parentNode))return null;n=n.parentNode.host}}return null},mt=(e,t)=>{if(!e||!t)return!1;if(e.contains(t))return!0;for(var n=t;n;){if(n===e)return!0;if(!n.parentNode)return!1;n="host"in n.parentNode?n.parentNode.host:n.parentNode}return!1},vt="undefined"!=typeof navigator&&/Mac OS X/.test(navigator.userAgent),yt="undefined"!=typeof navigator&&/Android/.test(navigator.userAgent),bt="undefined"!=typeof navigator&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),wt="undefined"!=typeof navigator&&/Chrome/i.test(navigator.userAgent);function xt(e){return xt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xt(e)}"undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&/Version\/(\d+)/.test(navigator.userAgent)&&null!==(tt=navigator.userAgent.match(/Version\/(\d+)/))&&void 0!==tt&&tt[1]&&parseInt(null===(nt=navigator.userAgent.match(/Version\/(\d+)/))||void 0===nt?void 0:nt[1],10);var Ot=0;class kt{constructor(){var e,t,n;e=this,n=void 0,(t=function(e){var t=function(e){if("object"!==xt(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==xt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===xt(t)?t:String(t)}(t="id"))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,this.id="".concat(Ot++)}}var St,jt=new WeakMap,Pt=new WeakMap,Et=new WeakMap,Nt=new WeakMap,Rt=new WeakMap,Ct=new WeakMap,Tt=new WeakMap,Mt=new WeakMap,Dt=new WeakMap,At=new WeakMap,Bt=new WeakMap,Lt=new WeakMap,_t={androidPendingDiffs:e=>Lt.get(e),androidScheduleFlush:e=>{var t;null===(t=Bt.get(e))||void 0===t||t()},blur:e=>{var t=_t.toDOMNode(e,e),n=_t.findDocumentOrShadowRoot(e);Dt.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=_t.findDocumentOrShadowRoot(e),r=ft(n);r&&r.rangeCount>0&&r.removeAllRanges(),t&&Le.deselect(e)},findDocumentOrShadowRoot:e=>{var t=_t.toDOMNode(e,e),n=t.getRootNode();return n instanceof Document||n instanceof ShadowRoot?n:t.ownerDocument},findEventRange:(e,t)=>{"nativeEvent"in t&&(t=t.nativeEvent);var{clientX:n,clientY:r,target:o}=t;if(null==n||null==r)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var i,a=_t.toSlateNode(e,t.target),s=_t.findPath(e,a);if(J.isElement(a)&&ce.isVoid(e,a)){var l=o.getBoundingClientRect(),c=e.isInline(a)?n-l.left<l.left+l.width-n:r-l.top<l.top+l.height-r,u=ce.point(e,s,{edge:c?"start":"end"}),d=c?ce.before(e,u):ce.after(e,u);if(d)return ce.range(e,d)}var{document:f}=_t.getWindow(e);if(f.caretRangeFromPoint)i=f.caretRangeFromPoint(n,r);else{var p=f.caretPositionFromPoint(n,r);p&&((i=f.createRange()).setStart(p.offsetNode,p.offset),i.setEnd(p.offsetNode,p.offset))}if(!i)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));return _t.toSlateRange(e,i,{exactMatch:!1,suppressThrow:!1})},findKey:(e,t)=>{var n=Ct.get(t);return n||(n=new kt,Ct.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var o=Pt.get(r);if(null==o){if(ce.isEditor(r))return n;break}var i=jt.get(r);if(null==i)break;n.unshift(i),r=o}throw new Error("Unable to find the path for Slate node: ".concat(he.stringify(t)))},focus:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{retries:5};if(!Dt.get(e)&&Nt.get(e)){if(t.retries<=0)throw new Error("Could not set focus, editor seems stuck with pending operations");if(e.operations.length>0)setTimeout(()=>{_t.focus(e,{retries:t.retries-1})},10);else{var n=_t.toDOMNode(e,e),r=_t.findDocumentOrShadowRoot(e);if(r.activeElement!==n){if(e.selection&&r instanceof Document){var o=ft(r),i=_t.toDOMRange(e,e.selection);null==o||o.removeAllRanges(),null==o||o.addRange(i)}e.selection||Le.select(e,ce.start(e,[])),Dt.set(e,!0),n.focus({preventScroll:!0})}}}},getWindow:e=>{var t=Et.get(e);if(!t)throw new Error("Unable to find a host window element for this editor");return t},hasDOMNode:function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{editable:o=!1}=r,i=_t.toDOMNode(e,e);try{n=st(t)?t:t.parentElement}catch(e){if(e instanceof Error&&!e.message.includes('Permission denied to access property "nodeType"'))throw e}return!!n&&!(gt(n,"[data-slate-editor]")!==i||o&&!n.isContentEditable&&("boolean"!=typeof n.isContentEditable||gt(n,'[contenteditable="false"]')!==i)&&!n.getAttribute("data-slate-zero-width"))},hasEditableTarget:(e,t)=>lt(t)&&_t.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return ce.hasPath(e,n.path)&&ce.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>_t.hasEditableTarget(e,t)||_t.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>lt(t)&&_t.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!At.get(e),isFocused:e=>!!Dt.get(e),isReadOnly:e=>!!Mt.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(Mt.get(e))return!1;var n=_t.hasTarget(e,t)&&_t.toSlateNode(e,t);return J.isElement(n)&&ce.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=Tt.get(e),r=ce.isEditor(t)?Nt.get(e):null==n?void 0:n.get(_t.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(he.stringify(t)));return r},toDOMPoint:(e,t)=>{var n,[r]=ce.node(e,t.path),o=_t.toDOMNode(e,r);ce.void(e,{at:t})&&(t={path:t.path,offset:0});for(var i=Array.from(o.querySelectorAll("[data-slate-string], [data-slate-zero-width]")),a=0,s=0;s<i.length;s++){var l=i[s],c=l.childNodes[0];if(null!=c&&null!=c.textContent){var{length:u}=c.textContent,d=l.getAttribute("data-slate-length"),f=a+(null==d?u:parseInt(d,10)),p=i[s+1];if(t.offset===f&&null!=p&&p.hasAttribute("data-slate-mark-placeholder")){var h,g=p.childNodes[0];n=[g instanceof ot?g:p,null!==(h=p.textContent)&&void 0!==h&&h.startsWith("\ufeff")?1:0];break}if(t.offset<=f){n=[c,Math.min(u,Math.max(0,t.offset-a))];break}a=f}}if(!n)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(he.stringify(t)));return n},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,o=$.isBackward(t),i=_t.toDOMPoint(e,n),a=$.isCollapsed(t)?i:_t.toDOMPoint(e,r),s=_t.getWindow(e).document.createRange(),[l,c]=o?a:i,[u,d]=o?i:a,f=!!(st(l)?l:l.parentElement).getAttribute("data-slate-zero-width"),p=!!(st(u)?u:u.parentElement).getAttribute("data-slate-zero-width");return s.setStart(l,f?1:c),s.setEnd(u,p?1:d),s},toSlateNode:(e,t)=>{var n=st(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Rt.get(n):null;if(!r)throw new Error("Cannot resolve a Slate node from DOM node: ".concat(n));return r},toSlatePoint:(e,t,n)=>{var{exactMatch:r,suppressThrow:o,searchDirection:i}=n,[a,s]=r?t:(e=>{var[t,n]=e;if(st(t)&&t.childNodes.length){var r=n===t.childNodes.length,o=r?n-1:n;for([t,o]=ut(t,o,r?"backward":"forward"),r=o<n;st(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=dt(t,i,r?"backward":"forward")}n=r&&null!=t.textContent?t.textContent.length:0}return[t,n]})(t),l=a.parentNode,c=null,u=0;if(l){var d,f,p=_t.toDOMNode(e,e),h=l.closest('[data-slate-void="true"]'),g=h&&mt(p,h)?h:null,m=l.closest('[contenteditable="false"]'),v=m&&mt(p,m)?m:null,y=l.closest("[data-slate-leaf]"),b=null;if(y){if(c=y.closest('[data-slate-node="text"]')){var w=_t.getWindow(e).document.createRange();w.setStart(c,0),w.setEnd(a,s);var x=w.cloneContents();[...Array.prototype.slice.call(x.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(x.querySelectorAll("[contenteditable=false]"))].forEach(e=>{yt&&!r&&e.hasAttribute("data-slate-zero-width")&&e.textContent.length>0&&"\ufeff"!==e.textContext?e.textContent.startsWith("\ufeff")&&(e.textContent=e.textContent.slice(1)):e.parentNode.removeChild(e)}),u=x.textContent.length,b=c}}else if(g){for(var O=g.querySelectorAll("[data-slate-leaf]"),k=0;k<O.length;k++){var S=O[k];if(_t.hasDOMNode(e,S)){y=S;break}}y?(c=y.closest('[data-slate-node="text"]'),u=(b=y).textContent.length,b.querySelectorAll("[data-slate-zero-width]").forEach(e=>{u-=e.textContent.length})):u=1}else if(v){var j,P,E=e=>e?e.querySelectorAll("[data-slate-leaf]:not(:scope [data-slate-editor] [data-slate-leaf])"):[],N=v.closest('[data-slate-node="element"]');"backward"!==i&&i||(y=null!==(j=[...E(null==N?void 0:N.previousElementSibling),...E(N)].findLast(e=>ht(v,e)))&&void 0!==j?j:null),"forward"!==i&&i||(y=null!==(P=[...E(N),...E(null==N?void 0:N.nextElementSibling)].find(e=>((e,t)=>Boolean(e.compareDocumentPosition(t)&rt.DOCUMENT_POSITION_FOLLOWING))(v,e)))&&void 0!==P?P:null),y&&(c=y.closest('[data-slate-node="text"]'),b=y,"forward"===i?u=0:(u=b.textContent.length,b.querySelectorAll("[data-slate-zero-width]").forEach(e=>{u-=e.textContent.length})))}b&&u===b.textContent.length&&yt&&"z"===b.getAttribute("data-slate-zero-width")&&null!==(d=b.textContent)&&void 0!==d&&d.startsWith("\ufeff")&&(l.hasAttribute("data-slate-zero-width")||bt&&null!==(f=b.textContent)&&void 0!==f&&f.endsWith("\n\n"))&&u--}if(yt&&!c&&!r){var R=l.hasAttribute("data-slate-node")?l:l.closest("[data-slate-node]");if(R&&_t.hasDOMNode(e,R,{editable:!0})){var C=_t.toSlateNode(e,R),{path:T,offset:M}=ce.start(e,_t.findPath(e,C));return R.querySelector("[data-slate-leaf]")||(M=s),{path:T,offset:M}}}if(!c){if(o)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var D=_t.toSlateNode(e,c);return{path:_t.findPath(e,D),offset:u}},toSlateRange:(e,t,n)=>{var r,o,i,a,s,l,{exactMatch:c,suppressThrow:u}=n;if(ct(t)?t.anchorNode:t.startContainer)if(ct(t)){if(bt&&t.rangeCount>1){a=t.focusNode;var d=t.getRangeAt(0),f=t.getRangeAt(t.rangeCount-1);if(a instanceof HTMLTableRowElement&&d.startContainer instanceof HTMLTableRowElement&&f.startContainer instanceof HTMLTableRowElement){function x(e){return e.childElementCount>0?x(e.children[0]):e}var p=d.startContainer,h=f.startContainer,g=x(p.children[d.startOffset]),m=x(h.children[f.startOffset]);s=0,o=m.childNodes.length>0?m.childNodes[0]:m,a=g.childNodes.length>0?g.childNodes[0]:g,i=m instanceof HTMLElement?m.innerHTML.length:0}else d.startContainer===a?(o=f.endContainer,i=f.endOffset,s=d.startOffset):(o=d.startContainer,i=d.endOffset,s=f.startOffset)}else o=t.anchorNode,i=t.anchorOffset,a=t.focusNode,s=t.focusOffset;l=wt&&(e=>{for(var t=e&&e.parentNode;t;){if("[object ShadowRoot]"===t.toString())return!0;t=t.parentNode}return!1})(o)||bt?t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:t.isCollapsed}else o=t.startContainer,i=t.startOffset,a=t.endContainer,s=t.endOffset,l=t.collapsed;if(null==o||null==a||null==i||null==s)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t));bt&&null!==(r=a.textContent)&&void 0!==r&&r.endsWith("\n\n")&&s===a.textContent.length&&s--;var v=_t.toSlatePoint(e,[o,i],{exactMatch:c,suppressThrow:u});if(!v)return null;var y=ht(o,a)||o===a&&s<i,b=l?v:_t.toSlatePoint(e,[a,s],{exactMatch:c,suppressThrow:u,searchDirection:y?"forward":"backward"});if(!b)return null;var w={anchor:v,focus:b};return $.isExpanded(w)&&$.isForward(w)&&st(a)&&ce.void(e,{at:w.focus,mode:"highest"})&&(w=ce.unhangRange(e,w,{voids:!0})),w}},Ft={bold:"mod+b",compose:["down","left","right","up","backspace","enter"],moveBackward:"left",moveForward:"right",moveWordBackward:"ctrl+left",moveWordForward:"ctrl+right",deleteBackward:"shift?+backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",extendForward:"shift+right",italic:"mod+i",insertSoftBreak:"shift+enter",splitBlock:"enter",undo:"mod+z"},qt={moveLineBackward:"opt+up",moveLineForward:"opt+down",moveWordBackward:"opt+left",moveWordForward:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},It={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Wt=e=>{var t=Ft[e],n=qt[e],r=It[e],o=t&&et(t),i=n&&et(n),a=r&&et(r);return e=>!(!o||!o(e))||!!(vt&&i&&i(e))||!(vt||!a||!a(e))};Wt("bold"),Wt("compose"),Wt("moveBackward"),Wt("moveForward"),Wt("deleteBackward"),Wt("deleteForward"),Wt("deleteLineBackward"),Wt("deleteLineForward"),Wt("deleteWordBackward"),Wt("deleteWordForward"),Wt("extendBackward"),Wt("extendForward"),Wt("extendLineBackward"),Wt("extendLineForward"),Wt("italic"),Wt("moveLineBackward"),Wt("moveLineForward"),Wt("moveWordBackward"),Wt("moveWordForward"),Wt("redo"),Wt("insertSoftBreak"),Wt("splitBlock"),Wt("transposeCharacter"),Wt("undo"),function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"}(St||(St={}));var zt=function(e){return Object.freeze(e)},Vt=function(e,t){this.inlineSize=e,this.blockSize=t,zt(this)},Ht=function(){function e(e,t,n,r){return this.x=e,this.y=t,this.width=n,this.height=r,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,zt(this)}return e.prototype.toJSON=function(){var e=this;return{x:e.x,y:e.y,top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.width,height:e.height}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),Kt="undefined"!=typeof window?window:{};/msie|trident/i.test(Kt.navigator&&Kt.navigator.userAgent);var Ut=function(e,t,n){return void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=!1),new Vt((n?t:e)||0,(n?e:t)||0)};function $t(e){return $t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$t(e)}function Xt(e,t,n){return(t=function(e){var t=function(e){if("object"!==$t(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==$t(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===$t(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}zt({devicePixelContentBoxSize:Ut(),borderBoxSize:Ut(),contentBoxSize:Ut(),contentRect:new Ht(0,0,0,0)});var Jt=s(null),Qt=_t,Yt={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};function Zt(e,t,n){var r;const o=(null!==(r=e.allowedAfter)&&void 0!==r?r:/^$|\s/).test(t),i=""===n||/\s/.test(n);return o&&i}function Gt(e){if(!e.selection||!$.isCollapsed(e.selection))return null;try{const t=Qt.toDOMRange(e,e.selection);if(!t)return null;const n=t.getClientRects();return{domRect:t.getBoundingClientRect(),clientRects:n.length>0?n:t.getClientRects()}}catch(e){const t=window.getSelection();if(!t||0===t.rangeCount)return null;const n=t.getRangeAt(0);return{domRect:n.getBoundingClientRect(),clientRects:n.getClientRects()}}}function en(){return"undefined"!=typeof window}function tn(e){return on(e)?(e.nodeName||"").toLowerCase():"#document"}function nn(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function rn(e){var t;return null==(t=(on(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function on(e){return!!en()&&(e instanceof Node||e instanceof nn(e).Node)}function an(e){return!!en()&&(e instanceof Element||e instanceof nn(e).Element)}function sn(e){return!!en()&&(e instanceof HTMLElement||e instanceof nn(e).HTMLElement)}function ln(e){return!(!en()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof nn(e).ShadowRoot)}Xt(class extends l{constructor(){super(...arguments),Xt(this,"context",null),Xt(this,"manager",null),Xt(this,"mutationObserver",null)}observe(){var e,{node:t}=this.props;if(!t.current)throw new Error("Failed to attach MutationObserver, `node` is undefined");null===(e=this.mutationObserver)||void 0===e||e.observe(t.current,Yt)}componentDidMount(){var{receivedUserInput:e}=this.props,t=this.context;this.manager=((e,t)=>{var n=[],r=()=>{n=[]};return{registerMutations:r=>{if(t.current){var o=r.filter(t=>pt(e,t,r));n.push(...o)}},restoreDOM:function(){n.length>0&&(n.reverse().forEach(e=>{"characterData"!==e.type&&(e.removedNodes.forEach(t=>{e.target.insertBefore(t,e.nextSibling)}),e.addedNodes.forEach(t=>{e.target.removeChild(t)}))}),r())},clear:r}})(t,e),this.mutationObserver=new MutationObserver(this.manager.registerMutations),this.observe()}getSnapshotBeforeUpdate(){var e,t,n,r,o=null===(e=this.mutationObserver)||void 0===e?void 0:e.takeRecords();return null!=o&&o.length&&(null===(r=this.manager)||void 0===r||r.registerMutations(o)),null===(t=this.mutationObserver)||void 0===t||t.disconnect(),null===(n=this.manager)||void 0===n||n.restoreDOM(),null}componentDidUpdate(){var e;null===(e=this.manager)||void 0===e||e.clear(),this.observe()}componentWillUnmount(){var e;null===(e=this.mutationObserver)||void 0===e||e.disconnect()}render(){return this.props.children}},"contextType",Jt),parseInt(o.version.split(".")[0],10),new g({type:"Mention",elements:e("mention",{render:e=>{const{element:n,attributes:r,children:o}=e,{name:i}=n.props;return t("span",Object.assign({},r,{contentEditable:!1,"data-mention":!0},{children:["@",i,o]}))},props:{id:"",name:"",avatar:"",type:void 0,meta:void 0},nodeType:"inlineVoid"}),options:{display:{title:"Mention",description:"Mention a user or resource"},char:"@"},commands:Fe,parsers:{html:{deserialize:{nodeNames:["SPAN"],parse:e=>{var t,n,r,o,i;if("SPAN"===e.nodeName&&e.dataset.mentionId)return{id:m(),type:"mention",children:[{text:""}],props:{id:null!==(t=e.dataset.mentionId)&&void 0!==t?t:"",name:null!==(r=null!==(n=e.dataset.mentionName)&&void 0!==n?n:e.textContent)&&void 0!==r?r:"",avatar:null!==(o=e.dataset.mentionAvatar)&&void 0!==o?o:"",type:null!==(i=e.dataset.mentionType)&&void 0!==i?i:void 0,nodeType:"inlineVoid"}}}},serialize:e=>{var t;const{id:n,name:r,avatar:o,type:i}=null!==(t=e.props)&&void 0!==t?t:{};return`<span data-mention data-mention-id="${n}" data-mention-name="${r}" data-mention-avatar="${null!=o?o:""}" data-mention-type="${null!=i?i:""}" style="color: #2563eb; font-weight: 500;">@${r}</span>`}},markdown:{serialize:e=>{var t,n;return`@${null!==(n=null===(t=e.props)||void 0===t?void 0:t.name)&&void 0!==n?n:""}`}},email:{serialize:e=>{var t;const{name:n}=null!==(t=e.props)&&void 0!==t?t:{};return`<span style="color: #2563eb; font-weight: 500;">@${n}</span>`}}},extensions:e=>{const{markableVoid:t,isInline:n}=e;return e.markableVoid=e=>"mention"===e.type||t(e),e.isInline=e=>"mention"===e.type||n(e),e},events:{onKeyDown:(e,t,n)=>r=>{var o,i,a;const s=e,l=null===(o=e.plugins.Mention)||void 0===o?void 0:o.options,c=function(e){var t;return e?e.triggers&&e.triggers.length>0?e.triggers:[{char:null!==(t=e.char)&&void 0!==t?t:"@"}]:[{char:"@"}]}(l),u=s.mentions.state,d=n.currentBlock;for(const e of c)if(1===e.char.length&&r.key===e.char&&t.selection&&$.isCollapsed(t.selection)){const n=ee.get(t,t.selection.anchor.path);if(!be.isText(n))continue;const r=n.text,o=t.selection.anchor.offset;if(!Zt(e,null!==(i=r[o-1])&&void 0!==i?i:"",null!==(a=r[o])&&void 0!==a?a:""))continue;if(!d)continue;const l=Gt(t);if(!l)continue;return void s.mentions.open({trigger:e,targetRect:l,triggerRange:{blockId:d.id,path:t.selection.anchor.path,startOffset:o}})}if(u.isOpen){const{key:e}=r;if("Escape"===e&&!1!==(null==l?void 0:l.closeOnEscape))return r.preventDefault(),void s.mentions.close("escape");if("Backspace"===e){const e=u.query.slice(0,-1);return 0===u.query.length?void s.mentions.close("backspace"):void s.mentions.setQuery(e)}if(1===e.length&&!r.ctrlKey&&!r.metaKey&&!r.altKey){const t=u.trigger;if(" "===e&&!(null==t?void 0:t.allowSpaces))return void s.mentions.close("manual");if(t&&e===t.char)return;s.mentions.setQuery(u.query+e)}}}}}),"function"==typeof SuppressedError&&SuppressedError;const cn=new Set(["inline","contents"]);function un(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=On(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!cn.has(o)}const dn=new Set(["table","td","th"]);function fn(e){return dn.has(tn(e))}const pn=[":popover-open",":modal"];function hn(e){return pn.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const gn=["transform","translate","scale","rotate","perspective"],mn=["transform","translate","scale","rotate","perspective","filter"],vn=["paint","layout","strict","content"];function yn(e){const t=bn(),n=an(e)?On(e):e;return gn.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||mn.some(e=>(n.willChange||"").includes(e))||vn.some(e=>(n.contain||"").includes(e))}function bn(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const wn=new Set(["html","body","#document"]);function xn(e){return wn.has(tn(e))}function On(e){return nn(e).getComputedStyle(e)}function kn(e){return an(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Sn(e){if("html"===tn(e))return e;const t=e.assignedSlot||e.parentNode||ln(e)&&e.host||rn(e);return ln(t)?t.host:t}function jn(e){const t=Sn(e);return xn(t)?e.ownerDocument?e.ownerDocument.body:e.body:sn(t)&&un(t)?t:jn(t)}function Pn(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=jn(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=nn(o);if(i){const e=En(a);return t.concat(a,a.visualViewport||[],un(o)?o:[],e&&n?Pn(e):[])}return t.concat(o,Pn(o,[],n))}function En(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const Nn=Math.min,Rn=Math.max,Cn=Math.round,Tn=Math.floor,Mn=e=>({x:e,y:e}),Dn={left:"right",right:"left",bottom:"top",top:"bottom"},An={start:"end",end:"start"};function Bn(e,t,n){return Rn(e,Nn(t,n))}function Ln(e,t){return"function"==typeof e?e(t):e}function _n(e){return e.split("-")[0]}function Fn(e){return e.split("-")[1]}function qn(e){return"x"===e?"y":"x"}function In(e){return"y"===e?"height":"width"}const Wn=new Set(["top","bottom"]);function zn(e){return Wn.has(_n(e))?"y":"x"}function Vn(e){return qn(zn(e))}function Hn(e){return e.replace(/start|end/g,e=>An[e])}const Kn=["left","right"],Un=["right","left"],$n=["top","bottom"],Xn=["bottom","top"];function Jn(e){return e.replace(/left|right|bottom|top/g,e=>Dn[e])}function Qn(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function Yn(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Zn(e,t,n){let{reference:r,floating:o}=e;const i=zn(t),a=Vn(t),s=In(a),l=_n(t),c="y"===i,u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[s]/2-o[s]/2;let p;switch(l){case"top":p={x:u,y:r.y-o.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-o.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Fn(t)){case"start":p[a]-=f*(n&&c?-1:1);break;case"end":p[a]+=f*(n&&c?-1:1)}return p}async function Gn(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=Ln(t,e),h=Qn(p),g=s[f?"floating"===d?"reference":"floating":d],m=Yn(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(g)))||n?g:g.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:l})),v="floating"===d?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),b=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},w=Yn(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:y,strategy:l}):v);return{top:(m.top-w.top+h.top)/b.y,bottom:(w.bottom-m.bottom+h.bottom)/b.y,left:(m.left-w.left+h.left)/b.x,right:(w.right-m.right+h.right)/b.x}}function er(e){const t=Nn(...e.map(e=>e.left)),n=Nn(...e.map(e=>e.top));return{x:t,y:n,width:Rn(...e.map(e=>e.right))-t,height:Rn(...e.map(e=>e.bottom))-n}}const tr=new Set(["left","top"]);function nr(e){const t=On(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=sn(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,s=Cn(n)!==i||Cn(r)!==a;return s&&(n=i,r=a),{width:n,height:r,$:s}}function rr(e){return an(e)?e:e.contextElement}function or(e){const t=rr(e);if(!sn(t))return Mn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=nr(t);let a=(i?Cn(n.width):n.width)/r,s=(i?Cn(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}const ir=Mn(0);function ar(e){const t=nn(e);return bn()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:ir}function sr(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=rr(e);let a=Mn(1);t&&(r?an(r)&&(a=or(r)):a=or(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==nn(e))&&t}(i,n,r)?ar(i):Mn(0);let l=(o.left+s.x)/a.x,c=(o.top+s.y)/a.y,u=o.width/a.x,d=o.height/a.y;if(i){const e=nn(i),t=r&&an(r)?nn(r):r;let n=e,o=En(n);for(;o&&r&&t!==n;){const e=or(o),t=o.getBoundingClientRect(),r=On(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,u*=e.x,d*=e.y,l+=i,c+=a,n=nn(o),o=En(n)}}return Yn({width:u,height:d,x:l,y:c})}function lr(e,t){const n=kn(e).scrollLeft;return t?t.left+n:sr(rn(e)).left+n}function cr(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-lr(e,n),y:n.top+t.scrollTop}}const ur=new Set(["absolute","fixed"]);function dr(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=nn(e),r=rn(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,s=0,l=0;if(o){i=o.width,a=o.height;const e=bn();(!e||e&&"fixed"===t)&&(s=o.offsetLeft,l=o.offsetTop)}const c=lr(r);if(c<=0){const e=r.ownerDocument,t=e.body,n=getComputedStyle(t),o="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,a=Math.abs(r.clientWidth-t.clientWidth-o);a<=25&&(i-=a)}else c<=25&&(i+=c);return{width:i,height:a,x:s,y:l}}(e,n);else if("document"===t)r=function(e){const t=rn(e),n=kn(e),r=e.ownerDocument.body,o=Rn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Rn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+lr(e);const s=-n.scrollTop;return"rtl"===On(r).direction&&(a+=Rn(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:s}}(rn(e));else if(an(t))r=function(e,t){const n=sr(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=sn(e)?or(e):Mn(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=ar(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Yn(r)}function fr(e,t){const n=Sn(e);return!(n===t||!an(n)||xn(n))&&("fixed"===On(n).position||fr(n,t))}function pr(e,t,n){const r=sn(t),o=rn(t),i="fixed"===n,a=sr(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=Mn(0);function c(){l.x=lr(o)}if(r||!r&&!i)if(("body"!==tn(t)||un(o))&&(s=kn(t)),r){const e=sr(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&c();i&&!r&&o&&c();const u=!o||r||i?Mn(0):cr(o,s);return{x:a.left+s.scrollLeft-l.x-u.x,y:a.top+s.scrollTop-l.y-u.y,width:a.width,height:a.height}}function hr(e){return"static"===On(e).position}function gr(e,t){if(!sn(e)||"fixed"===On(e).position)return null;if(t)return t(e);let n=e.offsetParent;return rn(e)===n&&(n=n.ownerDocument.body),n}function mr(e,t){const n=nn(e);if(hn(e))return n;if(!sn(e)){let t=Sn(e);for(;t&&!xn(t);){if(an(t)&&!hr(t))return t;t=Sn(t)}return n}let r=gr(e,t);for(;r&&fn(r)&&hr(r);)r=gr(r,t);return r&&xn(r)&&hr(r)&&!yn(r)?n:r||function(e){let t=Sn(e);for(;sn(t)&&!xn(t);){if(yn(t))return t;if(hn(t))return null;t=Sn(t)}return null}(e)||n}const vr={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=rn(r),s=!!t&&hn(t.floating);if(r===a||s&&i)return n;let l={scrollLeft:0,scrollTop:0},c=Mn(1);const u=Mn(0),d=sn(r);if((d||!d&&!i)&&(("body"!==tn(r)||un(a))&&(l=kn(r)),sn(r))){const e=sr(r);c=or(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}const f=!a||d||i?Mn(0):cr(a,l);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-l.scrollTop*c.y+u.y+f.y}},getDocumentElement:rn,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?hn(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=Pn(e,[],!1).filter(e=>an(e)&&"body"!==tn(e)),o=null;const i="fixed"===On(e).position;let a=i?Sn(e):e;for(;an(a)&&!xn(a);){const t=On(a),n=yn(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&ur.has(o.position)||un(a)&&!n&&fr(e,a))?r=r.filter(e=>e!==a):o=t,a=Sn(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=i[0],s=i.reduce((e,n)=>{const r=dr(t,n,o);return e.top=Rn(r.top,e.top),e.right=Nn(r.right,e.right),e.bottom=Nn(r.bottom,e.bottom),e.left=Rn(r.left,e.left),e},dr(t,a,o));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:mr,getElementRects:async function(e){const t=this.getOffsetParent||mr,n=this.getDimensions,r=await n(e.floating);return{reference:pr(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=nr(e);return{width:t,height:n}},getScale:or,isElement:an,isRTL:function(e){return"rtl"===On(e).direction}};function yr(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function br(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=rr(e),u=o||i?[...c?Pn(c):[],...Pn(t)]:[];u.forEach(e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)});const d=c&&s?function(e,t){let n,r=null;const o=rn(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function a(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),i();const c=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=c;if(s||t(),!f||!p)return;const h={rootMargin:-Tn(d)+"px "+-Tn(o.clientWidth-(u+f))+"px "+-Tn(o.clientHeight-(d+p))+"px "+-Tn(u)+"px",threshold:Rn(0,Nn(1,l))||1};let g=!0;function m(t){const r=t[0].intersectionRatio;if(r!==l){if(!g)return a();r?a(!1,r):n=setTimeout(()=>{a(!1,1e-7)},1e3)}1!==r||yr(c,e.getBoundingClientRect())||a(),g=!1}try{r=new IntersectionObserver(m,{...h,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(m,h)}r.observe(e)}(!0),i}(c,n):null;let f,p=-1,h=null;a&&(h=new ResizeObserver(e=>{let[r]=e;r&&r.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=h)||e.observe(t)})),n()}),c&&!l&&h.observe(c),h.observe(t));let g=l?sr(e):null;return l&&function t(){const r=sr(e);g&&!yr(g,r)&&n(),g=r,f=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach(e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)}),null==d||d(),null==(e=h)||e.disconnect(),h=null,l&&cancelAnimationFrame(f)}}const wr=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:s}=t,l=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=_n(n),s=Fn(n),l="y"===zn(n),c=tr.has(a)?-1:1,u=i&&l?-1:1,d=Ln(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:h}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&"number"==typeof h&&(p="end"===s?-1*h:h),l?{x:p*u,y:f*c}:{x:f*c,y:p*u}}(t,e);return a===(null==(n=s.offset)?void 0:n.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:a}}}}},xr=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Ln(e,t),c={x:n,y:r},u=await Gn(t,l),d=zn(_n(o)),f=qn(d);let p=c[f],h=c[d];if(i){const e="y"===f?"bottom":"right";p=Bn(p+u["y"===f?"top":"left"],p,p-u[e])}if(a){const e="y"===d?"bottom":"right";h=Bn(h+u["y"===d?"top":"left"],h,h-u[e])}const g=s.fn({...t,[f]:p,[d]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[f]:i,[d]:a}}}}}},Or=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...m}=Ln(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const v=_n(o),y=zn(s),b=_n(s)===s,w=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=f||(b||!g?[Jn(s)]:function(e){const t=Jn(e);return[Hn(e),t,Hn(t)]}(s)),O="none"!==h;!f&&O&&x.push(...function(e,t,n,r){const o=Fn(e);let i=function(e,t,n){switch(e){case"top":case"bottom":return n?t?Un:Kn:t?Kn:Un;case"left":case"right":return t?$n:Xn;default:return[]}}(_n(e),"start"===n,r);return o&&(i=i.map(e=>e+"-"+o),t&&(i=i.concat(i.map(Hn)))),i}(s,g,h,w));const k=[s,...x],S=await Gn(t,m),j=[];let P=(null==(r=i.flip)?void 0:r.overflows)||[];if(u&&j.push(S[v]),d){const e=function(e,t,n){void 0===n&&(n=!1);const r=Fn(e),o=Vn(e),i=In(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=Jn(a)),[a,Jn(a)]}(o,a,w);j.push(S[e[0]],S[e[1]])}if(P=[...P,{placement:o,overflows:j}],!j.every(e=>e<=0)){var E,N;const e=((null==(E=i.flip)?void 0:E.index)||0)+1,t=k[e];if(t&&("alignment"!==d||y===zn(t)||P.every(e=>zn(e.placement)!==y||e.overflows[0]>0)))return{data:{index:e,overflows:P},reset:{placement:t}};let n=null==(N=P.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:N.placement;if(!n)switch(p){case"bestFit":{var R;const e=null==(R=P.filter(e=>{if(O){const t=zn(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:R[0];e&&(n=e);break}case"initialPlacement":n=s}if(o!==n)return{reset:{placement:n}}}return{}}}},kr=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:i,strategy:a}=t,{padding:s=2,x:l,y:c}=Ln(e,t),u=Array.from(await(null==i.getClientRects?void 0:i.getClientRects(r.reference))||[]),d=function(e){const t=e.slice().sort((e,t)=>e.y-t.y),n=[];let r=null;for(let e=0;e<t.length;e++){const o=t[e];!r||o.y-r.y>r.height/2?n.push([o]):n[n.length-1].push(o),r=o}return n.map(e=>Yn(er(e)))}(u),f=Yn(er(u)),p=Qn(s),h=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===d.length&&d[0].left>d[1].right&&null!=l&&null!=c)return d.find(e=>l>e.left-p.left&&l<e.right+p.right&&c>e.top-p.top&&c<e.bottom+p.bottom)||f;if(d.length>=2){if("y"===zn(n)){const e=d[0],t=d[d.length-1],r="top"===_n(n),o=e.top,i=t.bottom,a=r?e.left:t.left,s=r?e.right:t.right;return{top:o,bottom:i,left:a,right:s,width:s-a,height:i-o,x:a,y:o}}const e="left"===_n(n),t=Rn(...d.map(e=>e.right)),r=Nn(...d.map(e=>e.left)),o=d.filter(n=>e?n.left===r:n.right===t),i=o[0].top,a=o[o.length-1].bottom;return{top:i,bottom:a,left:r,right:t,width:t-r,height:a-i,x:r,y:i}}return f}},floating:r.floating,strategy:a});return o.reference.x!==h.reference.x||o.reference.y!==h.reference.y||o.reference.width!==h.reference.width||o.reference.height!==h.reference.height?{reset:{rects:h}}:{}}}};var Sr="undefined"!=typeof document?f:function(){};function jr(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!==r--;)if(!jr(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!==r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!==r--;){const n=o[r];if(!("_owner"===n&&e.$$typeof||jr(e[n],t[n])))return!1}return!0}return e!=e&&t!=t}function Pr(e){return"undefined"==typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Er(e,t){const n=Pr(e);return Math.round(t*n)/n}function Nr(e){const t=r.useRef(e);return Sr(()=>{t.current=e}),t}const Rr=(e,t)=>({...wr(e),options:[e,t]}),Cr=(e,t)=>({...xr(e),options:[e,t]}),Tr=(e,t)=>({...Or(e),options:[e,t]}),Mr=(e,t)=>({...kr(e),options:[e,t]}),Dr={...r},Ar=Dr.useInsertionEffect||(e=>e());var Br="undefined"!=typeof document?f:u;let Lr=!1,_r=0;const Fr=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+_r++,qr=Dr.useId||function(){const[e,t]=r.useState(()=>Lr?Fr():void 0);return Br(()=>{null==e&&t(Fr())},[]),r.useEffect(()=>{Lr=!0},[]),e},Ir=r.createContext(null),Wr=r.createContext(null);function zr(e){void 0===e&&(e={});const{nodeId:t}=e,n=function(e){const{open:t=!1,onOpenChange:n,elements:o}=e,i=qr(),a=r.useRef({}),[s]=r.useState(()=>function(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach(e=>e(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter(e=>e!==n))||[])}}}()),l=null!=((null==(c=r.useContext(Ir))?void 0:c.id)||null);var c;const[u,d]=r.useState(o.reference),f=function(e){const t=r.useRef(()=>{});return Ar(()=>{t.current=e}),r.useCallback(function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)},[])}((e,t,r)=>{a.current.openEvent=e?t:void 0,s.emit("openchange",{open:e,event:t,reason:r,nested:l}),null==n||n(e,t,r)}),p=r.useMemo(()=>({setPositionReference:d}),[]),h=r.useMemo(()=>({reference:u||o.reference||null,floating:o.floating||null,domReference:o.reference}),[u,o.reference,o.floating]);return r.useMemo(()=>({dataRef:a,open:t,onOpenChange:f,elements:h,events:s,floatingId:i,refs:p}),[t,f,h,s,i,p])}({...e,elements:{reference:null,floating:null,...e.elements}}),o=e.rootContext||n,i=o.elements,[a,s]=r.useState(null),[l,c]=r.useState(null),u=(null==i?void 0:i.domReference)||a,d=r.useRef(null),f=r.useContext(Wr);Br(()=>{u&&(d.current=u)},[u]);const p=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:i,elements:{reference:a,floating:s}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=r.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=r.useState(o);jr(p,o)||h(o);const[g,m]=r.useState(null),[v,y]=r.useState(null),b=r.useCallback(e=>{e!==k.current&&(k.current=e,m(e))},[]),w=r.useCallback(e=>{e!==S.current&&(S.current=e,y(e))},[]),x=a||g,O=s||v,k=r.useRef(null),S=r.useRef(null),j=r.useRef(d),P=null!=c,E=Nr(c),N=Nr(i),R=Nr(u),C=r.useCallback(()=>{if(!k.current||!S.current)return;const e={placement:t,strategy:n,middleware:p};N.current&&(e.platform=N.current),((e,t,n)=>{const r=new Map,o={platform:vr,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,s=i.filter(Boolean),l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=Zn(c,r,l),f=r,p={},h=0;for(let n=0;n<s.length;n++){const{name:i,fn:g}=s[n],{x:m,y:v,data:y,reset:b}=await g({x:u,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:c,platform:a,elements:{reference:e,floating:t}});u=null!=m?m:u,d=null!=v?v:d,p={...p,[i]:{...p[i],...y}},b&&h<=50&&(h++,"object"==typeof b&&(b.placement&&(f=b.placement),b.rects&&(c=!0===b.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:u,y:d}=Zn(c,f,l))),n=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})})(k.current,S.current,e).then(e=>{const t={...e,isPositioned:!1!==R.current};M.current&&!jr(j.current,t)&&(j.current=t,T.flushSync(()=>{f(t)}))})},[p,t,n,N,R]);Sr(()=>{!1===u&&j.current.isPositioned&&(j.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[u]);const M=r.useRef(!1);Sr(()=>(M.current=!0,()=>{M.current=!1}),[]),Sr(()=>{if(x&&(k.current=x),O&&(S.current=O),x&&O){if(E.current)return E.current(x,O,C);C()}},[x,O,C,E,P]);const D=r.useMemo(()=>({reference:k,floating:S,setReference:b,setFloating:w}),[b,w]),A=r.useMemo(()=>({reference:x,floating:O}),[x,O]),B=r.useMemo(()=>{const e={position:n,left:0,top:0};if(!A.floating)return e;const t=Er(A.floating,d.x),r=Er(A.floating,d.y);return l?{...e,transform:"translate("+t+"px, "+r+"px)",...Pr(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,l,A.floating,d.x,d.y]);return r.useMemo(()=>({...d,update:C,refs:D,elements:A,floatingStyles:B}),[d,C,D,A,B])}({...e,elements:{...i,...l&&{reference:l}}}),h=r.useCallback(e=>{const t=an(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;c(t),p.refs.setReference(t)},[p.refs]),g=r.useCallback(e=>{(an(e)||null===e)&&(d.current=e,s(e)),(an(p.refs.reference.current)||null===p.refs.reference.current||null!==e&&!an(e))&&p.refs.setReference(e)},[p.refs]),m=r.useMemo(()=>({...p.refs,setReference:g,setPositionReference:h,domReference:d}),[p.refs,g,h]),v=r.useMemo(()=>({...p.elements,domReference:u}),[p.elements,u]),y=r.useMemo(()=>({...p,...o,refs:m,elements:v,nodeId:t}),[p,m,v,t,o]);return Br(()=>{o.dataRef.current.floatingContext=y;const e=null==f?void 0:f.nodesRef.current.find(e=>e.id===t);e&&(e.context=y)}),r.useMemo(()=>({...p,context:y,refs:m,elements:v}),[p,m,v,y])}function Vr(e={}){var t,n,r;const o=p(),s=y("Mention"),[l,f]=a([]),[h,g]=a(!1),[m,v]=a(null),[b,w]=a(0),[x,O]=a(_e),k=c(null),S=c(""),j=null!==(n=null!==(t=e.debounceMs)&&void 0!==t?t:null==s?void 0:s.debounceMs)&&void 0!==n?n:300,P=null!==(r=null==s?void 0:s.minQueryLength)&&void 0!==r?r:0,{refs:E,floatingStyles:N}=zr({placement:"bottom-start",open:x.isOpen,middleware:[Mr(),Tr(),Cr({padding:8}),Rr(4)],whileElementsMounted:br});u(()=>{const e=()=>{O(Object.assign({},o.mentions.state)),w(0),f([]),v(null)},t=()=>{O(Object.assign({},_e)),f([]),w(0),v(null)},n=()=>{O(Object.assign({},o.mentions.state))};return o.on("mention:open",e),o.on("mention:close",t),o.on("mention:query-change",n),()=>{o.off("mention:open",e),o.off("mention:close",t),o.off("mention:query-change",n)}},[o]),u(()=>{x.targetRect&&E.setReference({getBoundingClientRect:()=>x.targetRect.domRect,getClientRects:()=>x.targetRect.clientRects})},[x.targetRect,E]),u(()=>{if(!x.isOpen||!(null==s?void 0:s.onSearch))return;const e=x.query,t=x.trigger;if(!(e===S.current&&l.length>0)){if(S.current=e,!(e.length<P))return k.current&&clearTimeout(k.current),k.current=setTimeout(()=>function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{l(r.next(e))}catch(e){i(e)}}function s(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}l((r=r.apply(e,t||[])).next())})}(this,void 0,void 0,function*(){var n;if(t){g(!0),v(null);try{const r=yield null===(n=null==s?void 0:s.onSearch)||void 0===n?void 0:n.call(s,e,t);f(r),w(0)}catch(e){v(e instanceof Error?e:new Error("Search failed")),f([])}finally{g(!1)}}}),j),()=>{k.current&&clearTimeout(k.current)};f([])}},[x.isOpen,x.query,x.trigger,s,j,P,l.length]);const R=d(e=>{Fe.insertMention(o,e,{focus:!0})},[o]),C=d((e="manual")=>{Fe.closeDropdown(o,e)},[o]);return u(()=>{if(!x.isOpen)return;const e=e=>{switch(e.key){case"ArrowDown":e.preventDefault(),w(e=>(e+1)%Math.max(l.length,1));break;case"ArrowUp":e.preventDefault(),w(e=>(e-1+Math.max(l.length,1))%Math.max(l.length,1));break;case"Enter":e.preventDefault(),l[b]&&R(l[b]);break;case"Escape":e.preventDefault(),C("escape");break;case"Tab":C("escape")}};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[x.isOpen,l,b,R,C]),u(()=>{if(!x.isOpen)return;if(!1===(null==s?void 0:s.closeOnClickOutside))return;const e=e=>{const t=E.floating.current;t&&!t.contains(e.target)&&C("click-outside")},t=setTimeout(()=>{document.addEventListener("mousedown",e)},0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[x.isOpen,E.floating,C,null==s?void 0:s.closeOnClickOutside]),i(()=>({isOpen:x.isOpen,query:x.query,trigger:x.trigger,items:l,loading:h,error:m,selectedIndex:b,setSelectedIndex:w,selectItem:R,close:C,refs:{setFloating:E.setFloating,setReference:E.setReference},floatingStyles:N}),[x.isOpen,x.query,x.trigger,l,h,m,b,R,C,E.setFloating,E.setReference,N])}const Hr=n=>{var r;const{item:o,selected:i,onSelect:a,onMouseEnter:s,showTypeBadge:l=!0}=n,c=o.type?null!==(r=F[o.type])&&void 0!==r?r:F.custom:null;return t("button",Object.assign({type:"button",onClick:a,onMouseEnter:s,className:x("w-full flex items-center gap-2 px-2 py-1.5 text-left rounded-sm transition-colors","hover:bg-accent hover:text-accent-foreground","focus:outline-none focus:bg-accent focus:text-accent-foreground",i&&"bg-accent text-accent-foreground")},{children:[e(_,{name:o.name,avatar:o.avatar,size:"sm"}),t("div",Object.assign({className:"flex-1 min-w-0"},{children:[t("div",Object.assign({className:"flex items-center gap-1.5"},{children:[e("span",Object.assign({className:"font-medium text-sm truncate"},{children:o.name})),l&&o.type&&e("span",Object.assign({className:x("text-[10px] px-1.5 py-0.5 rounded-full font-medium",c)},{children:o.type}))]})),o.meta&&"object"==typeof o.meta&&"description"in o.meta&&e("p",Object.assign({className:"text-xs text-muted-foreground truncate"},{children:String(o.meta.description)}))]}))]}))},Kr=({showTypeBadge:n=!0,maxHeight:r=280,className:o})=>{const{isOpen:i,query:a,trigger:s,items:l,loading:d,error:f,selectedIndex:p,setSelectedIndex:h,selectItem:g,refs:m,floatingStyles:v}=Vr(),y=c(null),b=c(null);return u(()=>{b.current&&y.current&&b.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[p]),i?t("div",Object.assign({ref:m.setFloating,style:v,className:x("z-50 min-w-[220px] max-w-[320px] rounded-md border bg-popover text-popover-foreground shadow-md","animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",o)},{children:[a&&e("div",Object.assign({className:"px-3 py-2 border-b"},{children:t("p",Object.assign({className:"text-xs text-muted-foreground"},{children:["Searching for “",null==s?void 0:s.char,e("span",Object.assign({className:"font-medium text-foreground"},{children:a})),"”"]}))})),d&&e("div",Object.assign({className:"p-2 space-y-1"},{children:[1,2,3].map(n=>t("div",Object.assign({className:"flex items-center gap-2 px-2 py-1.5 animate-pulse"},{children:[e("div",{className:"w-6 h-6 rounded-full bg-muted"}),t("div",Object.assign({className:"flex-1 space-y-1"},{children:[e("div",{className:"h-3 w-24 rounded bg-muted"}),e("div",{className:"h-2 w-16 rounded bg-muted"})]}))]}),n))})),f&&!d&&e("div",Object.assign({className:"px-3 py-4 text-center"},{children:e("p",Object.assign({className:"text-sm text-destructive"},{children:f.message}))})),!d&&!f&&0===l.length&&e("div",Object.assign({className:"px-3 py-4 text-center"},{children:e("p",Object.assign({className:"text-sm text-muted-foreground"},{children:a?"No results found":"Type to search..."}))})),!d&&!f&&l.length>0&&e(M,Object.assign({style:{maxHeight:r,overflowY:"auto"},className:"p-1"},{children:e("div",Object.assign({ref:y,role:"listbox","aria-label":"Mention suggestions"},{children:l.map((t,r)=>e("div",Object.assign({ref:r===p?b:void 0,role:"option","aria-selected":r===p},{children:e(Hr,{item:t,selected:r===p,onSelect:()=>g(t),onMouseEnter:()=>h(r),showTypeBadge:n})}),t.id))}))})),l.length>0&&t("div",Object.assign({className:"px-3 py-1.5 border-t text-[10px] text-muted-foreground flex items-center gap-2"},{children:[t("span",{children:[e("kbd",Object.assign({className:"px-1 py-0.5 rounded bg-muted text-[9px]"},{children:"↑↓"}))," navigate"]}),t("span",{children:[e("kbd",Object.assign({className:"px-1 py-0.5 rounded bg-muted text-[9px]"},{children:"↵"}))," select"]}),t("span",{children:[e("kbd",Object.assign({className:"px-1 py-0.5 rounded bg-muted text-[9px]"},{children:"esc"}))," close"]})]}))]})):null},Ur={mention:{render:I}};export{_ as MentionAvatar,Kr as MentionDropdown,I as MentionElement,Hr as MentionItem,Ur as MentionUI};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as s}from"react";import{useYooptaEditor as n}from"@yoopta/editor";import{useTableOfContentsItems as i}from"@yoopta/table-of-contents";import{B as a}from"./chunks/button-ecb0aed1.js";import{C as o,b as l,c,a as r}from"./chunks/card-94325fef.js";import{S as d}from"./chunks/scroll-area-f7cd99a3.js";import{c as m}from"./chunks/utils-de9c4c2b.js";import{C as h}from"./chunks/chevron-up-5b4801a9.js";import{C as p}from"./chunks/chevron-down-abe5f871.js";import"./chunks/_tslib-35bb891d.js";import"./chunks/index-8dc6d938.js";import"react-dom";import"./chunks/index-91a5b8d5.js";import"./chunks/index-70f4e709.js";import"./chunks/index-13505606.js";import"./chunks/index-056e5c06.js";import"./chunks/createLucideIcon-70ab5429.js";const u={depth:3,title:"Table of Contents",headingTypes:["HeadingOne","HeadingTwo","HeadingThree"],showNumbers:!1,collapsible:!1},b={"table-of-contents":{render:b=>{var g,j;const f=n(),{blockId:k,element:v}=b,x=null!==(g=v.props)&&void 0!==g?g:u,{depth:N=3,title:y=u.title,headingTypes:O=(null!==(j=u.headingTypes)&&void 0!==j?j:[]),showNumbers:w=!0,collapsible:T=!0}=x,[C,z]=s(!0),H=i(f,k,{depth:N,headingTypes:O}),I=!T||C;return e("div",Object.assign({},b.attributes,{contentEditable:!1},{children:[e(o,Object.assign({className:"w-full overflow-hidden",role:"navigation","aria-label":null!=y?y:"Table of contents"},{children:[y?t(l,Object.assign({className:"pb-4 pt-4"},{children:e("div",Object.assign({className:"flex items-center gap-1"},{children:[t(c,Object.assign({className:"text-base font-semibold"},{children:y})),T?t(a,Object.assign({type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0","aria-expanded":C,onClick:()=>z(e=>!e)},{children:t(C?h:p,{className:"h-4 w-4"})})):null]}))})):T?t(l,Object.assign({className:"pb-4 pt-4"},{children:t(a,Object.assign({type:"button",variant:"ghost",size:"icon",className:"h-7 w-7","aria-expanded":C,onClick:()=>z(e=>!e)},{children:t(C?h:p,{className:"h-4 w-4"})}))})):null,I?t(r,Object.assign({className:m("pt-0",y||T?"pb-4":"py-4")},{children:H.length>0?t(d,Object.assign({className:"max-h-[280px] pr-3"},{children:t("ol",Object.assign({className:"space-y-1","data-show-numbers":w,style:{listStyle:w?"decimal":"none",paddingLeft:w?20:0}},{children:H.map(e=>t("li",Object.assign({"data-level":e.level,className:m("leading-tight",1===e.level&&"font-medium",2===e.level&&"pl-3 text-sm",3===e.level&&"pl-6 text-sm text-muted-foreground")},{children:t(a,Object.assign({type:"button",variant:"link",size:"sm",className:"h-auto justify-start p-0 text-left font-inherit text-inherit no-underline hover:underline",onClick:()=>{return t=e.id,f.focusBlock(t),void setTimeout(()=>{const e=document.querySelector(`[data-yoopta-block-id="${t}"]`);null==e||e.scrollIntoView({block:"center",behavior:"smooth"})},100);var t}},{children:e.text||"(Untitled)"}))}),e.id))}))})):t("p",Object.assign({className:"text-sm text-muted-foreground"},{children:"No headings in this document."}))})):null]})),b.children]}))}}};export{b as TableOfContentsUI};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as s}from"react";import{useYooptaEditor as n}from"@yoopta/editor";import{useTableOfContentsItems as i}from"@yoopta/table-of-contents";import{B as a}from"./chunks/button-ecb0aed1.js";import{C as o,b as l,c,a as r}from"./chunks/card-94325fef.js";import{S as d}from"./chunks/scroll-area-f7cd99a3.js";import{c as m}from"./chunks/utils-de9c4c2b.js";import{C as h}from"./chunks/chevron-up-5b4801a9.js";import{C as p}from"./chunks/chevron-down-abe5f871.js";import"./chunks/_tslib-35bb891d.js";import"./chunks/index-8dc6d938.js";import"react-dom";import"./chunks/index-91a5b8d5.js";import"./chunks/index-70f4e709.js";import"./chunks/index-13505606.js";import"./chunks/index-056e5c06.js";import"./chunks/createLucideIcon-70ab5429.js";const u={depth:3,title:"Table of Contents",headingTypes:["HeadingOne","HeadingTwo","HeadingThree"],showNumbers:!1,collapsible:!1},b={"table-of-contents":{render:b=>{var g,j;const f=n(),{blockId:k,element:v}=b,x=null!==(g=v.props)&&void 0!==g?g:u,{depth:N=3,title:y=u.title,headingTypes:O=(null!==(j=u.headingTypes)&&void 0!==j?j:[]),showNumbers:w=!0,collapsible:T=!0}=x,[C,z]=s(!0),H=i(f,k,{depth:N,headingTypes:O}),I=!T||C;return e("div",Object.assign({},b.attributes,{contentEditable:!1},{children:[e(o,Object.assign({className:"w-full overflow-hidden",role:"navigation","aria-label":null!=y?y:"Table of contents"},{children:[y?t(l,Object.assign({className:"pb-4 pt-4"},{children:e("div",Object.assign({className:"flex items-center gap-1"},{children:[t(c,Object.assign({className:"text-base font-semibold"},{children:y})),T?t(a,Object.assign({type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0","aria-expanded":C,onClick:()=>z(e=>!e)},{children:t(C?h:p,{className:"h-4 w-4"})})):null]}))})):T?t(l,Object.assign({className:"pb-4 pt-4"},{children:t(a,Object.assign({type:"button",variant:"ghost",size:"icon",className:"h-7 w-7","aria-expanded":C,onClick:()=>z(e=>!e)},{children:t(C?h:p,{className:"h-4 w-4"})}))})):null,I?t(r,Object.assign({className:m("pt-0",y||T?"pb-4":"py-4")},{children:H.length>0?t(d,Object.assign({className:"max-h-[280px] pr-3 overflow-y-auto"},{children:t("ol",Object.assign({className:"space-y-1","data-show-numbers":w,style:{listStyle:w?"decimal":"none",paddingLeft:w?20:0}},{children:H.map(e=>t("li",Object.assign({"data-level":e.level,className:m("leading-tight",1===e.level&&"font-medium",2===e.level&&"pl-3 text-sm",3===e.level&&"pl-6 text-sm text-muted-foreground")},{children:t(a,Object.assign({type:"button",variant:"link",size:"sm",className:"h-auto justify-start p-0 text-left font-inherit text-inherit no-underline hover:underline",onClick:()=>{return t=e.id,f.focusBlock(t),void setTimeout(()=>{const e=document.querySelector(`[data-yoopta-block-id="${t}"]`);null==e||e.scrollIntoView({block:"center",behavior:"smooth"})},100);var t}},{children:e.text||"(Untitled)"}))}),e.id))}))})):t("p",Object.assign({className:"text-sm text-muted-foreground"},{children:"No headings in this document."}))})):null]})),b.children]}))}}};export{b as TableOfContentsUI};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoopta/themes-shadcn",
3
- "version": "6.0.0-beta.11",
3
+ "version": "6.0.0-beta.13",
4
4
  "description": "Shadcn UI theme for Yoopta Editor plugins",
5
5
  "author": "Darginec05 <devopsbanda@gmail.com>",
6
6
  "homepage": "https://github.com/Darginec05/Yoopta-Editor#readme",
@@ -226,5 +226,5 @@
226
226
  "bugs": {
227
227
  "url": "https://github.com/Darginec05/Yoopta-Editor/issues"
228
228
  },
229
- "gitHead": "328b04fa6481a487b434708338f56057792aafa4"
229
+ "gitHead": "7f7239bbe8fdbcdc2791a7e25766687c2a6824ae"
230
230
  }