@nextblock-cms/editor 0.2.19 → 0.2.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.css +1 -1
- package/index.js +4 -342
- package/index.mjs +0 -402
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,41 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const C=require("react"),tu=require("react-dom"),Oe=require("@nextblock-cms/utils"),gt=require("@nextblock-cms/ui/popover"),le=require("@nextblock-cms/ui/button"),ns=require("@nextblock-cms/ui/input"),Ft=require("@nextblock-cms/ui/separator"),We=require("@nextblock-cms/ui/dropdown-menu"),at=require("@nextblock-cms/ui/card"),a1=require("@nextblock-cms/ui/badge");function rg(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const ne=rg(C),c1=rg(tu);function sg(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var io={exports:{}},Ls={}
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Yh;function d1(){if(Yh)return Ls;Yh=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,s,i){var o=null;if(i!==void 0&&(o=""+i),s.key!==void 0&&(o=""+s.key),"key"in s){i={};for(var l in s)l!=="key"&&(i[l]=s[l])}else i=s;return s=i.ref,{$$typeof:t,type:r,key:o,ref:s!==void 0?s:null,props:i}}return Ls.Fragment=e,Ls.jsx=n,Ls.jsxs=n,Ls}var Is={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.development.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var Xh;function u1(){return Xh||(Xh=1,process.env.NODE_ENV!=="production"&&(function(){function t(_){if(_==null)return null;if(typeof _=="function")return _.$$typeof===H?null:_.displayName||_.name||null;if(typeof _=="string")return _;switch(_){case y:return"Fragment";case w:return"Profiler";case b:return"StrictMode";case x:return"Suspense";case k:return"SuspenseList";case N:return"Activity"}if(typeof _=="object")switch(typeof _.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),_.$$typeof){case g:return"Portal";case S:return _.displayName||"Context";case M:return(_._context.displayName||"Context")+".Consumer";case A:var Z=_.render;return _=_.displayName,_||(_=Z.displayName||Z.name||"",_=_!==""?"ForwardRef("+_+")":"ForwardRef"),_;case v:return Z=_.displayName||null,Z!==null?Z:t(_.type)||"Memo";case T:Z=_._payload,_=_._init;try{return t(_(Z))}catch{}}return null}function e(_){return""+_}function n(_){try{e(_);var Z=!1}catch{Z=!0}if(Z){Z=console;var fe=Z.error,Se=typeof Symbol=="function"&&Symbol.toStringTag&&_[Symbol.toStringTag]||_.constructor.name||"Object";return fe.call(Z,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",Se),e(_)}}function r(_){if(_===y)return"<>";if(typeof _=="object"&&_!==null&&_.$$typeof===T)return"<...>";try{var Z=t(_);return Z?"<"+Z+">":"<...>"}catch{return"<...>"}}function s(){var _=V.A;return _===null?null:_.getOwner()}function i(){return Error("react-stack-top-frame")}function o(_){if($.call(_,"key")){var Z=Object.getOwnPropertyDescriptor(_,"key").get;if(Z&&Z.isReactWarning)return!1}return _.key!==void 0}function l(_,Z){function fe(){Q||(Q=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",Z))}fe.isReactWarning=!0,Object.defineProperty(_,"key",{get:fe,configurable:!0})}function a(){var _=t(this.type);return ie[_]||(ie[_]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),_=this.props.ref,_!==void 0?_:null}function c(_,Z,fe,Se,pn,fr){var $e=fe.ref;return _={$$typeof:p,type:_,key:Z,props:fe,_owner:Se},($e!==void 0?$e:null)!==null?Object.defineProperty(_,"ref",{enumerable:!1,get:a}):Object.defineProperty(_,"ref",{enumerable:!1,value:null}),_._store={},Object.defineProperty(_._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(_,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(_,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:pn}),Object.defineProperty(_,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:fr}),Object.freeze&&(Object.freeze(_.props),Object.freeze(_)),_}function d(_,Z,fe,Se,pn,fr){var $e=Z.children;if($e!==void 0)if(Se)if(I($e)){for(Se=0;Se<$e.length;Se++)u($e[Se]);Object.freeze&&Object.freeze($e)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else u($e);if($.call(Z,"key")){$e=t(_);var Ln=Object.keys(Z).filter(function(qr){return qr!=="key"});Se=0<Ln.length?"{key: someKey, "+Ln.join(": ..., ")+": ...}":"{key: someKey}",xe[$e+Se]||(Ln=0<Ln.length?"{"+Ln.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const C=require("react"),tu=require("react-dom"),Oe=require("@nextblock-cms/utils"),gt=require("@nextblock-cms/ui/popover"),le=require("@nextblock-cms/ui/button"),ns=require("@nextblock-cms/ui/input"),Ft=require("@nextblock-cms/ui/separator"),We=require("@nextblock-cms/ui/dropdown-menu"),at=require("@nextblock-cms/ui/card"),a1=require("@nextblock-cms/ui/badge");function rg(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const ne=rg(C),c1=rg(tu);function sg(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var io={exports:{}},Ls={};var Yh;function d1(){if(Yh)return Ls;Yh=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,s,i){var o=null;if(i!==void 0&&(o=""+i),s.key!==void 0&&(o=""+s.key),"key"in s){i={};for(var l in s)l!=="key"&&(i[l]=s[l])}else i=s;return s=i.ref,{$$typeof:t,type:r,key:o,ref:s!==void 0?s:null,props:i}}return Ls.Fragment=e,Ls.jsx=n,Ls.jsxs=n,Ls}var Is={};var Xh;function u1(){return Xh||(Xh=1,process.env.NODE_ENV!=="production"&&(function(){function t(_){if(_==null)return null;if(typeof _=="function")return _.$$typeof===H?null:_.displayName||_.name||null;if(typeof _=="string")return _;switch(_){case y:return"Fragment";case w:return"Profiler";case b:return"StrictMode";case x:return"Suspense";case k:return"SuspenseList";case N:return"Activity"}if(typeof _=="object")switch(typeof _.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),_.$$typeof){case g:return"Portal";case S:return _.displayName||"Context";case M:return(_._context.displayName||"Context")+".Consumer";case A:var Z=_.render;return _=_.displayName,_||(_=Z.displayName||Z.name||"",_=_!==""?"ForwardRef("+_+")":"ForwardRef"),_;case v:return Z=_.displayName||null,Z!==null?Z:t(_.type)||"Memo";case T:Z=_._payload,_=_._init;try{return t(_(Z))}catch{}}return null}function e(_){return""+_}function n(_){try{e(_);var Z=!1}catch{Z=!0}if(Z){Z=console;var fe=Z.error,Se=typeof Symbol=="function"&&Symbol.toStringTag&&_[Symbol.toStringTag]||_.constructor.name||"Object";return fe.call(Z,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",Se),e(_)}}function r(_){if(_===y)return"<>";if(typeof _=="object"&&_!==null&&_.$$typeof===T)return"<...>";try{var Z=t(_);return Z?"<"+Z+">":"<...>"}catch{return"<...>"}}function s(){var _=V.A;return _===null?null:_.getOwner()}function i(){return Error("react-stack-top-frame")}function o(_){if($.call(_,"key")){var Z=Object.getOwnPropertyDescriptor(_,"key").get;if(Z&&Z.isReactWarning)return!1}return _.key!==void 0}function l(_,Z){function fe(){Q||(Q=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",Z))}fe.isReactWarning=!0,Object.defineProperty(_,"key",{get:fe,configurable:!0})}function a(){var _=t(this.type);return ie[_]||(ie[_]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),_=this.props.ref,_!==void 0?_:null}function c(_,Z,fe,Se,pn,fr){var $e=fe.ref;return _={$$typeof:p,type:_,key:Z,props:fe,_owner:Se},($e!==void 0?$e:null)!==null?Object.defineProperty(_,"ref",{enumerable:!1,get:a}):Object.defineProperty(_,"ref",{enumerable:!1,value:null}),_._store={},Object.defineProperty(_._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(_,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(_,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:pn}),Object.defineProperty(_,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:fr}),Object.freeze&&(Object.freeze(_.props),Object.freeze(_)),_}function d(_,Z,fe,Se,pn,fr){var $e=Z.children;if($e!==void 0)if(Se)if(I($e)){for(Se=0;Se<$e.length;Se++)u($e[Se]);Object.freeze&&Object.freeze($e)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else u($e);if($.call(Z,"key")){$e=t(_);var Ln=Object.keys(Z).filter(function(qr){return qr!=="key"});Se=0<Ln.length?"{key: someKey, "+Ln.join(": ..., ")+": ...}":"{key: someKey}",xe[$e+Se]||(Ln=0<Ln.length?"{"+Ln.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
2
|
let props = %s;
|
|
19
3
|
<%s {...props} />
|
|
20
4
|
React keys must be passed directly to JSX without using spread:
|
|
21
5
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,Se,$e,Ln,$e),xe[$e+Se]=!0)}if($e=null,fe!==void 0&&(n(fe),$e=""+fe),o(Z)&&(n(Z.key),$e=""+Z.key),"key"in Z){fe={};for(var Zi in Z)Zi!=="key"&&(fe[Zi]=Z[Zi])}else fe=Z;return $e&&l(fe,typeof _=="function"?_.displayName||_.name||"Unknown":_),c(_,$e,fe,s(),pn,fr)}function u(_){h(_)?_._store&&(_._store.validated=1):typeof _=="object"&&_!==null&&_.$$typeof===T&&(_._payload.status==="fulfilled"?h(_._payload.value)&&_._payload.value._store&&(_._payload.value._store.validated=1):_._store&&(_._store.validated=1))}function h(_){return typeof _=="object"&&_!==null&&_.$$typeof===p}var f=C,p=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),S=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),v=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),N=Symbol.for("react.activity"),H=Symbol.for("react.client.reference"),V=f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,I=Array.isArray,j=console.createTask?console.createTask:function(){return null};f={react_stack_bottom_frame:function(_){return _()}};var Q,ie={},F=f.react_stack_bottom_frame.bind(f,i)(),ue=j(r(i)),xe={};Is.Fragment=y,Is.jsx=function(_,Z,fe){var Se=1e4>V.recentlyCreatedOwnerStacks++;return d(_,Z,fe,!1,Se?Error("react-stack-top-frame"):F,Se?j(r(_)):ue)},Is.jsxs=function(_,Z,fe){var Se=1e4>V.recentlyCreatedOwnerStacks++;return d(_,Z,fe,!0,Se?Error("react-stack-top-frame"):F,Se?j(r(_)):ue)}})()),Is}var Zh;function h1(){return Zh||(Zh=1,process.env.NODE_ENV==="production"?io.exports=d1():io.exports=u1()),io.exports}var m=h1(),oo={exports:{}},Wa={};/**
|
|
23
|
-
* @license React
|
|
24
|
-
* use-sync-external-store-shim.production.js
|
|
25
|
-
*
|
|
26
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
27
|
-
*
|
|
28
|
-
* This source code is licensed under the MIT license found in the
|
|
29
|
-
* LICENSE file in the root directory of this source tree.
|
|
30
|
-
*/var Qh;function f1(){if(Qh)return Wa;Qh=1;var t=C;function e(u,h){return u===h&&(u!==0||1/u===1/h)||u!==u&&h!==h}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,s=t.useEffect,i=t.useLayoutEffect,o=t.useDebugValue;function l(u,h){var f=h(),p=r({inst:{value:f,getSnapshot:h}}),g=p[0].inst,y=p[1];return i(function(){g.value=f,g.getSnapshot=h,a(g)&&y({inst:g})},[u,f,h]),s(function(){return a(g)&&y({inst:g}),u(function(){a(g)&&y({inst:g})})},[u]),o(f),f}function a(u){var h=u.getSnapshot;u=u.value;try{var f=h();return!n(u,f)}catch{return!0}}function c(u,h){return h()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:l;return Wa.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,Wa}var qa={};/**
|
|
31
|
-
* @license React
|
|
32
|
-
* use-sync-external-store-shim.development.js
|
|
33
|
-
*
|
|
34
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
35
|
-
*
|
|
36
|
-
* This source code is licensed under the MIT license found in the
|
|
37
|
-
* LICENSE file in the root directory of this source tree.
|
|
38
|
-
*/var ef;function p1(){return ef||(ef=1,process.env.NODE_ENV!=="production"&&(function(){function t(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}function e(f,p){d||s.startTransition===void 0||(d=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var g=p();if(!u){var y=p();i(g,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}y=o({inst:{value:g,getSnapshot:p}});var b=y[0].inst,w=y[1];return a(function(){b.value=g,b.getSnapshot=p,n(b)&&w({inst:b})},[f,g,p]),l(function(){return n(b)&&w({inst:b}),f(function(){n(b)&&w({inst:b})})},[f]),c(g),g}function n(f){var p=f.getSnapshot;f=f.value;try{var g=p();return!i(f,g)}catch{return!0}}function r(f,p){return p()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=C,i=typeof Object.is=="function"?Object.is:t,o=s.useState,l=s.useEffect,a=s.useLayoutEffect,c=s.useDebugValue,d=!1,u=!1,h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:e;qa.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:h,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),qa}var tf;function nu(){return tf||(tf=1,process.env.NODE_ENV==="production"?oo.exports=f1():oo.exports=p1()),oo.exports}var ig=nu();function rt(t){this.content=t}rt.prototype={constructor:rt,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,s=r.find(t),i=r.content.slice();return s==-1?i.push(n||t,e):(i[s+1]=e,n&&(i[s]=n)),new rt(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new rt(n)},addToStart:function(t,e){return new rt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new rt(n)},addBefore:function(t,e,n){var r=this.remove(e),s=r.content.slice(),i=r.find(t);return s.splice(i==-1?s.length:i,0,e,n),new rt(s)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=rt.from(t),t.size?new rt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=rt.from(t),t.size?new rt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=rt.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};rt.from=function(t){if(t instanceof rt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new rt(e)};function og(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),i=e.child(r);if(s==i){n+=s.nodeSize;continue}if(!s.sameMarkup(i))return n;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)n++;return n}if(s.content.size||i.content.size){let o=og(s.content,i.content,n+1);if(o!=null)return o}n+=s.nodeSize}}function lg(t,e,n,r){for(let s=t.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:n,b:r};let o=t.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){n-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:n,b:r};if(o.isText&&o.text!=l.text){let c=0,d=Math.min(o.text.length,l.text.length);for(;c<d&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(o.content.size||l.content.size){let c=lg(o.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}class O{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,s=0,i){for(let o=0,l=0;l<n;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,n-d),r,s+d)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,s){let i="",o=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new O(s,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],s=0;if(n>e)for(let i=0,o=0;o<n;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,n-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,n-o-1))),r.push(l),s+=l.nodeSize),o=a}return new O(r,s)}cutByIndex(e,n){return e==n?O.empty:e==0&&n==this.content.length?this:new O(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new O(s,i)}addToStart(e){return new O([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new O(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let s=this.content[n];e(s,r,n),r+=s.nodeSize}}findDiffStart(e,n=0){return og(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return lg(this,e,n,r)}findIndex(e){if(e==0)return lo(0,e);if(e==this.size)return lo(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let s=this.child(n),i=r+s.nodeSize;if(i>=e)return i==e?lo(n+1,i):lo(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return O.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new O(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return O.empty;let n,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(n||(n=e.slice(0,s)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new O(n||e,r)}static from(e){if(!e)return O.empty;if(e instanceof O)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new O([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}O.empty=new O([],0);const Ka={index:0,offset:0};function lo(t,e){return Ka.index=t,Ka.offset=e,Ka}function Ko(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Ko(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Ko(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Ee=class Hc{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,s)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Ko(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let s=r.create(n.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Hc.none;if(e instanceof Hc)return[e];let n=e.slice();return n.sort((r,s)=>r.type.rank-s.type.rank),n}};Ee.none=[];class Go extends Error{}class P{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=cg(this.content,e+this.openStart,n);return r&&new P(r,this.openStart,this.openEnd)}removeBetween(e,n){return new P(ag(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return P.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new P(O.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)s++;return new P(e,r,s)}}P.empty=new P(O.empty,0,0);function ag(t,e,n){let{index:r,offset:s}=t.findIndex(e),i=t.maybeChild(r),{index:o,offset:l}=t.findIndex(n);if(s==e||i.isText){if(l!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(ag(i.content,e-s-1,n-s-1)))}function cg(t,e,n,r){let{index:s,offset:i}=t.findIndex(e),o=t.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=cg(o.content,e-i-1,n,o);return l&&t.replaceChild(s,o.copy(l))}function m1(t,e,n){if(n.openStart>t.depth)throw new Go("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Go("Inconsistent open depths");return dg(t,e,n,0)}function dg(t,e,n,r){let s=t.index(r),i=t.node(r);if(s==e.index(r)&&r<t.depth-n.openStart){let o=dg(t,e,n,r+1);return i.copy(i.content.replaceChild(s,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,l=o.content;return Cr(o,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=g1(n,t);return Cr(i,hg(t,o,l,e,r))}else return Cr(i,Jo(t,e,r))}function ug(t,e){if(!e.type.compatibleContent(t.type))throw new Go("Cannot join "+e.type.name+" onto "+t.type.name)}function zc(t,e,n){let r=t.node(n);return ug(r,e.node(n)),r}function Sr(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Vs(t,e,n,r){let s=(e||t).node(n),i=0,o=e?e.index(n):s.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(Sr(t.nodeAfter,r),i++));for(let l=i;l<o;l++)Sr(s.child(l),r);e&&e.depth==n&&e.textOffset&&Sr(e.nodeBefore,r)}function Cr(t,e){return t.type.checkContent(e),t.copy(e)}function hg(t,e,n,r,s){let i=t.depth>s&&zc(t,e,s+1),o=r.depth>s&&zc(n,r,s+1),l=[];return Vs(null,t,s,l),i&&o&&e.index(s)==n.index(s)?(ug(i,o),Sr(Cr(i,hg(t,e,n,r,s+1)),l)):(i&&Sr(Cr(i,Jo(t,e,s+1)),l),Vs(e,n,s,l),o&&Sr(Cr(o,Jo(n,r,s+1)),l)),Vs(r,null,s,l),new O(l)}function Jo(t,e,n){let r=[];if(Vs(null,t,n,r),t.depth>n){let s=zc(t,e,n+1);Sr(Cr(s,Jo(t,e,n+1)),r)}return Vs(e,null,n,r),new O(r)}function g1(t,e){let n=e.depth-t.openStart,s=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)s=e.node(i).copy(O.from(s));return{start:s.resolveNoCache(t.openStart+n),end:s.resolveNoCache(s.content.size-t.openEnd-n)}}class ii{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(n);return r?e.child(n).cut(r):s}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],s=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Ee.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),s=e.maybeChild(n);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new oi(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],s=0,i=n;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(i),c=i-a;if(r.push(o,l,s+a),!c||(o=o.child(l),o.isText))break;i=c-1,s+=a+1}return new ii(n,r,i)}static resolveCached(e,n){let r=nf.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==n)return o}else nf.set(e,r=new y1);let s=r.elts[r.i]=ii.resolve(e,n);return r.i=(r.i+1)%b1,s}}class y1{constructor(){this.elts=[],this.i=0}}const b1=12,nf=new WeakMap;class oi{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const x1=Object.create(null);let Zn=class Fc{constructor(e,n,r,s=Ee.none){this.type=e,this.attrs=n,this.marks=s,this.content=r||O.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,s=0){this.content.nodesBetween(e,n,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,s){return this.content.textBetween(e,n,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Ko(this.attrs,n||e.defaultAttrs||x1)&&Ee.sameSet(this.marks,r||Ee.none)}copy(e=null){return e==this.content?this:new Fc(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Fc(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return P.empty;let s=this.resolve(e),i=this.resolve(n),o=r?0:s.sharedDepth(n),l=s.start(o),c=s.node(o).content.cut(s.pos-l,i.pos-l);return new P(c,s.depth-o,i.depth-o)}replace(e,n,r){return m1(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:s}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(s==e||n.isText)return n;e-=s+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let s=this.content.child(n-1);return{node:s,index:n-1,offset:r-s.nodeSize}}resolve(e){return ii.resolveCached(this,e)}resolveNoCache(e){return ii.resolve(this,e)}rangeHasMark(e,n,r){let s=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),fg(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=O.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=s;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Ee.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Ee.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let s=O.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,s,r);return i.type.checkAttrs(i.attrs),i}};Zn.prototype.text=void 0;class Yo extends Zn{constructor(e,n,r,s){if(super(e,n,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):fg(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Yo(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Yo(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function fg(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class _r{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new w1(e,n);if(r.next==null)return _r.empty;let s=pg(r);r.next&&r.err("Unexpected trailing text");let i=A1(M1(s));return T1(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let s=this;for(let i=n;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let s=[this];function i(o,l){let a=o.matchFragment(e,r);if(a&&(!n||a.validEnd))return O.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:d,next:u}=o.next[c];if(!(d.isText||d.hasRequiredAttrs())&&s.indexOf(u)==-1){s.push(u);let h=i(u,l.concat(d));if(h)return h}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:a}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&n(r.next[s].next)}return n(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
|
|
6
|
+
<%s key={someKey} {...props} />`,Se,$e,Ln,$e),xe[$e+Se]=!0)}if($e=null,fe!==void 0&&(n(fe),$e=""+fe),o(Z)&&(n(Z.key),$e=""+Z.key),"key"in Z){fe={};for(var Zi in Z)Zi!=="key"&&(fe[Zi]=Z[Zi])}else fe=Z;return $e&&l(fe,typeof _=="function"?_.displayName||_.name||"Unknown":_),c(_,$e,fe,s(),pn,fr)}function u(_){h(_)?_._store&&(_._store.validated=1):typeof _=="object"&&_!==null&&_.$$typeof===T&&(_._payload.status==="fulfilled"?h(_._payload.value)&&_._payload.value._store&&(_._payload.value._store.validated=1):_._store&&(_._store.validated=1))}function h(_){return typeof _=="object"&&_!==null&&_.$$typeof===p}var f=C,p=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),S=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),v=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),N=Symbol.for("react.activity"),H=Symbol.for("react.client.reference"),V=f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,I=Array.isArray,j=console.createTask?console.createTask:function(){return null};f={react_stack_bottom_frame:function(_){return _()}};var Q,ie={},F=f.react_stack_bottom_frame.bind(f,i)(),ue=j(r(i)),xe={};Is.Fragment=y,Is.jsx=function(_,Z,fe){var Se=1e4>V.recentlyCreatedOwnerStacks++;return d(_,Z,fe,!1,Se?Error("react-stack-top-frame"):F,Se?j(r(_)):ue)},Is.jsxs=function(_,Z,fe){var Se=1e4>V.recentlyCreatedOwnerStacks++;return d(_,Z,fe,!0,Se?Error("react-stack-top-frame"):F,Se?j(r(_)):ue)}})()),Is}var Zh;function h1(){return Zh||(Zh=1,process.env.NODE_ENV==="production"?io.exports=d1():io.exports=u1()),io.exports}var m=h1(),oo={exports:{}},Wa={};var Qh;function f1(){if(Qh)return Wa;Qh=1;var t=C;function e(u,h){return u===h&&(u!==0||1/u===1/h)||u!==u&&h!==h}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,s=t.useEffect,i=t.useLayoutEffect,o=t.useDebugValue;function l(u,h){var f=h(),p=r({inst:{value:f,getSnapshot:h}}),g=p[0].inst,y=p[1];return i(function(){g.value=f,g.getSnapshot=h,a(g)&&y({inst:g})},[u,f,h]),s(function(){return a(g)&&y({inst:g}),u(function(){a(g)&&y({inst:g})})},[u]),o(f),f}function a(u){var h=u.getSnapshot;u=u.value;try{var f=h();return!n(u,f)}catch{return!0}}function c(u,h){return h()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:l;return Wa.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,Wa}var qa={};var ef;function p1(){return ef||(ef=1,process.env.NODE_ENV!=="production"&&(function(){function t(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}function e(f,p){d||s.startTransition===void 0||(d=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var g=p();if(!u){var y=p();i(g,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}y=o({inst:{value:g,getSnapshot:p}});var b=y[0].inst,w=y[1];return a(function(){b.value=g,b.getSnapshot=p,n(b)&&w({inst:b})},[f,g,p]),l(function(){return n(b)&&w({inst:b}),f(function(){n(b)&&w({inst:b})})},[f]),c(g),g}function n(f){var p=f.getSnapshot;f=f.value;try{var g=p();return!i(f,g)}catch{return!0}}function r(f,p){return p()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=C,i=typeof Object.is=="function"?Object.is:t,o=s.useState,l=s.useEffect,a=s.useLayoutEffect,c=s.useDebugValue,d=!1,u=!1,h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:e;qa.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:h,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),qa}var tf;function nu(){return tf||(tf=1,process.env.NODE_ENV==="production"?oo.exports=f1():oo.exports=p1()),oo.exports}var ig=nu();function rt(t){this.content=t}rt.prototype={constructor:rt,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,s=r.find(t),i=r.content.slice();return s==-1?i.push(n||t,e):(i[s+1]=e,n&&(i[s]=n)),new rt(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new rt(n)},addToStart:function(t,e){return new rt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new rt(n)},addBefore:function(t,e,n){var r=this.remove(e),s=r.content.slice(),i=r.find(t);return s.splice(i==-1?s.length:i,0,e,n),new rt(s)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=rt.from(t),t.size?new rt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=rt.from(t),t.size?new rt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=rt.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};rt.from=function(t){if(t instanceof rt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new rt(e)};function og(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),i=e.child(r);if(s==i){n+=s.nodeSize;continue}if(!s.sameMarkup(i))return n;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)n++;return n}if(s.content.size||i.content.size){let o=og(s.content,i.content,n+1);if(o!=null)return o}n+=s.nodeSize}}function lg(t,e,n,r){for(let s=t.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:n,b:r};let o=t.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){n-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:n,b:r};if(o.isText&&o.text!=l.text){let c=0,d=Math.min(o.text.length,l.text.length);for(;c<d&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(o.content.size||l.content.size){let c=lg(o.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}class O{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,s=0,i){for(let o=0,l=0;l<n;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,n-d),r,s+d)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,s){let i="",o=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new O(s,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],s=0;if(n>e)for(let i=0,o=0;o<n;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,n-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,n-o-1))),r.push(l),s+=l.nodeSize),o=a}return new O(r,s)}cutByIndex(e,n){return e==n?O.empty:e==0&&n==this.content.length?this:new O(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new O(s,i)}addToStart(e){return new O([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new O(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let s=this.content[n];e(s,r,n),r+=s.nodeSize}}findDiffStart(e,n=0){return og(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return lg(this,e,n,r)}findIndex(e){if(e==0)return lo(0,e);if(e==this.size)return lo(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let s=this.child(n),i=r+s.nodeSize;if(i>=e)return i==e?lo(n+1,i):lo(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return O.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new O(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return O.empty;let n,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(n||(n=e.slice(0,s)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new O(n||e,r)}static from(e){if(!e)return O.empty;if(e instanceof O)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new O([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}O.empty=new O([],0);const Ka={index:0,offset:0};function lo(t,e){return Ka.index=t,Ka.offset=e,Ka}function Ko(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Ko(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Ko(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Ee=class Hc{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,s)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Ko(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let s=r.create(n.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Hc.none;if(e instanceof Hc)return[e];let n=e.slice();return n.sort((r,s)=>r.type.rank-s.type.rank),n}};Ee.none=[];class Go extends Error{}class P{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=cg(this.content,e+this.openStart,n);return r&&new P(r,this.openStart,this.openEnd)}removeBetween(e,n){return new P(ag(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return P.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new P(O.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)s++;return new P(e,r,s)}}P.empty=new P(O.empty,0,0);function ag(t,e,n){let{index:r,offset:s}=t.findIndex(e),i=t.maybeChild(r),{index:o,offset:l}=t.findIndex(n);if(s==e||i.isText){if(l!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(ag(i.content,e-s-1,n-s-1)))}function cg(t,e,n,r){let{index:s,offset:i}=t.findIndex(e),o=t.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=cg(o.content,e-i-1,n,o);return l&&t.replaceChild(s,o.copy(l))}function m1(t,e,n){if(n.openStart>t.depth)throw new Go("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Go("Inconsistent open depths");return dg(t,e,n,0)}function dg(t,e,n,r){let s=t.index(r),i=t.node(r);if(s==e.index(r)&&r<t.depth-n.openStart){let o=dg(t,e,n,r+1);return i.copy(i.content.replaceChild(s,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,l=o.content;return Cr(o,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=g1(n,t);return Cr(i,hg(t,o,l,e,r))}else return Cr(i,Jo(t,e,r))}function ug(t,e){if(!e.type.compatibleContent(t.type))throw new Go("Cannot join "+e.type.name+" onto "+t.type.name)}function zc(t,e,n){let r=t.node(n);return ug(r,e.node(n)),r}function Sr(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Vs(t,e,n,r){let s=(e||t).node(n),i=0,o=e?e.index(n):s.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(Sr(t.nodeAfter,r),i++));for(let l=i;l<o;l++)Sr(s.child(l),r);e&&e.depth==n&&e.textOffset&&Sr(e.nodeBefore,r)}function Cr(t,e){return t.type.checkContent(e),t.copy(e)}function hg(t,e,n,r,s){let i=t.depth>s&&zc(t,e,s+1),o=r.depth>s&&zc(n,r,s+1),l=[];return Vs(null,t,s,l),i&&o&&e.index(s)==n.index(s)?(ug(i,o),Sr(Cr(i,hg(t,e,n,r,s+1)),l)):(i&&Sr(Cr(i,Jo(t,e,s+1)),l),Vs(e,n,s,l),o&&Sr(Cr(o,Jo(n,r,s+1)),l)),Vs(r,null,s,l),new O(l)}function Jo(t,e,n){let r=[];if(Vs(null,t,n,r),t.depth>n){let s=zc(t,e,n+1);Sr(Cr(s,Jo(t,e,n+1)),r)}return Vs(e,null,n,r),new O(r)}function g1(t,e){let n=e.depth-t.openStart,s=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)s=e.node(i).copy(O.from(s));return{start:s.resolveNoCache(t.openStart+n),end:s.resolveNoCache(s.content.size-t.openEnd-n)}}class ii{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(n);return r?e.child(n).cut(r):s}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],s=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Ee.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),s=e.maybeChild(n);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new oi(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],s=0,i=n;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(i),c=i-a;if(r.push(o,l,s+a),!c||(o=o.child(l),o.isText))break;i=c-1,s+=a+1}return new ii(n,r,i)}static resolveCached(e,n){let r=nf.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==n)return o}else nf.set(e,r=new y1);let s=r.elts[r.i]=ii.resolve(e,n);return r.i=(r.i+1)%b1,s}}class y1{constructor(){this.elts=[],this.i=0}}const b1=12,nf=new WeakMap;class oi{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const x1=Object.create(null);let Zn=class Fc{constructor(e,n,r,s=Ee.none){this.type=e,this.attrs=n,this.marks=s,this.content=r||O.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,s=0){this.content.nodesBetween(e,n,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,s){return this.content.textBetween(e,n,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Ko(this.attrs,n||e.defaultAttrs||x1)&&Ee.sameSet(this.marks,r||Ee.none)}copy(e=null){return e==this.content?this:new Fc(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Fc(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return P.empty;let s=this.resolve(e),i=this.resolve(n),o=r?0:s.sharedDepth(n),l=s.start(o),c=s.node(o).content.cut(s.pos-l,i.pos-l);return new P(c,s.depth-o,i.depth-o)}replace(e,n,r){return m1(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:s}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(s==e||n.isText)return n;e-=s+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let s=this.content.child(n-1);return{node:s,index:n-1,offset:r-s.nodeSize}}resolve(e){return ii.resolveCached(this,e)}resolveNoCache(e){return ii.resolve(this,e)}rangeHasMark(e,n,r){let s=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),fg(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=O.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=s;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Ee.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Ee.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let s=O.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,s,r);return i.type.checkAttrs(i.attrs),i}};Zn.prototype.text=void 0;class Yo extends Zn{constructor(e,n,r,s){if(super(e,n,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):fg(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Yo(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Yo(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function fg(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class _r{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new w1(e,n);if(r.next==null)return _r.empty;let s=pg(r);r.next&&r.err("Unexpected trailing text");let i=A1(M1(s));return T1(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let s=this;for(let i=n;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let s=[this];function i(o,l){let a=o.matchFragment(e,r);if(a&&(!n||a.validEnd))return O.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:d,next:u}=o.next[c];if(!(d.isText||d.hasRequiredAttrs())&&s.indexOf(u)==-1){s.push(u);let h=i(u,l.concat(d));if(h)return h}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:a}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&n(r.next[s].next)}return n(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
|
|
39
7
|
`)}}_r.empty=new _r(!0);class w1{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function pg(t){let e=[];do e.push(k1(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function k1(t){let e=[];do e.push(v1(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function v1(t){let e=E1(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=S1(t,e);else break;return e}function rf(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function S1(t,e){let n=rf(t),r=n;return t.eat(",")&&(t.next!="}"?r=rf(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function C1(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let s=[];for(let i in n){let o=n[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&t.err("No node type or group '"+e+"' found"),s}function E1(t){if(t.eat("(")){let e=pg(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=C1(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function M1(t){let e=[[]];return s(i(t,0),n()),e;function n(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function s(o,l){o.forEach(a=>a.to=l)}function i(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=i(o.exprs[a],l);if(a==o.exprs.length-1)return c;s(c,l=n())}else if(o.type=="star"){let a=n();return r(l,a),s(i(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=n();return s(i(o.expr,l),a),s(i(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(i(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let d=n();s(i(o.expr,a),d),a=d}if(o.max==-1)s(i(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let d=n();r(a,d),s(i(o.expr,a),d),a=d}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function mg(t,e){return e-t}function sf(t,e){let n=[];return r(e),n.sort(mg);function r(s){let i=t[s];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(s);for(let o=0;o<i.length;o++){let{term:l,to:a}=i[o];!l&&n.indexOf(a)==-1&&r(a)}}}function A1(t){let e=Object.create(null);return n(sf(t,0));function n(r){let s=[];r.forEach(o=>{t[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let d=0;d<s.length;d++)s[d][0]==l&&(c=s[d][1]);sf(t,a).forEach(d=>{c||s.push([l,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let i=e[r.join(",")]=new _r(r.indexOf(t.length-1)>-1);for(let o=0;o<s.length;o++){let l=s[o][1].sort(mg);i.next.push({type:s[o][0],next:e[l.join(",")]||n(l)})}return i}}function T1(t,e){for(let n=0,r=[t];n<r.length;n++){let s=r[n],i=!s.validEnd,o=[];for(let l=0;l<s.next.length;l++){let{type:a,next:c}=s.next[l];o.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function gg(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function yg(t,e){let n=Object.create(null);for(let r in t){let s=e&&e[r];if(s===void 0){let i=t[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=s}return n}function bg(t,e,n,r){for(let s in e)if(!(s in t))throw new RangeError(`Unsupported attribute ${s} for ${n} of type ${s}`);for(let s in t){let i=t[s];i.validate&&i.validate(e[s])}}function xg(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new _1(t,r,e[r]);return n}let of=class wg{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=xg(e,r.attrs),this.defaultAttrs=gg(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==_r.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:yg(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Zn(this,this.computeAttrs(e),O.from(n),Ee.setFrom(r))}createChecked(e=null,n,r){return n=O.from(n),this.checkContent(n),new Zn(this,this.computeAttrs(e),n,Ee.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=O.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let s=this.contentMatch.matchFragment(n),i=s&&s.fillBefore(O.empty,!0);return i?new Zn(this,e,n.append(i),Ee.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){bg(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:Ee.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,o)=>r[i]=new wg(i,n,o));let s=n.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function N1(t,e,n){let r=n.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class _1{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?N1(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Zl{constructor(e,n,r,s){this.name=e,this.rank=n,this.schema=r,this.spec=s,this.attrs=xg(e,s.attrs),this.excluded=null;let i=gg(this.attrs);this.instance=i?new Ee(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Ee(this,yg(this.attrs,e))}static compile(e,n){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new Zl(i,s++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){bg(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class kg{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let s in e)n[s]=e[s];n.nodes=rt.from(e.nodes),n.marks=rt.from(e.marks||{}),this.nodes=of.compile(this.spec.nodes,this),this.marks=Zl.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=_r.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?lf(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:lf(this,o.split(" "))}this.nodeFromJSON=s=>Zn.fromJSON(this,s),this.markFromJSON=s=>Ee.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof of){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,s)}text(e,n){let r=this.nodes.text;return new Yo(r,r.defaultAttrs,e,Ee.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function lf(t,e){let n=[];for(let r=0;r<e.length;r++){let s=e[r],i=t.marks[s],o=i;if(i)n.push(i);else for(let l in t.marks){let a=t.marks[l];(s=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(s)>-1)&&n.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function R1(t){return t.tag!=null}function O1(t){return t.style!=null}let Ws=class Uc{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(s=>{if(R1(s))this.tags.push(s);else if(O1(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new cf(this,n,!1);return r.addAll(e,Ee.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new cf(this,n,!0);return r.addAll(e,Ee.none,n.from,n.to),P.maxOpen(r.finish())}matchTag(e,n,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(I1(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,n,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(o.getAttrs){let a=o.getAttrs(n);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let n=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<n.length;o++){let l=n[o];if((l.priority==null?50:l.priority)<i)break}n.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=df(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=df(o)),o.node||o.ignore||o.mark||(o.node=s)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Uc(e,Uc.schemaRules(e)))}};const vg={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},D1={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Sg={ol:!0,ul:!0},li=1,Vc=2,qs=4;function af(t,e,n){return e!=null?(e?li:0)|(e==="full"?Vc:0):t&&t.whitespace=="pre"?li|Vc:n&~qs}class ao{constructor(e,n,r,s,i,o){this.type=e,this.attrs=n,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=Ee.none,this.match=i||(o&qs?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(O.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&li)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let n=O.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(O.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!vg.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class cf{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=n.topNode,i,o=af(null,n.preserveWhitespace,0)|(r?qs:0);s?i=new ao(s.type,s.attrs,Ee.none,!0,n.topMatch||s.type.contentMatch,o):r?i=new ao(null,null,Ee.none,!0,null,o):i=new ao(e.schema.topNodeType,null,Ee.none,!0,null,o),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,s=this.top,i=s.options&Vc?"full":this.localPreserveWS||(s.options&li)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
|
|
40
8
|
`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),n,!0),l[a]&&this.insertNode(o.text(l[a]),n,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=s.content[s.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;Sg.hasOwnProperty(o)&&this.parser.normalizeLists&&L1(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:D1.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,d=this.needsBlock;if(vg.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let u=a&&a.skip?n:this.readStyles(e,n);u&&this.addAll(e,u),c&&this.sync(i),this.needsBlock=d}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=s}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
41
9
|
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(i,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?n=n.filter(c=>!a.clearMark(c)):n=n.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return n}addElementByRule(e,n,r,s){let i,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,n.attrs||null,r,n.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,n,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=s==null?null:e.childNodes[s];o!=l;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,n);this.findAtPoint(e,i)}findPlace(e,n,r){let s,i;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!s||s.length>c.length+l)&&(s=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)n=this.enterInner(s[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let s=this.findPlace(e,n,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=Ee.none;for(let l of s.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):uf(l.type,e.type))&&(o=l.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,n,r,s){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,s)),i}enterInner(e,n,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=af(e,i,o.options);o.options&qs&&o.content.length==0&&(l|=qs);let a=Ee.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):uf(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new ao(e,n,a,s,null,l)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=li)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&n.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(l,a)=>{for(;l>=0;l--){let c=n[l];if(c==""){if(l==n.length-1||l==0)continue;for(;a>=i;a--)if(o(l-1,a))return!0;return!1}else{let d=a>0||a==0&&s?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;a--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function L1(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Sg.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function I1(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function df(t){let e={};for(let n in t)e[n]=t[n];return e}function uf(t,e){let n=e.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(t))continue;let i=[],o=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:d}=l.edge(a);if(c==e||i.indexOf(d)<0&&o(d))return!0}};if(o(s.contentMatch))return!0}}class Fr{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Ga(n).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let l=0,a=0;for(;l<i.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)s=i.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],d=this.serializeMark(c,o.isInline,n);d&&(i.push([c,s]),s.appendChild(d.dom),s=d.contentDOM||d.dom)}}s.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:s}=Oo(Ga(n),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,s)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let s=this.marks[e.type.name];return s&&Oo(Ga(r),s(e,n),null,e.attrs)}static renderSpec(e,n,r=null,s){return Oo(e,n,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Fr(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=hf(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return hf(e.marks)}}function hf(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Ga(t){return t.document||window.document}const ff=new WeakMap;function j1(t){let e=ff.get(t);return e===void 0&&ff.set(t,e=P1(t)),e}function P1(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)n(r[s]);else for(let s in r)n(r[s])}return n(t),e}function Oo(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=j1(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(n=s.slice(0,o),s=s.slice(o+1));let l,a=n?t.createElementNS(n,s):t.createElement(s),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let h=u.indexOf(" ");h>0?a.setAttributeNS(u.slice(0,h),u.slice(h+1),c[u]):u=="style"&&a.style?a.style.cssText=c[u]:a.setAttribute(u,c[u])}}for(let u=d;u<e.length;u++){let h=e[u];if(h===0){if(u<e.length-1||u>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:f,contentDOM:p}=Oo(t,h,n,r);if(a.appendChild(f),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const Cg=65535,Eg=Math.pow(2,16);function B1(t,e){return t+e*Eg}function pf(t){return t&Cg}function $1(t){return(t-(t&Cg))/Eg}const Mg=1,Ag=2,Do=4,Tg=8;class Wc{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Tg)>0}get deletedBefore(){return(this.delInfo&(Mg|Do))>0}get deletedAfter(){return(this.delInfo&(Ag|Do))>0}get deletedAcross(){return(this.delInfo&Do)>0}}class _t{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&_t.empty)return _t.empty}recover(e){let n=0,r=pf(e);if(!this.inverted)for(let s=0;s<r;s++)n+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+n+$1(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?s:0);if(a>e)break;let c=this.ranges[l+i],d=this.ranges[l+o],u=a+c;if(e<=u){let h=c?e==a?-1:e==u?1:n:n,f=a+s+(h<0?0:d);if(r)return f;let p=e==(n<0?a:u)?null:B1(l/3,e-a),g=e==a?Ag:e==u?Mg:Do;return(n<0?e!=a:e!=u)&&(g|=Tg),new Wc(f,g,p)}s+=d-c}return r?e+s:new Wc(e+s,0,null)}touches(e,n){let r=0,s=pf(n),i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],d=a+c;if(e<=d&&l==s*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],l=o-(this.inverted?i:0),a=o+(this.inverted?0:i),c=this.ranges[s+n],d=this.ranges[s+r];e(l,l+c,a,a+d),i+=d-c}}invert(){return new _t(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?_t.empty:new _t(e<0?[0,-e,0]:[0,0,e])}}_t.empty=new _t([]);class ai{constructor(e,n,r=0,s=e?e.length:0){this.mirror=n,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new ai(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let s=e.getMirror(n);this.appendMap(e._maps[n],s!=null&&s<n?r+s:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let s=e.getMirror(n);this.appendMap(e._maps[n].invert(),s!=null&&s>n?r-s-1:void 0)}}invert(){let e=new ai;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],l=o.mapResult(e,n);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}s|=l.delInfo,e=l.pos}return r?e:new Wc(e,s,null)}}const Ja=Object.create(null);class mt{getMap(){return _t.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ja[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Ja)throw new RangeError("Duplicate use of step JSON ID "+e);return Ja[e]=n,n.prototype.jsonID=e,n}}class qe{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new qe(e,null)}static fail(e){return new qe(null,e)}static fromReplace(e,n,r,s){try{return qe.ok(e.replace(n,r,s))}catch(i){if(i instanceof Go)return qe.fail(i.message);throw i}}}function ru(t,e,n){let r=[];for(let s=0;s<t.childCount;s++){let i=t.child(s);i.content.size&&(i=i.copy(ru(i.content,e,i))),i.isInline&&(i=e(i,n,s)),r.push(i)}return O.fromArray(r)}class Kn extends mt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new P(ru(n.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),n.openStart,n.openEnd);return qe.fromReplace(e,this.from,this.to,i)}invert(){return new Wt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Kn(n.pos,r.pos,this.mark)}merge(e){return e instanceof Kn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Kn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Kn(n.from,n.to,e.markFromJSON(n.mark))}}mt.jsonID("addMark",Kn);class Wt extends mt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new P(ru(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),n.openStart,n.openEnd);return qe.fromReplace(e,this.from,this.to,r)}invert(){return new Kn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Wt(n.pos,r.pos,this.mark)}merge(e){return e instanceof Wt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Wt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Wt(n.from,n.to,e.markFromJSON(n.mark))}}mt.jsonID("removeMark",Wt);class Gn extends mt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return qe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return qe.fromReplace(e,this.pos,this.pos+1,new P(O.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let s=0;s<n.marks.length;s++)if(!n.marks[s].isInSet(r))return new Gn(this.pos,n.marks[s]);return new Gn(this.pos,this.mark)}}return new Rr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Gn(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Gn(n.pos,e.markFromJSON(n.mark))}}mt.jsonID("addNodeMark",Gn);class Rr extends mt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return qe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return qe.fromReplace(e,this.pos,this.pos+1,new P(O.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Gn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Rr(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Rr(n.pos,e.markFromJSON(n.mark))}}mt.jsonID("removeNodeMark",Rr);class Ze extends mt{constructor(e,n,r,s=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=s}apply(e){return this.structure&&qc(e,this.from,this.to)?qe.fail("Structure replace would overwrite content"):qe.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new _t([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ze(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Ze(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ze)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?P.empty:new P(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ze(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?P.empty:new P(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ze(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ze(n.from,n.to,P.fromJSON(e,n.slice),!!n.structure)}}mt.jsonID("replace",Ze);class Qe extends mt{constructor(e,n,r,s,i,o,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=l}apply(e){if(this.structure&&(qc(e,this.from,this.gapFrom)||qc(e,this.gapTo,this.to)))return qe.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return qe.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?qe.fromReplace(e,this.from,this.to,r):qe.fail("Content does not fit in gap")}getMap(){return new _t([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Qe(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||s<n.pos||i>r.pos?null:new Qe(n.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Qe(n.from,n.to,n.gapFrom,n.gapTo,P.fromJSON(e,n.slice),n.insert,!!n.structure)}}mt.jsonID("replaceAround",Qe);function qc(t,e,n){let r=t.resolve(e),s=n-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function H1(t,e,n,r){let s=[],i=[],o,l;t.doc.nodesBetween(e,n,(a,c,d)=>{if(!a.isInline)return;let u=a.marks;if(!r.isInSet(u)&&d.type.allowsMarkType(r.type)){let h=Math.max(c,e),f=Math.min(c+a.nodeSize,n),p=r.addToSet(u);for(let g=0;g<u.length;g++)u[g].isInSet(p)||(o&&o.to==h&&o.mark.eq(u[g])?o.to=f:s.push(o=new Wt(h,f,u[g])));l&&l.to==h?l.to=f:i.push(l=new Kn(h,f,r))}}),s.forEach(a=>t.step(a)),i.forEach(a=>t.step(a))}function z1(t,e,n,r){let s=[],i=0;t.doc.nodesBetween(e,n,(o,l)=>{if(!o.isInline)return;i++;let a=null;if(r instanceof Zl){let c=o.marks,d;for(;d=r.isInSet(c);)(a||(a=[])).push(d),c=d.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,n);for(let d=0;d<a.length;d++){let u=a[d],h;for(let f=0;f<s.length;f++){let p=s[f];p.step==i-1&&u.eq(s[f].style)&&(h=p)}h?(h.to=c,h.step=i):s.push({style:u,from:Math.max(l,e),to:c,step:i})}}}),s.forEach(o=>t.step(new Wt(o.from,o.to,o.style)))}function su(t,e,n,r=n.contentMatch,s=!0){let i=t.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),d=l+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new Ze(l,d,P.empty));else{r=u;for(let h=0;h<c.marks.length;h++)n.allowsMarkType(c.marks[h].type)||t.step(new Wt(l,d,c.marks[h]));if(s&&c.isText&&n.whitespace!="pre"){let h,f=/\r?\n|\r/g,p;for(;h=f.exec(c.text);)p||(p=new P(O.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),o.push(new Ze(l+h.index,l+h.index+h[0].length,p))}}l=d}if(!r.validEnd){let a=r.fillBefore(O.empty,!0);t.replace(l,l,new P(a,0,0))}for(let a=o.length-1;a>=0;a--)t.step(o[a])}function F1(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Cs(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let s=t.$from.node(r),i=t.$from.index(r),o=t.$to.indexAfter(r);if(r<t.depth&&s.canReplace(i,o,n))return r;if(r==0||s.type.spec.isolating||!F1(s,i,o))break}return null}function U1(t,e,n){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),l=s.after(i+1),a=o,c=l,d=O.empty,u=0;for(let p=i,g=!1;p>n;p--)g||r.index(p)>0?(g=!0,d=O.from(r.node(p).copy(d)),u++):a--;let h=O.empty,f=0;for(let p=i,g=!1;p>n;p--)g||s.after(p+1)<s.end(p)?(g=!0,h=O.from(s.node(p).copy(h)),f++):c++;t.step(new Qe(a,c,o,l,new P(d.append(h),u,f),d.size-u,!0))}function iu(t,e,n=null,r=t){let s=V1(t,e),i=s&&W1(r,e);return i?s.map(mf).concat({type:e,attrs:n}).concat(i.map(mf)):null}function mf(t){return{type:t,attrs:null}}function V1(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return n.canReplaceWith(r,s,o)?i:null}function W1(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;a&&c<s;c++)a=a.matchType(n.child(c).type);return!a||!a.validEnd?null:o}function q1(t,e,n){let r=O.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let l=n[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=O.from(n[o].type.create(n[o].attrs,r))}let s=e.start,i=e.end;t.step(new Qe(s,i,s,i,new P(r,0,0),n.length,!0))}function K1(t,e,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(o,l)=>{let a=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,a)&&G1(t.doc,t.mapping.slice(i).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!p?c=!1:!f&&p&&(c=!0)}c===!1&&_g(t,o,l,i),su(t,t.mapping.slice(i).map(l,1),r,void 0,c===null);let d=t.mapping.slice(i),u=d.map(l,1),h=d.map(l+o.nodeSize,1);return t.step(new Qe(u,h,u+1,h-1,new P(O.from(r.create(a,null,o.marks)),0,0),1,!0)),c===!0&&Ng(t,o,l,i),!1}})}function Ng(t,e,n,r){e.forEach((s,i)=>{if(s.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(s.text);){let a=t.mapping.slice(r).map(n+1+i+o.index);t.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function _g(t,e,n,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+i);t.replaceWith(o,o+1,e.type.schema.text(`
|
|
@@ -133,23 +101,7 @@ ${y}
|
|
|
133
101
|
`);A.trim()&&(e.customNestedParser?w=e.customNestedParser(A):w=n.blockTokens(A))}const S=e.createToken(p,w);a.push(S)}if(a.length!==0)return{items:a,raw:c.trim()}}function Lu(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const s=typeof n=="function"?n(r):n,[i,...o]=t.content,l=e.renderChildren([i]),a=[`${s}${l}`];return o&&o.length>0&&o.forEach(c=>{const d=e.renderChildren([c]);if(d){const u=d.split(`
|
|
134
102
|
`).map(h=>h?e.indent(h):"").join(`
|
|
135
103
|
`);a.push(u)}}),a.join(`
|
|
136
|
-
`)}function hE(t,e,n={}){const{state:r}=e,{doc:s,tr:i}=r,o=t;s.descendants((l,a)=>{const c=i.mapping.map(a),d=i.mapping.map(a)+l.nodeSize;let u=null;if(l.marks.forEach(f=>{if(f!==o)return!1;u=f}),!u)return;let h=!1;if(Object.keys(n).forEach(f=>{n[f]!==u.attrs[f]&&(h=!0)}),h){const f=t.type.create({...t.attrs,...n});i.removeMark(c,d,t.type),i.addMark(c,d,f)}}),i.docChanged&&e.view.dispatch(i)}var De=class cb extends Ru{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new cb(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},fE=class{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var e,n,r,s,i,o,l;const{view:a}=this.editor,c=t.target,d=c.nodeType===3?(e=c.parentElement)==null?void 0:e.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(n=this.contentDOM)!=null&&n.contains(c)||!d)return;let u=0,h=0;if(this.dom!==d){const w=this.dom.getBoundingClientRect(),M=d.getBoundingClientRect(),S=(s=t.offsetX)!=null?s:(r=t.nativeEvent)==null?void 0:r.offsetX,A=(o=t.offsetY)!=null?o:(i=t.nativeEvent)==null?void 0:i.offsetY;u=M.x-w.x+S,h=M.y-w.y+A}const f=this.dom.cloneNode(!0);try{const w=this.dom.getBoundingClientRect();f.style.width=`${Math.round(w.width)}px`,f.style.height=`${Math.round(w.height)}px`,f.style.boxSizing="border-box",f.style.pointerEvents="none"}catch{}let p=null;try{p=document.createElement("div"),p.style.position="absolute",p.style.top="-9999px",p.style.left="-9999px",p.style.pointerEvents="none",p.appendChild(f),document.body.appendChild(p),(l=t.dataTransfer)==null||l.setDragImage(f,u,h)}finally{p&&setTimeout(()=>{try{p?.remove()}catch{}},0)}const g=this.getPos();if(typeof g!="number")return;const y=q.create(a.state.doc,g),b=a.state.tr.setSelection(y);a.dispatch(b)}stopEvent(t){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const n=t.target;if(!(this.dom.contains(n)&&!((e=this.contentDOM)!=null&&e.contains(n))))return!1;const s=t.type.startsWith("drag"),i=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!i&&!s)return!0;const{isEditable:l}=this.editor,{isDragging:a}=this,c=!!this.node.type.spec.draggable,d=q.isSelectable(this.node),u=t.type==="copy",h=t.type==="paste",f=t.type==="cut",p=t.type==="mousedown";if(!c&&d&&s&&t.target===this.dom&&t.preventDefault(),c&&s&&!a&&t.target===this.dom)return t.preventDefault(),!1;if(c&&l&&!a&&p){const g=n.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(a||i||u||h||f||p&&d)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&(la()||Iy())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(n=>n.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:e})=>{const n=this.getPos();return typeof n!="number"?!1:(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if(typeof t!="number")return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}};function sr(t){return new qC({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:s})=>{const i=we(t.getAttributes,void 0,r,s);if(i===!1||i===null)return null;const{tr:o}=e,l=r[r.length-1],a=r[0];let c=n.to;if(l){const d=a.search(/\S/),u=n.from+a.indexOf(l),h=u+l.length;if(_u(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(y=>y===t.type&&y!==p.mark.type)).filter(p=>p.to>u).length)return null;h<n.to&&o.delete(h,n.to),u>n.from&&o.delete(n.from+d,u),c=n.from+d+l.length,o.addMark(n.from+d,c,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}var uc,cp;function pE(){return cp||(cp=1,uc=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,s,i;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(s=r;s--!==0;)if(!t(e[s],n[s]))return!1;return!0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(s of e.entries())if(!n.has(s[0]))return!1;for(s of e.entries())if(!t(s[1],n.get(s[0])))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(s of e.entries())if(!n.has(s[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(r=e.length,r!=n.length)return!1;for(s=r;s--!==0;)if(e[s]!==n[s])return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(i=Object.keys(e),r=i.length,r!==Object.keys(n).length)return!1;for(s=r;s--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[s]))return!1;for(s=r;s--!==0;){var o=i[s];if(!(o==="_owner"&&e.$$typeof)&&!t(e[o],n[o]))return!1}return!0}return e!==e&&n!==n}),uc}var mE=pE();const gE=sg(mE);var mo={exports:{}},hc={};/**
|
|
137
|
-
* @license React
|
|
138
|
-
* use-sync-external-store-shim/with-selector.production.js
|
|
139
|
-
*
|
|
140
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
141
|
-
*
|
|
142
|
-
* This source code is licensed under the MIT license found in the
|
|
143
|
-
* LICENSE file in the root directory of this source tree.
|
|
144
|
-
*/var dp;function yE(){if(dp)return hc;dp=1;var t=C,e=nu();function n(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var r=typeof Object.is=="function"?Object.is:n,s=e.useSyncExternalStore,i=t.useRef,o=t.useEffect,l=t.useMemo,a=t.useDebugValue;return hc.useSyncExternalStoreWithSelector=function(c,d,u,h,f){var p=i(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=l(function(){function b(x){if(!w){if(w=!0,M=x,x=h(x),f!==void 0&&g.hasValue){var k=g.value;if(f(k,x))return S=k}return S=x}if(k=S,r(M,x))return k;var v=h(x);return f!==void 0&&f(k,v)?(M=x,k):(M=x,S=v)}var w=!1,M,S,A=u===void 0?null:u;return[function(){return b(d())},A===null?void 0:function(){return b(A())}]},[d,u,h,f]);var y=s(c,p[0],p[1]);return o(function(){g.hasValue=!0,g.value=y},[y]),a(y),y},hc}var fc={};/**
|
|
145
|
-
* @license React
|
|
146
|
-
* use-sync-external-store-shim/with-selector.development.js
|
|
147
|
-
*
|
|
148
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
149
|
-
*
|
|
150
|
-
* This source code is licensed under the MIT license found in the
|
|
151
|
-
* LICENSE file in the root directory of this source tree.
|
|
152
|
-
*/var up;function bE(){return up||(up=1,process.env.NODE_ENV!=="production"&&(function(){function t(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var e=C,n=nu(),r=typeof Object.is=="function"?Object.is:t,s=n.useSyncExternalStore,i=e.useRef,o=e.useEffect,l=e.useMemo,a=e.useDebugValue;fc.useSyncExternalStoreWithSelector=function(c,d,u,h,f){var p=i(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=l(function(){function b(x){if(!w){if(w=!0,M=x,x=h(x),f!==void 0&&g.hasValue){var k=g.value;if(f(k,x))return S=k}return S=x}if(k=S,r(M,x))return k;var v=h(x);return f!==void 0&&f(k,v)?(M=x,k):(M=x,S=v)}var w=!1,M,S,A=u===void 0?null:u;return[function(){return b(d())},A===null?void 0:function(){return b(A())}]},[d,u,h,f]);var y=s(c,p[0],p[1]);return o(function(){g.hasValue=!0,g.value=y},[y]),a(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),fc}var hp;function xE(){return hp||(hp=1,process.env.NODE_ENV==="production"?mo.exports=yE():mo.exports=bE()),mo.exports}var wE=xE(),kE=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},vE=({contentComponent:t})=>{const e=ig.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return m.jsx(m.Fragment,{children:Object.values(e)})};function SE(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:tu.createPortal(r.reactElement,r.element,n)},t.forEach(s=>s())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(s=>s())}}}var CE=class extends C.Component{constructor(t){var e;super(t),this.editorContentRef=C.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const t=this.props.editor;if(t&&!t.isDestroyed&&t.options.element){if(t.contentComponent)return;const e=this.editorContentRef.current;e.append(t.view.dom),t.setOptions({element:e}),t.contentComponent=SE(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(n=>n.hasContentComponentInitialized?n:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.firstChild))return;const n=document.createElement("div");n.append(e.view.dom),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return m.jsxs(m.Fragment,{children:[m.jsx("div",{ref:kE(e,this.editorContentRef),...n}),t?.contentComponent&&m.jsx(vE,{contentComponent:t.contentComponent})]})}},EE=C.forwardRef((t,e)=>{const n=C.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return C.createElement(CE,{key:n,innerRef:e,...t})}),db=C.memo(EE),ME=typeof window<"u"?C.useLayoutEffect:C.useEffect,AE=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function TE(t){var e;const[n]=C.useState(()=>new AE(t.editor)),r=wE.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:gE);return ME(()=>n.watch(t.editor),[t.editor,n]),C.useDebugValue(r),r}var fp=process.env.NODE_ENV!=="production",ad=typeof window>"u",NE=ad||!!(typeof window<"u"&&window.next),_E=class ub{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){if(this.options.current.immediatelyRender===void 0){if(ad||NE){if(fp)throw new Error("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches.");return null}return this.createEditor()}if(this.options.current.immediatelyRender&&ad&&fp)throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");return this.options.current.immediatelyRender?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onBeforeCreate)==null?void 0:i.call(s,...r)},onBlur:(...r)=>{var s,i;return(i=(s=this.options.current).onBlur)==null?void 0:i.call(s,...r)},onCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onCreate)==null?void 0:i.call(s,...r)},onDestroy:(...r)=>{var s,i;return(i=(s=this.options.current).onDestroy)==null?void 0:i.call(s,...r)},onFocus:(...r)=>{var s,i;return(i=(s=this.options.current).onFocus)==null?void 0:i.call(s,...r)},onSelectionUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onSelectionUpdate)==null?void 0:i.call(s,...r)},onTransaction:(...r)=>{var s,i;return(i=(s=this.options.current).onTransaction)==null?void 0:i.call(s,...r)},onUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onUpdate)==null?void 0:i.call(s,...r)},onContentError:(...r)=>{var s,i;return(i=(s=this.options.current).onContentError)==null?void 0:i.call(s,...r)},onDrop:(...r)=>{var s,i;return(i=(s=this.options.current).onDrop)==null?void 0:i.call(s,...r)},onPaste:(...r)=>{var s,i;return(i=(s=this.options.current).onPaste)==null?void 0:i.call(s,...r)},onDelete:(...r)=>{var s,i;return(i=(s=this.options.current).onDelete)==null?void 0:i.call(s,...r)}};return new tE(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((s,i)=>{var o;return s===((o=n.extensions)==null?void 0:o[i])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?ub.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,s)=>r===e[s]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function hb(t={},e=[]){const n=C.useRef(t);n.current=t;const[r]=C.useState(()=>new _E(n)),s=ig.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return C.useDebugValue(s),C.useEffect(r.onRender(e)),TE({editor:s,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),s}var RE=C.createContext({editor:null});RE.Consumer;var fb=C.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),OE=()=>C.useContext(fb),Iu=C.forwardRef((t,e)=>{const{onDragStart:n}=OE(),r=t.as||"div";return m.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function pp(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function mp(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function DE(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function LE(t){if(pp(t)||mp(t))return!0;if(DE(t)){const e=t.type;if(e)return pp(e)||mp(e)}return!1}function IE(){try{if(C.version)return parseInt(C.version.split(".")[0],10)>=19}catch{}return!1}var pb=class{constructor(t,{editor:e,props:n={},as:r="div",className:s=""}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=e,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),s&&this.element.classList.add(...s.split(" ")),this.editor.isInitialized?tu.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.render()})}render(){var t;const e=this.component,n=this.props,r=this.editor,s=IE(),i=LE(e),o={...n};o.ref&&!(s||i)&&delete o.ref,!o.ref&&(s||i)&&(o.ref=l=>{this.ref=l}),this.reactElement=m.jsx(e,{...o}),(t=r?.contentComponent)==null||t.setRenderer(this.id,this)}updateProps(t={}){this.props={...this.props,...t},this.render()}destroy(){var t;const e=this.editor;(t=e?.contentComponent)==null||t.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(t){Object.keys(t).forEach(e=>{this.element.setAttribute(e,t[e])})}};C.createContext({markViewContentRef:()=>{}});var jE=class extends fE{constructor(t,e,n){if(super(t,e,n),!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");if(!r)return;r.appendChild(this.contentDOMElement)}}mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(a={})=>this.updateAttributes(a),deleteNode:()=>this.deleteNode(),ref:C.createRef()};if(!this.component.displayName){const a=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=a(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:a=>{a&&this.contentDOMElement&&a.firstChild!==this.contentDOMElement&&(a.hasAttribute("data-node-view-wrapper")&&a.removeAttribute("data-node-view-wrapper"),a.appendChild(this.contentDOMElement))}},s=this.component,i=C.memo(a=>m.jsx(fb.Provider,{value:r,children:C.createElement(s,a)}));i.displayName="ReactNodeView";let o=this.node.isInline?"span":"div";this.options.as&&(o=this.options.as);const{className:l=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new pb(i,{editor:this.editor,props:t,as:o,className:`node-${this.node.type.name} ${l}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var t;if(this.renderer.element.firstElementChild&&!((t=this.renderer.element.firstElementChild)!=null&&t.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){const{from:t,to:e}=this.editor.state.selection,n=this.getPos();if(typeof n=="number")if(t<=n&&e>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(t,e,n){const r=s=>{this.renderer.updateProps(s),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const s=this.node,i=this.decorations,o=this.innerDecorations;return this.node=t,this.decorations=e,this.innerDecorations=n,this.options.update({oldNode:s,oldDecorations:i,newNode:t,newDecorations:e,oldInnerDecorations:o,innerDecorations:n,updateProps:()=>r({node:t,decorations:e,innerDecorations:n})})}return t===this.node&&this.decorations===e&&this.innerDecorations===n||(this.node=t,this.decorations=e,this.innerDecorations=n,r({node:t,decorations:e,innerDecorations:n})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,n=mi(this.node,e);t=this.options.attrs({node:this.node,HTMLAttributes:n})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function ju(t,e){return n=>n.editor.contentComponent?new jE(t,n,e):{}}const gs=Math.min,Nt=Math.max,sl=Math.round,go=Math.floor,ln=t=>({x:t,y:t}),PE={left:"right",right:"left",bottom:"top",top:"bottom"},BE={start:"end",end:"start"};function gp(t,e,n){return Nt(t,gs(e,n))}function ji(t,e){return typeof t=="function"?t(e):t}function ir(t){return t.split("-")[0]}function Pi(t){return t.split("-")[1]}function mb(t){return t==="x"?"y":"x"}function gb(t){return t==="y"?"height":"width"}const $E=new Set(["top","bottom"]);function En(t){return $E.has(ir(t))?"y":"x"}function yb(t){return mb(En(t))}function HE(t,e,n){n===void 0&&(n=!1);const r=Pi(t),s=yb(t),i=gb(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=il(o)),[o,il(o)]}function zE(t){const e=il(t);return[cd(t),e,cd(e)]}function cd(t){return t.replace(/start|end/g,e=>BE[e])}const yp=["left","right"],bp=["right","left"],FE=["top","bottom"],UE=["bottom","top"];function VE(t,e,n){switch(t){case"top":case"bottom":return n?e?bp:yp:e?yp:bp;case"left":case"right":return e?FE:UE;default:return[]}}function WE(t,e,n,r){const s=Pi(t);let i=VE(ir(t),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),e&&(i=i.concat(i.map(cd)))),i}function il(t){return t.replace(/left|right|bottom|top/g,e=>PE[e])}function qE(t){return{top:0,right:0,bottom:0,left:0,...t}}function KE(t){return typeof t!="number"?qE(t):{top:t,right:t,bottom:t,left:t}}function ol(t){const{x:e,y:n,width:r,height:s}=t;return{width:r,height:s,top:n,left:e,right:e+r,bottom:n+s,x:e,y:n}}function xp(t,e,n){let{reference:r,floating:s}=t;const i=En(e),o=yb(e),l=gb(o),a=ir(e),c=i==="y",d=r.x+r.width/2-s.width/2,u=r.y+r.height/2-s.height/2,h=r[l]/2-s[l]/2;let f;switch(a){case"top":f={x:d,y:r.y-s.height};break;case"bottom":f={x:d,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:u};break;case"left":f={x:r.x-s.width,y:u};break;default:f={x:r.x,y:r.y}}switch(Pi(e)){case"start":f[o]-=h*(n&&c?-1:1);break;case"end":f[o]+=h*(n&&c?-1:1);break}return f}const GE=async(t,e,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,l=i.filter(Boolean),a=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:t,floating:e,strategy:s}),{x:d,y:u}=xp(c,r,a),h=r,f={},p=0;for(let g=0;g<l.length;g++){const{name:y,fn:b}=l[g],{x:w,y:M,data:S,reset:A}=await b({x:d,y:u,initialPlacement:r,placement:h,strategy:s,middlewareData:f,rects:c,platform:o,elements:{reference:t,floating:e}});d=w??d,u=M??u,f={...f,[y]:{...f[y],...S}},A&&p<=50&&(p++,typeof A=="object"&&(A.placement&&(h=A.placement),A.rects&&(c=A.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:s}):A.rects),{x:d,y:u}=xp(c,h,a)),g=-1)}return{x:d,y:u,placement:h,strategy:s,middlewareData:f}};async function Pu(t,e){var n;e===void 0&&(e={});const{x:r,y:s,platform:i,rects:o,elements:l,strategy:a}=t,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:h=!1,padding:f=0}=ji(e,t),p=KE(f),y=l[h?u==="floating"?"reference":"floating":u],b=ol(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:c,rootBoundary:d,strategy:a})),w=u==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,M=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),S=await(i.isElement==null?void 0:i.isElement(M))?await(i.getScale==null?void 0:i.getScale(M))||{x:1,y:1}:{x:1,y:1},A=ol(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:w,offsetParent:M,strategy:a}):w);return{top:(b.top-A.top+p.top)/S.y,bottom:(A.bottom-b.bottom+p.bottom)/S.y,left:(b.left-A.left+p.left)/S.x,right:(A.right-b.right+p.right)/S.x}}const JE=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:s,middlewareData:i,rects:o,initialPlacement:l,platform:a,elements:c}=e,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:h,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...y}=ji(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=ir(s),w=En(l),M=ir(l)===l,S=await(a.isRTL==null?void 0:a.isRTL(c.floating)),A=h||(M||!g?[il(l)]:zE(l)),x=p!=="none";!h&&x&&A.push(...WE(l,g,p,S));const k=[l,...A],v=await Pu(e,y),T=[];let N=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&T.push(v[b]),u){const I=HE(s,o,S);T.push(v[I[0]],v[I[1]])}if(N=[...N,{placement:s,overflows:T}],!T.every(I=>I<=0)){var H,V;const I=(((H=i.flip)==null?void 0:H.index)||0)+1,j=k[I];if(j&&(!(u==="alignment"?w!==En(j):!1)||N.every(F=>En(F.placement)===w?F.overflows[0]>0:!0)))return{data:{index:I,overflows:N},reset:{placement:j}};let Q=(V=N.filter(ie=>ie.overflows[0]<=0).sort((ie,F)=>ie.overflows[1]-F.overflows[1])[0])==null?void 0:V.placement;if(!Q)switch(f){case"bestFit":{var $;const ie=($=N.filter(F=>{if(x){const ue=En(F.placement);return ue===w||ue==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(ue=>ue>0).reduce((ue,xe)=>ue+xe,0)]).sort((F,ue)=>F[1]-ue[1])[0])==null?void 0:$[0];ie&&(Q=ie);break}case"initialPlacement":Q=l;break}if(s!==Q)return{reset:{placement:Q}}}return{}}}},YE=new Set(["left","top"]);async function XE(t,e){const{placement:n,platform:r,elements:s}=t,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=ir(n),l=Pi(n),a=En(n)==="y",c=YE.has(o)?-1:1,d=i&&a?-1:1,u=ji(e,t);let{mainAxis:h,crossAxis:f,alignmentAxis:p}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return l&&typeof p=="number"&&(f=l==="end"?p*-1:p),a?{x:f*d,y:h*c}:{x:h*c,y:f*d}}const ZE=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:s,y:i,placement:o,middlewareData:l}=e,a=await XE(e,t);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+a.x,y:i+a.y,data:{...a,placement:o}}}}},QE=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:s}=e,{mainAxis:i=!0,crossAxis:o=!1,limiter:l={fn:y=>{let{x:b,y:w}=y;return{x:b,y:w}}},...a}=ji(t,e),c={x:n,y:r},d=await Pu(e,a),u=En(ir(s)),h=mb(u);let f=c[h],p=c[u];if(i){const y=h==="y"?"top":"left",b=h==="y"?"bottom":"right",w=f+d[y],M=f-d[b];f=gp(w,f,M)}if(o){const y=u==="y"?"top":"left",b=u==="y"?"bottom":"right",w=p+d[y],M=p-d[b];p=gp(w,p,M)}const g=l.fn({...e,[h]:f,[u]:p});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[h]:i,[u]:o}}}}}},eM=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:s,rects:i,platform:o,elements:l}=e,{apply:a=()=>{},...c}=ji(t,e),d=await Pu(e,c),u=ir(s),h=Pi(s),f=En(s)==="y",{width:p,height:g}=i.floating;let y,b;u==="top"||u==="bottom"?(y=u,b=h===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(b=u,y=h==="end"?"top":"bottom");const w=g-d.top-d.bottom,M=p-d.left-d.right,S=gs(g-d[y],w),A=gs(p-d[b],M),x=!e.middlewareData.shift;let k=S,v=A;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(v=M),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(k=w),x&&!h){const N=Nt(d.left,0),H=Nt(d.right,0),V=Nt(d.top,0),$=Nt(d.bottom,0);f?v=p-2*(N!==0||H!==0?N+H:Nt(d.left,d.right)):k=g-2*(V!==0||$!==0?V+$:Nt(d.top,d.bottom))}await a({...e,availableWidth:v,availableHeight:k});const T=await o.getDimensions(l.floating);return p!==T.width||g!==T.height?{reset:{rects:!0}}:{}}}};function ua(){return typeof window<"u"}function Es(t){return bb(t)?(t.nodeName||"").toLowerCase():"#document"}function Ot(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function hn(t){var e;return(e=(bb(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function bb(t){return ua()?t instanceof Node||t instanceof Ot(t).Node:!1}function ut(t){return ua()?t instanceof Element||t instanceof Ot(t).Element:!1}function un(t){return ua()?t instanceof HTMLElement||t instanceof Ot(t).HTMLElement:!1}function wp(t){return!ua()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Ot(t).ShadowRoot}const tM=new Set(["inline","contents"]);function Bi(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=Jt(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!tM.has(s)}const nM=new Set(["table","td","th"]);function rM(t){return nM.has(Es(t))}const sM=[":popover-open",":modal"];function ha(t){return sM.some(e=>{try{return t.matches(e)}catch{return!1}})}const iM=["transform","translate","scale","rotate","perspective"],oM=["transform","translate","scale","rotate","perspective","filter"],lM=["paint","layout","strict","content"];function Bu(t){const e=$u(),n=ut(t)?Jt(t):t;return iM.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||oM.some(r=>(n.willChange||"").includes(r))||lM.some(r=>(n.contain||"").includes(r))}function aM(t){let e=or(t);for(;un(e)&&!ys(e);){if(Bu(e))return e;if(ha(e))return null;e=or(e)}return null}function $u(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const cM=new Set(["html","body","#document"]);function ys(t){return cM.has(Es(t))}function Jt(t){return Ot(t).getComputedStyle(t)}function fa(t){return ut(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function or(t){if(Es(t)==="html")return t;const e=t.assignedSlot||t.parentNode||wp(t)&&t.host||hn(t);return wp(e)?e.host:e}function xb(t){const e=or(t);return ys(e)?t.ownerDocument?t.ownerDocument.body:t.body:un(e)&&Bi(e)?e:xb(e)}function gi(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=xb(t),i=s===((r=t.ownerDocument)==null?void 0:r.body),o=Ot(s);if(i){const l=dd(o);return e.concat(o,o.visualViewport||[],Bi(s)?s:[],l&&n?gi(l):[])}return e.concat(s,gi(s,[],n))}function dd(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function wb(t){const e=Jt(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=un(t),i=s?t.offsetWidth:n,o=s?t.offsetHeight:r,l=sl(n)!==i||sl(r)!==o;return l&&(n=i,r=o),{width:n,height:r,$:l}}function Hu(t){return ut(t)?t:t.contextElement}function is(t){const e=Hu(t);if(!un(e))return ln(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:i}=wb(e);let o=(i?sl(n.width):n.width)/r,l=(i?sl(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const dM=ln(0);function kb(t){const e=Ot(t);return!$u()||!e.visualViewport?dM:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function uM(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Ot(t)?!1:e}function Ir(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=Hu(t);let o=ln(1);e&&(r?ut(r)&&(o=is(r)):o=is(t));const l=uM(i,n,r)?kb(i):ln(0);let a=(s.left+l.x)/o.x,c=(s.top+l.y)/o.y,d=s.width/o.x,u=s.height/o.y;if(i){const h=Ot(i),f=r&&ut(r)?Ot(r):r;let p=h,g=dd(p);for(;g&&r&&f!==p;){const y=is(g),b=g.getBoundingClientRect(),w=Jt(g),M=b.left+(g.clientLeft+parseFloat(w.paddingLeft))*y.x,S=b.top+(g.clientTop+parseFloat(w.paddingTop))*y.y;a*=y.x,c*=y.y,d*=y.x,u*=y.y,a+=M,c+=S,p=Ot(g),g=dd(p)}}return ol({width:d,height:u,x:a,y:c})}function pa(t,e){const n=fa(t).scrollLeft;return e?e.left+n:Ir(hn(t)).left+n}function vb(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-pa(t,n),s=n.top+e.scrollTop;return{x:r,y:s}}function hM(t){let{elements:e,rect:n,offsetParent:r,strategy:s}=t;const i=s==="fixed",o=hn(r),l=e?ha(e.floating):!1;if(r===o||l&&i)return n;let a={scrollLeft:0,scrollTop:0},c=ln(1);const d=ln(0),u=un(r);if((u||!u&&!i)&&((Es(r)!=="body"||Bi(o))&&(a=fa(r)),un(r))){const f=Ir(r);c=is(r),d.x=f.x+r.clientLeft,d.y=f.y+r.clientTop}const h=o&&!u&&!i?vb(o,a):ln(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+d.x+h.x,y:n.y*c.y-a.scrollTop*c.y+d.y+h.y}}function fM(t){return Array.from(t.getClientRects())}function pM(t){const e=hn(t),n=fa(t),r=t.ownerDocument.body,s=Nt(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=Nt(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+pa(t);const l=-n.scrollTop;return Jt(r).direction==="rtl"&&(o+=Nt(e.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:l}}const kp=25;function mM(t,e){const n=Ot(t),r=hn(t),s=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,l=0,a=0;if(s){i=s.width,o=s.height;const d=$u();(!d||d&&e==="fixed")&&(l=s.offsetLeft,a=s.offsetTop)}const c=pa(r);if(c<=0){const d=r.ownerDocument,u=d.body,h=getComputedStyle(u),f=d.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,p=Math.abs(r.clientWidth-u.clientWidth-f);p<=kp&&(i-=p)}else c<=kp&&(i+=c);return{width:i,height:o,x:l,y:a}}const gM=new Set(["absolute","fixed"]);function yM(t,e){const n=Ir(t,!0,e==="fixed"),r=n.top+t.clientTop,s=n.left+t.clientLeft,i=un(t)?is(t):ln(1),o=t.clientWidth*i.x,l=t.clientHeight*i.y,a=s*i.x,c=r*i.y;return{width:o,height:l,x:a,y:c}}function vp(t,e,n){let r;if(e==="viewport")r=mM(t,n);else if(e==="document")r=pM(hn(t));else if(ut(e))r=yM(e,n);else{const s=kb(t);r={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return ol(r)}function Sb(t,e){const n=or(t);return n===e||!ut(n)||ys(n)?!1:Jt(n).position==="fixed"||Sb(n,e)}function bM(t,e){const n=e.get(t);if(n)return n;let r=gi(t,[],!1).filter(l=>ut(l)&&Es(l)!=="body"),s=null;const i=Jt(t).position==="fixed";let o=i?or(t):t;for(;ut(o)&&!ys(o);){const l=Jt(o),a=Bu(o);!a&&l.position==="fixed"&&(s=null),(i?!a&&!s:!a&&l.position==="static"&&!!s&&gM.has(s.position)||Bi(o)&&!a&&Sb(t,o))?r=r.filter(d=>d!==o):s=l,o=or(o)}return e.set(t,r),r}function xM(t){let{element:e,boundary:n,rootBoundary:r,strategy:s}=t;const o=[...n==="clippingAncestors"?ha(e)?[]:bM(e,this._c):[].concat(n),r],l=o[0],a=o.reduce((c,d)=>{const u=vp(e,d,s);return c.top=Nt(u.top,c.top),c.right=gs(u.right,c.right),c.bottom=gs(u.bottom,c.bottom),c.left=Nt(u.left,c.left),c},vp(e,l,s));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function wM(t){const{width:e,height:n}=wb(t);return{width:e,height:n}}function kM(t,e,n){const r=un(e),s=hn(e),i=n==="fixed",o=Ir(t,!0,i,e);let l={scrollLeft:0,scrollTop:0};const a=ln(0);function c(){a.x=pa(s)}if(r||!r&&!i)if((Es(e)!=="body"||Bi(s))&&(l=fa(e)),r){const f=Ir(e,!0,i,e);a.x=f.x+e.clientLeft,a.y=f.y+e.clientTop}else s&&c();i&&!r&&s&&c();const d=s&&!r&&!i?vb(s,l):ln(0),u=o.left+l.scrollLeft-a.x-d.x,h=o.top+l.scrollTop-a.y-d.y;return{x:u,y:h,width:o.width,height:o.height}}function pc(t){return Jt(t).position==="static"}function Sp(t,e){if(!un(t)||Jt(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return hn(t)===n&&(n=n.ownerDocument.body),n}function Cb(t,e){const n=Ot(t);if(ha(t))return n;if(!un(t)){let s=or(t);for(;s&&!ys(s);){if(ut(s)&&!pc(s))return s;s=or(s)}return n}let r=Sp(t,e);for(;r&&rM(r)&&pc(r);)r=Sp(r,e);return r&&ys(r)&&pc(r)&&!Bu(r)?n:r||aM(t)||n}const vM=async function(t){const e=this.getOffsetParent||Cb,n=this.getDimensions,r=await n(t.floating);return{reference:kM(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function SM(t){return Jt(t).direction==="rtl"}const CM={convertOffsetParentRelativeRectToViewportRelativeRect:hM,getDocumentElement:hn,getClippingRect:xM,getOffsetParent:Cb,getElementRects:vM,getClientRects:fM,getDimensions:wM,getScale:is,isElement:ut,isRTL:SM};function Eb(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function EM(t,e){let n=null,r;const s=hn(t);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),i();const c=t.getBoundingClientRect(),{left:d,top:u,width:h,height:f}=c;if(l||e(),!h||!f)return;const p=go(u),g=go(s.clientWidth-(d+h)),y=go(s.clientHeight-(u+f)),b=go(d),M={rootMargin:-p+"px "+-g+"px "+-y+"px "+-b+"px",threshold:Nt(0,gs(1,a))||1};let S=!0;function A(x){const k=x[0].intersectionRatio;if(k!==a){if(!S)return o();k?o(!1,k):r=setTimeout(()=>{o(!1,1e-7)},1e3)}k===1&&!Eb(c,t.getBoundingClientRect())&&o(),S=!1}try{n=new IntersectionObserver(A,{...M,root:s.ownerDocument})}catch{n=new IntersectionObserver(A,M)}n.observe(t)}return o(!0),i}function Ms(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,c=Hu(t),d=s||i?[...c?gi(c):[],...gi(e)]:[];d.forEach(b=>{s&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const u=c&&l?EM(c,n):null;let h=-1,f=null;o&&(f=new ResizeObserver(b=>{let[w]=b;w&&w.target===c&&f&&(f.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var M;(M=f)==null||M.observe(e)})),n()}),c&&!a&&f.observe(c),f.observe(e));let p,g=a?Ir(t):null;a&&y();function y(){const b=Ir(t);g&&!Eb(g,b)&&n(),g=b,p=requestAnimationFrame(y)}return n(),()=>{var b;d.forEach(w=>{s&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),u?.(),(b=f)==null||b.disconnect(),f=null,a&&cancelAnimationFrame(p)}}const zu=ZE,Mb=QE,Ab=JE,Tb=eM,Fu=(t,e,n)=>{const r=new Map,s={platform:CM,...n},i={...s.platform,_c:r};return GE(t,e,{...s,platform:i})};var ll=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},MM=/^\s*>\s$/,Nb=De.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return ll("blockquote",{...be(this.options.HTMLAttributes,t),children:ll("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=[];return t.content.forEach(s=>{const o=e.renderChildren(s).split(`
|
|
104
|
+
`)}function hE(t,e,n={}){const{state:r}=e,{doc:s,tr:i}=r,o=t;s.descendants((l,a)=>{const c=i.mapping.map(a),d=i.mapping.map(a)+l.nodeSize;let u=null;if(l.marks.forEach(f=>{if(f!==o)return!1;u=f}),!u)return;let h=!1;if(Object.keys(n).forEach(f=>{n[f]!==u.attrs[f]&&(h=!0)}),h){const f=t.type.create({...t.attrs,...n});i.removeMark(c,d,t.type),i.addMark(c,d,f)}}),i.docChanged&&e.view.dispatch(i)}var De=class cb extends Ru{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new cb(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},fE=class{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var e,n,r,s,i,o,l;const{view:a}=this.editor,c=t.target,d=c.nodeType===3?(e=c.parentElement)==null?void 0:e.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(n=this.contentDOM)!=null&&n.contains(c)||!d)return;let u=0,h=0;if(this.dom!==d){const w=this.dom.getBoundingClientRect(),M=d.getBoundingClientRect(),S=(s=t.offsetX)!=null?s:(r=t.nativeEvent)==null?void 0:r.offsetX,A=(o=t.offsetY)!=null?o:(i=t.nativeEvent)==null?void 0:i.offsetY;u=M.x-w.x+S,h=M.y-w.y+A}const f=this.dom.cloneNode(!0);try{const w=this.dom.getBoundingClientRect();f.style.width=`${Math.round(w.width)}px`,f.style.height=`${Math.round(w.height)}px`,f.style.boxSizing="border-box",f.style.pointerEvents="none"}catch{}let p=null;try{p=document.createElement("div"),p.style.position="absolute",p.style.top="-9999px",p.style.left="-9999px",p.style.pointerEvents="none",p.appendChild(f),document.body.appendChild(p),(l=t.dataTransfer)==null||l.setDragImage(f,u,h)}finally{p&&setTimeout(()=>{try{p?.remove()}catch{}},0)}const g=this.getPos();if(typeof g!="number")return;const y=q.create(a.state.doc,g),b=a.state.tr.setSelection(y);a.dispatch(b)}stopEvent(t){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const n=t.target;if(!(this.dom.contains(n)&&!((e=this.contentDOM)!=null&&e.contains(n))))return!1;const s=t.type.startsWith("drag"),i=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!i&&!s)return!0;const{isEditable:l}=this.editor,{isDragging:a}=this,c=!!this.node.type.spec.draggable,d=q.isSelectable(this.node),u=t.type==="copy",h=t.type==="paste",f=t.type==="cut",p=t.type==="mousedown";if(!c&&d&&s&&t.target===this.dom&&t.preventDefault(),c&&s&&!a&&t.target===this.dom)return t.preventDefault(),!1;if(c&&l&&!a&&p){const g=n.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(a||i||u||h||f||p&&d)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&(la()||Iy())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(n=>n.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:e})=>{const n=this.getPos();return typeof n!="number"?!1:(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if(typeof t!="number")return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}};function sr(t){return new qC({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:s})=>{const i=we(t.getAttributes,void 0,r,s);if(i===!1||i===null)return null;const{tr:o}=e,l=r[r.length-1],a=r[0];let c=n.to;if(l){const d=a.search(/\S/),u=n.from+a.indexOf(l),h=u+l.length;if(_u(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(y=>y===t.type&&y!==p.mark.type)).filter(p=>p.to>u).length)return null;h<n.to&&o.delete(h,n.to),u>n.from&&o.delete(n.from+d,u),c=n.from+d+l.length,o.addMark(n.from+d,c,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}var uc,cp;function pE(){return cp||(cp=1,uc=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,s,i;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(s=r;s--!==0;)if(!t(e[s],n[s]))return!1;return!0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(s of e.entries())if(!n.has(s[0]))return!1;for(s of e.entries())if(!t(s[1],n.get(s[0])))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(s of e.entries())if(!n.has(s[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(r=e.length,r!=n.length)return!1;for(s=r;s--!==0;)if(e[s]!==n[s])return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(i=Object.keys(e),r=i.length,r!==Object.keys(n).length)return!1;for(s=r;s--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[s]))return!1;for(s=r;s--!==0;){var o=i[s];if(!(o==="_owner"&&e.$$typeof)&&!t(e[o],n[o]))return!1}return!0}return e!==e&&n!==n}),uc}var mE=pE();const gE=sg(mE);var mo={exports:{}},hc={};var dp;function yE(){if(dp)return hc;dp=1;var t=C,e=nu();function n(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var r=typeof Object.is=="function"?Object.is:n,s=e.useSyncExternalStore,i=t.useRef,o=t.useEffect,l=t.useMemo,a=t.useDebugValue;return hc.useSyncExternalStoreWithSelector=function(c,d,u,h,f){var p=i(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=l(function(){function b(x){if(!w){if(w=!0,M=x,x=h(x),f!==void 0&&g.hasValue){var k=g.value;if(f(k,x))return S=k}return S=x}if(k=S,r(M,x))return k;var v=h(x);return f!==void 0&&f(k,v)?(M=x,k):(M=x,S=v)}var w=!1,M,S,A=u===void 0?null:u;return[function(){return b(d())},A===null?void 0:function(){return b(A())}]},[d,u,h,f]);var y=s(c,p[0],p[1]);return o(function(){g.hasValue=!0,g.value=y},[y]),a(y),y},hc}var fc={};var up;function bE(){return up||(up=1,process.env.NODE_ENV!=="production"&&(function(){function t(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var e=C,n=nu(),r=typeof Object.is=="function"?Object.is:t,s=n.useSyncExternalStore,i=e.useRef,o=e.useEffect,l=e.useMemo,a=e.useDebugValue;fc.useSyncExternalStoreWithSelector=function(c,d,u,h,f){var p=i(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=l(function(){function b(x){if(!w){if(w=!0,M=x,x=h(x),f!==void 0&&g.hasValue){var k=g.value;if(f(k,x))return S=k}return S=x}if(k=S,r(M,x))return k;var v=h(x);return f!==void 0&&f(k,v)?(M=x,k):(M=x,S=v)}var w=!1,M,S,A=u===void 0?null:u;return[function(){return b(d())},A===null?void 0:function(){return b(A())}]},[d,u,h,f]);var y=s(c,p[0],p[1]);return o(function(){g.hasValue=!0,g.value=y},[y]),a(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),fc}var hp;function xE(){return hp||(hp=1,process.env.NODE_ENV==="production"?mo.exports=yE():mo.exports=bE()),mo.exports}var wE=xE(),kE=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},vE=({contentComponent:t})=>{const e=ig.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return m.jsx(m.Fragment,{children:Object.values(e)})};function SE(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:tu.createPortal(r.reactElement,r.element,n)},t.forEach(s=>s())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(s=>s())}}}var CE=class extends C.Component{constructor(t){var e;super(t),this.editorContentRef=C.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const t=this.props.editor;if(t&&!t.isDestroyed&&t.options.element){if(t.contentComponent)return;const e=this.editorContentRef.current;e.append(t.view.dom),t.setOptions({element:e}),t.contentComponent=SE(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(n=>n.hasContentComponentInitialized?n:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.firstChild))return;const n=document.createElement("div");n.append(e.view.dom),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return m.jsxs(m.Fragment,{children:[m.jsx("div",{ref:kE(e,this.editorContentRef),...n}),t?.contentComponent&&m.jsx(vE,{contentComponent:t.contentComponent})]})}},EE=C.forwardRef((t,e)=>{const n=C.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return C.createElement(CE,{key:n,innerRef:e,...t})}),db=C.memo(EE),ME=typeof window<"u"?C.useLayoutEffect:C.useEffect,AE=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function TE(t){var e;const[n]=C.useState(()=>new AE(t.editor)),r=wE.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:gE);return ME(()=>n.watch(t.editor),[t.editor,n]),C.useDebugValue(r),r}var fp=process.env.NODE_ENV!=="production",ad=typeof window>"u",NE=ad||!!(typeof window<"u"&&window.next),_E=class ub{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){if(this.options.current.immediatelyRender===void 0){if(ad||NE){if(fp)throw new Error("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches.");return null}return this.createEditor()}if(this.options.current.immediatelyRender&&ad&&fp)throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");return this.options.current.immediatelyRender?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onBeforeCreate)==null?void 0:i.call(s,...r)},onBlur:(...r)=>{var s,i;return(i=(s=this.options.current).onBlur)==null?void 0:i.call(s,...r)},onCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onCreate)==null?void 0:i.call(s,...r)},onDestroy:(...r)=>{var s,i;return(i=(s=this.options.current).onDestroy)==null?void 0:i.call(s,...r)},onFocus:(...r)=>{var s,i;return(i=(s=this.options.current).onFocus)==null?void 0:i.call(s,...r)},onSelectionUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onSelectionUpdate)==null?void 0:i.call(s,...r)},onTransaction:(...r)=>{var s,i;return(i=(s=this.options.current).onTransaction)==null?void 0:i.call(s,...r)},onUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onUpdate)==null?void 0:i.call(s,...r)},onContentError:(...r)=>{var s,i;return(i=(s=this.options.current).onContentError)==null?void 0:i.call(s,...r)},onDrop:(...r)=>{var s,i;return(i=(s=this.options.current).onDrop)==null?void 0:i.call(s,...r)},onPaste:(...r)=>{var s,i;return(i=(s=this.options.current).onPaste)==null?void 0:i.call(s,...r)},onDelete:(...r)=>{var s,i;return(i=(s=this.options.current).onDelete)==null?void 0:i.call(s,...r)}};return new tE(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((s,i)=>{var o;return s===((o=n.extensions)==null?void 0:o[i])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?ub.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,s)=>r===e[s]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function hb(t={},e=[]){const n=C.useRef(t);n.current=t;const[r]=C.useState(()=>new _E(n)),s=ig.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return C.useDebugValue(s),C.useEffect(r.onRender(e)),TE({editor:s,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),s}var RE=C.createContext({editor:null});RE.Consumer;var fb=C.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),OE=()=>C.useContext(fb),Iu=C.forwardRef((t,e)=>{const{onDragStart:n}=OE(),r=t.as||"div";return m.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function pp(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function mp(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function DE(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function LE(t){if(pp(t)||mp(t))return!0;if(DE(t)){const e=t.type;if(e)return pp(e)||mp(e)}return!1}function IE(){try{if(C.version)return parseInt(C.version.split(".")[0],10)>=19}catch{}return!1}var pb=class{constructor(t,{editor:e,props:n={},as:r="div",className:s=""}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=e,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),s&&this.element.classList.add(...s.split(" ")),this.editor.isInitialized?tu.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.render()})}render(){var t;const e=this.component,n=this.props,r=this.editor,s=IE(),i=LE(e),o={...n};o.ref&&!(s||i)&&delete o.ref,!o.ref&&(s||i)&&(o.ref=l=>{this.ref=l}),this.reactElement=m.jsx(e,{...o}),(t=r?.contentComponent)==null||t.setRenderer(this.id,this)}updateProps(t={}){this.props={...this.props,...t},this.render()}destroy(){var t;const e=this.editor;(t=e?.contentComponent)==null||t.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(t){Object.keys(t).forEach(e=>{this.element.setAttribute(e,t[e])})}};C.createContext({markViewContentRef:()=>{}});var jE=class extends fE{constructor(t,e,n){if(super(t,e,n),!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");if(!r)return;r.appendChild(this.contentDOMElement)}}mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(a={})=>this.updateAttributes(a),deleteNode:()=>this.deleteNode(),ref:C.createRef()};if(!this.component.displayName){const a=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=a(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:a=>{a&&this.contentDOMElement&&a.firstChild!==this.contentDOMElement&&(a.hasAttribute("data-node-view-wrapper")&&a.removeAttribute("data-node-view-wrapper"),a.appendChild(this.contentDOMElement))}},s=this.component,i=C.memo(a=>m.jsx(fb.Provider,{value:r,children:C.createElement(s,a)}));i.displayName="ReactNodeView";let o=this.node.isInline?"span":"div";this.options.as&&(o=this.options.as);const{className:l=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new pb(i,{editor:this.editor,props:t,as:o,className:`node-${this.node.type.name} ${l}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var t;if(this.renderer.element.firstElementChild&&!((t=this.renderer.element.firstElementChild)!=null&&t.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){const{from:t,to:e}=this.editor.state.selection,n=this.getPos();if(typeof n=="number")if(t<=n&&e>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(t,e,n){const r=s=>{this.renderer.updateProps(s),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const s=this.node,i=this.decorations,o=this.innerDecorations;return this.node=t,this.decorations=e,this.innerDecorations=n,this.options.update({oldNode:s,oldDecorations:i,newNode:t,newDecorations:e,oldInnerDecorations:o,innerDecorations:n,updateProps:()=>r({node:t,decorations:e,innerDecorations:n})})}return t===this.node&&this.decorations===e&&this.innerDecorations===n||(this.node=t,this.decorations=e,this.innerDecorations=n,r({node:t,decorations:e,innerDecorations:n})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,n=mi(this.node,e);t=this.options.attrs({node:this.node,HTMLAttributes:n})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function ju(t,e){return n=>n.editor.contentComponent?new jE(t,n,e):{}}const gs=Math.min,Nt=Math.max,sl=Math.round,go=Math.floor,ln=t=>({x:t,y:t}),PE={left:"right",right:"left",bottom:"top",top:"bottom"},BE={start:"end",end:"start"};function gp(t,e,n){return Nt(t,gs(e,n))}function ji(t,e){return typeof t=="function"?t(e):t}function ir(t){return t.split("-")[0]}function Pi(t){return t.split("-")[1]}function mb(t){return t==="x"?"y":"x"}function gb(t){return t==="y"?"height":"width"}const $E=new Set(["top","bottom"]);function En(t){return $E.has(ir(t))?"y":"x"}function yb(t){return mb(En(t))}function HE(t,e,n){n===void 0&&(n=!1);const r=Pi(t),s=yb(t),i=gb(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=il(o)),[o,il(o)]}function zE(t){const e=il(t);return[cd(t),e,cd(e)]}function cd(t){return t.replace(/start|end/g,e=>BE[e])}const yp=["left","right"],bp=["right","left"],FE=["top","bottom"],UE=["bottom","top"];function VE(t,e,n){switch(t){case"top":case"bottom":return n?e?bp:yp:e?yp:bp;case"left":case"right":return e?FE:UE;default:return[]}}function WE(t,e,n,r){const s=Pi(t);let i=VE(ir(t),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),e&&(i=i.concat(i.map(cd)))),i}function il(t){return t.replace(/left|right|bottom|top/g,e=>PE[e])}function qE(t){return{top:0,right:0,bottom:0,left:0,...t}}function KE(t){return typeof t!="number"?qE(t):{top:t,right:t,bottom:t,left:t}}function ol(t){const{x:e,y:n,width:r,height:s}=t;return{width:r,height:s,top:n,left:e,right:e+r,bottom:n+s,x:e,y:n}}function xp(t,e,n){let{reference:r,floating:s}=t;const i=En(e),o=yb(e),l=gb(o),a=ir(e),c=i==="y",d=r.x+r.width/2-s.width/2,u=r.y+r.height/2-s.height/2,h=r[l]/2-s[l]/2;let f;switch(a){case"top":f={x:d,y:r.y-s.height};break;case"bottom":f={x:d,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:u};break;case"left":f={x:r.x-s.width,y:u};break;default:f={x:r.x,y:r.y}}switch(Pi(e)){case"start":f[o]-=h*(n&&c?-1:1);break;case"end":f[o]+=h*(n&&c?-1:1);break}return f}const GE=async(t,e,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,l=i.filter(Boolean),a=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:t,floating:e,strategy:s}),{x:d,y:u}=xp(c,r,a),h=r,f={},p=0;for(let g=0;g<l.length;g++){const{name:y,fn:b}=l[g],{x:w,y:M,data:S,reset:A}=await b({x:d,y:u,initialPlacement:r,placement:h,strategy:s,middlewareData:f,rects:c,platform:o,elements:{reference:t,floating:e}});d=w??d,u=M??u,f={...f,[y]:{...f[y],...S}},A&&p<=50&&(p++,typeof A=="object"&&(A.placement&&(h=A.placement),A.rects&&(c=A.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:s}):A.rects),{x:d,y:u}=xp(c,h,a)),g=-1)}return{x:d,y:u,placement:h,strategy:s,middlewareData:f}};async function Pu(t,e){var n;e===void 0&&(e={});const{x:r,y:s,platform:i,rects:o,elements:l,strategy:a}=t,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:h=!1,padding:f=0}=ji(e,t),p=KE(f),y=l[h?u==="floating"?"reference":"floating":u],b=ol(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:c,rootBoundary:d,strategy:a})),w=u==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,M=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),S=await(i.isElement==null?void 0:i.isElement(M))?await(i.getScale==null?void 0:i.getScale(M))||{x:1,y:1}:{x:1,y:1},A=ol(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:w,offsetParent:M,strategy:a}):w);return{top:(b.top-A.top+p.top)/S.y,bottom:(A.bottom-b.bottom+p.bottom)/S.y,left:(b.left-A.left+p.left)/S.x,right:(A.right-b.right+p.right)/S.x}}const JE=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:s,middlewareData:i,rects:o,initialPlacement:l,platform:a,elements:c}=e,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:h,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...y}=ji(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=ir(s),w=En(l),M=ir(l)===l,S=await(a.isRTL==null?void 0:a.isRTL(c.floating)),A=h||(M||!g?[il(l)]:zE(l)),x=p!=="none";!h&&x&&A.push(...WE(l,g,p,S));const k=[l,...A],v=await Pu(e,y),T=[];let N=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&T.push(v[b]),u){const I=HE(s,o,S);T.push(v[I[0]],v[I[1]])}if(N=[...N,{placement:s,overflows:T}],!T.every(I=>I<=0)){var H,V;const I=(((H=i.flip)==null?void 0:H.index)||0)+1,j=k[I];if(j&&(!(u==="alignment"?w!==En(j):!1)||N.every(F=>En(F.placement)===w?F.overflows[0]>0:!0)))return{data:{index:I,overflows:N},reset:{placement:j}};let Q=(V=N.filter(ie=>ie.overflows[0]<=0).sort((ie,F)=>ie.overflows[1]-F.overflows[1])[0])==null?void 0:V.placement;if(!Q)switch(f){case"bestFit":{var $;const ie=($=N.filter(F=>{if(x){const ue=En(F.placement);return ue===w||ue==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(ue=>ue>0).reduce((ue,xe)=>ue+xe,0)]).sort((F,ue)=>F[1]-ue[1])[0])==null?void 0:$[0];ie&&(Q=ie);break}case"initialPlacement":Q=l;break}if(s!==Q)return{reset:{placement:Q}}}return{}}}},YE=new Set(["left","top"]);async function XE(t,e){const{placement:n,platform:r,elements:s}=t,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=ir(n),l=Pi(n),a=En(n)==="y",c=YE.has(o)?-1:1,d=i&&a?-1:1,u=ji(e,t);let{mainAxis:h,crossAxis:f,alignmentAxis:p}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return l&&typeof p=="number"&&(f=l==="end"?p*-1:p),a?{x:f*d,y:h*c}:{x:h*c,y:f*d}}const ZE=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:s,y:i,placement:o,middlewareData:l}=e,a=await XE(e,t);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+a.x,y:i+a.y,data:{...a,placement:o}}}}},QE=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:s}=e,{mainAxis:i=!0,crossAxis:o=!1,limiter:l={fn:y=>{let{x:b,y:w}=y;return{x:b,y:w}}},...a}=ji(t,e),c={x:n,y:r},d=await Pu(e,a),u=En(ir(s)),h=mb(u);let f=c[h],p=c[u];if(i){const y=h==="y"?"top":"left",b=h==="y"?"bottom":"right",w=f+d[y],M=f-d[b];f=gp(w,f,M)}if(o){const y=u==="y"?"top":"left",b=u==="y"?"bottom":"right",w=p+d[y],M=p-d[b];p=gp(w,p,M)}const g=l.fn({...e,[h]:f,[u]:p});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[h]:i,[u]:o}}}}}},eM=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:s,rects:i,platform:o,elements:l}=e,{apply:a=()=>{},...c}=ji(t,e),d=await Pu(e,c),u=ir(s),h=Pi(s),f=En(s)==="y",{width:p,height:g}=i.floating;let y,b;u==="top"||u==="bottom"?(y=u,b=h===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(b=u,y=h==="end"?"top":"bottom");const w=g-d.top-d.bottom,M=p-d.left-d.right,S=gs(g-d[y],w),A=gs(p-d[b],M),x=!e.middlewareData.shift;let k=S,v=A;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(v=M),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(k=w),x&&!h){const N=Nt(d.left,0),H=Nt(d.right,0),V=Nt(d.top,0),$=Nt(d.bottom,0);f?v=p-2*(N!==0||H!==0?N+H:Nt(d.left,d.right)):k=g-2*(V!==0||$!==0?V+$:Nt(d.top,d.bottom))}await a({...e,availableWidth:v,availableHeight:k});const T=await o.getDimensions(l.floating);return p!==T.width||g!==T.height?{reset:{rects:!0}}:{}}}};function ua(){return typeof window<"u"}function Es(t){return bb(t)?(t.nodeName||"").toLowerCase():"#document"}function Ot(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function hn(t){var e;return(e=(bb(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function bb(t){return ua()?t instanceof Node||t instanceof Ot(t).Node:!1}function ut(t){return ua()?t instanceof Element||t instanceof Ot(t).Element:!1}function un(t){return ua()?t instanceof HTMLElement||t instanceof Ot(t).HTMLElement:!1}function wp(t){return!ua()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Ot(t).ShadowRoot}const tM=new Set(["inline","contents"]);function Bi(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=Jt(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!tM.has(s)}const nM=new Set(["table","td","th"]);function rM(t){return nM.has(Es(t))}const sM=[":popover-open",":modal"];function ha(t){return sM.some(e=>{try{return t.matches(e)}catch{return!1}})}const iM=["transform","translate","scale","rotate","perspective"],oM=["transform","translate","scale","rotate","perspective","filter"],lM=["paint","layout","strict","content"];function Bu(t){const e=$u(),n=ut(t)?Jt(t):t;return iM.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||oM.some(r=>(n.willChange||"").includes(r))||lM.some(r=>(n.contain||"").includes(r))}function aM(t){let e=or(t);for(;un(e)&&!ys(e);){if(Bu(e))return e;if(ha(e))return null;e=or(e)}return null}function $u(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const cM=new Set(["html","body","#document"]);function ys(t){return cM.has(Es(t))}function Jt(t){return Ot(t).getComputedStyle(t)}function fa(t){return ut(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function or(t){if(Es(t)==="html")return t;const e=t.assignedSlot||t.parentNode||wp(t)&&t.host||hn(t);return wp(e)?e.host:e}function xb(t){const e=or(t);return ys(e)?t.ownerDocument?t.ownerDocument.body:t.body:un(e)&&Bi(e)?e:xb(e)}function gi(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=xb(t),i=s===((r=t.ownerDocument)==null?void 0:r.body),o=Ot(s);if(i){const l=dd(o);return e.concat(o,o.visualViewport||[],Bi(s)?s:[],l&&n?gi(l):[])}return e.concat(s,gi(s,[],n))}function dd(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function wb(t){const e=Jt(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=un(t),i=s?t.offsetWidth:n,o=s?t.offsetHeight:r,l=sl(n)!==i||sl(r)!==o;return l&&(n=i,r=o),{width:n,height:r,$:l}}function Hu(t){return ut(t)?t:t.contextElement}function is(t){const e=Hu(t);if(!un(e))return ln(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:i}=wb(e);let o=(i?sl(n.width):n.width)/r,l=(i?sl(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const dM=ln(0);function kb(t){const e=Ot(t);return!$u()||!e.visualViewport?dM:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function uM(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Ot(t)?!1:e}function Ir(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=Hu(t);let o=ln(1);e&&(r?ut(r)&&(o=is(r)):o=is(t));const l=uM(i,n,r)?kb(i):ln(0);let a=(s.left+l.x)/o.x,c=(s.top+l.y)/o.y,d=s.width/o.x,u=s.height/o.y;if(i){const h=Ot(i),f=r&&ut(r)?Ot(r):r;let p=h,g=dd(p);for(;g&&r&&f!==p;){const y=is(g),b=g.getBoundingClientRect(),w=Jt(g),M=b.left+(g.clientLeft+parseFloat(w.paddingLeft))*y.x,S=b.top+(g.clientTop+parseFloat(w.paddingTop))*y.y;a*=y.x,c*=y.y,d*=y.x,u*=y.y,a+=M,c+=S,p=Ot(g),g=dd(p)}}return ol({width:d,height:u,x:a,y:c})}function pa(t,e){const n=fa(t).scrollLeft;return e?e.left+n:Ir(hn(t)).left+n}function vb(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-pa(t,n),s=n.top+e.scrollTop;return{x:r,y:s}}function hM(t){let{elements:e,rect:n,offsetParent:r,strategy:s}=t;const i=s==="fixed",o=hn(r),l=e?ha(e.floating):!1;if(r===o||l&&i)return n;let a={scrollLeft:0,scrollTop:0},c=ln(1);const d=ln(0),u=un(r);if((u||!u&&!i)&&((Es(r)!=="body"||Bi(o))&&(a=fa(r)),un(r))){const f=Ir(r);c=is(r),d.x=f.x+r.clientLeft,d.y=f.y+r.clientTop}const h=o&&!u&&!i?vb(o,a):ln(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+d.x+h.x,y:n.y*c.y-a.scrollTop*c.y+d.y+h.y}}function fM(t){return Array.from(t.getClientRects())}function pM(t){const e=hn(t),n=fa(t),r=t.ownerDocument.body,s=Nt(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=Nt(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+pa(t);const l=-n.scrollTop;return Jt(r).direction==="rtl"&&(o+=Nt(e.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:l}}const kp=25;function mM(t,e){const n=Ot(t),r=hn(t),s=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,l=0,a=0;if(s){i=s.width,o=s.height;const d=$u();(!d||d&&e==="fixed")&&(l=s.offsetLeft,a=s.offsetTop)}const c=pa(r);if(c<=0){const d=r.ownerDocument,u=d.body,h=getComputedStyle(u),f=d.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,p=Math.abs(r.clientWidth-u.clientWidth-f);p<=kp&&(i-=p)}else c<=kp&&(i+=c);return{width:i,height:o,x:l,y:a}}const gM=new Set(["absolute","fixed"]);function yM(t,e){const n=Ir(t,!0,e==="fixed"),r=n.top+t.clientTop,s=n.left+t.clientLeft,i=un(t)?is(t):ln(1),o=t.clientWidth*i.x,l=t.clientHeight*i.y,a=s*i.x,c=r*i.y;return{width:o,height:l,x:a,y:c}}function vp(t,e,n){let r;if(e==="viewport")r=mM(t,n);else if(e==="document")r=pM(hn(t));else if(ut(e))r=yM(e,n);else{const s=kb(t);r={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return ol(r)}function Sb(t,e){const n=or(t);return n===e||!ut(n)||ys(n)?!1:Jt(n).position==="fixed"||Sb(n,e)}function bM(t,e){const n=e.get(t);if(n)return n;let r=gi(t,[],!1).filter(l=>ut(l)&&Es(l)!=="body"),s=null;const i=Jt(t).position==="fixed";let o=i?or(t):t;for(;ut(o)&&!ys(o);){const l=Jt(o),a=Bu(o);!a&&l.position==="fixed"&&(s=null),(i?!a&&!s:!a&&l.position==="static"&&!!s&&gM.has(s.position)||Bi(o)&&!a&&Sb(t,o))?r=r.filter(d=>d!==o):s=l,o=or(o)}return e.set(t,r),r}function xM(t){let{element:e,boundary:n,rootBoundary:r,strategy:s}=t;const o=[...n==="clippingAncestors"?ha(e)?[]:bM(e,this._c):[].concat(n),r],l=o[0],a=o.reduce((c,d)=>{const u=vp(e,d,s);return c.top=Nt(u.top,c.top),c.right=gs(u.right,c.right),c.bottom=gs(u.bottom,c.bottom),c.left=Nt(u.left,c.left),c},vp(e,l,s));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function wM(t){const{width:e,height:n}=wb(t);return{width:e,height:n}}function kM(t,e,n){const r=un(e),s=hn(e),i=n==="fixed",o=Ir(t,!0,i,e);let l={scrollLeft:0,scrollTop:0};const a=ln(0);function c(){a.x=pa(s)}if(r||!r&&!i)if((Es(e)!=="body"||Bi(s))&&(l=fa(e)),r){const f=Ir(e,!0,i,e);a.x=f.x+e.clientLeft,a.y=f.y+e.clientTop}else s&&c();i&&!r&&s&&c();const d=s&&!r&&!i?vb(s,l):ln(0),u=o.left+l.scrollLeft-a.x-d.x,h=o.top+l.scrollTop-a.y-d.y;return{x:u,y:h,width:o.width,height:o.height}}function pc(t){return Jt(t).position==="static"}function Sp(t,e){if(!un(t)||Jt(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return hn(t)===n&&(n=n.ownerDocument.body),n}function Cb(t,e){const n=Ot(t);if(ha(t))return n;if(!un(t)){let s=or(t);for(;s&&!ys(s);){if(ut(s)&&!pc(s))return s;s=or(s)}return n}let r=Sp(t,e);for(;r&&rM(r)&&pc(r);)r=Sp(r,e);return r&&ys(r)&&pc(r)&&!Bu(r)?n:r||aM(t)||n}const vM=async function(t){const e=this.getOffsetParent||Cb,n=this.getDimensions,r=await n(t.floating);return{reference:kM(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function SM(t){return Jt(t).direction==="rtl"}const CM={convertOffsetParentRelativeRectToViewportRelativeRect:hM,getDocumentElement:hn,getClippingRect:xM,getOffsetParent:Cb,getElementRects:vM,getClientRects:fM,getDimensions:wM,getScale:is,isElement:ut,isRTL:SM};function Eb(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function EM(t,e){let n=null,r;const s=hn(t);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),i();const c=t.getBoundingClientRect(),{left:d,top:u,width:h,height:f}=c;if(l||e(),!h||!f)return;const p=go(u),g=go(s.clientWidth-(d+h)),y=go(s.clientHeight-(u+f)),b=go(d),M={rootMargin:-p+"px "+-g+"px "+-y+"px "+-b+"px",threshold:Nt(0,gs(1,a))||1};let S=!0;function A(x){const k=x[0].intersectionRatio;if(k!==a){if(!S)return o();k?o(!1,k):r=setTimeout(()=>{o(!1,1e-7)},1e3)}k===1&&!Eb(c,t.getBoundingClientRect())&&o(),S=!1}try{n=new IntersectionObserver(A,{...M,root:s.ownerDocument})}catch{n=new IntersectionObserver(A,M)}n.observe(t)}return o(!0),i}function Ms(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,c=Hu(t),d=s||i?[...c?gi(c):[],...gi(e)]:[];d.forEach(b=>{s&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const u=c&&l?EM(c,n):null;let h=-1,f=null;o&&(f=new ResizeObserver(b=>{let[w]=b;w&&w.target===c&&f&&(f.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var M;(M=f)==null||M.observe(e)})),n()}),c&&!a&&f.observe(c),f.observe(e));let p,g=a?Ir(t):null;a&&y();function y(){const b=Ir(t);g&&!Eb(g,b)&&n(),g=b,p=requestAnimationFrame(y)}return n(),()=>{var b;d.forEach(w=>{s&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),u?.(),(b=f)==null||b.disconnect(),f=null,a&&cancelAnimationFrame(p)}}const zu=ZE,Mb=QE,Ab=JE,Tb=eM,Fu=(t,e,n)=>{const r=new Map,s={platform:CM,...n},i={...s.platform,_c:r};return GE(t,e,{...s,platform:i})};var ll=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},MM=/^\s*>\s$/,Nb=De.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return ll("blockquote",{...be(this.options.HTMLAttributes,t),children:ll("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=[];return t.content.forEach(s=>{const o=e.renderChildren(s).split(`
|
|
153
105
|
`).map(l=>`> ${l}`).join(`
|
|
154
106
|
`);n.push(o)}),n.flatMap(s=>[s,"> "]).slice(0,-1).join(`
|
|
155
107
|
`)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[ms({find:MM,type:this.type})]}}),AM=Nb,TM=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,NM=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,_M=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,RM=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,OM=Zt.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return ll("strong",{...be(this.options.HTMLAttributes,t),children:ll("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Lr({find:TM,type:this.type}),Lr({find:_M,type:this.type})]},addPasteRules(){return[sr({find:NM,type:this.type}),sr({find:RM,type:this.type})]}}),DM=/(^|[^`])`([^`]+)`(?!`)$/,LM=/(^|[^`])`([^`]+)`(?!`)/g,IM=Zt.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",be(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Lr({find:DM,type:this.type})]},addPasteRules(){return[sr({find:LM,type:this.type})]}}),mc=4,jM=/^```([a-z]+)?[\s\n]$/,PM=/^~~~([a-z]+)?[\s\n]$/,_b=De.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:mc,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const i=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",be(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const s=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${s}`,e.renderChildren(t.content),"```"].join(`
|
|
@@ -196,297 +148,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),Je=L,Me=Y),he===void 0
|
|
|
196
148
|
`,(d?i.slice(1):i).forEach(p=>{u+=`| ${new Array(o).fill(0).map((g,y)=>a(p[y]&&p[y].text||"",l[y])).join(" | ")} |
|
|
197
149
|
`}),u}var wN=xN,M0=De.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:hN,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:s}=fN(t,this.options.cellMinWidth),i=["table",be(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${s}`}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},i]:i},parseMarkdown:(t,e)=>{const n=[];if(t.header){const r=[];t.header.forEach(s=>{r.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(s.tokens)}]))}),n.push(e.createNode("tableRow",{},r))}return t.rows&&t.rows.forEach(r=>{const s=[];r.forEach(i=>{s.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),n.push(e.createNode("tableRow",{},s))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>wN(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:s,editor:i})=>{const o=mN(i.schema,t,e,n);if(s){const l=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(J.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>_T(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>RT(t,e),deleteColumn:()=>({state:t,dispatch:e})=>DT(t,e),addRowBefore:()=>({state:t,dispatch:e})=>IT(t,e),addRowAfter:()=>({state:t,dispatch:e})=>jT(t,e),deleteRow:()=>({state:t,dispatch:e})=>BT(t,e),deleteTable:()=>({state:t,dispatch:e})=>WT(t,e),mergeCells:()=>({state:t,dispatch:e})=>Up(t,e),splitCell:()=>({state:t,dispatch:e})=>Vp(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>xi("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>xi("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>UT(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Up(t,e)?!0:Vp(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>zT(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>qp(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>qp(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&b0(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=Te.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Co,"Mod-Backspace":Co,Delete:Co,"Mod-Delete":Co}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[tN({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],uN({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:we(G(t,"tableRole",e))}}});de.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(M0.configure(this.options.table)),this.options.tableCell!==!1&&t.push(S0.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(C0.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(E0.configure(this.options.tableRow)),t}});var kN=E0,vN=C0,SN=S0,CN=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,EN=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,MN=Zt.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",be(this.options.HTMLAttributes,t),0]},renderMarkdown:(t,e)=>`==${e.renderChildren(t)}==`,parseMarkdown:(t,e)=>e.applyMark("highlight",e.parseInline(t.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:t=>t.indexOf("=="),tokenize(t,e,n){const s=/^(==)([^=]+)(==)/.exec(t);if(s){const i=s[2].trim(),o=n.inlineTokens(i);return{type:"highlight",raw:s[0],text:i,tokens:o}}}},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Lr({find:CN,type:this.type})]},addPasteRules(){return[sr({find:EN,type:this.type})]}}),AN=MN,TN=Zt.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",be(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),NN=TN,_N=Zt.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",be(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),RN=_N,ON=de.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),DN=ON,LN=20,A0=(t,e=0)=>{const n=[];return!t.children.length||e>LN||Array.from(t.children).forEach(r=>{r.tagName==="SPAN"?n.push(r):r.children.length&&n.push(...A0(r,e+1))}),n},IN=t=>{if(!t.children.length)return;const e=A0(t);e&&e.forEach(n=>{var r,s;const i=n.getAttribute("style"),o=(s=(r=n.parentElement)==null?void 0:r.closest("span"))==null?void 0:s.getAttribute("style");n.setAttribute("style",`${o};${i}`)})},jN=Zt.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&IN(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",be(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,r)=>{if(n.isTextblock)return!0;n.marks.filter(s=>s.type===this.type).some(s=>Object.values(s.attrs).some(i=>!!i))||t.removeMark(r,r+n.nodeSize,this.type)}),!0}}}}),PN=de.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const n=t.getAttribute("style");if(n){const r=n.split(";").map(s=>s.trim()).filter(Boolean);for(let s=r.length-1;s>=0;s-=1){const i=r[s].split(":");if(i.length>=2){const o=i[0].trim().toLowerCase(),l=i.slice(1).join(":").trim();if(o==="background-color")return l.replace(/['"]+/g,"")}}}return(e=t.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),BN=de.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const n=t.getAttribute("style");if(n){const r=n.split(";").map(s=>s.trim()).filter(Boolean);for(let s=r.length-1;s>=0;s-=1){const i=r[s].split(":");if(i.length>=2){const o=i[0].trim().toLowerCase(),l=i.slice(1).join(":").trim();if(o==="color")return l.replace(/['"]+/g,"")}}}return(e=t.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),$N=de.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),HN=de.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize,renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),zN=de.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight,renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}}),FN=de.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(PN.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(BN.configure(this.options.color)),this.options.fontFamily!==!1&&t.push($N.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(HN.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(zN.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(jN.configure(this.options.textStyle)),t}}),UN=QA,VN=t=>Be({find:/--$/,replace:t??"—"}),WN=t=>Be({find:/\.\.\.$/,replace:t??"…"}),qN=t=>Be({find:/(?:^|[\s{[(<'"\u2018\u201C])(")$/,replace:t??"“"}),KN=t=>Be({find:/"$/,replace:t??"”"}),GN=t=>Be({find:/(?:^|[\s{[(<'"\u2018\u201C])(')$/,replace:t??"‘"}),JN=t=>Be({find:/'$/,replace:t??"’"}),YN=t=>Be({find:/<-$/,replace:t??"←"}),XN=t=>Be({find:/->$/,replace:t??"→"}),ZN=t=>Be({find:/\(c\)$/,replace:t??"©"}),QN=t=>Be({find:/\(tm\)$/,replace:t??"™"}),e_=t=>Be({find:/\(sm\)$/,replace:t??"℠"}),t_=t=>Be({find:/\(r\)$/,replace:t??"®"}),n_=t=>Be({find:/(?:^|\s)(1\/2)\s$/,replace:t??"½"}),r_=t=>Be({find:/\+\/-$/,replace:t??"±"}),s_=t=>Be({find:/!=$/,replace:t??"≠"}),i_=t=>Be({find:/<<$/,replace:t??"«"}),o_=t=>Be({find:/>>$/,replace:t??"»"}),l_=t=>Be({find:/\d+\s?([*x])\s?\d+$/,replace:t??"×"}),a_=t=>Be({find:/\^2$/,replace:t??"²"}),c_=t=>Be({find:/\^3$/,replace:t??"³"}),d_=t=>Be({find:/(?:^|\s)(1\/4)\s$/,replace:t??"¼"}),u_=t=>Be({find:/(?:^|\s)(3\/4)\s$/,replace:t??"¾"}),h_=de.create({name:"typography",addOptions(){return{closeDoubleQuote:"”",closeSingleQuote:"’",copyright:"©",ellipsis:"…",emDash:"—",laquo:"«",leftArrow:"←",multiplication:"×",notEqual:"≠",oneHalf:"½",oneQuarter:"¼",openDoubleQuote:"“",openSingleQuote:"‘",plusMinus:"±",raquo:"»",registeredTrademark:"®",rightArrow:"→",servicemark:"℠",superscriptThree:"³",superscriptTwo:"²",threeQuarters:"¾",trademark:"™"}},addInputRules(){const t=[];return this.options.emDash!==!1&&t.push(VN(this.options.emDash)),this.options.ellipsis!==!1&&t.push(WN(this.options.ellipsis)),this.options.openDoubleQuote!==!1&&t.push(qN(this.options.openDoubleQuote)),this.options.closeDoubleQuote!==!1&&t.push(KN(this.options.closeDoubleQuote)),this.options.openSingleQuote!==!1&&t.push(GN(this.options.openSingleQuote)),this.options.closeSingleQuote!==!1&&t.push(JN(this.options.closeSingleQuote)),this.options.leftArrow!==!1&&t.push(YN(this.options.leftArrow)),this.options.rightArrow!==!1&&t.push(XN(this.options.rightArrow)),this.options.copyright!==!1&&t.push(ZN(this.options.copyright)),this.options.trademark!==!1&&t.push(QN(this.options.trademark)),this.options.servicemark!==!1&&t.push(e_(this.options.servicemark)),this.options.registeredTrademark!==!1&&t.push(t_(this.options.registeredTrademark)),this.options.oneHalf!==!1&&t.push(n_(this.options.oneHalf)),this.options.plusMinus!==!1&&t.push(r_(this.options.plusMinus)),this.options.notEqual!==!1&&t.push(s_(this.options.notEqual)),this.options.laquo!==!1&&t.push(i_(this.options.laquo)),this.options.raquo!==!1&&t.push(o_(this.options.raquo)),this.options.multiplication!==!1&&t.push(l_(this.options.multiplication)),this.options.superscriptTwo!==!1&&t.push(a_(this.options.superscriptTwo)),this.options.superscriptThree!==!1&&t.push(c_(this.options.superscriptThree)),this.options.oneQuarter!==!1&&t.push(d_(this.options.oneQuarter)),this.options.threeQuarters!==!1&&t.push(u_(this.options.threeQuarters)),t}}),f_=h_,p_=o0,m_=l0;const Kt=()=>new Map,Ad=t=>{const e=Kt();return t.forEach((n,r)=>{e.set(r,n)}),e},On=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r},g_=(t,e)=>{const n=[];for(const[r,s]of t)n.push(e(s,r));return n},y_=(t,e)=>{for(const[n,r]of t)if(e(r,n))return!0;return!1},Pr=()=>new Set,Ac=t=>t[t.length-1],b_=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},Br=Array.from,x_=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},Td=Array.isArray;class T0{constructor(){this._observers=Kt()}on(e,n){return On(this._observers,e,Pr).add(n),n}once(e,n){const r=(...s)=>{this.off(e,r),n(...s)};this.on(e,r)}off(e,n){const r=this._observers.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e))}emit(e,n){return Br((this._observers.get(e)||Kt()).values()).forEach(r=>r(...n))}destroy(){this._observers=Kt()}}const _n=Math.floor,$o=Math.abs,bs=(t,e)=>t<e?t:e,lr=(t,e)=>t>e?t:e,N0=t=>t!==0?t<0:1/t<0,nm=1,rm=2,Tc=4,Nc=8,wi=32,Tn=64,yt=128,w_=1<<29,ya=31,Nd=63,Tr=127,k_=2147483647,_0=Number.MAX_SAFE_INTEGER,v_=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&_n(t)===t),S_=String.fromCharCode,C_=t=>t.toLowerCase(),E_=/^\s*/g,M_=t=>t.replace(E_,""),A_=/([A-Z])/g,sm=(t,e)=>M_(t.replace(A_,n=>`${e}${C_(n)}`)),T_=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let s=0;s<n;s++)r[s]=e.codePointAt(s);return r},ki=typeof TextEncoder<"u"?new TextEncoder:null,N_=t=>ki.encode(t),__=ki?N_:T_;let ti=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});ti&&ti.decode(new Uint8Array).length===1&&(ti=null);class Hi{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const zi=()=>new Hi,R_=t=>{const e=zi();return t(e),qt(e)},O_=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},qt=t=>{const e=new Uint8Array(O_(t));let n=0;for(let r=0;r<t.bufs.length;r++){const s=t.bufs[r];e.set(s,n),n+=s.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},D_=(t,e)=>{const n=t.cbuf.length;n-t.cpos<e&&(t.bufs.push(new Uint8Array(t.cbuf.buffer,0,t.cpos)),t.cbuf=new Uint8Array(lr(n,e)*2),t.cpos=0)},Xe=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},_d=Xe,me=(t,e)=>{for(;e>Tr;)Xe(t,yt|Tr&e),e=_n(e/128);Xe(t,Tr&e)},rh=(t,e)=>{const n=N0(e);for(n&&(e=-e),Xe(t,(e>Nd?yt:0)|(n?Tn:0)|Nd&e),e=_n(e/64);e>0;)Xe(t,(e>Tr?yt:0)|Tr&e),e=_n(e/128)},Rd=new Uint8Array(3e4),L_=Rd.length/3,I_=(t,e)=>{if(e.length<L_){const n=ki.encodeInto(e,Rd).written||0;me(t,n);for(let r=0;r<n;r++)Xe(t,Rd[r])}else Tt(t,__(e))},j_=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;me(t,r);for(let s=0;s<r;s++)Xe(t,n.codePointAt(s))},ls=ki&&ki.encodeInto?I_:j_,ba=(t,e)=>{const n=t.cbuf.length,r=t.cpos,s=bs(n-r,e.length),i=e.length-s;t.cbuf.set(e.subarray(0,s),r),t.cpos+=s,i>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(lr(n*2,i)),t.cbuf.set(e.subarray(s)),t.cpos=i)},Tt=(t,e)=>{me(t,e.byteLength),ba(t,e)},sh=(t,e)=>{D_(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},P_=(t,e)=>sh(t,4).setFloat32(0,e,!1),B_=(t,e)=>sh(t,8).setFloat64(0,e,!1),$_=(t,e)=>sh(t,8).setBigInt64(0,e,!1),im=new DataView(new ArrayBuffer(4)),H_=t=>(im.setFloat32(0,t),im.getFloat32(0)===t),xs=(t,e)=>{switch(typeof e){case"string":Xe(t,119),ls(t,e);break;case"number":v_(e)&&$o(e)<=k_?(Xe(t,125),rh(t,e)):H_(e)?(Xe(t,124),P_(t,e)):(Xe(t,123),B_(t,e));break;case"bigint":Xe(t,122),$_(t,e);break;case"object":if(e===null)Xe(t,126);else if(Td(e)){Xe(t,117),me(t,e.length);for(let n=0;n<e.length;n++)xs(t,e[n])}else if(e instanceof Uint8Array)Xe(t,116),Tt(t,e);else{Xe(t,118);const n=Object.keys(e);me(t,n.length);for(let r=0;r<n.length;r++){const s=n[r];ls(t,s),xs(t,e[s])}}break;case"boolean":Xe(t,e?120:121);break;default:Xe(t,127)}};class om extends Hi{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&me(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const lm=t=>{t.count>0&&(rh(t.encoder,t.count===1?t.s:-t.s),t.count>1&&me(t.encoder,t.count-2))};class Ho{constructor(){this.encoder=new Hi,this.s=0,this.count=0}write(e){this.s===e?this.count++:(lm(this),this.count=1,this.s=e)}toUint8Array(){return lm(this),qt(this.encoder)}}const am=t=>{if(t.count>0){const e=t.diff*2+(t.count===1?0:1);rh(t.encoder,e),t.count>1&&me(t.encoder,t.count-2)}};class _c{constructor(){this.encoder=new Hi,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(am(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return am(this),qt(this.encoder)}}class z_{constructor(){this.sarr=[],this.s="",this.lensE=new Ho}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new Hi;return this.sarr.push(this.s),this.s="",ls(e,this.sarr.join("")),ba(e,this.lensE.toUint8Array()),qt(e)}}const ar=t=>new Error(t),Gt=()=>{throw ar("Method unimplemented")},Mt=()=>{throw ar("Unexpected case")},R0=ar("Unexpected end of array"),O0=ar("Integer out of Range");class xa{constructor(e){this.arr=e,this.pos=0}}const ih=t=>new xa(t),F_=t=>t.pos!==t.arr.length,U_=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},It=t=>U_(t,Re(t)),vi=t=>t.arr[t.pos++],Re=t=>{let e=0,n=1;const r=t.arr.length;for(;t.pos<r;){const s=t.arr[t.pos++];if(e=e+(s&Tr)*n,n*=128,s<yt)return e;if(e>_0)throw O0}throw R0},oh=t=>{let e=t.arr[t.pos++],n=e&Nd,r=64;const s=(e&Tn)>0?-1:1;if((e&yt)===0)return s*n;const i=t.arr.length;for(;t.pos<i;){if(e=t.arr[t.pos++],n=n+(e&Tr)*r,r*=128,e<yt)return s*n;if(n>_0)throw O0}throw R0},V_=t=>{let e=Re(t);if(e===0)return"";{let n=String.fromCodePoint(vi(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(vi(t));else for(;e>0;){const r=e<1e4?e:1e4,s=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,n+=String.fromCodePoint.apply(null,s),e-=r}return decodeURIComponent(escape(n))}},W_=t=>ti.decode(It(t)),Od=ti?W_:V_,lh=(t,e)=>{const n=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,n},q_=t=>lh(t,4).getFloat32(0,!1),K_=t=>lh(t,8).getFloat64(0,!1),G_=t=>lh(t,8).getBigInt64(0,!1),J_=[t=>{},t=>null,oh,q_,K_,G_,t=>!1,t=>!0,Od,t=>{const e=Re(t),n={};for(let r=0;r<e;r++){const s=Od(t);n[s]=jl(t)}return n},t=>{const e=Re(t),n=[];for(let r=0;r<e;r++)n.push(jl(t));return n},It],jl=t=>J_[127-vi(t)](t);class cm extends xa{constructor(e,n){super(e),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),F_(this)?this.count=Re(this)+1:this.count=-1),this.count--,this.s}}class zo extends xa{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=oh(this);const e=N0(this.s);this.count=1,e&&(this.s=-this.s,this.count=Re(this)+2)}return this.count--,this.s}}class Rc extends xa{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=oh(this),n=e&1;this.diff=_n(e/2),this.count=1,n&&(this.count=Re(this)+2)}return this.s+=this.diff,this.count--,this.s}}class Y_{constructor(e){this.decoder=new zo(e),this.str=Od(this.decoder),this.spos=0}read(){const e=this.spos+this.decoder.read(),n=this.str.slice(this.spos,e);return this.spos=e,n}}const X_=crypto.getRandomValues.bind(crypto),Z_=Math.random,D0=()=>X_(new Uint32Array(1))[0],Q_=t=>t[_n(Z_()*t.length)],eR="10000000-1000-4000-8000"+-1e11,tR=()=>eR.replace(/[018]/g,t=>(t^D0()&15>>t/4).toString(16)),nR=Date.now,dm=t=>new Promise(t);Promise.all.bind(Promise);const um=t=>t===void 0?null:t;class rR{constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let L0=new rR,sR=!0;try{typeof localStorage<"u"&&localStorage&&(L0=localStorage,sR=!1)}catch{}const iR=L0,oR=Object.assign,I0=Object.keys,lR=(t,e)=>{for(const n in t)e(t[n],n)},hm=t=>I0(t).length,aR=t=>{for(const e in t)return!1;return!0},j0=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},cR=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),dR=(t,e)=>t===e||hm(t)===hm(e)&&j0(t,(n,r)=>(n!==void 0||cR(e,r))&&e[r]===n),uR=Object.freeze,P0=t=>{for(const e in t){const n=t[e];(typeof n=="object"||typeof n=="function")&&P0(t[e])}return uR(t)},ah=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&ah(t,e,n+1)}},hR=(t,e)=>e.includes(t),ws=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",B0=typeof window<"u"&&typeof document<"u"&&!ws;let rn;const fR=()=>{if(rn===void 0)if(ws){rn=Kt();const t=process.argv;let e=null;for(let n=0;n<t.length;n++){const r=t[n];r[0]==="-"?(e!==null&&rn.set(e,""),e=r):e!==null&&(rn.set(e,r),e=null)}e!==null&&rn.set(e,"")}else typeof location=="object"?(rn=Kt(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");rn.set(`--${sm(e,"-")}`,n),rn.set(`-${sm(e,"-")}`,n)}})):rn=Kt();return rn},Dd=t=>fR().has(t),Pl=t=>um(ws?process.env[t.toUpperCase().replaceAll("-","_")]:iR.getItem(t)),$0=t=>Dd("--"+t)||Pl(t)!==null;$0("production");const pR=ws&&hR(process.env.FORCE_COLOR,["true","1","2"]),mR=pR||!Dd("--no-colors")&&!$0("no-color")&&(!ws||process.stdout.isTTY)&&(!ws||Dd("--color")||Pl("COLORTERM")!==null||(Pl("TERM")||"").includes("color")),gR=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=S_(t[n]);return btoa(e)},yR=t=>Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),bR=B0?gR:yR,xR=t=>R_(e=>xs(e,t));class wR{constructor(e,n){this.left=e,this.right=n}}const xn=(t,e)=>new wR(t,e),kR=typeof document<"u"?document:{};typeof DOMParser<"u"&&new DOMParser;const vR=t=>g_(t,(e,n)=>`${n}:${e};`).join(""),SR=t=>class{constructor(n){this._=n}destroy(){t(this._)}},CR=SR(clearTimeout),H0=(t,e)=>new CR(setTimeout(e,t)),Dn=Symbol,z0=Dn(),F0=Dn(),ER=Dn(),MR=Dn(),AR=Dn(),U0=Dn(),TR=Dn(),ch=Dn(),NR=Dn(),_R=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());const e=[],n=[];let r=0;for(;r<t.length;r++){const s=t[r];if(s===void 0)break;if(s.constructor===String||s.constructor===Number)e.push(s);else if(s.constructor===Object)break}for(r>0&&n.push(e.join(""));r<t.length;r++){const s=t[r];s instanceof Symbol||n.push(s)}return n},RR={[z0]:xn("font-weight","bold"),[F0]:xn("font-weight","normal"),[ER]:xn("color","blue"),[AR]:xn("color","green"),[MR]:xn("color","grey"),[U0]:xn("color","red"),[TR]:xn("color","purple"),[ch]:xn("color","orange"),[NR]:xn("color","black")},OR=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());const e=[],n=[],r=Kt();let s=[],i=0;for(;i<t.length;i++){const o=t[i],l=RR[o];if(l!==void 0)r.set(l.left,l.right);else{if(o===void 0)break;if(o.constructor===String||o.constructor===Number){const a=vR(r);i>0||a.length>0?(e.push("%c"+o),n.push(a)):e.push(o)}else break}}for(i>0&&(s=n,s.unshift(e.join("")));i<t.length;i++){const o=t[i];o instanceof Symbol||s.push(o)}return s},V0=mR?OR:_R,DR=(...t)=>{console.log(...V0(t)),q0.forEach(e=>e.print(t))},W0=(...t)=>{console.warn(...V0(t)),t.unshift(ch),q0.forEach(e=>e.print(t))},q0=Pr(),K0=t=>({[Symbol.iterator](){return this},next:t}),LR=(t,e)=>K0(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),Oc=(t,e)=>K0(()=>{const{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}});class dh{constructor(e,n){this.clock=e,this.len=n}}class Ts{constructor(){this.clients=new Map}}const cr=(t,e,n)=>e.clients.forEach((r,s)=>{const i=t.doc.store.clients.get(s);if(i!=null){const o=i[i.length-1],l=o.id.clock+o.length;for(let a=0,c=r[a];a<r.length&&c.clock<l;c=r[++a])tx(t,i,c.clock,c.len,n)}}),IR=(t,e)=>{let n=0,r=t.length-1;for(;n<=r;){const s=_n((n+r)/2),i=t[s],o=i.clock;if(o<=e){if(e<o+i.len)return s;n=s+1}else r=s-1}return null},Ns=(t,e)=>{const n=t.clients.get(e.client);return n!==void 0&&IR(n,e.clock)!==null},uh=t=>{t.clients.forEach(e=>{e.sort((s,i)=>s.clock-i.clock);let n,r;for(n=1,r=1;n<e.length;n++){const s=e[r-1],i=e[n];s.clock+s.len>=i.clock?s.len=lr(s.len,i.clock+i.len-s.clock):(r<n&&(e[r]=i),r++)}e.length=r})},Ld=t=>{const e=new Ts;for(let n=0;n<t.length;n++)t[n].clients.forEach((r,s)=>{if(!e.clients.has(s)){const i=r.slice();for(let o=n+1;o<t.length;o++)b_(i,t[o].clients.get(s)||[]);e.clients.set(s,i)}});return uh(e),e},Si=(t,e,n,r)=>{On(t.clients,e,()=>[]).push(new dh(n,r))},G0=()=>new Ts,jR=t=>{const e=G0();return t.clients.forEach((n,r)=>{const s=[];for(let i=0;i<n.length;i++){const o=n[i];if(o.deleted){const l=o.id.clock;let a=o.length;if(i+1<n.length)for(let c=n[i+1];i+1<n.length&&c.deleted;c=n[++i+1])a+=c.length;s.push(new dh(l,a))}}s.length>0&&e.clients.set(r,s)}),e},hh=(t,e)=>{me(t.restEncoder,e.clients.size),Br(e.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{t.resetDsCurVal(),me(t.restEncoder,n);const s=r.length;me(t.restEncoder,s);for(let i=0;i<s;i++){const o=r[i];t.writeDsClock(o.clock),t.writeDsLen(o.len)}})},PR=t=>{const e=new Ts,n=Re(t.restDecoder);for(let r=0;r<n;r++){t.resetDsCurVal();const s=Re(t.restDecoder),i=Re(t.restDecoder);if(i>0){const o=On(e.clients,s,()=>[]);for(let l=0;l<i;l++)o.push(new dh(t.readDsClock(),t.readDsLen()))}}return e},fm=(t,e,n)=>{const r=new Ts,s=Re(t.restDecoder);for(let i=0;i<s;i++){t.resetDsCurVal();const o=Re(t.restDecoder),l=Re(t.restDecoder),a=n.clients.get(o)||[],c=Ue(n,o);for(let d=0;d<l;d++){const u=t.readDsClock(),h=u+t.readDsLen();if(u<c){c<h&&Si(r,o,c,h-c);let f=Yt(a,u),p=a[f];for(!p.deleted&&p.id.clock<u&&(a.splice(f+1,0,Vl(e,p,u-p.id.clock)),f++);f<a.length&&(p=a[f++],p.id.clock<h);)p.deleted||(h<p.id.clock+p.length&&a.splice(f,0,Vl(e,p,h-p.id.clock)),p.delete(e))}else Si(r,o,u,h-u)}}if(r.clients.size>0){const i=new wa;return me(i.restEncoder,0),hh(i,r),i.toUint8Array()}return null},J0=D0;class Ur extends T0{constructor({guid:e=tR(),collectionid:n=null,gc:r=!0,gcFilter:s=()=>!0,meta:i=null,autoLoad:o=!1,shouldLoad:l=!0}={}){super(),this.gc=r,this.gcFilter=s,this.clientID=J0(),this.guid=e,this.collectionid=n,this.share=new Map,this.store=new Q0,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=l,this.autoLoad=o,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=dm(c=>{this.on("load",()=>{this.isLoaded=!0,c(this)})});const a=()=>dm(c=>{const d=u=>{(u===void 0||u===!0)&&(this.off("sync",d),c())};this.on("sync",d)});this.on("sync",c=>{c===!1&&this.isSynced&&(this.whenSynced=a()),this.isSynced=c===void 0||c===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=a()}load(){const e=this._item;e!==null&&!this.shouldLoad&&Ce(e.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(Br(this.subdocs).map(e=>e.guid))}transact(e,n=null){return Ce(this,e,n)}get(e,n=tt){const r=On(this.share,e,()=>{const i=new n;return i._integrate(this,null),i}),s=r.constructor;if(n!==tt&&s!==n)if(s===tt){const i=new n;i._map=r._map,r._map.forEach(o=>{for(;o!==null;o=o.left)o.parent=i}),i._start=r._start;for(let o=i._start;o!==null;o=o.right)o.parent=i;return i._length=r._length,this.share.set(e,i),i._integrate(this,null),i}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return r}getArray(e=""){return this.get(e,ds)}getText(e=""){return this.get(e,dr)}getMap(e=""){return this.get(e,ks)}getXmlElement(e=""){return this.get(e,ht)}getXmlFragment(e=""){return this.get(e,$r)}toJSON(){const e={};return this.share.forEach((n,r)=>{e[r]=n.toJSON()}),e}destroy(){this.isDestroyed=!0,Br(this.subdocs).forEach(n=>n.destroy());const e=this._item;if(e!==null){this._item=null;const n=e.content;n.doc=new Ur({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=e,Ce(e.parent.doc,r=>{const s=n.doc;e.deleted||r.subdocsAdded.add(s),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class BR{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=Re(this.restDecoder),this.dsCurrVal}readDsLen(){const e=Re(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class Bl extends BR{constructor(e){super(e),this.keys=[],Re(e),this.keyClockDecoder=new Rc(It(e)),this.clientDecoder=new zo(It(e)),this.leftClockDecoder=new Rc(It(e)),this.rightClockDecoder=new Rc(It(e)),this.infoDecoder=new cm(It(e),vi),this.stringDecoder=new Y_(It(e)),this.parentInfoDecoder=new cm(It(e),vi),this.typeRefDecoder=new zo(It(e)),this.lenDecoder=new zo(It(e))}readLeftID(){return new as(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new as(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return jl(this.restDecoder)}readBuf(){return It(this.restDecoder)}readJSON(){return jl(this.restDecoder)}readKey(){const e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{const n=this.stringDecoder.read();return this.keys.push(n),n}}}class $R{constructor(){this.restEncoder=zi()}toUint8Array(){return qt(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){me(this.restEncoder,e)}writeDsLen(e){me(this.restEncoder,e)}}class HR extends $R{writeLeftID(e){me(this.restEncoder,e.client),me(this.restEncoder,e.clock)}writeRightID(e){me(this.restEncoder,e.client),me(this.restEncoder,e.clock)}writeClient(e){me(this.restEncoder,e)}writeInfo(e){_d(this.restEncoder,e)}writeString(e){ls(this.restEncoder,e)}writeParentInfo(e){me(this.restEncoder,e?1:0)}writeTypeRef(e){me(this.restEncoder,e)}writeLen(e){me(this.restEncoder,e)}writeAny(e){xs(this.restEncoder,e)}writeBuf(e){Tt(this.restEncoder,e)}writeJSON(e){ls(this.restEncoder,JSON.stringify(e))}writeKey(e){ls(this.restEncoder,e)}}class zR{constructor(){this.restEncoder=zi(),this.dsCurrVal=0}toUint8Array(){return qt(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const n=e-this.dsCurrVal;this.dsCurrVal=e,me(this.restEncoder,n)}writeDsLen(e){e===0&&Mt(),me(this.restEncoder,e-1),this.dsCurrVal+=e}}class wa extends zR{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new _c,this.clientEncoder=new Ho,this.leftClockEncoder=new _c,this.rightClockEncoder=new _c,this.infoEncoder=new om(_d),this.stringEncoder=new z_,this.parentInfoEncoder=new om(_d),this.typeRefEncoder=new Ho,this.lenEncoder=new Ho}toUint8Array(){const e=zi();return me(e,0),Tt(e,this.keyClockEncoder.toUint8Array()),Tt(e,this.clientEncoder.toUint8Array()),Tt(e,this.leftClockEncoder.toUint8Array()),Tt(e,this.rightClockEncoder.toUint8Array()),Tt(e,qt(this.infoEncoder)),Tt(e,this.stringEncoder.toUint8Array()),Tt(e,qt(this.parentInfoEncoder)),Tt(e,this.typeRefEncoder.toUint8Array()),Tt(e,this.lenEncoder.toUint8Array()),ba(e,qt(this.restEncoder)),qt(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){xs(this.restEncoder,e)}writeBuf(e){Tt(this.restEncoder,e)}writeJSON(e){xs(this.restEncoder,e)}writeKey(e){const n=this.keyMap.get(e);n===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(n)}}const FR=(t,e,n,r)=>{r=lr(r,e[0].id.clock);const s=Yt(e,r);me(t.restEncoder,e.length-s),t.writeClient(n),me(t.restEncoder,r);const i=e[s];i.write(t,r-i.id.clock);for(let o=s+1;o<e.length;o++)e[o].write(t,0)},Y0=(t,e,n)=>{const r=new Map;n.forEach((s,i)=>{Ue(e,i)>s&&r.set(i,s)}),ka(e).forEach((s,i)=>{n.has(i)||r.set(i,0)}),me(t.restEncoder,r.size),Br(r.entries()).sort((s,i)=>i[0]-s[0]).forEach(([s,i])=>{FR(t,e.clients.get(s),s,i)})},UR=(t,e)=>{const n=Kt(),r=Re(t.restDecoder);for(let s=0;s<r;s++){const i=Re(t.restDecoder),o=new Array(i),l=t.readClient();let a=Re(t.restDecoder);n.set(l,{i:0,refs:o});for(let c=0;c<i;c++){const d=t.readInfo();switch(ya&d){case 0:{const u=t.readLen();o[c]=new Bt(ce(l,a),u),a+=u;break}case 10:{const u=Re(t.restDecoder);o[c]=new Vt(ce(l,a),u),a+=u;break}default:{const u=(d&(Tn|yt))===0,h=new ve(ce(l,a),null,(d&yt)===yt?t.readLeftID():null,null,(d&Tn)===Tn?t.readRightID():null,u?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,u&&(d&wi)===wi?t.readString():null,Sx(t,d));o[c]=h,a+=h.length}}}}return n},VR=(t,e,n)=>{const r=[];let s=Br(n.keys()).sort((f,p)=>f-p);if(s.length===0)return null;const i=()=>{if(s.length===0)return null;let f=n.get(s[s.length-1]);for(;f.refs.length===f.i;)if(s.pop(),s.length>0)f=n.get(s[s.length-1]);else return null;return f};let o=i();if(o===null)return null;const l=new Q0,a=new Map,c=(f,p)=>{const g=a.get(f);(g==null||g>p)&&a.set(f,p)};let d=o.refs[o.i++];const u=new Map,h=()=>{for(const f of r){const p=f.id.client,g=n.get(p);g?(g.i--,l.clients.set(p,g.refs.slice(g.i)),n.delete(p),g.i=0,g.refs=[]):l.clients.set(p,[f]),s=s.filter(y=>y!==p)}r.length=0};for(;;){if(d.constructor!==Vt){const p=On(u,d.id.client,()=>Ue(e,d.id.client))-d.id.clock;if(p<0)r.push(d),c(d.id.client,d.id.clock-1),h();else{const g=d.getMissing(t,e);if(g!==null){r.push(d);const y=n.get(g)||{refs:[],i:0};if(y.refs.length===y.i)c(g,Ue(e,g)),h();else{d=y.refs[y.i++];continue}}else(p===0||p<d.length)&&(d.integrate(t,p),u.set(d.id.client,d.id.clock+d.length))}}if(r.length>0)d=r.pop();else if(o!==null&&o.i<o.refs.length)d=o.refs[o.i++];else{if(o=i(),o===null)break;d=o.refs[o.i++]}}if(l.clients.size>0){const f=new wa;return Y0(f,l,new Map),me(f.restEncoder,0),{missing:a,update:f.toUint8Array()}}return null},WR=(t,e)=>Y0(t,e.doc.store,e.beforeState),qR=(t,e,n,r=new Bl(t))=>Ce(e,s=>{s.local=!1;let i=!1;const o=s.doc,l=o.store,a=UR(r,o),c=VR(s,l,a),d=l.pendingStructs;if(d){for(const[h,f]of d.missing)if(f<Ue(l,h)){i=!0;break}if(c){for(const[h,f]of c.missing){const p=d.missing.get(h);(p==null||p>f)&&d.missing.set(h,f)}d.update=vm([d.update,c.update])}}else l.pendingStructs=c;const u=fm(r,s,l);if(l.pendingDs){const h=new Bl(ih(l.pendingDs));Re(h.restDecoder);const f=fm(h,s,l);u&&f?l.pendingDs=vm([u,f]):l.pendingDs=u||f}else l.pendingDs=u;if(i){const h=l.pendingStructs.update;l.pendingStructs=null,Id(s.doc,h)}},n,!1),Id=(t,e,n,r=Bl)=>{const s=ih(e);qR(s,t,n,new r(s))};class KR{constructor(){this.l=[]}}const pm=()=>new KR,mm=(t,e)=>t.l.push(e),gm=(t,e)=>{const n=t.l,r=n.length;t.l=n.filter(s=>e!==s),r===t.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},X0=(t,e,n)=>ah(t.l,[e,n]);class as{constructor(e,n){this.client=e,this.clock=n}}const Eo=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,ce=(t,e)=>new as(t,e),Ci=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw Mt()},Ei=(t,e)=>{for(;e!==null;){if(e.parent===t)return!0;e=e.parent._item}return!1};class $l{constructor(e,n,r,s=0){this.type=e,this.tname=n,this.item=r,this.assoc=s}}class GR{constructor(e,n,r=0){this.type=e,this.index=n,this.assoc=r}}const JR=(t,e,n=0)=>new GR(t,e,n),Mo=(t,e,n)=>{let r=null,s=null;return t._item===null?s=Ci(t):r=ce(t._item.id.client,t._item.id.clock),new $l(r,s,e,n)},Dc=(t,e,n=0)=>{let r=t._start;if(n<0){if(e===0)return Mo(t,null,n);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return Mo(t,ce(r.id.client,r.id.clock+e),n);e-=r.length}if(r.right===null&&n<0)return Mo(t,r.lastId,n);r=r.right}return Mo(t,null,n)},YR=(t,e)=>{const n=cs(t,e),r=e.clock-n.id.clock;return{item:n,diff:r}},XR=(t,e,n=!0)=>{const r=e.store,s=t.item,i=t.type,o=t.tname,l=t.assoc;let a=null,c=0;if(s!==null){if(Ue(r,s.client)<=s.clock)return null;const d=n?$d(r,s):YR(r,s),u=d.item;if(!(u instanceof ve))return null;if(a=u.parent,a._item===null||!a._item.deleted){c=u.deleted||!u.countable?0:d.diff+(l>=0?0:1);let h=u.left;for(;h!==null;)!h.deleted&&h.countable&&(c+=h.length),h=h.left}}else{if(o!==null)a=e.get(o);else if(i!==null){if(Ue(r,i.client)<=i.clock)return null;const{item:d}=n?$d(r,i):{item:cs(r,i)};if(d instanceof ve&&d.content instanceof en)a=d.content.type;else return null}else throw Mt();l>=0?c=a._length:c=0}return JR(a,c,t.assoc)};class fh{constructor(e,n){this.ds=e,this.sv=n}}const Z0=(t,e)=>new fh(t,e),Lc=t=>Z0(jR(t.store),ka(t.store)),br=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!Ns(e.ds,t.id),jd=(t,e)=>{const n=On(t.meta,jd,Pr),r=t.doc.store;n.has(e)||(e.sv.forEach((s,i)=>{s<Ue(r,i)&&vt(t,ce(i,s))}),cr(t,e.ds,s=>{}),n.add(e))};class Q0{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const ka=t=>{const e=new Map;return t.clients.forEach((n,r)=>{const s=n[n.length-1];e.set(r,s.id.clock+s.length)}),e},Ue=(t,e)=>{const n=t.clients.get(e);if(n===void 0)return 0;const r=n[n.length-1];return r.id.clock+r.length},ex=(t,e)=>{let n=t.clients.get(e.id.client);if(n===void 0)n=[],t.clients.set(e.id.client,n);else{const r=n[n.length-1];if(r.id.clock+r.length!==e.id.clock)throw Mt()}n.push(e)},Yt=(t,e)=>{let n=0,r=t.length-1,s=t[r],i=s.id.clock;if(i===e)return r;let o=_n(e/(i+s.length-1)*r);for(;n<=r;){if(s=t[o],i=s.id.clock,i<=e){if(e<i+s.length)return o;n=o+1}else r=o-1;o=_n((n+r)/2)}throw Mt()},ZR=(t,e)=>{const n=t.clients.get(e.client);return n[Yt(n,e.clock)]},cs=ZR,Pd=(t,e,n)=>{const r=Yt(e,n),s=e[r];return s.id.clock<n&&s instanceof ve?(e.splice(r+1,0,Vl(t,s,n-s.id.clock)),r+1):r},vt=(t,e)=>{const n=t.doc.store.clients.get(e.client);return n[Pd(t,n,e.clock)]},ym=(t,e,n)=>{const r=e.clients.get(n.client),s=Yt(r,n.clock),i=r[s];return n.clock!==i.id.clock+i.length-1&&i.constructor!==Bt&&r.splice(s+1,0,Vl(t,i,n.clock-i.id.clock+1)),i},QR=(t,e,n)=>{const r=t.clients.get(e.id.client);r[Yt(r,e.id.clock)]=n},tx=(t,e,n,r,s)=>{if(r===0)return;const i=n+r;let o=Pd(t,e,n),l;do l=e[o++],i<l.id.clock+l.length&&Pd(t,e,i),s(l);while(o<e.length&&e[o].id.clock<i)};class eO{constructor(e,n,r){this.doc=e,this.deleteSet=new Ts,this.beforeState=ka(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=n,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const bm=(t,e)=>e.deleteSet.clients.size===0&&!y_(e.afterState,(n,r)=>e.beforeState.get(r)!==n)?!1:(uh(e.deleteSet),WR(t,e),hh(t,e.deleteSet),!0),xm=(t,e,n)=>{const r=e._item;(r===null||r.id.clock<(t.beforeState.get(r.id.client)||0)&&!r.deleted)&&On(t.changed,e,Pr).add(n)},Fo=(t,e)=>{let n=t[e],r=t[e-1],s=e;for(;s>0;n=r,r=t[--s-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof ve&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}const i=e-s;return i&&t.splice(e+1-i,i),i},tO=(t,e,n)=>{for(const[r,s]of t.clients.entries()){const i=e.clients.get(r);for(let o=s.length-1;o>=0;o--){const l=s[o],a=l.clock+l.len;for(let c=Yt(i,l.clock),d=i[c];c<i.length&&d.id.clock<a;d=i[++c]){const u=i[c];if(l.clock+l.len<=u.id.clock)break;u instanceof ve&&u.deleted&&!u.keep&&n(u)&&u.gc(e,!1)}}}},nO=(t,e)=>{t.clients.forEach((n,r)=>{const s=e.clients.get(r);for(let i=n.length-1;i>=0;i--){const o=n[i],l=bs(s.length-1,1+Yt(s,o.clock+o.len-1));for(let a=l,c=s[a];a>0&&c.id.clock>=o.clock;c=s[a])a-=1+Fo(s,a)}})},nx=(t,e)=>{if(e<t.length){const n=t[e],r=n.doc,s=r.store,i=n.deleteSet,o=n._mergeStructs;try{uh(i),n.afterState=ka(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const l=[];n.changed.forEach((a,c)=>l.push(()=>{(c._item===null||!c._item.deleted)&&c._callObserver(n,a)})),l.push(()=>{n.changedParentTypes.forEach((a,c)=>{c._dEH.l.length>0&&(c._item===null||!c._item.deleted)&&(a=a.filter(d=>d.target._item===null||!d.target._item.deleted),a.forEach(d=>{d.currentTarget=c,d._path=null}),a.sort((d,u)=>d.path.length-u.path.length),X0(c._dEH,a,n))})}),l.push(()=>r.emit("afterTransaction",[n,r])),ah(l,[]),n._needFormattingCleanup&&vO(n)}finally{r.gc&&tO(i,s,r.gcFilter),nO(i,s),n.afterState.forEach((d,u)=>{const h=n.beforeState.get(u)||0;if(h!==d){const f=s.clients.get(u),p=lr(Yt(f,h),1);for(let g=f.length-1;g>=p;)g-=1+Fo(f,g)}});for(let d=o.length-1;d>=0;d--){const{client:u,clock:h}=o[d].id,f=s.clients.get(u),p=Yt(f,h);p+1<f.length&&Fo(f,p+1)>1||p>0&&Fo(f,p)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(DR(ch,z0,"[yjs] ",F0,U0,"Changed the client-id because another client seems to be using it."),r.clientID=J0()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const d=new HR;bm(d,n)&&r.emit("update",[d.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const d=new wa;bm(d,n)&&r.emit("updateV2",[d.toUint8Array(),n.origin,r,n])}const{subdocsAdded:l,subdocsLoaded:a,subdocsRemoved:c}=n;(l.size>0||c.size>0||a.size>0)&&(l.forEach(d=>{d.clientID=r.clientID,d.collectionid==null&&(d.collectionid=r.collectionid),r.subdocs.add(d)}),c.forEach(d=>r.subdocs.delete(d)),r.emit("subdocs",[{loaded:a,added:l,removed:c},r,n]),c.forEach(d=>d.destroy())),t.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,t])):nx(t,e+1)}}},Ce=(t,e,n=null,r=!0)=>{const s=t._transactionCleanups;let i=!1,o=null;t._transaction===null&&(i=!0,t._transaction=new eO(t,n,r),s.push(t._transaction),s.length===1&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{o=e(t._transaction)}finally{if(i){const l=t._transaction===s[0];t._transaction=null,l&&nx(s,0)}}return o};class rO{constructor(e,n){this.insertions=n,this.deletions=e,this.meta=new Map}}const wm=(t,e,n)=>{cr(t,n.deletions,r=>{r instanceof ve&&e.scope.some(s=>s===t.doc||Ei(s,r))&&bh(r,!1)})},km=(t,e,n)=>{let r=null;const s=t.doc,i=t.scope;Ce(s,l=>{for(;e.length>0&&t.currStackItem===null;){const a=s.store,c=e.pop(),d=new Set,u=[];let h=!1;cr(l,c.insertions,f=>{if(f instanceof ve){if(f.redone!==null){let{item:p,diff:g}=$d(a,f.id);g>0&&(p=vt(l,ce(p.id.client,p.id.clock+g))),f=p}!f.deleted&&i.some(p=>p===l.doc||Ei(p,f))&&u.push(f)}}),cr(l,c.deletions,f=>{f instanceof ve&&i.some(p=>p===l.doc||Ei(p,f))&&!Ns(c.insertions,f.id)&&d.add(f)}),d.forEach(f=>{h=vx(l,f,d,c.insertions,t.ignoreRemoteMapChanges,t)!==null||h});for(let f=u.length-1;f>=0;f--){const p=u[f];t.deleteFilter(p)&&(p.delete(l),h=!0)}t.currStackItem=h?c:null}l.changed.forEach((a,c)=>{a.has(null)&&c._searchMarker&&(c._searchMarker.length=0)}),r=l},t);const o=t.currStackItem;if(o!=null){const l=r.changedParentTypes;t.emit("stack-item-popped",[{stackItem:o,type:n,changedParentTypes:l,origin:t},t]),t.currStackItem=null}return o};class rx extends T0{constructor(e,{captureTimeout:n=500,captureTransaction:r=a=>!0,deleteFilter:s=()=>!0,trackedOrigins:i=new Set([null]),ignoreRemoteMapChanges:o=!1,doc:l=Td(e)?e[0].doc:e instanceof Ur?e:e.doc}={}){super(),this.scope=[],this.doc=l,this.addToScope(e),this.deleteFilter=s,i.add(this),this.trackedOrigins=i,this.captureTransaction=r,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=o,this.captureTimeout=n,this.afterTransactionHandler=a=>{if(!this.captureTransaction(a)||!this.scope.some(y=>a.changedParentTypes.has(y)||y===this.doc)||!this.trackedOrigins.has(a.origin)&&(!a.origin||!this.trackedOrigins.has(a.origin.constructor)))return;const c=this.undoing,d=this.redoing,u=c?this.redoStack:this.undoStack;c?this.stopCapturing():d||this.clear(!1,!0);const h=new Ts;a.afterState.forEach((y,b)=>{const w=a.beforeState.get(b)||0,M=y-w;M>0&&Si(h,b,w,M)});const f=nR();let p=!1;if(this.lastChange>0&&f-this.lastChange<this.captureTimeout&&u.length>0&&!c&&!d){const y=u[u.length-1];y.deletions=Ld([y.deletions,a.deleteSet]),y.insertions=Ld([y.insertions,h])}else u.push(new rO(a.deleteSet,h)),p=!0;!c&&!d&&(this.lastChange=f),cr(a,a.deleteSet,y=>{y instanceof ve&&this.scope.some(b=>b===a.doc||Ei(b,y))&&bh(y,!0)});const g=[{stackItem:u[u.length-1],origin:a.origin,type:c?"redo":"undo",changedParentTypes:a.changedParentTypes},this];p?this.emit("stack-item-added",g):this.emit("stack-item-updated",g)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(e){const n=new Set(this.scope);e=Td(e)?e:[e],e.forEach(r=>{n.has(r)||(n.add(r),(r instanceof tt?r.doc!==this.doc:r!==this.doc)&&W0("[yjs#509] Not same Y.Doc"),this.scope.push(r))})}addTrackedOrigin(e){this.trackedOrigins.add(e)}removeTrackedOrigin(e){this.trackedOrigins.delete(e)}clear(e=!0,n=!0){(e&&this.canUndo()||n&&this.canRedo())&&this.doc.transact(r=>{e&&(this.undoStack.forEach(s=>wm(r,this,s)),this.undoStack=[]),n&&(this.redoStack.forEach(s=>wm(r,this,s)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:e,redoStackCleared:n}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=km(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=km(this,this.redoStack,"redo")}finally{this.redoing=!1}return e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),super.destroy()}}function*sO(t){const e=Re(t.restDecoder);for(let n=0;n<e;n++){const r=Re(t.restDecoder),s=t.readClient();let i=Re(t.restDecoder);for(let o=0;o<r;o++){const l=t.readInfo();if(l===10){const a=Re(t.restDecoder);yield new Vt(ce(s,i),a),i+=a}else if((ya&l)!==0){const a=(l&(Tn|yt))===0,c=new ve(ce(s,i),null,(l&yt)===yt?t.readLeftID():null,null,(l&Tn)===Tn?t.readRightID():null,a?t.readParentInfo()?t.readString():t.readLeftID():null,a&&(l&wi)===wi?t.readString():null,Sx(t,l));yield c,i+=c.length}else{const a=t.readLen();yield new Bt(ce(s,i),a),i+=a}}}}class iO{constructor(e,n){this.gen=sO(e),this.curr=null,this.done=!1,this.filterSkips=n,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===Vt);return this.curr}}class oO{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const lO=(t,e)=>{if(t.constructor===Bt){const{client:n,clock:r}=t.id;return new Bt(ce(n,r+e),t.length-e)}else if(t.constructor===Vt){const{client:n,clock:r}=t.id;return new Vt(ce(n,r+e),t.length-e)}else{const n=t,{client:r,clock:s}=n.id;return new ve(ce(r,s+e),null,ce(r,s+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},vm=(t,e=Bl,n=wa)=>{if(t.length===1)return t[0];const r=t.map(d=>new e(ih(d)));let s=r.map(d=>new iO(d,!0)),i=null;const o=new n,l=new oO(o);for(;s=s.filter(h=>h.curr!==null),s.sort((h,f)=>{if(h.curr.id.client===f.curr.id.client){const p=h.curr.id.clock-f.curr.id.clock;return p===0?h.curr.constructor===f.curr.constructor?0:h.curr.constructor===Vt?1:-1:p}else return f.curr.id.client-h.curr.id.client}),s.length!==0;){const d=s[0],u=d.curr.id.client;if(i!==null){let h=d.curr,f=!1;for(;h!==null&&h.id.clock+h.length<=i.struct.id.clock+i.struct.length&&h.id.client>=i.struct.id.client;)h=d.next(),f=!0;if(h===null||h.id.client!==u||f&&h.id.clock>i.struct.id.clock+i.struct.length)continue;if(u!==i.struct.id.client)Bs(l,i.struct,i.offset),i={struct:h,offset:0},d.next();else if(i.struct.id.clock+i.struct.length<h.id.clock)if(i.struct.constructor===Vt)i.struct.length=h.id.clock+h.length-i.struct.id.clock;else{Bs(l,i.struct,i.offset);const p=h.id.clock-i.struct.id.clock-i.struct.length;i={struct:new Vt(ce(u,i.struct.id.clock+i.struct.length),p),offset:0}}else{const p=i.struct.id.clock+i.struct.length-h.id.clock;p>0&&(i.struct.constructor===Vt?i.struct.length-=p:h=lO(h,p)),i.struct.mergeWith(h)||(Bs(l,i.struct,i.offset),i={struct:h,offset:0},d.next())}}else i={struct:d.curr,offset:0},d.next();for(let h=d.curr;h!==null&&h.id.client===u&&h.id.clock===i.struct.id.clock+i.struct.length&&h.constructor!==Vt;h=d.next())Bs(l,i.struct,i.offset),i={struct:h,offset:0}}i!==null&&(Bs(l,i.struct,i.offset),i=null),aO(l);const a=r.map(d=>PR(d)),c=Ld(a);return hh(o,c),o.toUint8Array()},sx=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:qt(t.encoder.restEncoder)}),t.encoder.restEncoder=zi(),t.written=0)},Bs=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&sx(t),t.written===0&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),me(t.encoder.restEncoder,e.id.clock+n)),e.write(t.encoder,n),t.written++},aO=t=>{sx(t);const e=t.encoder.restEncoder;me(e,t.clientStructs.length);for(let n=0;n<t.clientStructs.length;n++){const r=t.clientStructs[n];me(e,r.written),ba(e,r.restEncoder)}},Sm="You must not compute changes after the event-handler fired.";class va{constructor(e,n){this.target=e,this.currentTarget=e,this.transaction=n,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=cO(this.currentTarget,this.target))}deletes(e){return Ns(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw ar(Sm);const e=new Map,n=this.target;this.transaction.changed.get(n).forEach(s=>{if(s!==null){const i=n._map.get(s);let o,l;if(this.adds(i)){let a=i.left;for(;a!==null&&this.adds(a);)a=a.left;if(this.deletes(i))if(a!==null&&this.deletes(a))o="delete",l=Ac(a.content.getContent());else return;else a!==null&&this.deletes(a)?(o="update",l=Ac(a.content.getContent())):(o="add",l=void 0)}else if(this.deletes(i))o="delete",l=Ac(i.content.getContent());else return;e.set(s,{action:o,oldValue:l})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw ar(Sm);const n=this.target,r=Pr(),s=Pr(),i=[];if(e={added:r,deleted:s,delta:i,keys:this.keys},this.transaction.changed.get(n).has(null)){let l=null;const a=()=>{l&&i.push(l)};for(let c=n._start;c!==null;c=c.right)c.deleted?this.deletes(c)&&!this.adds(c)&&((l===null||l.delete===void 0)&&(a(),l={delete:0}),l.delete+=c.length,s.add(c)):this.adds(c)?((l===null||l.insert===void 0)&&(a(),l={insert:[]}),l.insert=l.insert.concat(c.content.getContent()),r.add(c)):((l===null||l.retain===void 0)&&(a(),l={retain:0}),l.retain+=c.length);l!==null&&l.retain===void 0&&a()}this._changes=e}return e}}const cO=(t,e)=>{const n=[];for(;e._item!==null&&e!==t;){if(e._item.parentSub!==null)n.unshift(e._item.parentSub);else{let r=0,s=e._item.parent._start;for(;s!==e._item&&s!==null;)!s.deleted&&s.countable&&(r+=s.length),s=s.right;n.unshift(r)}e=e._item.parent}return n},ft=()=>{W0("Invalid access: Add Yjs type to a document before reading data.")},ix=80;let ph=0;class dO{constructor(e,n){e.marker=!0,this.p=e,this.index=n,this.timestamp=ph++}}const uO=t=>{t.timestamp=ph++},ox=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=ph++},hO=(t,e,n)=>{if(t.length>=ix){const r=t.reduce((s,i)=>s.timestamp<i.timestamp?s:i);return ox(r,e,n),r}else{const r=new dO(e,n);return t.push(r),r}},Sa=(t,e)=>{if(t._start===null||e===0||t._searchMarker===null)return null;const n=t._searchMarker.length===0?null:t._searchMarker.reduce((i,o)=>$o(e-i.index)<$o(e-o.index)?i:o);let r=t._start,s=0;for(n!==null&&(r=n.p,s=n.index,uO(n));r.right!==null&&s<e;){if(!r.deleted&&r.countable){if(e<s+r.length)break;s+=r.length}r=r.right}for(;r.left!==null&&s>e;)r=r.left,!r.deleted&&r.countable&&(s-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(s-=r.length);return n!==null&&$o(n.index-s)<r.parent.length/ix?(ox(n,r,s),n):hO(t._searchMarker,r,s)},Mi=(t,e,n)=>{for(let r=t.length-1;r>=0;r--){const s=t[r];if(n>0){let i=s.p;for(i.marker=!1;i&&(i.deleted||!i.countable);)i=i.left,i&&!i.deleted&&i.countable&&(s.index-=i.length);if(i===null||i.marker===!0){t.splice(r,1);continue}s.p=i,i.marker=!0}(e<s.index||n>0&&e===s.index)&&(s.index=lr(e,s.index+n))}},Ca=(t,e,n)=>{const r=t,s=e.changedParentTypes;for(;On(s,t,()=>[]).push(n),t._item!==null;)t=t._item.parent;X0(r._eH,n,e)};class tt{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=pm(),this._dEH=pm(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,n){this.doc=e,this._item=n}_copy(){throw Gt()}clone(){throw Gt()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,n){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){mm(this._eH,e)}observeDeep(e){mm(this._dEH,e)}unobserve(e){gm(this._eH,e)}unobserveDeep(e){gm(this._dEH,e)}toJSON(){}}const lx=(t,e,n)=>{t.doc??ft(),e<0&&(e=t._length+e),n<0&&(n=t._length+n);let r=n-e;const s=[];let i=t._start;for(;i!==null&&r>0;){if(i.countable&&!i.deleted){const o=i.content.getContent();if(o.length<=e)e-=o.length;else{for(let l=e;l<o.length&&r>0;l++)s.push(o[l]),r--;e=0}}i=i.right}return s},ax=t=>{t.doc??ft();const e=[];let n=t._start;for(;n!==null;){if(n.countable&&!n.deleted){const r=n.content.getContent();for(let s=0;s<r.length;s++)e.push(r[s])}n=n.right}return e},cx=(t,e)=>{const n=[];let r=t._start;for(;r!==null;){if(r.countable&&br(r,e)){const s=r.content.getContent();for(let i=0;i<s.length;i++)n.push(s[i])}r=r.right}return n},Ai=(t,e)=>{let n=0,r=t._start;for(t.doc??ft();r!==null;){if(r.countable&&!r.deleted){const s=r.content.getContent();for(let i=0;i<s.length;i++)e(s[i],n++,t)}r=r.right}},dx=(t,e)=>{const n=[];return Ai(t,(r,s)=>{n.push(e(r,s,t))}),n},fO=t=>{let e=t._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};n=e.content.getContent(),r=0,e=e.right}const s=n[r++];return n.length<=r&&(n=null),{done:!1,value:s}}}},ux=(t,e)=>{t.doc??ft();const n=Sa(t,e);let r=t._start;for(n!==null&&(r=n.p,e-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(e<r.length)return r.content.getContent()[e];e-=r.length}},Hl=(t,e,n,r)=>{let s=n;const i=t.doc,o=i.clientID,l=i.store,a=n===null?e._start:n.right;let c=[];const d=()=>{c.length>0&&(s=new ve(ce(o,Ue(l,o)),s,s&&s.lastId,a,a&&a.id,e,null,new Hr(c)),s.integrate(t,0),c=[])};r.forEach(u=>{if(u===null)c.push(u);else switch(u.constructor){case Number:case Object:case Boolean:case Array:case String:c.push(u);break;default:switch(d(),u.constructor){case Uint8Array:case ArrayBuffer:s=new ve(ce(o,Ue(l,o)),s,s&&s.lastId,a,a&&a.id,e,null,new Fi(new Uint8Array(u))),s.integrate(t,0);break;case Ur:s=new ve(ce(o,Ue(l,o)),s,s&&s.lastId,a,a&&a.id,e,null,new Ui(u)),s.integrate(t,0);break;default:if(u instanceof tt)s=new ve(ce(o,Ue(l,o)),s,s&&s.lastId,a,a&&a.id,e,null,new en(u)),s.integrate(t,0);else throw new Error("Unexpected content type in insert operation")}}}),d()},hx=()=>ar("Length exceeded!"),fx=(t,e,n,r)=>{if(n>e._length)throw hx();if(n===0)return e._searchMarker&&Mi(e._searchMarker,n,r.length),Hl(t,e,null,r);const s=n,i=Sa(e,n);let o=e._start;for(i!==null&&(o=i.p,n-=i.index,n===0&&(o=o.prev,n+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){n<o.length&&vt(t,ce(o.id.client,o.id.clock+n));break}n-=o.length}return e._searchMarker&&Mi(e._searchMarker,s,r.length),Hl(t,e,o,r)},pO=(t,e,n)=>{let s=(e._searchMarker||[]).reduce((i,o)=>o.index>i.index?o:i,{index:0,p:e._start}).p;if(s)for(;s.right;)s=s.right;return Hl(t,e,s,n)},px=(t,e,n,r)=>{if(r===0)return;const s=n,i=r,o=Sa(e,n);let l=e._start;for(o!==null&&(l=o.p,n-=o.index);l!==null&&n>0;l=l.right)!l.deleted&&l.countable&&(n<l.length&&vt(t,ce(l.id.client,l.id.clock+n)),n-=l.length);for(;r>0&&l!==null;)l.deleted||(r<l.length&&vt(t,ce(l.id.client,l.id.clock+r)),l.delete(t),r-=l.length),l=l.right;if(r>0)throw hx();e._searchMarker&&Mi(e._searchMarker,s,-i+r)},zl=(t,e,n)=>{const r=e._map.get(n);r!==void 0&&r.delete(t)},mh=(t,e,n,r)=>{const s=e._map.get(n)||null,i=t.doc,o=i.clientID;let l;if(r==null)l=new Hr([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:l=new Hr([r]);break;case Uint8Array:l=new Fi(r);break;case Ur:l=new Ui(r);break;default:if(r instanceof tt)l=new en(r);else throw new Error("Unexpected content type")}new ve(ce(o,Ue(i.store,o)),s,s&&s.lastId,null,null,e,n,l).integrate(t,0)},gh=(t,e)=>{t.doc??ft();const n=t._map.get(e);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},mx=t=>{const e={};return t.doc??ft(),t._map.forEach((n,r)=>{n.deleted||(e[r]=n.content.getContent()[n.length-1])}),e},gx=(t,e)=>{t.doc??ft();const n=t._map.get(e);return n!==void 0&&!n.deleted},mO=(t,e)=>{const n={};return t._map.forEach((r,s)=>{let i=r;for(;i!==null&&(!e.sv.has(i.id.client)||i.id.clock>=(e.sv.get(i.id.client)||0));)i=i.left;i!==null&&br(i,e)&&(n[s]=i.content.getContent()[i.length-1])}),n},Ao=t=>(t.doc??ft(),LR(t._map.entries(),e=>!e[1].deleted));class gO extends va{}class ds extends tt{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const n=new ds;return n.push(e),n}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new ds}clone(){const e=new ds;return e.insert(0,this.toArray().map(n=>n instanceof tt?n.clone():n)),e}get length(){return this.doc??ft(),this._length}_callObserver(e,n){super._callObserver(e,n),Ca(this,e,new gO(this,e))}insert(e,n){this.doc!==null?Ce(this.doc,r=>{fx(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}push(e){this.doc!==null?Ce(this.doc,n=>{pO(n,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,n=1){this.doc!==null?Ce(this.doc,r=>{px(r,this,e,n)}):this._prelimContent.splice(e,n)}get(e){return ux(this,e)}toArray(){return ax(this)}slice(e=0,n=this.length){return lx(this,e,n)}toJSON(){return this.map(e=>e instanceof tt?e.toJSON():e)}map(e){return dx(this,e)}forEach(e){Ai(this,e)}[Symbol.iterator](){return fO(this)}_write(e){e.writeTypeRef(zO)}}const yO=t=>new ds;class bO extends va{constructor(e,n,r){super(e,n),this.keysChanged=r}}class ks extends tt{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,n){super._integrate(e,n),this._prelimContent.forEach((r,s)=>{this.set(s,r)}),this._prelimContent=null}_copy(){return new ks}clone(){const e=new ks;return this.forEach((n,r)=>{e.set(r,n instanceof tt?n.clone():n)}),e}_callObserver(e,n){Ca(this,e,new bO(this,e,n))}toJSON(){this.doc??ft();const e={};return this._map.forEach((n,r)=>{if(!n.deleted){const s=n.content.getContent()[n.length-1];e[r]=s instanceof tt?s.toJSON():s}}),e}get size(){return[...Ao(this)].length}keys(){return Oc(Ao(this),e=>e[0])}values(){return Oc(Ao(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return Oc(Ao(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??ft(),this._map.forEach((n,r)=>{n.deleted||e(n.content.getContent()[n.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?Ce(this.doc,n=>{zl(n,this,e)}):this._prelimContent.delete(e)}set(e,n){return this.doc!==null?Ce(this.doc,r=>{mh(r,this,e,n)}):this._prelimContent.set(e,n),n}get(e){return gh(this,e)}has(e){return gx(this,e)}clear(){this.doc!==null?Ce(this.doc,e=>{this.forEach(function(n,r,s){zl(e,s,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(FO)}}const xO=t=>new ks,Yn=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&dR(t,e);class Bd{constructor(e,n,r,s){this.left=e,this.right=n,this.index=r,this.currentAttributes=s}forward(){switch(this.right===null&&Mt(),this.right.content.constructor){case Ge:this.right.deleted||_s(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}}const Cm=(t,e,n)=>{for(;e.right!==null&&n>0;){switch(e.right.content.constructor){case Ge:e.right.deleted||_s(e.currentAttributes,e.right.content);break;default:e.right.deleted||(n<e.right.length&&vt(t,ce(e.right.id.client,e.right.id.clock+n)),e.index+=e.right.length,n-=e.right.length);break}e.left=e.right,e.right=e.right.right}return e},To=(t,e,n,r)=>{const s=new Map,i=r?Sa(e,n):null;if(i){const o=new Bd(i.p.left,i.p,i.index,s);return Cm(t,o,n-i.index)}else{const o=new Bd(null,e._start,0,s);return Cm(t,o,n)}},yx=(t,e,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===Ge&&Yn(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const s=t.doc,i=s.clientID;r.forEach((o,l)=>{const a=n.left,c=n.right,d=new ve(ce(i,Ue(s.store,i)),a,a&&a.lastId,c,c&&c.id,e,null,new Ge(l,o));d.integrate(t,0),n.right=d,n.forward()})},_s=(t,e)=>{const{key:n,value:r}=e;r===null?t.delete(n):t.set(n,r)},bx=(t,e)=>{for(;t.right!==null;){if(!(t.right.deleted||t.right.content.constructor===Ge&&Yn(e[t.right.content.key]??null,t.right.content.value)))break;t.forward()}},xx=(t,e,n,r)=>{const s=t.doc,i=s.clientID,o=new Map;for(const l in r){const a=r[l],c=n.currentAttributes.get(l)??null;if(!Yn(c,a)){o.set(l,c);const{left:d,right:u}=n;n.right=new ve(ce(i,Ue(s.store,i)),d,d&&d.lastId,u,u&&u.id,e,null,new Ge(l,a)),n.right.integrate(t,0),n.forward()}}return o},Ic=(t,e,n,r,s)=>{n.currentAttributes.forEach((h,f)=>{s[f]===void 0&&(s[f]=null)});const i=t.doc,o=i.clientID;bx(n,s);const l=xx(t,e,n,s),a=r.constructor===String?new Xt(r):r instanceof tt?new en(r):new Vr(r);let{left:c,right:d,index:u}=n;e._searchMarker&&Mi(e._searchMarker,n.index,a.getLength()),d=new ve(ce(o,Ue(i.store,o)),c,c&&c.lastId,d,d&&d.id,e,null,a),d.integrate(t,0),n.right=d,n.index=u,n.forward(),yx(t,e,n,l)},Em=(t,e,n,r,s)=>{const i=t.doc,o=i.clientID;bx(n,s);const l=xx(t,e,n,s);e:for(;n.right!==null&&(r>0||l.size>0&&(n.right.deleted||n.right.content.constructor===Ge));){if(!n.right.deleted)switch(n.right.content.constructor){case Ge:{const{key:a,value:c}=n.right.content,d=s[a];if(d!==void 0){if(Yn(d,c))l.delete(a);else{if(r===0)break e;l.set(a,c)}n.right.delete(t)}else n.currentAttributes.set(a,c);break}default:r<n.right.length&&vt(t,ce(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let a="";for(;r>0;r--)a+=`
|
|
198
150
|
`;n.right=new ve(ce(o,Ue(i.store,o)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new Xt(a)),n.right.integrate(t,0),n.forward()}yx(t,e,n,l)},wx=(t,e,n,r,s)=>{let i=e;const o=Kt();for(;i&&(!i.countable||i.deleted);){if(!i.deleted&&i.content.constructor===Ge){const c=i.content;o.set(c.key,c)}i=i.right}let l=0,a=!1;for(;e!==i;){if(n===e&&(a=!0),!e.deleted){const c=e.content;switch(c.constructor){case Ge:{const{key:d,value:u}=c,h=r.get(d)??null;(o.get(d)!==c||h===u)&&(e.delete(t),l++,!a&&(s.get(d)??null)===u&&h!==u&&(h===null?s.delete(d):s.set(d,h))),!a&&!e.deleted&&_s(s,c);break}}}e=e.right}return l},wO=(t,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;const n=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===Ge){const r=e.content.key;n.has(r)?e.delete(t):n.add(r)}e=e.left}},kO=t=>{let e=0;return Ce(t.doc,n=>{let r=t._start,s=t._start,i=Kt();const o=Ad(i);for(;s;){if(s.deleted===!1)switch(s.content.constructor){case Ge:_s(o,s.content);break;default:e+=wx(n,r,s,i,o),i=Ad(o),r=s;break}s=s.right}}),e},vO=t=>{const e=new Set,n=t.doc;for(const[r,s]of t.afterState.entries()){const i=t.beforeState.get(r)||0;s!==i&&tx(t,n.store.clients.get(r),i,s,o=>{!o.deleted&&o.content.constructor===Ge&&o.constructor!==Bt&&e.add(o.parent)})}Ce(n,r=>{cr(t,t.deleteSet,s=>{if(s instanceof Bt||!s.parent._hasFormatting||e.has(s.parent))return;const i=s.parent;s.content.constructor===Ge?e.add(i):wO(r,s)});for(const s of e)kO(s)})},Mm=(t,e,n)=>{const r=n,s=Ad(e.currentAttributes),i=e.right;for(;n>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case en:case Vr:case Xt:n<e.right.length&&vt(t,ce(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t);break}e.forward()}i&&wx(t,i,e.right,s,e.currentAttributes);const o=(e.left||e.right).parent;return o._searchMarker&&Mi(o._searchMarker,e.index,-r+n),e};class SO extends va{constructor(e,n,r){super(e,n),this.childListChanged=!1,this.keysChanged=new Set,r.forEach(s=>{s===null?this.childListChanged=!0:this.keysChanged.add(s)})}get changes(){if(this._changes===null){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){const e=this.target.doc,n=[];Ce(e,r=>{const s=new Map,i=new Map;let o=this.target._start,l=null;const a={};let c="",d=0,u=0;const h=()=>{if(l!==null){let f=null;switch(l){case"delete":u>0&&(f={delete:u}),u=0;break;case"insert":(typeof c=="object"||c.length>0)&&(f={insert:c},s.size>0&&(f.attributes={},s.forEach((p,g)=>{p!==null&&(f.attributes[g]=p)}))),c="";break;case"retain":d>0&&(f={retain:d},aR(a)||(f.attributes=oR({},a))),d=0;break}f&&n.push(f),l=null}};for(;o!==null;){switch(o.content.constructor){case en:case Vr:this.adds(o)?this.deletes(o)||(h(),l="insert",c=o.content.getContent()[0],h()):this.deletes(o)?(l!=="delete"&&(h(),l="delete"),u+=1):o.deleted||(l!=="retain"&&(h(),l="retain"),d+=1);break;case Xt:this.adds(o)?this.deletes(o)||(l!=="insert"&&(h(),l="insert"),c+=o.content.str):this.deletes(o)?(l!=="delete"&&(h(),l="delete"),u+=o.length):o.deleted||(l!=="retain"&&(h(),l="retain"),d+=o.length);break;case Ge:{const{key:f,value:p}=o.content;if(this.adds(o)){if(!this.deletes(o)){const g=s.get(f)??null;Yn(g,p)?p!==null&&o.delete(r):(l==="retain"&&h(),Yn(p,i.get(f)??null)?delete a[f]:a[f]=p)}}else if(this.deletes(o)){i.set(f,p);const g=s.get(f)??null;Yn(g,p)||(l==="retain"&&h(),a[f]=g)}else if(!o.deleted){i.set(f,p);const g=a[f];g!==void 0&&(Yn(g,p)?g!==null&&o.delete(r):(l==="retain"&&h(),p===null?delete a[f]:a[f]=p))}o.deleted||(l==="insert"&&h(),_s(s,o.content));break}}o=o.right}for(h();n.length>0;){const f=n[n.length-1];if(f.retain!==void 0&&f.attributes===void 0)n.pop();else break}}),this._delta=n}return this._delta}}class dr extends tt{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??ft(),this._length}_integrate(e,n){super._integrate(e,n);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new dr}clone(){const e=new dr;return e.applyDelta(this.toDelta()),e}_callObserver(e,n){super._callObserver(e,n);const r=new SO(this,e,n);Ca(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??ft();let e="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===Xt&&(e+=n.content.str),n=n.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:n=!0}={}){this.doc!==null?Ce(this.doc,r=>{const s=new Bd(null,this._start,0,new Map);for(let i=0;i<e.length;i++){const o=e[i];if(o.insert!==void 0){const l=!n&&typeof o.insert=="string"&&i===e.length-1&&s.right===null&&o.insert.slice(-1)===`
|
|
199
|
-
`?o.insert.slice(0,-1):o.insert;(typeof l!="string"||l.length>0)&&Ic(r,this,s,l,o.attributes||{})}else o.retain!==void 0?Em(r,this,s,o.retain,o.attributes||{}):o.delete!==void 0&&Mm(r,s,o.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,r){this.doc??ft();const s=[],i=new Map,o=this.doc;let l="",a=this._start;function c(){if(l.length>0){const u={};let h=!1;i.forEach((p,g)=>{h=!0,u[g]=p});const f={insert:l};h&&(f.attributes=u),s.push(f),l=""}}const d=()=>{for(;a!==null;){if(br(a,e)||n!==void 0&&br(a,n))switch(a.content.constructor){case Xt:{const u=i.get("ychange");e!==void 0&&!br(a,e)?(u===void 0||u.user!==a.id.client||u.type!=="removed")&&(c(),i.set("ychange",r?r("removed",a.id):{type:"removed"})):n!==void 0&&!br(a,n)?(u===void 0||u.user!==a.id.client||u.type!=="added")&&(c(),i.set("ychange",r?r("added",a.id):{type:"added"})):u!==void 0&&(c(),i.delete("ychange")),l+=a.content.str;break}case en:case Vr:{c();const u={insert:a.content.getContent()[0]};if(i.size>0){const h={};u.attributes=h,i.forEach((f,p)=>{h[p]=f})}s.push(u);break}case Ge:br(a,e)&&(c(),_s(i,a.content));break}a=a.right}c()};return e||n?Ce(o,u=>{e&&jd(u,e),n&&jd(u,n),d()},"cleanup"):d(),s}insert(e,n,r){if(n.length<=0)return;const s=this.doc;s!==null?Ce(s,i=>{const o=To(i,this,e,!r);r||(r={},o.currentAttributes.forEach((l,a)=>{r[a]=l})),Ic(i,this,o,n,r)}):this._pending.push(()=>this.insert(e,n,r))}insertEmbed(e,n,r){const s=this.doc;s!==null?Ce(s,i=>{const o=To(i,this,e,!r);Ic(i,this,o,n,r||{})}):this._pending.push(()=>this.insertEmbed(e,n,r||{}))}delete(e,n){if(n===0)return;const r=this.doc;r!==null?Ce(r,s=>{Mm(s,To(s,this,e,!0),n)}):this._pending.push(()=>this.delete(e,n))}format(e,n,r){if(n===0)return;const s=this.doc;s!==null?Ce(s,i=>{const o=To(i,this,e,!1);o.right!==null&&Em(i,this,o,n,r)}):this._pending.push(()=>this.format(e,n,r))}removeAttribute(e){this.doc!==null?Ce(this.doc,n=>{zl(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?Ce(this.doc,r=>{mh(r,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return gh(this,e)}getAttributes(){return mx(this)}_write(e){e.writeTypeRef(UO)}}const CO=t=>new dr;class jc{constructor(e,n=()=>!0){this._filter=n,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??ft()}[Symbol.iterator](){return this}next(){let e=this._currentNode,n=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(n)))do if(n=e.content.type,!e.deleted&&(n.constructor===ht||n.constructor===$r)&&n._start!==null)e=n._start;else for(;e!==null;){const r=e.next;if(r!==null){e=r;break}else e.parent===this._root?e=null:e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class $r extends tt{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new $r}clone(){const e=new $r;return e.insert(0,this.toArray().map(n=>n instanceof tt?n.clone():n)),e}get length(){return this.doc??ft(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new jc(this,e)}querySelector(e){e=e.toUpperCase();const r=new jc(this,s=>s.nodeName&&s.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),Br(new jc(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){Ca(this,e,new AO(this,n,e))}toString(){return dx(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,n={},r){const s=e.createDocumentFragment();return r!==void 0&&r._createAssociation(s,this),Ai(this,i=>{s.insertBefore(i.toDOM(e,n,r),null)}),s}insert(e,n){this.doc!==null?Ce(this.doc,r=>{fx(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)Ce(this.doc,r=>{const s=e&&e instanceof tt?e._item:e;Hl(r,this,s,n)});else{const r=this._prelimContent,s=e===null?0:r.findIndex(i=>i===e)+1;if(s===0&&e!==null)throw ar("Reference item not found");r.splice(s,0,...n)}}delete(e,n=1){this.doc!==null?Ce(this.doc,r=>{px(r,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return ax(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return ux(this,e)}slice(e=0,n=this.length){return lx(this,e,n)}forEach(e){Ai(this,e)}_write(e){e.writeTypeRef(WO)}}const EO=t=>new $r;class ht extends $r{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,n){super._integrate(e,n),this._prelimAttrs.forEach((r,s)=>{this.setAttribute(s,r)}),this._prelimAttrs=null}_copy(){return new ht(this.nodeName)}clone(){const e=new ht(this.nodeName),n=this.getAttributes();return lR(n,(r,s)=>{typeof r=="string"&&e.setAttribute(s,r)}),e.insert(0,this.toArray().map(r=>r instanceof tt?r.clone():r)),e}toString(){const e=this.getAttributes(),n=[],r=[];for(const l in e)r.push(l);r.sort();const s=r.length;for(let l=0;l<s;l++){const a=r[l];n.push(a+'="'+e[a]+'"')}const i=this.nodeName.toLocaleLowerCase(),o=n.length>0?" "+n.join(" "):"";return`<${i}${o}>${super.toString()}</${i}>`}removeAttribute(e){this.doc!==null?Ce(this.doc,n=>{zl(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?Ce(this.doc,r=>{mh(r,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return gh(this,e)}hasAttribute(e){return gx(this,e)}getAttributes(e){return e?mO(this,e):mx(this)}toDOM(e=document,n={},r){const s=e.createElement(this.nodeName),i=this.getAttributes();for(const o in i){const l=i[o];typeof l=="string"&&s.setAttribute(o,l)}return Ai(this,o=>{s.appendChild(o.toDOM(e,n,r))}),r!==void 0&&r._createAssociation(s,this),s}_write(e){e.writeTypeRef(VO),e.writeKey(this.nodeName)}}const MO=t=>new ht(t.readKey());class AO extends va{constructor(e,n,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,n.forEach(s=>{s===null?this.childListChanged=!0:this.attributesChanged.add(s)})}}class Fl extends ks{constructor(e){super(),this.hookName=e}_copy(){return new Fl(this.hookName)}clone(){const e=new Fl(this.hookName);return this.forEach((n,r)=>{e.set(r,n)}),e}toDOM(e=document,n={},r){const s=n[this.hookName];let i;return s!==void 0?i=s.createDom(this):i=document.createElement(this.hookName),i.setAttribute("data-yjs-hook",this.hookName),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(qO),e.writeKey(this.hookName)}}const TO=t=>new Fl(t.readKey());class Et extends dr{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new Et}clone(){const e=new Et;return e.applyDelta(this.toDelta()),e}toDOM(e=document,n,r){const s=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(s,this),s}toString(){return this.toDelta().map(e=>{const n=[];for(const s in e.attributes){const i=[];for(const o in e.attributes[s])i.push({key:o,value:e.attributes[s][o]});i.sort((o,l)=>o.key<l.key?-1:1),n.push({nodeName:s,attrs:i})}n.sort((s,i)=>s.nodeName<i.nodeName?-1:1);let r="";for(let s=0;s<n.length;s++){const i=n[s];r+=`<${i.nodeName}`;for(let o=0;o<i.attrs.length;o++){const l=i.attrs[o];r+=` ${l.key}="${l.value}"`}r+=">"}r+=e.insert;for(let s=n.length-1;s>=0;s--)r+=`</${n[s].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(KO)}}const NO=t=>new Et;class yh{constructor(e,n){this.id=e,this.length=n}get deleted(){throw Gt()}mergeWith(e){return!1}write(e,n,r){throw Gt()}integrate(e,n){throw Gt()}}const _O=0;class Bt extends yh{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){n>0&&(this.id.clock+=n,this.length-=n),ex(e.doc.store,this)}write(e,n){e.writeInfo(_O),e.writeLen(this.length-n)}getMissing(e,n){return null}}class Fi{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new Fi(this.content)}splice(e){throw Gt()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}}const RO=t=>new Fi(t.readBuf());class Ti{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Ti(this.len)}splice(e){const n=new Ti(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){Si(e.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(e){}gc(e){}write(e,n){e.writeLen(this.len-n)}getRef(){return 1}}const OO=t=>new Ti(t.readLen()),kx=(t,e)=>new Ur({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class Ui{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const n={};this.opts=n,e.gc||(n.gc=!1),e.autoLoad&&(n.autoLoad=!0),e.meta!==null&&(n.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new Ui(kx(this.doc.guid,this.opts))}splice(e){throw Gt()}mergeWith(e){return!1}integrate(e,n){this.doc._item=n,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,n){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}const DO=t=>new Ui(kx(t.readString(),t.readAny()));class Vr{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new Vr(this.embed)}splice(e){throw Gt()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}}const LO=t=>new Vr(t.readJSON());class Ge{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new Ge(this.key,this.value)}splice(e){throw Gt()}mergeWith(e){return!1}integrate(e,n){const r=n.parent;r._searchMarker=null,r._hasFormatting=!0}delete(e){}gc(e){}write(e,n){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const IO=t=>new Ge(t.readKey(),t.readJSON());class Ul{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Ul(this.arr)}splice(e){const n=new Ul(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let s=n;s<r;s++){const i=this.arr[s];e.writeString(i===void 0?"undefined":JSON.stringify(i))}}getRef(){return 2}}const jO=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++){const s=t.readString();s==="undefined"?n.push(void 0):n.push(JSON.parse(s))}return new Ul(n)},PO=Pl("node_env")==="development";class Hr{constructor(e){this.arr=e,PO&&P0(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Hr(this.arr)}splice(e){const n=new Hr(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let s=n;s<r;s++){const i=this.arr[s];e.writeAny(i)}}getRef(){return 8}}const BO=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++)n.push(t.readAny());return new Hr(n)};class Xt{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new Xt(this.str)}splice(e){const n=new Xt(this.str.slice(e));this.str=this.str.slice(0,e);const r=this.str.charCodeAt(e-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"�",n.str="�"+n.str.slice(1)),n}mergeWith(e){return this.str+=e.str,!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}}const $O=t=>new Xt(t.readString()),HO=[yO,xO,CO,MO,EO,TO,NO],zO=0,FO=1,UO=2,VO=3,WO=4,qO=5,KO=6;class en{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new en(this.type._copy())}splice(e){throw Gt()}mergeWith(e){return!1}integrate(e,n){this.type._integrate(e.doc,n)}delete(e){let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(e.beforeState.get(n.id.client)||0)&&e._mergeStructs.push(n):n.delete(e),n=n.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(e.beforeState.get(r.id.client)||0)&&e._mergeStructs.push(r):r.delete(e)}),e.changed.delete(this.type)}gc(e){let n=this.type._start;for(;n!==null;)n.gc(e,!0),n=n.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(e,!0),r=r.left}),this.type._map=new Map}write(e,n){this.type._write(e)}getRef(){return 7}}const GO=t=>new en(HO[t.readTypeRef()](t)),$d=(t,e)=>{let n=e,r=0,s;do r>0&&(n=ce(n.client,n.clock+r)),s=cs(t,n),r=n.clock-s.id.clock,n=s.redone;while(n!==null&&s instanceof ve);return{item:s,diff:r}},bh=(t,e)=>{for(;t!==null&&t.keep!==e;)t.keep=e,t=t.parent._item},Vl=(t,e,n)=>{const{client:r,clock:s}=e.id,i=new ve(ce(r,s+n),e,ce(r,s+n-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(n));return e.deleted&&i.markDeleted(),e.keep&&(i.keep=!0),e.redone!==null&&(i.redone=ce(e.redone.client,e.redone.clock+n)),e.right=i,i.right!==null&&(i.right.left=i),t._mergeStructs.push(i),i.parentSub!==null&&i.right===null&&i.parent._map.set(i.parentSub,i),e.length=n,i},Am=(t,e)=>x_(t,n=>Ns(n.deletions,e)),vx=(t,e,n,r,s,i)=>{const o=t.doc,l=o.store,a=o.clientID,c=e.redone;if(c!==null)return vt(t,c);let d=e.parent._item,u=null,h;if(d!==null&&d.deleted===!0){if(d.redone===null&&(!n.has(d)||vx(t,d,n,r,s,i)===null))return null;for(;d.redone!==null;)d=vt(t,d.redone)}const f=d===null?e.parent:d.content.type;if(e.parentSub===null){for(u=e.left,h=e;u!==null;){let b=u;for(;b!==null&&b.parent._item!==d;)b=b.redone===null?null:vt(t,b.redone);if(b!==null&&b.parent._item===d){u=b;break}u=u.left}for(;h!==null;){let b=h;for(;b!==null&&b.parent._item!==d;)b=b.redone===null?null:vt(t,b.redone);if(b!==null&&b.parent._item===d){h=b;break}h=h.right}}else if(h=null,e.right&&!s){for(u=e;u!==null&&u.right!==null&&(u.right.redone||Ns(r,u.right.id)||Am(i.undoStack,u.right.id)||Am(i.redoStack,u.right.id));)for(u=u.right;u.redone;)u=vt(t,u.redone);if(u&&u.right!==null)return null}else u=f._map.get(e.parentSub)||null;const p=Ue(l,a),g=ce(a,p),y=new ve(g,u,u&&u.lastId,h,h&&h.id,f,e.parentSub,e.content.copy());return e.redone=g,bh(y,!0),y.integrate(t,0),y};class ve extends yh{constructor(e,n,r,s,i,o,l,a){super(e,a.getLength()),this.origin=r,this.left=n,this.right=s,this.rightOrigin=i,this.parent=o,this.parentSub=l,this.redone=null,this.content=a,this.info=this.content.isCountable()?rm:0}set marker(e){(this.info&Nc)>0!==e&&(this.info^=Nc)}get marker(){return(this.info&Nc)>0}get keep(){return(this.info&nm)>0}set keep(e){this.keep!==e&&(this.info^=nm)}get countable(){return(this.info&rm)>0}get deleted(){return(this.info&Tc)>0}set deleted(e){this.deleted!==e&&(this.info^=Tc)}markDeleted(){this.info|=Tc}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Ue(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Ue(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===as&&this.id.client!==this.parent.client&&this.parent.clock>=Ue(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=ym(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=vt(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===Bt||this.right&&this.right.constructor===Bt)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===ve?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===ve&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===as){const r=cs(n,this.parent);r.constructor===Bt?this.parent=null:this.parent=r.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=ym(e,e.doc.store,ce(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,s;if(r!==null)s=r.right;else if(this.parentSub!==null)for(s=this.parent._map.get(this.parentSub)||null;s!==null&&s.left!==null;)s=s.left;else s=this.parent._start;const i=new Set,o=new Set;for(;s!==null&&s!==this.right;){if(o.add(s),i.add(s),Eo(this.origin,s.origin)){if(s.id.client<this.id.client)r=s,i.clear();else if(Eo(this.rightOrigin,s.rightOrigin))break}else if(s.origin!==null&&o.has(cs(e.doc.store,s.origin)))i.has(cs(e.doc.store,s.origin))||(r=s,i.clear());else break;s=s.right}this.left=r}if(this.left!==null){const r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),ex(e.doc.store,this),this.content.integrate(e,this),xm(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new Bt(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:ce(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&Eo(e.origin,this.lastId)&&this.right===e&&Eo(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const n=this.parent._searchMarker;return n&&n.forEach(r=>{r.p===e&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),Si(e.deleteSet,this.id.client,this.id.clock,this.length),xm(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw Mt();this.content.gc(e),n?QR(e,this,new Bt(this.id,this.length)):this.content=new Ti(this.length)}write(e,n){const r=n>0?ce(this.id.client,this.id.clock+n-1):this.origin,s=this.rightOrigin,i=this.parentSub,o=this.content.getRef()&ya|(r===null?0:yt)|(s===null?0:Tn)|(i===null?0:wi);if(e.writeInfo(o),r!==null&&e.writeLeftID(r),s!==null&&e.writeRightID(s),r===null&&s===null){const l=this.parent;if(l._item!==void 0){const a=l._item;if(a===null){const c=Ci(l);e.writeParentInfo(!0),e.writeString(c)}else e.writeParentInfo(!1),e.writeLeftID(a.id)}else l.constructor===String?(e.writeParentInfo(!0),e.writeString(l)):l.constructor===as?(e.writeParentInfo(!1),e.writeLeftID(l)):Mt();i!==null&&e.writeString(i)}this.content.write(e,n)}}const Sx=(t,e)=>JO[e&ya](t),JO=[()=>{Mt()},OO,jO,RO,$O,LO,IO,GO,BO,DO,()=>{Mt()}],YO=10;class Vt extends yh{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){Mt()}write(e,n){e.writeInfo(YO),me(e.restEncoder,this.length-n)}getMissing(e,n){return null}}const Cx=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},Ex="__ $YJS$ __";Cx[Ex]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");Cx[Ex]=!0;const XO=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}},ZO=/[\uD800-\uDBFF]/,QO=/[\uDC00-\uDFFF]/,eD=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&ZO.test(t[n-1])&&n--;r+n<t.length&&r+n<e.length&&t[t.length-r-1]===e[e.length-r-1];)r++;return r>0&&QO.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},tD=eD,an=(t,e)=>t>>>e|t<<32-e,nD=t=>an(t,2)^an(t,13)^an(t,22),rD=t=>an(t,6)^an(t,11)^an(t,25),sD=t=>an(t,7)^an(t,18)^t>>>3,iD=t=>an(t,17)^an(t,19)^t>>>10,oD=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),lD=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class aD{constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(lD),this._W=new Uint32Array(e,64,64)}_updateHash(){const e=this._H,n=this._W;for(let u=16;u<64;u++)n[u]=iD(n[u-2])+n[u-7]+sD(n[u-15])+n[u-16];let r=e[0],s=e[1],i=e[2],o=e[3],l=e[4],a=e[5],c=e[6],d=e[7];for(let u=0,h,f;u<64;u++)h=d+rD(l)+(l&a^~l&c)+oD[u]+n[u]>>>0,f=nD(r)+(r&s^r&i^s&i)>>>0,d=c,c=a,a=l,l=o+h>>>0,o=i,i=s,s=r,r=h+f>>>0;e[0]+=r,e[1]+=s,e[2]+=i,e[3]+=o,e[4]+=l,e[5]+=a,e[6]+=c,e[7]+=d}digest(e){let n=0;for(;n+56<=e.length;){let o=0;for(;o<16&&n+3<e.length;o++)this._W[o]=e[n++]<<24|e[n++]<<16|e[n++]<<8|e[n++];if(n%64!==0){for(this._W.fill(0,o,16);n<e.length;)this._W[o]|=e[n]<<(3-n%4)*8,n++;this._W[o]|=yt<<(3-n%4)*8}this._updateHash()}const r=n%64!==0;this._W.fill(0,0,16);let s=0;for(;n<e.length;s++)for(let o=3;o>=0&&n<e.length;o--)this._W[s]|=e[n++]<<o*8;r||(this._W[s-(n%4===0?0:1)]|=yt<<(3-n%4)*8),this._W[14]=e.byteLength/w_,this._W[15]=e.byteLength*8,this._updateHash();const i=new Uint8Array(32);for(let o=0;o<this._H.length;o++)for(let l=0;l<4;l++)i[o*4+l]=this._H[o]>>>(3-l)*8;return i}}const cD=t=>new aD().digest(t),Ie=new ge("y-sync"),Nn=new ge("y-undo");new ge("yjs-cursor");const dD=t=>{for(let n=6;n<t.length;n++)t[n%6]=t[n%6]^t[n];return t.slice(0,6)},uD=t=>bR(dD(cD(xR(t)))),Wl=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&e.sv.get(t.id.client)>t.id.clock&&!Ns(e.ds,t.id),hD=[{light:"#ecd44433",dark:"#ecd444"}],fD=(t,e,n)=>{if(!t.has(n)){if(t.size<e.length){const r=Pr();t.forEach(s=>r.add(s)),e=e.filter(s=>!r.has(s))}t.set(n,Q_(e))}return t.get(n)},pD=(t,{colors:e=hD,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:s=()=>{},mapping:i}={})=>{let o=!1;const l=new gD(t,i),a=new pe({props:{editable:c=>{const d=Ie.getState(c);return d.snapshot==null&&d.prevSnapshot==null}},key:Ie,state:{init:(c,d)=>({type:t,doc:t.doc,binding:l,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:n,permanentUserData:r}),apply:(c,d)=>{const u=c.getMeta(Ie);if(u!==void 0){d=Object.assign({},d);for(const h in u)d[h]=u[h]}return d.addToHistory=c.getMeta("addToHistory")!==!1,d.isChangeOrigin=u!==void 0&&!!u.isChangeOrigin,d.isUndoRedoOperation=u!==void 0&&!!u.isChangeOrigin&&!!u.isUndoRedoOperation,l.prosemirrorView!==null&&u!==void 0&&(u.snapshot!=null||u.prevSnapshot!=null)&&H0(0,()=>{l.prosemirrorView!=null&&(u.restore==null?l._renderSnapshot(u.snapshot,u.prevSnapshot,d):(l._renderSnapshot(u.snapshot,u.snapshot,d),delete d.restore,delete d.snapshot,delete d.prevSnapshot,l.mux(()=>{l._prosemirrorChanged(l.prosemirrorView.state.doc)})))}),d}},view:c=>(l.initView(c),i==null&&l._forceRerender(),s(),{update:()=>{const d=a.getState(c.state);if(d.snapshot==null&&d.prevSnapshot==null&&(o||c.state.doc.content.findDiffStart(c.state.doc.type.createAndFill().content)!==null)){if(o=!0,d.addToHistory===!1&&!d.isChangeOrigin){const u=Nn.getState(c.state),h=u&&u.undoManager;h&&h.stopCapturing()}l.mux(()=>{d.doc.transact(u=>{u.meta.set("addToHistory",d.addToHistory),l._prosemirrorChanged(c.state.doc)},Ie)})}},destroy:()=>{l.destroy()}})});return a},mD=(t,e,n)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")t.setSelection(new St(t.doc));else if(e.type==="node"){const r=Vo(n.doc,n.type,e.anchor,n.mapping);t.setSelection(q.create(t.doc,r))}else{const r=Vo(n.doc,n.type,e.anchor,n.mapping),s=Vo(n.doc,n.type,e.head,n.mapping);r!==null&&s!==null&&t.setSelection(J.between(t.doc.resolve(r),t.doc.resolve(s)))}},Hd=(t,e)=>({type:e.selection.jsonID,anchor:Vd(e.selection.anchor,t.type,t.mapping),head:Vd(e.selection.head,t.type,t.mapping)});class gD{constructor(e,n=new Map){this.type=e,this.prosemirrorView=null,this.mux=XO(),this.mapping=n,this.isOMark=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=Hd(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(B0&&this._domSelectionInView===null&&(H0(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){const e=this.prosemirrorView._root.getSelection();if(e==null||e.anchorNode==null)return!1;const n=this.prosemirrorView._root.createRange();n.setStart(e.anchorNode,e.anchorOffset),n.setEnd(e.focusNode,e.focusOffset),n.getClientRects().length===0&&n.startContainer&&n.collapsed&&n.selectNodeContents(n.startContainer);const s=n.getBoundingClientRect(),i=kR.documentElement;return s.bottom>=0&&s.right>=0&&s.left<=(window.innerWidth||i.clientWidth||0)&&s.top<=(window.innerHeight||i.clientHeight||0)}renderSnapshot(e,n){n||(n=Z0(G0(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(Ie,{snapshot:e,prevSnapshot:n}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const e=this.type.toArray().map(r=>Uo(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new P(O.from(e),0,0));n.setMeta(Ie,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(n)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{const e=this.beforeTransactionSelection!==null?null:this.prosemirrorView.state.selection,n=this.type.toArray().map(s=>Uo(s,this.prosemirrorView.state.schema,this)).filter(s=>s!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new P(O.from(n),0,0));if(e){const s=bs(lr(e.anchor,0),r.doc.content.size),i=bs(lr(e.head,0),r.doc.content.size);r.setSelection(J.create(r.doc,s,i))}this.prosemirrorView.dispatch(r.setMeta(Ie,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,n,r){let s=this.doc,i=this.type;if(e||(e=Lc(this.doc)),e instanceof Uint8Array||n instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(n instanceof Uint8Array))&&Mt(),s=new Ur({gc:!1}),Id(s,n),n=Lc(s),Id(s,e),e=Lc(s),i._item===null){const o=Array.from(this.doc.share.keys()).find(l=>this.doc.share.get(l)===this.type);i=s.getXmlFragment(o)}else{const o=s.store.clients.get(i._item.id.client)??[],l=Yt(o,i._item.id.clock);i=o[l].content.type}this.mapping.clear(),this.mux(()=>{s.transact(o=>{const l=r.permanentUserData;l&&l.dss.forEach(u=>{cr(o,u,h=>{})});const a=(u,h)=>{const f=u==="added"?l.getUserByClientId(h.client):l.getUserByDeletedId(h);return{user:f,type:u,color:fD(r.colorMapping,r.colors,f)}},c=cx(i,new fh(n.ds,e.sv)).map(u=>!u._item.deleted||Wl(u._item,e)||Wl(u._item,n)?Uo(u,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,n,a):null).filter(u=>u!==null),d=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new P(O.from(c),0,0));this.prosemirrorView.dispatch(d.setMeta(Ie,{isChangeOrigin:!0}))},Ie)})}_typeChanged(e,n){if(this.prosemirrorView==null)return;const r=Ie.getState(this.prosemirrorView.state);if(e.length===0||r.snapshot!=null||r.prevSnapshot!=null){this.renderSnapshot(r.snapshot,r.prevSnapshot);return}this.mux(()=>{const s=(l,a)=>this.mapping.delete(a);cr(n,n.deleteSet,l=>{if(l.constructor===ve){const a=l.content.type;a&&this.mapping.delete(a)}}),n.changed.forEach(s),n.changedParentTypes.forEach(s);const i=this.type.toArray().map(l=>Mx(l,this.prosemirrorView.state.schema,this)).filter(l=>l!==null);let o=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new P(O.from(i),0,0));mD(o,this.beforeTransactionSelection,this),o=o.setMeta(Ie,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof rx}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&o.scrollIntoView(),this.prosemirrorView.dispatch(o)})}_prosemirrorChanged(e){this.doc.transact(()=>{Fd(this.doc,this.type,e,this),this.beforeTransactionSelection=Hd(this,this.prosemirrorView.state)},Ie)}initView(e){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=e,this.doc.on("beforeAllTransactions",this.beforeAllTransactions),this.doc.on("afterAllTransactions",this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off("beforeAllTransactions",this.beforeAllTransactions),this.doc.off("afterAllTransactions",this.afterAllTransactions))}}const Mx=(t,e,n,r,s,i)=>{const o=n.mapping.get(t);if(o===void 0){if(t instanceof ht)return Uo(t,e,n,r,s,i);throw Gt()}return o},Uo=(t,e,n,r,s,i)=>{const o=[],l=a=>{if(a instanceof ht){const c=Mx(a,e,n,r,s,i);c!==null&&o.push(c)}else{const c=a._item.right?.content?.type;c instanceof dr&&!c._item.deleted&&c._item.id.client===c.doc.clientID&&(a.applyDelta([{retain:a.length},...c.toDelta()]),c.doc.transact(u=>{c._item.delete(u)}));const d=yD(a,e,n,r,s,i);d!==null&&d.forEach(u=>{u!==null&&o.push(u)})}};r===void 0||s===void 0?t.toArray().forEach(l):cx(t,new fh(s.ds,r.sv)).forEach(l);try{const a=t.getAttributes(r);r!==void 0&&(Wl(t._item,r)?Wl(t._item,s)||(a.ychange=i?i("added",t._item.id):{type:"added"}):a.ychange=i?i("removed",t._item.id):{type:"removed"});const c=e.node(t.nodeName,a,o);return n.mapping.set(t,c),c}catch{return t.doc.transact(c=>{t._item.delete(c)},Ie),n.mapping.delete(t),null}},yD=(t,e,n,r,s,i)=>{const o=[],l=t.toDelta(r,s,i);try{for(let a=0;a<l.length;a++){const c=l[a];o.push(e.text(c.insert,SD(c.attributes,e)))}}catch{return t.doc.transact(c=>{t._item.delete(c)},Ie),null}return o},bD=(t,e)=>{const n=new Et,r=t.map(s=>({insert:s.text,attributes:Tx(s.marks,e)}));return n.applyDelta(r),e.mapping.set(n,t),n},xD=(t,e)=>{const n=new ht(t.type.name);for(const r in t.attrs){const s=t.attrs[r];s!==null&&r!=="ychange"&&n.setAttribute(r,s)}return n.insert(0,Ea(t).map(r=>zd(r,e))),e.mapping.set(n,t),n},zd=(t,e)=>t instanceof Array?bD(t,e):xD(t,e),Tm=t=>typeof t=="object"&&t!==null,xh=(t,e)=>{const n=Object.keys(t).filter(s=>t[s]!==null);let r=n.length===Object.keys(e).filter(s=>e[s]!==null).length;for(let s=0;s<n.length&&r;s++){const i=n[s],o=t[i],l=e[i];r=i==="ychange"||o===l||Tm(o)&&Tm(l)&&xh(o,l)}return r},Ea=t=>{const e=t.content.content,n=[];for(let r=0;r<e.length;r++){const s=e[r];if(s.isText){const i=[];for(let o=e[r];r<e.length&&o.isText;o=e[++r])i.push(o);r--,n.push(i)}else n.push(s)}return n},Ax=(t,e)=>{const n=t.toDelta();return n.length===e.length&&n.every((r,s)=>r.insert===e[s].text&&I0(r.attributes||{}).length===e[s].marks.length&&j0(r.attributes,(i,o)=>{const l=wh(o),a=e[s].marks;return xh(i,a.find(c=>c.type.name===l)?.attrs)}))},Ni=(t,e)=>{if(t instanceof ht&&!(e instanceof Array)&&Ud(t,e)){const n=Ea(e);return t._length===n.length&&xh(t.getAttributes(),e.attrs)&&t.toArray().every((r,s)=>Ni(r,n[s]))}return t instanceof Et&&e instanceof Array&&Ax(t,e)},ql=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((n,r)=>e[r]===n),Nm=(t,e,n)=>{const r=t.toArray(),s=Ea(e),i=s.length,o=r.length,l=bs(o,i);let a=0,c=0,d=!1;for(;a<l;a++){const u=r[a],h=s[a];if(ql(n.mapping.get(u),h))d=!0;else if(!Ni(u,h))break}for(;a+c<l;c++){const u=r[o-c-1],h=s[i-c-1];if(ql(n.mapping.get(u),h))d=!0;else if(!Ni(u,h))break}return{equalityFactor:a+c,foundMappedChild:d}},wD=t=>{let e="",n=t._start;const r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof Xt?e+=n.content.str:n.content instanceof Ge&&(r[n.content.key]=null)),n=n.right;return{str:e,nAttrs:r}},kD=(t,e,n)=>{n.mapping.set(t,e);const{nAttrs:r,str:s}=wD(t),i=e.map(c=>({insert:c.text,attributes:Object.assign({},r,Tx(c.marks,n))})),{insert:o,remove:l,index:a}=tD(s,i.map(c=>c.insert).join(""));t.delete(a,l),t.insert(a,o),t.applyDelta(i.map(c=>({retain:c.insert.length,attributes:c.attributes})))},vD=/(.*)(--[a-zA-Z0-9+/=]{8})$/,wh=t=>vD.exec(t)?.[1]??t,SD=(t,e)=>{const n=[];for(const r in t)n.push(e.mark(wh(r),t[r]));return n},Tx=(t,e)=>{const n={};return t.forEach(r=>{if(r.type.name!=="ychange"){const s=On(e.isOMark,r.type,()=>!r.type.excludes(r.type));n[s?`${r.type.name}--${uD(r.toJSON())}`:r.type.name]=r.attrs}}),n},Fd=(t,e,n,r)=>{if(e instanceof ht&&e.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.mapping.set(e,n),e instanceof ht){const u=e.getAttributes(),h=n.attrs;for(const f in h)h[f]!==null?u[f]!==h[f]&&f!=="ychange"&&e.setAttribute(f,h[f]):e.removeAttribute(f);for(const f in u)h[f]===void 0&&e.removeAttribute(f)}const s=Ea(n),i=s.length,o=e.toArray(),l=o.length,a=bs(i,l);let c=0,d=0;for(;c<a;c++){const u=o[c],h=s[c];if(!ql(r.mapping.get(u),h))if(Ni(u,h))r.mapping.set(u,h);else break}for(;d+c+1<a;d++){const u=o[l-d-1],h=s[i-d-1];if(!ql(r.mapping.get(u),h))if(Ni(u,h))r.mapping.set(u,h);else break}t.transact(()=>{for(;l-c-d>0&&i-c-d>0;){const h=o[c],f=s[c],p=o[l-d-1],g=s[i-d-1];if(h instanceof Et&&f instanceof Array)Ax(h,f)||kD(h,f,r),c+=1;else{let y=h instanceof ht&&Ud(h,f),b=p instanceof ht&&Ud(p,g);if(y&&b){const w=Nm(h,f,r),M=Nm(p,g,r);w.foundMappedChild&&!M.foundMappedChild?b=!1:!w.foundMappedChild&&M.foundMappedChild||w.equalityFactor<M.equalityFactor?y=!1:b=!1}y?(Fd(t,h,f,r),c+=1):b?(Fd(t,p,g,r),d+=1):(r.mapping.delete(e.get(c)),e.delete(c,1),e.insert(c,[zd(f,r)]),c+=1)}}const u=l-c-d;if(l===1&&i===0&&o[0]instanceof Et?(r.mapping.delete(o[0]),o[0].delete(0,o[0].length)):u>0&&(e.slice(c,c+u).forEach(h=>r.mapping.delete(h)),e.delete(c,u)),c+d<i){const h=[];for(let f=c;f<i-d;f++)h.push(zd(s[f],r));e.insert(c,h)}},Ie)},Ud=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name,Vd=(t,e,n)=>{if(t===0)return Dc(e,0,-1);let r=e._first===null?null:e._first.content.type;for(;r!==null&&e!==r;){if(r instanceof Et){if(r._length>=t)return Dc(r,t,-1);if(t-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,t--;while(r!==e&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==e&&(r=r._item===null?null:r._item.next.content.type)}}else{const s=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&t<s)r=r._first.content.type,t--;else{if(t===1&&r._length===0&&s>1)return new $l(r._item===null?null:r._item.id,r._item===null?Ci(r):null,null);if(t-=s,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(t===0)return r=r._item===null?r:r._item.parent,new $l(r._item===null?null:r._item.id,r._item===null?Ci(r):null,null);do r=r._item.parent,t--;while(r!==e&&r._item.next===null);r!==e&&(r=r._item.next.content.type)}}}if(r===null)throw Mt();if(t===0&&r.constructor!==Et&&r!==e)return CD(r._item.parent,r._item)}return Dc(e,e._length,-1)},CD=(t,e)=>{let n=null,r=null;return t._item===null?r=Ci(t):n=ce(t._item.id.client,t._item.id.clock),new $l(n,r,e.id)},Vo=(t,e,n,r)=>{const s=XR(n,t);if(s===null||s.type!==e&&!Ei(e,s.type._item))return null;let i=s.type,o=0;if(i.constructor===Et)o=s.index;else if(i._item===null||!i._item.deleted){let l=i._first,a=0;for(;a<i._length&&a<s.index&&l!==null;){if(!l.deleted){const c=l.content.type;a++,c instanceof Et?o+=c._length:o+=r.get(c).nodeSize}l=l.right}o+=1}for(;i!==e&&i._item!==null;){const l=i._item.parent;if(l._item===null||!l._item.deleted){o+=1;let a=l._first;for(;a!==null;){const c=a.content.type;if(c===i)break;a.deleted||(c instanceof Et?o+=c._length:o+=r.get(c).nodeSize),a=a.right}}i=l}return o-1};function ED(t){const e=t.toArray(),n=r=>{let s;if(r instanceof Et)s=r.toDelta().map(o=>{const l={type:"text",text:o.insert};return o.attributes&&(l.marks=Object.keys(o.attributes).map(a=>{const c=o.attributes[a],u={type:wh(a)};return Object.keys(c)&&(u.attrs=c),u})),l});else if(r instanceof ht){s={type:r.nodeName};const i=r.getAttributes();Object.keys(i).length&&(s.attrs=i);const o=r.toArray();o.length&&(s.content=o.map(n).flat())}else Mt();return s};return{type:"doc",content:e.map(n)}}const MD=t=>{const e=Nn.getState(t).undoManager;if(e!=null)return e.undo(),!0},AD=t=>{const e=Nn.getState(t).undoManager;if(e!=null)return e.redo(),!0},TD=new Set(["paragraph"]),ND=(t,e)=>!(t instanceof ve)||!(t.content instanceof en)||!(t.content.type instanceof dr||t.content.type instanceof ht&&e.has(t.content.type.nodeName))||t.content.type._length===0,_D=({protectedNodes:t=TD,trackedOrigins:e=[],undoManager:n=null}={})=>new pe({key:Nn,state:{init:(r,s)=>{const i=Ie.getState(s),o=n||new rx(i.type,{trackedOrigins:new Set([Ie].concat(e)),deleteFilter:l=>ND(l,t),captureTransaction:l=>l.meta.get("addToHistory")!==!1});return{undoManager:o,prevSel:null,hasUndoOps:o.undoStack.length>0,hasRedoOps:o.redoStack.length>0}},apply:(r,s,i,o)=>{const l=Ie.getState(o).binding,a=s.undoManager,c=a.undoStack.length>0,d=a.redoStack.length>0;return l?{undoManager:a,prevSel:Hd(l,i),hasUndoOps:c,hasRedoOps:d}:c!==s.hasUndoOps||d!==s.hasRedoOps?Object.assign({},s,{hasUndoOps:a.undoStack.length>0,hasRedoOps:a.redoStack.length>0}):s}},view:r=>{const s=Ie.getState(r.state),i=Nn.getState(r.state).undoManager;return i.on("stack-item-added",({stackItem:o})=>{const l=s.binding;l&&o.meta.set(l,Nn.getState(r.state).prevSel)}),i.on("stack-item-popped",({stackItem:o})=>{const l=s.binding;l&&(l.beforeTransactionSelection=o.meta.get(l)||l.beforeTransactionSelection)}),{destroy:()=>{i.destroy()}}}});de.create({name:"collaboration",priority:1e3,addOptions(){return{document:null,field:"default",fragment:null,provider:null}},addStorage(){return{isDisabled:!1}},onCreate(){this.editor.extensionManager.extensions.find(t=>t.name==="undoRedo")&&console.warn('[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-undo-redo".')},addCommands(){return{undo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),Nn.getState(e).undoManager.undoStack.length===0?!1:n?MD(e):!0),redo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),Nn.getState(e).undoManager.redoStack.length===0?!1:n?AD(e):!0)}},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){var t;const e=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),n=_D(this.options.yUndoOptions),r=n.spec.view;n.spec.view=o=>{const{undoManager:l}=Nn.getState(o.state);l.restore&&(l.restore(),l.restore=()=>{});const a=r?r(o):void 0;return{destroy:()=>{const c=l.trackedOrigins.has(l),d=l._observers;l.restore=()=>{c&&l.trackedOrigins.add(l),l.doc.on("afterTransaction",l.afterTransactionHandler),l._observers=d},a?.destroy&&a.destroy()}}};const s={...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender},i=pD(e,s);return this.editor.options.enableContentCheck&&((t=e.doc)==null||t.on("beforeTransaction",()=>{try{const o=ED(e);if(o.content.length===0)return;this.editor.schema.nodeFromJSON(o).check()}catch(o){return this.editor.emit("contentError",{error:o,editor:this.editor,disableCollaboration:()=>{var l;(l=e.doc)==null||l.destroy(),this.storage.isDisabled=!0}}),!1}})),[i,n,this.editor.options.enableContentCheck&&new pe({key:new ge("filterInvalidContent"),filterTransaction:()=>{var o;return this.storage.isDisabled!==!1&&((o=e.doc)==null||o.destroy()),!0}})].filter(Boolean)}});function RD(t){return!!t.getMeta(Ie)}function _m(t){if(!t.length)return ye.empty;const e=[],n=t[0].$from.node(0);return t.forEach(r=>{const s=r.$from.pos,i=r.$from.nodeAfter;i&&e.push(_e.node(s,s+i.nodeSize,{class:"ProseMirror-selectednoderange"}))}),ye.create(n,e)}function Ma(t,e,n){const r=[],s=t.node(0);typeof n=="number"&&n>=0||(t.sameParent(e)?n=Math.max(0,t.sharedDepth(e.pos)-1):n=t.sharedDepth(e.pos));const i=new oi(t,e,n),o=i.depth===0?0:s.resolve(i.start).posAtIndex(0);return i.parent.forEach((l,a)=>{const c=o+a,d=c+l.nodeSize;if(c<i.start||c>=i.end)return;const u=new lu(s.resolve(c),s.resolve(d));r.push(u)}),r}var OD=class Nx{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Nx(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return new Xn(n,r)}},Xn=class Hn extends ee{constructor(e,n,r,s=1){const{doc:i}=e,o=e===n,l=e.pos===i.content.size&&n.pos===i.content.size,a=o&&!l?i.resolve(n.pos+(s>0?1:-1)):n,c=o&&l?i.resolve(e.pos-(s>0?1:-1)):e,d=Ma(c.min(a),c.max(a),r),u=a.pos>=e.pos?d[0].$from:d[d.length-1].$to,h=a.pos>=e.pos?d[d.length-1].$to:d[0].$from;super(u,h,d),this.depth=r}get $to(){return this.ranges[this.ranges.length-1].$to}eq(e){return e instanceof Hn&&e.$from.pos===this.$from.pos&&e.$to.pos===this.$to.pos}map(e,n){const r=e.resolve(n.map(this.anchor)),s=e.resolve(n.map(this.head));return new Hn(r,s)}toJSON(){return{type:"nodeRange",anchor:this.anchor,head:this.head}}get isForwards(){return this.head>=this.anchor}get isBackwards(){return!this.isForwards}extendBackwards(){const{doc:e}=this.$from;if(this.isForwards&&this.ranges.length>1){const s=this.ranges.slice(0,-1),i=s[0].$from,o=s[s.length-1].$to;return new Hn(i,o,this.depth)}const n=this.ranges[0],r=e.resolve(Math.max(0,n.$from.pos-1));return new Hn(this.$anchor,r,this.depth)}extendForwards(){const{doc:e}=this.$from;if(this.isBackwards&&this.ranges.length>1){const s=this.ranges.slice(1),i=s[0].$from,o=s[s.length-1].$to;return new Hn(o,i,this.depth)}const n=this.ranges[this.ranges.length-1],r=e.resolve(Math.min(e.content.size,n.$to.pos+1));return new Hn(this.$anchor,r,this.depth)}static fromJSON(e,n){return new Hn(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r,s,i=1){return new this(e.resolve(n),e.resolve(r),s,i)}getBookmark(){return new OD(this.anchor,this.head)}};Xn.prototype.visible=!1;function No(t){return t instanceof Xn}var DD=de.create({name:"nodeRange",addOptions(){return{depth:void 0,key:"Mod"}},addKeyboardShortcuts(){return{"Shift-ArrowUp":({editor:t})=>{const{depth:e}=this.options,{view:n,state:r}=t,{doc:s,selection:i,tr:o}=r,{anchor:l,head:a}=i;if(!No(i)){const d=Xn.create(s,l,a,e,-1);return o.setSelection(d),n.dispatch(o),!0}const c=i.extendBackwards();return o.setSelection(c),n.dispatch(o),!0},"Shift-ArrowDown":({editor:t})=>{const{depth:e}=this.options,{view:n,state:r}=t,{doc:s,selection:i,tr:o}=r,{anchor:l,head:a}=i;if(!No(i)){const d=Xn.create(s,l,a,e);return o.setSelection(d),n.dispatch(o),!0}const c=i.extendForwards();return o.setSelection(c),n.dispatch(o),!0},"Mod-a":({editor:t})=>{const{depth:e}=this.options,{view:n,state:r}=t,{doc:s,tr:i}=r,o=Xn.create(s,0,s.content.size,e);return i.setSelection(o),n.dispatch(i),!0}}},onSelectionUpdate(){const{selection:t}=this.editor.state;No(t)&&this.editor.view.dom.classList.add("ProseMirror-noderangeselection")},addProseMirrorPlugins(){let t=!1,e=!1;return[new pe({key:new ge("nodeRange"),props:{attributes:()=>t?{class:"ProseMirror-noderangeselection"}:{class:""},handleDOMEvents:{mousedown:(n,r)=>{const{key:s}=this.options,i=/Mac/.test(navigator.platform),o=!!r.shiftKey,l=!!r.ctrlKey,a=!!r.altKey,c=!!r.metaKey,d=i?c:l;return(s==null||s==="Shift"&&o||s==="Control"&&l||s==="Alt"&&a||s==="Meta"&&c||s==="Mod"&&d)&&(e=!0),e&&document.addEventListener("mouseup",()=>{e=!1;const{state:u}=n,{doc:h,selection:f,tr:p}=u,{$anchor:g,$head:y}=f;if(g.sameParent(y))return;const b=Xn.create(h,g.pos,y.pos,this.options.depth);p.setSelection(b),n.dispatch(p)},{once:!0}),!1}},decorations:n=>{const{selection:r}=n,s=No(r);if(t=!1,!e)return s?(t=!0,_m(r.ranges)):null;const{$from:i,$to:o}=r;if(!s&&i.sameParent(o))return null;const l=Ma(i,o,this.options.depth);return l.length?(t=!0,_m(l)):null}}})]}}),LD=DD;function ID(t){let e="";const n=getComputedStyle(t);for(let r=0;r<n.length;r+=1)e+=`${n[r]}:${n.getPropertyValue(n[r])};`;return e}function jD(t){const e=t.cloneNode(!0),n=[t,...Array.from(t.getElementsByTagName("*"))],r=[e,...Array.from(e.getElementsByTagName("*"))];return n.forEach((s,i)=>{r[i].style.cssText=ID(s)}),e}function PD(t,e){let n=t;for(;n?.parentElement&&n.parentElement!==e.dom;)n=n.parentElement;return n?.parentElement===e.dom?n:void 0}function BD(t,e,n,r=5){const s=t.dom,i=s.firstElementChild,o=s.lastElementChild;if(!i||!o)return{x:e,y:n};const l=i.getBoundingClientRect(),a=o.getBoundingClientRect(),c=Math.min(Math.max(l.top+r,n),a.bottom-r),d=.5,u=Math.abs(l.left-a.left)<d,h=Math.abs(l.right-a.right)<d;let f=l;return u&&h&&(f=l),{x:Math.min(Math.max(f.left+r,e),f.right-r),y:c}}var _x=t=>{const{x:e,y:n,editor:r}=t,{view:s,state:i}=r,{x:o,y:l}=BD(s,e,n,5),a=s.root.elementsFromPoint(o,l);let c;if(Array.prototype.some.call(a,h=>{if(!s.dom.contains(h))return!1;const f=PD(h,s);return f?(c=f,!0):!1}),!c)return{resultElement:null,resultNode:null,pos:null};let d;try{d=s.posAtDOM(c,0)}catch{return{resultElement:null,resultNode:null,pos:null}}const u=i.doc.nodeAt(d);return{resultElement:c,resultNode:u,pos:d}};function _o(t,e){return window.getComputedStyle(t)[e]}function $D(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function HD(t,e,n){const r=parseInt(_o(t.dom,"paddingLeft"),10),s=parseInt(_o(t.dom,"paddingRight"),10),i=parseInt(_o(t.dom,"borderLeftWidth"),10),o=parseInt(_o(t.dom,"borderLeftWidth"),10),l=t.dom.getBoundingClientRect();return{left:$D(e,l.left+r+i,l.right-s-o),top:n}}function Rx(t){var e;(e=t.parentNode)==null||e.removeChild(t)}function zD(t,e){const{doc:n}=e.view.state,r=_x({editor:e,x:t.clientX,y:t.clientY});if(!r.resultNode||r.pos===null)return[];const s=t.clientX,i=HD(e.view,s,t.clientY),o=e.view.posAtCoords(i);if(!o)return[];const{pos:l}=o;if(!n.resolve(l).parent)return[];const c=n.resolve(r.pos),d=n.resolve(r.pos+1);return Ma(c,d,0)}function FD(t,e){const{view:n}=e;if(!t.dataTransfer)return;const{empty:r,$from:s,$to:i}=n.state.selection,o=zD(t,e),l=Ma(s,i,0),a=l.some(y=>o.find(b=>b.$from===y.$from&&b.$to===y.$to)),c=r||!a?o:l;if(!c.length)return;const{tr:d}=n.state,u=document.createElement("div"),h=c[0].$from.pos,f=c[c.length-1].$to.pos,p=Xn.create(n.state.doc,h,f),g=p.content();c.forEach(y=>{const b=n.nodeDOM(y.$from.pos),w=jD(b);u.append(w)}),u.style.position="absolute",u.style.top="-10000px",document.body.append(u),t.dataTransfer.clearData(),t.dataTransfer.setDragImage(u,0,0),n.dragging={slice:g,move:!0},d.setSelection(p),n.dispatch(d),document.addEventListener("drop",()=>Rx(u),{once:!0})}var Rm=(t,e)=>{const n=t.resolve(e),{depth:r}=n;return r===0?e:n.pos-n.parentOffset-1},Om=(t,e)=>{const n=t.nodeAt(e),r=t.resolve(e);let{depth:s}=r,i=n;for(;s>0;){const o=r.node(s);s-=1,s===0&&(i=o)}return i},Pc=(t,e)=>{const n=Ie.getState(t);return n?Vd(e,n.type,n.binding.mapping):null},UD=(t,e)=>{const n=Ie.getState(t);return n?Vo(n.doc,n.type,e,n.binding.mapping)||0:-1},Dm=(t,e)=>{let n=e;for(;n?.parentNode&&n.parentNode!==t.dom;)n=n.parentNode;return n},Ox=new ge("dragHandle"),Dx=({pluginKey:t=Ox,element:e,editor:n,computePositionConfig:r,getReferencedVirtualElement:s,onNodeChange:i,onElementDragStart:o,onElementDragEnd:l})=>{const a=document.createElement("div");let c=!1,d=null,u=-1,h,f=null,p=null;function g(){e&&(e.style.visibility="hidden",e.style.pointerEvents="none")}function y(){if(e){if(!n.isEditable){g();return}e.style.visibility="",e.style.pointerEvents="auto"}}function b(S){const A=s?.()||{getBoundingClientRect:()=>S.getBoundingClientRect()};Fu(A,e,r).then(x=>{Object.assign(e.style,{position:x.strategy,left:`${x.x}px`,top:`${x.y}px`})})}function w(S){o?.(S),FD(S,n),setTimeout(()=>{e&&(e.style.pointerEvents="none")},0)}function M(S){l?.(S),g(),e&&(e.style.pointerEvents="auto")}return e.addEventListener("dragstart",w),e.addEventListener("dragend",M),a.appendChild(e),{unbind(){e.removeEventListener("dragstart",w),e.removeEventListener("dragend",M),f&&(cancelAnimationFrame(f),f=null,p=null)},plugin:new pe({key:typeof t=="string"?new ge(t):t,state:{init(){return{locked:!1}},apply(S,A,x,k){const v=S.getMeta("lockDragHandle"),T=S.getMeta("hideDragHandle");if(v!==void 0&&(c=v),T)return g(),c=!1,d=null,u=-1,i?.({editor:n,node:null,pos:-1}),A;if(S.docChanged&&u!==-1&&e)if(RD(S)){const N=UD(k,h);N!==u&&(u=N)}else{const N=S.mapping.map(u);N!==u&&(u=N,h=Pc(k,u))}return A}},view:S=>{var A;return e.draggable=!0,e.style.pointerEvents="auto",(A=n.view.dom.parentElement)==null||A.appendChild(a),a.style.pointerEvents="none",a.style.position="absolute",a.style.top="0",a.style.left="0",{update(x,k){if(!e)return;if(!n.isEditable){g();return}if(c?e.draggable=!1:e.draggable=!0,S.state.doc.eq(k.doc)||u===-1)return;let v=S.nodeDOM(u);if(v=Dm(S,v),v===S.dom||v?.nodeType!==1)return;const T=S.posAtDOM(v,0),N=Om(n.state.doc,T),H=Rm(n.state.doc,T);d=N,u=H,h=Pc(S.state,u),i?.({editor:n,node:d,pos:u}),b(v)},destroy(){f&&(cancelAnimationFrame(f),f=null,p=null),e&&Rx(a)}}},props:{handleDOMEvents:{keydown(S){return!e||c||S.hasFocus()&&(g(),d=null,u=-1,i?.({editor:n,node:null,pos:-1})),!1},mouseleave(S,A){return c||A.target&&!a.contains(A.relatedTarget)&&(g(),d=null,u=-1,i?.({editor:n,node:null,pos:-1})),!1},mousemove(S,A){return!e||c||(p={x:A.clientX,y:A.clientY},f)||(f=requestAnimationFrame(()=>{if(f=null,!p)return;const{x,y:k}=p;p=null;const v=_x({x,y:k,editor:n});if(!v.resultElement)return;let T=v.resultElement;if(T=Dm(S,T),T===S.dom||T?.nodeType!==1)return;const N=S.posAtDOM(T,0),H=Om(n.state.doc,N);if(H!==d){const V=Rm(n.state.doc,N);d=H,u=V,h=Pc(S.state,u),i?.({editor:n,node:d,pos:u}),b(T),y()}})),!1}}}})}},Wd={placement:"left-start",strategy:"absolute"},VD=de.create({name:"dragHandle",addOptions(){return{render(){const t=document.createElement("div");return t.classList.add("drag-handle"),t},computePositionConfig:{},locked:!1,onNodeChange:()=>null,onElementDragStart:void 0,onElementDragEnd:void 0}},addCommands(){return{lockDragHandle:()=>({editor:t})=>(this.options.locked=!0,t.commands.setMeta("lockDragHandle",this.options.locked)),unlockDragHandle:()=>({editor:t})=>(this.options.locked=!1,t.commands.setMeta("lockDragHandle",this.options.locked)),toggleDragHandle:()=>({editor:t})=>(this.options.locked=!this.options.locked,t.commands.setMeta("lockDragHandle",this.options.locked))}},addProseMirrorPlugins(){const t=this.options.render();return[Dx({computePositionConfig:{...Wd,...this.options.computePositionConfig},getReferencedVirtualElement:this.options.getReferencedVirtualElement,element:t,editor:this.editor,onNodeChange:this.options.onNodeChange,onElementDragStart:this.options.onElementDragStart,onElementDragEnd:this.options.onElementDragEnd}).plugin]}}),WD=VD;function qD(t){const e=t.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const s={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},i=t.inherit(t.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},l={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,n,s]};s.contains.push(l);const a={match:/\\"/},c={className:"string",begin:/'/,end:/'/},d={match:/\\'/},u={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,n]},h=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],f=t.SHEBANG({binary:`(${h.join("|")})`,relevance:10}),p={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},g=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],y=["true","false"],b={match:/(\/[a-z._-]+)+/},w=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],M=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],S=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],A=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:g,literal:y,built_in:[...w,...M,"set","shopt",...S,...A]},contains:[f,t.SHEBANG(),p,u,i,o,b,l,a,c,d,n]}}const KD=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),GD=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],JD=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],YD=[...GD,...JD],XD=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),ZD=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),QD=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),eL=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function tL(t){const e=t.regex,n=KD(t),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},s="and or not only",i=/@-?\w[\w]*(-\w+)*/,o="[a-zA-Z-][a-zA-Z0-9_-]*",l=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+o,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+ZD.join("|")+")"},{begin:":(:)?("+QD.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+eL.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...l,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...l,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:e.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:XD.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...l,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+YD.join("|")+")\\b"}]}}const Lm="[A-Za-z$_][0-9A-Za-z$_]*",nL=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],rL=["true","false","null","undefined","NaN","Infinity"],Lx=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Ix=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],jx=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],sL=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],iL=[].concat(jx,Lx,Ix);function oL(t){const e=t.regex,n=(F,{after:ue})=>{const xe="</"+F[0].slice(1);return F.input.indexOf(xe,ue)!==-1},r=Lm,s={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(F,ue)=>{const xe=F[0].length+F.index,_=F.input[xe];if(_==="<"||_===","){ue.ignoreMatch();return}_===">"&&(n(F,{after:xe})||ue.ignoreMatch());let Z;const fe=F.input.substring(xe);if(Z=fe.match(/^\s*=/)){ue.ignoreMatch();return}if((Z=fe.match(/^\s+extends\s+/))&&Z.index===0){ue.ignoreMatch();return}}},l={$pattern:Lm,keyword:nL,literal:rL,built_in:iL,"variable.language":sL},a="[0-9](_?[0-9])*",c=`\\.(${a})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",u={className:"number",variants:[{begin:`(\\b(${d})((${c})|\\.)?|(${c}))[eE][+-]?(${a})\\b`},{begin:`\\b(${d})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},y={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,h]},w={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},M=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,p,g,y,{match:/\$\d+/},u];h.contains=M.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(M)});const S=[].concat(w,h.contains),A=S.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(S)}]),x={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:A},k={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},v={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Lx,...Ix]}},T={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},N={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[x],illegal:/%/},H={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function V(F){return e.concat("(?!",F.join("|"),")")}const $={match:e.concat(/\b/,V([...jx,"super","import"].map(F=>`${F}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},I={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},j={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},x]},Q="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",ie={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(Q)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[x]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:A,CLASS_REFERENCE:v},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),T,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,p,g,y,w,{match:/\$\d+/},u,v,{scope:"attr",match:r+e.lookahead(":"),relevance:0},ie,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[w,t.REGEXP_MODE,{className:"function",begin:Q,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:A}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},N,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[x,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},I,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[x]},$,H,k,j,{match:/\$[(.]/}]}}function lL(t){const e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],s={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[e,n,t.QUOTE_STRING_MODE,s,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function aL(t){const e=t.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],l={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},a={className:"meta",begin:/^(>>>|\.\.\.) /},c={className:"subst",begin:/\{/,end:/\}/,keywords:l,illegal:/#/},d={begin:/\{\{/,relevance:0},u={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,a,d,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,a,d,c]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[t.BACKSLASH_ESCAPE,d,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,d,c]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},h="[0-9](_?[0-9])*",f=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,p=`\\b|${r.join("|")}`,g={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${f}))[eE][+-]?(${h})[jJ]?(?=${p})`},{begin:`(${f})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${p})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${p})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${p})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${p})`},{begin:`\\b(${h})[jJ](?=${p})`}]},y={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:l,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},b={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:["self",a,g,u,t.HASH_COMMENT_MODE]}]};return c.contains=[u,g,a],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:l,illegal:/(<\/|\?)|=>/,contains:[a,g,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},u,y,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[b]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[g,b,u]}]}}function cL(t){const e=t.regex,n=t.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},s={begin:/"/,end:/"/,contains:[{match:/""/}]},i=["true","false","unknown"],o=["double precision","large object","with timezone","without timezone"],l=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],a=["add","asc","collation","desc","final","first","last","view"],c=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],d=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],u=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],h=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],f=d,p=[...c,...a].filter(A=>!d.includes(A)),g={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},y={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},b={match:e.concat(/\b/,e.either(...f),/\s*\(/),relevance:0,keywords:{built_in:f}};function w(A){return e.concat(/\b/,e.either(...A.map(x=>x.replace(/\s+/,"\\s+"))),/\b/)}const M={scope:"keyword",match:w(h),relevance:0};function S(A,{exceptions:x,when:k}={}){const v=k;return x=x||[],A.map(T=>T.match(/\|\d+$/)||x.includes(T)?T:v(T)?`${T}|0`:T)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:S(p,{when:A=>A.length<3}),literal:i,type:l,built_in:u},contains:[{scope:"type",match:w(o)},M,b,g,r,s,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,y]}}const Kl="[A-Za-z$_][0-9A-Za-z$_]*",Px=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Bx=["true","false","null","undefined","NaN","Infinity"],$x=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Hx=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],zx=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Fx=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Ux=[].concat(zx,$x,Hx);function dL(t){const e=t.regex,n=(F,{after:ue})=>{const xe="</"+F[0].slice(1);return F.input.indexOf(xe,ue)!==-1},r=Kl,s={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(F,ue)=>{const xe=F[0].length+F.index,_=F.input[xe];if(_==="<"||_===","){ue.ignoreMatch();return}_===">"&&(n(F,{after:xe})||ue.ignoreMatch());let Z;const fe=F.input.substring(xe);if(Z=fe.match(/^\s*=/)){ue.ignoreMatch();return}if((Z=fe.match(/^\s+extends\s+/))&&Z.index===0){ue.ignoreMatch();return}}},l={$pattern:Kl,keyword:Px,literal:Bx,built_in:Ux,"variable.language":Fx},a="[0-9](_?[0-9])*",c=`\\.(${a})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",u={className:"number",variants:[{begin:`(\\b(${d})((${c})|\\.)?|(${c}))[eE][+-]?(${a})\\b`},{begin:`\\b(${d})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},y={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,h]},w={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},M=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,p,g,y,{match:/\$\d+/},u];h.contains=M.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(M)});const S=[].concat(w,h.contains),A=S.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(S)}]),x={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:A},k={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},v={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...$x,...Hx]}},T={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},N={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[x],illegal:/%/},H={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function V(F){return e.concat("(?!",F.join("|"),")")}const $={match:e.concat(/\b/,V([...zx,"super","import"].map(F=>`${F}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},I={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},j={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},x]},Q="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",ie={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(Q)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[x]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:A,CLASS_REFERENCE:v},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),T,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,p,g,y,w,{match:/\$\d+/},u,v,{scope:"attr",match:r+e.lookahead(":"),relevance:0},ie,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[w,t.REGEXP_MODE,{className:"function",begin:Q,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:A}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},N,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[x,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},I,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[x]},$,H,k,j,{match:/\$[(.]/}]}}function uL(t){const e=t.regex,n=dL(t),r=Kl,s=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:s},contains:[n.exports.CLASS_REFERENCE]},l={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},a=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:Kl,keyword:Px.concat(a),literal:Bx,built_in:Ux.concat(s),"variable.language":Fx},d={className:"meta",begin:"@"+r},u=(g,y,b)=>{const w=g.contains.findIndex(M=>M.label===y);if(w===-1)throw new Error("can not find mode to replace");g.contains.splice(w,1,b)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(d);const h=n.contains.find(g=>g.scope==="attr"),f=Object.assign({},h,{match:e.concat(r,e.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,h,f]),n.contains=n.contains.concat([d,i,o,f]),u(n,"shebang",t.SHEBANG()),u(n,"use_strict",l);const p=n.contains.find(g=>g.label==="func.def");return p.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function hL(t){const e=t.regex,n=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,s={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=t.inherit(i,{begin:/\(/,end:/\)/}),l=t.inherit(t.APOS_STRING_MODE,{className:"string"}),a=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),c={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[s]},{begin:/'/,end:/'/,contains:[s]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[i,a,l,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[i,o,a,l]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},s,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[a]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(/</,e.lookahead(e.concat(n,e.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:c}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}const Im={},fL="hljs-";function pL(t){const e=a0.newInstance();return t&&i(t),{highlight:n,highlightAuto:r,listLanguages:s,register:i,registerAlias:o,registered:l};function n(a,c,d){const u=d||Im,h=typeof u.prefix=="string"?u.prefix:fL;if(!e.getLanguage(a))throw new Error("Unknown language: `"+a+"` is not registered");e.configure({__emitter:mL,classPrefix:h});const f=e.highlight(c,{ignoreIllegals:!0,language:a});if(f.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:f.errorRaised});const p=f._emitter.root,g=p.data;return g.language=f.language,g.relevance=f.relevance,p}function r(a,c){const u=(c||Im).subset||s();let h=-1,f=0,p;for(;++h<u.length;){const g=u[h];if(!e.getLanguage(g))continue;const y=n(g,a,c);y.data&&y.data.relevance!==void 0&&y.data.relevance>f&&(f=y.data.relevance,p=y)}return p||{type:"root",children:[],data:{language:void 0,relevance:f}}}function s(){return e.listLanguages()}function i(a,c){if(typeof a=="string")e.registerLanguage(a,c);else{let d;for(d in a)Object.hasOwn(a,d)&&e.registerLanguage(d,a[d])}}function o(a,c){if(typeof a=="string")e.registerAliases(typeof c=="string"?c:[...c],{languageName:a});else{let d;for(d in a)if(Object.hasOwn(a,d)){const u=a[d];e.registerAliases(typeof u=="string"?u:[...u],{languageName:d})}}}function l(a){return!!e.getLanguage(a)}}class mL{constructor(e){this.options=e,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(e){if(e==="")return;const n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=e:n.children.push({type:"text",value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,n){const r=this.stack[this.stack.length-1],s=e.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:s}):r.children.push(...s)}openNode(e){const n=this,r=e.split(".").map(function(o,l){return l?o+"_".repeat(l):n.options.classPrefix+o}),s=this.stack[this.stack.length-1],i={type:"element",tagName:"span",properties:{className:r},children:[]};s.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const Vx=de.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:[]}},addProseMirrorPlugins(){const t=new ge("trailingNode");return[new pe({key:t,appendTransaction:(e,n,r)=>{if(!e.some(h=>h.docChanged))return null;const{doc:i,schema:o}=r,l=i.lastChild,a=this.options.node,c=o.nodes[a];if(!c||l?.type.name===a||l&&this.options.notAfter.includes(l.type.name))return null;const d=i.content.size;return r.tr.insert(d,c.create())}})]}});var gL=tT;const yL=t=>{const{editor:e,pos:n}=t,r=e.state.doc.resolve(Math.max(n,0));return r.depth>0?r.node(r.depth-1):null},bL=t=>{const e='Press "/" to insert or start typing...',{node:n}=t,r=n.type.name,s=yL(t);if(r==="heading"){const i=n.attrs.level??1;switch(i){case 1:return"Add a title...";case 2:return"Add a section heading...";case 3:return"Add a subheading...";default:return`Heading ${i}`}}if(r==="taskItem")return"Add a task...";if(r==="listItem"){const i=s?.type.name;return i==="bulletList"?"Add a bullet...":i==="orderedList"?"Add a numbered item...":"Add a list item..."}if(r==="codeBlock"){const i=n.attrs.language;return i?`Write ${i} code...`:"Write some code..."}if(r==="paragraph"){const i=s?.type.name;if(!i||i==="doc")return e}return r==="doc"?e:""},Wx=gL.extend({addOptions(){return{...this.parent?.(),emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",includeChildren:!0,showOnlyCurrent:!0,showOnlyWhenEditable:!0,placeholder:e=>bL(e)}},addProseMirrorPlugins(){const t=new Set(["table","tableCell","tableHeader","tableRow"]),e=n=>{const r=this.editor.state.doc.resolve(n);for(let s=r.depth;s>=0;s-=1){const i=r.node(s);if(t.has(i.type.name))return!0}return!1};return[new pe({key:new ge("placeholder"),props:{decorations:({doc:n,selection:r})=>{if(!(this.editor.isEditable||!this.options.showOnlyWhenEditable))return null;const{anchor:i}=r,o=[],l=this.editor.isEmpty;return n.descendants((a,c)=>{if(e(c))return this.options.includeChildren;const d=i>=c&&i<=c+a.nodeSize,u=!a.isLeaf&&Li(a);if((d||!this.options.showOnlyCurrent)&&u){const h=[this.options.emptyNodeClass];l&&h.push(this.options.emptyEditorClass);const f=typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:a,pos:c,hasAnchor:d}):this.options.placeholder,p=_e.node(c,c+a.nodeSize,{class:h.join(" "),"data-placeholder":f});o.push(p)}return this.options.includeChildren}),o.length?ye.create(n,o):null}}})]}}),xL=({node:t,updateAttributes:e,editor:n})=>{const[r,s]=C.useState(!1),{type:i,title:o,message:l,align:a,size:c,textAlign:d}=t.attrs,u={info:"bg-blue-50 text-blue-900 border-2 border-blue-200 dark:bg-blue-900/20 dark:text-blue-100 dark:border-blue-800",warning:"bg-yellow-50 text-yellow-900 border-2 border-yellow-200 dark:bg-yellow-900/20 dark:text-yellow-100 dark:border-yellow-800",error:"bg-red-50 text-red-900 border-2 border-red-200 dark:bg-red-900/20 dark:text-red-100 dark:border-red-800",success:"bg-green-50 text-green-900 border-2 border-green-200 dark:bg-green-900/20 dark:text-green-100 dark:border-green-800"},h={small:"text-sm p-2",medium:"text-base p-3",large:"text-lg p-4"},f={left:"text-left",center:"text-center",right:"text-right"},p={left:"text-left",center:"text-center",right:"text-right"};return m.jsxs(Iu,{children:[m.jsx("div",{className:`${f[a]||"text-left"} cursor-grab`,onClick:()=>s(!0),"data-drag-handle":!0,children:m.jsxs("div",{className:`inline-block rounded-lg border p-2 m-1 ${u[i]||u.info} ${h[c]||h["fit-content"]} ${p[d]||p.left}`,children:[m.jsx("strong",{className:"font-bold block",children:o}),m.jsx("span",{children:l})]})}),r&&m.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 z-50 flex items-center justify-center",onClick:()=>s(!1),children:m.jsxs("div",{className:"bg-white p-6 rounded-lg shadow-xl w-full max-w-md",onClick:g=>g.stopPropagation(),children:[m.jsx("h3",{className:"text-xl font-semibold mb-4 text-gray-800",children:"Edit Alert"}),m.jsxs("div",{className:"space-y-4",children:[m.jsxs("div",{children:[m.jsx("label",{htmlFor:"title",className:"block text-sm font-medium text-gray-700 mb-1",children:"Title"}),m.jsx("input",{type:"text",id:"title",defaultValue:o,onBlur:g=>e({title:g.target.value}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm text-gray-900"})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"message",className:"block text-sm font-medium text-gray-700 mb-1",children:"Message"}),m.jsx("textarea",{id:"message",defaultValue:l,onBlur:g=>e({message:g.target.value}),rows:3,className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm text-gray-900"})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"type",className:"block text-sm font-medium text-gray-700 mb-1",children:"Type"}),m.jsxs("select",{id:"type",defaultValue:i,onChange:g=>e({type:g.target.value}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm text-gray-900",children:[m.jsx("option",{value:"info",children:"Info"}),m.jsx("option",{value:"warning",children:"Warning"}),m.jsx("option",{value:"error",children:"Error"}),m.jsx("option",{value:"success",children:"Success"})]})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"align",className:"block text-sm font-medium text-gray-700 mb-1",children:"Alignment"}),m.jsxs("select",{id:"align",defaultValue:a,onChange:g=>e({align:g.target.value}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm text-gray-900",children:[m.jsx("option",{value:"left",children:"Left"}),m.jsx("option",{value:"center",children:"Center"}),m.jsx("option",{value:"right",children:"Right"})]})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"size",className:"block text-sm font-medium text-gray-700 mb-1",children:"Size"}),m.jsxs("select",{id:"size",defaultValue:c,onChange:g=>e({size:g.target.value}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm text-gray-900",children:[m.jsx("option",{value:"small",children:"Small"}),m.jsx("option",{value:"medium",children:"Medium"}),m.jsx("option",{value:"large",children:"Large"})]})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"textAlign",className:"block text-sm font-medium text-gray-700 mb-1",children:"Text Alignment"}),m.jsxs("select",{id:"textAlign",defaultValue:d,onChange:g=>e({textAlign:g.target.value}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm text-gray-900",children:[m.jsx("option",{value:"left",children:"Left"}),m.jsx("option",{value:"center",children:"Center"}),m.jsx("option",{value:"right",children:"Right"})]})]})]}),m.jsx("div",{className:"mt-6 flex justify-end",children:m.jsx("button",{onClick:()=>s(!1),className:"px-4 py-2 bg-gray-600 text-white rounded-md hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500",children:"Done"})})]})})]})},qx=De.create({name:"alertWidget",group:"block",atom:!0,draggable:!0,defining:!0,addAttributes(){return{type:{default:"info",parseHTML:t=>t.getAttribute("data-type"),renderHTML:t=>({"data-type":t.type})},title:{default:"Alert",parseHTML:t=>t.getAttribute("data-title"),renderHTML:t=>({"data-title":t.title})},message:{default:"This is an alert message.",parseHTML:t=>t.getAttribute("data-message"),renderHTML:t=>({"data-message":t.message})},align:{default:"center",parseHTML:t=>t.getAttribute("data-align"),renderHTML:t=>({"data-align":t.align})},size:{default:"medium",parseHTML:t=>t.getAttribute("data-size"),renderHTML:t=>({"data-size":t.size})},textAlign:{default:"left",parseHTML:t=>t.getAttribute("data-text-align"),renderHTML:t=>({"data-text-align":t.textAlign})}}},parseHTML(){return[{tag:"div[data-alert-widget]",priority:52}]},renderHTML({HTMLAttributes:t}){return["div",be(t,{"data-alert-widget":""})]},addNodeView(){return ju(xL)},addCommands(){return{setAlertWidget:(t={})=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}}}),wL=({node:t,updateAttributes:e,editor:n})=>{const[r,s]=C.useState(!1),{text:i,url:o,style:l,size:a,textAlign:c}=t.attrs,d={primary:"bg-primary text-primary-foreground hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80"},u={"fit-content":"w-auto","full-width":"w-full"},h={left:"text-left",center:"text-center",right:"text-right"};return m.jsxs(Iu,{children:[m.jsx("div",{className:`p-2 ${h[c]||h.left} cursor-grab`,"data-drag-handle":!0,onClick:()=>s(!0),children:m.jsx("div",{role:"button",tabIndex:0,className:`inline-block px-4 py-2 rounded-md ${d[l]} ${u[a]||u["fit-content"]}`,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),s(!0))},children:i})}),r&&m.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 z-50 flex items-center justify-center",onClick:()=>s(!1),children:m.jsxs("div",{className:"bg-white p-6 rounded-lg shadow-xl w-full max-w-md",onClick:f=>f.stopPropagation(),children:[m.jsx("h3",{className:"text-xl font-semibold mb-4 text-gray-800",children:"Edit CTA Button"}),m.jsxs("div",{className:"space-y-4",children:[m.jsxs("div",{children:[m.jsx("label",{htmlFor:"text",className:"block text-sm font-medium text-gray-700 mb-1",children:"Button Text"}),m.jsx("input",{type:"text",id:"text",defaultValue:i,onBlur:f=>e({text:f.target.value}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm text-gray-900"})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"url",className:"block text-sm font-medium text-gray-700 mb-1",children:"URL"}),m.jsx("input",{type:"text",id:"url",defaultValue:o,onBlur:f=>e({url:f.target.value}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm text-gray-900"})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"style",className:"block text-sm font-medium text-gray-700 mb-1",children:"Style"}),m.jsxs("select",{id:"style",defaultValue:l,onChange:f=>e({style:f.target.value}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm text-gray-900",children:[m.jsx("option",{value:"primary",children:"Primary"}),m.jsx("option",{value:"secondary",children:"Secondary"})]})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"size",className:"block text-sm font-medium text-gray-700 mb-1",children:"Size"}),m.jsxs("select",{id:"size",defaultValue:a,onChange:f=>e({size:f.target.value}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm text-gray-900",children:[m.jsx("option",{value:"fit-content",children:"Fit Content"}),m.jsx("option",{value:"full-width",children:"Full Width"})]})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"textAlign",className:"block text-sm font-medium text-gray-700 mb-1",children:"Text Alignment"}),m.jsxs("select",{id:"textAlign",defaultValue:c,onChange:f=>e({textAlign:f.target.value}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm text-gray-900",children:[m.jsx("option",{value:"left",children:"Left"}),m.jsx("option",{value:"center",children:"Center"}),m.jsx("option",{value:"right",children:"Right"})]})]})]}),m.jsx("div",{className:"mt-6 flex justify-end",children:m.jsx("button",{onClick:()=>s(!1),className:"px-4 py-2 bg-gray-600 text-white rounded-md hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500",children:"Done"})})]})})]})},Kx=De.create({name:"ctaWidget",group:"block",draggable:!0,atom:!0,defining:!0,addAttributes(){return{text:{default:"Click Here",parseHTML:t=>t.getAttribute("data-text"),renderHTML:t=>({"data-text":t.text})},url:{default:"#",parseHTML:t=>t.getAttribute("data-url"),renderHTML:t=>({"data-url":t.url})},style:{default:"primary",parseHTML:t=>t.getAttribute("data-style"),renderHTML:t=>({"data-style":t.style})},size:{default:"fit-content",parseHTML:t=>t.getAttribute("data-size"),renderHTML:t=>({"data-size":t.size})},textAlign:{default:"left",parseHTML:t=>t.getAttribute("data-text-align"),renderHTML:t=>({"data-text-align":t.textAlign})}}},parseHTML(){return[{tag:"div[data-cta-widget]",priority:52}]},renderHTML({HTMLAttributes:t}){return["div",be(t,{"data-cta-widget":""})]},addNodeView(){return ju(wL)},addCommands(){return{setCtaWidget:(t={})=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}}});function kL(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:i,startOfLine:o,$position:l}=t,a=r&&!s,c=iE(n),d=new RegExp(`\\s${c}$`),u=o?"^":"",h=s?"":c,f=a?new RegExp(`${u}${c}.*?(?=\\s${h}|$)`,"gm"):new RegExp(`${u}(?:^)?${c}[^\\s${h}]*`,"gm"),p=((e=l.nodeBefore)==null?void 0:e.isText)&&l.nodeBefore.text;if(!p)return null;const g=l.pos-p.length,y=Array.from(p.matchAll(f)).pop();if(!y||y.input===void 0||y.index===void 0)return null;const b=y.input.slice(Math.max(0,y.index-1),y.index),w=new RegExp(`^[${i?.join("")}\0]?$`).test(b);if(i!==null&&!w)return null;const M=g+y.index;let S=M+y[0].length;return a&&d.test(p.slice(S-1,S+1))&&(y[0]+=" ",S+=1),M<l.pos&&S>=l.pos?{range:{from:M,to:S},query:y[0].slice(n.length),text:y[0]}:null}var vL=new ge("suggestion");function SL({pluginKey:t=vL,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:s=!1,allowedPrefixes:i=[" "],startOfLine:o=!1,decorationTag:l="span",decorationClass:a="suggestion",decorationContent:c="",decorationEmptyClass:d="is-empty",command:u=()=>null,items:h=()=>[],render:f=()=>({}),allow:p=()=>!0,findSuggestionMatch:g=kL}){let y;const b=f?.(),w=()=>{const x=e.state.selection.$anchor.pos,k=e.view.coordsAtPos(x),{top:v,right:T,bottom:N,left:H}=k;try{return new DOMRect(H,v,T-H,N-v)}catch{return null}},M=(x,k)=>k?()=>{const v=t.getState(e.state),T=v?.decorationId,N=x.dom.querySelector(`[data-decoration-id="${T}"]`);return N?.getBoundingClientRect()||null}:w;function S(x,k){var v;try{const N=t.getState(x.state),H=N?.decorationId?x.dom.querySelector(`[data-decoration-id="${N.decorationId}"]`):null,V={editor:e,range:N?.range||{from:0,to:0},query:N?.query||null,text:N?.text||null,items:[],command:$=>u({editor:e,range:N?.range||{from:0,to:0},props:$}),decorationNode:H,clientRect:M(x,H)};(v=b?.onExit)==null||v.call(b,V)}catch{}const T=x.state.tr.setMeta(k,{exit:!0});x.dispatch(T)}const A=new pe({key:t,view(){return{update:async(x,k)=>{var v,T,N,H,V,$,I;const j=(v=this.key)==null?void 0:v.getState(k),Q=(T=this.key)==null?void 0:T.getState(x.state),ie=j.active&&Q.active&&j.range.from!==Q.range.from,F=!j.active&&Q.active,ue=j.active&&!Q.active,xe=!F&&!ue&&j.query!==Q.query,_=F||ie&&xe,Z=xe||ie,fe=ue||ie&&xe;if(!_&&!Z&&!fe)return;const Se=fe&&!_?j:Q,pn=x.dom.querySelector(`[data-decoration-id="${Se.decorationId}"]`);y={editor:e,range:Se.range,query:Se.query,text:Se.text,items:[],command:fr=>u({editor:e,range:Se.range,props:fr}),decorationNode:pn,clientRect:M(x,pn)},_&&((N=b?.onBeforeStart)==null||N.call(b,y)),Z&&((H=b?.onBeforeUpdate)==null||H.call(b,y)),(Z||_)&&(y.items=await h({editor:e,query:Se.query})),fe&&((V=b?.onExit)==null||V.call(b,y)),Z&&(($=b?.onUpdate)==null||$.call(b,y)),_&&((I=b?.onStart)==null||I.call(b,y))},destroy:()=>{var x;y&&((x=b?.onExit)==null||x.call(b,y))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(x,k,v,T){const{isEditable:N}=e,{composing:H}=e.view,{selection:V}=x,{empty:$,from:I}=V,j={...k},Q=x.getMeta(t);if(Q&&Q.exit)return j.active=!1,j.decorationId=null,j.range={from:0,to:0},j.query=null,j.text=null,j;if(j.composing=H,N&&($||e.view.composing)){(I<k.range.from||I>k.range.to)&&!H&&!k.composing&&(j.active=!1);const ie=g({char:n,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:i,startOfLine:o,$position:V.$from}),F=`id_${Math.floor(Math.random()*4294967295)}`;ie&&p({editor:e,state:T,range:ie.range,isActive:k.active})?(j.active=!0,j.decorationId=k.decorationId?k.decorationId:F,j.range=ie.range,j.query=ie.query,j.text=ie.text):j.active=!1}else j.active=!1;return j.active||(j.decorationId=null,j.range={from:0,to:0},j.query=null,j.text=null),j}},props:{handleKeyDown(x,k){var v,T,N,H;const{active:V,range:$}=A.getState(x.state);if(!V)return!1;if(k.key==="Escape"||k.key==="Esc"){const j=A.getState(x.state),Q=(v=y?.decorationNode)!=null?v:null,ie=Q??(j?.decorationId?x.dom.querySelector(`[data-decoration-id="${j.decorationId}"]`):null);if(((T=b?.onKeyDown)==null?void 0:T.call(b,{view:x,event:k,range:j.range}))||!1)return!0;const ue={editor:e,range:j.range,query:j.query,text:j.text,items:[],command:xe=>u({editor:e,range:j.range,props:xe}),decorationNode:ie,clientRect:ie?()=>ie.getBoundingClientRect()||null:null};return(N=b?.onExit)==null||N.call(b,ue),S(x,t),!0}return((H=b?.onKeyDown)==null?void 0:H.call(b,{view:x,event:k,range:$}))||!1},decorations(x){const{active:k,range:v,decorationId:T,query:N}=A.getState(x);if(!k)return null;const H=!N?.length,V=[a];return H&&V.push(d),ye.create(x.doc,[_e.inline(v.from,v.to,{nodeName:l,class:V.join(" "),"data-decoration-id":T,"data-decoration-content":c})])}}});return A}/**
|
|
200
|
-
* @license lucide-react v0.548.0 - ISC
|
|
201
|
-
*
|
|
202
|
-
* This source code is licensed under the ISC license.
|
|
203
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
204
|
-
*/const CL=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),EL=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),jm=t=>{const e=EL(t);return e.charAt(0).toUpperCase()+e.slice(1)},Gx=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),ML=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/**
|
|
205
|
-
* @license lucide-react v0.548.0 - ISC
|
|
206
|
-
*
|
|
207
|
-
* This source code is licensed under the ISC license.
|
|
208
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
209
|
-
*/var AL={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
210
|
-
* @license lucide-react v0.548.0 - ISC
|
|
211
|
-
*
|
|
212
|
-
* This source code is licensed under the ISC license.
|
|
213
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
214
|
-
*/const TL=C.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:o,...l},a)=>C.createElement("svg",{ref:a,...AL,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:Gx("lucide",s),...!i&&!ML(l)&&{"aria-hidden":"true"},...l},[...o.map(([c,d])=>C.createElement(c,d)),...Array.isArray(i)?i:[i]]));/**
|
|
215
|
-
* @license lucide-react v0.548.0 - ISC
|
|
216
|
-
*
|
|
217
|
-
* This source code is licensed under the ISC license.
|
|
218
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
219
|
-
*/const X=(t,e)=>{const n=C.forwardRef(({className:r,...s},i)=>C.createElement(TL,{ref:i,iconNode:e,className:Gx(`lucide-${CL(jm(t))}`,`lucide-${t}`,r),...s}));return n.displayName=jm(t),n};/**
|
|
220
|
-
* @license lucide-react v0.548.0 - ISC
|
|
221
|
-
*
|
|
222
|
-
* This source code is licensed under the ISC license.
|
|
223
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
224
|
-
*/const NL=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],Gl=X("bold",NL);/**
|
|
225
|
-
* @license lucide-react v0.548.0 - ISC
|
|
226
|
-
*
|
|
227
|
-
* This source code is licensed under the ISC license.
|
|
228
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
229
|
-
*/const _L=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Pm=X("circle-alert",_L);/**
|
|
230
|
-
* @license lucide-react v0.548.0 - ISC
|
|
231
|
-
*
|
|
232
|
-
* This source code is licensed under the ISC license.
|
|
233
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
234
|
-
*/const RL=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],OL=X("circle-check-big",RL);/**
|
|
235
|
-
* @license lucide-react v0.548.0 - ISC
|
|
236
|
-
*
|
|
237
|
-
* This source code is licensed under the ISC license.
|
|
238
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
239
|
-
*/const DL=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],LL=X("circle-plus",DL);/**
|
|
240
|
-
* @license lucide-react v0.548.0 - ISC
|
|
241
|
-
*
|
|
242
|
-
* This source code is licensed under the ISC license.
|
|
243
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
244
|
-
*/const IL=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],jL=X("circle-x",IL);/**
|
|
245
|
-
* @license lucide-react v0.548.0 - ISC
|
|
246
|
-
*
|
|
247
|
-
* This source code is licensed under the ISC license.
|
|
248
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
249
|
-
*/const PL=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],Nr=X("code-xml",PL);/**
|
|
250
|
-
* @license lucide-react v0.548.0 - ISC
|
|
251
|
-
*
|
|
252
|
-
* This source code is licensed under the ISC license.
|
|
253
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
254
|
-
*/const BL=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],Rs=X("code",BL);/**
|
|
255
|
-
* @license lucide-react v0.548.0 - ISC
|
|
256
|
-
*
|
|
257
|
-
* This source code is licensed under the ISC license.
|
|
258
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
259
|
-
*/const $L=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],HL=X("columns-2",$L);/**
|
|
260
|
-
* @license lucide-react v0.548.0 - ISC
|
|
261
|
-
*
|
|
262
|
-
* This source code is licensed under the ISC license.
|
|
263
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
264
|
-
*/const zL=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],FL=X("columns-3",zL);/**
|
|
265
|
-
* @license lucide-react v0.548.0 - ISC
|
|
266
|
-
*
|
|
267
|
-
* This source code is licensed under the ISC license.
|
|
268
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
269
|
-
*/const UL=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Jx=X("download",UL);/**
|
|
270
|
-
* @license lucide-react v0.548.0 - ISC
|
|
271
|
-
*
|
|
272
|
-
* This source code is licensed under the ISC license.
|
|
273
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
274
|
-
*/const VL=[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]],WL=X("eraser",VL);/**
|
|
275
|
-
* @license lucide-react v0.548.0 - ISC
|
|
276
|
-
*
|
|
277
|
-
* This source code is licensed under the ISC license.
|
|
278
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
279
|
-
*/const qL=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],KL=X("eye",qL);/**
|
|
280
|
-
* @license lucide-react v0.548.0 - ISC
|
|
281
|
-
*
|
|
282
|
-
* This source code is licensed under the ISC license.
|
|
283
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
284
|
-
*/const GL=[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]],JL=X("file-code-2",GL);/**
|
|
285
|
-
* @license lucide-react v0.548.0 - ISC
|
|
286
|
-
*
|
|
287
|
-
* This source code is licensed under the ISC license.
|
|
288
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
289
|
-
*/const YL=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],XL=X("hash",YL);/**
|
|
290
|
-
* @license lucide-react v0.548.0 - ISC
|
|
291
|
-
*
|
|
292
|
-
* This source code is licensed under the ISC license.
|
|
293
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
294
|
-
*/const ZL=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],vs=X("heading-1",ZL);/**
|
|
295
|
-
* @license lucide-react v0.548.0 - ISC
|
|
296
|
-
*
|
|
297
|
-
* This source code is licensed under the ISC license.
|
|
298
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
299
|
-
*/const QL=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],Vi=X("heading-2",QL);/**
|
|
300
|
-
* @license lucide-react v0.548.0 - ISC
|
|
301
|
-
*
|
|
302
|
-
* This source code is licensed under the ISC license.
|
|
303
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
304
|
-
*/const eI=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],Aa=X("heading-3",eI);/**
|
|
305
|
-
* @license lucide-react v0.548.0 - ISC
|
|
306
|
-
*
|
|
307
|
-
* This source code is licensed under the ISC license.
|
|
308
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
309
|
-
*/const tI=[["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 10v3a1 1 0 0 0 1 1h3",key:"tj5zdr"}],["path",{d:"M21 10v8",key:"1kdml4"}],["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}]],nI=X("heading-4",tI);/**
|
|
310
|
-
* @license lucide-react v0.548.0 - ISC
|
|
311
|
-
*
|
|
312
|
-
* This source code is licensed under the ISC license.
|
|
313
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
314
|
-
*/const rI=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 13v-3h4",key:"1nvgqp"}],["path",{d:"M17 17.7c.4.2.8.3 1.3.3 1.5 0 2.7-1.1 2.7-2.5S19.8 13 18.3 13H17",key:"2nebdn"}]],sI=X("heading-5",rI);/**
|
|
315
|
-
* @license lucide-react v0.548.0 - ISC
|
|
316
|
-
*
|
|
317
|
-
* This source code is licensed under the ISC license.
|
|
318
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
319
|
-
*/const iI=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["circle",{cx:"19",cy:"16",r:"2",key:"15mx69"}],["path",{d:"M20 10c-2 2-3 3.5-3 6",key:"f35dl0"}]],oI=X("heading-6",iI);/**
|
|
320
|
-
* @license lucide-react v0.548.0 - ISC
|
|
321
|
-
*
|
|
322
|
-
* This source code is licensed under the ISC license.
|
|
323
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
324
|
-
*/const lI=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],zr=X("image",lI);/**
|
|
325
|
-
* @license lucide-react v0.548.0 - ISC
|
|
326
|
-
*
|
|
327
|
-
* This source code is licensed under the ISC license.
|
|
328
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
329
|
-
*/const aI=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],kh=X("italic",aI);/**
|
|
330
|
-
* @license lucide-react v0.548.0 - ISC
|
|
331
|
-
*
|
|
332
|
-
* This source code is licensed under the ISC license.
|
|
333
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
334
|
-
*/const cI=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],Ta=X("link-2",cI);/**
|
|
335
|
-
* @license lucide-react v0.548.0 - ISC
|
|
336
|
-
*
|
|
337
|
-
* This source code is licensed under the ISC license.
|
|
338
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
339
|
-
*/const dI=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],Wi=X("list-ordered",dI);/**
|
|
340
|
-
* @license lucide-react v0.548.0 - ISC
|
|
341
|
-
*
|
|
342
|
-
* This source code is licensed under the ISC license.
|
|
343
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
344
|
-
*/const uI=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Os=X("list",uI);/**
|
|
345
|
-
* @license lucide-react v0.548.0 - ISC
|
|
346
|
-
*
|
|
347
|
-
* This source code is licensed under the ISC license.
|
|
348
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
349
|
-
*/const hI=[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]],Na=X("megaphone",hI);/**
|
|
350
|
-
* @license lucide-react v0.548.0 - ISC
|
|
351
|
-
*
|
|
352
|
-
* This source code is licensed under the ISC license.
|
|
353
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
354
|
-
*/const fI=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],pI=X("menu",fI);/**
|
|
355
|
-
* @license lucide-react v0.548.0 - ISC
|
|
356
|
-
*
|
|
357
|
-
* This source code is licensed under the ISC license.
|
|
358
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
359
|
-
*/const mI=[["path",{d:"M5 12h14",key:"1ays0h"}]],_a=X("minus",mI);/**
|
|
360
|
-
* @license lucide-react v0.548.0 - ISC
|
|
361
|
-
*
|
|
362
|
-
* This source code is licensed under the ISC license.
|
|
363
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
364
|
-
*/const gI=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],vh=X("palette",gI);/**
|
|
365
|
-
* @license lucide-react v0.548.0 - ISC
|
|
366
|
-
*
|
|
367
|
-
* This source code is licensed under the ISC license.
|
|
368
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
369
|
-
*/const yI=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],bI=X("play",yI);/**
|
|
370
|
-
* @license lucide-react v0.548.0 - ISC
|
|
371
|
-
*
|
|
372
|
-
* This source code is licensed under the ISC license.
|
|
373
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
374
|
-
*/const xI=[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]],wI=X("redo-2",xI);/**
|
|
375
|
-
* @license lucide-react v0.548.0 - ISC
|
|
376
|
-
*
|
|
377
|
-
* This source code is licensed under the ISC license.
|
|
378
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
379
|
-
*/const kI=[["path",{d:"M14 4a1 1 0 0 1 1-1",key:"dhj8ez"}],["path",{d:"M15 10a1 1 0 0 1-1-1",key:"1mnyi5"}],["path",{d:"M21 4a1 1 0 0 0-1-1",key:"sfs9ap"}],["path",{d:"M21 9a1 1 0 0 1-1 1",key:"mp6qeo"}],["path",{d:"m3 7 3 3 3-3",key:"x25e72"}],["path",{d:"M6 10V5a2 2 0 0 1 2-2h2",key:"15xut4"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}]],vI=X("replace",kI);/**
|
|
380
|
-
* @license lucide-react v0.548.0 - ISC
|
|
381
|
-
*
|
|
382
|
-
* This source code is licensed under the ISC license.
|
|
383
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
384
|
-
*/const SI=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],CI=X("rotate-ccw",SI);/**
|
|
385
|
-
* @license lucide-react v0.548.0 - ISC
|
|
386
|
-
*
|
|
387
|
-
* This source code is licensed under the ISC license.
|
|
388
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
389
|
-
*/const EI=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]],MI=X("rows-2",EI);/**
|
|
390
|
-
* @license lucide-react v0.548.0 - ISC
|
|
391
|
-
*
|
|
392
|
-
* This source code is licensed under the ISC license.
|
|
393
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
394
|
-
*/const AI=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]],TI=X("rows-3",AI);/**
|
|
395
|
-
* @license lucide-react v0.548.0 - ISC
|
|
396
|
-
*
|
|
397
|
-
* This source code is licensed under the ISC license.
|
|
398
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
399
|
-
*/const NI=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],_I=X("search",NI);/**
|
|
400
|
-
* @license lucide-react v0.548.0 - ISC
|
|
401
|
-
*
|
|
402
|
-
* This source code is licensed under the ISC license.
|
|
403
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
404
|
-
*/const RI=[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Ra=X("square-check-big",RI);/**
|
|
405
|
-
* @license lucide-react v0.548.0 - ISC
|
|
406
|
-
*
|
|
407
|
-
* This source code is licensed under the ISC license.
|
|
408
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
409
|
-
*/const OI=[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]],Yx=X("strikethrough",OI);/**
|
|
410
|
-
* @license lucide-react v0.548.0 - ISC
|
|
411
|
-
*
|
|
412
|
-
* This source code is licensed under the ISC license.
|
|
413
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
414
|
-
*/const DI=[["path",{d:"m4 5 8 8",key:"1eunvl"}],["path",{d:"m12 5-8 8",key:"1ah0jp"}],["path",{d:"M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07",key:"e8ta8j"}]],Xx=X("subscript",DI);/**
|
|
415
|
-
* @license lucide-react v0.548.0 - ISC
|
|
416
|
-
*
|
|
417
|
-
* This source code is licensed under the ISC license.
|
|
418
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
419
|
-
*/const LI=[["path",{d:"m4 19 8-8",key:"hr47gm"}],["path",{d:"m12 19-8-8",key:"1dhhmo"}],["path",{d:"M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06",key:"1dfcux"}]],Zx=X("superscript",LI);/**
|
|
420
|
-
* @license lucide-react v0.548.0 - ISC
|
|
421
|
-
*
|
|
422
|
-
* This source code is licensed under the ISC license.
|
|
423
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
424
|
-
*/const II=[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]],qi=X("table-2",II);/**
|
|
425
|
-
* @license lucide-react v0.548.0 - ISC
|
|
426
|
-
*
|
|
427
|
-
* This source code is licensed under the ISC license.
|
|
428
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
429
|
-
*/const jI=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],PI=X("terminal",jI);/**
|
|
430
|
-
* @license lucide-react v0.548.0 - ISC
|
|
431
|
-
*
|
|
432
|
-
* This source code is licensed under the ISC license.
|
|
433
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
434
|
-
*/const BI=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 19H5",key:"vjpgq2"}]],Ki=X("text-align-center",BI);/**
|
|
435
|
-
* @license lucide-react v0.548.0 - ISC
|
|
436
|
-
*
|
|
437
|
-
* This source code is licensed under the ISC license.
|
|
438
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
439
|
-
*/const $I=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 19H7",key:"4cu937"}]],Gi=X("text-align-end",$I);/**
|
|
440
|
-
* @license lucide-react v0.548.0 - ISC
|
|
441
|
-
*
|
|
442
|
-
* This source code is licensed under the ISC license.
|
|
443
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
444
|
-
*/const HI=[["path",{d:"M3 5h18",key:"1u36vt"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 19h18",key:"awlh7x"}]],Sh=X("text-align-justify",HI);/**
|
|
445
|
-
* @license lucide-react v0.548.0 - ISC
|
|
446
|
-
*
|
|
447
|
-
* This source code is licensed under the ISC license.
|
|
448
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
449
|
-
*/const zI=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],Ss=X("text-align-start",zI);/**
|
|
450
|
-
* @license lucide-react v0.548.0 - ISC
|
|
451
|
-
*
|
|
452
|
-
* This source code is licensed under the ISC license.
|
|
453
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
454
|
-
*/const FI=[["path",{d:"M17 5H3",key:"1cn7zz"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 19H8",key:"13qgcb"}],["path",{d:"M3 12v7",key:"1ri8j3"}]],Ji=X("text-quote",FI);/**
|
|
455
|
-
* @license lucide-react v0.548.0 - ISC
|
|
456
|
-
*
|
|
457
|
-
* This source code is licensed under the ISC license.
|
|
458
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
459
|
-
*/const UI=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Qx=X("trash-2",UI);/**
|
|
460
|
-
* @license lucide-react v0.548.0 - ISC
|
|
461
|
-
*
|
|
462
|
-
* This source code is licensed under the ISC license.
|
|
463
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
464
|
-
*/const VI=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Oa=X("triangle-alert",VI);/**
|
|
465
|
-
* @license lucide-react v0.548.0 - ISC
|
|
466
|
-
*
|
|
467
|
-
* This source code is licensed under the ISC license.
|
|
468
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
469
|
-
*/const WI=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],Wr=X("type",WI);/**
|
|
470
|
-
* @license lucide-react v0.548.0 - ISC
|
|
471
|
-
*
|
|
472
|
-
* This source code is licensed under the ISC license.
|
|
473
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
474
|
-
*/const qI=[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]],Ch=X("underline",qI);/**
|
|
475
|
-
* @license lucide-react v0.548.0 - ISC
|
|
476
|
-
*
|
|
477
|
-
* This source code is licensed under the ISC license.
|
|
478
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
479
|
-
*/const KI=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],GI=X("undo-2",KI);/**
|
|
480
|
-
* @license lucide-react v0.548.0 - ISC
|
|
481
|
-
*
|
|
482
|
-
* This source code is licensed under the ISC license.
|
|
483
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
484
|
-
*/const JI=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],ew=X("video",JI);/**
|
|
485
|
-
* @license lucide-react v0.548.0 - ISC
|
|
486
|
-
*
|
|
487
|
-
* This source code is licensed under the ISC license.
|
|
488
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
489
|
-
*/const YI=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],tw=X("x",YI),Eh=C.forwardRef(({items:t,command:e},n)=>{const[r,s]=C.useState(-1),i=C.useRef(null),o=a=>{const c=t[a];c&&e(c)};C.useEffect(()=>{if(t.length===0){s(-1);return}s(a=>{if(a===-1)return-1;const c=Math.min(Math.max(a,0),t.length-1);return Number.isFinite(c)?c:-1})},[t]),C.useEffect(()=>{if(!i.current||r===-1)return;const a=i.current.querySelector(`[data-index="${r}"]`);a&&a.scrollIntoView({block:"nearest"})},[r]),C.useImperativeHandle(n,()=>({onKeyDown:({event:a})=>t.length===0?!1:a.key==="ArrowUp"?(a.preventDefault(),s(c=>c===-1?t.length-1:(c-1+t.length)%t.length),!0):a.key==="ArrowDown"?(a.preventDefault(),s(c=>c===-1?0:(c+1)%t.length),!0):a.key==="Enter"?(a.preventDefault(),r!==-1&&o(r),!0):!1}));const l=a=>{a.stopPropagation()};return m.jsx("div",{ref:i,className:"z-50 max-h-72 w-72 overflow-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md",role:"listbox","aria-activedescendant":r!==-1?`cmd-opt-${r}`:void 0,tabIndex:-1,onWheel:l,style:{scrollbarWidth:"thin",scrollbarColor:"rgb(148 163 184) transparent"},children:t.length>0?t.map((a,c)=>{const d=r!==-1&&c===r;return m.jsxs("button",{id:`cmd-opt-${c}`,"data-index":c,role:"option","aria-selected":d,type:"button",onMouseDown:u=>u.preventDefault(),onClick:()=>o(c),className:Oe.cn("flex w-full items-center gap-2 rounded-sm p-2 text-left text-sm transition-colors","hover:bg-accent hover:text-accent-foreground",d&&"bg-accent text-accent-foreground"),children:[m.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-md border bg-background",children:a.icon}),m.jsxs("div",{className:"min-w-0",children:[m.jsx("p",{className:"truncate font-medium",children:a.title}),a.description?m.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a.description}):null]})]},`${a.title}-${c}`)}):m.jsx("div",{className:"p-2 text-sm text-muted-foreground",children:"No results"})})});Eh.displayName="SlashCommandList";const XI=[{title:"Text",description:"Start writing with plain text.",icon:C.createElement(Wr,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).clearNodes().run()}},{title:"Heading 1",description:"Large section heading.",icon:C.createElement(vs,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setHeading({level:1}).run()}},{title:"Heading 2",description:"Medium section heading.",icon:C.createElement(Vi,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setHeading({level:2}).run()}},{title:"Heading 3",description:"Small section heading.",icon:C.createElement(Aa,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setHeading({level:3}).run()}},{title:"Heading 4",description:"Extra small section heading.",icon:C.createElement(nI,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setHeading({level:4}).run()}},{title:"Heading 5",description:"Tiny section heading.",icon:C.createElement(sI,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setHeading({level:5}).run()}},{title:"Heading 6",description:"Smallest section heading.",icon:C.createElement(oI,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setHeading({level:6}).run()}},{title:"Bullet List",description:"Create a simple bulleted list.",icon:C.createElement(Os,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).toggleBulletList().run()}},{title:"Numbered List",description:"Create a list with numbering.",icon:C.createElement(Wi,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).toggleOrderedList().run()}},{title:"Task List",description:"Create a list with checkboxes.",icon:C.createElement(Ra,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).toggleTaskList().run()}},{title:"Blockquote",description:"Create a quote or citation.",icon:C.createElement(Ji,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).toggleBlockquote().run()}},{title:"Code Block",description:"Create a code block with syntax highlighting.",icon:C.createElement(Rs,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).toggleCodeBlock().run()}},{title:"Horizontal Rule",description:"Insert a horizontal divider.",icon:C.createElement(_a,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setHorizontalRule().run()}},{title:"Image",description:"Insert an image from URL.",icon:C.createElement(zr,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{const n=window.prompt("Enter image URL:");n&&t.chain().focus().deleteRange(e).setImage({src:n}).run()}},{title:"Table",description:"Insert a table with rows and columns.",icon:C.createElement(qi,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).insertTable({rows:3,cols:3,withHeaderRow:!0}).run()}},{title:"Align Left",description:"Align text to the left.",icon:C.createElement(Ss,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setTextAlign("left").run()}},{title:"Align Center",description:"Center align text.",icon:C.createElement(Ki,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setTextAlign("center").run()}},{title:"Align Right",description:"Align text to the right.",icon:C.createElement(Gi,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setTextAlign("right").run()}},{title:"Justify",description:"Justify text alignment.",icon:C.createElement(Sh,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setTextAlign("justify").run()}},{title:"Video",description:"Embed a video from URL.",icon:C.createElement(ew,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{const n=window.prompt("Enter video URL (YouTube, Vimeo, etc.):");n&&t.chain().focus().deleteRange(e).insertContent(`<p><a href="${n}" target="_blank">Video: ${n}</a></p>`).run()}},{title:"Alert",description:"Insert an alert or notice.",icon:C.createElement(Oa,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.can().setAlertWidget()?t.chain().focus().deleteRange(e).setAlertWidget().run():t.chain().focus().deleteRange(e).toggleBlockquote().run()}},{title:"Call to Action",description:"Insert a call to action button.",icon:C.createElement(Na,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.can().setCtaWidget()?t.chain().focus().deleteRange(e).setCtaWidget({text:"Click me",url:"#",style:"primary",size:"medium",textAlign:"center"}).run():t.chain().focus().deleteRange(e).insertContent("Call to Action").run()}}],nw=de.create({name:"slashCommand",addOptions(){return{suggestion:{char:"/",allowSpaces:!1,allowedPrefixes:[" "],startOfLine:!1,decorationTag:"span",decorationClass:"slash-command"}}},addProseMirrorPlugins(){return[SL({char:"/",allowSpaces:!1,allowedPrefixes:[" "],startOfLine:!1,decorationTag:"span",decorationClass:"slash-command",editor:this.editor,items:({query:t})=>XI.filter(n=>n.title.toLowerCase().includes(t.toLowerCase())||n.description.toLowerCase().includes(t.toLowerCase())).slice(0,10),command:({editor:t,range:e,props:n})=>{n.command({editor:t,range:e})},render:()=>{let t=null,e=null,n=null;const r=i=>({getBoundingClientRect:()=>i()||new DOMRect(0,0,0,0)}),s=async i=>{if(!e)return;const o=r(i),{x:l,y:a}=await Fu(o,e,{placement:"bottom-start",middleware:[zu(6),Ab({fallbackPlacements:["top-start","bottom-start"]}),Mb({padding:8}),Tb({apply({availableWidth:c,availableHeight:d,elements:u}){Object.assign(u.floating.style,{maxWidth:`${Math.min(288,c-16)}px`,maxHeight:`${Math.min(288,d-16)}px`})}})],strategy:"fixed"});e.style.left=`${Math.round(l)}px`,e.style.top=`${Math.round(a)}px`};return{onStart:i=>{if(!i.clientRect)return;const o=i.clientRect;t=new pb(Eh,{props:i,editor:i.editor}),e=document.createElement("div"),e.style.position="fixed",e.style.zIndex="10000",e.style.top="0",e.style.left="0",e.style.pointerEvents="none",e.appendChild(t.element),t.element.style.pointerEvents="auto",t.element.addEventListener("wheel",a=>{a.stopPropagation()},{passive:!0}),document.body.appendChild(e);const l=r(o);n=Ms(l,e,()=>s(o)),s(o)},onUpdate:i=>{t?.updateProps(i),i.clientRect&&s(i.clientRect)},onKeyDown:({event:i})=>i.key==="Escape"?!0:t?.ref?.onKeyDown({event:i})??!1,onExit:()=>{n?.(),n=null,t?.destroy(),t=null,e?.remove(),e=null}}}})]}});var ZI=Zu,QI=eh;NA.extend({draggable:!0});zM.extend({draggable:!0});AM.extend({draggable:!0});ZI.extend({draggable:!0});QI.extend({draggable:!0});h0.extend({draggable:!0});f0.extend({draggable:!0});d0.extend({draggable:!0});u0.extend({draggable:!0});const rw=de.create({name:"draggableNodes",addGlobalAttributes(){return[{types:["paragraph","heading","blockquote","bulletList","orderedList","taskList","taskItem","codeBlock","image"],attributes:{draggable:{default:!0,parseHTML:()=>!0,renderHTML:()=>({"data-draggable":"true"})}}}]}}),e2=De.create({name:"styleTag",group:"block",atom:!0,isolating:!0,defining:!0,draggable:!1,addAttributes(){return{cssContent:{default:"",parseHTML:t=>t.innerHTML},type:{default:"text/css",parseHTML:t=>t.getAttribute("type"),renderHTML:t=>t.type?{type:t.type}:{}},media:{default:null,parseHTML:t=>t.getAttribute("media"),renderHTML:t=>t.media?{media:t.media}:{}}}},parseHTML(){return[{tag:"style",getAttrs:t=>{const e=t,n={cssContent:e.innerHTML,type:e.getAttribute("type")},r=e.getAttribute("media");return r!==null&&(n.media=r),n}}]},renderHTML({HTMLAttributes:t,node:e}){const n={...t};return delete n.cssContent,["style",n,e.attrs.cssContent||""]},addNodeView(){return({node:t,editor:e,getPos:n})=>{const r=document.createElement("div");return r.setAttribute("data-style-node-placeholder","true"),r.style.border="1px dashed #999",r.style.padding="8px",r.style.margin="1rem 0",r.style.fontFamily="monospace",r.style.fontSize="0.9em",r.style.color="#555",r.style.cursor="pointer",r.textContent="[Custom CSS Block - Edit in Source View]",r.contentEditable="false",r.title="Click to open Source View",r.addEventListener("click",()=>{try{e?.chain().focus()}catch{}try{window.dispatchEvent(new CustomEvent("editor:openSourceView"))}catch{}}),{dom:r}}}}),t2=De.create({name:"divBlock",group:"block",content:"block*",defining:!0,draggable:!0,addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{class:{default:null,parseHTML:t=>t.getAttribute("class"),renderHTML:t=>t.class?{class:t.class}:{}},style:{default:null,parseHTML:t=>t.getAttribute("style"),renderHTML:t=>t.style?{style:t.style}:{}},id:{default:null,parseHTML:t=>t.getAttribute("id"),renderHTML:t=>t.id?{id:t.id}:{}}}},parseHTML(){return[{tag:"div",priority:51,getAttrs:t=>{const e=t,n={};for(let r=0;r<e.attributes.length;r++){const s=e.attributes[r];n[s.name]=s.value}return n}}]},renderHTML({node:t}){return["div",be(this.options.HTMLAttributes,t.attrs),0]}}),n2=de.create({name:"preserveAllAttributesExtension",addGlobalAttributes(){return[{types:["paragraph","heading","listItem","blockquote","codeBlock","bulletList","orderedList","textStyle"],attributes:{style:{default:null,parseHTML:t=>t.getAttribute("style"),renderHTML:t=>t.style?{style:t.style}:{}},class:{default:null,parseHTML:t=>t.getAttribute("class"),renderHTML:t=>t.class?{class:t.class}:{}},id:{default:null,parseHTML:t=>t.getAttribute("id"),renderHTML:t=>t.id?{id:t.id}:{}},dataAttributes:{default:null,parseHTML:t=>{const e={};for(let n=0;n<t.attributes.length;n++){const r=t.attributes[n];r.name.startsWith("data-")&&(e[r.name]=r.value)}return Object.keys(e).length>0?e:null},renderHTML:t=>t.dataAttributes||{}}}}]}}),r2=De.create({name:"scriptTag",group:"block",atom:!0,isolating:!0,defining:!0,draggable:!1,addAttributes(){return{jsContent:{default:"",parseHTML:t=>t.innerHTML},type:{default:"text/javascript",parseHTML:t=>t.getAttribute("type"),renderHTML:t=>t.type?{type:t.type}:{}},src:{default:null,parseHTML:t=>t.getAttribute("src"),renderHTML:t=>t.src?{src:t.src}:{}},async:{default:null,parseHTML:t=>t.getAttribute("async"),renderHTML:t=>t.async!=null?{async:""}:{}},defer:{default:null,parseHTML:t=>t.getAttribute("defer"),renderHTML:t=>t.defer!=null?{defer:""}:{}}}},parseHTML(){return[{tag:"script",getAttrs:t=>{const e=t,n={jsContent:e.innerHTML,type:e.getAttribute("type")},r=e.getAttribute("src");return r!==null&&(n.src=r),e.hasAttribute("async")&&(n.async=""),e.hasAttribute("defer")&&(n.defer=""),n}}]},renderHTML({HTMLAttributes:t,node:e}){const n={...t};return delete n.jsContent,["script",n,e.attrs.src?"":e.attrs.jsContent||""]},addNodeView(){return({editor:t})=>{const e=document.createElement("div");return e.setAttribute("data-script-node-placeholder","true"),e.style.border="1px dashed #999",e.style.padding="8px",e.style.margin="1rem 0",e.style.fontFamily="monospace",e.style.fontSize="0.9em",e.style.color="#555",e.style.cursor="pointer",e.textContent="[Custom JavaScript Block - Edit in Source View]",e.contentEditable="false",e.title="Click to open Source View",e.addEventListener("click",()=>{try{t?.chain().focus()}catch{}try{window.dispatchEvent(new CustomEvent("editor:openSourceView"))}catch{}}),{dom:e}}}}),s2=pL({html:hL,css:tL,js:oL,ts:uL,python:aL,json:lL,bash:qD,sql:cL}),Bm="http://www.w3.org/2000/svg";function $m(t){const e=document.createElementNS(Bm,"svg");return e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","currentColor"),e.classList.add("tiptap-drag-handle__icon","tiptap-drag-handle__icon--filled"),t.forEach(n=>{const r=document.createElementNS(Bm,"path");r.setAttribute("d",n),e.appendChild(r)}),e}const Mh=[sT.configure({codeBlock:!1,link:!1,undoRedo:!1,bulletList:{HTMLAttributes:{class:"list-disc pl-4"},keepMarks:!0,keepAttributes:!1},orderedList:{HTMLAttributes:{class:"list-decimal pl-4"},keepMarks:!0,keepAttributes:!1},dropcursor:{color:"#60A5FA",width:2},gapcursor:!1}),bA.configure({openOnClick:!1,autolink:!0,defaultProtocol:"https",protocols:["http","https","ftp","mailto"],validate:t=>/^https?:\/\//.test(t),HTMLAttributes:{class:"text-primary underline underline-offset-2 hover:text-primary/80 cursor-pointer",rel:"noopener noreferrer",target:"_blank"}}),p_,LA,m_.configure({depth:100,newGroupDelay:500}),d0.configure({lowlight:s2,defaultLanguage:"plaintext",HTMLAttributes:{class:"relative rounded-md bg-muted p-4 font-mono text-sm"}}),t2,e2,r2,n2,pT.configure({inline:!0,allowBase64:!0,HTMLAttributes:{class:"max-w-full h-auto rounded-md"}}),h0.configure({HTMLAttributes:{class:"list-none pl-0 space-y-1"}}),f0.configure({nested:!0,HTMLAttributes:{class:"flex items-start gap-2 my-1"}}),M0.configure({resizable:!0,cellMinWidth:100,HTMLAttributes:{class:"w-full border-collapse border border-gray-300 dark:border-gray-700 my-4"}}),kN.configure({HTMLAttributes:{class:"border-b border-gray-300 dark:border-gray-700"}}),vN.configure({HTMLAttributes:{class:"bg-gray-100 dark:bg-gray-800 font-bold p-3 text-left border border-gray-300 dark:border-gray-700"}}),SN.configure({HTMLAttributes:{class:"p-3 border border-gray-300 dark:border-gray-700 min-w-[100px]"}}),FN.configure({color:{types:["textStyle"]},fontFamily:{types:["textStyle"]},fontSize:{types:["textStyle"]}}),AN.configure({multicolor:!0,HTMLAttributes:{class:"rounded-sm px-1 py-0.5"}}),NN,RN,DN.configure({types:["heading","paragraph","div"],alignments:["left","center","right","justify"],defaultAlignment:"left"}),f_,Wx,UN.configure({limit:5e4,mode:"textSize"}),Vx,qx,Kx,nw,rw,LD,WD.configure({computePositionConfig:{placement:"left-start",strategy:"absolute",middleware:[zu({mainAxis:5,crossAxis:0})]},onElementDragStart:()=>{typeof document<"u"&&document.body.classList.add("dragging")},onElementDragEnd:()=>{typeof document<"u"&&document.body.classList.remove("dragging")},onNodeChange:({editor:t})=>{},render(){const t=document.createElement("div");t.classList.add("drag-handle","tiptap-drag-handle"),typeof window<"u"&&(window.__dragHandleElement=t);const e=document.createElement("div");e.classList.add("tiptap-drag-handle__group"),e.setAttribute("role","group"),e.dataset.orientation="horizontal",t.appendChild(e);const n=document.createElement("button");n.type="button",n.classList.add("tiptap-drag-handle__button","tiptap-drag-handle__button--ghost","tiptap-drag-handle__plus"),n.setAttribute("aria-label","Insert block"),n.setAttribute("title","Insert block");const r=$m(["M13 5C13 4.44772 12.5523 4 12 4C11.4477 4 11 4.44772 11 5V11H5C4.44772 11 4 11.4477 4 12C4 12.5523 4.44772 13 5 13H11V19C11 19.5523 11.4477 20 12 20C12.5523 20 13 19.5523 13 19V13H19C19.5523 13 20 12.5523 20 12C20 11.4477 19.5523 11 19 11H13V5Z"]);n.appendChild(r),e.appendChild(n);const s=document.createElement("button");s.type="button",s.classList.add("tiptap-drag-handle__button","tiptap-drag-handle__button--ghost","tiptap-drag-handle__grip"),s.setAttribute("aria-label","Drag to reorder"),s.setAttribute("title","Drag to reorder"),s.setAttribute("tabindex","0"),s.setAttribute("aria-haspopup","menu"),s.setAttribute("aria-expanded","false");const i=$m(["M9 3C7.89543 3 7 3.89543 7 5C7 6.10457 7.89543 7 9 7C10.1046 7 11 6.10457 11 5C11 3.89543 10.1046 3 9 3Z","M9 10C7.89543 10 7 10.8954 7 12C7 13.1046 7.89543 14 9 14C10.1046 14 11 13.1046 11 12C11 10.8954 10.1046 10 9 10Z","M7 19C7 17.8954 7.89543 17 9 17C10.1046 17 11 17.8954 11 19C11 20.1046 10.1046 21 9 21C7.89543 21 7 20.1046 7 19Z","M15 10C13.8954 10 13 10.8954 13 12C13 13.1046 13.8954 14 15 14C16.1046 14 17 13.1046 17 12C17 10.8954 16.1046 10 15 10Z","M13 5C13 3.89543 13.8954 3 15 3C16.1046 3 17 3.89543 17 5C17 6.10457 16.1046 7 15 7C13.8954 7 13 6.10457 13 5Z","M15 17C13.8954 17 13 17.8954 13 19C13 20.1046 13.8954 21 15 21C16.1046 21 17 20.1046 17 19C17 17.8954 16.1046 17 15 17Z"]);s.appendChild(i),e.appendChild(s);const o=()=>{const l=new CustomEvent("tiptap-gutter-toggle",{bubbles:!0,detail:{handle:e,button:n}});e.dispatchEvent(l)};return n.addEventListener("click",l=>{l.preventDefault(),l.stopPropagation(),o()}),n.addEventListener("keydown",l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),o())}),s.addEventListener("mousedown",()=>{s.setAttribute("aria-expanded","true")}),s.addEventListener("mouseup",()=>{s.setAttribute("aria-expanded","false")}),t}})];var i2=typeof document<"u",o2=function(){},qd=i2?C.useLayoutEffect:o2;const l2={...ne},a2=l2.useInsertionEffect,c2=a2||(t=>t());function d2(t){const e=ne.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return c2(()=>{e.current=t}),ne.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return e.current==null?void 0:e.current(...r)},[])}var u2=typeof document<"u",h2=function(){},Wo=u2?C.useLayoutEffect:h2;function Jl(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Jl(t[r],e[r]))return!1;return!0}if(s=Object.keys(t),n=s.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&t.$$typeof)&&!Jl(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function sw(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Hm(t,e){const n=sw(t);return Math.round(e*n)/n}function Bc(t){const e=ne.useRef(t);return Wo(()=>{e.current=t}),e}function f2(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:l=!0,whileElementsMounted:a,open:c}=t,[d,u]=ne.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[h,f]=ne.useState(r);Jl(h,r)||f(r);const[p,g]=ne.useState(null),[y,b]=ne.useState(null),w=ne.useCallback(F=>{F!==x.current&&(x.current=F,g(F))},[]),M=ne.useCallback(F=>{F!==k.current&&(k.current=F,b(F))},[]),S=i||p,A=o||y,x=ne.useRef(null),k=ne.useRef(null),v=ne.useRef(d),T=a!=null,N=Bc(a),H=Bc(s),V=Bc(c),$=ne.useCallback(()=>{if(!x.current||!k.current)return;const F={placement:e,strategy:n,middleware:h};H.current&&(F.platform=H.current),Fu(x.current,k.current,F).then(ue=>{const xe={...ue,isPositioned:V.current!==!1};I.current&&!Jl(v.current,xe)&&(v.current=xe,c1.flushSync(()=>{u(xe)}))})},[h,e,n,H,V]);Wo(()=>{c===!1&&v.current.isPositioned&&(v.current.isPositioned=!1,u(F=>({...F,isPositioned:!1})))},[c]);const I=ne.useRef(!1);Wo(()=>(I.current=!0,()=>{I.current=!1}),[]),Wo(()=>{if(S&&(x.current=S),A&&(k.current=A),S&&A){if(N.current)return N.current(S,A,$);$()}},[S,A,$,N,T]);const j=ne.useMemo(()=>({reference:x,floating:k,setReference:w,setFloating:M}),[w,M]),Q=ne.useMemo(()=>({reference:S,floating:A}),[S,A]),ie=ne.useMemo(()=>{const F={position:n,left:0,top:0};if(!Q.floating)return F;const ue=Hm(Q.floating,d.x),xe=Hm(Q.floating,d.y);return l?{...F,transform:"translate("+ue+"px, "+xe+"px)",...sw(Q.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ue,top:xe}},[n,l,Q.floating,d.x,d.y]);return ne.useMemo(()=>({...d,update:$,refs:j,elements:Q,floatingStyles:ie}),[d,$,j,Q,ie])}const Yi=(t,e)=>({...zu(t),options:[t,e]}),Da=(t,e)=>({...Mb(t),options:[t,e]}),La=(t,e)=>({...Ab(t),options:[t,e]}),p2=(t,e)=>({...Tb(t),options:[t,e]}),m2={...ne};let zm=!1,g2=0;const Fm=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+g2++;function y2(){const[t,e]=ne.useState(()=>zm?Fm():void 0);return qd(()=>{t==null&&e(Fm())},[]),ne.useEffect(()=>{zm=!0},[]),t}const b2=m2.useId,x2=b2||y2;let Kd;process.env.NODE_ENV!=="production"&&(Kd=new Set);function w2(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];const s="Floating UI: "+n.join(" ");if(!((t=Kd)!=null&&t.has(s))){var i;(i=Kd)==null||i.add(s),console.error(s)}}function k2(){const t=new Map;return{emit(e,n){var r;(r=t.get(e))==null||r.forEach(s=>s(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var r;(r=t.get(e))==null||r.delete(n)}}}const v2=ne.createContext(null),S2=ne.createContext(null),C2=()=>{var t;return((t=ne.useContext(v2))==null?void 0:t.id)||null},E2=()=>ne.useContext(S2);function M2(t){const{open:e=!1,onOpenChange:n,elements:r}=t,s=x2(),i=ne.useRef({}),[o]=ne.useState(()=>k2()),l=C2()!=null;if(process.env.NODE_ENV!=="production"){const f=r.reference;f&&!ut(f)&&w2("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,c]=ne.useState(r.reference),d=d2((f,p,g)=>{i.current.openEvent=f?p:void 0,o.emit("openchange",{open:f,event:p,reason:g,nested:l}),n?.(f,p,g)}),u=ne.useMemo(()=>({setPositionReference:c}),[]),h=ne.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return ne.useMemo(()=>({dataRef:i,open:e,onOpenChange:d,elements:h,events:o,floatingId:s,refs:u}),[e,d,h,o,s,u])}function Xi(t){t===void 0&&(t={});const{nodeId:e}=t,n=M2({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,s=r.elements,[i,o]=ne.useState(null),[l,a]=ne.useState(null),d=s?.domReference||i,u=ne.useRef(null),h=E2();qd(()=>{d&&(u.current=d)},[d]);const f=f2({...t,elements:{...s,...l&&{reference:l}}}),p=ne.useCallback(M=>{const S=ut(M)?{getBoundingClientRect:()=>M.getBoundingClientRect(),getClientRects:()=>M.getClientRects(),contextElement:M}:M;a(S),f.refs.setReference(S)},[f.refs]),g=ne.useCallback(M=>{(ut(M)||M===null)&&(u.current=M,o(M)),(ut(f.refs.reference.current)||f.refs.reference.current===null||M!==null&&!ut(M))&&f.refs.setReference(M)},[f.refs]),y=ne.useMemo(()=>({...f.refs,setReference:g,setPositionReference:p,domReference:u}),[f.refs,g,p]),b=ne.useMemo(()=>({...f.elements,domReference:d}),[f.elements,d]),w=ne.useMemo(()=>({...f,...r,refs:y,elements:b,nodeId:e}),[f,y,b,e,r]);return qd(()=>{r.dataRef.current.floatingContext=w;const M=h?.nodesRef.current.find(S=>S.id===e);M&&(M.context=w)}),ne.useMemo(()=>({...f,context:w,refs:y,elements:b}),[f,y,b,w])}const A2="_pickerRoot_1wq30_1",T2="_picker_1wq30_1",Um={pickerRoot:A2,picker:T2};function Ia(){return(Ia=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function iw(t,e){if(t==null)return{};var n,r,s={},i=Object.keys(t);for(r=0;r<i.length;r++)e.indexOf(n=i[r])>=0||(s[n]=t[n]);return s}function Gd(t){var e=C.useRef(t),n=C.useRef(function(r){e.current&&e.current(r)});return e.current=t,n.current}var _i=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t<e?e:t},ni=function(t){return"touches"in t},Jd=function(t){return t&&t.ownerDocument.defaultView||self},Vm=function(t,e,n){var r=t.getBoundingClientRect(),s=ni(e)?(function(i,o){for(var l=0;l<i.length;l++)if(i[l].identifier===o)return i[l];return i[0]})(e.touches,n):e;return{left:_i((s.pageX-(r.left+Jd(t).pageXOffset))/r.width),top:_i((s.pageY-(r.top+Jd(t).pageYOffset))/r.height)}},Wm=function(t){!ni(t)&&t.preventDefault()},ow=C.memo(function(t){var e=t.onMove,n=t.onKey,r=iw(t,["onMove","onKey"]),s=C.useRef(null),i=Gd(e),o=Gd(n),l=C.useRef(null),a=C.useRef(!1),c=C.useMemo(function(){var f=function(y){Wm(y),(ni(y)?y.touches.length>0:y.buttons>0)&&s.current?i(Vm(s.current,y,l.current)):g(!1)},p=function(){return g(!1)};function g(y){var b=a.current,w=Jd(s.current),M=y?w.addEventListener:w.removeEventListener;M(b?"touchmove":"mousemove",f),M(b?"touchend":"mouseup",p)}return[function(y){var b=y.nativeEvent,w=s.current;if(w&&(Wm(b),!(function(S,A){return A&&!ni(S)})(b,a.current)&&w)){if(ni(b)){a.current=!0;var M=b.changedTouches||[];M.length&&(l.current=M[0].identifier)}w.focus(),i(Vm(w,b,l.current)),g(!0)}},function(y){var b=y.which||y.keyCode;b<37||b>40||(y.preventDefault(),o({left:b===39?.05:b===37?-.05:0,top:b===40?.05:b===38?-.05:0}))},g]},[o,i]),d=c[0],u=c[1],h=c[2];return C.useEffect(function(){return h},[h]),C.createElement("div",Ia({},r,{onTouchStart:d,onMouseDown:d,className:"react-colorful__interactive",ref:s,onKeyDown:u,tabIndex:0,role:"slider"}))}),Ah=function(t){return t.filter(Boolean).join(" ")},lw=function(t){var e=t.color,n=t.left,r=t.top,s=r===void 0?.5:r,i=Ah(["react-colorful__pointer",t.className]);return C.createElement("div",{className:i,style:{top:100*s+"%",left:100*n+"%"}},C.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},ot=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n},N2=function(t){return L2(Yd(t))},Yd=function(t){return t[0]==="#"&&(t=t.substring(1)),t.length<6?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?ot(parseInt(t[3]+t[3],16)/255,2):1}:{r:parseInt(t.substring(0,2),16),g:parseInt(t.substring(2,4),16),b:parseInt(t.substring(4,6),16),a:t.length===8?ot(parseInt(t.substring(6,8),16)/255,2):1}},_2=function(t){return D2(O2(t))},R2=function(t){var e=t.s,n=t.v,r=t.a,s=(200-e)*n/100;return{h:ot(t.h),s:ot(s>0&&s<200?e*n/100/(s<=100?s:200-s)*100:0),l:ot(s/2),a:ot(r,2)}},Xd=function(t){var e=R2(t);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},O2=function(t){var e=t.h,n=t.s,r=t.v,s=t.a;e=e/360*6,n/=100,r/=100;var i=Math.floor(e),o=r*(1-n),l=r*(1-(e-i)*n),a=r*(1-(1-e+i)*n),c=i%6;return{r:ot(255*[r,l,o,o,a,r][c]),g:ot(255*[a,r,r,l,o,o][c]),b:ot(255*[o,o,a,r,r,l][c]),a:ot(s,2)}},Ro=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},D2=function(t){var e=t.r,n=t.g,r=t.b,s=t.a,i=s<1?Ro(ot(255*s)):"";return"#"+Ro(e)+Ro(n)+Ro(r)+i},L2=function(t){var e=t.r,n=t.g,r=t.b,s=t.a,i=Math.max(e,n,r),o=i-Math.min(e,n,r),l=o?i===e?(n-r)/o:i===n?2+(r-e)/o:4+(e-n)/o:0;return{h:ot(60*(l<0?l+6:l)),s:ot(i?o/i*100:0),v:ot(i/255*100),a:s}},I2=C.memo(function(t){var e=t.hue,n=t.onChange,r=Ah(["react-colorful__hue",t.className]);return C.createElement("div",{className:r},C.createElement(ow,{onMove:function(s){n({h:360*s.left})},onKey:function(s){n({h:_i(e+360*s.left,0,360)})},"aria-label":"Hue","aria-valuenow":ot(e),"aria-valuemax":"360","aria-valuemin":"0"},C.createElement(lw,{className:"react-colorful__hue-pointer",left:e/360,color:Xd({h:e,s:100,v:100,a:1})})))}),j2=C.memo(function(t){var e=t.hsva,n=t.onChange,r={backgroundColor:Xd({h:e.h,s:100,v:100,a:1})};return C.createElement("div",{className:"react-colorful__saturation",style:r},C.createElement(ow,{onMove:function(s){n({s:100*s.left,v:100-100*s.top})},onKey:function(s){n({s:_i(e.s+100*s.left,0,100),v:_i(e.v-100*s.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+ot(e.s)+"%, Brightness "+ot(e.v)+"%"},C.createElement(lw,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:Xd(e)})))}),aw=function(t,e){if(t===e)return!0;for(var n in t)if(t[n]!==e[n])return!1;return!0},P2=function(t,e){return t.toLowerCase()===e.toLowerCase()||aw(Yd(t),Yd(e))};function B2(t,e,n){var r=Gd(n),s=C.useState(function(){return t.toHsva(e)}),i=s[0],o=s[1],l=C.useRef({color:e,hsva:i});C.useEffect(function(){if(!t.equal(e,l.current.color)){var c=t.toHsva(e);l.current={hsva:c,color:e},o(c)}},[e,t]),C.useEffect(function(){var c;aw(i,l.current.hsva)||t.equal(c=t.fromHsva(i),l.current.color)||(l.current={hsva:i,color:c},r(c))},[i,t,r]);var a=C.useCallback(function(c){o(function(d){return Object.assign({},d,c)})},[]);return[i,a]}var $2=typeof window<"u"?C.useLayoutEffect:C.useEffect,H2=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},qm=new Map,z2=function(t){$2(function(){var e=t.current?t.current.ownerDocument:document;if(e!==void 0&&!qm.has(e)){var n=e.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,qm.set(e,n);var r=H2();r&&n.setAttribute("nonce",r),e.head.appendChild(n)}},[])},F2=function(t){var e=t.className,n=t.colorModel,r=t.color,s=r===void 0?n.defaultColor:r,i=t.onChange,o=iw(t,["className","colorModel","color","onChange"]),l=C.useRef(null);z2(l);var a=B2(n,s,i),c=a[0],d=a[1],u=Ah(["react-colorful",e]);return C.createElement("div",Ia({},o,{ref:l,className:u}),C.createElement(j2,{hsva:c,onChange:d}),C.createElement(I2,{hue:c.h,onChange:d,className:"react-colorful__last-control"}))},U2={defaultColor:"000",toHsva:N2,fromHsva:function(t){return _2({h:t.h,s:t.s,v:t.v,a:1})},equal:P2},V2=function(t){return C.createElement(F2,Ia({},t,{colorModel:U2}))};const Km="#1F2937",Gm="#FFF7D1",W2=["#FFF7D1","#FFEAE3","#DCFCE7","#DBEAFE"],q2=[{title:"Brand",colors:[{label:"Primary",value:"hsl(var(--primary))"},{label:"Secondary",value:"hsl(var(--secondary))"},{label:"Accent",value:"hsl(var(--accent))"},{label:"Ring",value:"hsl(var(--ring))"}]},{title:"Neutrals",colors:[{label:"Foreground",value:"hsl(var(--foreground))"},{label:"Muted",value:"hsl(var(--muted-foreground))"},{label:"Background",value:"hsl(var(--background))"},{label:"Card",value:"hsl(var(--card))"}]},{title:"States",colors:[{label:"Warning",value:"hsl(var(--warning))"},{label:"Destructive",value:"hsl(var(--destructive))"},{label:"Success",value:"hsl(var(--chart-2))"},{label:"Info",value:"hsl(var(--chart-5))"}]},{title:"Utility",colors:[{label:"Secondary FG",value:"hsl(var(--secondary-foreground))"},{label:"Accent FG",value:"hsl(var(--accent-foreground))"},{label:"Primary FG",value:"hsl(var(--primary-foreground))"},{label:"Border",value:"hsl(var(--border))"}]}],K2=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,G2=/^#[0-9a-f]{6}$/i,cw=/^rgba?\((\s*\d{1,3}\s*,){2}\s*\d{1,3}\s*(,\s*(0|1|0?\.\d+)\s*)?\)$/i,dw=/^hsla?\((\s*\d{1,3}\s*,)(\s*\d{1,3}%\s*,)\s*\d{1,3}%\s*(,\s*(0|1|0?\.\d+)\s*)?\)$/i;function Yl(t){const e=t.replace("#","").trim();return e.length===3||e.length===4?`#${e.split("").map(r=>r+r).join("").toUpperCase()}`:e.length===6||e.length===8?`#${e.toUpperCase()}`:t}function uw(t){const e=Yl(t).replace("#","");if(e.length!==6&&e.length!==8)return null;const n=parseInt(e.slice(0,2),16),r=parseInt(e.slice(2,4),16),s=parseInt(e.slice(4,6),16),i=e.length===8?parseInt(e.slice(6,8),16)/255:1;return{r:n,g:r,b:s,a:i}}function Zd(t,e,n){return`#${[t,e,n].map(r=>Math.max(0,Math.min(255,Math.round(r))).toString(16).padStart(2,"0")).join("").toUpperCase()}`}function ri(t,e=2){const n=10**e;return Math.round(t*n)/n}function si(t,e,n,r=1){const s=t/255,i=e/255,o=n/255,l=Math.max(s,i,o),a=Math.min(s,i,o);let c=0,d=0;const u=(l+a)/2;if(l!==a){const g=l-a;switch(d=u>.5?g/(2-l-a):g/(l+a),l){case s:c=(i-o)/g+(i<o?6:0);break;case i:c=(o-s)/g+2;break;case o:c=(s-i)/g+4;break}c/=6}const h=Math.round(c*360),f=Math.round(d*100),p=Math.round(u*100);return r!==1?`hsla(${h}, ${f}%, ${p}%, ${ri(r,2)})`:`hsl(${h}, ${f}%, ${p}%)`}function Jm(t){if(typeof window>"u"||typeof document>"u")return null;const e=document.createElement("span");if(e.style.color="",e.style.color=t,!e.style.color)return null;e.style.position="absolute",e.style.visibility="hidden",e.style.pointerEvents="none",document.body.appendChild(e);const n=getComputedStyle(e).color;document.body.removeChild(e);const r=n.match(/rgba?\(([^)]+)\)/i);if(!r)return null;const[s,i,o,l]=r[1].split(",").map(a=>a.trim()).map((a,c)=>c===3?parseFloat(a):parseInt(a,10));return[s,i,o].some(a=>Number.isNaN(a))?null:{r:s,g:i,b:o,a:typeof l=="number"&&!Number.isNaN(l)?l:1}}function Sn(t){if(!t)return null;const e=t.trim();if(K2.test(e)){const r=Yl(e),s=uw(r);if(!s)return null;const i=`#${r.replace("#","").slice(0,6)}`;return{source:r,hex:i,rgb:s.a===1?`rgb(${s.r}, ${s.g}, ${s.b})`:`rgba(${s.r}, ${s.g}, ${s.b}, ${ri(s.a,2)})`,hsl:si(s.r,s.g,s.b,s.a),alpha:s.a}}if(cw.test(e)||dw.test(e)){const r=Jm(e);return r?{source:e,hex:Zd(r.r,r.g,r.b),rgb:r.a===1?`rgb(${r.r}, ${r.g}, ${r.b})`:`rgba(${r.r}, ${r.g}, ${r.b}, ${ri(r.a,2)})`,hsl:si(r.r,r.g,r.b,r.a),alpha:r.a}:null}const n=Jm(e);return n?{source:e,hex:Zd(n.r,n.g,n.b),rgb:n.a===1?`rgb(${n.r}, ${n.g}, ${n.b})`:`rgba(${n.r}, ${n.g}, ${n.b}, ${ri(n.a,2)})`,hsl:si(n.r,n.g,n.b,n.a),alpha:n.a}:null}function hw(t){const e=uw(t);if(e)return{source:Yl(t),hex:Zd(e.r,e.g,e.b),rgb:e.a===1?`rgb(${e.r}, ${e.g}, ${e.b})`:`rgba(${e.r}, ${e.g}, ${e.b}, ${ri(e.a,2)})`,hsl:si(e.r,e.g,e.b,e.a),alpha:e.a};const n=Yl(t);return{source:n,hex:n.slice(0,7),rgb:"rgb(0, 0, 0)",hsl:si(0,0,0,1),alpha:1}}const $s=Sn(Km)??hw(Km),Ym=Sn(Gm)??hw(Gm);function fw({editor:t,className:e,initialMode:n="text"}){const r=C.useRef(null),[s,i]=C.useState(n),[o,l]=C.useState(null),[a,c]=C.useState($s),[d,u]=C.useState(Ym);C.useEffect(()=>{i(n)},[n]);const[h,f]=C.useState($s.hex),[p,g]=C.useState(!1),[y,b]=C.useState($s.rgb),[w,M]=C.useState(!1),[S,A]=C.useState($s.hsl),[x,k]=C.useState(!1),v=s==="text"?a:d;C.useEffect(()=>{const $=()=>{if(o)return;const I=t.getAttributes("textStyle").color,j=t.getAttributes("highlight").color,Q=Sn(I)??$s,ie=Sn(j)??Ym;c(Q),u(ie)};return $(),t.on("selectionUpdate",$),t.on("transaction",$),()=>{t.off("selectionUpdate",$),t.off("transaction",$)}},[t,o,s]),C.useEffect(()=>{o!=="hex"&&f(v.hex),o!=="rgb"&&b(v.rgb),o!=="hsl"&&A(v.hsl),o===null&&(g(!1),M(!1),k(!1))},[v,o]);const T=C.useCallback(($,I,j=!0)=>{const Q=t.chain();j&&Q.focus(),$==="text"?(c(I),Q.setColor(I.source).run()):(u(I),Q.setHighlight({color:I.source}).run())},[t,c,u]),N=C.useCallback(($,I)=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{T($,I,!1)},300)},[T]),H=C.useCallback($=>{r.current&&clearTimeout(r.current);const I=Sn($);I&&(T(s,I,!1),g(!1))},[T,s,g]),V=C.useCallback($=>{r.current&&clearTimeout(r.current);const I=Sn($);I&&(T(s,I),g(!1))},[T,s,g]);return m.jsxs("div",{className:Oe.cn("flex w-full sm:w-auto flex-col gap-3 sm:gap-4",e),children:[m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsxs("div",{className:"inline-flex items-center gap-1 rounded-md bg-muted/60 p-1",children:[m.jsx(le.Button,{type:"button",variant:s==="text"?"default":"ghost",size:"sm",className:"h-7 px-3 text-xs",onClick:()=>i("text"),children:"Text"}),m.jsx(le.Button,{type:"button",variant:s==="highlight"?"default":"ghost",size:"sm",className:"h-7 px-3 text-xs",onClick:()=>i("highlight"),children:"Highlight"})]}),m.jsx("div",{className:"flex items-center",children:m.jsx(le.Button,{type:"button",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>{s==="text"?t.chain().focus().unsetColor().run():t.chain().focus().unsetHighlight().run()},children:"Remove Color"})})]}),m.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:gap-4",children:[m.jsx("div",{className:Um.pickerRoot,children:m.jsx(V2,{color:v.hex,onChange:H,className:Um.picker})}),m.jsxs("div",{className:"flex w-full flex-col gap-2 text-[11px] sm:w-[150px]",children:[m.jsxs("div",{className:"space-y-1",children:[m.jsx("p",{className:"font-medium text-muted-foreground",children:"HEX"}),m.jsx(ns.Input,{value:h,onFocus:()=>l("hex"),onChange:$=>{const I=$.target.value;if(f(I),G2.test(I)){const j=Sn(I);j&&(N(s,j),g(!1))}else g(!0)},onBlur:()=>{l(null),p&&(f(v.hex),g(!1))},spellCheck:!1,className:Oe.cn("h-8 w-full text-xs",p&&"border-destructive focus-visible:ring-destructive")})]}),m.jsxs("div",{className:"space-y-1",children:[m.jsx("p",{className:"font-medium text-muted-foreground",children:"RGB"}),m.jsx(ns.Input,{value:y,onFocus:()=>l("rgb"),onChange:$=>{const I=$.target.value;if(b(I),cw.test(I)){const j=Sn(I);j&&(N(s,j),M(!1))}else M(!0)},onBlur:()=>{l(null),w&&(b(v.rgb),M(!1))},spellCheck:!1,className:Oe.cn("h-8 w-full text-xs",w&&"border-destructive focus-visible:ring-destructive")})]}),m.jsxs("div",{className:"space-y-1",children:[m.jsx("p",{className:"font-medium text-muted-foreground",children:"HSL"}),m.jsx(ns.Input,{value:S,onFocus:()=>l("hsl"),onChange:$=>{const I=$.target.value;if(A(I),dw.test(I)){const j=Sn(I);j&&(N(s,j),k(!1))}else k(!0)},onBlur:()=>{l(null),x&&(A(v.hsl),k(!1))},spellCheck:!1,className:Oe.cn("h-8 w-full text-xs",x&&"border-destructive focus-visible:ring-destructive")})]})]})]}),m.jsxs("div",{className:"space-y-1.5",children:[m.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Theme colors"}),m.jsx("div",{className:"space-y-1",children:q2.map($=>m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsx("span",{className:"w-16 shrink-0 text-[11px] font-medium text-muted-foreground/80",children:$.title}),m.jsx("div",{className:"flex items-center gap-1.5",children:$.colors.map(I=>m.jsx("button",{type:"button",onClick:()=>V(I.value),className:"h-6 w-6 rounded border border-border bg-background shadow-sm transition hover:border-primary/40 hover:shadow-sm",style:{background:I.value},"aria-label":`${$.title} color ${I.label}`,title:`${$.title} color ${I.label}`},I.label))})]},$.title))})]}),s==="highlight"?m.jsxs("div",{className:"space-y-2",children:[m.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Highlight presets"}),m.jsx("div",{className:"flex flex-wrap gap-1.5",children:W2.map($=>m.jsxs("button",{type:"button",onClick:()=>V($),className:"flex items-center gap-1 rounded-full border bg-background px-2 py-1 text-[11px] shadow-sm transition hover:border-primary/40 hover:shadow-sm",children:[m.jsx("span",{className:"h-3.5 w-3.5 rounded-full border",style:{background:$},"aria-hidden":!0}),$]},$))})]}):null]})}const J2=["px","pt","rem","em","%"];function qo(t){if(!t)return null;const n=String(t).trim().match(/^(-?\d*\.?\d+)(px|pt|rem|em|%)$/i);if(!n)return null;const r=parseFloat(n[1]),s=n[2].toLowerCase();return Number.isFinite(r)?{value:r,unit:s}:null}function Qd(t){if(!t)return null;const{value:e,unit:n}=t;return n==="%"?`${Math.max(1,Math.round(e))}%`:n==="px"||n==="pt"?`${Math.max(1,Math.round(e))}${n}`:`${Math.max(.01,Math.round(e*100)/100)}${n}`}function Y2(t){const e=qo(t);return e?Qd(e):null}function X2(){if(typeof document>"u")return[];const t=[];try{const n=Array.from(document.styleSheets),r=[],s=[];for(const l of n){const a=l.href,c=l.ownerNode;`${a||""} ${c?.textContent||""}`.toLowerCase().includes("globals.css")?r.push(l):s.push(l)}const i=[...r,...s],o=new Set(["h1","h2","h3","h4","h5","h6"]);for(const l of i){let a=null;try{a=l.cssRules}catch{continue}if(a){for(const c of Array.from(a))if(c.style){const u=c.style.fontSize,h=c.selectorText;if(u&&h&&o.has(h)){const f=Y2(u)??u.trim();if(f){const p=parseInt(h.replace("h",""),10);t.push({level:p,value:f})}}}}}}catch{}const e=new Map;for(const n of t)e.has(n.level)||e.set(n.level,n.value);return Array.from(e.entries()).map(([n,r])=>({level:n,value:r}))}function Z2(t){if(typeof document>"u")return 0;try{const e=document.createElement("span");e.style.position="absolute",e.style.visibility="hidden",e.style.fontSize=t,document.body.appendChild(e);const n=parseFloat(getComputedStyle(e).fontSize);return document.body.removeChild(e),Number.isFinite(n)?n:0}catch{return 0}}function Xl(){if(typeof document>"u")return 16;try{const t=parseFloat(getComputedStyle(document.documentElement).fontSize);return Number.isFinite(t)&&t>0?t:16}catch{return 16}}function Th(t){try{const e=t.state.selection.from,n=t.view.domAtPos(e),r=n&&n.node||t.view.dom,s=r.nodeType===1?r:t.view.dom,i=parseFloat(getComputedStyle(s).fontSize);return Number.isFinite(i)&&i>0?i:Xl()}catch{return Xl()}}function Q2(t,e,n){const r=Xl(),s=Th(n);switch(e){case"px":return t;case"pt":return t*(96/72);case"rem":return t*r;case"em":return t*s;case"%":return t/100*s}}function ej(t,e,n){const r=Xl(),s=Th(n);switch(e){case"px":return t;case"pt":return t*(72/96);case"rem":return t/r;case"em":return t/s;case"%":return t/s*100}}function pw({editor:t,className:e}){const[n,r]=C.useState([]),[s,i]=C.useState(null),[o,l]=C.useState(""),[a,c]=C.useState("px"),[d,u]=C.useState(!1),h=C.useRef(null),f=C.useCallback(()=>{const S=t.getAttributes("textStyle").fontSize,A=qo(S);if(A)l(String(A.value)),c(A.unit),u(!1);else{if(S&&typeof S=="string"){const x=Z2(S);if(x>0&&!s){l(String(Math.round(x))),c("px"),u(!1);return}}s||(l(""),c("px"),u(!1))}},[t,s]);C.useEffect(()=>{f();const S=()=>f();return t.on("selectionUpdate",S),t.on("transaction",S),()=>{t.off("selectionUpdate",S),t.off("transaction",S)}},[t,f]),C.useEffect(()=>{r(X2())},[]);const p=C.useCallback((S,A=!0)=>{h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{const x=t.chain();A&&x.focus(),x.setFontSize(S).run()},120)},[t]),g=C.useCallback(S=>{l(S);const A=`${S}${a}`,x=qo(A);if(x){u(!1);const k=Qd(x);k&&p(k,!1)}else u(S.trim().length>0)},[a,p]),y=C.useCallback(S=>{const A=a;c(S);let x=0;const k=parseFloat(o);Number.isFinite(k)?x=Q2(k,A,t):x=Th(t);const v=ej(x,S,t);let T;S==="px"||S==="pt"||S==="%"?T=String(Math.round(v)):T=String(Math.max(.01,Math.round(v*100)/100)),l(T);const N=Qd(qo(`${T}${S}`));N&&p(N)},[a,o,t,p]),b=C.useCallback(()=>{h.current&&clearTimeout(h.current),t.chain().focus().unsetFontSize().run(),u(!1)},[t]),w=C.useMemo(()=>a==="px"||a==="pt"||a==="%"?1:.01,[a]),M=C.useMemo(()=>{switch(a){case"%":return"100";case"px":return"16";case"pt":return"12";case"rem":return"1";case"em":return"1";default:return""}},[a]);return m.jsxs("div",{className:Oe.cn("space-y-3",e),onMouseDown:S=>S.stopPropagation(),children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Wr,{className:"h-4 w-4 text-muted-foreground"}),m.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Font size"})]}),m.jsxs(le.Button,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:b,title:"Erase font size","aria-label":"Erase font size",children:[m.jsx(WL,{className:"h-3.5 w-3.5 mr-1"}),"Erase"]})]}),m.jsxs("div",{className:"grid grid-cols-[1fr_auto] gap-2 items-end",children:[m.jsxs("div",{className:"space-y-1",children:[m.jsx("p",{className:"font-medium text-muted-foreground",children:"Value"}),m.jsx(ns.Input,{type:"number",inputMode:"decimal",step:w,placeholder:M,value:o,onFocus:()=>i("value"),onChange:S=>g(S.target.value),onBlur:()=>i(null),className:Oe.cn("h-9",d&&"border-destructive focus-visible:ring-destructive"),spellCheck:!1})]}),m.jsxs("div",{className:"space-y-1",children:[m.jsx("p",{className:"font-medium text-muted-foreground",children:"Unit"}),m.jsx("div",{className:"flex gap-1",children:m.jsx("select",{value:a,onChange:S=>y(S.target.value),onFocus:()=>i("unit"),onBlur:()=>i(null),className:"h-9 w-[84px] rounded-md border border-input bg-background px-2 text-sm shadow-sm outline-none focus-visible:ring-2 focus-visible:ring-ring",children:J2.map(S=>m.jsx("option",{value:S,children:S},S))})})]})]}),m.jsxs("div",{className:"space-y-2",children:[n.length>0?m.jsxs("div",{className:"space-y-1",children:[m.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Headings"}),m.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:n.map(({level:S,value:A})=>m.jsx("button",{type:"button",onClick:()=>p(A),className:"h-8 w-full rounded-md border bg-background px-2 text-xs font-medium shadow-sm transition hover:border-primary/40 hover:shadow-sm",title:`Apply H${S} (${A})`,children:`H${S} (${A})`},`h${S}`))})]}):null,m.jsxs("div",{className:"space-y-1",children:[m.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Keywords"}),m.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:["xx-small","x-small","small","medium","large","x-large"].map(S=>m.jsx("button",{type:"button",onClick:()=>p(S),className:"h-8 w-full rounded-md border bg-background px-2 text-xs font-medium shadow-sm transition hover:border-primary/40 hover:shadow-sm",title:`Apply ${S}`,children:S.replace(/\b\w/g,A=>A.toUpperCase())},S))})]})]})]})}const tj=({editor:t})=>{const[e,n]=C.useState(t.getAttributes("link")?.href??"");C.useEffect(()=>{const s=()=>{n(t.getAttributes("link")?.href??"")};return t.on("selectionUpdate",s),t.on("transaction",s),()=>{t.off("selectionUpdate",s),t.off("transaction",s)}},[t]);const r=()=>{const s=e.trim();s?t.chain().focus().extendMarkRange("link").setLink({href:s}).run():t.chain().focus().extendMarkRange("link").unsetLink().run()};return m.jsxs("div",{className:"p-2 flex items-center gap-2",onMouseDown:s=>s.preventDefault(),children:[m.jsx("input",{type:"url",value:e,onChange:s=>n(s.target.value),placeholder:"Enter URL",className:"bg-background p-1 rounded border border-input text-sm",onKeyDown:s=>s.key==="Enter"&&r()}),m.jsx(le.Button,{type:"button",size:"sm",onClick:r,children:"Set Link"})]})},nj=({editor:t})=>m.jsx("div",{className:"w-[380px]",children:m.jsx(fw,{editor:t,className:"p-4",initialMode:t.isActive("highlight")?"highlight":"text"})}),Nh=({editor:t})=>{const[e,n]=C.useState(!1),[r,s]=C.useState(!1),[i,o]=C.useState(!1),[l,a]=C.useState(!1),{x:c,y:d,refs:u,strategy:h,update:f}=Xi({placement:"top",middleware:[Yi(6),La(),Da()],whileElementsMounted:Ms}),p=C.useCallback(()=>{if(!t||!t.isEditable)return!1;const{state:y}=t,{from:b,to:w}=y.selection,M=b!==w,S=y.selection instanceof q,A=t.isActive("codeBlock"),x=y.selection.empty&&(t.isActive("alert-widget")||t.isActive("cta-widget")),k=t.isActive("image");return M&&!S&&!A&&!x&&!k},[t]),g=C.useCallback(()=>{if(!(!t||!p()))try{const{from:y,to:b}=t.state.selection,w=t.view.coordsAtPos(y),M=t.view.coordsAtPos(b),S={getBoundingClientRect:()=>({x:w.left,y:w.top,top:w.top,left:w.left,bottom:M.bottom,right:M.right,width:M.right-w.left,height:M.bottom-w.top})};u.setReference(S),f(),requestAnimationFrame(()=>s(!0))}catch(y){console.warn("BubbleMenu positioning error:",y)}},[t,u,f,p]);return C.useEffect(()=>{if(!t)return;let y=0;const b=()=>{cancelAnimationFrame(y),y=requestAnimationFrame(()=>{p()?(n(!0),g()):!i&&!l&&n(!1)})},w=({event:M})=>{i||l||u.floating.current&&M.relatedTarget&&u.floating.current.contains(M.relatedTarget)||n(!1)};return b(),t.on("selectionUpdate",b),t.on("transaction",b),t.on("focus",b),t.on("blur",w),()=>{cancelAnimationFrame(y),t.off("selectionUpdate",b),t.off("transaction",b),t.off("focus",b),t.off("blur",w)}},[t,p,g,i,l,u.floating]),!t||!e?null:m.jsxs("div",{ref:u.setFloating,style:{position:h,top:d??0,left:c??0,zIndex:1e4,visibility:r?"visible":"hidden"},className:"flex gap-1 items-center bg-background border rounded-lg p-1 shadow-lg",onMouseDown:y=>y.preventDefault(),children:[m.jsx("button",{type:"button",onClick:()=>t.chain().focus().toggleBold().run(),className:`p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center ${t.isActive("bold")?"bg-accent":""}`,"aria-label":"Bold",title:"Bold",children:m.jsx(Gl,{className:"h-4 w-4 pointer-events-none"})}),m.jsx("button",{type:"button",onClick:()=>t.chain().focus().toggleItalic().run(),className:`p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center ${t.isActive("italic")?"bg-accent":""}`,"aria-label":"Italic",title:"Italic",children:m.jsx(kh,{className:"h-4 w-4 pointer-events-none"})}),m.jsx("button",{type:"button",onClick:()=>t.chain().focus().toggleUnderline().run(),className:`p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center ${t.isActive("underline")?"bg-accent":""}`,"aria-label":"Underline",title:"Underline",children:m.jsx(Ch,{className:"h-4 w-4 pointer-events-none"})}),m.jsx("button",{type:"button",onClick:()=>t.chain().focus().toggleStrike().run(),className:`p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center ${t.isActive("strike")?"bg-accent":""}`,"aria-label":"Strikethrough",title:"Strikethrough",children:m.jsx(Yx,{className:"h-4 w-4 pointer-events-none"})}),m.jsx("button",{type:"button",onClick:()=>t.chain().focus().toggleCode().run(),className:`p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center ${t.isActive("code")?"bg-accent":""}`,"aria-label":"Inline code",title:"Inline code",children:m.jsx(Rs,{className:"h-4 w-4 pointer-events-none"})}),m.jsx("div",{className:"w-px bg-border h-5"}),m.jsx("button",{type:"button",onClick:()=>t.chain().focus().toggleSubscript().run(),className:`p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center ${t.isActive("subscript")?"bg-accent":""}`,"aria-label":"Subscript",title:"Subscript",children:m.jsx(Xx,{className:"h-4 w-4 pointer-events-none"})}),m.jsx("button",{type:"button",onClick:()=>t.chain().focus().toggleSuperscript().run(),className:`p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center ${t.isActive("superscript")?"bg-accent":""}`,"aria-label":"Superscript",title:"Superscript",children:m.jsx(Zx,{className:"h-4 w-4 pointer-events-none"})}),m.jsx("div",{className:"w-px bg-border h-5"}),m.jsx("button",{type:"button",onClick:()=>t.chain().focus().setTextAlign("left").run(),className:`p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center ${t.isActive({textAlign:"left"})?"bg-accent":""}`,"aria-label":"Align left",title:"Align left",children:m.jsx(Ss,{className:"h-4 w-4 pointer-events-none"})}),m.jsx("button",{type:"button",onClick:()=>t.chain().focus().setTextAlign("center").run(),className:`p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center ${t.isActive({textAlign:"center"})?"bg-accent":""}`,"aria-label":"Align center",title:"Align center",children:m.jsx(Ki,{className:"h-4 w-4 pointer-events-none"})}),m.jsx("button",{type:"button",onClick:()=>t.chain().focus().setTextAlign("right").run(),className:`p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center ${t.isActive({textAlign:"right"})?"bg-accent":""}`,"aria-label":"Align right",title:"Align right",children:m.jsx(Gi,{className:"h-4 w-4 pointer-events-none"})}),m.jsx("button",{type:"button",onClick:()=>t.chain().focus().setTextAlign("justify").run(),className:`p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center ${t.isActive({textAlign:"justify"})?"bg-accent":""}`,"aria-label":"Justify",title:"Justify",children:m.jsx(Sh,{className:"h-4 w-4 pointer-events-none"})}),m.jsx("div",{className:"w-px bg-border h-5"}),m.jsxs(gt.Popover,{open:l,onOpenChange:a,children:[m.jsx(gt.PopoverTrigger,{asChild:!0,children:m.jsx("button",{type:"button",className:"p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center","aria-label":"Font size",title:"Font size",onMouseDown:y=>y.preventDefault(),children:m.jsx(Wr,{className:"h-4 w-4 pointer-events-none"})})}),m.jsx(gt.PopoverContent,{onFocusOutside:y=>y.preventDefault(),onMouseDown:y=>y.stopPropagation(),className:"w-[360px] p-0",side:"top",align:"start",children:m.jsx(pw,{editor:t,className:"p-4"})})]}),m.jsxs(gt.Popover,{children:[m.jsx(gt.PopoverTrigger,{asChild:!0,children:m.jsx("button",{type:"button",className:`p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center ${t.isActive("link")?"bg-accent":""}`,"aria-label":"Link",title:"Link",onMouseDown:y=>y.preventDefault(),children:m.jsx(Ta,{className:"h-4 w-4 pointer-events-none"})})}),m.jsx(gt.PopoverContent,{className:"w-auto p-0",side:"top",align:"start",children:m.jsx(tj,{editor:t})})]}),m.jsxs(gt.Popover,{open:i,onOpenChange:o,children:[m.jsx(gt.PopoverTrigger,{asChild:!0,children:m.jsx("button",{type:"button",onMouseDown:y=>y.preventDefault(),className:`p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center ${t.isActive("textStyle")||t.isActive("highlight")?"bg-accent":""}`,"aria-label":"Color / highlight",title:"Color / highlight",children:m.jsx(vh,{className:"h-4 w-4 pointer-events-none"})})}),m.jsx(gt.PopoverContent,{onFocusOutside:y=>y.preventDefault(),onMouseDown:y=>y.stopPropagation(),className:"w-auto p-0",side:"top",align:"start",children:m.jsx(nj,{editor:t})})]}),m.jsx("div",{className:"w-px bg-border h-5"})]})};function Xm(t,e){t.storage.mediaPicker={open:e}}function ja(t){return t.storage?.mediaPicker?.open}const rj=[{title:"Heading 1",icon:m.jsx(vs,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleHeading({level:1}).run()},{title:"Heading 2",icon:m.jsx(Vi,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleHeading({level:2}).run()},{title:"Bullet List",icon:m.jsx(Os,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleBulletList().run()},{title:"Ordered List",icon:m.jsx(Wi,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleOrderedList().run()},{title:"Blockquote",icon:m.jsx(Ji,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleBlockquote().run()},{title:"Code Block",icon:m.jsx(Rs,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleCodeBlock().run()},{title:"Image",icon:m.jsx(zr,{className:"h-4 w-4"}),command:async t=>{const e=ja(t);if(e){const r=await e();r?.src&&t.chain().focus().setImage({src:r.src,alt:r.alt||void 0}).updateAttributes("image",{blurDataURL:r.blurDataURL||void 0}).run();return}const n=window.prompt("URL");n&&t.chain().focus().setImage({src:n}).run()}},{title:"Table",icon:m.jsx(qi,{className:"h-4 w-4"}),command:t=>t.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run()},{title:"Horizontal Rule",icon:m.jsx(_a,{className:"h-4 w-4"}),command:t=>t.chain().focus().setHorizontalRule().run()},{title:"Link",icon:m.jsx(Ta,{className:"h-4 w-4"}),command:t=>{const e=window.prompt("Enter URL:");e&&t.chain().focus().setLink({href:e}).run()}},{title:"CSS Block",icon:m.jsx(Nr,{className:"h-4 w-4"}),command:t=>{const e=window.prompt("Enter CSS (without <style> tags):","/* your styles */");if(e!=null){const n=`<style>${e}</style>`;t.commands.insertContentAt({from:0,to:0},n)}}},{title:"Script Block",icon:m.jsx(Nr,{className:"h-4 w-4"}),command:t=>{const e=window.prompt("Enter JavaScript (without <script> tags):","// your script");if(e!=null){const n=`<script>${e}<\/script>`,r=t.state.doc.content.size;t.commands.insertContentAt(r,n)}}},{title:"DIV Block",icon:m.jsx(Nr,{className:"h-4 w-4"}),command:t=>{const e=window.prompt("Optional class for DIV:",""),n=window.prompt("Optional inline style for DIV:",""),r=window.prompt("Optional content for DIV:","New block"),s=`${e?` class="${e}"`:""}${n?` style="${n}"`:""}`,o=r?`<p>${(l=>l.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"))(r)}</p>`:"<p><br /></p>";t.chain().focus().insertContent(`<div${s}>${o}</div>`).run()}},{title:"Alert Widget",icon:m.jsx(Oa,{className:"h-4 w-4"}),command:t=>{t.chain().focus().setAlertWidget().run()}},{title:"CTA Widget",icon:m.jsx(Na,{className:"h-4 w-4"}),command:t=>{t.chain().focus().setCtaWidget({text:"Learn more",url:"",style:"primary",size:"medium",textAlign:"center"}).run()}}],_h=({editor:t})=>{const[e,n]=C.useState(!1),[r,s]=C.useState(null),[i,o]=C.useState(null),l=C.useRef(null),a=C.useRef(null),c=C.useRef(!1),d=C.useCallback(()=>{l.current&&l.current.setAttribute("aria-expanded","false"),a.current&&a.current.removeAttribute("data-menu-open"),l.current=null,a.current=null,s(null),n(!1)},[]),{x:u,y:h,refs:f,strategy:p}=Xi({placement:"right-start",open:e,middleware:[Yi(8),La(),Da()],whileElementsMounted:Ms});C.useEffect(()=>{c.current=e},[e]),C.useEffect(()=>{r?f.setReference(r):f.setReference(null)},[r,f]);const g=C.useCallback(()=>!(!t||!t.isEditable||t.isActive("image")),[t]);C.useEffect(()=>{if(!t)return;const b=t.view.dom.parentElement;if(!b)return;const w=M=>{const S=M,{handle:A,button:x}=S.detail;try{const v=t.state.selection?.$from;if(v){let T=v.depth;for(;T>0&&!v.node(T)?.isBlock;)T-=1;const N=typeof v.after=="function"?v.after(T):void 0;typeof N=="number"?o(N):typeof v.pos=="number"?o(v.pos):o(null)}else o(null)}catch{o(null)}if(l.current===x&&c.current){d();return}l.current&&l.current!==x&&l.current.setAttribute("aria-expanded","false"),a.current&&a.current!==A&&a.current.removeAttribute("data-menu-open"),l.current=x,a.current=A,x.setAttribute("aria-expanded","true"),A.setAttribute("data-menu-open","true"),s(x),n(!0)};return b.addEventListener("tiptap-gutter-toggle",w),()=>{b.removeEventListener("tiptap-gutter-toggle",w)}},[t,g,d]),C.useEffect(()=>{if(!t)return;const b=()=>{g()||d()};return t.on("selectionUpdate",b),t.on("transaction",b),t.on("blur",d),()=>{t.off("selectionUpdate",b),t.off("transaction",b),t.off("blur",d)}},[t,g,d]),C.useEffect(()=>{if(!e)return;const b=M=>{const S=M.target,A=f.floating.current;if(A&&!A.contains(S)){const x=l.current;(!x||!x.contains(S))&&d()}},w=M=>{M.key==="Escape"&&d()};return document.addEventListener("mousedown",b),document.addEventListener("keydown",w),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",w)}},[e,d,f]);const y=b=>{i!=null?t.chain().focus().insertContentAt(i,{type:"paragraph"}).setTextSelection(i+1).run():t.chain().focus().run(),b(t),d()};return!r||!e?null:m.jsx("div",{ref:f.setFloating,style:{position:p,top:h??0,left:u??0,zIndex:10001},className:"w-48 rounded-md bg-white p-1 shadow-lg max-h-[400px] overflow-auto",onMouseDown:b=>b.preventDefault(),children:m.jsx("div",{className:"flex flex-col",children:rj.map(b=>m.jsxs(le.Button,{type:"button",variant:"ghost",className:"justify-start",onClick:()=>y(b.command),children:[b.icon,m.jsx("span",{className:"ml-2",children:b.title})]},b.title))})})},sj=[{title:"Text",description:"Start writing with plain text",icon:m.jsx(Wr,{className:"h-4 w-4"}),command:t=>t.chain().focus().clearNodes().run(),category:"basic",keywords:["text","paragraph","plain"]},{title:"Heading 1",description:"Large section heading",icon:m.jsx(vs,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleHeading({level:1}).run(),category:"headings",keywords:["heading","h1","title","large"]},{title:"Heading 2",description:"Medium section heading",icon:m.jsx(Vi,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleHeading({level:2}).run(),category:"headings",keywords:["heading","h2","subtitle","medium"]},{title:"Heading 3",description:"Small section heading",icon:m.jsx(Aa,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleHeading({level:3}).run(),category:"headings",keywords:["heading","h3","small"]},{title:"Bullet List",description:"Create a simple bulleted list",icon:m.jsx(Os,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleBulletList().run(),category:"lists",keywords:["bullet","list","unordered","ul"]},{title:"Numbered List",description:"Create a list with numbering",icon:m.jsx(Wi,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleOrderedList().run(),category:"lists",keywords:["numbered","list","ordered","ol"]},{title:"Task List",description:"Create a list with checkboxes",icon:m.jsx(Ra,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleTaskList().run(),category:"lists",keywords:["task","todo","checkbox","checklist"]},{title:"Image",description:"Insert an image",icon:m.jsx(zr,{className:"h-4 w-4"}),command:async t=>{const e=ja(t);if(e){const r=await e();r?.src&&t.chain().focus().setImage({src:r.src,alt:r.alt||void 0}).updateAttributes("image",{blurDataURL:r.blurDataURL||void 0}).run();return}const n=window.prompt("Enter image URL:");n&&t.chain().focus().setImage({src:n}).run()},category:"media",keywords:["image","picture","photo","img"]},{title:"Video",description:"Embed a video from URL",icon:m.jsx(ew,{className:"h-4 w-4"}),command:t=>{const e=window.prompt("Enter video URL (YouTube, Vimeo, etc.):");e&&t.chain().focus().insertContent(`<p><a href="${e}" target="_blank">Video: ${e}</a></p>`).run()},category:"media",keywords:["video","youtube","vimeo","embed"]},{title:"Blockquote",description:"Create a quote or citation",icon:m.jsx(Ji,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleBlockquote().run(),category:"advanced",keywords:["quote","blockquote","citation"]},{title:"Code Block",description:"Create a code block with syntax highlighting",icon:m.jsx(Rs,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleCodeBlock().run(),category:"advanced",keywords:["code","programming","syntax","block"]},{title:"Table",description:"Insert a table with rows and columns",icon:m.jsx(qi,{className:"h-4 w-4"}),command:t=>t.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),category:"advanced",keywords:["table","grid","rows","columns"]},{title:"Horizontal Rule",description:"Insert a horizontal divider",icon:m.jsx(_a,{className:"h-4 w-4"}),command:t=>t.chain().focus().setHorizontalRule().run(),category:"advanced",keywords:["divider","separator","line","hr"]},{title:"Alert",description:"Insert an alert or notice",icon:m.jsx(Oa,{className:"h-4 w-4"}),command:t=>{t.can().setAlertWidget()?t.chain().focus().setAlertWidget().run():t.chain().focus().toggleBlockquote().run()},category:"advanced",keywords:["alert","notice","warning","info"]},{title:"Call to Action",description:"Insert a call to action button",icon:m.jsx(Na,{className:"h-4 w-4"}),command:t=>{t.can().setCtaWidget()?t.chain().focus().setCtaWidget({text:"Click me",url:"#",style:"primary",size:"medium",textAlign:"center"}).run():t.chain().focus().insertContent("Call to Action").run()},category:"advanced",keywords:["cta","button","action","link"]}],Zm={basic:m.jsx(Wr,{className:"h-3 w-3"}),headings:m.jsx(XL,{className:"h-3 w-3"}),lists:m.jsx(Os,{className:"h-3 w-3"}),media:m.jsx(zr,{className:"h-3 w-3"}),advanced:m.jsx(PI,{className:"h-3 w-3"})},Qm={basic:"Basic",headings:"Headings",lists:"Lists",media:"Media",advanced:"Advanced"},mw=({editor:t,wrapperRef:e})=>{const[n,r]=C.useState(!1),[s,i]=C.useState(!1),[o,l]=C.useState(!1),[a,c]=C.useState(""),[d,u]=C.useState("all"),[h,f]=C.useState({top:-9999,left:-9999,width:0}),{x:p,y:g,refs:y,strategy:b,update:w}=Xi({placement:"bottom-start",open:n,onOpenChange:r,middleware:[Yi(10),La({fallbackPlacements:["top-start","bottom-start","right-start"]}),Da({padding:8}),p2({apply({availableWidth:v,availableHeight:T,elements:N}){Object.assign(N.floating.style,{maxWidth:`${Math.min(400,v-16)}px`,maxHeight:`${Math.min(500,T-16)}px`})}})],whileElementsMounted:Ms}),M=C.useCallback(()=>{const{$from:v}=t.state.selection,T=v.parent;if(T.type.name==="paragraph"&&T.content.size===0||T.type.name==="heading"&&T.content.size===0)return!0;if(T.type.name==="listItem"&&T.content.size===1){const N=T.firstChild;if(N&&N.type.name==="paragraph"&&N.content.size===0)return!0}return t.isEditable},[t]),S=C.useCallback(()=>{if(!e?.current)return;const v=e.current.getBoundingClientRect(),T=t.view.dom.getBoundingClientRect(),H=t.view.coordsAtPos(t.state.selection.from).top-v.top,V=T.left-v.left,$=T.width;f({top:H,left:V,width:$}),w(),requestAnimationFrame(()=>l(!0))},[t,w,e]);C.useEffect(()=>{if(!t)return;let v=0;const T=()=>{cancelAnimationFrame(v),v=requestAnimationFrame(()=>{M()?(i(!0),l(!1),S()):(i(!1),r(!1),l(!1))})},N=()=>{i(!1),r(!1),l(!1)};return T(),t.on("selectionUpdate",T),t.on("transaction",T),t.on("focus",T),t.on("blur",N),()=>{cancelAnimationFrame(v),t.off("selectionUpdate",T),t.off("transaction",T),t.off("focus",T),t.off("blur",N)}},[t,M,S]);const A=v=>{v(t),r(!1),c(""),u("all")},x=sj.filter(v=>{const T=d==="all"||v.category===d,N=a===""||v.title.toLowerCase().includes(a.toLowerCase())||v.description.toLowerCase().includes(a.toLowerCase())||v.keywords.some(H=>H.toLowerCase().includes(a.toLowerCase()));return T&&N}),k=x.reduce((v,T)=>(v[T.category]||(v[T.category]=[]),v[T.category].push(T),v),{});return s?m.jsxs(m.Fragment,{children:[m.jsx("div",{style:{position:"absolute",top:h.top,left:h.left,width:h.width,visibility:o?"visible":"hidden",zIndex:1e4},className:"group",children:m.jsxs("div",{className:"relative py-4 w-[95%] mx-auto flex items-center","aria-label":"Insert block",children:[m.jsx("div",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-full h-0.5 bg-gradient-to-r from-transparent via-slate-300 to-transparent dark:via-slate-600 transform origin-center scale-x-0 opacity-0 group-hover:scale-x-100 group-hover:opacity-100 transition-all duration-300"}),m.jsxs("div",{ref:y.setReference,className:"relative z-10 cursor-pointer mx-auto",onClick:()=>r(v=>!v),children:[m.jsx("div",{className:"absolute -inset-3 rounded-full bg-primary/10 dark:bg-primary/20 scale-0 opacity-0 group-hover:scale-100 group-hover:opacity-100 transition-all duration-300 ease-out animate-pulse"}),m.jsx("div",{className:"relative bg-background border border-border p-1.5 rounded-full shadow-sm group-hover:shadow-md transition-all duration-200",children:m.jsx(LL,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors duration-200"})})]})]})}),n&&m.jsxs("div",{ref:y.setFloating,style:{position:b,top:g??0,left:p??0,zIndex:10001},className:"bg-background border border-border shadow-lg rounded-lg p-2 w-96 max-h-[500px] overflow-hidden",onMouseDown:v=>v.preventDefault(),children:[m.jsx("div",{className:"p-2 border-b border-border",children:m.jsx("input",{type:"text",placeholder:"Search blocks...",value:a,onChange:v=>c(v.target.value),className:"w-full px-3 py-2 text-sm bg-muted border border-input rounded-md focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent",autoFocus:!0})}),m.jsxs("div",{className:"flex gap-1 p-2 border-b border-border overflow-x-auto",children:[m.jsx(le.Button,{variant:d==="all"?"default":"ghost",size:"sm",onClick:()=>u("all"),className:"text-xs whitespace-nowrap",children:"All"}),Object.entries(Qm).map(([v,T])=>m.jsxs(le.Button,{variant:d===v?"default":"ghost",size:"sm",onClick:()=>u(v),className:"text-xs whitespace-nowrap flex items-center gap-1",children:[Zm[v],T]},v))]}),m.jsxs("div",{className:"max-h-80 overflow-y-auto",children:[d==="all"?Object.entries(k).map(([v,T])=>m.jsxs("div",{className:"py-2",children:[m.jsxs("div",{className:"px-3 py-1 text-xs font-medium text-muted-foreground uppercase tracking-wide flex items-center gap-2",children:[Zm[v],Qm[v]]}),T.map(N=>m.jsx(le.Button,{variant:"ghost",className:"w-full justify-start p-3 h-auto text-left",onClick:()=>A(N.command),children:m.jsxs("div",{className:"flex items-center gap-3 w-full",children:[m.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-md border bg-muted",children:N.icon}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("p",{className:"font-medium text-sm",children:N.title}),m.jsx("p",{className:"text-xs text-muted-foreground truncate",children:N.description})]})]})},N.title))]},v)):x.map(v=>m.jsx(le.Button,{variant:"ghost",className:"w-full justify-start p-3 h-auto text-left",onClick:()=>A(v.command),children:m.jsxs("div",{className:"flex items-center gap-3 w-full",children:[m.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-md border bg-muted",children:v.icon}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("p",{className:"font-medium text-sm",children:v.title}),m.jsx("p",{className:"text-xs text-muted-foreground truncate",children:v.description})]})]})},v.title)),x.length===0&&m.jsxs("div",{className:"p-4 text-center text-sm text-muted-foreground",children:['No blocks found for "',a,'"']})]})]})]}):null},ij=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),eg=new Set(["address","article","aside","blockquote","canvas","dd","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","li","main","nav","noscript","ol","p","pre","section","table","tfoot","ul","video","thead","tbody","tr","th","td","colgroup"]);function gw(t){const e=t.match(/^<\/?\s*([a-zA-Z0-9:-]+)/);return e?e[1].toLowerCase():null}function oj(t){return/^<\s*[^/!][^>]*>$/.test(t)}function tg(t){return/^<\s*\//.test(t)}function lj(t){if(/\/\s*>$/.test(t))return!0;const e=gw(t);return e?ij.has(e):!1}function aj(t){return/^<\s*!/.test(t)}function $c(t,e=2){if(!t)return"";const n=t.replace(/\r\n?/g,`
|
|
151
|
+
`?o.insert.slice(0,-1):o.insert;(typeof l!="string"||l.length>0)&&Ic(r,this,s,l,o.attributes||{})}else o.retain!==void 0?Em(r,this,s,o.retain,o.attributes||{}):o.delete!==void 0&&Mm(r,s,o.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,r){this.doc??ft();const s=[],i=new Map,o=this.doc;let l="",a=this._start;function c(){if(l.length>0){const u={};let h=!1;i.forEach((p,g)=>{h=!0,u[g]=p});const f={insert:l};h&&(f.attributes=u),s.push(f),l=""}}const d=()=>{for(;a!==null;){if(br(a,e)||n!==void 0&&br(a,n))switch(a.content.constructor){case Xt:{const u=i.get("ychange");e!==void 0&&!br(a,e)?(u===void 0||u.user!==a.id.client||u.type!=="removed")&&(c(),i.set("ychange",r?r("removed",a.id):{type:"removed"})):n!==void 0&&!br(a,n)?(u===void 0||u.user!==a.id.client||u.type!=="added")&&(c(),i.set("ychange",r?r("added",a.id):{type:"added"})):u!==void 0&&(c(),i.delete("ychange")),l+=a.content.str;break}case en:case Vr:{c();const u={insert:a.content.getContent()[0]};if(i.size>0){const h={};u.attributes=h,i.forEach((f,p)=>{h[p]=f})}s.push(u);break}case Ge:br(a,e)&&(c(),_s(i,a.content));break}a=a.right}c()};return e||n?Ce(o,u=>{e&&jd(u,e),n&&jd(u,n),d()},"cleanup"):d(),s}insert(e,n,r){if(n.length<=0)return;const s=this.doc;s!==null?Ce(s,i=>{const o=To(i,this,e,!r);r||(r={},o.currentAttributes.forEach((l,a)=>{r[a]=l})),Ic(i,this,o,n,r)}):this._pending.push(()=>this.insert(e,n,r))}insertEmbed(e,n,r){const s=this.doc;s!==null?Ce(s,i=>{const o=To(i,this,e,!r);Ic(i,this,o,n,r||{})}):this._pending.push(()=>this.insertEmbed(e,n,r||{}))}delete(e,n){if(n===0)return;const r=this.doc;r!==null?Ce(r,s=>{Mm(s,To(s,this,e,!0),n)}):this._pending.push(()=>this.delete(e,n))}format(e,n,r){if(n===0)return;const s=this.doc;s!==null?Ce(s,i=>{const o=To(i,this,e,!1);o.right!==null&&Em(i,this,o,n,r)}):this._pending.push(()=>this.format(e,n,r))}removeAttribute(e){this.doc!==null?Ce(this.doc,n=>{zl(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?Ce(this.doc,r=>{mh(r,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return gh(this,e)}getAttributes(){return mx(this)}_write(e){e.writeTypeRef(UO)}}const CO=t=>new dr;class jc{constructor(e,n=()=>!0){this._filter=n,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??ft()}[Symbol.iterator](){return this}next(){let e=this._currentNode,n=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(n)))do if(n=e.content.type,!e.deleted&&(n.constructor===ht||n.constructor===$r)&&n._start!==null)e=n._start;else for(;e!==null;){const r=e.next;if(r!==null){e=r;break}else e.parent===this._root?e=null:e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class $r extends tt{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new $r}clone(){const e=new $r;return e.insert(0,this.toArray().map(n=>n instanceof tt?n.clone():n)),e}get length(){return this.doc??ft(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new jc(this,e)}querySelector(e){e=e.toUpperCase();const r=new jc(this,s=>s.nodeName&&s.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),Br(new jc(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){Ca(this,e,new AO(this,n,e))}toString(){return dx(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,n={},r){const s=e.createDocumentFragment();return r!==void 0&&r._createAssociation(s,this),Ai(this,i=>{s.insertBefore(i.toDOM(e,n,r),null)}),s}insert(e,n){this.doc!==null?Ce(this.doc,r=>{fx(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)Ce(this.doc,r=>{const s=e&&e instanceof tt?e._item:e;Hl(r,this,s,n)});else{const r=this._prelimContent,s=e===null?0:r.findIndex(i=>i===e)+1;if(s===0&&e!==null)throw ar("Reference item not found");r.splice(s,0,...n)}}delete(e,n=1){this.doc!==null?Ce(this.doc,r=>{px(r,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return ax(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return ux(this,e)}slice(e=0,n=this.length){return lx(this,e,n)}forEach(e){Ai(this,e)}_write(e){e.writeTypeRef(WO)}}const EO=t=>new $r;class ht extends $r{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,n){super._integrate(e,n),this._prelimAttrs.forEach((r,s)=>{this.setAttribute(s,r)}),this._prelimAttrs=null}_copy(){return new ht(this.nodeName)}clone(){const e=new ht(this.nodeName),n=this.getAttributes();return lR(n,(r,s)=>{typeof r=="string"&&e.setAttribute(s,r)}),e.insert(0,this.toArray().map(r=>r instanceof tt?r.clone():r)),e}toString(){const e=this.getAttributes(),n=[],r=[];for(const l in e)r.push(l);r.sort();const s=r.length;for(let l=0;l<s;l++){const a=r[l];n.push(a+'="'+e[a]+'"')}const i=this.nodeName.toLocaleLowerCase(),o=n.length>0?" "+n.join(" "):"";return`<${i}${o}>${super.toString()}</${i}>`}removeAttribute(e){this.doc!==null?Ce(this.doc,n=>{zl(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?Ce(this.doc,r=>{mh(r,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return gh(this,e)}hasAttribute(e){return gx(this,e)}getAttributes(e){return e?mO(this,e):mx(this)}toDOM(e=document,n={},r){const s=e.createElement(this.nodeName),i=this.getAttributes();for(const o in i){const l=i[o];typeof l=="string"&&s.setAttribute(o,l)}return Ai(this,o=>{s.appendChild(o.toDOM(e,n,r))}),r!==void 0&&r._createAssociation(s,this),s}_write(e){e.writeTypeRef(VO),e.writeKey(this.nodeName)}}const MO=t=>new ht(t.readKey());class AO extends va{constructor(e,n,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,n.forEach(s=>{s===null?this.childListChanged=!0:this.attributesChanged.add(s)})}}class Fl extends ks{constructor(e){super(),this.hookName=e}_copy(){return new Fl(this.hookName)}clone(){const e=new Fl(this.hookName);return this.forEach((n,r)=>{e.set(r,n)}),e}toDOM(e=document,n={},r){const s=n[this.hookName];let i;return s!==void 0?i=s.createDom(this):i=document.createElement(this.hookName),i.setAttribute("data-yjs-hook",this.hookName),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(qO),e.writeKey(this.hookName)}}const TO=t=>new Fl(t.readKey());class Et extends dr{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new Et}clone(){const e=new Et;return e.applyDelta(this.toDelta()),e}toDOM(e=document,n,r){const s=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(s,this),s}toString(){return this.toDelta().map(e=>{const n=[];for(const s in e.attributes){const i=[];for(const o in e.attributes[s])i.push({key:o,value:e.attributes[s][o]});i.sort((o,l)=>o.key<l.key?-1:1),n.push({nodeName:s,attrs:i})}n.sort((s,i)=>s.nodeName<i.nodeName?-1:1);let r="";for(let s=0;s<n.length;s++){const i=n[s];r+=`<${i.nodeName}`;for(let o=0;o<i.attrs.length;o++){const l=i.attrs[o];r+=` ${l.key}="${l.value}"`}r+=">"}r+=e.insert;for(let s=n.length-1;s>=0;s--)r+=`</${n[s].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(KO)}}const NO=t=>new Et;class yh{constructor(e,n){this.id=e,this.length=n}get deleted(){throw Gt()}mergeWith(e){return!1}write(e,n,r){throw Gt()}integrate(e,n){throw Gt()}}const _O=0;class Bt extends yh{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){n>0&&(this.id.clock+=n,this.length-=n),ex(e.doc.store,this)}write(e,n){e.writeInfo(_O),e.writeLen(this.length-n)}getMissing(e,n){return null}}class Fi{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new Fi(this.content)}splice(e){throw Gt()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}}const RO=t=>new Fi(t.readBuf());class Ti{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Ti(this.len)}splice(e){const n=new Ti(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){Si(e.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(e){}gc(e){}write(e,n){e.writeLen(this.len-n)}getRef(){return 1}}const OO=t=>new Ti(t.readLen()),kx=(t,e)=>new Ur({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class Ui{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const n={};this.opts=n,e.gc||(n.gc=!1),e.autoLoad&&(n.autoLoad=!0),e.meta!==null&&(n.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new Ui(kx(this.doc.guid,this.opts))}splice(e){throw Gt()}mergeWith(e){return!1}integrate(e,n){this.doc._item=n,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,n){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}const DO=t=>new Ui(kx(t.readString(),t.readAny()));class Vr{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new Vr(this.embed)}splice(e){throw Gt()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}}const LO=t=>new Vr(t.readJSON());class Ge{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new Ge(this.key,this.value)}splice(e){throw Gt()}mergeWith(e){return!1}integrate(e,n){const r=n.parent;r._searchMarker=null,r._hasFormatting=!0}delete(e){}gc(e){}write(e,n){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const IO=t=>new Ge(t.readKey(),t.readJSON());class Ul{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Ul(this.arr)}splice(e){const n=new Ul(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let s=n;s<r;s++){const i=this.arr[s];e.writeString(i===void 0?"undefined":JSON.stringify(i))}}getRef(){return 2}}const jO=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++){const s=t.readString();s==="undefined"?n.push(void 0):n.push(JSON.parse(s))}return new Ul(n)},PO=Pl("node_env")==="development";class Hr{constructor(e){this.arr=e,PO&&P0(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Hr(this.arr)}splice(e){const n=new Hr(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let s=n;s<r;s++){const i=this.arr[s];e.writeAny(i)}}getRef(){return 8}}const BO=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++)n.push(t.readAny());return new Hr(n)};class Xt{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new Xt(this.str)}splice(e){const n=new Xt(this.str.slice(e));this.str=this.str.slice(0,e);const r=this.str.charCodeAt(e-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"�",n.str="�"+n.str.slice(1)),n}mergeWith(e){return this.str+=e.str,!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}}const $O=t=>new Xt(t.readString()),HO=[yO,xO,CO,MO,EO,TO,NO],zO=0,FO=1,UO=2,VO=3,WO=4,qO=5,KO=6;class en{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new en(this.type._copy())}splice(e){throw Gt()}mergeWith(e){return!1}integrate(e,n){this.type._integrate(e.doc,n)}delete(e){let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(e.beforeState.get(n.id.client)||0)&&e._mergeStructs.push(n):n.delete(e),n=n.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(e.beforeState.get(r.id.client)||0)&&e._mergeStructs.push(r):r.delete(e)}),e.changed.delete(this.type)}gc(e){let n=this.type._start;for(;n!==null;)n.gc(e,!0),n=n.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(e,!0),r=r.left}),this.type._map=new Map}write(e,n){this.type._write(e)}getRef(){return 7}}const GO=t=>new en(HO[t.readTypeRef()](t)),$d=(t,e)=>{let n=e,r=0,s;do r>0&&(n=ce(n.client,n.clock+r)),s=cs(t,n),r=n.clock-s.id.clock,n=s.redone;while(n!==null&&s instanceof ve);return{item:s,diff:r}},bh=(t,e)=>{for(;t!==null&&t.keep!==e;)t.keep=e,t=t.parent._item},Vl=(t,e,n)=>{const{client:r,clock:s}=e.id,i=new ve(ce(r,s+n),e,ce(r,s+n-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(n));return e.deleted&&i.markDeleted(),e.keep&&(i.keep=!0),e.redone!==null&&(i.redone=ce(e.redone.client,e.redone.clock+n)),e.right=i,i.right!==null&&(i.right.left=i),t._mergeStructs.push(i),i.parentSub!==null&&i.right===null&&i.parent._map.set(i.parentSub,i),e.length=n,i},Am=(t,e)=>x_(t,n=>Ns(n.deletions,e)),vx=(t,e,n,r,s,i)=>{const o=t.doc,l=o.store,a=o.clientID,c=e.redone;if(c!==null)return vt(t,c);let d=e.parent._item,u=null,h;if(d!==null&&d.deleted===!0){if(d.redone===null&&(!n.has(d)||vx(t,d,n,r,s,i)===null))return null;for(;d.redone!==null;)d=vt(t,d.redone)}const f=d===null?e.parent:d.content.type;if(e.parentSub===null){for(u=e.left,h=e;u!==null;){let b=u;for(;b!==null&&b.parent._item!==d;)b=b.redone===null?null:vt(t,b.redone);if(b!==null&&b.parent._item===d){u=b;break}u=u.left}for(;h!==null;){let b=h;for(;b!==null&&b.parent._item!==d;)b=b.redone===null?null:vt(t,b.redone);if(b!==null&&b.parent._item===d){h=b;break}h=h.right}}else if(h=null,e.right&&!s){for(u=e;u!==null&&u.right!==null&&(u.right.redone||Ns(r,u.right.id)||Am(i.undoStack,u.right.id)||Am(i.redoStack,u.right.id));)for(u=u.right;u.redone;)u=vt(t,u.redone);if(u&&u.right!==null)return null}else u=f._map.get(e.parentSub)||null;const p=Ue(l,a),g=ce(a,p),y=new ve(g,u,u&&u.lastId,h,h&&h.id,f,e.parentSub,e.content.copy());return e.redone=g,bh(y,!0),y.integrate(t,0),y};class ve extends yh{constructor(e,n,r,s,i,o,l,a){super(e,a.getLength()),this.origin=r,this.left=n,this.right=s,this.rightOrigin=i,this.parent=o,this.parentSub=l,this.redone=null,this.content=a,this.info=this.content.isCountable()?rm:0}set marker(e){(this.info&Nc)>0!==e&&(this.info^=Nc)}get marker(){return(this.info&Nc)>0}get keep(){return(this.info&nm)>0}set keep(e){this.keep!==e&&(this.info^=nm)}get countable(){return(this.info&rm)>0}get deleted(){return(this.info&Tc)>0}set deleted(e){this.deleted!==e&&(this.info^=Tc)}markDeleted(){this.info|=Tc}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Ue(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Ue(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===as&&this.id.client!==this.parent.client&&this.parent.clock>=Ue(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=ym(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=vt(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===Bt||this.right&&this.right.constructor===Bt)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===ve?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===ve&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===as){const r=cs(n,this.parent);r.constructor===Bt?this.parent=null:this.parent=r.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=ym(e,e.doc.store,ce(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,s;if(r!==null)s=r.right;else if(this.parentSub!==null)for(s=this.parent._map.get(this.parentSub)||null;s!==null&&s.left!==null;)s=s.left;else s=this.parent._start;const i=new Set,o=new Set;for(;s!==null&&s!==this.right;){if(o.add(s),i.add(s),Eo(this.origin,s.origin)){if(s.id.client<this.id.client)r=s,i.clear();else if(Eo(this.rightOrigin,s.rightOrigin))break}else if(s.origin!==null&&o.has(cs(e.doc.store,s.origin)))i.has(cs(e.doc.store,s.origin))||(r=s,i.clear());else break;s=s.right}this.left=r}if(this.left!==null){const r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),ex(e.doc.store,this),this.content.integrate(e,this),xm(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new Bt(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:ce(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&Eo(e.origin,this.lastId)&&this.right===e&&Eo(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const n=this.parent._searchMarker;return n&&n.forEach(r=>{r.p===e&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),Si(e.deleteSet,this.id.client,this.id.clock,this.length),xm(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw Mt();this.content.gc(e),n?QR(e,this,new Bt(this.id,this.length)):this.content=new Ti(this.length)}write(e,n){const r=n>0?ce(this.id.client,this.id.clock+n-1):this.origin,s=this.rightOrigin,i=this.parentSub,o=this.content.getRef()&ya|(r===null?0:yt)|(s===null?0:Tn)|(i===null?0:wi);if(e.writeInfo(o),r!==null&&e.writeLeftID(r),s!==null&&e.writeRightID(s),r===null&&s===null){const l=this.parent;if(l._item!==void 0){const a=l._item;if(a===null){const c=Ci(l);e.writeParentInfo(!0),e.writeString(c)}else e.writeParentInfo(!1),e.writeLeftID(a.id)}else l.constructor===String?(e.writeParentInfo(!0),e.writeString(l)):l.constructor===as?(e.writeParentInfo(!1),e.writeLeftID(l)):Mt();i!==null&&e.writeString(i)}this.content.write(e,n)}}const Sx=(t,e)=>JO[e&ya](t),JO=[()=>{Mt()},OO,jO,RO,$O,LO,IO,GO,BO,DO,()=>{Mt()}],YO=10;class Vt extends yh{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){Mt()}write(e,n){e.writeInfo(YO),me(e.restEncoder,this.length-n)}getMissing(e,n){return null}}const Cx=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},Ex="__ $YJS$ __";Cx[Ex]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");Cx[Ex]=!0;const XO=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}},ZO=/[\uD800-\uDBFF]/,QO=/[\uDC00-\uDFFF]/,eD=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&ZO.test(t[n-1])&&n--;r+n<t.length&&r+n<e.length&&t[t.length-r-1]===e[e.length-r-1];)r++;return r>0&&QO.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},tD=eD,an=(t,e)=>t>>>e|t<<32-e,nD=t=>an(t,2)^an(t,13)^an(t,22),rD=t=>an(t,6)^an(t,11)^an(t,25),sD=t=>an(t,7)^an(t,18)^t>>>3,iD=t=>an(t,17)^an(t,19)^t>>>10,oD=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),lD=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class aD{constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(lD),this._W=new Uint32Array(e,64,64)}_updateHash(){const e=this._H,n=this._W;for(let u=16;u<64;u++)n[u]=iD(n[u-2])+n[u-7]+sD(n[u-15])+n[u-16];let r=e[0],s=e[1],i=e[2],o=e[3],l=e[4],a=e[5],c=e[6],d=e[7];for(let u=0,h,f;u<64;u++)h=d+rD(l)+(l&a^~l&c)+oD[u]+n[u]>>>0,f=nD(r)+(r&s^r&i^s&i)>>>0,d=c,c=a,a=l,l=o+h>>>0,o=i,i=s,s=r,r=h+f>>>0;e[0]+=r,e[1]+=s,e[2]+=i,e[3]+=o,e[4]+=l,e[5]+=a,e[6]+=c,e[7]+=d}digest(e){let n=0;for(;n+56<=e.length;){let o=0;for(;o<16&&n+3<e.length;o++)this._W[o]=e[n++]<<24|e[n++]<<16|e[n++]<<8|e[n++];if(n%64!==0){for(this._W.fill(0,o,16);n<e.length;)this._W[o]|=e[n]<<(3-n%4)*8,n++;this._W[o]|=yt<<(3-n%4)*8}this._updateHash()}const r=n%64!==0;this._W.fill(0,0,16);let s=0;for(;n<e.length;s++)for(let o=3;o>=0&&n<e.length;o--)this._W[s]|=e[n++]<<o*8;r||(this._W[s-(n%4===0?0:1)]|=yt<<(3-n%4)*8),this._W[14]=e.byteLength/w_,this._W[15]=e.byteLength*8,this._updateHash();const i=new Uint8Array(32);for(let o=0;o<this._H.length;o++)for(let l=0;l<4;l++)i[o*4+l]=this._H[o]>>>(3-l)*8;return i}}const cD=t=>new aD().digest(t),Ie=new ge("y-sync"),Nn=new ge("y-undo");new ge("yjs-cursor");const dD=t=>{for(let n=6;n<t.length;n++)t[n%6]=t[n%6]^t[n];return t.slice(0,6)},uD=t=>bR(dD(cD(xR(t)))),Wl=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&e.sv.get(t.id.client)>t.id.clock&&!Ns(e.ds,t.id),hD=[{light:"#ecd44433",dark:"#ecd444"}],fD=(t,e,n)=>{if(!t.has(n)){if(t.size<e.length){const r=Pr();t.forEach(s=>r.add(s)),e=e.filter(s=>!r.has(s))}t.set(n,Q_(e))}return t.get(n)},pD=(t,{colors:e=hD,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:s=()=>{},mapping:i}={})=>{let o=!1;const l=new gD(t,i),a=new pe({props:{editable:c=>{const d=Ie.getState(c);return d.snapshot==null&&d.prevSnapshot==null}},key:Ie,state:{init:(c,d)=>({type:t,doc:t.doc,binding:l,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:n,permanentUserData:r}),apply:(c,d)=>{const u=c.getMeta(Ie);if(u!==void 0){d=Object.assign({},d);for(const h in u)d[h]=u[h]}return d.addToHistory=c.getMeta("addToHistory")!==!1,d.isChangeOrigin=u!==void 0&&!!u.isChangeOrigin,d.isUndoRedoOperation=u!==void 0&&!!u.isChangeOrigin&&!!u.isUndoRedoOperation,l.prosemirrorView!==null&&u!==void 0&&(u.snapshot!=null||u.prevSnapshot!=null)&&H0(0,()=>{l.prosemirrorView!=null&&(u.restore==null?l._renderSnapshot(u.snapshot,u.prevSnapshot,d):(l._renderSnapshot(u.snapshot,u.snapshot,d),delete d.restore,delete d.snapshot,delete d.prevSnapshot,l.mux(()=>{l._prosemirrorChanged(l.prosemirrorView.state.doc)})))}),d}},view:c=>(l.initView(c),i==null&&l._forceRerender(),s(),{update:()=>{const d=a.getState(c.state);if(d.snapshot==null&&d.prevSnapshot==null&&(o||c.state.doc.content.findDiffStart(c.state.doc.type.createAndFill().content)!==null)){if(o=!0,d.addToHistory===!1&&!d.isChangeOrigin){const u=Nn.getState(c.state),h=u&&u.undoManager;h&&h.stopCapturing()}l.mux(()=>{d.doc.transact(u=>{u.meta.set("addToHistory",d.addToHistory),l._prosemirrorChanged(c.state.doc)},Ie)})}},destroy:()=>{l.destroy()}})});return a},mD=(t,e,n)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")t.setSelection(new St(t.doc));else if(e.type==="node"){const r=Vo(n.doc,n.type,e.anchor,n.mapping);t.setSelection(q.create(t.doc,r))}else{const r=Vo(n.doc,n.type,e.anchor,n.mapping),s=Vo(n.doc,n.type,e.head,n.mapping);r!==null&&s!==null&&t.setSelection(J.between(t.doc.resolve(r),t.doc.resolve(s)))}},Hd=(t,e)=>({type:e.selection.jsonID,anchor:Vd(e.selection.anchor,t.type,t.mapping),head:Vd(e.selection.head,t.type,t.mapping)});class gD{constructor(e,n=new Map){this.type=e,this.prosemirrorView=null,this.mux=XO(),this.mapping=n,this.isOMark=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=Hd(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(B0&&this._domSelectionInView===null&&(H0(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){const e=this.prosemirrorView._root.getSelection();if(e==null||e.anchorNode==null)return!1;const n=this.prosemirrorView._root.createRange();n.setStart(e.anchorNode,e.anchorOffset),n.setEnd(e.focusNode,e.focusOffset),n.getClientRects().length===0&&n.startContainer&&n.collapsed&&n.selectNodeContents(n.startContainer);const s=n.getBoundingClientRect(),i=kR.documentElement;return s.bottom>=0&&s.right>=0&&s.left<=(window.innerWidth||i.clientWidth||0)&&s.top<=(window.innerHeight||i.clientHeight||0)}renderSnapshot(e,n){n||(n=Z0(G0(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(Ie,{snapshot:e,prevSnapshot:n}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const e=this.type.toArray().map(r=>Uo(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new P(O.from(e),0,0));n.setMeta(Ie,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(n)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{const e=this.beforeTransactionSelection!==null?null:this.prosemirrorView.state.selection,n=this.type.toArray().map(s=>Uo(s,this.prosemirrorView.state.schema,this)).filter(s=>s!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new P(O.from(n),0,0));if(e){const s=bs(lr(e.anchor,0),r.doc.content.size),i=bs(lr(e.head,0),r.doc.content.size);r.setSelection(J.create(r.doc,s,i))}this.prosemirrorView.dispatch(r.setMeta(Ie,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,n,r){let s=this.doc,i=this.type;if(e||(e=Lc(this.doc)),e instanceof Uint8Array||n instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(n instanceof Uint8Array))&&Mt(),s=new Ur({gc:!1}),Id(s,n),n=Lc(s),Id(s,e),e=Lc(s),i._item===null){const o=Array.from(this.doc.share.keys()).find(l=>this.doc.share.get(l)===this.type);i=s.getXmlFragment(o)}else{const o=s.store.clients.get(i._item.id.client)??[],l=Yt(o,i._item.id.clock);i=o[l].content.type}this.mapping.clear(),this.mux(()=>{s.transact(o=>{const l=r.permanentUserData;l&&l.dss.forEach(u=>{cr(o,u,h=>{})});const a=(u,h)=>{const f=u==="added"?l.getUserByClientId(h.client):l.getUserByDeletedId(h);return{user:f,type:u,color:fD(r.colorMapping,r.colors,f)}},c=cx(i,new fh(n.ds,e.sv)).map(u=>!u._item.deleted||Wl(u._item,e)||Wl(u._item,n)?Uo(u,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,n,a):null).filter(u=>u!==null),d=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new P(O.from(c),0,0));this.prosemirrorView.dispatch(d.setMeta(Ie,{isChangeOrigin:!0}))},Ie)})}_typeChanged(e,n){if(this.prosemirrorView==null)return;const r=Ie.getState(this.prosemirrorView.state);if(e.length===0||r.snapshot!=null||r.prevSnapshot!=null){this.renderSnapshot(r.snapshot,r.prevSnapshot);return}this.mux(()=>{const s=(l,a)=>this.mapping.delete(a);cr(n,n.deleteSet,l=>{if(l.constructor===ve){const a=l.content.type;a&&this.mapping.delete(a)}}),n.changed.forEach(s),n.changedParentTypes.forEach(s);const i=this.type.toArray().map(l=>Mx(l,this.prosemirrorView.state.schema,this)).filter(l=>l!==null);let o=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new P(O.from(i),0,0));mD(o,this.beforeTransactionSelection,this),o=o.setMeta(Ie,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof rx}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&o.scrollIntoView(),this.prosemirrorView.dispatch(o)})}_prosemirrorChanged(e){this.doc.transact(()=>{Fd(this.doc,this.type,e,this),this.beforeTransactionSelection=Hd(this,this.prosemirrorView.state)},Ie)}initView(e){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=e,this.doc.on("beforeAllTransactions",this.beforeAllTransactions),this.doc.on("afterAllTransactions",this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off("beforeAllTransactions",this.beforeAllTransactions),this.doc.off("afterAllTransactions",this.afterAllTransactions))}}const Mx=(t,e,n,r,s,i)=>{const o=n.mapping.get(t);if(o===void 0){if(t instanceof ht)return Uo(t,e,n,r,s,i);throw Gt()}return o},Uo=(t,e,n,r,s,i)=>{const o=[],l=a=>{if(a instanceof ht){const c=Mx(a,e,n,r,s,i);c!==null&&o.push(c)}else{const c=a._item.right?.content?.type;c instanceof dr&&!c._item.deleted&&c._item.id.client===c.doc.clientID&&(a.applyDelta([{retain:a.length},...c.toDelta()]),c.doc.transact(u=>{c._item.delete(u)}));const d=yD(a,e,n,r,s,i);d!==null&&d.forEach(u=>{u!==null&&o.push(u)})}};r===void 0||s===void 0?t.toArray().forEach(l):cx(t,new fh(s.ds,r.sv)).forEach(l);try{const a=t.getAttributes(r);r!==void 0&&(Wl(t._item,r)?Wl(t._item,s)||(a.ychange=i?i("added",t._item.id):{type:"added"}):a.ychange=i?i("removed",t._item.id):{type:"removed"});const c=e.node(t.nodeName,a,o);return n.mapping.set(t,c),c}catch{return t.doc.transact(c=>{t._item.delete(c)},Ie),n.mapping.delete(t),null}},yD=(t,e,n,r,s,i)=>{const o=[],l=t.toDelta(r,s,i);try{for(let a=0;a<l.length;a++){const c=l[a];o.push(e.text(c.insert,SD(c.attributes,e)))}}catch{return t.doc.transact(c=>{t._item.delete(c)},Ie),null}return o},bD=(t,e)=>{const n=new Et,r=t.map(s=>({insert:s.text,attributes:Tx(s.marks,e)}));return n.applyDelta(r),e.mapping.set(n,t),n},xD=(t,e)=>{const n=new ht(t.type.name);for(const r in t.attrs){const s=t.attrs[r];s!==null&&r!=="ychange"&&n.setAttribute(r,s)}return n.insert(0,Ea(t).map(r=>zd(r,e))),e.mapping.set(n,t),n},zd=(t,e)=>t instanceof Array?bD(t,e):xD(t,e),Tm=t=>typeof t=="object"&&t!==null,xh=(t,e)=>{const n=Object.keys(t).filter(s=>t[s]!==null);let r=n.length===Object.keys(e).filter(s=>e[s]!==null).length;for(let s=0;s<n.length&&r;s++){const i=n[s],o=t[i],l=e[i];r=i==="ychange"||o===l||Tm(o)&&Tm(l)&&xh(o,l)}return r},Ea=t=>{const e=t.content.content,n=[];for(let r=0;r<e.length;r++){const s=e[r];if(s.isText){const i=[];for(let o=e[r];r<e.length&&o.isText;o=e[++r])i.push(o);r--,n.push(i)}else n.push(s)}return n},Ax=(t,e)=>{const n=t.toDelta();return n.length===e.length&&n.every((r,s)=>r.insert===e[s].text&&I0(r.attributes||{}).length===e[s].marks.length&&j0(r.attributes,(i,o)=>{const l=wh(o),a=e[s].marks;return xh(i,a.find(c=>c.type.name===l)?.attrs)}))},Ni=(t,e)=>{if(t instanceof ht&&!(e instanceof Array)&&Ud(t,e)){const n=Ea(e);return t._length===n.length&&xh(t.getAttributes(),e.attrs)&&t.toArray().every((r,s)=>Ni(r,n[s]))}return t instanceof Et&&e instanceof Array&&Ax(t,e)},ql=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((n,r)=>e[r]===n),Nm=(t,e,n)=>{const r=t.toArray(),s=Ea(e),i=s.length,o=r.length,l=bs(o,i);let a=0,c=0,d=!1;for(;a<l;a++){const u=r[a],h=s[a];if(ql(n.mapping.get(u),h))d=!0;else if(!Ni(u,h))break}for(;a+c<l;c++){const u=r[o-c-1],h=s[i-c-1];if(ql(n.mapping.get(u),h))d=!0;else if(!Ni(u,h))break}return{equalityFactor:a+c,foundMappedChild:d}},wD=t=>{let e="",n=t._start;const r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof Xt?e+=n.content.str:n.content instanceof Ge&&(r[n.content.key]=null)),n=n.right;return{str:e,nAttrs:r}},kD=(t,e,n)=>{n.mapping.set(t,e);const{nAttrs:r,str:s}=wD(t),i=e.map(c=>({insert:c.text,attributes:Object.assign({},r,Tx(c.marks,n))})),{insert:o,remove:l,index:a}=tD(s,i.map(c=>c.insert).join(""));t.delete(a,l),t.insert(a,o),t.applyDelta(i.map(c=>({retain:c.insert.length,attributes:c.attributes})))},vD=/(.*)(--[a-zA-Z0-9+/=]{8})$/,wh=t=>vD.exec(t)?.[1]??t,SD=(t,e)=>{const n=[];for(const r in t)n.push(e.mark(wh(r),t[r]));return n},Tx=(t,e)=>{const n={};return t.forEach(r=>{if(r.type.name!=="ychange"){const s=On(e.isOMark,r.type,()=>!r.type.excludes(r.type));n[s?`${r.type.name}--${uD(r.toJSON())}`:r.type.name]=r.attrs}}),n},Fd=(t,e,n,r)=>{if(e instanceof ht&&e.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.mapping.set(e,n),e instanceof ht){const u=e.getAttributes(),h=n.attrs;for(const f in h)h[f]!==null?u[f]!==h[f]&&f!=="ychange"&&e.setAttribute(f,h[f]):e.removeAttribute(f);for(const f in u)h[f]===void 0&&e.removeAttribute(f)}const s=Ea(n),i=s.length,o=e.toArray(),l=o.length,a=bs(i,l);let c=0,d=0;for(;c<a;c++){const u=o[c],h=s[c];if(!ql(r.mapping.get(u),h))if(Ni(u,h))r.mapping.set(u,h);else break}for(;d+c+1<a;d++){const u=o[l-d-1],h=s[i-d-1];if(!ql(r.mapping.get(u),h))if(Ni(u,h))r.mapping.set(u,h);else break}t.transact(()=>{for(;l-c-d>0&&i-c-d>0;){const h=o[c],f=s[c],p=o[l-d-1],g=s[i-d-1];if(h instanceof Et&&f instanceof Array)Ax(h,f)||kD(h,f,r),c+=1;else{let y=h instanceof ht&&Ud(h,f),b=p instanceof ht&&Ud(p,g);if(y&&b){const w=Nm(h,f,r),M=Nm(p,g,r);w.foundMappedChild&&!M.foundMappedChild?b=!1:!w.foundMappedChild&&M.foundMappedChild||w.equalityFactor<M.equalityFactor?y=!1:b=!1}y?(Fd(t,h,f,r),c+=1):b?(Fd(t,p,g,r),d+=1):(r.mapping.delete(e.get(c)),e.delete(c,1),e.insert(c,[zd(f,r)]),c+=1)}}const u=l-c-d;if(l===1&&i===0&&o[0]instanceof Et?(r.mapping.delete(o[0]),o[0].delete(0,o[0].length)):u>0&&(e.slice(c,c+u).forEach(h=>r.mapping.delete(h)),e.delete(c,u)),c+d<i){const h=[];for(let f=c;f<i-d;f++)h.push(zd(s[f],r));e.insert(c,h)}},Ie)},Ud=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name,Vd=(t,e,n)=>{if(t===0)return Dc(e,0,-1);let r=e._first===null?null:e._first.content.type;for(;r!==null&&e!==r;){if(r instanceof Et){if(r._length>=t)return Dc(r,t,-1);if(t-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,t--;while(r!==e&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==e&&(r=r._item===null?null:r._item.next.content.type)}}else{const s=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&t<s)r=r._first.content.type,t--;else{if(t===1&&r._length===0&&s>1)return new $l(r._item===null?null:r._item.id,r._item===null?Ci(r):null,null);if(t-=s,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(t===0)return r=r._item===null?r:r._item.parent,new $l(r._item===null?null:r._item.id,r._item===null?Ci(r):null,null);do r=r._item.parent,t--;while(r!==e&&r._item.next===null);r!==e&&(r=r._item.next.content.type)}}}if(r===null)throw Mt();if(t===0&&r.constructor!==Et&&r!==e)return CD(r._item.parent,r._item)}return Dc(e,e._length,-1)},CD=(t,e)=>{let n=null,r=null;return t._item===null?r=Ci(t):n=ce(t._item.id.client,t._item.id.clock),new $l(n,r,e.id)},Vo=(t,e,n,r)=>{const s=XR(n,t);if(s===null||s.type!==e&&!Ei(e,s.type._item))return null;let i=s.type,o=0;if(i.constructor===Et)o=s.index;else if(i._item===null||!i._item.deleted){let l=i._first,a=0;for(;a<i._length&&a<s.index&&l!==null;){if(!l.deleted){const c=l.content.type;a++,c instanceof Et?o+=c._length:o+=r.get(c).nodeSize}l=l.right}o+=1}for(;i!==e&&i._item!==null;){const l=i._item.parent;if(l._item===null||!l._item.deleted){o+=1;let a=l._first;for(;a!==null;){const c=a.content.type;if(c===i)break;a.deleted||(c instanceof Et?o+=c._length:o+=r.get(c).nodeSize),a=a.right}}i=l}return o-1};function ED(t){const e=t.toArray(),n=r=>{let s;if(r instanceof Et)s=r.toDelta().map(o=>{const l={type:"text",text:o.insert};return o.attributes&&(l.marks=Object.keys(o.attributes).map(a=>{const c=o.attributes[a],u={type:wh(a)};return Object.keys(c)&&(u.attrs=c),u})),l});else if(r instanceof ht){s={type:r.nodeName};const i=r.getAttributes();Object.keys(i).length&&(s.attrs=i);const o=r.toArray();o.length&&(s.content=o.map(n).flat())}else Mt();return s};return{type:"doc",content:e.map(n)}}const MD=t=>{const e=Nn.getState(t).undoManager;if(e!=null)return e.undo(),!0},AD=t=>{const e=Nn.getState(t).undoManager;if(e!=null)return e.redo(),!0},TD=new Set(["paragraph"]),ND=(t,e)=>!(t instanceof ve)||!(t.content instanceof en)||!(t.content.type instanceof dr||t.content.type instanceof ht&&e.has(t.content.type.nodeName))||t.content.type._length===0,_D=({protectedNodes:t=TD,trackedOrigins:e=[],undoManager:n=null}={})=>new pe({key:Nn,state:{init:(r,s)=>{const i=Ie.getState(s),o=n||new rx(i.type,{trackedOrigins:new Set([Ie].concat(e)),deleteFilter:l=>ND(l,t),captureTransaction:l=>l.meta.get("addToHistory")!==!1});return{undoManager:o,prevSel:null,hasUndoOps:o.undoStack.length>0,hasRedoOps:o.redoStack.length>0}},apply:(r,s,i,o)=>{const l=Ie.getState(o).binding,a=s.undoManager,c=a.undoStack.length>0,d=a.redoStack.length>0;return l?{undoManager:a,prevSel:Hd(l,i),hasUndoOps:c,hasRedoOps:d}:c!==s.hasUndoOps||d!==s.hasRedoOps?Object.assign({},s,{hasUndoOps:a.undoStack.length>0,hasRedoOps:a.redoStack.length>0}):s}},view:r=>{const s=Ie.getState(r.state),i=Nn.getState(r.state).undoManager;return i.on("stack-item-added",({stackItem:o})=>{const l=s.binding;l&&o.meta.set(l,Nn.getState(r.state).prevSel)}),i.on("stack-item-popped",({stackItem:o})=>{const l=s.binding;l&&(l.beforeTransactionSelection=o.meta.get(l)||l.beforeTransactionSelection)}),{destroy:()=>{i.destroy()}}}});de.create({name:"collaboration",priority:1e3,addOptions(){return{document:null,field:"default",fragment:null,provider:null}},addStorage(){return{isDisabled:!1}},onCreate(){this.editor.extensionManager.extensions.find(t=>t.name==="undoRedo")&&console.warn('[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-undo-redo".')},addCommands(){return{undo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),Nn.getState(e).undoManager.undoStack.length===0?!1:n?MD(e):!0),redo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),Nn.getState(e).undoManager.redoStack.length===0?!1:n?AD(e):!0)}},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){var t;const e=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),n=_D(this.options.yUndoOptions),r=n.spec.view;n.spec.view=o=>{const{undoManager:l}=Nn.getState(o.state);l.restore&&(l.restore(),l.restore=()=>{});const a=r?r(o):void 0;return{destroy:()=>{const c=l.trackedOrigins.has(l),d=l._observers;l.restore=()=>{c&&l.trackedOrigins.add(l),l.doc.on("afterTransaction",l.afterTransactionHandler),l._observers=d},a?.destroy&&a.destroy()}}};const s={...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender},i=pD(e,s);return this.editor.options.enableContentCheck&&((t=e.doc)==null||t.on("beforeTransaction",()=>{try{const o=ED(e);if(o.content.length===0)return;this.editor.schema.nodeFromJSON(o).check()}catch(o){return this.editor.emit("contentError",{error:o,editor:this.editor,disableCollaboration:()=>{var l;(l=e.doc)==null||l.destroy(),this.storage.isDisabled=!0}}),!1}})),[i,n,this.editor.options.enableContentCheck&&new pe({key:new ge("filterInvalidContent"),filterTransaction:()=>{var o;return this.storage.isDisabled!==!1&&((o=e.doc)==null||o.destroy()),!0}})].filter(Boolean)}});function RD(t){return!!t.getMeta(Ie)}function _m(t){if(!t.length)return ye.empty;const e=[],n=t[0].$from.node(0);return t.forEach(r=>{const s=r.$from.pos,i=r.$from.nodeAfter;i&&e.push(_e.node(s,s+i.nodeSize,{class:"ProseMirror-selectednoderange"}))}),ye.create(n,e)}function Ma(t,e,n){const r=[],s=t.node(0);typeof n=="number"&&n>=0||(t.sameParent(e)?n=Math.max(0,t.sharedDepth(e.pos)-1):n=t.sharedDepth(e.pos));const i=new oi(t,e,n),o=i.depth===0?0:s.resolve(i.start).posAtIndex(0);return i.parent.forEach((l,a)=>{const c=o+a,d=c+l.nodeSize;if(c<i.start||c>=i.end)return;const u=new lu(s.resolve(c),s.resolve(d));r.push(u)}),r}var OD=class Nx{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Nx(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return new Xn(n,r)}},Xn=class Hn extends ee{constructor(e,n,r,s=1){const{doc:i}=e,o=e===n,l=e.pos===i.content.size&&n.pos===i.content.size,a=o&&!l?i.resolve(n.pos+(s>0?1:-1)):n,c=o&&l?i.resolve(e.pos-(s>0?1:-1)):e,d=Ma(c.min(a),c.max(a),r),u=a.pos>=e.pos?d[0].$from:d[d.length-1].$to,h=a.pos>=e.pos?d[d.length-1].$to:d[0].$from;super(u,h,d),this.depth=r}get $to(){return this.ranges[this.ranges.length-1].$to}eq(e){return e instanceof Hn&&e.$from.pos===this.$from.pos&&e.$to.pos===this.$to.pos}map(e,n){const r=e.resolve(n.map(this.anchor)),s=e.resolve(n.map(this.head));return new Hn(r,s)}toJSON(){return{type:"nodeRange",anchor:this.anchor,head:this.head}}get isForwards(){return this.head>=this.anchor}get isBackwards(){return!this.isForwards}extendBackwards(){const{doc:e}=this.$from;if(this.isForwards&&this.ranges.length>1){const s=this.ranges.slice(0,-1),i=s[0].$from,o=s[s.length-1].$to;return new Hn(i,o,this.depth)}const n=this.ranges[0],r=e.resolve(Math.max(0,n.$from.pos-1));return new Hn(this.$anchor,r,this.depth)}extendForwards(){const{doc:e}=this.$from;if(this.isBackwards&&this.ranges.length>1){const s=this.ranges.slice(1),i=s[0].$from,o=s[s.length-1].$to;return new Hn(o,i,this.depth)}const n=this.ranges[this.ranges.length-1],r=e.resolve(Math.min(e.content.size,n.$to.pos+1));return new Hn(this.$anchor,r,this.depth)}static fromJSON(e,n){return new Hn(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r,s,i=1){return new this(e.resolve(n),e.resolve(r),s,i)}getBookmark(){return new OD(this.anchor,this.head)}};Xn.prototype.visible=!1;function No(t){return t instanceof Xn}var DD=de.create({name:"nodeRange",addOptions(){return{depth:void 0,key:"Mod"}},addKeyboardShortcuts(){return{"Shift-ArrowUp":({editor:t})=>{const{depth:e}=this.options,{view:n,state:r}=t,{doc:s,selection:i,tr:o}=r,{anchor:l,head:a}=i;if(!No(i)){const d=Xn.create(s,l,a,e,-1);return o.setSelection(d),n.dispatch(o),!0}const c=i.extendBackwards();return o.setSelection(c),n.dispatch(o),!0},"Shift-ArrowDown":({editor:t})=>{const{depth:e}=this.options,{view:n,state:r}=t,{doc:s,selection:i,tr:o}=r,{anchor:l,head:a}=i;if(!No(i)){const d=Xn.create(s,l,a,e);return o.setSelection(d),n.dispatch(o),!0}const c=i.extendForwards();return o.setSelection(c),n.dispatch(o),!0},"Mod-a":({editor:t})=>{const{depth:e}=this.options,{view:n,state:r}=t,{doc:s,tr:i}=r,o=Xn.create(s,0,s.content.size,e);return i.setSelection(o),n.dispatch(i),!0}}},onSelectionUpdate(){const{selection:t}=this.editor.state;No(t)&&this.editor.view.dom.classList.add("ProseMirror-noderangeselection")},addProseMirrorPlugins(){let t=!1,e=!1;return[new pe({key:new ge("nodeRange"),props:{attributes:()=>t?{class:"ProseMirror-noderangeselection"}:{class:""},handleDOMEvents:{mousedown:(n,r)=>{const{key:s}=this.options,i=/Mac/.test(navigator.platform),o=!!r.shiftKey,l=!!r.ctrlKey,a=!!r.altKey,c=!!r.metaKey,d=i?c:l;return(s==null||s==="Shift"&&o||s==="Control"&&l||s==="Alt"&&a||s==="Meta"&&c||s==="Mod"&&d)&&(e=!0),e&&document.addEventListener("mouseup",()=>{e=!1;const{state:u}=n,{doc:h,selection:f,tr:p}=u,{$anchor:g,$head:y}=f;if(g.sameParent(y))return;const b=Xn.create(h,g.pos,y.pos,this.options.depth);p.setSelection(b),n.dispatch(p)},{once:!0}),!1}},decorations:n=>{const{selection:r}=n,s=No(r);if(t=!1,!e)return s?(t=!0,_m(r.ranges)):null;const{$from:i,$to:o}=r;if(!s&&i.sameParent(o))return null;const l=Ma(i,o,this.options.depth);return l.length?(t=!0,_m(l)):null}}})]}}),LD=DD;function ID(t){let e="";const n=getComputedStyle(t);for(let r=0;r<n.length;r+=1)e+=`${n[r]}:${n.getPropertyValue(n[r])};`;return e}function jD(t){const e=t.cloneNode(!0),n=[t,...Array.from(t.getElementsByTagName("*"))],r=[e,...Array.from(e.getElementsByTagName("*"))];return n.forEach((s,i)=>{r[i].style.cssText=ID(s)}),e}function PD(t,e){let n=t;for(;n?.parentElement&&n.parentElement!==e.dom;)n=n.parentElement;return n?.parentElement===e.dom?n:void 0}function BD(t,e,n,r=5){const s=t.dom,i=s.firstElementChild,o=s.lastElementChild;if(!i||!o)return{x:e,y:n};const l=i.getBoundingClientRect(),a=o.getBoundingClientRect(),c=Math.min(Math.max(l.top+r,n),a.bottom-r),d=.5,u=Math.abs(l.left-a.left)<d,h=Math.abs(l.right-a.right)<d;let f=l;return u&&h&&(f=l),{x:Math.min(Math.max(f.left+r,e),f.right-r),y:c}}var _x=t=>{const{x:e,y:n,editor:r}=t,{view:s,state:i}=r,{x:o,y:l}=BD(s,e,n,5),a=s.root.elementsFromPoint(o,l);let c;if(Array.prototype.some.call(a,h=>{if(!s.dom.contains(h))return!1;const f=PD(h,s);return f?(c=f,!0):!1}),!c)return{resultElement:null,resultNode:null,pos:null};let d;try{d=s.posAtDOM(c,0)}catch{return{resultElement:null,resultNode:null,pos:null}}const u=i.doc.nodeAt(d);return{resultElement:c,resultNode:u,pos:d}};function _o(t,e){return window.getComputedStyle(t)[e]}function $D(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function HD(t,e,n){const r=parseInt(_o(t.dom,"paddingLeft"),10),s=parseInt(_o(t.dom,"paddingRight"),10),i=parseInt(_o(t.dom,"borderLeftWidth"),10),o=parseInt(_o(t.dom,"borderLeftWidth"),10),l=t.dom.getBoundingClientRect();return{left:$D(e,l.left+r+i,l.right-s-o),top:n}}function Rx(t){var e;(e=t.parentNode)==null||e.removeChild(t)}function zD(t,e){const{doc:n}=e.view.state,r=_x({editor:e,x:t.clientX,y:t.clientY});if(!r.resultNode||r.pos===null)return[];const s=t.clientX,i=HD(e.view,s,t.clientY),o=e.view.posAtCoords(i);if(!o)return[];const{pos:l}=o;if(!n.resolve(l).parent)return[];const c=n.resolve(r.pos),d=n.resolve(r.pos+1);return Ma(c,d,0)}function FD(t,e){const{view:n}=e;if(!t.dataTransfer)return;const{empty:r,$from:s,$to:i}=n.state.selection,o=zD(t,e),l=Ma(s,i,0),a=l.some(y=>o.find(b=>b.$from===y.$from&&b.$to===y.$to)),c=r||!a?o:l;if(!c.length)return;const{tr:d}=n.state,u=document.createElement("div"),h=c[0].$from.pos,f=c[c.length-1].$to.pos,p=Xn.create(n.state.doc,h,f),g=p.content();c.forEach(y=>{const b=n.nodeDOM(y.$from.pos),w=jD(b);u.append(w)}),u.style.position="absolute",u.style.top="-10000px",document.body.append(u),t.dataTransfer.clearData(),t.dataTransfer.setDragImage(u,0,0),n.dragging={slice:g,move:!0},d.setSelection(p),n.dispatch(d),document.addEventListener("drop",()=>Rx(u),{once:!0})}var Rm=(t,e)=>{const n=t.resolve(e),{depth:r}=n;return r===0?e:n.pos-n.parentOffset-1},Om=(t,e)=>{const n=t.nodeAt(e),r=t.resolve(e);let{depth:s}=r,i=n;for(;s>0;){const o=r.node(s);s-=1,s===0&&(i=o)}return i},Pc=(t,e)=>{const n=Ie.getState(t);return n?Vd(e,n.type,n.binding.mapping):null},UD=(t,e)=>{const n=Ie.getState(t);return n?Vo(n.doc,n.type,e,n.binding.mapping)||0:-1},Dm=(t,e)=>{let n=e;for(;n?.parentNode&&n.parentNode!==t.dom;)n=n.parentNode;return n},Ox=new ge("dragHandle"),Dx=({pluginKey:t=Ox,element:e,editor:n,computePositionConfig:r,getReferencedVirtualElement:s,onNodeChange:i,onElementDragStart:o,onElementDragEnd:l})=>{const a=document.createElement("div");let c=!1,d=null,u=-1,h,f=null,p=null;function g(){e&&(e.style.visibility="hidden",e.style.pointerEvents="none")}function y(){if(e){if(!n.isEditable){g();return}e.style.visibility="",e.style.pointerEvents="auto"}}function b(S){const A=s?.()||{getBoundingClientRect:()=>S.getBoundingClientRect()};Fu(A,e,r).then(x=>{Object.assign(e.style,{position:x.strategy,left:`${x.x}px`,top:`${x.y}px`})})}function w(S){o?.(S),FD(S,n),setTimeout(()=>{e&&(e.style.pointerEvents="none")},0)}function M(S){l?.(S),g(),e&&(e.style.pointerEvents="auto")}return e.addEventListener("dragstart",w),e.addEventListener("dragend",M),a.appendChild(e),{unbind(){e.removeEventListener("dragstart",w),e.removeEventListener("dragend",M),f&&(cancelAnimationFrame(f),f=null,p=null)},plugin:new pe({key:typeof t=="string"?new ge(t):t,state:{init(){return{locked:!1}},apply(S,A,x,k){const v=S.getMeta("lockDragHandle"),T=S.getMeta("hideDragHandle");if(v!==void 0&&(c=v),T)return g(),c=!1,d=null,u=-1,i?.({editor:n,node:null,pos:-1}),A;if(S.docChanged&&u!==-1&&e)if(RD(S)){const N=UD(k,h);N!==u&&(u=N)}else{const N=S.mapping.map(u);N!==u&&(u=N,h=Pc(k,u))}return A}},view:S=>{var A;return e.draggable=!0,e.style.pointerEvents="auto",(A=n.view.dom.parentElement)==null||A.appendChild(a),a.style.pointerEvents="none",a.style.position="absolute",a.style.top="0",a.style.left="0",{update(x,k){if(!e)return;if(!n.isEditable){g();return}if(c?e.draggable=!1:e.draggable=!0,S.state.doc.eq(k.doc)||u===-1)return;let v=S.nodeDOM(u);if(v=Dm(S,v),v===S.dom||v?.nodeType!==1)return;const T=S.posAtDOM(v,0),N=Om(n.state.doc,T),H=Rm(n.state.doc,T);d=N,u=H,h=Pc(S.state,u),i?.({editor:n,node:d,pos:u}),b(v)},destroy(){f&&(cancelAnimationFrame(f),f=null,p=null),e&&Rx(a)}}},props:{handleDOMEvents:{keydown(S){return!e||c||S.hasFocus()&&(g(),d=null,u=-1,i?.({editor:n,node:null,pos:-1})),!1},mouseleave(S,A){return c||A.target&&!a.contains(A.relatedTarget)&&(g(),d=null,u=-1,i?.({editor:n,node:null,pos:-1})),!1},mousemove(S,A){return!e||c||(p={x:A.clientX,y:A.clientY},f)||(f=requestAnimationFrame(()=>{if(f=null,!p)return;const{x,y:k}=p;p=null;const v=_x({x,y:k,editor:n});if(!v.resultElement)return;let T=v.resultElement;if(T=Dm(S,T),T===S.dom||T?.nodeType!==1)return;const N=S.posAtDOM(T,0),H=Om(n.state.doc,N);if(H!==d){const V=Rm(n.state.doc,N);d=H,u=V,h=Pc(S.state,u),i?.({editor:n,node:d,pos:u}),b(T),y()}})),!1}}}})}},Wd={placement:"left-start",strategy:"absolute"},VD=de.create({name:"dragHandle",addOptions(){return{render(){const t=document.createElement("div");return t.classList.add("drag-handle"),t},computePositionConfig:{},locked:!1,onNodeChange:()=>null,onElementDragStart:void 0,onElementDragEnd:void 0}},addCommands(){return{lockDragHandle:()=>({editor:t})=>(this.options.locked=!0,t.commands.setMeta("lockDragHandle",this.options.locked)),unlockDragHandle:()=>({editor:t})=>(this.options.locked=!1,t.commands.setMeta("lockDragHandle",this.options.locked)),toggleDragHandle:()=>({editor:t})=>(this.options.locked=!this.options.locked,t.commands.setMeta("lockDragHandle",this.options.locked))}},addProseMirrorPlugins(){const t=this.options.render();return[Dx({computePositionConfig:{...Wd,...this.options.computePositionConfig},getReferencedVirtualElement:this.options.getReferencedVirtualElement,element:t,editor:this.editor,onNodeChange:this.options.onNodeChange,onElementDragStart:this.options.onElementDragStart,onElementDragEnd:this.options.onElementDragEnd}).plugin]}}),WD=VD;function qD(t){const e=t.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const s={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},i=t.inherit(t.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},l={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,n,s]};s.contains.push(l);const a={match:/\\"/},c={className:"string",begin:/'/,end:/'/},d={match:/\\'/},u={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,n]},h=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],f=t.SHEBANG({binary:`(${h.join("|")})`,relevance:10}),p={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},g=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],y=["true","false"],b={match:/(\/[a-z._-]+)+/},w=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],M=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],S=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],A=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:g,literal:y,built_in:[...w,...M,"set","shopt",...S,...A]},contains:[f,t.SHEBANG(),p,u,i,o,b,l,a,c,d,n]}}const KD=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),GD=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],JD=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],YD=[...GD,...JD],XD=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),ZD=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),QD=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),eL=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function tL(t){const e=t.regex,n=KD(t),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},s="and or not only",i=/@-?\w[\w]*(-\w+)*/,o="[a-zA-Z-][a-zA-Z0-9_-]*",l=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+o,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+ZD.join("|")+")"},{begin:":(:)?("+QD.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+eL.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...l,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...l,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:e.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:XD.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...l,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+YD.join("|")+")\\b"}]}}const Lm="[A-Za-z$_][0-9A-Za-z$_]*",nL=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],rL=["true","false","null","undefined","NaN","Infinity"],Lx=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Ix=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],jx=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],sL=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],iL=[].concat(jx,Lx,Ix);function oL(t){const e=t.regex,n=(F,{after:ue})=>{const xe="</"+F[0].slice(1);return F.input.indexOf(xe,ue)!==-1},r=Lm,s={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(F,ue)=>{const xe=F[0].length+F.index,_=F.input[xe];if(_==="<"||_===","){ue.ignoreMatch();return}_===">"&&(n(F,{after:xe})||ue.ignoreMatch());let Z;const fe=F.input.substring(xe);if(Z=fe.match(/^\s*=/)){ue.ignoreMatch();return}if((Z=fe.match(/^\s+extends\s+/))&&Z.index===0){ue.ignoreMatch();return}}},l={$pattern:Lm,keyword:nL,literal:rL,built_in:iL,"variable.language":sL},a="[0-9](_?[0-9])*",c=`\\.(${a})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",u={className:"number",variants:[{begin:`(\\b(${d})((${c})|\\.)?|(${c}))[eE][+-]?(${a})\\b`},{begin:`\\b(${d})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},y={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,h]},w={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},M=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,p,g,y,{match:/\$\d+/},u];h.contains=M.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(M)});const S=[].concat(w,h.contains),A=S.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(S)}]),x={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:A},k={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},v={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Lx,...Ix]}},T={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},N={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[x],illegal:/%/},H={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function V(F){return e.concat("(?!",F.join("|"),")")}const $={match:e.concat(/\b/,V([...jx,"super","import"].map(F=>`${F}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},I={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},j={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},x]},Q="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",ie={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(Q)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[x]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:A,CLASS_REFERENCE:v},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),T,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,p,g,y,w,{match:/\$\d+/},u,v,{scope:"attr",match:r+e.lookahead(":"),relevance:0},ie,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[w,t.REGEXP_MODE,{className:"function",begin:Q,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:A}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},N,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[x,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},I,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[x]},$,H,k,j,{match:/\$[(.]/}]}}function lL(t){const e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],s={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[e,n,t.QUOTE_STRING_MODE,s,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function aL(t){const e=t.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],l={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},a={className:"meta",begin:/^(>>>|\.\.\.) /},c={className:"subst",begin:/\{/,end:/\}/,keywords:l,illegal:/#/},d={begin:/\{\{/,relevance:0},u={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,a,d,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,a,d,c]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[t.BACKSLASH_ESCAPE,d,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,d,c]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},h="[0-9](_?[0-9])*",f=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,p=`\\b|${r.join("|")}`,g={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${f}))[eE][+-]?(${h})[jJ]?(?=${p})`},{begin:`(${f})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${p})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${p})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${p})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${p})`},{begin:`\\b(${h})[jJ](?=${p})`}]},y={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:l,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},b={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:["self",a,g,u,t.HASH_COMMENT_MODE]}]};return c.contains=[u,g,a],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:l,illegal:/(<\/|\?)|=>/,contains:[a,g,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},u,y,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[b]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[g,b,u]}]}}function cL(t){const e=t.regex,n=t.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},s={begin:/"/,end:/"/,contains:[{match:/""/}]},i=["true","false","unknown"],o=["double precision","large object","with timezone","without timezone"],l=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],a=["add","asc","collation","desc","final","first","last","view"],c=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],d=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],u=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],h=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],f=d,p=[...c,...a].filter(A=>!d.includes(A)),g={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},y={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},b={match:e.concat(/\b/,e.either(...f),/\s*\(/),relevance:0,keywords:{built_in:f}};function w(A){return e.concat(/\b/,e.either(...A.map(x=>x.replace(/\s+/,"\\s+"))),/\b/)}const M={scope:"keyword",match:w(h),relevance:0};function S(A,{exceptions:x,when:k}={}){const v=k;return x=x||[],A.map(T=>T.match(/\|\d+$/)||x.includes(T)?T:v(T)?`${T}|0`:T)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:S(p,{when:A=>A.length<3}),literal:i,type:l,built_in:u},contains:[{scope:"type",match:w(o)},M,b,g,r,s,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,y]}}const Kl="[A-Za-z$_][0-9A-Za-z$_]*",Px=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Bx=["true","false","null","undefined","NaN","Infinity"],$x=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Hx=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],zx=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Fx=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Ux=[].concat(zx,$x,Hx);function dL(t){const e=t.regex,n=(F,{after:ue})=>{const xe="</"+F[0].slice(1);return F.input.indexOf(xe,ue)!==-1},r=Kl,s={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(F,ue)=>{const xe=F[0].length+F.index,_=F.input[xe];if(_==="<"||_===","){ue.ignoreMatch();return}_===">"&&(n(F,{after:xe})||ue.ignoreMatch());let Z;const fe=F.input.substring(xe);if(Z=fe.match(/^\s*=/)){ue.ignoreMatch();return}if((Z=fe.match(/^\s+extends\s+/))&&Z.index===0){ue.ignoreMatch();return}}},l={$pattern:Kl,keyword:Px,literal:Bx,built_in:Ux,"variable.language":Fx},a="[0-9](_?[0-9])*",c=`\\.(${a})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",u={className:"number",variants:[{begin:`(\\b(${d})((${c})|\\.)?|(${c}))[eE][+-]?(${a})\\b`},{begin:`\\b(${d})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},y={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,h]},w={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},M=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,p,g,y,{match:/\$\d+/},u];h.contains=M.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(M)});const S=[].concat(w,h.contains),A=S.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(S)}]),x={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:A},k={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},v={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...$x,...Hx]}},T={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},N={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[x],illegal:/%/},H={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function V(F){return e.concat("(?!",F.join("|"),")")}const $={match:e.concat(/\b/,V([...zx,"super","import"].map(F=>`${F}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},I={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},j={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},x]},Q="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",ie={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(Q)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[x]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:A,CLASS_REFERENCE:v},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),T,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,p,g,y,w,{match:/\$\d+/},u,v,{scope:"attr",match:r+e.lookahead(":"),relevance:0},ie,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[w,t.REGEXP_MODE,{className:"function",begin:Q,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:A}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},N,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[x,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},I,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[x]},$,H,k,j,{match:/\$[(.]/}]}}function uL(t){const e=t.regex,n=dL(t),r=Kl,s=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:s},contains:[n.exports.CLASS_REFERENCE]},l={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},a=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:Kl,keyword:Px.concat(a),literal:Bx,built_in:Ux.concat(s),"variable.language":Fx},d={className:"meta",begin:"@"+r},u=(g,y,b)=>{const w=g.contains.findIndex(M=>M.label===y);if(w===-1)throw new Error("can not find mode to replace");g.contains.splice(w,1,b)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(d);const h=n.contains.find(g=>g.scope==="attr"),f=Object.assign({},h,{match:e.concat(r,e.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,h,f]),n.contains=n.contains.concat([d,i,o,f]),u(n,"shebang",t.SHEBANG()),u(n,"use_strict",l);const p=n.contains.find(g=>g.label==="func.def");return p.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function hL(t){const e=t.regex,n=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,s={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=t.inherit(i,{begin:/\(/,end:/\)/}),l=t.inherit(t.APOS_STRING_MODE,{className:"string"}),a=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),c={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[s]},{begin:/'/,end:/'/,contains:[s]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[i,a,l,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[i,o,a,l]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},s,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[a]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(/</,e.lookahead(e.concat(n,e.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:c}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}const Im={},fL="hljs-";function pL(t){const e=a0.newInstance();return t&&i(t),{highlight:n,highlightAuto:r,listLanguages:s,register:i,registerAlias:o,registered:l};function n(a,c,d){const u=d||Im,h=typeof u.prefix=="string"?u.prefix:fL;if(!e.getLanguage(a))throw new Error("Unknown language: `"+a+"` is not registered");e.configure({__emitter:mL,classPrefix:h});const f=e.highlight(c,{ignoreIllegals:!0,language:a});if(f.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:f.errorRaised});const p=f._emitter.root,g=p.data;return g.language=f.language,g.relevance=f.relevance,p}function r(a,c){const u=(c||Im).subset||s();let h=-1,f=0,p;for(;++h<u.length;){const g=u[h];if(!e.getLanguage(g))continue;const y=n(g,a,c);y.data&&y.data.relevance!==void 0&&y.data.relevance>f&&(f=y.data.relevance,p=y)}return p||{type:"root",children:[],data:{language:void 0,relevance:f}}}function s(){return e.listLanguages()}function i(a,c){if(typeof a=="string")e.registerLanguage(a,c);else{let d;for(d in a)Object.hasOwn(a,d)&&e.registerLanguage(d,a[d])}}function o(a,c){if(typeof a=="string")e.registerAliases(typeof c=="string"?c:[...c],{languageName:a});else{let d;for(d in a)if(Object.hasOwn(a,d)){const u=a[d];e.registerAliases(typeof u=="string"?u:[...u],{languageName:d})}}}function l(a){return!!e.getLanguage(a)}}class mL{constructor(e){this.options=e,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(e){if(e==="")return;const n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=e:n.children.push({type:"text",value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,n){const r=this.stack[this.stack.length-1],s=e.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:s}):r.children.push(...s)}openNode(e){const n=this,r=e.split(".").map(function(o,l){return l?o+"_".repeat(l):n.options.classPrefix+o}),s=this.stack[this.stack.length-1],i={type:"element",tagName:"span",properties:{className:r},children:[]};s.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const Vx=de.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:[]}},addProseMirrorPlugins(){const t=new ge("trailingNode");return[new pe({key:t,appendTransaction:(e,n,r)=>{if(!e.some(h=>h.docChanged))return null;const{doc:i,schema:o}=r,l=i.lastChild,a=this.options.node,c=o.nodes[a];if(!c||l?.type.name===a||l&&this.options.notAfter.includes(l.type.name))return null;const d=i.content.size;return r.tr.insert(d,c.create())}})]}});var gL=tT;const yL=t=>{const{editor:e,pos:n}=t,r=e.state.doc.resolve(Math.max(n,0));return r.depth>0?r.node(r.depth-1):null},bL=t=>{const e='Press "/" to insert or start typing...',{node:n}=t,r=n.type.name,s=yL(t);if(r==="heading"){const i=n.attrs.level??1;switch(i){case 1:return"Add a title...";case 2:return"Add a section heading...";case 3:return"Add a subheading...";default:return`Heading ${i}`}}if(r==="taskItem")return"Add a task...";if(r==="listItem"){const i=s?.type.name;return i==="bulletList"?"Add a bullet...":i==="orderedList"?"Add a numbered item...":"Add a list item..."}if(r==="codeBlock"){const i=n.attrs.language;return i?`Write ${i} code...`:"Write some code..."}if(r==="paragraph"){const i=s?.type.name;if(!i||i==="doc")return e}return r==="doc"?e:""},Wx=gL.extend({addOptions(){return{...this.parent?.(),emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",includeChildren:!0,showOnlyCurrent:!0,showOnlyWhenEditable:!0,placeholder:e=>bL(e)}},addProseMirrorPlugins(){const t=new Set(["table","tableCell","tableHeader","tableRow"]),e=n=>{const r=this.editor.state.doc.resolve(n);for(let s=r.depth;s>=0;s-=1){const i=r.node(s);if(t.has(i.type.name))return!0}return!1};return[new pe({key:new ge("placeholder"),props:{decorations:({doc:n,selection:r})=>{if(!(this.editor.isEditable||!this.options.showOnlyWhenEditable))return null;const{anchor:i}=r,o=[],l=this.editor.isEmpty;return n.descendants((a,c)=>{if(e(c))return this.options.includeChildren;const d=i>=c&&i<=c+a.nodeSize,u=!a.isLeaf&&Li(a);if((d||!this.options.showOnlyCurrent)&&u){const h=[this.options.emptyNodeClass];l&&h.push(this.options.emptyEditorClass);const f=typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:a,pos:c,hasAnchor:d}):this.options.placeholder,p=_e.node(c,c+a.nodeSize,{class:h.join(" "),"data-placeholder":f});o.push(p)}return this.options.includeChildren}),o.length?ye.create(n,o):null}}})]}}),xL=({node:t,updateAttributes:e,editor:n})=>{const[r,s]=C.useState(!1),{type:i,title:o,message:l,align:a,size:c,textAlign:d}=t.attrs,u={info:"bg-blue-50 text-blue-900 border-2 border-blue-200 dark:bg-blue-900/20 dark:text-blue-100 dark:border-blue-800",warning:"bg-yellow-50 text-yellow-900 border-2 border-yellow-200 dark:bg-yellow-900/20 dark:text-yellow-100 dark:border-yellow-800",error:"bg-red-50 text-red-900 border-2 border-red-200 dark:bg-red-900/20 dark:text-red-100 dark:border-red-800",success:"bg-green-50 text-green-900 border-2 border-green-200 dark:bg-green-900/20 dark:text-green-100 dark:border-green-800"},h={small:"text-sm p-2",medium:"text-base p-3",large:"text-lg p-4"},f={left:"text-left",center:"text-center",right:"text-right"},p={left:"text-left",center:"text-center",right:"text-right"};return m.jsxs(Iu,{children:[m.jsx("div",{className:`${f[a]||"text-left"} cursor-grab`,onClick:()=>s(!0),"data-drag-handle":!0,children:m.jsxs("div",{className:`inline-block rounded-lg border p-2 m-1 ${u[i]||u.info} ${h[c]||h["fit-content"]} ${p[d]||p.left}`,children:[m.jsx("strong",{className:"font-bold block",children:o}),m.jsx("span",{children:l})]})}),r&&m.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 z-50 flex items-center justify-center",onClick:()=>s(!1),children:m.jsxs("div",{className:"bg-white p-6 rounded-lg shadow-xl w-full max-w-md",onClick:g=>g.stopPropagation(),children:[m.jsx("h3",{className:"text-xl font-semibold mb-4 text-gray-800",children:"Edit Alert"}),m.jsxs("div",{className:"space-y-4",children:[m.jsxs("div",{children:[m.jsx("label",{htmlFor:"title",className:"block text-sm font-medium text-gray-700 mb-1",children:"Title"}),m.jsx("input",{type:"text",id:"title",defaultValue:o,onBlur:g=>e({title:g.target.value}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm text-gray-900"})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"message",className:"block text-sm font-medium text-gray-700 mb-1",children:"Message"}),m.jsx("textarea",{id:"message",defaultValue:l,onBlur:g=>e({message:g.target.value}),rows:3,className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm text-gray-900"})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"type",className:"block text-sm font-medium text-gray-700 mb-1",children:"Type"}),m.jsxs("select",{id:"type",defaultValue:i,onChange:g=>e({type:g.target.value}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm text-gray-900",children:[m.jsx("option",{value:"info",children:"Info"}),m.jsx("option",{value:"warning",children:"Warning"}),m.jsx("option",{value:"error",children:"Error"}),m.jsx("option",{value:"success",children:"Success"})]})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"align",className:"block text-sm font-medium text-gray-700 mb-1",children:"Alignment"}),m.jsxs("select",{id:"align",defaultValue:a,onChange:g=>e({align:g.target.value}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm text-gray-900",children:[m.jsx("option",{value:"left",children:"Left"}),m.jsx("option",{value:"center",children:"Center"}),m.jsx("option",{value:"right",children:"Right"})]})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"size",className:"block text-sm font-medium text-gray-700 mb-1",children:"Size"}),m.jsxs("select",{id:"size",defaultValue:c,onChange:g=>e({size:g.target.value}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm text-gray-900",children:[m.jsx("option",{value:"small",children:"Small"}),m.jsx("option",{value:"medium",children:"Medium"}),m.jsx("option",{value:"large",children:"Large"})]})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"textAlign",className:"block text-sm font-medium text-gray-700 mb-1",children:"Text Alignment"}),m.jsxs("select",{id:"textAlign",defaultValue:d,onChange:g=>e({textAlign:g.target.value}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm text-gray-900",children:[m.jsx("option",{value:"left",children:"Left"}),m.jsx("option",{value:"center",children:"Center"}),m.jsx("option",{value:"right",children:"Right"})]})]})]}),m.jsx("div",{className:"mt-6 flex justify-end",children:m.jsx("button",{onClick:()=>s(!1),className:"px-4 py-2 bg-gray-600 text-white rounded-md hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500",children:"Done"})})]})})]})},qx=De.create({name:"alertWidget",group:"block",atom:!0,draggable:!0,defining:!0,addAttributes(){return{type:{default:"info",parseHTML:t=>t.getAttribute("data-type"),renderHTML:t=>({"data-type":t.type})},title:{default:"Alert",parseHTML:t=>t.getAttribute("data-title"),renderHTML:t=>({"data-title":t.title})},message:{default:"This is an alert message.",parseHTML:t=>t.getAttribute("data-message"),renderHTML:t=>({"data-message":t.message})},align:{default:"center",parseHTML:t=>t.getAttribute("data-align"),renderHTML:t=>({"data-align":t.align})},size:{default:"medium",parseHTML:t=>t.getAttribute("data-size"),renderHTML:t=>({"data-size":t.size})},textAlign:{default:"left",parseHTML:t=>t.getAttribute("data-text-align"),renderHTML:t=>({"data-text-align":t.textAlign})}}},parseHTML(){return[{tag:"div[data-alert-widget]",priority:52}]},renderHTML({HTMLAttributes:t}){return["div",be(t,{"data-alert-widget":""})]},addNodeView(){return ju(xL)},addCommands(){return{setAlertWidget:(t={})=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}}}),wL=({node:t,updateAttributes:e,editor:n})=>{const[r,s]=C.useState(!1),{text:i,url:o,style:l,size:a,textAlign:c}=t.attrs,d={primary:"bg-primary text-primary-foreground hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80"},u={"fit-content":"w-auto","full-width":"w-full"},h={left:"text-left",center:"text-center",right:"text-right"};return m.jsxs(Iu,{children:[m.jsx("div",{className:`p-2 ${h[c]||h.left} cursor-grab`,"data-drag-handle":!0,onClick:()=>s(!0),children:m.jsx("div",{role:"button",tabIndex:0,className:`inline-block px-4 py-2 rounded-md ${d[l]} ${u[a]||u["fit-content"]}`,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),s(!0))},children:i})}),r&&m.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 z-50 flex items-center justify-center",onClick:()=>s(!1),children:m.jsxs("div",{className:"bg-white p-6 rounded-lg shadow-xl w-full max-w-md",onClick:f=>f.stopPropagation(),children:[m.jsx("h3",{className:"text-xl font-semibold mb-4 text-gray-800",children:"Edit CTA Button"}),m.jsxs("div",{className:"space-y-4",children:[m.jsxs("div",{children:[m.jsx("label",{htmlFor:"text",className:"block text-sm font-medium text-gray-700 mb-1",children:"Button Text"}),m.jsx("input",{type:"text",id:"text",defaultValue:i,onBlur:f=>e({text:f.target.value}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm text-gray-900"})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"url",className:"block text-sm font-medium text-gray-700 mb-1",children:"URL"}),m.jsx("input",{type:"text",id:"url",defaultValue:o,onBlur:f=>e({url:f.target.value}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm text-gray-900"})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"style",className:"block text-sm font-medium text-gray-700 mb-1",children:"Style"}),m.jsxs("select",{id:"style",defaultValue:l,onChange:f=>e({style:f.target.value}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm text-gray-900",children:[m.jsx("option",{value:"primary",children:"Primary"}),m.jsx("option",{value:"secondary",children:"Secondary"})]})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"size",className:"block text-sm font-medium text-gray-700 mb-1",children:"Size"}),m.jsxs("select",{id:"size",defaultValue:a,onChange:f=>e({size:f.target.value}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm text-gray-900",children:[m.jsx("option",{value:"fit-content",children:"Fit Content"}),m.jsx("option",{value:"full-width",children:"Full Width"})]})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"textAlign",className:"block text-sm font-medium text-gray-700 mb-1",children:"Text Alignment"}),m.jsxs("select",{id:"textAlign",defaultValue:c,onChange:f=>e({textAlign:f.target.value}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm text-gray-900",children:[m.jsx("option",{value:"left",children:"Left"}),m.jsx("option",{value:"center",children:"Center"}),m.jsx("option",{value:"right",children:"Right"})]})]})]}),m.jsx("div",{className:"mt-6 flex justify-end",children:m.jsx("button",{onClick:()=>s(!1),className:"px-4 py-2 bg-gray-600 text-white rounded-md hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500",children:"Done"})})]})})]})},Kx=De.create({name:"ctaWidget",group:"block",draggable:!0,atom:!0,defining:!0,addAttributes(){return{text:{default:"Click Here",parseHTML:t=>t.getAttribute("data-text"),renderHTML:t=>({"data-text":t.text})},url:{default:"#",parseHTML:t=>t.getAttribute("data-url"),renderHTML:t=>({"data-url":t.url})},style:{default:"primary",parseHTML:t=>t.getAttribute("data-style"),renderHTML:t=>({"data-style":t.style})},size:{default:"fit-content",parseHTML:t=>t.getAttribute("data-size"),renderHTML:t=>({"data-size":t.size})},textAlign:{default:"left",parseHTML:t=>t.getAttribute("data-text-align"),renderHTML:t=>({"data-text-align":t.textAlign})}}},parseHTML(){return[{tag:"div[data-cta-widget]",priority:52}]},renderHTML({HTMLAttributes:t}){return["div",be(t,{"data-cta-widget":""})]},addNodeView(){return ju(wL)},addCommands(){return{setCtaWidget:(t={})=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}}});function kL(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:i,startOfLine:o,$position:l}=t,a=r&&!s,c=iE(n),d=new RegExp(`\\s${c}$`),u=o?"^":"",h=s?"":c,f=a?new RegExp(`${u}${c}.*?(?=\\s${h}|$)`,"gm"):new RegExp(`${u}(?:^)?${c}[^\\s${h}]*`,"gm"),p=((e=l.nodeBefore)==null?void 0:e.isText)&&l.nodeBefore.text;if(!p)return null;const g=l.pos-p.length,y=Array.from(p.matchAll(f)).pop();if(!y||y.input===void 0||y.index===void 0)return null;const b=y.input.slice(Math.max(0,y.index-1),y.index),w=new RegExp(`^[${i?.join("")}\0]?$`).test(b);if(i!==null&&!w)return null;const M=g+y.index;let S=M+y[0].length;return a&&d.test(p.slice(S-1,S+1))&&(y[0]+=" ",S+=1),M<l.pos&&S>=l.pos?{range:{from:M,to:S},query:y[0].slice(n.length),text:y[0]}:null}var vL=new ge("suggestion");function SL({pluginKey:t=vL,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:s=!1,allowedPrefixes:i=[" "],startOfLine:o=!1,decorationTag:l="span",decorationClass:a="suggestion",decorationContent:c="",decorationEmptyClass:d="is-empty",command:u=()=>null,items:h=()=>[],render:f=()=>({}),allow:p=()=>!0,findSuggestionMatch:g=kL}){let y;const b=f?.(),w=()=>{const x=e.state.selection.$anchor.pos,k=e.view.coordsAtPos(x),{top:v,right:T,bottom:N,left:H}=k;try{return new DOMRect(H,v,T-H,N-v)}catch{return null}},M=(x,k)=>k?()=>{const v=t.getState(e.state),T=v?.decorationId,N=x.dom.querySelector(`[data-decoration-id="${T}"]`);return N?.getBoundingClientRect()||null}:w;function S(x,k){var v;try{const N=t.getState(x.state),H=N?.decorationId?x.dom.querySelector(`[data-decoration-id="${N.decorationId}"]`):null,V={editor:e,range:N?.range||{from:0,to:0},query:N?.query||null,text:N?.text||null,items:[],command:$=>u({editor:e,range:N?.range||{from:0,to:0},props:$}),decorationNode:H,clientRect:M(x,H)};(v=b?.onExit)==null||v.call(b,V)}catch{}const T=x.state.tr.setMeta(k,{exit:!0});x.dispatch(T)}const A=new pe({key:t,view(){return{update:async(x,k)=>{var v,T,N,H,V,$,I;const j=(v=this.key)==null?void 0:v.getState(k),Q=(T=this.key)==null?void 0:T.getState(x.state),ie=j.active&&Q.active&&j.range.from!==Q.range.from,F=!j.active&&Q.active,ue=j.active&&!Q.active,xe=!F&&!ue&&j.query!==Q.query,_=F||ie&&xe,Z=xe||ie,fe=ue||ie&&xe;if(!_&&!Z&&!fe)return;const Se=fe&&!_?j:Q,pn=x.dom.querySelector(`[data-decoration-id="${Se.decorationId}"]`);y={editor:e,range:Se.range,query:Se.query,text:Se.text,items:[],command:fr=>u({editor:e,range:Se.range,props:fr}),decorationNode:pn,clientRect:M(x,pn)},_&&((N=b?.onBeforeStart)==null||N.call(b,y)),Z&&((H=b?.onBeforeUpdate)==null||H.call(b,y)),(Z||_)&&(y.items=await h({editor:e,query:Se.query})),fe&&((V=b?.onExit)==null||V.call(b,y)),Z&&(($=b?.onUpdate)==null||$.call(b,y)),_&&((I=b?.onStart)==null||I.call(b,y))},destroy:()=>{var x;y&&((x=b?.onExit)==null||x.call(b,y))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(x,k,v,T){const{isEditable:N}=e,{composing:H}=e.view,{selection:V}=x,{empty:$,from:I}=V,j={...k},Q=x.getMeta(t);if(Q&&Q.exit)return j.active=!1,j.decorationId=null,j.range={from:0,to:0},j.query=null,j.text=null,j;if(j.composing=H,N&&($||e.view.composing)){(I<k.range.from||I>k.range.to)&&!H&&!k.composing&&(j.active=!1);const ie=g({char:n,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:i,startOfLine:o,$position:V.$from}),F=`id_${Math.floor(Math.random()*4294967295)}`;ie&&p({editor:e,state:T,range:ie.range,isActive:k.active})?(j.active=!0,j.decorationId=k.decorationId?k.decorationId:F,j.range=ie.range,j.query=ie.query,j.text=ie.text):j.active=!1}else j.active=!1;return j.active||(j.decorationId=null,j.range={from:0,to:0},j.query=null,j.text=null),j}},props:{handleKeyDown(x,k){var v,T,N,H;const{active:V,range:$}=A.getState(x.state);if(!V)return!1;if(k.key==="Escape"||k.key==="Esc"){const j=A.getState(x.state),Q=(v=y?.decorationNode)!=null?v:null,ie=Q??(j?.decorationId?x.dom.querySelector(`[data-decoration-id="${j.decorationId}"]`):null);if(((T=b?.onKeyDown)==null?void 0:T.call(b,{view:x,event:k,range:j.range}))||!1)return!0;const ue={editor:e,range:j.range,query:j.query,text:j.text,items:[],command:xe=>u({editor:e,range:j.range,props:xe}),decorationNode:ie,clientRect:ie?()=>ie.getBoundingClientRect()||null:null};return(N=b?.onExit)==null||N.call(b,ue),S(x,t),!0}return((H=b?.onKeyDown)==null?void 0:H.call(b,{view:x,event:k,range:$}))||!1},decorations(x){const{active:k,range:v,decorationId:T,query:N}=A.getState(x);if(!k)return null;const H=!N?.length,V=[a];return H&&V.push(d),ye.create(x.doc,[_e.inline(v.from,v.to,{nodeName:l,class:V.join(" "),"data-decoration-id":T,"data-decoration-content":c})])}}});return A}const CL=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),EL=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),jm=t=>{const e=EL(t);return e.charAt(0).toUpperCase()+e.slice(1)},Gx=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),ML=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var AL={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const TL=C.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:o,...l},a)=>C.createElement("svg",{ref:a,...AL,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:Gx("lucide",s),...!i&&!ML(l)&&{"aria-hidden":"true"},...l},[...o.map(([c,d])=>C.createElement(c,d)),...Array.isArray(i)?i:[i]]));const X=(t,e)=>{const n=C.forwardRef(({className:r,...s},i)=>C.createElement(TL,{ref:i,iconNode:e,className:Gx(`lucide-${CL(jm(t))}`,`lucide-${t}`,r),...s}));return n.displayName=jm(t),n};const NL=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],Gl=X("bold",NL);const _L=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Pm=X("circle-alert",_L);const RL=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],OL=X("circle-check-big",RL);const DL=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],LL=X("circle-plus",DL);const IL=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],jL=X("circle-x",IL);const PL=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],Nr=X("code-xml",PL);const BL=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],Rs=X("code",BL);const $L=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],HL=X("columns-2",$L);const zL=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],FL=X("columns-3",zL);const UL=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Jx=X("download",UL);const VL=[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]],WL=X("eraser",VL);const qL=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],KL=X("eye",qL);const GL=[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]],JL=X("file-code-2",GL);const YL=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],XL=X("hash",YL);const ZL=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],vs=X("heading-1",ZL);const QL=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],Vi=X("heading-2",QL);const eI=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],Aa=X("heading-3",eI);const tI=[["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 10v3a1 1 0 0 0 1 1h3",key:"tj5zdr"}],["path",{d:"M21 10v8",key:"1kdml4"}],["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}]],nI=X("heading-4",tI);const rI=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 13v-3h4",key:"1nvgqp"}],["path",{d:"M17 17.7c.4.2.8.3 1.3.3 1.5 0 2.7-1.1 2.7-2.5S19.8 13 18.3 13H17",key:"2nebdn"}]],sI=X("heading-5",rI);const iI=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["circle",{cx:"19",cy:"16",r:"2",key:"15mx69"}],["path",{d:"M20 10c-2 2-3 3.5-3 6",key:"f35dl0"}]],oI=X("heading-6",iI);const lI=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],zr=X("image",lI);const aI=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],kh=X("italic",aI);const cI=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],Ta=X("link-2",cI);const dI=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],Wi=X("list-ordered",dI);const uI=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Os=X("list",uI);const hI=[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]],Na=X("megaphone",hI);const fI=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],pI=X("menu",fI);const mI=[["path",{d:"M5 12h14",key:"1ays0h"}]],_a=X("minus",mI);const gI=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],vh=X("palette",gI);const yI=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],bI=X("play",yI);const xI=[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]],wI=X("redo-2",xI);const kI=[["path",{d:"M14 4a1 1 0 0 1 1-1",key:"dhj8ez"}],["path",{d:"M15 10a1 1 0 0 1-1-1",key:"1mnyi5"}],["path",{d:"M21 4a1 1 0 0 0-1-1",key:"sfs9ap"}],["path",{d:"M21 9a1 1 0 0 1-1 1",key:"mp6qeo"}],["path",{d:"m3 7 3 3 3-3",key:"x25e72"}],["path",{d:"M6 10V5a2 2 0 0 1 2-2h2",key:"15xut4"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}]],vI=X("replace",kI);const SI=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],CI=X("rotate-ccw",SI);const EI=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]],MI=X("rows-2",EI);const AI=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]],TI=X("rows-3",AI);const NI=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],_I=X("search",NI);const RI=[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Ra=X("square-check-big",RI);const OI=[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]],Yx=X("strikethrough",OI);const DI=[["path",{d:"m4 5 8 8",key:"1eunvl"}],["path",{d:"m12 5-8 8",key:"1ah0jp"}],["path",{d:"M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07",key:"e8ta8j"}]],Xx=X("subscript",DI);const LI=[["path",{d:"m4 19 8-8",key:"hr47gm"}],["path",{d:"m12 19-8-8",key:"1dhhmo"}],["path",{d:"M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06",key:"1dfcux"}]],Zx=X("superscript",LI);const II=[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]],qi=X("table-2",II);const jI=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],PI=X("terminal",jI);const BI=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 19H5",key:"vjpgq2"}]],Ki=X("text-align-center",BI);const $I=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 19H7",key:"4cu937"}]],Gi=X("text-align-end",$I);const HI=[["path",{d:"M3 5h18",key:"1u36vt"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 19h18",key:"awlh7x"}]],Sh=X("text-align-justify",HI);const zI=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],Ss=X("text-align-start",zI);const FI=[["path",{d:"M17 5H3",key:"1cn7zz"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 19H8",key:"13qgcb"}],["path",{d:"M3 12v7",key:"1ri8j3"}]],Ji=X("text-quote",FI);const UI=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Qx=X("trash-2",UI);const VI=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Oa=X("triangle-alert",VI);const WI=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],Wr=X("type",WI);const qI=[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]],Ch=X("underline",qI);const KI=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],GI=X("undo-2",KI);const JI=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],ew=X("video",JI);const YI=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],tw=X("x",YI),Eh=C.forwardRef(({items:t,command:e},n)=>{const[r,s]=C.useState(-1),i=C.useRef(null),o=a=>{const c=t[a];c&&e(c)};C.useEffect(()=>{if(t.length===0){s(-1);return}s(a=>{if(a===-1)return-1;const c=Math.min(Math.max(a,0),t.length-1);return Number.isFinite(c)?c:-1})},[t]),C.useEffect(()=>{if(!i.current||r===-1)return;const a=i.current.querySelector(`[data-index="${r}"]`);a&&a.scrollIntoView({block:"nearest"})},[r]),C.useImperativeHandle(n,()=>({onKeyDown:({event:a})=>t.length===0?!1:a.key==="ArrowUp"?(a.preventDefault(),s(c=>c===-1?t.length-1:(c-1+t.length)%t.length),!0):a.key==="ArrowDown"?(a.preventDefault(),s(c=>c===-1?0:(c+1)%t.length),!0):a.key==="Enter"?(a.preventDefault(),r!==-1&&o(r),!0):!1}));const l=a=>{a.stopPropagation()};return m.jsx("div",{ref:i,className:"z-50 max-h-72 w-72 overflow-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md",role:"listbox","aria-activedescendant":r!==-1?`cmd-opt-${r}`:void 0,tabIndex:-1,onWheel:l,style:{scrollbarWidth:"thin",scrollbarColor:"rgb(148 163 184) transparent"},children:t.length>0?t.map((a,c)=>{const d=r!==-1&&c===r;return m.jsxs("button",{id:`cmd-opt-${c}`,"data-index":c,role:"option","aria-selected":d,type:"button",onMouseDown:u=>u.preventDefault(),onClick:()=>o(c),className:Oe.cn("flex w-full items-center gap-2 rounded-sm p-2 text-left text-sm transition-colors","hover:bg-accent hover:text-accent-foreground",d&&"bg-accent text-accent-foreground"),children:[m.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-md border bg-background",children:a.icon}),m.jsxs("div",{className:"min-w-0",children:[m.jsx("p",{className:"truncate font-medium",children:a.title}),a.description?m.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a.description}):null]})]},`${a.title}-${c}`)}):m.jsx("div",{className:"p-2 text-sm text-muted-foreground",children:"No results"})})});Eh.displayName="SlashCommandList";const XI=[{title:"Text",description:"Start writing with plain text.",icon:C.createElement(Wr,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).clearNodes().run()}},{title:"Heading 1",description:"Large section heading.",icon:C.createElement(vs,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setHeading({level:1}).run()}},{title:"Heading 2",description:"Medium section heading.",icon:C.createElement(Vi,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setHeading({level:2}).run()}},{title:"Heading 3",description:"Small section heading.",icon:C.createElement(Aa,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setHeading({level:3}).run()}},{title:"Heading 4",description:"Extra small section heading.",icon:C.createElement(nI,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setHeading({level:4}).run()}},{title:"Heading 5",description:"Tiny section heading.",icon:C.createElement(sI,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setHeading({level:5}).run()}},{title:"Heading 6",description:"Smallest section heading.",icon:C.createElement(oI,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setHeading({level:6}).run()}},{title:"Bullet List",description:"Create a simple bulleted list.",icon:C.createElement(Os,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).toggleBulletList().run()}},{title:"Numbered List",description:"Create a list with numbering.",icon:C.createElement(Wi,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).toggleOrderedList().run()}},{title:"Task List",description:"Create a list with checkboxes.",icon:C.createElement(Ra,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).toggleTaskList().run()}},{title:"Blockquote",description:"Create a quote or citation.",icon:C.createElement(Ji,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).toggleBlockquote().run()}},{title:"Code Block",description:"Create a code block with syntax highlighting.",icon:C.createElement(Rs,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).toggleCodeBlock().run()}},{title:"Horizontal Rule",description:"Insert a horizontal divider.",icon:C.createElement(_a,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setHorizontalRule().run()}},{title:"Image",description:"Insert an image from URL.",icon:C.createElement(zr,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{const n=window.prompt("Enter image URL:");n&&t.chain().focus().deleteRange(e).setImage({src:n}).run()}},{title:"Table",description:"Insert a table with rows and columns.",icon:C.createElement(qi,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).insertTable({rows:3,cols:3,withHeaderRow:!0}).run()}},{title:"Align Left",description:"Align text to the left.",icon:C.createElement(Ss,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setTextAlign("left").run()}},{title:"Align Center",description:"Center align text.",icon:C.createElement(Ki,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setTextAlign("center").run()}},{title:"Align Right",description:"Align text to the right.",icon:C.createElement(Gi,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setTextAlign("right").run()}},{title:"Justify",description:"Justify text alignment.",icon:C.createElement(Sh,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.chain().focus().deleteRange(e).setTextAlign("justify").run()}},{title:"Video",description:"Embed a video from URL.",icon:C.createElement(ew,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{const n=window.prompt("Enter video URL (YouTube, Vimeo, etc.):");n&&t.chain().focus().deleteRange(e).insertContent(`<p><a href="${n}" target="_blank">Video: ${n}</a></p>`).run()}},{title:"Alert",description:"Insert an alert or notice.",icon:C.createElement(Oa,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.can().setAlertWidget()?t.chain().focus().deleteRange(e).setAlertWidget().run():t.chain().focus().deleteRange(e).toggleBlockquote().run()}},{title:"Call to Action",description:"Insert a call to action button.",icon:C.createElement(Na,{className:"h-5 w-5"}),command:({editor:t,range:e})=>{t.can().setCtaWidget()?t.chain().focus().deleteRange(e).setCtaWidget({text:"Click me",url:"#",style:"primary",size:"medium",textAlign:"center"}).run():t.chain().focus().deleteRange(e).insertContent("Call to Action").run()}}],nw=de.create({name:"slashCommand",addOptions(){return{suggestion:{char:"/",allowSpaces:!1,allowedPrefixes:[" "],startOfLine:!1,decorationTag:"span",decorationClass:"slash-command"}}},addProseMirrorPlugins(){return[SL({char:"/",allowSpaces:!1,allowedPrefixes:[" "],startOfLine:!1,decorationTag:"span",decorationClass:"slash-command",editor:this.editor,items:({query:t})=>XI.filter(n=>n.title.toLowerCase().includes(t.toLowerCase())||n.description.toLowerCase().includes(t.toLowerCase())).slice(0,10),command:({editor:t,range:e,props:n})=>{n.command({editor:t,range:e})},render:()=>{let t=null,e=null,n=null;const r=i=>({getBoundingClientRect:()=>i()||new DOMRect(0,0,0,0)}),s=async i=>{if(!e)return;const o=r(i),{x:l,y:a}=await Fu(o,e,{placement:"bottom-start",middleware:[zu(6),Ab({fallbackPlacements:["top-start","bottom-start"]}),Mb({padding:8}),Tb({apply({availableWidth:c,availableHeight:d,elements:u}){Object.assign(u.floating.style,{maxWidth:`${Math.min(288,c-16)}px`,maxHeight:`${Math.min(288,d-16)}px`})}})],strategy:"fixed"});e.style.left=`${Math.round(l)}px`,e.style.top=`${Math.round(a)}px`};return{onStart:i=>{if(!i.clientRect)return;const o=i.clientRect;t=new pb(Eh,{props:i,editor:i.editor}),e=document.createElement("div"),e.style.position="fixed",e.style.zIndex="10000",e.style.top="0",e.style.left="0",e.style.pointerEvents="none",e.appendChild(t.element),t.element.style.pointerEvents="auto",t.element.addEventListener("wheel",a=>{a.stopPropagation()},{passive:!0}),document.body.appendChild(e);const l=r(o);n=Ms(l,e,()=>s(o)),s(o)},onUpdate:i=>{t?.updateProps(i),i.clientRect&&s(i.clientRect)},onKeyDown:({event:i})=>i.key==="Escape"?!0:t?.ref?.onKeyDown({event:i})??!1,onExit:()=>{n?.(),n=null,t?.destroy(),t=null,e?.remove(),e=null}}}})]}});var ZI=Zu,QI=eh;NA.extend({draggable:!0});zM.extend({draggable:!0});AM.extend({draggable:!0});ZI.extend({draggable:!0});QI.extend({draggable:!0});h0.extend({draggable:!0});f0.extend({draggable:!0});d0.extend({draggable:!0});u0.extend({draggable:!0});const rw=de.create({name:"draggableNodes",addGlobalAttributes(){return[{types:["paragraph","heading","blockquote","bulletList","orderedList","taskList","taskItem","codeBlock","image"],attributes:{draggable:{default:!0,parseHTML:()=>!0,renderHTML:()=>({"data-draggable":"true"})}}}]}}),e2=De.create({name:"styleTag",group:"block",atom:!0,isolating:!0,defining:!0,draggable:!1,addAttributes(){return{cssContent:{default:"",parseHTML:t=>t.innerHTML},type:{default:"text/css",parseHTML:t=>t.getAttribute("type"),renderHTML:t=>t.type?{type:t.type}:{}},media:{default:null,parseHTML:t=>t.getAttribute("media"),renderHTML:t=>t.media?{media:t.media}:{}}}},parseHTML(){return[{tag:"style",getAttrs:t=>{const e=t,n={cssContent:e.innerHTML,type:e.getAttribute("type")},r=e.getAttribute("media");return r!==null&&(n.media=r),n}}]},renderHTML({HTMLAttributes:t,node:e}){const n={...t};return delete n.cssContent,["style",n,e.attrs.cssContent||""]},addNodeView(){return({node:t,editor:e,getPos:n})=>{const r=document.createElement("div");return r.setAttribute("data-style-node-placeholder","true"),r.style.border="1px dashed #999",r.style.padding="8px",r.style.margin="1rem 0",r.style.fontFamily="monospace",r.style.fontSize="0.9em",r.style.color="#555",r.style.cursor="pointer",r.textContent="[Custom CSS Block - Edit in Source View]",r.contentEditable="false",r.title="Click to open Source View",r.addEventListener("click",()=>{try{e?.chain().focus()}catch{}try{window.dispatchEvent(new CustomEvent("editor:openSourceView"))}catch{}}),{dom:r}}}}),t2=De.create({name:"divBlock",group:"block",content:"block*",defining:!0,draggable:!0,addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{class:{default:null,parseHTML:t=>t.getAttribute("class"),renderHTML:t=>t.class?{class:t.class}:{}},style:{default:null,parseHTML:t=>t.getAttribute("style"),renderHTML:t=>t.style?{style:t.style}:{}},id:{default:null,parseHTML:t=>t.getAttribute("id"),renderHTML:t=>t.id?{id:t.id}:{}}}},parseHTML(){return[{tag:"div",priority:51,getAttrs:t=>{const e=t,n={};for(let r=0;r<e.attributes.length;r++){const s=e.attributes[r];n[s.name]=s.value}return n}}]},renderHTML({node:t}){return["div",be(this.options.HTMLAttributes,t.attrs),0]}}),n2=de.create({name:"preserveAllAttributesExtension",addGlobalAttributes(){return[{types:["paragraph","heading","listItem","blockquote","codeBlock","bulletList","orderedList","textStyle"],attributes:{style:{default:null,parseHTML:t=>t.getAttribute("style"),renderHTML:t=>t.style?{style:t.style}:{}},class:{default:null,parseHTML:t=>t.getAttribute("class"),renderHTML:t=>t.class?{class:t.class}:{}},id:{default:null,parseHTML:t=>t.getAttribute("id"),renderHTML:t=>t.id?{id:t.id}:{}},dataAttributes:{default:null,parseHTML:t=>{const e={};for(let n=0;n<t.attributes.length;n++){const r=t.attributes[n];r.name.startsWith("data-")&&(e[r.name]=r.value)}return Object.keys(e).length>0?e:null},renderHTML:t=>t.dataAttributes||{}}}}]}}),r2=De.create({name:"scriptTag",group:"block",atom:!0,isolating:!0,defining:!0,draggable:!1,addAttributes(){return{jsContent:{default:"",parseHTML:t=>t.innerHTML},type:{default:"text/javascript",parseHTML:t=>t.getAttribute("type"),renderHTML:t=>t.type?{type:t.type}:{}},src:{default:null,parseHTML:t=>t.getAttribute("src"),renderHTML:t=>t.src?{src:t.src}:{}},async:{default:null,parseHTML:t=>t.getAttribute("async"),renderHTML:t=>t.async!=null?{async:""}:{}},defer:{default:null,parseHTML:t=>t.getAttribute("defer"),renderHTML:t=>t.defer!=null?{defer:""}:{}}}},parseHTML(){return[{tag:"script",getAttrs:t=>{const e=t,n={jsContent:e.innerHTML,type:e.getAttribute("type")},r=e.getAttribute("src");return r!==null&&(n.src=r),e.hasAttribute("async")&&(n.async=""),e.hasAttribute("defer")&&(n.defer=""),n}}]},renderHTML({HTMLAttributes:t,node:e}){const n={...t};return delete n.jsContent,["script",n,e.attrs.src?"":e.attrs.jsContent||""]},addNodeView(){return({editor:t})=>{const e=document.createElement("div");return e.setAttribute("data-script-node-placeholder","true"),e.style.border="1px dashed #999",e.style.padding="8px",e.style.margin="1rem 0",e.style.fontFamily="monospace",e.style.fontSize="0.9em",e.style.color="#555",e.style.cursor="pointer",e.textContent="[Custom JavaScript Block - Edit in Source View]",e.contentEditable="false",e.title="Click to open Source View",e.addEventListener("click",()=>{try{t?.chain().focus()}catch{}try{window.dispatchEvent(new CustomEvent("editor:openSourceView"))}catch{}}),{dom:e}}}}),s2=pL({html:hL,css:tL,js:oL,ts:uL,python:aL,json:lL,bash:qD,sql:cL}),Bm="http://www.w3.org/2000/svg";function $m(t){const e=document.createElementNS(Bm,"svg");return e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","currentColor"),e.classList.add("tiptap-drag-handle__icon","tiptap-drag-handle__icon--filled"),t.forEach(n=>{const r=document.createElementNS(Bm,"path");r.setAttribute("d",n),e.appendChild(r)}),e}const Mh=[sT.configure({codeBlock:!1,link:!1,undoRedo:!1,bulletList:{HTMLAttributes:{class:"list-disc pl-4"},keepMarks:!0,keepAttributes:!1},orderedList:{HTMLAttributes:{class:"list-decimal pl-4"},keepMarks:!0,keepAttributes:!1},dropcursor:{color:"#60A5FA",width:2},gapcursor:!1}),bA.configure({openOnClick:!1,autolink:!0,defaultProtocol:"https",protocols:["http","https","ftp","mailto"],validate:t=>/^https?:\/\//.test(t),HTMLAttributes:{class:"text-primary underline underline-offset-2 hover:text-primary/80 cursor-pointer",rel:"noopener noreferrer",target:"_blank"}}),p_,LA,m_.configure({depth:100,newGroupDelay:500}),d0.configure({lowlight:s2,defaultLanguage:"plaintext",HTMLAttributes:{class:"relative rounded-md bg-muted p-4 font-mono text-sm"}}),t2,e2,r2,n2,pT.configure({inline:!0,allowBase64:!0,HTMLAttributes:{class:"max-w-full h-auto rounded-md"}}),h0.configure({HTMLAttributes:{class:"list-none pl-0 space-y-1"}}),f0.configure({nested:!0,HTMLAttributes:{class:"flex items-start gap-2 my-1"}}),M0.configure({resizable:!0,cellMinWidth:100,HTMLAttributes:{class:"w-full border-collapse border border-gray-300 dark:border-gray-700 my-4"}}),kN.configure({HTMLAttributes:{class:"border-b border-gray-300 dark:border-gray-700"}}),vN.configure({HTMLAttributes:{class:"bg-gray-100 dark:bg-gray-800 font-bold p-3 text-left border border-gray-300 dark:border-gray-700"}}),SN.configure({HTMLAttributes:{class:"p-3 border border-gray-300 dark:border-gray-700 min-w-[100px]"}}),FN.configure({color:{types:["textStyle"]},fontFamily:{types:["textStyle"]},fontSize:{types:["textStyle"]}}),AN.configure({multicolor:!0,HTMLAttributes:{class:"rounded-sm px-1 py-0.5"}}),NN,RN,DN.configure({types:["heading","paragraph","div"],alignments:["left","center","right","justify"],defaultAlignment:"left"}),f_,Wx,UN.configure({limit:5e4,mode:"textSize"}),Vx,qx,Kx,nw,rw,LD,WD.configure({computePositionConfig:{placement:"left-start",strategy:"absolute",middleware:[zu({mainAxis:5,crossAxis:0})]},onElementDragStart:()=>{typeof document<"u"&&document.body.classList.add("dragging")},onElementDragEnd:()=>{typeof document<"u"&&document.body.classList.remove("dragging")},onNodeChange:({editor:t})=>{},render(){const t=document.createElement("div");t.classList.add("drag-handle","tiptap-drag-handle"),typeof window<"u"&&(window.__dragHandleElement=t);const e=document.createElement("div");e.classList.add("tiptap-drag-handle__group"),e.setAttribute("role","group"),e.dataset.orientation="horizontal",t.appendChild(e);const n=document.createElement("button");n.type="button",n.classList.add("tiptap-drag-handle__button","tiptap-drag-handle__button--ghost","tiptap-drag-handle__plus"),n.setAttribute("aria-label","Insert block"),n.setAttribute("title","Insert block");const r=$m(["M13 5C13 4.44772 12.5523 4 12 4C11.4477 4 11 4.44772 11 5V11H5C4.44772 11 4 11.4477 4 12C4 12.5523 4.44772 13 5 13H11V19C11 19.5523 11.4477 20 12 20C12.5523 20 13 19.5523 13 19V13H19C19.5523 13 20 12.5523 20 12C20 11.4477 19.5523 11 19 11H13V5Z"]);n.appendChild(r),e.appendChild(n);const s=document.createElement("button");s.type="button",s.classList.add("tiptap-drag-handle__button","tiptap-drag-handle__button--ghost","tiptap-drag-handle__grip"),s.setAttribute("aria-label","Drag to reorder"),s.setAttribute("title","Drag to reorder"),s.setAttribute("tabindex","0"),s.setAttribute("aria-haspopup","menu"),s.setAttribute("aria-expanded","false");const i=$m(["M9 3C7.89543 3 7 3.89543 7 5C7 6.10457 7.89543 7 9 7C10.1046 7 11 6.10457 11 5C11 3.89543 10.1046 3 9 3Z","M9 10C7.89543 10 7 10.8954 7 12C7 13.1046 7.89543 14 9 14C10.1046 14 11 13.1046 11 12C11 10.8954 10.1046 10 9 10Z","M7 19C7 17.8954 7.89543 17 9 17C10.1046 17 11 17.8954 11 19C11 20.1046 10.1046 21 9 21C7.89543 21 7 20.1046 7 19Z","M15 10C13.8954 10 13 10.8954 13 12C13 13.1046 13.8954 14 15 14C16.1046 14 17 13.1046 17 12C17 10.8954 16.1046 10 15 10Z","M13 5C13 3.89543 13.8954 3 15 3C16.1046 3 17 3.89543 17 5C17 6.10457 16.1046 7 15 7C13.8954 7 13 6.10457 13 5Z","M15 17C13.8954 17 13 17.8954 13 19C13 20.1046 13.8954 21 15 21C16.1046 21 17 20.1046 17 19C17 17.8954 16.1046 17 15 17Z"]);s.appendChild(i),e.appendChild(s);const o=()=>{const l=new CustomEvent("tiptap-gutter-toggle",{bubbles:!0,detail:{handle:e,button:n}});e.dispatchEvent(l)};return n.addEventListener("click",l=>{l.preventDefault(),l.stopPropagation(),o()}),n.addEventListener("keydown",l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),o())}),s.addEventListener("mousedown",()=>{s.setAttribute("aria-expanded","true")}),s.addEventListener("mouseup",()=>{s.setAttribute("aria-expanded","false")}),t}})];var i2=typeof document<"u",o2=function(){},qd=i2?C.useLayoutEffect:o2;const l2={...ne},a2=l2.useInsertionEffect,c2=a2||(t=>t());function d2(t){const e=ne.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return c2(()=>{e.current=t}),ne.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return e.current==null?void 0:e.current(...r)},[])}var u2=typeof document<"u",h2=function(){},Wo=u2?C.useLayoutEffect:h2;function Jl(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Jl(t[r],e[r]))return!1;return!0}if(s=Object.keys(t),n=s.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&t.$$typeof)&&!Jl(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function sw(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Hm(t,e){const n=sw(t);return Math.round(e*n)/n}function Bc(t){const e=ne.useRef(t);return Wo(()=>{e.current=t}),e}function f2(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:l=!0,whileElementsMounted:a,open:c}=t,[d,u]=ne.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[h,f]=ne.useState(r);Jl(h,r)||f(r);const[p,g]=ne.useState(null),[y,b]=ne.useState(null),w=ne.useCallback(F=>{F!==x.current&&(x.current=F,g(F))},[]),M=ne.useCallback(F=>{F!==k.current&&(k.current=F,b(F))},[]),S=i||p,A=o||y,x=ne.useRef(null),k=ne.useRef(null),v=ne.useRef(d),T=a!=null,N=Bc(a),H=Bc(s),V=Bc(c),$=ne.useCallback(()=>{if(!x.current||!k.current)return;const F={placement:e,strategy:n,middleware:h};H.current&&(F.platform=H.current),Fu(x.current,k.current,F).then(ue=>{const xe={...ue,isPositioned:V.current!==!1};I.current&&!Jl(v.current,xe)&&(v.current=xe,c1.flushSync(()=>{u(xe)}))})},[h,e,n,H,V]);Wo(()=>{c===!1&&v.current.isPositioned&&(v.current.isPositioned=!1,u(F=>({...F,isPositioned:!1})))},[c]);const I=ne.useRef(!1);Wo(()=>(I.current=!0,()=>{I.current=!1}),[]),Wo(()=>{if(S&&(x.current=S),A&&(k.current=A),S&&A){if(N.current)return N.current(S,A,$);$()}},[S,A,$,N,T]);const j=ne.useMemo(()=>({reference:x,floating:k,setReference:w,setFloating:M}),[w,M]),Q=ne.useMemo(()=>({reference:S,floating:A}),[S,A]),ie=ne.useMemo(()=>{const F={position:n,left:0,top:0};if(!Q.floating)return F;const ue=Hm(Q.floating,d.x),xe=Hm(Q.floating,d.y);return l?{...F,transform:"translate("+ue+"px, "+xe+"px)",...sw(Q.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ue,top:xe}},[n,l,Q.floating,d.x,d.y]);return ne.useMemo(()=>({...d,update:$,refs:j,elements:Q,floatingStyles:ie}),[d,$,j,Q,ie])}const Yi=(t,e)=>({...zu(t),options:[t,e]}),Da=(t,e)=>({...Mb(t),options:[t,e]}),La=(t,e)=>({...Ab(t),options:[t,e]}),p2=(t,e)=>({...Tb(t),options:[t,e]}),m2={...ne};let zm=!1,g2=0;const Fm=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+g2++;function y2(){const[t,e]=ne.useState(()=>zm?Fm():void 0);return qd(()=>{t==null&&e(Fm())},[]),ne.useEffect(()=>{zm=!0},[]),t}const b2=m2.useId,x2=b2||y2;let Kd;process.env.NODE_ENV!=="production"&&(Kd=new Set);function w2(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];const s="Floating UI: "+n.join(" ");if(!((t=Kd)!=null&&t.has(s))){var i;(i=Kd)==null||i.add(s),console.error(s)}}function k2(){const t=new Map;return{emit(e,n){var r;(r=t.get(e))==null||r.forEach(s=>s(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var r;(r=t.get(e))==null||r.delete(n)}}}const v2=ne.createContext(null),S2=ne.createContext(null),C2=()=>{var t;return((t=ne.useContext(v2))==null?void 0:t.id)||null},E2=()=>ne.useContext(S2);function M2(t){const{open:e=!1,onOpenChange:n,elements:r}=t,s=x2(),i=ne.useRef({}),[o]=ne.useState(()=>k2()),l=C2()!=null;if(process.env.NODE_ENV!=="production"){const f=r.reference;f&&!ut(f)&&w2("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,c]=ne.useState(r.reference),d=d2((f,p,g)=>{i.current.openEvent=f?p:void 0,o.emit("openchange",{open:f,event:p,reason:g,nested:l}),n?.(f,p,g)}),u=ne.useMemo(()=>({setPositionReference:c}),[]),h=ne.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return ne.useMemo(()=>({dataRef:i,open:e,onOpenChange:d,elements:h,events:o,floatingId:s,refs:u}),[e,d,h,o,s,u])}function Xi(t){t===void 0&&(t={});const{nodeId:e}=t,n=M2({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,s=r.elements,[i,o]=ne.useState(null),[l,a]=ne.useState(null),d=s?.domReference||i,u=ne.useRef(null),h=E2();qd(()=>{d&&(u.current=d)},[d]);const f=f2({...t,elements:{...s,...l&&{reference:l}}}),p=ne.useCallback(M=>{const S=ut(M)?{getBoundingClientRect:()=>M.getBoundingClientRect(),getClientRects:()=>M.getClientRects(),contextElement:M}:M;a(S),f.refs.setReference(S)},[f.refs]),g=ne.useCallback(M=>{(ut(M)||M===null)&&(u.current=M,o(M)),(ut(f.refs.reference.current)||f.refs.reference.current===null||M!==null&&!ut(M))&&f.refs.setReference(M)},[f.refs]),y=ne.useMemo(()=>({...f.refs,setReference:g,setPositionReference:p,domReference:u}),[f.refs,g,p]),b=ne.useMemo(()=>({...f.elements,domReference:d}),[f.elements,d]),w=ne.useMemo(()=>({...f,...r,refs:y,elements:b,nodeId:e}),[f,y,b,e,r]);return qd(()=>{r.dataRef.current.floatingContext=w;const M=h?.nodesRef.current.find(S=>S.id===e);M&&(M.context=w)}),ne.useMemo(()=>({...f,context:w,refs:y,elements:b}),[f,y,b,w])}const A2="_pickerRoot_1wq30_1",T2="_picker_1wq30_1",Um={pickerRoot:A2,picker:T2};function Ia(){return(Ia=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function iw(t,e){if(t==null)return{};var n,r,s={},i=Object.keys(t);for(r=0;r<i.length;r++)e.indexOf(n=i[r])>=0||(s[n]=t[n]);return s}function Gd(t){var e=C.useRef(t),n=C.useRef(function(r){e.current&&e.current(r)});return e.current=t,n.current}var _i=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t<e?e:t},ni=function(t){return"touches"in t},Jd=function(t){return t&&t.ownerDocument.defaultView||self},Vm=function(t,e,n){var r=t.getBoundingClientRect(),s=ni(e)?(function(i,o){for(var l=0;l<i.length;l++)if(i[l].identifier===o)return i[l];return i[0]})(e.touches,n):e;return{left:_i((s.pageX-(r.left+Jd(t).pageXOffset))/r.width),top:_i((s.pageY-(r.top+Jd(t).pageYOffset))/r.height)}},Wm=function(t){!ni(t)&&t.preventDefault()},ow=C.memo(function(t){var e=t.onMove,n=t.onKey,r=iw(t,["onMove","onKey"]),s=C.useRef(null),i=Gd(e),o=Gd(n),l=C.useRef(null),a=C.useRef(!1),c=C.useMemo(function(){var f=function(y){Wm(y),(ni(y)?y.touches.length>0:y.buttons>0)&&s.current?i(Vm(s.current,y,l.current)):g(!1)},p=function(){return g(!1)};function g(y){var b=a.current,w=Jd(s.current),M=y?w.addEventListener:w.removeEventListener;M(b?"touchmove":"mousemove",f),M(b?"touchend":"mouseup",p)}return[function(y){var b=y.nativeEvent,w=s.current;if(w&&(Wm(b),!(function(S,A){return A&&!ni(S)})(b,a.current)&&w)){if(ni(b)){a.current=!0;var M=b.changedTouches||[];M.length&&(l.current=M[0].identifier)}w.focus(),i(Vm(w,b,l.current)),g(!0)}},function(y){var b=y.which||y.keyCode;b<37||b>40||(y.preventDefault(),o({left:b===39?.05:b===37?-.05:0,top:b===40?.05:b===38?-.05:0}))},g]},[o,i]),d=c[0],u=c[1],h=c[2];return C.useEffect(function(){return h},[h]),C.createElement("div",Ia({},r,{onTouchStart:d,onMouseDown:d,className:"react-colorful__interactive",ref:s,onKeyDown:u,tabIndex:0,role:"slider"}))}),Ah=function(t){return t.filter(Boolean).join(" ")},lw=function(t){var e=t.color,n=t.left,r=t.top,s=r===void 0?.5:r,i=Ah(["react-colorful__pointer",t.className]);return C.createElement("div",{className:i,style:{top:100*s+"%",left:100*n+"%"}},C.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},ot=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n},N2=function(t){return L2(Yd(t))},Yd=function(t){return t[0]==="#"&&(t=t.substring(1)),t.length<6?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?ot(parseInt(t[3]+t[3],16)/255,2):1}:{r:parseInt(t.substring(0,2),16),g:parseInt(t.substring(2,4),16),b:parseInt(t.substring(4,6),16),a:t.length===8?ot(parseInt(t.substring(6,8),16)/255,2):1}},_2=function(t){return D2(O2(t))},R2=function(t){var e=t.s,n=t.v,r=t.a,s=(200-e)*n/100;return{h:ot(t.h),s:ot(s>0&&s<200?e*n/100/(s<=100?s:200-s)*100:0),l:ot(s/2),a:ot(r,2)}},Xd=function(t){var e=R2(t);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},O2=function(t){var e=t.h,n=t.s,r=t.v,s=t.a;e=e/360*6,n/=100,r/=100;var i=Math.floor(e),o=r*(1-n),l=r*(1-(e-i)*n),a=r*(1-(1-e+i)*n),c=i%6;return{r:ot(255*[r,l,o,o,a,r][c]),g:ot(255*[a,r,r,l,o,o][c]),b:ot(255*[o,o,a,r,r,l][c]),a:ot(s,2)}},Ro=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},D2=function(t){var e=t.r,n=t.g,r=t.b,s=t.a,i=s<1?Ro(ot(255*s)):"";return"#"+Ro(e)+Ro(n)+Ro(r)+i},L2=function(t){var e=t.r,n=t.g,r=t.b,s=t.a,i=Math.max(e,n,r),o=i-Math.min(e,n,r),l=o?i===e?(n-r)/o:i===n?2+(r-e)/o:4+(e-n)/o:0;return{h:ot(60*(l<0?l+6:l)),s:ot(i?o/i*100:0),v:ot(i/255*100),a:s}},I2=C.memo(function(t){var e=t.hue,n=t.onChange,r=Ah(["react-colorful__hue",t.className]);return C.createElement("div",{className:r},C.createElement(ow,{onMove:function(s){n({h:360*s.left})},onKey:function(s){n({h:_i(e+360*s.left,0,360)})},"aria-label":"Hue","aria-valuenow":ot(e),"aria-valuemax":"360","aria-valuemin":"0"},C.createElement(lw,{className:"react-colorful__hue-pointer",left:e/360,color:Xd({h:e,s:100,v:100,a:1})})))}),j2=C.memo(function(t){var e=t.hsva,n=t.onChange,r={backgroundColor:Xd({h:e.h,s:100,v:100,a:1})};return C.createElement("div",{className:"react-colorful__saturation",style:r},C.createElement(ow,{onMove:function(s){n({s:100*s.left,v:100-100*s.top})},onKey:function(s){n({s:_i(e.s+100*s.left,0,100),v:_i(e.v-100*s.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+ot(e.s)+"%, Brightness "+ot(e.v)+"%"},C.createElement(lw,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:Xd(e)})))}),aw=function(t,e){if(t===e)return!0;for(var n in t)if(t[n]!==e[n])return!1;return!0},P2=function(t,e){return t.toLowerCase()===e.toLowerCase()||aw(Yd(t),Yd(e))};function B2(t,e,n){var r=Gd(n),s=C.useState(function(){return t.toHsva(e)}),i=s[0],o=s[1],l=C.useRef({color:e,hsva:i});C.useEffect(function(){if(!t.equal(e,l.current.color)){var c=t.toHsva(e);l.current={hsva:c,color:e},o(c)}},[e,t]),C.useEffect(function(){var c;aw(i,l.current.hsva)||t.equal(c=t.fromHsva(i),l.current.color)||(l.current={hsva:i,color:c},r(c))},[i,t,r]);var a=C.useCallback(function(c){o(function(d){return Object.assign({},d,c)})},[]);return[i,a]}var $2=typeof window<"u"?C.useLayoutEffect:C.useEffect,H2=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},qm=new Map,z2=function(t){$2(function(){var e=t.current?t.current.ownerDocument:document;if(e!==void 0&&!qm.has(e)){var n=e.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,qm.set(e,n);var r=H2();r&&n.setAttribute("nonce",r),e.head.appendChild(n)}},[])},F2=function(t){var e=t.className,n=t.colorModel,r=t.color,s=r===void 0?n.defaultColor:r,i=t.onChange,o=iw(t,["className","colorModel","color","onChange"]),l=C.useRef(null);z2(l);var a=B2(n,s,i),c=a[0],d=a[1],u=Ah(["react-colorful",e]);return C.createElement("div",Ia({},o,{ref:l,className:u}),C.createElement(j2,{hsva:c,onChange:d}),C.createElement(I2,{hue:c.h,onChange:d,className:"react-colorful__last-control"}))},U2={defaultColor:"000",toHsva:N2,fromHsva:function(t){return _2({h:t.h,s:t.s,v:t.v,a:1})},equal:P2},V2=function(t){return C.createElement(F2,Ia({},t,{colorModel:U2}))};const Km="#1F2937",Gm="#FFF7D1",W2=["#FFF7D1","#FFEAE3","#DCFCE7","#DBEAFE"],q2=[{title:"Brand",colors:[{label:"Primary",value:"hsl(var(--primary))"},{label:"Secondary",value:"hsl(var(--secondary))"},{label:"Accent",value:"hsl(var(--accent))"},{label:"Ring",value:"hsl(var(--ring))"}]},{title:"Neutrals",colors:[{label:"Foreground",value:"hsl(var(--foreground))"},{label:"Muted",value:"hsl(var(--muted-foreground))"},{label:"Background",value:"hsl(var(--background))"},{label:"Card",value:"hsl(var(--card))"}]},{title:"States",colors:[{label:"Warning",value:"hsl(var(--warning))"},{label:"Destructive",value:"hsl(var(--destructive))"},{label:"Success",value:"hsl(var(--chart-2))"},{label:"Info",value:"hsl(var(--chart-5))"}]},{title:"Utility",colors:[{label:"Secondary FG",value:"hsl(var(--secondary-foreground))"},{label:"Accent FG",value:"hsl(var(--accent-foreground))"},{label:"Primary FG",value:"hsl(var(--primary-foreground))"},{label:"Border",value:"hsl(var(--border))"}]}],K2=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,G2=/^#[0-9a-f]{6}$/i,cw=/^rgba?\((\s*\d{1,3}\s*,){2}\s*\d{1,3}\s*(,\s*(0|1|0?\.\d+)\s*)?\)$/i,dw=/^hsla?\((\s*\d{1,3}\s*,)(\s*\d{1,3}%\s*,)\s*\d{1,3}%\s*(,\s*(0|1|0?\.\d+)\s*)?\)$/i;function Yl(t){const e=t.replace("#","").trim();return e.length===3||e.length===4?`#${e.split("").map(r=>r+r).join("").toUpperCase()}`:e.length===6||e.length===8?`#${e.toUpperCase()}`:t}function uw(t){const e=Yl(t).replace("#","");if(e.length!==6&&e.length!==8)return null;const n=parseInt(e.slice(0,2),16),r=parseInt(e.slice(2,4),16),s=parseInt(e.slice(4,6),16),i=e.length===8?parseInt(e.slice(6,8),16)/255:1;return{r:n,g:r,b:s,a:i}}function Zd(t,e,n){return`#${[t,e,n].map(r=>Math.max(0,Math.min(255,Math.round(r))).toString(16).padStart(2,"0")).join("").toUpperCase()}`}function ri(t,e=2){const n=10**e;return Math.round(t*n)/n}function si(t,e,n,r=1){const s=t/255,i=e/255,o=n/255,l=Math.max(s,i,o),a=Math.min(s,i,o);let c=0,d=0;const u=(l+a)/2;if(l!==a){const g=l-a;switch(d=u>.5?g/(2-l-a):g/(l+a),l){case s:c=(i-o)/g+(i<o?6:0);break;case i:c=(o-s)/g+2;break;case o:c=(s-i)/g+4;break}c/=6}const h=Math.round(c*360),f=Math.round(d*100),p=Math.round(u*100);return r!==1?`hsla(${h}, ${f}%, ${p}%, ${ri(r,2)})`:`hsl(${h}, ${f}%, ${p}%)`}function Jm(t){if(typeof window>"u"||typeof document>"u")return null;const e=document.createElement("span");if(e.style.color="",e.style.color=t,!e.style.color)return null;e.style.position="absolute",e.style.visibility="hidden",e.style.pointerEvents="none",document.body.appendChild(e);const n=getComputedStyle(e).color;document.body.removeChild(e);const r=n.match(/rgba?\(([^)]+)\)/i);if(!r)return null;const[s,i,o,l]=r[1].split(",").map(a=>a.trim()).map((a,c)=>c===3?parseFloat(a):parseInt(a,10));return[s,i,o].some(a=>Number.isNaN(a))?null:{r:s,g:i,b:o,a:typeof l=="number"&&!Number.isNaN(l)?l:1}}function Sn(t){if(!t)return null;const e=t.trim();if(K2.test(e)){const r=Yl(e),s=uw(r);if(!s)return null;const i=`#${r.replace("#","").slice(0,6)}`;return{source:r,hex:i,rgb:s.a===1?`rgb(${s.r}, ${s.g}, ${s.b})`:`rgba(${s.r}, ${s.g}, ${s.b}, ${ri(s.a,2)})`,hsl:si(s.r,s.g,s.b,s.a),alpha:s.a}}if(cw.test(e)||dw.test(e)){const r=Jm(e);return r?{source:e,hex:Zd(r.r,r.g,r.b),rgb:r.a===1?`rgb(${r.r}, ${r.g}, ${r.b})`:`rgba(${r.r}, ${r.g}, ${r.b}, ${ri(r.a,2)})`,hsl:si(r.r,r.g,r.b,r.a),alpha:r.a}:null}const n=Jm(e);return n?{source:e,hex:Zd(n.r,n.g,n.b),rgb:n.a===1?`rgb(${n.r}, ${n.g}, ${n.b})`:`rgba(${n.r}, ${n.g}, ${n.b}, ${ri(n.a,2)})`,hsl:si(n.r,n.g,n.b,n.a),alpha:n.a}:null}function hw(t){const e=uw(t);if(e)return{source:Yl(t),hex:Zd(e.r,e.g,e.b),rgb:e.a===1?`rgb(${e.r}, ${e.g}, ${e.b})`:`rgba(${e.r}, ${e.g}, ${e.b}, ${ri(e.a,2)})`,hsl:si(e.r,e.g,e.b,e.a),alpha:e.a};const n=Yl(t);return{source:n,hex:n.slice(0,7),rgb:"rgb(0, 0, 0)",hsl:si(0,0,0,1),alpha:1}}const $s=Sn(Km)??hw(Km),Ym=Sn(Gm)??hw(Gm);function fw({editor:t,className:e,initialMode:n="text"}){const r=C.useRef(null),[s,i]=C.useState(n),[o,l]=C.useState(null),[a,c]=C.useState($s),[d,u]=C.useState(Ym);C.useEffect(()=>{i(n)},[n]);const[h,f]=C.useState($s.hex),[p,g]=C.useState(!1),[y,b]=C.useState($s.rgb),[w,M]=C.useState(!1),[S,A]=C.useState($s.hsl),[x,k]=C.useState(!1),v=s==="text"?a:d;C.useEffect(()=>{const $=()=>{if(o)return;const I=t.getAttributes("textStyle").color,j=t.getAttributes("highlight").color,Q=Sn(I)??$s,ie=Sn(j)??Ym;c(Q),u(ie)};return $(),t.on("selectionUpdate",$),t.on("transaction",$),()=>{t.off("selectionUpdate",$),t.off("transaction",$)}},[t,o,s]),C.useEffect(()=>{o!=="hex"&&f(v.hex),o!=="rgb"&&b(v.rgb),o!=="hsl"&&A(v.hsl),o===null&&(g(!1),M(!1),k(!1))},[v,o]);const T=C.useCallback(($,I,j=!0)=>{const Q=t.chain();j&&Q.focus(),$==="text"?(c(I),Q.setColor(I.source).run()):(u(I),Q.setHighlight({color:I.source}).run())},[t,c,u]),N=C.useCallback(($,I)=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{T($,I,!1)},300)},[T]),H=C.useCallback($=>{r.current&&clearTimeout(r.current);const I=Sn($);I&&(T(s,I,!1),g(!1))},[T,s,g]),V=C.useCallback($=>{r.current&&clearTimeout(r.current);const I=Sn($);I&&(T(s,I),g(!1))},[T,s,g]);return m.jsxs("div",{className:Oe.cn("flex w-full sm:w-auto flex-col gap-3 sm:gap-4",e),children:[m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsxs("div",{className:"inline-flex items-center gap-1 rounded-md bg-muted/60 p-1",children:[m.jsx(le.Button,{type:"button",variant:s==="text"?"default":"ghost",size:"sm",className:"h-7 px-3 text-xs",onClick:()=>i("text"),children:"Text"}),m.jsx(le.Button,{type:"button",variant:s==="highlight"?"default":"ghost",size:"sm",className:"h-7 px-3 text-xs",onClick:()=>i("highlight"),children:"Highlight"})]}),m.jsx("div",{className:"flex items-center",children:m.jsx(le.Button,{type:"button",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>{s==="text"?t.chain().focus().unsetColor().run():t.chain().focus().unsetHighlight().run()},children:"Remove Color"})})]}),m.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:gap-4",children:[m.jsx("div",{className:Um.pickerRoot,children:m.jsx(V2,{color:v.hex,onChange:H,className:Um.picker})}),m.jsxs("div",{className:"flex w-full flex-col gap-2 text-[11px] sm:w-[150px]",children:[m.jsxs("div",{className:"space-y-1",children:[m.jsx("p",{className:"font-medium text-muted-foreground",children:"HEX"}),m.jsx(ns.Input,{value:h,onFocus:()=>l("hex"),onChange:$=>{const I=$.target.value;if(f(I),G2.test(I)){const j=Sn(I);j&&(N(s,j),g(!1))}else g(!0)},onBlur:()=>{l(null),p&&(f(v.hex),g(!1))},spellCheck:!1,className:Oe.cn("h-8 w-full text-xs",p&&"border-destructive focus-visible:ring-destructive")})]}),m.jsxs("div",{className:"space-y-1",children:[m.jsx("p",{className:"font-medium text-muted-foreground",children:"RGB"}),m.jsx(ns.Input,{value:y,onFocus:()=>l("rgb"),onChange:$=>{const I=$.target.value;if(b(I),cw.test(I)){const j=Sn(I);j&&(N(s,j),M(!1))}else M(!0)},onBlur:()=>{l(null),w&&(b(v.rgb),M(!1))},spellCheck:!1,className:Oe.cn("h-8 w-full text-xs",w&&"border-destructive focus-visible:ring-destructive")})]}),m.jsxs("div",{className:"space-y-1",children:[m.jsx("p",{className:"font-medium text-muted-foreground",children:"HSL"}),m.jsx(ns.Input,{value:S,onFocus:()=>l("hsl"),onChange:$=>{const I=$.target.value;if(A(I),dw.test(I)){const j=Sn(I);j&&(N(s,j),k(!1))}else k(!0)},onBlur:()=>{l(null),x&&(A(v.hsl),k(!1))},spellCheck:!1,className:Oe.cn("h-8 w-full text-xs",x&&"border-destructive focus-visible:ring-destructive")})]})]})]}),m.jsxs("div",{className:"space-y-1.5",children:[m.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Theme colors"}),m.jsx("div",{className:"space-y-1",children:q2.map($=>m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsx("span",{className:"w-16 shrink-0 text-[11px] font-medium text-muted-foreground/80",children:$.title}),m.jsx("div",{className:"flex items-center gap-1.5",children:$.colors.map(I=>m.jsx("button",{type:"button",onClick:()=>V(I.value),className:"h-6 w-6 rounded border border-border bg-background shadow-sm transition hover:border-primary/40 hover:shadow-sm",style:{background:I.value},"aria-label":`${$.title} color ${I.label}`,title:`${$.title} color ${I.label}`},I.label))})]},$.title))})]}),s==="highlight"?m.jsxs("div",{className:"space-y-2",children:[m.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Highlight presets"}),m.jsx("div",{className:"flex flex-wrap gap-1.5",children:W2.map($=>m.jsxs("button",{type:"button",onClick:()=>V($),className:"flex items-center gap-1 rounded-full border bg-background px-2 py-1 text-[11px] shadow-sm transition hover:border-primary/40 hover:shadow-sm",children:[m.jsx("span",{className:"h-3.5 w-3.5 rounded-full border",style:{background:$},"aria-hidden":!0}),$]},$))})]}):null]})}const J2=["px","pt","rem","em","%"];function qo(t){if(!t)return null;const n=String(t).trim().match(/^(-?\d*\.?\d+)(px|pt|rem|em|%)$/i);if(!n)return null;const r=parseFloat(n[1]),s=n[2].toLowerCase();return Number.isFinite(r)?{value:r,unit:s}:null}function Qd(t){if(!t)return null;const{value:e,unit:n}=t;return n==="%"?`${Math.max(1,Math.round(e))}%`:n==="px"||n==="pt"?`${Math.max(1,Math.round(e))}${n}`:`${Math.max(.01,Math.round(e*100)/100)}${n}`}function Y2(t){const e=qo(t);return e?Qd(e):null}function X2(){if(typeof document>"u")return[];const t=[];try{const n=Array.from(document.styleSheets),r=[],s=[];for(const l of n){const a=l.href,c=l.ownerNode;`${a||""} ${c?.textContent||""}`.toLowerCase().includes("globals.css")?r.push(l):s.push(l)}const i=[...r,...s],o=new Set(["h1","h2","h3","h4","h5","h6"]);for(const l of i){let a=null;try{a=l.cssRules}catch{continue}if(a){for(const c of Array.from(a))if(c.style){const u=c.style.fontSize,h=c.selectorText;if(u&&h&&o.has(h)){const f=Y2(u)??u.trim();if(f){const p=parseInt(h.replace("h",""),10);t.push({level:p,value:f})}}}}}}catch{}const e=new Map;for(const n of t)e.has(n.level)||e.set(n.level,n.value);return Array.from(e.entries()).map(([n,r])=>({level:n,value:r}))}function Z2(t){if(typeof document>"u")return 0;try{const e=document.createElement("span");e.style.position="absolute",e.style.visibility="hidden",e.style.fontSize=t,document.body.appendChild(e);const n=parseFloat(getComputedStyle(e).fontSize);return document.body.removeChild(e),Number.isFinite(n)?n:0}catch{return 0}}function Xl(){if(typeof document>"u")return 16;try{const t=parseFloat(getComputedStyle(document.documentElement).fontSize);return Number.isFinite(t)&&t>0?t:16}catch{return 16}}function Th(t){try{const e=t.state.selection.from,n=t.view.domAtPos(e),r=n&&n.node||t.view.dom,s=r.nodeType===1?r:t.view.dom,i=parseFloat(getComputedStyle(s).fontSize);return Number.isFinite(i)&&i>0?i:Xl()}catch{return Xl()}}function Q2(t,e,n){const r=Xl(),s=Th(n);switch(e){case"px":return t;case"pt":return t*(96/72);case"rem":return t*r;case"em":return t*s;case"%":return t/100*s}}function ej(t,e,n){const r=Xl(),s=Th(n);switch(e){case"px":return t;case"pt":return t*(72/96);case"rem":return t/r;case"em":return t/s;case"%":return t/s*100}}function pw({editor:t,className:e}){const[n,r]=C.useState([]),[s,i]=C.useState(null),[o,l]=C.useState(""),[a,c]=C.useState("px"),[d,u]=C.useState(!1),h=C.useRef(null),f=C.useCallback(()=>{const S=t.getAttributes("textStyle").fontSize,A=qo(S);if(A)l(String(A.value)),c(A.unit),u(!1);else{if(S&&typeof S=="string"){const x=Z2(S);if(x>0&&!s){l(String(Math.round(x))),c("px"),u(!1);return}}s||(l(""),c("px"),u(!1))}},[t,s]);C.useEffect(()=>{f();const S=()=>f();return t.on("selectionUpdate",S),t.on("transaction",S),()=>{t.off("selectionUpdate",S),t.off("transaction",S)}},[t,f]),C.useEffect(()=>{r(X2())},[]);const p=C.useCallback((S,A=!0)=>{h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{const x=t.chain();A&&x.focus(),x.setFontSize(S).run()},120)},[t]),g=C.useCallback(S=>{l(S);const A=`${S}${a}`,x=qo(A);if(x){u(!1);const k=Qd(x);k&&p(k,!1)}else u(S.trim().length>0)},[a,p]),y=C.useCallback(S=>{const A=a;c(S);let x=0;const k=parseFloat(o);Number.isFinite(k)?x=Q2(k,A,t):x=Th(t);const v=ej(x,S,t);let T;S==="px"||S==="pt"||S==="%"?T=String(Math.round(v)):T=String(Math.max(.01,Math.round(v*100)/100)),l(T);const N=Qd(qo(`${T}${S}`));N&&p(N)},[a,o,t,p]),b=C.useCallback(()=>{h.current&&clearTimeout(h.current),t.chain().focus().unsetFontSize().run(),u(!1)},[t]),w=C.useMemo(()=>a==="px"||a==="pt"||a==="%"?1:.01,[a]),M=C.useMemo(()=>{switch(a){case"%":return"100";case"px":return"16";case"pt":return"12";case"rem":return"1";case"em":return"1";default:return""}},[a]);return m.jsxs("div",{className:Oe.cn("space-y-3",e),onMouseDown:S=>S.stopPropagation(),children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Wr,{className:"h-4 w-4 text-muted-foreground"}),m.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Font size"})]}),m.jsxs(le.Button,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:b,title:"Erase font size","aria-label":"Erase font size",children:[m.jsx(WL,{className:"h-3.5 w-3.5 mr-1"}),"Erase"]})]}),m.jsxs("div",{className:"grid grid-cols-[1fr_auto] gap-2 items-end",children:[m.jsxs("div",{className:"space-y-1",children:[m.jsx("p",{className:"font-medium text-muted-foreground",children:"Value"}),m.jsx(ns.Input,{type:"number",inputMode:"decimal",step:w,placeholder:M,value:o,onFocus:()=>i("value"),onChange:S=>g(S.target.value),onBlur:()=>i(null),className:Oe.cn("h-9",d&&"border-destructive focus-visible:ring-destructive"),spellCheck:!1})]}),m.jsxs("div",{className:"space-y-1",children:[m.jsx("p",{className:"font-medium text-muted-foreground",children:"Unit"}),m.jsx("div",{className:"flex gap-1",children:m.jsx("select",{value:a,onChange:S=>y(S.target.value),onFocus:()=>i("unit"),onBlur:()=>i(null),className:"h-9 w-[84px] rounded-md border border-input bg-background px-2 text-sm shadow-sm outline-none focus-visible:ring-2 focus-visible:ring-ring",children:J2.map(S=>m.jsx("option",{value:S,children:S},S))})})]})]}),m.jsxs("div",{className:"space-y-2",children:[n.length>0?m.jsxs("div",{className:"space-y-1",children:[m.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Headings"}),m.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:n.map(({level:S,value:A})=>m.jsx("button",{type:"button",onClick:()=>p(A),className:"h-8 w-full rounded-md border bg-background px-2 text-xs font-medium shadow-sm transition hover:border-primary/40 hover:shadow-sm",title:`Apply H${S} (${A})`,children:`H${S} (${A})`},`h${S}`))})]}):null,m.jsxs("div",{className:"space-y-1",children:[m.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Keywords"}),m.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:["xx-small","x-small","small","medium","large","x-large"].map(S=>m.jsx("button",{type:"button",onClick:()=>p(S),className:"h-8 w-full rounded-md border bg-background px-2 text-xs font-medium shadow-sm transition hover:border-primary/40 hover:shadow-sm",title:`Apply ${S}`,children:S.replace(/\b\w/g,A=>A.toUpperCase())},S))})]})]})]})}const tj=({editor:t})=>{const[e,n]=C.useState(t.getAttributes("link")?.href??"");C.useEffect(()=>{const s=()=>{n(t.getAttributes("link")?.href??"")};return t.on("selectionUpdate",s),t.on("transaction",s),()=>{t.off("selectionUpdate",s),t.off("transaction",s)}},[t]);const r=()=>{const s=e.trim();s?t.chain().focus().extendMarkRange("link").setLink({href:s}).run():t.chain().focus().extendMarkRange("link").unsetLink().run()};return m.jsxs("div",{className:"p-2 flex items-center gap-2",onMouseDown:s=>s.preventDefault(),children:[m.jsx("input",{type:"url",value:e,onChange:s=>n(s.target.value),placeholder:"Enter URL",className:"bg-background p-1 rounded border border-input text-sm",onKeyDown:s=>s.key==="Enter"&&r()}),m.jsx(le.Button,{type:"button",size:"sm",onClick:r,children:"Set Link"})]})},nj=({editor:t})=>m.jsx("div",{className:"w-[380px]",children:m.jsx(fw,{editor:t,className:"p-4",initialMode:t.isActive("highlight")?"highlight":"text"})}),Nh=({editor:t})=>{const[e,n]=C.useState(!1),[r,s]=C.useState(!1),[i,o]=C.useState(!1),[l,a]=C.useState(!1),{x:c,y:d,refs:u,strategy:h,update:f}=Xi({placement:"top",middleware:[Yi(6),La(),Da()],whileElementsMounted:Ms}),p=C.useCallback(()=>{if(!t||!t.isEditable)return!1;const{state:y}=t,{from:b,to:w}=y.selection,M=b!==w,S=y.selection instanceof q,A=t.isActive("codeBlock"),x=y.selection.empty&&(t.isActive("alert-widget")||t.isActive("cta-widget")),k=t.isActive("image");return M&&!S&&!A&&!x&&!k},[t]),g=C.useCallback(()=>{if(!(!t||!p()))try{const{from:y,to:b}=t.state.selection,w=t.view.coordsAtPos(y),M=t.view.coordsAtPos(b),S={getBoundingClientRect:()=>({x:w.left,y:w.top,top:w.top,left:w.left,bottom:M.bottom,right:M.right,width:M.right-w.left,height:M.bottom-w.top})};u.setReference(S),f(),requestAnimationFrame(()=>s(!0))}catch(y){console.warn("BubbleMenu positioning error:",y)}},[t,u,f,p]);return C.useEffect(()=>{if(!t)return;let y=0;const b=()=>{cancelAnimationFrame(y),y=requestAnimationFrame(()=>{p()?(n(!0),g()):!i&&!l&&n(!1)})},w=({event:M})=>{i||l||u.floating.current&&M.relatedTarget&&u.floating.current.contains(M.relatedTarget)||n(!1)};return b(),t.on("selectionUpdate",b),t.on("transaction",b),t.on("focus",b),t.on("blur",w),()=>{cancelAnimationFrame(y),t.off("selectionUpdate",b),t.off("transaction",b),t.off("focus",b),t.off("blur",w)}},[t,p,g,i,l,u.floating]),!t||!e?null:m.jsxs("div",{ref:u.setFloating,style:{position:h,top:d??0,left:c??0,zIndex:1e4,visibility:r?"visible":"hidden"},className:"flex gap-1 items-center bg-background border rounded-lg p-1 shadow-lg",onMouseDown:y=>y.preventDefault(),children:[m.jsx("button",{type:"button",onClick:()=>t.chain().focus().toggleBold().run(),className:`p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center ${t.isActive("bold")?"bg-accent":""}`,"aria-label":"Bold",title:"Bold",children:m.jsx(Gl,{className:"h-4 w-4 pointer-events-none"})}),m.jsx("button",{type:"button",onClick:()=>t.chain().focus().toggleItalic().run(),className:`p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center ${t.isActive("italic")?"bg-accent":""}`,"aria-label":"Italic",title:"Italic",children:m.jsx(kh,{className:"h-4 w-4 pointer-events-none"})}),m.jsx("button",{type:"button",onClick:()=>t.chain().focus().toggleUnderline().run(),className:`p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center ${t.isActive("underline")?"bg-accent":""}`,"aria-label":"Underline",title:"Underline",children:m.jsx(Ch,{className:"h-4 w-4 pointer-events-none"})}),m.jsx("button",{type:"button",onClick:()=>t.chain().focus().toggleStrike().run(),className:`p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center ${t.isActive("strike")?"bg-accent":""}`,"aria-label":"Strikethrough",title:"Strikethrough",children:m.jsx(Yx,{className:"h-4 w-4 pointer-events-none"})}),m.jsx("button",{type:"button",onClick:()=>t.chain().focus().toggleCode().run(),className:`p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center ${t.isActive("code")?"bg-accent":""}`,"aria-label":"Inline code",title:"Inline code",children:m.jsx(Rs,{className:"h-4 w-4 pointer-events-none"})}),m.jsx("div",{className:"w-px bg-border h-5"}),m.jsx("button",{type:"button",onClick:()=>t.chain().focus().toggleSubscript().run(),className:`p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center ${t.isActive("subscript")?"bg-accent":""}`,"aria-label":"Subscript",title:"Subscript",children:m.jsx(Xx,{className:"h-4 w-4 pointer-events-none"})}),m.jsx("button",{type:"button",onClick:()=>t.chain().focus().toggleSuperscript().run(),className:`p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center ${t.isActive("superscript")?"bg-accent":""}`,"aria-label":"Superscript",title:"Superscript",children:m.jsx(Zx,{className:"h-4 w-4 pointer-events-none"})}),m.jsx("div",{className:"w-px bg-border h-5"}),m.jsx("button",{type:"button",onClick:()=>t.chain().focus().setTextAlign("left").run(),className:`p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center ${t.isActive({textAlign:"left"})?"bg-accent":""}`,"aria-label":"Align left",title:"Align left",children:m.jsx(Ss,{className:"h-4 w-4 pointer-events-none"})}),m.jsx("button",{type:"button",onClick:()=>t.chain().focus().setTextAlign("center").run(),className:`p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center ${t.isActive({textAlign:"center"})?"bg-accent":""}`,"aria-label":"Align center",title:"Align center",children:m.jsx(Ki,{className:"h-4 w-4 pointer-events-none"})}),m.jsx("button",{type:"button",onClick:()=>t.chain().focus().setTextAlign("right").run(),className:`p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center ${t.isActive({textAlign:"right"})?"bg-accent":""}`,"aria-label":"Align right",title:"Align right",children:m.jsx(Gi,{className:"h-4 w-4 pointer-events-none"})}),m.jsx("button",{type:"button",onClick:()=>t.chain().focus().setTextAlign("justify").run(),className:`p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center ${t.isActive({textAlign:"justify"})?"bg-accent":""}`,"aria-label":"Justify",title:"Justify",children:m.jsx(Sh,{className:"h-4 w-4 pointer-events-none"})}),m.jsx("div",{className:"w-px bg-border h-5"}),m.jsxs(gt.Popover,{open:l,onOpenChange:a,children:[m.jsx(gt.PopoverTrigger,{asChild:!0,children:m.jsx("button",{type:"button",className:"p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center","aria-label":"Font size",title:"Font size",onMouseDown:y=>y.preventDefault(),children:m.jsx(Wr,{className:"h-4 w-4 pointer-events-none"})})}),m.jsx(gt.PopoverContent,{onFocusOutside:y=>y.preventDefault(),onMouseDown:y=>y.stopPropagation(),className:"w-[360px] p-0",side:"top",align:"start",children:m.jsx(pw,{editor:t,className:"p-4"})})]}),m.jsxs(gt.Popover,{children:[m.jsx(gt.PopoverTrigger,{asChild:!0,children:m.jsx("button",{type:"button",className:`p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center ${t.isActive("link")?"bg-accent":""}`,"aria-label":"Link",title:"Link",onMouseDown:y=>y.preventDefault(),children:m.jsx(Ta,{className:"h-4 w-4 pointer-events-none"})})}),m.jsx(gt.PopoverContent,{className:"w-auto p-0",side:"top",align:"start",children:m.jsx(tj,{editor:t})})]}),m.jsxs(gt.Popover,{open:i,onOpenChange:o,children:[m.jsx(gt.PopoverTrigger,{asChild:!0,children:m.jsx("button",{type:"button",onMouseDown:y=>y.preventDefault(),className:`p-1.5 rounded hover:bg-accent transition-colors duration-100 flex items-center justify-center ${t.isActive("textStyle")||t.isActive("highlight")?"bg-accent":""}`,"aria-label":"Color / highlight",title:"Color / highlight",children:m.jsx(vh,{className:"h-4 w-4 pointer-events-none"})})}),m.jsx(gt.PopoverContent,{onFocusOutside:y=>y.preventDefault(),onMouseDown:y=>y.stopPropagation(),className:"w-auto p-0",side:"top",align:"start",children:m.jsx(nj,{editor:t})})]}),m.jsx("div",{className:"w-px bg-border h-5"})]})};function Xm(t,e){t.storage.mediaPicker={open:e}}function ja(t){return t.storage?.mediaPicker?.open}const rj=[{title:"Heading 1",icon:m.jsx(vs,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleHeading({level:1}).run()},{title:"Heading 2",icon:m.jsx(Vi,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleHeading({level:2}).run()},{title:"Bullet List",icon:m.jsx(Os,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleBulletList().run()},{title:"Ordered List",icon:m.jsx(Wi,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleOrderedList().run()},{title:"Blockquote",icon:m.jsx(Ji,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleBlockquote().run()},{title:"Code Block",icon:m.jsx(Rs,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleCodeBlock().run()},{title:"Image",icon:m.jsx(zr,{className:"h-4 w-4"}),command:async t=>{const e=ja(t);if(e){const r=await e();r?.src&&t.chain().focus().setImage({src:r.src,alt:r.alt||void 0}).updateAttributes("image",{blurDataURL:r.blurDataURL||void 0}).run();return}const n=window.prompt("URL");n&&t.chain().focus().setImage({src:n}).run()}},{title:"Table",icon:m.jsx(qi,{className:"h-4 w-4"}),command:t=>t.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run()},{title:"Horizontal Rule",icon:m.jsx(_a,{className:"h-4 w-4"}),command:t=>t.chain().focus().setHorizontalRule().run()},{title:"Link",icon:m.jsx(Ta,{className:"h-4 w-4"}),command:t=>{const e=window.prompt("Enter URL:");e&&t.chain().focus().setLink({href:e}).run()}},{title:"CSS Block",icon:m.jsx(Nr,{className:"h-4 w-4"}),command:t=>{const e=window.prompt("Enter CSS (without <style> tags):","/* your styles */");if(e!=null){const n=`<style>${e}</style>`;t.commands.insertContentAt({from:0,to:0},n)}}},{title:"Script Block",icon:m.jsx(Nr,{className:"h-4 w-4"}),command:t=>{const e=window.prompt("Enter JavaScript (without <script> tags):","// your script");if(e!=null){const n=`<script>${e}<\/script>`,r=t.state.doc.content.size;t.commands.insertContentAt(r,n)}}},{title:"DIV Block",icon:m.jsx(Nr,{className:"h-4 w-4"}),command:t=>{const e=window.prompt("Optional class for DIV:",""),n=window.prompt("Optional inline style for DIV:",""),r=window.prompt("Optional content for DIV:","New block"),s=`${e?` class="${e}"`:""}${n?` style="${n}"`:""}`,o=r?`<p>${(l=>l.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"))(r)}</p>`:"<p><br /></p>";t.chain().focus().insertContent(`<div${s}>${o}</div>`).run()}},{title:"Alert Widget",icon:m.jsx(Oa,{className:"h-4 w-4"}),command:t=>{t.chain().focus().setAlertWidget().run()}},{title:"CTA Widget",icon:m.jsx(Na,{className:"h-4 w-4"}),command:t=>{t.chain().focus().setCtaWidget({text:"Learn more",url:"",style:"primary",size:"medium",textAlign:"center"}).run()}}],_h=({editor:t})=>{const[e,n]=C.useState(!1),[r,s]=C.useState(null),[i,o]=C.useState(null),l=C.useRef(null),a=C.useRef(null),c=C.useRef(!1),d=C.useCallback(()=>{l.current&&l.current.setAttribute("aria-expanded","false"),a.current&&a.current.removeAttribute("data-menu-open"),l.current=null,a.current=null,s(null),n(!1)},[]),{x:u,y:h,refs:f,strategy:p}=Xi({placement:"right-start",open:e,middleware:[Yi(8),La(),Da()],whileElementsMounted:Ms});C.useEffect(()=>{c.current=e},[e]),C.useEffect(()=>{r?f.setReference(r):f.setReference(null)},[r,f]);const g=C.useCallback(()=>!(!t||!t.isEditable||t.isActive("image")),[t]);C.useEffect(()=>{if(!t)return;const b=t.view.dom.parentElement;if(!b)return;const w=M=>{const S=M,{handle:A,button:x}=S.detail;try{const v=t.state.selection?.$from;if(v){let T=v.depth;for(;T>0&&!v.node(T)?.isBlock;)T-=1;const N=typeof v.after=="function"?v.after(T):void 0;typeof N=="number"?o(N):typeof v.pos=="number"?o(v.pos):o(null)}else o(null)}catch{o(null)}if(l.current===x&&c.current){d();return}l.current&&l.current!==x&&l.current.setAttribute("aria-expanded","false"),a.current&&a.current!==A&&a.current.removeAttribute("data-menu-open"),l.current=x,a.current=A,x.setAttribute("aria-expanded","true"),A.setAttribute("data-menu-open","true"),s(x),n(!0)};return b.addEventListener("tiptap-gutter-toggle",w),()=>{b.removeEventListener("tiptap-gutter-toggle",w)}},[t,g,d]),C.useEffect(()=>{if(!t)return;const b=()=>{g()||d()};return t.on("selectionUpdate",b),t.on("transaction",b),t.on("blur",d),()=>{t.off("selectionUpdate",b),t.off("transaction",b),t.off("blur",d)}},[t,g,d]),C.useEffect(()=>{if(!e)return;const b=M=>{const S=M.target,A=f.floating.current;if(A&&!A.contains(S)){const x=l.current;(!x||!x.contains(S))&&d()}},w=M=>{M.key==="Escape"&&d()};return document.addEventListener("mousedown",b),document.addEventListener("keydown",w),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",w)}},[e,d,f]);const y=b=>{i!=null?t.chain().focus().insertContentAt(i,{type:"paragraph"}).setTextSelection(i+1).run():t.chain().focus().run(),b(t),d()};return!r||!e?null:m.jsx("div",{ref:f.setFloating,style:{position:p,top:h??0,left:u??0,zIndex:10001},className:"w-48 rounded-md bg-white p-1 shadow-lg max-h-[400px] overflow-auto",onMouseDown:b=>b.preventDefault(),children:m.jsx("div",{className:"flex flex-col",children:rj.map(b=>m.jsxs(le.Button,{type:"button",variant:"ghost",className:"justify-start",onClick:()=>y(b.command),children:[b.icon,m.jsx("span",{className:"ml-2",children:b.title})]},b.title))})})},sj=[{title:"Text",description:"Start writing with plain text",icon:m.jsx(Wr,{className:"h-4 w-4"}),command:t=>t.chain().focus().clearNodes().run(),category:"basic",keywords:["text","paragraph","plain"]},{title:"Heading 1",description:"Large section heading",icon:m.jsx(vs,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleHeading({level:1}).run(),category:"headings",keywords:["heading","h1","title","large"]},{title:"Heading 2",description:"Medium section heading",icon:m.jsx(Vi,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleHeading({level:2}).run(),category:"headings",keywords:["heading","h2","subtitle","medium"]},{title:"Heading 3",description:"Small section heading",icon:m.jsx(Aa,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleHeading({level:3}).run(),category:"headings",keywords:["heading","h3","small"]},{title:"Bullet List",description:"Create a simple bulleted list",icon:m.jsx(Os,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleBulletList().run(),category:"lists",keywords:["bullet","list","unordered","ul"]},{title:"Numbered List",description:"Create a list with numbering",icon:m.jsx(Wi,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleOrderedList().run(),category:"lists",keywords:["numbered","list","ordered","ol"]},{title:"Task List",description:"Create a list with checkboxes",icon:m.jsx(Ra,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleTaskList().run(),category:"lists",keywords:["task","todo","checkbox","checklist"]},{title:"Image",description:"Insert an image",icon:m.jsx(zr,{className:"h-4 w-4"}),command:async t=>{const e=ja(t);if(e){const r=await e();r?.src&&t.chain().focus().setImage({src:r.src,alt:r.alt||void 0}).updateAttributes("image",{blurDataURL:r.blurDataURL||void 0}).run();return}const n=window.prompt("Enter image URL:");n&&t.chain().focus().setImage({src:n}).run()},category:"media",keywords:["image","picture","photo","img"]},{title:"Video",description:"Embed a video from URL",icon:m.jsx(ew,{className:"h-4 w-4"}),command:t=>{const e=window.prompt("Enter video URL (YouTube, Vimeo, etc.):");e&&t.chain().focus().insertContent(`<p><a href="${e}" target="_blank">Video: ${e}</a></p>`).run()},category:"media",keywords:["video","youtube","vimeo","embed"]},{title:"Blockquote",description:"Create a quote or citation",icon:m.jsx(Ji,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleBlockquote().run(),category:"advanced",keywords:["quote","blockquote","citation"]},{title:"Code Block",description:"Create a code block with syntax highlighting",icon:m.jsx(Rs,{className:"h-4 w-4"}),command:t=>t.chain().focus().toggleCodeBlock().run(),category:"advanced",keywords:["code","programming","syntax","block"]},{title:"Table",description:"Insert a table with rows and columns",icon:m.jsx(qi,{className:"h-4 w-4"}),command:t=>t.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),category:"advanced",keywords:["table","grid","rows","columns"]},{title:"Horizontal Rule",description:"Insert a horizontal divider",icon:m.jsx(_a,{className:"h-4 w-4"}),command:t=>t.chain().focus().setHorizontalRule().run(),category:"advanced",keywords:["divider","separator","line","hr"]},{title:"Alert",description:"Insert an alert or notice",icon:m.jsx(Oa,{className:"h-4 w-4"}),command:t=>{t.can().setAlertWidget()?t.chain().focus().setAlertWidget().run():t.chain().focus().toggleBlockquote().run()},category:"advanced",keywords:["alert","notice","warning","info"]},{title:"Call to Action",description:"Insert a call to action button",icon:m.jsx(Na,{className:"h-4 w-4"}),command:t=>{t.can().setCtaWidget()?t.chain().focus().setCtaWidget({text:"Click me",url:"#",style:"primary",size:"medium",textAlign:"center"}).run():t.chain().focus().insertContent("Call to Action").run()},category:"advanced",keywords:["cta","button","action","link"]}],Zm={basic:m.jsx(Wr,{className:"h-3 w-3"}),headings:m.jsx(XL,{className:"h-3 w-3"}),lists:m.jsx(Os,{className:"h-3 w-3"}),media:m.jsx(zr,{className:"h-3 w-3"}),advanced:m.jsx(PI,{className:"h-3 w-3"})},Qm={basic:"Basic",headings:"Headings",lists:"Lists",media:"Media",advanced:"Advanced"},mw=({editor:t,wrapperRef:e})=>{const[n,r]=C.useState(!1),[s,i]=C.useState(!1),[o,l]=C.useState(!1),[a,c]=C.useState(""),[d,u]=C.useState("all"),[h,f]=C.useState({top:-9999,left:-9999,width:0}),{x:p,y:g,refs:y,strategy:b,update:w}=Xi({placement:"bottom-start",open:n,onOpenChange:r,middleware:[Yi(10),La({fallbackPlacements:["top-start","bottom-start","right-start"]}),Da({padding:8}),p2({apply({availableWidth:v,availableHeight:T,elements:N}){Object.assign(N.floating.style,{maxWidth:`${Math.min(400,v-16)}px`,maxHeight:`${Math.min(500,T-16)}px`})}})],whileElementsMounted:Ms}),M=C.useCallback(()=>{const{$from:v}=t.state.selection,T=v.parent;if(T.type.name==="paragraph"&&T.content.size===0||T.type.name==="heading"&&T.content.size===0)return!0;if(T.type.name==="listItem"&&T.content.size===1){const N=T.firstChild;if(N&&N.type.name==="paragraph"&&N.content.size===0)return!0}return t.isEditable},[t]),S=C.useCallback(()=>{if(!e?.current)return;const v=e.current.getBoundingClientRect(),T=t.view.dom.getBoundingClientRect(),H=t.view.coordsAtPos(t.state.selection.from).top-v.top,V=T.left-v.left,$=T.width;f({top:H,left:V,width:$}),w(),requestAnimationFrame(()=>l(!0))},[t,w,e]);C.useEffect(()=>{if(!t)return;let v=0;const T=()=>{cancelAnimationFrame(v),v=requestAnimationFrame(()=>{M()?(i(!0),l(!1),S()):(i(!1),r(!1),l(!1))})},N=()=>{i(!1),r(!1),l(!1)};return T(),t.on("selectionUpdate",T),t.on("transaction",T),t.on("focus",T),t.on("blur",N),()=>{cancelAnimationFrame(v),t.off("selectionUpdate",T),t.off("transaction",T),t.off("focus",T),t.off("blur",N)}},[t,M,S]);const A=v=>{v(t),r(!1),c(""),u("all")},x=sj.filter(v=>{const T=d==="all"||v.category===d,N=a===""||v.title.toLowerCase().includes(a.toLowerCase())||v.description.toLowerCase().includes(a.toLowerCase())||v.keywords.some(H=>H.toLowerCase().includes(a.toLowerCase()));return T&&N}),k=x.reduce((v,T)=>(v[T.category]||(v[T.category]=[]),v[T.category].push(T),v),{});return s?m.jsxs(m.Fragment,{children:[m.jsx("div",{style:{position:"absolute",top:h.top,left:h.left,width:h.width,visibility:o?"visible":"hidden",zIndex:1e4},className:"group",children:m.jsxs("div",{className:"relative py-4 w-[95%] mx-auto flex items-center","aria-label":"Insert block",children:[m.jsx("div",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-full h-0.5 bg-gradient-to-r from-transparent via-slate-300 to-transparent dark:via-slate-600 transform origin-center scale-x-0 opacity-0 group-hover:scale-x-100 group-hover:opacity-100 transition-all duration-300"}),m.jsxs("div",{ref:y.setReference,className:"relative z-10 cursor-pointer mx-auto",onClick:()=>r(v=>!v),children:[m.jsx("div",{className:"absolute -inset-3 rounded-full bg-primary/10 dark:bg-primary/20 scale-0 opacity-0 group-hover:scale-100 group-hover:opacity-100 transition-all duration-300 ease-out animate-pulse"}),m.jsx("div",{className:"relative bg-background border border-border p-1.5 rounded-full shadow-sm group-hover:shadow-md transition-all duration-200",children:m.jsx(LL,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors duration-200"})})]})]})}),n&&m.jsxs("div",{ref:y.setFloating,style:{position:b,top:g??0,left:p??0,zIndex:10001},className:"bg-background border border-border shadow-lg rounded-lg p-2 w-96 max-h-[500px] overflow-hidden",onMouseDown:v=>v.preventDefault(),children:[m.jsx("div",{className:"p-2 border-b border-border",children:m.jsx("input",{type:"text",placeholder:"Search blocks...",value:a,onChange:v=>c(v.target.value),className:"w-full px-3 py-2 text-sm bg-muted border border-input rounded-md focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent",autoFocus:!0})}),m.jsxs("div",{className:"flex gap-1 p-2 border-b border-border overflow-x-auto",children:[m.jsx(le.Button,{variant:d==="all"?"default":"ghost",size:"sm",onClick:()=>u("all"),className:"text-xs whitespace-nowrap",children:"All"}),Object.entries(Qm).map(([v,T])=>m.jsxs(le.Button,{variant:d===v?"default":"ghost",size:"sm",onClick:()=>u(v),className:"text-xs whitespace-nowrap flex items-center gap-1",children:[Zm[v],T]},v))]}),m.jsxs("div",{className:"max-h-80 overflow-y-auto",children:[d==="all"?Object.entries(k).map(([v,T])=>m.jsxs("div",{className:"py-2",children:[m.jsxs("div",{className:"px-3 py-1 text-xs font-medium text-muted-foreground uppercase tracking-wide flex items-center gap-2",children:[Zm[v],Qm[v]]}),T.map(N=>m.jsx(le.Button,{variant:"ghost",className:"w-full justify-start p-3 h-auto text-left",onClick:()=>A(N.command),children:m.jsxs("div",{className:"flex items-center gap-3 w-full",children:[m.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-md border bg-muted",children:N.icon}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("p",{className:"font-medium text-sm",children:N.title}),m.jsx("p",{className:"text-xs text-muted-foreground truncate",children:N.description})]})]})},N.title))]},v)):x.map(v=>m.jsx(le.Button,{variant:"ghost",className:"w-full justify-start p-3 h-auto text-left",onClick:()=>A(v.command),children:m.jsxs("div",{className:"flex items-center gap-3 w-full",children:[m.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-md border bg-muted",children:v.icon}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("p",{className:"font-medium text-sm",children:v.title}),m.jsx("p",{className:"text-xs text-muted-foreground truncate",children:v.description})]})]})},v.title)),x.length===0&&m.jsxs("div",{className:"p-4 text-center text-sm text-muted-foreground",children:['No blocks found for "',a,'"']})]})]})]}):null},ij=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),eg=new Set(["address","article","aside","blockquote","canvas","dd","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","li","main","nav","noscript","ol","p","pre","section","table","tfoot","ul","video","thead","tbody","tr","th","td","colgroup"]);function gw(t){const e=t.match(/^<\/?\s*([a-zA-Z0-9:-]+)/);return e?e[1].toLowerCase():null}function oj(t){return/^<\s*[^/!][^>]*>$/.test(t)}function tg(t){return/^<\s*\//.test(t)}function lj(t){if(/\/\s*>$/.test(t))return!0;const e=gw(t);return e?ij.has(e):!1}function aj(t){return/^<\s*!/.test(t)}function $c(t,e=2){if(!t)return"";const n=t.replace(/\r\n?/g,`
|
|
490
152
|
`).split(/(<[^>]+>)/g).filter(Boolean),r=" ".repeat(e);let s=0;const i=[];let o=null;for(let l=0;l<n.length;l++){const a=n[l];if(a.startsWith("<")){const c=gw(a);c&&(c==="pre"||c==="code"||c==="script"||c==="style")&&tg(a)&&(o=null),tg(a)&&s>0&&(s-=1);const d=c&&eg.has(c)||aj(a),u=`${d?r.repeat(s):""}${a.trim()}`;if(d)i.push(u);else{const h=i.length?i[i.length-1]:"";h&&!h.endsWith(`
|
|
491
153
|
`)?i[i.length-1]=h+a.trim():i.push(r.repeat(s)+a.trim())}c&&oj(a)&&!lj(a)&&eg.has(c)&&(s+=1,(c==="pre"||c==="code"||c==="script"||c==="style")&&(o=c))}else if(o){const c=a.split(`
|
|
492
154
|
`);for(const d of c)i.push(d)}else{const c=a.replace(/\s+/g," ");if(c.length>0){const d=i.length?i[i.length-1]:"";if(d&&!d.endsWith(`
|