axiom-editor 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +127 -0
- package/dist/axiom-editor.cjs +9 -216
- package/dist/axiom-editor.es.js +1180 -38469
- package/dist/style.css +1 -1
- package/package.json +3 -2
package/dist/axiom-editor.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react"),I=require("@tiptap/react"),ue=require("@tiptap/starter-kit"),ne=require("lowlight"),me=require("@tiptap/extension-code-block-lowlight"),xe=require("@tiptap/extension-task-list"),fe=require("@tiptap/extension-task-item"),pe=require("@tiptap/extension-text-style"),he=require("@tiptap/extension-color"),be=require("@tiptap/extension-text-align"),ge=require("@tiptap/extension-link"),ae=require("dompurify"),we=require("@tiptap/extension-character-count"),L=require("@tiptap/core"),d=require("lucide-react"),ve=require("@tiptap/extension-youtube"),je=require("@tiptap/suggestion"),Ne=require("tippy.js"),ye=require("tiptap-extension-global-drag-handle"),ke=require("@tiptap/extension-underline"),Ce=require("@tiptap/extension-strike");var G={exports:{}},F={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var re;function Ee(){if(re)return F;re=1;var t=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function o(r,h,f){var j=null;if(f!==void 0&&(j=""+f),h.key!==void 0&&(j=""+h.key),"key"in h){f={};for(var i in h)i!=="key"&&(f[i]=h[i])}else f=h;return h=f.ref,{$$typeof:t,type:r,key:j,ref:h!==void 0?h:null,props:f}}return F.Fragment=s,F.jsx=o,F.jsxs=o,F}var V={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,221 +14,14 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var oe;function De(){return oe||(oe=1,process.env.NODE_ENV!=="production"&&function(){function t(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===U?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case p:return"Fragment";case S:return"Profiler";case k:return"StrictMode";case $:return"Suspense";case m:return"SuspenseList";case _:return"Activity"}if(typeof n=="object")switch(typeof n.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),n.$$typeof){case D:return"Portal";case a:return n.displayName||"Context";case T:return(n._context.displayName||"Context")+".Consumer";case u:var v=n.render;return n=n.displayName,n||(n=v.displayName||v.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case P:return v=n.displayName||null,v!==null?v:t(n.type)||"Memo";case l:v=n._payload,n=n._init;try{return t(n(v))}catch{}}return null}function s(n){return""+n}function o(n){try{s(n);var v=!1}catch{v=!0}if(v){v=console;var M=v.error,R=typeof Symbol=="function"&&Symbol.toStringTag&&n[Symbol.toStringTag]||n.constructor.name||"Object";return M.call(v,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",R),s(n)}}function r(n){if(n===p)return"<>";if(typeof n=="object"&&n!==null&&n.$$typeof===l)return"<...>";try{var v=t(n);return v?"<"+v+">":"<...>"}catch{return"<...>"}}function h(){var n=O.A;return n===null?null:n.getOwner()}function f(){return Error("react-stack-top-frame")}function j(n){if(q.call(n,"key")){var v=Object.getOwnPropertyDescriptor(n,"key").get;if(v&&v.isReactWarning)return!1}return n.key!==void 0}function i(n,v){function M(){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)",v))}M.isReactWarning=!0,Object.defineProperty(n,"key",{get:M,configurable:!0})}function c(){var n=t(this.type);return Z[n]||(Z[n]=!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.")),n=this.props.ref,n!==void 0?n:null}function w(n,v,M,R,B,K){var A=M.ref;return n={$$typeof:b,type:n,key:v,props:M,_owner:R},(A!==void 0?A:null)!==null?Object.defineProperty(n,"ref",{enumerable:!1,get:c}):Object.defineProperty(n,"ref",{enumerable:!1,value:null}),n._store={},Object.defineProperty(n._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(n,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(n,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:B}),Object.defineProperty(n,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:K}),Object.freeze&&(Object.freeze(n.props),Object.freeze(n)),n}function N(n,v,M,R,B,K){var A=v.children;if(A!==void 0)if(R)if(W(A)){for(R=0;R<A.length;R++)y(A[R]);Object.freeze&&Object.freeze(A)}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 y(A);if(q.call(v,"key")){A=t(n);var H=Object.keys(v).filter(function(de){return de!=="key"});R=0<H.length?"{key: someKey, "+H.join(": ..., ")+": ...}":"{key: someKey}",se[A+R]||(H=0<H.length?"{"+H.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,ne,fe,ie,fe),Q[fe+ne]=!0)}if(fe=null,se!==void 0&&(n(se),fe=""+se),o(z)&&(n(z.key),fe=""+z.key),"key"in z){se={};for(var $e in z)$e!=="key"&&(se[$e]=z[$e])}else se=z;return fe&&a(se,typeof A=="function"?A.displayName||A.name||"Unknown":A),c(A,fe,se,i(),de,oe)}function d(A){p(A)?A._store&&(A._store.validated=1):typeof A=="object"&&A!==null&&A.$$typeof===N&&(A._payload.status==="fulfilled"?p(A._payload.value)&&A._payload.value._store&&(A._payload.value._store.validated=1):A._store&&(A._store.validated=1))}function p(A){return typeof A=="object"&&A!==null&&A.$$typeof===h}var f=W,h=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),b=Symbol.for("react.context"),x=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),N=Symbol.for("react.lazy"),O=Symbol.for("react.activity"),j=Symbol.for("react.client.reference"),V=f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=Object.prototype.hasOwnProperty,B=Array.isArray,H=console.createTask?console.createTask:function(){return null};f={react_stack_bottom_frame:function(A){return A()}};var _,D={},L=f.react_stack_bottom_frame.bind(f,s)(),I=H(r(s)),Q={};bi.Fragment=g,bi.jsx=function(A,z,se){var ne=1e4>V.recentlyCreatedOwnerStacks++;return u(A,z,se,!1,ne?Error("react-stack-top-frame"):L,ne?H(r(A)):I)},bi.jsxs=function(A,z,se){var ne=1e4>V.recentlyCreatedOwnerStacks++;return u(A,z,se,!0,ne?Error("react-stack-top-frame"):L,ne?H(r(A)):I)}}()),bi}process.env.NODE_ENV==="production"?Al.exports=iy():Al.exports=sy();var E=Al.exports,Cl={exports:{}},La={};/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
*
|
|
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 zu;function oy(){if(zu)return La;zu=1;var t=W;function e(d,p){return d===p&&(d!==0||1/d===1/p)||d!==d&&p!==p}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,o=t.useDebugValue;function a(d,p){var f=p(),h=r({inst:{value:f,getSnapshot:p}}),m=h[0].inst,g=h[1];return s(function(){m.value=f,m.getSnapshot=p,l(m)&&g({inst:m})},[d,f,p]),i(function(){return l(m)&&g({inst:m}),d(function(){l(m)&&g({inst:m})})},[d]),o(f),f}function l(d){var p=d.getSnapshot;d=d.value;try{var f=p();return!n(d,f)}catch{return!0}}function c(d,p){return p()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return La.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,La}var Pa={};/**
|
|
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 $u;function ay(){return $u||($u=1,process.env.NODE_ENV!=="production"&&function(){function t(f,h){return f===h&&(f!==0||1/f===1/h)||f!==f&&h!==h}function e(f,h){u||i.startTransition===void 0||(u=!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 m=h();if(!d){var g=h();s(m,g)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}g=o({inst:{value:m,getSnapshot:h}});var y=g[0].inst,w=g[1];return l(function(){y.value=m,y.getSnapshot=h,n(y)&&w({inst:y})},[f,m,h]),a(function(){return n(y)&&w({inst:y}),f(function(){n(y)&&w({inst:y})})},[f]),c(m),m}function n(f){var h=f.getSnapshot;f=f.value;try{var m=h();return!s(f,m)}catch{return!0}}function r(f,h){return h()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var i=W,s=typeof Object.is=="function"?Object.is:t,o=i.useState,a=i.useEffect,l=i.useLayoutEffect,c=i.useDebugValue,u=!1,d=!1,p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:e;Pa.useSyncExternalStore=i.useSyncExternalStore!==void 0?i.useSyncExternalStore:p,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Pa}process.env.NODE_ENV==="production"?Cl.exports=oy():Cl.exports=ay();var pa=Cl.exports;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,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new rt(s)},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),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new rt(i)},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 Ap(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)n++;return n}if(i.content.size||s.content.size){let o=Ap(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function Cp(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let o=t.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){n-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let c=0,u=Math.min(o.text.length,a.text.length);for(;c<u&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(o.content.size||a.content.size){let c=Cp(o.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}let F=class ht{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,i=0,s){for(let o=0,a=0;a<n;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,i+a,s||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new ht(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,o=0;o<n;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),i+=a.nodeSize),o=l}return new ht(r,i)}cutByIndex(e,n){return e==n?ht.empty:e==0&&n==this.content.length?this:new ht(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new ht(i,s)}addToStart(e){return new ht([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ht(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 i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return Ap(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Cp(this,e,n,r)}findIndex(e){if(e==0)return Ls(0,e);if(e==this.size)return Ls(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 i=this.child(n),s=r+i.nodeSize;if(s>=e)return s==e?Ls(n+1,s):Ls(n,r);r=s}}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 ht.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return ht.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ht.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new ht(n||e,r)}static from(e){if(!e)return ht.empty;if(e instanceof ht)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new ht([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};F.empty=new F([],0);const Ba={index:0,offset:0};function Ls(t,e){return Ba.index=t,Ba.offset=e,Ba}function vo(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(!vo(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!vo(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let _e=class Ml{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}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&&vo(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 i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}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 Ml.none;if(e instanceof Ml)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};_e.none=[];let xo=class extends Error{},G=class Pr{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=Op(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new Pr(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Pr(Mp(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 Pr.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Pr(F.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new Pr(e,r,i)}};G.empty=new G(F.empty,0,0);function Mp(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(i==e||s.isText){if(a!=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,s.copy(Mp(s.content,e-i-1,n-i-1)))}function Op(t,e,n,r,i,s){let{index:o,offset:a}=t.findIndex(e),l=t.maybeChild(o);if(a==e||l.isText)return s&&r<=0&&i<=0&&!s.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=Op(l.content,e-a-1,n,o==0?r-1:0,o==t.childCount-1?i-1:0,l);return c&&t.replaceChild(o,l.copy(c))}function ly(t,e,n){if(n.openStart>t.depth)throw new xo("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new xo("Inconsistent open depths");return Rp(t,e,n,0)}function Rp(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let o=Rp(t,e,n,r+1);return s.copy(s.content.replaceChild(i,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,a=o.content;return lr(o,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=cy(n,t);return lr(s,Dp(t,o,a,e,r))}else return lr(s,wo(t,e,r))}function Ip(t,e){if(!e.type.compatibleContent(t.type))throw new xo("Cannot join "+e.type.name+" onto "+t.type.name)}function Ol(t,e,n){let r=t.node(n);return Ip(r,e.node(n)),r}function ar(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 ji(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(ar(t.nodeAfter,r),s++));for(let a=s;a<o;a++)ar(i.child(a),r);e&&e.depth==n&&e.textOffset&&ar(e.nodeBefore,r)}function lr(t,e){return t.type.checkContent(e),t.copy(e)}function Dp(t,e,n,r,i){let s=t.depth>i&&Ol(t,e,i+1),o=r.depth>i&&Ol(n,r,i+1),a=[];return ji(null,t,i,a),s&&o&&e.index(i)==n.index(i)?(Ip(s,o),ar(lr(s,Dp(t,e,n,r,i+1)),a)):(s&&ar(lr(s,wo(t,e,i+1)),a),ji(e,n,i,a),o&&ar(lr(o,wo(n,r,i+1)),a)),ji(r,null,i,a),new F(a)}function wo(t,e,n){let r=[];if(ji(null,t,n,r),t.depth>n){let i=Ol(t,e,n+1);ar(lr(i,wo(t,e,n+1)),r)}return ji(e,null,n,r),new F(r)}function cy(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(F.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class is{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],i=e.child(n);return r?e.child(n).cut(r):i}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],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return _e.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let a=r;r=i,i=a}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].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 So(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=[],i=0,s=n;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),c=s-l;if(r.push(o,a,i+l),!c||(o=o.child(a),o.isText))break;s=c-1,i+=l+1}return new is(n,r,s)}static resolveCached(e,n){let r=Uu.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==n)return o}else Uu.set(e,r=new uy);let i=r.elts[r.i]=is.resolve(e,n);return r.i=(r.i+1)%dy,i}}class uy{constructor(){this.elts=[],this.i=0}}const dy=12,Uu=new WeakMap;class So{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 fy=Object.create(null);class Qt{constructor(e,n,r,i=_e.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||F.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,i=0){this.content.nodesBetween(e,n,r,i,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,i){return this.content.textBetween(e,n,r,i)}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&&vo(this.attrs,n||e.defaultAttrs||fy)&&_e.sameSet(this.marks,r||_e.none)}copy(e=null){return e==this.content?this:new Qt(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Qt(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 G.empty;let i=this.resolve(e),s=this.resolve(n),o=r?0:i.sharedDepth(n),a=i.start(o),c=i.node(o).content.cut(i.pos-a,s.pos-a);return new G(c,i.depth-o,s.depth-o)}replace(e,n,r){return ly(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+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 i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return is.resolveCached(this,e)}resolveNoCache(e){return is.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}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()+")"),Lp(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=F.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.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=_e.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(!_e.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 i=F.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}}Qt.prototype.text=void 0;class ko extends Qt{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Lp(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 ko(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ko(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 Lp(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class hr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new py(e,n);if(r.next==null)return hr.empty;let i=Pp(r);r.next&&r.err("Unexpected trailing text");let s=vy(Ey(i));return xy(s,r),s}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 i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}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 i=[this];function s(o,a){let l=o.matchFragment(e,r);if(l&&(!n||l.validEnd))return F.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let p=s(d,a.concat(u));if(p)return p}}return null}return s(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 i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),n[a.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 i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
|
|
39
|
-
`)}}hr.empty=new hr(!0);class py{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 Pp(t){let e=[];do e.push(hy(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function hy(t){let e=[];do e.push(my(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function my(t){let e=yy(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=gy(t,e);else break;return e}function Hu(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function gy(t,e){let n=Hu(t),r=n;return t.eat(",")&&(t.next!="}"?r=Hu(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function by(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let o=n[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function yy(t){if(t.eat("(")){let e=Pp(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=by(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 Ey(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(s(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=s(o.exprs[l],a);if(l==o.exprs.length-1)return c;i(c,a=n())}else if(o.type=="star"){let l=n();return r(a,l),i(s(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=n();return i(s(o.expr,a),l),i(s(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let u=n();i(s(o.expr,l),u),l=u}if(o.max==-1)i(s(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let u=n();r(l,u),i(s(o.expr,l),u),l=u}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Bp(t,e){return e-t}function ju(t,e){let n=[];return r(e),n.sort(Bp);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let o=0;o<s.length;o++){let{term:a,to:l}=s[o];!a&&n.indexOf(l)==-1&&r(l)}}}function vy(t){let e=Object.create(null);return n(ju(t,0));function n(r){let i=[];r.forEach(o=>{t[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<i.length;u++)i[u][0]==a&&(c=i[u][1]);ju(t,l).forEach(u=>{c||i.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new hr(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(Bp);s.next.push({type:i[o][0],next:e[a.join(",")]||n(a)})}return s}}function xy(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];o.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Fp(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 zp(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let s=t[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function $p(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let s=t[i];s.validate&&s.validate(e[i])}}function Up(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new Sy(t,r,e[r]);return n}let Vu=class Hp{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=Up(e,r.attrs),this.defaultAttrs=Fp(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==hr.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:zp(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Qt(this,this.computeAttrs(e),F.from(n),_e.setFrom(r))}createChecked(e=null,n,r){return n=F.from(n),this.checkContent(n),new Qt(this,this.computeAttrs(e),n,_e.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=F.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(F.empty,!0);return s?new Qt(this,e,n.append(s),_e.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){$p(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:_e.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,o)=>r[s]=new Hp(s,n,o));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function wy(t,e,n){let r=n.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class Sy{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?wy(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class ha{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=Up(e,i.attrs),this.excluded=null;let s=Fp(this.attrs);this.instance=s?new _e(this,s):null}create(e=null){return!e&&this.instance?this.instance:new _e(this,zp(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new ha(s,i++,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){$p(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class jp{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=rt.from(e.nodes),n.marks=rt.from(e.marks||{}),this.nodes=Vu.compile(this.spec.nodes,this),this.marks=ha.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=hr.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?Wu(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:Wu(this,o.split(" "))}this.nodeFromJSON=i=>Qt.fromJSON(this,i),this.markFromJSON=i=>_e.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Vu){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,i)}text(e,n){let r=this.nodes.text;return new ko(r,r.defaultAttrs,e,_e.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 Wu(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],o=s;if(s)n.push(s);else for(let a in t.marks){let l=t.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function ky(t){return t.tag!=null}function Ty(t){return t.style!=null}class zn{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(ky(i))this.tags.push(i);else if(Ty(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new qu(this,n,!1);return r.addAll(e,_e.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new qu(this,n,!0);return r.addAll(e,_e.none,n.from,n.to),G.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(Ay(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(o.getAttrs){let l=o.getAttrs(n);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<n.length;o++){let a=n[o];if((a.priority==null?50:a.priority)<s)break}n.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=Gu(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=Gu(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new zn(e,zn.schemaRules(e)))}}const Vp={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},Ny={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Wp={ol:!0,ul:!0},ss=1,Rl=2,Vi=4;function Ku(t,e,n){return e!=null?(e?ss:0)|(e==="full"?Rl:0):t&&t.whitespace=="pre"?ss|Rl:n&~Vi}class Ps{constructor(e,n,r,i,s,o){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=_e.none,this.match=s||(o&Vi?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(F.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ss)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let n=F.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(F.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&&!Vp.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class qu{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,o=Ku(null,n.preserveWhitespace,0)|(r?Vi:0);i?s=new Ps(i.type,i.attrs,_e.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new Ps(null,null,_e.none,!0,null,o):s=new Ps(e.schema.topNodeType,null,_e.none,!0,null,o),this.nodes=[s],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,i=this.top,s=i.options&Rl?"full":this.localPreserveWS||(i.options&ss)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
|
|
40
|
-
`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(o.text(a[l]),n,!/\S/.test(a[l]));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 a=i.content[i.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.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 i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;Wp.hasOwnProperty(o)&&this.parser.normalizeLists&&_y(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:Ny.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,u=this.needsBlock;if(Vp.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(s),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
41
|
-
`),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 i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(s,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,i){let s,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 l=this.enter(o,n.attrs||null,r,n.preserveWhitespace);l&&(s=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}s&&this.sync(a)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],c=l.findWrapping(e);if(c&&(!i||i.length>c.length+a)&&(i=c,s=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)n=this.enterInner(i[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=_e.none;for(let a of i.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):Yu(a.type,e.type))&&(o=a.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,n,r,i){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,i)),s}enterInner(e,n,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=Ku(e,s,o.options);o.options&Vi&&o.content.length==0&&(a|=Vi);let l=_e.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):Yu(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Ps(e,n,l,i,null,a)),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|=ss)}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 i=r.length-1;i>=0;i--)e+=r[i].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 i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].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,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let u=l>0||l==0&&i?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}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 _y(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Wp.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function Ay(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Gu(t){let e={};for(let n in t)e[n]=t[n];return e}function Yu(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||s.indexOf(u)<0&&o(u))return!0}};if(o(i.contentMatch))return!0}}class xr{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Bs(n).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,l=0;for(;a<s.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(s[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)i=s.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],u=this.serializeMark(c,o.isInline,n);u&&(s.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){if(e.isText)return Bs(n).createTextNode(e.text);let{dom:r,contentDOM:i}=oo(Bs(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&oo(Bs(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return typeof n=="string"?{dom:e.createTextNode(n)}:oo(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new xr(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Ju(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Ju(e.marks)}}function Ju(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Bs(t){return t.document||window.document}const Xu=new WeakMap;function Cy(t){let e=Xu.get(t);return e===void 0&&Xu.set(t,e=My(t)),e}function My(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 i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function oo(t,e,n,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=Cy(r))&&s.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=i.indexOf(" ");o>0&&(n=i.slice(0,o),i=i.slice(o+1));let a,l=n?t.createElementNS(n,i):t.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let p=d.indexOf(" ");p>0?l.setAttributeNS(d.slice(0,p),d.slice(p+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let p=e[d];if(p===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else if(typeof p=="string")l.appendChild(t.createTextNode(p));else{let{dom:f,contentDOM:h}=oo(t,p,n,r);if(l.appendChild(f),h){if(a)throw new RangeError("Multiple content holes");a=h}}}return{dom:l,contentDOM:a}}const Kp=65535,qp=Math.pow(2,16);function Oy(t,e){return t+e*qp}function Zu(t){return t&Kp}function Ry(t){return(t-(t&Kp))/qp}const Gp=1,Yp=2,ao=4,Jp=8;let Il=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Jp)>0}get deletedBefore(){return(this.delInfo&(Gp|ao))>0}get deletedAfter(){return(this.delInfo&(Yp|ao))>0}get deletedAcross(){return(this.delInfo&ao)>0}},mr=class Br{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Br.empty)return Br.empty}recover(e){let n=0,r=Zu(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+Ry(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 i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+s],u=this.ranges[a+o],d=l+c;if(e<=d){let p=c?e==l?-1:e==d?1:n:n,f=l+i+(p<0?0:u);if(r)return f;let h=e==(n<0?l:d)?null:Oy(a/3,e-l),m=e==l?Yp:e==d?Gp:ao;return(n<0?e!=l:e!=d)&&(m|=Jp),new Il(f,m,h)}i+=u-c}return r?e+i:new Il(e+i,0,null)}touches(e,n){let r=0,i=Zu(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+s],u=l+c;if(e<=u&&a==i*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),c=this.ranges[i+n],u=this.ranges[i+r];e(a,a+c,l,l+u),s+=u-c}}invert(){return new Br(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Br.empty:new Br(e<0?[0,-e,0]:[0,0,e])}};mr.empty=new mr([]);class as{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new as(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 i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i: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 i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new as;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 i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],a=o.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new Il(e,i,null)}}const Fa=Object.create(null);let dt=class{getMap(){return mr.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Fa[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 Fa)throw new RangeError("Duplicate use of step JSON ID "+e);return Fa[e]=n,n.prototype.jsonID=e,n}},yt=class Ti{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Ti(e,null)}static fail(e){return new Ti(null,e)}static fromReplace(e,n,r,i){try{return Ti.ok(e.replace(n,r,i))}catch(s){if(s instanceof xo)return Ti.fail(s.message);throw s}}};function xc(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(xc(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return F.fromArray(r)}let wc=class Ni extends dt{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),i=r.node(r.sharedDepth(this.to)),s=new G(xc(n.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return yt.fromReplace(e,this.from,this.to,s)}invert(){return new di(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 Ni(n.pos,r.pos,this.mark)}merge(e){return e instanceof Ni&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ni(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 Ni(n.from,n.to,e.markFromJSON(n.mark))}};dt.jsonID("addMark",wc);let di=class _i extends dt{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 G(xc(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return yt.fromReplace(e,this.from,this.to,r)}invert(){return new wc(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 _i(n.pos,r.pos,this.mark)}merge(e){return e instanceof _i&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new _i(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 _i(n.from,n.to,e.markFromJSON(n.mark))}};dt.jsonID("removeMark",di);let Sc=class Ai extends dt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return yt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return yt.fromReplace(e,this.pos,this.pos+1,new G(F.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 i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Ai(this.pos,n.marks[i]);return new Ai(this.pos,this.mark)}}return new To(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ai(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 Ai(n.pos,e.markFromJSON(n.mark))}};dt.jsonID("addNodeMark",Sc);let To=class Dl extends dt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return yt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return yt.fromReplace(e,this.pos,this.pos+1,new G(F.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Sc(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Dl(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 Dl(n.pos,e.markFromJSON(n.mark))}};dt.jsonID("removeNodeMark",To);let Wt=class Mn extends dt{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Ll(e,this.from,this.to)?yt.fail("Structure replace would overwrite content"):yt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new mr([this.from,this.to-this.from,this.slice.size])}invert(e){return new Mn(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&Mn.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new Mn(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Mn)||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?G.empty:new G(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Mn(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?G.empty:new G(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Mn(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 Mn(n.from,n.to,G.fromJSON(e,n.slice),!!n.structure)}};Wt.MAP_BIAS=1;dt.jsonID("replace",Wt);let Mt=class lo extends dt{constructor(e,n,r,i,s,o,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(Ll(e,this.from,this.gapFrom)||Ll(e,this.gapTo,this.to)))return yt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return yt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?yt.fromReplace(e,this.from,this.to,r):yt.fail("Content does not fit in gap")}getMap(){return new mr([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 lo(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),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new lo(n.pos,r.pos,i,s,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 lo(n.from,n.to,n.gapFrom,n.gapTo,G.fromJSON(e,n.slice),n.insert,!!n.structure)}};dt.jsonID("replaceAround",Mt);function Ll(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function Iy(t,e,n,r){let i=[],s=[],o,a;t.doc.nodesBetween(e,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let p=Math.max(c,e),f=Math.min(c+l.nodeSize,n),h=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(h)||(o&&o.to==p&&o.mark.eq(d[m])?o.to=f:i.push(o=new di(p,f,d[m])));a&&a.to==p?a.to=f:s.push(a=new wc(p,f,r))}}),i.forEach(l=>t.step(l)),s.forEach(l=>t.step(l))}function Dy(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(r instanceof ha){let c=o.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,n);for(let u=0;u<l.length;u++){let d=l[u],p;for(let f=0;f<i.length;f++){let h=i[f];h.step==s-1&&d.eq(i[f].style)&&(p=h)}p?(p.to=c,p.step=s):i.push({style:d,from:Math.max(a,e),to:c,step:s})}}}),i.forEach(o=>t.step(new di(o.from,o.to,o.style)))}function kc(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<s.childCount;l++){let c=s.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new Wt(a,u,G.empty));else{r=d;for(let p=0;p<c.marks.length;p++)n.allowsMarkType(c.marks[p].type)||t.step(new di(a,u,c.marks[p]));if(i&&c.isText&&n.whitespace!="pre"){let p,f=/\r?\n|\r/g,h;for(;p=f.exec(c.text);)h||(h=new G(F.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),o.push(new Wt(a+p.index,a+p.index+p[0].length,h))}}a=u}if(!r.validEnd){let l=r.fillBefore(F.empty,!0);t.replace(a,a,new G(l,0,0))}for(let l=o.length-1;l>=0;l--)t.step(o[l])}function Ly(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function fi(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let o=t.$from.node(r),a=t.$from.index(r)+i,l=t.$to.indexAfter(r)-s;if(r<t.depth&&o.canReplace(a,l,n))return r;if(r==0||o.type.spec.isolating||!Ly(o,a,l))break;a&&(i=1),l<o.childCount&&(s=1)}return null}function Py(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),a=i.after(s+1),l=o,c=a,u=F.empty,d=0;for(let h=s,m=!1;h>n;h--)m||r.index(h)>0?(m=!0,u=F.from(r.node(h).copy(u)),d++):l--;let p=F.empty,f=0;for(let h=s,m=!1;h>n;h--)m||i.after(h+1)<i.end(h)?(m=!0,p=F.from(i.node(h).copy(p)),f++):c++;t.step(new Mt(l,c,o,a,new G(u.append(p),d,f),u.size-d,!0))}function Tc(t,e,n=null,r=t){let i=By(t,e),s=i&&Fy(r,e);return s?i.map(Qu).concat({type:e,attrs:n}).concat(s.map(Qu)):null}function Qu(t){return{type:t,attrs:null}}function By(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}function Fy(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;l&&c<i;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:o}function zy(t,e,n){let r=F.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let a=n[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=F.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new Mt(i,s,i,s,new G(r,0,0),n.length,!0))}function $y(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(o,a)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,l)&&Uy(t.doc,t.mapping.slice(s).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",h=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!h?c=!1:!f&&h&&(c=!0)}c===!1&&Zp(t,o,a,s),kc(t,t.mapping.slice(s).map(a,1),r,void 0,c===null);let u=t.mapping.slice(s),d=u.map(a,1),p=u.map(a+o.nodeSize,1);return t.step(new Mt(d,p,d+1,p-1,new G(F.from(r.create(l,null,o.marks)),0,0),1,!0)),c===!0&&Xp(t,o,a,s),!1}})}function Xp(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function Zp(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
|
|
42
|
-
`))}})}function Uy(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function Hy(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Mt(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new G(F.from(o),0,0),1,!0))}function wn(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=n-2;c>s;c--,u--){let d=i.node(c),p=i.index(c);if(d.type.spec.isolating)return!1;let f=d.content.cutByIndex(p,d.childCount),h=r&&r[u+1];h&&(f=f.replaceChild(0,h.type.create(h.attrs)));let m=r&&r[u]||d;if(!d.canReplace(p+1,d.childCount)||!m.type.validContent(f))return!1}let a=i.indexAfter(s),l=r&&r[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function jy(t,e,n=1,r){let i=t.doc.resolve(e),s=F.empty,o=F.empty;for(let a=i.depth,l=i.depth-n,c=n-1;a>l;a--,c--){s=F.from(i.node(a).copy(s));let u=r&&r[c];o=F.from(u?u.type.create(u.attrs,o):i.node(a).copy(o))}t.step(new Wt(e,e,new G(s.append(o),n,n),!0))}function Wn(t,e){let n=t.resolve(e),r=n.index();return Qp(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Vy(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function Qp(t,e){return!!(t&&e&&!t.isLeaf&&Vy(t,e))}function ma(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let s,o,a=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):n>0?(s=r.node(i+1),a++,o=r.node(i).maybeChild(a)):(s=r.node(i).maybeChild(a-1),o=r.node(i+1)),s&&!s.isTextblock&&Qp(s,o)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function Wy(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),o=s.node().type;if(i&&o.inlineContent){let u=o.whitespace=="pre",d=!!o.contentMatch.matchType(i);u&&!d?r=!1:!u&&d&&(r=!0)}let a=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);Zp(t,u.node(),u.before(),a)}o.inlineContent&&kc(t,e+n-1,o,s.node().contentMatchAt(s.index()),r==null);let l=t.mapping.slice(a),c=l.map(e-n);if(t.step(new Wt(c,l.map(e+n,-1),G.empty,!0)),r===!0){let u=t.doc.resolve(c);Xp(t,u.node(),u.before(),t.steps.length)}return t}function Ky(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,n))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function eh(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),c=r.node(o),u=!1;if(s==1)u=c.canReplace(l,l,i);else{let d=c.contentMatchAt(l).findWrapping(i.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function ga(t,e,n=e,r=G.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return th(i,s,r)?new Wt(e,n,r):new qy(i,s,r).fit()}function th(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class qy{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=F.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=F.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new G(s,o,a);return e>-1?new Mt(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Wt(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=za(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(n==1&&(o?c.matchType(o.type)||(d=c.fillBefore(F.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:d};if(n==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=za(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new G(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=za(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new G(Ci(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new G(Ci(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,c=0,u=[],{match:d,type:p}=this.frontier[n];if(i){for(let m=0;m<i.childCount;m++)u.push(i.child(m));d=d.matchFragment(i)}let f=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let m=a.child(c),g=d.matchType(m.type);if(!g)break;c++,(c>1||l==0||m.content.size)&&(d=g,u.push(nh(m.mark(p.allowedMarks(m.marks)),c==1?l:0,c==a.childCount?f:-1)))}let h=c==a.childCount;h||(f=-1),this.placed=Mi(this.placed,n,F.from(u)),this.frontier[n].match=d,h&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<f;m++){let y=g.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),g=y.content}this.unplaced=h?e==0?G.empty:new G(Ci(o.content,e-1,1),e-1,f<0?o.openEnd:e-1):new G(Ci(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!$a(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=$a(e,n,i,r,s);if(o){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=$a(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:o,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Mi(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Mi(this.placed,this.depth,F.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(F.empty,!0);n.childCount&&(this.placed=Mi(this.placed,this.frontier.length,n))}}function Ci(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Ci(t.firstChild.content,e-1,n)))}function Mi(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Mi(t.lastChild.content,e-1,n)))}function za(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function nh(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,nh(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(F.empty,!0)))),t.copy(r)}function $a(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!Gy(n,s.content,o)?a:null}function Gy(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function Yy(t){return t.spec.defining||t.spec.definingForContent}function Jy(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(th(i,s,r))return t.step(new Wt(e,n,r));let o=ih(i,s);o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let p=i.depth,f=i.pos-1;p>0;p--,f--){let h=i.node(p).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;o.indexOf(p)>-1?a=p:i.before(p)==f&&o.splice(1,0,-p)}let l=o.indexOf(a),c=[],u=r.openStart;for(let p=r.content,f=0;;f++){let h=p.firstChild;if(c.push(h),f==r.openStart)break;p=h.content}for(let p=u-1;p>=0;p--){let f=c[p],h=Yy(f.type);if(h&&!f.sameMarkup(i.node(Math.abs(a)-1)))u=p;else if(h||!f.type.isTextblock)break}for(let p=r.openStart;p>=0;p--){let f=(p+u+1)%(r.openStart+1),h=c[f];if(h)for(let m=0;m<o.length;m++){let g=o[(m+l)%o.length],y=!0;g<0&&(y=!1,g=-g);let w=i.node(g-1),S=i.index(g-1);if(w.canReplaceWith(S,S,h.type,h.marks))return t.replace(i.before(g),y?s.after(g):n,new G(rh(r.content,0,r.openStart,f),f,r.openEnd))}}let d=t.steps.length;for(let p=o.length-1;p>=0&&(t.replace(e,n,r),!(t.steps.length>d));p--){let f=o[p];f<0||(e=i.before(f),n=s.after(f))}}function rh(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(rh(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(F.empty,!0))}return t}function Xy(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=Ky(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new G(F.from(r),0,0))}function Zy(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let o=r.sharedDepth(n),a=!1;for(let l=r.depth;l>o;l--)r.node(l).type.spec.isolating&&(a=!0);for(let l=i.depth;l>o;l--)i.node(l).type.spec.isolating&&(a=!0);if(!a){for(let l=r.depth;l>0&&e==r.start(l);l--)e=r.before(l);for(let l=i.depth;l>0&&n==i.start(l);l--)n=i.before(l);r=t.doc.resolve(e),i=t.doc.resolve(n)}}let s=ih(r,i);for(let o=0;o<s.length;o++){let a=s[o],l=o==s.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return t.delete(r.before(a),i.after(a))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function ih(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}let sh=class co extends dt{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return yt.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return yt.fromReplace(e,this.pos,this.pos+1,new G(F.from(i),0,n.isLeaf?0:1))}getMap(){return mr.empty}invert(e){return new co(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new co(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new co(n.pos,n.attr,n.value)}};dt.jsonID("attr",sh);let oh=class Pl extends dt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return yt.ok(r)}getMap(){return mr.empty}invert(e){return new Pl(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Pl(n.attr,n.value)}};dt.jsonID("docAttr",oh);let Jr=class extends Error{};Jr=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Jr.prototype=Object.create(Error.prototype);Jr.prototype.constructor=Jr;Jr.prototype.name="TransformError";class ah{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new as}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Jr(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),n=i.map(n,-1)),i.forEach((s,o,a,l)=>{e=Math.min(e,a),n=Math.max(n,l)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=G.empty){let i=ga(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new G(F.from(r),0,0))}delete(e,n){return this.replace(e,n,G.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return Jy(this,e,n,r),this}replaceRangeWith(e,n,r){return Xy(this,e,n,r),this}deleteRange(e,n){return Zy(this,e,n),this}lift(e,n){return Py(this,e,n),this}join(e,n=1){return Wy(this,e,n),this}wrap(e,n){return zy(this,e,n),this}setBlockType(e,n=e,r,i=null){return $y(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return Hy(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new sh(e,n,r)),this}setDocAttribute(e,n){return this.step(new oh(e,n)),this}addNodeMark(e,n){return this.step(new Sc(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof _e)n.isInSet(r.marks)&&this.step(new To(e,n));else{let i=r.marks,s,o=[];for(;s=n.isInSet(i);)o.push(new To(e,s)),i=s.removeFromSet(i);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,n=1,r){return jy(this,e,n,r),this}addMark(e,n,r){return Iy(this,e,n,r),this}removeMark(e,n,r){return Dy(this,e,n,r),this}clearIncompatible(e,n,r){return kc(this,e,n,r),this}}const Ua=Object.create(null);let ue=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Qy(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=G.empty){let r=n.content.lastChild,i=null;for(let a=0;a<n.openEnd;a++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],u=e.mapping.slice(s);e.replaceRange(u.map(l.pos),u.map(c.pos),a?G.empty:n),a==0&&nd(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:a}=i[s],l=e.mapping.slice(r),c=l.map(o.pos),u=l.map(a.pos);s?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),nd(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new le(e):Fr(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=n<0?Fr(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):Fr(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Sn(e.node(0))}static atStart(e){return Fr(e,e,0,0,1)||new Sn(e)}static atEnd(e){return Fr(e,e,e.content.size,e.childCount,-1)||new Sn(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ua[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Ua)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ua[e]=n,n.prototype.jsonID=e,n}getBookmark(){return le.between(this.$anchor,this.$head).getBookmark()}};ue.prototype.visible=!0;let Qy=class{constructor(e,n){this.$from=e,this.$to=n}},ed=!1;function td(t){!ed&&!t.parent.inlineContent&&(ed=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}let le=class Oi extends ue{constructor(e,n=e){td(e),td(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return ue.near(r);let i=e.resolve(n.map(this.anchor));return new Oi(i.parent.inlineContent?i:r,r)}replace(e,n=G.empty){if(super.replace(e,n),n==G.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Oi&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new lh(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Oi(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=ue.findFrom(n,r,!0)||ue.findFrom(n,-r,!0);if(s)n=s.$head;else return ue.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(ue.findFrom(e,-r,!0)||ue.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new Oi(e,n)}};ue.jsonID("text",le);let lh=class ch{constructor(e,n){this.anchor=e,this.head=n}map(e){return new ch(e.map(this.anchor),e.map(this.head))}resolve(e){return le.between(e.resolve(this.anchor),e.resolve(this.head))}},ee=class Ri extends ue{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?ue.near(s):new Ri(s)}content(){return new G(F.from(this.node),0,0)}eq(e){return e instanceof Ri&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new eE(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ri(e.resolve(n.anchor))}static create(e,n){return new Ri(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};ee.prototype.visible=!1;ue.jsonID("node",ee);let eE=class uh{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new lh(r,r):new uh(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&ee.isSelectable(r)?new ee(n):ue.near(n)}},Sn=class uo extends ue{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=G.empty){if(n==G.empty){e.delete(0,e.doc.content.size);let r=ue.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new uo(e)}map(e){return new uo(e)}eq(e){return e instanceof uo}getBookmark(){return tE}};ue.jsonID("all",Sn);const tE={map(){return this},resolve(t){return new Sn(t)}};function Fr(t,e,n,r,i,s=!1){if(e.inlineContent)return le.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&ee.isSelectable(a))return ee.create(t,n-(i<0?a.nodeSize:0))}else{let l=Fr(t,a,n+i,i<0?a.childCount:0,i,s);if(l)return l}n+=a.nodeSize*i}return null}function nd(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof Wt||i instanceof Mt))return;let s=t.mapping.maps[r],o;s.forEach((a,l,c,u)=>{o==null&&(o=u)}),t.setSelection(ue.near(t.doc.resolve(o),n))}const rd=1,Fs=2,id=4;class nE extends ah{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|rd)&~Fs,this.storedMarks=null,this}get selectionSet(){return(this.updated&rd)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Fs,this}ensureMarks(e){return _e.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Fs)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Fs,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||_e.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(n);s=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,s)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(ue.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=id,this}get scrolledIntoView(){return(this.updated&id)>0}}function sd(t,e){return!e||!t?t:t.bind(e)}let Ii=class{constructor(e,n,r){this.name=e,this.init=sd(n.init,r),this.apply=sd(n.apply,r)}};const rE=[new Ii("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Ii("selection",{init(t,e){return t.selection||ue.atStart(e.doc)},apply(t){return t.selection}}),new Ii("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Ii("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Ha{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=rE.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Ii(r.key,r.spec.state,r))})}}class Gr{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=i?i[o].n:0,c=i?i[o].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<o?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),s=!0}i&&(i[o]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Gr(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new nE(this)}static create(e){let n=new Ha(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Gr(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new Ha(this.schema,e.plugins),r=n.fields,i=new Gr(n);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Ha(e.schema,e.plugins),s=new Gr(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=Qt.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=ue.fromJSON(s.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){s[o.name]=c.fromJSON.call(l,e,n[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function dh(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=dh(i,e,{})),n[r]=i}return n}class Me{constructor(e){this.spec=e,this.props={},e.props&&dh(e.props,this,this.props),this.key=e.key?e.key.key:fh("plugin")}getState(e){return e[this.key]}}const ja=Object.create(null);function fh(t){return t in ja?t+"$"+ ++ja[t]:(ja[t]=0,t+"$")}class ze{constructor(e="key"){this.key=fh(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const ph=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function hh(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const mh=(t,e,n)=>{let r=hh(t,n);if(!r)return!1;let i=Nc(r);if(!i){let o=r.blockRange(),a=o&&fi(o);return a==null?!1:(e&&e(t.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(kh(t,i,e,-1))return!0;if(r.parent.content.size==0&&(Xr(s,"end")||ee.isSelectable(s)))for(let o=r.depth;;o--){let a=ga(t.doc,r.before(o),r.after(o),G.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(Xr(s,"end")?ue.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):ee.create(l.doc,i.pos-s.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},iE=(t,e,n)=>{let r=hh(t,n);if(!r)return!1;let i=Nc(r);return i?gh(t,i,e):!1},sE=(t,e,n)=>{let r=yh(t,n);if(!r)return!1;let i=_c(r);return i?gh(t,i,e):!1};function gh(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let c=ga(t.doc,s,l,G.empty);if(!c||c.from!=s||c instanceof Wt&&c.slice.size>=l-s)return!1;if(n){let u=t.tr.step(c);u.setSelection(le.create(u.doc,s)),n(u.scrollIntoView())}return!0}function Xr(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const bh=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=Nc(r)}let o=s&&s.nodeBefore;return!o||!ee.isSelectable(o)?!1:(e&&e(t.tr.setSelection(ee.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function Nc(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function yh(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Eh=(t,e,n)=>{let r=yh(t,n);if(!r)return!1;let i=_c(r);if(!i)return!1;let s=i.nodeAfter;if(kh(t,i,e,1))return!0;if(r.parent.content.size==0&&(Xr(s,"start")||ee.isSelectable(s))){let o=ga(t.doc,r.before(),r.after(),G.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(Xr(s,"start")?ue.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):ee.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},vh=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=_c(r)}let o=s&&s.nodeAfter;return!o||!ee.isSelectable(o)?!1:(e&&e(t.tr.setSelection(ee.create(t.doc,s.pos)).scrollIntoView()),!0)};function _c(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const oE=(t,e)=>{let n=t.selection,r=n instanceof ee,i;if(r){if(n.node.isTextblock||!Wn(t.doc,n.from))return!1;i=n.from}else if(i=ma(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(ee.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},aE=(t,e)=>{let n=t.selection,r;if(n instanceof ee){if(n.node.isTextblock||!Wn(t.doc,n.to))return!1;r=n.to}else if(r=ma(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},lE=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&fi(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},xh=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
|
43
|
-
`).scrollIntoView()),!0)};function Ac(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const cE=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),o=Ac(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,o.createAndFill());l.setSelection(ue.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},wh=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Sn||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=Ac(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=t.tr.insert(o,s.createAndFill());a.setSelection(le.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},Sh=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(wn(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&fi(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function uE(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof ee&&e.selection.node.isBlock)return!r.parentOffset||!wn(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,a,l=!1,c=!1;for(let f=r.depth;;f--)if(r.node(f).isBlock){l=r.end(f)==r.pos+(r.depth-f),c=r.start(f)==r.pos-(r.depth-f),a=Ac(r.node(f-1).contentMatchAt(r.indexAfter(f-1))),s.unshift(l&&a?{type:a}:null),o=f;break}else{if(f==1)return!1;s.unshift(null)}let u=e.tr;(e.selection instanceof le||e.selection instanceof Sn)&&u.deleteSelection();let d=u.mapping.map(r.pos),p=wn(u.doc,d,s.length,s);if(p||(s[0]=a?{type:a}:null,p=wn(u.doc,d,s.length,s)),!p)return!1;if(u.split(d,s.length,s),!l&&c&&r.node(o).type!=a){let f=u.mapping.map(r.before(o)),h=u.doc.resolve(f);a&&r.node(o-1).canReplaceWith(h.index(),h.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(o)),a)}return n&&n(u.scrollIntoView()),!0}}const dE=uE(),fE=(t,e)=>{let{$from:n,to:r}=t.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),e&&e(t.tr.setSelection(ee.create(t.doc,i))),!0)};function pE(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Wn(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function kh(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,o,a,l=i.type.spec.isolating||s.type.spec.isolating;if(!l&&pE(t,e,n))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&a.matchType(o[0]||s.type).validEnd){if(n){let f=e.pos+s.nodeSize,h=F.empty;for(let y=o.length-1;y>=0;y--)h=F.from(o[y].create(null,h));h=F.from(i.copy(h));let m=t.tr.step(new Mt(e.pos-1,f,e.pos,f,new G(h,1,0),o.length,!0)),g=m.doc.resolve(f+2*o.length);g.nodeAfter&&g.nodeAfter.type==i.type&&Wn(m.doc,g.pos)&&m.join(g.pos),n(m.scrollIntoView())}return!0}let u=s.type.spec.isolating||r>0&&l?null:ue.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),p=d&&fi(d);if(p!=null&&p>=e.depth)return n&&n(t.tr.lift(d,p).scrollIntoView()),!0;if(c&&Xr(s,"start",!0)&&Xr(i,"end")){let f=i,h=[];for(;h.push(f),!f.isTextblock;)f=f.lastChild;let m=s,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(f.canReplace(f.childCount,f.childCount,m.content)){if(n){let y=F.empty;for(let S=h.length-1;S>=0;S--)y=F.from(h[S].copy(y));let w=t.tr.step(new Mt(e.pos-h.length,e.pos+s.nodeSize,e.pos+g,e.pos+s.nodeSize-g,new G(y,h.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function Th(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(le.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const hE=Th(-1),mE=Th(1);function gE(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),a=o&&Tc(o,t,e);return a?(r&&r(n.tr.wrap(o,a).scrollIntoView()),!0):!1}}function od(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=n.selection.ranges[s];n.doc.nodesBetween(o,a,(l,c)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)i=!0;else{let u=n.doc.resolve(c),d=u.index();i=u.parent.canReplaceWith(d,d+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[o];s.setBlockType(a,l,t,e)}r(s.scrollIntoView())}return!0}}function Cc(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}Cc(ph,mh,bh);Cc(ph,Eh,vh);Cc(xh,wh,Sh,dE);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function bE(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s);if(!o)return!1;let a=r?n.tr:null;return yE(a,o,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function yE(t,e,n,r=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=o.resolve(e.start-2);s=new So(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new So(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=Tc(s,n,r,e);return a?(t&&EE(t,e,a,i,n),!0):!1}function EE(t,e,n,r,i){let s=F.empty;for(let u=n.length-1;u>=0;u--)s=F.from(n[u].type.create(n[u].attrs,s));t.step(new Mt(e.start-(r?2:0),e.end,e.start,e.end,new G(s,0,0),n.length,!0));let o=0;for(let u=0;u<n.length;u++)n[u].type==i&&(o=u+1);let a=n.length-o,l=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,p=!0;u<d;u++,p=!1)!p&&wn(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return t}function vE(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?xE(e,n,t,s):wE(e,n,s):!0:!1}}function xE(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new Mt(s-1,o,s,o,new G(F.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new So(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const a=fi(r);if(a==null)return!1;i.lift(r,a);let l=i.doc.resolve(i.mapping.map(s,-1)-1);return Wn(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function wE(t,e,n){let r=t.tr,i=n.parent;for(let f=n.end,h=n.endIndex-1,m=n.startIndex;h>m;h--)f-=i.child(h).nodeSize,r.delete(f-1,f+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==i.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(a?0:1),u+1,o.content.append(l?F.empty:F.from(i))))return!1;let d=s.pos,p=d+o.nodeSize;return r.step(new Mt(d-(a?1:0),p+(l?1:0),d+1,p-1,new G((a?F.empty:F.from(i.copy(F.empty))).append(l?F.empty:F.from(i.copy(F.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function SE(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==t);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=t)return!1;if(n){let c=l.lastChild&&l.lastChild.type==a.type,u=F.from(c?t.create():null),d=new G(F.from(t.create(null,F.from(a.type.create(null,u)))),c?3:1,0),p=s.start,f=s.end;n(e.tr.step(new Mt(p-(c?3:1),f,p,f,d,1,!0)).scrollIntoView())}return!0}}const it=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Zr=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Bl=null;const En=function(t,e,n){let r=Bl||(Bl=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},kE=function(){Bl=null},gr=function(t,e,n,r){return n&&(ad(t,e,n,r,-1)||ad(t,e,n,r,1))},TE=/^(img|br|input|textarea|hr)$/i;function ad(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Ut(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Ts(t)||TE.test(t.nodeName)||t.contentEditable=="false")return!1;e=it(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?Ut(t):0}else return!1}}function Ut(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function NE(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Ut(t)}else if(t.parentNode&&!Ts(t))e=it(t),t=t.parentNode;else return null}}function _E(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Ts(t))e=it(t)+1,t=t.parentNode;else return null}}function AE(t,e,n){for(let r=e==0,i=e==Ut(t);r||i;){if(t==n)return!0;let s=it(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Ut(t)}}function Ts(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const ba=function(t){return t.focusNode&&gr(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function tr(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function CE(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function ME(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Ut(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Ut(r.startContainer),r.startOffset)}}}const un=typeof navigator<"u"?navigator:null,ld=typeof document<"u"?document:null,Kn=un&&un.userAgent||"",Fl=/Edge\/(\d+)/.exec(Kn),Nh=/MSIE \d/.exec(Kn),zl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Kn),_t=!!(Nh||zl||Fl),$n=Nh?document.documentMode:zl?+zl[1]:Fl?+Fl[1]:0,Ht=!_t&&/gecko\/(\d+)/i.test(Kn);Ht&&+(/Firefox\/(\d+)/.exec(Kn)||[0,0])[1];const $l=!_t&&/Chrome\/(\d+)/.exec(Kn),ot=!!$l,_h=$l?+$l[1]:0,ut=!_t&&!!un&&/Apple Computer/.test(un.vendor),Qr=ut&&(/Mobile\/\w+/.test(Kn)||!!un&&un.maxTouchPoints>2),$t=Qr||(un?/Mac/.test(un.platform):!1),Ah=un?/Win/.test(un.platform):!1,xn=/Android \d/.test(Kn),Ns=!!ld&&"webkitFontSmoothing"in ld.documentElement.style,OE=Ns?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function RE(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function mn(t,e){return typeof t=="number"?t:t[e]}function IE(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function cd(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=Zr(o);continue}let a=o,l=a==s.body,c=l?RE(s):IE(a),u=0,d=0;if(e.top<c.top+mn(r,"top")?d=-(c.top-e.top+mn(i,"top")):e.bottom>c.bottom-mn(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+mn(i,"top")-c.top:e.bottom-c.bottom+mn(i,"bottom")),e.left<c.left+mn(r,"left")?u=-(c.left-e.left+mn(i,"left")):e.right>c.right-mn(r,"right")&&(u=e.right-c.right+mn(i,"right")),u||d)if(l)s.defaultView.scrollBy(u,d);else{let f=a.scrollLeft,h=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let m=a.scrollLeft-f,g=a.scrollTop-h;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let p=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(p))break;o=p=="absolute"?o.offsetParent:Zr(o)}}function DE(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=t.root.elementFromPoint(s,o);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:Ch(t.dom)}}function Ch(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Zr(r));return e}function LE({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Mh(n,r==0?0:r-e)}function Mh(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:s}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Cr=null;function PE(t){if(t.setActive)return t.setActive();if(Cr)return t.focus(Cr);let e=Ch(t);t.focus(Cr==null?{get preventScroll(){return Cr={preventScroll:!0},!0}}:void 0),Cr||(Cr=!1,Mh(e,0))}function Oh(t,e){let n,r=2e8,i,s=0,o=e.top,a=e.top,l,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let p;if(u.nodeType==1)p=u.getClientRects();else if(u.nodeType==3)p=En(u).getClientRects();else continue;for(let f=0;f<p.length;f++){let h=p[f];if(h.top<=o&&h.bottom>=a){o=Math.max(h.bottom,o),a=Math.min(h.top,a);let m=h.left>e.left?h.left-e.left:h.right<e.left?e.left-h.right:0;if(m<r){n=u,r=m,i=m&&n.nodeType==3?{left:h.right<e.left?h.right:h.left,top:e.top}:e,u.nodeType==1&&m&&(s=d+(e.left>=(h.left+h.right)/2?1:0));continue}}else h.top>e.top&&!l&&h.left<=e.left&&h.right>=e.left&&(l=u,c={left:Math.max(h.left,Math.min(h.right,e.left)),top:h.top});!n&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(s=d+1)}}return!n&&l&&(n=l,i=c,r=0),n&&n.nodeType==3?BE(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:Oh(n,i)}function BE(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let o=On(r,1);if(o.top!=o.bottom&&Mc(e,o)){i={node:t,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function Mc(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function FE(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function zE(t,e,n){let{node:r,offset:i}=Oh(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function $E(t,e,n,r){let i=-1;for(let s=e,o=!1;s!=t.dom;){let a=t.docView.nearestDesc(s,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&l.left>r.left||l.top>r.top?i=a.posBefore:(!o&&l.right<r.left||l.bottom<r.top)&&(i=a.posAfter),o=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;s=a.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function Rh(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let o=t.childNodes[s];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(Mc(e,c))return Rh(o,e,c)}}if((s=(s+1)%r)==i)break}return t}function UE(t,e){let n=t.dom.ownerDocument,r,i=0,s=ME(n,e.left,e.top);s&&({node:r,offset:i}=s);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=t.dom.getBoundingClientRect();if(!Mc(e,c)||(o=Rh(t.dom,e,c),!o))return null}if(ut)for(let c=o;r&&c;c=Zr(c))c.draggable&&(r=void 0);if(o=FE(o,e),r){if(Ht&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let u=r.childNodes[i],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let c;Ns&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=$E(t,r,i,e))}a==null&&(a=zE(t,o,e));let l=t.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function ud(t){return t.top<t.bottom||t.left<t.right}function On(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(ud(r))return r}return Array.prototype.find.call(n,ud)||t.getBoundingClientRect()}const HE=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Ih(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=Ns||Ht;if(r.nodeType==3)if(o&&(HE.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let l=On(En(r,i,i),n);if(Ht&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=On(En(r,i-1,i-1),-1);if(c.top==l.top){let u=On(En(r,i,i+1),-1);if(u.top!=l.top)return yi(u,u.left<c.left)}}return l}else{let l=i,c=i,u=n<0?1:-1;return n<0&&!i?(c++,u=-1):n>=0&&i==r.nodeValue.length?(l--,u=1):n<0?l--:c++,yi(On(En(r,l,c),u),u<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==Ut(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return Va(l.getBoundingClientRect(),!1)}if(s==null&&i<Ut(r)){let l=r.childNodes[i];if(l.nodeType==1)return Va(l.getBoundingClientRect(),!0)}return Va(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==Ut(r))){let l=r.childNodes[i-1],c=l.nodeType==3?En(l,Ut(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return yi(On(c,1),!1)}if(s==null&&i<Ut(r)){let l=r.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?En(l,0,o?0:1):l.nodeType==1?l:null:null;if(c)return yi(On(c,-1),!0)}return yi(On(r.nodeType==3?En(r):r,-n),n>=0)}function yi(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Va(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Dh(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function jE(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return Dh(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=Ih(t,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=En(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(n=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const VE=/[\u0590-\u08ac]/;function WE(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,a=t.domSelection();return a?!VE.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?s:o:Dh(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),p=a.caretBidiLevel;a.modify("move",n,"character");let f=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:h,focusOffset:m}=t.domSelectionRange(),g=h&&!f.contains(h.nodeType==1?h:h.parentNode)||l==h&&c==m;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return p!=null&&(a.caretBidiLevel=p),g}):r.pos==r.start()||r.pos==r.end()}let dd=null,fd=null,pd=!1;function KE(t,e,n){return dd==e&&fd==n?pd:(dd=e,fd=n,pd=n=="up"||n=="down"?jE(t,e,n):WE(t,e,n))}const jt=0,hd=1,nr=2,dn=3;class _s{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=jt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>it(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!n||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let a=i.children[o];if(a.size){i=a;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],a=s+o.size;if(a>e||o instanceof Ph){i=e-s;break}s=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof Lh&&s.side>=0;r--);if(n<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&n&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?it(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?it(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,a=0;;a++){let l=this.children[a],c=o+l.size;if(i==-1&&e<=c){let u=o+l.border;if(e>=u&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,u);e=o;for(let d=a;d>0;d--){let p=this.children[d-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){i=it(p.dom)+1;break}e-=p.size}i==-1&&(i=0)}if(i>-1&&(c>n||a==this.children.length-1)){n=c;for(let u=a+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){s=it(d.dom);break}n+=d.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let s=Math.min(e,n),o=Math.max(e,n);for(let f=0,h=0;f<this.children.length;f++){let m=this.children[f],g=h+m.size;if(s>h&&o<g)return m.setSelection(e-h-m.border,n-h-m.border,r,i);h=g}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((Ht||ut)&&e==n){let{node:f,offset:h}=a;if(f.nodeType==3){if(d=!!(h&&f.nodeValue[h-1]==`
|
|
44
|
-
`),d&&h==f.nodeValue.length)for(let m=f,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(a=l={node:g.parentNode,offset:it(g)+1});break}let y=m.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let m=f.childNodes[h-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Ht&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let f=u.focusNode.childNodes[u.focusOffset];f&&f.contentEditable=="false"&&(i=!0)}if(!(i||d&&ut)&&gr(a.node,a.offset,u.anchorNode,u.anchorOffset)&&gr(l.node,l.offset,u.focusNode,u.focusOffset))return;let p=!1;if((c.extend||e==n)&&!(d&&Ht)){c.collapse(a.node,a.offset);try{e!=n&&c.extend(l.node,l.offset),p=!0}catch{}}if(!p){if(e>n){let h=a;a=l,l=h}let f=document.createRange();f.setEnd(l.node,l.offset),f.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let a=r+s.border,l=o-s.border;if(e>=a&&n<=l){this.dirty=e==r||n==o?nr:hd,e==a&&n==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=dn:s.markDirty(e-a,n-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?nr:dn}r=o}this.dirty=nr}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?nr:hd;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Lh extends _s{constructor(e,n,r,i){let s,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==jt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class qE extends _s{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class br extends _s{constructor(e,n,r,i,s){super(e,[],r,i),this.mark=n,this.spec=s}static create(e,n,r,i){let s=i.nodeViews[n.type.name],o=s&&s(n,i,r);return(!o||!o.dom)&&(o=xr.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new br(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&dn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=dn&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=jt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=jt}}slice(e,n,r){let i=br.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;n<o&&(s=Hl(s,n,o,r)),e>0&&(s=Hl(s,0,e,r));for(let a=0;a<s.length;a++)s[a].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Un extends _s{constructor(e,n,r,i,s,o,a,l,c){super(e,[],s,o),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,n,r,i,s,o){let a=s.nodeViews[n.type.name],l,c=a&&a(n,s,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,i),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=xr.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let p=u;return u=zh(u,r,n),c?l=new GE(e,n,r,i,u,d||null,p,c,s,o+1):n.isText?new ya(e,n,r,i,u,p,s):new Un(e,n,r,i,u,d||null,p,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>F.empty)}return e}matchesNode(e,n,r){return this.dirty==jt&&e.eq(this.node)&&No(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new JE(this,o&&o.node,e);QE(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e,u):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?_e.none:this.node.child(u).marks,r,e,u),l.placeWidget(c,e,i)},(c,u,d,p)=>{l.syncToMarks(c.marks,r,e,p);let f;l.findNodeMatch(c,u,d,p)||a&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(f=l.findIndexWithChild(s.node))>-1&&l.updateNodeAt(c,u,d,f,e)||l.updateNextNode(c,u,d,e,p,i)||l.addNode(c,u,d,e,i),i+=c.nodeSize}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==nr)&&(o&&this.protectLocalComposition(e,o),Bh(this.contentDOM,this.children,e),Qr&&ev(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof le)||r<n||i>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,a=tv(this.node.content,o,r-n,i-n);return a<0?null:{node:s,pos:a,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new qE(this,s,n,i);e.input.compositionNodes.push(o),this.children=Hl(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==dn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=jt}updateOuterDeco(e){if(No(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Fh(this.dom,this.nodeDOM,Ul(this.outerDeco,this.node,n),Ul(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function md(t,e,n,r,i){zh(r,e,t);let s=new Un(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class ya extends Un{constructor(e,n,r,i,s,o,a){super(e,n,r,i,s,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==dn||this.dirty!=jt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=jt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=jt,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),s=document.createTextNode(i.text);return new ya(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=dn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Ph extends _s{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==jt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class GE extends Un{constructor(e,n,r,i,s,o,a,l,c,u){super(e,n,r,i,s,o,a,c,u),this.spec=l}update(e,n,r,i){if(this.dirty==dn)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Bh(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],a=o.dom;if(a.parentNode==t){for(;a!=r;)r=gd(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(a,r);if(o instanceof br){let l=r?r.previousSibling:t.lastChild;Bh(o.contentDOM,o.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=gd(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const Wi=function(t){t&&(this.nodeName=t)};Wi.prototype=Object.create(null);const rr=[new Wi];function Ul(t,e,n){if(t.length==0)return rr;let r=n?rr[0]:new Wi,i=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&i.push(r=new Wi(o.nodeName));for(let a in o){let l=o[a];l!=null&&(n&&i.length==1&&i.push(r=new Wi(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return i}function Fh(t,e,n,r){if(n==rr&&r==rr)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],a=n[s];if(s){let l;a&&a.nodeName==o.nodeName&&i!=t&&(l=i.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=rr[0]),i=l}YE(i,a||rr[0],o)}return i}function YE(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&t.classList.add(i[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function zh(t,e,n){return Fh(t,t,rr,Ul(e,n,t.nodeType!=1))}function No(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function gd(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class JE{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=XE(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,i){let s=0,o=this.stack.length>>1,a=Math.min(o,e.length);for(;s<a&&(s==o-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<o;)this.destroyRest(),this.top.dirty=jt,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let l=-1,c=this.top.children.length;i<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let u=this.index;u<c;u++){let d=this.top.children[u];if(d.matchesMark(e[o])&&!this.isLocked(d.dom)){l=u;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let u=br.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let o=this.top.children[i];return o.dirty==dn&&o.dom==o.contentDOM&&(o.dirty=nr),o.update(e,n,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,s,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Un){let c=this.preMatch.matched.get(l);if(c!=null&&c!=s)return!1;let u=l.dom,d,p=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=dn&&No(n,l.outerDeco));if(!p&&l.update(e,n,r,i))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!p&&(d=this.recreateWrapper(l,e,n,r,i,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=nr,d.updateChildren(i,o+1),d.dirty=jt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!No(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=Un.create(this.top,n,r,i,s,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,n,r,i,s){let o=Un.create(this.top,e,n,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new Lh(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof br;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof ya)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ut||ot)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new Ph(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function XE(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,o=[];e:for(;i>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof br)n=c,r=c.children.length;else{a=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function ZE(t,e){return t.type.side-e.type.side}function QE(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,i,e.forChild(s,u),c),s+=u.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let u,d;for(;o<i.length&&i[o].to==s;){let g=i[o++];g.widget&&(u?(d||(d=[u])).push(g):u=g)}if(u)if(d){d.sort(ZE);for(let g=0;g<d.length;g++)n(d[g],c,!!l)}else n(u,c,!!l);let p,f;if(l)f=-1,p=l,l=null;else if(c<t.childCount)f=c,p=t.child(c++);else break;for(let g=0;g<a.length;g++)a[g].to<=s&&a.splice(g--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let h=s+p.nodeSize;if(p.isText){let g=h;o<i.length&&i[o].from<g&&(g=i[o].from);for(let y=0;y<a.length;y++)a[y].to<g&&(g=a[y].to);g<h&&(l=p.cut(g-s),p=p.cut(0,g-s),h=g,f=-1)}else for(;o<i.length&&i[o].to<h;)o++;let m=p.isInline&&!p.isLeaf?a.filter(g=>!g.inline):a.slice();r(p,m,e.forChild(s,p),f),s=h}}function ev(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function tv(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let o=t.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<t.childCount;){let c=t.child(i++);if(s+=c.nodeSize,!c.isText)break;l+=c.text}if(s>=n){if(s>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=n)return a+c;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function Hl(t,e,n,r,i){let s=[];for(let o=0,a=0;o<t.length;o++){let l=t[o],c=a,u=a+=l.size;c>=n||u<=e?s.push(l):(c<e&&s.push(l.slice(0,e-c,r)),i&&(s.push(i),i=void 0),u>n&&s.push(l.slice(n-c,l.size,r)))}return s}function Oc(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,c;if(ba(n)){for(l=o;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&ee.isSelectable(d)&&i.parent&&!(d.isInline&&AE(n.focusNode,n.focusOffset,i.dom))){let p=i.posBefore;c=new ee(o==p?a:r.resolve(p))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=o,p=o;for(let f=0;f<n.rangeCount;f++){let h=n.getRangeAt(f);d=Math.min(d,t.docView.posFromDOM(h.startContainer,h.startOffset,1)),p=Math.max(p,t.docView.posFromDOM(h.endContainer,h.endOffset,-1))}if(d<0)return null;[l,o]=p==t.state.selection.anchor?[p,d]:[d,p],a=r.resolve(o)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);if(!c){let d=e=="pointer"||t.state.selection.head<a.pos&&!s?1:-1;c=Rc(t,u,a,d)}return c}function $h(t){return t.editable?t.hasFocus():Hh(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function kn(t,e=!1){let n=t.state.selection;if(Uh(t,n),!!$h(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&ot){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&gr(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)rv(t);else{let{anchor:r,head:i}=n,s,o;bd&&!(n instanceof le)&&(n.$from.parent.inlineContent||(s=yd(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=yd(t,n.to))),t.docView.setSelection(r,i,t,e),bd&&(s&&Ed(s),o&&Ed(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&nv(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const bd=ut||ot&&_h<63;function yd(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(ut&&i&&i.contentEditable=="false")return Wa(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Wa(i);if(s)return Wa(s)}}function Wa(t){return t.contentEditable="true",ut&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Ed(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function nv(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!$h(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function rv(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,it(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&_t&&$n<=11&&(n.disabled=!0,n.disabled=!1)}function Uh(t,e){if(e instanceof ee){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(vd(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else vd(t)}function vd(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Rc(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||le.between(e,n,r)}function xd(t){return t.editable&&!t.hasFocus()?!1:Hh(t)}function Hh(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function iv(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return gr(e.node,e.offset,n.anchorNode,n.anchorOffset)}function jl(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&ue.findFrom(s,e)}function In(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function wd(t,e,n){let r=t.state.selection;if(r instanceof le)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return In(t,new le(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=jl(t.state,e);return i&&i instanceof ee?In(t,i):!1}else if(!($t&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(a))&&!o.contentDOM?ee.isSelectable(s)?In(t,new ee(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):Ns?In(t,new le(t.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof ee&&r.node.isInline)return In(t,new le(e>0?r.$to:r.$from));{let i=jl(t.state,e);return i?In(t,i):!1}}}function _o(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Ki(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Mr(t,e){return e<0?sv(t):ov(t)}function sv(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(Ht&&n.nodeType==1&&r<_o(n)&&Ki(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Ki(a,-1))i=n,s=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(jh(n))break;{let a=n.previousSibling;for(;a&&Ki(a,-1);)i=n.parentNode,s=it(a),a=a.previousSibling;if(a)n=a,r=_o(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Vl(t,n,r):i&&Vl(t,i,s)}function ov(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=_o(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let a=n.childNodes[r];if(Ki(a,1))s=n,o=++r;else break}else{if(jh(n))break;{let a=n.nextSibling;for(;a&&Ki(a,1);)s=a.parentNode,o=it(a)+1,a=a.nextSibling;if(a)n=a,r=0,i=_o(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&Vl(t,s,o)}function jh(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function av(t,e){for(;t&&e==t.childNodes.length&&!Ts(t);)e=it(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function lv(t,e){for(;t&&!e&&!Ts(t);)e=it(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Vl(t,e,n){if(e.nodeType!=3){let s,o;(o=av(e,n))?(e=o,n=0):(s=lv(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(ba(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&kn(t)},50)}function Sd(t,e){let n=t.state.doc.resolve(e);if(!(ot||Ah)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function kd(t,e,n){let r=t.state.selection;if(r instanceof le&&!r.empty||n.indexOf("s")>-1||$t&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=jl(t.state,e);if(o&&o instanceof ee)return In(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=r instanceof Sn?ue.near(o,e):ue.findFrom(o,e);return a?In(t,a):!1}return!1}function Td(t,e){if(!(t.state.selection instanceof le))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function Nd(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function cv(t){if(!ut||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Nd(t,r,"true"),setTimeout(()=>Nd(t,r,"false"),20)}return!1}function uv(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function dv(t,e){let n=e.keyCode,r=uv(e);if(n==8||$t&&n==72&&r=="c")return Td(t,-1)||Mr(t,-1);if(n==46&&!e.shiftKey||$t&&n==68&&r=="c")return Td(t,1)||Mr(t,1);if(n==13||n==27)return!0;if(n==37||$t&&n==66&&r=="c"){let i=n==37?Sd(t,t.state.selection.from)=="ltr"?-1:1:-1;return wd(t,i,r)||Mr(t,i)}else if(n==39||$t&&n==70&&r=="c"){let i=n==39?Sd(t,t.state.selection.from)=="ltr"?1:-1:1;return wd(t,i,r)||Mr(t,i)}else{if(n==38||$t&&n==80&&r=="c")return kd(t,-1,r)||Mr(t,-1);if(n==40||$t&&n==78&&r=="c")return cv(t)||kd(t,1,r)||Mr(t,1);if(r==($t?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Ic(t,e){t.someProp("transformCopied",f=>{e=f(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let f=r.firstChild;n.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let o=t.someProp("clipboardSerializer")||xr.fromSchema(t.state.schema),a=Gh(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=qh[c.nodeName.toLowerCase()]);){for(let f=u.length-1;f>=0;f--){let h=a.createElement(u[f]);for(;l.firstChild;)h.appendChild(l.firstChild);l.appendChild(h),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(n)}`);let p=t.someProp("clipboardTextSerializer",f=>f(e,t))||e.content.textBetween(0,e.content.size,`
|
|
45
|
-
|
|
46
|
-
`);return{dom:l,text:p,slice:e}}function Dc(t,e,n,r,i){let s=i.parent.type.spec.code,o,a;if(!n&&!e)return null;let l=!!e&&(r||s||!n);if(l){if(t.someProp("transformPastedText",p=>{e=p(e,s||r,t)}),s)return a=new G(F.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
47
|
-
`))),0,0),t.someProp("transformPasted",p=>{a=p(a,t,!0)}),a;let d=t.someProp("clipboardTextParser",p=>p(e,i,r,t));if(d)a=d;else{let p=i.marks(),{schema:f}=t.state,h=xr.fromSchema(f);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(h.serializeNode(f.text(m,p)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),o=mv(n),Ns&&gv(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let p=o.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;o=p}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||zn.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||u),context:i,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!fv.test(p.parentNode.nodeName)?{ignore:!0}:null}})),u)a=bv(_d(a,+u[1],+u[2]),u[4]);else if(a=G.maxOpen(pv(a.content,i),!0),a.openStart||a.openEnd){let d=0,p=0;for(let f=a.content.firstChild;d<a.openStart&&!f.type.spec.isolating;d++,f=f.firstChild);for(let f=a.content.lastChild;p<a.openEnd&&!f.type.spec.isolating;p++,f=f.lastChild);a=_d(a,d,p)}return t.someProp("transformPasted",d=>{a=d(a,t,l)}),a}const fv=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function pv(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&s.length&&Wh(l,s,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=Kh(o[o.length-1],s.length));let u=Vh(a,l);o.push(u),i=i.matchType(u.type),s=l}}),o)return F.from(o)}return t}function Vh(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,F.from(t));return t}function Wh(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=Wh(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(F.from(Vh(n,t,i+1))))}}function Kh(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Kh(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(F.empty,!0);return t.copy(n.append(r))}function Wl(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,a=o.content;return t.childCount>1&&(s=0),i<r-1&&(a=Wl(a,e,n,r,i+1,s)),i>=n&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(F.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(a))}function _d(t,e,n){return e<t.openStart&&(t=new G(Wl(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new G(Wl(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const qh={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Ad=null;function Gh(){return Ad||(Ad=document.implementation.createHTMLDocument("title"))}let Ka=null;function hv(t){let e=window.trustedTypes;return e?(Ka||(Ka=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Ka.createHTML(t)):t}function mv(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Gh().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&qh[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=hv(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function gv(t){let e=t.querySelectorAll(ot?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function bv(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:o}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=F.from(l.create(r[a+1],i)),s++,o++}return new G(i,s,o)}const vt={},xt={},yv={touchstart:!0,touchmove:!0};class Ev{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function vv(t){for(let e in vt){let n=vt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{wv(t,r)&&!Lc(t,r)&&(t.editable||!(r.type in xt))&&n(t,r)},yv[e]?{passive:!0}:void 0)}ut&&t.dom.addEventListener("input",()=>null),Kl(t)}function Bn(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function xv(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Kl(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Lc(t,r))})}function Lc(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function wv(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function Sv(t,e){!Lc(t,e)&&vt[e.type]&&(t.editable||!(e.type in xt))&&vt[e.type](t,e)}xt.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Jh(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(xn&&ot&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Qr&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,tr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||dv(t,n)?n.preventDefault():Bn(t,"key")};xt.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};xt.keypress=(t,e)=>{let n=e;if(Jh(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||$t&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof le)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function Ea(t){return{left:t.clientX,top:t.clientY}}function kv(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Pc(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,a=>o>s.depth?a(t,n,s.nodeAfter,s.before(o),i,!0):a(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function Yr(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function Tv(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&ee.isSelectable(r)?(Yr(t,new ee(n)),!0):!1}function Nv(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof ee&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(ee.isSelectable(a)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(Yr(t,ee.create(t.state.doc,i)),!0):!1}function _v(t,e,n,r,i){return Pc(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?Nv(t,n):Tv(t,n))}function Av(t,e,n,r){return Pc(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function Cv(t,e,n,r){return Pc(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||Mv(t,n,r)}function Mv(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Yr(t,le.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)Yr(t,le.create(r,a+1,a+1+o.content.size));else if(ee.isSelectable(o))Yr(t,ee.create(r,a));else continue;return!0}}function Bc(t){return ls(t)}const Yh=$t?"metaKey":"ctrlKey";vt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Bc(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&kv(n,t.input.lastClick)&&!n[Yh]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button};let o=t.posAtCoords(Ea(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new Ov(t,o,n,!!r)):(s=="doubleClick"?Av:Cv)(t,o.pos,o.inside,n)?n.preventDefault():Bn(t,"pointer"))};class Ov{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Yh],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let u=e.state.doc.resolve(n.pos);s=u.parent,o=u.depth?u.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;r.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof ee&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ht&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Bn(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>kn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Ea(e))),this.updateAllowDefault(e),this.allowDefault||!n?Bn(this.view,"pointer"):_v(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ut&&this.mightDrag&&!this.mightDrag.node.isAtom||ot&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Yr(this.view,ue.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Bn(this.view,"pointer")}move(e){this.updateAllowDefault(e),Bn(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}vt.touchstart=t=>{t.input.lastTouch=Date.now(),Bc(t),Bn(t,"pointer")};vt.touchmove=t=>{t.input.lastTouch=Date.now(),Bn(t,"pointer")};vt.contextmenu=t=>Bc(t);function Jh(t,e){return t.composing?!0:ut&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Rv=xn?5e3:-1;xt.compositionstart=xt.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof le&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||ot&&Ah&&Iv(t)))t.markCursor=t.state.storedMarks||n.marks(),ls(t,!0),t.markCursor=null;else if(ls(t,!e.selection.empty),Ht&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let a=t.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}Xh(t,Rv)};function Iv(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}xt.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Xh(t,20))};function Xh(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>ls(t),e))}function Zh(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Lv());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Dv(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=NE(e.focusNode,e.focusOffset),r=_E(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function Lv(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function ls(t,e=!1){if(!(xn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Zh(t),e||t.docView&&t.docView.dirty){let n=Oc(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function Pv(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const cs=_t&&$n<15||Qr&&OE<604;vt.copy=xt.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=cs?null:n.clipboardData,o=r.content(),{dom:a,text:l}=Ic(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):Pv(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Bv(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Fv(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?us(t,r.value,null,i,e):us(t,r.textContent,r.innerHTML,i,e)},50)}function us(t,e,n,r,i){let s=Dc(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,s||G.empty)))return!0;if(!s)return!1;let o=Bv(s),a=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Qh(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}xt.paste=(t,e)=>{let n=e;if(t.composing&&!xn)return;let r=cs?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&us(t,Qh(r),r.getData("text/html"),i,n)?n.preventDefault():Fv(t,n)};class em{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const zv=$t?"altKey":"ctrlKey";function tm(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[zv]}vt.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(Ea(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof ee?i.to-1:i.to))){if(r&&r.mightDrag)o=ee.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(o=ee.create(t.state.doc,d.posBefore))}}let a=(o||t.state.selection).content(),{dom:l,text:c,slice:u}=Ic(t,a);(!n.dataTransfer.files.length||!ot||_h>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(cs?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",cs||n.dataTransfer.setData("text/plain",c),t.dragging=new em(u,tm(t,n),o)};vt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};xt.dragover=xt.dragenter=(t,e)=>e.preventDefault();xt.drop=(t,e)=>{try{$v(t,e,t.dragging)}finally{t.dragging=null}};function $v(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Ea(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",f=>{s=f(s,t,!1)}):s=Dc(t,Qh(e.dataTransfer),cs?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&tm(t,e));if(t.someProp("handleDrop",f=>f(t,e,s||G.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let a=s?eh(t.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let l=t.state.tr;if(o){let{node:f}=n;f?f.replace(l):l.deleteSelection()}let c=l.mapping.map(a),u=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=l.doc;if(u?l.replaceRangeWith(c,c,s.content.firstChild):l.replaceRange(c,c,s),l.doc.eq(d))return;let p=l.doc.resolve(c);if(u&&ee.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))l.setSelection(new ee(p));else{let f=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((h,m,g,y)=>f=y),l.setSelection(Rc(t,p,l.doc.resolve(f)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}vt.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&kn(t)},20))};vt.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};vt.beforeinput=(t,e)=>{if(ot&&xn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,tr(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in xt)vt[t]=xt[t];function ds(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Ao{constructor(e,n){this.toDOM=e,this.spec=n||cr,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new Qe(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Ao&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ds(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Hn{constructor(e,n){this.attrs=e,this.spec=n||cr}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new Qe(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Hn&&ds(this.attrs,e.attrs)&&ds(this.spec,e.spec)}static is(e){return e.type instanceof Hn}destroy(){}}class Fc{constructor(e,n){this.attrs=e,this.spec=n||cr}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new Qe(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof Fc&&ds(this.attrs,e.attrs)&&ds(this.spec,e.spec)}destroy(){}}class Qe{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Qe(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Qe(e,e,new Ao(n,r))}static inline(e,n,r,i){return new Qe(e,n,new Hn(r,i))}static node(e,n,r,i){return new Qe(e,n,new Fc(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Hn}get widget(){return this.type instanceof Ao}}const zr=[],cr={};class Ce{constructor(e,n){this.local=e.length?e:zr,this.children=n.length?n:zr}static create(e,n){return n.length?Co(n,e,0,cr):ct}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=n&&a.to>=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,n-a,r,i+a,s)}}map(e,n,r){return this==ct||e.maps.length==0?this:this.mapInner(e,n,0,0,r||cr)}mapInner(e,n,r,i,s){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(n,l)?(o||(o=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?Uv(this.children,o||[],e,n,r,i,s):o?new Ce(o.sort(ur),zr):ct}add(e,n){return n.length?this==ct?Ce.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((a,l)=>{let c=l+r,u;if(u=rm(n,a,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<l;)s+=3;i[s]==l?i[s+2]=i[s+2].addInner(a,u,c+1):i.splice(s,0,l,l+a.nodeSize,Co(u,a,c+1,cr)),s+=3}});let o=nm(s?im(n):n,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new Ce(o.length?this.local.concat(o).sort(ur):this.local,i||this.children)}remove(e){return e.length==0||this==ct?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,a=r[s]+n,l=r[s+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>a&&d.to<l&&(e[u]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(o,a+1);c!=ct?r[s+2]=c:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Ce(i,r):ct}forChild(e,n){if(this==ct)return this;if(n.isLeaf)return Ce.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,o=s+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>s&&l.type instanceof Hn){let c=Math.max(s,l.from)-s,u=Math.min(o,l.to)-s;c<u&&(i||(i=[])).push(l.copy(c,u))}}if(i){let a=new Ce(i.sort(ur),zr);return r?new Pn([a,r]):a}return r||ct}eq(e){if(this==e)return!0;if(!(e instanceof Ce)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return zc(this.localsInner(e))}localsInner(e){if(this==ct)return zr;if(e.inlineContent||!this.local.some(Hn.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Hn||n.push(this.local[r]);return n}forEachSet(e){e(this)}}Ce.empty=new Ce([],[]);Ce.removeOverlap=zc;const ct=Ce.empty;class Pn{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,cr));return Pn.from(r)}forChild(e,n){if(n.isLeaf)return Ce.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=ct&&(s instanceof Pn?r=r.concat(s.members):r.push(s))}return Pn.from(r)}eq(e){if(!(e instanceof Pn)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?zc(r?n:n.sort(ur)):zr}static from(e){switch(e.length){case 0:return ct;case 1:return e[0];default:return new Pn(e.every(n=>n instanceof Ce)?e:e.reduce((n,r)=>n.concat(r instanceof Ce?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function Uv(t,e,n,r,i,s,o){let a=t.slice();for(let c=0,u=s;c<n.maps.length;c++){let d=0;n.maps[c].forEach((p,f,h,m)=>{let g=m-h-(f-p);for(let y=0;y<a.length;y+=3){let w=a[y+1];if(w<0||p>w+u-d)continue;let S=a[y]+u-d;f>=S?a[y+1]=p<=S?-2:-1:p>=u&&g&&(a[y]+=g,a[y+1]+=g)}d+=g}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=n.map(t[c]+s),d=u-i;if(d<0||d>=r.content.size){l=!0;continue}let p=n.map(t[c+1]+s,-1),f=p-i,{index:h,offset:m}=r.content.findIndex(d),g=r.maybeChild(h);if(g&&m==d&&m+g.nodeSize==f){let y=a[c+2].mapInner(n,g,u+1,t[c]+s+1,o);y!=ct?(a[c]=d,a[c+1]=f,a[c+2]=y):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=Hv(a,t,e,n,i,s,o),u=Co(c,r,0,o);e=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,p=0;d<u.children.length;d+=3){let f=u.children[d];for(;p<a.length&&a[p]<f;)p+=3;a.splice(p,0,u.children[d],u.children[d+1],u.children[d+2])}}return new Ce(e.sort(ur),a)}function nm(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new Qe(i.from+e,i.to+e,i.type))}return n}function Hv(t,e,n,r,i,s,o){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(r,i,c);d?n.push(d):o.onRemove&&o.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+s+1);return n}function rm(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function im(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Co(t,e,n,r){let i=[],s=!1;e.forEach((a,l)=>{let c=rm(t,a,l+n);if(c){s=!0;let u=Co(c,a,n+l+1,r);u!=ct&&i.push(l,l+a.nodeSize,u)}});let o=nm(s?im(t):t,-n).sort(ur);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new Ce(o,i):ct}function ur(t,e){return t.from-e.from||t.to-e.to}function zc(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),Cd(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),Cd(e,i,r.copy(s.from,r.to)));break}}}return e}function Cd(t,e,n){for(;e<t.length&&ur(n,t[e])>0;)e++;t.splice(e,0,n)}function qa(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=ct&&e.push(r)}),t.cursorWrapper&&e.push(Ce.create(t.state.doc,[t.cursorWrapper.deco])),Pn.from(e)}const jv={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Vv=_t&&$n<=11;class Wv{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Kv{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Wv,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);_t&&$n<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():ut&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Vv&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,jv)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(xd(this.view)){if(this.suppressingSelectionUpdates)return kn(this.view);if(_t&&$n<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&gr(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let s=e.focusNode;s;s=Zr(s))n.add(s);for(let s=e.anchorNode;s;s=Zr(s))if(n.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&xd(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],l);d&&(s=s<0?d.from:Math.min(d.from,s),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(a=!0))}if(l.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of l)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;for(;d&&d.nodeType==1;){if(d.contentEditable=="false"){u.parentNode.removeChild(u);break}d=d.firstChild}}}else if(Ht&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,p]=u;d.parentNode&&d.parentNode.parentNode==p.parentNode?p.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let p of u){let f=p.parentNode;f&&f.nodeName=="LI"&&(!d||Yv(e,d)!=f)&&p.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ba(r)&&(c=Oc(e))&&c.eq(ue.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,kn(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),qv(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Jv(e,l)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||kn(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(_t&&$n<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:p}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(s=p)}let o=i&&i.parentNode==e.target?it(i)+1:0,a=r.localPosFromDOM(e.target,o,-1),l=s&&s.parentNode==e.target?it(s):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Md=new WeakMap,Od=!1;function qv(t){if(!Md.has(t)&&(Md.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Ht,Od)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Od=!0}}function Rd(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return gr(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function Gv(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return Rd(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Rd(t,n):null}function Yv(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function Jv(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=s.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let a=o;for(;;){let l=a.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;a=l}a.insertBefore(s,a.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function Xv(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:o,to:a}=t.docView.parseRange(e,n),l=t.domSelectionRange(),c,u=l.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],ba(l)||c.push({node:l.focusNode,offset:l.focusOffset})),ot&&t.input.lastKeyCode===8)for(let g=s;g>i;g--){let y=r.childNodes[g-1],w=y.pmViewDesc;if(y.nodeName=="BR"&&!w){s=g;break}if(!w||w.size)break}let d=t.state.doc,p=t.someProp("domParser")||zn.fromSchema(t.state.schema),f=d.resolve(o),h=null,m=p.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:i,to:s,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Zv,context:f});if(c&&c[0].pos!=null){let g=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=g),h={anchor:g+o,head:y+o}}return{doc:m,sel:h,from:o,to:a}}function Zv(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(ut&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||ut&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Qv=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function ex(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let k=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,R=Oc(t,k);if(R&&!t.state.selection.eq(R)){if(ot&&xn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",O=>O(t,tr(13,"Enter"))))return;let N=t.state.tr.setSelection(R);k=="pointer"?N.setMeta("pointer",!0):k=="key"&&N.scrollIntoView(),s&&N.setMeta("composition",s),t.dispatch(N)}return}let o=t.state.doc.resolve(e),a=o.sharedDepth(n);e=o.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,c=Xv(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),p,f;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(p=t.state.selection.to,f="end"):(p=t.state.selection.from,f="start"),t.input.lastKeyCode=null;let h=rx(d.content,c.doc.content,c.from,p,f);if(h&&t.input.domChangeCount++,(Qr&&t.input.lastIOSEnter>Date.now()-225||xn)&&i.some(k=>k.nodeType==1&&!Qv.test(k.nodeName))&&(!h||h.endA>=h.endB)&&t.someProp("handleKeyDown",k=>k(t,tr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!h)if(r&&l instanceof le&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))h={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let k=Id(t,t.state.doc,c.sel);if(k&&!k.eq(t.state.selection)){let R=t.state.tr.setSelection(k);s&&R.setMeta("composition",s),t.dispatch(R)}}return}t.state.selection.from<t.state.selection.to&&h.start==h.endB&&t.state.selection instanceof le&&(h.start>t.state.selection.from&&h.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?h.start=t.state.selection.from:h.endA<t.state.selection.to&&h.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(h.endB+=t.state.selection.to-h.endA,h.endA=t.state.selection.to)),_t&&$n<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>c.from&&c.doc.textBetween(h.start-c.from-1,h.start-c.from+1)==" "&&(h.start--,h.endA--,h.endB--);let m=c.doc.resolveNoCache(h.start-c.from),g=c.doc.resolveNoCache(h.endB-c.from),y=u.resolve(h.start),w=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=h.endA;if((Qr&&t.input.lastIOSEnter>Date.now()-225&&(!w||i.some(k=>k.nodeName=="DIV"||k.nodeName=="P"))||!w&&m.pos<c.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(c.doc.textBetween(m.pos,g.pos,"","")))&&t.someProp("handleKeyDown",k=>k(t,tr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>h.start&&nx(u,h.start,h.endA,m,g)&&t.someProp("handleKeyDown",k=>k(t,tr(8,"Backspace")))){xn&&ot&&t.domObserver.suppressSelectionUpdates();return}ot&&h.endB==h.start&&(t.input.lastChromeDelete=Date.now()),xn&&!w&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==h.endA&&(h.endB-=2,g=c.doc.resolveNoCache(h.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(k){return k(t,tr(13,"Enter"))})},20));let S=h.start,b=h.endA,x=k=>{let R=k||t.state.tr.replace(S,b,c.doc.slice(h.start-c.from,h.endB-c.from));if(c.sel){let N=Id(t,R.doc,c.sel);N&&!(ot&&t.composing&&N.empty&&(h.start!=h.endB||t.input.lastChromeDelete<Date.now()-100)&&(N.head==S||N.head==R.mapping.map(b)-1)||_t&&N.empty&&N.head==S)&&R.setSelection(N)}return s&&R.setMeta("composition",s),R.scrollIntoView()},T;if(w)if(m.pos==g.pos){_t&&$n<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>kn(t),20));let k=x(t.state.tr.delete(S,b)),R=u.resolve(h.start).marksAcross(u.resolve(h.endA));R&&k.ensureMarks(R),t.dispatch(k)}else if(h.endA==h.endB&&(T=tx(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,h.endA-y.start())))){let k=x(t.state.tr);T.type=="add"?k.addMark(S,b,T.mark):k.removeMark(S,b,T.mark),t.dispatch(k)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let k=m.parent.textBetween(m.parentOffset,g.parentOffset),R=()=>x(t.state.tr.insertText(k,S,b));t.someProp("handleTextInput",N=>N(t,S,b,k,R))||t.dispatch(R())}else t.dispatch(x());else t.dispatch(x())}function Id(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Rc(t,e.resolve(n.anchor),e.resolve(n.head))}function tx(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,a,l;for(let u=0;u<r.length;u++)i=r[u].removeFromSet(i);for(let u=0;u<n.length;u++)s=n[u].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],o="add",l=u=>u.mark(a.addToSet(u.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(l(e.child(u)));if(F.from(c).eq(t))return{mark:a,type:o}}function nx(t,e,n,r,i){if(n-e<=i.pos-r.pos||Ga(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let a=s.nodeAfter;return a!=null&&n==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=t.resolve(Ga(s,!0,!0));return!o.parent.isTextblock||o.pos>n||Ga(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Ga(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function rx(t,e,n,r,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:o,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let l=Math.max(0,s-Math.min(o,a));r-=o+l-s}if(o<s&&t.size<e.size){let l=r<=s&&r>=o?s-r:0;s-=l,s&&s<e.size&&Dd(e.textBetween(s-1,s+1))&&(s+=l?1:-1),a=s+(a-o),o=s}else if(a<s){let l=r<=s&&r>=a?s-r:0;s-=l,s&&s<t.size&&Dd(t.textBetween(s-1,s+1))&&(s+=l?1:-1),o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}function Dd(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}const ix=Dc,sx=ls;class $c{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Ev,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(zd),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Bd(this),Pd(this),this.nodeViews=Fd(this),this.docView=md(this.state.doc,Ld(this),qa(this),this.dom,this),this.domObserver=new Kv(this,(r,i,s,o)=>ex(this,r,i,s,o)),this.domObserver.start(),vv(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Kl(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(zd),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(Zh(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let f=Fd(this);ax(f,this.nodeViews)&&(this.nodeViews=f,s=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Kl(this),this.editable=Bd(this),Pd(this);let l=qa(this),c=Ld(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,c,l);(d||!e.selection.eq(i.selection))&&(o=!0);let p=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&DE(this);if(o){this.domObserver.stop();let f=d&&(_t||ot)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&ox(i.selection,e.selection);if(d){let h=ot?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Dv(this)),(s||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=md(e.doc,c,l,this.dom,this)),h&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&iv(this))?kn(this,f):(Uh(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():p&&LE(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof ee){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&cd(this,n.getBoundingClientRect(),e)}else cd(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new em(e.slice,e.move,i<0?void 0:ee.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=n?n(a):a))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let a=s[o].props[e];if(a!=null&&(i=n?n(a):a))return i}}hasFocus(){if(_t){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&PE(this.dom),kn(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return UE(this,e)}coordsAtPos(e,n=1){return Ih(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return KE(this,n||this.state,e)}pasteHTML(e,n){return us(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return us(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Ic(this,e)}destroy(){this.docView&&(xv(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],qa(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,kE())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Sv(this,e)}domSelectionRange(){let e=this.domSelection();return e?ut&&this.root.nodeType===11&&CE(this.dom.ownerDocument)==this.dom&&Gv(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}$c.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Ld(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Qe.node(0,t.state.doc.content.size,e)]}function Pd(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Qe.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Bd(t){return!t.someProp("editable",e=>e(t.state)===!1)}function ox(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Fd(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function ax(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function zd(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}const lx=Object.freeze(Object.defineProperty({__proto__:null,Decoration:Qe,DecorationSet:Ce,EditorView:$c,__endComposition:sx,__parseFromClipboard:ix},Symbol.toStringTag,{value:"Module"}));var jn={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Mo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},cx=typeof navigator<"u"&&/Mac/.test(navigator.platform),ux=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var st=0;st<10;st++)jn[48+st]=jn[96+st]=String(st);for(var st=1;st<=24;st++)jn[st+111]="F"+st;for(var st=65;st<=90;st++)jn[st]=String.fromCharCode(st+32),Mo[st]=String.fromCharCode(st);for(var Ya in jn)Mo.hasOwnProperty(Ya)||(Mo[Ya]=jn[Ya]);function dx(t){var e=cx&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||ux&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Mo:jn)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const fx=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),px=typeof navigator<"u"&&/Win/.test(navigator.platform);function hx(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))fx?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),o&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function mx(t){let e=Object.create(null);for(let n in t)e[hx(n)]=t[n];return e}function Ja(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function gx(t){return new Me({props:{handleKeyDown:sm(t)}})}function sm(t){let e=mx(t);return function(n,r){let i=dx(r),s,o=e[Ja(i,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[Ja(i,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(px&&r.ctrlKey&&r.altKey)&&(s=jn[r.keyCode])&&s!=i){let a=e[Ja(s,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}var bx=Object.defineProperty,Uc=(t,e)=>{for(var n in e)bx(t,n,{get:e[n],enumerable:!0})};function va(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,s=n.storedMarks,n}}}var xa=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:i}=n,s=this.buildProps(i);return Object.fromEntries(Object.entries(t).map(([o,a])=>[o,(...c)=>{const u=a(...c)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:s}=r,o=[],a=!!t,l=t||i.tr,c=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(l),o.every(d=>d===!0)),u={...Object.fromEntries(Object.entries(n).map(([d,p])=>[d,(...h)=>{const m=this.buildProps(l,e),g=p(...h)(m);return o.push(g),u}])),run:c};return u}createCan(t){const{rawCommands:e,state:n}=this,r=!1,i=t||n.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>l(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:s}=r,o={tr:t,editor:r,view:s,state:va({state:i,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([a,l])=>[a,(...c)=>l(...c)(o)]))}};return o}},om={};Uc(om,{blur:()=>yx,clearContent:()=>Ex,clearNodes:()=>vx,command:()=>xx,createParagraphNear:()=>wx,cut:()=>Sx,deleteCurrentNode:()=>kx,deleteNode:()=>Tx,deleteRange:()=>Nx,deleteSelection:()=>Cx,enter:()=>Mx,exitCode:()=>Ox,extendMarkRange:()=>Rx,first:()=>Ix,focus:()=>Lx,forEach:()=>Px,insertContent:()=>Bx,insertContentAt:()=>$x,joinBackward:()=>jx,joinDown:()=>Hx,joinForward:()=>Vx,joinItemBackward:()=>Wx,joinItemForward:()=>Kx,joinTextblockBackward:()=>qx,joinTextblockForward:()=>Gx,joinUp:()=>Ux,keyboardShortcut:()=>Jx,lift:()=>Xx,liftEmptyBlock:()=>Zx,liftListItem:()=>Qx,newlineInCode:()=>e0,resetAttributes:()=>t0,scrollIntoView:()=>n0,selectAll:()=>r0,selectNodeBackward:()=>i0,selectNodeForward:()=>s0,selectParentNode:()=>o0,selectTextblockEnd:()=>a0,selectTextblockStart:()=>l0,setContent:()=>c0,setMark:()=>O0,setMeta:()=>R0,setNode:()=>I0,setNodeSelection:()=>D0,setTextDirection:()=>L0,setTextSelection:()=>P0,sinkListItem:()=>B0,splitBlock:()=>F0,splitListItem:()=>z0,toggleList:()=>U0,toggleMark:()=>H0,toggleNode:()=>j0,toggleWrap:()=>V0,undoInputRule:()=>W0,unsetAllMarks:()=>K0,unsetMark:()=>q0,unsetTextDirection:()=>G0,updateAttributes:()=>Y0,wrapIn:()=>J0,wrapInList:()=>X0});var yx=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),Ex=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),vx=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:o})=>{t.doc.nodesBetween(s.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(l)),p=c.resolve(u.map(l+a.nodeSize)),f=d.blockRange(p);if(!f)return;const h=fi(f);if(a.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(f.start,m)}(h||h===0)&&e.lift(f,h)})}),!0},xx=t=>e=>t(e),wx=()=>({state:t,dispatch:e})=>wh(t,e),Sx=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new le(r.doc.resolve(Math.max(o-1,0)))),!0},kx=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const a=i.before(s),l=i.after(s);t.delete(a,l).scrollIntoView()}return!0}return!1};function Ke(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var Tx=t=>({tr:e,state:n,dispatch:r})=>{const i=Ke(t,n.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const l=s.before(o),c=s.after(o);e.delete(l,c).scrollIntoView()}return!0}return!1},Nx=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},_x=t=>t.content?/^text(\*|\+)/.test(t.content):!1,$d=(t,e,n)=>{if(!t.parent.isInline||n==="left"&&t.pos>t.start()||n==="right"&&t.pos<t.end())return t.pos;const r=e.nodes[t.parent.type.name].spec;return _x(r)?n==="left"?t.start()-1:t.end()+1:t.pos},Ax=(t,e,n)=>{const r=$d(t,n,"left"),i=$d(e,n,"right");return{from:r,to:i}},Cx=()=>({state:t,dispatch:e})=>{const{$from:n,$to:r}=t.selection;if(t.selection.empty)return!1;const{from:i,to:s}=Ax(n,r,t.schema);return e&&(t.tr.deleteRange(i,s).scrollIntoView(),e(t.tr)),!0},Mx=()=>({commands:t})=>t.keyboardShortcut("Enter"),Ox=()=>({state:t,dispatch:e})=>cE(t,e);function Hc(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Oo(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:Hc(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function am(t,e,n={}){return t.find(r=>r.type===e&&Oo(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function Ud(t,e,n={}){return!!am(t,e,n)}function jc(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(c=>c.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(c=>c.type===e))return;if(!n){const c=r.node.marks.find(u=>u.type===e);c&&(n=c.attrs)}if(!am([...r.node.marks],e,n))return;let s=r.index,o=t.start()+r.offset,a=s+1,l=o+r.node.nodeSize;for(;s>0&&Ud([...t.parent.child(s-1).marks],e,n);)s-=1,o-=t.parent.child(s).nodeSize;for(;a<t.parent.childCount&&Ud([...t.parent.child(a).marks],e,n);)l+=t.parent.child(a).nodeSize,a+=1;return{from:o,to:l}}function _n(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var Rx=(t,e)=>({tr:n,state:r,dispatch:i})=>{const s=_n(t,r.schema),{doc:o,selection:a}=n,{$from:l,from:c,to:u}=a;if(i){const d=jc(l,s,e);if(d&&d.from<=c&&d.to>=u){const p=le.create(o,d.from,d.to);n.setSelection(p)}}return!0},Ix=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function Vc(t){return t instanceof le}function ir(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function lm(t,e=null){if(!e)return null;const n=ue.atStart(t),r=ue.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?le.create(t,ir(0,i,s),ir(t.content.size,i,s)):le.create(t,ir(e,i,s),ir(e,i,s))}function ql(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function fs(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Dx(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var Lx=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(fs()||ql())&&r.dom.focus(),Dx()&&!fs()&&!ql()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(s&&t===null&&!Vc(n.state.selection))return o(),!0;const a=lm(i.doc,t)||n.state.selection,l=n.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},Px=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),Bx=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),cm=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&cm(r)}return t};function zs(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return cm(n)}function ps(t,e,n){if(t instanceof Qt||t instanceof F)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return F.fromArray(t.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),ps("",e,n)}if(i){if(n.errorOnInvalidContent){let o=!1,a="";const l=new jp({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?zn.fromSchema(l).parseSlice(zs(t),n.parseOptions):zn.fromSchema(l).parse(zs(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=zn.fromSchema(e);return n.slice?s.parseSlice(zs(t),n.parseOptions).content:s.parse(zs(t),n.parseOptions)}return ps("",e,n)}function Fx(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof Wt||i instanceof Mt))return;const s=t.mapping.maps[r];let o=0;s.forEach((a,l,c,u)=>{o===0&&(o=u)}),t.setSelection(ue.near(t.doc.resolve(o),n))}var zx=t=>!("type"in t),$x=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const l=g=>{s.emit("contentError",{editor:s,error:g,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{ps(e,s.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(g){l(g)}try{a=ps(e,s.schema,{parseOptions:c,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:s.options.enableContentCheck})}catch(g){return l(g),!1}let{from:u,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},p=!0,f=!0;if((zx(a)?a:[a]).forEach(g=>{g.check(),p=p?g.isText&&g.marks.length===0:!1,f=f?g.isBlock:!1}),u===d&&f){const{parent:g}=r.doc.resolve(u);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(u-=1,d+=1)}let m;if(p){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof F){let g="";e.forEach(y=>{y.text&&(g+=y.text)}),m=g}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,u,d)}else{m=a;const g=r.doc.resolve(u),y=g.node(),w=g.parentOffset===0,S=y.isText||y.isTextblock,b=y.content.size>0;w&&S&&b&&f&&(u=Math.max(0,u-1)),r.replaceWith(u,d,m)}n.updateSelection&&Fx(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:m})}return!0},Ux=()=>({state:t,dispatch:e})=>oE(t,e),Hx=()=>({state:t,dispatch:e})=>aE(t,e),jx=()=>({state:t,dispatch:e})=>mh(t,e),Vx=()=>({state:t,dispatch:e})=>Eh(t,e),Wx=()=>({state:t,dispatch:e,tr:n})=>{try{const r=ma(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Kx=()=>({state:t,dispatch:e,tr:n})=>{try{const r=ma(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},qx=()=>({state:t,dispatch:e})=>iE(t,e),Gx=()=>({state:t,dispatch:e})=>sE(t,e);function um(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Yx(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))fs()||um()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}var Jx=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=Yx(t).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,a))});return l==null||l.steps.forEach(c=>{const u=c.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};function Vn(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,o=e?Ke(e,t.schema):null,a=[];t.doc.nodesBetween(r,i,(d,p)=>{if(d.isText)return;const f=Math.max(r,p),h=Math.min(i,p+d.nodeSize);a.push({node:d,from:f,to:h})});const l=i-r,c=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>Oo(d.node.attrs,n,{strict:!1}));return s?!!c.length:c.reduce((d,p)=>d+p.to-p.from,0)>=l}var Xx=(t,e={})=>({state:n,dispatch:r})=>{const i=Ke(t,n.schema);return Vn(n,i,e)?lE(n,r):!1},Zx=()=>({state:t,dispatch:e})=>Sh(t,e),Qx=t=>({state:e,dispatch:n})=>{const r=Ke(t,e.schema);return vE(r)(e,n)},e0=()=>({state:t,dispatch:e})=>xh(t,e);function wa(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Hd(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}var t0=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=wa(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(s=Ke(t,r.schema)),a==="mark"&&(o=_n(t,r.schema));let l=!1;return n.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,d)=>{s&&s===u.type&&(l=!0,i&&n.setNodeMarkup(d,void 0,Hd(u.attrs,e))),o&&u.marks.length&&u.marks.forEach(p=>{o===p.type&&(l=!0,i&&n.addMark(d,d+u.nodeSize,o.create(Hd(p.attrs,e))))})})}),l},n0=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),r0=()=>({tr:t,dispatch:e})=>{if(e){const n=new Sn(t.doc);t.setSelection(n)}return!0},i0=()=>({state:t,dispatch:e})=>bh(t,e),s0=()=>({state:t,dispatch:e})=>vh(t,e),o0=()=>({state:t,dispatch:e})=>fE(t,e),a0=()=>({state:t,dispatch:e})=>mE(t,e),l0=()=>({state:t,dispatch:e})=>hE(t,e);function Gl(t,e,n={},r={}){return ps(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var c0=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:o,commands:a})=>{const{doc:l}=s;if(r.preserveWhitespace!=="full"){const c=Gl(t,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return o&&s.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!n),!0}return o&&s.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},t,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function dm(t,e){const n=_n(e,t.schema),{from:r,to:i,empty:s}=t.selection,o=[];s?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function fm(t,e){const n=new ah(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function u0(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Yl(t,e){const n=[];return t.descendants((r,i)=>{e(r)&&n.push({node:r,pos:i})}),n}function d0(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function f0(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Sa(t){return e=>f0(e.$from,t)}function te(t,e,n){return t.config[e]===void 0&&t.parent?te(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?te(t.parent,e,n):null}):t.config[e]}function Wc(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=te(e,"addExtensions",n);return r?[e,...Wc(r())]:e}).flat(10)}function Kc(t,e){const n=xr.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function pm(t){return typeof t=="function"}function we(t,e=void 0,...n){return pm(t)?e?t.bind(e)(...n):t(...n):t}function p0(t={}){return Object.keys(t).length===0&&t.constructor===Object}function ei(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function hm(t){const e=[],{nodeExtensions:n,markExtensions:r}=ei(t),i=[...n,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(c=>c.name!=="text").map(c=>c.name),a=r.map(c=>c.name),l=[...o,...a];return t.forEach(c=>{const u={name:c.name,options:c.options,storage:c.storage,extensions:i},d=te(c,"addGlobalAttributes",u);if(!d)return;d().forEach(f=>{let h;Array.isArray(f.types)?h=f.types:f.types==="*"?h=l:f.types==="nodes"?h=o:f.types==="marks"?h=a:h=[],h.forEach(m=>{Object.entries(f.attributes).forEach(([g,y])=>{e.push({type:m,name:g,attribute:{...s,...y}})})})})}),i.forEach(c=>{const u={name:c.name,options:c.options,storage:c.storage},d=te(c,"addAttributes",u);if(!d)return;const p=d();Object.entries(p).forEach(([f,h])=>{const m={...s,...h};typeof(m==null?void 0:m.default)=="function"&&(m.default=m.default()),m!=null&&m.isRequired&&(m==null?void 0:m.default)===void 0&&delete m.default,e.push({type:c.name,name:f,attribute:m})})}),e}function h0(t){const e=[];let n="",r=!1,i=!1,s=0;const o=t.length;for(let a=0;a<o;a+=1){const l=t[a];if(l==="'"&&!i){r=!r,n+=l;continue}if(l==='"'&&!r){i=!i,n+=l;continue}if(!r&&!i){if(l==="("){s+=1,n+=l;continue}if(l===")"&&s>0){s-=1,n+=l;continue}if(l===";"&&s===0){e.push(n),n="";continue}}n+=l}return n&&e.push(n),e}function jd(t){const e=[],n=h0(t||""),r=n.length;for(let i=0;i<r;i+=1){const s=n[i],o=s.indexOf(":");if(o===-1)continue;const a=s.slice(0,o).trim(),l=s.slice(o+1).trim();a&&l&&e.push([a,l])}return e}function Ae(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const a=s?String(s).split(" "):[],l=r[i]?r[i].split(" "):[],c=a.filter(u=>!l.includes(u));r[i]=[...l,...c].join(" ")}else if(i==="style"){const a=new Map([...jd(r[i]),...jd(s)]);r[i]=Array.from(a.entries()).map(([l,c])=>`${l}: ${c}`).join("; ")}else r[i]=s}),r},{})}function ti(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>Ae(n,r),{})}function m0(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Vd(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(n):m0(n.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...r,...i}}}}function Wd(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&p0(n)?!1:n!=null))}function Kd(t){var e,n;const r={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(r.default=t.attribute.default),((n=t==null?void 0:t.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function g0(t,e){var n;const r=hm(t),{nodeExtensions:i,markExtensions:s}=ei(t),o=(n=i.find(c=>te(c,"topNode")))==null?void 0:n.name,a=Object.fromEntries(i.map(c=>{const u=r.filter(y=>y.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},p=t.reduce((y,w)=>{const S=te(w,"extendNodeSchema",d);return{...y,...S?S(c):{}}},{}),f=Wd({...p,content:we(te(c,"content",d)),marks:we(te(c,"marks",d)),group:we(te(c,"group",d)),inline:we(te(c,"inline",d)),atom:we(te(c,"atom",d)),selectable:we(te(c,"selectable",d)),draggable:we(te(c,"draggable",d)),code:we(te(c,"code",d)),whitespace:we(te(c,"whitespace",d)),linebreakReplacement:we(te(c,"linebreakReplacement",d)),defining:we(te(c,"defining",d)),isolating:we(te(c,"isolating",d)),attrs:Object.fromEntries(u.map(Kd))}),h=we(te(c,"parseHTML",d));h&&(f.parseDOM=h.map(y=>Vd(y,u)));const m=te(c,"renderHTML",d);m&&(f.toDOM=y=>m({node:y,HTMLAttributes:ti(y,u)}));const g=te(c,"renderText",d);return g&&(f.toText=g),[c.name,f]})),l=Object.fromEntries(s.map(c=>{const u=r.filter(g=>g.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},p=t.reduce((g,y)=>{const w=te(y,"extendMarkSchema",d);return{...g,...w?w(c):{}}},{}),f=Wd({...p,inclusive:we(te(c,"inclusive",d)),excludes:we(te(c,"excludes",d)),group:we(te(c,"group",d)),spanning:we(te(c,"spanning",d)),code:we(te(c,"code",d)),attrs:Object.fromEntries(u.map(Kd))}),h=we(te(c,"parseHTML",d));h&&(f.parseDOM=h.map(g=>Vd(g,u)));const m=te(c,"renderHTML",d);return m&&(f.toDOM=g=>m({mark:g,HTMLAttributes:ti(g,u)})),[c.name,f]}));return new jp({topNode:o,nodes:a,marks:l})}function b0(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function qi(t){return t.sort((n,r)=>{const i=te(n,"priority")||100,s=te(r,"priority")||100;return i>s?-1:i<s?1:0})}function mm(t){const e=qi(Wc(t)),n=b0(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function gm(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
|
|
48
|
-
|
|
49
|
-
`,textSerializers:o={}}=n||{};let a="";return t.nodesBetween(r,i,(l,c,u,d)=>{var p;l.isBlock&&c>r&&(a+=s);const f=o==null?void 0:o[l.type.name];if(f)return u&&(a+=f({node:l,pos:c,parent:u,index:d,range:e})),!1;l.isText&&(a+=(p=l==null?void 0:l.text)==null?void 0:p.slice(Math.max(r,c)-c,i-c))}),a}function y0(t,e){const n={from:0,to:t.content.size};return gm(t,n,e)}function bm(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function E0(t,e){const n=Ke(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===n.name);return o?{...o.attrs}:{}}function ym(t,e){const n=wa(typeof e=="string"?e:e.name,t.schema);return n==="node"?E0(t,e):n==="mark"?dm(t,e):{}}function v0(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function x0(t){const e=v0(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,o)=>o!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function Em(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=n[s];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const c=e.slice(s).map(a,-1),u=e.slice(s).map(l),d=e.invert().map(c,-1),p=e.invert().map(u);r.push({oldRange:{from:d,to:p},newRange:{from:c,to:u}})})}),x0(r)}function qc(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t),o=jc(s,i.type);o&&r.push({mark:i,...o})}):n.nodesBetween(t,e,(i,s)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}var w0=(t,e,n,r=20)=>{const i=t.doc.resolve(n);let s=r,o=null;for(;s>0&&o===null;){const a=i.node(s);(a==null?void 0:a.type.name)===e?o=a:s-=1}return[o,s]};function Ei(t,e){return e.nodes[t]||e.marks[t]||null}function fo(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}var S0=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,a)=>{var l,c;const u=((c=(l=i.type.spec).toText)==null?void 0:c.call(l,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?u:u.slice(0,Math.max(0,r-s))}),n};function Jl(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?_n(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>Oo(d.attrs,n,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:d,$to:p})=>{const f=d.pos,h=p.pos;t.doc.nodesBetween(f,h,(m,g)=>{if(s&&m.inlineContent&&!m.type.allowsMarkType(s))return!1;if(!m.isText&&!m.marks.length)return;const y=Math.max(f,g),w=Math.min(h,g+m.nodeSize),S=w-y;o+=S,a.push(...m.marks.map(b=>({mark:b,from:y,to:w})))})}),o===0)return!1;const l=a.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>Oo(d.mark.attrs,n,{strict:!1})).reduce((d,p)=>d+p.to-p.from,0),c=a.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,p)=>d+p.to-p.from,0);return(l>0?l+c:l)>=o}function k0(t,e,n={}){if(!e)return Vn(t,null,n)||Jl(t,null,n);const r=wa(e,t.schema);return r==="node"?Vn(t,e,n):r==="mark"?Jl(t,e,n):!1}var T0=(t,e)=>{const{$from:n,$to:r,$anchor:i}=t.selection;if(e){const s=Sa(a=>a.type.name===e)(t.selection);if(!s)return!1;const o=t.doc.resolve(s.pos+1);return i.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},N0=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function qd(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Xa(t,e){const{nodeExtensions:n}=ei(e),r=n.find(o=>o.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=we(te(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function hs(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return!/\S/.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(s=>{i!==!1&&(hs(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function vm(t){return t instanceof ee}function _0({selection:t,pos:e,nodeSize:n,selectedOnTextSelection:r=!1}){const{from:i,to:s}=t;return!!(i<=e&&s>=e+n||r&&Vc(t)&&i>e&&s<e+n)}var xm=class wm{constructor(e){this.position=e}static fromJSON(e){return new wm(e.position)}toJSON(){return{position:this.position}}};function A0(t,e){const n=e.mapping.mapResult(t.position);return{position:new xm(n.pos),mapResult:n}}function C0(t){return new xm(t)}function M0(t,e,n){var r;const{selection:i}=e;let s=null;if(Vc(i)&&(s=i.$cursor),s){const a=(r=t.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(n)&&(!!n.isInSet(a)||!a.some(c=>c.type.excludes(n)))}const{ranges:o}=i;return o.some(({$from:a,$to:l})=>{let c=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(u,d,p)=>{if(c)return!1;if(u.isInline){const f=!p||p.type.allowsMarkType(n),h=!!n.isInSet(u.marks)||!u.marks.some(m=>m.type.excludes(n));c=f&&h}return!c}),c})}var O0=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:o,ranges:a}=s,l=_n(t,r.schema);if(i)if(o){const c=dm(r,l);n.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(p,f)=>{const h=Math.max(f,u),m=Math.min(f+p.nodeSize,d);p.marks.find(y=>y.type===l)?p.marks.forEach(y=>{l===y.type&&n.addMark(h,m,l.create({...y.attrs,...e}))}):n.addMark(h,m,l.create(e))})});return M0(r,n,l)},R0=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),I0=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=Ke(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:a})=>od(s,{...o,...e})(n)?!0:a.clearNodes()).command(({state:a})=>od(s,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},D0=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=ir(t,0,r.content.size),s=ee.create(r,i);e.setSelection(s)}return!0},L0=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=r;let o,a;return typeof e=="number"?(o=e,a=e):e&&"from"in e&&"to"in e?(o=e.from,a=e.to):(o=s.from,a=s.to),i&&n.doc.nodesBetween(o,a,(l,c)=>{l.isText||n.setNodeMarkup(c,void 0,{...l.attrs,dir:t})}),!0},P0=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,o=le.atStart(r).from,a=le.atEnd(r).to,l=ir(i,o,a),c=ir(s,o,a),u=le.create(r,l,c);e.setSelection(u)}return!0},B0=t=>({state:e,dispatch:n})=>{const r=Ke(t,e.schema);return SE(r)(e,n)};function Gd(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e==null?void 0:e.includes(i.type.name));t.tr.ensureMarks(r)}}var F0=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:l}=s,c=i.extensionManager.attributes,u=fo(c,a.node().type.name,a.node().attrs);if(s instanceof ee&&s.node.isBlock)return!a.parentOffset||!wn(o,a.pos)?!1:(r&&(t&&Gd(n,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,p=a.depth===0?void 0:u0(a.node(-1).contentMatchAt(a.indexAfter(-1)));let f=d&&p?[{type:p,attrs:u}]:void 0,h=wn(e.doc,e.mapping.map(a.pos),1,f);if(!f&&!h&&wn(e.doc,e.mapping.map(a.pos),1,p?[{type:p}]:void 0)&&(h=!0,f=p?[{type:p,attrs:u}]:void 0),r){if(h&&(s instanceof le&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,f),p&&!d&&!a.parentOffset&&a.parent.type!==p)){const m=e.mapping.map(a.before()),g=e.doc.resolve(m);a.node(-1).canReplaceWith(g.index(),g.index()+1,p)&&e.setNodeMarkup(e.mapping.map(a.before()),p)}t&&Gd(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return h},z0=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var o;const a=Ke(t,r.schema),{$from:l,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;const d=l.node(-1);if(d.type!==a)return!1;const p=s.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let y=F.empty;const w=l.index(-1)?1:l.index(-2)?2:3;for(let R=l.depth-w;R>=l.depth-3;R-=1)y=F.from(l.node(R).copy(y));const S=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,b={...fo(p,l.node().type.name,l.node().attrs),...e},x=((o=a.contentMatch.defaultType)==null?void 0:o.createAndFill(b))||void 0;y=y.append(F.from(a.createAndFill(null,x)||void 0));const T=l.before(l.depth-(w-1));n.replace(T,l.after(-S),new G(y,4-w,0));let k=-1;n.doc.nodesBetween(T,n.doc.content.size,(R,N)=>{if(k>-1)return!1;R.isTextblock&&R.content.size===0&&(k=N+1)}),k>-1&&n.setSelection(le.near(n.doc.resolve(k))),n.scrollIntoView()}return!0}const f=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,h={...fo(p,d.type.name,d.attrs),...e},m={...fo(p,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,c.pos);const g=f?[{type:a,attrs:h},{type:f,attrs:m}]:[{type:a,attrs:h}];if(!wn(n.doc,l.pos,2))return!1;if(i){const{selection:y,storedMarks:w}=r,{splittableMarks:S}=s.extensionManager,b=w||y.$to.parentOffset&&y.$from.marks();if(n.split(l.pos,2,g).scrollIntoView(),!b||!i)return!0;const x=b.filter(T=>S.includes(T.type.name));n.ensureMarks(x)}return!0},Za=(t,e)=>{const n=Sa(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Wn(t.doc,n.pos)&&t.join(n.pos),!0},Qa=(t,e)=>{const n=Sa(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Wn(t.doc,r)&&t.join(r),!0};function $0(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=e.resolve(1),i=e.resolve(n.nodeSize-1);return le.between(r,i)}var U0=(t,e,n,r={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:p}=i.extensionManager,f=Ke(t,o.schema),h=Ke(e,o.schema),{selection:m,storedMarks:g}=o,{$from:y,$to:w}=m,S=y.blockRange(w),b=g||m.$to.parentOffset&&m.$from.marks();if(!S)return!1;const x=Sa(U=>Xa(U.type.name,d))(m),T=m.from===0&&m.to===o.doc.content.size,k=o.doc.content.content,R=k.length===1?k[0]:null,N=T&&R&&Xa(R.type.name,d)?{node:R,pos:0}:null,O=x??N,j=!!x&&S.depth>=1&&S.depth-x.depth<=1,V=!!N;if((j||V)&&O){if(O.node.type===f)return T&&V?l().command(({tr:U,dispatch:B})=>{const H=$0(U);return H?(U.setSelection(H),B&&B(U),!0):!1}).liftListItem(h).run():c.liftListItem(h);if(Xa(O.node.type.name,d)&&f.validContent(O.node.content))return l().command(()=>(s.setNodeMarkup(O.pos,f),!0)).command(()=>Za(s,f)).command(()=>Qa(s,f)).run()}return!n||!b||!a?l().command(()=>u().wrapInList(f,r)?!0:c.clearNodes()).wrapInList(f,r).command(()=>Za(s,f)).command(()=>Qa(s,f)).run():l().command(()=>{const U=u().wrapInList(f,r),B=b.filter(H=>p.includes(H.type.name));return s.ensureMarks(B),U?!0:c.clearNodes()}).wrapInList(f,r).command(()=>Za(s,f)).command(()=>Qa(s,f)).run()},H0=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,o=_n(t,r.schema);return Jl(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},j0=(t,e,n={})=>({state:r,commands:i})=>{const s=Ke(t,r.schema),o=Ke(e,r.schema),a=Vn(r,s,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?i.setNode(o,l):i.setNode(s,{...l,...n})},V0=(t,e={})=>({state:n,commands:r})=>{const i=Ke(t,n.schema);return Vn(n,i,e)?r.lift(i):r.wrapIn(i,e)},W0=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const o=t.tr,a=s.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,l))}else o.delete(s.from,s.to)}return!0}}return!1},K0=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{ignoreClearable:i=!1}=t,{selection:s}=e,{empty:o,ranges:a}=s;if(o)return!0;const{nonClearableMarks:l}=r.extensionManager;if(n){const c=Object.values(r.schema.marks).filter(u=>i||!l.includes(u.name));a.forEach(u=>{for(const d of c)e.removeMark(u.$from.pos,u.$to.pos,d)})}return!0},q0=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=n,l=_n(t,r.schema),{$from:c,empty:u,ranges:d}=a;if(!i)return!0;if(u&&o){let{from:p,to:f}=a;const h=(s=c.marks().find(g=>g.type===l))==null?void 0:s.attrs,m=jc(c,l,h);m&&(p=m.from,f=m.to),n.removeMark(p,f,l)}else d.forEach(p=>{n.removeMark(p.$from.pos,p.$to.pos,l)});return n.removeStoredMark(l),!0},G0=t=>({tr:e,state:n,dispatch:r})=>{const{selection:i}=n;let s,o;return typeof t=="number"?(s=t,o=t):t&&"from"in t&&"to"in t?(s=t.from,o=t.to):(s=i.from,o=i.to),r&&e.doc.nodesBetween(s,o,(a,l)=>{if(a.isText)return;const c={...a.attrs};delete c.dir,e.setNodeMarkup(l,void 0,c)}),!0},Y0=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=wa(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(s=Ke(t,r.schema)),a==="mark"&&(o=_n(t,r.schema));let l=!1;return n.selection.ranges.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;let p,f,h,m;n.selection.empty?r.doc.nodesBetween(u,d,(g,y)=>{s&&s===g.type&&(l=!0,h=Math.max(y,u),m=Math.min(y+g.nodeSize,d),p=y,f=g)}):r.doc.nodesBetween(u,d,(g,y)=>{y<u&&s&&s===g.type&&(l=!0,h=Math.max(y,u),m=Math.min(y+g.nodeSize,d),p=y,f=g),y>=u&&y<=d&&(s&&s===g.type&&(l=!0,i&&n.setNodeMarkup(y,void 0,{...g.attrs,...e})),o&&g.marks.length&&g.marks.forEach(w=>{if(o===w.type&&(l=!0,i)){const S=Math.max(y,u),b=Math.min(y+g.nodeSize,d);n.addMark(S,b,o.create({...w.attrs,...e}))}}))}),f&&(p!==void 0&&i&&n.setNodeMarkup(p,void 0,{...f.attrs,...e}),o&&f.marks.length&&f.marks.forEach(g=>{o===g.type&&i&&n.addMark(h,m,o.create({...g.attrs,...e}))}))}),l},J0=(t,e={})=>({state:n,dispatch:r})=>{const i=Ke(t,n.schema);return gE(i,e)(n,r)},X0=(t,e={})=>({state:n,dispatch:r})=>{const i=Ke(t,n.schema);return bE(i,e)(n,r)},Z0=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},ka=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},Q0=(t,e)=>{if(Hc(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function $s(t){var e;const{editor:n,from:r,to:i,text:s,rules:o,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(p=>p.type.spec.code))return!1;let u=!1;const d=S0(c)+s;return o.forEach(p=>{if(u)return;const f=Q0(d,p.find);if(!f)return;const h=l.state.tr,m=va({state:l.state,transaction:h}),g={from:r-(f[0].length-s.length),to:i},{commands:y,chain:w,can:S}=new xa({editor:n,state:m});p.handler({state:m,range:g,match:f,commands:y,chain:w,can:S})===null||!h.steps.length||(p.undoable&&h.setMeta(a,{transform:h,from:r,to:i,text:s}),l.dispatch(h),u=!0)}),u}function ew(t){const{editor:e,rules:n}=t,r=new Me({state:{init(){return null},apply(i,s,o){const a=i.getMeta(r);if(a)return a;const l=i.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=Kc(F.from(u),o.schema);const{from:d}=l,p=d+u.length;$s({editor:e,from:d,to:p,text:u,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return $s({editor:e,from:s,to:o,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&$s({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?$s({editor:e,from:o.pos,to:o.pos,text:`
|
|
50
|
-
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function tw(t){return Object.prototype.toString.call(t).slice(8,-1)}function Us(t){return tw(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Sm(t,e){const n={...t};return Us(t)&&Us(e)&&Object.keys(e).forEach(r=>{Us(e[r])&&Us(t[r])?n[r]=Sm(t[r],e[r]):n[r]=e[r]}),n}var Gc=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...we(te(this,"addOptions",{name:this.name}))}}get storage(){return{...we(te(this,"addStorage",{name:this.name,options:this.options}))}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>Sm(this.options,t)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},qn=class km extends Gc{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new km(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(c=>(c==null?void 0:c.type.name)===n.name))return!1;const l=o.find(c=>(c==null?void 0:c.type.name)===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function nw(t){return typeof t=="number"}var Tm=class{constructor(t){this.find=t.find,this.handler=t.handler}},rw=(t,e,n)=>{if(Hc(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=t,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function iw(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:o,dropEvent:a}=t,{commands:l,chain:c,can:u}=new xa({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,i,(f,h)=>{var m,g,y,w,S;if((g=(m=f.type)==null?void 0:m.spec)!=null&&g.code||!(f.isText||f.isTextblock||f.isInline))return;const b=(S=(w=(y=f.content)==null?void 0:y.size)!=null?w:f.nodeSize)!=null?S:0,x=Math.max(r,h),T=Math.min(i,h+b);if(x>=T)return;const k=f.isText?f.text||"":f.textBetween(x-h,T-h,void 0,"");rw(k,s.find,o).forEach(N=>{if(N.index===void 0)return;const O=x+N.index+1,j=O+N[0].length,V={from:n.tr.mapping.map(O),to:n.tr.mapping.map(j)},U=s.handler({state:n,range:V,match:N,commands:l,chain:c,can:u,pasteEvent:o,dropEvent:a});d.push(U)})}),d.every(f=>f!==null)}var Hs=null,sw=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function ow(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:u,from:d,to:p,rule:f,pasteEvt:h})=>{const m=u.tr,g=va({state:u,transaction:m});if(!(!iw({editor:e,state:g,from:Math.max(d-1,0),to:p.b-1,rule:f,pasteEvent:h,dropEvent:a})||!m.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(u=>new Me({view(d){const p=h=>{var m;r=(m=d.dom.parentElement)!=null&&m.contains(h.target)?d.dom.parentElement:null,r&&(Hs=e)},f=()=>{Hs&&(Hs=null)};return window.addEventListener("dragstart",p),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",p),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(d,p)=>{if(s=r===d.dom.parentElement,a=p,!s){const f=Hs;f!=null&&f.isEditable&&setTimeout(()=>{const h=f.state.selection;h&&f.commands.deleteRange({from:h.from,to:h.to})},10)}return!1},paste:(d,p)=>{var f;const h=(f=p.clipboardData)==null?void 0:f.getData("text/html");return o=p,i=!!(h!=null&&h.includes("data-pm-slice")),!1}}},appendTransaction:(d,p,f)=>{const h=d[0],m=h.getMeta("uiEvent")==="paste"&&!i,g=h.getMeta("uiEvent")==="drop"&&!s,y=h.getMeta("applyPasteRules"),w=!!y;if(!m&&!g&&!w)return;if(w){let{text:x}=y;typeof x=="string"?x=x:x=Kc(F.from(x),f.schema);const{from:T}=y,k=T+x.length,R=sw(x);return l({rule:u,state:f,from:T,to:{b:k},pasteEvt:R})}const S=p.doc.content.findDiffStart(f.doc.content),b=p.doc.content.findDiffEnd(f.doc.content);if(!(!nw(S)||!b||S===b.b))return l({rule:u,state:f,from:S,to:b,pasteEvt:o})}}))}var Ta=class{constructor(t,e){this.splittableMarks=[],this.nonClearableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=mm(t),this.schema=g0(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Ei(e.name,this.schema)},r=te(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return qi([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Ei(r.name,this.schema)},s=[],o=te(r,"addKeyboardShortcuts",i);let a={};if(r.type==="mark"&&te(r,"exitable",i)&&(a.ArrowRight=()=>qn.handleExit({editor:t,mark:r})),o){const p=Object.fromEntries(Object.entries(o()).map(([f,h])=>[f,()=>h({editor:t})]));a={...a,...p}}const l=gx(a);s.push(l);const c=te(r,"addInputRules",i);if(qd(r,t.options.enableInputRules)&&c){const p=c();if(p&&p.length){const f=ew({editor:t,rules:p}),h=Array.isArray(f)?f:[f];s.push(...h)}}const u=te(r,"addPasteRules",i);if(qd(r,t.options.enablePasteRules)&&u){const p=u();if(p&&p.length){const f=ow({editor:t,rules:p});s.push(...f)}}const d=te(r,"addProseMirrorPlugins",i);if(d){const p=d();s.push(...p)}return s})}get attributes(){return hm(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=ei(this.extensions);return Object.fromEntries(e.filter(n=>!!te(n,"addNodeView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Ke(n.name,this.schema)},s=te(n,"addNodeView",i);if(!s)return[];const o=s();if(!o)return[];const a=(l,c,u,d,p)=>{const f=ti(l,r);return o({node:l,view:c,getPos:u,decorations:d,innerDecorations:p,editor:t,extension:n,HTMLAttributes:f})};return[n.name,a]}))}dispatchTransaction(t){const{editor:e}=this;return qi([...this.extensions].reverse()).reduceRight((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Ei(i.name,this.schema)},o=te(i,"dispatchTransaction",s);return o?a=>{o.call(s,{transaction:a,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return qi([...this.extensions]).reduce((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Ei(i.name,this.schema)},o=te(i,"transformPastedHTML",s);return o?(a,l)=>{const c=r(a,l);return o.call(s,c)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=ei(this.extensions);return Object.fromEntries(e.filter(n=>!!te(n,"addMarkView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:_n(n.name,this.schema)},s=te(n,"addMarkView",i);if(!s)return[];const o=(a,l,c)=>{const u=ti(a,r);return s()({mark:a,view:l,inline:c,editor:t,extension:n,HTMLAttributes:u,updateAttributes:d=>{Ew(a,t,d)}})};return[n.name,o]}))}destroy(){this.extensions.forEach(t=>{let e=t;for(;e.parent;){const n=e.parent;n.child===e&&(n.child=null),e=n}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n,r;const i={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Ei(e.name,this.schema)};e.type==="mark"&&(((n=we(te(e,"keepOnSplit",i)))==null||n)&&this.splittableMarks.push(e.name),(r=we(te(e,"clearable",i)))==null||r||this.nonClearableMarks.push(e.name));const s=te(e,"onBeforeCreate",i),o=te(e,"onCreate",i),a=te(e,"onUpdate",i),l=te(e,"onSelectionUpdate",i),c=te(e,"onTransaction",i),u=te(e,"onFocus",i),d=te(e,"onBlur",i),p=te(e,"onDestroy",i);s&&this.editor.on("beforeCreate",s),o&&this.editor.on("create",o),a&&this.editor.on("update",a),l&&this.editor.on("selectionUpdate",l),c&&this.editor.on("transaction",c),u&&this.editor.on("focus",u),d&&this.editor.on("blur",d),p&&this.editor.on("destroy",p)})}};Ta.resolve=mm;Ta.sort=qi;Ta.flatten=Wc;var aw={};Uc(aw,{ClipboardTextSerializer:()=>_m,Commands:()=>Am,Delete:()=>Cm,Drop:()=>Mm,Editable:()=>Om,FocusEvents:()=>Im,Keymap:()=>Dm,Paste:()=>Lm,Tabindex:()=>Pm,TextDirection:()=>Bm,focusEventsPluginKey:()=>Rm});var ke=class Nm extends Gc{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new Nm(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},_m=ke.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Me({key:new ze("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,s=bm(n),{blockSeparator:o}=this.options,a={...o!==void 0?{blockSeparator:o}:{},textSerializers:s};return[...i.ranges].sort((c,u)=>c.$from.pos-u.$from.pos).map(({$from:c,$to:u})=>gm(r,{from:c.pos,to:u.pos},a)).join(o??`
|
|
51
|
-
|
|
52
|
-
`)}}})]}}),Am=ke.create({name:"commands",addCommands(){return{...om}}}),Cm=ke.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,i;const s=()=>{var o,a,l,c;if((c=(l=(a=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,t))!=null?c:t.getMeta("y-sync$"))return;const u=fm(t.before,[t,...e]);Em(u).forEach(f=>{u.mapping.mapResult(f.oldRange.from).deletedAfter&&u.mapping.mapResult(f.oldRange.to).deletedBefore&&u.before.nodesBetween(f.oldRange.from,f.oldRange.to,(h,m)=>{const g=m+h.nodeSize-2,y=f.oldRange.from<=m&&g<=f.oldRange.to;this.editor.emit("delete",{type:"node",node:h,from:m,to:g,newFrom:u.mapping.map(m),newTo:u.mapping.map(g),deletedRange:f.oldRange,newRange:f.newRange,partial:!y,editor:this.editor,transaction:t,combinedTransform:u})})});const p=u.mapping;u.steps.forEach((f,h)=>{var m,g;if(f instanceof di){const y=p.slice(h).map(f.from,-1),w=p.slice(h).map(f.to),S=p.invert().map(y,-1),b=p.invert().map(w),x=y>0?(m=u.doc.nodeAt(y-1))==null?void 0:m.marks.some(k=>k.eq(f.mark)):!1,T=(g=u.doc.nodeAt(w))==null?void 0:g.marks.some(k=>k.eq(f.mark));this.editor.emit("delete",{type:"mark",mark:f.mark,from:f.from,to:f.to,deletedRange:{from:S,to:b},newRange:{from:y,to:w},partial:!!(T||x),editor:this.editor,transaction:t,combinedTransform:u})}})};(i=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||i?setTimeout(s,0):s()}}),Mm=ke.create({name:"drop",addProseMirrorPlugins(){return[new Me({key:new ze("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),Om=ke.create({name:"editable",addProseMirrorPlugins(){return[new Me({key:new ze("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Rm=new ze("focusEvents"),Im=ke.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Me({key:Rm,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Dm=ke.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:u,$anchor:d}=l,{pos:p,parent:f}=d,h=d.parent.isTextblock&&p>0?a.doc.resolve(p-1):d,m=h.parent.type.spec.isolating,g=d.pos-d.parentOffset,y=m&&h.parent.childCount===1?g===d.pos:ue.atStart(c).from===p;return!u||!f.type.isTextblock||f.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return fs()||um()?s:i},addProseMirrorPlugins(){return[new Me({key:new ze("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(m=>m.getMeta("composition")))return;const r=t.some(m=>m.docChanged)&&!e.doc.eq(n.doc),i=t.some(m=>m.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:a}=e.selection,l=ue.atStart(e.doc).from,c=ue.atEnd(e.doc).to;if(s||!(o===l&&a===c)||!hs(n.doc))return;const p=n.tr,f=va({state:n,transaction:p}),{commands:h}=new xa({editor:this.editor,state:f});if(h.clearNodes(),!!p.steps.length)return p}})]}}),Lm=ke.create({name:"paste",addProseMirrorPlugins(){return[new Me({key:new ze("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),Pm=ke.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Me({key:new ze("tabindex"),props:{attributes:()=>{var t;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(t=this.options.value)!=null?t:"0"}}}})]}}),Bm=ke.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=ei(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Me({key:new ze("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),lw=class Di{constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Di(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Di(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Di(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,o=n.isInline,a=this.pos+r+(s?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!i&&!o&&l.depth<=this.depth)return;const c=new Di(l,this.editor,i,i||o?n:null);i&&(c.actualDepth=this.depth+1),e.push(c)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const s=i.node.attrs,o=Object.keys(n);for(let a=0;a<o.length;a+=1){const l=o[a];if(s[l]!==n[l])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(l=>n[l]===o.node.attrs[l])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},cw=`.ProseMirror {
|
|
53
|
-
position: relative;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.ProseMirror {
|
|
57
|
-
word-wrap: break-word;
|
|
58
|
-
white-space: pre-wrap;
|
|
59
|
-
white-space: break-spaces;
|
|
60
|
-
-webkit-font-variant-ligatures: none;
|
|
61
|
-
font-variant-ligatures: none;
|
|
62
|
-
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.ProseMirror [contenteditable="false"] {
|
|
66
|
-
white-space: normal;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
70
|
-
white-space: pre-wrap;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.ProseMirror pre {
|
|
74
|
-
white-space: pre-wrap;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
img.ProseMirror-separator {
|
|
78
|
-
display: inline !important;
|
|
79
|
-
border: none !important;
|
|
80
|
-
margin: 0 !important;
|
|
81
|
-
width: 0 !important;
|
|
82
|
-
height: 0 !important;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.ProseMirror-gapcursor {
|
|
86
|
-
display: none;
|
|
87
|
-
pointer-events: none;
|
|
88
|
-
position: absolute;
|
|
89
|
-
margin: 0;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.ProseMirror-gapcursor:after {
|
|
93
|
-
content: "";
|
|
94
|
-
display: block;
|
|
95
|
-
position: absolute;
|
|
96
|
-
top: -2px;
|
|
97
|
-
width: 20px;
|
|
98
|
-
border-top: 1px solid black;
|
|
99
|
-
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
@keyframes ProseMirror-cursor-blink {
|
|
103
|
-
to {
|
|
104
|
-
visibility: hidden;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.ProseMirror-hideselection *::selection {
|
|
109
|
-
background: transparent;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.ProseMirror-hideselection *::-moz-selection {
|
|
113
|
-
background: transparent;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.ProseMirror-hideselection * {
|
|
117
|
-
caret-color: transparent;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
121
|
-
display: block;
|
|
122
|
-
}`;function Fm(t,e,n){const r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:""}]`);if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute(`data-tiptap-style${n?`-${n}`:""}`,""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}var uw=class extends Z0{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:A0,createMappablePosition:C0},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:i,moved:s})=>this.options.onDrop(r,i,s)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=lm(e,this.options.autofocus);this.editorState=Gr.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t!=null&&t.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=Fm(cw,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=pm(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;n=n.filter(o=>!o.key.startsWith(s))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e,n,r;const s=[...this.options.enableCoreExtensions?[Om,_m.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),Am,Im,Dm,Pm.configure({value:(r=(n=this.options.coreExtensionOptions)==null?void 0:n.tabindex)==null?void 0:r.value}),Mm,Lm,Cm,Bm.configure({direction:this.options.textDirection})].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o==null?void 0:o.type));this.extensionManager=new Ta(s,this)}createCommandManager(){this.commandManager=new xa({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Gl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=Gl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,s=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(s);this.editorView=new $c(t,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS();const l=this.view.dom;l.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(c=>{var u;return(u=this.capturedTransaction)==null?void 0:u.step(c)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),i=n.includes(t),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),a=o==null?void 0:o.getMeta("focus"),l=o==null?void 0:o.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:o}),l&&this.emit("blur",{editor:this,event:l.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return ym(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return k0(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Kc(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
|
|
123
|
-
|
|
124
|
-
`,textSerializers:n={}}=t||{};return y0(this.state.doc,{blockSeparator:e,textSerializers:{...bm(this.schema),...n}})}get isEmpty(){return hs(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t),n=t>0&&e.nodeAfter&&!e.nodeAfter.isText?e.nodeAfter:null;return new lw(e,this,!1,n)}get $doc(){return this.$pos(0)}};function ni(t){return new ka({find:t.find,handler:({state:e,range:n,match:r})=>{const i=we(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],a=r[0];if(o){const l=a.search(/\S/),c=n.from+a.indexOf(o),u=c+o.length;if(qc(n.from,n.to,e.doc).filter(f=>f.mark.type.excluded.find(m=>m===t.type&&m!==f.mark.type)).filter(f=>f.to>c).length)return null;u<n.to&&s.delete(u,n.to),c>n.from&&s.delete(n.from+l,c);const p=n.from+l+o.length;s.addMark(n.from+l,p,t.type.create(i||{})),s.removeStoredMark(t.type)}},undoable:t.undoable})}function dw(t){return new ka({find:t.find,handler:({state:e,range:n,match:r})=>{const i=we(t.getAttributes,void 0,r)||{},{tr:s}=e,o=n.from;let a=n.to;const l=t.type.create(i);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=o+c;u>a?u=a:a=u+r[1].length;const d=r[0][r[0].length-1];s.insertText(d,o+r[0].length-1),s.replaceWith(u,a,l)}else if(r[0]){const c=t.type.isInline?o:o-1;s.insert(c,t.type.create(i)).delete(s.mapping.map(o),s.mapping.map(a))}s.scrollIntoView()},undoable:t.undoable})}function Xl(t){return new ka({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=we(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)},undoable:t.undoable})}function ri(t){return new ka({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=we(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),l=o.doc.resolve(n.from).blockRange(),c=l&&Tc(l,t.type,s);if(!c)return null;if(o.wrap(l,c),t.keepMarks&&t.editor){const{selection:d,storedMarks:p}=e,{splittableMarks:f}=t.editor.extensionManager,h=p||d.$to.parentOffset&&d.$from.marks();if(h){const m=h.filter(g=>f.includes(g.type.name));o.ensureMarks(m)}}if(t.keepAttributes){const d=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,s).run()}const u=o.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&Wn(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&o.join(n.from-1)},undoable:t.undoable})}function fw(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof ee){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let i=r.depth;for(;i>=0;){const s=r.index(i);if(r.node(i).contentMatchAt(s).matchType(e))return!0;i-=1}return!1}function pw(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function As(t,e){const n=t.getAttribute("style");if(!n)return null;const r=n.split(";").map(s=>s.trim()).filter(Boolean),i=e.toLowerCase();for(let s=r.length-1;s>=0;s-=1){const o=r[s],a=o.indexOf(":");if(a===-1)continue;if(o.slice(0,a).trim().toLowerCase()===i)return o.slice(a+1).trim()}return null}var hw={};Uc(hw,{createAtomBlockMarkdownSpec:()=>zm,createBlockMarkdownSpec:()=>mw,createInlineMarkdownSpec:()=>yw,parseAttributes:()=>Yc,parseIndentedBlocks:()=>Zl,renderNestedMarkdownContent:()=>Xc,serializeAttributes:()=>Jc});function Yc(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,c=>(n.push(c),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const c=i.map(u=>u.trim().slice(1));e.class=c.join(" ")}const s=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,c,u])=>{var d;const p=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),f=n[p];f&&(e[c]=f.slice(1,-1))});const l=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function Jc(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function zm(t){const{nodeName:e,name:n,parseAttributes:r=Yc,serializeAttributes:i=Jc,defaultAttributes:s={},requiredAttributes:o=[],allowedAttributes:a}=t,l=n||e,c=u=>{if(!a)return u;const d={};return a.forEach(p=>{p in u&&(d[p]=u[p])}),d};return{parseMarkdown:(u,d)=>{const p={...s,...u.attributes};return d.createNode(e,p,[])},markdownTokenizer:{name:e,level:"block",start(u){var d;const p=new RegExp(`^:::${l}(?:\\s|$)`,"m"),f=(d=u.match(p))==null?void 0:d.index;return f!==void 0?f:-1},tokenize(u,d,p){const f=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),h=u.match(f);if(!h)return;const m=h[1]||"",g=r(m);if(!o.find(w=>!(w in g)))return{type:e,raw:h[0],attributes:g}}},renderMarkdown:u=>{const d=c(u.attrs||{}),p=i(d),f=p?` {${p}}`:"";return`:::${l}${f} :::`}}}function mw(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=Yc,serializeAttributes:s=Jc,defaultAttributes:o={},content:a="block",allowedAttributes:l}=t,c=n||e,u=d=>{if(!l)return d;const p={};return l.forEach(f=>{f in d&&(p[f]=d[f])}),p};return{parseMarkdown:(d,p)=>{let f;if(r){const m=r(d);f=typeof m=="string"?[{type:"text",text:m}]:m}else a==="block"?f=p.parseChildren(d.tokens||[]):f=p.parseInline(d.tokens||[]);const h={...o,...d.attributes};return p.createNode(e,h,f)},markdownTokenizer:{name:e,level:"block",start(d){var p;const f=new RegExp(`^:::${c}`,"m"),h=(p=d.match(f))==null?void 0:p.index;return h!==void 0?h:-1},tokenize(d,p,f){var h;const m=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),g=d.match(m);if(!g)return;const[y,w=""]=g,S=i(w);let b=1;const x=y.length;let T="";const k=/^:::([\w-]*)(\s.*)?/gm,R=d.slice(x);for(k.lastIndex=0;;){const N=k.exec(R);if(N===null)break;const O=N.index,j=N[1];if(!((h=N[2])!=null&&h.endsWith(":::"))){if(j)b+=1;else if(b-=1,b===0){const V=R.slice(0,O);T=V.trim();const U=d.slice(0,x+O+N[0].length);let B=[];if(T)if(a==="block")for(B=f.blockTokens(V),B.forEach(H=>{H.text&&(!H.tokens||H.tokens.length===0)&&(H.tokens=f.inlineTokens(H.text))});B.length>0;){const H=B[B.length-1];if(H.type==="paragraph"&&(!H.text||H.text.trim()===""))B.pop();else break}else B=f.inlineTokens(T);return{type:e,raw:U,attributes:S,content:T,tokens:B}}}}}},renderMarkdown:(d,p)=>{const f=u(d.attrs||{}),h=s(f),m=h?` {${h}}`:"",g=p.renderChildren(d.content||[],`
|
|
125
|
-
|
|
126
|
-
`);return`:::${c}${m}
|
|
127
|
-
|
|
128
|
-
${g}
|
|
129
|
-
|
|
130
|
-
:::`}}}function gw(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,i,s,o]=r;e[i]=s||o,r=n.exec(t)}return e}function bw(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function yw(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=gw,serializeAttributes:s=bw,defaultAttributes:o={},selfClosing:a=!1,allowedAttributes:l}=t,c=n||e,u=p=>{if(!l)return p;const f={};return l.forEach(h=>{const m=typeof h=="string"?h:h.name,g=typeof h=="string"?void 0:h.skipIfDefault;if(m in p){const y=p[m];if(g!==void 0&&y===g)return;f[m]=y}}),f},d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(p,f)=>{const h={...o,...p.attributes};if(a)return f.createNode(e,h);const m=r?r(p):p.content||"";return m?f.createNode(e,h,[f.createTextNode(m)]):f.createNode(e,h,[])},markdownTokenizer:{name:e,level:"inline",start(p){const f=a?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),h=p.match(f),m=h==null?void 0:h.index;return m!==void 0?m:-1},tokenize(p,f,h){const m=a?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),g=p.match(m);if(!g)return;let y="",w="";if(a){const[,b]=g;w=b}else{const[,b,x]=g;w=b,y=x||""}const S=i(w.trim());return{type:e,raw:g[0],content:y.trim(),attributes:S}}},renderMarkdown:p=>{let f="";r?f=r(p):p.content&&p.content.length>0&&(f=p.content.filter(y=>y.type==="text").map(y=>y.text).join(""));const h=u(p.attrs||{}),m=s(h),g=m?` ${m}`:"";return a?`[${c}${g}]`:`[${c}${g}]${f}[/${c}]`}}}function Zl(t,e,n){var r,i,s,o;const a=t.split(`
|
|
131
|
-
`),l=[];let c="",u=0;const d=e.baseIndentSize||2;for(;u<a.length;){const p=a[u],f=p.match(e.itemPattern);if(!f){if(l.length>0)break;if(p.trim()===""){u+=1,c=`${c}${p}
|
|
132
|
-
`;continue}else return}const h=e.extractItemData(f),{indentLevel:m,mainContent:g}=h;c=`${c}${p}
|
|
133
|
-
`;const y=[g];for(u+=1;u<a.length;){const x=a[u];if(x.trim()===""){const k=a.slice(u+1).findIndex(O=>O.trim()!=="");if(k===-1)break;if((((i=(r=a[u+1+k].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>m){y.push(x),c=`${c}${x}
|
|
134
|
-
`,u+=1;continue}else break}if((((o=(s=x.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:o.length)||0)>m)y.push(x),c=`${c}${x}
|
|
135
|
-
`,u+=1;else break}let w;const S=y.slice(1);if(S.length>0){const x=S.map(T=>T.slice(m+d)).join(`
|
|
136
|
-
`);x.trim()&&(e.customNestedParser?w=e.customNestedParser(x):w=n.blockTokens(x))}const b=e.createToken(h,w);l.push(b)}if(l.length!==0)return{items:l,raw:c}}function Xc(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const i=typeof n=="function"?n(r):n,[s,...o]=t.content,a=e.renderChildren([s]);let l=`${i}${a}`;return o&&o.length>0&&o.forEach((c,u)=>{var d,p;const f=(p=(d=e.renderChild)==null?void 0:d.call(e,c,u+1))!=null?p:e.renderChildren([c]);if(f!=null){const h=f.split(`
|
|
137
|
-
`).map(m=>m?e.indent(m):e.indent("")).join(`
|
|
138
|
-
`);l+=c.type==="paragraph"?`
|
|
139
|
-
|
|
140
|
-
${h}`:`
|
|
141
|
-
${h}`}}),l}function Ew(t,e,n={}){const{state:r}=e,{doc:i,tr:s}=r,o=t;i.descendants((a,l)=>{const c=s.mapping.map(l),u=s.mapping.map(l)+a.nodeSize;let d=null;if(a.marks.forEach(f=>{if(f!==o)return!1;d=f}),!d)return;let p=!1;if(Object.keys(n).forEach(f=>{n[f]!==d.attrs[f]&&(p=!0)}),p){const f=t.type.create({...t.attrs,...n});s.removeMark(c,u,t.type),s.addMark(c,u,f)}}),s.docChanged&&e.view.dispatch(s)}var Ye=class $m extends Gc{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new $m(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},vw=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,i,s,o,a;const{view:l}=this.editor,c=t.target,u=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)||!u)return;let d=0,p=0;if(this.dom!==u){const w=this.dom.getBoundingClientRect(),S=u.getBoundingClientRect(),b=(i=t.offsetX)!=null?i:(r=t.nativeEvent)==null?void 0:r.offsetX,x=(o=t.offsetY)!=null?o:(s=t.nativeEvent)==null?void 0:s.offsetY;d=S.x-w.x+b,p=S.y-w.y+x}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 h=null;try{h=document.createElement("div"),h.style.position="absolute",h.style.top="-9999px",h.style.left="-9999px",h.style.pointerEvents="none",h.appendChild(f),document.body.appendChild(h),(a=t.dataTransfer)==null||a.setDragImage(f,d,p)}finally{h&&setTimeout(()=>{try{h==null||h.remove()}catch{}},0)}const m=this.getPos();if(typeof m!="number")return;const g=ee.create(l.state.doc,m),y=l.state.tr.setSelection(g);l.dispatch(y)}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 i=t.type.startsWith("drag"),s=t.type==="dragover"||t.type==="dragenter",o=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!o&&!i)return!0;const{isEditable:l}=this.editor,{isDragging:c}=this,u=!!this.node.type.spec.draggable,d=ee.isSelectable(this.node),p=t.type==="copy",f=t.type==="paste",h=t.type==="cut",m=t.type==="mousedown";if(!u&&d&&i&&t.target===this.dom&&t.preventDefault(),u&&i&&!c&&t.target===this.dom)return t.preventDefault(),!1;if(u&&l&&!c&&m){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!(c||s||o||p||f||h||m&&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"&&(fs()||ql())&&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 yr(t){return new Tm({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=we(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,a=r[r.length-1],l=r[0];let c=n.to;if(a){const u=l.search(/\S/),d=n.from+l.indexOf(a),p=d+a.length;if(qc(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(y=>y===t.type&&y!==m.mark.type)).filter(m=>m.to>d).length)return null;p<n.to&&o.delete(p,n.to),d>n.from&&o.delete(n.from+u,d),c=n.from+u+a.length,o.addMark(n.from+u,c,t.type.create(s||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(t.type)}}})}function xw(t){return new Tm({find:t.find,handler({match:e,chain:n,range:r,pasteEvent:i}){const s=we(t.getAttributes,void 0,e,i),o=we(t.getContent,void 0,s);if(s===!1||s===null)return null;const a={type:t.type.name,attrs:s};o&&(a.content=o),e.input&&n().deleteRange(r).insertContentAt(r.from,a)}})}const{getOwnPropertyNames:ww,getOwnPropertySymbols:Sw}=Object,{hasOwnProperty:kw}=Object.prototype;function el(t,e){return function(r,i,s){return t(r,i,s)&&e(r,i,s)}}function js(t){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,i);const{cache:s}=i,o=s.get(n),a=s.get(r);if(o&&a)return o===r&&a===n;s.set(n,r),s.set(r,n);const l=t(n,r,i);return s.delete(n),s.delete(r),l}}function Tw(t){return t!=null?t[Symbol.toStringTag]:void 0}function Yd(t){return ww(t).concat(Sw(t))}const Nw=Object.hasOwn||((t,e)=>kw.call(t,e));function wr(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const _w="__v",Aw="__o",Cw="_owner",{getOwnPropertyDescriptor:Jd,keys:Xd}=Object;function Mw(t,e){return t.byteLength===e.byteLength&&Ro(new Uint8Array(t),new Uint8Array(e))}function Ow(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function Rw(t,e){return t.byteLength===e.byteLength&&Ro(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function Iw(t,e){return wr(t.getTime(),e.getTime())}function Dw(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function Lw(t,e){return t===e}function Zd(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),s=t.entries();let o,a,l=0;for(;(o=s.next())&&!o.done;){const c=e.entries();let u=!1,d=0;for(;(a=c.next())&&!a.done;){if(i[d]){d++;continue}const p=o.value,f=a.value;if(n.equals(p[0],f[0],l,d,t,e,n)&&n.equals(p[1],f[1],p[0],f[0],t,e,n)){u=i[d]=!0;break}d++}if(!u)return!1;l++}return!0}const Pw=wr;function Bw(t,e,n){const r=Xd(t);let i=r.length;if(Xd(e).length!==i)return!1;for(;i-- >0;)if(!Um(t,e,n,r[i]))return!1;return!0}function vi(t,e,n){const r=Yd(t);let i=r.length;if(Yd(e).length!==i)return!1;let s,o,a;for(;i-- >0;)if(s=r[i],!Um(t,e,n,s)||(o=Jd(t,s),a=Jd(e,s),(o||a)&&(!o||!a||o.configurable!==a.configurable||o.enumerable!==a.enumerable||o.writable!==a.writable)))return!1;return!0}function Fw(t,e){return wr(t.valueOf(),e.valueOf())}function zw(t,e){return t.source===e.source&&t.flags===e.flags}function Qd(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),s=t.values();let o,a;for(;(o=s.next())&&!o.done;){const l=e.values();let c=!1,u=0;for(;(a=l.next())&&!a.done;){if(!i[u]&&n.equals(o.value,a.value,o.value,a.value,t,e,n)){c=i[u]=!0;break}u++}if(!c)return!1}return!0}function Ro(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function $w(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function Um(t,e,n,r){return(r===Cw||r===Aw||r===_w)&&(t.$$typeof||e.$$typeof)?!0:Nw(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const Uw="[object ArrayBuffer]",Hw="[object Arguments]",jw="[object Boolean]",Vw="[object DataView]",Ww="[object Date]",Kw="[object Error]",qw="[object Map]",Gw="[object Number]",Yw="[object Object]",Jw="[object RegExp]",Xw="[object Set]",Zw="[object String]",Qw={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},eS="[object URL]",tS=Object.prototype.toString;function nS({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:s,areMapsEqual:o,areNumbersEqual:a,areObjectsEqual:l,arePrimitiveWrappersEqual:c,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:p,areUrlsEqual:f,unknownTagComparators:h}){return function(g,y,w){if(g===y)return!0;if(g==null||y==null)return!1;const S=typeof g;if(S!==typeof y)return!1;if(S!=="object")return S==="number"?a(g,y,w):S==="function"?s(g,y,w):!1;const b=g.constructor;if(b!==y.constructor)return!1;if(b===Object)return l(g,y,w);if(Array.isArray(g))return e(g,y,w);if(b===Date)return r(g,y,w);if(b===RegExp)return u(g,y,w);if(b===Map)return o(g,y,w);if(b===Set)return d(g,y,w);const x=tS.call(g);if(x===Ww)return r(g,y,w);if(x===Jw)return u(g,y,w);if(x===qw)return o(g,y,w);if(x===Xw)return d(g,y,w);if(x===Yw)return typeof g.then!="function"&&typeof y.then!="function"&&l(g,y,w);if(x===eS)return f(g,y,w);if(x===Kw)return i(g,y,w);if(x===Hw)return l(g,y,w);if(Qw[x])return p(g,y,w);if(x===Uw)return t(g,y,w);if(x===Vw)return n(g,y,w);if(x===jw||x===Gw||x===Zw)return c(g,y,w);if(h){let T=h[x];if(!T){const k=Tw(g);k&&(T=h[k])}if(T)return T(g,y,w)}return!1}}function rS({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:Mw,areArraysEqual:n?vi:Ow,areDataViewsEqual:Rw,areDatesEqual:Iw,areErrorsEqual:Dw,areFunctionsEqual:Lw,areMapsEqual:n?el(Zd,vi):Zd,areNumbersEqual:Pw,areObjectsEqual:n?vi:Bw,arePrimitiveWrappersEqual:Fw,areRegExpsEqual:zw,areSetsEqual:n?el(Qd,vi):Qd,areTypedArraysEqual:n?el(Ro,vi):Ro,areUrlsEqual:$w,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const i=js(r.areArraysEqual),s=js(r.areMapsEqual),o=js(r.areObjectsEqual),a=js(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:s,areObjectsEqual:o,areSetsEqual:a})}return r}function iS(t){return function(e,n,r,i,s,o,a){return t(e,n,a)}}function sS({circular:t,comparator:e,createState:n,equals:r,strict:i}){if(n)return function(a,l){const{cache:c=t?new WeakMap:void 0,meta:u}=n();return e(a,l,{cache:c,equals:r,meta:u,strict:i})};if(t)return function(a,l){return e(a,l,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};const s={cache:void 0,equals:r,meta:void 0,strict:i};return function(a,l){return e(a,l,s)}}const oS=Gn();Gn({strict:!0});Gn({circular:!0});Gn({circular:!0,strict:!0});Gn({createInternalComparator:()=>wr});Gn({strict:!0,createInternalComparator:()=>wr});Gn({circular:!0,createInternalComparator:()=>wr});Gn({circular:!0,createInternalComparator:()=>wr,strict:!0});function Gn(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:i=!1}=t,s=rS(t),o=nS(s),a=n?n(o):iS(o);return sS({circular:e,comparator:o,createState:r,equals:a,strict:i})}var Ql={exports:{}},tl={};/**
|
|
142
|
-
* @license React
|
|
143
|
-
* use-sync-external-store-shim/with-selector.production.js
|
|
144
|
-
*
|
|
145
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
146
|
-
*
|
|
147
|
-
* This source code is licensed under the MIT license found in the
|
|
148
|
-
* LICENSE file in the root directory of this source tree.
|
|
149
|
-
*/var ef;function aS(){if(ef)return tl;ef=1;var t=W,e=pa;function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,o=t.useEffect,a=t.useMemo,l=t.useDebugValue;return tl.useSyncExternalStoreWithSelector=function(c,u,d,p,f){var h=s(null);if(h.current===null){var m={hasValue:!1,value:null};h.current=m}else m=h.current;h=a(function(){function y(T){if(!w){if(w=!0,S=T,T=p(T),f!==void 0&&m.hasValue){var k=m.value;if(f(k,T))return b=k}return b=T}if(k=b,r(S,T))return k;var R=p(T);return f!==void 0&&f(k,R)?(S=T,k):(S=T,b=R)}var w=!1,S,b,x=d===void 0?null:d;return[function(){return y(u())},x===null?void 0:function(){return y(x())}]},[u,d,p,f]);var g=i(c,h[0],h[1]);return o(function(){m.hasValue=!0,m.value=g},[g]),l(g),g},tl}var nl={};/**
|
|
150
|
-
* @license React
|
|
151
|
-
* use-sync-external-store-shim/with-selector.development.js
|
|
152
|
-
*
|
|
153
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
154
|
-
*
|
|
155
|
-
* This source code is licensed under the MIT license found in the
|
|
156
|
-
* LICENSE file in the root directory of this source tree.
|
|
157
|
-
*/var tf;function lS(){return tf||(tf=1,process.env.NODE_ENV!=="production"&&function(){function t(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var e=W,n=pa,r=typeof Object.is=="function"?Object.is:t,i=n.useSyncExternalStore,s=e.useRef,o=e.useEffect,a=e.useMemo,l=e.useDebugValue;nl.useSyncExternalStoreWithSelector=function(c,u,d,p,f){var h=s(null);if(h.current===null){var m={hasValue:!1,value:null};h.current=m}else m=h.current;h=a(function(){function y(T){if(!w){if(w=!0,S=T,T=p(T),f!==void 0&&m.hasValue){var k=m.value;if(f(k,T))return b=k}return b=T}if(k=b,r(S,T))return k;var R=p(T);return f!==void 0&&f(k,R)?(S=T,k):(S=T,b=R)}var w=!1,S,b,x=d===void 0?null:d;return[function(){return y(u())},x===null?void 0:function(){return y(x())}]},[u,d,p,f]);var g=i(c,h[0],h[1]);return o(function(){m.hasValue=!0,m.value=g},[g]),l(g),g},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),nl}process.env.NODE_ENV==="production"?Ql.exports=aS():Ql.exports=lS();var cS=Ql.exports,uS=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},dS=({contentComponent:t})=>{const e=pa.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return E.jsx(E.Fragment,{children:Object.values(e)})};function fS(){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]:_p.createPortal(r.reactElement,r.element,n)},t.forEach(i=>i())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(i=>i())}}}var pS=class extends W.Component{constructor(t){super(t),this.editorContentRef=W.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=fS(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){var t;const e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return E.jsxs(E.Fragment,{children:[E.jsx("div",{ref:uS(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&E.jsx(dS,{contentComponent:t.contentComponent})]})}},hS=W.forwardRef((t,e)=>{const n=W.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return W.createElement(pS,{key:n,innerRef:e,...t})}),Hm=W.memo(hS),mS=typeof window<"u"?W.useLayoutEffect:W.useEffect,gS=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 bS(t){var e;const[n]=W.useState(()=>new gS(t.editor)),r=cS.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:oS);return mS(()=>n.watch(t.editor),[t.editor,n]),W.useDebugValue(r),r}var nf=process.env.NODE_ENV!=="production",jm=typeof window>"u",yS=jm||!!(typeof window<"u"&&window.next),ES=class Vm{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(){const e=this.options.current.immediatelyRender;let n=e??!0;return jm?(n&&nf&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),n=!1):yS&&e===void 0&&(n=!1,nf&&console.warn("Next.js detected. `immediatelyRender` defaults to false to avoid hydration mismatches. Pass `immediatelyRender: true` explicitly if you are rendering the editor only on the client.")),n?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onBeforeCreate)==null?void 0:s.call(i,...r)},onBlur:(...r)=>{var i,s;return(s=(i=this.options.current).onBlur)==null?void 0:s.call(i,...r)},onCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onCreate)==null?void 0:s.call(i,...r)},onDestroy:(...r)=>{var i,s;return(s=(i=this.options.current).onDestroy)==null?void 0:s.call(i,...r)},onFocus:(...r)=>{var i,s;return(s=(i=this.options.current).onFocus)==null?void 0:s.call(i,...r)},onSelectionUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onSelectionUpdate)==null?void 0:s.call(i,...r)},onTransaction:(...r)=>{var i,s;return(s=(i=this.options.current).onTransaction)==null?void 0:s.call(i,...r)},onUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onUpdate)==null?void 0:s.call(i,...r)},onContentError:(...r)=>{var i,s;return(s=(i=this.options.current).onContentError)==null?void 0:s.call(i,...r)},onDrop:(...r)=>{var i,s;return(s=(i=this.options.current).onDrop)==null?void 0:s.call(i,...r)},onPaste:(...r)=>{var i,s;return(s=(i=this.options.current).onPaste)==null?void 0:s.call(i,...r)},onDelete:(...r)=>{var i,s;return(s=(i=this.options.current).onDelete)==null?void 0:s.call(i,...r)}};return new uw(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((i,s)=>{var o;return i===((o=n.extensions)==null?void 0:o[s])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?Vm.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,i)=>r===e[i]))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 vS(t={},e=[]){const n=W.useRef(t);n.current=t;const[r]=W.useState(()=>new ES(n)),i=pa.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return W.useDebugValue(i),W.useEffect(r.onRender(e)),bS({editor:i,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&s===0?0:s+1}),i}var Wm=W.createContext({editor:null});Wm.Consumer;var Km=W.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),qm=()=>W.useContext(Km);function Gm({as:t="div",...e}){const{nodeViewContentRef:n,nodeViewContentChildren:r}=qm();return E.jsx(t,{...e,ref:n,"data-node-view-content":"",style:{whiteSpace:"pre-wrap",...e.style},children:r})}var pi=W.forwardRef((t,e)=>{const{onDragStart:n}=qm(),r=t.as||"div";return E.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function rf(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function sf(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function xS(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function wS(t){if(rf(t)||sf(t))return!0;if(xS(t)){const e=t.type;if(e)return rf(e)||sf(e)}return!1}function SS(){try{if(W.version)return parseInt(W.version.split(".")[0],10)>=19}catch{}return!1}var Ym=class{constructor(t,{editor:e,props:n={},as:r="div",className:i=""}){this.ref=null,this.destroyed=!1,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"),i&&this.element.classList.add(...i.split(" ")),this.editor.isEditorContentInitialized?_p.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var t;if(this.destroyed)return;const e=this.component,n=this.props,r=this.editor,i=SS(),s=wS(e),o={...n};o.ref&&!(i||s)&&delete o.ref,!o.ref&&(i||s)&&(o.ref=a=>{this.ref=a}),this.reactElement=E.jsx(e,{...o}),(t=r==null?void 0:r.contentComponent)==null||t.setRenderer(this.id,this)}updateProps(t={}){if(this.destroyed)return;let e=!1;const n=Object.keys(t);for(let r=0;r<n.length;r+=1){const i=n[r];if(t[i]!==this.props[i]){e=!0;break}}e&&(this.props={...this.props,...t},this.render())}destroy(){var t;this.destroyed=!0;const e=this.editor;(t=e==null?void 0: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])})}};W.createContext({markViewContentRef:()=>{}});var kS=class extends vw{constructor(t,e,n){if(super(t,e,n),this.selectionRafId=null,this.handlePositionUpdate=()=>{const r=this.getPos();typeof r!="number"||r===this.currentPos||(this.currentPos=r,this.renderer.updateProps({getPos:()=>this.getPos()}),typeof this.options.attrs=="function"&&this.updateElementAttributes())},this.cachedExtensionWithSyncedStorage=null,!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)}this.options.trackNodeViewPosition&&this.editor.on("update",this.handlePositionUpdate)}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const t=this.editor,e=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(e,{get(n,r,i){var s;return r==="storage"?(s=t.storage[e.name])!=null?s:{}:Reflect.get(n,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){const e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(c={})=>this.updateAttributes(c),deleteNode:()=>this.deleteNode(),ref:W.createRef()};if(!this.component.displayName){const c=u=>u.charAt(0).toUpperCase()+u.substring(1);this.component.displayName=c(this.extension.name)}const i={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:c=>{c&&this.contentDOMElement&&c.firstChild!==this.contentDOMElement&&(c.hasAttribute("data-node-view-wrapper")&&c.removeAttribute("data-node-view-wrapper"),c.appendChild(this.contentDOMElement))}},s=this.component,o=W.memo(c=>E.jsx(Km.Provider,{value:i,children:W.createElement(s,c)}));o.displayName="ReactNodeView";let a=this.node.isInline?"span":"div";this.options.as&&(a=this.options.as);const{className:l=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new Ym(o,{editor:this.editor,props:e,as:a,className:`node-${this.node.type.name} ${l}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes(),this.currentPos=this.getPos()}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(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;const t=this.currentPos;if(typeof t!="number")return;if(_0({selection:this.editor.state.selection,pos:t,nodeSize:this.node.nodeSize,selectedOnTextSelection:this.options.selectedOnTextSelection})){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(t,e,n){const r=a=>{this.renderer.updateProps(a),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const a=this.node,l=this.decorations,c=this.innerDecorations;return this.node=t,this.decorations=e,this.innerDecorations=n,this.currentPos=this.getPos(),this.options.update({oldNode:a,oldDecorations:l,newNode:t,newDecorations:e,oldInnerDecorations:c,innerDecorations:n,updateProps:()=>r({node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}if(!(t!==this.node))return this.node=t,this.decorations=e,this.innerDecorations=n,!0;const s=this.getPos();this.node=t,this.decorations=e,this.innerDecorations=n,this.currentPos=s;const o={node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage};return this.options.trackNodeViewPosition&&(o.getPos=()=>this.getPos()),r(o),!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.options.trackNodeViewPosition&&this.editor.off("update",this.handlePositionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,n=ti(this.node,e);t=this.options.attrs({node:this.node,HTMLAttributes:n})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function hi(t,e){return n=>n.editor.contentComponent?new kS(t,n,e):{}}var Zc=W.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Zc.displayName="TiptapContext";var TS=()=>W.useContext(Zc);function Jm({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const i=W.useMemo(()=>({editor:r}),[r]),s=W.useMemo(()=>({editor:r}),[r]);return E.jsx(Wm.Provider,{value:s,children:E.jsx(Zc.Provider,{value:i,children:n})})}Jm.displayName="Tiptap";function Xm({...t}){const{editor:e}=TS();return E.jsx(Hm,{editor:e,...t})}Xm.displayName="Tiptap.Content";Object.assign(Jm,{Content:Xm});var Io=(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]};function Zm(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)n++;return n}if(i.content.size||s.content.size){let o=Zm(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function Qm(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let o=t.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){n-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let c=0,u=Math.min(o.text.length,a.text.length);for(;c<u&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(o.content.size||a.content.size){let c=Qm(o.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}var Tn=class mt{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,i=0,s){for(let o=0,a=0;a<n;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,i+a,s||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new mt(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,o=0;o<n;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),i+=a.nodeSize),o=l}return new mt(r,i)}cutByIndex(e,n){return e==n?mt.empty:e==0&&n==this.content.length?this:new mt(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new mt(i,s)}addToStart(e){return new mt([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new mt(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 i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return Zm(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Qm(this,e,n,r)}findIndex(e){if(e==0)return Vs(0,e);if(e==this.size)return Vs(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 i=this.child(n),s=r+i.nodeSize;if(s>=e)return s==e?Vs(n+1,s):Vs(n,r);r=s}}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 mt.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return mt.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return mt.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new mt(n||e,r)}static from(e){if(!e)return mt.empty;if(e instanceof mt)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new mt([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};Tn.empty=new Tn([],0);var rl={index:0,offset:0};function Vs(t,e){return rl.index=t,rl.offset=e,rl}var NS=class extends Error{},We=class $r{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=tg(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new $r(r,this.openStart,this.openEnd)}removeBetween(e,n){return new $r(eg(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 $r.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new $r(Tn.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new $r(e,r,i)}};We.empty=new We(Tn.empty,0,0);function eg(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(i==e||s.isText){if(a!=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,s.copy(eg(s.content,e-i-1,n-i-1)))}function tg(t,e,n,r,i,s){let{index:o,offset:a}=t.findIndex(e),l=t.maybeChild(o);if(a==e||l.isText)return s&&r<=0&&i<=0&&!s.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=tg(l.content,e-a-1,n,o==0?r-1:0,o==t.childCount-1?i-1:0,l);return c&&t.replaceChild(o,l.copy(c))}var ng=65535,rg=Math.pow(2,16);function _S(t,e){return t+e*rg}function of(t){return t&ng}function AS(t){return(t-(t&ng))/rg}var ig=1,sg=2,po=4,og=8,af=class{constructor(t,e,n){this.pos=t,this.delInfo=e,this.recover=n}get deleted(){return(this.delInfo&og)>0}get deletedBefore(){return(this.delInfo&(ig|po))>0}get deletedAfter(){return(this.delInfo&(sg|po))>0}get deletedAcross(){return(this.delInfo&po)>0}},Er=class Ur{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Ur.empty)return Ur.empty}recover(e){let n=0,r=of(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+AS(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 i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+s],u=this.ranges[a+o],d=l+c;if(e<=d){let p=c?e==l?-1:e==d?1:n:n,f=l+i+(p<0?0:u);if(r)return f;let h=e==(n<0?l:d)?null:_S(a/3,e-l),m=e==l?sg:e==d?ig:po;return(n<0?e!=l:e!=d)&&(m|=og),new af(f,m,h)}i+=u-c}return r?e+i:new af(e+i,0,null)}touches(e,n){let r=0,i=of(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+s],u=l+c;if(e<=u&&a==i*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),c=this.ranges[i+n],u=this.ranges[i+r];e(a,a+c,l,l+u),s+=u-c}}invert(){return new Ur(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ur.empty:new Ur(e<0?[0,-e,0]:[0,0,e])}};Er.empty=new Er([]);var il=Object.create(null),ft=class{getMap(){return Er.empty}merge(t){return null}static fromJSON(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=il[e.stepType];if(!n)throw new RangeError(`No step type ${e.stepType} defined`);return n.fromJSON(t,e)}static jsonID(t,e){if(t in il)throw new RangeError("Duplicate use of step JSON ID "+t);return il[t]=e,e.prototype.jsonID=t,e}},Et=class Li{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Li(e,null)}static fail(e){return new Li(null,e)}static fromReplace(e,n,r,i){try{return Li.ok(e.replace(n,r,i))}catch(s){if(s instanceof NS)return Li.fail(s.message);throw s}}};function Qc(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(Qc(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return Tn.fromArray(r)}var ag=class Pi extends ft{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),i=r.node(r.sharedDepth(this.to)),s=new We(Qc(n.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return Et.fromReplace(e,this.from,this.to,s)}invert(){return new lg(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 Pi(n.pos,r.pos,this.mark)}merge(e){return e instanceof Pi&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Pi(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 Pi(n.from,n.to,e.markFromJSON(n.mark))}};ft.jsonID("addMark",ag);var lg=class Bi extends ft{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 We(Qc(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Et.fromReplace(e,this.from,this.to,r)}invert(){return new ag(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 Bi(n.pos,r.pos,this.mark)}merge(e){return e instanceof Bi&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Bi(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 Bi(n.from,n.to,e.markFromJSON(n.mark))}};ft.jsonID("removeMark",lg);var cg=class Fi extends ft{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Et.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Et.fromReplace(e,this.pos,this.pos+1,new We(Tn.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 i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Fi(this.pos,n.marks[i]);return new Fi(this.pos,this.mark)}}return new ug(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Fi(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 Fi(n.pos,e.markFromJSON(n.mark))}};ft.jsonID("addNodeMark",cg);var ug=class ec extends ft{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Et.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Et.fromReplace(e,this.pos,this.pos+1,new We(Tn.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new cg(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new ec(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 ec(n.pos,e.markFromJSON(n.mark))}};ft.jsonID("removeNodeMark",ug);var eu=class Rn extends ft{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&tc(e,this.from,this.to)?Et.fail("Structure replace would overwrite content"):Et.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Er([this.from,this.to-this.from,this.slice.size])}invert(e){return new Rn(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&Rn.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new Rn(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Rn)||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?We.empty:new We(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Rn(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?We.empty:new We(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Rn(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 Rn(n.from,n.to,We.fromJSON(e,n.slice),!!n.structure)}};eu.MAP_BIAS=1;ft.jsonID("replace",eu);var dg=class ho extends ft{constructor(e,n,r,i,s,o,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(tc(e,this.from,this.gapFrom)||tc(e,this.gapTo,this.to)))return Et.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Et.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Et.fromReplace(e,this.from,this.to,r):Et.fail("Content does not fit in gap")}getMap(){return new Er([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 ho(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),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new ho(n.pos,r.pos,i,s,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 ho(n.from,n.to,n.gapFrom,n.gapTo,We.fromJSON(e,n.slice),n.insert,!!n.structure)}};ft.jsonID("replaceAround",dg);function tc(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}var CS=class mo extends ft{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Et.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Et.fromReplace(e,this.pos,this.pos+1,new We(Tn.from(i),0,n.isLeaf?0:1))}getMap(){return Er.empty}invert(e){return new mo(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new mo(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new mo(n.pos,n.attr,n.value)}};ft.jsonID("attr",CS);var MS=class nc extends ft{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Et.ok(r)}getMap(){return Er.empty}invert(e){return new nc(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new nc(n.attr,n.value)}};ft.jsonID("docAttr",MS);var ms=class extends Error{};ms=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};ms.prototype=Object.create(Error.prototype);ms.prototype.constructor=ms;ms.prototype.name="TransformError";var sl=Object.create(null),Ze=class{constructor(t,e,n){this.$anchor=t,this.$head=e,this.ranges=n||[new OS(t.min(e),t.max(e))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,e=We.empty){let n=e.content.lastChild,r=null;for(let o=0;o<e.openEnd;o++)r=n,n=n.lastChild;let i=t.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){let{$from:a,$to:l}=s[o],c=t.mapping.slice(i);t.replaceRange(c.map(a.pos),c.map(l.pos),o?We.empty:e),o==0&&uf(t,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(t,e){let n=t.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:o}=r[i],a=t.mapping.slice(n),l=a.map(s.pos),c=a.map(o.pos);i?t.deleteRange(l,c):(t.replaceRangeWith(l,c,e),uf(t,n,e.isInline?-1:1))}}static findFrom(t,e,n=!1){let r=t.parent.inlineContent?new ii(t):Hr(t.node(0),t.parent,t.pos,t.index(),e,n);if(r)return r;for(let i=t.depth-1;i>=0;i--){let s=e<0?Hr(t.node(0),t.node(i),t.before(i+1),t.index(i),e,n):Hr(t.node(0),t.node(i),t.after(i+1),t.index(i)+1,e,n);if(s)return s}return null}static near(t,e=1){return this.findFrom(t,e)||this.findFrom(t,-e)||new Gi(t.node(0))}static atStart(t){return Hr(t,t,0,0,1)||new Gi(t)}static atEnd(t){return Hr(t,t,t.content.size,t.childCount,-1)||new Gi(t)}static fromJSON(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=sl[e.type];if(!n)throw new RangeError(`No selection type ${e.type} defined`);return n.fromJSON(t,e)}static jsonID(t,e){if(t in sl)throw new RangeError("Duplicate use of selection JSON ID "+t);return sl[t]=e,e.prototype.jsonID=t,e}getBookmark(){return ii.between(this.$anchor,this.$head).getBookmark()}};Ze.prototype.visible=!0;var OS=class{constructor(t,e){this.$from=t,this.$to=e}},lf=!1;function cf(t){!lf&&!t.parent.inlineContent&&(lf=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}var ii=class zi extends Ze{constructor(e,n=e){cf(e),cf(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Ze.near(r);let i=e.resolve(n.map(this.anchor));return new zi(i.parent.inlineContent?i:r,r)}replace(e,n=We.empty){if(super.replace(e,n),n==We.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof zi&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new fg(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new zi(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=Ze.findFrom(n,r,!0)||Ze.findFrom(n,-r,!0);if(s)n=s.$head;else return Ze.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(Ze.findFrom(e,-r,!0)||Ze.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new zi(e,n)}};Ze.jsonID("text",ii);var fg=class pg{constructor(e,n){this.anchor=e,this.head=n}map(e){return new pg(e.map(this.anchor),e.map(this.head))}resolve(e){return ii.between(e.resolve(this.anchor),e.resolve(this.head))}},si=class $i extends Ze{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?Ze.near(s):new $i(s)}content(){return new We(Tn.from(this.node),0,0)}eq(e){return e instanceof $i&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new RS(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new $i(e.resolve(n.anchor))}static create(e,n){return new $i(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};si.prototype.visible=!1;Ze.jsonID("node",si);var RS=class hg{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new fg(r,r):new hg(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&si.isSelectable(r)?new si(n):Ze.near(n)}},Gi=class go extends Ze{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=We.empty){if(n==We.empty){e.delete(0,e.doc.content.size);let r=Ze.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new go(e)}map(e){return new go(e)}eq(e){return e instanceof go}getBookmark(){return IS}};Ze.jsonID("all",Gi);var IS={map(){return this},resolve(t){return new Gi(t)}};function Hr(t,e,n,r,i,s=!1){if(e.inlineContent)return ii.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&si.isSelectable(a))return si.create(t,n-(i<0?a.nodeSize:0))}else{let l=Hr(t,a,n+i,i<0?a.childCount:0,i,s);if(l)return l}n+=a.nodeSize*i}return null}function uf(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof eu||i instanceof dg))return;let s=t.mapping.maps[r],o;s.forEach((a,l,c,u)=>{o==null&&(o=u)}),t.setSelection(Ze.near(t.doc.resolve(o),n))}function df(t,e){return!e||!t?t:t.bind(e)}var Ws=class{constructor(t,e,n){this.name=t,this.init=df(e.init,n),this.apply=df(e.apply,n)}};new Ws("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Ws("selection",{init(t,e){return t.selection||Ze.atStart(e.doc)},apply(t){return t.selection}}),new Ws("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Ws("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}});var DS=(t,e)=>{var n;const{state:r,view:i}=t,{selection:s}=r;if(!s.empty)return!1;const{$from:o}=s;if(o.parentOffset!==0)return!1;const a=o.depth-1,l=o.node(a),c=o.index(a);if(c===0)return!1;if(l.type===e)return t.commands.lift(e.name);const u=l.child(c-1);if(u.type!==e||!((n=u.lastChild)!=null&&n.isTextblock))return!1;const d=o.before(),f=d-1-1,{tr:h}=r;return h.delete(d,o.after()).insert(f,o.parent.content),h.setSelection(ii.create(h.doc,f)),i.dispatch(h.scrollIntoView()),!0},LS=/^\s*>\s$/,PS=Ye.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Io("blockquote",{...Ae(this.options.HTMLAttributes,t),children:Io("slot",{})})},parseMarkdown:(t,e)=>{var n;const r=(n=e.parseBlockChildren)!=null?n:e.parseChildren;return e.createNode("blockquote",void 0,r(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach((i,s)=>{var o,a;const u=((a=(o=e.renderChild)==null?void 0:o.call(e,i,s))!=null?a:e.renderChildren([i])).split(`
|
|
158
|
-
`).map(d=>d.trim()===""?n:`${n} ${d}`);r.push(u.join(`
|
|
159
|
-
`))}),r.join(`
|
|
160
|
-
${n}
|
|
161
|
-
`)},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(),Backspace:()=>DS(this.editor,this.type)}},addInputRules(){return[ri({find:LS,type:this.type})]}}),BS=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,FS=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,zS=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,$S=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,US=qn.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 Io("strong",{...Ae(this.options.HTMLAttributes,t),children:Io("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},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[ni({find:BS,type:this.type}),ni({find:zS,type:this.type})]},addPasteRules(){return[yr({find:FS,type:this.type}),yr({find:$S,type:this.type})]}}),HS=t=>{const e=/`([^`]+)`(?!`)$/.exec(t);return!e||e.index>0&&t[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},jS=t=>{const e=/`([^`]+)`(?!`)/g,n=[];let r;for(;(r=e.exec(t))!==null;)r.index>0&&t[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n},VS=qn.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Ae(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[ni({find:HS,type:this.type})]},addPasteRules(){return[yr({find:jS,type:this.type})]}}),ol=4,WS=/^```([a-z]+)?[\s\n]$/,KS=/^~~~([a-z]+)?[\s\n]$/,mg=Ye.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:ol,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 s=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Ae(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&((r=t.raw)==null?void 0:r.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 i=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${i}`,e.renderChildren(t.content),"```"].join(`
|
|
162
|
-
`):r=`\`\`\`${i}
|
|
163
|
-
|
|
164
|
-
\`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:ol,{state:r}=t,{selection:i}=r,{$from:s,empty:o}=i;if(s.parent.type!==this.type)return!1;const a=" ".repeat(n);return o?t.commands.insertContent(a):t.commands.command(({tr:l})=>{const{from:c,to:u}=i,f=r.doc.textBetween(c,u,`
|
|
165
|
-
`,`
|
|
166
|
-
`).split(`
|
|
167
|
-
`).map(h=>a+h).join(`
|
|
168
|
-
`);return l.replaceWith(c,u,r.schema.text(f)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:ol,{state:r}=t,{selection:i}=r,{$from:s,empty:o}=i;return s.parent.type!==this.type?!1:o?t.commands.command(({tr:a})=>{var l;const{pos:c}=s,u=s.start(),d=s.end(),f=r.doc.textBetween(u,d,`
|
|
169
|
-
`,`
|
|
170
|
-
`).split(`
|
|
171
|
-
`);let h=0,m=0;const g=c-u;for(let T=0;T<f.length;T+=1){if(m+f[T].length>=g){h=T;break}m+=f[T].length+1}const w=((l=f[h].match(/^ */))==null?void 0:l[0])||"",S=Math.min(w.length,n);if(S===0)return!0;let b=u;for(let T=0;T<h;T+=1)b+=f[T].length+1;return a.delete(b,b+S),c-b<=S&&a.setSelection(le.create(a.doc,b)),!0}):t.commands.command(({tr:a})=>{const{from:l,to:c}=i,p=r.doc.textBetween(l,c,`
|
|
172
|
-
`,`
|
|
173
|
-
`).split(`
|
|
174
|
-
`).map(f=>{var h;const m=((h=f.match(/^ */))==null?void 0:h[0])||"",g=Math.min(m.length,n);return f.slice(g)}).join(`
|
|
175
|
-
`);return a.replaceWith(l,c,r.schema.text(p)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
|
|
176
|
-
|
|
177
|
-
`);return!s||!o?!1:t.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const a=i.after();return a===void 0?!1:r.nodeAt(a)?t.commands.command(({tr:c})=>(c.setSelection(ue.near(r.resolve(a))),!0)):t.commands.exitCode()}}},addInputRules(){return[Xl({find:WS,type:this.type,getAttributes:t=>({language:t[1]})}),Xl({find:KS,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Me({key:new ze("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i==null?void 0:i.mode;if(!n||!s)return!1;const{tr:o,schema:a}=t.state,l=a.text(n.replace(/\r\n?/g,`
|
|
178
|
-
`));return o.replaceSelectionWith(this.type.create({language:s},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(le.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),qS=Ye.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
179
|
-
|
|
180
|
-
`):""}),GS=Ye.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Ae(this.options.HTMLAttributes,t)]},renderText(){return`
|
|
181
|
-
`},renderMarkdown:()=>`
|
|
182
|
-
`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:s}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,l=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&o){const d=l.filter(p=>a.includes(p.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),YS=Ye.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Ae(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,i="#".repeat(r);return t.content?`${i} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Xl({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),JS=Ye.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Ae(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!fw(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,i=t();return vm(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:s,tr:o,dispatch:a})=>{if(a){const{$to:l}=o.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?o.setSelection(le.create(o.doc,l.pos+1)):l.nodeAfter.isBlock?o.setSelection(ee.create(o.doc,l.pos)):o.setSelection(le.create(o.doc,l.pos));else{const u=s.schema.nodes[this.options.nextNodeType]||l.parent.type.contentMatch.defaultType,d=u==null?void 0:u.create();d&&(o.insert(c,d),o.setSelection(le.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[dw({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),XS=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,ZS=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,QS=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,ek=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,tk=qn.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Ae(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[ni({find:XS,type:this.type}),ni({find:QS,type:this.type})]},addPasteRules(){return[yr({find:ZS,type:this.type}),yr({find:ek,type:this.type})]}});const nk="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",rk="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",rc="numeric",ic="ascii",sc="alpha",Yi="asciinumeric",Ui="alphanumeric",oc="domain",gg="emoji",ik="scheme",sk="slashscheme",al="whitespace";function ok(t,e){return t in e||(e[t]=[]),e[t]}function sr(t,e,n){e[rc]&&(e[Yi]=!0,e[Ui]=!0),e[ic]&&(e[Yi]=!0,e[sc]=!0),e[Yi]&&(e[Ui]=!0),e[sc]&&(e[Ui]=!0),e[Ui]&&(e[oc]=!0),e[gg]&&(e[oc]=!0);for(const r in e){const i=ok(r,n);i.indexOf(t)<0&&i.push(t)}}function ak(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Nt(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Nt.groups={};Nt.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],s=e.jr[r][1];if(s&&i.test(t))return s}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,n,r)},tr(t,e,n,r){r=r||Nt.groups;let i;return e&&e.j?i=e:(i=new Nt(e),n&&r&&sr(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this;const s=t.length;if(!s)return i;for(let o=0;o<s-1;o++)i=i.tt(t[o]);return i.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||Nt.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const s=e;let o,a=i.go(t);if(a?(o=new Nt,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new Nt,s){if(r)if(o.t&&typeof o.t=="string"){const l=Object.assign(ak(o.t,r),n);sr(s,l,r)}else n&&sr(s,n,r);o.t=s}return i.j[t]=o,o}};const me=(t,e,n,r,i)=>t.ta(e,n,r,i),Pe=(t,e,n,r,i)=>t.tr(e,n,r,i),ff=(t,e,n,r,i)=>t.ts(e,n,r,i),P=(t,e,n,r,i)=>t.tt(e,n,r,i),yn="WORD",ac="UWORD",bg="ASCIINUMERICAL",yg="ALPHANUMERICAL",gs="LOCALHOST",lc="TLD",cc="UTLD",bo="SCHEME",jr="SLASH_SCHEME",tu="NUM",uc="WS",nu="NL",Ji="OPENBRACE",Xi="CLOSEBRACE",Do="OPENBRACKET",Lo="CLOSEBRACKET",Po="OPENPAREN",Bo="CLOSEPAREN",Fo="OPENANGLEBRACKET",zo="CLOSEANGLEBRACKET",$o="FULLWIDTHLEFTPAREN",Uo="FULLWIDTHRIGHTPAREN",Ho="LEFTCORNERBRACKET",jo="RIGHTCORNERBRACKET",Vo="LEFTWHITECORNERBRACKET",Wo="RIGHTWHITECORNERBRACKET",Ko="FULLWIDTHLESSTHAN",qo="FULLWIDTHGREATERTHAN",Go="AMPERSAND",Yo="APOSTROPHE",Jo="ASTERISK",Dn="AT",Xo="BACKSLASH",Zo="BACKTICK",Qo="CARET",or="COLON",ru="COMMA",ea="DOLLAR",sn="DOT",ta="EQUALS",iu="EXCLAMATION",zt="HYPHEN",Zi="PERCENT",na="PIPE",ra="PLUS",ia="POUND",Qi="QUERY",su="QUOTE",Eg="FULLWIDTHMIDDLEDOT",ou="SEMI",on="SLASH",es="TILDE",sa="UNDERSCORE",vg="EMOJI",oa="SYM";var xg=Object.freeze({__proto__:null,ALPHANUMERICAL:yg,AMPERSAND:Go,APOSTROPHE:Yo,ASCIINUMERICAL:bg,ASTERISK:Jo,AT:Dn,BACKSLASH:Xo,BACKTICK:Zo,CARET:Qo,CLOSEANGLEBRACKET:zo,CLOSEBRACE:Xi,CLOSEBRACKET:Lo,CLOSEPAREN:Bo,COLON:or,COMMA:ru,DOLLAR:ea,DOT:sn,EMOJI:vg,EQUALS:ta,EXCLAMATION:iu,FULLWIDTHGREATERTHAN:qo,FULLWIDTHLEFTPAREN:$o,FULLWIDTHLESSTHAN:Ko,FULLWIDTHMIDDLEDOT:Eg,FULLWIDTHRIGHTPAREN:Uo,HYPHEN:zt,LEFTCORNERBRACKET:Ho,LEFTWHITECORNERBRACKET:Vo,LOCALHOST:gs,NL:nu,NUM:tu,OPENANGLEBRACKET:Fo,OPENBRACE:Ji,OPENBRACKET:Do,OPENPAREN:Po,PERCENT:Zi,PIPE:na,PLUS:ra,POUND:ia,QUERY:Qi,QUOTE:su,RIGHTCORNERBRACKET:jo,RIGHTWHITECORNERBRACKET:Wo,SCHEME:bo,SEMI:ou,SLASH:on,SLASH_SCHEME:jr,SYM:oa,TILDE:es,TLD:lc,UNDERSCORE:sa,UTLD:cc,UWORD:ac,WORD:yn,WS:uc});const gn=/[a-z]/,xi=new RegExp("\\p{L}","u"),ll=new RegExp("\\p{Emoji}","u"),bn=/\d/,cl=/\s/,pf="\r",ul=`
|
|
183
|
-
`,lk="️",ck="",dl="";let Ks=null,qs=null;function uk(t=[]){const e={};Nt.groups=e;const n=new Nt;Ks==null&&(Ks=hf(nk)),qs==null&&(qs=hf(rk)),P(n,"'",Yo),P(n,"{",Ji),P(n,"}",Xi),P(n,"[",Do),P(n,"]",Lo),P(n,"(",Po),P(n,")",Bo),P(n,"<",Fo),P(n,">",zo),P(n,"(",$o),P(n,")",Uo),P(n,"「",Ho),P(n,"」",jo),P(n,"『",Vo),P(n,"』",Wo),P(n,"<",Ko),P(n,">",qo),P(n,"&",Go),P(n,"*",Jo),P(n,"@",Dn),P(n,"`",Zo),P(n,"^",Qo),P(n,":",or),P(n,",",ru),P(n,"$",ea),P(n,".",sn),P(n,"=",ta),P(n,"!",iu),P(n,"-",zt),P(n,"%",Zi),P(n,"|",na),P(n,"+",ra),P(n,"#",ia),P(n,"?",Qi),P(n,'"',su),P(n,"/",on),P(n,";",ou),P(n,"~",es),P(n,"_",sa),P(n,"\\",Xo),P(n,"・",Eg);const r=Pe(n,bn,tu,{[rc]:!0});Pe(r,bn,r);const i=Pe(r,gn,bg,{[Yi]:!0}),s=Pe(r,xi,yg,{[Ui]:!0}),o=Pe(n,gn,yn,{[ic]:!0});Pe(o,bn,i),Pe(o,gn,o),Pe(i,bn,i),Pe(i,gn,i);const a=Pe(n,xi,ac,{[sc]:!0});Pe(a,gn),Pe(a,bn,s),Pe(a,xi,a),Pe(s,bn,s),Pe(s,gn),Pe(s,xi,s);const l=P(n,ul,nu,{[al]:!0}),c=P(n,pf,uc,{[al]:!0}),u=Pe(n,cl,uc,{[al]:!0});P(n,dl,u),P(c,ul,l),P(c,dl,u),Pe(c,cl,u),P(u,pf),P(u,ul),Pe(u,cl,u),P(u,dl,u);const d=Pe(n,ll,vg,{[gg]:!0});P(d,"#"),Pe(d,ll,d),P(d,lk,d);const p=P(d,ck);P(p,"#"),Pe(p,ll,d);const f=[[gn,o],[bn,i]],h=[[gn,null],[xi,a],[bn,s]];for(let m=0;m<Ks.length;m++)Cn(n,Ks[m],lc,yn,f);for(let m=0;m<qs.length;m++)Cn(n,qs[m],cc,ac,h);sr(lc,{tld:!0,ascii:!0},e),sr(cc,{utld:!0,alpha:!0},e),Cn(n,"file",bo,yn,f),Cn(n,"mailto",bo,yn,f),Cn(n,"http",jr,yn,f),Cn(n,"https",jr,yn,f),Cn(n,"ftp",jr,yn,f),Cn(n,"ftps",jr,yn,f),sr(bo,{scheme:!0,ascii:!0},e),sr(jr,{slashscheme:!0,ascii:!0},e),t=t.sort((m,g)=>m[0]>g[0]?1:-1);for(let m=0;m<t.length;m++){const g=t[m][0],w=t[m][1]?{[ik]:!0}:{[sk]:!0};g.indexOf("-")>=0?w[oc]=!0:gn.test(g)?bn.test(g)?w[Yi]=!0:w[ic]=!0:w[rc]=!0,ff(n,g,g,w)}return ff(n,"localhost",gs,{ascii:!0}),n.jd=new Nt(oa),{start:n,tokens:Object.assign({groups:e},xg)}}function wg(t,e){const n=dk(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,i=[];let s=0,o=0;for(;o<r;){let a=t,l=null,c=0,u=null,d=-1,p=-1;for(;o<r&&(l=a.go(n[o]));)a=l,a.accepts()?(d=0,p=0,u=a):d>=0&&(d+=n[o].length,p++),c+=n[o].length,s+=n[o].length,o++;s-=d,o-=p,c-=d,i.push({t:u.t,v:e.slice(s-c,s),s:s-c,e:s})}return i}function dk(t){const e=[],n=t.length;let r=0;for(;r<n;){let i=t.charCodeAt(r),s,o=i<55296||i>56319||r+1===n||(s=t.charCodeAt(r+1))<56320||s>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function Cn(t,e,n,r,i){let s;const o=e.length;for(let a=0;a<o-1;a++){const l=e[a];t.j[l]?s=t.j[l]:(s=new Nt(r),s.jr=i.slice(),t.j[l]=s),t=s}return s=new Nt(n),s.jr=i.slice(),t.j[e[o-1]]=s,s}function hf(t){const e=[],n=[];let r=0,i="0123456789";for(;r<t.length;){let s=0;for(;i.indexOf(t[r+s])>=0;)s++;if(s>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+s),10);o>0;o--)n.pop();r+=s}else n.push(t[r]),r++}return e}const bs={defaultProtocol:"http",events:null,format:mf,formatHref:mf,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function au(t,e=null){let n=Object.assign({},bs);t&&(n=Object.assign(n,t instanceof au?t.o:t));const r=n.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=i}au.prototype={o:bs,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let i=this.o[t];return i&&(typeof i=="object"?(i=n.t in i?i[n.t]:bs[t],typeof i=="function"&&r&&(i=i(e,n))):typeof i=="function"&&r&&(i=i(e,n.t,n)),i)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function mf(t){return t}function Sg(t,e){this.t="token",this.v=t,this.tk=e}Sg.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=bs.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),s=this.toFormattedString(t),o={},a=t.get("className",n,e),l=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return o.href=r,a&&(o.class=a),l&&(o.target=l),c&&(o.rel=c),u&&Object.assign(o,u),{tagName:i,attributes:o,content:s,eventListeners:d}}};function Na(t,e){class n extends Sg{constructor(i,s){super(i,s),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const fk=Na("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),gf=Na("text"),pk=Na("nl"),Gs=Na("url",{isLink:!0,toHref(t=bs.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==gs&&t[1].t===or}}),Ft=t=>new Nt(t);function hk({groups:t}){const e=t.domain.concat([Go,Jo,Dn,Xo,Zo,Qo,ea,ta,zt,tu,Zi,na,ra,ia,on,oa,es,sa]),n=[Yo,or,ru,sn,iu,Zi,Qi,su,ou,Fo,zo,Ji,Xi,Lo,Do,Po,Bo,$o,Uo,Ho,jo,Vo,Wo,Ko,qo],r=[Go,Yo,Jo,Xo,Zo,Qo,ea,ta,zt,Ji,Xi,Zi,na,ra,ia,Qi,on,oa,es,sa],i=Ft(),s=P(i,es);me(s,r,s),me(s,t.domain,s);const o=Ft(),a=Ft(),l=Ft();me(i,t.domain,o),me(i,t.scheme,a),me(i,t.slashscheme,l),me(o,r,s),me(o,t.domain,o);const c=P(o,Dn);P(s,Dn,c),P(a,Dn,c),P(l,Dn,c);const u=P(s,sn);me(u,r,s),me(u,t.domain,s);const d=Ft();me(c,t.domain,d),me(d,t.domain,d);const p=P(d,sn);me(p,t.domain,d);const f=Ft(fk);me(p,t.tld,f),me(p,t.utld,f),P(c,gs,f);const h=P(d,zt);P(h,zt,h),me(h,t.domain,d),me(f,t.domain,d),P(f,sn,p),P(f,zt,h);const m=P(o,zt),g=P(o,sn);P(m,zt,m),me(m,t.domain,o),me(g,r,s),me(g,t.domain,o);const y=Ft(Gs);me(g,t.tld,y),me(g,t.utld,y),me(y,t.domain,o),me(y,r,s),P(y,sn,g),P(y,zt,m),P(y,Dn,c);const w=P(y,or),S=Ft(Gs);me(w,t.numeric,S);const b=Ft(Gs),x=Ft();me(b,e,b),me(b,n,x),me(x,e,b),me(x,n,x),P(y,on,b),P(S,on,b);const T=P(a,or),k=P(l,or),R=P(k,on),N=P(R,on);me(a,t.domain,o),P(a,sn,g),P(a,zt,m),me(l,t.domain,o),P(l,sn,g),P(l,zt,m),me(T,t.domain,b),P(T,on,b),P(T,Qi,b),me(N,t.domain,b),me(N,e,b),P(N,on,b);const O=[[Ji,Xi],[Do,Lo],[Po,Bo],[Fo,zo],[$o,Uo],[Ho,jo],[Vo,Wo],[Ko,qo]];for(let j=0;j<O.length;j++){const[V,U]=O[j],B=P(b,V);P(x,V,B);const H=Ft(Gs);me(B,e,H);const _=Ft();me(B,n,_),P(B,U,b),me(H,e,H),me(H,n,_),me(_,e,H),me(_,n,_),P(H,U,b),P(_,U,b)}return P(i,gs,y),P(i,nu,pk),{start:i,tokens:xg}}function mk(t,e,n){let r=n.length,i=0,s=[],o=[];for(;i<r;){let a=t,l=null,c=null,u=0,d=null,p=-1;for(;i<r&&!(l=a.go(n[i].t));)o.push(n[i++]);for(;i<r&&(c=l||a.go(n[i].t));)l=null,a=c,a.accepts()?(p=0,d=a):p>=0&&p++,i++,u++;if(p<0)i-=u,i<r&&(o.push(n[i]),i++);else{o.length>0&&(s.push(fl(gf,e,o)),o=[]),i-=p,u-=p;const f=d.t,h=n.slice(i-u,i);s.push(fl(f,e,h))}}return o.length>0&&s.push(fl(gf,e,o)),s}function fl(t,e,n){const r=n[0].s,i=n[n.length-1].e,s=e.slice(r,i);return new t(s,n)}const gk=typeof console<"u"&&console&&console.warn||(()=>{}),bk="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Re={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function yk(){return Nt.groups={},Re.scanner=null,Re.parser=null,Re.tokenQueue=[],Re.pluginQueue=[],Re.customSchemes=[],Re.initialized=!1,Re}function bf(t,e=!1){if(Re.initialized&&gk(`linkifyjs: already initialized - will not register custom scheme "${t}" ${bk}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
|
|
184
|
-
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
185
|
-
2. Cannot start or end with "-"
|
|
186
|
-
3. "-" cannot repeat`);Re.customSchemes.push([t,e])}function Ek(){Re.scanner=uk(Re.customSchemes);for(let t=0;t<Re.tokenQueue.length;t++)Re.tokenQueue[t][1]({scanner:Re.scanner});Re.parser=hk(Re.scanner.tokens);for(let t=0;t<Re.pluginQueue.length;t++)Re.pluginQueue[t][1]({scanner:Re.scanner,parser:Re.parser});return Re.initialized=!0,Re}function lu(t){return Re.initialized||Ek(),mk(Re.parser.start,t,wg(Re.scanner.start,t))}lu.scan=wg;function kg(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new au(n),i=lu(t),s=[];for(let o=0;o<i.length;o++){const a=i[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&s.push(a.toFormattedObject(r))}return s}var cu="[\0- -\u2029 ]",vk=new RegExp(cu),xk=new RegExp(`${cu}$`),wk=new RegExp(cu,"g");function Sk(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function kk(t){return new Me({key:new ze("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,a=fm(n.doc,[...e]);if(Em(a).forEach(({newRange:c})=>{const u=d0(r.doc,c,f=>f.isTextblock);let d,p;if(u.length>1)d=u[0],p=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const f=r.doc.textBetween(c.from,c.to," "," ");if(!xk.test(f))return;d=u[0],p=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&p){const f=p.split(vk).filter(Boolean);if(f.length<=0)return!1;const h=f[f.length-1],m=d.pos+p.lastIndexOf(h);if(!h)return!1;const g=lu(h).map(y=>y.toObject(t.defaultProtocol));if(!Sk(g))return!1;g.filter(y=>y.isLink).map(y=>({...y,from:m+y.start+1,to:m+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>t.validate(y.value)).filter(y=>t.shouldAutoLink(y.value)).forEach(y=>{qc(y.from,y.to,r.doc).some(w=>w.mark.type===t.type)||o.addMark(y.from,y.to,t.type.create({href:y.href}))})}}),!!o.steps.length)return o}})}function Tk(t){return new Me({key:new ze("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const l=r.target;if(!l)return!1;const c=t.editor.view.dom;o=l.closest("a"),o&&!c.contains(o)&&(o=null)}if(!o)return!1;let a=!1;if(t.enableClickSelection&&(a=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const l=ym(e.state,t.type.name),c=(i=o.href)!=null?i:l.href,u=(s=o.target)!=null?s:l.target;c&&(window.open(c,u),a=!0)}return a}}})}function Nk(t){return new Me({key:new ze("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:i}=t,{state:s}=e,{selection:o}=s,{empty:a}=o;if(a)return!1;let l="";r.content.forEach(u=>{l+=u.textContent});const c=kg(l,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===l);return!l||!c||i!==void 0&&!i(c.value)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function Zn(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(wk,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Tg=qn.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){bf(t);return}bf(t.scheme,t.optionalSlashes)})},onDestroy(){yk()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Zn(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const i=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Zn(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Zn(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Ae(this.options.HTMLAttributes,t),0]:["a",Ae(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,i,s;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",a=(s=(i=t.attrs)==null?void 0:i.title)!=null?s:"",l=e.renderChildren(t);return a?`[${l}](${o} "${a}")`:`[${l}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Zn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!Zn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[yr({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=kg(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:o=>!!Zn(o,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(s=>{this.options.shouldAutoLink(s.value)&&e.push({text:s.value,data:{href:s.href},index:s.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(kk({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Zn(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(Tk({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(Nk({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),_k=Tg,Ak=Object.defineProperty,Ck=(t,e)=>{for(var n in e)Ak(t,n,{get:e[n],enumerable:!0})},Mk="listItem",yf="textStyle",Ef=/^\s*([-+*])\s$/,Ng=Ye.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Ae(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
187
|
-
`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Mk,this.editor.getAttributes(yf)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=ri({find:Ef,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=ri({find:Ef,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(yf),editor:this.editor})),[t]}}),Ok=(t,e,n)=>{const{selection:r}=t;if(!r.empty)return null;const{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let s=-1;for(let f=i.depth;f>0;f-=1)if(i.node(f).type.name===e){s=f;break}if(s<0)return null;const o=i.node(s),a=i.index(s);if(a+1>=o.childCount)return null;const l=o.child(a+1);if(!n.includes(l.type.name))return null;const c=t.schema.nodes[e];let u=!1;if(l.forEach(f=>{f.type===c&&f.childCount>1&&(u=!0)}),!u)return null;const d=t.doc.resolve(i.after()).nodeAfter;if(!d||!n.includes(d.type.name))return null;const p=[];return d.forEach(f=>{p.push(f)}),p.length===0?null:{listItemDepth:s,nestedList:d,nestedListPos:i.after(),insertPos:i.after(s),items:p}},Rk=(t,e,n,r)=>{const i=Ok(t,n,r);if(!i)return!1;const{selection:s}=t,{nestedList:o,nestedListPos:a,insertPos:l,items:c}=i,u=t.tr;u.delete(a,a+o.nodeSize);const d=u.mapping.map(l);return u.insert(d,F.from(c)),u.setSelection(s.map(u.doc,u.mapping)),e&&e(u),!0},Ik=(t,e,n)=>Rk(t.state,t.view.dispatch,e,n),_g=(t,e)=>ke.create({name:`${t}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const n=()=>Ik(this.editor,t,e);return{Delete:n,"Mod-Delete":n}}});function Dk(t){var e,n;const r=(e=t.tokens)==null?void 0:e[0];return!!(t.text&&((n=t.tokens)==null?void 0:n.length)===1&&(r==null?void 0:r.type)==="list"&&r.ordered&&r.raw===t.text)}function Lk(t,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(t)):e.parseInline([{type:"text",raw:t,text:t}])}var Ag=Ye.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Ae(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{var n;if(t.type!=="list_item")return[];const r=(n=e.parseBlockChildren)!=null?n:e.parseChildren;let i=[];if(t.tokens&&t.tokens.length>0){if(Dk(t))return{type:"listItem",content:[{type:"paragraph",content:Lk(t.text||"",e)}]};if(t.tokens.some(o=>o.type==="paragraph"))i=r(t.tokens);else{const o=t.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(i=[{type:"paragraph",content:e.parseInline(o.tokens)}],t.tokens.length>1){const l=t.tokens.slice(1),c=r(l);i.push(...c)}}else i=r(t.tokens)}}return i.length===0&&(i=[{type:"paragraph",content:[]}]),{type:"listItem",content:i}},renderMarkdown:(t,e,n)=>Xc(t,e,r=>{var i,s;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((s=(i=r.meta)==null?void 0:i.parentAttrs)==null?void 0:s.start)||1)+r.index}. `:"- "},n),addExtensions(){return[_g(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Pk={};Ck(Pk,{findListItemPos:()=>_a,getNextListDepth:()=>uu,handleBackspace:()=>dc,handleDelete:()=>fc,hasListBefore:()=>Cg,hasListItemAfter:()=>Bk,hasListItemBefore:()=>Fk,listItemHasSubList:()=>zk,nextListIsDeeper:()=>Mg,nextListIsHigher:()=>Og});var _a=(t,e)=>{const{$from:n}=e.selection,r=Ke(t,e.schema);let i=null,s=n.depth,o=n.pos,a=null;for(;s>0&&a===null;)i=n.node(s),i.type===r?a=s:(s-=1,o-=1);return a===null?null:{$pos:e.doc.resolve(o),depth:a}},uu=(t,e)=>{const n=_a(t,e);if(!n)return!1;const[,r]=w0(e,t,n.$pos.pos+4);return r},Cg=(t,e,n)=>{const{$anchor:r}=t.selection,i=Math.max(0,r.pos-2),s=t.doc.resolve(i).node();return!(!s||!n.includes(s.type.name))},dc=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Vn(t.state,e)&&Cg(t.state,e,n)){const{$anchor:r}=t.state.selection,i=t.state.doc.resolve(r.before()-1),s=[];i.node().descendants((l,c)=>{l.type.name===e&&s.push({node:l,pos:c})});const o=s.at(-1);if(!o)return!1;const a=t.state.doc.resolve(i.start()+o.pos+1);return t.chain().cut({from:r.start()-1,to:r.end()+1},a.end()).joinForward().run()}return!Vn(t.state,e)||!N0(t.state)?!1:t.chain().liftListItem(e).run()},Mg=(t,e)=>{const n=uu(t,e),r=_a(t,e);return!r||!n?!1:n>r.depth},Og=(t,e)=>{const n=uu(t,e),r=_a(t,e);return!r||!n?!1:n<r.depth},fc=(t,e)=>{if(!Vn(t.state,e)||!T0(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:Mg(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():Og(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},Bk=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((n=i.nodeAfter)==null?void 0:n.type.name)!==t)},Fk=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((n=i.nodeBefore)==null?void 0:n.type.name)!==t)},zk=(t,e,n)=>{if(!n)return!1;const r=Ke(t,e.schema);let i=!1;return n.descendants(s=>{s.type===r&&(i=!0)}),i},Rg=ke.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&fc(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&fc(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&dc(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&dc(t,n,r)&&(e=!0)}),e}}}}),vf=/^(\s*)(\d+)\.\s+(.*)$/,$k=/^\s/;function Uk(t){const e=t.trimStart();return/^[-+*]\s+/.test(e)||/^\d+\.\s+/.test(e)||/^>\s?/.test(e)||/^```/.test(e)||/^~~~/.test(e)}function Hk(t){const e=[],n=[];let r=!1;return t.forEach(i=>{if(r){n.push(i);return}if(i.trim()===""){r=!0,n.push(i);return}if(e.length>0&&Uk(i)){r=!0,n.push(i);return}e.push(i)}),{paragraphLines:e,blockLines:n}}function jk(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n],s=i.match(vf);if(!s)break;const[,o,a,l]=s,c=o.length,u=[l];let d=n+1;const p=[i];let f=!1;for(;d<t.length;){const h=t[d];if(h.match(vf))break;if(h.trim()==="")p.push(h),u.push(""),f=!0,d+=1;else if(h.match($k))p.push(h),u.push(h.slice(c+2)),d+=1;else{if(f)break;p.push(h),u.push(h),d+=1}}e.push({indent:c,number:parseInt(a,10),content:u.join(`
|
|
188
|
-
`).trim(),contentLines:u,raw:p.join(`
|
|
189
|
-
`)}),r=d,n=d}return[e,r]}function Ig(t,e,n){const r=[];let i=0;for(;i<t.length;){const s=t[i];if(s.indent===e){const{paragraphLines:o,blockLines:a}=Hk(s.contentLines),l=o.join(`
|
|
190
|
-
`).trim(),c=[];l&&c.push({type:"paragraph",raw:l,tokens:n.inlineTokens(l)});const u=a.join(`
|
|
191
|
-
`).trim();if(u){const f=n.blockTokens(u);c.push(...f)}let d=i+1;const p=[];for(;d<t.length&&t[d].indent>e;)p.push(t[d]),d+=1;if(p.length>0){const f=Math.min(...p.map(m=>m.indent)),h=Ig(p,f,n);c.push({type:"list",ordered:!0,start:p[0].number,items:h,raw:p.map(m=>m.raw).join(`
|
|
192
|
-
`)})}r.push({type:"list_item",raw:s.raw,tokens:c}),i=d}else i+=1}return r}function Vk(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const s=e.parseChildren([i]);r.push({type:"paragraph",content:s})}else{const s=e.parseChildren([i]);s.length>0&&r.push(...s)}}),{type:"listItem",content:r}})}var Wk="listItem",xf="textStyle",wf=/^(\d+)\.\s$/,Dg=Ye.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Ae(this.options.HTMLAttributes,n),0]:["ol",Ae(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?Vk(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
193
|
-
`):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e==null?void 0:e.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const i=t.split(`
|
|
194
|
-
`),[s,o]=jk(i);if(s.length===0)return;const a=Ig(s,0,n);return a.length===0?void 0:{type:"list",ordered:!0,start:((r=s[0])==null?void 0:r.number)||1,items:a,raw:i.slice(0,o).join(`
|
|
195
|
-
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Wk,this.editor.getAttributes(xf)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=ri({find:wf,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=ri({find:wf,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(xf)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),Kk=/^\s*(\[([( |x])?\])\s$/,Lg=Ye.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Ae(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const i=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return Xc(t,e,i)},addExtensions(){return this.options.nested?[_g(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=d=>{var p,f;a.ariaLabel=((f=(p=this.options.a11y)==null?void 0:p.checkboxLabel)==null?void 0:f.call(p,d,a.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};c(t),s.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",d=>d.preventDefault()),a.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:p}=d.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const h=n();if(typeof h!="number")return!1;const m=f.doc.nodeAt(h);return f.setNodeMarkup(h,void 0,{...m==null?void 0:m.attrs,checked:p}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,p)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,p])=>{i.setAttribute(d,p)}),i.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,s.append(a,o),i.append(s,l),Object.entries(e).forEach(([d,p])=>{i.setAttribute(d,p)});let u=new Set(Object.keys(e));return{dom:i,contentDOM:l,update:d=>{if(d.type!==this.type)return!1;i.dataset.checked=d.attrs.checked,a.checked=d.attrs.checked,c(d);const p=r.extensionManager.attributes,f=ti(d,p),h=new Set(Object.keys(f)),m=this.options.HTMLAttributes;return u.forEach(g=>{h.has(g)||(g in m?i.setAttribute(g,m[g]):i.removeAttribute(g))}),Object.entries(f).forEach(([g,y])=>{y==null?g in m?i.setAttribute(g,m[g]):i.removeAttribute(g):i.setAttribute(g,y)}),u=h,!0}}}},addInputRules(){return[ri({find:Kk,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Pg=Ye.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",Ae(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
196
|
-
`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=s=>{const o=Zl(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:n.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:r},n);return o?[{type:"taskList",raw:o.raw,items:o.items}]:n.blockTokens(s)},i=Zl(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,o)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:n.inlineTokens(s.mainContent),nestedTokens:o}),customNestedParser:r},n);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});ke.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(Ng.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(Ag.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(Rg.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(Dg.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(Lg.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(Pg.configure(this.options.taskList)),t}});var Ys=" ",pl=" ",qk=Ye.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Ae(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return n.length===1&&n[0].type==="text"&&(n[0].raw===Ys||n[0].text===Ys||n[0].raw===pl||n[0].text===pl)&&r.length===1&&r[0].type==="text"&&(r[0].text===Ys||r[0].text===pl)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{var r,i;if(!t)return"";const s=Array.isArray(t.content)?t.content:[];if(s.length===0){const o=Array.isArray((r=n==null?void 0:n.previousNode)==null?void 0:r.content)?n.previousNode.content:[];return((i=n==null?void 0:n.previousNode)==null?void 0:i.type)==="paragraph"&&o.length===0?Ys:""}return e.renderChildren(s)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Gk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Yk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Bg=qn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Ae(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[ni({find:Gk,type:this.type})]},addPasteRules(){return[yr({find:Yk,type:this.type})]}}),Jk=Ye.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),Fg=qn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Ae(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!i)return;const s=i[2].trim();return{type:"underline",raw:i[0],text:s,tokens:n.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function Xk(t={}){return new Me({view(e){return new Zk(e,t)}})}class Zk{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,a=s.height/i.offsetHeight;if(n){let d=e.nodeBefore,p=e.nodeAfter;if(d||p){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let h=f.getBoundingClientRect(),m=d?h.bottom:h.top;d&&p&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*a;r={left:h.left,right:h.right,top:m-g,bottom:m+g}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*o;r={left:d.left-p,right:d.left+p,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),p=d.width/l.offsetWidth,f=d.height/l.offsetHeight;c=d.left-l.scrollLeft*p,u=d.top-l.scrollTop*f}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!s){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=eh(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Fe extends ue{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Fe.valid(r)?new Fe(r):ue.near(r)}content(){return G.empty}eq(e){return e instanceof Fe&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Fe(e.resolve(n.pos))}getBookmark(){return new du(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!Qk(e)||!eT(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Fe.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let a=e.node(o);if(n>0?e.indexAfter(o)<a.childCount:e.index(o)>0){s=a.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=n;let l=e.doc.resolve(i);if(Fe.valid(l))return l}for(;;){let o=n>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!ee.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*n),r=!1;continue e}break}s=o,i+=n;let a=e.doc.resolve(i);if(Fe.valid(a))return a}return null}}}Fe.prototype.visible=!1;Fe.findFrom=Fe.findGapCursorFrom;ue.jsonID("gapcursor",Fe);class du{constructor(e){this.pos=e}map(e){return new du(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Fe.valid(n)?new Fe(n):ue.near(n)}}function zg(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function Qk(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||zg(i.type))return!0;if(i.inlineContent)return!1}}return!0}function eT(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||zg(i.type))return!0;if(i.inlineContent)return!1}}return!0}function tT(){return new Me({props:{decorations:sT,createSelectionBetween(t,e,n){return e.pos==n.pos&&Fe.valid(n)?new Fe(n):null},handleClick:rT,handleKeyDown:nT,handleDOMEvents:{beforeinput:iT}}})}const nT=sm({ArrowLeft:Js("horiz",-1),ArrowRight:Js("horiz",1),ArrowUp:Js("vert",-1),ArrowDown:Js("vert",1)});function Js(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof le){if(!s.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=Fe.findGapCursorFrom(a,e,l);return c?(i&&i(r.tr.setSelection(new Fe(c))),!0):!1}}function rT(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Fe.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&ee.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Fe(r))),!0)}function iT(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Fe))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=F.empty;for(let o=r.length-1;o>=0;o--)i=F.from(r[o].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new G(i,0,0));return s.setSelection(le.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function sT(t){if(!(t.selection instanceof Fe))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Ce.create(t.doc,[Qe.widget(t.selection.head,e,{key:"gapcursor"})])}var aa=200,et=function(){};et.prototype.append=function(e){return e.length?(e=et.from(e),!this.length&&e||e.length<aa&&this.leafAppend(e)||this.length<aa&&e.leafPrepend(this)||this.appendInner(e)):this};et.prototype.prepend=function(e){return e.length?et.from(e).append(this):this};et.prototype.appendInner=function(e){return new oT(this,e)};et.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?et.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};et.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};et.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};et.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},n,r),i};et.from=function(e){return e instanceof et?e:e&&e.length?new $g(e):et.empty};var $g=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var l=s;l<o;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){for(var l=s-1;l>=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=aa)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=aa)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(et);et.empty=new $g([]);var oT=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(s,a),o)===!1||s>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(s,a)-a,o+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(et);const aT=500;class Zt{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,a,l,c=[],u=[];return this.items.forEach((d,p)=>{if(!d.step){i||(i=this.remapping(r,p+1),s=i.maps.length),s--,u.push(d);return}if(i){u.push(new an(d.map));let f=d.step.map(i.slice(s)),h;f&&o.maybeStep(f).doc&&(h=o.mapping.maps[o.mapping.maps.length-1],c.push(new an(h,void 0,void 0,c.length+u.length))),s--,h&&i.appendMap(h,s)}else o.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(s)):d.selection,l=new Zt(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,n,r,i){let s=[],o=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),p=new an(e.mapping.maps[u],d,n),f;(f=l&&l.merge(p))&&(p=f,u?s.pop():a=a.slice(0,a.length-1)),s.push(p),n&&(o++,n=void 0),i||(l=p)}let c=o-r.depth;return c>cT&&(a=lT(a,c),o-=c),new Zt(a.append(s),o)}remapping(e,n){let r=new as;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new Zt(this.items.append(e.map(n=>new an(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(p=>{p.selection&&a--},i);let l=n;this.items.forEach(p=>{let f=s.getMirror(--l);if(f==null)return;o=Math.min(o,f);let h=s.maps[f];if(p.step){let m=e.steps[f].invert(e.docs[f]),g=p.selection&&p.selection.map(s.slice(l+1,f));g&&a++,r.push(new an(h,m,g))}else r.push(new an(h))},i);let c=[];for(let p=n;p<o;p++)c.push(new an(s.maps[p]));let u=this.items.slice(0,i).append(c).append(r),d=new Zt(u,a);return d.emptyItemCount()>aT&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let l=o.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=o.selection&&o.selection.map(n.slice(r));u&&s++;let d=new an(c.invert(),l,u),p,f=i.length-1;(p=i.length&&i[f].merge(d))?i[f]=p:i.push(d)}}else o.map&&r--},this.items.length,0),new Zt(et.from(i.reverse()),s)}}Zt.empty=new Zt(et.empty,0);function lT(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class an{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new an(n.getMap().invert(),n,this.selection)}}}class Ln{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const cT=20;function uT(t,e,n,r){let i=n.getMeta(dr),s;if(i)return i.historyState;n.getMeta(pT)&&(t=new Ln(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(dr))return o.getMeta(dr).redo?new Ln(t.done.addTransform(n,void 0,r,yo(e)),t.undone,Sf(n.mapping.maps),t.prevTime,t.prevComposition):new Ln(t.done,t.undone.addTransform(n,void 0,r,yo(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!o&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!dT(n,t.prevRanges)),c=o?hl(t.prevRanges,n.mapping):Sf(n.mapping.maps);return new Ln(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,yo(e)),Zt.empty,c,n.time,a??t.prevComposition)}else return(s=n.getMeta("rebased"))?new Ln(t.done.rebased(n,s),t.undone.rebased(n,s),hl(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Ln(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),hl(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function dT(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(n=!0)}),n}function Sf(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,s,o)=>e.push(s,o));return e}function hl(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),s=e.map(t[r+1],-1);i<=s&&n.push(i,s)}return n}function fT(t,e,n){let r=yo(e),i=dr.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),l=new Ln(n?a:s.remaining,n?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(dr,{redo:n,historyState:l})}let ml=!1,kf=null;function yo(t){let e=t.plugins;if(kf!=e){ml=!1,kf=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){ml=!0;break}}return ml}const dr=new ze("history"),pT=new ze("closeHistory");function hT(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Me({key:dr,state:{init(){return new Ln(Zt.empty,Zt.empty,null,0,-1)},apply(e,n,r){return uT(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?Hg:r=="historyRedo"?jg:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function Ug(t,e){return(n,r)=>{let i=dr.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=fT(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const Hg=Ug(!1,!0),jg=Ug(!0,!0);var mT=ke.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Me({key:new ze("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const i=this.options.limit,s=this.options.autoTrim;if(i==null||i===0||s===!1){t=!0;return}const o=this.storage.characters({node:r.doc});if(o>i){const a=o-i,l=0,c=a;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const u=r.tr.deleteRange(l,c);return t=!0,u}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:n.doc}),s=this.storage.characters({node:e.doc});if(s<=r||i>r&&s>r&&s<=i)return!0;if(i>r&&s>r&&s>i||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,l=s-r,c=a-l,u=a;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>r)}})]}}),gT=ke.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Xk(this.options)]}});ke.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Me({key:new ze("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!n||!r)return Ce.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((l,c)=>{if(l.isText)return;if(!(i>=c&&i<=c+l.nodeSize-1))return!1;o+=1});let a=0;return t.descendants((l,c)=>{if(l.isText||!(i>=c&&i<=c+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";s.push(Qe.node(c,c+l.nodeSize,{class:this.options.className}))}),Ce.create(t,s)}}})]}});var bT=ke.create({name:"gapCursor",addProseMirrorPlugins(){return[tT()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=we(te(t,"allowGapCursor",n)))!=null?e:null}}}),Vg="placeholder",ys=new ze("tiptap__placeholder"),Tf=200;function Nf(t){const{editor:e,placeholder:n,dataAttribute:r,pos:i,node:s,isEmptyDoc:o,hasAnchor:a,classes:{emptyNode:l,emptyEditor:c}}=t,u=[l];return o&&u.push(c),Qe.node(i,i+s.nodeSize,{class:u.join(" "),[r]:typeof n=="function"?n({editor:e,node:s,pos:i,hasAnchor:a}):n})}function _f(t,e){return typeof t=="function"?t(e):t}function yT({editor:t,options:e,dataAttribute:n,doc:r,selection:i}){var s,o;if(!(t.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:l}=i,c=[],u=t.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){const p=r.resolve(l),f=p.depth>0?p.node(1):p.nodeAfter,h=p.depth>0?p.before(1):l;if(f&&f.type.isTextblock&&hs(f)){const m=l>=h&&l<=h+f.nodeSize;c.push(Nf({editor:t,isEmptyDoc:u,dataAttribute:n,hasAnchor:m,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:_f(e.emptyNodeClass,{editor:t,node:f,pos:h,hasAnchor:m})},node:f,pos:h}))}}else{const p=ys.getState(t.state),f=(s=p==null?void 0:p.topPos)!=null?s:0,h=(o=p==null?void 0:p.bottomPos)!=null?o:r.content.size;r.nodesBetween(f,h,(m,g)=>{const y=l>=g&&l<=g+m.nodeSize,w=!m.isLeaf&&hs(m);return m.type.isTextblock&&(y||!e.showOnlyCurrent)&&w&&c.push(Nf({editor:t,isEmptyDoc:u,dataAttribute:n,hasAnchor:y,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:_f(e.emptyNodeClass,{editor:t,node:m,pos:g,hasAnchor:y})},node:m,pos:g})),e.includeChildren})}return Ce.create(r,c)}function ET(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function vT(t){const e=getComputedStyle(t),n=`${e.overflow} ${e.overflowY} ${e.overflowX}`;return/auto|scroll|overlay/.test(n)}function xT(t){let e=t;for(;e;){if(vT(e))return e;const n=e.parentElement;if(!n){const r=e.getRootNode();if(r instanceof ShadowRoot){e=r.host;continue}return window}e=n}return window}function wT(t){return t===window?{top:0,bottom:window.innerHeight}:t.getBoundingClientRect()}function ST({doc:t,view:e,scrollContainer:n}){const r=e.dom.getBoundingClientRect(),i=n?wT(n):{top:0,bottom:window.innerHeight},s=Math.max(r.top,i.top)-Tf,o=Math.min(r.bottom,i.bottom)+Tf;if(s>=o)return{top:0,bottom:t.content.size};const l=getComputedStyle(e.dom).direction==="rtl"?Math.max(r.right-2,r.left+2):r.left+2,c=e.posAtCoords({left:l,top:s+2}),u=e.posAtCoords({left:l,top:o-2});return{top:c?c.pos:0,bottom:u?u.pos:t.content.size}}var kT={init(){return{topPos:null,bottomPos:null}},apply(t,e){const n=t.getMeta(ys);return n!=null&&n.positions?{topPos:n.positions.top,bottomPos:n.positions.bottom}:t.docChanged?{topPos:e.topPos!==null?t.mapping.map(e.topPos):null,bottomPos:e.bottomPos!==null?t.mapping.map(e.bottomPos):null}:e}};function TT(t){const e=xT(t.dom),n=()=>{const a=ST({view:t,doc:t.state.doc,scrollContainer:e}),l=ys.getState(t.state);if((l==null?void 0:l.topPos)===a.top&&(l==null?void 0:l.bottomPos)===a.bottom)return;const c=t.state.tr.setMeta(ys,{positions:a});t.dispatch(c)};let r=null,i=0;const s=150,o=()=>{r===null&&(r=requestAnimationFrame(()=>{r=null;const a=performance.now();a-i>=s?(i=a,n()):o()}))};return e.addEventListener("scroll",o,{passive:!0}),n(),{update(a,l){t.state.doc.content.size!==l.doc.content.size&&o()},destroy:()=>{r!==null&&cancelAnimationFrame(r),e.removeEventListener("scroll",o)}}}function NT({editor:t,options:e}){const n=e.dataAttribute?`data-${ET(e.dataAttribute)}`:`data-${Vg}`;return new Me({key:ys,state:kT,view:TT,props:{decorations:({doc:r,selection:i})=>yT({editor:t,options:e,dataAttribute:n,doc:r,selection:i})}})}ke.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Vg,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[NT({editor:this.editor,options:this.options})]}});var _T=`.ProseMirror:not(.ProseMirror-focused) *::selection {
|
|
197
|
-
background: transparent;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
.ProseMirror:not(.ProseMirror-focused) *::-moz-selection {
|
|
201
|
-
background: transparent;
|
|
202
|
-
}`;ke.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return t.options.injectCSS&&typeof document<"u"&&Fm(_T,t.options.injectNonce,"selection"),[new Me({key:new ze("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||vm(n.selection)||t.view.dragging?null:Ce.create(n.doc,[Qe.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});var AT="skipTrailingNode";function Af({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var CT=ke.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new ze(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(n).includes(i.name));return[new Me({key:e,appendTransaction:(i,s,o)=>{const{doc:a,tr:l,schema:c}=o,u=e.getState(o),d=a.content.size,p=c.nodes[n];if(!i.some(f=>f.getMeta(AT))&&u)return l.insert(d,p.create())},state:{init:(i,s)=>{const o=s.tr.doc.lastChild;return!Af({node:o,types:r})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const o=i.doc.lastChild;return!Af({node:o,types:r})}}})]}}),MT=ke.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Hg(t,e),redo:()=>({state:t,dispatch:e})=>jg(t,e)}},addProseMirrorPlugins(){return[hT(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),OT=ke.create({name:"starterKit",addExtensions(){var t,e,n,r;const i=[];return this.options.bold!==!1&&i.push(US.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(PS.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(Ng.configure(this.options.bulletList)),this.options.code!==!1&&i.push(VS.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(mg.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(qS.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(gT.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(bT.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(GS.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(YS.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(MT.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(JS.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(tk.configure(this.options.italic)),this.options.listItem!==!1&&i.push(Ag.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(Rg.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&i.push(Tg.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(Dg.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(qk.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(Bg.configure(this.options.strike)),this.options.text!==!1&&i.push(Jk.configure(this.options.text)),this.options.underline!==!1&&i.push(Fg.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&i.push(CT.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),RT=OT;function IT(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="(?!struct)("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},d={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},p={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},f=e.optional(i)+t.IDENT_RE+"\\s*\\(",h=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],m=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],g=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],y=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],b={type:m,keyword:h,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:g},x={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},T=[x,d,a,n,t.C_BLOCK_COMMENT_MODE,u,c],k={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:b,contains:T.concat([{begin:/\(/,end:/\)/,keywords:b,contains:T.concat(["self"]),relevance:0}]),relevance:0},R={className:"function",begin:"("+o+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:b,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:b,relevance:0},{begin:f,returnBegin:!0,contains:[p],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,u]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,u,a,{begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,c,u,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,d]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:b,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(k,R,x,T,[d,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:b,contains:["self",a]},{begin:t.IDENT_RE+"::",keywords:b},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function DT(t){const e={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},n=IT(t),r=n.keywords;return r.type=[...r.type,...e.type],r.literal=[...r.literal,...e.literal],r.built_in=[...r.built_in,...e.built_in],r._hints=e._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function LT(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 i={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},s=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"})]}},a={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,n,i]};i.contains.push(a);const l={match:/\\"/},c={className:"string",begin:/'/,end:/'/},u={match:/\\'/},d={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,n]},p=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],f=t.SHEBANG({binary:`(${p.join("|")})`,relevance:10}),h={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},m=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],g=["true","false"],y={match:/(\/[a-z._-]+)+/},w=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],S=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],b=["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"],x=["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:m,literal:g,built_in:[...w,...S,"set","shopt",...b,...x]},contains:[f,t.SHEBANG(),h,d,s,o,y,a,l,c,u,n]}}function PT(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},d={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},p={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},f=e.optional(i)+t.IDENT_RE+"\\s*\\(",g={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},y=[d,a,n,t.C_BLOCK_COMMENT_MODE,u,c],w={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:g,contains:y.concat([{begin:/\(/,end:/\)/,keywords:g,contains:y.concat(["self"]),relevance:0}]),relevance:0},S={begin:"("+o+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:g,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:g,relevance:0},{begin:f,returnBegin:!0,contains:[t.inherit(p,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,u,a,{begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,c,u,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,d]};return{name:"C",aliases:["h"],keywords:g,disableAutodetect:!0,illegal:"</",contains:[].concat(w,S,y,[d,{begin:t.IDENT_RE+"::",keywords:g},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{preprocessor:d,strings:c,keywords:g}}}function BT(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="(?!struct)("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},d={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},p={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},f=e.optional(i)+t.IDENT_RE+"\\s*\\(",h=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],m=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],g=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],y=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],b={type:m,keyword:h,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:g},x={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},T=[x,d,a,n,t.C_BLOCK_COMMENT_MODE,u,c],k={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:b,contains:T.concat([{begin:/\(/,end:/\)/,keywords:b,contains:T.concat(["self"]),relevance:0}]),relevance:0},R={className:"function",begin:"("+o+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:b,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:b,relevance:0},{begin:f,returnBegin:!0,contains:[p],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,u]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,u,a,{begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,c,u,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,d]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:b,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(k,R,x,T,[d,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:b,contains:["self",a]},{begin:t.IDENT_RE+"::",keywords:b},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function FT(t){const e=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],i=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],s=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],o={keyword:i.concat(s),built_in:e,literal:r},a=t.inherit(t.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),l={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},c={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},u={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},d=t.inherit(u,{illegal:/\n/}),p={className:"subst",begin:/\{/,end:/\}/,keywords:o},f=t.inherit(p,{illegal:/\n/}),h={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},t.BACKSLASH_ESCAPE,f]},m={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]},g=t.inherit(m,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},f]});p.contains=[m,h,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,l,t.C_BLOCK_COMMENT_MODE],f.contains=[g,h,d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,l,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const y={variants:[c,m,h,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},w={begin:"<",end:">",contains:[{beginKeywords:"in out"},a]},S=t.IDENT_RE+"(<"+t.IDENT_RE+"(\\s*,\\s*"+t.IDENT_RE+")*>)?(\\[\\])?",b={begin:"@"+t.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:o,illegal:/::/,contains:[t.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},y,l,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},a,w,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,w,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+S+"\\s+)+"+t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:o,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[t.TITLE_MODE,w],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,relevance:0,contains:[y,l,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},b]}}const zT=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_-]*/}}),$T=["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"],UT=["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"],HT=[...$T,...UT],jT=["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(),VT=["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(),WT=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),KT=["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 qT(t){const e=t.regex,n=zT(t),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",s=/@-?\w[\w]*(-\w+)*/,o="[a-zA-Z-][a-zA-Z0-9_-]*",a=[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:":("+VT.join("|")+")"},{begin:":(:)?("+WT.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+KT.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...a,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:e.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:s},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:jT.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+HT.join("|")+")\\b"}]}}function GT(t){const e=t.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:e.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:e.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function YT(t){const s={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:s,illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"string",variants:[t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[t.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:s,illegal:/["']/}]}]}}function JT(t){const e=t.regex,n=/[_A-Za-z][_0-9A-Za-z]*/;return{name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[t.HASH_COMMENT_MODE,t.QUOTE_STRING_MODE,t.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:e.concat(n,e.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function XT(t){const e=t.regex,n={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:t.NUMBER_RE}]},r=t.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const i={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},s={className:"literal",begin:/\bon|off|true|false|yes|no\b/},o={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},a={begin:/\[/,end:/\]/,contains:[r,s,i,o,n,"self"],relevance:0},l=/[A-Za-z0-9_-]+/,c=/"(\\"|[^"])*"/,u=/'[^']*'/,d=e.either(l,c,u),p=e.concat(d,"(\\s*\\.\\s*",d,")*",e.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[r,{className:"section",begin:/\[+/,end:/\]+/},{begin:p,className:"attr",starts:{end:/$/,contains:[r,a,s,i,o,n]}}]}}var Vr="[0-9](_*[0-9])*",Xs=`\\.(${Vr})`,Zs="[0-9a-fA-F](_*[0-9a-fA-F])*",Cf={className:"number",variants:[{begin:`(\\b(${Vr})((${Xs})|\\.)?|(${Xs}))[eE][+-]?(${Vr})[fFdD]?\\b`},{begin:`\\b(${Vr})((${Xs})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Xs})[fFdD]?\\b`},{begin:`\\b(${Vr})[fFdD]\\b`},{begin:`\\b0[xX]((${Zs})\\.?|(${Zs})?\\.(${Zs}))[pP][+-]?(${Vr})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Zs})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Wg(t,e,n){return n===-1?"":t.replace(e,r=>Wg(t,e,n-1))}function ZT(t){const e=t.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+Wg("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),l={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},c={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},u={className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[t.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:l,illegal:/<\/|#/,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[t.BACKSLASH_ESCAPE]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[e.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[u,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",t.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:l,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[c,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,Cf,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},Cf,c]}}const Mf="[A-Za-z$_][0-9A-Za-z$_]*",QT=["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"],eN=["true","false","null","undefined","NaN","Infinity"],Kg=["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"],qg=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Gg=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],tN=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],nN=[].concat(Gg,Kg,qg);function rN(t){const e=t.regex,n=(L,{after:I})=>{const Q="</"+L[0].slice(1);return L.input.indexOf(Q,I)!==-1},r=Mf,i={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(L,I)=>{const Q=L[0].length+L.index,A=L.input[Q];if(A==="<"||A===","){I.ignoreMatch();return}A===">"&&(n(L,{after:Q})||I.ignoreMatch());let z;const se=L.input.substring(Q);if(z=se.match(/^\s*=/)){I.ignoreMatch();return}if((z=se.match(/^\s+extends\s+/))&&z.index===0){I.ignoreMatch();return}}},a={$pattern:Mf,keyword:QT,literal:eN,built_in:nN,"variable.language":tN},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\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},p={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,p],subLanguage:"xml"}},h={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,p],subLanguage:"css"}},m={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,p],subLanguage:"graphql"}},g={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,p]},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]},S=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,h,m,g,{match:/\$\d+/},d];p.contains=S.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(S)});const b=[].concat(w,p.contains),x=b.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(b)}]),T={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:x},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"}}]},R={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:{_:[...Kg,...qg]}},N={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},O={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[T],illegal:/%/},j={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function V(L){return e.concat("(?!",L.join("|"),")")}const U={match:e.concat(/\b/,V([...Gg,"super","import"].map(L=>`${L}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},B={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},H={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},T]},_="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",D={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(_)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[T]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:x,CLASS_REFERENCE:R},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),N,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,h,m,g,w,{match:/\$\d+/},d,R,{scope:"attr",match:r+e.lookahead(":"),relevance:0},D,{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:_,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:a,contains:x}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:s},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},O,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[T,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},B,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[T]},U,j,k,H,{match:/\$[(.]/}]}}function iN(t){const e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],i={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[e,n,t.QUOTE_STRING_MODE,i,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var Wr="[0-9](_*[0-9])*",Qs=`\\.(${Wr})`,eo="[0-9a-fA-F](_*[0-9a-fA-F])*",sN={className:"number",variants:[{begin:`(\\b(${Wr})((${Qs})|\\.)?|(${Qs}))[eE][+-]?(${Wr})[fFdD]?\\b`},{begin:`\\b(${Wr})((${Qs})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Qs})[fFdD]?\\b`},{begin:`\\b(${Wr})[fFdD]\\b`},{begin:`\\b0[xX]((${eo})\\.?|(${eo})?\\.(${eo}))[pP][+-]?(${Wr})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${eo})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function oN(t){const e={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"@"},i={className:"subst",begin:/\$\{/,end:/\}/,contains:[t.C_NUMBER_MODE]},s={className:"variable",begin:"\\$"+t.UNDERSCORE_IDENT_RE},o={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[s,i]},{begin:"'",end:"'",illegal:/\n/,contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[t.BACKSLASH_ESCAPE,s,i]}]};i.contains.push(o);const a={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+t.UNDERSCORE_IDENT_RE+")?"},l={className:"meta",begin:"@"+t.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[t.inherit(o,{className:"string"}),"self"]}]},c=sN,u=t.COMMENT("/\\*","\\*/",{contains:[t.C_BLOCK_COMMENT_MODE]}),d={variants:[{className:"type",begin:t.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},p=d;return p.variants[1].contains=[d],d.variants[1].contains=[p],{name:"Kotlin",aliases:["kt","kts"],keywords:e,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),t.C_LINE_COMMENT_MODE,u,n,r,a,l,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:e,relevance:5,contains:[{begin:t.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[t.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:e,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[d,t.C_LINE_COMMENT_MODE,u],relevance:0},t.C_LINE_COMMENT_MODE,u,a,l,o,t.C_NUMBER_MODE]},u]},{begin:[/class|interface|trait/,/\s+/,t.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},t.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},a,l]},o,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
|
|
203
|
-
`},c]}}const aN=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_-]*/}}),lN=["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"],cN=["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"],uN=[...lN,...cN],dN=["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(),Yg=["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(),Jg=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),fN=["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(),pN=Yg.concat(Jg).sort().reverse();function hN(t){const e=aN(t),n=pN,r="and or not only",i="[\\w-]+",s="("+i+"|@\\{"+i+"\\})",o=[],a=[],l=function(S){return{className:"string",begin:"~?"+S+".*?"+S}},c=function(S,b,x){return{className:S,begin:b,relevance:x}},u={$pattern:/[a-z-]+/,keyword:r,attribute:dN.join(" ")},d={begin:"\\(",end:"\\)",contains:a,keywords:u,relevance:0};a.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,l("'"),l('"'),e.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},e.HEXCOLOR,d,c("variable","@@?"+i,10),c("variable","@\\{"+i+"\\}"),c("built_in","~?`[^`]*?`"),{className:"attribute",begin:i+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},e.IMPORTANT,{beginKeywords:"and not"},e.FUNCTION_DISPATCH);const p=a.concat({begin:/\{/,end:/\}/,contains:o}),f={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(a)},h={begin:s+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+fN.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:a}}]},m={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:u,returnEnd:!0,contains:a,relevance:0}},g={className:"variable",variants:[{begin:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:p}},y={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:s,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,f,c("keyword","all\\b"),c("variable","@\\{"+i+"\\}"),{begin:"\\b("+uN.join("|")+")\\b",className:"selector-tag"},e.CSS_NUMBER_MODE,c("selector-tag",s,0),c("selector-id","#"+s),c("selector-class","\\."+s,0),c("selector-tag","&",0),e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+Yg.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+Jg.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:p},{begin:"!important"},e.FUNCTION_DISPATCH]},w={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[y]};return o.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,m,g,w,h,y,f,e.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:o}}function mN(t){const e="\\[=*\\[",n="\\]=*\\]",r={begin:e,end:n,contains:["self"]},i=[t.COMMENT("--(?!"+e+")","$"),t.COMMENT("--"+e,n,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:t.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:i.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[t.inherit(t.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:i}].concat(i)},t.C_NUMBER_MODE,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{className:"string",begin:e,end:n,contains:[r],relevance:5}])}}function gN(t){const e={className:"variable",variants:[{begin:"\\$\\("+t.UNDERSCORE_IDENT_RE+"\\)",contains:[t.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},n={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,e]},r={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[e,n]},i={begin:"^"+t.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},s={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},o={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[e]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[t.HASH_COMMENT_MODE,e,n,r,i,s,o]}}function bN(t){const e=t.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},i={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},s={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},a=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:e.concat(/\[.+?\]\(/,a,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},c={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},u={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},d=t.inherit(c,{contains:[]}),p=t.inherit(u,{contains:[]});c.contains.push(p),u.contains.push(d);let f=[n,l];return[c,u,d,p].forEach(y=>{y.contains=y.contains.concat(f)}),f=f.concat(c,u),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:f},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:f}]}]},n,s,c,u,{className:"quote",begin:"^>\\s+",contains:f,end:"$"},i,r,l,o,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function yN(t){const e={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,a={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},l={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:a,illegal:"</",contains:[e,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,t.C_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+l.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:l,contains:[t.UNDERSCORE_TITLE_MODE]},{begin:"\\."+t.UNDERSCORE_IDENT_RE,relevance:0}]}}function EN(t){const e=t.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,i={$pattern:/[\w.]+/,keyword:n.join(" ")},s={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},o={begin:/->\{/,end:/\}/},a={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},l={scope:"variable",variants:[{begin:/\$\d/},{begin:e.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[a]},c={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},u=[t.BACKSLASH_ESCAPE,s,l],d=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],p=(m,g,y="\\1")=>{const w=y==="\\1"?y:e.concat(y,g);return e.concat(e.concat("(?:",m,")"),g,/(?:\\.|[^\\\/])*?/,w,/(?:\\.|[^\\\/])*?/,y,r)},f=(m,g,y)=>e.concat(e.concat("(?:",m,")"),g,/(?:\\.|[^\\\/])*?/,y,r),h=[l,t.HASH_COMMENT_MODE,t.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),o,{className:"string",contains:u,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},c,{begin:"(\\/\\/|"+t.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[t.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:p("s|tr|y",e.either(...d,{capture:!0}))},{begin:p("s|tr|y","\\(","\\)")},{begin:p("s|tr|y","\\[","\\]")},{begin:p("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:f("(?:m|qr)?",/\//,/\//)},{begin:f("m|qr",e.either(...d,{capture:!0}),/\1/)},{begin:f("m|qr",/\(/,/\)/)},{begin:f("m|qr",/\[/,/\]/)},{begin:f("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,a]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,a,c]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return s.contains=h,o.contains=h,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:h}}function vN(t){const e=t.regex,n=/(?![A-Za-z0-9])(?![$])/,r=e.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),i=e.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),s=e.concat(/[A-Z]+/,n),o={scope:"variable",match:"\\$+"+r},a={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},l={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},c=t.inherit(t.APOS_STRING_MODE,{illegal:null}),u=t.inherit(t.QUOTE_STRING_MODE,{illegal:null,contains:t.QUOTE_STRING_MODE.contains.concat(l)}),d={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:t.QUOTE_STRING_MODE.contains.concat(l),"on:begin":(B,H)=>{H.data._beginMatch=B[1]||B[2]},"on:end":(B,H)=>{H.data._beginMatch!==B[1]&&H.ignoreMatch()}},p=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),f=`[
|
|
204
|
-
]`,h={scope:"string",variants:[u,c,d,p]},m={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},g=["false","null","true"],y=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],w=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],b={keyword:y,literal:(B=>{const H=[];return B.forEach(_=>{H.push(_),_.toLowerCase()===_?H.push(_.toUpperCase()):H.push(_.toLowerCase())}),H})(g),built_in:w},x=B=>B.map(H=>H.replace(/\|\d+$/,"")),T={variants:[{match:[/new/,e.concat(f,"+"),e.concat("(?!",x(w).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},k=e.concat(r,"\\b(?!\\()"),R={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),k],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,e.concat(/::/,e.lookahead(/(?!class\b)/)),k],scope:{1:"title.class",3:"variable.constant"}},{match:[i,e.concat("::",e.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},N={scope:"attr",match:e.concat(r,e.lookahead(":"),e.lookahead(/(?!::)/))},O={relevance:0,begin:/\(/,end:/\)/,keywords:b,contains:[N,o,R,t.C_BLOCK_COMMENT_MODE,h,m,T]},j={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",x(y).join("\\b|"),"|",x(w).join("\\b|"),"\\b)"),r,e.concat(f,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[O]};O.contains.push(j);const V=[N,R,t.C_BLOCK_COMMENT_MODE,h,m,T],U={begin:e.concat(/#\[\s*\\?/,e.either(i,s)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:g,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:g,keyword:["new","array"]},contains:["self",...V]},...V,{scope:"meta",variants:[{match:i},{match:s}]}]};return{case_insensitive:!1,keywords:b,contains:[U,t.HASH_COMMENT_MODE,t.COMMENT("//","$"),t.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:t.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},a,{scope:"variable.language",match:/\$this\b/},o,j,R,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},T,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},t.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:b,contains:["self",U,o,R,t.C_BLOCK_COMMENT_MODE,h,m]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},t.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[t.inherit(t.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},t.UNDERSCORE_TITLE_MODE]},h,m]}}function xN(t){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},t.inherit(t.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),t.inherit(t.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function wN(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function SN(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"],a={$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"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},c={className:"subst",begin:/\{/,end:/\}/,keywords:a,illegal:/#/},u={begin:/\{\{/,relevance:0},d={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,l,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,l,u,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,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,u,c]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},p="[0-9](_?[0-9])*",f=`(\\b(${p}))?\\.(${p})|\\b(${p})\\.`,h=`\\b|${r.join("|")}`,m={className:"number",relevance:0,variants:[{begin:`(\\b(${p})|(${f}))[eE][+-]?(${p})[jJ]?(?=${h})`},{begin:`(${f})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${h})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${h})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${h})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${h})`},{begin:`\\b(${p})[jJ](?=${h})`}]},g={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:a,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},y={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:["self",l,m,d,t.HASH_COMMENT_MODE]}]};return c.contains=[d,m,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:a,illegal:/(<\/|\?)|=>/,contains:[l,m,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},d,g,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[y]},{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:[m,y,d]}]}}function kN(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function TN(t){const e=t.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=e.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,s=e.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[t.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:e.lookahead(e.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),t.HASH_COMMENT_MODE,{scope:"string",contains:[t.BACKSLASH_ESCAPE],variants:[t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[i,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[s,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:s},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function NN(t){const e=t.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=e.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=e.concat(r,/(::\w+)*/),o={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},a={className:"doctag",begin:"@[A-Za-z]+"},l={begin:"#<",end:">"},c=[t.COMMENT("#","$",{contains:[a]}),t.COMMENT("^=begin","^=end",{contains:[a],relevance:10}),t.COMMENT("^__END__",t.MATCH_NOTHING_RE)],u={className:"subst",begin:/#\{/,end:/\}/,keywords:o},d={className:"string",contains:[t.BACKSLASH_ESCAPE,u],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:e.concat(/<<[-~]?'?/,e.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[t.BACKSLASH_ESCAPE,u]})]}]},p="[1-9](_?[0-9])*|0",f="[0-9](_?[0-9])*",h={className:"number",relevance:0,variants:[{begin:`\\b(${p})(\\.(${f}))?([eE][+-]?(${f})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},m={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:o}]},T=[d,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:o},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:o},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[m]},{begin:t.IDENT_RE+"::"},{className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[d,{begin:n}],relevance:0},h,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:o},{begin:"("+t.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[t.BACKSLASH_ESCAPE,u],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(l,c),relevance:0}].concat(l,c);u.contains=T,m.contains=T;const O=[{begin:/^\s*=>/,starts:{end:"$",contains:T}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:o,contains:T}}];return c.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:o,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(O).concat(c).concat(T)}}function _N(t){const e=t.regex,n=/(r#)?/,r=e.concat(n,t.UNDERSCORE_IDENT_RE),i=e.concat(n,t.IDENT_RE),s={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,e.lookahead(/\s*\(/))},o="([ui](8|16|32|64|128|size)|f(32|64))?",a=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],l=["true","false","Some","None","Ok","Err"],c=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],u=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:t.IDENT_RE+"!?",type:u,keyword:a,literal:l,built_in:c},illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.COMMENT("/\\*","\\*/",{contains:["self"]}),t.inherit(t.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+o},{begin:"\\b0o([0-7_]+)"+o},{begin:"\\b0x([A-Fa-f0-9_]+)"+o},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+o}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:t.IDENT_RE+"::",keywords:{keyword:"Self",built_in:c,type:u}},{className:"punctuation",begin:"->"},s]}}const AN=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_-]*/}}),CN=["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"],MN=["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"],ON=[...CN,...MN],RN=["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(),IN=["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(),DN=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),LN=["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 PN(t){const e=AN(t),n=DN,r=IN,i="@[a-z-]+",s="and or not only",a={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,e.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+ON.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},a,{begin:/\(/,end:/\)/,contains:[e.CSS_NUMBER_MODE]},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+LN.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[e.BLOCK_COMMENT,a,e.HEXCOLOR,e.CSS_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.IMPORTANT,e.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:i,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:RN.join(" ")},contains:[{begin:i,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},a,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.HEXCOLOR,e.CSS_NUMBER_MODE]},e.FUNCTION_DISPATCH]}}function BN(t){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function FN(t){const e=t.regex,n=t.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},s=["true","false","unknown"],o=["double precision","large object","with timezone","without timezone"],a=["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"],l=["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"],u=["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"],d=["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"],p=["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=u,h=[...c,...l].filter(x=>!u.includes(x)),m={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},g={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},y={match:e.concat(/\b/,e.either(...f),/\s*\(/),relevance:0,keywords:{built_in:f}};function w(x){return e.concat(/\b/,e.either(...x.map(T=>T.replace(/\s+/,"\\s+"))),/\b/)}const S={scope:"keyword",match:w(p),relevance:0};function b(x,{exceptions:T,when:k}={}){const R=k;return T=T||[],x.map(N=>N.match(/\|\d+$/)||T.includes(N)?N:R(N)?`${N}|0`:N)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:b(h,{when:x=>x.length<3}),literal:s,type:a,built_in:d},contains:[{scope:"type",match:w(o)},S,y,m,r,i,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,g]}}function Xg(t){return t?typeof t=="string"?t:t.source:null}function wi(t){return Te("(?=",t,")")}function Te(...t){return t.map(n=>Xg(n)).join("")}function zN(t){const e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function bt(...t){return"("+(zN(t).capture?"":"?:")+t.map(r=>Xg(r)).join("|")+")"}const fu=t=>Te(/\b/,t,/\w$/.test(t)?/\b/:/\B/),$N=["Protocol","Type"].map(fu),Of=["init","self"].map(fu),UN=["Any","Self"],gl=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],Rf=["false","nil","true"],HN=["assignment","associativity","higherThan","left","lowerThan","none","right"],jN=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],If=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],Zg=bt(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),Qg=bt(Zg,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),bl=Te(Zg,Qg,"*"),eb=bt(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),la=bt(eb,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),nn=Te(eb,la,"*"),to=Te(/[A-Z]/,la,"*"),VN=["attached","autoclosure",Te(/convention\(/,bt("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Te(/objc\(/,nn,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],WN=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function KN(t){const e={match:/\s+/,relevance:0},n=t.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[t.C_LINE_COMMENT_MODE,n],i={match:[/\./,bt(...$N,...Of)],className:{2:"keyword"}},s={match:Te(/\./,bt(...gl)),relevance:0},o=gl.filter(ye=>typeof ye=="string").concat(["_|0"]),a=gl.filter(ye=>typeof ye!="string").concat(UN).map(fu),l={variants:[{className:"keyword",match:bt(...a,...Of)}]},c={$pattern:bt(/\b\w+/,/#\w+/),keyword:o.concat(jN),literal:Rf},u=[i,s,l],d={match:Te(/\./,bt(...If)),relevance:0},p={className:"built_in",match:Te(/\b/,bt(...If),/(?=\()/)},f=[d,p],h={match:/->/,relevance:0},m={className:"operator",relevance:0,variants:[{match:bl},{match:`\\.(\\.|${Qg})+`}]},g=[h,m],y="([0-9]_*)+",w="([0-9a-fA-F]_*)+",S={className:"number",relevance:0,variants:[{match:`\\b(${y})(\\.(${y}))?([eE][+-]?(${y}))?\\b`},{match:`\\b0x(${w})(\\.(${w}))?([pP][+-]?(${y}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},b=(ye="")=>({className:"subst",variants:[{match:Te(/\\/,ye,/[0\\tnr"']/)},{match:Te(/\\/,ye,/u\{[0-9a-fA-F]{1,8}\}/)}]}),x=(ye="")=>({className:"subst",match:Te(/\\/,ye,/[\t ]*(?:[\r\n]|\r\n)/)}),T=(ye="")=>({className:"subst",label:"interpol",begin:Te(/\\/,ye,/\(/),end:/\)/}),k=(ye="")=>({begin:Te(ye,/"""/),end:Te(/"""/,ye),contains:[b(ye),x(ye),T(ye)]}),R=(ye="")=>({begin:Te(ye,/"/),end:Te(/"/,ye),contains:[b(ye),T(ye)]}),N={className:"string",variants:[k(),k("#"),k("##"),k("###"),R(),R("#"),R("##"),R("###")]},O=[t.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[t.BACKSLASH_ESCAPE]}],j={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:O},V=ye=>{const tt=Te(ye,/\//),Y=Te(/\//,ye);return{begin:tt,end:Y,contains:[...O,{scope:"comment",begin:`#(?!.*${Y})`,end:/$/}]}},U={scope:"regexp",variants:[V("###"),V("##"),V("#"),j]},B={match:Te(/`/,nn,/`/)},H={className:"variable",match:/\$\d+/},_={className:"variable",match:`\\$${la}+`},D=[B,H,_],L={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:WN,contains:[...g,S,N]}]}},I={scope:"keyword",match:Te(/@/,bt(...VN),wi(bt(/\(/,/\s+/)))},Q={scope:"meta",match:Te(/@/,nn)},A=[L,I,Q],z={match:wi(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Te(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,la,"+")},{className:"type",match:to,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Te(/\s+&\s+/,wi(to)),relevance:0}]},se={begin:/</,end:/>/,keywords:c,contains:[...r,...u,...A,h,z]};z.contains.push(se);const ne={match:Te(nn,/\s*:/),keywords:"_|0",relevance:0},de={begin:/\(/,end:/\)/,relevance:0,keywords:c,contains:["self",ne,...r,U,...u,...f,...g,S,N,...D,...A,z]},oe={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,z]},fe={begin:bt(wi(Te(nn,/\s*:/)),wi(Te(nn,/\s+/,nn,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:nn}]},ie={begin:/\(/,end:/\)/,keywords:c,contains:[fe,...r,...u,...g,S,N,...A,z,de],endsParent:!0,illegal:/["']/},$e={match:[/(func|macro)/,/\s+/,bt(B.match,nn,bl)],className:{1:"keyword",3:"title.function"},contains:[oe,ie,e],illegal:[/\[/,/%/]},ge={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[oe,ie,e],illegal:/\[|%/},at={match:[/operator/,/\s+/,bl],className:{1:"keyword",3:"title"}},Ot={begin:[/precedencegroup/,/\s+/,to],className:{1:"keyword",3:"title"},contains:[z],keywords:[...HN,...Rf],end:/}/},Ue={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Pt={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},He={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,nn,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:c,contains:[oe,...u,{begin:/:/,end:/\{/,keywords:c,contains:[{scope:"title.class.inherited",match:to},...u],relevance:0}]};for(const ye of N.variants){const tt=ye.contains.find(pt=>pt.label==="interpol");tt.keywords=c;const Y=[...u,...f,...g,S,N,...D];tt.contains=[...Y,{begin:/\(/,end:/\)/,contains:["self",...Y]}]}return{name:"Swift",keywords:c,contains:[...r,$e,ge,Ue,Pt,He,at,Ot,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},U,...u,...f,...g,S,N,...D,...A,z,de]}}const ca="[A-Za-z$_][0-9A-Za-z$_]*",tb=["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"],nb=["true","false","null","undefined","NaN","Infinity"],rb=["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"],ib=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],sb=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],ob=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],ab=[].concat(sb,rb,ib);function qN(t){const e=t.regex,n=(L,{after:I})=>{const Q="</"+L[0].slice(1);return L.input.indexOf(Q,I)!==-1},r=ca,i={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(L,I)=>{const Q=L[0].length+L.index,A=L.input[Q];if(A==="<"||A===","){I.ignoreMatch();return}A===">"&&(n(L,{after:Q})||I.ignoreMatch());let z;const se=L.input.substring(Q);if(z=se.match(/^\s*=/)){I.ignoreMatch();return}if((z=se.match(/^\s+extends\s+/))&&z.index===0){I.ignoreMatch();return}}},a={$pattern:ca,keyword:tb,literal:nb,built_in:ab,"variable.language":ob},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\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},p={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,p],subLanguage:"xml"}},h={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,p],subLanguage:"css"}},m={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,p],subLanguage:"graphql"}},g={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,p]},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]},S=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,h,m,g,{match:/\$\d+/},d];p.contains=S.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(S)});const b=[].concat(w,p.contains),x=b.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(b)}]),T={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:x},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"}}]},R={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:{_:[...rb,...ib]}},N={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},O={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[T],illegal:/%/},j={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function V(L){return e.concat("(?!",L.join("|"),")")}const U={match:e.concat(/\b/,V([...sb,"super","import"].map(L=>`${L}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},B={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},H={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},T]},_="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",D={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(_)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[T]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:x,CLASS_REFERENCE:R},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),N,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,h,m,g,w,{match:/\$\d+/},d,R,{scope:"attr",match:r+e.lookahead(":"),relevance:0},D,{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:_,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:a,contains:x}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:s},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},O,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[T,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},B,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[T]},U,j,k,H,{match:/\$[(.]/}]}}function GN(t){const e=t.regex,n=qN(t),r=ca,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],s={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[n.exports.CLASS_REFERENCE]},a={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:ca,keyword:tb.concat(l),literal:nb,built_in:ab.concat(i),"variable.language":ob},u={className:"meta",begin:"@"+r},d=(m,g,y)=>{const w=m.contains.findIndex(S=>S.label===g);if(w===-1)throw new Error("can not find mode to replace");m.contains.splice(w,1,y)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(u);const p=n.contains.find(m=>m.scope==="attr"),f=Object.assign({},p,{match:e.concat(r,e.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,p,f]),n.contains=n.contains.concat([u,s,o,f]),d(n,"shebang",t.SHEBANG()),d(n,"use_strict",a);const h=n.contains.find(m=>m.label==="func.def");return h.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function YN(t){const e=t.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,s=/\d{4}-\d{1,2}-\d{1,2}/,o=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,a=/\d{1,2}(:\d{1,2}){1,2}/,l={className:"literal",variants:[{begin:e.concat(/# */,e.either(s,i),/ *#/)},{begin:e.concat(/# */,a,/ *#/)},{begin:e.concat(/# */,o,/ *#/)},{begin:e.concat(/# */,e.either(s,i),/ +/,e.either(o,a),/ *#/)}]},c={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},u={className:"label",begin:/^\w+:/},d=t.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),p=t.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,r,l,c,u,d,p,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[p]}]}}function JN(t){t.regex;const e=t.COMMENT(/\(;/,/;\)/);e.contains.push("self");const n=t.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],i={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},s={className:"variable",begin:/\$[\w_]+/},o={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},a={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},l={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},c={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[n,e,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},s,o,i,t.QUOTE_STRING_MODE,l,c,a]}}function XN(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,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},s={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=t.inherit(s,{begin:/\(/,end:/\)/}),a=t.inherit(t.APOS_STRING_MODE,{className:"string"}),l=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:[i]},{begin:/'/,end:/'/,contains:[i]},{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:[s,l,a,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[s,o,l,a]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{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}]}]}}function ZN(t){const e="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},s={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,i]},a=t.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),p={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},f={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},h={begin:/\{/,end:/\}/,contains:[f],illegal:"\\n",relevance:0},m={begin:"\\[",end:"\\]",contains:[f],illegal:"\\n",relevance:0},g=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},p,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},h,m,s,o],y=[...g];return y.pop(),y.push(a),f.contains=y,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:g}}const QN={arduino:DT,bash:LT,c:PT,cpp:BT,csharp:FT,css:qT,diff:GT,go:YT,graphql:JT,ini:XT,java:ZT,javascript:rN,json:iN,kotlin:oN,less:hN,lua:mN,makefile:gN,markdown:bN,objectivec:yN,perl:EN,php:vN,"php-template":xN,plaintext:wN,python:SN,"python-repl":kN,r:TN,ruby:NN,rust:_N,scss:PN,shell:BN,sql:FN,swift:KN,typescript:GN,vbnet:YN,wasm:JN,xml:XN,yaml:ZN};function lb(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(e=>{const n=t[e],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&lb(n)}),t}class Df{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function cb(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Fn(t,...e){const n=Object.create(null);for(const r in t)n[r]=t[r];return e.forEach(function(r){for(const i in r)n[i]=r[i]}),n}const e_="</span>",Lf=t=>!!t.scope,t_=(t,{prefix:e})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){const n=t.split(".");return[`${e}${n.shift()}`,...n.map((r,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return`${e}${t}`};class n_{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=cb(e)}openNode(e){if(!Lf(e))return;const n=t_(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){Lf(e)&&(this.buffer+=e_)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}}const Pf=(t={})=>{const e={children:[]};return Object.assign(e,t),e};class pu{constructor(){this.rootNode=Pf(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const n=Pf({scope:e});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){return typeof n=="string"?e.addText(n):n.children&&(e.openNode(n),n.children.forEach(r=>this._walk(e,r)),e.closeNode(n)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(n=>typeof n=="string")?e.children=[e.children.join("")]:e.children.forEach(n=>{pu._collapse(n)}))}}class r_ extends pu{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,n){const r=e.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new n_(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Es(t){return t?typeof t=="string"?t:t.source:null}function ub(t){return Sr("(?=",t,")")}function i_(t){return Sr("(?:",t,")*")}function s_(t){return Sr("(?:",t,")?")}function Sr(...t){return t.map(n=>Es(n)).join("")}function o_(t){const e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function hu(...t){return"("+(o_(t).capture?"":"?:")+t.map(r=>Es(r)).join("|")+")"}function db(t){return new RegExp(t.toString()+"|").exec("").length-1}function a_(t,e){const n=t&&t.exec(e);return n&&n.index===0}const l_=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function mu(t,{joinWith:e}){let n=0;return t.map(r=>{n+=1;const i=n;let s=Es(r),o="";for(;s.length>0;){const a=l_.exec(s);if(!a){o+=s;break}o+=s.substring(0,a.index),s=s.substring(a.index+a[0].length),a[0][0]==="\\"&&a[1]?o+="\\"+String(Number(a[1])+i):(o+=a[0],a[0]==="("&&n++)}return o}).map(r=>`(${r})`).join(e)}const c_=/\b\B/,fb="[a-zA-Z]\\w*",gu="[a-zA-Z_]\\w*",pb="\\b\\d+(\\.\\d+)?",hb="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",mb="\\b(0b[01]+)",u_="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",d_=(t={})=>{const e=/^#![ ]*\//;return t.binary&&(t.begin=Sr(e,/.*\b/,t.binary,/\b.*/)),Fn({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},t)},vs={begin:"\\\\[\\s\\S]",relevance:0},f_={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[vs]},p_={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[vs]},h_={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Aa=function(t,e,n={}){const r=Fn({scope:"comment",begin:t,end:e,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const i=hu("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:Sr(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},m_=Aa("//","$"),g_=Aa("/\\*","\\*/"),b_=Aa("#","$"),y_={scope:"number",begin:pb,relevance:0},E_={scope:"number",begin:hb,relevance:0},v_={scope:"number",begin:mb,relevance:0},x_={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[vs,{begin:/\[/,end:/\]/,relevance:0,contains:[vs]}]},w_={scope:"title",begin:fb,relevance:0},S_={scope:"title",begin:gu,relevance:0},k_={begin:"\\.\\s*"+gu,relevance:0},T_=function(t){return Object.assign(t,{"on:begin":(e,n)=>{n.data._beginMatch=e[1]},"on:end":(e,n)=>{n.data._beginMatch!==e[1]&&n.ignoreMatch()}})};var no=Object.freeze({__proto__:null,APOS_STRING_MODE:f_,BACKSLASH_ESCAPE:vs,BINARY_NUMBER_MODE:v_,BINARY_NUMBER_RE:mb,COMMENT:Aa,C_BLOCK_COMMENT_MODE:g_,C_LINE_COMMENT_MODE:m_,C_NUMBER_MODE:E_,C_NUMBER_RE:hb,END_SAME_AS_BEGIN:T_,HASH_COMMENT_MODE:b_,IDENT_RE:fb,MATCH_NOTHING_RE:c_,METHOD_GUARD:k_,NUMBER_MODE:y_,NUMBER_RE:pb,PHRASAL_WORDS_MODE:h_,QUOTE_STRING_MODE:p_,REGEXP_MODE:x_,RE_STARTERS_RE:u_,SHEBANG:d_,TITLE_MODE:w_,UNDERSCORE_IDENT_RE:gu,UNDERSCORE_TITLE_MODE:S_});function N_(t,e){t.input[t.index-1]==="."&&e.ignoreMatch()}function __(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className)}function A_(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=N_,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function C_(t,e){Array.isArray(t.illegal)&&(t.illegal=hu(...t.illegal))}function M_(t,e){if(t.match){if(t.begin||t.end)throw new Error("begin & end are not supported with match");t.begin=t.match,delete t.match}}function O_(t,e){t.relevance===void 0&&(t.relevance=1)}const R_=(t,e)=>{if(!t.beforeMatch)return;if(t.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},t);Object.keys(t).forEach(r=>{delete t[r]}),t.keywords=n.keywords,t.begin=Sr(n.beforeMatch,ub(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch},I_=["of","and","for","in","not","or","if","then","parent","list","value"],D_="keyword";function gb(t,e,n=D_){const r=Object.create(null);return typeof t=="string"?i(n,t.split(" ")):Array.isArray(t)?i(n,t):Object.keys(t).forEach(function(s){Object.assign(r,gb(t[s],e,s))}),r;function i(s,o){e&&(o=o.map(a=>a.toLowerCase())),o.forEach(function(a){const l=a.split("|");r[l[0]]=[s,L_(l[0],l[1])]})}}function L_(t,e){return e?Number(e):P_(t)?0:1}function P_(t){return I_.includes(t.toLowerCase())}const Bf={},fr=t=>{console.error(t)},Ff=(t,...e)=>{console.log(`WARN: ${t}`,...e)},Or=(t,e)=>{Bf[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),Bf[`${t}/${e}`]=!0)},ua=new Error;function bb(t,e,{key:n}){let r=0;const i=t[n],s={},o={};for(let a=1;a<=e.length;a++)o[a+r]=i[a],s[a+r]=!0,r+=db(e[a-1]);t[n]=o,t[n]._emit=s,t[n]._multi=!0}function B_(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw fr("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ua;if(typeof t.beginScope!="object"||t.beginScope===null)throw fr("beginScope must be object"),ua;bb(t,t.begin,{key:"beginScope"}),t.begin=mu(t.begin,{joinWith:""})}}function F_(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw fr("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ua;if(typeof t.endScope!="object"||t.endScope===null)throw fr("endScope must be object"),ua;bb(t,t.end,{key:"endScope"}),t.end=mu(t.end,{joinWith:""})}}function z_(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function $_(t){z_(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),B_(t),F_(t)}function U_(t){function e(o,a){return new RegExp(Es(o),"m"+(t.case_insensitive?"i":"")+(t.unicodeRegex?"u":"")+(a?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(a,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,a]),this.matchAt+=db(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const a=this.regexes.map(l=>l[1]);this.matcherRe=e(mu(a,{joinWith:"|"}),!0),this.lastIndex=0}exec(a){this.matcherRe.lastIndex=this.lastIndex;const l=this.matcherRe.exec(a);if(!l)return null;const c=l.findIndex((d,p)=>p>0&&d!==void 0),u=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,u)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(a){if(this.multiRegexes[a])return this.multiRegexes[a];const l=new n;return this.rules.slice(a).forEach(([c,u])=>l.addRule(c,u)),l.compile(),this.multiRegexes[a]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(a,l){this.rules.push([a,l]),l.type==="begin"&&this.count++}exec(a){const l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let c=l.exec(a);if(this.resumingScanAtSamePosition()&&!(c&&c.index===this.lastIndex)){const u=this.getMatcher(0);u.lastIndex=this.lastIndex+1,c=u.exec(a)}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function i(o){const a=new r;return o.contains.forEach(l=>a.addRule(l.begin,{rule:l,type:"begin"})),o.terminatorEnd&&a.addRule(o.terminatorEnd,{type:"end"}),o.illegal&&a.addRule(o.illegal,{type:"illegal"}),a}function s(o,a){const l=o;if(o.isCompiled)return l;[__,M_,$_,R_].forEach(u=>u(o,a)),t.compilerExtensions.forEach(u=>u(o,a)),o.__beforeBegin=null,[A_,C_,O_].forEach(u=>u(o,a)),o.isCompiled=!0;let c=null;return typeof o.keywords=="object"&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),c=o.keywords.$pattern,delete o.keywords.$pattern),c=c||/\w+/,o.keywords&&(o.keywords=gb(o.keywords,t.case_insensitive)),l.keywordPatternRe=e(c,!0),a&&(o.begin||(o.begin=/\B|\b/),l.beginRe=e(l.begin),!o.end&&!o.endsWithParent&&(o.end=/\B|\b/),o.end&&(l.endRe=e(l.end)),l.terminatorEnd=Es(l.end)||"",o.endsWithParent&&a.terminatorEnd&&(l.terminatorEnd+=(o.end?"|":"")+a.terminatorEnd)),o.illegal&&(l.illegalRe=e(o.illegal)),o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map(function(u){return H_(u==="self"?o:u)})),o.contains.forEach(function(u){s(u,l)}),o.starts&&s(o.starts,a),l.matcher=i(l),l}if(t.compilerExtensions||(t.compilerExtensions=[]),t.contains&&t.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return t.classNameAliases=Fn(t.classNameAliases||{}),s(t)}function yb(t){return t?t.endsWithParent||yb(t.starts):!1}function H_(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return Fn(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:yb(t)?Fn(t,{starts:t.starts?Fn(t.starts):null}):Object.isFrozen(t)?Fn(t):t}var j_="11.11.1";class V_ extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}}const yl=cb,zf=Fn,$f=Symbol("nomatch"),W_=7,Eb=function(t){const e=Object.create(null),n=Object.create(null),r=[];let i=!0;const s="Could not find the language '{}', did you forget to load/include a language module?",o={disableAutodetect:!0,name:"Plain text",contains:[]};let a={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:r_};function l(_){return a.noHighlightRe.test(_)}function c(_){let D=_.className+" ";D+=_.parentNode?_.parentNode.className:"";const L=a.languageDetectRe.exec(D);if(L){const I=R(L[1]);return I||(Ff(s.replace("{}",L[1])),Ff("Falling back to no-highlight mode for this block.",_)),I?L[1]:"no-highlight"}return D.split(/\s+/).find(I=>l(I)||R(I))}function u(_,D,L){let I="",Q="";typeof D=="object"?(I=_,L=D.ignoreIllegals,Q=D.language):(Or("10.7.0","highlight(lang, code, ...args) has been deprecated."),Or("10.7.0",`Please use highlight(code, options) instead.
|
|
205
|
-
https://github.com/highlightjs/highlight.js/issues/2277`),Q=_,I=D),L===void 0&&(L=!0);const A={code:I,language:Q};B("before:highlight",A);const z=A.result?A.result:d(A.language,A.code,L);return z.code=A.code,B("after:highlight",z),z}function d(_,D,L,I){const Q=Object.create(null);function A($,q){return $.keywords[q]}function z(){if(!Y.keywords){Ee.addText(pe);return}let $=0;Y.keywordPatternRe.lastIndex=0;let q=Y.keywordPatternRe.exec(pe),ae="";for(;q;){ae+=pe.substring($,q.index);const ve=He.case_insensitive?q[0].toLowerCase():q[0],Ie=A(Y,ve);if(Ie){const[Je,Tt]=Ie;if(Ee.addText(ae),ae="",Q[ve]=(Q[ve]||0)+1,Q[ve]<=W_&&(St+=Tt),Je.startsWith("_"))ae+=q[0];else{const Jn=He.classNameAliases[Je]||Je;de(q[0],Jn)}}else ae+=q[0];$=Y.keywordPatternRe.lastIndex,q=Y.keywordPatternRe.exec(pe)}ae+=pe.substring($),Ee.addText(ae)}function se(){if(pe==="")return;let $=null;if(typeof Y.subLanguage=="string"){if(!e[Y.subLanguage]){Ee.addText(pe);return}$=d(Y.subLanguage,pe,!0,pt[Y.subLanguage]),pt[Y.subLanguage]=$._top}else $=f(pe,Y.subLanguage.length?Y.subLanguage:null);Y.relevance>0&&(St+=$.relevance),Ee.__addSublanguage($._emitter,$.language)}function ne(){Y.subLanguage!=null?se():z(),pe=""}function de($,q){$!==""&&(Ee.startScope(q),Ee.addText($),Ee.endScope())}function oe($,q){let ae=1;const ve=q.length-1;for(;ae<=ve;){if(!$._emit[ae]){ae++;continue}const Ie=He.classNameAliases[$[ae]]||$[ae],Je=q[ae];Ie?de(Je,Ie):(pe=Je,z(),pe=""),ae++}}function fe($,q){return $.scope&&typeof $.scope=="string"&&Ee.openNode(He.classNameAliases[$.scope]||$.scope),$.beginScope&&($.beginScope._wrap?(de(pe,He.classNameAliases[$.beginScope._wrap]||$.beginScope._wrap),pe=""):$.beginScope._multi&&(oe($.beginScope,q),pe="")),Y=Object.create($,{parent:{value:Y}}),Y}function ie($,q,ae){let ve=a_($.endRe,ae);if(ve){if($["on:end"]){const Ie=new Df($);$["on:end"](q,Ie),Ie.isMatchIgnored&&(ve=!1)}if(ve){for(;$.endsParent&&$.parent;)$=$.parent;return $}}if($.endsWithParent)return ie($.parent,q,ae)}function $e($){return Y.matcher.regexIndex===0?(pe+=$[0],1):(Rt=!0,0)}function ge($){const q=$[0],ae=$.rule,ve=new Df(ae),Ie=[ae.__beforeBegin,ae["on:begin"]];for(const Je of Ie)if(Je&&(Je($,ve),ve.isMatchIgnored))return $e(q);return ae.skip?pe+=q:(ae.excludeBegin&&(pe+=q),ne(),!ae.returnBegin&&!ae.excludeBegin&&(pe=q)),fe(ae,$),ae.returnBegin?0:q.length}function at($){const q=$[0],ae=D.substring($.index),ve=ie(Y,$,ae);if(!ve)return $f;const Ie=Y;Y.endScope&&Y.endScope._wrap?(ne(),de(q,Y.endScope._wrap)):Y.endScope&&Y.endScope._multi?(ne(),oe(Y.endScope,$)):Ie.skip?pe+=q:(Ie.returnEnd||Ie.excludeEnd||(pe+=q),ne(),Ie.excludeEnd&&(pe=q));do Y.scope&&Ee.closeNode(),!Y.skip&&!Y.subLanguage&&(St+=Y.relevance),Y=Y.parent;while(Y!==ve.parent);return ve.starts&&fe(ve.starts,$),Ie.returnEnd?0:q.length}function Ot(){const $=[];for(let q=Y;q!==He;q=q.parent)q.scope&&$.unshift(q.scope);$.forEach(q=>Ee.openNode(q))}let Ue={};function Pt($,q){const ae=q&&q[0];if(pe+=$,ae==null)return ne(),0;if(Ue.type==="begin"&&q.type==="end"&&Ue.index===q.index&&ae===""){if(pe+=D.slice(q.index,q.index+1),!i){const ve=new Error(`0 width match regex (${_})`);throw ve.languageName=_,ve.badRule=Ue.rule,ve}return 1}if(Ue=q,q.type==="begin")return ge(q);if(q.type==="illegal"&&!L){const ve=new Error('Illegal lexeme "'+ae+'" for mode "'+(Y.scope||"<unnamed>")+'"');throw ve.mode=Y,ve}else if(q.type==="end"){const ve=at(q);if(ve!==$f)return ve}if(q.type==="illegal"&&ae==="")return pe+=`
|
|
206
|
-
`,1;if(kt>1e5&&kt>q.index*3)throw new Error("potential infinite loop, way more iterations than matches");return pe+=ae,ae.length}const He=R(_);if(!He)throw fr(s.replace("{}",_)),new Error('Unknown language: "'+_+'"');const ye=U_(He);let tt="",Y=I||ye;const pt={},Ee=new a.__emitter(a);Ot();let pe="",St=0,Le=0,kt=0,Rt=!1;try{if(He.__emitTokens)He.__emitTokens(D,Ee);else{for(Y.matcher.considerAll();;){kt++,Rt?Rt=!1:Y.matcher.considerAll(),Y.matcher.lastIndex=Le;const $=Y.matcher.exec(D);if(!$)break;const q=D.substring(Le,$.index),ae=Pt(q,$);Le=$.index+ae}Pt(D.substring(Le))}return Ee.finalize(),tt=Ee.toHTML(),{language:_,value:tt,relevance:St,illegal:!1,_emitter:Ee,_top:Y}}catch($){if($.message&&$.message.includes("Illegal"))return{language:_,value:yl(D),illegal:!0,relevance:0,_illegalBy:{message:$.message,index:Le,context:D.slice(Le-100,Le+100),mode:$.mode,resultSoFar:tt},_emitter:Ee};if(i)return{language:_,value:yl(D),illegal:!1,relevance:0,errorRaised:$,_emitter:Ee,_top:Y};throw $}}function p(_){const D={value:yl(_),illegal:!1,relevance:0,_top:o,_emitter:new a.__emitter(a)};return D._emitter.addText(_),D}function f(_,D){D=D||a.languages||Object.keys(e);const L=p(_),I=D.filter(R).filter(O).map(ne=>d(ne,_,!1));I.unshift(L);const Q=I.sort((ne,de)=>{if(ne.relevance!==de.relevance)return de.relevance-ne.relevance;if(ne.language&&de.language){if(R(ne.language).supersetOf===de.language)return 1;if(R(de.language).supersetOf===ne.language)return-1}return 0}),[A,z]=Q,se=A;return se.secondBest=z,se}function h(_,D,L){const I=D&&n[D]||L;_.classList.add("hljs"),_.classList.add(`language-${I}`)}function m(_){let D=null;const L=c(_);if(l(L))return;if(B("before:highlightElement",{el:_,language:L}),_.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",_);return}if(_.children.length>0&&(a.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(_)),a.throwUnescapedHTML))throw new V_("One of your code blocks includes unescaped HTML.",_.innerHTML);D=_;const I=D.textContent,Q=L?u(I,{language:L,ignoreIllegals:!0}):f(I);_.innerHTML=Q.value,_.dataset.highlighted="yes",h(_,L,Q.language),_.result={language:Q.language,re:Q.relevance,relevance:Q.relevance},Q.secondBest&&(_.secondBest={language:Q.secondBest.language,relevance:Q.secondBest.relevance}),B("after:highlightElement",{el:_,result:Q,text:I})}function g(_){a=zf(a,_)}const y=()=>{b(),Or("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function w(){b(),Or("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let S=!1;function b(){function _(){b()}if(document.readyState==="loading"){S||window.addEventListener("DOMContentLoaded",_,!1),S=!0;return}document.querySelectorAll(a.cssSelector).forEach(m)}function x(_,D){let L=null;try{L=D(t)}catch(I){if(fr("Language definition for '{}' could not be registered.".replace("{}",_)),i)fr(I);else throw I;L=o}L.name||(L.name=_),e[_]=L,L.rawDefinition=D.bind(null,t),L.aliases&&N(L.aliases,{languageName:_})}function T(_){delete e[_];for(const D of Object.keys(n))n[D]===_&&delete n[D]}function k(){return Object.keys(e)}function R(_){return _=(_||"").toLowerCase(),e[_]||e[n[_]]}function N(_,{languageName:D}){typeof _=="string"&&(_=[_]),_.forEach(L=>{n[L.toLowerCase()]=D})}function O(_){const D=R(_);return D&&!D.disableAutodetect}function j(_){_["before:highlightBlock"]&&!_["before:highlightElement"]&&(_["before:highlightElement"]=D=>{_["before:highlightBlock"](Object.assign({block:D.el},D))}),_["after:highlightBlock"]&&!_["after:highlightElement"]&&(_["after:highlightElement"]=D=>{_["after:highlightBlock"](Object.assign({block:D.el},D))})}function V(_){j(_),r.push(_)}function U(_){const D=r.indexOf(_);D!==-1&&r.splice(D,1)}function B(_,D){const L=_;r.forEach(function(I){I[L]&&I[L](D)})}function H(_){return Or("10.7.0","highlightBlock will be removed entirely in v12.0"),Or("10.7.0","Please use highlightElement now."),m(_)}Object.assign(t,{highlight:u,highlightAuto:f,highlightAll:b,highlightElement:m,highlightBlock:H,configure:g,initHighlighting:y,initHighlightingOnLoad:w,registerLanguage:x,unregisterLanguage:T,listLanguages:k,getLanguage:R,registerAliases:N,autoDetection:O,inherit:zf,addPlugin:V,removePlugin:U}),t.debugMode=function(){i=!1},t.safeMode=function(){i=!0},t.versionString=j_,t.regex={concat:Sr,lookahead:ub,either:hu,optional:s_,anyNumberOfTimes:i_};for(const _ in no)typeof no[_]=="object"&&lb(no[_]);return Object.assign(t,no),t},oi=Eb({});oi.newInstance=()=>Eb({});var K_=oi;oi.HighlightJS=oi;oi.default=oi;const vb=ry(K_),Uf={},q_="hljs-";function G_(t){const e=vb.newInstance();return t&&s(t),{highlight:n,highlightAuto:r,listLanguages:i,register:s,registerAlias:o,registered:a};function n(l,c,u){const d=u||Uf,p=typeof d.prefix=="string"?d.prefix:q_;if(!e.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");e.configure({__emitter:Y_,classPrefix:p});const f=e.highlight(c,{ignoreIllegals:!0,language:l});if(f.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:f.errorRaised});const h=f._emitter.root,m=h.data;return m.language=f.language,m.relevance=f.relevance,h}function r(l,c){const d=(c||Uf).subset||i();let p=-1,f=0,h;for(;++p<d.length;){const m=d[p];if(!e.getLanguage(m))continue;const g=n(m,l,c);g.data&&g.data.relevance!==void 0&&g.data.relevance>f&&(f=g.data.relevance,h=g)}return h||{type:"root",children:[],data:{language:void 0,relevance:f}}}function i(){return e.listLanguages()}function s(l,c){if(typeof l=="string")e.registerLanguage(l,c);else{let u;for(u in l)Object.hasOwn(l,u)&&e.registerLanguage(u,l[u])}}function o(l,c){if(typeof l=="string")e.registerAliases(typeof c=="string"?c:[...c],{languageName:l});else{let u;for(u in l)if(Object.hasOwn(l,u)){const d=l[u];e.registerAliases(typeof d=="string"?d:[...d],{languageName:u})}}}function a(l){return!!e.getLanguage(l)}}class Y_{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],i=e.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):r.children.push(...i)}openNode(e){const n=this,r=e.split(".").map(function(o,a){return a?o+"_".repeat(a):n.options.classPrefix+o}),i=this.stack[this.stack.length-1],s={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(s),this.stack.push(s)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}function xb(t,e=[]){return t.flatMap(n=>{const r=[...e,...n.properties?n.properties.className:[]];return n.children?xb(n.children,r):{text:n.value,classes:r}})}function Hf(t){return t.value||t.children||[]}function J_(t){return!!vb.getLanguage(t)}function jf({doc:t,name:e,lowlight:n,defaultLanguage:r}){const i=[];return Yl(t,s=>s.type.name===e).forEach(s=>{var o;let a=s.pos+1;const l=s.node.attrs.language||r,c=n.listLanguages(),u=l&&(c.includes(l)||J_(l)||(o=n.registered)!=null&&o.call(n,l))?Hf(n.highlight(l,s.node.textContent)):Hf(n.highlightAuto(s.node.textContent));xb(u).forEach(d=>{const p=a+d.text.length;if(d.classes.length){const f=Qe.inline(a,p,{class:d.classes.join(" ")});i.push(f)}a=p})}),Ce.create(t,i)}function X_(t){return typeof t=="function"}function Z_({name:t,lowlight:e,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(i=>X_(e[i])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const r=new Me({key:new ze("lowlight"),state:{init:(i,{doc:s})=>jf({doc:s,name:t,lowlight:e,defaultLanguage:n}),apply:(i,s,o,a)=>{const l=o.selection.$head.parent.type.name,c=a.selection.$head.parent.type.name,u=Yl(o.doc,p=>p.type.name===t),d=Yl(a.doc,p=>p.type.name===t);return i.docChanged&&([l,c].includes(t)||d.length!==u.length||i.steps.some(p=>p.from!==void 0&&p.to!==void 0&&u.some(f=>f.pos>=p.from&&f.pos+f.node.nodeSize<=p.to)))?jf({doc:i.doc,name:t,lowlight:e,defaultLanguage:n}):s.map(i.mapping,i.doc)}},props:{decorations(i){return r.getState(i)}}});return r}var Q_=mg.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},addProseMirrorPlugins(){var t;return[...((t=this.parent)==null?void 0:t.call(this))||[],Z_({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}),eA=Q_,tA=Pg,nA=Lg,rA=20,wb=(t,e=0)=>{const n=[];return!t.children.length||e>rA||Array.from(t.children).forEach(r=>{r.tagName==="SPAN"?n.push(r):r.children.length&&n.push(...wb(r,e+1))}),n},iA=t=>{if(!t.children.length)return;const e=wb(t);e&&e.forEach(n=>{var r,i;const s=n.getAttribute("style"),o=(i=(r=n.parentElement)==null?void 0:r.closest("span"))==null?void 0:i.getAttribute("style");n.setAttribute("style",`${o};${s}`)})},Sb=qn.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&iA(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",Ae(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(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(s=>!!s))||t.removeMark(r,r+n.nodeSize,this.type)}),!0}}}}),sA=ke.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const n=(e=As(t,"background-color"))!=null?e:t.style.backgroundColor;return n==null?void 0:n.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()}}}),kb=ke.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const n=(e=As(t,"color"))!=null?e:t.style.color;return n==null?void 0:n.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()}}}),oA=ke.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>{var e;return(e=As(t,"font-family"))!=null?e: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()}}}),aA=ke.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>{var e;return(e=As(t,"font-size"))!=null?e: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()}}}),lA=ke.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>{var e;return(e=As(t,"line-height"))!=null?e: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()}}});ke.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(sA.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(kb.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(oA.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(aA.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(lA.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(Sb.configure(this.options.textStyle)),t}});var cA=ke.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})).some(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).some(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")}}}),uA=cA;/*! @license DOMPurify 3.4.8 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.8/LICENSE */function Vf(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function dA(t){if(Array.isArray(t))return t}function fA(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(u){c=!0,i=u}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function pA(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
207
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hA(t,e){return dA(t)||fA(t,e)||mA(t,e)||pA()}function mA(t,e){if(t){if(typeof t=="string")return Vf(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Vf(t,e):void 0}}const Tb=Object.entries,Wf=Object.setPrototypeOf,gA=Object.isFrozen,bA=Object.getPrototypeOf,yA=Object.getOwnPropertyDescriptor;let wt=Object.freeze,Kt=Object.seal,Kr=Object.create,Nb=typeof Reflect<"u"&&Reflect,pc=Nb.apply,hc=Nb.construct;wt||(wt=function(e){return e});Kt||(Kt=function(e){return e});pc||(pc=function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];return e.apply(n,i)});hc||(hc=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return new e(...r)});const Qn=qe(Array.prototype.forEach),EA=qe(Array.prototype.lastIndexOf),Kf=qe(Array.prototype.pop),Rr=qe(Array.prototype.push),vA=qe(Array.prototype.splice),gt=Array.isArray,Hi=qe(String.prototype.toLowerCase),El=qe(String.prototype.toString),qf=qe(String.prototype.match),Ir=qe(String.prototype.replace),Gf=qe(String.prototype.indexOf),xA=qe(String.prototype.trim),wA=qe(Number.prototype.toString),SA=qe(Boolean.prototype.toString),Yf=typeof BigInt>"u"?null:qe(BigInt.prototype.toString),Jf=typeof Symbol>"u"?null:qe(Symbol.prototype.toString),Be=qe(Object.prototype.hasOwnProperty),Si=qe(Object.prototype.toString),nt=qe(RegExp.prototype.test),Dr=kA(TypeError);function qe(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return pc(t,e,r)}}function kA(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return hc(t,n)}}function ce(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Hi;if(Wf&&Wf(t,null),!gt(e))return t;let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const s=n(i);s!==i&&(gA(e)||(e[r]=s),i=s)}t[i]=!0}return t}function TA(t){for(let e=0;e<t.length;e++)Be(t,e)||(t[e]=null);return t}function lt(t){const e=Kr(null);for(const r of Tb(t)){var n=hA(r,2);const i=n[0],s=n[1];Be(t,i)&&(gt(s)?e[i]=TA(s):s&&typeof s=="object"&&s.constructor===Object?e[i]=lt(s):e[i]=s)}return e}function NA(t){switch(typeof t){case"string":return t;case"number":return wA(t);case"boolean":return SA(t);case"bigint":return Yf?Yf(t):"0";case"symbol":return Jf?Jf(t):"Symbol()";case"undefined":return Si(t);case"function":case"object":{if(t===null)return Si(t);const e=t,n=rn(e,"toString");if(typeof n=="function"){const r=n(e);return typeof r=="string"?r:Si(r)}return Si(t)}default:return Si(t)}}function rn(t,e){for(;t!==null;){const r=yA(t,e);if(r){if(r.get)return qe(r.get);if(typeof r.value=="function")return qe(r.value)}t=bA(t)}function n(){return null}return n}function _A(t){try{return nt(t,""),!0}catch{return!1}}const Xf=wt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),vl=wt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),xl=wt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),AA=wt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),wl=wt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),CA=wt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Zf=wt(["#text"]),Qf=wt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Sl=wt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),ep=wt(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ro=wt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),MA=Kt(/{{[\w\W]*|^[\w\W]*}}/g),OA=Kt(/<%[\w\W]*|^[\w\W]*%>/g),RA=Kt(/\${[\w\W]*/g),IA=Kt(/^data-[\-\w.\u00B7-\uFFFF]+$/),DA=Kt(/^aria-[\-\w]+$/),tp=Kt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),LA=Kt(/^(?:\w+script|data):/i),PA=Kt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),BA=Kt(/^html$/i),FA=Kt(/^[a-z][.\w]*(-[.\w]+)+$/i),tn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},zA=function(){return typeof window>"u"?null:window},$A=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(r=n.getAttribute(i));const s="dompurify"+(r?"#"+r:"");try{return e.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},np=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function _b(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:zA();const e=Z=>_b(Z);if(e.version="3.4.8",e.removed=[],!t||!t.document||t.document.nodeType!==tn.document||!t.Element)return e.isSupported=!1,e;let n=t.document;const r=n,i=r.currentScript;t.DocumentFragment;const s=t.HTMLTemplateElement,o=t.Node,a=t.Element,l=t.NodeFilter,c=t.NamedNodeMap;c===void 0&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const u=t.DOMParser,d=t.trustedTypes,p=a.prototype,f=rn(p,"cloneNode"),h=rn(p,"remove"),m=rn(p,"nextSibling"),g=rn(p,"childNodes"),y=rn(p,"parentNode"),w=rn(p,"shadowRoot"),S=rn(p,"attributes"),b=o&&o.prototype?rn(o.prototype,"nodeType"):null,x=o&&o.prototype?rn(o.prototype,"nodeName"):null;if(typeof s=="function"){const Z=n.createElement("template");Z.content&&Z.content.ownerDocument&&(n=Z.content.ownerDocument)}let T,k="",R=0;const N=function(v){if(R>0)throw Dr('The configured TRUSTED_TYPES_POLICY.createHTML must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose createHTML wraps DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.');R++;try{return T.createHTML(v)}finally{R--}},O=n,j=O.implementation,V=O.createNodeIterator,U=O.createDocumentFragment,B=O.getElementsByTagName,H=r.importNode;let _=np();e.isSupported=typeof Tb=="function"&&typeof y=="function"&&j&&j.createHTMLDocument!==void 0;const D=MA,L=OA,I=RA,Q=IA,A=DA,z=LA,se=PA,ne=FA;let de=tp,oe=null;const fe=ce({},[...Xf,...vl,...xl,...wl,...Zf]);let ie=null;const $e=ce({},[...Qf,...Sl,...ep,...ro]);let ge=Object.seal(Kr(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),at=null,Ot=null;const Ue=Object.seal(Kr(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Pt=!0,He=!0,ye=!1,tt=!0,Y=!1,pt=!0,Ee=!1,pe=!1,St=!1,Le=!1,kt=!1,Rt=!1,$=!0,q=!1;const ae="user-content-";let ve=!0,Ie=!1,Je={},Tt=null;const Jn=ce({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let C=null;const J=ce({},["audio","video","img","source","image","track"]);let re=null;const xe=ce({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),be="http://www.w3.org/1998/Math/MathML",Ve="http://www.w3.org/2000/svg",De="http://www.w3.org/1999/xhtml";let It=De,kr=!1,Yt=null;const mi=ce({},[be,Ve,De],El);let An=ce({},["mi","mo","mn","ms","mtext"]),en=ce({},["annotation-xml"]);const Oa=ce({},["title","style","font","a","script"]);let pn=null;const Tr=["application/xhtml+xml","text/html"],Qb="text/html";let je=null,Nr=null;const ey=n.createElement("form"),Nu=function(v){return v instanceof RegExp||v instanceof Function},Ra=function(){let v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Nr&&Nr===v)return;(!v||typeof v!="object")&&(v={}),v=lt(v),pn=Tr.indexOf(v.PARSER_MEDIA_TYPE)===-1?Qb:v.PARSER_MEDIA_TYPE,je=pn==="application/xhtml+xml"?El:Hi,oe=Be(v,"ALLOWED_TAGS")&>(v.ALLOWED_TAGS)?ce({},v.ALLOWED_TAGS,je):fe,ie=Be(v,"ALLOWED_ATTR")&>(v.ALLOWED_ATTR)?ce({},v.ALLOWED_ATTR,je):$e,Yt=Be(v,"ALLOWED_NAMESPACES")&>(v.ALLOWED_NAMESPACES)?ce({},v.ALLOWED_NAMESPACES,El):mi,re=Be(v,"ADD_URI_SAFE_ATTR")&>(v.ADD_URI_SAFE_ATTR)?ce(lt(xe),v.ADD_URI_SAFE_ATTR,je):xe,C=Be(v,"ADD_DATA_URI_TAGS")&>(v.ADD_DATA_URI_TAGS)?ce(lt(J),v.ADD_DATA_URI_TAGS,je):J,Tt=Be(v,"FORBID_CONTENTS")&>(v.FORBID_CONTENTS)?ce({},v.FORBID_CONTENTS,je):Jn,at=Be(v,"FORBID_TAGS")&>(v.FORBID_TAGS)?ce({},v.FORBID_TAGS,je):lt({}),Ot=Be(v,"FORBID_ATTR")&>(v.FORBID_ATTR)?ce({},v.FORBID_ATTR,je):lt({}),Je=Be(v,"USE_PROFILES")?v.USE_PROFILES&&typeof v.USE_PROFILES=="object"?lt(v.USE_PROFILES):v.USE_PROFILES:!1,Pt=v.ALLOW_ARIA_ATTR!==!1,He=v.ALLOW_DATA_ATTR!==!1,ye=v.ALLOW_UNKNOWN_PROTOCOLS||!1,tt=v.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Y=v.SAFE_FOR_TEMPLATES||!1,pt=v.SAFE_FOR_XML!==!1,Ee=v.WHOLE_DOCUMENT||!1,Le=v.RETURN_DOM||!1,kt=v.RETURN_DOM_FRAGMENT||!1,Rt=v.RETURN_TRUSTED_TYPE||!1,St=v.FORCE_BODY||!1,$=v.SANITIZE_DOM!==!1,q=v.SANITIZE_NAMED_PROPS||!1,ve=v.KEEP_CONTENT!==!1,Ie=v.IN_PLACE||!1,de=_A(v.ALLOWED_URI_REGEXP)?v.ALLOWED_URI_REGEXP:tp,It=typeof v.NAMESPACE=="string"?v.NAMESPACE:De,An=Be(v,"MATHML_TEXT_INTEGRATION_POINTS")&&v.MATHML_TEXT_INTEGRATION_POINTS&&typeof v.MATHML_TEXT_INTEGRATION_POINTS=="object"?lt(v.MATHML_TEXT_INTEGRATION_POINTS):ce({},["mi","mo","mn","ms","mtext"]),en=Be(v,"HTML_INTEGRATION_POINTS")&&v.HTML_INTEGRATION_POINTS&&typeof v.HTML_INTEGRATION_POINTS=="object"?lt(v.HTML_INTEGRATION_POINTS):ce({},["annotation-xml"]);const M=Be(v,"CUSTOM_ELEMENT_HANDLING")&&v.CUSTOM_ELEMENT_HANDLING&&typeof v.CUSTOM_ELEMENT_HANDLING=="object"?lt(v.CUSTOM_ELEMENT_HANDLING):Kr(null);if(ge=Kr(null),Be(M,"tagNameCheck")&&Nu(M.tagNameCheck)&&(ge.tagNameCheck=M.tagNameCheck),Be(M,"attributeNameCheck")&&Nu(M.attributeNameCheck)&&(ge.attributeNameCheck=M.attributeNameCheck),Be(M,"allowCustomizedBuiltInElements")&&typeof M.allowCustomizedBuiltInElements=="boolean"&&(ge.allowCustomizedBuiltInElements=M.allowCustomizedBuiltInElements),Y&&(He=!1),kt&&(Le=!0),Je&&(oe=ce({},Zf),ie=Kr(null),Je.html===!0&&(ce(oe,Xf),ce(ie,Qf)),Je.svg===!0&&(ce(oe,vl),ce(ie,Sl),ce(ie,ro)),Je.svgFilters===!0&&(ce(oe,xl),ce(ie,Sl),ce(ie,ro)),Je.mathMl===!0&&(ce(oe,wl),ce(ie,ep),ce(ie,ro))),Ue.tagCheck=null,Ue.attributeCheck=null,Be(v,"ADD_TAGS")&&(typeof v.ADD_TAGS=="function"?Ue.tagCheck=v.ADD_TAGS:gt(v.ADD_TAGS)&&(oe===fe&&(oe=lt(oe)),ce(oe,v.ADD_TAGS,je))),Be(v,"ADD_ATTR")&&(typeof v.ADD_ATTR=="function"?Ue.attributeCheck=v.ADD_ATTR:gt(v.ADD_ATTR)&&(ie===$e&&(ie=lt(ie)),ce(ie,v.ADD_ATTR,je))),Be(v,"ADD_URI_SAFE_ATTR")&>(v.ADD_URI_SAFE_ATTR)&&ce(re,v.ADD_URI_SAFE_ATTR,je),Be(v,"FORBID_CONTENTS")&>(v.FORBID_CONTENTS)&&(Tt===Jn&&(Tt=lt(Tt)),ce(Tt,v.FORBID_CONTENTS,je)),Be(v,"ADD_FORBID_CONTENTS")&>(v.ADD_FORBID_CONTENTS)&&(Tt===Jn&&(Tt=lt(Tt)),ce(Tt,v.ADD_FORBID_CONTENTS,je)),ve&&(oe["#text"]=!0),Ee&&ce(oe,["html","head","body"]),oe.table&&(ce(oe,["tbody"]),delete at.tbody),v.TRUSTED_TYPES_POLICY){if(typeof v.TRUSTED_TYPES_POLICY.createHTML!="function")throw Dr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof v.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Dr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const K=T;T=v.TRUSTED_TYPES_POLICY;try{k=N("")}catch(Se){throw T=K,Se}}else T===void 0&&v.TRUSTED_TYPES_POLICY!==null&&(T=$A(d,i)),T&&typeof k=="string"&&(k=N(""));(_.uponSanitizeElement.length>0||_.uponSanitizeAttribute.length>0)&&oe===fe&&(oe=lt(oe)),_.uponSanitizeAttribute.length>0&&ie===$e&&(ie=lt(ie)),wt&&wt(v),Nr=v},_u=ce({},[...vl,...xl,...AA]),Au=ce({},[...wl,...CA]),ty=function(v){let M=y(v);(!M||!M.tagName)&&(M={namespaceURI:It,tagName:"template"});const K=Hi(v.tagName),Se=Hi(M.tagName);return Yt[v.namespaceURI]?v.namespaceURI===Ve?M.namespaceURI===De?K==="svg":M.namespaceURI===be?K==="svg"&&(Se==="annotation-xml"||An[Se]):!!_u[K]:v.namespaceURI===be?M.namespaceURI===De?K==="math":M.namespaceURI===Ve?K==="math"&&en[Se]:!!Au[K]:v.namespaceURI===De?M.namespaceURI===Ve&&!en[Se]||M.namespaceURI===be&&!An[Se]?!1:!Au[K]&&(Oa[K]||!_u[K]):!!(pn==="application/xhtml+xml"&&Yt[v.namespaceURI]):!1},Jt=function(v){Rr(e.removed,{element:v});try{y(v).removeChild(v)}catch{h(v)}},Xn=function(v,M){try{Rr(e.removed,{attribute:M.getAttributeNode(v),from:M})}catch{Rr(e.removed,{attribute:null,from:M})}if(M.removeAttribute(v),v==="is")if(Le||kt)try{Jt(M)}catch{}else try{M.setAttribute(v,"")}catch{}},Cu=function(v){let M=null,K=null;if(St)v="<remove></remove>"+v;else{const Ne=qf(v,/^[\r\n\t ]+/);K=Ne&&Ne[0]}pn==="application/xhtml+xml"&&It===De&&(v='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+v+"</body></html>");const Se=T?N(v):v;if(It===De)try{M=new u().parseFromString(Se,pn)}catch{}if(!M||!M.documentElement){M=j.createDocument(It,"template",null);try{M.documentElement.innerHTML=kr?k:Se}catch{}}const he=M.body||M.documentElement;return v&&K&&he.insertBefore(n.createTextNode(K),he.childNodes[0]||null),It===De?B.call(M,Ee?"html":"body")[0]:Ee?M.documentElement:he},Mu=function(v){return V.call(v.ownerDocument||v,v,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Ia=function(v){var M,K;v.normalize();const Se=V.call(v.ownerDocument||v,v,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let he=Se.nextNode();for(;he;){let Ge=he.data;Qn([D,L,I],Bt=>{Ge=Ir(Ge,Bt," ")}),he.data=Ge,he=Se.nextNode()}const Ne=(M=(K=v.querySelectorAll)===null||K===void 0?void 0:K.call(v,"template"))!==null&&M!==void 0?M:[];Qn(Array.from(Ne),Ge=>{_r(Ge.content)&&Ia(Ge.content)})},Rs=function(v){const M=x?x(v):null;return typeof M!="string"||je(M)!=="form"?!1:typeof v.nodeName!="string"||typeof v.textContent!="string"||typeof v.removeChild!="function"||v.attributes!==S(v)||typeof v.removeAttribute!="function"||typeof v.setAttribute!="function"||typeof v.namespaceURI!="string"||typeof v.insertBefore!="function"||typeof v.hasChildNodes!="function"||v.nodeType!==b(v)||v.childNodes!==g(v)},_r=function(v){if(!b||typeof v!="object"||v===null)return!1;try{return b(v)===tn.documentFragment}catch{return!1}},Is=function(v){if(!b||typeof v!="object"||v===null)return!1;try{return typeof b(v)=="number"}catch{return!1}};function hn(Z,v,M){Qn(Z,K=>{K.call(e,v,M,Nr)})}const Ou=function(v){let M=null;if(hn(_.beforeSanitizeElements,v,null),Rs(v))return Jt(v),!0;const K=je(x?x(v):v.nodeName);if(hn(_.uponSanitizeElement,v,{tagName:K,allowedTags:oe}),pt&&v.hasChildNodes()&&!Is(v.firstElementChild)&&nt(/<[/\w!]/g,v.innerHTML)&&nt(/<[/\w!]/g,v.textContent)||pt&&v.namespaceURI===De&&K==="style"&&Is(v.firstElementChild)||v.nodeType===tn.progressingInstruction||pt&&v.nodeType===tn.comment&&nt(/<[/\w]/g,v.data))return Jt(v),!0;if(at[K]||!(Ue.tagCheck instanceof Function&&Ue.tagCheck(K))&&!oe[K]){if(!at[K]&&Iu(K)&&(ge.tagNameCheck instanceof RegExp&&nt(ge.tagNameCheck,K)||ge.tagNameCheck instanceof Function&&ge.tagNameCheck(K)))return!1;if(ve&&!Tt[K]){const he=y(v),Ne=g(v);if(Ne&&he){const Ge=Ne.length;for(let Bt=Ge-1;Bt>=0;--Bt){const Xt=f(Ne[Bt],!0);he.insertBefore(Xt,m(v))}}}return Jt(v),!0}return(b?b(v):v.nodeType)===tn.element&&!ty(v)||(K==="noscript"||K==="noembed"||K==="noframes")&&nt(/<\/no(script|embed|frames)/i,v.innerHTML)?(Jt(v),!0):(Y&&v.nodeType===tn.text&&(M=v.textContent,Qn([D,L,I],he=>{M=Ir(M,he," ")}),v.textContent!==M&&(Rr(e.removed,{element:v.cloneNode()}),v.textContent=M)),hn(_.afterSanitizeElements,v,null),!1)},Ru=function(v,M,K){if(Ot[M]||$&&(M==="id"||M==="name")&&(K in n||K in ey))return!1;const Se=ie[M]||Ue.attributeCheck instanceof Function&&Ue.attributeCheck(M,v);if(!(He&&!Ot[M]&&nt(Q,M))){if(!(Pt&&nt(A,M))){if(!Se||Ot[M]){if(!(Iu(v)&&(ge.tagNameCheck instanceof RegExp&&nt(ge.tagNameCheck,v)||ge.tagNameCheck instanceof Function&&ge.tagNameCheck(v))&&(ge.attributeNameCheck instanceof RegExp&&nt(ge.attributeNameCheck,M)||ge.attributeNameCheck instanceof Function&&ge.attributeNameCheck(M,v))||M==="is"&&ge.allowCustomizedBuiltInElements&&(ge.tagNameCheck instanceof RegExp&&nt(ge.tagNameCheck,K)||ge.tagNameCheck instanceof Function&&ge.tagNameCheck(K))))return!1}else if(!re[M]){if(!nt(de,Ir(K,se,""))){if(!((M==="src"||M==="xlink:href"||M==="href")&&v!=="script"&&Gf(K,"data:")===0&&C[v])){if(!(ye&&!nt(z,Ir(K,se,"")))){if(K)return!1}}}}}}return!0},ny=ce({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Iu=function(v){return!ny[Hi(v)]&&nt(ne,v)},Du=function(v){hn(_.beforeSanitizeAttributes,v,null);const M=v.attributes;if(!M||Rs(v))return;const K={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ie,forceKeepAttr:void 0};let Se=M.length;for(;Se--;){const he=M[Se],Ne=he.name,Ge=he.namespaceURI,Bt=he.value,Xt=je(Ne),Da=Bt;let Xe=Ne==="value"?Da:xA(Da);if(K.attrName=Xt,K.attrValue=Xe,K.keepAttr=!0,K.forceKeepAttr=void 0,hn(_.uponSanitizeAttribute,v,K),Xe=K.attrValue,q&&(Xt==="id"||Xt==="name")&&Gf(Xe,ae)!==0&&(Xn(Ne,v),Xe=ae+Xe),pt&&nt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Xe)){Xn(Ne,v);continue}if(Xt==="attributename"&&qf(Xe,"href")){Xn(Ne,v);continue}if(K.forceKeepAttr)continue;if(!K.keepAttr){Xn(Ne,v);continue}if(!tt&&nt(/\/>/i,Xe)){Xn(Ne,v);continue}Y&&Qn([D,L,I],Pu=>{Xe=Ir(Xe,Pu," ")});const Lu=je(v.nodeName);if(!Ru(Lu,Xt,Xe)){Xn(Ne,v);continue}if(T&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!Ge)switch(d.getAttributeType(Lu,Xt)){case"TrustedHTML":{Xe=N(Xe);break}case"TrustedScriptURL":{Xe=T.createScriptURL(Xe);break}}if(Xe!==Da)try{Ge?v.setAttributeNS(Ge,Ne,Xe):v.setAttribute(Ne,Xe),Rs(v)?Jt(v):Kf(e.removed)}catch{Xn(Ne,v)}}hn(_.afterSanitizeAttributes,v,null)},Ds=function(v){let M=null;const K=Mu(v);for(hn(_.beforeSanitizeShadowDOM,v,null);M=K.nextNode();)if(hn(_.uponSanitizeShadowNode,M,null),Ou(M),Du(M),_r(M.content)&&Ds(M.content),(b?b(M):M.nodeType)===tn.element){const he=w?w(M):M.shadowRoot;_r(he)&&(Ar(he),Ds(he))}hn(_.afterSanitizeShadowDOM,v,null)},Ar=function(v){const M=b?b(v):v.nodeType;if(M===tn.element){const he=w?w(v):v.shadowRoot;_r(he)&&(Ar(he),Ds(he))}const K=g?g(v):v.childNodes;if(!K)return;const Se=[];Qn(K,he=>{Rr(Se,he)});for(const he of Se)Ar(he);if(M===tn.element){const he=x?x(v):null;if(typeof he=="string"&&je(he)==="template"){const Ne=v.content;_r(Ne)&&Ar(Ne)}}};return e.sanitize=function(Z){let v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},M=null,K=null,Se=null,he=null;if(kr=!Z,kr&&(Z="<!-->"),typeof Z!="string"&&!Is(Z)&&(Z=NA(Z),typeof Z!="string"))throw Dr("dirty is not a string, aborting");if(!e.isSupported)return Z;if(pe||Ra(v),e.removed=[],typeof Z=="string"&&(Ie=!1),Ie){const Bt=x?x(Z):Z.nodeName;if(typeof Bt=="string"){const Xt=je(Bt);if(!oe[Xt]||at[Xt])throw Dr("root node is forbidden and cannot be sanitized in-place")}if(Rs(Z))throw Dr("root node is clobbered and cannot be sanitized in-place");Ar(Z)}else if(Is(Z))M=Cu("<!---->"),K=M.ownerDocument.importNode(Z,!0),K.nodeType===tn.element&&K.nodeName==="BODY"||K.nodeName==="HTML"?M=K:M.appendChild(K),Ar(K);else{if(!Le&&!Y&&!Ee&&Z.indexOf("<")===-1)return T&&Rt?N(Z):Z;if(M=Cu(Z),!M)return Le?null:Rt?k:""}M&&St&&Jt(M.firstChild);const Ne=Mu(Ie?Z:M);for(;Se=Ne.nextNode();)Ou(Se),Du(Se),_r(Se.content)&&Ds(Se.content);if(Ie)return Y&&Ia(Z),Z;if(Le){if(Y&&Ia(M),kt)for(he=U.call(M.ownerDocument);M.firstChild;)he.appendChild(M.firstChild);else he=M;return(ie.shadowroot||ie.shadowrootmode)&&(he=H.call(r,he,!0)),he}let Ge=Ee?M.outerHTML:M.innerHTML;return Ee&&oe["!doctype"]&&M.ownerDocument&&M.ownerDocument.doctype&&M.ownerDocument.doctype.name&&nt(BA,M.ownerDocument.doctype.name)&&(Ge="<!DOCTYPE "+M.ownerDocument.doctype.name+`>
|
|
208
|
-
`+Ge),Y&&Qn([D,L,I],Bt=>{Ge=Ir(Ge,Bt," ")}),T&&Rt?N(Ge):Ge},e.setConfig=function(){let Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ra(Z),pe=!0},e.clearConfig=function(){Nr=null,pe=!1},e.isValidAttribute=function(Z,v,M){Nr||Ra({});const K=je(Z),Se=je(v);return Ru(K,Se,M)},e.addHook=function(Z,v){typeof v=="function"&&Rr(_[Z],v)},e.removeHook=function(Z,v){if(v!==void 0){const M=EA(_[Z],v);return M===-1?void 0:vA(_[Z],M,1)[0]}return Kf(_[Z])},e.removeHooks=function(Z){_[Z]=[]},e.removeAllHooks=function(){_=np()},e}var Ab=_b(),UA=mT;const Cb=W.createContext(void 0),Ca=()=>{const t=W.useContext(Cb);if(t===void 0)throw new Error("useAxiomEditor must be used within an AxiomEditorProvider");return t},HA=({node:t,updateAttributes:e,deleteNode:n,selected:r})=>{const[i,s]=W.useState(!1),[o,a]=W.useState(!1),[l,c]=W.useState(!1),[u,d]=W.useState(!1),p=W.useRef(null),f=t.attrs.align||"center",h=t.attrs.width||"100%",m=t.attrs.caption||"",g=t.attrs.captionPosition||"below",y=t.attrs.alt||"",w=t.attrs.src,S=W.useCallback(k=>{if(!u||!p.current)return;const R=p.current.getBoundingClientRect(),N=Math.max(150,k.clientX-R.left);e({width:`${N}px`})},[u,e]),b=W.useCallback(()=>{d(!1)},[]);W.useEffect(()=>(u&&(window.addEventListener("mousemove",S),window.addEventListener("mouseup",b)),()=>{window.removeEventListener("mousemove",S),window.removeEventListener("mouseup",b)}),[u,S,b]);let x="w-full relative my-8 flex flex-col outline-none group cursor-pointer ";f==="left"?x+="items-start mr-auto ml-0":f==="right"?x+="items-end ml-auto mr-0":x+="items-center mx-auto";const T=`rounded-xl shadow-2xl transition-all border border-smoke/30 max-w-full ${r?"ring-4 ring-amber ring-offset-4 ring-offset-obsidian":""}`;return E.jsxs(pi,{className:x,children:[E.jsxs("div",{ref:p,className:"relative inline-block",style:{width:h,minWidth:"150px"},children:[m&&g==="above"&&E.jsx("p",{className:"text-steel text-xs md:text-sm italic mb-3 uppercase tracking-widest font-medium px-2",children:m}),E.jsx("img",{src:w,className:T,alt:y,style:{width:"100%",display:"block"}}),r&&E.jsx("div",{onMouseDown:k=>{k.preventDefault(),d(!0)},className:"absolute -right-2 -bottom-2 w-5 h-5 bg-amber border-2 border-charcoal rounded-full cursor-se-resize z-50 hover:scale-125 transition-transform",title:"Drag to resize"}),m&&g==="below"&&E.jsx("p",{className:"text-steel text-xs md:text-sm italic mt-3 uppercase tracking-widest font-medium px-2",children:m})]}),r&&E.jsx("div",{className:"absolute -top-14 left-1/2 -translate-x-1/2 z-50 bg-charcoal border border-smoke rounded-xl shadow-2xl flex items-center divide-x divide-smoke/30 h-11 px-1",onMouseDown:k=>k.stopPropagation(),onKeyDown:k=>k.stopPropagation(),children:i?E.jsxs("div",{className:"flex items-center px-2 py-1 gap-2",children:[E.jsx("input",{type:"text",autoFocus:!0,placeholder:"Alt text / Title...",value:y,onChange:k=>e({alt:k.target.value}),onKeyDown:k=>{k.key==="Enter"&&s(!1)},className:"bg-obsidian border border-smoke/50 rounded-lg px-3 py-1 text-xs text-bone focus:outline-none focus:border-amber w-40"}),E.jsx("button",{onMouseDown:k=>{k.preventDefault(),s(!1)},className:"text-[10px] text-amber uppercase font-bold px-1",children:"Done"})]}):o?E.jsxs("div",{className:"flex items-center px-2 py-1 gap-2",children:[E.jsx("input",{type:"text",autoFocus:!0,placeholder:"Caption...",value:m,onChange:k=>e({caption:k.target.value}),onKeyDown:k=>{k.key==="Enter"&&a(!1)},className:"bg-obsidian border border-smoke/50 rounded-lg px-3 py-1 text-xs text-bone focus:outline-none focus:border-amber w-40"}),E.jsx("button",{onMouseDown:k=>{k.preventDefault(),e({captionPosition:g==="above"?"below":"above"})},className:"p-1.5 text-steel hover:text-amber rounded",title:"Toggle Position",children:E.jsx(X.Layout,{className:"w-3.5 h-3.5"})}),E.jsx("button",{onMouseDown:k=>{k.preventDefault(),a(!1)},className:"text-[10px] text-amber uppercase font-bold px-1",children:"Done"})]}):l?E.jsxs("div",{className:"flex items-center px-2 py-1 gap-2",children:[E.jsx("input",{type:"text",autoFocus:!0,placeholder:"Size (px or %)...",value:h,onChange:k=>e({width:k.target.value}),onKeyDown:k=>{k.key==="Enter"&&c(!1)},className:"bg-obsidian border border-smoke/50 rounded-lg px-3 py-1 text-xs text-bone focus:outline-none focus:border-amber w-32"}),E.jsx("button",{onMouseDown:k=>{k.preventDefault(),c(!1)},className:"text-[10px] text-amber uppercase font-bold px-1",children:"Done"})]}):E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:"flex px-1 items-center gap-0.5",children:[E.jsx("button",{onMouseDown:k=>{k.preventDefault(),e({width:"100%"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-all",title:"Full Width",children:E.jsx(X.Maximize,{className:"w-4 h-4"})}),E.jsx("button",{onMouseDown:k=>{k.preventDefault(),c(!0)},className:"text-[10px] font-bold text-bone hover:text-amber px-2 py-1 transition-all",children:"Size"})]}),E.jsxs("div",{className:"flex px-1 items-center gap-0.5",children:[E.jsx("button",{onMouseDown:k=>{k.preventDefault(),e({align:"left"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",children:E.jsx(X.AlignLeft,{className:"w-4 h-4"})}),E.jsx("button",{onMouseDown:k=>{k.preventDefault(),e({align:"center"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",children:E.jsx(X.AlignCenter,{className:"w-4 h-4"})}),E.jsx("button",{onMouseDown:k=>{k.preventDefault(),e({align:"right"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",children:E.jsx(X.AlignRight,{className:"w-4 h-4"})})]}),E.jsxs("div",{className:"flex px-1 items-center gap-0.5",children:[E.jsx("button",{onMouseDown:k=>{k.preventDefault(),a(!0)},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",title:"Caption",children:E.jsx(X.Type,{className:"w-4 h-4"})}),E.jsx("button",{onMouseDown:k=>{k.preventDefault(),s(!0)},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",title:"Alt Text / Title",children:"Alt"}),E.jsx("button",{onMouseDown:k=>{k.preventDefault(),n()},className:"p-2 text-red-500 hover:text-red-400 hover:bg-red-500/10 rounded-lg transition-colors",children:E.jsx(X.Trash2,{className:"w-4 h-4"})})]})]})})]})},jA=Ye.create({name:"image",group:"block",atom:!0,addAttributes(){return{src:{default:null},alt:{default:null},caption:{default:null},captionPosition:{default:"below"},width:{default:"100%"},align:{default:"center"}}},parseHTML(){return[{tag:"img[src]",getAttrs:t=>typeof t=="string"?{}:{src:t.getAttribute("src"),alt:t.getAttribute("alt"),width:t.style.width||t.getAttribute("width")||"100%"}}]},renderHTML({HTMLAttributes:t}){return["img",Ae(t)]},addNodeView(){return hi(HA)}});var VA=/^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu\.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/,WA=/^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu\.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/g,bu=t=>t.match(VA),rp=(t,e)=>e?"https://www.youtube-nocookie.com/embed/videoseries?list=":t?"https://www.youtube-nocookie.com/embed/":"https://www.youtube.com/embed/",KA=t=>{const{url:e,allowFullscreen:n,autoplay:r,ccLanguage:i,ccLoadPolicy:s,controls:o,disableKBcontrols:a,enableIFrameApi:l,endTime:c,interfaceLanguage:u,ivLoadPolicy:d,loop:p,modestBranding:f,nocookie:h,origin:m,playlist:g,progressBarColor:y,startAt:w,rel:S}=t;if(!bu(e))return null;if(e.includes("/embed/"))return e;if(e.includes("youtu.be")){const R=e.split("/").pop();return R?`${rp(h)}${R}`:null}const x=/(?:(v|list)=|shorts\/)([-\w]+)/gm.exec(e);if(!x||!x[2])return null;let T=`${rp(h,x[1]==="list")}${x[2]}`;const k=[];return n===!1&&k.push("fs=0"),r&&k.push("autoplay=1"),i&&k.push(`cc_lang_pref=${i}`),s&&k.push("cc_load_policy=1"),o||k.push("controls=0"),a&&k.push("disablekb=1"),l&&k.push("enablejsapi=1"),c&&k.push(`end=${c}`),u&&k.push(`hl=${u}`),d&&k.push(`iv_load_policy=${d}`),p&&k.push("loop=1"),f&&k.push("modestbranding=1"),m&&k.push(`origin=${m}`),g&&k.push(`playlist=${g}`),w&&k.push(`start=${w}`),y&&k.push(`color=${y}`),S!==void 0&&k.push(`rel=${S}`),k.length&&(T+=`${x[1]==="list"?"&":"?"}${k.join("&")}`),T},qA=t=>{let e;try{e=new URL(t)}catch{return null}const n=e.hostname.replace(/^www\./,"");if(n!=="youtube.com"&&n!=="youtube-nocookie.com")return null;let r=null;if(e.pathname==="/embed/videoseries"){const o=e.searchParams.get("list");if(!o)return null;r=`https://www.youtube.com/playlist?list=${o}`}else{const o=e.pathname.match(/^\/embed\/([\w-]+)$/);if(!(o!=null&&o[1]))return null;r=`https://www.youtube.com/watch?v=${o[1]}`}if(!bu(r))return null;const i={src:r},s=e.searchParams.get("start");if(s){const o=Number.parseInt(s,10);Number.isNaN(o)||(i.start=o)}return i},ip=t=>{if(!t)return null;const e=Number.parseInt(t,10);return Number.isNaN(e)?null:e},sp=t=>{const e=t.getAttribute("src");if(!e)return null;const n=qA(e);return n||{src:e}},GA=Ye.create({name:"youtube",addOptions(){return{addPasteHandler:!0,allowFullscreen:!0,autoplay:!1,ccLanguage:void 0,ccLoadPolicy:void 0,controls:!0,disableKBcontrols:!1,enableIFrameApi:!1,endTime:0,height:480,interfaceLanguage:void 0,ivLoadPolicy:0,loop:!1,modestBranding:!1,HTMLAttributes:{},inline:!1,nocookie:!1,origin:"",playlist:"",progressBarColor:void 0,width:640,rel:1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null,parseHTML:t=>{var e;return(e=sp(t))==null?void 0:e.src}},start:{default:0,parseHTML:t=>{var e;return(e=sp(t))==null?void 0:e.start}},width:{default:this.options.width,parseHTML:t=>ip(t.getAttribute("width"))},height:{default:this.options.height,parseHTML:t=>ip(t.getAttribute("height"))}}},parseHTML(){return[{tag:"div[data-youtube-video] iframe"}]},addCommands(){return{setYoutubeVideo:t=>({commands:e})=>bu(t.src)?e.insertContent({type:this.name,attrs:t}):!1}},addPasteRules(){return this.options.addPasteHandler?[xw({find:WA,type:this.type,getAttributes:t=>({src:t.input})})]:[]},renderHTML({HTMLAttributes:t}){const e=KA({url:t.src,allowFullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,controls:this.options.controls,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,nocookie:this.options.nocookie,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor,startAt:t.start||0,rel:this.options.rel});return t.src=e,["div",{"data-youtube-video":""},["iframe",Ae(this.options.HTMLAttributes,{width:this.options.width,height:this.options.height,allowfullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor,rel:this.options.rel},t)]]},...zm({nodeName:"youtube",allowedAttributes:["src","width","height","start"]})}),YA=GA;const JA=({node:t,updateAttributes:e,deleteNode:n,selected:r,editor:i})=>{const[s,o]=W.useState(!1),[a,l]=W.useState(!1),[c,u]=W.useState(!1),d=t.attrs.align||"center",p=t.attrs.width||"100%",f=t.attrs.caption||"",h=t.attrs.captionPosition||"below",m=t.attrs.alt||"";let g=t.attrs.src||"";const y=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=|live\/)|youtu\.be\/|youtube\.com\/shorts\/)([a-zA-Z0-9_-]{11})/,w=g.match(y);w&&w[1]&&(g=`https://www.youtube-nocookie.com/embed/${w[1]}`);let S="w-full relative my-8 flex flex-col outline-none group cursor-pointer ";d==="left"?S+="items-start mr-auto ml-0":d==="right"?S+="items-end ml-auto mr-0":S+="items-center mx-auto";const b=`rounded-xl shadow-2xl transition-all border border-smoke/30 max-w-full aspect-video ${r?"ring-4 ring-amber ring-offset-4 ring-offset-obsidian":""}`;return E.jsxs(pi,{className:S,children:[f&&h==="above"&&E.jsx("p",{className:"text-steel text-xs md:text-sm italic mb-3 uppercase tracking-widest font-medium px-2",children:f}),E.jsxs("div",{className:"relative",style:{width:p,maxWidth:"720px",minWidth:"320px"},children:[i.isEditable&&E.jsx("div",{className:"absolute inset-0 z-10 cursor-pointer",title:"Click to edit embed"}),E.jsx("iframe",{src:g,className:`${b} w-full h-full`,style:{pointerEvents:i.isEditable?"none":"auto"},title:m,allowFullScreen:!0})]}),f&&h==="below"&&E.jsx("p",{className:"text-steel text-xs md:text-sm italic mt-3 uppercase tracking-widest font-medium px-2",children:f}),r&&E.jsx("div",{className:"absolute -top-14 left-1/2 -translate-x-1/2 z-50 bg-charcoal border border-smoke rounded-xl shadow-2xl flex items-center divide-x divide-smoke/30 h-11 px-1",onMouseDown:x=>x.stopPropagation(),onKeyDown:x=>x.stopPropagation(),children:s?E.jsxs("div",{className:"flex items-center px-2 py-1 gap-2",children:[E.jsx("input",{type:"text",autoFocus:!0,placeholder:"Alt text / Title...",value:m,onChange:x=>e({alt:x.target.value}),onKeyDown:x=>{x.key==="Enter"&&o(!1)},className:"bg-obsidian border border-smoke/50 rounded-lg px-3 py-1 text-xs text-bone focus:outline-none focus:border-amber w-40"}),E.jsx("button",{onMouseDown:x=>{x.preventDefault(),o(!1)},className:"text-[10px] text-amber uppercase font-bold px-1",children:"Done"})]}):a?E.jsxs("div",{className:"flex items-center px-2 py-1 gap-2",children:[E.jsx("input",{type:"text",autoFocus:!0,placeholder:"Caption...",value:f,onChange:x=>e({caption:x.target.value}),onKeyDown:x=>{x.key==="Enter"&&l(!1)},className:"bg-obsidian border border-smoke/50 rounded-lg px-3 py-1 text-xs text-bone focus:outline-none focus:border-amber w-40"}),E.jsx("button",{onMouseDown:x=>{x.preventDefault(),e({captionPosition:h==="above"?"below":"above"})},className:"p-1.5 text-steel hover:text-amber rounded",title:"Toggle Position",children:E.jsx(X.Layout,{className:"w-3.5 h-3.5"})}),E.jsx("button",{onMouseDown:x=>{x.preventDefault(),l(!1)},className:"text-[10px] text-amber uppercase font-bold px-1",children:"Done"})]}):c?E.jsxs("div",{className:"flex items-center px-2 py-1 gap-2",children:[E.jsx("input",{type:"text",autoFocus:!0,placeholder:"Size (px or %)...",value:p,onChange:x=>e({width:x.target.value}),onKeyDown:x=>{x.key==="Enter"&&u(!1)},className:"bg-obsidian border border-smoke/50 rounded-lg px-3 py-1 text-xs text-bone focus:outline-none focus:border-amber w-32"}),E.jsx("button",{onMouseDown:x=>{x.preventDefault(),u(!1)},className:"text-[10px] text-amber uppercase font-bold px-1",children:"Done"})]}):E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:"flex px-1 items-center gap-0.5",children:[E.jsx("button",{onMouseDown:x=>{x.preventDefault(),e({width:"100%"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-all",title:"Full Width",children:E.jsx(X.Maximize,{className:"w-4 h-4"})}),E.jsx("button",{onMouseDown:x=>{x.preventDefault(),u(!0)},className:"text-[10px] font-bold text-bone hover:text-amber px-2 py-1 transition-all",children:"Size"})]}),E.jsxs("div",{className:"flex px-1 items-center gap-0.5",children:[E.jsx("button",{onMouseDown:x=>{x.preventDefault(),e({align:"left"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",children:E.jsx(X.AlignLeft,{className:"w-4 h-4"})}),E.jsx("button",{onMouseDown:x=>{x.preventDefault(),e({align:"center"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",children:E.jsx(X.AlignCenter,{className:"w-4 h-4"})}),E.jsx("button",{onMouseDown:x=>{x.preventDefault(),e({align:"right"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",children:E.jsx(X.AlignRight,{className:"w-4 h-4"})})]}),E.jsxs("div",{className:"flex px-1 items-center gap-0.5",children:[E.jsx("button",{onMouseDown:x=>{x.preventDefault(),l(!0)},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",title:"Caption",children:E.jsx(X.Type,{className:"w-4 h-4"})}),E.jsx("button",{onMouseDown:x=>{x.preventDefault(),o(!0)},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",title:"Alt Text / Title",children:"Alt"}),E.jsx("button",{onMouseDown:x=>{x.preventDefault(),n()},className:"p-2 text-red-500 hover:text-red-400 hover:bg-red-500/10 rounded-lg transition-colors",children:E.jsx(X.Trash2,{className:"w-4 h-4"})})]})]})})]})},XA=YA.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),align:{default:"center"},width:{default:"100%"},caption:{default:""},captionPosition:{default:"below"},alt:{default:""}}},addNodeView(){return hi(JA)}}),ZA=({node:t,updateAttributes:e,deleteNode:n,selected:r,editor:i})=>{const s=W.useRef(null),[o,a]=W.useState(!1),[l,c]=W.useState(!1),[u,d]=W.useState(!1),[p,f]=W.useState(!1),h=t.attrs.align||"center",m=t.attrs.url||"",g=t.attrs.width||"100%",y=t.attrs.caption||"",w=t.attrs.captionPosition||"below",S=t.attrs.alt||"";let b=t.attrs.tweetId;if(!b&&m){const N=m.match(/status\/(\d+)/);b=N?N[1]:""}const[x,T]=W.useState({tweetId:b,align:h});(b!==x.tweetId||h!==x.align)&&(T({tweetId:b,align:h}),a(!1)),W.useEffect(()=>{if(!window.twttr){const N=document.createElement("script");N.setAttribute("src","https://platform.twitter.com/widgets.js"),N.setAttribute("async","true"),N.setAttribute("charset","utf-8"),document.head.appendChild(N)}},[]),W.useEffect(()=>{let N=!0;if(!b)return;const O=setInterval(()=>{var V,U,B,H;(V=window.twttr)!=null&&V.widgets&&(clearInterval(O),clearTimeout(j),s.current&&N&&(s.current.innerHTML="",(H=(B=(U=window.twttr.widgets).createTweet)==null?void 0:B.call(U,b,s.current,{theme:"dark",align:h,dnt:!0}))==null||H.then(()=>{N&&a(!0)})))},100),j=setTimeout(()=>{N=!1,clearInterval(O)},1e4);return()=>{N=!1,clearInterval(O),clearTimeout(j)}},[b,h]);let k="w-full relative my-8 flex flex-col outline-none group cursor-pointer ";h==="left"?k+="items-start mr-auto ml-0":h==="right"?k+="items-end ml-auto mr-0":k+="items-center mx-auto";const R=()=>{let N=String(g).trim();if(N.endsWith("%")){const O=parseInt(N.replace("%",""),10);!isNaN(O)&&O<30&&(N="30%")}else{const O=parseInt(N.replace("px",""),10);!isNaN(O)&&O<250?N="250px":!isNaN(O)&&!N.endsWith("px")&&(N=`${O}px`)}e({width:N}),f(!1)};return E.jsxs(pi,{className:k,children:[y&&w==="above"&&E.jsx("p",{className:"text-steel text-xs md:text-sm italic mb-3 uppercase tracking-widest font-medium px-2",children:y}),E.jsxs("div",{style:{width:g,maxWidth:"550px",minWidth:"250px"},className:`relative py-4 flex items-center justify-center min-h-[150px] overflow-hidden bg-obsidian border border-smoke/30 rounded-xl transition-all ${r?"ring-4 ring-amber ring-offset-4 ring-offset-obsidian":""}`,title:S,children:[i.isEditable&&E.jsx("div",{className:"absolute inset-0 z-10 cursor-pointer",title:"Click to edit embed"}),!o&&E.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-xs text-steel animate-pulse uppercase tracking-wider font-semibold",children:"Establishing connection to X..."}),E.jsx("div",{ref:s,className:`w-full flex justify-center ${i.isEditable?"pointer-events-none":""}`})]}),y&&w==="below"&&E.jsx("p",{className:"text-steel text-xs md:text-sm italic mt-3 uppercase tracking-widest font-medium px-2",children:y}),r&&E.jsx("div",{className:"absolute -top-14 left-1/2 -translate-x-1/2 z-50 bg-charcoal border border-smoke rounded-xl shadow-2xl flex items-center divide-x divide-smoke/30 h-11 px-1",onMouseDown:N=>N.stopPropagation(),onKeyDown:N=>N.stopPropagation(),children:l?E.jsxs("div",{className:"flex items-center px-2 py-1 gap-2",children:[E.jsx("input",{type:"text",autoFocus:!0,placeholder:"Alt text / Title...",value:S,onChange:N=>e({alt:N.target.value}),onKeyDown:N=>{N.key==="Enter"&&c(!1)},className:"bg-obsidian border border-smoke/50 rounded-lg px-3 py-1 text-xs text-bone focus:outline-none focus:border-amber w-40"}),E.jsx("button",{onMouseDown:N=>{N.preventDefault(),c(!1)},className:"text-[10px] text-amber uppercase font-bold px-1",children:"Done"})]}):u?E.jsxs("div",{className:"flex items-center px-2 py-1 gap-2",children:[E.jsx("input",{type:"text",autoFocus:!0,placeholder:"Caption...",value:y,onChange:N=>e({caption:N.target.value}),onKeyDown:N=>{N.key==="Enter"&&d(!1)},className:"bg-obsidian border border-smoke/50 rounded-lg px-3 py-1 text-xs text-bone focus:outline-none focus:border-amber w-40"}),E.jsx("button",{onMouseDown:N=>{N.preventDefault(),e({captionPosition:w==="above"?"below":"above"})},className:"p-1.5 text-steel hover:text-amber rounded",title:"Toggle Position",children:E.jsx(X.Layout,{className:"w-3.5 h-3.5"})}),E.jsx("button",{onMouseDown:N=>{N.preventDefault(),d(!1)},className:"text-[10px] text-amber uppercase font-bold px-1",children:"Done"})]}):p?E.jsxs("div",{className:"flex items-center px-2 py-1 gap-2",children:[E.jsx("input",{type:"text",autoFocus:!0,placeholder:"Size (px or %)...",value:g,onChange:N=>e({width:N.target.value}),onKeyDown:N=>{N.key==="Enter"&&R()},className:"bg-obsidian border border-smoke/50 rounded-lg px-3 py-1 text-xs text-bone focus:outline-none focus:border-amber w-32"}),E.jsx("button",{onMouseDown:N=>{N.preventDefault(),R()},className:"text-[10px] text-amber uppercase font-bold px-1",children:"Done"})]}):E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:"flex px-1 items-center gap-0.5",children:[E.jsx("button",{onMouseDown:N=>{N.preventDefault(),e({width:"100%"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-all",title:"Full Width",children:E.jsx(X.Maximize,{className:"w-4 h-4"})}),E.jsx("button",{onMouseDown:N=>{N.preventDefault(),f(!0)},className:"text-[10px] font-bold text-bone hover:text-amber px-2 py-1 transition-all",children:"Size"})]}),E.jsxs("div",{className:"flex px-1 items-center gap-0.5",children:[E.jsx("button",{onMouseDown:N=>{N.preventDefault(),e({align:"left"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",children:E.jsx(X.AlignLeft,{className:"w-4 h-4"})}),E.jsx("button",{onMouseDown:N=>{N.preventDefault(),e({align:"center"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",children:E.jsx(X.AlignCenter,{className:"w-4 h-4"})}),E.jsx("button",{onMouseDown:N=>{N.preventDefault(),e({align:"right"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",children:E.jsx(X.AlignRight,{className:"w-4 h-4"})})]}),E.jsxs("div",{className:"flex px-1 items-center gap-0.5",children:[E.jsx("button",{onMouseDown:N=>{N.preventDefault(),d(!0)},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",title:"Caption",children:E.jsx(X.Type,{className:"w-4 h-4"})}),E.jsx("button",{onMouseDown:N=>{N.preventDefault(),c(!0)},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",title:"Alt Text / Title",children:"Alt"}),E.jsx("button",{onMouseDown:N=>{N.preventDefault(),n()},className:"p-2 text-red-500 hover:text-red-400 hover:bg-red-500/10 rounded-lg transition-colors",children:E.jsx(X.Trash2,{className:"w-4 h-4"})})]})]})})]})},QA=Ye.create({name:"tweet",group:"block",atom:!0,addAttributes(){return{tweetId:{default:null},url:{default:null},align:{default:"center"},width:{default:"100%"},caption:{default:""},captionPosition:{default:"below"},alt:{default:""}}},parseHTML(){return[{tag:'div[data-type="tweet"]',getAttrs:t=>{if(typeof t=="string")return!1;const e=t.getAttribute("data-url")||"";return e&&!/^https?:\/\/(www\.)?(twitter|x)\.com\//i.test(e)?!1:null}},{tag:"blockquote.twitter-tweet"}]},renderHTML({HTMLAttributes:t}){const e=t.url||"";return e&&!/^https?:\/\/(www\.)?(twitter|x)\.com\//i.test(e)?["div"]:["div",Ae(t,{"data-type":"tweet","data-url":e})]},addNodeView(){return hi(ZA)}});function eC(t){let e=t||"";return e=e.split("?")[0].split("#")[0],e=e.replace(/(\/embed\/?)+$/,""),e=e.replace("/reels/","/reel/"),e.includes("instagram.com")&&!e.includes("www.instagram.com")&&(e=e.replace("instagram.com","www.instagram.com")),e.endsWith("/")||(e+="/"),e}const tC=({node:t,updateAttributes:e,deleteNode:n,selected:r,editor:i})=>{const[s,o]=W.useState(!1),[a,l]=W.useState(!1),[c,u]=W.useState(!1),d=t.attrs.align||"center",p=t.attrs.width||"100%",f=t.attrs.caption||"",h=t.attrs.captionPosition||"below",m=t.attrs.alt||"",g=t.attrs.url||"",y=eC(g);let w="w-full relative my-8 flex flex-col outline-none group cursor-pointer ";d==="left"?w+="items-start mr-auto ml-0":d==="right"?w+="items-end ml-auto mr-0":w+="items-center mx-auto";const S=()=>{let b=String(p).trim();if(b.endsWith("%")){const x=parseInt(b.replace("%",""),10);!isNaN(x)&&x<30&&(b="30%")}else{const x=parseInt(b.replace("px",""),10);!isNaN(x)&&x<250?b="250px":!isNaN(x)&&!b.endsWith("px")&&(b=`${x}px`)}e({width:b}),u(!1)};return E.jsxs(pi,{className:w,children:[f&&h==="above"&&E.jsx("p",{className:"text-steel text-xs md:text-sm italic mb-3 uppercase tracking-widest font-medium px-2",children:f}),E.jsxs("div",{style:{width:p},className:`w-full max-w-[540px] min-w-[250px] rounded-2xl bg-charcoal/40 border border-smoke/30 p-6 flex flex-col items-center gap-4 transition-all duration-300 relative ${r?"ring-4 ring-amber ring-offset-4 ring-offset-obsidian":""}`,title:m,children:[i.isEditable&&E.jsx("div",{className:"absolute inset-0 z-10 cursor-pointer",title:"Click to edit embed"}),E.jsx("div",{className:`w-16 h-16 rounded-2xl bg-gradient-to-tr from-[#f9ce34] via-[#ee2a7b] to-[#6228d7] flex items-center justify-center shadow-lg shadow-pink-500/10 ${i.isEditable?"pointer-events-none":""}`,children:E.jsxs("svg",{className:"w-9 h-9 text-white",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[E.jsx("rect",{x:"2",y:"2",width:"20",height:"20",rx:"5",ry:"5"}),E.jsx("path",{d:"M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z"}),E.jsx("line",{x1:"17.5",y1:"6.5",x2:"17.51",y2:"6.5"})]})}),E.jsxs("div",{className:"text-center space-y-1.5 w-full",children:[E.jsx("span",{className:"text-[10px] text-amber uppercase tracking-widest font-bold",children:"Instagram Embed"}),E.jsx("h4",{className:"text-sm font-semibold text-bone truncate max-w-xs mx-auto",title:y,children:y}),E.jsx("p",{className:"text-[11px] text-steel max-w-[280px] mx-auto leading-relaxed",children:"Browser cookie blocking is active in localhost. This embed will hydrate and load beautifully on your live secure HTTPS site!"})]})]}),f&&h==="below"&&E.jsx("p",{className:"text-steel text-xs md:text-sm italic mt-3 uppercase tracking-widest font-medium px-2",children:f}),r&&E.jsx("div",{className:"absolute -top-14 left-1/2 -translate-x-1/2 z-50 bg-charcoal border border-smoke rounded-xl shadow-2xl flex items-center divide-x divide-smoke/30 h-11 px-1",onMouseDown:b=>b.stopPropagation(),onKeyDown:b=>b.stopPropagation(),children:s?E.jsxs("div",{className:"flex items-center px-2 py-1 gap-2",children:[E.jsx("input",{type:"text",autoFocus:!0,placeholder:"Alt text / Title...",value:m,onChange:b=>e({alt:b.target.value}),onKeyDown:b=>{b.key==="Enter"&&o(!1)},className:"bg-obsidian border border-smoke/50 rounded-lg px-3 py-1 text-xs text-bone focus:outline-none focus:border-amber w-40"}),E.jsx("button",{onMouseDown:b=>{b.preventDefault(),o(!1)},className:"text-[10px] text-amber uppercase font-bold px-1",children:"Done"})]}):a?E.jsxs("div",{className:"flex items-center px-2 py-1 gap-2",children:[E.jsx("input",{type:"text",autoFocus:!0,placeholder:"Caption...",value:f,onChange:b=>e({caption:b.target.value}),onKeyDown:b=>{b.key==="Enter"&&l(!1)},className:"bg-obsidian border border-smoke/50 rounded-lg px-3 py-1 text-xs text-bone focus:outline-none focus:border-amber w-40"}),E.jsx("button",{onMouseDown:b=>{b.preventDefault(),e({captionPosition:h==="above"?"below":"above"})},className:"p-1.5 text-steel hover:text-amber rounded",title:"Toggle Position",children:E.jsx(X.Layout,{className:"w-3.5 h-3.5"})}),E.jsx("button",{onMouseDown:b=>{b.preventDefault(),l(!1)},className:"text-[10px] text-amber uppercase font-bold px-1",children:"Done"})]}):c?E.jsxs("div",{className:"flex items-center px-2 py-1 gap-2",children:[E.jsx("input",{type:"text",autoFocus:!0,placeholder:"Size (px or %)...",value:p,onChange:b=>e({width:b.target.value}),onKeyDown:b=>{b.key==="Enter"&&S()},className:"bg-obsidian border border-smoke/50 rounded-lg px-3 py-1 text-xs text-bone focus:outline-none focus:border-amber w-32"}),E.jsx("button",{onMouseDown:b=>{b.preventDefault(),S()},className:"text-[10px] text-amber uppercase font-bold px-1",children:"Done"})]}):E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:"flex px-1 items-center gap-0.5",children:[E.jsx("button",{onMouseDown:b=>{b.preventDefault(),e({width:"100%"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-all",title:"Full Width",children:E.jsx(X.Maximize,{className:"w-4 h-4"})}),E.jsx("button",{onMouseDown:b=>{b.preventDefault(),u(!0)},className:"text-[10px] font-bold text-bone hover:text-amber px-2 py-1 transition-all",children:"Size"})]}),E.jsxs("div",{className:"flex px-1 items-center gap-0.5",children:[E.jsx("button",{onMouseDown:b=>{b.preventDefault(),e({align:"left"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",children:E.jsx(X.AlignLeft,{className:"w-4 h-4"})}),E.jsx("button",{onMouseDown:b=>{b.preventDefault(),e({align:"center"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",children:E.jsx(X.AlignCenter,{className:"w-4 h-4"})}),E.jsx("button",{onMouseDown:b=>{b.preventDefault(),e({align:"right"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",children:E.jsx(X.AlignRight,{className:"w-4 h-4"})})]}),E.jsxs("div",{className:"flex px-1 items-center gap-0.5",children:[E.jsx("button",{onMouseDown:b=>{b.preventDefault(),l(!0)},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",title:"Caption",children:E.jsx(X.Type,{className:"w-4 h-4"})}),E.jsx("button",{onMouseDown:b=>{b.preventDefault(),o(!0)},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",title:"Alt Text / Title",children:"Alt"}),E.jsx("button",{onMouseDown:b=>{b.preventDefault(),n()},className:"p-2 text-red-500 hover:text-red-400 hover:bg-red-500/10 rounded-lg transition-colors",children:E.jsx(X.Trash2,{className:"w-4 h-4"})})]})]})})]})},nC=Ye.create({name:"instagram",group:"block",atom:!0,addAttributes(){return{url:{default:null},align:{default:"center"},width:{default:"100%"},caption:{default:""},captionPosition:{default:"below"},alt:{default:""}}},parseHTML(){return[{tag:'div[data-type="instagram"]',getAttrs:t=>{if(typeof t=="string")return!1;const e=t.getAttribute("data-url")||"";return e&&!/^https?:\/\/(www\.)?instagram\.com\//i.test(e)?!1:null}},{tag:"blockquote.instagram-media"}]},renderHTML({HTMLAttributes:t}){const e=t.url||"";return e&&!/^https?:\/\/(www\.)?instagram\.com\//i.test(e)?["div"]:["div",Ae(t,{"data-type":"instagram","data-url":e})]},addNodeView(){return hi(tC)}}),rC=({deleteNode:t,selected:e,editor:n})=>E.jsxs(pi,{className:`my-6 relative transition-all duration-300 rounded-xl overflow-hidden border-2
|
|
209
|
-
${e?"border-amber shadow-[0_0_15px_rgba(255,191,0,0.2)]":"border-amber/40 border-dashed hover:border-amber/70"}`,children:[E.jsxs("div",{className:"bg-amber/10 px-4 py-2 border-b border-amber/20 flex items-center justify-between select-none",children:[E.jsxs("div",{className:"flex items-center gap-2 text-amber font-display font-semibold tracking-wide text-sm",children:[E.jsx(X.Archive,{className:"w-4 h-4"}),E.jsxs("span",{children:["STASHED NOTE ",E.jsx("span",{className:"opacity-60 text-xs ml-1",children:"(Internal Only)"})]})]}),n.isEditable&&E.jsx("button",{onClick:t,className:"p-1.5 text-amber/60 hover:text-red-400 hover:bg-red-400/10 rounded-lg transition-colors",title:"Delete Stash",children:E.jsx(X.Trash2,{className:"w-4 h-4"})})]}),E.jsx("div",{className:"bg-charcoal/50 p-4 md:p-6 text-bone/90 prose-p:my-2 first:prose-p:mt-0 last:prose-p:mb-0",children:E.jsx(Gm,{className:"min-h-[2rem]"})})]}),iC=Ye.create({name:"stash",group:"block",content:"block+",defining:!0,parseHTML(){return[{tag:'div[data-type="stash"]'}]},renderHTML({HTMLAttributes:t}){return["div",Ae(t,{"data-type":"stash"}),0]},addNodeView(){return hi(rC)}}),sC=({node:t,updateAttributes:e,selected:n})=>{const{emoji:r,type:i}=t.attrs,s={info:"bg-blue-500/10 border-blue-500/30 text-blue-100",warning:"bg-amber-500/10 border-amber-500/30 text-amber-100",success:"bg-emerald-500/10 border-emerald-500/30 text-emerald-100",error:"bg-red-500/10 border-red-500/30 text-red-100"},o=s[i]||s.info,a=()=>{const l=["💡","⚠️","✅","❌","🔥","📌","✨"],c=l.indexOf(r),u=l[(c+1)%l.length];let d="info";u==="⚠️"&&(d="warning"),u==="✅"&&(d="success"),u==="❌"&&(d="error"),e({emoji:u,type:d})};return E.jsxs(pi,{className:`my-6 flex gap-4 p-4 md:p-5 rounded-2xl border transition-all duration-300
|
|
210
|
-
${o}
|
|
211
|
-
${n?"ring-2 ring-white/20 shadow-lg":"shadow-md"}
|
|
212
|
-
`,children:[E.jsx("button",{contentEditable:!1,onClick:a,className:"text-2xl shrink-0 mt-0.5 hover:scale-110 active:scale-95 transition-transform select-none cursor-pointer",title:"Change Icon",children:r}),E.jsx("div",{className:"flex-1 font-medium leading-relaxed",children:E.jsx(Gm,{className:"min-h-[1.5rem]"})})]})},oC=Ye.create({name:"callout",group:"block",content:"inline*",defining:!0,addAttributes(){return{emoji:{default:"💡"},type:{default:"info"}}},parseHTML(){return[{tag:'div[data-type="callout"]'}]},renderHTML({HTMLAttributes:t}){return["div",Ae(t,{"data-type":"callout"}),0]},addNodeView(){return hi(sC)}});function aC(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:s,startOfLine:o,$position:a}=t,l=r&&!i,c=pw(n),u=new RegExp(`\\s${c}$`),d=o?"^":"",p=i?"":c,f=l?new RegExp(`${d}${c}.*?(?=\\s${p}|$)`,"gm"):new RegExp(`${d}(?:^)?${c}[^\\s${p}]*`,"gm"),h=((e=a.nodeBefore)==null?void 0:e.isText)&&a.nodeBefore.text;if(!h)return null;const m=a.pos-h.length,g=Array.from(h.matchAll(f)).pop();if(!g||g.input===void 0||g.index===void 0)return null;const y=g.input.slice(Math.max(0,g.index-1),g.index),w=new RegExp(`^[${s==null?void 0:s.join("")}\0]?$`).test(y);if(s!==null&&!w)return null;const S=m+g.index;let b=S+g[0].length;return l&&u.test(h.slice(b-1,b+1))&&(g[0]+=" ",b+=1),S<a.pos&&b>=a.pos?{range:{from:S,to:b},query:g[0].slice(n.length),text:g[0]}:null}function lC(t){return t.docChanged?t.steps.some(e=>{const n=e.slice;if(!(n!=null&&n.content))return!1;const r=n.content.textBetween(0,n.content.size,`
|
|
213
|
-
`);return/\s/.test(r)}):!1}var cC=new ze("suggestion");function uC({pluginKey:t=cC,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:s=[" "],startOfLine:o=!1,decorationTag:a="span",decorationClass:l="suggestion",decorationContent:c="",decorationEmptyClass:u="is-empty",command:d=()=>null,items:p=()=>[],render:f=()=>({}),allow:h=()=>!0,findSuggestionMatch:m=aC,shouldShow:g,shouldResetDismissed:y}){let w;const S=f==null?void 0:f(),b=r&&!i,x=()=>{const O=e.state.selection.$anchor.pos,j=e.view.coordsAtPos(O),{top:V,right:U,bottom:B,left:H}=j;try{return new DOMRect(H,V,U-H,B-V)}catch{return null}},T=(O,j)=>j?()=>{const V=t.getState(e.state),U=V==null?void 0:V.decorationId,B=O.dom.querySelector(`[data-decoration-id="${U}"]`);return(B==null?void 0:B.getBoundingClientRect())||null}:x,k=({match:O,dismissedRange:j,state:V,transaction:U})=>y!=null&&y({editor:e,state:V,range:j,match:O,transaction:U,allowSpaces:b})?!1:b?O.range.from===j.from:O.range.from===j.from&&!lC(U);function R(O,j){var V;try{const B=t.getState(O.state),H=B!=null&&B.decorationId?O.dom.querySelector(`[data-decoration-id="${B.decorationId}"]`):null,_={editor:e,range:(B==null?void 0:B.range)||{from:0,to:0},query:(B==null?void 0:B.query)||null,text:(B==null?void 0:B.text)||null,items:[],command:D=>d({editor:e,range:(B==null?void 0:B.range)||{from:0,to:0},props:D}),decorationNode:H,clientRect:T(O,H)};(V=S==null?void 0:S.onExit)==null||V.call(S,_)}catch{}const U=O.state.tr.setMeta(j,{exit:!0});O.dispatch(U)}const N=new Me({key:t,view(){return{update:async(O,j)=>{var V,U,B,H,_,D,L;const I=(V=this.key)==null?void 0:V.getState(j),Q=(U=this.key)==null?void 0:U.getState(O.state),A=I.active&&Q.active&&I.range.from!==Q.range.from,z=!I.active&&Q.active,se=I.active&&!Q.active,ne=!z&&!se&&I.query!==Q.query,de=z||A&&ne,oe=ne||A,fe=se||A&≠if(!de&&!oe&&!fe)return;const ie=fe&&!de?I:Q,$e=O.dom.querySelector(`[data-decoration-id="${ie.decorationId}"]`);w={editor:e,range:ie.range,query:ie.query,text:ie.text,items:[],command:ge=>d({editor:e,range:ie.range,props:ge}),decorationNode:$e,clientRect:T(O,$e)},de&&((B=S==null?void 0:S.onBeforeStart)==null||B.call(S,w)),oe&&((H=S==null?void 0:S.onBeforeUpdate)==null||H.call(S,w)),(oe||de)&&(w.items=await p({editor:e,query:ie.query})),fe&&((_=S==null?void 0:S.onExit)==null||_.call(S,w)),oe&&((D=S==null?void 0:S.onUpdate)==null||D.call(S,w)),de&&((L=S==null?void 0:S.onStart)==null||L.call(S,w))},destroy:()=>{var O;w&&((O=S==null?void 0:S.onExit)==null||O.call(S,w))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(O,j,V,U){const{isEditable:B}=e,{composing:H}=e.view,{selection:_}=O,{empty:D,from:L}=_,I={...j},Q=O.getMeta(t);if(Q&&Q.exit)return I.active=!1,I.decorationId=null,I.range={from:0,to:0},I.query=null,I.text=null,I.dismissedRange=j.active?{...j.range}:j.dismissedRange,I;if(I.composing=H,O.docChanged&&I.dismissedRange!==null&&(I.dismissedRange={from:O.mapping.map(I.dismissedRange.from),to:O.mapping.map(I.dismissedRange.to)}),B&&(D||e.view.composing)){(L<j.range.from||L>j.range.to)&&!H&&!j.composing&&(I.active=!1);const A=m({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:s,startOfLine:o,$position:_.$from}),z=`id_${Math.floor(Math.random()*4294967295)}`;A&&h({editor:e,state:U,range:A.range,isActive:j.active})&&(!g||g({editor:e,range:A.range,query:A.query,text:A.text,transaction:O}))?(I.dismissedRange!==null&&!k({match:A,dismissedRange:I.dismissedRange,state:U,transaction:O})&&(I.dismissedRange=null),I.dismissedRange===null?(I.active=!0,I.decorationId=j.decorationId?j.decorationId:z,I.range=A.range,I.query=A.query,I.text=A.text):I.active=!1):(A||(I.dismissedRange=null),I.active=!1)}else I.active=!1;return I.active||(I.decorationId=null,I.range={from:0,to:0},I.query=null,I.text=null),I}},props:{handleKeyDown(O,j){var V,U;const{active:B,range:H}=N.getState(O.state);if(!B)return!1;if(j.key==="Escape"||j.key==="Esc"){const D=N.getState(O.state);return(V=S==null?void 0:S.onKeyDown)==null||V.call(S,{view:O,event:j,range:D.range}),R(O,t),!0}return((U=S==null?void 0:S.onKeyDown)==null?void 0:U.call(S,{view:O,event:j,range:H}))||!1},decorations(O){const{active:j,range:V,decorationId:U,query:B}=N.getState(O);if(!j)return null;const H=!(B!=null&&B.length),_=[l];return H&&_.push(u),Ce.create(O.doc,[Qe.inline(V.from,V.to,{nodeName:a,class:_.join(" "),"data-decoration-id":U,"data-decoration-content":c})])}}});return N}var dC=uC,At="top",qt="bottom",Gt="right",Ct="left",yu="auto",Cs=[At,qt,Gt,Ct],ai="start",xs="end",fC="clippingParents",Mb="viewport",ki="popper",pC="reference",op=Cs.reduce(function(t,e){return t.concat([e+"-"+ai,e+"-"+xs])},[]),Ob=[].concat(Cs,[yu]).reduce(function(t,e){return t.concat([e,e+"-"+ai,e+"-"+xs])},[]),hC="beforeRead",mC="read",gC="afterRead",bC="beforeMain",yC="main",EC="afterMain",vC="beforeWrite",xC="write",wC="afterWrite",SC=[hC,mC,gC,bC,yC,EC,vC,xC,wC];function fn(t){return t?(t.nodeName||"").toLowerCase():null}function Lt(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function vr(t){var e=Lt(t).Element;return t instanceof e||t instanceof Element}function Vt(t){var e=Lt(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function Eu(t){if(typeof ShadowRoot>"u")return!1;var e=Lt(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function kC(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},i=e.attributes[n]||{},s=e.elements[n];!Vt(s)||!fn(s)||(Object.assign(s.style,r),Object.keys(i).forEach(function(o){var a=i[o];a===!1?s.removeAttribute(o):s.setAttribute(o,a===!0?"":a)}))})}function TC(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var i=e.elements[r],s=e.attributes[r]||{},o=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),a=o.reduce(function(l,c){return l[c]="",l},{});!Vt(i)||!fn(i)||(Object.assign(i.style,a),Object.keys(s).forEach(function(l){i.removeAttribute(l)}))})}}const Rb={name:"applyStyles",enabled:!0,phase:"write",fn:kC,effect:TC,requires:["computeStyles"]};function cn(t){return t.split("-")[0]}var pr=Math.max,da=Math.min,li=Math.round;function mc(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function Ib(){return!/^((?!chrome|android).)*safari/i.test(mc())}function ci(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),i=1,s=1;e&&Vt(t)&&(i=t.offsetWidth>0&&li(r.width)/t.offsetWidth||1,s=t.offsetHeight>0&&li(r.height)/t.offsetHeight||1);var o=vr(t)?Lt(t):window,a=o.visualViewport,l=!Ib()&&n,c=(r.left+(l&&a?a.offsetLeft:0))/i,u=(r.top+(l&&a?a.offsetTop:0))/s,d=r.width/i,p=r.height/s;return{width:d,height:p,top:u,right:c+d,bottom:u+p,left:c,x:c,y:u}}function vu(t){var e=ci(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function Db(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&Eu(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Nn(t){return Lt(t).getComputedStyle(t)}function NC(t){return["table","td","th"].indexOf(fn(t))>=0}function Yn(t){return((vr(t)?t.ownerDocument:t.document)||window.document).documentElement}function Ma(t){return fn(t)==="html"?t:t.assignedSlot||t.parentNode||(Eu(t)?t.host:null)||Yn(t)}function ap(t){return!Vt(t)||Nn(t).position==="fixed"?null:t.offsetParent}function _C(t){var e=/firefox/i.test(mc()),n=/Trident/i.test(mc());if(n&&Vt(t)){var r=Nn(t);if(r.position==="fixed")return null}var i=Ma(t);for(Eu(i)&&(i=i.host);Vt(i)&&["html","body"].indexOf(fn(i))<0;){var s=Nn(i);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return i;i=i.parentNode}return null}function Ms(t){for(var e=Lt(t),n=ap(t);n&&NC(n)&&Nn(n).position==="static";)n=ap(n);return n&&(fn(n)==="html"||fn(n)==="body"&&Nn(n).position==="static")?e:n||_C(t)||e}function xu(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function ts(t,e,n){return pr(t,da(e,n))}function AC(t,e,n){var r=ts(t,e,n);return r>n?n:r}function Lb(){return{top:0,right:0,bottom:0,left:0}}function Pb(t){return Object.assign({},Lb(),t)}function Bb(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var CC=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,Pb(typeof e!="number"?e:Bb(e,Cs))};function MC(t){var e,n=t.state,r=t.name,i=t.options,s=n.elements.arrow,o=n.modifiersData.popperOffsets,a=cn(n.placement),l=xu(a),c=[Ct,Gt].indexOf(a)>=0,u=c?"height":"width";if(!(!s||!o)){var d=CC(i.padding,n),p=vu(s),f=l==="y"?At:Ct,h=l==="y"?qt:Gt,m=n.rects.reference[u]+n.rects.reference[l]-o[l]-n.rects.popper[u],g=o[l]-n.rects.reference[l],y=Ms(s),w=y?l==="y"?y.clientHeight||0:y.clientWidth||0:0,S=m/2-g/2,b=d[f],x=w-p[u]-d[h],T=w/2-p[u]/2+S,k=ts(b,T,x),R=l;n.modifiersData[r]=(e={},e[R]=k,e.centerOffset=k-T,e)}}function OC(t){var e=t.state,n=t.options,r=n.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||Db(e.elements.popper,i)&&(e.elements.arrow=i))}const RC={name:"arrow",enabled:!0,phase:"main",fn:MC,effect:OC,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ui(t){return t.split("-")[1]}var IC={top:"auto",right:"auto",bottom:"auto",left:"auto"};function DC(t,e){var n=t.x,r=t.y,i=e.devicePixelRatio||1;return{x:li(n*i)/i||0,y:li(r*i)/i||0}}function lp(t){var e,n=t.popper,r=t.popperRect,i=t.placement,s=t.variation,o=t.offsets,a=t.position,l=t.gpuAcceleration,c=t.adaptive,u=t.roundOffsets,d=t.isFixed,p=o.x,f=p===void 0?0:p,h=o.y,m=h===void 0?0:h,g=typeof u=="function"?u({x:f,y:m}):{x:f,y:m};f=g.x,m=g.y;var y=o.hasOwnProperty("x"),w=o.hasOwnProperty("y"),S=Ct,b=At,x=window;if(c){var T=Ms(n),k="clientHeight",R="clientWidth";if(T===Lt(n)&&(T=Yn(n),Nn(T).position!=="static"&&a==="absolute"&&(k="scrollHeight",R="scrollWidth")),T=T,i===At||(i===Ct||i===Gt)&&s===xs){b=qt;var N=d&&T===x&&x.visualViewport?x.visualViewport.height:T[k];m-=N-r.height,m*=l?1:-1}if(i===Ct||(i===At||i===qt)&&s===xs){S=Gt;var O=d&&T===x&&x.visualViewport?x.visualViewport.width:T[R];f-=O-r.width,f*=l?1:-1}}var j=Object.assign({position:a},c&&IC),V=u===!0?DC({x:f,y:m},Lt(n)):{x:f,y:m};if(f=V.x,m=V.y,l){var U;return Object.assign({},j,(U={},U[b]=w?"0":"",U[S]=y?"0":"",U.transform=(x.devicePixelRatio||1)<=1?"translate("+f+"px, "+m+"px)":"translate3d("+f+"px, "+m+"px, 0)",U))}return Object.assign({},j,(e={},e[b]=w?m+"px":"",e[S]=y?f+"px":"",e.transform="",e))}function LC(t){var e=t.state,n=t.options,r=n.gpuAcceleration,i=r===void 0?!0:r,s=n.adaptive,o=s===void 0?!0:s,a=n.roundOffsets,l=a===void 0?!0:a,c={placement:cn(e.placement),variation:ui(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,lp(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,lp(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const PC={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:LC,data:{}};var io={passive:!0};function BC(t){var e=t.state,n=t.instance,r=t.options,i=r.scroll,s=i===void 0?!0:i,o=r.resize,a=o===void 0?!0:o,l=Lt(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&c.forEach(function(u){u.addEventListener("scroll",n.update,io)}),a&&l.addEventListener("resize",n.update,io),function(){s&&c.forEach(function(u){u.removeEventListener("scroll",n.update,io)}),a&&l.removeEventListener("resize",n.update,io)}}const FC={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:BC,data:{}};var zC={left:"right",right:"left",bottom:"top",top:"bottom"};function Eo(t){return t.replace(/left|right|bottom|top/g,function(e){return zC[e]})}var $C={start:"end",end:"start"};function cp(t){return t.replace(/start|end/g,function(e){return $C[e]})}function wu(t){var e=Lt(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Su(t){return ci(Yn(t)).left+wu(t).scrollLeft}function UC(t,e){var n=Lt(t),r=Yn(t),i=n.visualViewport,s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;var c=Ib();(c||!c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a+Su(t),y:l}}function HC(t){var e,n=Yn(t),r=wu(t),i=(e=t.ownerDocument)==null?void 0:e.body,s=pr(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),o=pr(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-r.scrollLeft+Su(t),l=-r.scrollTop;return Nn(i||n).direction==="rtl"&&(a+=pr(n.clientWidth,i?i.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}function ku(t){var e=Nn(t),n=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function Fb(t){return["html","body","#document"].indexOf(fn(t))>=0?t.ownerDocument.body:Vt(t)&&ku(t)?t:Fb(Ma(t))}function ns(t,e){var n;e===void 0&&(e=[]);var r=Fb(t),i=r===((n=t.ownerDocument)==null?void 0:n.body),s=Lt(r),o=i?[s].concat(s.visualViewport||[],ku(r)?r:[]):r,a=e.concat(o);return i?a:a.concat(ns(Ma(o)))}function gc(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function jC(t,e){var n=ci(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function up(t,e,n){return e===Mb?gc(UC(t,n)):vr(e)?jC(e,n):gc(HC(Yn(t)))}function VC(t){var e=ns(Ma(t)),n=["absolute","fixed"].indexOf(Nn(t).position)>=0,r=n&&Vt(t)?Ms(t):t;return vr(r)?e.filter(function(i){return vr(i)&&Db(i,r)&&fn(i)!=="body"}):[]}function WC(t,e,n,r){var i=e==="clippingParents"?VC(t):[].concat(e),s=[].concat(i,[n]),o=s[0],a=s.reduce(function(l,c){var u=up(t,c,r);return l.top=pr(u.top,l.top),l.right=da(u.right,l.right),l.bottom=da(u.bottom,l.bottom),l.left=pr(u.left,l.left),l},up(t,o,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function zb(t){var e=t.reference,n=t.element,r=t.placement,i=r?cn(r):null,s=r?ui(r):null,o=e.x+e.width/2-n.width/2,a=e.y+e.height/2-n.height/2,l;switch(i){case At:l={x:o,y:e.y-n.height};break;case qt:l={x:o,y:e.y+e.height};break;case Gt:l={x:e.x+e.width,y:a};break;case Ct:l={x:e.x-n.width,y:a};break;default:l={x:e.x,y:e.y}}var c=i?xu(i):null;if(c!=null){var u=c==="y"?"height":"width";switch(s){case ai:l[c]=l[c]-(e[u]/2-n[u]/2);break;case xs:l[c]=l[c]+(e[u]/2-n[u]/2);break}}return l}function ws(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=r===void 0?t.placement:r,s=n.strategy,o=s===void 0?t.strategy:s,a=n.boundary,l=a===void 0?fC:a,c=n.rootBoundary,u=c===void 0?Mb:c,d=n.elementContext,p=d===void 0?ki:d,f=n.altBoundary,h=f===void 0?!1:f,m=n.padding,g=m===void 0?0:m,y=Pb(typeof g!="number"?g:Bb(g,Cs)),w=p===ki?pC:ki,S=t.rects.popper,b=t.elements[h?w:p],x=WC(vr(b)?b:b.contextElement||Yn(t.elements.popper),l,u,o),T=ci(t.elements.reference),k=zb({reference:T,element:S,placement:i}),R=gc(Object.assign({},S,k)),N=p===ki?R:T,O={top:x.top-N.top+y.top,bottom:N.bottom-x.bottom+y.bottom,left:x.left-N.left+y.left,right:N.right-x.right+y.right},j=t.modifiersData.offset;if(p===ki&&j){var V=j[i];Object.keys(O).forEach(function(U){var B=[Gt,qt].indexOf(U)>=0?1:-1,H=[At,qt].indexOf(U)>=0?"y":"x";O[U]+=V[H]*B})}return O}function KC(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=n.boundary,s=n.rootBoundary,o=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,c=l===void 0?Ob:l,u=ui(r),d=u?a?op:op.filter(function(h){return ui(h)===u}):Cs,p=d.filter(function(h){return c.indexOf(h)>=0});p.length===0&&(p=d);var f=p.reduce(function(h,m){return h[m]=ws(t,{placement:m,boundary:i,rootBoundary:s,padding:o})[cn(m)],h},{});return Object.keys(f).sort(function(h,m){return f[h]-f[m]})}function qC(t){if(cn(t)===yu)return[];var e=Eo(t);return[cp(t),e,cp(e)]}function GC(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var i=n.mainAxis,s=i===void 0?!0:i,o=n.altAxis,a=o===void 0?!0:o,l=n.fallbackPlacements,c=n.padding,u=n.boundary,d=n.rootBoundary,p=n.altBoundary,f=n.flipVariations,h=f===void 0?!0:f,m=n.allowedAutoPlacements,g=e.options.placement,y=cn(g),w=y===g,S=l||(w||!h?[Eo(g)]:qC(g)),b=[g].concat(S).reduce(function(ne,de){return ne.concat(cn(de)===yu?KC(e,{placement:de,boundary:u,rootBoundary:d,padding:c,flipVariations:h,allowedAutoPlacements:m}):de)},[]),x=e.rects.reference,T=e.rects.popper,k=new Map,R=!0,N=b[0],O=0;O<b.length;O++){var j=b[O],V=cn(j),U=ui(j)===ai,B=[At,qt].indexOf(V)>=0,H=B?"width":"height",_=ws(e,{placement:j,boundary:u,rootBoundary:d,altBoundary:p,padding:c}),D=B?U?Gt:Ct:U?qt:At;x[H]>T[H]&&(D=Eo(D));var L=Eo(D),I=[];if(s&&I.push(_[V]<=0),a&&I.push(_[D]<=0,_[L]<=0),I.every(function(ne){return ne})){N=j,R=!1;break}k.set(j,I)}if(R)for(var Q=h?3:1,A=function(de){var oe=b.find(function(fe){var ie=k.get(fe);if(ie)return ie.slice(0,de).every(function($e){return $e})});if(oe)return N=oe,"break"},z=Q;z>0;z--){var se=A(z);if(se==="break")break}e.placement!==N&&(e.modifiersData[r]._skip=!0,e.placement=N,e.reset=!0)}}const YC={name:"flip",enabled:!0,phase:"main",fn:GC,requiresIfExists:["offset"],data:{_skip:!1}};function dp(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function fp(t){return[At,Gt,qt,Ct].some(function(e){return t[e]>=0})}function JC(t){var e=t.state,n=t.name,r=e.rects.reference,i=e.rects.popper,s=e.modifiersData.preventOverflow,o=ws(e,{elementContext:"reference"}),a=ws(e,{altBoundary:!0}),l=dp(o,r),c=dp(a,i,s),u=fp(l),d=fp(c);e.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}const XC={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:JC};function ZC(t,e,n){var r=cn(t),i=[Ct,At].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,o=s[0],a=s[1];return o=o||0,a=(a||0)*i,[Ct,Gt].indexOf(r)>=0?{x:a,y:o}:{x:o,y:a}}function QC(t){var e=t.state,n=t.options,r=t.name,i=n.offset,s=i===void 0?[0,0]:i,o=Ob.reduce(function(u,d){return u[d]=ZC(d,e.rects,s),u},{}),a=o[e.placement],l=a.x,c=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=o}const eM={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:QC};function tM(t){var e=t.state,n=t.name;e.modifiersData[n]=zb({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})}const nM={name:"popperOffsets",enabled:!0,phase:"read",fn:tM,data:{}};function rM(t){return t==="x"?"y":"x"}function iM(t){var e=t.state,n=t.options,r=t.name,i=n.mainAxis,s=i===void 0?!0:i,o=n.altAxis,a=o===void 0?!1:o,l=n.boundary,c=n.rootBoundary,u=n.altBoundary,d=n.padding,p=n.tether,f=p===void 0?!0:p,h=n.tetherOffset,m=h===void 0?0:h,g=ws(e,{boundary:l,rootBoundary:c,padding:d,altBoundary:u}),y=cn(e.placement),w=ui(e.placement),S=!w,b=xu(y),x=rM(b),T=e.modifiersData.popperOffsets,k=e.rects.reference,R=e.rects.popper,N=typeof m=="function"?m(Object.assign({},e.rects,{placement:e.placement})):m,O=typeof N=="number"?{mainAxis:N,altAxis:N}:Object.assign({mainAxis:0,altAxis:0},N),j=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,V={x:0,y:0};if(T){if(s){var U,B=b==="y"?At:Ct,H=b==="y"?qt:Gt,_=b==="y"?"height":"width",D=T[b],L=D+g[B],I=D-g[H],Q=f?-R[_]/2:0,A=w===ai?k[_]:R[_],z=w===ai?-R[_]:-k[_],se=e.elements.arrow,ne=f&&se?vu(se):{width:0,height:0},de=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Lb(),oe=de[B],fe=de[H],ie=ts(0,k[_],ne[_]),$e=S?k[_]/2-Q-ie-oe-O.mainAxis:A-ie-oe-O.mainAxis,ge=S?-k[_]/2+Q+ie+fe+O.mainAxis:z+ie+fe+O.mainAxis,at=e.elements.arrow&&Ms(e.elements.arrow),Ot=at?b==="y"?at.clientTop||0:at.clientLeft||0:0,Ue=(U=j==null?void 0:j[b])!=null?U:0,Pt=D+$e-Ue-Ot,He=D+ge-Ue,ye=ts(f?da(L,Pt):L,D,f?pr(I,He):I);T[b]=ye,V[b]=ye-D}if(a){var tt,Y=b==="x"?At:Ct,pt=b==="x"?qt:Gt,Ee=T[x],pe=x==="y"?"height":"width",St=Ee+g[Y],Le=Ee-g[pt],kt=[At,Ct].indexOf(y)!==-1,Rt=(tt=j==null?void 0:j[x])!=null?tt:0,$=kt?St:Ee-k[pe]-R[pe]-Rt+O.altAxis,q=kt?Ee+k[pe]+R[pe]-Rt-O.altAxis:Le,ae=f&&kt?AC($,Ee,q):ts(f?$:St,Ee,f?q:Le);T[x]=ae,V[x]=ae-Ee}e.modifiersData[r]=V}}const sM={name:"preventOverflow",enabled:!0,phase:"main",fn:iM,requiresIfExists:["offset"]};function oM(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function aM(t){return t===Lt(t)||!Vt(t)?wu(t):oM(t)}function lM(t){var e=t.getBoundingClientRect(),n=li(e.width)/t.offsetWidth||1,r=li(e.height)/t.offsetHeight||1;return n!==1||r!==1}function cM(t,e,n){n===void 0&&(n=!1);var r=Vt(e),i=Vt(e)&&lM(e),s=Yn(e),o=ci(t,i,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((fn(e)!=="body"||ku(s))&&(a=aM(e)),Vt(e)?(l=ci(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=Su(s))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function uM(t){var e=new Map,n=new Set,r=[];t.forEach(function(s){e.set(s.name,s)});function i(s){n.add(s.name);var o=[].concat(s.requires||[],s.requiresIfExists||[]);o.forEach(function(a){if(!n.has(a)){var l=e.get(a);l&&i(l)}}),r.push(s)}return t.forEach(function(s){n.has(s.name)||i(s)}),r}function dM(t){var e=uM(t);return SC.reduce(function(n,r){return n.concat(e.filter(function(i){return i.phase===r}))},[])}function fM(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function pM(t){var e=t.reduce(function(n,r){var i=n[r.name];return n[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var pp={placement:"bottom",modifiers:[],strategy:"absolute"};function hp(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return!e.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function hM(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,i=e.defaultOptions,s=i===void 0?pp:i;return function(a,l,c){c===void 0&&(c=s);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},pp,s),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},d=[],p=!1,f={state:u,setOptions:function(y){var w=typeof y=="function"?y(u.options):y;m(),u.options=Object.assign({},s,u.options,w),u.scrollParents={reference:vr(a)?ns(a):a.contextElement?ns(a.contextElement):[],popper:ns(l)};var S=dM(pM([].concat(r,u.options.modifiers)));return u.orderedModifiers=S.filter(function(b){return b.enabled}),h(),f.update()},forceUpdate:function(){if(!p){var y=u.elements,w=y.reference,S=y.popper;if(hp(w,S)){u.rects={reference:cM(w,Ms(S),u.options.strategy==="fixed"),popper:vu(S)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(O){return u.modifiersData[O.name]=Object.assign({},O.data)});for(var b=0;b<u.orderedModifiers.length;b++){if(u.reset===!0){u.reset=!1,b=-1;continue}var x=u.orderedModifiers[b],T=x.fn,k=x.options,R=k===void 0?{}:k,N=x.name;typeof T=="function"&&(u=T({state:u,options:R,name:N,instance:f})||u)}}}},update:fM(function(){return new Promise(function(g){f.forceUpdate(),g(u)})}),destroy:function(){m(),p=!0}};if(!hp(a,l))return f;f.setOptions(c).then(function(g){!p&&c.onFirstUpdate&&c.onFirstUpdate(g)});function h(){u.orderedModifiers.forEach(function(g){var y=g.name,w=g.options,S=w===void 0?{}:w,b=g.effect;if(typeof b=="function"){var x=b({state:u,name:y,instance:f,options:S}),T=function(){};d.push(x||T)}})}function m(){d.forEach(function(g){return g()}),d=[]}return f}}var mM=[FC,nM,PC,Rb,eM,YC,sM,RC,XC],gM=hM({defaultModifiers:mM}),bM="tippy-box",$b="tippy-content",yM="tippy-backdrop",Ub="tippy-arrow",Hb="tippy-svg-arrow",er={passive:!0,capture:!0},jb=function(){return document.body};function EM(t,e){return{}.hasOwnProperty.call(t,e)}function kl(t,e,n){if(Array.isArray(t)){var r=t[e];return r??(Array.isArray(n)?n[e]:n)}return t}function Tu(t,e){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(e+"]")>-1}function Vb(t,e){return typeof t=="function"?t.apply(void 0,e):t}function mp(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function vM(t,e){var n=Object.assign({},t);return e.forEach(function(r){delete n[r]}),n}function xM(t){return t.split(/\s+/).filter(Boolean)}function qr(t){return[].concat(t)}function gp(t,e){t.indexOf(e)===-1&&t.push(e)}function wM(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function SM(t){return t.split("-")[0]}function fa(t){return[].slice.call(t)}function bp(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function rs(){return document.createElement("div")}function Ss(t){return["Element","Fragment"].some(function(e){return Tu(t,e)})}function kM(t){return Tu(t,"NodeList")}function TM(t){return Tu(t,"MouseEvent")}function NM(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function _M(t){return Ss(t)?[t]:kM(t)?fa(t):Array.isArray(t)?t:fa(document.querySelectorAll(t))}function Tl(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function yp(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function AM(t){var e,n=qr(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function CM(t,e){var n=e.clientX,r=e.clientY;return t.every(function(i){var s=i.popperRect,o=i.popperState,a=i.props,l=a.interactiveBorder,c=SM(o.placement),u=o.modifiersData.offset;if(!u)return!0;var d=c==="bottom"?u.top.y:0,p=c==="top"?u.bottom.y:0,f=c==="right"?u.left.x:0,h=c==="left"?u.right.x:0,m=s.top-r+d>l,g=r-s.bottom-p>l,y=s.left-n+f>l,w=n-s.right-h>l;return m||g||y||w})}function Nl(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){t[r](i,n)})}function Ep(t,e){for(var n=e;n;){var r;if(t.contains(n))return!0;n=n.getRootNode==null||(r=n.getRootNode())==null?void 0:r.host}return!1}var ln={isTouch:!1},vp=0;function MM(){ln.isTouch||(ln.isTouch=!0,window.performance&&document.addEventListener("mousemove",Wb))}function Wb(){var t=performance.now();t-vp<20&&(ln.isTouch=!1,document.removeEventListener("mousemove",Wb)),vp=t}function OM(){var t=document.activeElement;if(NM(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function RM(){document.addEventListener("touchstart",MM,er),window.addEventListener("blur",OM)}var IM=typeof window<"u"&&typeof document<"u",DM=IM?!!window.msCrypto:!1;function Lr(t){var e=t==="destroy"?"n already-":" ";return[t+"() was called on a"+e+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function xp(t){var e=/[ \t]{2,}/g,n=/^[ \t]*/gm;return t.replace(e," ").replace(n,"").trim()}function LM(t){return xp(`
|
|
214
|
-
%ctippy.js
|
|
215
|
-
|
|
216
|
-
%c`+xp(t)+`
|
|
217
|
-
|
|
218
|
-
%c👷 This is a development-only message. It will be removed in production.
|
|
219
|
-
`)}function Kb(t){return[LM(t),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var ks;process.env.NODE_ENV!=="production"&&PM();function PM(){ks=new Set}function vn(t,e){if(t&&!ks.has(e)){var n;ks.add(e),(n=console).warn.apply(n,Kb(e))}}function bc(t,e){if(t&&!ks.has(e)){var n;ks.add(e),(n=console).error.apply(n,Kb(e))}}function BM(t){var e=!t,n=Object.prototype.toString.call(t)==="[object Object]"&&!t.addEventListener;bc(e,["tippy() was passed","`"+String(t)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),bc(n,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var qb={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},FM={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Dt=Object.assign({appendTo:jb,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},qb,FM),zM=Object.keys(Dt),$M=function(e){process.env.NODE_ENV!=="production"&&Yb(e,[]);var n=Object.keys(e);n.forEach(function(r){Dt[r]=e[r]})};function Gb(t){var e=t.plugins||[],n=e.reduce(function(r,i){var s=i.name,o=i.defaultValue;if(s){var a;r[s]=t[s]!==void 0?t[s]:(a=Dt[s])!=null?a:o}return r},{});return Object.assign({},t,n)}function UM(t,e){var n=e?Object.keys(Gb(Object.assign({},Dt,{plugins:e}))):zM,r=n.reduce(function(i,s){var o=(t.getAttribute("data-tippy-"+s)||"").trim();if(!o)return i;if(s==="content")i[s]=o;else try{i[s]=JSON.parse(o)}catch{i[s]=o}return i},{});return r}function wp(t,e){var n=Object.assign({},e,{content:Vb(e.content,[t])},e.ignoreAttributes?{}:UM(t,e.plugins));return n.aria=Object.assign({},Dt.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?e.interactive:n.aria.expanded,content:n.aria.content==="auto"?e.interactive?null:"describedby":n.aria.content},n}function Yb(t,e){t===void 0&&(t={}),e===void 0&&(e=[]);var n=Object.keys(t);n.forEach(function(r){var i=vM(Dt,Object.keys(qb)),s=!EM(i,r);s&&(s=e.filter(function(o){return o.name===r}).length===0),vn(s,["`"+r+"`","is not a valid prop. You may have spelled it incorrectly, or if it's","a plugin, forgot to pass it in an array as props.plugins.",`
|
|
220
|
-
|
|
221
|
-
`,`All props: https://atomiks.github.io/tippyjs/v6/all-props/
|
|
222
|
-
`,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var HM=function(){return"innerHTML"};function yc(t,e){t[HM()]=e}function Sp(t){var e=rs();return t===!0?e.className=Ub:(e.className=Hb,Ss(t)?e.appendChild(t):yc(e,t)),e}function kp(t,e){Ss(e.content)?(yc(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?yc(t,e.content):t.textContent=e.content)}function Ec(t){var e=t.firstElementChild,n=fa(e.children);return{box:e,content:n.find(function(r){return r.classList.contains($b)}),arrow:n.find(function(r){return r.classList.contains(Ub)||r.classList.contains(Hb)}),backdrop:n.find(function(r){return r.classList.contains(yM)})}}function Jb(t){var e=rs(),n=rs();n.className=bM,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=rs();r.className=$b,r.setAttribute("data-state","hidden"),kp(r,t.props),e.appendChild(n),n.appendChild(r),i(t.props,t.props);function i(s,o){var a=Ec(e),l=a.box,c=a.content,u=a.arrow;o.theme?l.setAttribute("data-theme",o.theme):l.removeAttribute("data-theme"),typeof o.animation=="string"?l.setAttribute("data-animation",o.animation):l.removeAttribute("data-animation"),o.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?l.setAttribute("role",o.role):l.removeAttribute("role"),(s.content!==o.content||s.allowHTML!==o.allowHTML)&&kp(c,t.props),o.arrow?u?s.arrow!==o.arrow&&(l.removeChild(u),l.appendChild(Sp(o.arrow))):l.appendChild(Sp(o.arrow)):u&&l.removeChild(u)}return{popper:e,onUpdate:i}}Jb.$$tippy=!0;var jM=1,so=[],_l=[];function VM(t,e){var n=wp(t,Object.assign({},Dt,Gb(bp(e)))),r,i,s,o=!1,a=!1,l=!1,c=!1,u,d,p,f=[],h=mp(Pt,n.interactiveDebounce),m,g=jM++,y=null,w=wM(n.plugins),S={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},b={id:g,reference:t,popper:rs(),popperInstance:y,props:n,state:S,plugins:w,clearDelayTimeouts:$,setProps:q,setContent:ae,show:ve,hide:Ie,hideWithInteractivity:Je,enable:kt,disable:Rt,unmount:Tt,destroy:Jn};if(!n.render)return process.env.NODE_ENV!=="production"&&bc(!0,"render() function has not been supplied."),b;var x=n.render(b),T=x.popper,k=x.onUpdate;T.setAttribute("data-tippy-root",""),T.id="tippy-"+b.id,b.popper=T,t._tippy=b,T._tippy=b;var R=w.map(function(C){return C.fn(b)}),N=t.hasAttribute("aria-expanded");return at(),Q(),D(),L("onCreate",[b]),n.showOnCreate&&St(),T.addEventListener("mouseenter",function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()}),T.addEventListener("mouseleave",function(){b.props.interactive&&b.props.trigger.indexOf("mouseenter")>=0&&B().addEventListener("mousemove",h)}),b;function O(){var C=b.props.touch;return Array.isArray(C)?C:[C,0]}function j(){return O()[0]==="hold"}function V(){var C;return!!((C=b.props.render)!=null&&C.$$tippy)}function U(){return m||t}function B(){var C=U().parentNode;return C?AM(C):document}function H(){return Ec(T)}function _(C){return b.state.isMounted&&!b.state.isVisible||ln.isTouch||u&&u.type==="focus"?0:kl(b.props.delay,C?0:1,Dt.delay)}function D(C){C===void 0&&(C=!1),T.style.pointerEvents=b.props.interactive&&!C?"":"none",T.style.zIndex=""+b.props.zIndex}function L(C,J,re){if(re===void 0&&(re=!0),R.forEach(function(be){be[C]&&be[C].apply(be,J)}),re){var xe;(xe=b.props)[C].apply(xe,J)}}function I(){var C=b.props.aria;if(C.content){var J="aria-"+C.content,re=T.id,xe=qr(b.props.triggerTarget||t);xe.forEach(function(be){var Ve=be.getAttribute(J);if(b.state.isVisible)be.setAttribute(J,Ve?Ve+" "+re:re);else{var De=Ve&&Ve.replace(re,"").trim();De?be.setAttribute(J,De):be.removeAttribute(J)}})}}function Q(){if(!(N||!b.props.aria.expanded)){var C=qr(b.props.triggerTarget||t);C.forEach(function(J){b.props.interactive?J.setAttribute("aria-expanded",b.state.isVisible&&J===U()?"true":"false"):J.removeAttribute("aria-expanded")})}}function A(){B().removeEventListener("mousemove",h),so=so.filter(function(C){return C!==h})}function z(C){if(!(ln.isTouch&&(l||C.type==="mousedown"))){var J=C.composedPath&&C.composedPath()[0]||C.target;if(!(b.props.interactive&&Ep(T,J))){if(qr(b.props.triggerTarget||t).some(function(re){return Ep(re,J)})){if(ln.isTouch||b.state.isVisible&&b.props.trigger.indexOf("click")>=0)return}else L("onClickOutside",[b,C]);b.props.hideOnClick===!0&&(b.clearDelayTimeouts(),b.hide(),a=!0,setTimeout(function(){a=!1}),b.state.isMounted||oe())}}}function se(){l=!0}function ne(){l=!1}function de(){var C=B();C.addEventListener("mousedown",z,!0),C.addEventListener("touchend",z,er),C.addEventListener("touchstart",ne,er),C.addEventListener("touchmove",se,er)}function oe(){var C=B();C.removeEventListener("mousedown",z,!0),C.removeEventListener("touchend",z,er),C.removeEventListener("touchstart",ne,er),C.removeEventListener("touchmove",se,er)}function fe(C,J){$e(C,function(){!b.state.isVisible&&T.parentNode&&T.parentNode.contains(T)&&J()})}function ie(C,J){$e(C,J)}function $e(C,J){var re=H().box;function xe(be){be.target===re&&(Nl(re,"remove",xe),J())}if(C===0)return J();Nl(re,"remove",d),Nl(re,"add",xe),d=xe}function ge(C,J,re){re===void 0&&(re=!1);var xe=qr(b.props.triggerTarget||t);xe.forEach(function(be){be.addEventListener(C,J,re),f.push({node:be,eventType:C,handler:J,options:re})})}function at(){j()&&(ge("touchstart",Ue,{passive:!0}),ge("touchend",He,{passive:!0})),xM(b.props.trigger).forEach(function(C){if(C!=="manual")switch(ge(C,Ue),C){case"mouseenter":ge("mouseleave",He);break;case"focus":ge(DM?"focusout":"blur",ye);break;case"focusin":ge("focusout",ye);break}})}function Ot(){f.forEach(function(C){var J=C.node,re=C.eventType,xe=C.handler,be=C.options;J.removeEventListener(re,xe,be)}),f=[]}function Ue(C){var J,re=!1;if(!(!b.state.isEnabled||tt(C)||a)){var xe=((J=u)==null?void 0:J.type)==="focus";u=C,m=C.currentTarget,Q(),!b.state.isVisible&&TM(C)&&so.forEach(function(be){return be(C)}),C.type==="click"&&(b.props.trigger.indexOf("mouseenter")<0||o)&&b.props.hideOnClick!==!1&&b.state.isVisible?re=!0:St(C),C.type==="click"&&(o=!re),re&&!xe&&Le(C)}}function Pt(C){var J=C.target,re=U().contains(J)||T.contains(J);if(!(C.type==="mousemove"&&re)){var xe=pe().concat(T).map(function(be){var Ve,De=be._tippy,It=(Ve=De.popperInstance)==null?void 0:Ve.state;return It?{popperRect:be.getBoundingClientRect(),popperState:It,props:n}:null}).filter(Boolean);CM(xe,C)&&(A(),Le(C))}}function He(C){var J=tt(C)||b.props.trigger.indexOf("click")>=0&&o;if(!J){if(b.props.interactive){b.hideWithInteractivity(C);return}Le(C)}}function ye(C){b.props.trigger.indexOf("focusin")<0&&C.target!==U()||b.props.interactive&&C.relatedTarget&&T.contains(C.relatedTarget)||Le(C)}function tt(C){return ln.isTouch?j()!==C.type.indexOf("touch")>=0:!1}function Y(){pt();var C=b.props,J=C.popperOptions,re=C.placement,xe=C.offset,be=C.getReferenceClientRect,Ve=C.moveTransition,De=V()?Ec(T).arrow:null,It=be?{getBoundingClientRect:be,contextElement:be.contextElement||U()}:t,kr={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(An){var en=An.state;if(V()){var Oa=H(),pn=Oa.box;["placement","reference-hidden","escaped"].forEach(function(Tr){Tr==="placement"?pn.setAttribute("data-placement",en.placement):en.attributes.popper["data-popper-"+Tr]?pn.setAttribute("data-"+Tr,""):pn.removeAttribute("data-"+Tr)}),en.attributes.popper={}}}},Yt=[{name:"offset",options:{offset:xe}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Ve}},kr];V()&&De&&Yt.push({name:"arrow",options:{element:De,padding:3}}),Yt.push.apply(Yt,(J==null?void 0:J.modifiers)||[]),b.popperInstance=gM(It,T,Object.assign({},J,{placement:re,onFirstUpdate:p,modifiers:Yt}))}function pt(){b.popperInstance&&(b.popperInstance.destroy(),b.popperInstance=null)}function Ee(){var C=b.props.appendTo,J,re=U();b.props.interactive&&C===jb||C==="parent"?J=re.parentNode:J=Vb(C,[re]),J.contains(T)||J.appendChild(T),b.state.isMounted=!0,Y(),process.env.NODE_ENV!=="production"&&vn(b.props.interactive&&C===Dt.appendTo&&re.nextElementSibling!==T,["Interactive tippy element may not be accessible via keyboard","navigation because it is not directly after the reference element","in the DOM source order.",`
|
|
223
|
-
|
|
224
|
-
`,"Using a wrapper <div> or <span> tag around the reference element","solves this by creating a new parentNode context.",`
|
|
225
|
-
|
|
226
|
-
`,"Specifying `appendTo: document.body` silences this warning, but it","assumes you are using a focus management solution to handle","keyboard navigation.",`
|
|
227
|
-
|
|
228
|
-
`,"See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}function pe(){return fa(T.querySelectorAll("[data-tippy-root]"))}function St(C){b.clearDelayTimeouts(),C&&L("onTrigger",[b,C]),de();var J=_(!0),re=O(),xe=re[0],be=re[1];ln.isTouch&&xe==="hold"&&be&&(J=be),J?r=setTimeout(function(){b.show()},J):b.show()}function Le(C){if(b.clearDelayTimeouts(),L("onUntrigger",[b,C]),!b.state.isVisible){oe();return}if(!(b.props.trigger.indexOf("mouseenter")>=0&&b.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(C.type)>=0&&o)){var J=_(!1);J?i=setTimeout(function(){b.state.isVisible&&b.hide()},J):s=requestAnimationFrame(function(){b.hide()})}}function kt(){b.state.isEnabled=!0}function Rt(){b.hide(),b.state.isEnabled=!1}function $(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(s)}function q(C){if(process.env.NODE_ENV!=="production"&&vn(b.state.isDestroyed,Lr("setProps")),!b.state.isDestroyed){L("onBeforeUpdate",[b,C]),Ot();var J=b.props,re=wp(t,Object.assign({},J,bp(C),{ignoreAttributes:!0}));b.props=re,at(),J.interactiveDebounce!==re.interactiveDebounce&&(A(),h=mp(Pt,re.interactiveDebounce)),J.triggerTarget&&!re.triggerTarget?qr(J.triggerTarget).forEach(function(xe){xe.removeAttribute("aria-expanded")}):re.triggerTarget&&t.removeAttribute("aria-expanded"),Q(),D(),k&&k(J,re),b.popperInstance&&(Y(),pe().forEach(function(xe){requestAnimationFrame(xe._tippy.popperInstance.forceUpdate)})),L("onAfterUpdate",[b,C])}}function ae(C){b.setProps({content:C})}function ve(){process.env.NODE_ENV!=="production"&&vn(b.state.isDestroyed,Lr("show"));var C=b.state.isVisible,J=b.state.isDestroyed,re=!b.state.isEnabled,xe=ln.isTouch&&!b.props.touch,be=kl(b.props.duration,0,Dt.duration);if(!(C||J||re||xe)&&!U().hasAttribute("disabled")&&(L("onShow",[b],!1),b.props.onShow(b)!==!1)){if(b.state.isVisible=!0,V()&&(T.style.visibility="visible"),D(),de(),b.state.isMounted||(T.style.transition="none"),V()){var Ve=H(),De=Ve.box,It=Ve.content;Tl([De,It],0)}p=function(){var Yt;if(!(!b.state.isVisible||c)){if(c=!0,T.offsetHeight,T.style.transition=b.props.moveTransition,V()&&b.props.animation){var mi=H(),An=mi.box,en=mi.content;Tl([An,en],be),yp([An,en],"visible")}I(),Q(),gp(_l,b),(Yt=b.popperInstance)==null||Yt.forceUpdate(),L("onMount",[b]),b.props.animation&&V()&&ie(be,function(){b.state.isShown=!0,L("onShown",[b])})}},Ee()}}function Ie(){process.env.NODE_ENV!=="production"&&vn(b.state.isDestroyed,Lr("hide"));var C=!b.state.isVisible,J=b.state.isDestroyed,re=!b.state.isEnabled,xe=kl(b.props.duration,1,Dt.duration);if(!(C||J||re)&&(L("onHide",[b],!1),b.props.onHide(b)!==!1)){if(b.state.isVisible=!1,b.state.isShown=!1,c=!1,o=!1,V()&&(T.style.visibility="hidden"),A(),oe(),D(!0),V()){var be=H(),Ve=be.box,De=be.content;b.props.animation&&(Tl([Ve,De],xe),yp([Ve,De],"hidden"))}I(),Q(),b.props.animation?V()&&fe(xe,b.unmount):b.unmount()}}function Je(C){process.env.NODE_ENV!=="production"&&vn(b.state.isDestroyed,Lr("hideWithInteractivity")),B().addEventListener("mousemove",h),gp(so,h),h(C)}function Tt(){process.env.NODE_ENV!=="production"&&vn(b.state.isDestroyed,Lr("unmount")),b.state.isVisible&&b.hide(),b.state.isMounted&&(pt(),pe().forEach(function(C){C._tippy.unmount()}),T.parentNode&&T.parentNode.removeChild(T),_l=_l.filter(function(C){return C!==b}),b.state.isMounted=!1,L("onHidden",[b]))}function Jn(){process.env.NODE_ENV!=="production"&&vn(b.state.isDestroyed,Lr("destroy")),!b.state.isDestroyed&&(b.clearDelayTimeouts(),b.unmount(),Ot(),delete t._tippy,b.state.isDestroyed=!0,L("onDestroy",[b]))}}function Os(t,e){e===void 0&&(e={});var n=Dt.plugins.concat(e.plugins||[]);process.env.NODE_ENV!=="production"&&(BM(t),Yb(e,n)),RM();var r=Object.assign({},e,{plugins:n}),i=_M(t);if(process.env.NODE_ENV!=="production"){var s=Ss(r.content),o=i.length>1;vn(s&&o,["tippy() was passed an Element as the `content` prop, but more than","one tippy instance was created by this invocation. This means the","content element will only be appended to the last tippy instance.",`
|
|
229
|
-
|
|
230
|
-
`,"Instead, pass the .innerHTML of the element, or use a function that","returns a cloned version of the element instead.",`
|
|
231
|
-
|
|
232
|
-
`,`1) content: element.innerHTML
|
|
233
|
-
`,"2) content: () => element.cloneNode(true)"].join(" "))}var a=i.reduce(function(l,c){var u=c&&VM(c,r);return u&&l.push(u),l},[]);return Ss(t)?a[0]:a}Os.defaultProps=Dt;Os.setDefaultProps=$M;Os.currentInput=ln;Object.assign({},Rb,{effect:function(e){var n=e.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow)}});Os.setDefaultProps({render:Jb});const Xb=W.forwardRef((t,e)=>{const[n,r]=W.useState(0),i=l=>{const c=t.items[l];c&&t.command(c)},s=()=>{r((n+t.items.length-1)%t.items.length)},o=()=>{r((n+1)%t.items.length)},a=()=>{i(n)};return W.useEffect(()=>{r(0)},[t.items]),W.useImperativeHandle(e,()=>({onKeyDown:({event:l})=>l.key==="ArrowUp"?(s(),!0):l.key==="ArrowDown"?(o(),!0):l.key==="Enter"?(a(),!0):!1})),t.items.length?E.jsx("div",{className:"bg-obsidian border border-smoke/60 shadow-2xl rounded-xl overflow-hidden py-2 min-w-[240px]",children:t.items.map((l,c)=>{const u=l.icon;return E.jsxs("button",{className:`w-full flex items-center gap-3 px-4 py-2.5 text-left transition-colors
|
|
234
|
-
${c===n?"bg-amber/10 text-amber":"text-bone hover:bg-charcoal/50 hover:text-amber/80"}`,onClick:()=>i(c),children:[E.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md bg-charcoal/30 border border-smoke/30 shrink-0",children:E.jsx(u,{className:"w-4 h-4"})}),E.jsxs("div",{className:"flex flex-col",children:[E.jsx("span",{className:"font-semibold text-sm font-display tracking-wide",children:l.title}),E.jsx("span",{className:"text-xs text-steel",children:l.description})]})]},c)})}):null});Xb.displayName="CommandList";const WM=({query:t})=>[{title:"Heading 1",description:"Big section heading.",icon:X.Heading1,command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setNode("heading",{level:1}).run()}},{title:"Heading 2",description:"Medium section heading.",icon:X.Heading2,command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setNode("heading",{level:2}).run()}},{title:"Heading 3",description:"Small section heading.",icon:X.Heading3,command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setNode("heading",{level:3}).run()}},{title:"Bullet List",description:"Create a simple bulleted list.",icon:X.List,command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).toggleBulletList().run()}},{title:"Numbered List",description:"Create a list with numbering.",icon:X.ListOrdered,command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).toggleOrderedList().run()}},{title:"Quote",description:"Capture a quote.",icon:X.Quote,command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).toggleBlockquote().run()}},{title:"Task List",description:"Track tasks with a to-do list.",icon:X.CheckSquare,command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).toggleTaskList().run()}},{title:"Code Block",description:"Capture a code snippet.",icon:X.Code,command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).toggleCodeBlock().run()}},{title:"Callout",description:"Highlight important information.",icon:X.MessageSquareWarning,command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).insertContent({type:"callout",content:[{type:"paragraph"}]}).run()}},{title:"Stash Note",description:"Hidden journalist draft note.",icon:X.Archive,command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).insertContent({type:"stash",content:[{type:"paragraph"}]}).run()}}].filter(n=>n.title.toLowerCase().includes(t.toLowerCase())).slice(0,10),KM=ke.create({name:"slashMenu",addOptions(){return{suggestion:{char:"/",command:({editor:t,range:e,props:n})=>{n.command({editor:t,range:e})}}}},addProseMirrorPlugins(){return[dC({editor:this.editor,...this.options.suggestion,items:WM,render:()=>{let t,e;return{onStart:n=>{t=new Ym(Xb,{props:n,editor:n.editor}),n.clientRect&&(e=Os("body",{getReferenceClientRect:n.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"}))},onUpdate(n){t.updateProps(n),n.clientRect&&e[0].setProps({getReferenceClientRect:n.clientRect})},onKeyDown(n){var r;return n.event.key==="Escape"?(e[0].hide(),!0):(r=t.ref)==null?void 0:r.onKeyDown(n)},onExit(){e[0].destroy(),t.destroy()}}}})]}});function qM(){try{return lx}catch{return null}}function GM(t,e){if(t&&typeof t.serializeForClipboard=="function")return t.serializeForClipboard(e);const n=qM();if(n&&typeof(n==null?void 0:n.__serializeForClipboard)=="function")return n.__serializeForClipboard(t,e);throw new Error("No supported clipboard serialization method found.")}function YM(t){const e=t.getBoundingClientRect(),n=t.closest('[role="dialog"]');if(n&&window.getComputedStyle(n).transform!=="none"){const r=n.getBoundingClientRect();return{top:e.top-r.top,left:e.left-r.left,width:e.width}}return{top:e.top,left:e.left,width:e.width}}function Tp(t,e){const n=["li","p:not(:first-child)","pre","blockquote","h1","h2","h3","h4","h5","h6",...e.customNodes.map(r=>`[data-type=${r}]`)].join(", ");return document.elementsFromPoint(t.x,t.y).find(r=>{var i,s;return((s=(i=r.parentElement)==null?void 0:i.matches)==null?void 0:s.call(i,".ProseMirror"))||r.matches(n)})}function JM(t,e,n){var i;const r=t.getBoundingClientRect();return(i=e.posAtCoords({left:r.left+50+n.dragHandleWidth,top:r.top+1}))==null?void 0:i.inside}function Np(t,e){const n=e.state.doc.resolve(t);return n.depth>1?n.before(n.depth):t}function XM(t){let e="";function n(a,l){if(l.focus(),!a.dataTransfer)return;const c=Tp({x:a.clientX+50+t.dragHandleWidth,y:a.clientY},t);if(!(c instanceof Element))return;let u=JM(c,l,t);if(u==null||u<0)return;u=Np(u,l);const{from:d,to:p}=l.state.selection,f=d-p,h=Np(d,l);let m=!1;const g=l.state.doc.resolve(h);if(g.node().type.name==="doc")m=!0;else{const x=ee.create(l.state.doc,g.before());m=!(u+1>=x.$from.pos&&u<=x.$to.pos)}let y=l.state.selection;if(!m&&f!==0&&!(l.state.selection instanceof ee)){const x=ee.create(l.state.doc,p-1);y=le.create(l.state.doc,u,x.$to.pos)}else if(y=ee.create(l.state.doc,u),y.node.type.isInline||y.node.type.name==="tableRow"){let x=l.state.doc.resolve(y.from);y=ee.create(l.state.doc,x.before())}l.dispatch(l.state.tr.setSelection(y)),l.state.selection instanceof ee&&l.state.selection.node.type.name==="listItem"&&(e=c.parentElement.tagName);const w=l.state.selection.content(),{dom:S,text:b}=GM(l,w);a.dataTransfer.clearData(),a.dataTransfer.setData("text/html",S.innerHTML),a.dataTransfer.setData("text/plain",b),a.dataTransfer.effectAllowed="copyMove",a.dataTransfer.setDragImage(c,0,0),l.dragging={slice:w,move:a.ctrlKey}}let r=null;function i(){r&&r.classList.add("hide")}function s(){r&&r.classList.remove("hide")}function o(a){if(a.target instanceof Element){const l=a.relatedTarget;if((l==null?void 0:l.classList.contains("tiptap"))||(l==null?void 0:l.classList.contains("drag-handle")))return}i()}return new Me({key:new ze(t.pluginKey),view:a=>{var d,p,f,h;const l=t.dragHandleSelector?document.querySelector(t.dragHandleSelector):null;r=l??document.createElement("div"),r.draggable=!0,r.dataset.dragHandle="",r.classList.add("drag-handle");function c(m){n(m,a)}r.addEventListener("dragstart",c);function u(m){i();let g=window.scrollY;m.clientY<t.scrollTreshold?window.scrollTo({top:g-30,behavior:"smooth"}):window.innerHeight-m.clientY<t.scrollTreshold&&window.scrollTo({top:g+30,behavior:"smooth"})}return r.addEventListener("drag",u),i(),l||(p=(d=a==null?void 0:a.dom)==null?void 0:d.parentElement)==null||p.appendChild(r),(h=(f=a==null?void 0:a.dom)==null?void 0:f.parentElement)==null||h.addEventListener("mouseout",o),{destroy:()=>{var m,g,y;l||(m=r==null?void 0:r.remove)==null||m.call(r),r==null||r.removeEventListener("drag",u),r==null||r.removeEventListener("dragstart",c),r=null,(y=(g=a==null?void 0:a.dom)==null?void 0:g.parentElement)==null||y.removeEventListener("mouseout",o)}}},props:{handleDOMEvents:{mousemove:(a,l)=>{if(!a.editable)return;const c=Tp({x:l.clientX+50+t.dragHandleWidth,y:l.clientY},t),u=c==null?void 0:c.closest(".not-draggable"),d=t.excludedTags.concat(["ol","ul"]).join(", ");if(!(c instanceof Element)||c.matches(d)||u){i();return}const p=window.getComputedStyle(c),f=parseInt(p.lineHeight,10),h=isNaN(f)?parseInt(p.fontSize)*1.2:f,m=parseInt(p.paddingTop,10),g=YM(c);g.top+=(h-24)/2,g.top+=m,c.matches("ul:not([data-type=taskList]) li, ol li")&&(g.left-=t.dragHandleWidth),g.width=t.dragHandleWidth,r&&(r.style.left=`${g.left-g.width}px`,r.style.top=`${g.top}px`,s())},keydown:()=>{i()},mousewheel:()=>{i()},dragstart:a=>{a.dom.classList.add("dragging")},drop:(a,l)=>{var f;a.dom.classList.remove("dragging"),i();let c=null;const u=a.posAtCoords({left:l.clientX,top:l.clientY});if(!u||(a.state.selection instanceof ee&&(c=a.state.selection.node),!c))return;const p=a.state.doc.resolve(u.pos).parent.type.name==="listItem";if(a.state.selection instanceof ee&&a.state.selection.node.type.name==="listItem"&&!p&&e=="OL"){const h=(f=a.state.schema.nodes.orderedList)==null?void 0:f.createAndFill(null,c),m=new G(F.from(h),0,0);a.dragging={slice:m,move:l.ctrlKey}}},dragend:a=>{a.dom.classList.remove("dragging")}}}})}const ZM=ke.create({name:"globalDragHandle",addOptions(){return{dragHandleWidth:20,scrollTreshold:100,excludedTags:[],customNodes:[]}},addProseMirrorPlugins(){return[XM({pluginKey:"globalDragHandle",dragHandleWidth:this.options.dragHandleWidth,scrollTreshold:this.options.scrollTreshold,dragHandleSelector:this.options.dragHandleSelector,excludedTags:this.options.excludedTags,customNodes:this.options.customNodes})]}}),QM=Fg.extend({addAttributes(){return{color:{default:null,parseHTML:t=>t.style.textDecorationColor||null,renderHTML:t=>t.color?{style:`text-decoration-color: ${t.color};`}:{}}}},addCommands(){return{setUnderline:t=>({commands:e})=>e.setMark(this.name,t),toggleUnderline:t=>({commands:e})=>e.toggleMark(this.name,t),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}}}),eO=Bg.extend({addAttributes(){return{color:{default:null,parseHTML:t=>t.style.textDecorationColor||null,renderHTML:t=>t.color?{style:`text-decoration-color: ${t.color};`}:{}}}},addCommands(){return{setStrike:t=>({commands:e})=>e.setMark(this.name,t),toggleStrike:t=>({commands:e})=>e.toggleMark(this.name,t),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}}}),tO=G_(QN);Ab.addHook("uponSanitizeElement",(t,e)=>{var n;e.tagName==="iframe"&&((t.getAttribute("src")||"").startsWith("https://www.youtube.com/embed/")||(n=t.parentNode)==null||n.removeChild(t))});const Zb=({initialContent:t,onChange:e,uploadImage:n,children:r,minHeightClass:i="min-h-[150px]",maxHeightClass:s="max-h-[500px]"})=>{const[o,a]=W.useState(!0),[l,c]=W.useState(!1),[u,d]=W.useState("link"),[p,f]=W.useState(""),h=vS({extensions:[RT.configure({heading:{levels:[1,2,3]},strike:!1,codeBlock:!1}),QM,eO,Sb,kb,uA.configure({types:["heading","paragraph","image","youtube"]}),_k.configure({openOnClick:!1,HTMLAttributes:{class:"text-amber hover:text-amber/80 transition-colors underline underline-offset-4 cursor-pointer"}}),jA.configure({inline:!1}),XA.configure({inline:!1}),QA,nC,iC,oC,UA,eA.configure({lowlight:tO}),tA,nA.configure({nested:!0}),KM,ZM.configure({dragHandleWidth:20,scrollTreshold:100})],content:typeof t=="string"?t?Ab.sanitize(t,{ADD_TAGS:["iframe"],ADD_ATTR:["allowfullscreen","frameborder","src"]}):"<p></p>":t,onUpdate:({editor:m})=>{a(!1);const g=m.getJSON(),y=m.getHTML();e&&e(g,y),setTimeout(()=>a(!0),800)},editorProps:{attributes:{class:"prose prose-invert max-w-none focus:outline-none min-h-full p-4 sm:p-6 md:p-8 pb-16 md:pb-24 text-bone font-body leading-relaxed prose-p:my-1 prose-headings:my-4"}}});return W.useEffect(()=>{const m=async g=>{const y=g,{file:w,position:S}=y.detail;if(w)if(n){a(!1);try{const b=await n(w);S!==void 0?h==null||h.chain().insertContentAt(S,{type:"image",attrs:{src:b}}).focus().run():h==null||h.chain().focus().insertContent({type:"image",attrs:{src:b}}).run()}catch(b){console.error("Image upload failed",b)}finally{a(!0)}}else{const b=URL.createObjectURL(w);S!==void 0?h==null||h.chain().insertContentAt(S,{type:"image",attrs:{src:b}}).focus().run():h==null||h.chain().focus().insertContent({type:"image",attrs:{src:b}}).run()}};return window.addEventListener("axiom-image-upload",m),()=>window.removeEventListener("axiom-image-upload",m)},[h,n]),E.jsx(Cb.Provider,{value:{editor:h,isSaved:o,setIsSaved:a,mediaModalOpen:l,setMediaModalOpen:c,mediaModalType:u,setMediaModalType:d,mediaModalInput:p,setMediaModalInput:f,uploadImage:n,minHeightClass:i,maxHeightClass:s},children:r})},Oe=W.forwardRef(({active:t,icon:e,label:n,variant:r="icon",className:i="",...s},o)=>{const a="transition-all rounded-lg shrink-0 flex items-center justify-center gap-2",l=r==="icon"?"p-2.5":"px-3 py-2 text-xs font-semibold",c=t?"text-amber bg-amber/5":"text-steel hover:text-amber hover:bg-amber/5",u=s.disabled?"opacity-30 cursor-not-allowed":"";return E.jsxs("button",{ref:o,type:"button",className:`${a} ${l} ${c} ${u} ${i}`,...s,children:[e,n&&E.jsx("span",{className:"hidden lg:inline",children:n})]})});Oe.displayName="ToolbarButton";const nO=()=>{const{editor:t,isSaved:e,setMediaModalOpen:n,setMediaModalType:r,setMediaModalInput:i}=Ca(),[s,o]=W.useState(!1),a=W.useRef(null),[l,c]=W.useState(!1),u=W.useRef(null),[d,p]=W.useState(!1),f=W.useRef(null);if(W.useEffect(()=>{const g=y=>{a.current&&!a.current.contains(y.target)&&o(!1),u.current&&!u.current.contains(y.target)&&c(!1),f.current&&!f.current.contains(y.target)&&p(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[]),!t)return null;const h=g=>{i(""),r(g),n(!0)},m=()=>{const g=t.state.selection.from,y=document.createElement("input");y.type="file",y.accept="image/*",y.onchange=async w=>{var b;const S=(b=w.target.files)==null?void 0:b[0];S&&window.dispatchEvent(new CustomEvent("axiom-image-upload",{detail:{file:S,position:g}}))},y.click()};return E.jsx("div",{className:"-mx-1 px-1 mb-2",children:E.jsxs("div",{className:"flex items-center gap-1 p-2 bg-obsidian border border-smoke/60 rounded-xl sticky top-4 z-20 shadow-xl shadow-black/20 flex-wrap",children:[E.jsxs("div",{className:"flex items-center gap-0.5 mr-1",children:[E.jsx(Oe,{icon:E.jsx(X.Undo,{className:"w-4 h-4"}),title:"Undo",onClick:()=>t.chain().focus().undo().run(),disabled:!t.can().undo()}),E.jsx(Oe,{icon:E.jsx(X.Redo,{className:"w-4 h-4"}),title:"Redo",onClick:()=>t.chain().focus().redo().run(),disabled:!t.can().redo()})]}),E.jsx("div",{className:"w-px h-6 bg-smoke/60 mx-1"}),E.jsx(Oe,{icon:E.jsx(X.Bold,{className:"w-4 h-4"}),title:"Bold",active:t.isActive("bold"),onClick:()=>t.chain().focus().toggleBold().run()}),E.jsx(Oe,{icon:E.jsx(X.Italic,{className:"w-4 h-4"}),title:"Italic",active:t.isActive("italic"),onClick:()=>t.chain().focus().toggleItalic().run()}),E.jsxs("div",{ref:u,className:"relative",children:[E.jsx(Oe,{icon:E.jsx(X.Underline,{className:"w-4 h-4"}),title:"Underline",active:t.isActive("underline"),onClick:()=>{t.isActive("underline")?t.chain().focus().unsetUnderline().run():c(!l)}}),l&&E.jsxs("div",{className:"absolute top-full left-0 mt-2 p-3 bg-charcoal border border-smoke/80 rounded-xl shadow-2xl grid grid-cols-4 gap-2 z-30 min-w-[120px]",children:[["#f9761f","#ffffff","#94a3b8","#ef4444","#22c55e","#3b82f6","#a855f7","#eab308"].map(g=>E.jsx("button",{type:"button",onClick:()=>{t.chain().focus().setUnderline({color:g}).run(),c(!1)},className:"w-6 h-6 rounded-full border border-white/10 hover:scale-110 active:scale-95 transition-all shadow-md cursor-pointer",style:{backgroundColor:g},title:g},g)),E.jsx("button",{type:"button",onClick:()=>{t.chain().focus().unsetUnderline().run(),c(!1)},className:"w-6 h-6 rounded-full border border-white/20 hover:scale-110 active:scale-95 transition-all flex items-center justify-center bg-transparent cursor-pointer text-red-500 font-bold text-xs",title:"Remove Underline",style:{display:"flex",alignItems:"center",justifyContent:"center"},children:"/"})]})]}),E.jsxs("div",{ref:f,className:"relative",children:[E.jsx(Oe,{icon:E.jsx(X.Strikethrough,{className:"w-4 h-4"}),title:"Strikethrough",active:t.isActive("strike"),onClick:()=>{t.isActive("strike")?t.chain().focus().unsetStrike().run():p(!d)}}),d&&E.jsxs("div",{className:"absolute top-full left-0 mt-2 p-3 bg-charcoal border border-smoke/80 rounded-xl shadow-2xl grid grid-cols-4 gap-2 z-30 min-w-[120px]",children:[["#f9761f","#ffffff","#94a3b8","#ef4444","#22c55e","#3b82f6","#a855f7","#eab308"].map(g=>E.jsx("button",{type:"button",onClick:()=>{t.chain().focus().setStrike({color:g}).run(),p(!1)},className:"w-6 h-6 rounded-full border border-white/10 hover:scale-110 active:scale-95 transition-all shadow-md cursor-pointer",style:{backgroundColor:g},title:g},g)),E.jsx("button",{type:"button",onClick:()=>{t.chain().focus().unsetStrike().run(),p(!1)},className:"w-6 h-6 rounded-full border border-white/20 hover:scale-110 active:scale-95 transition-all flex items-center justify-center bg-transparent cursor-pointer text-red-500 font-bold text-xs",title:"Remove Strikethrough",style:{display:"flex",alignItems:"center",justifyContent:"center"},children:"/"})]})]}),E.jsxs("div",{ref:a,className:"relative",children:[E.jsx(Oe,{icon:E.jsx(X.Highlighter,{className:"w-4 h-4"}),title:"Text Color",active:!!t.getAttributes("textStyle").color,onClick:()=>{t.getAttributes("textStyle").color?t.chain().focus().unsetColor().run():o(!s)}}),s&&E.jsxs("div",{className:"absolute top-full left-0 mt-2 p-3 bg-charcoal border border-smoke/80 rounded-xl shadow-2xl grid grid-cols-4 gap-2 z-30 min-w-[120px]",children:[["#f9761f","#ffffff","#94a3b8","#ef4444","#22c55e","#3b82f6","#a855f7","#eab308"].map(g=>E.jsx("button",{type:"button",onClick:()=>{t.chain().focus().setColor(g).run(),o(!1)},className:"w-6 h-6 rounded-full border border-white/10 hover:scale-110 active:scale-95 transition-all shadow-md cursor-pointer",style:{backgroundColor:g},title:g},g)),E.jsx("button",{type:"button",onClick:()=>{t.chain().focus().unsetColor().run(),o(!1)},className:"w-6 h-6 rounded-full border border-white/20 hover:scale-110 active:scale-95 transition-all flex items-center justify-center bg-transparent cursor-pointer text-red-500 font-bold text-xs",title:"Remove Text Color",style:{display:"flex",alignItems:"center",justifyContent:"center"},children:"/"})]})]}),E.jsx(Oe,{icon:E.jsx(X.Link,{className:"w-4 h-4"}),title:"Link",active:t.isActive("link"),onClick:()=>t.getAttributes("link").href?t.chain().focus().unsetLink().run():h("link")}),E.jsx("div",{className:"w-px h-6 bg-smoke/60 mx-1"}),E.jsx(Oe,{variant:"text",label:"H1",title:"Heading 1",active:t.isActive("heading",{level:1}),onClick:()=>t.chain().focus().toggleHeading({level:1}).run()}),E.jsx(Oe,{variant:"text",label:"H2",title:"Heading 2",active:t.isActive("heading",{level:2}),onClick:()=>t.chain().focus().toggleHeading({level:2}).run()}),E.jsx(Oe,{variant:"text",label:"H3",title:"Heading 3",active:t.isActive("heading",{level:3}),onClick:()=>t.chain().focus().toggleHeading({level:3}).run()}),E.jsx(Oe,{icon:E.jsx(X.Quote,{className:"w-4 h-4"}),title:"Blockquote",active:t.isActive("blockquote"),onClick:()=>t.chain().focus().toggleBlockquote().run()}),E.jsx(Oe,{icon:E.jsx(X.Code,{className:"w-4 h-4"}),title:"Code Block",active:t.isActive("codeBlock"),onClick:()=>t.chain().focus().toggleCodeBlock().run()}),E.jsx(Oe,{icon:E.jsx(X.MessageSquareWarning,{className:"w-4 h-4"}),title:"Callout",active:t.isActive("callout"),onClick:()=>t.chain().focus().insertContent({type:"callout",content:[{type:"paragraph"}]}).run()}),E.jsx("div",{className:"w-px h-6 bg-smoke/60 mx-1"}),E.jsx(Oe,{icon:E.jsx(X.List,{className:"w-4 h-4"}),title:"Bullet List",active:t.isActive("bulletList"),onClick:()=>t.chain().focus().toggleBulletList().run()}),E.jsx(Oe,{icon:E.jsx(X.ListOrdered,{className:"w-4 h-4"}),title:"Numbered List",active:t.isActive("orderedList"),onClick:()=>t.chain().focus().toggleOrderedList().run()}),E.jsx(Oe,{icon:E.jsx(X.CheckSquare,{className:"w-4 h-4"}),title:"Task List",active:t.isActive("taskList"),onClick:()=>t.chain().focus().toggleTaskList().run()}),E.jsx("div",{className:"w-px h-6 bg-smoke/60 mx-1"}),E.jsx(Oe,{icon:E.jsx(X.AlignLeft,{className:"w-4 h-4"}),title:"Align Left",active:t.isActive({textAlign:"left"}),onClick:()=>t.chain().focus().setTextAlign("left").run()}),E.jsx(Oe,{icon:E.jsx(X.AlignCenter,{className:"w-4 h-4"}),title:"Align Center",active:t.isActive({textAlign:"center"}),onClick:()=>t.chain().focus().setTextAlign("center").run()}),E.jsx(Oe,{icon:E.jsx(X.AlignRight,{className:"w-4 h-4"}),title:"Align Right",active:t.isActive({textAlign:"right"}),onClick:()=>t.chain().focus().setTextAlign("right").run()}),E.jsx("div",{className:"w-px h-6 bg-smoke/60 mx-1"}),E.jsx(Oe,{icon:E.jsx(X.ImagePlus,{className:"w-4 h-4"}),label:"Image",title:"Insert Image",onClick:m}),E.jsx(Oe,{icon:E.jsx(X.Video,{className:"w-4 h-4"}),label:"Video",title:"Insert Video",onClick:()=>h("video")}),E.jsx(Oe,{icon:E.jsx(X.MessageSquare,{className:"w-4 h-4"}),label:"Tweet",title:"Insert Tweet",onClick:()=>h("tweet")}),E.jsx(Oe,{icon:E.jsx(X.Camera,{className:"w-4 h-4"}),label:"Instagram",title:"Insert Instagram",onClick:()=>h("instagram")}),E.jsx("div",{className:"flex-1"}),E.jsxs("div",{className:"flex items-center gap-3",children:[E.jsxs("div",{className:"text-xs text-steel font-medium tracking-wide",children:[t.storage.characterCount.words()," words"]}),E.jsx("div",{className:"flex items-center gap-2 px-3 py-1 bg-white/5 rounded-lg border border-white/5",children:e?E.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-emerald-400 font-semibold uppercase tracking-wider",children:[E.jsx(X.CheckCircle2,{className:"w-3 h-3"}),E.jsx("span",{children:"Saved"})]}):E.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-amber/70 font-semibold uppercase tracking-wider",children:[E.jsx(X.CloudUpload,{className:"w-3 h-3 animate-pulse"}),E.jsx("span",{children:"Syncing"})]})})]})]})})},rO=()=>{const{editor:t}=Ca();return t?E.jsx("div",{className:"axiom-editor-canvas relative border border-smoke/60 rounded-xl overflow-y-auto overflow-x-hidden shadow-inner bg-obsidian text-bone transition-colors duration-300 custom-scrollbar axiom-editor-fixed-size min-h-0",children:E.jsx(Hm,{editor:t,className:"min-h-full"})}):null},iO=()=>{const{editor:t,mediaModalOpen:e,setMediaModalOpen:n,mediaModalType:r,mediaModalInput:i,setMediaModalInput:s}=Ca(),o=W.useCallback(()=>{const a=i.trim();if(!a||!t){n(!1);return}if(r==="link"){let l=a;!/^https?:\/\//i.test(l)&&!/^mailto:/i.test(l)&&!/^tel:/i.test(l)&&(l="https://"+l),t.chain().focus().extendMarkRange("link").setLink({href:l}).run()}else r==="video"?t.chain().focus().setYoutubeVideo({src:a}).run():r==="tweet"?t.chain().focus().insertContent({type:"tweet",attrs:{url:a}}).run():r==="instagram"&&t.chain().focus().insertContent({type:"instagram",attrs:{url:a}}).run();n(!1),s("")},[i,r,t,n,s]);return e?E.jsx("div",{className:"fixed inset-0 z-[9999] bg-black/80 flex items-center justify-center p-4 backdrop-blur-sm",children:E.jsxs("div",{className:"bg-obsidian border border-smoke/60 p-5 md:p-6 rounded-2xl w-full max-w-md shadow-2xl mx-4 sm:mx-0",children:[E.jsxs("h3",{className:"text-bone font-display font-semibold mb-4",children:[r==="link"&&"Insert Hyperlink",r==="video"&&"Insert YouTube Embed",r==="tweet"&&"Insert X / Twitter Embed",r==="instagram"&&"Insert Instagram Embed"]}),E.jsx("input",{type:"text",value:i,onChange:a=>s(a.target.value),placeholder:r==="link"?"https://example.com":r==="video"?"https://youtube.com/watch?v=...":r==="tweet"?"https://x.com/username/status/...":"https://instagram.com/reel/...",className:"w-full bg-charcoal/30 border border-smoke/60 rounded-xl px-4 py-3 text-bone focus:outline-none focus:border-amber mb-6 transition-colors text-sm",autoFocus:!0,onKeyDown:a=>{a.key==="Enter"?(a.preventDefault(),o()):a.key==="Escape"&&n(!1)}}),E.jsxs("div",{className:"flex justify-end gap-3",children:[E.jsx("button",{type:"button",onClick:()=>n(!1),className:"px-5 py-2.5 text-steel hover:text-bone text-sm font-medium transition-colors",children:"Cancel"}),E.jsxs("button",{type:"button",onClick:o,className:"px-5 py-2.5 bg-amber hover:bg-amber/90 text-obsidian font-semibold rounded-xl text-sm transition-all shadow-[0_0_15px_rgba(255,191,0,0.15)]",children:[r==="link"&&"Insert Link",r==="video"&&"Insert Video",r==="tweet"&&"Insert Tweet",r==="instagram"&&"Insert Instagram"]})]})]})}):null},sO=({initialContent:t,onChange:e,uploadImage:n,minHeightClass:r,maxHeightClass:i})=>E.jsx(Zb,{initialContent:t,onChange:e,uploadImage:n,minHeightClass:r,maxHeightClass:i,children:E.jsxs("div",{className:"flex flex-col gap-4",children:[E.jsx(nO,{}),E.jsx(rO,{}),E.jsx(iO,{})]})}),vc=(t,e)=>{var s,o;if(t.type==="doc")return E.jsx(E.Fragment,{children:(s=t.content)==null?void 0:s.map((a,l)=>vc(a,l))});if(t.type==="text"){let a=t.text||"";return t.marks&&t.marks.forEach(l=>{var c,u,d,p;if(l.type==="bold"&&(a=E.jsx("strong",{children:a},l.type)),l.type==="italic"&&(a=E.jsx("em",{children:a},l.type)),l.type==="underline"){const f=(c=l.attrs)==null?void 0:c.color;a=E.jsx("u",{style:f?{textDecorationColor:f}:{},children:a},l.type)}if(l.type==="strike"){const f=(u=l.attrs)==null?void 0:u.color;a=E.jsx("s",{style:f?{textDecorationColor:f}:{},children:a},l.type)}if(l.type==="textStyle"){const f=(d=l.attrs)==null?void 0:d.color;f&&(a=E.jsx("span",{style:{color:f},children:a},l.type))}if(l.type==="link"){const f=(p=l.attrs)==null?void 0:p.href;f&&(a=E.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"text-amber hover:text-amber/80 transition-colors underline underline-offset-4",children:a},l.type))}}),E.jsx(W.Fragment,{children:a},e)}const n=(o=t.content)==null?void 0:o.map((a,l)=>vc(a,l)),r=t.attrs||{},i=r.textAlign?{textAlign:r.textAlign}:{};switch(t.type){case"paragraph":return E.jsx("p",{style:i,children:n},e);case"heading":{const a=`h${r.level||1}`;return E.jsx(a,{style:i,children:n},e)}case"blockquote":return E.jsx("blockquote",{className:"border-l-4 border-amber/50 pl-4 py-1 italic bg-charcoal/30 rounded-r-lg",children:n},e);case"bulletList":return E.jsx("ul",{className:"list-disc pl-6 marker:text-amber",children:n},e);case"orderedList":return E.jsx("ol",{className:"list-decimal pl-6 marker:text-amber",children:n},e);case"listItem":return E.jsx("li",{children:n},e);case"image":{const a=r.align||"center",l=r.width||"100%";let c="items-center mx-auto";return a==="left"&&(c="items-start mr-auto ml-0"),a==="right"&&(c="items-end ml-auto mr-0"),E.jsxs("div",{className:`flex flex-col my-8 w-full ${c}`,children:[r.caption&&r.captionPosition==="above"&&E.jsx("p",{className:"text-steel text-xs md:text-sm italic mb-3 uppercase tracking-widest font-medium px-2",children:r.caption}),E.jsx("img",{src:r.src,alt:r.alt||"",title:r.title,style:{width:l,minWidth:"150px"},className:"rounded-xl object-cover shadow-2xl border border-smoke/30 max-w-full"}),r.caption&&r.captionPosition==="below"&&E.jsx("p",{className:"text-steel text-xs md:text-sm italic mt-3 uppercase tracking-widest font-medium px-2",children:r.caption})]},e)}case"youtube":return E.jsx("div",{className:"my-8 aspect-video rounded-2xl overflow-hidden shadow-[0_0_40px_rgba(0,0,0,0.5)] border border-smoke/30 bg-black relative",children:E.jsx("iframe",{src:r.src,className:"absolute inset-0 w-full h-full border-0",allowFullScreen:!0})},e);case"tweet":return E.jsx("div",{className:"my-6",children:E.jsx("blockquote",{className:"twitter-tweet",children:E.jsx("a",{href:r.url})})},e);case"instagram":return E.jsx("div",{className:"my-6",children:E.jsx("blockquote",{className:"instagram-media","data-instgrm-permalink":r.url})},e);case"callout":{const a={info:"bg-blue-500/10 border-blue-500/30 text-blue-100",warning:"bg-amber-500/10 border-amber-500/30 text-amber-100",success:"bg-emerald-500/10 border-emerald-500/30 text-emerald-100",error:"bg-red-500/10 border-red-500/30 text-red-100"},l=a[r.type]||a.info;return E.jsxs("div",{className:`my-6 flex gap-4 p-4 md:p-5 rounded-2xl border shadow-md ${l}`,children:[E.jsx("div",{className:"text-2xl shrink-0 mt-0.5 select-none",children:r.emoji}),E.jsx("div",{className:"flex-1 font-medium leading-relaxed",children:n})]},e)}case"codeBlock":return E.jsx("pre",{className:"bg-obsidian border border-smoke/30 p-4 rounded-xl overflow-x-auto text-sm my-6 font-mono text-steel",children:E.jsx("code",{className:`language-${r.language||"plaintext"}`,children:n})},e);case"taskList":return E.jsx("ul",{className:"list-none pl-0 my-6 space-y-2","data-type":"taskList",children:n},e);case"taskItem":return E.jsxs("li",{className:"flex items-start gap-3","data-type":"taskItem",children:[E.jsx("input",{type:"checkbox",className:"mt-1.5 w-4 h-4 rounded border-smoke/30 bg-charcoal text-amber accent-amber cursor-not-allowed",checked:r.checked,readOnly:!0}),E.jsx("div",{className:"flex-1 text-bone",children:n})]},e);case"stash":return null;default:return E.jsx(W.Fragment,{children:n},e)}},oO=({content:t})=>E.jsx("div",{className:"prose prose-invert max-w-none text-bone font-body leading-relaxed prose-p:my-1 prose-headings:my-4",children:vc(t)});exports.AxiomEditor=sO;exports.AxiomEditorProvider=Zb;exports.AxiomJSONRenderer=oO;exports.useAxiomEditor=Ca;
|
|
22
|
+
<%s key={someKey} {...props} />`,R,A,H,A),se[A+R]=!0)}if(A=null,M!==void 0&&(o(M),A=""+M),j(v)&&(o(v.key),A=""+v.key),"key"in v){M={};for(var J in v)J!=="key"&&(M[J]=v[J])}else M=v;return A&&i(M,typeof n=="function"?n.displayName||n.name||"Unknown":n),w(n,A,M,h(),B,K)}function y(n){C(n)?n._store&&(n._store.validated=1):typeof n=="object"&&n!==null&&n.$$typeof===l&&(n._payload.status==="fulfilled"?C(n._payload.value)&&n._payload.value._store&&(n._payload.value._store.validated=1):n._store&&(n._store.validated=1))}function C(n){return typeof n=="object"&&n!==null&&n.$$typeof===b}var g=x,b=Symbol.for("react.transitional.element"),D=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),a=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),$=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),l=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),U=Symbol.for("react.client.reference"),O=g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=Object.prototype.hasOwnProperty,W=Array.isArray,z=console.createTask?console.createTask:function(){return null};g={react_stack_bottom_frame:function(n){return n()}};var Q,Z={},ee=g.react_stack_bottom_frame.bind(g,f)(),te=z(r(f)),se={};V.Fragment=p,V.jsx=function(n,v,M){var R=1e4>O.recentlyCreatedOwnerStacks++;return N(n,v,M,!1,R?Error("react-stack-top-frame"):ee,R?z(r(n)):te)},V.jsxs=function(n,v,M){var R=1e4>O.recentlyCreatedOwnerStacks++;return N(n,v,M,!0,R?Error("react-stack-top-frame"):ee,R?z(r(n)):te)}}()),V}process.env.NODE_ENV==="production"?G.exports=Ee():G.exports=De();var e=G.exports;const ie=x.createContext(void 0),Y=()=>{const t=x.useContext(ie);if(t===void 0)throw new Error("useAxiomEditor must be used within an AxiomEditorProvider");return t},Te=({node:t,updateAttributes:s,deleteNode:o,selected:r})=>{const[h,f]=x.useState(!1),[j,i]=x.useState(!1),[c,w]=x.useState(!1),[N,y]=x.useState(!1),C=x.useRef(null),g=t.attrs.align||"center",b=t.attrs.width||"100%",D=t.attrs.caption||"",p=t.attrs.captionPosition||"below",k=t.attrs.alt||"",S=t.attrs.src,T=x.useCallback(m=>{if(!N||!C.current)return;const P=C.current.getBoundingClientRect(),l=Math.max(150,m.clientX-P.left);s({width:`${l}px`})},[N,s]),a=x.useCallback(()=>{y(!1)},[]);x.useEffect(()=>(N&&(window.addEventListener("mousemove",T),window.addEventListener("mouseup",a)),()=>{window.removeEventListener("mousemove",T),window.removeEventListener("mouseup",a)}),[N,T,a]);let u="w-full relative my-8 flex flex-col outline-none group cursor-pointer ";g==="left"?u+="items-start mr-auto ml-0":g==="right"?u+="items-end ml-auto mr-0":u+="items-center mx-auto";const $=`rounded-xl shadow-2xl transition-all border border-smoke/30 max-w-full ${r?"ring-4 ring-amber ring-offset-4 ring-offset-obsidian":""}`;return e.jsxs(I.NodeViewWrapper,{className:u,children:[e.jsxs("div",{ref:C,className:"relative inline-block",style:{width:b,minWidth:"150px"},children:[D&&p==="above"&&e.jsx("p",{className:"text-steel text-xs md:text-sm italic mb-3 uppercase tracking-widest font-medium px-2",children:D}),e.jsx("img",{src:S,className:$,alt:k,style:{width:"100%",display:"block"}}),r&&e.jsx("div",{onMouseDown:m=>{m.preventDefault(),y(!0)},className:"absolute -right-2 -bottom-2 w-5 h-5 bg-amber border-2 border-charcoal rounded-full cursor-se-resize z-50 hover:scale-125 transition-transform",title:"Drag to resize"}),D&&p==="below"&&e.jsx("p",{className:"text-steel text-xs md:text-sm italic mt-3 uppercase tracking-widest font-medium px-2",children:D})]}),r&&e.jsx("div",{className:"absolute -top-14 left-1/2 -translate-x-1/2 z-50 bg-charcoal border border-smoke rounded-xl shadow-2xl flex items-center divide-x divide-smoke/30 h-11 px-1",onMouseDown:m=>m.stopPropagation(),onKeyDown:m=>m.stopPropagation(),children:h?e.jsxs("div",{className:"flex items-center px-2 py-1 gap-2",children:[e.jsx("input",{type:"text",autoFocus:!0,placeholder:"Alt text / Title...",value:k,onChange:m=>s({alt:m.target.value}),onKeyDown:m=>{m.key==="Enter"&&f(!1)},className:"bg-obsidian border border-smoke/50 rounded-lg px-3 py-1 text-xs text-bone focus:outline-none focus:border-amber w-40"}),e.jsx("button",{onMouseDown:m=>{m.preventDefault(),f(!1)},className:"text-[10px] text-amber uppercase font-bold px-1",children:"Done"})]}):j?e.jsxs("div",{className:"flex items-center px-2 py-1 gap-2",children:[e.jsx("input",{type:"text",autoFocus:!0,placeholder:"Caption...",value:D,onChange:m=>s({caption:m.target.value}),onKeyDown:m=>{m.key==="Enter"&&i(!1)},className:"bg-obsidian border border-smoke/50 rounded-lg px-3 py-1 text-xs text-bone focus:outline-none focus:border-amber w-40"}),e.jsx("button",{onMouseDown:m=>{m.preventDefault(),s({captionPosition:p==="above"?"below":"above"})},className:"p-1.5 text-steel hover:text-amber rounded",title:"Toggle Position",children:e.jsx(d.Layout,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onMouseDown:m=>{m.preventDefault(),i(!1)},className:"text-[10px] text-amber uppercase font-bold px-1",children:"Done"})]}):c?e.jsxs("div",{className:"flex items-center px-2 py-1 gap-2",children:[e.jsx("input",{type:"text",autoFocus:!0,placeholder:"Size (px or %)...",value:b,onChange:m=>s({width:m.target.value}),onKeyDown:m=>{m.key==="Enter"&&w(!1)},className:"bg-obsidian border border-smoke/50 rounded-lg px-3 py-1 text-xs text-bone focus:outline-none focus:border-amber w-32"}),e.jsx("button",{onMouseDown:m=>{m.preventDefault(),w(!1)},className:"text-[10px] text-amber uppercase font-bold px-1",children:"Done"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex px-1 items-center gap-0.5",children:[e.jsx("button",{onMouseDown:m=>{m.preventDefault(),s({width:"100%"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-all",title:"Full Width",children:e.jsx(d.Maximize,{className:"w-4 h-4"})}),e.jsx("button",{onMouseDown:m=>{m.preventDefault(),w(!0)},className:"text-[10px] font-bold text-bone hover:text-amber px-2 py-1 transition-all",children:"Size"})]}),e.jsxs("div",{className:"flex px-1 items-center gap-0.5",children:[e.jsx("button",{onMouseDown:m=>{m.preventDefault(),s({align:"left"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",children:e.jsx(d.AlignLeft,{className:"w-4 h-4"})}),e.jsx("button",{onMouseDown:m=>{m.preventDefault(),s({align:"center"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",children:e.jsx(d.AlignCenter,{className:"w-4 h-4"})}),e.jsx("button",{onMouseDown:m=>{m.preventDefault(),s({align:"right"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",children:e.jsx(d.AlignRight,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"flex px-1 items-center gap-0.5",children:[e.jsx("button",{onMouseDown:m=>{m.preventDefault(),i(!0)},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",title:"Caption",children:e.jsx(d.Type,{className:"w-4 h-4"})}),e.jsx("button",{onMouseDown:m=>{m.preventDefault(),f(!0)},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",title:"Alt Text / Title",children:"Alt"}),e.jsx("button",{onMouseDown:m=>{m.preventDefault(),o()},className:"p-2 text-red-500 hover:text-red-400 hover:bg-red-500/10 rounded-lg transition-colors",children:e.jsx(d.Trash2,{className:"w-4 h-4"})})]})]})})]})},Se=L.Node.create({name:"image",group:"block",atom:!0,addAttributes(){return{src:{default:null},alt:{default:null},caption:{default:null},captionPosition:{default:"below"},width:{default:"100%"},align:{default:"center"}}},parseHTML(){return[{tag:"img[src]",getAttrs:t=>typeof t=="string"?{}:{src:t.getAttribute("src"),alt:t.getAttribute("alt"),width:t.style.width||t.getAttribute("width")||"100%"}}]},renderHTML({HTMLAttributes:t}){return["img",L.mergeAttributes(t)]},addNodeView(){return I.ReactNodeViewRenderer(Te)}}),Me=({node:t,updateAttributes:s,deleteNode:o,selected:r,editor:h})=>{const[f,j]=x.useState(!1),[i,c]=x.useState(!1),[w,N]=x.useState(!1),y=t.attrs.align||"center",C=t.attrs.width||"100%",g=t.attrs.caption||"",b=t.attrs.captionPosition||"below",D=t.attrs.alt||"";let p=t.attrs.src||"";const k=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=|live\/)|youtu\.be\/|youtube\.com\/shorts\/)([a-zA-Z0-9_-]{11})/,S=p.match(k);S&&S[1]&&(p=`https://www.youtube-nocookie.com/embed/${S[1]}`);let T="w-full relative my-8 flex flex-col outline-none group cursor-pointer ";y==="left"?T+="items-start mr-auto ml-0":y==="right"?T+="items-end ml-auto mr-0":T+="items-center mx-auto";const a=`rounded-xl shadow-2xl transition-all border border-smoke/30 max-w-full aspect-video ${r?"ring-4 ring-amber ring-offset-4 ring-offset-obsidian":""}`;return e.jsxs(I.NodeViewWrapper,{className:T,children:[g&&b==="above"&&e.jsx("p",{className:"text-steel text-xs md:text-sm italic mb-3 uppercase tracking-widest font-medium px-2",children:g}),e.jsxs("div",{className:"relative",style:{width:C,maxWidth:"720px",minWidth:"320px"},children:[h.isEditable&&e.jsx("div",{className:"absolute inset-0 z-10 cursor-pointer",title:"Click to edit embed"}),e.jsx("iframe",{src:p,className:`${a} w-full h-full`,style:{pointerEvents:h.isEditable?"none":"auto"},title:D,allowFullScreen:!0})]}),g&&b==="below"&&e.jsx("p",{className:"text-steel text-xs md:text-sm italic mt-3 uppercase tracking-widest font-medium px-2",children:g}),r&&e.jsx("div",{className:"absolute -top-14 left-1/2 -translate-x-1/2 z-50 bg-charcoal border border-smoke rounded-xl shadow-2xl flex items-center divide-x divide-smoke/30 h-11 px-1",onMouseDown:u=>u.stopPropagation(),onKeyDown:u=>u.stopPropagation(),children:f?e.jsxs("div",{className:"flex items-center px-2 py-1 gap-2",children:[e.jsx("input",{type:"text",autoFocus:!0,placeholder:"Alt text / Title...",value:D,onChange:u=>s({alt:u.target.value}),onKeyDown:u=>{u.key==="Enter"&&j(!1)},className:"bg-obsidian border border-smoke/50 rounded-lg px-3 py-1 text-xs text-bone focus:outline-none focus:border-amber w-40"}),e.jsx("button",{onMouseDown:u=>{u.preventDefault(),j(!1)},className:"text-[10px] text-amber uppercase font-bold px-1",children:"Done"})]}):i?e.jsxs("div",{className:"flex items-center px-2 py-1 gap-2",children:[e.jsx("input",{type:"text",autoFocus:!0,placeholder:"Caption...",value:g,onChange:u=>s({caption:u.target.value}),onKeyDown:u=>{u.key==="Enter"&&c(!1)},className:"bg-obsidian border border-smoke/50 rounded-lg px-3 py-1 text-xs text-bone focus:outline-none focus:border-amber w-40"}),e.jsx("button",{onMouseDown:u=>{u.preventDefault(),s({captionPosition:b==="above"?"below":"above"})},className:"p-1.5 text-steel hover:text-amber rounded",title:"Toggle Position",children:e.jsx(d.Layout,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onMouseDown:u=>{u.preventDefault(),c(!1)},className:"text-[10px] text-amber uppercase font-bold px-1",children:"Done"})]}):w?e.jsxs("div",{className:"flex items-center px-2 py-1 gap-2",children:[e.jsx("input",{type:"text",autoFocus:!0,placeholder:"Size (px or %)...",value:C,onChange:u=>s({width:u.target.value}),onKeyDown:u=>{u.key==="Enter"&&N(!1)},className:"bg-obsidian border border-smoke/50 rounded-lg px-3 py-1 text-xs text-bone focus:outline-none focus:border-amber w-32"}),e.jsx("button",{onMouseDown:u=>{u.preventDefault(),N(!1)},className:"text-[10px] text-amber uppercase font-bold px-1",children:"Done"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex px-1 items-center gap-0.5",children:[e.jsx("button",{onMouseDown:u=>{u.preventDefault(),s({width:"100%"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-all",title:"Full Width",children:e.jsx(d.Maximize,{className:"w-4 h-4"})}),e.jsx("button",{onMouseDown:u=>{u.preventDefault(),N(!0)},className:"text-[10px] font-bold text-bone hover:text-amber px-2 py-1 transition-all",children:"Size"})]}),e.jsxs("div",{className:"flex px-1 items-center gap-0.5",children:[e.jsx("button",{onMouseDown:u=>{u.preventDefault(),s({align:"left"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",children:e.jsx(d.AlignLeft,{className:"w-4 h-4"})}),e.jsx("button",{onMouseDown:u=>{u.preventDefault(),s({align:"center"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",children:e.jsx(d.AlignCenter,{className:"w-4 h-4"})}),e.jsx("button",{onMouseDown:u=>{u.preventDefault(),s({align:"right"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",children:e.jsx(d.AlignRight,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"flex px-1 items-center gap-0.5",children:[e.jsx("button",{onMouseDown:u=>{u.preventDefault(),c(!0)},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",title:"Caption",children:e.jsx(d.Type,{className:"w-4 h-4"})}),e.jsx("button",{onMouseDown:u=>{u.preventDefault(),j(!0)},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",title:"Alt Text / Title",children:"Alt"}),e.jsx("button",{onMouseDown:u=>{u.preventDefault(),o()},className:"p-2 text-red-500 hover:text-red-400 hover:bg-red-500/10 rounded-lg transition-colors",children:e.jsx(d.Trash2,{className:"w-4 h-4"})})]})]})})]})},Re=ve.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),align:{default:"center"},width:{default:"100%"},caption:{default:""},captionPosition:{default:"below"},alt:{default:""}}},addNodeView(){return I.ReactNodeViewRenderer(Me)}}),Ae=({node:t,updateAttributes:s,deleteNode:o,selected:r,editor:h})=>{const f=x.useRef(null),[j,i]=x.useState(!1),[c,w]=x.useState(!1),[N,y]=x.useState(!1),[C,g]=x.useState(!1),b=t.attrs.align||"center",D=t.attrs.url||"",p=t.attrs.width||"100%",k=t.attrs.caption||"",S=t.attrs.captionPosition||"below",T=t.attrs.alt||"";let a=t.attrs.tweetId;if(!a&&D){const l=D.match(/status\/(\d+)/);a=l?l[1]:""}const[u,$]=x.useState({tweetId:a,align:b});(a!==u.tweetId||b!==u.align)&&($({tweetId:a,align:b}),i(!1)),x.useEffect(()=>{if(!window.twttr){const l=document.createElement("script");l.setAttribute("src","https://platform.twitter.com/widgets.js"),l.setAttribute("async","true"),l.setAttribute("charset","utf-8"),document.head.appendChild(l)}},[]),x.useEffect(()=>{let l=!0;if(!a)return;const _=setInterval(()=>{var O,q,W,z;(O=window.twttr)!=null&&O.widgets&&(clearInterval(_),clearTimeout(U),f.current&&l&&(f.current.innerHTML="",(z=(W=(q=window.twttr.widgets).createTweet)==null?void 0:W.call(q,a,f.current,{theme:"dark",align:b,dnt:!0}))==null||z.then(()=>{l&&i(!0)})))},100),U=setTimeout(()=>{l=!1,clearInterval(_)},1e4);return()=>{l=!1,clearInterval(_),clearTimeout(U)}},[a,b]);let m="w-full relative my-8 flex flex-col outline-none group cursor-pointer ";b==="left"?m+="items-start mr-auto ml-0":b==="right"?m+="items-end ml-auto mr-0":m+="items-center mx-auto";const P=()=>{let l=String(p).trim();if(l.endsWith("%")){const _=parseInt(l.replace("%",""),10);!isNaN(_)&&_<30&&(l="30%")}else{const _=parseInt(l.replace("px",""),10);!isNaN(_)&&_<250?l="250px":!isNaN(_)&&!l.endsWith("px")&&(l=`${_}px`)}s({width:l}),g(!1)};return e.jsxs(I.NodeViewWrapper,{className:m,children:[k&&S==="above"&&e.jsx("p",{className:"text-steel text-xs md:text-sm italic mb-3 uppercase tracking-widest font-medium px-2",children:k}),e.jsxs("div",{style:{width:p,maxWidth:"550px",minWidth:"250px"},className:`relative py-4 flex items-center justify-center min-h-[150px] overflow-hidden bg-obsidian border border-smoke/30 rounded-xl transition-all ${r?"ring-4 ring-amber ring-offset-4 ring-offset-obsidian":""}`,title:T,children:[h.isEditable&&e.jsx("div",{className:"absolute inset-0 z-10 cursor-pointer",title:"Click to edit embed"}),!j&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-xs text-steel animate-pulse uppercase tracking-wider font-semibold",children:"Establishing connection to X..."}),e.jsx("div",{ref:f,className:`w-full flex justify-center ${h.isEditable?"pointer-events-none":""}`})]}),k&&S==="below"&&e.jsx("p",{className:"text-steel text-xs md:text-sm italic mt-3 uppercase tracking-widest font-medium px-2",children:k}),r&&e.jsx("div",{className:"absolute -top-14 left-1/2 -translate-x-1/2 z-50 bg-charcoal border border-smoke rounded-xl shadow-2xl flex items-center divide-x divide-smoke/30 h-11 px-1",onMouseDown:l=>l.stopPropagation(),onKeyDown:l=>l.stopPropagation(),children:c?e.jsxs("div",{className:"flex items-center px-2 py-1 gap-2",children:[e.jsx("input",{type:"text",autoFocus:!0,placeholder:"Alt text / Title...",value:T,onChange:l=>s({alt:l.target.value}),onKeyDown:l=>{l.key==="Enter"&&w(!1)},className:"bg-obsidian border border-smoke/50 rounded-lg px-3 py-1 text-xs text-bone focus:outline-none focus:border-amber w-40"}),e.jsx("button",{onMouseDown:l=>{l.preventDefault(),w(!1)},className:"text-[10px] text-amber uppercase font-bold px-1",children:"Done"})]}):N?e.jsxs("div",{className:"flex items-center px-2 py-1 gap-2",children:[e.jsx("input",{type:"text",autoFocus:!0,placeholder:"Caption...",value:k,onChange:l=>s({caption:l.target.value}),onKeyDown:l=>{l.key==="Enter"&&y(!1)},className:"bg-obsidian border border-smoke/50 rounded-lg px-3 py-1 text-xs text-bone focus:outline-none focus:border-amber w-40"}),e.jsx("button",{onMouseDown:l=>{l.preventDefault(),s({captionPosition:S==="above"?"below":"above"})},className:"p-1.5 text-steel hover:text-amber rounded",title:"Toggle Position",children:e.jsx(d.Layout,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onMouseDown:l=>{l.preventDefault(),y(!1)},className:"text-[10px] text-amber uppercase font-bold px-1",children:"Done"})]}):C?e.jsxs("div",{className:"flex items-center px-2 py-1 gap-2",children:[e.jsx("input",{type:"text",autoFocus:!0,placeholder:"Size (px or %)...",value:p,onChange:l=>s({width:l.target.value}),onKeyDown:l=>{l.key==="Enter"&&P()},className:"bg-obsidian border border-smoke/50 rounded-lg px-3 py-1 text-xs text-bone focus:outline-none focus:border-amber w-32"}),e.jsx("button",{onMouseDown:l=>{l.preventDefault(),P()},className:"text-[10px] text-amber uppercase font-bold px-1",children:"Done"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex px-1 items-center gap-0.5",children:[e.jsx("button",{onMouseDown:l=>{l.preventDefault(),s({width:"100%"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-all",title:"Full Width",children:e.jsx(d.Maximize,{className:"w-4 h-4"})}),e.jsx("button",{onMouseDown:l=>{l.preventDefault(),g(!0)},className:"text-[10px] font-bold text-bone hover:text-amber px-2 py-1 transition-all",children:"Size"})]}),e.jsxs("div",{className:"flex px-1 items-center gap-0.5",children:[e.jsx("button",{onMouseDown:l=>{l.preventDefault(),s({align:"left"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",children:e.jsx(d.AlignLeft,{className:"w-4 h-4"})}),e.jsx("button",{onMouseDown:l=>{l.preventDefault(),s({align:"center"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",children:e.jsx(d.AlignCenter,{className:"w-4 h-4"})}),e.jsx("button",{onMouseDown:l=>{l.preventDefault(),s({align:"right"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",children:e.jsx(d.AlignRight,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"flex px-1 items-center gap-0.5",children:[e.jsx("button",{onMouseDown:l=>{l.preventDefault(),y(!0)},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",title:"Caption",children:e.jsx(d.Type,{className:"w-4 h-4"})}),e.jsx("button",{onMouseDown:l=>{l.preventDefault(),w(!0)},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",title:"Alt Text / Title",children:"Alt"}),e.jsx("button",{onMouseDown:l=>{l.preventDefault(),o()},className:"p-2 text-red-500 hover:text-red-400 hover:bg-red-500/10 rounded-lg transition-colors",children:e.jsx(d.Trash2,{className:"w-4 h-4"})})]})]})})]})},Ie=L.Node.create({name:"tweet",group:"block",atom:!0,addAttributes(){return{tweetId:{default:null},url:{default:null},align:{default:"center"},width:{default:"100%"},caption:{default:""},captionPosition:{default:"below"},alt:{default:""}}},parseHTML(){return[{tag:'div[data-type="tweet"]',getAttrs:t=>{if(typeof t=="string")return!1;const s=t.getAttribute("data-url")||"";return s&&!/^https?:\/\/(www\.)?(twitter|x)\.com\//i.test(s)?!1:null}},{tag:"blockquote.twitter-tweet"}]},renderHTML({HTMLAttributes:t}){const s=t.url||"";return s&&!/^https?:\/\/(www\.)?(twitter|x)\.com\//i.test(s)?["div"]:["div",L.mergeAttributes(t,{"data-type":"tweet","data-url":s})]},addNodeView(){return I.ReactNodeViewRenderer(Ae)}});function _e(t){let s=t||"";return s=s.split("?")[0].split("#")[0],s=s.replace(/(\/embed\/?)+$/,""),s=s.replace("/reels/","/reel/"),s.includes("instagram.com")&&!s.includes("www.instagram.com")&&(s=s.replace("instagram.com","www.instagram.com")),s.endsWith("/")||(s+="/"),s}const Le=({node:t,updateAttributes:s,deleteNode:o,selected:r,editor:h})=>{const[f,j]=x.useState(!1),[i,c]=x.useState(!1),[w,N]=x.useState(!1),y=t.attrs.align||"center",C=t.attrs.width||"100%",g=t.attrs.caption||"",b=t.attrs.captionPosition||"below",D=t.attrs.alt||"",p=t.attrs.url||"",k=_e(p);let S="w-full relative my-8 flex flex-col outline-none group cursor-pointer ";y==="left"?S+="items-start mr-auto ml-0":y==="right"?S+="items-end ml-auto mr-0":S+="items-center mx-auto";const T=()=>{let a=String(C).trim();if(a.endsWith("%")){const u=parseInt(a.replace("%",""),10);!isNaN(u)&&u<30&&(a="30%")}else{const u=parseInt(a.replace("px",""),10);!isNaN(u)&&u<250?a="250px":!isNaN(u)&&!a.endsWith("px")&&(a=`${u}px`)}s({width:a}),N(!1)};return e.jsxs(I.NodeViewWrapper,{className:S,children:[g&&b==="above"&&e.jsx("p",{className:"text-steel text-xs md:text-sm italic mb-3 uppercase tracking-widest font-medium px-2",children:g}),e.jsxs("div",{style:{width:C},className:`w-full max-w-[540px] min-w-[250px] rounded-2xl bg-charcoal/40 border border-smoke/30 p-6 flex flex-col items-center gap-4 transition-all duration-300 relative ${r?"ring-4 ring-amber ring-offset-4 ring-offset-obsidian":""}`,title:D,children:[h.isEditable&&e.jsx("div",{className:"absolute inset-0 z-10 cursor-pointer",title:"Click to edit embed"}),e.jsx("div",{className:`w-16 h-16 rounded-2xl bg-gradient-to-tr from-[#f9ce34] via-[#ee2a7b] to-[#6228d7] flex items-center justify-center shadow-lg shadow-pink-500/10 ${h.isEditable?"pointer-events-none":""}`,children:e.jsxs("svg",{className:"w-9 h-9 text-white",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"2",width:"20",height:"20",rx:"5",ry:"5"}),e.jsx("path",{d:"M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z"}),e.jsx("line",{x1:"17.5",y1:"6.5",x2:"17.51",y2:"6.5"})]})}),e.jsxs("div",{className:"text-center space-y-1.5 w-full",children:[e.jsx("span",{className:"text-[10px] text-amber uppercase tracking-widest font-bold",children:"Instagram Embed"}),e.jsx("h4",{className:"text-sm font-semibold text-bone truncate max-w-xs mx-auto",title:k,children:k}),e.jsx("p",{className:"text-[11px] text-steel max-w-[280px] mx-auto leading-relaxed",children:"Browser cookie blocking is active in localhost. This embed will hydrate and load beautifully on your live secure HTTPS site!"})]})]}),g&&b==="below"&&e.jsx("p",{className:"text-steel text-xs md:text-sm italic mt-3 uppercase tracking-widest font-medium px-2",children:g}),r&&e.jsx("div",{className:"absolute -top-14 left-1/2 -translate-x-1/2 z-50 bg-charcoal border border-smoke rounded-xl shadow-2xl flex items-center divide-x divide-smoke/30 h-11 px-1",onMouseDown:a=>a.stopPropagation(),onKeyDown:a=>a.stopPropagation(),children:f?e.jsxs("div",{className:"flex items-center px-2 py-1 gap-2",children:[e.jsx("input",{type:"text",autoFocus:!0,placeholder:"Alt text / Title...",value:D,onChange:a=>s({alt:a.target.value}),onKeyDown:a=>{a.key==="Enter"&&j(!1)},className:"bg-obsidian border border-smoke/50 rounded-lg px-3 py-1 text-xs text-bone focus:outline-none focus:border-amber w-40"}),e.jsx("button",{onMouseDown:a=>{a.preventDefault(),j(!1)},className:"text-[10px] text-amber uppercase font-bold px-1",children:"Done"})]}):i?e.jsxs("div",{className:"flex items-center px-2 py-1 gap-2",children:[e.jsx("input",{type:"text",autoFocus:!0,placeholder:"Caption...",value:g,onChange:a=>s({caption:a.target.value}),onKeyDown:a=>{a.key==="Enter"&&c(!1)},className:"bg-obsidian border border-smoke/50 rounded-lg px-3 py-1 text-xs text-bone focus:outline-none focus:border-amber w-40"}),e.jsx("button",{onMouseDown:a=>{a.preventDefault(),s({captionPosition:b==="above"?"below":"above"})},className:"p-1.5 text-steel hover:text-amber rounded",title:"Toggle Position",children:e.jsx(d.Layout,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onMouseDown:a=>{a.preventDefault(),c(!1)},className:"text-[10px] text-amber uppercase font-bold px-1",children:"Done"})]}):w?e.jsxs("div",{className:"flex items-center px-2 py-1 gap-2",children:[e.jsx("input",{type:"text",autoFocus:!0,placeholder:"Size (px or %)...",value:C,onChange:a=>s({width:a.target.value}),onKeyDown:a=>{a.key==="Enter"&&T()},className:"bg-obsidian border border-smoke/50 rounded-lg px-3 py-1 text-xs text-bone focus:outline-none focus:border-amber w-32"}),e.jsx("button",{onMouseDown:a=>{a.preventDefault(),T()},className:"text-[10px] text-amber uppercase font-bold px-1",children:"Done"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex px-1 items-center gap-0.5",children:[e.jsx("button",{onMouseDown:a=>{a.preventDefault(),s({width:"100%"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-all",title:"Full Width",children:e.jsx(d.Maximize,{className:"w-4 h-4"})}),e.jsx("button",{onMouseDown:a=>{a.preventDefault(),N(!0)},className:"text-[10px] font-bold text-bone hover:text-amber px-2 py-1 transition-all",children:"Size"})]}),e.jsxs("div",{className:"flex px-1 items-center gap-0.5",children:[e.jsx("button",{onMouseDown:a=>{a.preventDefault(),s({align:"left"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",children:e.jsx(d.AlignLeft,{className:"w-4 h-4"})}),e.jsx("button",{onMouseDown:a=>{a.preventDefault(),s({align:"center"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",children:e.jsx(d.AlignCenter,{className:"w-4 h-4"})}),e.jsx("button",{onMouseDown:a=>{a.preventDefault(),s({align:"right"})},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",children:e.jsx(d.AlignRight,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"flex px-1 items-center gap-0.5",children:[e.jsx("button",{onMouseDown:a=>{a.preventDefault(),c(!0)},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",title:"Caption",children:e.jsx(d.Type,{className:"w-4 h-4"})}),e.jsx("button",{onMouseDown:a=>{a.preventDefault(),j(!0)},className:"p-2 text-bone hover:text-amber rounded-lg transition-colors",title:"Alt Text / Title",children:"Alt"}),e.jsx("button",{onMouseDown:a=>{a.preventDefault(),o()},className:"p-2 text-red-500 hover:text-red-400 hover:bg-red-500/10 rounded-lg transition-colors",children:e.jsx(d.Trash2,{className:"w-4 h-4"})})]})]})})]})},Pe=L.Node.create({name:"instagram",group:"block",atom:!0,addAttributes(){return{url:{default:null},align:{default:"center"},width:{default:"100%"},caption:{default:""},captionPosition:{default:"below"},alt:{default:""}}},parseHTML(){return[{tag:'div[data-type="instagram"]',getAttrs:t=>{if(typeof t=="string")return!1;const s=t.getAttribute("data-url")||"";return s&&!/^https?:\/\/(www\.)?instagram\.com\//i.test(s)?!1:null}},{tag:"blockquote.instagram-media"}]},renderHTML({HTMLAttributes:t}){const s=t.url||"";return s&&!/^https?:\/\/(www\.)?instagram\.com\//i.test(s)?["div"]:["div",L.mergeAttributes(t,{"data-type":"instagram","data-url":s})]},addNodeView(){return I.ReactNodeViewRenderer(Le)}}),Oe=({deleteNode:t,selected:s,editor:o})=>e.jsxs(I.NodeViewWrapper,{className:`my-6 relative transition-all duration-300 rounded-xl overflow-hidden border-2
|
|
23
|
+
${s?"border-amber shadow-[0_0_15px_rgba(255,191,0,0.2)]":"border-amber/40 border-dashed hover:border-amber/70"}`,children:[e.jsxs("div",{className:"bg-amber/10 px-4 py-2 border-b border-amber/20 flex items-center justify-between select-none",children:[e.jsxs("div",{className:"flex items-center gap-2 text-amber font-display font-semibold tracking-wide text-sm",children:[e.jsx(d.Archive,{className:"w-4 h-4"}),e.jsxs("span",{children:["STASHED NOTE ",e.jsx("span",{className:"opacity-60 text-xs ml-1",children:"(Internal Only)"})]})]}),o.isEditable&&e.jsx("button",{onClick:t,className:"p-1.5 text-amber/60 hover:text-red-400 hover:bg-red-400/10 rounded-lg transition-colors",title:"Delete Stash",children:e.jsx(d.Trash2,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"bg-charcoal/50 p-4 md:p-6 text-bone/90 prose-p:my-2 first:prose-p:mt-0 last:prose-p:mb-0",children:e.jsx(I.NodeViewContent,{className:"min-h-[2rem]"})})]}),ze=L.Node.create({name:"stash",group:"block",content:"block+",defining:!0,parseHTML(){return[{tag:'div[data-type="stash"]'}]},renderHTML({HTMLAttributes:t}){return["div",L.mergeAttributes(t,{"data-type":"stash"}),0]},addNodeView(){return I.ReactNodeViewRenderer(Oe)}}),He=({node:t,updateAttributes:s,selected:o})=>{const{emoji:r,type:h}=t.attrs,f={info:"bg-blue-500/10 border-blue-500/30 text-blue-100",warning:"bg-amber-500/10 border-amber-500/30 text-amber-100",success:"bg-emerald-500/10 border-emerald-500/30 text-emerald-100",error:"bg-red-500/10 border-red-500/30 text-red-100"},j=f[h]||f.info,i=()=>{const c=["💡","⚠️","✅","❌","🔥","📌","✨"],w=c.indexOf(r),N=c[(w+1)%c.length];let y="info";N==="⚠️"&&(y="warning"),N==="✅"&&(y="success"),N==="❌"&&(y="error"),s({emoji:N,type:y})};return e.jsxs(I.NodeViewWrapper,{className:`my-6 flex gap-4 p-4 md:p-5 rounded-2xl border transition-all duration-300
|
|
24
|
+
${j}
|
|
25
|
+
${o?"ring-2 ring-white/20 shadow-lg":"shadow-md"}
|
|
26
|
+
`,children:[e.jsx("button",{contentEditable:!1,onClick:i,className:"text-2xl shrink-0 mt-0.5 hover:scale-110 active:scale-95 transition-transform select-none cursor-pointer",title:"Change Icon",children:r}),e.jsx("div",{className:"flex-1 font-medium leading-relaxed",children:e.jsx(I.NodeViewContent,{className:"min-h-[1.5rem]"})})]})},$e=L.Node.create({name:"callout",group:"block",content:"inline*",defining:!0,addAttributes(){return{emoji:{default:"💡"},type:{default:"info"}}},parseHTML(){return[{tag:'div[data-type="callout"]'}]},renderHTML({HTMLAttributes:t}){return["div",L.mergeAttributes(t,{"data-type":"callout"}),0]},addNodeView(){return I.ReactNodeViewRenderer(He)}}),le=x.forwardRef((t,s)=>{const[o,r]=x.useState(0),h=c=>{const w=t.items[c];w&&t.command(w)},f=()=>{r((o+t.items.length-1)%t.items.length)},j=()=>{r((o+1)%t.items.length)},i=()=>{h(o)};return x.useEffect(()=>{r(0)},[t.items]),x.useImperativeHandle(s,()=>({onKeyDown:({event:c})=>c.key==="ArrowUp"?(f(),!0):c.key==="ArrowDown"?(j(),!0):c.key==="Enter"?(i(),!0):!1})),t.items.length?e.jsx("div",{className:"bg-obsidian border border-smoke/60 shadow-2xl rounded-xl overflow-hidden py-2 min-w-[240px]",children:t.items.map((c,w)=>{const N=c.icon;return e.jsxs("button",{className:`w-full flex items-center gap-3 px-4 py-2.5 text-left transition-colors
|
|
27
|
+
${w===o?"bg-amber/10 text-amber":"text-bone hover:bg-charcoal/50 hover:text-amber/80"}`,onClick:()=>h(w),children:[e.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md bg-charcoal/30 border border-smoke/30 shrink-0",children:e.jsx(N,{className:"w-4 h-4"})}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-semibold text-sm font-display tracking-wide",children:c.title}),e.jsx("span",{className:"text-xs text-steel",children:c.description})]})]},w)})}):null});le.displayName="CommandList";const qe=({query:t})=>[{title:"Heading 1",description:"Big section heading.",icon:d.Heading1,command:({editor:o,range:r})=>{o.chain().focus().deleteRange(r).setNode("heading",{level:1}).run()}},{title:"Heading 2",description:"Medium section heading.",icon:d.Heading2,command:({editor:o,range:r})=>{o.chain().focus().deleteRange(r).setNode("heading",{level:2}).run()}},{title:"Heading 3",description:"Small section heading.",icon:d.Heading3,command:({editor:o,range:r})=>{o.chain().focus().deleteRange(r).setNode("heading",{level:3}).run()}},{title:"Bullet List",description:"Create a simple bulleted list.",icon:d.List,command:({editor:o,range:r})=>{o.chain().focus().deleteRange(r).toggleBulletList().run()}},{title:"Numbered List",description:"Create a list with numbering.",icon:d.ListOrdered,command:({editor:o,range:r})=>{o.chain().focus().deleteRange(r).toggleOrderedList().run()}},{title:"Quote",description:"Capture a quote.",icon:d.Quote,command:({editor:o,range:r})=>{o.chain().focus().deleteRange(r).toggleBlockquote().run()}},{title:"Task List",description:"Track tasks with a to-do list.",icon:d.CheckSquare,command:({editor:o,range:r})=>{o.chain().focus().deleteRange(r).toggleTaskList().run()}},{title:"Code Block",description:"Capture a code snippet.",icon:d.Code,command:({editor:o,range:r})=>{o.chain().focus().deleteRange(r).toggleCodeBlock().run()}},{title:"Callout",description:"Highlight important information.",icon:d.MessageSquareWarning,command:({editor:o,range:r})=>{o.chain().focus().deleteRange(r).insertContent({type:"callout",content:[{type:"paragraph"}]}).run()}},{title:"Stash Note",description:"Hidden journalist draft note.",icon:d.Archive,command:({editor:o,range:r})=>{o.chain().focus().deleteRange(r).insertContent({type:"stash",content:[{type:"paragraph"}]}).run()}}].filter(o=>o.title.toLowerCase().includes(t.toLowerCase())).slice(0,10),Fe=L.Extension.create({name:"slashMenu",addOptions(){return{suggestion:{char:"/",command:({editor:t,range:s,props:o})=>{o.command({editor:t,range:s})}}}},addProseMirrorPlugins(){return[je({editor:this.editor,...this.options.suggestion,items:qe,render:()=>{let t,s;return{onStart:o=>{t=new I.ReactRenderer(le,{props:o,editor:o.editor}),o.clientRect&&(s=Ne("body",{getReferenceClientRect:o.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"}))},onUpdate(o){t.updateProps(o),o.clientRect&&s[0].setProps({getReferenceClientRect:o.clientRect})},onKeyDown(o){var r;return o.event.key==="Escape"?(s[0].hide(),!0):(r=t.ref)==null?void 0:r.onKeyDown(o)},onExit(){s[0].destroy(),t.destroy()}}}})]}}),Ve=ke.Underline.extend({addAttributes(){return{color:{default:null,parseHTML:t=>t.style.textDecorationColor||null,renderHTML:t=>t.color?{style:`text-decoration-color: ${t.color};`}:{}}}},addCommands(){return{setUnderline:t=>({commands:s})=>s.setMark(this.name,t),toggleUnderline:t=>({commands:s})=>s.toggleMark(this.name,t),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}}}),Ue=Ce.Strike.extend({addAttributes(){return{color:{default:null,parseHTML:t=>t.style.textDecorationColor||null,renderHTML:t=>t.color?{style:`text-decoration-color: ${t.color};`}:{}}}},addCommands(){return{setStrike:t=>({commands:s})=>s.setMark(this.name,t),toggleStrike:t=>({commands:s})=>s.toggleMark(this.name,t),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}}}),We=ne.createLowlight(ne.common);typeof window<"u"&&ae.addHook("uponSanitizeElement",(t,s)=>{var o;s.tagName==="iframe"&&((t.getAttribute("src")||"").startsWith("https://www.youtube.com/embed/")||(o=t.parentNode)==null||o.removeChild(t))});const ce=({initialContent:t,onChange:s,uploadImage:o,children:r,minHeightClass:h="min-h-[150px]",maxHeightClass:f="max-h-[500px]"})=>{const[j,i]=x.useState(!0),[c,w]=x.useState(!1),[N,y]=x.useState("link"),[C,g]=x.useState(""),b=I.useEditor({extensions:[ue.configure({heading:{levels:[1,2,3]},strike:!1,codeBlock:!1}),Ve,Ue,pe.TextStyle,he.Color,be.configure({types:["heading","paragraph","image","youtube"]}),ge.configure({openOnClick:!1,HTMLAttributes:{class:"text-amber hover:text-amber/80 transition-colors underline underline-offset-4 cursor-pointer"}}),Se.configure({inline:!1}),Re.configure({inline:!1}),Ie,Pe,ze,$e,we,me.configure({lowlight:We}),xe,fe.configure({nested:!0}),Fe,ye.configure({dragHandleWidth:20,scrollTreshold:100})],content:typeof t=="string"?t?ae.sanitize(t,{ADD_TAGS:["iframe"],ADD_ATTR:["allowfullscreen","frameborder","src"]}):"<p></p>":t,onUpdate:({editor:D})=>{i(!1);const p=D.getJSON(),k=D.getHTML();s&&s(p,k),setTimeout(()=>i(!0),800)},editorProps:{attributes:{class:"prose prose-invert max-w-none focus:outline-none min-h-full p-4 sm:p-6 md:p-8 pb-16 md:pb-24 text-bone font-body leading-relaxed prose-p:my-1 prose-headings:my-4"}}});return x.useEffect(()=>{const D=async p=>{const k=p,{file:S,position:T}=k.detail;if(S)if(o){i(!1);try{const a=await o(S);T!==void 0?b==null||b.chain().insertContentAt(T,{type:"image",attrs:{src:a}}).focus().run():b==null||b.chain().focus().insertContent({type:"image",attrs:{src:a}}).run()}catch(a){console.error("Image upload failed",a)}finally{i(!0)}}else{const a=URL.createObjectURL(S);T!==void 0?b==null||b.chain().insertContentAt(T,{type:"image",attrs:{src:a}}).focus().run():b==null||b.chain().focus().insertContent({type:"image",attrs:{src:a}}).run()}};return window.addEventListener("axiom-image-upload",D),()=>window.removeEventListener("axiom-image-upload",D)},[b,o]),e.jsx(ie.Provider,{value:{editor:b,isSaved:j,setIsSaved:i,mediaModalOpen:c,setMediaModalOpen:w,mediaModalType:N,setMediaModalType:y,mediaModalInput:C,setMediaModalInput:g,uploadImage:o,minHeightClass:h,maxHeightClass:f},children:r})},E=x.forwardRef(({active:t,icon:s,label:o,variant:r="icon",className:h="",...f},j)=>{const i="transition-all rounded-lg shrink-0 flex items-center justify-center gap-2",c=r==="icon"?"p-2.5":"px-3 py-2 text-xs font-semibold",w=t?"text-amber bg-amber/5":"text-steel hover:text-amber hover:bg-amber/5",N=f.disabled?"opacity-30 cursor-not-allowed":"";return e.jsxs("button",{ref:j,type:"button",className:`${i} ${c} ${w} ${N} ${h}`,...f,children:[s,o&&e.jsx("span",{className:"hidden lg:inline",children:o})]})});E.displayName="ToolbarButton";const Be=()=>{const{editor:t,isSaved:s,setMediaModalOpen:o,setMediaModalType:r,setMediaModalInput:h}=Y(),[f,j]=x.useState(!1),i=x.useRef(null),[c,w]=x.useState(!1),N=x.useRef(null),[y,C]=x.useState(!1),g=x.useRef(null);if(x.useEffect(()=>{const p=k=>{i.current&&!i.current.contains(k.target)&&j(!1),N.current&&!N.current.contains(k.target)&&w(!1),g.current&&!g.current.contains(k.target)&&C(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]),!t)return null;const b=p=>{h(""),r(p),o(!0)},D=()=>{const p=t.state.selection.from,k=document.createElement("input");k.type="file",k.accept="image/*",k.onchange=async S=>{var a;const T=(a=S.target.files)==null?void 0:a[0];T&&window.dispatchEvent(new CustomEvent("axiom-image-upload",{detail:{file:T,position:p}}))},k.click()};return e.jsx("div",{className:"-mx-1 px-1 mb-2",children:e.jsxs("div",{className:"flex items-center gap-1 p-2 bg-obsidian border border-smoke/60 rounded-xl sticky top-4 z-20 shadow-xl shadow-black/20 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-0.5 mr-1",children:[e.jsx(E,{icon:e.jsx(d.Undo,{className:"w-4 h-4"}),title:"Undo",onClick:()=>t.chain().focus().undo().run(),disabled:!t.can().undo()}),e.jsx(E,{icon:e.jsx(d.Redo,{className:"w-4 h-4"}),title:"Redo",onClick:()=>t.chain().focus().redo().run(),disabled:!t.can().redo()})]}),e.jsx("div",{className:"w-px h-6 bg-smoke/60 mx-1"}),e.jsx(E,{icon:e.jsx(d.Bold,{className:"w-4 h-4"}),title:"Bold",active:t.isActive("bold"),onClick:()=>t.chain().focus().toggleBold().run()}),e.jsx(E,{icon:e.jsx(d.Italic,{className:"w-4 h-4"}),title:"Italic",active:t.isActive("italic"),onClick:()=>t.chain().focus().toggleItalic().run()}),e.jsxs("div",{ref:N,className:"relative",children:[e.jsx(E,{icon:e.jsx(d.Underline,{className:"w-4 h-4"}),title:"Underline",active:t.isActive("underline"),onClick:()=>{t.isActive("underline")?t.chain().focus().unsetUnderline().run():w(!c)}}),c&&e.jsxs("div",{className:"absolute top-full left-0 mt-2 p-3 bg-charcoal border border-smoke/80 rounded-xl shadow-2xl grid grid-cols-4 gap-2 z-30 min-w-[120px]",children:[["#f9761f","#ffffff","#94a3b8","#ef4444","#22c55e","#3b82f6","#a855f7","#eab308"].map(p=>e.jsx("button",{type:"button",onClick:()=>{t.chain().focus().setUnderline({color:p}).run(),w(!1)},className:"w-6 h-6 rounded-full border border-white/10 hover:scale-110 active:scale-95 transition-all shadow-md cursor-pointer",style:{backgroundColor:p},title:p},p)),e.jsx("button",{type:"button",onClick:()=>{t.chain().focus().unsetUnderline().run(),w(!1)},className:"w-6 h-6 rounded-full border border-white/20 hover:scale-110 active:scale-95 transition-all flex items-center justify-center bg-transparent cursor-pointer text-red-500 font-bold text-xs",title:"Remove Underline",style:{display:"flex",alignItems:"center",justifyContent:"center"},children:"/"})]})]}),e.jsxs("div",{ref:g,className:"relative",children:[e.jsx(E,{icon:e.jsx(d.Strikethrough,{className:"w-4 h-4"}),title:"Strikethrough",active:t.isActive("strike"),onClick:()=>{t.isActive("strike")?t.chain().focus().unsetStrike().run():C(!y)}}),y&&e.jsxs("div",{className:"absolute top-full left-0 mt-2 p-3 bg-charcoal border border-smoke/80 rounded-xl shadow-2xl grid grid-cols-4 gap-2 z-30 min-w-[120px]",children:[["#f9761f","#ffffff","#94a3b8","#ef4444","#22c55e","#3b82f6","#a855f7","#eab308"].map(p=>e.jsx("button",{type:"button",onClick:()=>{t.chain().focus().setStrike({color:p}).run(),C(!1)},className:"w-6 h-6 rounded-full border border-white/10 hover:scale-110 active:scale-95 transition-all shadow-md cursor-pointer",style:{backgroundColor:p},title:p},p)),e.jsx("button",{type:"button",onClick:()=>{t.chain().focus().unsetStrike().run(),C(!1)},className:"w-6 h-6 rounded-full border border-white/20 hover:scale-110 active:scale-95 transition-all flex items-center justify-center bg-transparent cursor-pointer text-red-500 font-bold text-xs",title:"Remove Strikethrough",style:{display:"flex",alignItems:"center",justifyContent:"center"},children:"/"})]})]}),e.jsxs("div",{ref:i,className:"relative",children:[e.jsx(E,{icon:e.jsx(d.Highlighter,{className:"w-4 h-4"}),title:"Text Color",active:!!t.getAttributes("textStyle").color,onClick:()=>{t.getAttributes("textStyle").color?t.chain().focus().unsetColor().run():j(!f)}}),f&&e.jsxs("div",{className:"absolute top-full left-0 mt-2 p-3 bg-charcoal border border-smoke/80 rounded-xl shadow-2xl grid grid-cols-4 gap-2 z-30 min-w-[120px]",children:[["#f9761f","#ffffff","#94a3b8","#ef4444","#22c55e","#3b82f6","#a855f7","#eab308"].map(p=>e.jsx("button",{type:"button",onClick:()=>{t.chain().focus().setColor(p).run(),j(!1)},className:"w-6 h-6 rounded-full border border-white/10 hover:scale-110 active:scale-95 transition-all shadow-md cursor-pointer",style:{backgroundColor:p},title:p},p)),e.jsx("button",{type:"button",onClick:()=>{t.chain().focus().unsetColor().run(),j(!1)},className:"w-6 h-6 rounded-full border border-white/20 hover:scale-110 active:scale-95 transition-all flex items-center justify-center bg-transparent cursor-pointer text-red-500 font-bold text-xs",title:"Remove Text Color",style:{display:"flex",alignItems:"center",justifyContent:"center"},children:"/"})]})]}),e.jsx(E,{icon:e.jsx(d.Link,{className:"w-4 h-4"}),title:"Link",active:t.isActive("link"),onClick:()=>t.getAttributes("link").href?t.chain().focus().unsetLink().run():b("link")}),e.jsx("div",{className:"w-px h-6 bg-smoke/60 mx-1"}),e.jsx(E,{variant:"text",label:"H1",title:"Heading 1",active:t.isActive("heading",{level:1}),onClick:()=>t.chain().focus().toggleHeading({level:1}).run()}),e.jsx(E,{variant:"text",label:"H2",title:"Heading 2",active:t.isActive("heading",{level:2}),onClick:()=>t.chain().focus().toggleHeading({level:2}).run()}),e.jsx(E,{variant:"text",label:"H3",title:"Heading 3",active:t.isActive("heading",{level:3}),onClick:()=>t.chain().focus().toggleHeading({level:3}).run()}),e.jsx(E,{icon:e.jsx(d.Quote,{className:"w-4 h-4"}),title:"Blockquote",active:t.isActive("blockquote"),onClick:()=>t.chain().focus().toggleBlockquote().run()}),e.jsx(E,{icon:e.jsx(d.Code,{className:"w-4 h-4"}),title:"Code Block",active:t.isActive("codeBlock"),onClick:()=>t.chain().focus().toggleCodeBlock().run()}),e.jsx(E,{icon:e.jsx(d.MessageSquareWarning,{className:"w-4 h-4"}),title:"Callout",active:t.isActive("callout"),onClick:()=>t.chain().focus().insertContent({type:"callout",content:[{type:"paragraph"}]}).run()}),e.jsx("div",{className:"w-px h-6 bg-smoke/60 mx-1"}),e.jsx(E,{icon:e.jsx(d.List,{className:"w-4 h-4"}),title:"Bullet List",active:t.isActive("bulletList"),onClick:()=>t.chain().focus().toggleBulletList().run()}),e.jsx(E,{icon:e.jsx(d.ListOrdered,{className:"w-4 h-4"}),title:"Numbered List",active:t.isActive("orderedList"),onClick:()=>t.chain().focus().toggleOrderedList().run()}),e.jsx(E,{icon:e.jsx(d.CheckSquare,{className:"w-4 h-4"}),title:"Task List",active:t.isActive("taskList"),onClick:()=>t.chain().focus().toggleTaskList().run()}),e.jsx("div",{className:"w-px h-6 bg-smoke/60 mx-1"}),e.jsx(E,{icon:e.jsx(d.AlignLeft,{className:"w-4 h-4"}),title:"Align Left",active:t.isActive({textAlign:"left"}),onClick:()=>t.chain().focus().setTextAlign("left").run()}),e.jsx(E,{icon:e.jsx(d.AlignCenter,{className:"w-4 h-4"}),title:"Align Center",active:t.isActive({textAlign:"center"}),onClick:()=>t.chain().focus().setTextAlign("center").run()}),e.jsx(E,{icon:e.jsx(d.AlignRight,{className:"w-4 h-4"}),title:"Align Right",active:t.isActive({textAlign:"right"}),onClick:()=>t.chain().focus().setTextAlign("right").run()}),e.jsx("div",{className:"w-px h-6 bg-smoke/60 mx-1"}),e.jsx(E,{icon:e.jsx(d.ImagePlus,{className:"w-4 h-4"}),label:"Image",title:"Insert Image",onClick:D}),e.jsx(E,{icon:e.jsx(d.Video,{className:"w-4 h-4"}),label:"Video",title:"Insert Video",onClick:()=>b("video")}),e.jsx(E,{icon:e.jsx(d.MessageSquare,{className:"w-4 h-4"}),label:"Tweet",title:"Insert Tweet",onClick:()=>b("tweet")}),e.jsx(E,{icon:e.jsx(d.Camera,{className:"w-4 h-4"}),label:"Instagram",title:"Insert Instagram",onClick:()=>b("instagram")}),e.jsx("div",{className:"flex-1"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"text-xs text-steel font-medium tracking-wide",children:[t.storage.characterCount.words()," words"]}),e.jsx("div",{className:"flex items-center gap-2 px-3 py-1 bg-white/5 rounded-lg border border-white/5",children:s?e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-emerald-400 font-semibold uppercase tracking-wider",children:[e.jsx(d.CheckCircle2,{className:"w-3 h-3"}),e.jsx("span",{children:"Saved"})]}):e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-amber/70 font-semibold uppercase tracking-wider",children:[e.jsx(d.CloudUpload,{className:"w-3 h-3 animate-pulse"}),e.jsx("span",{children:"Syncing"})]})})]})]})})},Ye=()=>{const{editor:t}=Y();return t?e.jsx("div",{className:"axiom-editor-canvas relative border border-smoke/60 rounded-xl overflow-y-auto overflow-x-hidden shadow-inner bg-obsidian text-bone transition-colors duration-300 custom-scrollbar axiom-editor-fixed-size min-h-0",children:e.jsx(I.EditorContent,{editor:t,className:"min-h-full"})}):null},Ke=()=>{const{editor:t,mediaModalOpen:s,setMediaModalOpen:o,mediaModalType:r,mediaModalInput:h,setMediaModalInput:f}=Y(),j=x.useCallback(()=>{const i=h.trim();if(!i||!t){o(!1);return}if(r==="link"){let c=i;!/^https?:\/\//i.test(c)&&!/^mailto:/i.test(c)&&!/^tel:/i.test(c)&&(c="https://"+c),t.chain().focus().extendMarkRange("link").setLink({href:c}).run()}else r==="video"?t.chain().focus().setYoutubeVideo({src:i}).run():r==="tweet"?t.chain().focus().insertContent({type:"tweet",attrs:{url:i}}).run():r==="instagram"&&t.chain().focus().insertContent({type:"instagram",attrs:{url:i}}).run();o(!1),f("")},[h,r,t,o,f]);return s?e.jsx("div",{className:"fixed inset-0 z-[9999] bg-black/80 flex items-center justify-center p-4 backdrop-blur-sm",children:e.jsxs("div",{className:"bg-obsidian border border-smoke/60 p-5 md:p-6 rounded-2xl w-full max-w-md shadow-2xl mx-4 sm:mx-0",children:[e.jsxs("h3",{className:"text-bone font-display font-semibold mb-4",children:[r==="link"&&"Insert Hyperlink",r==="video"&&"Insert YouTube Embed",r==="tweet"&&"Insert X / Twitter Embed",r==="instagram"&&"Insert Instagram Embed"]}),e.jsx("input",{type:"text",value:h,onChange:i=>f(i.target.value),placeholder:r==="link"?"https://example.com":r==="video"?"https://youtube.com/watch?v=...":r==="tweet"?"https://x.com/username/status/...":"https://instagram.com/reel/...",className:"w-full bg-charcoal/30 border border-smoke/60 rounded-xl px-4 py-3 text-bone focus:outline-none focus:border-amber mb-6 transition-colors text-sm",autoFocus:!0,onKeyDown:i=>{i.key==="Enter"?(i.preventDefault(),j()):i.key==="Escape"&&o(!1)}}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:()=>o(!1),className:"px-5 py-2.5 text-steel hover:text-bone text-sm font-medium transition-colors",children:"Cancel"}),e.jsxs("button",{type:"button",onClick:j,className:"px-5 py-2.5 bg-amber hover:bg-amber/90 text-obsidian font-semibold rounded-xl text-sm transition-all shadow-[0_0_15px_rgba(255,191,0,0.15)]",children:[r==="link"&&"Insert Link",r==="video"&&"Insert Video",r==="tweet"&&"Insert Tweet",r==="instagram"&&"Insert Instagram"]})]})]})}):null},Je=({initialContent:t,onChange:s,uploadImage:o,minHeightClass:r,maxHeightClass:h})=>e.jsx(ce,{initialContent:t,onChange:s,uploadImage:o,minHeightClass:r,maxHeightClass:h,children:e.jsxs("div",{className:"axiom-editor-wrapper flex flex-col gap-4",children:[e.jsx(Be,{}),e.jsx(Ye,{}),e.jsx(Ke,{})]})}),X=(t,s)=>{var f,j;if(t.type==="doc")return e.jsx(e.Fragment,{children:(f=t.content)==null?void 0:f.map((i,c)=>X(i,c))});if(t.type==="text"){let i=t.text||"";return t.marks&&t.marks.forEach(c=>{var w,N,y,C;if(c.type==="bold"&&(i=e.jsx("strong",{children:i},c.type)),c.type==="italic"&&(i=e.jsx("em",{children:i},c.type)),c.type==="underline"){const g=(w=c.attrs)==null?void 0:w.color;i=e.jsx("u",{style:g?{textDecorationColor:g}:{},children:i},c.type)}if(c.type==="strike"){const g=(N=c.attrs)==null?void 0:N.color;i=e.jsx("s",{style:g?{textDecorationColor:g}:{},children:i},c.type)}if(c.type==="textStyle"){const g=(y=c.attrs)==null?void 0:y.color;g&&(i=e.jsx("span",{style:{color:g},children:i},c.type))}if(c.type==="link"){const g=(C=c.attrs)==null?void 0:C.href;g&&(i=e.jsx("a",{href:g,target:"_blank",rel:"noopener noreferrer",className:"text-amber hover:text-amber/80 transition-colors underline underline-offset-4",children:i},c.type))}}),e.jsx(x.Fragment,{children:i},s)}const o=(j=t.content)==null?void 0:j.map((i,c)=>X(i,c)),r=t.attrs||{},h=r.textAlign?{textAlign:r.textAlign}:{};switch(t.type){case"paragraph":return e.jsx("p",{style:h,children:o},s);case"heading":{const i=`h${r.level||1}`;return e.jsx(i,{style:h,children:o},s)}case"blockquote":return e.jsx("blockquote",{className:"border-l-4 border-amber/50 pl-4 py-1 italic bg-charcoal/30 rounded-r-lg",children:o},s);case"bulletList":return e.jsx("ul",{className:"list-disc pl-6 marker:text-amber",children:o},s);case"orderedList":return e.jsx("ol",{className:"list-decimal pl-6 marker:text-amber",children:o},s);case"listItem":return e.jsx("li",{children:o},s);case"image":{const i=r.align||"center",c=r.width||"100%";let w="items-center mx-auto";return i==="left"&&(w="items-start mr-auto ml-0"),i==="right"&&(w="items-end ml-auto mr-0"),e.jsxs("div",{className:`flex flex-col my-8 w-full ${w}`,children:[r.caption&&r.captionPosition==="above"&&e.jsx("p",{className:"text-steel text-xs md:text-sm italic mb-3 uppercase tracking-widest font-medium px-2",children:r.caption}),e.jsx("img",{src:r.src,alt:r.alt||"",title:r.title,style:{width:c,minWidth:"150px"},className:"rounded-xl object-cover shadow-2xl border border-smoke/30 max-w-full"}),r.caption&&r.captionPosition==="below"&&e.jsx("p",{className:"text-steel text-xs md:text-sm italic mt-3 uppercase tracking-widest font-medium px-2",children:r.caption})]},s)}case"youtube":return e.jsx("div",{className:"my-8 aspect-video rounded-2xl overflow-hidden shadow-[0_0_40px_rgba(0,0,0,0.5)] border border-smoke/30 bg-black relative",children:e.jsx("iframe",{src:r.src,className:"absolute inset-0 w-full h-full border-0",allowFullScreen:!0})},s);case"tweet":return e.jsx("div",{className:"my-6",children:e.jsx("blockquote",{className:"twitter-tweet",children:e.jsx("a",{href:r.url})})},s);case"instagram":return e.jsx("div",{className:"my-6",children:e.jsx("blockquote",{className:"instagram-media","data-instgrm-permalink":r.url})},s);case"callout":{const i={info:"bg-blue-500/10 border-blue-500/30 text-blue-100",warning:"bg-amber-500/10 border-amber-500/30 text-amber-100",success:"bg-emerald-500/10 border-emerald-500/30 text-emerald-100",error:"bg-red-500/10 border-red-500/30 text-red-100"},c=i[r.type]||i.info;return e.jsxs("div",{className:`my-6 flex gap-4 p-4 md:p-5 rounded-2xl border shadow-md ${c}`,children:[e.jsx("div",{className:"text-2xl shrink-0 mt-0.5 select-none",children:r.emoji}),e.jsx("div",{className:"flex-1 font-medium leading-relaxed",children:o})]},s)}case"codeBlock":return e.jsx("pre",{className:"bg-obsidian border border-smoke/30 p-4 rounded-xl overflow-x-auto text-sm my-6 font-mono text-steel",children:e.jsx("code",{className:`language-${r.language||"plaintext"}`,children:o})},s);case"taskList":return e.jsx("ul",{className:"list-none pl-0 my-6 space-y-2","data-type":"taskList",children:o},s);case"taskItem":return e.jsxs("li",{className:"flex items-start gap-3","data-type":"taskItem",children:[e.jsx("input",{type:"checkbox",className:"mt-1.5 w-4 h-4 rounded border-smoke/30 bg-charcoal text-amber accent-amber cursor-not-allowed",checked:r.checked,readOnly:!0}),e.jsx("div",{className:"flex-1 text-bone",children:o})]},s);case"stash":return null;default:return e.jsx(x.Fragment,{children:o},s)}},Ge=({content:t})=>e.jsx("div",{className:"prose prose-invert max-w-none text-bone font-body leading-relaxed prose-p:my-1 prose-headings:my-4",children:X(t)});exports.AxiomEditor=Je;exports.AxiomEditorProvider=ce;exports.AxiomJSONRenderer=Ge;exports.useAxiomEditor=Y;
|