@zipify/wysiwyg 4.11.0-3 → 4.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/node.js CHANGED
@@ -1,39 +1,39 @@
1
- "use strict";var jp=require("jsdom");function mE(n){const e=Object.create(null);for(const t of n.split(","))e[t]=1;return t=>t in e}const us=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const mi=()=>{},gE=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&(n.charCodeAt(2)>122||n.charCodeAt(2)<97),or=Object.assign,yE=Object.prototype.hasOwnProperty,nc=(n,e)=>yE.call(n,e),Le=Array.isArray,gi=n=>$o(n)==="[object Map]",bE=n=>$o(n)==="[object Set]",Ye=n=>typeof n=="function",In=n=>typeof n=="string",cs=n=>typeof n=="symbol",ht=n=>n!==null&&typeof n=="object",wE=n=>(ht(n)||Ye(n))&&Ye(n.then)&&Ye(n.catch),SE=Object.prototype.toString,$o=n=>SE.call(n),Yp=n=>$o(n).slice(8,-1),xE=n=>$o(n)==="[object Object]",rc=n=>In(n)&&n!=="NaN"&&n[0]!=="-"&&""+parseInt(n,10)===n,kE=n=>{const e=Object.create(null);return t=>e[t]||(e[t]=n(t))},EE=kE(n=>n.charAt(0).toUpperCase()+n.slice(1)),lr=(n,e)=>!Object.is(n,e);let Xp;const Wo=()=>Xp||(Xp=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function ic(n){if(Le(n)){const e={};for(let t=0;t<n.length;t++){const r=n[t],i=In(r)?CE(r):ic(r);if(i)for(const o in i)e[o]=i[o]}return e}else if(In(n)||ht(n))return n}const _E=/;(?![^(]*\))/g,vE=/:([^]+)/,TE=/\/\*[^]*?\*\//g;function CE(n){const e={};return n.replace(TE,"").split(_E).forEach(t=>{if(t){const r=t.split(vE);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function sc(n){let e="";if(In(n))e=n;else if(Le(n))for(let t=0;t<n.length;t++){const r=sc(n[t]);r&&(e+=r+" ")}else if(ht(n))for(const t in n)n[t]&&(e+=t+" ");return e.trim()}function On(n,...e){console.warn(`[Vue warn] ${n}`,...e)}let be;const oc=new WeakSet;class ME{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,oc.has(this)&&(oc.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Qp(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,im(this),em(this);const e=be,t=Qt;be=this,Qt=!0;try{return this.fn()}finally{process.env.NODE_ENV!=="production"&&be!==this&&On("Active effect was not restored correctly - this is likely a Vue internal bug."),tm(this),be=e,Qt=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)cc(e);this.deps=this.depsTail=void 0,im(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?oc.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){uc(this)&&this.run()}get dirty(){return uc(this)}}let Zp=0,fs,ds;function Qp(n,e=!1){if(n.flags|=8,e){n.next=ds,ds=n;return}n.next=fs,fs=n}function lc(){Zp++}function ac(){if(--Zp>0)return;if(ds){let e=ds;for(ds=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let n;for(;fs;){let e=fs;for(fs=void 0;e;){const t=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(r){n||(n=r)}e=t}}if(n)throw n}function em(n){for(let e=n.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function tm(n){let e,t=n.depsTail,r=t;for(;r;){const i=r.prevDep;r.version===-1?(r===t&&(t=i),cc(r),AE(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=i}n.deps=e,n.depsTail=t}function uc(n){for(let e=n.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(nm(e.dep.computed)||e.dep.version!==e.version))return!0;return!!n._dirty}function nm(n){if(n.flags&4&&!(n.flags&16)||(n.flags&=-17,n.globalVersion===hs))return;n.globalVersion=hs;const e=n.dep;if(n.flags|=2,e.version>0&&!n.isSSR&&n.deps&&!uc(n)){n.flags&=-3;return}const t=be,r=Qt;be=n,Qt=!0;try{em(n);const i=n.fn(n._value);(e.version===0||lr(i,n._value))&&(n._value=i,e.version++)}catch(i){throw e.version++,i}finally{be=t,Qt=r,tm(n),n.flags&=-3}}function cc(n,e=!1){const{dep:t,prevSub:r,nextSub:i}=n;if(r&&(r.nextSub=i,n.prevSub=void 0),i&&(i.prevSub=r,n.nextSub=void 0),process.env.NODE_ENV!=="production"&&t.subsHead===n&&(t.subsHead=i),t.subs===n&&(t.subs=r,!r&&t.computed)){t.computed.flags&=-5;for(let o=t.computed.deps;o;o=o.nextDep)cc(o,!0)}!e&&!--t.sc&&t.map&&t.map.delete(t.key)}function AE(n){const{prevDep:e,nextDep:t}=n;e&&(e.nextDep=t,n.prevDep=void 0),t&&(t.prevDep=e,n.nextDep=void 0)}let Qt=!0;const rm=[];function Uo(){rm.push(Qt),Qt=!1}function Vo(){const n=rm.pop();Qt=n===void 0?!0:n}function im(n){const{cleanup:e}=n;if(n.cleanup=void 0,e){const t=be;be=void 0;try{e()}finally{be=t}}}let hs=0,IE=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}};class fc{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,process.env.NODE_ENV!=="production"&&(this.subsHead=void 0)}track(e){if(!be||!Qt||be===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==be)t=this.activeLink=new IE(be,this),be.deps?(t.prevDep=be.depsTail,be.depsTail.nextDep=t,be.depsTail=t):be.deps=be.depsTail=t,sm(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){const r=t.nextDep;r.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=r),t.prevDep=be.depsTail,t.nextDep=void 0,be.depsTail.nextDep=t,be.depsTail=t,be.deps===t&&(be.deps=r)}return process.env.NODE_ENV!=="production"&&be.onTrack&&be.onTrack(or({effect:be},e)),t}trigger(e){this.version++,hs++,this.notify(e)}notify(e){lc();try{if(process.env.NODE_ENV!=="production")for(let t=this.subsHead;t;t=t.nextSub)t.sub.onTrigger&&!(t.sub.flags&8)&&t.sub.onTrigger(or({effect:t.sub},e));for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{ac()}}}function sm(n){if(n.dep.sc++,n.sub.flags&4){const e=n.dep.computed;if(e&&!n.dep.subs){e.flags|=20;for(let r=e.deps;r;r=r.nextDep)sm(r)}const t=n.dep.subs;t!==n&&(n.prevSub=t,t&&(t.nextSub=n)),process.env.NODE_ENV!=="production"&&n.dep.subsHead===void 0&&(n.dep.subsHead=n),n.dep.subs=n}}const Ko=new WeakMap,Pr=Symbol(process.env.NODE_ENV!=="production"?"Object iterate":""),dc=Symbol(process.env.NODE_ENV!=="production"?"Map keys iterate":""),ps=Symbol(process.env.NODE_ENV!=="production"?"Array iterate":"");function pt(n,e,t){if(Qt&&be){let r=Ko.get(n);r||Ko.set(n,r=new Map);let i=r.get(t);i||(r.set(t,i=new fc),i.map=r,i.key=t),process.env.NODE_ENV!=="production"?i.track({target:n,type:e,key:t}):i.track()}}function ar(n,e,t,r,i,o){const a=Ko.get(n);if(!a){hs++;return}const u=f=>{f&&(process.env.NODE_ENV!=="production"?f.trigger({target:n,type:e,key:t,newValue:r,oldValue:i,oldTarget:o}):f.trigger())};if(lc(),e==="clear")a.forEach(u);else{const f=Le(n),d=f&&rc(t);if(f&&t==="length"){const m=Number(r);a.forEach((p,g)=>{(g==="length"||g===ps||!cs(g)&&g>=m)&&u(p)})}else switch((t!==void 0||a.has(void 0))&&u(a.get(t)),d&&u(a.get(ps)),e){case"add":f?d&&u(a.get("length")):(u(a.get(Pr)),gi(n)&&u(a.get(dc)));break;case"delete":f||(u(a.get(Pr)),gi(n)&&u(a.get(dc)));break;case"set":gi(n)&&u(a.get(Pr));break}}ac()}function OE(n,e){const t=Ko.get(n);return t&&t.get(e)}function yi(n){const e=oe(n);return e===n?e:(pt(e,"iterate",ps),mt(n)?e:e.map(it))}function hc(n){return pt(n=oe(n),"iterate",ps),n}const NE={__proto__:null,[Symbol.iterator](){return pc(this,Symbol.iterator,it)},concat(...n){return yi(this).concat(...n.map(e=>Le(e)?yi(e):e))},entries(){return pc(this,"entries",n=>(n[1]=it(n[1]),n))},every(n,e){return Nn(this,"every",n,e,void 0,arguments)},filter(n,e){return Nn(this,"filter",n,e,t=>t.map(it),arguments)},find(n,e){return Nn(this,"find",n,e,it,arguments)},findIndex(n,e){return Nn(this,"findIndex",n,e,void 0,arguments)},findLast(n,e){return Nn(this,"findLast",n,e,it,arguments)},findLastIndex(n,e){return Nn(this,"findLastIndex",n,e,void 0,arguments)},forEach(n,e){return Nn(this,"forEach",n,e,void 0,arguments)},includes(...n){return mc(this,"includes",n)},indexOf(...n){return mc(this,"indexOf",n)},join(n){return yi(this).join(n)},lastIndexOf(...n){return mc(this,"lastIndexOf",n)},map(n,e){return Nn(this,"map",n,e,void 0,arguments)},pop(){return ms(this,"pop")},push(...n){return ms(this,"push",n)},reduce(n,...e){return om(this,"reduce",n,e)},reduceRight(n,...e){return om(this,"reduceRight",n,e)},shift(){return ms(this,"shift")},some(n,e){return Nn(this,"some",n,e,void 0,arguments)},splice(...n){return ms(this,"splice",n)},toReversed(){return yi(this).toReversed()},toSorted(n){return yi(this).toSorted(n)},toSpliced(...n){return yi(this).toSpliced(...n)},unshift(...n){return ms(this,"unshift",n)},values(){return pc(this,"values",it)}};function pc(n,e,t){const r=hc(n),i=r[e]();return r!==n&&!mt(n)&&(i._next=i.next,i.next=()=>{const o=i._next();return o.value&&(o.value=t(o.value)),o}),i}const RE=Array.prototype;function Nn(n,e,t,r,i,o){const a=hc(n),u=a!==n&&!mt(n),f=a[e];if(f!==RE[e]){const p=f.apply(n,o);return u?it(p):p}let d=t;a!==n&&(u?d=function(p,g){return t.call(this,it(p),g,n)}:t.length>2&&(d=function(p,g){return t.call(this,p,g,n)}));const m=f.call(a,d,r);return u&&i?i(m):m}function om(n,e,t,r){const i=hc(n);let o=t;return i!==n&&(mt(n)?t.length>3&&(o=function(a,u,f){return t.call(this,a,u,f,n)}):o=function(a,u,f){return t.call(this,a,it(u),f,n)}),i[e](o,...r)}function mc(n,e,t){const r=oe(n);pt(r,"iterate",ps);const i=r[e](...t);return(i===-1||i===!1)&&qo(t[0])?(t[0]=oe(t[0]),r[e](...t)):i}function ms(n,e,t=[]){Uo(),lc();const r=oe(n)[e].apply(n,t);return ac(),Vo(),r}const LE=mE("__proto__,__v_isRef,__isVue"),lm=new Set(Object.getOwnPropertyNames(Symbol).filter(n=>n!=="arguments"&&n!=="caller").map(n=>Symbol[n]).filter(cs));function PE(n){cs(n)||(n=String(n));const e=oe(this);return pt(e,"has",n),e.hasOwnProperty(n)}class am{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,r){if(t==="__v_skip")return e.__v_skip;const i=this._isReadonly,o=this._isShallow;if(t==="__v_isReactive")return!i;if(t==="__v_isReadonly")return i;if(t==="__v_isShallow")return o;if(t==="__v_raw")return r===(i?o?KE:dm:o?VE:fm).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const a=Le(e);if(!i){let f;if(a&&(f=NE[t]))return f;if(t==="hasOwnProperty")return PE}const u=Reflect.get(e,t,st(e)?e:r);return(cs(t)?lm.has(t):LE(t))||(i||pt(e,"get",t),o)?u:st(u)?a&&rc(t)?u:u.value:ht(u)?i?hm(u):yc(u):u}}class DE extends am{constructor(e=!1){super(!1,e)}set(e,t,r,i){let o=e[t];if(!this._isShallow){const f=Rn(o);if(!mt(r)&&!Rn(r)&&(o=oe(o),r=oe(r)),!Le(e)&&st(o)&&!st(r))return f?!1:(o.value=r,!0)}const a=Le(e)&&rc(t)?Number(t)<e.length:nc(e,t),u=Reflect.set(e,t,r,st(e)?e:i);return e===oe(i)&&(a?lr(r,o)&&ar(e,"set",t,r,o):ar(e,"add",t,r)),u}deleteProperty(e,t){const r=nc(e,t),i=e[t],o=Reflect.deleteProperty(e,t);return o&&r&&ar(e,"delete",t,void 0,i),o}has(e,t){const r=Reflect.has(e,t);return(!cs(t)||!lm.has(t))&&pt(e,"has",t),r}ownKeys(e){return pt(e,"iterate",Le(e)?"length":Pr),Reflect.ownKeys(e)}}class zE extends am{constructor(e=!1){super(!0,e)}set(e,t){return process.env.NODE_ENV!=="production"&&On(`Set operation on key "${String(t)}" failed: target is readonly.`,e),!0}deleteProperty(e,t){return process.env.NODE_ENV!=="production"&&On(`Delete operation on key "${String(t)}" failed: target is readonly.`,e),!0}}const BE=new DE,FE=new zE,gc=n=>n,Go=n=>Reflect.getPrototypeOf(n);function HE(n,e,t){return function(...r){const i=this.__v_raw,o=oe(i),a=gi(o),u=n==="entries"||n===Symbol.iterator&&a,f=n==="keys"&&a,d=i[n](...r),m=t?gc:e?bc:it;return!e&&pt(o,"iterate",f?dc:Pr),{next(){const{value:p,done:g}=d.next();return g?{value:p,done:g}:{value:u?[m(p[0]),m(p[1])]:m(p),done:g}},[Symbol.iterator](){return this}}}}function Jo(n){return function(...e){if(process.env.NODE_ENV!=="production"){const t=e[0]?`on key "${e[0]}" `:"";On(`${EE(n)} operation ${t}failed: target is readonly.`,oe(this))}return n==="delete"?!1:n==="clear"?void 0:this}}function $E(n,e){const t={get(i){const o=this.__v_raw,a=oe(o),u=oe(i);n||(lr(i,u)&&pt(a,"get",i),pt(a,"get",u));const{has:f}=Go(a),d=e?gc:n?bc:it;if(f.call(a,i))return d(o.get(i));if(f.call(a,u))return d(o.get(u));o!==a&&o.get(i)},get size(){const i=this.__v_raw;return!n&&pt(oe(i),"iterate",Pr),Reflect.get(i,"size",i)},has(i){const o=this.__v_raw,a=oe(o),u=oe(i);return n||(lr(i,u)&&pt(a,"has",i),pt(a,"has",u)),i===u?o.has(i):o.has(i)||o.has(u)},forEach(i,o){const a=this,u=a.__v_raw,f=oe(u),d=e?gc:n?bc:it;return!n&&pt(f,"iterate",Pr),u.forEach((m,p)=>i.call(o,d(m),d(p),a))}};return or(t,n?{add:Jo("add"),set:Jo("set"),delete:Jo("delete"),clear:Jo("clear")}:{add(i){!e&&!mt(i)&&!Rn(i)&&(i=oe(i));const o=oe(this);return Go(o).has.call(o,i)||(o.add(i),ar(o,"add",i,i)),this},set(i,o){!e&&!mt(o)&&!Rn(o)&&(o=oe(o));const a=oe(this),{has:u,get:f}=Go(a);let d=u.call(a,i);d?process.env.NODE_ENV!=="production"&&cm(a,u,i):(i=oe(i),d=u.call(a,i));const m=f.call(a,i);return a.set(i,o),d?lr(o,m)&&ar(a,"set",i,o,m):ar(a,"add",i,o),this},delete(i){const o=oe(this),{has:a,get:u}=Go(o);let f=a.call(o,i);f?process.env.NODE_ENV!=="production"&&cm(o,a,i):(i=oe(i),f=a.call(o,i));const d=u?u.call(o,i):void 0,m=o.delete(i);return f&&ar(o,"delete",i,void 0,d),m},clear(){const i=oe(this),o=i.size!==0,a=process.env.NODE_ENV!=="production"?gi(i)?new Map(i):new Set(i):void 0,u=i.clear();return o&&ar(i,"clear",void 0,void 0,a),u}}),["keys","values","entries",Symbol.iterator].forEach(i=>{t[i]=HE(i,n,e)}),t}function um(n,e){const t=$E(n,e);return(r,i,o)=>i==="__v_isReactive"?!n:i==="__v_isReadonly"?n:i==="__v_raw"?r:Reflect.get(nc(t,i)&&i in r?t:r,i,o)}const WE={get:um(!1,!1)},UE={get:um(!0,!1)};function cm(n,e,t){const r=oe(t);if(r!==t&&e.call(n,r)){const i=Yp(n);On(`Reactive ${i} contains both the raw and reactive versions of the same object${i==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}const fm=new WeakMap,VE=new WeakMap,dm=new WeakMap,KE=new WeakMap;function GE(n){switch(n){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function JE(n){return n.__v_skip||!Object.isExtensible(n)?0:GE(Yp(n))}function yc(n){return Rn(n)?n:pm(n,!1,BE,WE,fm)}function hm(n){return pm(n,!0,FE,UE,dm)}function pm(n,e,t,r,i){if(!ht(n))return process.env.NODE_ENV!=="production"&&On(`value cannot be made ${e?"readonly":"reactive"}: ${String(n)}`),n;if(n.__v_raw&&!(e&&n.__v_isReactive))return n;const o=i.get(n);if(o)return o;const a=JE(n);if(a===0)return n;const u=new Proxy(n,a===2?r:t);return i.set(n,u),u}function gs(n){return Rn(n)?gs(n.__v_raw):!!(n&&n.__v_isReactive)}function Rn(n){return!!(n&&n.__v_isReadonly)}function mt(n){return!!(n&&n.__v_isShallow)}function qo(n){return n?!!n.__v_raw:!1}function oe(n){const e=n&&n.__v_raw;return e?oe(e):n}const it=n=>ht(n)?yc(n):n,bc=n=>ht(n)?hm(n):n;function st(n){return n?n.__v_isRef===!0:!1}function jo(n){return qE(n,!1)}function qE(n,e){return st(n)?n:new jE(n,e)}class jE{constructor(e,t){this.dep=new fc,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:oe(e),this._value=t?e:it(e),this.__v_isShallow=t}get value(){return process.env.NODE_ENV!=="production"?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track(),this._value}set value(e){const t=this._rawValue,r=this.__v_isShallow||mt(e)||Rn(e);e=r?e:oe(e),lr(e,t)&&(this._rawValue=e,this._value=r?e:it(e),process.env.NODE_ENV!=="production"?this.dep.trigger({target:this,type:"set",key:"value",newValue:e,oldValue:t}):this.dep.trigger())}}function B(n){return st(n)?n.value:n}class YE{constructor(e,t,r){this._object=e,this._key=t,this._defaultValue=r,this.__v_isRef=!0,this._value=void 0}get value(){const e=this._object[this._key];return this._value=e===void 0?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){return OE(oe(this._object),this._key)}}class XE{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}function bi(n,e,t){return st(n)?n:Ye(n)?new XE(n):ht(n)&&arguments.length>1?ZE(n,e,t):jo(n)}function ZE(n,e,t){const r=n[e];return st(r)?r:new YE(n,e,t)}class QE{constructor(e,t,r){this.fn=e,this.setter=t,this._value=void 0,this.dep=new fc(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=hs-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&be!==this)return Qp(this,!0),!0;process.env.NODE_ENV}get value(){const e=process.env.NODE_ENV!=="production"?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track();return nm(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter?this.setter(e):process.env.NODE_ENV!=="production"&&On("Write operation failed: computed value is readonly")}}function e_(n,e,t=!1){let r,i;Ye(n)?r=n:(r=n.get,i=n.set);const o=new QE(r,i,t);return process.env.NODE_ENV,o}const Yo={},Xo=new WeakMap;let Dr;function t_(n,e=!1,t=Dr){if(t){let r=Xo.get(t);r||Xo.set(t,r=[]),r.push(n)}else process.env.NODE_ENV!=="production"&&!e&&On("onWatcherCleanup() was called when there was no active watcher to associate with.")}function n_(n,e,t=us){const{immediate:r,deep:i,once:o,scheduler:a,augmentJob:u,call:f}=t,d=$=>{(t.onWarn||On)("Invalid watch source: ",$,"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.")},m=$=>i?$:mt($)||i===!1||i===0?ur($,1):ur($);let p,g,b,x,E=!1,C=!1;if(st(n)?(g=()=>n.value,E=mt(n)):gs(n)?(g=()=>m(n),E=!0):Le(n)?(C=!0,E=n.some($=>gs($)||mt($)),g=()=>n.map($=>{if(st($))return $.value;if(gs($))return m($);if(Ye($))return f?f($,2):$();process.env.NODE_ENV!=="production"&&d($)})):Ye(n)?e?g=f?()=>f(n,2):n:g=()=>{if(b){Uo();try{b()}finally{Vo()}}const $=Dr;Dr=p;try{return f?f(n,3,[x]):n(x)}finally{Dr=$}}:(g=mi,process.env.NODE_ENV!=="production"&&d(n)),e&&i){const $=g,U=i===!0?1/0:i;g=()=>ur($(),U)}const M=()=>{p.stop()};if(o&&e){const $=e;e=(...U)=>{$(...U),M()}}let P=C?new Array(n.length).fill(Yo):Yo;const F=$=>{if(!(!(p.flags&1)||!p.dirty&&!$))if(e){const U=p.run();if(i||E||(C?U.some((ue,fe)=>lr(ue,P[fe])):lr(U,P))){b&&b();const ue=Dr;Dr=p;try{const fe=[U,P===Yo?void 0:C&&P[0]===Yo?[]:P,x];f?f(e,3,fe):e(...fe),P=U}finally{Dr=ue}}}else p.run()};return u&&u(F),p=new ME(g),p.scheduler=a?()=>a(F,!1):F,x=$=>t_($,!1,p),b=p.onStop=()=>{const $=Xo.get(p);if($){if(f)f($,4);else for(const U of $)U();Xo.delete(p)}},process.env.NODE_ENV!=="production"&&(p.onTrack=t.onTrack,p.onTrigger=t.onTrigger),e?r?F(!0):P=p.run():a?a(F.bind(null,!0),!0):p.run(),M.pause=p.pause.bind(p),M.resume=p.resume.bind(p),M.stop=M,M}function ur(n,e=1/0,t){if(e<=0||!ht(n)||n.__v_skip||(t=t||new Set,t.has(n)))return n;if(t.add(n),e--,st(n))ur(n.value,e,t);else if(Le(n))for(let r=0;r<n.length;r++)ur(n[r],e,t);else if(bE(n)||gi(n))n.forEach(r=>{ur(r,e,t)});else if(xE(n)){for(const r in n)ur(n[r],e,t);for(const r of Object.getOwnPropertySymbols(n))Object.prototype.propertyIsEnumerable.call(n,r)&&ur(n[r],e,t)}return n}const zr=[];function r_(n){zr.push(n)}function i_(){zr.pop()}let wc=!1;function ot(n,...e){if(wc)return;wc=!0,Uo();const t=zr.length?zr[zr.length-1].component:null,r=t&&t.appContext.config.warnHandler,i=s_();if(r)Zo(r,t,11,[n+e.map(o=>{var a,u;return(u=(a=o.toString)==null?void 0:a.call(o))!=null?u:JSON.stringify(o)}).join(""),t&&t.proxy,i.map(({vnode:o})=>`at <${Nm(t,o.type)}>`).join(`
1
+ "use strict";var jp=require("jsdom");function pk(n){const e=Object.create(null);for(const t of n.split(","))e[t]=1;return t=>t in e}const as=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const pi=()=>{},mk=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&(n.charCodeAt(2)>122||n.charCodeAt(2)<97),sr=Object.assign,gk=Object.prototype.hasOwnProperty,tu=(n,e)=>gk.call(n,e),Pe=Array.isArray,mi=n=>Ho(n)==="[object Map]",yk=n=>Ho(n)==="[object Set]",Xe=n=>typeof n=="function",On=n=>typeof n=="string",cs=n=>typeof n=="symbol",pt=n=>n!==null&&typeof n=="object",bk=n=>(pt(n)||Xe(n))&&Xe(n.then)&&Xe(n.catch),vk=Object.prototype.toString,Ho=n=>vk.call(n),Yp=n=>Ho(n).slice(8,-1),wk=n=>Ho(n)==="[object Object]",nu=n=>On(n)&&n!=="NaN"&&n[0]!=="-"&&""+parseInt(n,10)===n,Sk=n=>{const e=Object.create(null);return t=>e[t]||(e[t]=n(t))},xk=Sk(n=>n.charAt(0).toUpperCase()+n.slice(1)),or=(n,e)=>!Object.is(n,e);let Xp;const $o=()=>Xp||(Xp=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function ru(n){if(Pe(n)){const e={};for(let t=0;t<n.length;t++){const r=n[t],i=On(r)?Tk(r):ru(r);if(i)for(const o in i)e[o]=i[o]}return e}else if(On(n)||pt(n))return n}const kk=/;(?![^(]*\))/g,Ek=/:([^]+)/,_k=/\/\*[^]*?\*\//g;function Tk(n){const e={};return n.replace(_k,"").split(kk).forEach(t=>{if(t){const r=t.split(Ek);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function iu(n){let e="";if(On(n))e=n;else if(Pe(n))for(let t=0;t<n.length;t++){const r=iu(n[t]);r&&(e+=r+" ")}else if(pt(n))for(const t in n)n[t]&&(e+=t+" ");return e.trim()}function Nn(n,...e){console.warn(`[Vue warn] ${n}`,...e)}let ye;const su=new WeakSet;class Ck{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,su.has(this)&&(su.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Qp(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,im(this),em(this);const e=ye,t=en;ye=this,en=!0;try{return this.fn()}finally{process.env.NODE_ENV!=="production"&&ye!==this&&Nn("Active effect was not restored correctly - this is likely a Vue internal bug."),tm(this),ye=e,en=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)cu(e);this.deps=this.depsTail=void 0,im(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?su.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){au(this)&&this.run()}get dirty(){return au(this)}}let Zp=0,us,fs;function Qp(n,e=!1){if(n.flags|=8,e){n.next=fs,fs=n;return}n.next=us,us=n}function ou(){Zp++}function lu(){if(--Zp>0)return;if(fs){let e=fs;for(fs=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let n;for(;us;){let e=us;for(us=void 0;e;){const t=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(r){n||(n=r)}e=t}}if(n)throw n}function em(n){for(let e=n.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function tm(n){let e,t=n.depsTail,r=t;for(;r;){const i=r.prevDep;r.version===-1?(r===t&&(t=i),cu(r),Mk(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=i}n.deps=e,n.depsTail=t}function au(n){for(let e=n.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(nm(e.dep.computed)||e.dep.version!==e.version))return!0;return!!n._dirty}function nm(n){if(n.flags&4&&!(n.flags&16)||(n.flags&=-17,n.globalVersion===hs))return;n.globalVersion=hs;const e=n.dep;if(n.flags|=2,e.version>0&&!n.isSSR&&n.deps&&!au(n)){n.flags&=-3;return}const t=ye,r=en;ye=n,en=!0;try{em(n);const i=n.fn(n._value);(e.version===0||or(i,n._value))&&(n._value=i,e.version++)}catch(i){throw e.version++,i}finally{ye=t,en=r,tm(n),n.flags&=-3}}function cu(n,e=!1){const{dep:t,prevSub:r,nextSub:i}=n;if(r&&(r.nextSub=i,n.prevSub=void 0),i&&(i.prevSub=r,n.nextSub=void 0),process.env.NODE_ENV!=="production"&&t.subsHead===n&&(t.subsHead=i),t.subs===n&&(t.subs=r,!r&&t.computed)){t.computed.flags&=-5;for(let o=t.computed.deps;o;o=o.nextDep)cu(o,!0)}!e&&!--t.sc&&t.map&&t.map.delete(t.key)}function Mk(n){const{prevDep:e,nextDep:t}=n;e&&(e.nextDep=t,n.prevDep=void 0),t&&(t.prevDep=e,n.nextDep=void 0)}let en=!0;const rm=[];function Wo(){rm.push(en),en=!1}function Uo(){const n=rm.pop();en=n===void 0?!0:n}function im(n){const{cleanup:e}=n;if(n.cleanup=void 0,e){const t=ye;ye=void 0;try{e()}finally{ye=t}}}let hs=0,Ak=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}};class uu{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,process.env.NODE_ENV!=="production"&&(this.subsHead=void 0)}track(e){if(!ye||!en||ye===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==ye)t=this.activeLink=new Ak(ye,this),ye.deps?(t.prevDep=ye.depsTail,ye.depsTail.nextDep=t,ye.depsTail=t):ye.deps=ye.depsTail=t,sm(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){const r=t.nextDep;r.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=r),t.prevDep=ye.depsTail,t.nextDep=void 0,ye.depsTail.nextDep=t,ye.depsTail=t,ye.deps===t&&(ye.deps=r)}return process.env.NODE_ENV!=="production"&&ye.onTrack&&ye.onTrack(sr({effect:ye},e)),t}trigger(e){this.version++,hs++,this.notify(e)}notify(e){ou();try{if(process.env.NODE_ENV!=="production")for(let t=this.subsHead;t;t=t.nextSub)t.sub.onTrigger&&!(t.sub.flags&8)&&t.sub.onTrigger(sr({effect:t.sub},e));for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{lu()}}}function sm(n){if(n.dep.sc++,n.sub.flags&4){const e=n.dep.computed;if(e&&!n.dep.subs){e.flags|=20;for(let r=e.deps;r;r=r.nextDep)sm(r)}const t=n.dep.subs;t!==n&&(n.prevSub=t,t&&(t.nextSub=n)),process.env.NODE_ENV!=="production"&&n.dep.subsHead===void 0&&(n.dep.subsHead=n),n.dep.subs=n}}const Vo=new WeakMap,Lr=Symbol(process.env.NODE_ENV!=="production"?"Object iterate":""),fu=Symbol(process.env.NODE_ENV!=="production"?"Map keys iterate":""),ds=Symbol(process.env.NODE_ENV!=="production"?"Array iterate":"");function mt(n,e,t){if(en&&ye){let r=Vo.get(n);r||Vo.set(n,r=new Map);let i=r.get(t);i||(r.set(t,i=new uu),i.map=r,i.key=t),process.env.NODE_ENV!=="production"?i.track({target:n,type:e,key:t}):i.track()}}function lr(n,e,t,r,i,o){const a=Vo.get(n);if(!a){hs++;return}const c=f=>{f&&(process.env.NODE_ENV!=="production"?f.trigger({target:n,type:e,key:t,newValue:r,oldValue:i,oldTarget:o}):f.trigger())};if(ou(),e==="clear")a.forEach(c);else{const f=Pe(n),h=f&&nu(t);if(f&&t==="length"){const m=Number(r);a.forEach((p,g)=>{(g==="length"||g===ds||!cs(g)&&g>=m)&&c(p)})}else switch((t!==void 0||a.has(void 0))&&c(a.get(t)),h&&c(a.get(ds)),e){case"add":f?h&&c(a.get("length")):(c(a.get(Lr)),mi(n)&&c(a.get(fu)));break;case"delete":f||(c(a.get(Lr)),mi(n)&&c(a.get(fu)));break;case"set":mi(n)&&c(a.get(Lr));break}}lu()}function Ik(n,e){const t=Vo.get(n);return t&&t.get(e)}function gi(n){const e=oe(n);return e===n?e:(mt(e,"iterate",ds),gt(n)?e:e.map(st))}function hu(n){return mt(n=oe(n),"iterate",ds),n}const Ok={__proto__:null,[Symbol.iterator](){return du(this,Symbol.iterator,st)},concat(...n){return gi(this).concat(...n.map(e=>Pe(e)?gi(e):e))},entries(){return du(this,"entries",n=>(n[1]=st(n[1]),n))},every(n,e){return Rn(this,"every",n,e,void 0,arguments)},filter(n,e){return Rn(this,"filter",n,e,t=>t.map(st),arguments)},find(n,e){return Rn(this,"find",n,e,st,arguments)},findIndex(n,e){return Rn(this,"findIndex",n,e,void 0,arguments)},findLast(n,e){return Rn(this,"findLast",n,e,st,arguments)},findLastIndex(n,e){return Rn(this,"findLastIndex",n,e,void 0,arguments)},forEach(n,e){return Rn(this,"forEach",n,e,void 0,arguments)},includes(...n){return pu(this,"includes",n)},indexOf(...n){return pu(this,"indexOf",n)},join(n){return gi(this).join(n)},lastIndexOf(...n){return pu(this,"lastIndexOf",n)},map(n,e){return Rn(this,"map",n,e,void 0,arguments)},pop(){return ps(this,"pop")},push(...n){return ps(this,"push",n)},reduce(n,...e){return om(this,"reduce",n,e)},reduceRight(n,...e){return om(this,"reduceRight",n,e)},shift(){return ps(this,"shift")},some(n,e){return Rn(this,"some",n,e,void 0,arguments)},splice(...n){return ps(this,"splice",n)},toReversed(){return gi(this).toReversed()},toSorted(n){return gi(this).toSorted(n)},toSpliced(...n){return gi(this).toSpliced(...n)},unshift(...n){return ps(this,"unshift",n)},values(){return du(this,"values",st)}};function du(n,e,t){const r=hu(n),i=r[e]();return r!==n&&!gt(n)&&(i._next=i.next,i.next=()=>{const o=i._next();return o.value&&(o.value=t(o.value)),o}),i}const Nk=Array.prototype;function Rn(n,e,t,r,i,o){const a=hu(n),c=a!==n&&!gt(n),f=a[e];if(f!==Nk[e]){const p=f.apply(n,o);return c?st(p):p}let h=t;a!==n&&(c?h=function(p,g){return t.call(this,st(p),g,n)}:t.length>2&&(h=function(p,g){return t.call(this,p,g,n)}));const m=f.call(a,h,r);return c&&i?i(m):m}function om(n,e,t,r){const i=hu(n);let o=t;return i!==n&&(gt(n)?t.length>3&&(o=function(a,c,f){return t.call(this,a,c,f,n)}):o=function(a,c,f){return t.call(this,a,st(c),f,n)}),i[e](o,...r)}function pu(n,e,t){const r=oe(n);mt(r,"iterate",ds);const i=r[e](...t);return(i===-1||i===!1)&&Jo(t[0])?(t[0]=oe(t[0]),r[e](...t)):i}function ps(n,e,t=[]){Wo(),ou();const r=oe(n)[e].apply(n,t);return lu(),Uo(),r}const Rk=pk("__proto__,__v_isRef,__isVue"),lm=new Set(Object.getOwnPropertyNames(Symbol).filter(n=>n!=="arguments"&&n!=="caller").map(n=>Symbol[n]).filter(cs));function Lk(n){cs(n)||(n=String(n));const e=oe(this);return mt(e,"has",n),e.hasOwnProperty(n)}class am{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,r){if(t==="__v_skip")return e.__v_skip;const i=this._isReadonly,o=this._isShallow;if(t==="__v_isReactive")return!i;if(t==="__v_isReadonly")return i;if(t==="__v_isShallow")return o;if(t==="__v_raw")return r===(i?o?Vk:hm:o?Uk:fm).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const a=Pe(e);if(!i){let f;if(a&&(f=Ok[t]))return f;if(t==="hasOwnProperty")return Lk}const c=Reflect.get(e,t,ot(e)?e:r);return(cs(t)?lm.has(t):Rk(t))||(i||mt(e,"get",t),o)?c:ot(c)?a&&nu(t)?c:c.value:pt(c)?i?dm(c):gu(c):c}}class Pk extends am{constructor(e=!1){super(!1,e)}set(e,t,r,i){let o=e[t];if(!this._isShallow){const f=Ln(o);if(!gt(r)&&!Ln(r)&&(o=oe(o),r=oe(r)),!Pe(e)&&ot(o)&&!ot(r))return f?!1:(o.value=r,!0)}const a=Pe(e)&&nu(t)?Number(t)<e.length:tu(e,t),c=Reflect.set(e,t,r,ot(e)?e:i);return e===oe(i)&&(a?or(r,o)&&lr(e,"set",t,r,o):lr(e,"add",t,r)),c}deleteProperty(e,t){const r=tu(e,t),i=e[t],o=Reflect.deleteProperty(e,t);return o&&r&&lr(e,"delete",t,void 0,i),o}has(e,t){const r=Reflect.has(e,t);return(!cs(t)||!lm.has(t))&&mt(e,"has",t),r}ownKeys(e){return mt(e,"iterate",Pe(e)?"length":Lr),Reflect.ownKeys(e)}}class Dk extends am{constructor(e=!1){super(!0,e)}set(e,t){return process.env.NODE_ENV!=="production"&&Nn(`Set operation on key "${String(t)}" failed: target is readonly.`,e),!0}deleteProperty(e,t){return process.env.NODE_ENV!=="production"&&Nn(`Delete operation on key "${String(t)}" failed: target is readonly.`,e),!0}}const zk=new Pk,Bk=new Dk,mu=n=>n,Ko=n=>Reflect.getPrototypeOf(n);function Fk(n,e,t){return function(...r){const i=this.__v_raw,o=oe(i),a=mi(o),c=n==="entries"||n===Symbol.iterator&&a,f=n==="keys"&&a,h=i[n](...r),m=t?mu:e?yu:st;return!e&&mt(o,"iterate",f?fu:Lr),{next(){const{value:p,done:g}=h.next();return g?{value:p,done:g}:{value:c?[m(p[0]),m(p[1])]:m(p),done:g}},[Symbol.iterator](){return this}}}}function Go(n){return function(...e){if(process.env.NODE_ENV!=="production"){const t=e[0]?`on key "${e[0]}" `:"";Nn(`${xk(n)} operation ${t}failed: target is readonly.`,oe(this))}return n==="delete"?!1:n==="clear"?void 0:this}}function Hk(n,e){const t={get(i){const o=this.__v_raw,a=oe(o),c=oe(i);n||(or(i,c)&&mt(a,"get",i),mt(a,"get",c));const{has:f}=Ko(a),h=e?mu:n?yu:st;if(f.call(a,i))return h(o.get(i));if(f.call(a,c))return h(o.get(c));o!==a&&o.get(i)},get size(){const i=this.__v_raw;return!n&&mt(oe(i),"iterate",Lr),Reflect.get(i,"size",i)},has(i){const o=this.__v_raw,a=oe(o),c=oe(i);return n||(or(i,c)&&mt(a,"has",i),mt(a,"has",c)),i===c?o.has(i):o.has(i)||o.has(c)},forEach(i,o){const a=this,c=a.__v_raw,f=oe(c),h=e?mu:n?yu:st;return!n&&mt(f,"iterate",Lr),c.forEach((m,p)=>i.call(o,h(m),h(p),a))}};return sr(t,n?{add:Go("add"),set:Go("set"),delete:Go("delete"),clear:Go("clear")}:{add(i){!e&&!gt(i)&&!Ln(i)&&(i=oe(i));const o=oe(this);return Ko(o).has.call(o,i)||(o.add(i),lr(o,"add",i,i)),this},set(i,o){!e&&!gt(o)&&!Ln(o)&&(o=oe(o));const a=oe(this),{has:c,get:f}=Ko(a);let h=c.call(a,i);h?process.env.NODE_ENV!=="production"&&um(a,c,i):(i=oe(i),h=c.call(a,i));const m=f.call(a,i);return a.set(i,o),h?or(o,m)&&lr(a,"set",i,o,m):lr(a,"add",i,o),this},delete(i){const o=oe(this),{has:a,get:c}=Ko(o);let f=a.call(o,i);f?process.env.NODE_ENV!=="production"&&um(o,a,i):(i=oe(i),f=a.call(o,i));const h=c?c.call(o,i):void 0,m=o.delete(i);return f&&lr(o,"delete",i,void 0,h),m},clear(){const i=oe(this),o=i.size!==0,a=process.env.NODE_ENV!=="production"?mi(i)?new Map(i):new Set(i):void 0,c=i.clear();return o&&lr(i,"clear",void 0,void 0,a),c}}),["keys","values","entries",Symbol.iterator].forEach(i=>{t[i]=Fk(i,n,e)}),t}function cm(n,e){const t=Hk(n,e);return(r,i,o)=>i==="__v_isReactive"?!n:i==="__v_isReadonly"?n:i==="__v_raw"?r:Reflect.get(tu(t,i)&&i in r?t:r,i,o)}const $k={get:cm(!1,!1)},Wk={get:cm(!0,!1)};function um(n,e,t){const r=oe(t);if(r!==t&&e.call(n,r)){const i=Yp(n);Nn(`Reactive ${i} contains both the raw and reactive versions of the same object${i==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}const fm=new WeakMap,Uk=new WeakMap,hm=new WeakMap,Vk=new WeakMap;function Kk(n){switch(n){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Gk(n){return n.__v_skip||!Object.isExtensible(n)?0:Kk(Yp(n))}function gu(n){return Ln(n)?n:pm(n,!1,zk,$k,fm)}function dm(n){return pm(n,!0,Bk,Wk,hm)}function pm(n,e,t,r,i){if(!pt(n))return process.env.NODE_ENV!=="production"&&Nn(`value cannot be made ${e?"readonly":"reactive"}: ${String(n)}`),n;if(n.__v_raw&&!(e&&n.__v_isReactive))return n;const o=i.get(n);if(o)return o;const a=Gk(n);if(a===0)return n;const c=new Proxy(n,a===2?r:t);return i.set(n,c),c}function ms(n){return Ln(n)?ms(n.__v_raw):!!(n&&n.__v_isReactive)}function Ln(n){return!!(n&&n.__v_isReadonly)}function gt(n){return!!(n&&n.__v_isShallow)}function Jo(n){return n?!!n.__v_raw:!1}function oe(n){const e=n&&n.__v_raw;return e?oe(e):n}const st=n=>pt(n)?gu(n):n,yu=n=>pt(n)?dm(n):n;function ot(n){return n?n.__v_isRef===!0:!1}function qo(n){return Jk(n,!1)}function Jk(n,e){return ot(n)?n:new qk(n,e)}class qk{constructor(e,t){this.dep=new uu,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:oe(e),this._value=t?e:st(e),this.__v_isShallow=t}get value(){return process.env.NODE_ENV!=="production"?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track(),this._value}set value(e){const t=this._rawValue,r=this.__v_isShallow||gt(e)||Ln(e);e=r?e:oe(e),or(e,t)&&(this._rawValue=e,this._value=r?e:st(e),process.env.NODE_ENV!=="production"?this.dep.trigger({target:this,type:"set",key:"value",newValue:e,oldValue:t}):this.dep.trigger())}}function B(n){return ot(n)?n.value:n}class jk{constructor(e,t,r){this._object=e,this._key=t,this._defaultValue=r,this.__v_isRef=!0,this._value=void 0}get value(){const e=this._object[this._key];return this._value=e===void 0?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){return Ik(oe(this._object),this._key)}}class Yk{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}function yi(n,e,t){return ot(n)?n:Xe(n)?new Yk(n):pt(n)&&arguments.length>1?Xk(n,e,t):qo(n)}function Xk(n,e,t){const r=n[e];return ot(r)?r:new jk(n,e,t)}class Zk{constructor(e,t,r){this.fn=e,this.setter=t,this._value=void 0,this.dep=new uu(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=hs-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&ye!==this)return Qp(this,!0),!0;process.env.NODE_ENV}get value(){const e=process.env.NODE_ENV!=="production"?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track();return nm(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter?this.setter(e):process.env.NODE_ENV!=="production"&&Nn("Write operation failed: computed value is readonly")}}function Qk(n,e,t=!1){let r,i;Xe(n)?r=n:(r=n.get,i=n.set);const o=new Zk(r,i,t);return process.env.NODE_ENV,o}const jo={},Yo=new WeakMap;let Pr;function eE(n,e=!1,t=Pr){if(t){let r=Yo.get(t);r||Yo.set(t,r=[]),r.push(n)}else process.env.NODE_ENV!=="production"&&!e&&Nn("onWatcherCleanup() was called when there was no active watcher to associate with.")}function tE(n,e,t=as){const{immediate:r,deep:i,once:o,scheduler:a,augmentJob:c,call:f}=t,h=$=>{(t.onWarn||Nn)("Invalid watch source: ",$,"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.")},m=$=>i?$:gt($)||i===!1||i===0?ar($,1):ar($);let p,g,b,S,k=!1,C=!1;if(ot(n)?(g=()=>n.value,k=gt(n)):ms(n)?(g=()=>m(n),k=!0):Pe(n)?(C=!0,k=n.some($=>ms($)||gt($)),g=()=>n.map($=>{if(ot($))return $.value;if(ms($))return m($);if(Xe($))return f?f($,2):$();process.env.NODE_ENV!=="production"&&h($)})):Xe(n)?e?g=f?()=>f(n,2):n:g=()=>{if(b){Wo();try{b()}finally{Uo()}}const $=Pr;Pr=p;try{return f?f(n,3,[S]):n(S)}finally{Pr=$}}:(g=pi,process.env.NODE_ENV!=="production"&&h(n)),e&&i){const $=g,U=i===!0?1/0:i;g=()=>ar($(),U)}const M=()=>{p.stop()};if(o&&e){const $=e;e=(...U)=>{$(...U),M()}}let P=C?new Array(n.length).fill(jo):jo;const F=$=>{if(!(!(p.flags&1)||!p.dirty&&!$))if(e){const U=p.run();if(i||k||(C?U.some((ce,fe)=>or(ce,P[fe])):or(U,P))){b&&b();const ce=Pr;Pr=p;try{const fe=[U,P===jo?void 0:C&&P[0]===jo?[]:P,S];f?f(e,3,fe):e(...fe),P=U}finally{Pr=ce}}}else p.run()};return c&&c(F),p=new Ck(g),p.scheduler=a?()=>a(F,!1):F,S=$=>eE($,!1,p),b=p.onStop=()=>{const $=Yo.get(p);if($){if(f)f($,4);else for(const U of $)U();Yo.delete(p)}},process.env.NODE_ENV!=="production"&&(p.onTrack=t.onTrack,p.onTrigger=t.onTrigger),e?r?F(!0):P=p.run():a?a(F.bind(null,!0),!0):p.run(),M.pause=p.pause.bind(p),M.resume=p.resume.bind(p),M.stop=M,M}function ar(n,e=1/0,t){if(e<=0||!pt(n)||n.__v_skip||(t=t||new Set,t.has(n)))return n;if(t.add(n),e--,ot(n))ar(n.value,e,t);else if(Pe(n))for(let r=0;r<n.length;r++)ar(n[r],e,t);else if(yk(n)||mi(n))n.forEach(r=>{ar(r,e,t)});else if(wk(n)){for(const r in n)ar(n[r],e,t);for(const r of Object.getOwnPropertySymbols(n))Object.prototype.propertyIsEnumerable.call(n,r)&&ar(n[r],e,t)}return n}const Dr=[];function nE(n){Dr.push(n)}function rE(){Dr.pop()}let bu=!1;function lt(n,...e){if(bu)return;bu=!0,Wo();const t=Dr.length?Dr[Dr.length-1].component:null,r=t&&t.appContext.config.warnHandler,i=iE();if(r)Xo(r,t,11,[n+e.map(o=>{var a,c;return(c=(a=o.toString)==null?void 0:a.call(o))!=null?c:JSON.stringify(o)}).join(""),t&&t.proxy,i.map(({vnode:o})=>`at <${Nm(t,o.type)}>`).join(`
2
2
  `),i]);else{const o=[`[Vue warn]: ${n}`,...e];i.length&&o.push(`
3
- `,...o_(i)),console.warn(...o)}Vo(),wc=!1}function s_(){let n=zr[zr.length-1];if(!n)return[];const e=[];for(;n;){const t=e[0];t&&t.vnode===n?t.recurseCount++:e.push({vnode:n,recurseCount:0});const r=n.component&&n.component.parent;n=r&&r.vnode}return e}function o_(n){const e=[];return n.forEach((t,r)=>{e.push(...r===0?[]:[`
4
- `],...l_(t))}),e}function l_({vnode:n,recurseCount:e}){const t=e>0?`... (${e} recursive calls)`:"",r=n.component?n.component.parent==null:!1,i=` at <${Nm(n.component,n.type,r)}`,o=">"+t;return n.props?[i,...a_(n.props),o]:[i+o]}function a_(n){const e=[],t=Object.keys(n);return t.slice(0,3).forEach(r=>{e.push(...mm(r,n[r]))}),t.length>3&&e.push(" ..."),e}function mm(n,e,t){return In(e)?(e=JSON.stringify(e),t?e:[`${n}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?t?e:[`${n}=${e}`]:st(e)?(e=mm(n,oe(e.value),!0),t?e:[`${n}=Ref<`,e,">"]):Ye(e)?[`${n}=fn${e.name?`<${e.name}>`:""}`]:(e=oe(e),t?e:[`${n}=`,e])}const gm={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush",15:"component update",16:"app unmount cleanup function"};function Zo(n,e,t,r){try{return r?n(...r):n()}catch(i){Sc(i,e,t)}}function ym(n,e,t,r){if(Ye(n)){const i=Zo(n,e,t,r);return i&&wE(i)&&i.catch(o=>{Sc(o,e,t)}),i}if(Le(n)){const i=[];for(let o=0;o<n.length;o++)i.push(ym(n[o],e,t,r));return i}else process.env.NODE_ENV!=="production"&&ot(`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof n}`)}function Sc(n,e,t,r=!0){const i=e?e.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:a}=e&&e.appContext.config||us;if(e){let u=e.parent;const f=e.proxy,d=process.env.NODE_ENV!=="production"?gm[t]:`https://vuejs.org/error-reference/#runtime-${t}`;for(;u;){const m=u.ec;if(m){for(let p=0;p<m.length;p++)if(m[p](n,f,d)===!1)return}u=u.parent}if(o){Uo(),Zo(o,null,10,[n,f,d]),Vo();return}}u_(n,t,i,r,a)}function u_(n,e,t,r=!0,i=!1){if(process.env.NODE_ENV!=="production"){const o=gm[e];if(t&&r_(t),ot(`Unhandled error${o?` during execution of ${o}`:""}`),t&&i_(),r)throw n;console.error(n)}else{if(i)throw n;console.error(n)}}const Ht=[];let Ln=-1;const wi=[];let cr=null,Si=0;const c_=Promise.resolve();let xc=null;const f_=100;function d_(n){let e=Ln+1,t=Ht.length;for(;e<t;){const r=e+t>>>1,i=Ht[r],o=ys(i);o<n||o===n&&i.flags&2?e=r+1:t=r}return e}function bm(n){if(!(n.flags&1)){const e=ys(n),t=Ht[Ht.length-1];!t||!(n.flags&2)&&e>=ys(t)?Ht.push(n):Ht.splice(d_(e),0,n),n.flags|=1,wm()}}function wm(){xc||(xc=c_.then(xm))}function Sm(n){Le(n)?wi.push(...n):cr&&n.id===-1?cr.splice(Si+1,0,n):n.flags&1||(wi.push(n),n.flags|=1),wm()}function h_(n){if(wi.length){const e=[...new Set(wi)].sort((t,r)=>ys(t)-ys(r));if(wi.length=0,cr){cr.push(...e);return}for(cr=e,process.env.NODE_ENV!=="production"&&(n=n||new Map),Si=0;Si<cr.length;Si++){const t=cr[Si];process.env.NODE_ENV!=="production"&&km(n,t)||(t.flags&4&&(t.flags&=-2),t.flags&8||t(),t.flags&=-2)}cr=null,Si=0}}const ys=n=>n.id==null?n.flags&2?-1:1/0:n.id;function xm(n){process.env.NODE_ENV!=="production"&&(n=n||new Map);const e=process.env.NODE_ENV!=="production"?t=>km(n,t):mi;try{for(Ln=0;Ln<Ht.length;Ln++){const t=Ht[Ln];if(t&&!(t.flags&8)){if(process.env.NODE_ENV!=="production"&&e(t))continue;t.flags&4&&(t.flags&=-2),Zo(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2)}}}finally{for(;Ln<Ht.length;Ln++){const t=Ht[Ln];t&&(t.flags&=-2)}Ln=-1,Ht.length=0,h_(n),xc=null,(Ht.length||wi.length)&&xm(n)}}function km(n,e){const t=n.get(e)||0;if(t>f_){const r=e.i,i=r&&Om(r.type);return Sc(`Maximum recursive updates exceeded${i?` in component <${i}>`:""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,null,10),!0}return n.set(e,t+1),!1}const kc=new Map;process.env.NODE_ENV!=="production"&&(Wo().__VUE_HMR_RUNTIME__={createRecord:Ec(p_),rerender:Ec(m_),reload:Ec(g_)});const Qo=new Map;function p_(n,e){return Qo.has(n)?!1:(Qo.set(n,{initialDef:el(e),instances:new Set}),!0)}function el(n){return Rm(n)?n.__vccOpts:n}function m_(n,e){const t=Qo.get(n);t&&(t.initialDef.render=e,[...t.instances].forEach(r=>{e&&(r.render=e,el(r.type).render=e),r.renderCache=[],r.update()}))}function g_(n,e){const t=Qo.get(n);if(!t)return;e=el(e),Em(t.initialDef,e);const r=[...t.instances];for(let i=0;i<r.length;i++){const o=r[i],a=el(o.type);let u=kc.get(a);u||(a!==t.initialDef&&Em(a,e),kc.set(a,u=new Set)),u.add(o),o.appContext.propsCache.delete(o.type),o.appContext.emitsCache.delete(o.type),o.appContext.optionsCache.delete(o.type),o.ceReload?(u.add(o),o.ceReload(e.styles),u.delete(o)):o.parent?bm(()=>{o.parent.update(),u.delete(o)}):o.appContext.reload?o.appContext.reload():typeof window<"u"?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required."),o.root.ce&&o!==o.root&&o.root.ce._removeChildStyle(a)}Sm(()=>{kc.clear()})}function Em(n,e){or(n,e);for(const t in n)t!=="__file"&&!(t in e)&&delete n[t]}function Ec(n){return(e,t)=>{try{return n(e,t)}catch(r){console.error(r),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let xi,tl=[];function _m(n,e){var t,r;xi=n,xi?(xi.enabled=!0,tl.forEach(({event:i,args:o})=>xi.emit(i,...o)),tl=[]):typeof window<"u"&&window.HTMLElement&&!((r=(t=window.navigator)==null?void 0:t.userAgent)!=null&&r.includes("jsdom"))?((e.__VUE_DEVTOOLS_HOOK_REPLAY__=e.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(o=>{_m(o,e)}),setTimeout(()=>{xi||(e.__VUE_DEVTOOLS_HOOK_REPLAY__=null,tl=[])},3e3)):tl=[]}let ki=null,y_=null;const b_=n=>n.__isTeleport;function vm(n,e){n.shapeFlag&6&&n.component?(n.transition=e,vm(n.component.subTree,e)):n.shapeFlag&128?(n.ssContent.transition=e.clone(n.ssContent),n.ssFallback.transition=e.clone(n.ssFallback)):n.transition=e}Wo().requestIdleCallback,Wo().cancelIdleCallback;const w_=Symbol.for("v-ndc"),S_={};process.env.NODE_ENV!=="production"&&(S_.ownKeys=n=>(ot("Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."),Reflect.ownKeys(n)));let x_=null;function k_(n,e,t=!1){const r=il||ki;if(r||x_){const i=r?r.parent==null?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&n in i)return i[n];if(arguments.length>1)return t&&Ye(e)?e.call(r&&r.proxy):e;process.env.NODE_ENV!=="production"&&ot(`injection "${String(n)}" not found.`)}else process.env.NODE_ENV!=="production"&&ot("inject() can only be used inside setup() or functional components.")}const E_={},Tm=n=>Object.getPrototypeOf(n)===E_,__=I_,v_=Symbol.for("v-scx"),T_=()=>{{const n=k_(v_);return n||process.env.NODE_ENV!=="production"&&ot("Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build."),n}};function C_(n,e,t){return process.env.NODE_ENV!=="production"&&!Ye(e)&&ot("`watch(fn, options?)` signature has been moved to a separate API. Use `watchEffect(fn, options?)` instead. `watch` now only supports `watch(source, cb, options?) signature."),M_(n,e,t)}function M_(n,e,t=us){const{immediate:r,deep:i,flush:o,once:a}=t;process.env.NODE_ENV!=="production"&&!e&&(r!==void 0&&ot('watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.'),i!==void 0&&ot('watch() "deep" option is only respected when using the watch(source, callback, options?) signature.'),a!==void 0&&ot('watch() "once" option is only respected when using the watch(source, callback, options?) signature.'));const u=or({},t);process.env.NODE_ENV!=="production"&&(u.onWarn=ot);const f=e&&r||!e&&o!=="post";let d;if(sl){if(o==="sync"){const b=T_();d=b.__watcherHandles||(b.__watcherHandles=[])}else if(!f){const b=()=>{};return b.stop=mi,b.resume=mi,b.pause=mi,b}}const m=il;u.call=(b,x,E)=>ym(b,m,x,E);let p=!1;o==="post"?u.scheduler=b=>{__(b,m&&m.suspense)}:o!=="sync"&&(p=!0,u.scheduler=(b,x)=>{x?b():bm(b)}),u.augmentJob=b=>{e&&(b.flags|=4),p&&(b.flags|=2,m&&(b.id=m.uid,b.i=m))};const g=n_(n,e,u);return sl&&(d?d.push(g):f&&g()),g}const A_=n=>n.__isSuspense;function I_(n,e){e&&e.pendingBranch?Le(n)?e.effects.push(...n):e.effects.push(n):Sm(n)}const Cm=Symbol.for("v-fgt"),O_=Symbol.for("v-txt"),N_=Symbol.for("v-cmt");function R_(n){return n?n.__v_isVNode===!0:!1}const L_=(...n)=>Am(...n),Mm=({key:n})=>n??null,nl=({ref:n,ref_key:e,ref_for:t})=>(typeof n=="number"&&(n=""+n),n!=null?In(n)||st(n)||Ye(n)?{i:ki,r:n,k:e,f:!!t}:n:null);function P_(n,e=null,t=null,r=0,i=null,o=n===Cm?0:1,a=!1,u=!1){const f={__v_isVNode:!0,__v_skip:!0,type:n,props:e,key:e&&Mm(e),ref:e&&nl(e),scopeId:y_,slotScopeIds:null,children:t,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:o,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:ki};return u?(_c(f,t),o&128&&n.normalize(f)):t&&(f.shapeFlag|=In(t)?8:16),process.env.NODE_ENV!=="production"&&f.key!==f.key&&ot("VNode created with invalid key (NaN). VNode type:",f.type),f}const D_=process.env.NODE_ENV!=="production"?L_:Am;function Am(n,e=null,t=null,r=0,i=null,o=!1){if((!n||n===w_)&&(process.env.NODE_ENV!=="production"&&!n&&ot(`Invalid vnode type when creating vnode: ${n}.`),n=N_),R_(n)){const u=rl(n,e,!0);return t&&_c(u,t),u.patchFlag=-2,u}if(Rm(n)&&(n=n.__vccOpts),e){e=z_(e);let{class:u,style:f}=e;u&&!In(u)&&(e.class=sc(u)),ht(f)&&(qo(f)&&!Le(f)&&(f=or({},f)),e.style=ic(f))}const a=In(n)?1:A_(n)?128:b_(n)?64:ht(n)?4:Ye(n)?2:0;return process.env.NODE_ENV!=="production"&&a&4&&qo(n)&&(n=oe(n),ot("Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.",`
5
- Component that was made reactive: `,n)),P_(n,e,t,r,i,a,o,!0)}function z_(n){return n?qo(n)||Tm(n)?or({},n):n:null}function rl(n,e,t=!1,r=!1){const{props:i,ref:o,patchFlag:a,children:u,transition:f}=n,d=e?F_(i||{},e):i,m={__v_isVNode:!0,__v_skip:!0,type:n.type,props:d,key:d&&Mm(d),ref:e&&e.ref?t&&o?Le(o)?o.concat(nl(e)):[o,nl(e)]:nl(e):o,scopeId:n.scopeId,slotScopeIds:n.slotScopeIds,children:process.env.NODE_ENV!=="production"&&a===-1&&Le(u)?u.map(Im):u,target:n.target,targetStart:n.targetStart,targetAnchor:n.targetAnchor,staticCount:n.staticCount,shapeFlag:n.shapeFlag,patchFlag:e&&n.type!==Cm?a===-1?16:a|16:a,dynamicProps:n.dynamicProps,dynamicChildren:n.dynamicChildren,appContext:n.appContext,dirs:n.dirs,transition:f,component:n.component,suspense:n.suspense,ssContent:n.ssContent&&rl(n.ssContent),ssFallback:n.ssFallback&&rl(n.ssFallback),el:n.el,anchor:n.anchor,ctx:n.ctx,ce:n.ce};return f&&r&&vm(m,f.clone(m)),m}function Im(n){const e=rl(n);return Le(n.children)&&(e.children=n.children.map(Im)),e}function B_(n=" ",e=0){return D_(O_,null,n,e)}function _c(n,e){let t=0;const{shapeFlag:r}=n;if(e==null)e=null;else if(Le(e))t=16;else if(typeof e=="object")if(r&65){const i=e.default;i&&(i._c&&(i._d=!1),_c(n,i()),i._c&&(i._d=!0));return}else t=32,!e._&&!Tm(e)&&(e._ctx=ki);else Ye(e)?(e={default:e,_ctx:ki},t=32):(e=String(e),r&64?(t=16,e=[B_(e)]):t=8);n.children=e,n.shapeFlag|=t}function F_(...n){const e={};for(let t=0;t<n.length;t++){const r=n[t];for(const i in r)if(i==="class")e.class!==r.class&&(e.class=sc([e.class,r.class]));else if(i==="style")e.style=ic([e.style,r.style]);else if(gE(i)){const o=e[i],a=r[i];a&&o!==a&&!(Le(o)&&o.includes(a))&&(e[i]=o?[].concat(o,a):a)}else i!==""&&(e[i]=r[i])}return e}let il=null;const H_=()=>il||ki;{const n=Wo(),e=(t,r)=>{let i;return(i=n[t])||(i=n[t]=[]),i.push(r),o=>{i.length>1?i.forEach(a=>a(o)):i[0](o)}};e("__VUE_INSTANCE_SETTERS__",t=>il=t),e("__VUE_SSR_SETTERS__",t=>sl=t)}let sl=!1;process.env.NODE_ENV;const $_=/(?:^|[-_])(\w)/g,W_=n=>n.replace($_,e=>e.toUpperCase()).replace(/[-_]/g,"");function Om(n,e=!0){return Ye(n)?n.displayName||n.name:n.name||e&&n.__name}function Nm(n,e,t=!1){let r=Om(e);if(!r&&e.__file){const i=e.__file.match(/([^/\\]+)\.\w+$/);i&&(r=i[1])}if(!r&&n&&n.parent){const i=o=>{for(const a in o)if(o[a]===e)return a};r=i(n.components||n.parent.type.components)||i(n.appContext.components)}return r?W_(r):t?"App":"Anonymous"}function Rm(n){return Ye(n)&&"__vccOpts"in n}const he=(n,e)=>{const t=e_(n,e,sl);if(process.env.NODE_ENV!=="production"){const r=H_();r&&r.appContext.config.warnRecursiveComputed&&(t._warnRecursive=!0)}return t};function U_(){if(process.env.NODE_ENV==="production"||typeof window>"u")return;const n={style:"color:#3ba776"},e={style:"color:#1677ff"},t={style:"color:#f5222d"},r={style:"color:#eb2f96"},i={__vue_custom_formatter:!0,header(p){return ht(p)?p.__isVue?["div",n,"VueInstance"]:st(p)?["div",{},["span",n,m(p)],"<",u("_value"in p?p._value:p),">"]:gs(p)?["div",{},["span",n,mt(p)?"ShallowReactive":"Reactive"],"<",u(p),`>${Rn(p)?" (readonly)":""}`]:Rn(p)?["div",{},["span",n,mt(p)?"ShallowReadonly":"Readonly"],"<",u(p),">"]:null:null},hasBody(p){return p&&p.__isVue},body(p){if(p&&p.__isVue)return["div",{},...o(p.$)]}};function o(p){const g=[];p.type.props&&p.props&&g.push(a("props",oe(p.props))),p.setupState!==us&&g.push(a("setup",p.setupState)),p.data!==us&&g.push(a("data",oe(p.data)));const b=f(p,"computed");b&&g.push(a("computed",b));const x=f(p,"inject");return x&&g.push(a("injected",x)),g.push(["div",{},["span",{style:r.style+";opacity:0.66"},"$ (internal): "],["object",{object:p}]]),g}function a(p,g){return g=or({},g),Object.keys(g).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},p],["div",{style:"padding-left:1.25em"},...Object.keys(g).map(b=>["div",{},["span",r,b+": "],u(g[b],!1)])]]:["span",{}]}function u(p,g=!0){return typeof p=="number"?["span",e,p]:typeof p=="string"?["span",t,JSON.stringify(p)]:typeof p=="boolean"?["span",r,p]:ht(p)?["object",{object:g?oe(p):p}]:["span",t,String(p)]}function f(p,g){const b=p.type;if(Ye(b))return;const x={};for(const E in p.ctx)d(b,E,g)&&(x[E]=p.ctx[E]);return x}function d(p,g,b){const x=p[b];if(Le(x)&&x.includes(g)||ht(x)&&g in x||p.extends&&d(p.extends,g,b)||p.mixins&&p.mixins.some(E=>d(E,g,b)))return!0}function m(p){return mt(p)?"ShallowRef":p.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(i):window.devtoolsFormatters=[i]}process.env.NODE_ENV,process.env.NODE_ENV,process.env.NODE_ENV;function V_(){U_()}process.env.NODE_ENV!=="production"&&V_();function Xe(n){this.content=n}Xe.prototype={constructor:Xe,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,i=r.find(n),o=r.content.slice();return i==-1?o.push(t||n,e):(o[i+1]=e,t&&(o[i]=t)),new Xe(o)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Xe(t)},addToStart:function(n,e){return new Xe([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Xe(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),o=r.find(n);return i.splice(o==-1?i.length:o,0,e,t),new Xe(i)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Xe.from(n),n.size?new Xe(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Xe.from(n),n.size?new Xe(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Xe.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},Xe.from=function(n){if(n instanceof Xe)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Xe(e)};function Lm(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),o=e.child(r);if(i==o){t+=i.nodeSize;continue}if(!i.sameMarkup(o))return t;if(i.isText&&i.text!=o.text){for(let a=0;i.text[a]==o.text[a];a++)t++;return t}if(i.content.size||o.content.size){let a=Lm(i.content,o.content,t+1);if(a!=null)return a}t+=i.nodeSize}}function Pm(n,e,t,r){for(let i=n.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:t,b:r};let a=n.child(--i),u=e.child(--o),f=a.nodeSize;if(a==u){t-=f,r-=f;continue}if(!a.sameMarkup(u))return{a:t,b:r};if(a.isText&&a.text!=u.text){let d=0,m=Math.min(a.text.length,u.text.length);for(;d<m&&a.text[a.text.length-d-1]==u.text[u.text.length-d-1];)d++,t--,r--;return{a:t,b:r}}if(a.content.size||u.content.size){let d=Pm(a.content,u.content,t-1,r-1);if(d)return d}t-=f,r-=f}}class L{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,i=0,o){for(let a=0,u=0;u<t;a++){let f=this.content[a],d=u+f.nodeSize;if(d>e&&r(f,i+u,o||null,a)!==!1&&f.content.size){let m=u+1;f.nodesBetween(Math.max(0,e-m),Math.min(f.content.size,t-m),r,i+m)}u=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let o="",a=!0;return this.nodesBetween(e,t,(u,f)=>{let d=u.isText?u.text.slice(Math.max(e,f)-f,t-f):u.isLeaf?i?typeof i=="function"?i(u):i:u.type.spec.leafText?u.type.spec.leafText(u):"":"";u.isBlock&&(u.isLeaf&&d||u.isTextblock)&&r&&(a?a=!1:o+=r),o+=d},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new L(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let o=0,a=0;a<t;o++){let u=this.content[o],f=a+u.nodeSize;f>e&&((a<e||f>t)&&(u.isText?u=u.cut(Math.max(0,e-a),Math.min(u.text.length,t-a)):u=u.cut(Math.max(0,e-a-1),Math.min(u.content.size,t-a-1))),r.push(u),i+=u.nodeSize),a=f}return new L(r,i)}cutByIndex(e,t){return e==t?L.empty:e==0&&t==this.content.length?this:new L(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new L(i,o)}addToStart(e){return new L([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new L(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))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 t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return Lm(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Pm(this,e,t,r)}findIndex(e,t=-1){if(e==0)return ol(0,e);if(e==this.size)return ol(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),a=i+o.nodeSize;if(a>=e)return a==e||t>0?ol(r+1,a):ol(r,i);i=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return L.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new L(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return L.empty;let t,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(t||(t=e.slice(0,i)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new L(t||e,r)}static from(e){if(!e)return L.empty;if(e instanceof L)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new L([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}L.empty=new L([],0);const vc={index:0,offset:0};function ol(n,e){return vc.index=n,vc.offset=e,vc}function ll(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!ll(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!ll(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let Te=class fd{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(o)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ll(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=r.create(t.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return fd.none;if(e instanceof fd)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};Te.none=[];class al extends Error{}class W{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=zm(this.content,e+this.openStart,t);return r&&new W(r,this.openStart,this.openEnd)}removeBetween(e,t){return new W(Dm(this.content,e+this.openStart,t+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,t){if(!t)return W.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new W(L.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)i++;return new W(e,r,i)}}W.empty=new W(L.empty,0,0);function Dm(n,e,t){let{index:r,offset:i}=n.findIndex(e),o=n.maybeChild(r),{index:a,offset:u}=n.findIndex(t);if(i==e||o.isText){if(u!=t&&!n.child(a).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=a)throw new RangeError("Removing non-flat range");return n.replaceChild(r,o.copy(Dm(o.content,e-i-1,t-i-1)))}function zm(n,e,t,r){let{index:i,offset:o}=n.findIndex(e),a=n.maybeChild(i);if(o==e||a.isText)return n.cut(0,e).append(t).append(n.cut(e));let u=zm(a.content,e-o-1,t);return u&&n.replaceChild(i,a.copy(u))}function K_(n,e,t){if(t.openStart>n.depth)throw new al("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new al("Inconsistent open depths");return Bm(n,e,t,0)}function Bm(n,e,t,r){let i=n.index(r),o=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let a=Bm(n,e,t,r+1);return o.copy(o.content.replaceChild(i,a))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let a=n.parent,u=a.content;return Fr(a,u.cut(0,n.parentOffset).append(t.content).append(u.cut(e.parentOffset)))}else{let{start:a,end:u}=G_(t,n);return Fr(o,Hm(n,a,u,e,r))}else return Fr(o,ul(n,e,r))}function Fm(n,e){if(!e.type.compatibleContent(n.type))throw new al("Cannot join "+e.type.name+" onto "+n.type.name)}function Tc(n,e,t){let r=n.node(t);return Fm(r,e.node(t)),r}function Br(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function bs(n,e,t,r){let i=(e||n).node(t),o=0,a=e?e.index(t):i.childCount;n&&(o=n.index(t),n.depth>t?o++:n.textOffset&&(Br(n.nodeAfter,r),o++));for(let u=o;u<a;u++)Br(i.child(u),r);e&&e.depth==t&&e.textOffset&&Br(e.nodeBefore,r)}function Fr(n,e){return n.type.checkContent(e),n.copy(e)}function Hm(n,e,t,r,i){let o=n.depth>i&&Tc(n,e,i+1),a=r.depth>i&&Tc(t,r,i+1),u=[];return bs(null,n,i,u),o&&a&&e.index(i)==t.index(i)?(Fm(o,a),Br(Fr(o,Hm(n,e,t,r,i+1)),u)):(o&&Br(Fr(o,ul(n,e,i+1)),u),bs(e,t,i,u),a&&Br(Fr(a,ul(t,r,i+1)),u)),bs(r,null,i,u),new L(u)}function ul(n,e,t){let r=[];if(bs(null,n,t,r),n.depth>t){let i=Tc(n,e,t+1);Br(Fr(i,ul(n,e,t+1)),r)}return bs(e,null,t,r),new L(r)}function G_(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)i=e.node(o).copy(L.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class Vs{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.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,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Te.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let u=r;r=i,i=u}let o=r.marks;for(var a=0;a<o.length;a++)o[a].type.spec.inclusive===!1&&(!i||!o[a].isInSet(i.marks))&&(o=o[a--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){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)&&(!t||t(this.node(r))))return new cl(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 t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,o=t;for(let a=e;;){let{index:u,offset:f}=a.content.findIndex(o),d=o-f;if(r.push(a,u,i+f),!d||(a=a.child(u),a.isText))break;o=d-1,i+=f+1}return new Vs(t,r,o)}static resolveCached(e,t){let r=$m.get(e);if(r)for(let o=0;o<r.elts.length;o++){let a=r.elts[o];if(a.pos==t)return a}else $m.set(e,r=new J_);let i=r.elts[r.i]=Vs.resolve(e,t);return r.i=(r.i+1)%q_,i}}class J_{constructor(){this.elts=[],this.i=0}}const q_=12,$m=new WeakMap;class cl{constructor(e,t,r){this.$from=e,this.$to=t,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 j_=Object.create(null);let fr=class dd{constructor(e,t,r,i=Te.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||L.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,t,r,i=0){this.content.nodesBetween(e,t,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,t,r,i){return this.content.textBetween(e,t,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,t,r){return this.type==e&&ll(this.attrs,t||e.defaultAttrs||j_)&&Te.sameSet(this.marks,r||Te.none)}copy(e=null){return e==this.content?this:new dd(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new dd(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return W.empty;let i=this.resolve(e),o=this.resolve(t),a=r?0:i.sharedDepth(t),u=i.start(a),d=i.node(a).content.cut(i.pos-u,o.pos-u);return new W(d,i.depth-a,o.depth-a)}replace(e,t,r){return K_(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return Vs.resolveCached(this,e)}resolveNoCache(e){return Vs.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,o=>(r.isInSet(o.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()+")"),Wm(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=L.empty,i=0,o=r.childCount){let a=this.contentMatchAt(e).matchFragment(r,i,o),u=a&&a.matchFragment(this.content,t);if(!u||!u.validEnd)return!1;for(let f=i;f<o;f++)if(!this.type.allowsMarks(r.child(f).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),a=o&&o.matchFragment(this.content,t);return a?a.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=Te.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Te.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t 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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=L.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};fr.prototype.text=void 0;class Ca extends fr{constructor(e,t,r,i){if(super(e,t,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):Wm(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Ca(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ca(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Wm(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Xr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Y_(e,t);if(r.next==null)return Xr.empty;let i=Um(r);r.next&&r.err("Unexpected trailing text");let o=rv(nv(i));return iv(o,r),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let i=this;for(let o=t;i&&o<r;o++)i=i.matchType(e.child(o).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:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let i=[this];function o(a,u){let f=a.matchFragment(e,r);if(f&&(!t||f.validEnd))return L.from(u.map(d=>d.createAndFill()));for(let d=0;d<a.next.length;d++){let{type:m,next:p}=a.next[d];if(!(m.isText||m.hasRequiredAttrs())&&i.indexOf(p)==-1){i.push(p);let g=o(p,u.concat(m));if(g)return g}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let a=[];for(let u=i;u.type;u=u.via)a.push(u.type);return a.reverse()}for(let a=0;a<o.next.length;a++){let{type:u,next:f}=o.next[a];!u.isLeaf&&!u.hasRequiredAttrs()&&!(u.name in t)&&(!i.type||f.validEnd)&&(r.push({match:u.contentMatch,type:u,via:i}),t[u.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 t(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let a=0;a<r.next.length;a++)o+=(a?", ":"")+r.next[a].type.name+"->"+e.indexOf(r.next[a].next);return o}).join(`
6
- `)}}Xr.empty=new Xr(!0);class Y_{constructor(e,t){this.string=e,this.nodeTypes=t,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 Um(n){let e=[];do e.push(X_(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function X_(n){let e=[];do e.push(Z_(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Z_(n){let e=tv(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Q_(n,e);else break;return e}function Vm(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Q_(n,e){let t=Vm(n),r=t;return n.eat(",")&&(n.next!="}"?r=Vm(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function ev(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let o in t){let a=t[o];a.isInGroup(e)&&i.push(a)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function tv(n){if(n.eat("(")){let e=Um(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=ev(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function nv(n){let e=[[]];return i(o(n,0),t()),e;function t(){return e.push([])-1}function r(a,u,f){let d={term:f,to:u};return e[a].push(d),d}function i(a,u){a.forEach(f=>f.to=u)}function o(a,u){if(a.type=="choice")return a.exprs.reduce((f,d)=>f.concat(o(d,u)),[]);if(a.type=="seq")for(let f=0;;f++){let d=o(a.exprs[f],u);if(f==a.exprs.length-1)return d;i(d,u=t())}else if(a.type=="star"){let f=t();return r(u,f),i(o(a.expr,f),f),[r(f)]}else if(a.type=="plus"){let f=t();return i(o(a.expr,u),f),i(o(a.expr,f),f),[r(f)]}else{if(a.type=="opt")return[r(u)].concat(o(a.expr,u));if(a.type=="range"){let f=u;for(let d=0;d<a.min;d++){let m=t();i(o(a.expr,f),m),f=m}if(a.max==-1)i(o(a.expr,f),f);else for(let d=a.min;d<a.max;d++){let m=t();r(f,m),i(o(a.expr,f),m),f=m}return[r(f)]}else{if(a.type=="name")return[r(u,void 0,a.value)];throw new Error("Unknown expr type")}}}}function Km(n,e){return e-n}function Gm(n,e){let t=[];return r(e),t.sort(Km);function r(i){let o=n[i];if(o.length==1&&!o[0].term)return r(o[0].to);t.push(i);for(let a=0;a<o.length;a++){let{term:u,to:f}=o[a];!u&&t.indexOf(f)==-1&&r(f)}}}function rv(n){let e=Object.create(null);return t(Gm(n,0));function t(r){let i=[];r.forEach(a=>{n[a].forEach(({term:u,to:f})=>{if(!u)return;let d;for(let m=0;m<i.length;m++)i[m][0]==u&&(d=i[m][1]);Gm(n,f).forEach(m=>{d||i.push([u,d=[]]),d.indexOf(m)==-1&&d.push(m)})})});let o=e[r.join(",")]=new Xr(r.indexOf(n.length-1)>-1);for(let a=0;a<i.length;a++){let u=i[a][1].sort(Km);o.next.push({type:i[a][0],next:e[u.join(",")]||t(u)})}return o}}function iv(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],o=!i.validEnd,a=[];for(let u=0;u<i.next.length;u++){let{type:f,next:d}=i.next[u];a.push(f.name),o&&!(f.isText||f.hasRequiredAttrs())&&(o=!1),r.indexOf(d)==-1&&r.push(d)}o&&e.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Jm(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function qm(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let o=n[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function jm(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in n){let o=n[i];o.validate&&o.validate(e[i])}}function Ym(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new ov(n,r,e[r]);return t}let Xm=class My{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Ym(e,r.attrs),this.defaultAttrs=Jm(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==Xr.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:qm(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new fr(this,this.computeAttrs(e),L.from(t),Te.setFrom(r))}createChecked(e=null,t,r){return t=L.from(t),this.checkContent(t),new fr(this,this.computeAttrs(e),t,Te.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=L.from(t),t.size){let a=this.contentMatch.fillBefore(t);if(!a)return null;t=a.append(t)}let i=this.contentMatch.matchFragment(t),o=i&&i.fillBefore(L.empty,!0);return o?new fr(this,e,t.append(o),Te.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.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){jm(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 t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:Te.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,a)=>r[o]=new My(o,t,a));let i=t.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 o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function sv(n,e,t){let r=t.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${o}`)}}class ov{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?sv(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Ma{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Ym(e,i.attrs),this.excluded=null;let o=Jm(this.attrs);this.instance=o?new Te(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Te(this,qm(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((o,a)=>r[o]=new Ma(o,i++,t,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){jm(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Zm{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Xe.from(e.nodes),t.marks=Xe.from(e.marks||{}),this.nodes=Xm.compile(this.spec.nodes,this),this.marks=Ma.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 o=this.nodes[i],a=o.spec.content||"",u=o.spec.marks;if(o.contentMatch=r[a]||(r[a]=Xr.parse(a,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=u=="_"?null:u?Qm(this,u.split(" ")):u==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],a=o.spec.excludes;o.excluded=a==null?[o]:a==""?[]:Qm(this,a.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Xm){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(t,r,i)}text(e,t){let r=this.nodes.text;return new Ca(r,r.defaultAttrs,e,Te.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return fr.fromJSON(this,e)}markFromJSON(e){return Te.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Qm(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],o=n.marks[i],a=o;if(o)t.push(o);else for(let u in n.marks){let f=n.marks[u];(i=="_"||f.spec.group&&f.spec.group.split(" ").indexOf(i)>-1)&&t.push(a=f)}if(!a)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function lv(n){return n.tag!=null}function av(n){return n.style!=null}let ws=class hd{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(lv(i))this.tags.push(i);else if(av(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,t={}){let r=new rg(this,t,!1);return r.addAll(e,Te.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new rg(this,t,!0);return r.addAll(e,Te.none,t.from,t.to),W.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(fv(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){let a=o.getAttrs(e);if(a===!1)continue;o.attrs=a||void 0}return o}}}matchStyle(e,t,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let a=this.styles[o],u=a.style;if(!(u.indexOf(e)!=0||a.context&&!r.matchesContext(a.context)||u.length>e.length&&(u.charCodeAt(e.length)!=61||u.slice(e.length+1)!=t))){if(a.getAttrs){let f=a.getAttrs(t);if(f===!1)continue;a.attrs=f||void 0}return a}}}static schemaRules(e){let t=[];function r(i){let o=i.priority==null?50:i.priority,a=0;for(;a<t.length;a++){let u=t[a];if((u.priority==null?50:u.priority)<o)break}t.splice(a,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(a=>{r(a=ig(a)),a.mark||a.ignore||a.clearMark||(a.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(a=>{r(a=ig(a)),a.node||a.ignore||a.mark||(a.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new hd(e,hd.schemaRules(e)))}};const eg={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},uv={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},tg={ol:!0,ul:!0},Ss=1,Cc=2,fl=4;function ng(n,e,t){return e!=null?(e?Ss:0)|(e==="full"?Cc:0):n&&n.whitespace=="pre"?Ss|Cc:t&-5}class dl{constructor(e,t,r,i,o,a){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=a,this.content=[],this.activeMarks=Te.none,this.match=o||(a&fl?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(L.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);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 o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let t=L.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(L.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!eg.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class rg{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,o,a=ng(null,t.preserveWhitespace,0)|(r?fl:0);i?o=new dl(i.type,i.attrs,Te.none,!0,t.topMatch||i.type.contentMatch,a):r?o=new dl(null,null,Te.none,!0,null,a):o=new dl(e.schema.topNodeType,null,Te.none,!0,null,a),this.nodes=[o],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,i=this.top,o=i.options&Cc?"full":this.localPreserveWS||(i.options&Ss)>0;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)o!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
7
- `);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],u=e.previousSibling;(!a||u&&u.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),t),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),u;tg.hasOwnProperty(a)&&this.parser.normalizeLists&&cv(e);let f=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(u=this.parser.matchTag(e,this,r));e:if(f?f.ignore:uv.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!f||f.skip||f.closeParent){f&&f.closeParent?this.open=Math.max(0,this.open-1):f&&f.skip.nodeType&&(e=f.skip);let d,m=this.needsBlock;if(eg.hasOwnProperty(a))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),d=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let p=f&&f.skip?t:this.readStyles(e,t);p&&this.addAll(e,p),d&&this.sync(o),this.needsBlock=m}else{let d=this.readStyles(e,t);d&&this.addElementByRule(e,f,d,f.consuming===!1?u:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
8
- `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],a=r.getPropertyValue(o);if(a)for(let u=void 0;;){let f=this.parser.matchStyle(o,a,this,u);if(!f)break;if(f.ignore)return null;if(f.clearMark?t=t.filter(d=>!f.clearMark(d)):t=t.concat(this.parser.schema.marks[f.mark].create(f.attrs)),f.consuming===!1)u=f;else break}}return t}addElementByRule(e,t,r,i){let o,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),r)||this.leafFallback(e,r);else{let f=this.enter(a,t.attrs||null,r,t.preserveWhitespace);f&&(o=!0,r=f)}else{let f=this.parser.schema.marks[t.mark];r=r.concat(f.create(t.attrs))}let u=this.top;if(a&&a.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(f=>this.insertNode(f,r));else{let f=e;typeof t.contentElement=="string"?f=e.querySelector(t.contentElement):typeof t.contentElement=="function"?f=t.contentElement(e):t.contentElement&&(f=t.contentElement),this.findAround(e,f,!0),this.addAll(f,r),this.findAround(e,f,!1)}o&&this.sync(u)&&this.open--}addAll(e,t,r,i){let o=r||0;for(let a=r?e.childNodes[r]:e.firstChild,u=i==null?null:e.childNodes[i];a!=u;a=a.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(a,t);this.findAtPoint(e,o)}findPlace(e,t){let r,i;for(let o=this.open;o>=0;o--){let a=this.nodes[o],u=a.findWrapping(e);if(u&&(!r||r.length>u.length)&&(r=u,i=a,!u.length)||a.solid)break}if(!r)return null;this.sync(i);for(let o=0;o<r.length;o++)t=this.enterInner(r[o],null,t,!1);return t}insertNode(e,t){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let r=this.findPlace(e,t);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=Te.none;for(let a of r.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):sg(a.type,e.type))&&(o=a.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,t,r,i){let o=this.findPlace(e.create(t),r);return o&&(o=this.enterInner(e,t,r,!0,i)),o}enterInner(e,t,r,i=!1,o){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let u=ng(e,o,a.options);a.options&fl&&a.content.length==0&&(u|=fl);let f=Te.none;return r=r.filter(d=>(a.type?a.type.allowsMarkType(d.type):sg(d.type,e))?(f=d.addToSet(f),!1):!0),this.nodes.push(new dl(e,t,f,i,null,u)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].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 t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=Ss)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&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)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),a=(u,f)=>{for(;u>=0;u--){let d=t[u];if(d==""){if(u==t.length-1||u==0)continue;for(;f>=o;f--)if(a(u-1,f))return!0;return!1}else{let m=f>0||f==0&&i?this.nodes[f].type:r&&f>=o?r.node(f-o).type:null;if(!m||m.name!=d&&!m.isInGroup(d))return!1;f--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function cv(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&tg.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function fv(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function ig(n){let e={};for(let t in n)e[t]=n[t];return e}function sg(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let o=[],a=u=>{o.push(u);for(let f=0;f<u.edgeCount;f++){let{type:d,next:m}=u.edge(f);if(d==e||o.indexOf(m)<0&&a(m))return!0}};if(a(i.contentMatch))return!0}}class Us{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Mc(t).createDocumentFragment());let i=r,o=[];return e.forEach(a=>{if(o.length||a.marks.length){let u=0,f=0;for(;u<o.length&&f<a.marks.length;){let d=a.marks[f];if(!this.marks[d.type.name]){f++;continue}if(!d.eq(o[u][0])||d.type.spec.spanning===!1)break;u++,f++}for(;u<o.length;)i=o.pop()[1];for(;f<a.marks.length;){let d=a.marks[f++],m=this.serializeMark(d,a.isInline,t);m&&(o.push([d,i]),i.appendChild(m.dom),i=m.contentDOM||m.dom)}}i.appendChild(this.serializeNodeInner(a,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=hl(Mc(t),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,t,i)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&hl(Mc(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return hl(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Us(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=og(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return og(e.marks)}}function og(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Mc(n){return n.document||window.document}const lg=new WeakMap;function dv(n){let e=lg.get(n);return e===void 0&&lg.set(n,e=hv(n)),e}function hv(n){let e=null;function t(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++)t(r[i]);else for(let i in r)t(r[i])}return t(n),e}function hl(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=dv(r))&&o.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 a=i.indexOf(" ");a>0&&(t=i.slice(0,a),i=i.slice(a+1));let u,f=t?n.createElementNS(t,i):n.createElement(i),d=e[1],m=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){m=2;for(let p in d)if(d[p]!=null){let g=p.indexOf(" ");g>0?f.setAttributeNS(p.slice(0,g),p.slice(g+1),d[p]):f.setAttribute(p,d[p])}}for(let p=m;p<e.length;p++){let g=e[p];if(g===0){if(p<e.length-1||p>m)throw new RangeError("Content hole must be the only child of its parent node");return{dom:f,contentDOM:f}}else{let{dom:b,contentDOM:x}=hl(n,g,t,r);if(f.appendChild(b),x){if(u)throw new RangeError("Multiple content holes");u=x}}}return{dom:f,contentDOM:u}}const ag=65535,ug=Math.pow(2,16);function pv(n,e){return n+e*ug}function cg(n){return n&ag}function mv(n){return(n-(n&ag))/ug}const fg=1,dg=2,pl=4,hg=8;class Ac{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&hg)>0}get deletedBefore(){return(this.delInfo&(fg|pl))>0}get deletedAfter(){return(this.delInfo&(dg|pl))>0}get deletedAcross(){return(this.delInfo&pl)>0}}class It{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&It.empty)return It.empty}recover(e){let t=0,r=cg(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+mv(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let i=0,o=this.inverted?2:1,a=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let f=this.ranges[u]-(this.inverted?i:0);if(f>e)break;let d=this.ranges[u+o],m=this.ranges[u+a],p=f+d;if(e<=p){let g=d?e==f?-1:e==p?1:t:t,b=f+i+(g<0?0:m);if(r)return b;let x=e==(t<0?f:p)?null:pv(u/3,e-f),E=e==f?dg:e==p?fg:pl;return(t<0?e!=f:e!=p)&&(E|=hg),new Ac(b,E,x)}i+=m-d}return r?e+i:new Ac(e+i,0,null)}touches(e,t){let r=0,i=cg(t),o=this.inverted?2:1,a=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let f=this.ranges[u]-(this.inverted?r:0);if(f>e)break;let d=this.ranges[u+o],m=f+d;if(e<=m&&u==i*3)return!0;r+=this.ranges[u+a]-d}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let a=this.ranges[i],u=a-(this.inverted?o:0),f=a+(this.inverted?0:o),d=this.ranges[i+t],m=this.ranges[i+r];e(u,u+d,f,f+m),o+=m-d}}invert(){return new It(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?It.empty:new It(e<0?[0,-e,0]:[0,0,e])}}It.empty=new It([]);class zi{constructor(e=[],t,r=0,i=e.length){this.maps=e,this.mirror=t,this.from=r,this.to=i}slice(e=0,t=this.maps.length){return new zi(this.maps,this.mirror,e,t)}copy(){return new zi(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),t!=null&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,r=this.maps.length;t<e.maps.length;t++){let i=e.getMirror(t);this.appendMap(e.maps[t],i!=null&&i<t?r+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this.maps.length+e.maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e.maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new zi;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let i=0;for(let o=this.from;o<this.to;o++){let a=this.maps[o],u=a.mapResult(e,t);if(u.recover!=null){let f=this.getMirror(o);if(f!=null&&f>o&&f<this.to){o=f,e=this.maps[f].recover(u.recover);continue}}i|=u.delInfo,e=u.pos}return r?e:new Ac(e,i,null)}}const Ic=Object.create(null);class $e{getMap(){return It.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ic[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Ic)throw new RangeError("Duplicate use of step JSON ID "+e);return Ic[e]=t,t.prototype.jsonID=e,t}}class Re{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Re(e,null)}static fail(e){return new Re(null,e)}static fromReplace(e,t,r,i){try{return Re.ok(e.replace(t,r,i))}catch(o){if(o instanceof al)return Re.fail(o.message);throw o}}}function Oc(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(Oc(o.content,e,o))),o.isInline&&(o=e(o,t,i)),r.push(o)}return L.fromArray(r)}class _r extends $e{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new W(Oc(t.content,(a,u)=>!a.isAtom||!u.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),i),t.openStart,t.openEnd);return Re.fromReplace(e,this.from,this.to,o)}invert(){return new yn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new _r(t.pos,r.pos,this.mark)}merge(e){return e instanceof _r&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new _r(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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new _r(t.from,t.to,e.markFromJSON(t.mark))}}$e.jsonID("addMark",_r);class yn extends $e{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new W(Oc(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return Re.fromReplace(e,this.from,this.to,r)}invert(){return new _r(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new yn(t.pos,r.pos,this.mark)}merge(e){return e instanceof yn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new yn(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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new yn(t.from,t.to,e.markFromJSON(t.mark))}}$e.jsonID("removeMark",yn);class vr extends $e{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Re.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Re.fromReplace(e,this.pos,this.pos+1,new W(L.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new vr(this.pos,t.marks[i]);return new vr(this.pos,this.mark)}}return new Bi(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new vr(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new vr(t.pos,e.markFromJSON(t.mark))}}$e.jsonID("addNodeMark",vr);class Bi extends $e{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Re.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Re.fromReplace(e,this.pos,this.pos+1,new W(L.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new vr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Bi(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Bi(t.pos,e.markFromJSON(t.mark))}}$e.jsonID("removeNodeMark",Bi);class Ge extends $e{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&Nc(e,this.from,this.to)?Re.fail("Structure replace would overwrite content"):Re.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new It([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ge(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new Ge(t.pos,Math.max(t.pos,r.pos),this.slice)}merge(e){if(!(e instanceof Ge)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?W.empty:new W(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ge(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?W.empty:new W(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ge(e.from,this.to,t,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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ge(t.from,t.to,W.fromJSON(e,t.slice),!!t.structure)}}$e.jsonID("replace",Ge);class Ke extends $e{constructor(e,t,r,i,o,a,u=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=a,this.structure=u}apply(e){if(this.structure&&(Nc(e,this.from,this.gapFrom)||Nc(e,this.gapTo,this.to)))return Re.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Re.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?Re.fromReplace(e,this.from,this.to,r):Re.fail("Content does not fit in gap")}getMap(){return new It([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Ke(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||o>r.pos?null:new Ke(t.pos,r.pos,i,o,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,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ke(t.from,t.to,t.gapFrom,t.gapTo,W.fromJSON(e,t.slice),t.insert,!!t.structure)}}$e.jsonID("replaceAround",Ke);function Nc(n,e,t){let r=n.resolve(e),i=t-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let a=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}}return!1}function gv(n,e,t,r){let i=[],o=[],a,u;n.doc.nodesBetween(e,t,(f,d,m)=>{if(!f.isInline)return;let p=f.marks;if(!r.isInSet(p)&&m.type.allowsMarkType(r.type)){let g=Math.max(d,e),b=Math.min(d+f.nodeSize,t),x=r.addToSet(p);for(let E=0;E<p.length;E++)p[E].isInSet(x)||(a&&a.to==g&&a.mark.eq(p[E])?a.to=b:i.push(a=new yn(g,b,p[E])));u&&u.to==g?u.to=b:o.push(u=new _r(g,b,r))}}),i.forEach(f=>n.step(f)),o.forEach(f=>n.step(f))}function yv(n,e,t,r){let i=[],o=0;n.doc.nodesBetween(e,t,(a,u)=>{if(!a.isInline)return;o++;let f=null;if(r instanceof Ma){let d=a.marks,m;for(;m=r.isInSet(d);)(f||(f=[])).push(m),d=m.removeFromSet(d)}else r?r.isInSet(a.marks)&&(f=[r]):f=a.marks;if(f&&f.length){let d=Math.min(u+a.nodeSize,t);for(let m=0;m<f.length;m++){let p=f[m],g;for(let b=0;b<i.length;b++){let x=i[b];x.step==o-1&&p.eq(i[b].style)&&(g=x)}g?(g.to=d,g.step=o):i.push({style:p,from:Math.max(u,e),to:d,step:o})}}}),i.forEach(a=>n.step(new yn(a.from,a.to,a.style)))}function Rc(n,e,t,r=t.contentMatch,i=!0){let o=n.doc.nodeAt(e),a=[],u=e+1;for(let f=0;f<o.childCount;f++){let d=o.child(f),m=u+d.nodeSize,p=r.matchType(d.type);if(!p)a.push(new Ge(u,m,W.empty));else{r=p;for(let g=0;g<d.marks.length;g++)t.allowsMarkType(d.marks[g].type)||n.step(new yn(u,m,d.marks[g]));if(i&&d.isText&&t.whitespace!="pre"){let g,b=/\r?\n|\r/g,x;for(;g=b.exec(d.text);)x||(x=new W(L.from(t.schema.text(" ",t.allowedMarks(d.marks))),0,0)),a.push(new Ge(u+g.index,u+g.index+g[0].length,x))}}u=m}if(!r.validEnd){let f=r.fillBefore(L.empty,!0);n.replace(u,u,new W(f,0,0))}for(let f=a.length-1;f>=0;f--)n.step(a[f])}function bv(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Ei(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),o=n.$from.index(r),a=n.$to.indexAfter(r);if(r<n.depth&&i.canReplace(o,a,t))return r;if(r==0||i.type.spec.isolating||!bv(i,o,a))break}return null}function wv(n,e,t){let{$from:r,$to:i,depth:o}=e,a=r.before(o+1),u=i.after(o+1),f=a,d=u,m=L.empty,p=0;for(let x=o,E=!1;x>t;x--)E||r.index(x)>0?(E=!0,m=L.from(r.node(x).copy(m)),p++):f--;let g=L.empty,b=0;for(let x=o,E=!1;x>t;x--)E||i.after(x+1)<i.end(x)?(E=!0,g=L.from(i.node(x).copy(g)),b++):d++;n.step(new Ke(f,d,a,u,new W(m.append(g),p,b),m.size-p,!0))}function Lc(n,e,t=null,r=n){let i=Sv(n,e),o=i&&xv(r,e);return o?i.map(pg).concat({type:e,attrs:t}).concat(o.map(pg)):null}function pg(n){return{type:n,attrs:null}}function Sv(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.contentMatchAt(r).findWrapping(e);if(!o)return null;let a=o.length?o[0]:e;return t.canReplaceWith(r,i,a)?o:null}function xv(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.child(r),a=e.contentMatch.findWrapping(o.type);if(!a)return null;let f=(a.length?a[a.length-1]:e).contentMatch;for(let d=r;f&&d<i;d++)f=f.matchType(t.child(d).type);return!f||!f.validEnd?null:a}function kv(n,e,t){let r=L.empty;for(let a=t.length-1;a>=0;a--){if(r.size){let u=t[a].type.contentMatch.matchFragment(r);if(!u||!u.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=L.from(t[a].type.create(t[a].attrs,r))}let i=e.start,o=e.end;n.step(new Ke(i,o,i,o,new W(r,0,0),t.length,!0))}function Ev(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=n.steps.length;n.doc.nodesBetween(e,t,(a,u)=>{let f=typeof i=="function"?i(a):i;if(a.isTextblock&&!a.hasMarkup(r,f)&&_v(n.doc,n.mapping.slice(o).map(u),r)){let d=null;if(r.schema.linebreakReplacement){let b=r.whitespace=="pre",x=!!r.contentMatch.matchType(r.schema.linebreakReplacement);b&&!x?d=!1:!b&&x&&(d=!0)}d===!1&&gg(n,a,u,o),Rc(n,n.mapping.slice(o).map(u,1),r,void 0,d===null);let m=n.mapping.slice(o),p=m.map(u,1),g=m.map(u+a.nodeSize,1);return n.step(new Ke(p,g,p+1,g-1,new W(L.from(r.create(f,null,a.marks)),0,0),1,!0)),d===!0&&mg(n,a,u,o),!1}})}function mg(n,e,t,r){e.forEach((i,o)=>{if(i.isText){let a,u=/\r?\n|\r/g;for(;a=u.exec(i.text);){let f=n.mapping.slice(r).map(t+1+o+a.index);n.replaceWith(f,f+1,e.type.schema.linebreakReplacement.create())}}})}function gg(n,e,t,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let a=n.mapping.slice(r).map(t+1+o);n.replaceWith(a,a+1,e.type.schema.text(`
9
- `))}})}function _v(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function vv(n,e,t,r,i){let o=n.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");t||(t=o.type);let a=t.create(r,null,i||o.marks);if(o.isLeaf)return n.replaceWith(e,e+o.nodeSize,a);if(!t.validContent(o.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Ke(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new W(L.from(a),0,0),1,!0))}function Pn(n,e,t=1,r){let i=n.resolve(e),o=i.depth-t,a=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!a.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let d=i.depth-1,m=t-2;d>o;d--,m--){let p=i.node(d),g=i.index(d);if(p.type.spec.isolating)return!1;let b=p.content.cutByIndex(g,p.childCount),x=r&&r[m+1];x&&(b=b.replaceChild(0,x.type.create(x.attrs)));let E=r&&r[m]||p;if(!p.canReplace(g+1,p.childCount)||!E.type.validContent(b))return!1}let u=i.indexAfter(o),f=r&&r[0];return i.node(o).canReplaceWith(u,u,f?f.type:i.node(o+1).type)}function Tv(n,e,t=1,r){let i=n.doc.resolve(e),o=L.empty,a=L.empty;for(let u=i.depth,f=i.depth-t,d=t-1;u>f;u--,d--){o=L.from(i.node(u).copy(o));let m=r&&r[d];a=L.from(m?m.type.create(m.attrs,a):i.node(u).copy(a))}n.step(new Ge(e,e,new W(o.append(a),t,t),!0))}function dr(n,e){let t=n.resolve(e),r=t.index();return yg(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Cv(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<e.childCount;i++){let o=e.child(i),a=o.type==r?n.type.schema.nodes.text:o.type;if(t=t.matchType(a),!t||!n.type.allowsMarks(o.marks))return!1}return t.validEnd}function yg(n,e){return!!(n&&e&&!n.isLeaf&&Cv(n,e))}function ml(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let o,a,u=r.index(i);if(i==r.depth?(o=r.nodeBefore,a=r.nodeAfter):t>0?(o=r.node(i+1),u++,a=r.node(i).maybeChild(u)):(o=r.node(i).maybeChild(u-1),a=r.node(i+1)),o&&!o.isTextblock&&yg(o,a)&&r.node(i).canReplace(u,u+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function Mv(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,o=n.doc.resolve(e-t),a=o.node().type;if(i&&a.inlineContent){let m=a.whitespace=="pre",p=!!a.contentMatch.matchType(i);m&&!p?r=!1:!m&&p&&(r=!0)}let u=n.steps.length;if(r===!1){let m=n.doc.resolve(e+t);gg(n,m.node(),m.before(),u)}a.inlineContent&&Rc(n,e+t-1,a,o.node().contentMatchAt(o.index()),r==null);let f=n.mapping.slice(u),d=f.map(e-t);if(n.step(new Ge(d,f.map(e+t,-1),W.empty,!0)),r===!0){let m=n.doc.resolve(d);mg(n,m.node(),m.before(),n.steps.length)}return n}function Av(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,t))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,t))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function Iv(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let o=0;o<t.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(t.openStart==0&&t.size?2:1);o++)for(let a=r.depth;a>=0;a--){let u=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,f=r.index(a)+(u>0?1:0),d=r.node(a),m=!1;if(o==1)m=d.canReplace(f,f,i);else{let p=d.contentMatchAt(f).findWrapping(i.firstChild.type);m=p&&d.canReplaceWith(f,f,p[0])}if(m)return u==0?r.pos:u<0?r.before(a+1):r.after(a+1)}return null}function gl(n,e,t=e,r=W.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),o=n.resolve(t);return bg(i,o,r)?new Ge(e,t,r):new Ov(i,o,r).fit()}function bg(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Ov{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=L.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=L.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=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 o=this.placed,a=r.depth,u=i.depth;for(;a&&u&&o.childCount==1;)o=o.firstChild.content,a--,u--;let f=new W(o,a,u);return e>-1?new Ke(r.pos,e,this.$to.pos,this.$to.end(),f,t):f.size||r.pos!=this.$to.pos?new Ge(r.pos,i.pos,f):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=t.firstChild;if(t.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}t=o.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=Pc(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let a=i.firstChild;for(let u=this.depth;u>=0;u--){let{type:f,match:d}=this.frontier[u],m,p=null;if(t==1&&(a?d.matchType(a.type)||(p=d.fillBefore(L.from(a),!1)):o&&f.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:u,parent:o,inject:p};if(t==2&&a&&(m=d.findWrapping(a.type)))return{sliceDepth:r,frontierDepth:u,parent:o,wrap:m};if(o&&d.matchType(o.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Pc(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new W(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Pc(e,t);if(i.childCount<=1&&t>0){let o=e.size-t<=t+i.size;this.unplaced=new W(xs(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new W(xs(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let E=0;E<o.length;E++)this.openFrontierNode(o[E]);let a=this.unplaced,u=r?r.content:a.content,f=a.openStart-e,d=0,m=[],{match:p,type:g}=this.frontier[t];if(i){for(let E=0;E<i.childCount;E++)m.push(i.child(E));p=p.matchFragment(i)}let b=u.size+e-(a.content.size-a.openEnd);for(;d<u.childCount;){let E=u.child(d),C=p.matchType(E.type);if(!C)break;d++,(d>1||f==0||E.content.size)&&(p=C,m.push(wg(E.mark(g.allowedMarks(E.marks)),d==1?f:0,d==u.childCount?b:-1)))}let x=d==u.childCount;x||(b=-1),this.placed=ks(this.placed,t,L.from(m)),this.frontier[t].match=p,x&&b<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let E=0,C=u;E<b;E++){let M=C.lastChild;this.frontier.push({type:M.type,match:M.contentMatchAt(M.childCount)}),C=M.content}this.unplaced=x?e==0?W.empty:new W(xs(a.content,e-1,1),e-1,b<0?a.openEnd:e-1):new W(xs(a.content,e,d),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Dc(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.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 t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=Dc(e,t,i,r,o);if(a){for(let u=t-1;u>=0;u--){let{match:f,type:d}=this.frontier[u],m=Dc(e,u,d,f,!0);if(!m||m.childCount)continue e}return{depth:t,fit:a,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=ks(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=ks(this.placed,this.depth,L.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(L.empty,!0);t.childCount&&(this.placed=ks(this.placed,this.frontier.length,t))}}function xs(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(xs(n.firstChild.content,e-1,t)))}function ks(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(ks(n.lastChild.content,e-1,t)))}function Pc(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function wg(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,wg(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(L.empty,!0)))),n.copy(r)}function Dc(n,e,t,r,i){let o=n.node(e),a=i?n.indexAfter(e):n.index(e);if(a==o.childCount&&!t.compatibleContent(o.type))return null;let u=r.fillBefore(o.content,!0,a);return u&&!Nv(t,o.content,a)?u:null}function Nv(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function Rv(n){return n.spec.defining||n.spec.definingForContent}function Lv(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),o=n.doc.resolve(t);if(bg(i,o,r))return n.step(new Ge(e,t,r));let a=xg(i,n.doc.resolve(t));a[a.length-1]==0&&a.pop();let u=-(i.depth+1);a.unshift(u);for(let g=i.depth,b=i.pos-1;g>0;g--,b--){let x=i.node(g).type.spec;if(x.defining||x.definingAsContext||x.isolating)break;a.indexOf(g)>-1?u=g:i.before(g)==b&&a.splice(1,0,-g)}let f=a.indexOf(u),d=[],m=r.openStart;for(let g=r.content,b=0;;b++){let x=g.firstChild;if(d.push(x),b==r.openStart)break;g=x.content}for(let g=m-1;g>=0;g--){let b=d[g],x=Rv(b.type);if(x&&!b.sameMarkup(i.node(Math.abs(u)-1)))m=g;else if(x||!b.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let b=(g+m+1)%(r.openStart+1),x=d[b];if(x)for(let E=0;E<a.length;E++){let C=a[(E+f)%a.length],M=!0;C<0&&(M=!1,C=-C);let P=i.node(C-1),F=i.index(C-1);if(P.canReplaceWith(F,F,x.type,x.marks))return n.replace(i.before(C),M?o.after(C):t,new W(Sg(r.content,0,r.openStart,b),b,r.openEnd))}}let p=n.steps.length;for(let g=a.length-1;g>=0&&(n.replace(e,t,r),!(n.steps.length>p));g--){let b=a[g];b<0||(e=i.before(b),t=o.after(b))}}function Sg(n,e,t,r,i){if(e<t){let o=n.firstChild;n=n.replaceChild(0,o.copy(Sg(o.content,e+1,t,r,o)))}if(e>r){let o=i.contentMatchAt(0),a=o.fillBefore(n).append(n);n=a.append(o.matchFragment(a).fillBefore(L.empty,!0))}return n}function Pv(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=Av(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new W(L.from(r),0,0))}function Dv(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),o=xg(r,i);for(let a=0;a<o.length;a++){let u=o[a],f=a==o.length-1;if(f&&u==0||r.node(u).type.contentMatch.validEnd)return n.delete(r.start(u),i.end(u));if(u>0&&(f||r.node(u-1).canReplace(r.index(u-1),i.indexAfter(u-1))))return n.delete(r.before(u),i.after(u))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(e-r.start(a)==r.depth-a&&t>r.end(a)&&i.end(a)-t!=i.depth-a&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return n.delete(r.before(a),t);n.delete(e,t)}function xg(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let o=n.start(i);if(o<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&t.push(i)}return t}class Fi extends $e{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return Re.fail("No node at attribute step's position");let r=Object.create(null);for(let o in t.attrs)r[o]=t.attrs[o];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return Re.fromReplace(e,this.pos,this.pos+1,new W(L.from(i),0,t.isLeaf?0:1))}getMap(){return It.empty}invert(e){return new Fi(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Fi(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Fi(t.pos,t.attr,t.value)}}$e.jsonID("attr",Fi);class Ks extends $e{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return Re.ok(r)}getMap(){return It.empty}invert(e){return new Ks(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Ks(t.attr,t.value)}}$e.jsonID("docAttr",Ks);let _i=class extends Error{};_i=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},_i.prototype=Object.create(Error.prototype),_i.prototype.constructor=_i,_i.prototype.name="TransformError";class zv{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new zi}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new _i(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=W.empty){let i=gl(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new W(L.from(r),0,0))}delete(e,t){return this.replace(e,t,W.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return Lv(this,e,t,r),this}replaceRangeWith(e,t,r){return Pv(this,e,t,r),this}deleteRange(e,t){return Dv(this,e,t),this}lift(e,t){return wv(this,e,t),this}join(e,t=1){return Mv(this,e,t),this}wrap(e,t){return kv(this,e,t),this}setBlockType(e,t=e,r,i=null){return Ev(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return vv(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Fi(e,t,r)),this}setDocAttribute(e,t){return this.step(new Ks(e,t)),this}addNodeMark(e,t){return this.step(new vr(e,t)),this}removeNodeMark(e,t){if(!(t instanceof Te)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new Bi(e,t)),this}split(e,t=1,r){return Tv(this,e,t,r),this}addMark(e,t,r){return gv(this,e,t,r),this}removeMark(e,t,r){return yv(this,e,t,r),this}clearIncompatible(e,t,r){return Rc(this,e,t,r),this}}const zc=Object.create(null);class pe{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new Bv(e.min(t),e.max(t))]}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 t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=W.empty){let r=t.content.lastChild,i=null;for(let u=0;u<t.openEnd;u++)i=r,r=r.lastChild;let o=e.steps.length,a=this.ranges;for(let u=0;u<a.length;u++){let{$from:f,$to:d}=a[u],m=e.mapping.slice(o);e.replaceRange(m.map(f.pos),m.map(d.pos),u?W.empty:t),u==0&&_g(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:a,$to:u}=i[o],f=e.mapping.slice(r),d=f.map(a.pos),m=f.map(u.pos);o?e.deleteRange(d,m):(e.replaceRangeWith(d,m,t),_g(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new ae(e):vi(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let a=t<0?vi(e.node(0),e.node(o),e.before(o+1),e.index(o),t,r):vi(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,r);if(a)return a}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new At(e.node(0))}static atStart(e){return vi(e,e,0,0,1)||new At(e)}static atEnd(e){return vi(e,e,e.content.size,e.childCount,-1)||new At(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=zc[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in zc)throw new RangeError("Duplicate use of selection JSON ID "+e);return zc[e]=t,t.prototype.jsonID=e,t}getBookmark(){return ae.between(this.$anchor,this.$head).getBookmark()}}pe.prototype.visible=!0;class Bv{constructor(e,t){this.$from=e,this.$to=t}}let kg=!1;function Eg(n){!kg&&!n.parent.inlineContent&&(kg=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class ae extends pe{constructor(e,t=e){Eg(e),Eg(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return pe.near(r);let i=e.resolve(t.map(this.anchor));return new ae(i.parent.inlineContent?i:r,r)}replace(e,t=W.empty){if(super.replace(e,t),t==W.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ae&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Aa(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new ae(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let o=pe.findFrom(t,r,!0)||pe.findFrom(t,-r,!0);if(o)t=o.$head;else return pe.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(pe.findFrom(e,-r,!0)||pe.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new ae(e,t)}}pe.jsonID("text",ae);class Aa{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Aa(e.map(this.anchor),e.map(this.head))}resolve(e){return ae.between(e.resolve(this.anchor),e.resolve(this.head))}}class Y extends pe{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:i}=t.mapResult(this.anchor),o=e.resolve(i);return r?pe.near(o):new Y(o)}content(){return new W(L.from(this.node),0,0)}eq(e){return e instanceof Y&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new pd(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Y(e.resolve(t.anchor))}static create(e,t){return new Y(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Y.prototype.visible=!1,pe.jsonID("node",Y);class pd{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Aa(r,r):new pd(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&Y.isSelectable(r)?new Y(t):pe.near(t)}}class At extends pe{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=W.empty){if(t==W.empty){e.delete(0,e.doc.content.size);let r=pe.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new At(e)}map(e){return new At(e)}eq(e){return e instanceof At}getBookmark(){return Fv}}pe.jsonID("all",At);const Fv={map(){return this},resolve(n){return new At(n)}};function vi(n,e,t,r,i,o=!1){if(e.inlineContent)return ae.create(n,t);for(let a=r-(i>0?0:1);i>0?a<e.childCount:a>=0;a+=i){let u=e.child(a);if(u.isAtom){if(!o&&Y.isSelectable(u))return Y.create(n,t-(i<0?u.nodeSize:0))}else{let f=vi(n,u,t+i,i<0?u.childCount:0,i,o);if(f)return f}t+=u.nodeSize*i}return null}function _g(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof Ge||i instanceof Ke))return;let o=n.mapping.maps[r],a;o.forEach((u,f,d,m)=>{a==null&&(a=m)}),n.setSelection(pe.near(n.doc.resolve(a),t))}function vg(n,e){return!e||!n?n:n.bind(e)}class yl{constructor(e,t,r){this.name=e,this.init=vg(t.init,r),this.apply=vg(t.apply,r)}}new yl("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new yl("selection",{init(n,e){return n.selection||pe.atStart(e.doc)},apply(n){return n.selection}}),new yl("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new yl("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}});function Tg(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Tg(i,e,{})),t[r]=i}return t}class lt{constructor(e){this.spec=e,this.props={},e.props&&Tg(e.props,this,this.props),this.key=e.key?e.key.key:Cg("plugin")}getState(e){return e[this.key]}}const Bc=Object.create(null);function Cg(n){return n in Bc?n+"$"+ ++Bc[n]:(Bc[n]=0,n+"$")}class Tt{constructor(e="key"){this.key=Cg(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Hr=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Mg=function(n,e,t,r){return t&&(Ag(n,e,t,r,-1)||Ag(n,e,t,r,1))},Hv=/^(img|br|input|textarea|hr)$/i;function Ag(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:bl(n))){let o=n.parentNode;if(!o||o.nodeType!=1||Fc(n)||Hv.test(n.nodeName)||n.contentEditable=="false")return!1;e=Hr(n)+(i<0?0:1),n=o}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.contentEditable=="false")return!1;e=i<0?bl(n):0}else return!1}}function bl(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function $v(n,e,t){for(let r=e==0,i=e==bl(n);r||i;){if(n==t)return!0;let o=Hr(n);if(n=n.parentNode,!n)return!1;r=r&&o==0,i=i&&o==bl(n)}}function Fc(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Ig=function(n){return n.focusNode&&Mg(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Og(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}const fn=typeof navigator<"u"?navigator:null,Ng=typeof document<"u"?document:null,hr=fn&&fn.userAgent||"",Hc=/Edge\/(\d+)/.exec(hr),Rg=/MSIE \d/.exec(hr),$c=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(hr),Es=!!(Rg||$c||Hc),Lg=Rg?document.documentMode:$c?+$c[1]:Hc?+Hc[1]:0,wl=!Es&&/gecko\/(\d+)/i.test(hr);wl&&+(/Firefox\/(\d+)/.exec(hr)||[0,0])[1];const Wc=!Es&&/Chrome\/(\d+)/.exec(hr),pr=!!Wc,Pg=Wc?+Wc[1]:0,$r=!Es&&!!fn&&/Apple Computer/.test(fn.vendor),Uc=$r&&(/Mobile\/\w+/.test(hr)||!!fn&&fn.maxTouchPoints>2),$t=Uc||(fn?/Mac/.test(fn.platform):!1),Wv=fn?/Win/.test(fn.platform):!1,_s=/Android \d/.test(hr),Vc=!!Ng&&"webkitFontSmoothing"in Ng.documentElement.style,Uv=Vc?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Vv(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),o=i&&i.size==0,a=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(a<0)return null;let u=r.resolve(a),f,d;if(Ig(t)){for(f=a;i&&!i.node;)i=i.parent;let p=i.node;if(i&&p.isAtom&&Y.isSelectable(p)&&i.parent&&!(p.isInline&&$v(t.focusNode,t.focusOffset,i.dom))){let g=i.posBefore;d=new Y(a==g?u:r.resolve(g))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let p=a,g=a;for(let b=0;b<t.rangeCount;b++){let x=t.getRangeAt(b);p=Math.min(p,n.docView.posFromDOM(x.startContainer,x.startOffset,1)),g=Math.max(g,n.docView.posFromDOM(x.endContainer,x.endOffset,-1))}if(p<0)return null;[f,a]=g==n.state.selection.anchor?[g,p]:[p,g],u=r.resolve(a)}else f=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(f<0)return null}let m=r.resolve(f);if(!d){let p=e=="pointer"||n.state.selection.head<u.pos&&!o?1:-1;d=$g(n,m,u,p)}return d}function Dg(n){return n.editable?n.hasFocus():qv(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Kc(n,e=!1){let t=n.state.selection;if(Jv(n,t),!!Dg(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&pr){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Mg(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)Gv(n);else{let{anchor:r,head:i}=t,o,a;zg&&!(t instanceof ae)&&(t.$from.parent.inlineContent||(o=Bg(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(a=Bg(n,t.to))),n.docView.setSelection(r,i,n,e),zg&&(o&&Fg(o),a&&Fg(a)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Kv(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const zg=$r||pr&&Pg<63;function Bg(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,o=r?t.childNodes[r-1]:null;if($r&&i&&i.contentEditable=="false")return Gc(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return Gc(i);if(o)return Gc(o)}}function Gc(n){return n.contentEditable="true",$r&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Fg(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Kv(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Dg(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Gv(n){let e=n.domSelection(),t=document.createRange();if(!e)return;let r=n.cursorWrapper.dom,i=r.nodeName=="IMG";i?t.setStart(r.parentNode,Hr(r)+1):t.setStart(r,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&&Es&&Lg<=11&&(r.disabled=!0,r.disabled=!1)}function Jv(n,e){if(e instanceof Y){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Hg(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Hg(n)}function Hg(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function $g(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||ae.between(e,t,r)}function qv(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Jc(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),o=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return o&&pe.findFrom(o,e)}function mr(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Wg(n,e,t){let r=n.state.selection;if(r instanceof ae)if(t.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let a=n.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return mr(n,new ae(r.$anchor,a))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=Jc(n.state,e);return i&&i instanceof Y?mr(n,i):!1}else if(!($t&&t.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,a;if(!o||o.isText)return!1;let u=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(a=n.docView.descAt(u))&&!a.contentDOM?Y.isSelectable(o)?mr(n,new Y(e<0?n.state.doc.resolve(i.pos-o.nodeSize):i)):Vc?mr(n,new ae(n.state.doc.resolve(e<0?u:u+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Y&&r.node.isInline)return mr(n,new ae(e>0?r.$to:r.$from));{let i=Jc(n.state,e);return i?mr(n,i):!1}}}function Sl(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function vs(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Ti(n,e){return e<0?jv(n):Yv(n)}function jv(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,o,a=!1;for(wl&&t.nodeType==1&&r<Sl(t)&&vs(t.childNodes[r],-1)&&(a=!0);;)if(r>0){if(t.nodeType!=1)break;{let u=t.childNodes[r-1];if(vs(u,-1))i=t,o=--r;else if(u.nodeType==3)t=u,r=t.nodeValue.length;else break}}else{if(Ug(t))break;{let u=t.previousSibling;for(;u&&vs(u,-1);)i=t.parentNode,o=Hr(u),u=u.previousSibling;if(u)t=u,r=Sl(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}a?qc(n,t,r):i&&qc(n,i,o)}function Yv(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=Sl(t),o,a;for(;;)if(r<i){if(t.nodeType!=1)break;let u=t.childNodes[r];if(vs(u,1))o=t,a=++r;else break}else{if(Ug(t))break;{let u=t.nextSibling;for(;u&&vs(u,1);)o=u.parentNode,a=Hr(u)+1,u=u.nextSibling;if(u)t=u,r=0,i=Sl(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}o&&qc(n,o,a)}function Ug(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Xv(n,e){for(;n&&e==n.childNodes.length&&!Fc(n);)e=Hr(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function Zv(n,e){for(;n&&!e&&!Fc(n);)e=Hr(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function qc(n,e,t){if(e.nodeType!=3){let o,a;(a=Xv(e,t))?(e=a,t=0):(o=Zv(e,t))&&(e=o,t=o.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Ig(r)){let o=document.createRange();o.setEnd(e,t),o.setStart(e,t),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&Kc(n)},50)}function Vg(n,e){let t=n.state.doc.resolve(e);if(!(pr||Wv)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let o=n.coordsAtPos(e-1),a=(o.top+o.bottom)/2;if(a>i.top&&a<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(e<t.end()){let o=n.coordsAtPos(e+1),a=(o.top+o.bottom)/2;if(a>i.top&&a<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Kg(n,e,t){let r=n.state.selection;if(r instanceof ae&&!r.empty||t.indexOf("s")>-1||$t&&t.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let a=Jc(n.state,e);if(a&&a instanceof Y)return mr(n,a)}if(!i.parent.inlineContent){let a=e<0?i:o,u=r instanceof At?pe.near(a,e):pe.findFrom(a,e);return u?mr(n,u):!1}return!1}function Gg(n,e){if(!(n.state.selection instanceof ae))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(o&&!o.isText){let a=n.state.tr;return e<0?a.delete(t.pos-o.nodeSize,t.pos):a.delete(t.pos,t.pos+o.nodeSize),n.dispatch(a),!0}return!1}function Jg(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Qv(n){if(!$r||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Jg(n,r,"true"),setTimeout(()=>Jg(n,r,"false"),20)}return!1}function eT(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function tT(n,e){let t=e.keyCode,r=eT(e);if(t==8||$t&&t==72&&r=="c")return Gg(n,-1)||Ti(n,-1);if(t==46&&!e.shiftKey||$t&&t==68&&r=="c")return Gg(n,1)||Ti(n,1);if(t==13||t==27)return!0;if(t==37||$t&&t==66&&r=="c"){let i=t==37?Vg(n,n.state.selection.from)=="ltr"?-1:1:-1;return Wg(n,i,r)||Ti(n,i)}else if(t==39||$t&&t==70&&r=="c"){let i=t==39?Vg(n,n.state.selection.from)=="ltr"?1:-1:1;return Wg(n,i,r)||Ti(n,i)}else{if(t==38||$t&&t==80&&r=="c")return Kg(n,-1,r)||Ti(n,-1);if(t==40||$t&&t==78&&r=="c")return Qv(n)||Kg(n,1,r)||Ti(n,1);if(r==($t?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function qg(n,e){n.someProp("transformCopied",b=>{e=b(e,n)});let t=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let b=r.firstChild;t.push(b.type.name,b.attrs!=b.type.defaultAttrs?b.attrs:null),r=b.content}let a=n.someProp("clipboardSerializer")||Us.fromSchema(n.state.schema),u=n0(),f=u.createElement("div");f.appendChild(a.serializeFragment(r,{document:u}));let d=f.firstChild,m,p=0;for(;d&&d.nodeType==1&&(m=e0[d.nodeName.toLowerCase()]);){for(let b=m.length-1;b>=0;b--){let x=u.createElement(m[b]);for(;f.firstChild;)x.appendChild(f.firstChild);f.appendChild(x),p++}d=f.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${i} ${o}${p?` -${p}`:""} ${JSON.stringify(t)}`);let g=n.someProp("clipboardTextSerializer",b=>b(e,n))||e.content.textBetween(0,e.content.size,`
3
+ `,...sE(i)),console.warn(...o)}Uo(),bu=!1}function iE(){let n=Dr[Dr.length-1];if(!n)return[];const e=[];for(;n;){const t=e[0];t&&t.vnode===n?t.recurseCount++:e.push({vnode:n,recurseCount:0});const r=n.component&&n.component.parent;n=r&&r.vnode}return e}function sE(n){const e=[];return n.forEach((t,r)=>{e.push(...r===0?[]:[`
4
+ `],...oE(t))}),e}function oE({vnode:n,recurseCount:e}){const t=e>0?`... (${e} recursive calls)`:"",r=n.component?n.component.parent==null:!1,i=` at <${Nm(n.component,n.type,r)}`,o=">"+t;return n.props?[i,...lE(n.props),o]:[i+o]}function lE(n){const e=[],t=Object.keys(n);return t.slice(0,3).forEach(r=>{e.push(...mm(r,n[r]))}),t.length>3&&e.push(" ..."),e}function mm(n,e,t){return On(e)?(e=JSON.stringify(e),t?e:[`${n}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?t?e:[`${n}=${e}`]:ot(e)?(e=mm(n,oe(e.value),!0),t?e:[`${n}=Ref<`,e,">"]):Xe(e)?[`${n}=fn${e.name?`<${e.name}>`:""}`]:(e=oe(e),t?e:[`${n}=`,e])}const gm={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush",15:"component update",16:"app unmount cleanup function"};function Xo(n,e,t,r){try{return r?n(...r):n()}catch(i){vu(i,e,t)}}function ym(n,e,t,r){if(Xe(n)){const i=Xo(n,e,t,r);return i&&bk(i)&&i.catch(o=>{vu(o,e,t)}),i}if(Pe(n)){const i=[];for(let o=0;o<n.length;o++)i.push(ym(n[o],e,t,r));return i}else process.env.NODE_ENV!=="production"&&lt(`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof n}`)}function vu(n,e,t,r=!0){const i=e?e.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:a}=e&&e.appContext.config||as;if(e){let c=e.parent;const f=e.proxy,h=process.env.NODE_ENV!=="production"?gm[t]:`https://vuejs.org/error-reference/#runtime-${t}`;for(;c;){const m=c.ec;if(m){for(let p=0;p<m.length;p++)if(m[p](n,f,h)===!1)return}c=c.parent}if(o){Wo(),Xo(o,null,10,[n,f,h]),Uo();return}}aE(n,t,i,r,a)}function aE(n,e,t,r=!0,i=!1){if(process.env.NODE_ENV!=="production"){const o=gm[e];if(t&&nE(t),lt(`Unhandled error${o?` during execution of ${o}`:""}`),t&&rE(),r)throw n;console.error(n)}else{if(i)throw n;console.error(n)}}const $t=[];let Pn=-1;const bi=[];let cr=null,vi=0;const cE=Promise.resolve();let wu=null;const uE=100;function fE(n){let e=Pn+1,t=$t.length;for(;e<t;){const r=e+t>>>1,i=$t[r],o=gs(i);o<n||o===n&&i.flags&2?e=r+1:t=r}return e}function bm(n){if(!(n.flags&1)){const e=gs(n),t=$t[$t.length-1];!t||!(n.flags&2)&&e>=gs(t)?$t.push(n):$t.splice(fE(e),0,n),n.flags|=1,vm()}}function vm(){wu||(wu=cE.then(Sm))}function wm(n){Pe(n)?bi.push(...n):cr&&n.id===-1?cr.splice(vi+1,0,n):n.flags&1||(bi.push(n),n.flags|=1),vm()}function hE(n){if(bi.length){const e=[...new Set(bi)].sort((t,r)=>gs(t)-gs(r));if(bi.length=0,cr){cr.push(...e);return}for(cr=e,process.env.NODE_ENV!=="production"&&(n=n||new Map),vi=0;vi<cr.length;vi++){const t=cr[vi];process.env.NODE_ENV!=="production"&&xm(n,t)||(t.flags&4&&(t.flags&=-2),t.flags&8||t(),t.flags&=-2)}cr=null,vi=0}}const gs=n=>n.id==null?n.flags&2?-1:1/0:n.id;function Sm(n){process.env.NODE_ENV!=="production"&&(n=n||new Map);const e=process.env.NODE_ENV!=="production"?t=>xm(n,t):pi;try{for(Pn=0;Pn<$t.length;Pn++){const t=$t[Pn];if(t&&!(t.flags&8)){if(process.env.NODE_ENV!=="production"&&e(t))continue;t.flags&4&&(t.flags&=-2),Xo(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2)}}}finally{for(;Pn<$t.length;Pn++){const t=$t[Pn];t&&(t.flags&=-2)}Pn=-1,$t.length=0,hE(n),wu=null,($t.length||bi.length)&&Sm(n)}}function xm(n,e){const t=n.get(e)||0;if(t>uE){const r=e.i,i=r&&Om(r.type);return vu(`Maximum recursive updates exceeded${i?` in component <${i}>`:""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,null,10),!0}return n.set(e,t+1),!1}const Su=new Map;process.env.NODE_ENV!=="production"&&($o().__VUE_HMR_RUNTIME__={createRecord:xu(dE),rerender:xu(pE),reload:xu(mE)});const Zo=new Map;function dE(n,e){return Zo.has(n)?!1:(Zo.set(n,{initialDef:Qo(e),instances:new Set}),!0)}function Qo(n){return Rm(n)?n.__vccOpts:n}function pE(n,e){const t=Zo.get(n);t&&(t.initialDef.render=e,[...t.instances].forEach(r=>{e&&(r.render=e,Qo(r.type).render=e),r.renderCache=[],r.update()}))}function mE(n,e){const t=Zo.get(n);if(!t)return;e=Qo(e),km(t.initialDef,e);const r=[...t.instances];for(let i=0;i<r.length;i++){const o=r[i],a=Qo(o.type);let c=Su.get(a);c||(a!==t.initialDef&&km(a,e),Su.set(a,c=new Set)),c.add(o),o.appContext.propsCache.delete(o.type),o.appContext.emitsCache.delete(o.type),o.appContext.optionsCache.delete(o.type),o.ceReload?(c.add(o),o.ceReload(e.styles),c.delete(o)):o.parent?bm(()=>{o.parent.update(),c.delete(o)}):o.appContext.reload?o.appContext.reload():typeof window<"u"?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required."),o.root.ce&&o!==o.root&&o.root.ce._removeChildStyle(a)}wm(()=>{Su.clear()})}function km(n,e){sr(n,e);for(const t in n)t!=="__file"&&!(t in e)&&delete n[t]}function xu(n){return(e,t)=>{try{return n(e,t)}catch(r){console.error(r),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let wi,el=[];function Em(n,e){var t,r;wi=n,wi?(wi.enabled=!0,el.forEach(({event:i,args:o})=>wi.emit(i,...o)),el=[]):typeof window<"u"&&window.HTMLElement&&!((r=(t=window.navigator)==null?void 0:t.userAgent)!=null&&r.includes("jsdom"))?((e.__VUE_DEVTOOLS_HOOK_REPLAY__=e.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(o=>{Em(o,e)}),setTimeout(()=>{wi||(e.__VUE_DEVTOOLS_HOOK_REPLAY__=null,el=[])},3e3)):el=[]}let Si=null,gE=null;const yE=n=>n.__isTeleport;function _m(n,e){n.shapeFlag&6&&n.component?(n.transition=e,_m(n.component.subTree,e)):n.shapeFlag&128?(n.ssContent.transition=e.clone(n.ssContent),n.ssFallback.transition=e.clone(n.ssFallback)):n.transition=e}$o().requestIdleCallback,$o().cancelIdleCallback;const bE=Symbol.for("v-ndc"),vE={};process.env.NODE_ENV!=="production"&&(vE.ownKeys=n=>(lt("Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."),Reflect.ownKeys(n)));let wE=null;function SE(n,e,t=!1){const r=rl||Si;if(r||wE){const i=r?r.parent==null?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&n in i)return i[n];if(arguments.length>1)return t&&Xe(e)?e.call(r&&r.proxy):e;process.env.NODE_ENV!=="production"&&lt(`injection "${String(n)}" not found.`)}else process.env.NODE_ENV!=="production"&&lt("inject() can only be used inside setup() or functional components.")}const xE={},Tm=n=>Object.getPrototypeOf(n)===xE,kE=AE,EE=Symbol.for("v-scx"),_E=()=>{{const n=SE(EE);return n||process.env.NODE_ENV!=="production"&&lt("Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build."),n}};function TE(n,e,t){return process.env.NODE_ENV!=="production"&&!Xe(e)&&lt("`watch(fn, options?)` signature has been moved to a separate API. Use `watchEffect(fn, options?)` instead. `watch` now only supports `watch(source, cb, options?) signature."),CE(n,e,t)}function CE(n,e,t=as){const{immediate:r,deep:i,flush:o,once:a}=t;process.env.NODE_ENV!=="production"&&!e&&(r!==void 0&&lt('watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.'),i!==void 0&&lt('watch() "deep" option is only respected when using the watch(source, callback, options?) signature.'),a!==void 0&&lt('watch() "once" option is only respected when using the watch(source, callback, options?) signature.'));const c=sr({},t);process.env.NODE_ENV!=="production"&&(c.onWarn=lt);const f=e&&r||!e&&o!=="post";let h;if(il){if(o==="sync"){const b=_E();h=b.__watcherHandles||(b.__watcherHandles=[])}else if(!f){const b=()=>{};return b.stop=pi,b.resume=pi,b.pause=pi,b}}const m=rl;c.call=(b,S,k)=>ym(b,m,S,k);let p=!1;o==="post"?c.scheduler=b=>{kE(b,m&&m.suspense)}:o!=="sync"&&(p=!0,c.scheduler=(b,S)=>{S?b():bm(b)}),c.augmentJob=b=>{e&&(b.flags|=4),p&&(b.flags|=2,m&&(b.id=m.uid,b.i=m))};const g=tE(n,e,c);return il&&(h?h.push(g):f&&g()),g}const ME=n=>n.__isSuspense;function AE(n,e){e&&e.pendingBranch?Pe(n)?e.effects.push(...n):e.effects.push(n):wm(n)}const Cm=Symbol.for("v-fgt"),IE=Symbol.for("v-txt"),OE=Symbol.for("v-cmt");function NE(n){return n?n.__v_isVNode===!0:!1}const RE=(...n)=>Am(...n),Mm=({key:n})=>n??null,tl=({ref:n,ref_key:e,ref_for:t})=>(typeof n=="number"&&(n=""+n),n!=null?On(n)||ot(n)||Xe(n)?{i:Si,r:n,k:e,f:!!t}:n:null);function LE(n,e=null,t=null,r=0,i=null,o=n===Cm?0:1,a=!1,c=!1){const f={__v_isVNode:!0,__v_skip:!0,type:n,props:e,key:e&&Mm(e),ref:e&&tl(e),scopeId:gE,slotScopeIds:null,children:t,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:o,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:Si};return c?(ku(f,t),o&128&&n.normalize(f)):t&&(f.shapeFlag|=On(t)?8:16),process.env.NODE_ENV!=="production"&&f.key!==f.key&&lt("VNode created with invalid key (NaN). VNode type:",f.type),f}const PE=process.env.NODE_ENV!=="production"?RE:Am;function Am(n,e=null,t=null,r=0,i=null,o=!1){if((!n||n===bE)&&(process.env.NODE_ENV!=="production"&&!n&&lt(`Invalid vnode type when creating vnode: ${n}.`),n=OE),NE(n)){const c=nl(n,e,!0);return t&&ku(c,t),c.patchFlag=-2,c}if(Rm(n)&&(n=n.__vccOpts),e){e=DE(e);let{class:c,style:f}=e;c&&!On(c)&&(e.class=iu(c)),pt(f)&&(Jo(f)&&!Pe(f)&&(f=sr({},f)),e.style=ru(f))}const a=On(n)?1:ME(n)?128:yE(n)?64:pt(n)?4:Xe(n)?2:0;return process.env.NODE_ENV!=="production"&&a&4&&Jo(n)&&(n=oe(n),lt("Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.",`
5
+ Component that was made reactive: `,n)),LE(n,e,t,r,i,a,o,!0)}function DE(n){return n?Jo(n)||Tm(n)?sr({},n):n:null}function nl(n,e,t=!1,r=!1){const{props:i,ref:o,patchFlag:a,children:c,transition:f}=n,h=e?BE(i||{},e):i,m={__v_isVNode:!0,__v_skip:!0,type:n.type,props:h,key:h&&Mm(h),ref:e&&e.ref?t&&o?Pe(o)?o.concat(tl(e)):[o,tl(e)]:tl(e):o,scopeId:n.scopeId,slotScopeIds:n.slotScopeIds,children:process.env.NODE_ENV!=="production"&&a===-1&&Pe(c)?c.map(Im):c,target:n.target,targetStart:n.targetStart,targetAnchor:n.targetAnchor,staticCount:n.staticCount,shapeFlag:n.shapeFlag,patchFlag:e&&n.type!==Cm?a===-1?16:a|16:a,dynamicProps:n.dynamicProps,dynamicChildren:n.dynamicChildren,appContext:n.appContext,dirs:n.dirs,transition:f,component:n.component,suspense:n.suspense,ssContent:n.ssContent&&nl(n.ssContent),ssFallback:n.ssFallback&&nl(n.ssFallback),el:n.el,anchor:n.anchor,ctx:n.ctx,ce:n.ce};return f&&r&&_m(m,f.clone(m)),m}function Im(n){const e=nl(n);return Pe(n.children)&&(e.children=n.children.map(Im)),e}function zE(n=" ",e=0){return PE(IE,null,n,e)}function ku(n,e){let t=0;const{shapeFlag:r}=n;if(e==null)e=null;else if(Pe(e))t=16;else if(typeof e=="object")if(r&65){const i=e.default;i&&(i._c&&(i._d=!1),ku(n,i()),i._c&&(i._d=!0));return}else t=32,!e._&&!Tm(e)&&(e._ctx=Si);else Xe(e)?(e={default:e,_ctx:Si},t=32):(e=String(e),r&64?(t=16,e=[zE(e)]):t=8);n.children=e,n.shapeFlag|=t}function BE(...n){const e={};for(let t=0;t<n.length;t++){const r=n[t];for(const i in r)if(i==="class")e.class!==r.class&&(e.class=iu([e.class,r.class]));else if(i==="style")e.style=ru([e.style,r.style]);else if(mk(i)){const o=e[i],a=r[i];a&&o!==a&&!(Pe(o)&&o.includes(a))&&(e[i]=o?[].concat(o,a):a)}else i!==""&&(e[i]=r[i])}return e}let rl=null;const FE=()=>rl||Si;{const n=$o(),e=(t,r)=>{let i;return(i=n[t])||(i=n[t]=[]),i.push(r),o=>{i.length>1?i.forEach(a=>a(o)):i[0](o)}};e("__VUE_INSTANCE_SETTERS__",t=>rl=t),e("__VUE_SSR_SETTERS__",t=>il=t)}let il=!1;process.env.NODE_ENV;const HE=/(?:^|[-_])(\w)/g,$E=n=>n.replace(HE,e=>e.toUpperCase()).replace(/[-_]/g,"");function Om(n,e=!0){return Xe(n)?n.displayName||n.name:n.name||e&&n.__name}function Nm(n,e,t=!1){let r=Om(e);if(!r&&e.__file){const i=e.__file.match(/([^/\\]+)\.\w+$/);i&&(r=i[1])}if(!r&&n&&n.parent){const i=o=>{for(const a in o)if(o[a]===e)return a};r=i(n.components||n.parent.type.components)||i(n.appContext.components)}return r?$E(r):t?"App":"Anonymous"}function Rm(n){return Xe(n)&&"__vccOpts"in n}const he=(n,e)=>{const t=Qk(n,e,il);if(process.env.NODE_ENV!=="production"){const r=FE();r&&r.appContext.config.warnRecursiveComputed&&(t._warnRecursive=!0)}return t};function WE(){if(process.env.NODE_ENV==="production"||typeof window>"u")return;const n={style:"color:#3ba776"},e={style:"color:#1677ff"},t={style:"color:#f5222d"},r={style:"color:#eb2f96"},i={__vue_custom_formatter:!0,header(p){return pt(p)?p.__isVue?["div",n,"VueInstance"]:ot(p)?["div",{},["span",n,m(p)],"<",c("_value"in p?p._value:p),">"]:ms(p)?["div",{},["span",n,gt(p)?"ShallowReactive":"Reactive"],"<",c(p),`>${Ln(p)?" (readonly)":""}`]:Ln(p)?["div",{},["span",n,gt(p)?"ShallowReadonly":"Readonly"],"<",c(p),">"]:null:null},hasBody(p){return p&&p.__isVue},body(p){if(p&&p.__isVue)return["div",{},...o(p.$)]}};function o(p){const g=[];p.type.props&&p.props&&g.push(a("props",oe(p.props))),p.setupState!==as&&g.push(a("setup",p.setupState)),p.data!==as&&g.push(a("data",oe(p.data)));const b=f(p,"computed");b&&g.push(a("computed",b));const S=f(p,"inject");return S&&g.push(a("injected",S)),g.push(["div",{},["span",{style:r.style+";opacity:0.66"},"$ (internal): "],["object",{object:p}]]),g}function a(p,g){return g=sr({},g),Object.keys(g).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},p],["div",{style:"padding-left:1.25em"},...Object.keys(g).map(b=>["div",{},["span",r,b+": "],c(g[b],!1)])]]:["span",{}]}function c(p,g=!0){return typeof p=="number"?["span",e,p]:typeof p=="string"?["span",t,JSON.stringify(p)]:typeof p=="boolean"?["span",r,p]:pt(p)?["object",{object:g?oe(p):p}]:["span",t,String(p)]}function f(p,g){const b=p.type;if(Xe(b))return;const S={};for(const k in p.ctx)h(b,k,g)&&(S[k]=p.ctx[k]);return S}function h(p,g,b){const S=p[b];if(Pe(S)&&S.includes(g)||pt(S)&&g in S||p.extends&&h(p.extends,g,b)||p.mixins&&p.mixins.some(k=>h(k,g,b)))return!0}function m(p){return gt(p)?"ShallowRef":p.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(i):window.devtoolsFormatters=[i]}process.env.NODE_ENV,process.env.NODE_ENV,process.env.NODE_ENV;function UE(){WE()}process.env.NODE_ENV!=="production"&&UE();function Ze(n){this.content=n}Ze.prototype={constructor:Ze,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,i=r.find(n),o=r.content.slice();return i==-1?o.push(t||n,e):(o[i+1]=e,t&&(o[i]=t)),new Ze(o)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Ze(t)},addToStart:function(n,e){return new Ze([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Ze(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),o=r.find(n);return i.splice(o==-1?i.length:o,0,e,t),new Ze(i)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Ze.from(n),n.size?new Ze(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Ze.from(n),n.size?new Ze(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Ze.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},Ze.from=function(n){if(n instanceof Ze)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Ze(e)};function Lm(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),o=e.child(r);if(i==o){t+=i.nodeSize;continue}if(!i.sameMarkup(o))return t;if(i.isText&&i.text!=o.text){for(let a=0;i.text[a]==o.text[a];a++)t++;return t}if(i.content.size||o.content.size){let a=Lm(i.content,o.content,t+1);if(a!=null)return a}t+=i.nodeSize}}function Pm(n,e,t,r){for(let i=n.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:t,b:r};let a=n.child(--i),c=e.child(--o),f=a.nodeSize;if(a==c){t-=f,r-=f;continue}if(!a.sameMarkup(c))return{a:t,b:r};if(a.isText&&a.text!=c.text){let h=0,m=Math.min(a.text.length,c.text.length);for(;h<m&&a.text[a.text.length-h-1]==c.text[c.text.length-h-1];)h++,t--,r--;return{a:t,b:r}}if(a.content.size||c.content.size){let h=Pm(a.content,c.content,t-1,r-1);if(h)return h}t-=f,r-=f}}class L{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,i=0,o){for(let a=0,c=0;c<t;a++){let f=this.content[a],h=c+f.nodeSize;if(h>e&&r(f,i+c,o||null,a)!==!1&&f.content.size){let m=c+1;f.nodesBetween(Math.max(0,e-m),Math.min(f.content.size,t-m),r,i+m)}c=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let o="",a=!0;return this.nodesBetween(e,t,(c,f)=>{let h=c.isText?c.text.slice(Math.max(e,f)-f,t-f):c.isLeaf?i?typeof i=="function"?i(c):i:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&h||c.isTextblock)&&r&&(a?a=!1:o+=r),o+=h},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new L(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let o=0,a=0;a<t;o++){let c=this.content[o],f=a+c.nodeSize;f>e&&((a<e||f>t)&&(c.isText?c=c.cut(Math.max(0,e-a),Math.min(c.text.length,t-a)):c=c.cut(Math.max(0,e-a-1),Math.min(c.content.size,t-a-1))),r.push(c),i+=c.nodeSize),a=f}return new L(r,i)}cutByIndex(e,t){return e==t?L.empty:e==0&&t==this.content.length?this:new L(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new L(i,o)}addToStart(e){return new L([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new L(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))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 t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return Lm(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Pm(this,e,t,r)}findIndex(e,t=-1){if(e==0)return sl(0,e);if(e==this.size)return sl(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),a=i+o.nodeSize;if(a>=e)return a==e||t>0?sl(r+1,a):sl(r,i);i=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return L.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new L(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return L.empty;let t,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(t||(t=e.slice(0,i)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new L(t||e,r)}static from(e){if(!e)return L.empty;if(e instanceof L)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new L([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}L.empty=new L([],0);const Eu={index:0,offset:0};function sl(n,e){return Eu.index=n,Eu.offset=e,Eu}function ol(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!ol(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!ol(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let _e=class fh{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(o)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ol(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=r.create(t.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return fh.none;if(e instanceof fh)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};_e.none=[];class ll extends Error{}class W{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=zm(this.content,e+this.openStart,t);return r&&new W(r,this.openStart,this.openEnd)}removeBetween(e,t){return new W(Dm(this.content,e+this.openStart,t+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,t){if(!t)return W.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new W(L.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)i++;return new W(e,r,i)}}W.empty=new W(L.empty,0,0);function Dm(n,e,t){let{index:r,offset:i}=n.findIndex(e),o=n.maybeChild(r),{index:a,offset:c}=n.findIndex(t);if(i==e||o.isText){if(c!=t&&!n.child(a).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=a)throw new RangeError("Removing non-flat range");return n.replaceChild(r,o.copy(Dm(o.content,e-i-1,t-i-1)))}function zm(n,e,t,r){let{index:i,offset:o}=n.findIndex(e),a=n.maybeChild(i);if(o==e||a.isText)return n.cut(0,e).append(t).append(n.cut(e));let c=zm(a.content,e-o-1,t);return c&&n.replaceChild(i,a.copy(c))}function VE(n,e,t){if(t.openStart>n.depth)throw new ll("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new ll("Inconsistent open depths");return Bm(n,e,t,0)}function Bm(n,e,t,r){let i=n.index(r),o=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let a=Bm(n,e,t,r+1);return o.copy(o.content.replaceChild(i,a))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let a=n.parent,c=a.content;return Br(a,c.cut(0,n.parentOffset).append(t.content).append(c.cut(e.parentOffset)))}else{let{start:a,end:c}=KE(t,n);return Br(o,Hm(n,a,c,e,r))}else return Br(o,al(n,e,r))}function Fm(n,e){if(!e.type.compatibleContent(n.type))throw new ll("Cannot join "+e.type.name+" onto "+n.type.name)}function _u(n,e,t){let r=n.node(t);return Fm(r,e.node(t)),r}function zr(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function ys(n,e,t,r){let i=(e||n).node(t),o=0,a=e?e.index(t):i.childCount;n&&(o=n.index(t),n.depth>t?o++:n.textOffset&&(zr(n.nodeAfter,r),o++));for(let c=o;c<a;c++)zr(i.child(c),r);e&&e.depth==t&&e.textOffset&&zr(e.nodeBefore,r)}function Br(n,e){return n.type.checkContent(e),n.copy(e)}function Hm(n,e,t,r,i){let o=n.depth>i&&_u(n,e,i+1),a=r.depth>i&&_u(t,r,i+1),c=[];return ys(null,n,i,c),o&&a&&e.index(i)==t.index(i)?(Fm(o,a),zr(Br(o,Hm(n,e,t,r,i+1)),c)):(o&&zr(Br(o,al(n,e,i+1)),c),ys(e,t,i,c),a&&zr(Br(a,al(t,r,i+1)),c)),ys(r,null,i,c),new L(c)}function al(n,e,t){let r=[];if(ys(null,n,t,r),n.depth>t){let i=_u(n,e,t+1);zr(Br(i,al(n,e,t+1)),r)}return ys(e,null,t,r),new L(r)}function KE(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)i=e.node(o).copy(L.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class Us{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.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,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return _e.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let c=r;r=i,i=c}let o=r.marks;for(var a=0;a<o.length;a++)o[a].type.spec.inclusive===!1&&(!i||!o[a].isInSet(i.marks))&&(o=o[a--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){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)&&(!t||t(this.node(r))))return new cl(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 t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,o=t;for(let a=e;;){let{index:c,offset:f}=a.content.findIndex(o),h=o-f;if(r.push(a,c,i+f),!h||(a=a.child(c),a.isText))break;o=h-1,i+=f+1}return new Us(t,r,o)}static resolveCached(e,t){let r=$m.get(e);if(r)for(let o=0;o<r.elts.length;o++){let a=r.elts[o];if(a.pos==t)return a}else $m.set(e,r=new GE);let i=r.elts[r.i]=Us.resolve(e,t);return r.i=(r.i+1)%JE,i}}class GE{constructor(){this.elts=[],this.i=0}}const JE=12,$m=new WeakMap;class cl{constructor(e,t,r){this.$from=e,this.$to=t,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 qE=Object.create(null);let ur=class hh{constructor(e,t,r,i=_e.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||L.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,t,r,i=0){this.content.nodesBetween(e,t,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,t,r,i){return this.content.textBetween(e,t,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,t,r){return this.type==e&&ol(this.attrs,t||e.defaultAttrs||qE)&&_e.sameSet(this.marks,r||_e.none)}copy(e=null){return e==this.content?this:new hh(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new hh(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return W.empty;let i=this.resolve(e),o=this.resolve(t),a=r?0:i.sharedDepth(t),c=i.start(a),h=i.node(a).content.cut(i.pos-c,o.pos-c);return new W(h,i.depth-a,o.depth-a)}replace(e,t,r){return VE(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return Us.resolveCached(this,e)}resolveNoCache(e){return Us.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,o=>(r.isInSet(o.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()+")"),Wm(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=L.empty,i=0,o=r.childCount){let a=this.contentMatchAt(e).matchFragment(r,i,o),c=a&&a.matchFragment(this.content,t);if(!c||!c.validEnd)return!1;for(let f=i;f<o;f++)if(!this.type.allowsMarks(r.child(f).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),a=o&&o.matchFragment(this.content,t);return a?a.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 t=0;t<this.marks.length;t++){let r=this.marks[t];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(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t 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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=L.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};ur.prototype.text=void 0;class Ta extends ur{constructor(e,t,r,i){if(super(e,t,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):Wm(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Ta(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ta(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Wm(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Yr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new jE(e,t);if(r.next==null)return Yr.empty;let i=Um(r);r.next&&r.err("Unexpected trailing text");let o=n_(t_(i));return r_(o,r),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let i=this;for(let o=t;i&&o<r;o++)i=i.matchType(e.child(o).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:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let i=[this];function o(a,c){let f=a.matchFragment(e,r);if(f&&(!t||f.validEnd))return L.from(c.map(h=>h.createAndFill()));for(let h=0;h<a.next.length;h++){let{type:m,next:p}=a.next[h];if(!(m.isText||m.hasRequiredAttrs())&&i.indexOf(p)==-1){i.push(p);let g=o(p,c.concat(m));if(g)return g}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let a=[];for(let c=i;c.type;c=c.via)a.push(c.type);return a.reverse()}for(let a=0;a<o.next.length;a++){let{type:c,next:f}=o.next[a];!c.isLeaf&&!c.hasRequiredAttrs()&&!(c.name in t)&&(!i.type||f.validEnd)&&(r.push({match:c.contentMatch,type:c,via:i}),t[c.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 t(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let a=0;a<r.next.length;a++)o+=(a?", ":"")+r.next[a].type.name+"->"+e.indexOf(r.next[a].next);return o}).join(`
6
+ `)}}Yr.empty=new Yr(!0);class jE{constructor(e,t){this.string=e,this.nodeTypes=t,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 Um(n){let e=[];do e.push(YE(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function YE(n){let e=[];do e.push(XE(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function XE(n){let e=e_(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=ZE(n,e);else break;return e}function Vm(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function ZE(n,e){let t=Vm(n),r=t;return n.eat(",")&&(n.next!="}"?r=Vm(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function QE(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let o in t){let a=t[o];a.isInGroup(e)&&i.push(a)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function e_(n){if(n.eat("(")){let e=Um(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=QE(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function t_(n){let e=[[]];return i(o(n,0),t()),e;function t(){return e.push([])-1}function r(a,c,f){let h={term:f,to:c};return e[a].push(h),h}function i(a,c){a.forEach(f=>f.to=c)}function o(a,c){if(a.type=="choice")return a.exprs.reduce((f,h)=>f.concat(o(h,c)),[]);if(a.type=="seq")for(let f=0;;f++){let h=o(a.exprs[f],c);if(f==a.exprs.length-1)return h;i(h,c=t())}else if(a.type=="star"){let f=t();return r(c,f),i(o(a.expr,f),f),[r(f)]}else if(a.type=="plus"){let f=t();return i(o(a.expr,c),f),i(o(a.expr,f),f),[r(f)]}else{if(a.type=="opt")return[r(c)].concat(o(a.expr,c));if(a.type=="range"){let f=c;for(let h=0;h<a.min;h++){let m=t();i(o(a.expr,f),m),f=m}if(a.max==-1)i(o(a.expr,f),f);else for(let h=a.min;h<a.max;h++){let m=t();r(f,m),i(o(a.expr,f),m),f=m}return[r(f)]}else{if(a.type=="name")return[r(c,void 0,a.value)];throw new Error("Unknown expr type")}}}}function Km(n,e){return e-n}function Gm(n,e){let t=[];return r(e),t.sort(Km);function r(i){let o=n[i];if(o.length==1&&!o[0].term)return r(o[0].to);t.push(i);for(let a=0;a<o.length;a++){let{term:c,to:f}=o[a];!c&&t.indexOf(f)==-1&&r(f)}}}function n_(n){let e=Object.create(null);return t(Gm(n,0));function t(r){let i=[];r.forEach(a=>{n[a].forEach(({term:c,to:f})=>{if(!c)return;let h;for(let m=0;m<i.length;m++)i[m][0]==c&&(h=i[m][1]);Gm(n,f).forEach(m=>{h||i.push([c,h=[]]),h.indexOf(m)==-1&&h.push(m)})})});let o=e[r.join(",")]=new Yr(r.indexOf(n.length-1)>-1);for(let a=0;a<i.length;a++){let c=i[a][1].sort(Km);o.next.push({type:i[a][0],next:e[c.join(",")]||t(c)})}return o}}function r_(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],o=!i.validEnd,a=[];for(let c=0;c<i.next.length;c++){let{type:f,next:h}=i.next[c];a.push(f.name),o&&!(f.isText||f.hasRequiredAttrs())&&(o=!1),r.indexOf(h)==-1&&r.push(h)}o&&e.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Jm(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function qm(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let o=n[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function jm(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in n){let o=n[i];o.validate&&o.validate(e[i])}}function Ym(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new s_(n,r,e[r]);return t}let Xm=class Cy{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Ym(e,r.attrs),this.defaultAttrs=Jm(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==Yr.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:qm(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ur(this,this.computeAttrs(e),L.from(t),_e.setFrom(r))}createChecked(e=null,t,r){return t=L.from(t),this.checkContent(t),new ur(this,this.computeAttrs(e),t,_e.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=L.from(t),t.size){let a=this.contentMatch.fillBefore(t);if(!a)return null;t=a.append(t)}let i=this.contentMatch.matchFragment(t),o=i&&i.fillBefore(L.empty,!0);return o?new ur(this,e,t.append(o),_e.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.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){jm(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 t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:_e.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,a)=>r[o]=new Cy(o,t,a));let i=t.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 o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function i_(n,e,t){let r=t.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${o}`)}}class s_{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?i_(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Ca{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Ym(e,i.attrs),this.excluded=null;let o=Jm(this.attrs);this.instance=o?new _e(this,o):null}create(e=null){return!e&&this.instance?this.instance:new _e(this,qm(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((o,a)=>r[o]=new Ca(o,i++,t,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){jm(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Zm{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Ze.from(e.nodes),t.marks=Ze.from(e.marks||{}),this.nodes=Xm.compile(this.spec.nodes,this),this.marks=Ca.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 o=this.nodes[i],a=o.spec.content||"",c=o.spec.marks;if(o.contentMatch=r[a]||(r[a]=Yr.parse(a,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=c=="_"?null:c?Qm(this,c.split(" ")):c==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],a=o.spec.excludes;o.excluded=a==null?[o]:a==""?[]:Qm(this,a.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Xm){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(t,r,i)}text(e,t){let r=this.nodes.text;return new Ta(r,r.defaultAttrs,e,_e.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return ur.fromJSON(this,e)}markFromJSON(e){return _e.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Qm(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],o=n.marks[i],a=o;if(o)t.push(o);else for(let c in n.marks){let f=n.marks[c];(i=="_"||f.spec.group&&f.spec.group.split(" ").indexOf(i)>-1)&&t.push(a=f)}if(!a)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function o_(n){return n.tag!=null}function l_(n){return n.style!=null}let bs=class dh{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(o_(i))this.tags.push(i);else if(l_(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,t={}){let r=new rg(this,t,!1);return r.addAll(e,_e.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new rg(this,t,!0);return r.addAll(e,_e.none,t.from,t.to),W.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(u_(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){let a=o.getAttrs(e);if(a===!1)continue;o.attrs=a||void 0}return o}}}matchStyle(e,t,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let a=this.styles[o],c=a.style;if(!(c.indexOf(e)!=0||a.context&&!r.matchesContext(a.context)||c.length>e.length&&(c.charCodeAt(e.length)!=61||c.slice(e.length+1)!=t))){if(a.getAttrs){let f=a.getAttrs(t);if(f===!1)continue;a.attrs=f||void 0}return a}}}static schemaRules(e){let t=[];function r(i){let o=i.priority==null?50:i.priority,a=0;for(;a<t.length;a++){let c=t[a];if((c.priority==null?50:c.priority)<o)break}t.splice(a,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(a=>{r(a=ig(a)),a.mark||a.ignore||a.clearMark||(a.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(a=>{r(a=ig(a)),a.node||a.ignore||a.mark||(a.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new dh(e,dh.schemaRules(e)))}};const eg={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},a_={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},tg={ol:!0,ul:!0},vs=1,Tu=2,ul=4;function ng(n,e,t){return e!=null?(e?vs:0)|(e==="full"?Tu:0):n&&n.whitespace=="pre"?vs|Tu:t&-5}class fl{constructor(e,t,r,i,o,a){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=a,this.content=[],this.activeMarks=_e.none,this.match=o||(a&ul?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(L.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);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&vs)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let t=L.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(L.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!eg.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class rg{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,o,a=ng(null,t.preserveWhitespace,0)|(r?ul:0);i?o=new fl(i.type,i.attrs,_e.none,!0,t.topMatch||i.type.contentMatch,a):r?o=new fl(null,null,_e.none,!0,null,a):o=new fl(e.schema.topNodeType,null,_e.none,!0,null,a),this.nodes=[o],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,i=this.top,o=i.options&Tu?"full":this.localPreserveWS||(i.options&vs)>0;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)o!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
7
+ `);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],c=e.previousSibling;(!a||c&&c.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),t),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),c;tg.hasOwnProperty(a)&&this.parser.normalizeLists&&c_(e);let f=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(c=this.parser.matchTag(e,this,r));e:if(f?f.ignore:a_.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!f||f.skip||f.closeParent){f&&f.closeParent?this.open=Math.max(0,this.open-1):f&&f.skip.nodeType&&(e=f.skip);let h,m=this.needsBlock;if(eg.hasOwnProperty(a))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),h=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let p=f&&f.skip?t:this.readStyles(e,t);p&&this.addAll(e,p),h&&this.sync(o),this.needsBlock=m}else{let h=this.readStyles(e,t);h&&this.addElementByRule(e,f,h,f.consuming===!1?c:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
8
+ `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],a=r.getPropertyValue(o);if(a)for(let c=void 0;;){let f=this.parser.matchStyle(o,a,this,c);if(!f)break;if(f.ignore)return null;if(f.clearMark?t=t.filter(h=>!f.clearMark(h)):t=t.concat(this.parser.schema.marks[f.mark].create(f.attrs)),f.consuming===!1)c=f;else break}}return t}addElementByRule(e,t,r,i){let o,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),r)||this.leafFallback(e,r);else{let f=this.enter(a,t.attrs||null,r,t.preserveWhitespace);f&&(o=!0,r=f)}else{let f=this.parser.schema.marks[t.mark];r=r.concat(f.create(t.attrs))}let c=this.top;if(a&&a.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(f=>this.insertNode(f,r));else{let f=e;typeof t.contentElement=="string"?f=e.querySelector(t.contentElement):typeof t.contentElement=="function"?f=t.contentElement(e):t.contentElement&&(f=t.contentElement),this.findAround(e,f,!0),this.addAll(f,r),this.findAround(e,f,!1)}o&&this.sync(c)&&this.open--}addAll(e,t,r,i){let o=r||0;for(let a=r?e.childNodes[r]:e.firstChild,c=i==null?null:e.childNodes[i];a!=c;a=a.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(a,t);this.findAtPoint(e,o)}findPlace(e,t){let r,i;for(let o=this.open;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!r||r.length>c.length)&&(r=c,i=a,!c.length)||a.solid)break}if(!r)return null;this.sync(i);for(let o=0;o<r.length;o++)t=this.enterInner(r[o],null,t,!1);return t}insertNode(e,t){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let r=this.findPlace(e,t);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=_e.none;for(let a of r.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):sg(a.type,e.type))&&(o=a.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,t,r,i){let o=this.findPlace(e.create(t),r);return o&&(o=this.enterInner(e,t,r,!0,i)),o}enterInner(e,t,r,i=!1,o){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let c=ng(e,o,a.options);a.options&ul&&a.content.length==0&&(c|=ul);let f=_e.none;return r=r.filter(h=>(a.type?a.type.allowsMarkType(h.type):sg(h.type,e))?(f=h.addToSet(f),!1):!0),this.nodes.push(new fl(e,t,f,i,null,c)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].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 t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=vs)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&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)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),a=(c,f)=>{for(;c>=0;c--){let h=t[c];if(h==""){if(c==t.length-1||c==0)continue;for(;f>=o;f--)if(a(c-1,f))return!0;return!1}else{let m=f>0||f==0&&i?this.nodes[f].type:r&&f>=o?r.node(f-o).type:null;if(!m||m.name!=h&&!m.isInGroup(h))return!1;f--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function c_(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&tg.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function u_(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function ig(n){let e={};for(let t in n)e[t]=n[t];return e}function sg(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let o=[],a=c=>{o.push(c);for(let f=0;f<c.edgeCount;f++){let{type:h,next:m}=c.edge(f);if(h==e||o.indexOf(m)<0&&a(m))return!0}};if(a(i.contentMatch))return!0}}class Ws{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Cu(t).createDocumentFragment());let i=r,o=[];return e.forEach(a=>{if(o.length||a.marks.length){let c=0,f=0;for(;c<o.length&&f<a.marks.length;){let h=a.marks[f];if(!this.marks[h.type.name]){f++;continue}if(!h.eq(o[c][0])||h.type.spec.spanning===!1)break;c++,f++}for(;c<o.length;)i=o.pop()[1];for(;f<a.marks.length;){let h=a.marks[f++],m=this.serializeMark(h,a.isInline,t);m&&(o.push([h,i]),i.appendChild(m.dom),i=m.contentDOM||m.dom)}}i.appendChild(this.serializeNodeInner(a,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=hl(Cu(t),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,t,i)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&hl(Cu(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return hl(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ws(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=og(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return og(e.marks)}}function og(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Cu(n){return n.document||window.document}const lg=new WeakMap;function f_(n){let e=lg.get(n);return e===void 0&&lg.set(n,e=h_(n)),e}function h_(n){let e=null;function t(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++)t(r[i]);else for(let i in r)t(r[i])}return t(n),e}function hl(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=f_(r))&&o.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 a=i.indexOf(" ");a>0&&(t=i.slice(0,a),i=i.slice(a+1));let c,f=t?n.createElementNS(t,i):n.createElement(i),h=e[1],m=1;if(h&&typeof h=="object"&&h.nodeType==null&&!Array.isArray(h)){m=2;for(let p in h)if(h[p]!=null){let g=p.indexOf(" ");g>0?f.setAttributeNS(p.slice(0,g),p.slice(g+1),h[p]):f.setAttribute(p,h[p])}}for(let p=m;p<e.length;p++){let g=e[p];if(g===0){if(p<e.length-1||p>m)throw new RangeError("Content hole must be the only child of its parent node");return{dom:f,contentDOM:f}}else{let{dom:b,contentDOM:S}=hl(n,g,t,r);if(f.appendChild(b),S){if(c)throw new RangeError("Multiple content holes");c=S}}}return{dom:f,contentDOM:c}}const ag=65535,cg=Math.pow(2,16);function d_(n,e){return n+e*cg}function ug(n){return n&ag}function p_(n){return(n-(n&ag))/cg}const fg=1,hg=2,dl=4,dg=8;class Mu{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&dg)>0}get deletedBefore(){return(this.delInfo&(fg|dl))>0}get deletedAfter(){return(this.delInfo&(hg|dl))>0}get deletedAcross(){return(this.delInfo&dl)>0}}class Ot{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Ot.empty)return Ot.empty}recover(e){let t=0,r=ug(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+p_(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let i=0,o=this.inverted?2:1,a=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let f=this.ranges[c]-(this.inverted?i:0);if(f>e)break;let h=this.ranges[c+o],m=this.ranges[c+a],p=f+h;if(e<=p){let g=h?e==f?-1:e==p?1:t:t,b=f+i+(g<0?0:m);if(r)return b;let S=e==(t<0?f:p)?null:d_(c/3,e-f),k=e==f?hg:e==p?fg:dl;return(t<0?e!=f:e!=p)&&(k|=dg),new Mu(b,k,S)}i+=m-h}return r?e+i:new Mu(e+i,0,null)}touches(e,t){let r=0,i=ug(t),o=this.inverted?2:1,a=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let f=this.ranges[c]-(this.inverted?r:0);if(f>e)break;let h=this.ranges[c+o],m=f+h;if(e<=m&&c==i*3)return!0;r+=this.ranges[c+a]-h}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let a=this.ranges[i],c=a-(this.inverted?o:0),f=a+(this.inverted?0:o),h=this.ranges[i+t],m=this.ranges[i+r];e(c,c+h,f,f+m),o+=m-h}}invert(){return new Ot(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ot.empty:new Ot(e<0?[0,-e,0]:[0,0,e])}}Ot.empty=new Ot([]);class Di{constructor(e=[],t,r=0,i=e.length){this.maps=e,this.mirror=t,this.from=r,this.to=i}slice(e=0,t=this.maps.length){return new Di(this.maps,this.mirror,e,t)}copy(){return new Di(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),t!=null&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,r=this.maps.length;t<e.maps.length;t++){let i=e.getMirror(t);this.appendMap(e.maps[t],i!=null&&i<t?r+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this.maps.length+e.maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e.maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new Di;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let i=0;for(let o=this.from;o<this.to;o++){let a=this.maps[o],c=a.mapResult(e,t);if(c.recover!=null){let f=this.getMirror(o);if(f!=null&&f>o&&f<this.to){o=f,e=this.maps[f].recover(c.recover);continue}}i|=c.delInfo,e=c.pos}return r?e:new Mu(e,i,null)}}const Au=Object.create(null);class We{getMap(){return Ot.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Au[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Au)throw new RangeError("Duplicate use of step JSON ID "+e);return Au[e]=t,t.prototype.jsonID=e,t}}class Le{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Le(e,null)}static fail(e){return new Le(null,e)}static fromReplace(e,t,r,i){try{return Le.ok(e.replace(t,r,i))}catch(o){if(o instanceof ll)return Le.fail(o.message);throw o}}}function Iu(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(Iu(o.content,e,o))),o.isInline&&(o=e(o,t,i)),r.push(o)}return L.fromArray(r)}class kr extends We{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new W(Iu(t.content,(a,c)=>!a.isAtom||!c.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),i),t.openStart,t.openEnd);return Le.fromReplace(e,this.from,this.to,o)}invert(){return new bn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new kr(t.pos,r.pos,this.mark)}merge(e){return e instanceof kr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new kr(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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new kr(t.from,t.to,e.markFromJSON(t.mark))}}We.jsonID("addMark",kr);class bn extends We{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new W(Iu(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return Le.fromReplace(e,this.from,this.to,r)}invert(){return new kr(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new bn(t.pos,r.pos,this.mark)}merge(e){return e instanceof bn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new bn(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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new bn(t.from,t.to,e.markFromJSON(t.mark))}}We.jsonID("removeMark",bn);class Er extends We{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Le.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Le.fromReplace(e,this.pos,this.pos+1,new W(L.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new Er(this.pos,t.marks[i]);return new Er(this.pos,this.mark)}}return new zi(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Er(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Er(t.pos,e.markFromJSON(t.mark))}}We.jsonID("addNodeMark",Er);class zi extends We{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Le.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Le.fromReplace(e,this.pos,this.pos+1,new W(L.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Er(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new zi(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new zi(t.pos,e.markFromJSON(t.mark))}}We.jsonID("removeNodeMark",zi);class Je extends We{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&Ou(e,this.from,this.to)?Le.fail("Structure replace would overwrite content"):Le.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ot([this.from,this.to-this.from,this.slice.size])}invert(e){return new Je(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new Je(t.pos,Math.max(t.pos,r.pos),this.slice)}merge(e){if(!(e instanceof Je)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?W.empty:new W(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Je(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?W.empty:new W(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Je(e.from,this.to,t,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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Je(t.from,t.to,W.fromJSON(e,t.slice),!!t.structure)}}We.jsonID("replace",Je);class Ge extends We{constructor(e,t,r,i,o,a,c=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=a,this.structure=c}apply(e){if(this.structure&&(Ou(e,this.from,this.gapFrom)||Ou(e,this.gapTo,this.to)))return Le.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Le.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?Le.fromReplace(e,this.from,this.to,r):Le.fail("Content does not fit in gap")}getMap(){return new Ot([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Ge(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||o>r.pos?null:new Ge(t.pos,r.pos,i,o,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,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ge(t.from,t.to,t.gapFrom,t.gapTo,W.fromJSON(e,t.slice),t.insert,!!t.structure)}}We.jsonID("replaceAround",Ge);function Ou(n,e,t){let r=n.resolve(e),i=t-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let a=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}}return!1}function m_(n,e,t,r){let i=[],o=[],a,c;n.doc.nodesBetween(e,t,(f,h,m)=>{if(!f.isInline)return;let p=f.marks;if(!r.isInSet(p)&&m.type.allowsMarkType(r.type)){let g=Math.max(h,e),b=Math.min(h+f.nodeSize,t),S=r.addToSet(p);for(let k=0;k<p.length;k++)p[k].isInSet(S)||(a&&a.to==g&&a.mark.eq(p[k])?a.to=b:i.push(a=new bn(g,b,p[k])));c&&c.to==g?c.to=b:o.push(c=new kr(g,b,r))}}),i.forEach(f=>n.step(f)),o.forEach(f=>n.step(f))}function g_(n,e,t,r){let i=[],o=0;n.doc.nodesBetween(e,t,(a,c)=>{if(!a.isInline)return;o++;let f=null;if(r instanceof Ca){let h=a.marks,m;for(;m=r.isInSet(h);)(f||(f=[])).push(m),h=m.removeFromSet(h)}else r?r.isInSet(a.marks)&&(f=[r]):f=a.marks;if(f&&f.length){let h=Math.min(c+a.nodeSize,t);for(let m=0;m<f.length;m++){let p=f[m],g;for(let b=0;b<i.length;b++){let S=i[b];S.step==o-1&&p.eq(i[b].style)&&(g=S)}g?(g.to=h,g.step=o):i.push({style:p,from:Math.max(c,e),to:h,step:o})}}}),i.forEach(a=>n.step(new bn(a.from,a.to,a.style)))}function Nu(n,e,t,r=t.contentMatch,i=!0){let o=n.doc.nodeAt(e),a=[],c=e+1;for(let f=0;f<o.childCount;f++){let h=o.child(f),m=c+h.nodeSize,p=r.matchType(h.type);if(!p)a.push(new Je(c,m,W.empty));else{r=p;for(let g=0;g<h.marks.length;g++)t.allowsMarkType(h.marks[g].type)||n.step(new bn(c,m,h.marks[g]));if(i&&h.isText&&t.whitespace!="pre"){let g,b=/\r?\n|\r/g,S;for(;g=b.exec(h.text);)S||(S=new W(L.from(t.schema.text(" ",t.allowedMarks(h.marks))),0,0)),a.push(new Je(c+g.index,c+g.index+g[0].length,S))}}c=m}if(!r.validEnd){let f=r.fillBefore(L.empty,!0);n.replace(c,c,new W(f,0,0))}for(let f=a.length-1;f>=0;f--)n.step(a[f])}function y_(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function xi(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),o=n.$from.index(r),a=n.$to.indexAfter(r);if(r<n.depth&&i.canReplace(o,a,t))return r;if(r==0||i.type.spec.isolating||!y_(i,o,a))break}return null}function b_(n,e,t){let{$from:r,$to:i,depth:o}=e,a=r.before(o+1),c=i.after(o+1),f=a,h=c,m=L.empty,p=0;for(let S=o,k=!1;S>t;S--)k||r.index(S)>0?(k=!0,m=L.from(r.node(S).copy(m)),p++):f--;let g=L.empty,b=0;for(let S=o,k=!1;S>t;S--)k||i.after(S+1)<i.end(S)?(k=!0,g=L.from(i.node(S).copy(g)),b++):h++;n.step(new Ge(f,h,a,c,new W(m.append(g),p,b),m.size-p,!0))}function Ru(n,e,t=null,r=n){let i=v_(n,e),o=i&&w_(r,e);return o?i.map(pg).concat({type:e,attrs:t}).concat(o.map(pg)):null}function pg(n){return{type:n,attrs:null}}function v_(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.contentMatchAt(r).findWrapping(e);if(!o)return null;let a=o.length?o[0]:e;return t.canReplaceWith(r,i,a)?o:null}function w_(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.child(r),a=e.contentMatch.findWrapping(o.type);if(!a)return null;let f=(a.length?a[a.length-1]:e).contentMatch;for(let h=r;f&&h<i;h++)f=f.matchType(t.child(h).type);return!f||!f.validEnd?null:a}function S_(n,e,t){let r=L.empty;for(let a=t.length-1;a>=0;a--){if(r.size){let c=t[a].type.contentMatch.matchFragment(r);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=L.from(t[a].type.create(t[a].attrs,r))}let i=e.start,o=e.end;n.step(new Ge(i,o,i,o,new W(r,0,0),t.length,!0))}function x_(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=n.steps.length;n.doc.nodesBetween(e,t,(a,c)=>{let f=typeof i=="function"?i(a):i;if(a.isTextblock&&!a.hasMarkup(r,f)&&k_(n.doc,n.mapping.slice(o).map(c),r)){let h=null;if(r.schema.linebreakReplacement){let b=r.whitespace=="pre",S=!!r.contentMatch.matchType(r.schema.linebreakReplacement);b&&!S?h=!1:!b&&S&&(h=!0)}h===!1&&gg(n,a,c,o),Nu(n,n.mapping.slice(o).map(c,1),r,void 0,h===null);let m=n.mapping.slice(o),p=m.map(c,1),g=m.map(c+a.nodeSize,1);return n.step(new Ge(p,g,p+1,g-1,new W(L.from(r.create(f,null,a.marks)),0,0),1,!0)),h===!0&&mg(n,a,c,o),!1}})}function mg(n,e,t,r){e.forEach((i,o)=>{if(i.isText){let a,c=/\r?\n|\r/g;for(;a=c.exec(i.text);){let f=n.mapping.slice(r).map(t+1+o+a.index);n.replaceWith(f,f+1,e.type.schema.linebreakReplacement.create())}}})}function gg(n,e,t,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let a=n.mapping.slice(r).map(t+1+o);n.replaceWith(a,a+1,e.type.schema.text(`
9
+ `))}})}function k_(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function E_(n,e,t,r,i){let o=n.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");t||(t=o.type);let a=t.create(r,null,i||o.marks);if(o.isLeaf)return n.replaceWith(e,e+o.nodeSize,a);if(!t.validContent(o.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Ge(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new W(L.from(a),0,0),1,!0))}function Dn(n,e,t=1,r){let i=n.resolve(e),o=i.depth-t,a=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!a.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let h=i.depth-1,m=t-2;h>o;h--,m--){let p=i.node(h),g=i.index(h);if(p.type.spec.isolating)return!1;let b=p.content.cutByIndex(g,p.childCount),S=r&&r[m+1];S&&(b=b.replaceChild(0,S.type.create(S.attrs)));let k=r&&r[m]||p;if(!p.canReplace(g+1,p.childCount)||!k.type.validContent(b))return!1}let c=i.indexAfter(o),f=r&&r[0];return i.node(o).canReplaceWith(c,c,f?f.type:i.node(o+1).type)}function __(n,e,t=1,r){let i=n.doc.resolve(e),o=L.empty,a=L.empty;for(let c=i.depth,f=i.depth-t,h=t-1;c>f;c--,h--){o=L.from(i.node(c).copy(o));let m=r&&r[h];a=L.from(m?m.type.create(m.attrs,a):i.node(c).copy(a))}n.step(new Je(e,e,new W(o.append(a),t,t),!0))}function fr(n,e){let t=n.resolve(e),r=t.index();return yg(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function T_(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<e.childCount;i++){let o=e.child(i),a=o.type==r?n.type.schema.nodes.text:o.type;if(t=t.matchType(a),!t||!n.type.allowsMarks(o.marks))return!1}return t.validEnd}function yg(n,e){return!!(n&&e&&!n.isLeaf&&T_(n,e))}function pl(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let o,a,c=r.index(i);if(i==r.depth?(o=r.nodeBefore,a=r.nodeAfter):t>0?(o=r.node(i+1),c++,a=r.node(i).maybeChild(c)):(o=r.node(i).maybeChild(c-1),a=r.node(i+1)),o&&!o.isTextblock&&yg(o,a)&&r.node(i).canReplace(c,c+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function C_(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,o=n.doc.resolve(e-t),a=o.node().type;if(i&&a.inlineContent){let m=a.whitespace=="pre",p=!!a.contentMatch.matchType(i);m&&!p?r=!1:!m&&p&&(r=!0)}let c=n.steps.length;if(r===!1){let m=n.doc.resolve(e+t);gg(n,m.node(),m.before(),c)}a.inlineContent&&Nu(n,e+t-1,a,o.node().contentMatchAt(o.index()),r==null);let f=n.mapping.slice(c),h=f.map(e-t);if(n.step(new Je(h,f.map(e+t,-1),W.empty,!0)),r===!0){let m=n.doc.resolve(h);mg(n,m.node(),m.before(),n.steps.length)}return n}function M_(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,t))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,t))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function A_(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let o=0;o<t.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(t.openStart==0&&t.size?2:1);o++)for(let a=r.depth;a>=0;a--){let c=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,f=r.index(a)+(c>0?1:0),h=r.node(a),m=!1;if(o==1)m=h.canReplace(f,f,i);else{let p=h.contentMatchAt(f).findWrapping(i.firstChild.type);m=p&&h.canReplaceWith(f,f,p[0])}if(m)return c==0?r.pos:c<0?r.before(a+1):r.after(a+1)}return null}function ml(n,e,t=e,r=W.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),o=n.resolve(t);return bg(i,o,r)?new Je(e,t,r):new I_(i,o,r).fit()}function bg(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class I_{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=L.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=L.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let h=this.findFittable();h?this.placeNodes(h):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=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 o=this.placed,a=r.depth,c=i.depth;for(;a&&c&&o.childCount==1;)o=o.firstChild.content,a--,c--;let f=new W(o,a,c);return e>-1?new Ge(r.pos,e,this.$to.pos,this.$to.end(),f,t):f.size||r.pos!=this.$to.pos?new Je(r.pos,i.pos,f):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=t.firstChild;if(t.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}t=o.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=Lu(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let a=i.firstChild;for(let c=this.depth;c>=0;c--){let{type:f,match:h}=this.frontier[c],m,p=null;if(t==1&&(a?h.matchType(a.type)||(p=h.fillBefore(L.from(a),!1)):o&&f.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:c,parent:o,inject:p};if(t==2&&a&&(m=h.findWrapping(a.type)))return{sliceDepth:r,frontierDepth:c,parent:o,wrap:m};if(o&&h.matchType(o.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Lu(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new W(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Lu(e,t);if(i.childCount<=1&&t>0){let o=e.size-t<=t+i.size;this.unplaced=new W(ws(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new W(ws(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let k=0;k<o.length;k++)this.openFrontierNode(o[k]);let a=this.unplaced,c=r?r.content:a.content,f=a.openStart-e,h=0,m=[],{match:p,type:g}=this.frontier[t];if(i){for(let k=0;k<i.childCount;k++)m.push(i.child(k));p=p.matchFragment(i)}let b=c.size+e-(a.content.size-a.openEnd);for(;h<c.childCount;){let k=c.child(h),C=p.matchType(k.type);if(!C)break;h++,(h>1||f==0||k.content.size)&&(p=C,m.push(vg(k.mark(g.allowedMarks(k.marks)),h==1?f:0,h==c.childCount?b:-1)))}let S=h==c.childCount;S||(b=-1),this.placed=Ss(this.placed,t,L.from(m)),this.frontier[t].match=p,S&&b<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let k=0,C=c;k<b;k++){let M=C.lastChild;this.frontier.push({type:M.type,match:M.contentMatchAt(M.childCount)}),C=M.content}this.unplaced=S?e==0?W.empty:new W(ws(a.content,e-1,1),e-1,b<0?a.openEnd:e-1):new W(ws(a.content,e,h),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Pu(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.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 t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=Pu(e,t,i,r,o);if(a){for(let c=t-1;c>=0;c--){let{match:f,type:h}=this.frontier[c],m=Pu(e,c,h,f,!0);if(!m||m.childCount)continue e}return{depth:t,fit:a,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Ss(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Ss(this.placed,this.depth,L.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(L.empty,!0);t.childCount&&(this.placed=Ss(this.placed,this.frontier.length,t))}}function ws(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(ws(n.firstChild.content,e-1,t)))}function Ss(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Ss(n.lastChild.content,e-1,t)))}function Lu(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function vg(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,vg(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(L.empty,!0)))),n.copy(r)}function Pu(n,e,t,r,i){let o=n.node(e),a=i?n.indexAfter(e):n.index(e);if(a==o.childCount&&!t.compatibleContent(o.type))return null;let c=r.fillBefore(o.content,!0,a);return c&&!O_(t,o.content,a)?c:null}function O_(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function N_(n){return n.spec.defining||n.spec.definingForContent}function R_(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),o=n.doc.resolve(t);if(bg(i,o,r))return n.step(new Je(e,t,r));let a=Sg(i,n.doc.resolve(t));a[a.length-1]==0&&a.pop();let c=-(i.depth+1);a.unshift(c);for(let g=i.depth,b=i.pos-1;g>0;g--,b--){let S=i.node(g).type.spec;if(S.defining||S.definingAsContext||S.isolating)break;a.indexOf(g)>-1?c=g:i.before(g)==b&&a.splice(1,0,-g)}let f=a.indexOf(c),h=[],m=r.openStart;for(let g=r.content,b=0;;b++){let S=g.firstChild;if(h.push(S),b==r.openStart)break;g=S.content}for(let g=m-1;g>=0;g--){let b=h[g],S=N_(b.type);if(S&&!b.sameMarkup(i.node(Math.abs(c)-1)))m=g;else if(S||!b.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let b=(g+m+1)%(r.openStart+1),S=h[b];if(S)for(let k=0;k<a.length;k++){let C=a[(k+f)%a.length],M=!0;C<0&&(M=!1,C=-C);let P=i.node(C-1),F=i.index(C-1);if(P.canReplaceWith(F,F,S.type,S.marks))return n.replace(i.before(C),M?o.after(C):t,new W(wg(r.content,0,r.openStart,b),b,r.openEnd))}}let p=n.steps.length;for(let g=a.length-1;g>=0&&(n.replace(e,t,r),!(n.steps.length>p));g--){let b=a[g];b<0||(e=i.before(b),t=o.after(b))}}function wg(n,e,t,r,i){if(e<t){let o=n.firstChild;n=n.replaceChild(0,o.copy(wg(o.content,e+1,t,r,o)))}if(e>r){let o=i.contentMatchAt(0),a=o.fillBefore(n).append(n);n=a.append(o.matchFragment(a).fillBefore(L.empty,!0))}return n}function L_(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=M_(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new W(L.from(r),0,0))}function P_(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),o=Sg(r,i);for(let a=0;a<o.length;a++){let c=o[a],f=a==o.length-1;if(f&&c==0||r.node(c).type.contentMatch.validEnd)return n.delete(r.start(c),i.end(c));if(c>0&&(f||r.node(c-1).canReplace(r.index(c-1),i.indexAfter(c-1))))return n.delete(r.before(c),i.after(c))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(e-r.start(a)==r.depth-a&&t>r.end(a)&&i.end(a)-t!=i.depth-a&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return n.delete(r.before(a),t);n.delete(e,t)}function Sg(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let o=n.start(i);if(o<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&t.push(i)}return t}class Bi extends We{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return Le.fail("No node at attribute step's position");let r=Object.create(null);for(let o in t.attrs)r[o]=t.attrs[o];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return Le.fromReplace(e,this.pos,this.pos+1,new W(L.from(i),0,t.isLeaf?0:1))}getMap(){return Ot.empty}invert(e){return new Bi(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Bi(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Bi(t.pos,t.attr,t.value)}}We.jsonID("attr",Bi);class Vs extends We{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return Le.ok(r)}getMap(){return Ot.empty}invert(e){return new Vs(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Vs(t.attr,t.value)}}We.jsonID("docAttr",Vs);let ki=class extends Error{};ki=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},ki.prototype=Object.create(Error.prototype),ki.prototype.constructor=ki,ki.prototype.name="TransformError";class D_{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Di}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new ki(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=W.empty){let i=ml(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new W(L.from(r),0,0))}delete(e,t){return this.replace(e,t,W.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return R_(this,e,t,r),this}replaceRangeWith(e,t,r){return L_(this,e,t,r),this}deleteRange(e,t){return P_(this,e,t),this}lift(e,t){return b_(this,e,t),this}join(e,t=1){return C_(this,e,t),this}wrap(e,t){return S_(this,e,t),this}setBlockType(e,t=e,r,i=null){return x_(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return E_(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Bi(e,t,r)),this}setDocAttribute(e,t){return this.step(new Vs(e,t)),this}addNodeMark(e,t){return this.step(new Er(e,t)),this}removeNodeMark(e,t){if(!(t instanceof _e)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new zi(e,t)),this}split(e,t=1,r){return __(this,e,t,r),this}addMark(e,t,r){return m_(this,e,t,r),this}removeMark(e,t,r){return g_(this,e,t,r),this}clearIncompatible(e,t,r){return Nu(this,e,t,r),this}}const Du=Object.create(null);class de{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new z_(e.min(t),e.max(t))]}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 t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=W.empty){let r=t.content.lastChild,i=null;for(let c=0;c<t.openEnd;c++)i=r,r=r.lastChild;let o=e.steps.length,a=this.ranges;for(let c=0;c<a.length;c++){let{$from:f,$to:h}=a[c],m=e.mapping.slice(o);e.replaceRange(m.map(f.pos),m.map(h.pos),c?W.empty:t),c==0&&Eg(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:a,$to:c}=i[o],f=e.mapping.slice(r),h=f.map(a.pos),m=f.map(c.pos);o?e.deleteRange(h,m):(e.replaceRangeWith(h,m,t),Eg(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new ae(e):Ei(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let a=t<0?Ei(e.node(0),e.node(o),e.before(o+1),e.index(o),t,r):Ei(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,r);if(a)return a}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new It(e.node(0))}static atStart(e){return Ei(e,e,0,0,1)||new It(e)}static atEnd(e){return Ei(e,e,e.content.size,e.childCount,-1)||new It(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Du[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Du)throw new RangeError("Duplicate use of selection JSON ID "+e);return Du[e]=t,t.prototype.jsonID=e,t}getBookmark(){return ae.between(this.$anchor,this.$head).getBookmark()}}de.prototype.visible=!0;class z_{constructor(e,t){this.$from=e,this.$to=t}}let xg=!1;function kg(n){!xg&&!n.parent.inlineContent&&(xg=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class ae extends de{constructor(e,t=e){kg(e),kg(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return de.near(r);let i=e.resolve(t.map(this.anchor));return new ae(i.parent.inlineContent?i:r,r)}replace(e,t=W.empty){if(super.replace(e,t),t==W.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ae&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ma(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new ae(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let o=de.findFrom(t,r,!0)||de.findFrom(t,-r,!0);if(o)t=o.$head;else return de.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(de.findFrom(e,-r,!0)||de.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new ae(e,t)}}de.jsonID("text",ae);class Ma{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Ma(e.map(this.anchor),e.map(this.head))}resolve(e){return ae.between(e.resolve(this.anchor),e.resolve(this.head))}}class Y extends de{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:i}=t.mapResult(this.anchor),o=e.resolve(i);return r?de.near(o):new Y(o)}content(){return new W(L.from(this.node),0,0)}eq(e){return e instanceof Y&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ph(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Y(e.resolve(t.anchor))}static create(e,t){return new Y(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Y.prototype.visible=!1,de.jsonID("node",Y);class ph{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Ma(r,r):new ph(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&Y.isSelectable(r)?new Y(t):de.near(t)}}class It extends de{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=W.empty){if(t==W.empty){e.delete(0,e.doc.content.size);let r=de.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new It(e)}map(e){return new It(e)}eq(e){return e instanceof It}getBookmark(){return B_}}de.jsonID("all",It);const B_={map(){return this},resolve(n){return new It(n)}};function Ei(n,e,t,r,i,o=!1){if(e.inlineContent)return ae.create(n,t);for(let a=r-(i>0?0:1);i>0?a<e.childCount:a>=0;a+=i){let c=e.child(a);if(c.isAtom){if(!o&&Y.isSelectable(c))return Y.create(n,t-(i<0?c.nodeSize:0))}else{let f=Ei(n,c,t+i,i<0?c.childCount:0,i,o);if(f)return f}t+=c.nodeSize*i}return null}function Eg(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof Je||i instanceof Ge))return;let o=n.mapping.maps[r],a;o.forEach((c,f,h,m)=>{a==null&&(a=m)}),n.setSelection(de.near(n.doc.resolve(a),t))}function _g(n,e){return!e||!n?n:n.bind(e)}class gl{constructor(e,t,r){this.name=e,this.init=_g(t.init,r),this.apply=_g(t.apply,r)}}new gl("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new gl("selection",{init(n,e){return n.selection||de.atStart(e.doc)},apply(n){return n.selection}}),new gl("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new gl("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}});function Tg(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Tg(i,e,{})),t[r]=i}return t}class at{constructor(e){this.spec=e,this.props={},e.props&&Tg(e.props,this,this.props),this.key=e.key?e.key.key:Cg("plugin")}getState(e){return e[this.key]}}const zu=Object.create(null);function Cg(n){return n in zu?n+"$"+ ++zu[n]:(zu[n]=0,n+"$")}class Ct{constructor(e="key"){this.key=Cg(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Fr=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Mg=function(n,e,t,r){return t&&(Ag(n,e,t,r,-1)||Ag(n,e,t,r,1))},F_=/^(img|br|input|textarea|hr)$/i;function Ag(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:yl(n))){let o=n.parentNode;if(!o||o.nodeType!=1||Bu(n)||F_.test(n.nodeName)||n.contentEditable=="false")return!1;e=Fr(n)+(i<0?0:1),n=o}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.contentEditable=="false")return!1;e=i<0?yl(n):0}else return!1}}function yl(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function H_(n,e,t){for(let r=e==0,i=e==yl(n);r||i;){if(n==t)return!0;let o=Fr(n);if(n=n.parentNode,!n)return!1;r=r&&o==0,i=i&&o==yl(n)}}function Bu(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Ig=function(n){return n.focusNode&&Mg(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Og(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}const fn=typeof navigator<"u"?navigator:null,Ng=typeof document<"u"?document:null,hr=fn&&fn.userAgent||"",Fu=/Edge\/(\d+)/.exec(hr),Rg=/MSIE \d/.exec(hr),Hu=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(hr),xs=!!(Rg||Hu||Fu),Lg=Rg?document.documentMode:Hu?+Hu[1]:Fu?+Fu[1]:0,bl=!xs&&/gecko\/(\d+)/i.test(hr);bl&&+(/Firefox\/(\d+)/.exec(hr)||[0,0])[1];const $u=!xs&&/Chrome\/(\d+)/.exec(hr),dr=!!$u,Pg=$u?+$u[1]:0,Hr=!xs&&!!fn&&/Apple Computer/.test(fn.vendor),Wu=Hr&&(/Mobile\/\w+/.test(hr)||!!fn&&fn.maxTouchPoints>2),Wt=Wu||(fn?/Mac/.test(fn.platform):!1),$_=fn?/Win/.test(fn.platform):!1,ks=/Android \d/.test(hr),Uu=!!Ng&&"webkitFontSmoothing"in Ng.documentElement.style,W_=Uu?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function U_(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),o=i&&i.size==0,a=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(a<0)return null;let c=r.resolve(a),f,h;if(Ig(t)){for(f=a;i&&!i.node;)i=i.parent;let p=i.node;if(i&&p.isAtom&&Y.isSelectable(p)&&i.parent&&!(p.isInline&&H_(t.focusNode,t.focusOffset,i.dom))){let g=i.posBefore;h=new Y(a==g?c:r.resolve(g))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let p=a,g=a;for(let b=0;b<t.rangeCount;b++){let S=t.getRangeAt(b);p=Math.min(p,n.docView.posFromDOM(S.startContainer,S.startOffset,1)),g=Math.max(g,n.docView.posFromDOM(S.endContainer,S.endOffset,-1))}if(p<0)return null;[f,a]=g==n.state.selection.anchor?[g,p]:[p,g],c=r.resolve(a)}else f=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(f<0)return null}let m=r.resolve(f);if(!h){let p=e=="pointer"||n.state.selection.head<c.pos&&!o?1:-1;h=$g(n,m,c,p)}return h}function Dg(n){return n.editable?n.hasFocus():J_(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Vu(n,e=!1){let t=n.state.selection;if(G_(n,t),!!Dg(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&dr){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Mg(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)K_(n);else{let{anchor:r,head:i}=t,o,a;zg&&!(t instanceof ae)&&(t.$from.parent.inlineContent||(o=Bg(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(a=Bg(n,t.to))),n.docView.setSelection(r,i,n,e),zg&&(o&&Fg(o),a&&Fg(a)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&V_(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const zg=Hr||dr&&Pg<63;function Bg(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,o=r?t.childNodes[r-1]:null;if(Hr&&i&&i.contentEditable=="false")return Ku(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return Ku(i);if(o)return Ku(o)}}function Ku(n){return n.contentEditable="true",Hr&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Fg(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function V_(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Dg(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function K_(n){let e=n.domSelection(),t=document.createRange();if(!e)return;let r=n.cursorWrapper.dom,i=r.nodeName=="IMG";i?t.setStart(r.parentNode,Fr(r)+1):t.setStart(r,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&&xs&&Lg<=11&&(r.disabled=!0,r.disabled=!1)}function G_(n,e){if(e instanceof Y){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Hg(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Hg(n)}function Hg(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function $g(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||ae.between(e,t,r)}function J_(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Gu(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),o=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return o&&de.findFrom(o,e)}function pr(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Wg(n,e,t){let r=n.state.selection;if(r instanceof ae)if(t.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let a=n.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return pr(n,new ae(r.$anchor,a))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=Gu(n.state,e);return i&&i instanceof Y?pr(n,i):!1}else if(!(Wt&&t.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,a;if(!o||o.isText)return!1;let c=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(a=n.docView.descAt(c))&&!a.contentDOM?Y.isSelectable(o)?pr(n,new Y(e<0?n.state.doc.resolve(i.pos-o.nodeSize):i)):Uu?pr(n,new ae(n.state.doc.resolve(e<0?c:c+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Y&&r.node.isInline)return pr(n,new ae(e>0?r.$to:r.$from));{let i=Gu(n.state,e);return i?pr(n,i):!1}}}function vl(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Es(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function _i(n,e){return e<0?q_(n):j_(n)}function q_(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,o,a=!1;for(bl&&t.nodeType==1&&r<vl(t)&&Es(t.childNodes[r],-1)&&(a=!0);;)if(r>0){if(t.nodeType!=1)break;{let c=t.childNodes[r-1];if(Es(c,-1))i=t,o=--r;else if(c.nodeType==3)t=c,r=t.nodeValue.length;else break}}else{if(Ug(t))break;{let c=t.previousSibling;for(;c&&Es(c,-1);)i=t.parentNode,o=Fr(c),c=c.previousSibling;if(c)t=c,r=vl(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}a?Ju(n,t,r):i&&Ju(n,i,o)}function j_(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=vl(t),o,a;for(;;)if(r<i){if(t.nodeType!=1)break;let c=t.childNodes[r];if(Es(c,1))o=t,a=++r;else break}else{if(Ug(t))break;{let c=t.nextSibling;for(;c&&Es(c,1);)o=c.parentNode,a=Fr(c)+1,c=c.nextSibling;if(c)t=c,r=0,i=vl(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}o&&Ju(n,o,a)}function Ug(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Y_(n,e){for(;n&&e==n.childNodes.length&&!Bu(n);)e=Fr(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function X_(n,e){for(;n&&!e&&!Bu(n);)e=Fr(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function Ju(n,e,t){if(e.nodeType!=3){let o,a;(a=Y_(e,t))?(e=a,t=0):(o=X_(e,t))&&(e=o,t=o.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Ig(r)){let o=document.createRange();o.setEnd(e,t),o.setStart(e,t),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&Vu(n)},50)}function Vg(n,e){let t=n.state.doc.resolve(e);if(!(dr||$_)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let o=n.coordsAtPos(e-1),a=(o.top+o.bottom)/2;if(a>i.top&&a<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(e<t.end()){let o=n.coordsAtPos(e+1),a=(o.top+o.bottom)/2;if(a>i.top&&a<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Kg(n,e,t){let r=n.state.selection;if(r instanceof ae&&!r.empty||t.indexOf("s")>-1||Wt&&t.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let a=Gu(n.state,e);if(a&&a instanceof Y)return pr(n,a)}if(!i.parent.inlineContent){let a=e<0?i:o,c=r instanceof It?de.near(a,e):de.findFrom(a,e);return c?pr(n,c):!1}return!1}function Gg(n,e){if(!(n.state.selection instanceof ae))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(o&&!o.isText){let a=n.state.tr;return e<0?a.delete(t.pos-o.nodeSize,t.pos):a.delete(t.pos,t.pos+o.nodeSize),n.dispatch(a),!0}return!1}function Jg(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Z_(n){if(!Hr||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Jg(n,r,"true"),setTimeout(()=>Jg(n,r,"false"),20)}return!1}function Q_(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function eT(n,e){let t=e.keyCode,r=Q_(e);if(t==8||Wt&&t==72&&r=="c")return Gg(n,-1)||_i(n,-1);if(t==46&&!e.shiftKey||Wt&&t==68&&r=="c")return Gg(n,1)||_i(n,1);if(t==13||t==27)return!0;if(t==37||Wt&&t==66&&r=="c"){let i=t==37?Vg(n,n.state.selection.from)=="ltr"?-1:1:-1;return Wg(n,i,r)||_i(n,i)}else if(t==39||Wt&&t==70&&r=="c"){let i=t==39?Vg(n,n.state.selection.from)=="ltr"?1:-1:1;return Wg(n,i,r)||_i(n,i)}else{if(t==38||Wt&&t==80&&r=="c")return Kg(n,-1,r)||_i(n,-1);if(t==40||Wt&&t==78&&r=="c")return Z_(n)||Kg(n,1,r)||_i(n,1);if(r==(Wt?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function qg(n,e){n.someProp("transformCopied",b=>{e=b(e,n)});let t=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let b=r.firstChild;t.push(b.type.name,b.attrs!=b.type.defaultAttrs?b.attrs:null),r=b.content}let a=n.someProp("clipboardSerializer")||Ws.fromSchema(n.state.schema),c=n0(),f=c.createElement("div");f.appendChild(a.serializeFragment(r,{document:c}));let h=f.firstChild,m,p=0;for(;h&&h.nodeType==1&&(m=e0[h.nodeName.toLowerCase()]);){for(let b=m.length-1;b>=0;b--){let S=c.createElement(m[b]);for(;f.firstChild;)S.appendChild(f.firstChild);f.appendChild(S),p++}h=f.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${i} ${o}${p?` -${p}`:""} ${JSON.stringify(t)}`);let g=n.someProp("clipboardTextSerializer",b=>b(e,n))||e.content.textBetween(0,e.content.size,`
10
10
 
11
- `);return{dom:f,text:g,slice:e}}function jg(n,e,t,r,i){let o=i.parent.type.spec.code,a,u;if(!t&&!e)return null;let f=e&&(r||o||!t);if(f){if(n.someProp("transformPastedText",g=>{e=g(e,o||r,n)}),o)return e?new W(L.from(n.state.schema.text(e.replace(/\r\n?/g,`
12
- `))),0,0):W.empty;let p=n.someProp("clipboardTextParser",g=>g(e,i,r,n));if(p)u=p;else{let g=i.marks(),{schema:b}=n.state,x=Us.fromSchema(b);a=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(E=>{let C=a.appendChild(document.createElement("p"));E&&C.appendChild(x.serializeNode(b.text(E,g)))})}}else n.someProp("transformPastedHTML",p=>{t=p(t,n)}),a=sT(t),Vc&&oT(a);let d=a&&a.querySelector("[data-pm-slice]"),m=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(m&&m[3])for(let p=+m[3];p>0;p--){let g=a.firstChild;for(;g&&g.nodeType!=1;)g=g.nextSibling;if(!g)break;a=g}if(u||(u=(n.someProp("clipboardParser")||n.someProp("domParser")||ws.fromSchema(n.state.schema)).parseSlice(a,{preserveWhitespace:!!(f||m),context:i,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!nT.test(g.parentNode.nodeName)?{ignore:!0}:null}})),m)u=lT(Qg(u,+m[1],+m[2]),m[4]);else if(u=W.maxOpen(rT(u.content,i),!0),u.openStart||u.openEnd){let p=0,g=0;for(let b=u.content.firstChild;p<u.openStart&&!b.type.spec.isolating;p++,b=b.firstChild);for(let b=u.content.lastChild;g<u.openEnd&&!b.type.spec.isolating;g++,b=b.lastChild);u=Qg(u,p,g)}return n.someProp("transformPasted",p=>{u=p(u,n)}),u}const nT=/^(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 rT(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),o,a=[];if(n.forEach(u=>{if(!a)return;let f=i.findWrapping(u.type),d;if(!f)return a=null;if(d=a.length&&o.length&&Xg(f,o,u,a[a.length-1],0))a[a.length-1]=d;else{a.length&&(a[a.length-1]=Zg(a[a.length-1],o.length));let m=Yg(u,f);a.push(m),i=i.matchType(m.type),o=f}}),a)return L.from(a)}return n}function Yg(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,L.from(n));return n}function Xg(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let o=Xg(n,e,t,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(L.from(Yg(t,n,i+1))))}}function Zg(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Zg(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(L.empty,!0);return n.copy(t.append(r))}function jc(n,e,t,r,i,o){let a=e<0?n.firstChild:n.lastChild,u=a.content;return n.childCount>1&&(o=0),i<r-1&&(u=jc(u,e,t,r,i+1,o)),i>=t&&(u=e<0?a.contentMatchAt(0).fillBefore(u,o<=i).append(u):u.append(a.contentMatchAt(a.childCount).fillBefore(L.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,a.copy(u))}function Qg(n,e,t){return e<n.openStart&&(n=new W(jc(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new W(jc(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const e0={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 t0=null;function n0(){return t0||(t0=document.implementation.createHTMLDocument("title"))}let Yc=null;function iT(n){let e=window.trustedTypes;return e?(Yc||(Yc=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Yc.createHTML(n)):n}function sT(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=n0().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&e0[r[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),t.innerHTML=iT(n),i)for(let o=0;o<i.length;o++)t=t.querySelector(i[o])||t;return t}function oT(n){let e=n.querySelectorAll(pr?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent=="\xA0"&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function lT(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:i,openStart:o,openEnd:a}=n;for(let u=r.length-2;u>=0;u-=2){let f=t.nodes[r[u]];if(!f||f.hasRequiredAttrs())break;i=L.from(f.create(r[u+1],i)),o++,a++}return new W(i,o,a)}const en={},Ct={};function gr(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}Ct.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!i0(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(_s&&pr&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Uc&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,Og(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||tT(n,t)?t.preventDefault():gr(n,"key")},Ct.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)},Ct.keypress=(n,e)=>{let t=e;if(i0(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||$t&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof ae)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode);!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i))&&n.dispatch(n.state.tr.insertText(i).scrollIntoView()),t.preventDefault()}};function xl(n){return{left:n.clientX,top:n.clientY}}function aT(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Xc(n,e,t,r,i){if(r==-1)return!1;let o=n.state.doc.resolve(r);for(let a=o.depth+1;a>0;a--)if(n.someProp(e,u=>a>o.depth?u(n,t,o.nodeAfter,o.before(a),i,!0):u(n,t,o.node(a),o.before(a),i,!1)))return!0;return!1}function Ci(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function uT(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&Y.isSelectable(r)?(Ci(n,new Y(t)),!0):!1}function cT(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof Y&&(r=t.node);let o=n.state.doc.resolve(e);for(let a=o.depth+1;a>0;a--){let u=a>o.depth?o.nodeAfter:o.node(a);if(Y.isSelectable(u)){r&&t.$from.depth>0&&a>=t.$from.depth&&o.before(t.$from.depth+1)==t.$from.pos?i=o.before(t.$from.depth):i=o.before(a);break}}return i!=null?(Ci(n,Y.create(n.state.doc,i)),!0):!1}function fT(n,e,t,r,i){return Xc(n,"handleClickOn",e,t,r)||n.someProp("handleClick",o=>o(n,e,r))||(i?cT(n,t):uT(n,t))}function dT(n,e,t,r){return Xc(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function hT(n,e,t,r){return Xc(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||pT(n,t,r)}function pT(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Ci(n,ae.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let a=o>i.depth?i.nodeAfter:i.node(o),u=i.before(o);if(a.inlineContent)Ci(n,ae.create(r,u+1,u+1+a.content.size));else if(Y.isSelectable(a))Ci(n,Y.create(r,u));else continue;return!0}}function Zc(n){return kl(n)}const r0=$t?"metaKey":"ctrlKey";en.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Zc(n),i=Date.now(),o="singleClick";i-n.input.lastClick.time<500&&aT(t,n.input.lastClick)&&!t[r0]&&(n.input.lastClick.type=="singleClick"?o="doubleClick":n.input.lastClick.type=="doubleClick"&&(o="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:o};let a=n.posAtCoords(xl(t));a&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new mT(n,a,t,!!r)):(o=="doubleClick"?dT:hT)(n,a.pos,a.inside,t)?t.preventDefault():gr(n,"pointer"))};class mT{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[r0],this.allowDefault=r.shiftKey;let o,a;if(t.inside>-1)o=e.state.doc.nodeAt(t.inside),a=t.inside;else{let m=e.state.doc.resolve(t.pos);o=m.parent,a=m.depth?m.before():0}const u=i?null:r.target,f=u?e.docView.nearestDesc(u,!0):null;this.target=f&&f.dom.nodeType==1?f.dom:null;let{selection:d}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||d instanceof Y&&d.from<=a&&d.to>a)&&(this.mightDrag={node:o,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&wl&&!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)),gr(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(()=>Kc(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(xl(e))),this.updateAllowDefault(e),this.allowDefault||!t?gr(this.view,"pointer"):fT(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||$r&&this.mightDrag&&!this.mightDrag.node.isAtom||pr&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Ci(this.view,pe.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):gr(this.view,"pointer")}move(e){this.updateAllowDefault(e),gr(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)}}en.touchstart=n=>{n.input.lastTouch=Date.now(),Zc(n),gr(n,"pointer")},en.touchmove=n=>{n.input.lastTouch=Date.now(),gr(n,"pointer")},en.contextmenu=n=>Zc(n);function i0(n,e){return n.composing?!0:$r&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const gT=_s?5e3:-1;Ct.compositionstart=Ct.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof ae&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),kl(n,!0),n.markCursor=null;else if(kl(n,!e.selection.empty),wl&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let a=o<0?i.lastChild:i.childNodes[o-1];if(!a)break;if(a.nodeType==3){let u=n.domSelection();u&&u.collapse(a,a.nodeValue.length);break}else i=a,o=-1}}n.input.composing=!0}s0(n,gT)},Ct.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,s0(n,20))};function s0(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>kl(n),e))}function yT(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=bT());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function bT(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function kl(n,e=!1){if(!(_s&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),yT(n),e||n.docView&&n.docView.dirty){let t=Vv(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!n.state.selection.empty?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function wT(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Ts=Es&&Lg<15||Uc&&Uv<604;en.copy=Ct.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let o=Ts?null:t.clipboardData,a=r.content(),{dom:u,text:f}=qg(n,a);o?(t.preventDefault(),o.clearData(),o.setData("text/html",u.innerHTML),o.setData("text/plain",f)):wT(n,u),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function ST(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function xT(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Qc(n,r.value,null,i,e):Qc(n,r.textContent,r.innerHTML,i,e)},50)}function Qc(n,e,t,r,i){let o=jg(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",f=>f(n,i,o||W.empty)))return!0;if(!o)return!1;let a=ST(o),u=a?n.state.tr.replaceSelectionWith(a,r):n.state.tr.replaceSelection(o);return n.dispatch(u.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function o0(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}Ct.paste=(n,e)=>{let t=e;if(n.composing&&!_s)return;let r=Ts?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Qc(n,o0(r),r.getData("text/html"),i,t)?t.preventDefault():xT(n,t)};class kT{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const l0=$t?"altKey":"ctrlKey";en.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,o=i.empty?null:n.posAtCoords(xl(t)),a;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof Y?i.to-1:i.to))){if(r&&r.mightDrag)a=Y.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let p=n.docView.nearestDesc(t.target,!0);p&&p.node.type.spec.draggable&&p!=n.docView&&(a=Y.create(n.state.doc,p.posBefore))}}let u=(a||n.state.selection).content(),{dom:f,text:d,slice:m}=qg(n,u);(!t.dataTransfer.files.length||!pr||Pg>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Ts?"Text":"text/html",f.innerHTML),t.dataTransfer.effectAllowed="copyMove",Ts||t.dataTransfer.setData("text/plain",d),n.dragging=new kT(m,!t[l0],a)},en.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)},Ct.dragover=Ct.dragenter=(n,e)=>e.preventDefault(),Ct.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(xl(t));if(!i)return;let o=n.state.doc.resolve(i.pos),a=r&&r.slice;a?n.someProp("transformPasted",x=>{a=x(a,n)}):a=jg(n,o0(t.dataTransfer),Ts?null:t.dataTransfer.getData("text/html"),!1,o);let u=!!(r&&!t[l0]);if(n.someProp("handleDrop",x=>x(n,t,a||W.empty,u))){t.preventDefault();return}if(!a)return;t.preventDefault();let f=a?Iv(n.state.doc,o.pos,a):o.pos;f==null&&(f=o.pos);let d=n.state.tr;if(u){let{node:x}=r;x?x.replace(d):d.deleteSelection()}let m=d.mapping.map(f),p=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,g=d.doc;if(p?d.replaceRangeWith(m,m,a.content.firstChild):d.replaceRange(m,m,a),d.doc.eq(g))return;let b=d.doc.resolve(m);if(p&&Y.isSelectable(a.content.firstChild)&&b.nodeAfter&&b.nodeAfter.sameMarkup(a.content.firstChild))d.setSelection(new Y(b));else{let x=d.mapping.map(f);d.mapping.maps[d.mapping.maps.length-1].forEach((E,C,M,P)=>x=P),d.setSelection($g(n,b,d.doc.resolve(x)))}n.focus(),n.dispatch(d.setMeta("uiEvent","drop"))},en.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Kc(n)},20))},en.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)},en.beforeinput=(n,e)=>{if(pr&&_s&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",o=>o(n,Og(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in Ct)en[n]=Ct[n];function Cs(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class Ia{constructor(e,t){this.toDOM=e,this.spec=t||Wr,this.side=this.spec.side||0}map(e,t,r,i){let{pos:o,deleted:a}=e.mapResult(t.from+i,this.side<0?-1:1);return a?null:new bn(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Ia&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Cs(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Er{constructor(e,t){this.attrs=e,this.spec=t||Wr}map(e,t,r,i){let o=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,a=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=a?null:new bn(o,a,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Er&&Cs(this.attrs,e.attrs)&&Cs(this.spec,e.spec)}static is(e){return e.type instanceof Er}destroy(){}}let ET=class Ay{constructor(e,t){this.attrs=e,this.spec=t||Wr}map(e,t,r,i){let o=e.mapResult(t.from+i,1);if(o.deleted)return null;let a=e.mapResult(t.to+i,-1);return a.deleted||a.pos<=o.pos?null:new bn(o.pos-r,a.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),o;return i==t.from&&!(o=e.child(r)).isText&&i+o.nodeSize==t.to}eq(e){return this==e||e instanceof Ay&&Cs(this.attrs,e.attrs)&&Cs(this.spec,e.spec)}destroy(){}};class bn{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new bn(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new bn(e,e,new Ia(t,r))}static inline(e,t,r,i){return new bn(e,t,new Er(r,i))}static node(e,t,r,i){return new bn(e,t,new ET(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Er}get widget(){return this.type instanceof Ia}}const Mi=[],Wr={};class Je{constructor(e,t){this.local=e.length?e:Mi,this.children=t.length?t:Mi}static create(e,t){return t.length?El(t,e,0,Wr):at}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,o){for(let a=0;a<this.local.length;a++){let u=this.local[a];u.from<=t&&u.to>=e&&(!o||o(u.spec))&&r.push(u.copy(u.from+i,u.to+i))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let u=this.children[a]+1;this.children[a+2].findInner(e-u,t-u,r,i+u,o)}}map(e,t,r){return this==at||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Wr)}mapInner(e,t,r,i,o){let a;for(let u=0;u<this.local.length;u++){let f=this.local[u].map(e,r,i);f&&f.type.valid(t,f)?(a||(a=[])).push(f):o.onRemove&&o.onRemove(this.local[u].spec)}return this.children.length?_T(this.children,a||[],e,t,r,i,o):a?new Je(a.sort(Ur),Mi):at}add(e,t){return t.length?this==at?Je.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,o=0;e.forEach((u,f)=>{let d=f+r,m;if(m=u0(t,u,d)){for(i||(i=this.children.slice());o<i.length&&i[o]<f;)o+=3;i[o]==f?i[o+2]=i[o+2].addInner(u,m,d+1):i.splice(o,0,f,f+u.nodeSize,El(m,u,d+1,Wr)),o+=3}});let a=a0(o?c0(t):t,-r);for(let u=0;u<a.length;u++)a[u].type.valid(e,a[u])||a.splice(u--,1);return new Je(a.length?this.local.concat(a).sort(Ur):this.local,i||this.children)}remove(e){return e.length==0||this==at?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let a,u=r[o]+t,f=r[o+1]+t;for(let m=0,p;m<e.length;m++)(p=e[m])&&p.from>u&&p.to<f&&(e[m]=null,(a||(a=[])).push(p));if(!a)continue;r==this.children&&(r=this.children.slice());let d=r[o+2].removeInner(a,u+1);d!=at?r[o+2]=d:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,a;o<e.length;o++)if(a=e[o])for(let u=0;u<i.length;u++)i[u].eq(a,t)&&(i==this.local&&(i=this.local.slice()),i.splice(u--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Je(i,r):at}forChild(e,t){if(this==at)return this;if(t.isLeaf)return Je.empty;let r,i;for(let u=0;u<this.children.length;u+=3)if(this.children[u]>=e){this.children[u]==e&&(r=this.children[u+2]);break}let o=e+1,a=o+t.content.size;for(let u=0;u<this.local.length;u++){let f=this.local[u];if(f.from<a&&f.to>o&&f.type instanceof Er){let d=Math.max(o,f.from)-o,m=Math.min(a,f.to)-o;d<m&&(i||(i=[])).push(f.copy(d,m))}}if(i){let u=new Je(i.sort(Ur),Mi);return r?new Zr([u,r]):u}return r||at}eq(e){if(this==e)return!0;if(!(e instanceof Je)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return ef(this.localsInner(e))}localsInner(e){if(this==at)return Mi;if(e.inlineContent||!this.local.some(Er.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Er||t.push(this.local[r]);return t}forEachSet(e){e(this)}}Je.empty=new Je([],[]),Je.removeOverlap=ef;const at=Je.empty;class Zr{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,Wr));return Zr.from(r)}forChild(e,t){if(t.isLeaf)return Je.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,t);o!=at&&(o instanceof Zr?r=r.concat(o.members):r.push(o))}return Zr.from(r)}eq(e){if(!(e instanceof Zr)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(!t)t=o;else{r&&(t=t.slice(),r=!1);for(let a=0;a<o.length;a++)t.push(o[a])}}return t?ef(r?t:t.sort(Ur)):Mi}static from(e){switch(e.length){case 0:return at;case 1:return e[0];default:return new Zr(e.every(t=>t instanceof Je)?e:e.reduce((t,r)=>t.concat(r instanceof Je?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function _T(n,e,t,r,i,o,a){let u=n.slice();for(let d=0,m=o;d<t.maps.length;d++){let p=0;t.maps[d].forEach((g,b,x,E)=>{let C=E-x-(b-g);for(let M=0;M<u.length;M+=3){let P=u[M+1];if(P<0||g>P+m-p)continue;let F=u[M]+m-p;b>=F?u[M+1]=g<=F?-2:-1:g>=m&&C&&(u[M]+=C,u[M+1]+=C)}p+=C}),m=t.maps[d].map(m,-1)}let f=!1;for(let d=0;d<u.length;d+=3)if(u[d+1]<0){if(u[d+1]==-2){f=!0,u[d+1]=-1;continue}let m=t.map(n[d]+o),p=m-i;if(p<0||p>=r.content.size){f=!0;continue}let g=t.map(n[d+1]+o,-1),b=g-i,{index:x,offset:E}=r.content.findIndex(p),C=r.maybeChild(x);if(C&&E==p&&E+C.nodeSize==b){let M=u[d+2].mapInner(t,C,m+1,n[d]+o+1,a);M!=at?(u[d]=p,u[d+1]=b,u[d+2]=M):(u[d+1]=-2,f=!0)}else f=!0}if(f){let d=vT(u,n,e,t,i,o,a),m=El(d,r,0,a);e=m.local;for(let p=0;p<u.length;p+=3)u[p+1]<0&&(u.splice(p,3),p-=3);for(let p=0,g=0;p<m.children.length;p+=3){let b=m.children[p];for(;g<u.length&&u[g]<b;)g+=3;u.splice(g,0,m.children[p],m.children[p+1],m.children[p+2])}}return new Je(e.sort(Ur),u)}function a0(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let i=n[r];t.push(new bn(i.from+e,i.to+e,i.type))}return t}function vT(n,e,t,r,i,o,a){function u(f,d){for(let m=0;m<f.local.length;m++){let p=f.local[m].map(r,i,d);p?t.push(p):a.onRemove&&a.onRemove(f.local[m].spec)}for(let m=0;m<f.children.length;m+=3)u(f.children[m+2],f.children[m]+d+1)}for(let f=0;f<n.length;f+=3)n[f+1]==-1&&u(n[f+2],e[f]+o+1);return t}function u0(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let o=0,a;o<n.length;o++)(a=n[o])&&a.from>t&&a.to<r&&((i||(i=[])).push(a),n[o]=null);return i}function c0(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function El(n,e,t,r){let i=[],o=!1;e.forEach((u,f)=>{let d=u0(n,u,f+t);if(d){o=!0;let m=El(d,u,t+f+1,r);m!=at&&i.push(f,f+u.nodeSize,m)}});let a=a0(o?c0(n):n,-t).sort(Ur);for(let u=0;u<a.length;u++)a[u].type.valid(e,a[u])||(r.onRemove&&r.onRemove(a[u].spec),a.splice(u--,1));return a.length||i.length?new Je(a,i):at}function Ur(n,e){return n.from-e.from||n.to-e.to}function ef(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let i=t+1;i<e.length;i++){let o=e[i];if(o.from==r.from){o.to!=r.to&&(e==n&&(e=n.slice()),e[i]=o.copy(o.from,r.to),f0(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,o.from),f0(e,i,r.copy(o.from,r.to)));break}}}return e}function f0(n,e,t){for(;e<n.length&&Ur(t,n[e])>0;)e++;n.splice(e,0,t)}for(var yr={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:"'"},_l={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},TT=typeof navigator<"u"&&/Mac/.test(navigator.platform),CT=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Ze=0;Ze<10;Ze++)yr[48+Ze]=yr[96+Ze]=String(Ze);for(var Ze=1;Ze<=24;Ze++)yr[Ze+111]="F"+Ze;for(var Ze=65;Ze<=90;Ze++)yr[Ze]=String.fromCharCode(Ze+32),_l[Ze]=String.fromCharCode(Ze);for(var tf in yr)_l.hasOwnProperty(tf)||(_l[tf]=yr[tf]);function MT(n){var e=TT&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||CT&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?_l:yr)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const AT=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function IT(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,o,a;for(let u=0;u<e.length-1;u++){let f=e[u];if(/^(cmd|meta|m)$/i.test(f))a=!0;else if(/^a(lt)?$/i.test(f))r=!0;else if(/^(c|ctrl|control)$/i.test(f))i=!0;else if(/^s(hift)?$/i.test(f))o=!0;else if(/^mod$/i.test(f))AT?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+f)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),a&&(t="Meta-"+t),o&&(t="Shift-"+t),t}function OT(n){let e=Object.create(null);for(let t in n)e[IT(t)]=n[t];return e}function nf(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function NT(n){return new lt({props:{handleKeyDown:RT(n)}})}function RT(n){let e=OT(n);return function(t,r){let i=MT(r),o,a=e[nf(i,r)];if(a&&a(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let u=e[nf(i,r,!1)];if(u&&u(t.state,t.dispatch,t))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(o=yr[r.keyCode])&&o!=i){let u=e[nf(o,r)];if(u&&u(t.state,t.dispatch,t))return!0}}return!1}}const rf=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function d0(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const h0=(n,e,t)=>{let r=d0(n,t);if(!r)return!1;let i=sf(r);if(!i){let a=r.blockRange(),u=a&&Ei(a);return u==null?!1:(e&&e(n.tr.lift(a,u).scrollIntoView()),!0)}let o=i.nodeBefore;if(k0(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Ai(o,"end")||Y.isSelectable(o)))for(let a=r.depth;;a--){let u=gl(n.doc,r.before(a),r.after(a),W.empty);if(u&&u.slice.size<u.to-u.from){if(e){let f=n.tr.step(u);f.setSelection(Ai(o,"end")?pe.findFrom(f.doc.resolve(f.mapping.map(i.pos,-1)),-1):Y.create(f.doc,i.pos-o.nodeSize)),e(f.scrollIntoView())}return!0}if(a==1||r.node(a-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},LT=(n,e,t)=>{let r=d0(n,t);if(!r)return!1;let i=sf(r);return i?p0(n,i,e):!1},PT=(n,e,t)=>{let r=g0(n,t);if(!r)return!1;let i=of(r);return i?p0(n,i,e):!1};function p0(n,e,t){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let m=i.lastChild;if(!m)return!1;i=m}let a=e.nodeAfter,u=a,f=e.pos+1;for(;!u.isTextblock;f++){if(u.type.spec.isolating)return!1;let m=u.firstChild;if(!m)return!1;u=m}let d=gl(n.doc,o,f,W.empty);if(!d||d.from!=o||d instanceof Ge&&d.slice.size>=f-o)return!1;if(t){let m=n.tr.step(d);m.setSelection(ae.create(m.doc,o)),t(m.scrollIntoView())}return!0}function Ai(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const m0=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;o=sf(r)}let a=o&&o.nodeBefore;return!a||!Y.isSelectable(a)?!1:(e&&e(n.tr.setSelection(Y.create(n.doc,o.pos-a.nodeSize)).scrollIntoView()),!0)};function sf(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function g0(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const y0=(n,e,t)=>{let r=g0(n,t);if(!r)return!1;let i=of(r);if(!i)return!1;let o=i.nodeAfter;if(k0(n,i,e,1))return!0;if(r.parent.content.size==0&&(Ai(o,"start")||Y.isSelectable(o))){let a=gl(n.doc,r.before(),r.after(),W.empty);if(a&&a.slice.size<a.to-a.from){if(e){let u=n.tr.step(a);u.setSelection(Ai(o,"start")?pe.findFrom(u.doc.resolve(u.mapping.map(i.pos)),1):Y.create(u.doc,u.mapping.map(i.pos))),e(u.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},b0=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;o=of(r)}let a=o&&o.nodeAfter;return!a||!Y.isSelectable(a)?!1:(e&&e(n.tr.setSelection(Y.create(n.doc,o.pos)).scrollIntoView()),!0)};function of(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const DT=(n,e)=>{let t=n.selection,r=t instanceof Y,i;if(r){if(t.node.isTextblock||!dr(n.doc,t.from))return!1;i=t.from}else if(i=ml(n.doc,t.from,-1),i==null)return!1;if(e){let o=n.tr.join(i);r&&o.setSelection(Y.create(o.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},zT=(n,e)=>{let t=n.selection,r;if(t instanceof Y){if(t.node.isTextblock||!dr(n.doc,t.to))return!1;r=t.to}else if(r=ml(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},BT=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),o=i&&Ei(i);return o==null?!1:(e&&e(n.tr.lift(i,o).scrollIntoView()),!0)},w0=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
13
- `).scrollIntoView()),!0)};function lf(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const FT=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),o=t.indexAfter(-1),a=lf(i.contentMatchAt(o));if(!a||!i.canReplaceWith(o,o,a))return!1;if(e){let u=t.after(),f=n.tr.replaceWith(u,u,a.createAndFill());f.setSelection(pe.near(f.doc.resolve(u),1)),e(f.scrollIntoView())}return!0},S0=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof At||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=lf(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let a=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,u=n.tr.insert(a,o.createAndFill());u.setSelection(ae.create(u.doc,a+1)),e(u.scrollIntoView())}return!0},x0=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let o=t.before();if(Pn(n.doc,o))return e&&e(n.tr.split(o).scrollIntoView()),!0}let r=t.blockRange(),i=r&&Ei(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};function HT(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof Y&&e.selection.node.isBlock)return!r.parentOffset||!Pn(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let o=[],a,u,f=!1,d=!1;for(let b=r.depth;;b--)if(r.node(b).isBlock){f=r.end(b)==r.pos+(r.depth-b),d=r.start(b)==r.pos-(r.depth-b),u=lf(r.node(b-1).contentMatchAt(r.indexAfter(b-1))),o.unshift(f&&u?{type:u}:null),a=b;break}else{if(b==1)return!1;o.unshift(null)}let m=e.tr;(e.selection instanceof ae||e.selection instanceof At)&&m.deleteSelection();let p=m.mapping.map(r.pos),g=Pn(m.doc,p,o.length,o);if(g||(o[0]=u?{type:u}:null,g=Pn(m.doc,p,o.length,o)),m.split(p,o.length,o),!f&&d&&r.node(a).type!=u){let b=m.mapping.map(r.before(a)),x=m.doc.resolve(b);u&&r.node(a-1).canReplaceWith(x.index(),x.index()+1,u)&&m.setNodeMarkup(m.mapping.map(r.before(a)),u)}return t&&t(m.scrollIntoView()),!0}}const $T=HT(),WT=(n,e)=>{let{$from:t,to:r}=n.selection,i,o=t.sharedDepth(r);return o==0?!1:(i=t.before(o),e&&e(n.tr.setSelection(Y.create(n.doc,i))),!0)};function UT(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||dr(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function k0(n,e,t,r){let i=e.nodeBefore,o=e.nodeAfter,a,u,f=i.type.spec.isolating||o.type.spec.isolating;if(!f&&UT(n,e,t))return!0;let d=!f&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(a=(u=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&u.matchType(a[0]||o.type).validEnd){if(t){let b=e.pos+o.nodeSize,x=L.empty;for(let M=a.length-1;M>=0;M--)x=L.from(a[M].create(null,x));x=L.from(i.copy(x));let E=n.tr.step(new Ke(e.pos-1,b,e.pos,b,new W(x,1,0),a.length,!0)),C=E.doc.resolve(b+2*a.length);C.nodeAfter&&C.nodeAfter.type==i.type&&dr(E.doc,C.pos)&&E.join(C.pos),t(E.scrollIntoView())}return!0}let m=o.type.spec.isolating||r>0&&f?null:pe.findFrom(e,1),p=m&&m.$from.blockRange(m.$to),g=p&&Ei(p);if(g!=null&&g>=e.depth)return t&&t(n.tr.lift(p,g).scrollIntoView()),!0;if(d&&Ai(o,"start",!0)&&Ai(i,"end")){let b=i,x=[];for(;x.push(b),!b.isTextblock;)b=b.lastChild;let E=o,C=1;for(;!E.isTextblock;E=E.firstChild)C++;if(b.canReplace(b.childCount,b.childCount,E.content)){if(t){let M=L.empty;for(let F=x.length-1;F>=0;F--)M=L.from(x[F].copy(M));let P=n.tr.step(new Ke(e.pos-x.length,e.pos+o.nodeSize,e.pos+C,e.pos+o.nodeSize-C,new W(M,x.length,0),0,!0));t(P.scrollIntoView())}return!0}}return!1}function E0(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(t&&t(e.tr.setSelection(ae.create(e.doc,n<0?i.start(o):i.end(o)))),!0):!1}}const VT=E0(-1),KT=E0(1);function GT(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,a=i.blockRange(o),u=a&&Lc(a,n,e);return u?(r&&r(t.tr.wrap(a,u).scrollIntoView()),!0):!1}}function _0(n,e=null){return function(t,r){let i=!1;for(let o=0;o<t.selection.ranges.length&&!i;o++){let{$from:{pos:a},$to:{pos:u}}=t.selection.ranges[o];t.doc.nodesBetween(a,u,(f,d)=>{if(i)return!1;if(!(!f.isTextblock||f.hasMarkup(n,e)))if(f.type==n)i=!0;else{let m=t.doc.resolve(d),p=m.index();i=m.parent.canReplaceWith(p,p+1,n)}})}if(!i)return!1;if(r){let o=t.tr;for(let a=0;a<t.selection.ranges.length;a++){let{$from:{pos:u},$to:{pos:f}}=t.selection.ranges[a];o.setBlockType(u,f,n,e)}r(o.scrollIntoView())}return!0}}function af(...n){return function(e,t,r){for(let i=0;i<n.length;i++)if(n[i](e,t,r))return!0;return!1}}af(rf,h0,m0),af(rf,y0,b0),af(w0,S0,x0,$T),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function JT(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,a=i.blockRange(o);if(!a)return!1;let u=r?t.tr:null;return qT(u,a,n,e)?(r&&r(u.scrollIntoView()),!0):!1}}function qT(n,e,t,r=null){let i=!1,o=e,a=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let f=a.resolve(e.start-2);o=new cl(f,f,e.depth),e.endIndex<e.parent.childCount&&(e=new cl(e.$from,a.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let u=Lc(o,t,r,e);return u?(n&&jT(n,e,u,i,t),!0):!1}function jT(n,e,t,r,i){let o=L.empty;for(let m=t.length-1;m>=0;m--)o=L.from(t[m].type.create(t[m].attrs,o));n.step(new Ke(e.start-(r?2:0),e.end,e.start,e.end,new W(o,0,0),t.length,!0));let a=0;for(let m=0;m<t.length;m++)t[m].type==i&&(a=m+1);let u=t.length-a,f=e.start+t.length-(r?2:0),d=e.parent;for(let m=e.startIndex,p=e.endIndex,g=!0;m<p;m++,g=!1)!g&&Pn(n.doc,f,u)&&(n.split(f,u),f+=2*u),f+=d.child(m).nodeSize;return n}function YT(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,a=>a.childCount>0&&a.firstChild.type==n);return o?t?r.node(o.depth-1).type==n?XT(e,t,n,o):ZT(e,t,o):!0:!1}}function XT(n,e,t,r){let i=n.tr,o=r.end,a=r.$to.end(r.depth);o<a&&(i.step(new Ke(o-1,a,o,a,new W(L.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new cl(i.doc.resolve(r.$from.pos),i.doc.resolve(a),r.depth));const u=Ei(r);if(u==null)return!1;i.lift(r,u);let f=i.mapping.map(o,-1)-1;return dr(i.doc,f)&&i.join(f),e(i.scrollIntoView()),!0}function ZT(n,e,t){let r=n.tr,i=t.parent;for(let b=t.end,x=t.endIndex-1,E=t.startIndex;x>E;x--)b-=i.child(x).nodeSize,r.delete(b-1,b+1);let o=r.doc.resolve(t.start),a=o.nodeAfter;if(r.mapping.map(t.end)!=t.start+o.nodeAfter.nodeSize)return!1;let u=t.startIndex==0,f=t.endIndex==i.childCount,d=o.node(-1),m=o.index(-1);if(!d.canReplace(m+(u?0:1),m+1,a.content.append(f?L.empty:L.from(i))))return!1;let p=o.pos,g=p+a.nodeSize;return r.step(new Ke(p-(u?1:0),g+(f?1:0),p+1,g-1,new W((u?L.empty:L.from(i.copy(L.empty))).append(f?L.empty:L.from(i.copy(L.empty))),u?0:1,f?0:1),u?0:1)),e(r.scrollIntoView()),!0}function QT(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,d=>d.childCount>0&&d.firstChild.type==n);if(!o)return!1;let a=o.startIndex;if(a==0)return!1;let u=o.parent,f=u.child(a-1);if(f.type!=n)return!1;if(t){let d=f.lastChild&&f.lastChild.type==u.type,m=L.from(d?n.create():null),p=new W(L.from(n.create(null,L.from(u.type.create(null,m)))),d?3:1,0),g=o.start,b=o.end;t(e.tr.step(new Ke(g-(d?3:1),b,g,b,p,1,!0)).scrollIntoView())}return!0}}function vl(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:o}=t;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 o},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,o=t.storedMarks,t}}}class uf{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:r}=this,{view:i}=t,{tr:o}=r,a=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([u,f])=>[u,(...m)=>{const p=f(...m)(a);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),p}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:r,editor:i,state:o}=this,{view:a}=i,u=[],f=!!e,d=e||o.tr,m=()=>(!f&&t&&!d.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(d),u.every(g=>g===!0)),p={...Object.fromEntries(Object.entries(r).map(([g,b])=>[g,(...E)=>{const C=this.buildProps(d,t),M=b(...E)(C);return u.push(M),p}])),run:m};return p}createCan(e){const{rawCommands:t,state:r}=this,i=!1,o=e||r.tr,a=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(t).map(([f,d])=>[f,(...m)=>d(...m)({...a,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(e,t=!0){const{rawCommands:r,editor:i,state:o}=this,{view:a}=i,u={tr:e,editor:i,view:a,state:vl({state:o,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([f,d])=>[f,(...m)=>d(...m)(u)]))}};return u}}function K(n,e,t){return n.config[e]===void 0&&n.parent?K(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?K(n.parent,e,t):null}):n.config[e]}function Tl(n){const e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function v0(n){const e=[],{nodeExtensions:t,markExtensions:r}=Tl(n),i=[...t,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(a=>{const u={name:a.name,options:a.options,storage:a.storage,extensions:i},f=K(a,"addGlobalAttributes",u);if(!f)return;f().forEach(m=>{m.types.forEach(p=>{Object.entries(m.attributes).forEach(([g,b])=>{e.push({type:p,name:g,attribute:{...o,...b}})})})})}),i.forEach(a=>{const u={name:a.name,options:a.options,storage:a.storage},f=K(a,"addAttributes",u);if(!f)return;const d=f();Object.entries(d).forEach(([m,p])=>{const g={...o,...p};typeof g?.default=="function"&&(g.default=g.default()),g?.isRequired&&g?.default===void 0&&delete g.default,e.push({type:a.name,name:m,attribute:g})})}),e}function We(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}function Ii(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){const u=o?String(o).split(" "):[],f=r[i]?r[i].split(" "):[],d=u.filter(m=>!f.includes(m));r[i]=[...f,...d].join(" ")}else if(i==="style"){const u=o?o.split(";").map(m=>m.trim()).filter(Boolean):[],f=r[i]?r[i].split(";").map(m=>m.trim()).filter(Boolean):[],d=new Map;f.forEach(m=>{const[p,g]=m.split(":").map(b=>b.trim());d.set(p,g)}),u.forEach(m=>{const[p,g]=m.split(":").map(b=>b.trim());d.set(p,g)}),r[i]=Array.from(d.entries()).map(([m,p])=>`${m}: ${p}`).join("; ")}else r[i]=o}),r},{})}function cf(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>Ii(t,r),{})}function eC(n){return typeof n=="function"}function le(n,e=void 0,...t){return eC(n)?e?n.bind(e)(...t):n(...t):n}function tC(n={}){return Object.keys(n).length===0&&n.constructor===Object}function nC(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function T0(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((o,a)=>{const u=a.attribute.parseHTML?a.attribute.parseHTML(t):nC(t.getAttribute(a.name));return u==null?o:{...o,[a.name]:u}},{});return{...r,...i}}}}function C0(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&tC(t)?!1:t!=null))}function M0(n,e){var t;const r=v0(n),{nodeExtensions:i,markExtensions:o}=Tl(n),a=(t=i.find(d=>K(d,"topNode")))===null||t===void 0?void 0:t.name,u=Object.fromEntries(i.map(d=>{const m=r.filter(M=>M.type===d.name),p={name:d.name,options:d.options,storage:d.storage,editor:e},g=n.reduce((M,P)=>{const F=K(P,"extendNodeSchema",p);return{...M,...F?F(d):{}}},{}),b=C0({...g,content:le(K(d,"content",p)),marks:le(K(d,"marks",p)),group:le(K(d,"group",p)),inline:le(K(d,"inline",p)),atom:le(K(d,"atom",p)),selectable:le(K(d,"selectable",p)),draggable:le(K(d,"draggable",p)),code:le(K(d,"code",p)),whitespace:le(K(d,"whitespace",p)),linebreakReplacement:le(K(d,"linebreakReplacement",p)),defining:le(K(d,"defining",p)),isolating:le(K(d,"isolating",p)),attrs:Object.fromEntries(m.map(M=>{var P;return[M.name,{default:(P=M?.attribute)===null||P===void 0?void 0:P.default}]}))}),x=le(K(d,"parseHTML",p));x&&(b.parseDOM=x.map(M=>T0(M,m)));const E=K(d,"renderHTML",p);E&&(b.toDOM=M=>E({node:M,HTMLAttributes:cf(M,m)}));const C=K(d,"renderText",p);return C&&(b.toText=C),[d.name,b]})),f=Object.fromEntries(o.map(d=>{const m=r.filter(C=>C.type===d.name),p={name:d.name,options:d.options,storage:d.storage,editor:e},g=n.reduce((C,M)=>{const P=K(M,"extendMarkSchema",p);return{...C,...P?P(d):{}}},{}),b=C0({...g,inclusive:le(K(d,"inclusive",p)),excludes:le(K(d,"excludes",p)),group:le(K(d,"group",p)),spanning:le(K(d,"spanning",p)),code:le(K(d,"code",p)),attrs:Object.fromEntries(m.map(C=>{var M;return[C.name,{default:(M=C?.attribute)===null||M===void 0?void 0:M.default}]}))}),x=le(K(d,"parseHTML",p));x&&(b.parseDOM=x.map(C=>T0(C,m)));const E=K(d,"renderHTML",p);return E&&(b.toDOM=C=>E({mark:C,HTMLAttributes:cf(C,m)})),[d.name,b]}));return new Zm({topNode:a,nodes:u,marks:f})}function ff(n,e){return e.nodes[n]||e.marks[n]||null}function A0(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function I0(n,e){const t=Us.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}const rC=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,o,a,u)=>{var f,d;const m=((d=(f=i.type.spec).toText)===null||d===void 0?void 0:d.call(f,{node:i,pos:o,parent:a,index:u}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?m:m.slice(0,Math.max(0,r-o))}),t};function df(n){return Object.prototype.toString.call(n)==="[object RegExp]"}class O0{constructor(e){this.find=e.find,this.handler=e.handler}}const iC=(n,e)=>{if(df(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function Cl(n){var e;const{editor:t,from:r,to:i,text:o,rules:a,plugin:u}=n,{view:f}=t;if(f.composing)return!1;const d=f.state.doc.resolve(r);if(d.parent.type.spec.code||!((e=d.nodeBefore||d.nodeAfter)===null||e===void 0)&&e.marks.find(g=>g.type.spec.code))return!1;let m=!1;const p=rC(d)+o;return a.forEach(g=>{if(m)return;const b=iC(p,g.find);if(!b)return;const x=f.state.tr,E=vl({state:f.state,transaction:x}),C={from:r-(b[0].length-o.length),to:i},{commands:M,chain:P,can:F}=new uf({editor:t,state:E});g.handler({state:E,range:C,match:b,commands:M,chain:P,can:F})===null||!x.steps.length||(x.setMeta(u,{transform:x,from:r,to:i,text:o}),f.dispatch(x),m=!0)}),m}function sC(n){const{editor:e,rules:t}=n,r=new lt({state:{init(){return null},apply(i,o,a){const u=i.getMeta(r);if(u)return u;const f=i.getMeta("applyInputRules");return!!f&&setTimeout(()=>{let{text:m}=f;typeof m=="string"?m=m:m=I0(L.from(m),a.schema);const{from:p}=f,g=p+m.length;Cl({editor:e,from:p,to:g,text:m,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,a,u){return Cl({editor:e,from:o,to:a,text:u,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&Cl({editor:e,from:o.pos,to:o.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:a}=i.state.selection;return a?Cl({editor:e,from:a.pos,to:a.pos,text:`
14
- `,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function oC(n){return Object.prototype.toString.call(n).slice(8,-1)}function Ml(n){return oC(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Al(n,e){const t={...n};return Ml(n)&&Ml(e)&&Object.keys(e).forEach(r=>{Ml(e[r])&&Ml(n[r])?t[r]=Al(n[r],e[r]):t[r]=e[r]}),t}class Mt{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=le(K(this,"addOptions",{name:this.name}))),this.storage=le(K(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Mt(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Al(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Mt(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=le(K(t,"addOptions",{name:t.name})),t.storage=le(K(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const a=i.marks();if(!!!a.find(d=>d?.type.name===t.name))return!1;const f=a.find(d=>d?.type.name===t.name);return f&&r.removeStoredMark(f),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}function lC(n){return typeof n=="number"}class aC{constructor(e){this.find=e.find,this.handler=e.handler}}const uC=(n,e,t)=>{if(df(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(i=>{const o=[i.text];return o.index=i.index,o.input=n,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function cC(n){const{editor:e,state:t,from:r,to:i,rule:o,pasteEvent:a,dropEvent:u}=n,{commands:f,chain:d,can:m}=new uf({editor:e,state:t}),p=[];return t.doc.nodesBetween(r,i,(b,x)=>{if(!b.isTextblock||b.type.spec.code)return;const E=Math.max(r,x),C=Math.min(i,x+b.content.size),M=b.textBetween(E-x,C-x,void 0,"\uFFFC");uC(M,o.find,a).forEach(F=>{if(F.index===void 0)return;const $=E+F.index+1,U=$+F[0].length,ue={from:t.tr.mapping.map($),to:t.tr.mapping.map(U)},fe=o.handler({state:t,range:ue,match:F,commands:f,chain:d,can:m,pasteEvent:a,dropEvent:u});p.push(fe)})}),p.every(b=>b!==null)}let Il=null;const fC=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)===null||e===void 0||e.setData("text/html",n),t};function dC(n){const{editor:e,rules:t}=n;let r=null,i=!1,o=!1,a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,u;try{u=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{u=null}const f=({state:m,from:p,to:g,rule:b,pasteEvt:x})=>{const E=m.tr,C=vl({state:m,transaction:E});if(!(!cC({editor:e,state:C,from:Math.max(p-1,0),to:g.b-1,rule:b,pasteEvent:x,dropEvent:u})||!E.steps.length)){try{u=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{u=null}return a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,E}};return t.map(m=>new lt({view(p){const g=x=>{var E;r=!((E=p.dom.parentElement)===null||E===void 0)&&E.contains(x.target)?p.dom.parentElement:null,r&&(Il=e)},b=()=>{Il&&(Il=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",b),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",b)}}},props:{handleDOMEvents:{drop:(p,g)=>{if(o=r===p.dom.parentElement,u=g,!o){const b=Il;b&&setTimeout(()=>{const x=b.state.selection;x&&b.commands.deleteRange({from:x.from,to:x.to})},10)}return!1},paste:(p,g)=>{var b;const x=(b=g.clipboardData)===null||b===void 0?void 0:b.getData("text/html");return a=g,i=!!x?.includes("data-pm-slice"),!1}}},appendTransaction:(p,g,b)=>{const x=p[0],E=x.getMeta("uiEvent")==="paste"&&!i,C=x.getMeta("uiEvent")==="drop"&&!o,M=x.getMeta("applyPasteRules"),P=!!M;if(!E&&!C&&!P)return;if(P){let{text:U}=M;typeof U=="string"?U=U:U=I0(L.from(U),b.schema);const{from:ue}=M,fe=ue+U.length,we=fC(U);return f({rule:m,state:b,from:ue,to:{b:fe},pasteEvt:we})}const F=g.doc.content.findDiffStart(b.doc.content),$=g.doc.content.findDiffEnd(b.doc.content);if(!(!lC(F)||!$||F===$.b))return f({rule:m,state:b,from:F,to:$,pasteEvt:a})}}))}function hC(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}class Di{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=Di.resolve(e),this.schema=M0(this.extensions,t),this.setupExtensions()}static resolve(e){const t=Di.sort(Di.flatten(e)),r=hC(t.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),t}static flatten(e){return e.map(t=>{const r={name:t.name,options:t.options,storage:t.storage},i=K(t,"addExtensions",r);return i?[t,...this.flatten(i())]:t}).flat(10)}static sort(e){return e.sort((r,i)=>{const o=K(r,"priority")||100,a=K(i,"priority")||100;return o>a?-1:o<a?1:0})}get commands(){return this.extensions.reduce((e,t)=>{const r={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:ff(t.name,this.schema)},i=K(t,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,t=Di.sort([...this.extensions].reverse()),r=[],i=[],o=t.map(a=>{const u={name:a.name,options:a.options,storage:a.storage,editor:e,type:ff(a.name,this.schema)},f=[],d=K(a,"addKeyboardShortcuts",u);let m={};if(a.type==="mark"&&K(a,"exitable",u)&&(m.ArrowRight=()=>Mt.handleExit({editor:e,mark:a})),d){const E=Object.fromEntries(Object.entries(d()).map(([C,M])=>[C,()=>M({editor:e})]));m={...m,...E}}const p=NT(m);f.push(p);const g=K(a,"addInputRules",u);A0(a,e.options.enableInputRules)&&g&&r.push(...g());const b=K(a,"addPasteRules",u);A0(a,e.options.enablePasteRules)&&b&&i.push(...b());const x=K(a,"addProseMirrorPlugins",u);if(x){const E=x();f.push(...E)}return f}).flat();return[sC({editor:e,rules:r}),...dC({editor:e,rules:i}),...o]}get attributes(){return v0(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Tl(this.extensions);return Object.fromEntries(t.filter(r=>!!K(r,"addNodeView")).map(r=>{const i=this.attributes.filter(f=>f.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:e,type:We(r.name,this.schema)},a=K(r,"addNodeView",o);if(!a)return[];const u=(f,d,m,p,g)=>{const b=cf(f,i);return a()({node:f,view:d,getPos:m,decorations:p,innerDecorations:g,editor:e,extension:r,HTMLAttributes:b})};return[r.name,u]}))}setupExtensions(){this.extensions.forEach(e=>{var t;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:ff(e.name,this.schema)};e.type==="mark"&&(!((t=le(K(e,"keepOnSplit",r)))!==null&&t!==void 0)||t)&&this.splittableMarks.push(e.name);const i=K(e,"onBeforeCreate",r),o=K(e,"onCreate",r),a=K(e,"onUpdate",r),u=K(e,"onSelectionUpdate",r),f=K(e,"onTransaction",r),d=K(e,"onFocus",r),m=K(e,"onBlur",r),p=K(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),a&&this.editor.on("update",a),u&&this.editor.on("selectionUpdate",u),f&&this.editor.on("transaction",f),d&&this.editor.on("focus",d),m&&this.editor.on("blur",m),p&&this.editor.on("destroy",p)})}}class Ie{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=le(K(this,"addOptions",{name:this.name}))),this.storage=le(K(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ie(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Al(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Ie({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=le(K(t,"addOptions",{name:t.name})),t.storage=le(K(t,"addStorage",{name:t.name,options:t.options})),t}}function pC(n,e,t){const{from:r,to:i}=e,{blockSeparator:o=`
11
+ `);return{dom:f,text:g,slice:e}}function jg(n,e,t,r,i){let o=i.parent.type.spec.code,a,c;if(!t&&!e)return null;let f=e&&(r||o||!t);if(f){if(n.someProp("transformPastedText",g=>{e=g(e,o||r,n)}),o)return e?new W(L.from(n.state.schema.text(e.replace(/\r\n?/g,`
12
+ `))),0,0):W.empty;let p=n.someProp("clipboardTextParser",g=>g(e,i,r,n));if(p)c=p;else{let g=i.marks(),{schema:b}=n.state,S=Ws.fromSchema(b);a=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(k=>{let C=a.appendChild(document.createElement("p"));k&&C.appendChild(S.serializeNode(b.text(k,g)))})}}else n.someProp("transformPastedHTML",p=>{t=p(t,n)}),a=iT(t),Uu&&sT(a);let h=a&&a.querySelector("[data-pm-slice]"),m=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(m&&m[3])for(let p=+m[3];p>0;p--){let g=a.firstChild;for(;g&&g.nodeType!=1;)g=g.nextSibling;if(!g)break;a=g}if(c||(c=(n.someProp("clipboardParser")||n.someProp("domParser")||bs.fromSchema(n.state.schema)).parseSlice(a,{preserveWhitespace:!!(f||m),context:i,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!tT.test(g.parentNode.nodeName)?{ignore:!0}:null}})),m)c=oT(Qg(c,+m[1],+m[2]),m[4]);else if(c=W.maxOpen(nT(c.content,i),!0),c.openStart||c.openEnd){let p=0,g=0;for(let b=c.content.firstChild;p<c.openStart&&!b.type.spec.isolating;p++,b=b.firstChild);for(let b=c.content.lastChild;g<c.openEnd&&!b.type.spec.isolating;g++,b=b.lastChild);c=Qg(c,p,g)}return n.someProp("transformPasted",p=>{c=p(c,n)}),c}const tT=/^(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 nT(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),o,a=[];if(n.forEach(c=>{if(!a)return;let f=i.findWrapping(c.type),h;if(!f)return a=null;if(h=a.length&&o.length&&Xg(f,o,c,a[a.length-1],0))a[a.length-1]=h;else{a.length&&(a[a.length-1]=Zg(a[a.length-1],o.length));let m=Yg(c,f);a.push(m),i=i.matchType(m.type),o=f}}),a)return L.from(a)}return n}function Yg(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,L.from(n));return n}function Xg(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let o=Xg(n,e,t,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(L.from(Yg(t,n,i+1))))}}function Zg(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Zg(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(L.empty,!0);return n.copy(t.append(r))}function qu(n,e,t,r,i,o){let a=e<0?n.firstChild:n.lastChild,c=a.content;return n.childCount>1&&(o=0),i<r-1&&(c=qu(c,e,t,r,i+1,o)),i>=t&&(c=e<0?a.contentMatchAt(0).fillBefore(c,o<=i).append(c):c.append(a.contentMatchAt(a.childCount).fillBefore(L.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,a.copy(c))}function Qg(n,e,t){return e<n.openStart&&(n=new W(qu(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new W(qu(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const e0={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 t0=null;function n0(){return t0||(t0=document.implementation.createHTMLDocument("title"))}let ju=null;function rT(n){let e=window.trustedTypes;return e?(ju||(ju=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),ju.createHTML(n)):n}function iT(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=n0().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&e0[r[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),t.innerHTML=rT(n),i)for(let o=0;o<i.length;o++)t=t.querySelector(i[o])||t;return t}function sT(n){let e=n.querySelectorAll(dr?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent=="\xA0"&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function oT(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:i,openStart:o,openEnd:a}=n;for(let c=r.length-2;c>=0;c-=2){let f=t.nodes[r[c]];if(!f||f.hasRequiredAttrs())break;i=L.from(f.create(r[c+1],i)),o++,a++}return new W(i,o,a)}const tn={},Mt={};function mr(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}Mt.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!i0(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(ks&&dr&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Wu&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,Og(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||eT(n,t)?t.preventDefault():mr(n,"key")},Mt.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)},Mt.keypress=(n,e)=>{let t=e;if(i0(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Wt&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof ae)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode);!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i))&&n.dispatch(n.state.tr.insertText(i).scrollIntoView()),t.preventDefault()}};function wl(n){return{left:n.clientX,top:n.clientY}}function lT(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Yu(n,e,t,r,i){if(r==-1)return!1;let o=n.state.doc.resolve(r);for(let a=o.depth+1;a>0;a--)if(n.someProp(e,c=>a>o.depth?c(n,t,o.nodeAfter,o.before(a),i,!0):c(n,t,o.node(a),o.before(a),i,!1)))return!0;return!1}function Ti(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function aT(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&Y.isSelectable(r)?(Ti(n,new Y(t)),!0):!1}function cT(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof Y&&(r=t.node);let o=n.state.doc.resolve(e);for(let a=o.depth+1;a>0;a--){let c=a>o.depth?o.nodeAfter:o.node(a);if(Y.isSelectable(c)){r&&t.$from.depth>0&&a>=t.$from.depth&&o.before(t.$from.depth+1)==t.$from.pos?i=o.before(t.$from.depth):i=o.before(a);break}}return i!=null?(Ti(n,Y.create(n.state.doc,i)),!0):!1}function uT(n,e,t,r,i){return Yu(n,"handleClickOn",e,t,r)||n.someProp("handleClick",o=>o(n,e,r))||(i?cT(n,t):aT(n,t))}function fT(n,e,t,r){return Yu(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function hT(n,e,t,r){return Yu(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||dT(n,t,r)}function dT(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Ti(n,ae.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let a=o>i.depth?i.nodeAfter:i.node(o),c=i.before(o);if(a.inlineContent)Ti(n,ae.create(r,c+1,c+1+a.content.size));else if(Y.isSelectable(a))Ti(n,Y.create(r,c));else continue;return!0}}function Xu(n){return Sl(n)}const r0=Wt?"metaKey":"ctrlKey";tn.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Xu(n),i=Date.now(),o="singleClick";i-n.input.lastClick.time<500&&lT(t,n.input.lastClick)&&!t[r0]&&(n.input.lastClick.type=="singleClick"?o="doubleClick":n.input.lastClick.type=="doubleClick"&&(o="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:o};let a=n.posAtCoords(wl(t));a&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new pT(n,a,t,!!r)):(o=="doubleClick"?fT:hT)(n,a.pos,a.inside,t)?t.preventDefault():mr(n,"pointer"))};class pT{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[r0],this.allowDefault=r.shiftKey;let o,a;if(t.inside>-1)o=e.state.doc.nodeAt(t.inside),a=t.inside;else{let m=e.state.doc.resolve(t.pos);o=m.parent,a=m.depth?m.before():0}const c=i?null:r.target,f=c?e.docView.nearestDesc(c,!0):null;this.target=f&&f.dom.nodeType==1?f.dom:null;let{selection:h}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||h instanceof Y&&h.from<=a&&h.to>a)&&(this.mightDrag={node:o,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&bl&&!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)),mr(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(()=>Vu(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(wl(e))),this.updateAllowDefault(e),this.allowDefault||!t?mr(this.view,"pointer"):uT(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Hr&&this.mightDrag&&!this.mightDrag.node.isAtom||dr&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Ti(this.view,de.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):mr(this.view,"pointer")}move(e){this.updateAllowDefault(e),mr(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)}}tn.touchstart=n=>{n.input.lastTouch=Date.now(),Xu(n),mr(n,"pointer")},tn.touchmove=n=>{n.input.lastTouch=Date.now(),mr(n,"pointer")},tn.contextmenu=n=>Xu(n);function i0(n,e){return n.composing?!0:Hr&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const mT=ks?5e3:-1;Mt.compositionstart=Mt.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof ae&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),Sl(n,!0),n.markCursor=null;else if(Sl(n,!e.selection.empty),bl&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let a=o<0?i.lastChild:i.childNodes[o-1];if(!a)break;if(a.nodeType==3){let c=n.domSelection();c&&c.collapse(a,a.nodeValue.length);break}else i=a,o=-1}}n.input.composing=!0}s0(n,mT)},Mt.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,s0(n,20))};function s0(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Sl(n),e))}function gT(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=yT());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function yT(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Sl(n,e=!1){if(!(ks&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),gT(n),e||n.docView&&n.docView.dirty){let t=U_(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!n.state.selection.empty?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function bT(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const _s=xs&&Lg<15||Wu&&W_<604;tn.copy=Mt.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let o=_s?null:t.clipboardData,a=r.content(),{dom:c,text:f}=qg(n,a);o?(t.preventDefault(),o.clearData(),o.setData("text/html",c.innerHTML),o.setData("text/plain",f)):bT(n,c),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function vT(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function wT(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Zu(n,r.value,null,i,e):Zu(n,r.textContent,r.innerHTML,i,e)},50)}function Zu(n,e,t,r,i){let o=jg(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",f=>f(n,i,o||W.empty)))return!0;if(!o)return!1;let a=vT(o),c=a?n.state.tr.replaceSelectionWith(a,r):n.state.tr.replaceSelection(o);return n.dispatch(c.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function o0(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}Mt.paste=(n,e)=>{let t=e;if(n.composing&&!ks)return;let r=_s?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Zu(n,o0(r),r.getData("text/html"),i,t)?t.preventDefault():wT(n,t)};class ST{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const l0=Wt?"altKey":"ctrlKey";tn.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,o=i.empty?null:n.posAtCoords(wl(t)),a;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof Y?i.to-1:i.to))){if(r&&r.mightDrag)a=Y.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let p=n.docView.nearestDesc(t.target,!0);p&&p.node.type.spec.draggable&&p!=n.docView&&(a=Y.create(n.state.doc,p.posBefore))}}let c=(a||n.state.selection).content(),{dom:f,text:h,slice:m}=qg(n,c);(!t.dataTransfer.files.length||!dr||Pg>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(_s?"Text":"text/html",f.innerHTML),t.dataTransfer.effectAllowed="copyMove",_s||t.dataTransfer.setData("text/plain",h),n.dragging=new ST(m,!t[l0],a)},tn.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)},Mt.dragover=Mt.dragenter=(n,e)=>e.preventDefault(),Mt.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(wl(t));if(!i)return;let o=n.state.doc.resolve(i.pos),a=r&&r.slice;a?n.someProp("transformPasted",S=>{a=S(a,n)}):a=jg(n,o0(t.dataTransfer),_s?null:t.dataTransfer.getData("text/html"),!1,o);let c=!!(r&&!t[l0]);if(n.someProp("handleDrop",S=>S(n,t,a||W.empty,c))){t.preventDefault();return}if(!a)return;t.preventDefault();let f=a?A_(n.state.doc,o.pos,a):o.pos;f==null&&(f=o.pos);let h=n.state.tr;if(c){let{node:S}=r;S?S.replace(h):h.deleteSelection()}let m=h.mapping.map(f),p=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,g=h.doc;if(p?h.replaceRangeWith(m,m,a.content.firstChild):h.replaceRange(m,m,a),h.doc.eq(g))return;let b=h.doc.resolve(m);if(p&&Y.isSelectable(a.content.firstChild)&&b.nodeAfter&&b.nodeAfter.sameMarkup(a.content.firstChild))h.setSelection(new Y(b));else{let S=h.mapping.map(f);h.mapping.maps[h.mapping.maps.length-1].forEach((k,C,M,P)=>S=P),h.setSelection($g(n,b,h.doc.resolve(S)))}n.focus(),n.dispatch(h.setMeta("uiEvent","drop"))},tn.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Vu(n)},20))},tn.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)},tn.beforeinput=(n,e)=>{if(dr&&ks&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",o=>o(n,Og(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in Mt)tn[n]=Mt[n];function Ts(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class Aa{constructor(e,t){this.toDOM=e,this.spec=t||$r,this.side=this.spec.side||0}map(e,t,r,i){let{pos:o,deleted:a}=e.mapResult(t.from+i,this.side<0?-1:1);return a?null:new vn(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Aa&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ts(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class xr{constructor(e,t){this.attrs=e,this.spec=t||$r}map(e,t,r,i){let o=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,a=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=a?null:new vn(o,a,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof xr&&Ts(this.attrs,e.attrs)&&Ts(this.spec,e.spec)}static is(e){return e.type instanceof xr}destroy(){}}let xT=class My{constructor(e,t){this.attrs=e,this.spec=t||$r}map(e,t,r,i){let o=e.mapResult(t.from+i,1);if(o.deleted)return null;let a=e.mapResult(t.to+i,-1);return a.deleted||a.pos<=o.pos?null:new vn(o.pos-r,a.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),o;return i==t.from&&!(o=e.child(r)).isText&&i+o.nodeSize==t.to}eq(e){return this==e||e instanceof My&&Ts(this.attrs,e.attrs)&&Ts(this.spec,e.spec)}destroy(){}};class vn{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new vn(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new vn(e,e,new Aa(t,r))}static inline(e,t,r,i){return new vn(e,t,new xr(r,i))}static node(e,t,r,i){return new vn(e,t,new xT(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof xr}get widget(){return this.type instanceof Aa}}const Ci=[],$r={};class qe{constructor(e,t){this.local=e.length?e:Ci,this.children=t.length?t:Ci}static create(e,t){return t.length?xl(t,e,0,$r):ct}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,o){for(let a=0;a<this.local.length;a++){let c=this.local[a];c.from<=t&&c.to>=e&&(!o||o(c.spec))&&r.push(c.copy(c.from+i,c.to+i))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let c=this.children[a]+1;this.children[a+2].findInner(e-c,t-c,r,i+c,o)}}map(e,t,r){return this==ct||e.maps.length==0?this:this.mapInner(e,t,0,0,r||$r)}mapInner(e,t,r,i,o){let a;for(let c=0;c<this.local.length;c++){let f=this.local[c].map(e,r,i);f&&f.type.valid(t,f)?(a||(a=[])).push(f):o.onRemove&&o.onRemove(this.local[c].spec)}return this.children.length?kT(this.children,a||[],e,t,r,i,o):a?new qe(a.sort(Wr),Ci):ct}add(e,t){return t.length?this==ct?qe.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,o=0;e.forEach((c,f)=>{let h=f+r,m;if(m=c0(t,c,h)){for(i||(i=this.children.slice());o<i.length&&i[o]<f;)o+=3;i[o]==f?i[o+2]=i[o+2].addInner(c,m,h+1):i.splice(o,0,f,f+c.nodeSize,xl(m,c,h+1,$r)),o+=3}});let a=a0(o?u0(t):t,-r);for(let c=0;c<a.length;c++)a[c].type.valid(e,a[c])||a.splice(c--,1);return new qe(a.length?this.local.concat(a).sort(Wr):this.local,i||this.children)}remove(e){return e.length==0||this==ct?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let a,c=r[o]+t,f=r[o+1]+t;for(let m=0,p;m<e.length;m++)(p=e[m])&&p.from>c&&p.to<f&&(e[m]=null,(a||(a=[])).push(p));if(!a)continue;r==this.children&&(r=this.children.slice());let h=r[o+2].removeInner(a,c+1);h!=ct?r[o+2]=h:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,a;o<e.length;o++)if(a=e[o])for(let c=0;c<i.length;c++)i[c].eq(a,t)&&(i==this.local&&(i=this.local.slice()),i.splice(c--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new qe(i,r):ct}forChild(e,t){if(this==ct)return this;if(t.isLeaf)return qe.empty;let r,i;for(let c=0;c<this.children.length;c+=3)if(this.children[c]>=e){this.children[c]==e&&(r=this.children[c+2]);break}let o=e+1,a=o+t.content.size;for(let c=0;c<this.local.length;c++){let f=this.local[c];if(f.from<a&&f.to>o&&f.type instanceof xr){let h=Math.max(o,f.from)-o,m=Math.min(a,f.to)-o;h<m&&(i||(i=[])).push(f.copy(h,m))}}if(i){let c=new qe(i.sort(Wr),Ci);return r?new Xr([c,r]):c}return r||ct}eq(e){if(this==e)return!0;if(!(e instanceof qe)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Qu(this.localsInner(e))}localsInner(e){if(this==ct)return Ci;if(e.inlineContent||!this.local.some(xr.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof xr||t.push(this.local[r]);return t}forEachSet(e){e(this)}}qe.empty=new qe([],[]),qe.removeOverlap=Qu;const ct=qe.empty;class Xr{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,$r));return Xr.from(r)}forChild(e,t){if(t.isLeaf)return qe.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,t);o!=ct&&(o instanceof Xr?r=r.concat(o.members):r.push(o))}return Xr.from(r)}eq(e){if(!(e instanceof Xr)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(!t)t=o;else{r&&(t=t.slice(),r=!1);for(let a=0;a<o.length;a++)t.push(o[a])}}return t?Qu(r?t:t.sort(Wr)):Ci}static from(e){switch(e.length){case 0:return ct;case 1:return e[0];default:return new Xr(e.every(t=>t instanceof qe)?e:e.reduce((t,r)=>t.concat(r instanceof qe?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function kT(n,e,t,r,i,o,a){let c=n.slice();for(let h=0,m=o;h<t.maps.length;h++){let p=0;t.maps[h].forEach((g,b,S,k)=>{let C=k-S-(b-g);for(let M=0;M<c.length;M+=3){let P=c[M+1];if(P<0||g>P+m-p)continue;let F=c[M]+m-p;b>=F?c[M+1]=g<=F?-2:-1:g>=m&&C&&(c[M]+=C,c[M+1]+=C)}p+=C}),m=t.maps[h].map(m,-1)}let f=!1;for(let h=0;h<c.length;h+=3)if(c[h+1]<0){if(c[h+1]==-2){f=!0,c[h+1]=-1;continue}let m=t.map(n[h]+o),p=m-i;if(p<0||p>=r.content.size){f=!0;continue}let g=t.map(n[h+1]+o,-1),b=g-i,{index:S,offset:k}=r.content.findIndex(p),C=r.maybeChild(S);if(C&&k==p&&k+C.nodeSize==b){let M=c[h+2].mapInner(t,C,m+1,n[h]+o+1,a);M!=ct?(c[h]=p,c[h+1]=b,c[h+2]=M):(c[h+1]=-2,f=!0)}else f=!0}if(f){let h=ET(c,n,e,t,i,o,a),m=xl(h,r,0,a);e=m.local;for(let p=0;p<c.length;p+=3)c[p+1]<0&&(c.splice(p,3),p-=3);for(let p=0,g=0;p<m.children.length;p+=3){let b=m.children[p];for(;g<c.length&&c[g]<b;)g+=3;c.splice(g,0,m.children[p],m.children[p+1],m.children[p+2])}}return new qe(e.sort(Wr),c)}function a0(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let i=n[r];t.push(new vn(i.from+e,i.to+e,i.type))}return t}function ET(n,e,t,r,i,o,a){function c(f,h){for(let m=0;m<f.local.length;m++){let p=f.local[m].map(r,i,h);p?t.push(p):a.onRemove&&a.onRemove(f.local[m].spec)}for(let m=0;m<f.children.length;m+=3)c(f.children[m+2],f.children[m]+h+1)}for(let f=0;f<n.length;f+=3)n[f+1]==-1&&c(n[f+2],e[f]+o+1);return t}function c0(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let o=0,a;o<n.length;o++)(a=n[o])&&a.from>t&&a.to<r&&((i||(i=[])).push(a),n[o]=null);return i}function u0(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function xl(n,e,t,r){let i=[],o=!1;e.forEach((c,f)=>{let h=c0(n,c,f+t);if(h){o=!0;let m=xl(h,c,t+f+1,r);m!=ct&&i.push(f,f+c.nodeSize,m)}});let a=a0(o?u0(n):n,-t).sort(Wr);for(let c=0;c<a.length;c++)a[c].type.valid(e,a[c])||(r.onRemove&&r.onRemove(a[c].spec),a.splice(c--,1));return a.length||i.length?new qe(a,i):ct}function Wr(n,e){return n.from-e.from||n.to-e.to}function Qu(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let i=t+1;i<e.length;i++){let o=e[i];if(o.from==r.from){o.to!=r.to&&(e==n&&(e=n.slice()),e[i]=o.copy(o.from,r.to),f0(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,o.from),f0(e,i,r.copy(o.from,r.to)));break}}}return e}function f0(n,e,t){for(;e<n.length&&Wr(t,n[e])>0;)e++;n.splice(e,0,t)}for(var gr={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:"'"},kl={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},_T=typeof navigator<"u"&&/Mac/.test(navigator.platform),TT=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Qe=0;Qe<10;Qe++)gr[48+Qe]=gr[96+Qe]=String(Qe);for(var Qe=1;Qe<=24;Qe++)gr[Qe+111]="F"+Qe;for(var Qe=65;Qe<=90;Qe++)gr[Qe]=String.fromCharCode(Qe+32),kl[Qe]=String.fromCharCode(Qe);for(var ef in gr)kl.hasOwnProperty(ef)||(kl[ef]=gr[ef]);function CT(n){var e=_T&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||TT&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?kl:gr)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const MT=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function AT(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,o,a;for(let c=0;c<e.length-1;c++){let f=e[c];if(/^(cmd|meta|m)$/i.test(f))a=!0;else if(/^a(lt)?$/i.test(f))r=!0;else if(/^(c|ctrl|control)$/i.test(f))i=!0;else if(/^s(hift)?$/i.test(f))o=!0;else if(/^mod$/i.test(f))MT?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+f)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),a&&(t="Meta-"+t),o&&(t="Shift-"+t),t}function IT(n){let e=Object.create(null);for(let t in n)e[AT(t)]=n[t];return e}function tf(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function OT(n){return new at({props:{handleKeyDown:NT(n)}})}function NT(n){let e=IT(n);return function(t,r){let i=CT(r),o,a=e[tf(i,r)];if(a&&a(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let c=e[tf(i,r,!1)];if(c&&c(t.state,t.dispatch,t))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(o=gr[r.keyCode])&&o!=i){let c=e[tf(o,r)];if(c&&c(t.state,t.dispatch,t))return!0}}return!1}}const nf=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function h0(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const d0=(n,e,t)=>{let r=h0(n,t);if(!r)return!1;let i=rf(r);if(!i){let a=r.blockRange(),c=a&&xi(a);return c==null?!1:(e&&e(n.tr.lift(a,c).scrollIntoView()),!0)}let o=i.nodeBefore;if(x0(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Mi(o,"end")||Y.isSelectable(o)))for(let a=r.depth;;a--){let c=ml(n.doc,r.before(a),r.after(a),W.empty);if(c&&c.slice.size<c.to-c.from){if(e){let f=n.tr.step(c);f.setSelection(Mi(o,"end")?de.findFrom(f.doc.resolve(f.mapping.map(i.pos,-1)),-1):Y.create(f.doc,i.pos-o.nodeSize)),e(f.scrollIntoView())}return!0}if(a==1||r.node(a-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},RT=(n,e,t)=>{let r=h0(n,t);if(!r)return!1;let i=rf(r);return i?p0(n,i,e):!1},LT=(n,e,t)=>{let r=g0(n,t);if(!r)return!1;let i=sf(r);return i?p0(n,i,e):!1};function p0(n,e,t){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let m=i.lastChild;if(!m)return!1;i=m}let a=e.nodeAfter,c=a,f=e.pos+1;for(;!c.isTextblock;f++){if(c.type.spec.isolating)return!1;let m=c.firstChild;if(!m)return!1;c=m}let h=ml(n.doc,o,f,W.empty);if(!h||h.from!=o||h instanceof Je&&h.slice.size>=f-o)return!1;if(t){let m=n.tr.step(h);m.setSelection(ae.create(m.doc,o)),t(m.scrollIntoView())}return!0}function Mi(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const m0=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;o=rf(r)}let a=o&&o.nodeBefore;return!a||!Y.isSelectable(a)?!1:(e&&e(n.tr.setSelection(Y.create(n.doc,o.pos-a.nodeSize)).scrollIntoView()),!0)};function rf(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function g0(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const y0=(n,e,t)=>{let r=g0(n,t);if(!r)return!1;let i=sf(r);if(!i)return!1;let o=i.nodeAfter;if(x0(n,i,e,1))return!0;if(r.parent.content.size==0&&(Mi(o,"start")||Y.isSelectable(o))){let a=ml(n.doc,r.before(),r.after(),W.empty);if(a&&a.slice.size<a.to-a.from){if(e){let c=n.tr.step(a);c.setSelection(Mi(o,"start")?de.findFrom(c.doc.resolve(c.mapping.map(i.pos)),1):Y.create(c.doc,c.mapping.map(i.pos))),e(c.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},b0=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;o=sf(r)}let a=o&&o.nodeAfter;return!a||!Y.isSelectable(a)?!1:(e&&e(n.tr.setSelection(Y.create(n.doc,o.pos)).scrollIntoView()),!0)};function sf(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const PT=(n,e)=>{let t=n.selection,r=t instanceof Y,i;if(r){if(t.node.isTextblock||!fr(n.doc,t.from))return!1;i=t.from}else if(i=pl(n.doc,t.from,-1),i==null)return!1;if(e){let o=n.tr.join(i);r&&o.setSelection(Y.create(o.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},DT=(n,e)=>{let t=n.selection,r;if(t instanceof Y){if(t.node.isTextblock||!fr(n.doc,t.to))return!1;r=t.to}else if(r=pl(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},zT=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),o=i&&xi(i);return o==null?!1:(e&&e(n.tr.lift(i,o).scrollIntoView()),!0)},v0=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
13
+ `).scrollIntoView()),!0)};function of(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const BT=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),o=t.indexAfter(-1),a=of(i.contentMatchAt(o));if(!a||!i.canReplaceWith(o,o,a))return!1;if(e){let c=t.after(),f=n.tr.replaceWith(c,c,a.createAndFill());f.setSelection(de.near(f.doc.resolve(c),1)),e(f.scrollIntoView())}return!0},w0=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof It||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=of(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let a=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,c=n.tr.insert(a,o.createAndFill());c.setSelection(ae.create(c.doc,a+1)),e(c.scrollIntoView())}return!0},S0=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let o=t.before();if(Dn(n.doc,o))return e&&e(n.tr.split(o).scrollIntoView()),!0}let r=t.blockRange(),i=r&&xi(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};function FT(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof Y&&e.selection.node.isBlock)return!r.parentOffset||!Dn(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let o=[],a,c,f=!1,h=!1;for(let b=r.depth;;b--)if(r.node(b).isBlock){f=r.end(b)==r.pos+(r.depth-b),h=r.start(b)==r.pos-(r.depth-b),c=of(r.node(b-1).contentMatchAt(r.indexAfter(b-1))),o.unshift(f&&c?{type:c}:null),a=b;break}else{if(b==1)return!1;o.unshift(null)}let m=e.tr;(e.selection instanceof ae||e.selection instanceof It)&&m.deleteSelection();let p=m.mapping.map(r.pos),g=Dn(m.doc,p,o.length,o);if(g||(o[0]=c?{type:c}:null,g=Dn(m.doc,p,o.length,o)),m.split(p,o.length,o),!f&&h&&r.node(a).type!=c){let b=m.mapping.map(r.before(a)),S=m.doc.resolve(b);c&&r.node(a-1).canReplaceWith(S.index(),S.index()+1,c)&&m.setNodeMarkup(m.mapping.map(r.before(a)),c)}return t&&t(m.scrollIntoView()),!0}}const HT=FT(),$T=(n,e)=>{let{$from:t,to:r}=n.selection,i,o=t.sharedDepth(r);return o==0?!1:(i=t.before(o),e&&e(n.tr.setSelection(Y.create(n.doc,i))),!0)};function WT(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||fr(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function x0(n,e,t,r){let i=e.nodeBefore,o=e.nodeAfter,a,c,f=i.type.spec.isolating||o.type.spec.isolating;if(!f&&WT(n,e,t))return!0;let h=!f&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(a=(c=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&c.matchType(a[0]||o.type).validEnd){if(t){let b=e.pos+o.nodeSize,S=L.empty;for(let M=a.length-1;M>=0;M--)S=L.from(a[M].create(null,S));S=L.from(i.copy(S));let k=n.tr.step(new Ge(e.pos-1,b,e.pos,b,new W(S,1,0),a.length,!0)),C=k.doc.resolve(b+2*a.length);C.nodeAfter&&C.nodeAfter.type==i.type&&fr(k.doc,C.pos)&&k.join(C.pos),t(k.scrollIntoView())}return!0}let m=o.type.spec.isolating||r>0&&f?null:de.findFrom(e,1),p=m&&m.$from.blockRange(m.$to),g=p&&xi(p);if(g!=null&&g>=e.depth)return t&&t(n.tr.lift(p,g).scrollIntoView()),!0;if(h&&Mi(o,"start",!0)&&Mi(i,"end")){let b=i,S=[];for(;S.push(b),!b.isTextblock;)b=b.lastChild;let k=o,C=1;for(;!k.isTextblock;k=k.firstChild)C++;if(b.canReplace(b.childCount,b.childCount,k.content)){if(t){let M=L.empty;for(let F=S.length-1;F>=0;F--)M=L.from(S[F].copy(M));let P=n.tr.step(new Ge(e.pos-S.length,e.pos+o.nodeSize,e.pos+C,e.pos+o.nodeSize-C,new W(M,S.length,0),0,!0));t(P.scrollIntoView())}return!0}}return!1}function k0(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(t&&t(e.tr.setSelection(ae.create(e.doc,n<0?i.start(o):i.end(o)))),!0):!1}}const UT=k0(-1),VT=k0(1);function KT(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,a=i.blockRange(o),c=a&&Ru(a,n,e);return c?(r&&r(t.tr.wrap(a,c).scrollIntoView()),!0):!1}}function E0(n,e=null){return function(t,r){let i=!1;for(let o=0;o<t.selection.ranges.length&&!i;o++){let{$from:{pos:a},$to:{pos:c}}=t.selection.ranges[o];t.doc.nodesBetween(a,c,(f,h)=>{if(i)return!1;if(!(!f.isTextblock||f.hasMarkup(n,e)))if(f.type==n)i=!0;else{let m=t.doc.resolve(h),p=m.index();i=m.parent.canReplaceWith(p,p+1,n)}})}if(!i)return!1;if(r){let o=t.tr;for(let a=0;a<t.selection.ranges.length;a++){let{$from:{pos:c},$to:{pos:f}}=t.selection.ranges[a];o.setBlockType(c,f,n,e)}r(o.scrollIntoView())}return!0}}function lf(...n){return function(e,t,r){for(let i=0;i<n.length;i++)if(n[i](e,t,r))return!0;return!1}}lf(nf,d0,m0),lf(nf,y0,b0),lf(v0,w0,S0,HT),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function GT(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,a=i.blockRange(o);if(!a)return!1;let c=r?t.tr:null;return JT(c,a,n,e)?(r&&r(c.scrollIntoView()),!0):!1}}function JT(n,e,t,r=null){let i=!1,o=e,a=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let f=a.resolve(e.start-2);o=new cl(f,f,e.depth),e.endIndex<e.parent.childCount&&(e=new cl(e.$from,a.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let c=Ru(o,t,r,e);return c?(n&&qT(n,e,c,i,t),!0):!1}function qT(n,e,t,r,i){let o=L.empty;for(let m=t.length-1;m>=0;m--)o=L.from(t[m].type.create(t[m].attrs,o));n.step(new Ge(e.start-(r?2:0),e.end,e.start,e.end,new W(o,0,0),t.length,!0));let a=0;for(let m=0;m<t.length;m++)t[m].type==i&&(a=m+1);let c=t.length-a,f=e.start+t.length-(r?2:0),h=e.parent;for(let m=e.startIndex,p=e.endIndex,g=!0;m<p;m++,g=!1)!g&&Dn(n.doc,f,c)&&(n.split(f,c),f+=2*c),f+=h.child(m).nodeSize;return n}function jT(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,a=>a.childCount>0&&a.firstChild.type==n);return o?t?r.node(o.depth-1).type==n?YT(e,t,n,o):XT(e,t,o):!0:!1}}function YT(n,e,t,r){let i=n.tr,o=r.end,a=r.$to.end(r.depth);o<a&&(i.step(new Ge(o-1,a,o,a,new W(L.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new cl(i.doc.resolve(r.$from.pos),i.doc.resolve(a),r.depth));const c=xi(r);if(c==null)return!1;i.lift(r,c);let f=i.mapping.map(o,-1)-1;return fr(i.doc,f)&&i.join(f),e(i.scrollIntoView()),!0}function XT(n,e,t){let r=n.tr,i=t.parent;for(let b=t.end,S=t.endIndex-1,k=t.startIndex;S>k;S--)b-=i.child(S).nodeSize,r.delete(b-1,b+1);let o=r.doc.resolve(t.start),a=o.nodeAfter;if(r.mapping.map(t.end)!=t.start+o.nodeAfter.nodeSize)return!1;let c=t.startIndex==0,f=t.endIndex==i.childCount,h=o.node(-1),m=o.index(-1);if(!h.canReplace(m+(c?0:1),m+1,a.content.append(f?L.empty:L.from(i))))return!1;let p=o.pos,g=p+a.nodeSize;return r.step(new Ge(p-(c?1:0),g+(f?1:0),p+1,g-1,new W((c?L.empty:L.from(i.copy(L.empty))).append(f?L.empty:L.from(i.copy(L.empty))),c?0:1,f?0:1),c?0:1)),e(r.scrollIntoView()),!0}function ZT(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,h=>h.childCount>0&&h.firstChild.type==n);if(!o)return!1;let a=o.startIndex;if(a==0)return!1;let c=o.parent,f=c.child(a-1);if(f.type!=n)return!1;if(t){let h=f.lastChild&&f.lastChild.type==c.type,m=L.from(h?n.create():null),p=new W(L.from(n.create(null,L.from(c.type.create(null,m)))),h?3:1,0),g=o.start,b=o.end;t(e.tr.step(new Ge(g-(h?3:1),b,g,b,p,1,!0)).scrollIntoView())}return!0}}function El(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:o}=t;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 o},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,o=t.storedMarks,t}}}class af{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:r}=this,{view:i}=t,{tr:o}=r,a=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([c,f])=>[c,(...m)=>{const p=f(...m)(a);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),p}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:r,editor:i,state:o}=this,{view:a}=i,c=[],f=!!e,h=e||o.tr,m=()=>(!f&&t&&!h.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(h),c.every(g=>g===!0)),p={...Object.fromEntries(Object.entries(r).map(([g,b])=>[g,(...k)=>{const C=this.buildProps(h,t),M=b(...k)(C);return c.push(M),p}])),run:m};return p}createCan(e){const{rawCommands:t,state:r}=this,i=!1,o=e||r.tr,a=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(t).map(([f,h])=>[f,(...m)=>h(...m)({...a,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(e,t=!0){const{rawCommands:r,editor:i,state:o}=this,{view:a}=i,c={tr:e,editor:i,view:a,state:El({state:o,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([f,h])=>[f,(...m)=>h(...m)(c)]))}};return c}}function K(n,e,t){return n.config[e]===void 0&&n.parent?K(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?K(n.parent,e,t):null}):n.config[e]}function _l(n){const e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function _0(n){const e=[],{nodeExtensions:t,markExtensions:r}=_l(n),i=[...t,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(a=>{const c={name:a.name,options:a.options,storage:a.storage,extensions:i},f=K(a,"addGlobalAttributes",c);if(!f)return;f().forEach(m=>{m.types.forEach(p=>{Object.entries(m.attributes).forEach(([g,b])=>{e.push({type:p,name:g,attribute:{...o,...b}})})})})}),i.forEach(a=>{const c={name:a.name,options:a.options,storage:a.storage},f=K(a,"addAttributes",c);if(!f)return;const h=f();Object.entries(h).forEach(([m,p])=>{const g={...o,...p};typeof g?.default=="function"&&(g.default=g.default()),g?.isRequired&&g?.default===void 0&&delete g.default,e.push({type:a.name,name:m,attribute:g})})}),e}function Ue(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}function Ai(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){const c=o?String(o).split(" "):[],f=r[i]?r[i].split(" "):[],h=c.filter(m=>!f.includes(m));r[i]=[...f,...h].join(" ")}else if(i==="style"){const c=o?o.split(";").map(m=>m.trim()).filter(Boolean):[],f=r[i]?r[i].split(";").map(m=>m.trim()).filter(Boolean):[],h=new Map;f.forEach(m=>{const[p,g]=m.split(":").map(b=>b.trim());h.set(p,g)}),c.forEach(m=>{const[p,g]=m.split(":").map(b=>b.trim());h.set(p,g)}),r[i]=Array.from(h.entries()).map(([m,p])=>`${m}: ${p}`).join("; ")}else r[i]=o}),r},{})}function cf(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>Ai(t,r),{})}function QT(n){return typeof n=="function"}function le(n,e=void 0,...t){return QT(n)?e?n.bind(e)(...t):n(...t):n}function eC(n={}){return Object.keys(n).length===0&&n.constructor===Object}function tC(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function T0(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((o,a)=>{const c=a.attribute.parseHTML?a.attribute.parseHTML(t):tC(t.getAttribute(a.name));return c==null?o:{...o,[a.name]:c}},{});return{...r,...i}}}}function C0(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&eC(t)?!1:t!=null))}function M0(n,e){var t;const r=_0(n),{nodeExtensions:i,markExtensions:o}=_l(n),a=(t=i.find(h=>K(h,"topNode")))===null||t===void 0?void 0:t.name,c=Object.fromEntries(i.map(h=>{const m=r.filter(M=>M.type===h.name),p={name:h.name,options:h.options,storage:h.storage,editor:e},g=n.reduce((M,P)=>{const F=K(P,"extendNodeSchema",p);return{...M,...F?F(h):{}}},{}),b=C0({...g,content:le(K(h,"content",p)),marks:le(K(h,"marks",p)),group:le(K(h,"group",p)),inline:le(K(h,"inline",p)),atom:le(K(h,"atom",p)),selectable:le(K(h,"selectable",p)),draggable:le(K(h,"draggable",p)),code:le(K(h,"code",p)),whitespace:le(K(h,"whitespace",p)),linebreakReplacement:le(K(h,"linebreakReplacement",p)),defining:le(K(h,"defining",p)),isolating:le(K(h,"isolating",p)),attrs:Object.fromEntries(m.map(M=>{var P;return[M.name,{default:(P=M?.attribute)===null||P===void 0?void 0:P.default}]}))}),S=le(K(h,"parseHTML",p));S&&(b.parseDOM=S.map(M=>T0(M,m)));const k=K(h,"renderHTML",p);k&&(b.toDOM=M=>k({node:M,HTMLAttributes:cf(M,m)}));const C=K(h,"renderText",p);return C&&(b.toText=C),[h.name,b]})),f=Object.fromEntries(o.map(h=>{const m=r.filter(C=>C.type===h.name),p={name:h.name,options:h.options,storage:h.storage,editor:e},g=n.reduce((C,M)=>{const P=K(M,"extendMarkSchema",p);return{...C,...P?P(h):{}}},{}),b=C0({...g,inclusive:le(K(h,"inclusive",p)),excludes:le(K(h,"excludes",p)),group:le(K(h,"group",p)),spanning:le(K(h,"spanning",p)),code:le(K(h,"code",p)),attrs:Object.fromEntries(m.map(C=>{var M;return[C.name,{default:(M=C?.attribute)===null||M===void 0?void 0:M.default}]}))}),S=le(K(h,"parseHTML",p));S&&(b.parseDOM=S.map(C=>T0(C,m)));const k=K(h,"renderHTML",p);return k&&(b.toDOM=C=>k({mark:C,HTMLAttributes:cf(C,m)})),[h.name,b]}));return new Zm({topNode:a,nodes:c,marks:f})}function uf(n,e){return e.nodes[n]||e.marks[n]||null}function A0(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function I0(n,e){const t=Ws.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}const nC=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,o,a,c)=>{var f,h;const m=((h=(f=i.type.spec).toText)===null||h===void 0?void 0:h.call(f,{node:i,pos:o,parent:a,index:c}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?m:m.slice(0,Math.max(0,r-o))}),t};function ff(n){return Object.prototype.toString.call(n)==="[object RegExp]"}class O0{constructor(e){this.find=e.find,this.handler=e.handler}}const rC=(n,e)=>{if(ff(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function Tl(n){var e;const{editor:t,from:r,to:i,text:o,rules:a,plugin:c}=n,{view:f}=t;if(f.composing)return!1;const h=f.state.doc.resolve(r);if(h.parent.type.spec.code||!((e=h.nodeBefore||h.nodeAfter)===null||e===void 0)&&e.marks.find(g=>g.type.spec.code))return!1;let m=!1;const p=nC(h)+o;return a.forEach(g=>{if(m)return;const b=rC(p,g.find);if(!b)return;const S=f.state.tr,k=El({state:f.state,transaction:S}),C={from:r-(b[0].length-o.length),to:i},{commands:M,chain:P,can:F}=new af({editor:t,state:k});g.handler({state:k,range:C,match:b,commands:M,chain:P,can:F})===null||!S.steps.length||(S.setMeta(c,{transform:S,from:r,to:i,text:o}),f.dispatch(S),m=!0)}),m}function iC(n){const{editor:e,rules:t}=n,r=new at({state:{init(){return null},apply(i,o,a){const c=i.getMeta(r);if(c)return c;const f=i.getMeta("applyInputRules");return!!f&&setTimeout(()=>{let{text:m}=f;typeof m=="string"?m=m:m=I0(L.from(m),a.schema);const{from:p}=f,g=p+m.length;Tl({editor:e,from:p,to:g,text:m,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,a,c){return Tl({editor:e,from:o,to:a,text:c,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&Tl({editor:e,from:o.pos,to:o.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:a}=i.state.selection;return a?Tl({editor:e,from:a.pos,to:a.pos,text:`
14
+ `,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function sC(n){return Object.prototype.toString.call(n).slice(8,-1)}function Cl(n){return sC(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Ml(n,e){const t={...n};return Cl(n)&&Cl(e)&&Object.keys(e).forEach(r=>{Cl(e[r])&&Cl(n[r])?t[r]=Ml(n[r],e[r]):t[r]=e[r]}),t}class At{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=le(K(this,"addOptions",{name:this.name}))),this.storage=le(K(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new At(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Ml(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new At(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=le(K(t,"addOptions",{name:t.name})),t.storage=le(K(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const a=i.marks();if(!!!a.find(h=>h?.type.name===t.name))return!1;const f=a.find(h=>h?.type.name===t.name);return f&&r.removeStoredMark(f),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}function oC(n){return typeof n=="number"}class lC{constructor(e){this.find=e.find,this.handler=e.handler}}const aC=(n,e,t)=>{if(ff(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(i=>{const o=[i.text];return o.index=i.index,o.input=n,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function cC(n){const{editor:e,state:t,from:r,to:i,rule:o,pasteEvent:a,dropEvent:c}=n,{commands:f,chain:h,can:m}=new af({editor:e,state:t}),p=[];return t.doc.nodesBetween(r,i,(b,S)=>{if(!b.isTextblock||b.type.spec.code)return;const k=Math.max(r,S),C=Math.min(i,S+b.content.size),M=b.textBetween(k-S,C-S,void 0,"\uFFFC");aC(M,o.find,a).forEach(F=>{if(F.index===void 0)return;const $=k+F.index+1,U=$+F[0].length,ce={from:t.tr.mapping.map($),to:t.tr.mapping.map(U)},fe=o.handler({state:t,range:ce,match:F,commands:f,chain:h,can:m,pasteEvent:a,dropEvent:c});p.push(fe)})}),p.every(b=>b!==null)}let Al=null;const uC=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)===null||e===void 0||e.setData("text/html",n),t};function fC(n){const{editor:e,rules:t}=n;let r=null,i=!1,o=!1,a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const f=({state:m,from:p,to:g,rule:b,pasteEvt:S})=>{const k=m.tr,C=El({state:m,transaction:k});if(!(!cC({editor:e,state:C,from:Math.max(p-1,0),to:g.b-1,rule:b,pasteEvent:S,dropEvent:c})||!k.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,k}};return t.map(m=>new at({view(p){const g=S=>{var k;r=!((k=p.dom.parentElement)===null||k===void 0)&&k.contains(S.target)?p.dom.parentElement:null,r&&(Al=e)},b=()=>{Al&&(Al=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",b),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",b)}}},props:{handleDOMEvents:{drop:(p,g)=>{if(o=r===p.dom.parentElement,c=g,!o){const b=Al;b&&setTimeout(()=>{const S=b.state.selection;S&&b.commands.deleteRange({from:S.from,to:S.to})},10)}return!1},paste:(p,g)=>{var b;const S=(b=g.clipboardData)===null||b===void 0?void 0:b.getData("text/html");return a=g,i=!!S?.includes("data-pm-slice"),!1}}},appendTransaction:(p,g,b)=>{const S=p[0],k=S.getMeta("uiEvent")==="paste"&&!i,C=S.getMeta("uiEvent")==="drop"&&!o,M=S.getMeta("applyPasteRules"),P=!!M;if(!k&&!C&&!P)return;if(P){let{text:U}=M;typeof U=="string"?U=U:U=I0(L.from(U),b.schema);const{from:ce}=M,fe=ce+U.length,be=uC(U);return f({rule:m,state:b,from:ce,to:{b:fe},pasteEvt:be})}const F=g.doc.content.findDiffStart(b.doc.content),$=g.doc.content.findDiffEnd(b.doc.content);if(!(!oC(F)||!$||F===$.b))return f({rule:m,state:b,from:F,to:$,pasteEvt:a})}}))}function hC(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}class Pi{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=Pi.resolve(e),this.schema=M0(this.extensions,t),this.setupExtensions()}static resolve(e){const t=Pi.sort(Pi.flatten(e)),r=hC(t.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),t}static flatten(e){return e.map(t=>{const r={name:t.name,options:t.options,storage:t.storage},i=K(t,"addExtensions",r);return i?[t,...this.flatten(i())]:t}).flat(10)}static sort(e){return e.sort((r,i)=>{const o=K(r,"priority")||100,a=K(i,"priority")||100;return o>a?-1:o<a?1:0})}get commands(){return this.extensions.reduce((e,t)=>{const r={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:uf(t.name,this.schema)},i=K(t,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,t=Pi.sort([...this.extensions].reverse()),r=[],i=[],o=t.map(a=>{const c={name:a.name,options:a.options,storage:a.storage,editor:e,type:uf(a.name,this.schema)},f=[],h=K(a,"addKeyboardShortcuts",c);let m={};if(a.type==="mark"&&K(a,"exitable",c)&&(m.ArrowRight=()=>At.handleExit({editor:e,mark:a})),h){const k=Object.fromEntries(Object.entries(h()).map(([C,M])=>[C,()=>M({editor:e})]));m={...m,...k}}const p=OT(m);f.push(p);const g=K(a,"addInputRules",c);A0(a,e.options.enableInputRules)&&g&&r.push(...g());const b=K(a,"addPasteRules",c);A0(a,e.options.enablePasteRules)&&b&&i.push(...b());const S=K(a,"addProseMirrorPlugins",c);if(S){const k=S();f.push(...k)}return f}).flat();return[iC({editor:e,rules:r}),...fC({editor:e,rules:i}),...o]}get attributes(){return _0(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=_l(this.extensions);return Object.fromEntries(t.filter(r=>!!K(r,"addNodeView")).map(r=>{const i=this.attributes.filter(f=>f.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:e,type:Ue(r.name,this.schema)},a=K(r,"addNodeView",o);if(!a)return[];const c=(f,h,m,p,g)=>{const b=cf(f,i);return a()({node:f,view:h,getPos:m,decorations:p,innerDecorations:g,editor:e,extension:r,HTMLAttributes:b})};return[r.name,c]}))}setupExtensions(){this.extensions.forEach(e=>{var t;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:uf(e.name,this.schema)};e.type==="mark"&&(!((t=le(K(e,"keepOnSplit",r)))!==null&&t!==void 0)||t)&&this.splittableMarks.push(e.name);const i=K(e,"onBeforeCreate",r),o=K(e,"onCreate",r),a=K(e,"onUpdate",r),c=K(e,"onSelectionUpdate",r),f=K(e,"onTransaction",r),h=K(e,"onFocus",r),m=K(e,"onBlur",r),p=K(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),a&&this.editor.on("update",a),c&&this.editor.on("selectionUpdate",c),f&&this.editor.on("transaction",f),h&&this.editor.on("focus",h),m&&this.editor.on("blur",m),p&&this.editor.on("destroy",p)})}}class Ie{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=le(K(this,"addOptions",{name:this.name}))),this.storage=le(K(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ie(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Ml(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Ie({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=le(K(t,"addOptions",{name:t.name})),t.storage=le(K(t,"addStorage",{name:t.name,options:t.options})),t}}function dC(n,e,t){const{from:r,to:i}=e,{blockSeparator:o=`
15
15
 
16
- `,textSerializers:a={}}=t||{};let u="";return n.nodesBetween(r,i,(f,d,m,p)=>{var g;f.isBlock&&d>r&&(u+=o);const b=a?.[f.type.name];if(b)return m&&(u+=b({node:f,pos:d,parent:m,index:p,range:e})),!1;f.isText&&(u+=(g=f?.text)===null||g===void 0?void 0:g.slice(Math.max(r,d)-d,i-d))}),u}function mC(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}Ie.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new lt({key:new Tt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:o}=i,a=Math.min(...o.map(m=>m.$from.pos)),u=Math.max(...o.map(m=>m.$to.pos)),f=mC(t);return pC(r,{from:a,to:u},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:f})}}})]}});const gC=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())===null||t===void 0||t.removeAllRanges())}),!0),yC=(n=!1)=>({commands:e})=>e.setContent("",n),bC=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:o,$to:a})=>{n.doc.nodesBetween(o.pos,a.pos,(u,f)=>{if(u.type.isText)return;const{doc:d,mapping:m}=e,p=d.resolve(m.map(f)),g=d.resolve(m.map(f+u.nodeSize)),b=p.blockRange(g);if(!b)return;const x=Ei(b);if(u.type.isTextblock){const{defaultType:E}=p.parent.contentMatchAt(p.index());e.setNodeMarkup(b.start,E)}(x||x===0)&&e.lift(b,x)})}),!0},wC=n=>e=>n(e),SC=()=>({state:n,dispatch:e})=>S0(n,e),xC=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,o=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const a=r.mapping.map(e);return r.insert(a,o.content),r.setSelection(new ae(r.doc.resolve(a-1))),!0},kC=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const i=n.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){const u=i.before(o),f=i.after(o);n.delete(u,f).scrollIntoView()}return!0}return!1},EC=n=>({tr:e,state:t,dispatch:r})=>{const i=We(n,t.schema),o=e.selection.$anchor;for(let a=o.depth;a>0;a-=1)if(o.node(a).type===i){if(r){const f=o.before(a),d=o.after(a);e.delete(f,d).scrollIntoView()}return!0}return!1},_C=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},vC=()=>({state:n,dispatch:e})=>rf(n,e),TC=()=>({commands:n})=>n.keyboardShortcut("Enter"),CC=()=>({state:n,dispatch:e})=>FT(n,e);function Ol(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:df(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function N0(n,e,t={}){return n.find(r=>r.type===e&&Ol(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function R0(n,e,t={}){return!!N0(n,e,t)}function hf(n,e,t){var r;if(!n||!e)return;let i=n.parent.childAfter(n.parentOffset);if((!i.node||!i.node.marks.some(m=>m.type===e))&&(i=n.parent.childBefore(n.parentOffset)),!i.node||!i.node.marks.some(m=>m.type===e)||(t=t||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!N0([...i.node.marks],e,t)))return;let a=i.index,u=n.start()+i.offset,f=a+1,d=u+i.node.nodeSize;for(;a>0&&R0([...n.parent.child(a-1).marks],e,t);)a-=1,u-=n.parent.child(a).nodeSize;for(;f<n.parent.childCount&&R0([...n.parent.child(f).marks],e,t);)d+=n.parent.child(f).nodeSize,f+=1;return{from:u,to:d}}function dn(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}const MC=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const o=dn(n,r.schema),{doc:a,selection:u}=t,{$from:f,from:d,to:m}=u;if(i){const p=hf(f,o,e);if(p&&p.from<=d&&p.to>=m){const g=ae.create(a,p.from,p.to);t.setSelection(g)}}return!0},AC=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function L0(n){return n instanceof ae}function Vr(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function IC(n,e=null){if(!e)return null;const t=pe.atStart(n),r=pe.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const i=t.from,o=r.to;return e==="all"?ae.create(n,Vr(0,i,o),Vr(n.content.size,i,o)):ae.create(n,Vr(e,i,o),Vr(e,i,o))}function OC(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function pf(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const NC=(n=null,e={})=>({editor:t,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const a=()=>{(pf()||OC())&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(o&&n===null&&!L0(t.state.selection))return a(),!0;const u=IC(i.doc,n)||t.state.selection,f=t.state.selection.eq(u);return o&&(f||i.setSelection(u),f&&i.storedMarks&&i.setStoredMarks(i.storedMarks),a()),!0},RC=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),LC=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),P0=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&P0(r)}return n};function Nl(n){const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return P0(t)}function Rl(n,e,t){if(n instanceof fr||n instanceof L)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return L.fromArray(n.map(u=>e.nodeFromJSON(u)));const a=e.nodeFromJSON(n);return t.errorOnInvalidContent&&a.check(),a}catch(o){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",o),Rl("",e,t)}if(i){if(t.errorOnInvalidContent){let a=!1,u="";const f=new Zm({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:d=>(a=!0,u=typeof d=="string"?d:d.outerHTML,null)}]}})});if(t.slice?ws.fromSchema(f).parseSlice(Nl(n),t.parseOptions):ws.fromSchema(f).parse(Nl(n),t.parseOptions),t.errorOnInvalidContent&&a)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${u}`)})}const o=ws.fromSchema(e);return t.slice?o.parseSlice(Nl(n),t.parseOptions).content:o.parse(Nl(n),t.parseOptions)}return Rl("",e,t)}function PC(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof Ge||i instanceof Ke))return;const o=n.mapping.maps[r];let a=0;o.forEach((u,f,d,m)=>{a===0&&(a=m)}),n.setSelection(pe.near(n.doc.resolve(a),t))}const DC=n=>!("type"in n),zC=(n,e,t)=>({tr:r,dispatch:i,editor:o})=>{var a;if(i){t={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let u;try{u=Rl(e,o.schema,{parseOptions:{preserveWhitespace:"full",...t.parseOptions},errorOnInvalidContent:(a=t.errorOnInvalidContent)!==null&&a!==void 0?a:o.options.enableContentCheck})}catch(x){return o.emit("contentError",{editor:o,error:x,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}}),!1}let{from:f,to:d}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},m=!0,p=!0;if((DC(u)?u:[u]).forEach(x=>{x.check(),m=m?x.isText&&x.marks.length===0:!1,p=p?x.isBlock:!1}),f===d&&p){const{parent:x}=r.doc.resolve(f);x.isTextblock&&!x.type.spec.code&&!x.childCount&&(f-=1,d+=1)}let b;if(m){if(Array.isArray(e))b=e.map(x=>x.text||"").join("");else if(e instanceof L){let x="";e.forEach(E=>{E.text&&(x+=E.text)}),b=x}else typeof e=="object"&&e&&e.text?b=e.text:b=e;r.insertText(b,f,d)}else b=u,r.replaceWith(f,d,b);t.updateSelection&&PC(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:f,text:b}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:f,text:b})}return!0},BC=()=>({state:n,dispatch:e})=>DT(n,e),FC=()=>({state:n,dispatch:e})=>zT(n,e),HC=()=>({state:n,dispatch:e})=>h0(n,e),$C=()=>({state:n,dispatch:e})=>y0(n,e),WC=()=>({state:n,dispatch:e,tr:t})=>{try{const r=ml(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},UC=()=>({state:n,dispatch:e,tr:t})=>{try{const r=ml(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},VC=()=>({state:n,dispatch:e})=>LT(n,e),KC=()=>({state:n,dispatch:e})=>PT(n,e);function D0(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function GC(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,o,a;for(let u=0;u<e.length-1;u+=1){const f=e[u];if(/^(cmd|meta|m)$/i.test(f))a=!0;else if(/^a(lt)?$/i.test(f))r=!0;else if(/^(c|ctrl|control)$/i.test(f))i=!0;else if(/^s(hift)?$/i.test(f))o=!0;else if(/^mod$/i.test(f))pf()||D0()?a=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${f}`)}return r&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),a&&(t=`Meta-${t}`),o&&(t=`Shift-${t}`),t}const JC=n=>({editor:e,view:t,tr:r,dispatch:i})=>{const o=GC(n).split(/-(?!$)/),a=o.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),u=new KeyboardEvent("keydown",{key:a==="Space"?" ":a,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),f=e.captureTransaction(()=>{t.someProp("handleKeyDown",d=>d(t,u))});return f?.steps.forEach(d=>{const m=d.map(r.mapping);m&&i&&r.maybeStep(m)}),!0};function mf(n,e,t={}){const{from:r,to:i,empty:o}=n.selection,a=e?We(e,n.schema):null,u=[];n.doc.nodesBetween(r,i,(p,g)=>{if(p.isText)return;const b=Math.max(r,g),x=Math.min(i,g+p.nodeSize);u.push({node:p,from:b,to:x})});const f=i-r,d=u.filter(p=>a?a.name===p.node.type.name:!0).filter(p=>Ol(p.node.attrs,t,{strict:!1}));return o?!!d.length:d.reduce((p,g)=>p+g.to-g.from,0)>=f}const qC=(n,e={})=>({state:t,dispatch:r})=>{const i=We(n,t.schema);return mf(t,i,e)?BT(t,r):!1},jC=()=>({state:n,dispatch:e})=>x0(n,e),YC=n=>({state:e,dispatch:t})=>{const r=We(n,e.schema);return YT(r)(e,t)},XC=()=>({state:n,dispatch:e})=>w0(n,e);function gf(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function z0(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}const ZC=(n,e)=>({tr:t,state:r,dispatch:i})=>{let o=null,a=null;const u=gf(typeof n=="string"?n:n.name,r.schema);return u?(u==="node"&&(o=We(n,r.schema)),u==="mark"&&(a=dn(n,r.schema)),i&&t.selection.ranges.forEach(f=>{r.doc.nodesBetween(f.$from.pos,f.$to.pos,(d,m)=>{o&&o===d.type&&t.setNodeMarkup(m,void 0,z0(d.attrs,e)),a&&d.marks.length&&d.marks.forEach(p=>{a===p.type&&t.addMark(m,m+d.nodeSize,a.create(z0(p.attrs,e)))})})}),!0):!1},QC=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),eM=()=>({tr:n,dispatch:e})=>{if(e){const t=new At(n.doc);n.setSelection(t)}return!0},tM=()=>({state:n,dispatch:e})=>m0(n,e),nM=()=>({state:n,dispatch:e})=>b0(n,e),rM=()=>({state:n,dispatch:e})=>WT(n,e),iM=()=>({state:n,dispatch:e})=>KT(n,e),sM=()=>({state:n,dispatch:e})=>VT(n,e);function oM(n,e,t={},r={}){return Rl(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}const lM=(n,e=!1,t={},r={})=>({editor:i,tr:o,dispatch:a,commands:u})=>{var f,d;const{doc:m}=o;if(t.preserveWhitespace!=="full"){const p=oM(n,i.schema,t,{errorOnInvalidContent:(f=r.errorOnInvalidContent)!==null&&f!==void 0?f:i.options.enableContentCheck});return a&&o.replaceWith(0,m.content.size,p).setMeta("preventUpdate",!e),!0}return a&&o.setMeta("preventUpdate",!e),u.insertContentAt({from:0,to:m.content.size},n,{parseOptions:t,errorOnInvalidContent:(d=r.errorOnInvalidContent)!==null&&d!==void 0?d:i.options.enableContentCheck})};function B0(n,e){const t=dn(e,n.schema),{from:r,to:i,empty:o}=n.selection,a=[];o?(n.storedMarks&&a.push(...n.storedMarks),a.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,f=>{a.push(...f.marks)});const u=a.find(f=>f.type.name===t.name);return u?{...u.attrs}:{}}function aM(n,e){const t=new zv(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function uM(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function cM(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,o)=>{t(i)&&r.push({node:i,pos:o})}),r}function fM(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function yf(n){return e=>fM(e.$from,n)}function dM(n,e){const t=Di.resolve(n);return M0(t,e)}function hM(n,e){const t=We(e,n.schema),{from:r,to:i}=n.selection,o=[];n.doc.nodesBetween(r,i,u=>{o.push(u)});const a=o.reverse().find(u=>u.type.name===t.name);return a?{...a.attrs}:{}}function pM(n,e){const t=gf(typeof e=="string"?e:e.name,n.schema);return t==="node"?hM(n,e):t==="mark"?B0(n,e):{}}function mM(n,e=JSON.stringify){const t={};return n.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function gM(n){const e=mM(n);return e.length===1?e:e.filter((t,r)=>!e.filter((o,a)=>a!==r).some(o=>t.oldRange.from>=o.oldRange.from&&t.oldRange.to<=o.oldRange.to&&t.newRange.from>=o.newRange.from&&t.newRange.to<=o.newRange.to))}function yM(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,o)=>{const a=[];if(i.ranges.length)i.forEach((u,f)=>{a.push({from:u,to:f})});else{const{from:u,to:f}=t[o];if(u===void 0||f===void 0)return;a.push({from:u,to:f})}a.forEach(({from:u,to:f})=>{const d=e.slice(o).map(u,-1),m=e.slice(o).map(f),p=e.invert().map(d,-1),g=e.invert().map(m);r.push({oldRange:{from:p,to:g},newRange:{from:d,to:m}})})}),gM(r)}function F0(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const o=t.resolve(n),a=hf(o,i.type);a&&r.push({mark:i,...a})}):t.nodesBetween(n,e,(i,o)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(a=>({from:o,to:o+i.nodeSize,mark:a})))}),r}function Ll(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}function bM(n,e,t={}){const{empty:r,ranges:i}=n.selection,o=e?dn(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(p=>o?o.name===p.type.name:!0).find(p=>Ol(p.attrs,t,{strict:!1}));let a=0;const u=[];if(i.forEach(({$from:p,$to:g})=>{const b=p.pos,x=g.pos;n.doc.nodesBetween(b,x,(E,C)=>{if(!E.isText&&!E.marks.length)return;const M=Math.max(b,C),P=Math.min(x,C+E.nodeSize),F=P-M;a+=F,u.push(...E.marks.map($=>({mark:$,from:M,to:P})))})}),a===0)return!1;const f=u.filter(p=>o?o.name===p.mark.type.name:!0).filter(p=>Ol(p.mark.attrs,t,{strict:!1})).reduce((p,g)=>p+g.to-g.from,0),d=u.filter(p=>o?p.mark.type!==o&&p.mark.type.excludes(o):!0).reduce((p,g)=>p+g.to-g.from,0);return(f>0?f+d:f)>=a}function H0(n,e){const{nodeExtensions:t}=Tl(e),r=t.find(a=>a.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=le(K(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function $0(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!==null&&r!==void 0?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let i=!0;return n.content.forEach(o=>{i!==!1&&($0(o,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function wM(n,e,t){var r;const{selection:i}=e;let o=null;if(L0(i)&&(o=i.$cursor),o){const u=(r=n.storedMarks)!==null&&r!==void 0?r:o.marks();return!!t.isInSet(u)||!u.some(f=>f.type.excludes(t))}const{ranges:a}=i;return a.some(({$from:u,$to:f})=>{let d=u.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(u.pos,f.pos,(m,p,g)=>{if(d)return!1;if(m.isInline){const b=!g||g.type.allowsMarkType(t),x=!!t.isInSet(m.marks)||!m.marks.some(E=>E.type.excludes(t));d=b&&x}return!d}),d})}const SM=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:o}=t,{empty:a,ranges:u}=o,f=dn(n,r.schema);if(i)if(a){const d=B0(r,f);t.addStoredMark(f.create({...d,...e}))}else u.forEach(d=>{const m=d.$from.pos,p=d.$to.pos;r.doc.nodesBetween(m,p,(g,b)=>{const x=Math.max(b,m),E=Math.min(b+g.nodeSize,p);g.marks.find(M=>M.type===f)?g.marks.forEach(M=>{f===M.type&&t.addMark(x,E,f.create({...M.attrs,...e}))}):t.addMark(x,E,f.create(e))})});return wM(r,t,f)},xM=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),kM=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const o=We(n,t.schema);let a;return t.selection.$anchor.sameParent(t.selection.$head)&&(a=t.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:u})=>_0(o,{...a,...e})(t)?!0:u.clearNodes()).command(({state:u})=>_0(o,{...a,...e})(u,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},EM=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=Vr(n,0,r.content.size),o=Y.create(r,i);e.setSelection(o)}return!0},_M=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:o}=typeof n=="number"?{from:n,to:n}:n,a=ae.atStart(r).from,u=ae.atEnd(r).to,f=Vr(i,a,u),d=Vr(o,a,u),m=ae.create(r,f,d);e.setSelection(m)}return!0},vM=n=>({state:e,dispatch:t})=>{const r=We(n,e.schema);return QT(r)(e,t)};function W0(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(i=>e?.includes(i.type.name));n.tr.ensureMarks(r)}}const TM=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:o,doc:a}=e,{$from:u,$to:f}=o,d=i.extensionManager.attributes,m=Ll(d,u.node().type.name,u.node().attrs);if(o instanceof Y&&o.node.isBlock)return!u.parentOffset||!Pn(a,u.pos)?!1:(r&&(n&&W0(t,i.extensionManager.splittableMarks),e.split(u.pos).scrollIntoView()),!0);if(!u.parent.isBlock)return!1;const p=f.parentOffset===f.parent.content.size,g=u.depth===0?void 0:uM(u.node(-1).contentMatchAt(u.indexAfter(-1)));let b=p&&g?[{type:g,attrs:m}]:void 0,x=Pn(e.doc,e.mapping.map(u.pos),1,b);if(!b&&!x&&Pn(e.doc,e.mapping.map(u.pos),1,g?[{type:g}]:void 0)&&(x=!0,b=g?[{type:g,attrs:m}]:void 0),r){if(x&&(o instanceof ae&&e.deleteSelection(),e.split(e.mapping.map(u.pos),1,b),g&&!p&&!u.parentOffset&&u.parent.type!==g)){const E=e.mapping.map(u.before()),C=e.doc.resolve(E);u.node(-1).canReplaceWith(C.index(),C.index()+1,g)&&e.setNodeMarkup(e.mapping.map(u.before()),g)}n&&W0(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return x},CM=(n,e={})=>({tr:t,state:r,dispatch:i,editor:o})=>{var a;const u=We(n,r.schema),{$from:f,$to:d}=r.selection,m=r.selection.node;if(m&&m.isBlock||f.depth<2||!f.sameParent(d))return!1;const p=f.node(-1);if(p.type!==u)return!1;const g=o.extensionManager.attributes;if(f.parent.content.size===0&&f.node(-1).childCount===f.indexAfter(-1)){if(f.depth===2||f.node(-3).type!==u||f.index(-2)!==f.node(-2).childCount-1)return!1;if(i){let M=L.empty;const P=f.index(-1)?1:f.index(-2)?2:3;for(let we=f.depth-P;we>=f.depth-3;we-=1)M=L.from(f.node(we).copy(M));const F=f.indexAfter(-1)<f.node(-2).childCount?1:f.indexAfter(-2)<f.node(-3).childCount?2:3,$={...Ll(g,f.node().type.name,f.node().attrs),...e},U=((a=u.contentMatch.defaultType)===null||a===void 0?void 0:a.createAndFill($))||void 0;M=M.append(L.from(u.createAndFill(null,U)||void 0));const ue=f.before(f.depth-(P-1));t.replace(ue,f.after(-F),new W(M,4-P,0));let fe=-1;t.doc.nodesBetween(ue,t.doc.content.size,(we,yt)=>{if(fe>-1)return!1;we.isTextblock&&we.content.size===0&&(fe=yt+1)}),fe>-1&&t.setSelection(ae.near(t.doc.resolve(fe))),t.scrollIntoView()}return!0}const b=d.pos===f.end()?p.contentMatchAt(0).defaultType:null,x={...Ll(g,p.type.name,p.attrs),...e},E={...Ll(g,f.node().type.name,f.node().attrs),...e};t.delete(f.pos,d.pos);const C=b?[{type:u,attrs:x},{type:b,attrs:E}]:[{type:u,attrs:x}];if(!Pn(t.doc,f.pos,2))return!1;if(i){const{selection:M,storedMarks:P}=r,{splittableMarks:F}=o.extensionManager,$=P||M.$to.parentOffset&&M.$from.marks();if(t.split(f.pos,2,C).scrollIntoView(),!$||!i)return!0;const U=$.filter(ue=>F.includes(ue.type.name));t.ensureMarks(U)}return!0},bf=(n,e)=>{const t=yf(a=>a.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&dr(n.doc,t.pos)&&n.join(t.pos),!0},wf=(n,e)=>{const t=yf(a=>a.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&dr(n.doc,r)&&n.join(r),!0},MM=(n,e,t,r={})=>({editor:i,tr:o,state:a,dispatch:u,chain:f,commands:d,can:m})=>{const{extensions:p,splittableMarks:g}=i.extensionManager,b=We(n,a.schema),x=We(e,a.schema),{selection:E,storedMarks:C}=a,{$from:M,$to:P}=E,F=M.blockRange(P),$=C||E.$to.parentOffset&&E.$from.marks();if(!F)return!1;const U=yf(ue=>H0(ue.type.name,p))(E);if(F.depth>=1&&U&&F.depth-U.depth<=1){if(U.node.type===b)return d.liftListItem(x);if(H0(U.node.type.name,p)&&b.validContent(U.node.content)&&u)return f().command(()=>(o.setNodeMarkup(U.pos,b),!0)).command(()=>bf(o,b)).command(()=>wf(o,b)).run()}return!t||!$||!u?f().command(()=>m().wrapInList(b,r)?!0:d.clearNodes()).wrapInList(b,r).command(()=>bf(o,b)).command(()=>wf(o,b)).run():f().command(()=>{const ue=m().wrapInList(b,r),fe=$.filter(we=>g.includes(we.type.name));return o.ensureMarks(fe),ue?!0:d.clearNodes()}).wrapInList(b,r).command(()=>bf(o,b)).command(()=>wf(o,b)).run()},AM=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=t,a=dn(n,r.schema);return bM(r,a,e)?i.unsetMark(a,{extendEmptyMarkRange:o}):i.setMark(a,e)},IM=(n,e,t={})=>({state:r,commands:i})=>{const o=We(n,r.schema),a=We(e,r.schema),u=mf(r,o,t);let f;return r.selection.$anchor.sameParent(r.selection.$head)&&(f=r.selection.$anchor.parent.attrs),u?i.setNode(a,f):i.setNode(o,{...f,...t})},OM=(n,e={})=>({state:t,commands:r})=>{const i=We(n,t.schema);return mf(t,i,e)?r.lift(i):r.wrapIn(i,e)},NM=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const i=t[r];let o;if(i.spec.isInputRules&&(o=i.getState(n))){if(e){const a=n.tr,u=o.transform;for(let f=u.steps.length-1;f>=0;f-=1)a.step(u.steps[f].invert(u.docs[f]));if(o.text){const f=a.doc.resolve(o.from).marks();a.replaceWith(o.from,o.to,n.schema.text(o.text,f))}else a.delete(o.from,o.to)}return!0}}return!1},RM=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(o=>{n.removeMark(o.$from.pos,o.$to.pos)}),!0},LM=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:a=!1}=e,{selection:u}=t,f=dn(n,r.schema),{$from:d,empty:m,ranges:p}=u;if(!i)return!0;if(m&&a){let{from:g,to:b}=u;const x=(o=d.marks().find(C=>C.type===f))===null||o===void 0?void 0:o.attrs,E=hf(d,f,x);E&&(g=E.from,b=E.to),t.removeMark(g,b,f)}else p.forEach(g=>{t.removeMark(g.$from.pos,g.$to.pos,f)});return t.removeStoredMark(f),!0},PM=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let o=null,a=null;const u=gf(typeof n=="string"?n:n.name,r.schema);return u?(u==="node"&&(o=We(n,r.schema)),u==="mark"&&(a=dn(n,r.schema)),i&&t.selection.ranges.forEach(f=>{const d=f.$from.pos,m=f.$to.pos;let p,g,b,x;t.selection.empty?r.doc.nodesBetween(d,m,(E,C)=>{o&&o===E.type&&(b=Math.max(C,d),x=Math.min(C+E.nodeSize,m),p=C,g=E)}):r.doc.nodesBetween(d,m,(E,C)=>{C<d&&o&&o===E.type&&(b=Math.max(C,d),x=Math.min(C+E.nodeSize,m),p=C,g=E),C>=d&&C<=m&&(o&&o===E.type&&t.setNodeMarkup(C,void 0,{...E.attrs,...e}),a&&E.marks.length&&E.marks.forEach(M=>{if(a===M.type){const P=Math.max(C,d),F=Math.min(C+E.nodeSize,m);t.addMark(P,F,a.create({...M.attrs,...e}))}}))}),g&&(p!==void 0&&t.setNodeMarkup(p,void 0,{...g.attrs,...e}),a&&g.marks.length&&g.marks.forEach(E=>{a===E.type&&t.addMark(b,x,a.create({...E.attrs,...e}))}))}),!0):!1},DM=(n,e={})=>({state:t,dispatch:r})=>{const i=We(n,t.schema);return GT(i,e)(t,r)},zM=(n,e={})=>({state:t,dispatch:r})=>{const i=We(n,t.schema);return JT(i,e)(t,r)};var BM=Object.freeze({__proto__:null,blur:gC,clearContent:yC,clearNodes:bC,command:wC,createParagraphNear:SC,cut:xC,deleteCurrentNode:kC,deleteNode:EC,deleteRange:_C,deleteSelection:vC,enter:TC,exitCode:CC,extendMarkRange:MC,first:AC,focus:NC,forEach:RC,insertContent:LC,insertContentAt:zC,joinBackward:HC,joinDown:FC,joinForward:$C,joinItemBackward:WC,joinItemForward:UC,joinTextblockBackward:VC,joinTextblockForward:KC,joinUp:BC,keyboardShortcut:JC,lift:qC,liftEmptyBlock:jC,liftListItem:YC,newlineInCode:XC,resetAttributes:ZC,scrollIntoView:QC,selectAll:eM,selectNodeBackward:tM,selectNodeForward:nM,selectParentNode:rM,selectTextblockEnd:iM,selectTextblockStart:sM,setContent:lM,setMark:SM,setMeta:xM,setNode:kM,setNodeSelection:EM,setTextSelection:_M,sinkListItem:vM,splitBlock:TM,splitListItem:CM,toggleList:MM,toggleMark:AM,toggleNode:IM,toggleWrap:OM,undoInputRule:NM,unsetAllMarks:RM,unsetMark:LM,updateAttributes:PM,wrapIn:DM,wrapInList:zM});Ie.create({name:"commands",addCommands(){return{...BM}}}),Ie.create({name:"drop",addProseMirrorPlugins(){return[new lt({key:new Tt("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),Ie.create({name:"editable",addProseMirrorPlugins(){return[new lt({key:new Tt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Ie.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new lt({key:new Tt("focusEvents"),props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Ie.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:a})=>[()=>a.undoInputRule(),()=>a.command(({tr:u})=>{const{selection:f,doc:d}=u,{empty:m,$anchor:p}=f,{pos:g,parent:b}=p,x=p.parent.isTextblock&&g>0?u.doc.resolve(g-1):p,E=x.parent.type.spec.isolating,C=p.pos-p.parentOffset,M=E&&x.parent.childCount===1?C===p.pos:pe.atStart(d).from===g;return!m||!b.type.isTextblock||b.textContent.length||!M||M&&p.parent.type.name==="paragraph"?!1:a.clearNodes()}),()=>a.deleteSelection(),()=>a.joinBackward(),()=>a.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:a})=>[()=>a.deleteSelection(),()=>a.deleteCurrentNode(),()=>a.joinForward(),()=>a.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:a})=>[()=>a.newlineInCode(),()=>a.createParagraphNear(),()=>a.liftEmptyBlock(),()=>a.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},o={...r,"Ctrl-h":n,"Alt-Backspace":n,"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 pf()||D0()?o:i},addProseMirrorPlugins(){return[new lt({key:new Tt("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(E=>E.getMeta("composition")))return;const r=n.some(E=>E.docChanged)&&!e.doc.eq(t.doc),i=n.some(E=>E.getMeta("preventClearDocument"));if(!r||i)return;const{empty:o,from:a,to:u}=e.selection,f=pe.atStart(e.doc).from,d=pe.atEnd(e.doc).to;if(o||!(a===f&&u===d)||!$0(t.doc))return;const g=t.tr,b=vl({state:t,transaction:g}),{commands:x}=new uf({editor:this.editor,state:b});if(x.clearNodes(),!!g.steps.length)return g}})]}}),Ie.create({name:"paste",addProseMirrorPlugins(){return[new lt({key:new Tt("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),Ie.create({name:"tabindex",addProseMirrorPlugins(){return[new lt({key:new Tt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});function FM(n){return new O0({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),o=le(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,o)}})}function HM(n){return new O0({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const o=le(n.getAttributes,void 0,r)||{},a=e.tr.delete(t.from,t.to),f=a.doc.resolve(t.from).blockRange(),d=f&&Lc(f,n.type,o);if(!d)return null;if(a.wrap(f,d),n.keepMarks&&n.editor){const{selection:p,storedMarks:g}=e,{splittableMarks:b}=n.editor.extensionManager,x=g||p.$to.parentOffset&&p.$from.marks();if(x){const E=x.filter(C=>b.includes(C.type.name));a.ensureMarks(E)}}if(n.keepAttributes){const p=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(p,o).run()}const m=a.doc.resolve(t.from-1).nodeBefore;m&&m.type===n.type&&dr(a.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,m))&&a.join(t.from-1)}})}class Gn{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=le(K(this,"addOptions",{name:this.name}))),this.storage=le(K(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Gn(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Al(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Gn(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=le(K(t,"addOptions",{name:t.name})),t.storage=le(K(t,"addStorage",{name:t.name,options:t.options})),t}}function $M(n){return new aC({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const o=le(n.getAttributes,void 0,r,i);if(o===!1||o===null)return null;const{tr:a}=e,u=r[r.length-1],f=r[0];let d=t.to;if(u){const m=f.search(/\S/),p=t.from+f.indexOf(u),g=p+u.length;if(F0(t.from,t.to,e.doc).filter(x=>x.mark.type.excluded.find(C=>C===n.type&&C!==x.mark.type)).filter(x=>x.to>p).length)return null;g<t.to&&a.delete(g,t.to),p>t.from&&a.delete(t.from+m,p),d=t.from+m+u.length,a.addMark(t.from+m,d,n.type.create(o||{})),a.removeStoredMark(n.type)}}})}const WM=Gn.create({name:"text",group:"inline"});var Pl=200,Ue=function(){};Ue.prototype.append=function(e){return e.length?(e=Ue.from(e),!this.length&&e||e.length<Pl&&this.leafAppend(e)||this.length<Pl&&e.leafPrepend(this)||this.appendInner(e)):this},Ue.prototype.prepend=function(e){return e.length?Ue.from(e).append(this):this},Ue.prototype.appendInner=function(e){return new UM(this,e)},Ue.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Ue.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Ue.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Ue.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)},Ue.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,a){return i.push(e(o,a))},t,r),i},Ue.from=function(e){return e instanceof Ue?e:e&&e.length?new U0(e):Ue.empty};var U0=function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,a,u){for(var f=o;f<a;f++)if(i(this.values[f],u+f)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,a,u){for(var f=o-1;f>=a;f--)if(i(this.values[f],u+f)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Pl)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Pl)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(Ue);Ue.empty=new U0([]);var UM=function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.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,o,a){var u=this.left.length;if(i<u&&this.left.forEachInner(r,i,Math.min(o,u),a)===!1||o>u&&this.right.forEachInner(r,Math.max(i-u,0),Math.min(this.length,o)-u,a+u)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,a){var u=this.left.length;if(i>u&&this.right.forEachInvertedInner(r,i-u,Math.max(o,u)-u,a+u)===!1||o<u&&this.left.forEachInvertedInner(r,Math.min(i,u),o,a)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},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}(Ue);const VM=500;class rn{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;t&&(i=this.remapping(r,this.items.length),o=i.maps.length);let a=e.tr,u,f,d=[],m=[];return this.items.forEach((p,g)=>{if(!p.step){i||(i=this.remapping(r,g+1),o=i.maps.length),o--,m.push(p);return}if(i){m.push(new mn(p.map));let b=p.step.map(i.slice(o)),x;b&&a.maybeStep(b).doc&&(x=a.mapping.maps[a.mapping.maps.length-1],d.push(new mn(x,void 0,void 0,d.length+m.length))),o--,x&&i.appendMap(x,o)}else a.maybeStep(p.step);if(p.selection)return u=i?p.selection.map(i.slice(o)):p.selection,f=new rn(this.items.slice(0,r).append(m.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:f,transform:a,selection:u}}addTransform(e,t,r,i){let o=[],a=this.eventCount,u=this.items,f=!i&&u.length?u.get(u.length-1):null;for(let m=0;m<e.steps.length;m++){let p=e.steps[m].invert(e.docs[m]),g=new mn(e.mapping.maps[m],p,t),b;(b=f&&f.merge(g))&&(g=b,m?o.pop():u=u.slice(0,u.length-1)),o.push(g),t&&(a++,t=void 0),i||(f=g)}let d=a-r.depth;return d>GM&&(u=KM(u,d),a-=d),new rn(u.append(o),a)}remapping(e,t){let r=new zi;return this.items.forEach((i,o)=>{let a=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,a)},e,t),r}addMaps(e){return this.eventCount==0?this:new rn(this.items.append(e.map(t=>new mn(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),o=e.mapping,a=e.steps.length,u=this.eventCount;this.items.forEach(g=>{g.selection&&u--},i);let f=t;this.items.forEach(g=>{let b=o.getMirror(--f);if(b==null)return;a=Math.min(a,b);let x=o.maps[b];if(g.step){let E=e.steps[b].invert(e.docs[b]),C=g.selection&&g.selection.map(o.slice(f+1,b));C&&u++,r.push(new mn(x,E,C))}else r.push(new mn(x))},i);let d=[];for(let g=t;g<a;g++)d.push(new mn(o.maps[g]));let m=this.items.slice(0,i).append(d).append(r),p=new rn(m,u);return p.emptyItemCount()>VM&&(p=p.compress(this.items.length-r.length)),p}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,i=[],o=0;return this.items.forEach((a,u)=>{if(u>=e)i.push(a),a.selection&&o++;else if(a.step){let f=a.step.map(t.slice(r)),d=f&&f.getMap();if(r--,d&&t.appendMap(d,r),f){let m=a.selection&&a.selection.map(t.slice(r));m&&o++;let p=new mn(d.invert(),f,m),g,b=i.length-1;(g=i.length&&i[b].merge(p))?i[b]=g:i.push(p)}}else a.map&&r--},this.items.length,0),new rn(Ue.from(i.reverse()),o)}}rn.empty=new rn(Ue.empty,0);function KM(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class mn{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new mn(t.getMap().invert(),t,this.selection)}}}class br{constructor(e,t,r,i,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const GM=20;function JM(n,e,t,r){let i=t.getMeta(Kr),o;if(i)return i.historyState;t.getMeta(YM)&&(n=new br(n.done,n.undone,null,0,-1));let a=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(a&&a.getMeta(Kr))return a.getMeta(Kr).redo?new br(n.done.addTransform(t,void 0,r,Dl(e)),n.undone,V0(t.mapping.maps),n.prevTime,n.prevComposition):new br(n.done,n.undone.addTransform(t,void 0,r,Dl(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(a&&a.getMeta("addToHistory")===!1)){let u=t.getMeta("composition"),f=n.prevTime==0||!a&&n.prevComposition!=u&&(n.prevTime<(t.time||0)-r.newGroupDelay||!qM(t,n.prevRanges)),d=a?Sf(n.prevRanges,t.mapping):V0(t.mapping.maps);return new br(n.done.addTransform(t,f?e.selection.getBookmark():void 0,r,Dl(e)),rn.empty,d,t.time,u??n.prevComposition)}else return(o=t.getMeta("rebased"))?new br(n.done.rebased(t,o),n.undone.rebased(t,o),Sf(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new br(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Sf(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function qM(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(t=!0)}),t}function V0(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,o,a)=>e.push(o,a));return e}function Sf(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),o=e.map(n[r+1],-1);i<=o&&t.push(i,o)}return t}function jM(n,e,t){let r=Dl(e),i=Kr.get(e).spec.config,o=(t?n.undone:n.done).popEvent(e,r);if(!o)return null;let a=o.selection.resolve(o.transform.doc),u=(t?n.done:n.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),f=new br(t?u:o.remaining,t?o.remaining:u,null,0,-1);return o.transform.setSelection(a).setMeta(Kr,{redo:t,historyState:f})}let xf=!1,K0=null;function Dl(n){let e=n.plugins;if(K0!=e){xf=!1,K0=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){xf=!0;break}}return xf}const Kr=new Tt("history"),YM=new Tt("closeHistory");function XM(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new lt({key:Kr,state:{init(){return new br(rn.empty,rn.empty,null,0,-1)},apply(e,t,r){return JM(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?J0:r=="historyRedo"?q0:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function G0(n,e){return(t,r)=>{let i=Kr.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let o=jM(i,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const J0=G0(!1,!0),q0=G0(!0,!0),ZM=Ie.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>J0(n,e),redo:()=>({state:n,dispatch:e})=>q0(n,e)}},addProseMirrorPlugins(){return[XM(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}});var j0=(n=>(n.COMMON="common",n.DESKTOP="desktop",n.TABLET="tablet",n.MOBILE="mobile",n))(j0||{});const QM=["common","mobile","tablet","desktop"],kf={...j0,values:QM};var Y0=(n=>(n.UPPERCASE="uppercase",n.LOWERCASE="lowercase",n.CAPITALIZE="capitalize",n))(Y0||{});const Ef=Y0;var X0=(n=>(n.LEFT="left",n.CENTER="center",n.RIGHT="right",n.JUSTIFY="justify",n))(X0||{});const eA=["left","center","right","justify"],wr={...X0,values:eA};var Dn=(n=>(n.DOCUMENT="doc",n.PARAGRAPH="paragraph",n.HEADING="heading",n.LIST="list",n.LIST_ITEM="listItem",n.TEXT="text",n))(Dn||{});const tA=["paragraph","list","heading"],de=Object.freeze({...Dn,blocks:tA});var Z0=(n=>(n.DISC="disc",n.CIRCLE="circle",n.SQUARE="square",n.DECIMAL="decimal",n.ROMAN="roman",n.LATIN="latin",n))(Z0||{});const nA=["disc","circle","square","decimal","roman","latin"],rA=["decimal","roman","latin"],Wt={...Z0,values:nA,ordered:rA};var _f=(n=>(n.ALIGNMENT="alignment",n.BACKGROUND_COLOR="background_color",n.FONT_COLOR="font_color",n.FONT_FAMILY="font_family",n.FONT_SIZE="font_size",n.FONT_STYLE="font_style",n.FONT_WEIGHT="font_weight",n.LINE_HEIGHT="line_height",n.TEXT_DECORATION="text_decoration",n.SUPERSCRIPT="superscript",n.MARGIN="margin",n.LINK="link",n.STYLE_PRESET="style_preset",n))(_f||{});const iA=["alignment","line_height","margin"],sA=["line_height"],oA=["text_decoration","link","superscript","background_color"],lA=["background_color","font_color","font_family","font_size","font_style","font_weight","text_decoration","superscript"],me={..._f,attributes:iA,presetAttributes:sA,inlineMarks:oA,marks:lA};var Q0=(n=>(n.SETTINGS="settings",n.ALL="_",n))(Q0||{});const tn=Q0;var e1=(n=>(n.BLANK="_blank",n.SELF="_self",n))(e1||{});const t1=e1;var n1=(n=>(n.URL="url",n.BLOCK="block",n))(n1||{});const Ms=n1;class vf{static create(e,t){const r=new this(e,t||{});return new lt({key:new Tt(this.name),props:r._buildProps()})}constructor(e,t){this.options=t,this.editor=e}_buildProps(){const t=Object.entries(this.addProps()).map(([r,i])=>[r,i.bind(this)]);return Object.fromEntries(t)}addProps(){return{}}}class aA extends vf{addProps(){return{transformPastedHTML:this._transformPastedHTML,handlePaste:this._handlePaste}}_transformPastedHTML(e){if(e.includes("data-pm-slice")&&e.includes("zw-style"))return e;const t=Oa.build(e);return t.normalizeHTML(),this._removeDeprecatedStyles(t),t.normalizedHTML}_removeDeprecatedStyles(e){const t=e.dom.querySelectorAll('[style*="margin"]');for(const r of Array.from(t))r.style.removeProperty("margin"),r.style.removeProperty("margin-top"),r.style.removeProperty("margin-right"),r.style.removeProperty("margin-bottom"),r.style.removeProperty("margin-left")}_handlePaste(e,t,r){const i=this._insertPastedContent(e,r).scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste");return e.dispatch(i),!0}_insertPastedContent({state:e},t){return this._isFullBlockSelected(e)?e.tr.replaceSelectionWith(t.content,!1):e.tr.replaceSelection(t)}_isFullBlockSelected(e){const t=this._expandSelectionToBlocks(e),r=this._isMatchPosition(t.from,e.selection.from),i=this._isMatchPosition(t.to,e.selection.to);return r&&i}_expandSelectionToBlocks({selection:e,doc:t}){let r=e.from,i=e.to;return t.nodesBetween(r,i,(o,a,u)=>{u.type.name===de.DOCUMENT&&(r=Math.min(r,a+1),i=Math.max(i,a+o.nodeSize-1))}),{from:r,to:i}}_isMatchPosition(e,t){return Math.abs(e-t)<5}}class uA extends vf{addProps(){return{decorations:this._buildDecorations}}_buildDecorations({doc:e}){const t=[];if(!this.editor.isEditable)return null;if(!(e.childCount>1))return e.descendants((r,i)=>{if(!r.childCount){const o=bn.node(i,i+r.nodeSize,{class:"zw-wysiwyg__placeholder","data-placeholder":"Type your text here..."});t.push(o)}return!1}),Je.create(e,t)}}const cA="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",fA="\u03B5\u03BB1\u03C52\u0431\u04331\u0435\u043B3\u0434\u0435\u0442\u04384\u0435\u044E2\u043A\u0430\u0442\u043E\u043B\u0438\u043A6\u043E\u043C3\u043C\u043A\u04342\u043E\u043D1\u0441\u043A\u0432\u04306\u043E\u043D\u043B\u0430\u0439\u043D5\u0440\u04333\u0440\u0443\u04412\u04442\u0441\u0430\u0439\u04423\u0440\u04313\u0443\u043A\u04403\u049B\u0430\u04373\u0570\u0561\u05753\u05D9\u05E9\u05E8\u05D0\u05DC5\u05E7\u05D5\u05DD3\u0627\u0628\u0648\u0638\u0628\u064A5\u0631\u0627\u0645\u0643\u06485\u0644\u0627\u0631\u062F\u06464\u0628\u062D\u0631\u064A\u06465\u062C\u0632\u0627\u0626\u06315\u0633\u0639\u0648\u062F\u064A\u06296\u0639\u0644\u064A\u0627\u06465\u0645\u063A\u0631\u06285\u0645\u0627\u0631\u0627\u062A5\u06CC\u0631\u0627\u06465\u0628\u0627\u0631\u062A2\u0632\u0627\u06314\u064A\u062A\u06433\u06BE\u0627\u0631\u062A5\u062A\u0648\u0646\u06334\u0633\u0648\u062F\u0627\u06463\u0631\u064A\u06295\u0634\u0628\u0643\u06294\u0639\u0631\u0627\u06422\u06282\u0645\u0627\u06464\u0641\u0644\u0633\u0637\u064A\u06466\u0642\u0637\u06313\u0643\u0627\u062B\u0648\u0644\u064A\u06436\u0648\u06453\u0645\u0635\u06312\u0644\u064A\u0633\u064A\u06275\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u06277\u0642\u06394\u0647\u0645\u0631\u0627\u06475\u067E\u0627\u06A9\u0633\u062A\u0627\u06467\u0680\u0627\u0631\u062A4\u0915\u0949\u092E3\u0928\u0947\u091F3\u092D\u093E\u0930\u09240\u092E\u094D3\u094B\u09245\u0938\u0902\u0917\u0920\u09285\u09AC\u09BE\u0982\u09B2\u09BE5\u09AD\u09BE\u09B0\u09A42\u09F0\u09A44\u0A2D\u0A3E\u0A30\u0A244\u0AAD\u0ABE\u0AB0\u0AA44\u0B2D\u0B3E\u0B30\u0B244\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE6\u0BB2\u0B99\u0BCD\u0B95\u0BC86\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD11\u0C2D\u0C3E\u0C30\u0C24\u0C4D5\u0CAD\u0CBE\u0CB0\u0CA44\u0D2D\u0D3E\u0D30\u0D24\u0D025\u0DBD\u0D82\u0D9A\u0DCF4\u0E04\u0E2D\u0E213\u0E44\u0E17\u0E223\u0EA5\u0EB2\u0EA73\u10D2\u10D42\u307F\u3093\u306A3\u30A2\u30DE\u30BE\u30F34\u30AF\u30E9\u30A6\u30C94\u30B0\u30FC\u30B0\u30EB4\u30B3\u30E02\u30B9\u30C8\u30A23\u30BB\u30FC\u30EB3\u30D5\u30A1\u30C3\u30B7\u30E7\u30F36\u30DD\u30A4\u30F3\u30C84\u4E16\u754C2\u4E2D\u4FE11\u56FD1\u570B1\u6587\u7F513\u4E9A\u9A6C\u900A3\u4F01\u4E1A2\u4F5B\u5C712\u4FE1\u606F2\u5065\u5EB72\u516B\u53662\u516C\u53F81\u76CA2\u53F0\u6E7E1\u70632\u5546\u57CE1\u5E971\u68072\u5609\u91CC0\u5927\u9152\u5E975\u5728\u7EBF2\u5927\u62FF2\u5929\u4E3B\u65593\u5A31\u4E502\u5BB6\u96FB2\u5E7F\u4E1C2\u5FAE\u535A2\u6148\u55842\u6211\u7231\u4F603\u624B\u673A2\u62DB\u80582\u653F\u52A11\u5E9C2\u65B0\u52A0\u57612\u95FB2\u65F6\u5C1A2\u66F8\u7C4D2\u673A\u67842\u6DE1\u9A6C\u95213\u6E38\u620F2\u6FB3\u95802\u70B9\u770B2\u79FB\u52A82\u7EC4\u7EC7\u673A\u67844\u7F51\u57401\u5E971\u7AD91\u7EDC2\u8054\u901A2\u8C37\u6B4C2\u8D2D\u72692\u901A\u8CA92\u96C6\u56E22\u96FB\u8A0A\u76C8\u79D14\u98DE\u5229\u6D663\u98DF\u54C12\u9910\u53852\u9999\u683C\u91CC\u62C93\u6E2F2\uB2F7\uB1371\uCEF42\uC0BC\uC1312\uD55C\uAD6D2",Oi=(n,e)=>{for(const t in e)n[t]=e[t];return n},Tf="numeric",Cf="ascii",Mf="alpha",As="asciinumeric",Is="alphanumeric",Af="domain",r1="emoji",dA="scheme",hA="slashscheme",If="whitespace";function pA(n,e){return n in e||(e[n]=[]),e[n]}function Gr(n,e,t){e[Tf]&&(e[As]=!0,e[Is]=!0),e[Cf]&&(e[As]=!0,e[Mf]=!0),e[As]&&(e[Is]=!0),e[Mf]&&(e[Is]=!0),e[Is]&&(e[Af]=!0),e[r1]&&(e[Af]=!0);for(const r in e){const i=pA(r,t);i.indexOf(n)<0&&i.push(n)}}function mA(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function gt(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}gt.groups={},gt.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],o=e.jr[r][1];if(o&&i.test(n))return o}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let i=0;i<n.length;i++)this.tt(n[i],e,t,r)},tr(n,e,t,r){r=r||gt.groups;let i;return e&&e.j?i=e:(i=new gt(e),t&&r&&Gr(e,t,r)),this.jr.push([n,i]),i},ts(n,e,t,r){let i=this;const o=n.length;if(!o)return i;for(let a=0;a<o-1;a++)i=i.tt(n[a]);return i.tt(n[o-1],e,t,r)},tt(n,e,t,r){r=r||gt.groups;const i=this;if(e&&e.j)return i.j[n]=e,e;const o=e;let a,u=i.go(n);if(u?(a=new gt,Oi(a.j,u.j),a.jr.push.apply(a.jr,u.jr),a.jd=u.jd,a.t=u.t):a=new gt,o){if(r)if(a.t&&typeof a.t=="string"){const f=Oi(mA(a.t,r),t);Gr(o,f,r)}else t&&Gr(o,t,r);a.t=o}return i.j[n]=a,a}};const te=(n,e,t,r,i)=>n.ta(e,t,r,i),Ae=(n,e,t,r,i)=>n.tr(e,t,r,i),i1=(n,e,t,r,i)=>n.ts(e,t,r,i),D=(n,e,t,r,i)=>n.tt(e,t,r,i),zn="WORD",Of="UWORD",s1="ASCIINUMERICAL",o1="ALPHANUMERICAL",Os="LOCALHOST",Nf="TLD",Rf="UTLD",zl="SCHEME",Ni="SLASH_SCHEME",Lf="NUM",Pf="WS",Df="NL",Ns="OPENBRACE",Rs="CLOSEBRACE",Bl="OPENBRACKET",Fl="CLOSEBRACKET",Hl="OPENPAREN",$l="CLOSEPAREN",Wl="OPENANGLEBRACKET",Ul="CLOSEANGLEBRACKET",Vl="FULLWIDTHLEFTPAREN",Kl="FULLWIDTHRIGHTPAREN",Gl="LEFTCORNERBRACKET",Jl="RIGHTCORNERBRACKET",ql="LEFTWHITECORNERBRACKET",jl="RIGHTWHITECORNERBRACKET",Yl="FULLWIDTHLESSTHAN",Xl="FULLWIDTHGREATERTHAN",Zl="AMPERSAND",zf="APOSTROPHE",Ql="ASTERISK",Sr="AT",ea="BACKSLASH",ta="BACKTICK",na="CARET",xr="COLON",Bf="COMMA",ra="DOLLAR",hn="DOT",ia="EQUALS",Ff="EXCLAMATION",Ut="HYPHEN",Ls="PERCENT",sa="PIPE",oa="PLUS",la="POUND",Ps="QUERY",Hf="QUOTE",l1="FULLWIDTHMIDDLEDOT",$f="SEMI",pn="SLASH",Ds="TILDE",aa="UNDERSCORE",a1="EMOJI",ua="SYM";var u1=Object.freeze({__proto__:null,WORD:zn,UWORD:Of,ASCIINUMERICAL:s1,ALPHANUMERICAL:o1,LOCALHOST:Os,TLD:Nf,UTLD:Rf,SCHEME:zl,SLASH_SCHEME:Ni,NUM:Lf,WS:Pf,NL:Df,OPENBRACE:Ns,CLOSEBRACE:Rs,OPENBRACKET:Bl,CLOSEBRACKET:Fl,OPENPAREN:Hl,CLOSEPAREN:$l,OPENANGLEBRACKET:Wl,CLOSEANGLEBRACKET:Ul,FULLWIDTHLEFTPAREN:Vl,FULLWIDTHRIGHTPAREN:Kl,LEFTCORNERBRACKET:Gl,RIGHTCORNERBRACKET:Jl,LEFTWHITECORNERBRACKET:ql,RIGHTWHITECORNERBRACKET:jl,FULLWIDTHLESSTHAN:Yl,FULLWIDTHGREATERTHAN:Xl,AMPERSAND:Zl,APOSTROPHE:zf,ASTERISK:Ql,AT:Sr,BACKSLASH:ea,BACKTICK:ta,CARET:na,COLON:xr,COMMA:Bf,DOLLAR:ra,DOT:hn,EQUALS:ia,EXCLAMATION:Ff,HYPHEN:Ut,PERCENT:Ls,PIPE:sa,PLUS:oa,POUND:la,QUERY:Ps,QUOTE:Hf,FULLWIDTHMIDDLEDOT:l1,SEMI:$f,SLASH:pn,TILDE:Ds,UNDERSCORE:aa,EMOJI:a1,SYM:ua});const Bn=/[a-z]/,zs=/\p{L}/u,Wf=/\p{Emoji}/u,Fn=/\d/,Uf=/\s/,c1="\r",Vf=`
17
- `,gA="\uFE0F",yA="\u200D",Kf="\uFFFC";let ca=null,fa=null;function bA(n=[]){const e={};gt.groups=e;const t=new gt;ca==null&&(ca=d1(cA)),fa==null&&(fa=d1(fA)),D(t,"'",zf),D(t,"{",Ns),D(t,"}",Rs),D(t,"[",Bl),D(t,"]",Fl),D(t,"(",Hl),D(t,")",$l),D(t,"<",Wl),D(t,">",Ul),D(t,"\uFF08",Vl),D(t,"\uFF09",Kl),D(t,"\u300C",Gl),D(t,"\u300D",Jl),D(t,"\u300E",ql),D(t,"\u300F",jl),D(t,"\uFF1C",Yl),D(t,"\uFF1E",Xl),D(t,"&",Zl),D(t,"*",Ql),D(t,"@",Sr),D(t,"`",ta),D(t,"^",na),D(t,":",xr),D(t,",",Bf),D(t,"$",ra),D(t,".",hn),D(t,"=",ia),D(t,"!",Ff),D(t,"-",Ut),D(t,"%",Ls),D(t,"|",sa),D(t,"+",oa),D(t,"#",la),D(t,"?",Ps),D(t,'"',Hf),D(t,"/",pn),D(t,";",$f),D(t,"~",Ds),D(t,"_",aa),D(t,"\\",ea),D(t,"\u30FB",l1);const r=Ae(t,Fn,Lf,{[Tf]:!0});Ae(r,Fn,r);const i=Ae(r,Bn,s1,{[As]:!0}),o=Ae(r,zs,o1,{[Is]:!0}),a=Ae(t,Bn,zn,{[Cf]:!0});Ae(a,Fn,i),Ae(a,Bn,a),Ae(i,Fn,i),Ae(i,Bn,i);const u=Ae(t,zs,Of,{[Mf]:!0});Ae(u,Bn),Ae(u,Fn,o),Ae(u,zs,u),Ae(o,Fn,o),Ae(o,Bn),Ae(o,zs,o);const f=D(t,Vf,Df,{[If]:!0}),d=D(t,c1,Pf,{[If]:!0}),m=Ae(t,Uf,Pf,{[If]:!0});D(t,Kf,m),D(d,Vf,f),D(d,Kf,m),Ae(d,Uf,m),D(m,c1),D(m,Vf),Ae(m,Uf,m),D(m,Kf,m);const p=Ae(t,Wf,a1,{[r1]:!0});D(p,"#"),Ae(p,Wf,p),D(p,gA,p);const g=D(p,yA);D(g,"#"),Ae(g,Wf,p);const b=[[Bn,a],[Fn,i]],x=[[Bn,null],[zs,u],[Fn,o]];for(let E=0;E<ca.length;E++)kr(t,ca[E],Nf,zn,b);for(let E=0;E<fa.length;E++)kr(t,fa[E],Rf,Of,x);Gr(Nf,{tld:!0,ascii:!0},e),Gr(Rf,{utld:!0,alpha:!0},e),kr(t,"file",zl,zn,b),kr(t,"mailto",zl,zn,b),kr(t,"http",Ni,zn,b),kr(t,"https",Ni,zn,b),kr(t,"ftp",Ni,zn,b),kr(t,"ftps",Ni,zn,b),Gr(zl,{scheme:!0,ascii:!0},e),Gr(Ni,{slashscheme:!0,ascii:!0},e),n=n.sort((E,C)=>E[0]>C[0]?1:-1);for(let E=0;E<n.length;E++){const C=n[E][0],P=n[E][1]?{[dA]:!0}:{[hA]:!0};C.indexOf("-")>=0?P[Af]=!0:Bn.test(C)?Fn.test(C)?P[As]=!0:P[Cf]=!0:P[Tf]=!0,i1(t,C,C,P)}return i1(t,"localhost",Os,{ascii:!0}),t.jd=new gt(ua),{start:t,tokens:Oi({groups:e},u1)}}function f1(n,e){const t=wA(e.replace(/[A-Z]/g,u=>u.toLowerCase())),r=t.length,i=[];let o=0,a=0;for(;a<r;){let u=n,f=null,d=0,m=null,p=-1,g=-1;for(;a<r&&(f=u.go(t[a]));)u=f,u.accepts()?(p=0,g=0,m=u):p>=0&&(p+=t[a].length,g++),d+=t[a].length,o+=t[a].length,a++;o-=p,a-=g,d-=p,i.push({t:m.t,v:e.slice(o-d,o),s:o-d,e:o})}return i}function wA(n){const e=[],t=n.length;let r=0;for(;r<t;){let i=n.charCodeAt(r),o,a=i<55296||i>56319||r+1===t||(o=n.charCodeAt(r+1))<56320||o>57343?n[r]:n.slice(r,r+2);e.push(a),r+=a.length}return e}function kr(n,e,t,r,i){let o;const a=e.length;for(let u=0;u<a-1;u++){const f=e[u];n.j[f]?o=n.j[f]:(o=new gt(r),o.jr=i.slice(),n.j[f]=o),n=o}return o=new gt(t),o.jr=i.slice(),n.j[e[a-1]]=o,o}function d1(n){const e=[],t=[];let r=0,i="0123456789";for(;r<n.length;){let o=0;for(;i.indexOf(n[r+o])>=0;)o++;if(o>0){e.push(t.join(""));for(let a=parseInt(n.substring(r,r+o),10);a>0;a--)t.pop();r+=o}else t.push(n[r]),r++}return e}const Bs={defaultProtocol:"http",events:null,format:h1,formatHref:h1,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Gf(n,e=null){let t=Oi({},Bs);n&&(t=Oi(t,n instanceof Gf?n.o:n));const r=t.ignoreTags,i=[];for(let o=0;o<r.length;o++)i.push(r[o].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}Gf.prototype={o:Bs,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let i=this.o[n];return i&&(typeof i=="object"?(i=t.t in i?i[t.t]:Bs[n],typeof i=="function"&&r&&(i=i(e,t))):typeof i=="function"&&r&&(i=i(e,t.t,t)),i)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function h1(n){return n}function p1(n,e){this.t="token",this.v=n,this.tk=e}p1.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"\u2026":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=Bs.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),i=n.get("tagName",t,e),o=this.toFormattedString(n),a={},u=n.get("className",t,e),f=n.get("target",t,e),d=n.get("rel",t,e),m=n.getObj("attributes",t,e),p=n.getObj("events",t,e);return a.href=r,u&&(a.class=u),f&&(a.target=f),d&&(a.rel=d),m&&Oi(a,m),{tagName:i,attributes:a,content:o,eventListeners:p}}};function da(n,e){class t extends p1{constructor(i,o){super(i,o),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const m1=da("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),g1=da("text"),SA=da("nl"),ha=da("url",{isLink:!0,toHref(n=Bs.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Os&&n[1].t===xr}}),Vt=n=>new gt(n);function xA({groups:n}){const e=n.domain.concat([Zl,Ql,Sr,ea,ta,na,ra,ia,Ut,Lf,Ls,sa,oa,la,pn,ua,Ds,aa]),t=[xr,Bf,hn,Ff,Ls,Ps,Hf,$f,Wl,Ul,Ns,Rs,Fl,Bl,Hl,$l,Vl,Kl,Gl,Jl,ql,jl,Yl,Xl],r=[Zl,zf,Ql,ea,ta,na,ra,ia,Ut,Ns,Rs,Ls,sa,oa,la,Ps,pn,ua,Ds,aa],i=Vt(),o=D(i,Ds);te(o,r,o),te(o,n.domain,o);const a=Vt(),u=Vt(),f=Vt();te(i,n.domain,a),te(i,n.scheme,u),te(i,n.slashscheme,f),te(a,r,o),te(a,n.domain,a);const d=D(a,Sr);D(o,Sr,d),D(u,Sr,d),D(f,Sr,d);const m=D(o,hn);te(m,r,o),te(m,n.domain,o);const p=Vt();te(d,n.domain,p),te(p,n.domain,p);const g=D(p,hn);te(g,n.domain,p);const b=Vt(m1);te(g,n.tld,b),te(g,n.utld,b),D(d,Os,b);const x=D(p,Ut);D(x,Ut,x),te(x,n.domain,p),te(b,n.domain,p),D(b,hn,g),D(b,Ut,x);const E=D(b,xr);te(E,n.numeric,m1);const C=D(a,Ut),M=D(a,hn);D(C,Ut,C),te(C,n.domain,a),te(M,r,o),te(M,n.domain,a);const P=Vt(ha);te(M,n.tld,P),te(M,n.utld,P),te(P,n.domain,a),te(P,r,o),D(P,hn,M),D(P,Ut,C),D(P,Sr,d);const F=D(P,xr),$=Vt(ha);te(F,n.numeric,$);const U=Vt(ha),ue=Vt();te(U,e,U),te(U,t,ue),te(ue,e,U),te(ue,t,ue),D(P,pn,U),D($,pn,U);const fe=D(u,xr),we=D(f,xr),yt=D(we,pn),Jn=D(yt,pn);te(u,n.domain,a),D(u,hn,M),D(u,Ut,C),te(f,n.domain,a),D(f,hn,M),D(f,Ut,C),te(fe,n.domain,U),D(fe,pn,U),D(fe,Ps,U),te(Jn,n.domain,U),te(Jn,e,U),D(Jn,pn,U);const sn=[[Ns,Rs],[Bl,Fl],[Hl,$l],[Wl,Ul],[Vl,Kl],[Gl,Jl],[ql,jl],[Yl,Xl]];for(let qn=0;qn<sn.length;qn++){const[Qr,on]=sn[qn],wn=D(U,Qr);D(ue,Qr,wn),D(wn,on,U);const Fe=Vt(ha);te(wn,e,Fe);const bt=Vt();te(wn,t),te(Fe,e,Fe),te(Fe,t,bt),te(bt,e,Fe),te(bt,t,bt),D(Fe,on,U),D(bt,on,U)}return D(i,Os,P),D(i,Df,SA),{start:i,tokens:u1}}function kA(n,e,t){let r=t.length,i=0,o=[],a=[];for(;i<r;){let u=n,f=null,d=null,m=0,p=null,g=-1;for(;i<r&&!(f=u.go(t[i].t));)a.push(t[i++]);for(;i<r&&(d=f||u.go(t[i].t));)f=null,u=d,u.accepts()?(g=0,p=u):g>=0&&g++,i++,m++;if(g<0)i-=m,i<r&&(a.push(t[i]),i++);else{a.length>0&&(o.push(Jf(g1,e,a)),a=[]),i-=g,m-=g;const b=p.t,x=t.slice(i-m,i);o.push(Jf(b,e,x))}}return a.length>0&&o.push(Jf(g1,e,a)),o}function Jf(n,e,t){const r=t[0].s,i=t[t.length-1].e,o=e.slice(r,i);return new n(o,t)}const EA=typeof console<"u"&&console&&console.warn||(()=>{}),_A="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",_e={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function vA(){return gt.groups={},_e.scanner=null,_e.parser=null,_e.tokenQueue=[],_e.pluginQueue=[],_e.customSchemes=[],_e.initialized=!1,_e}function y1(n,e=!1){if(_e.initialized&&EA(`linkifyjs: already initialized - will not register custom scheme "${n}" ${_A}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
16
+ `,textSerializers:a={}}=t||{};let c="";return n.nodesBetween(r,i,(f,h,m,p)=>{var g;f.isBlock&&h>r&&(c+=o);const b=a?.[f.type.name];if(b)return m&&(c+=b({node:f,pos:h,parent:m,index:p,range:e})),!1;f.isText&&(c+=(g=f?.text)===null||g===void 0?void 0:g.slice(Math.max(r,h)-h,i-h))}),c}function pC(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}Ie.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new at({key:new Ct("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:o}=i,a=Math.min(...o.map(m=>m.$from.pos)),c=Math.max(...o.map(m=>m.$to.pos)),f=pC(t);return dC(r,{from:a,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:f})}}})]}});const mC=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())===null||t===void 0||t.removeAllRanges())}),!0),gC=(n=!1)=>({commands:e})=>e.setContent("",n),yC=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:o,$to:a})=>{n.doc.nodesBetween(o.pos,a.pos,(c,f)=>{if(c.type.isText)return;const{doc:h,mapping:m}=e,p=h.resolve(m.map(f)),g=h.resolve(m.map(f+c.nodeSize)),b=p.blockRange(g);if(!b)return;const S=xi(b);if(c.type.isTextblock){const{defaultType:k}=p.parent.contentMatchAt(p.index());e.setNodeMarkup(b.start,k)}(S||S===0)&&e.lift(b,S)})}),!0},bC=n=>e=>n(e),vC=()=>({state:n,dispatch:e})=>w0(n,e),wC=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,o=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const a=r.mapping.map(e);return r.insert(a,o.content),r.setSelection(new ae(r.doc.resolve(a-1))),!0},SC=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const i=n.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){const c=i.before(o),f=i.after(o);n.delete(c,f).scrollIntoView()}return!0}return!1},xC=n=>({tr:e,state:t,dispatch:r})=>{const i=Ue(n,t.schema),o=e.selection.$anchor;for(let a=o.depth;a>0;a-=1)if(o.node(a).type===i){if(r){const f=o.before(a),h=o.after(a);e.delete(f,h).scrollIntoView()}return!0}return!1},kC=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},EC=()=>({state:n,dispatch:e})=>nf(n,e),_C=()=>({commands:n})=>n.keyboardShortcut("Enter"),TC=()=>({state:n,dispatch:e})=>BT(n,e);function Il(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:ff(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function N0(n,e,t={}){return n.find(r=>r.type===e&&Il(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function R0(n,e,t={}){return!!N0(n,e,t)}function hf(n,e,t){var r;if(!n||!e)return;let i=n.parent.childAfter(n.parentOffset);if((!i.node||!i.node.marks.some(m=>m.type===e))&&(i=n.parent.childBefore(n.parentOffset)),!i.node||!i.node.marks.some(m=>m.type===e)||(t=t||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!N0([...i.node.marks],e,t)))return;let a=i.index,c=n.start()+i.offset,f=a+1,h=c+i.node.nodeSize;for(;a>0&&R0([...n.parent.child(a-1).marks],e,t);)a-=1,c-=n.parent.child(a).nodeSize;for(;f<n.parent.childCount&&R0([...n.parent.child(f).marks],e,t);)h+=n.parent.child(f).nodeSize,f+=1;return{from:c,to:h}}function hn(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}const CC=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const o=hn(n,r.schema),{doc:a,selection:c}=t,{$from:f,from:h,to:m}=c;if(i){const p=hf(f,o,e);if(p&&p.from<=h&&p.to>=m){const g=ae.create(a,p.from,p.to);t.setSelection(g)}}return!0},MC=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function L0(n){return n instanceof ae}function Ur(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function AC(n,e=null){if(!e)return null;const t=de.atStart(n),r=de.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const i=t.from,o=r.to;return e==="all"?ae.create(n,Ur(0,i,o),Ur(n.content.size,i,o)):ae.create(n,Ur(e,i,o),Ur(e,i,o))}function IC(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function df(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const OC=(n=null,e={})=>({editor:t,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const a=()=>{(df()||IC())&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(o&&n===null&&!L0(t.state.selection))return a(),!0;const c=AC(i.doc,n)||t.state.selection,f=t.state.selection.eq(c);return o&&(f||i.setSelection(c),f&&i.storedMarks&&i.setStoredMarks(i.storedMarks),a()),!0},NC=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),RC=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),P0=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&P0(r)}return n};function Ol(n){const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return P0(t)}function Nl(n,e,t){if(n instanceof ur||n instanceof L)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return L.fromArray(n.map(c=>e.nodeFromJSON(c)));const a=e.nodeFromJSON(n);return t.errorOnInvalidContent&&a.check(),a}catch(o){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",o),Nl("",e,t)}if(i){if(t.errorOnInvalidContent){let a=!1,c="";const f=new Zm({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:h=>(a=!0,c=typeof h=="string"?h:h.outerHTML,null)}]}})});if(t.slice?bs.fromSchema(f).parseSlice(Ol(n),t.parseOptions):bs.fromSchema(f).parse(Ol(n),t.parseOptions),t.errorOnInvalidContent&&a)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const o=bs.fromSchema(e);return t.slice?o.parseSlice(Ol(n),t.parseOptions).content:o.parse(Ol(n),t.parseOptions)}return Nl("",e,t)}function LC(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof Je||i instanceof Ge))return;const o=n.mapping.maps[r];let a=0;o.forEach((c,f,h,m)=>{a===0&&(a=m)}),n.setSelection(de.near(n.doc.resolve(a),t))}const PC=n=>!("type"in n),DC=(n,e,t)=>({tr:r,dispatch:i,editor:o})=>{var a;if(i){t={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let c;try{c=Nl(e,o.schema,{parseOptions:{preserveWhitespace:"full",...t.parseOptions},errorOnInvalidContent:(a=t.errorOnInvalidContent)!==null&&a!==void 0?a:o.options.enableContentCheck})}catch(S){return o.emit("contentError",{editor:o,error:S,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}}),!1}let{from:f,to:h}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},m=!0,p=!0;if((PC(c)?c:[c]).forEach(S=>{S.check(),m=m?S.isText&&S.marks.length===0:!1,p=p?S.isBlock:!1}),f===h&&p){const{parent:S}=r.doc.resolve(f);S.isTextblock&&!S.type.spec.code&&!S.childCount&&(f-=1,h+=1)}let b;if(m){if(Array.isArray(e))b=e.map(S=>S.text||"").join("");else if(e instanceof L){let S="";e.forEach(k=>{k.text&&(S+=k.text)}),b=S}else typeof e=="object"&&e&&e.text?b=e.text:b=e;r.insertText(b,f,h)}else b=c,r.replaceWith(f,h,b);t.updateSelection&&LC(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:f,text:b}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:f,text:b})}return!0},zC=()=>({state:n,dispatch:e})=>PT(n,e),BC=()=>({state:n,dispatch:e})=>DT(n,e),FC=()=>({state:n,dispatch:e})=>d0(n,e),HC=()=>({state:n,dispatch:e})=>y0(n,e),$C=()=>({state:n,dispatch:e,tr:t})=>{try{const r=pl(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},WC=()=>({state:n,dispatch:e,tr:t})=>{try{const r=pl(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},UC=()=>({state:n,dispatch:e})=>RT(n,e),VC=()=>({state:n,dispatch:e})=>LT(n,e);function D0(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function KC(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,o,a;for(let c=0;c<e.length-1;c+=1){const f=e[c];if(/^(cmd|meta|m)$/i.test(f))a=!0;else if(/^a(lt)?$/i.test(f))r=!0;else if(/^(c|ctrl|control)$/i.test(f))i=!0;else if(/^s(hift)?$/i.test(f))o=!0;else if(/^mod$/i.test(f))df()||D0()?a=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${f}`)}return r&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),a&&(t=`Meta-${t}`),o&&(t=`Shift-${t}`),t}const GC=n=>({editor:e,view:t,tr:r,dispatch:i})=>{const o=KC(n).split(/-(?!$)/),a=o.find(h=>!["Alt","Ctrl","Meta","Shift"].includes(h)),c=new KeyboardEvent("keydown",{key:a==="Space"?" ":a,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),f=e.captureTransaction(()=>{t.someProp("handleKeyDown",h=>h(t,c))});return f?.steps.forEach(h=>{const m=h.map(r.mapping);m&&i&&r.maybeStep(m)}),!0};function pf(n,e,t={}){const{from:r,to:i,empty:o}=n.selection,a=e?Ue(e,n.schema):null,c=[];n.doc.nodesBetween(r,i,(p,g)=>{if(p.isText)return;const b=Math.max(r,g),S=Math.min(i,g+p.nodeSize);c.push({node:p,from:b,to:S})});const f=i-r,h=c.filter(p=>a?a.name===p.node.type.name:!0).filter(p=>Il(p.node.attrs,t,{strict:!1}));return o?!!h.length:h.reduce((p,g)=>p+g.to-g.from,0)>=f}const JC=(n,e={})=>({state:t,dispatch:r})=>{const i=Ue(n,t.schema);return pf(t,i,e)?zT(t,r):!1},qC=()=>({state:n,dispatch:e})=>S0(n,e),jC=n=>({state:e,dispatch:t})=>{const r=Ue(n,e.schema);return jT(r)(e,t)},YC=()=>({state:n,dispatch:e})=>v0(n,e);function mf(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function z0(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}const XC=(n,e)=>({tr:t,state:r,dispatch:i})=>{let o=null,a=null;const c=mf(typeof n=="string"?n:n.name,r.schema);return c?(c==="node"&&(o=Ue(n,r.schema)),c==="mark"&&(a=hn(n,r.schema)),i&&t.selection.ranges.forEach(f=>{r.doc.nodesBetween(f.$from.pos,f.$to.pos,(h,m)=>{o&&o===h.type&&t.setNodeMarkup(m,void 0,z0(h.attrs,e)),a&&h.marks.length&&h.marks.forEach(p=>{a===p.type&&t.addMark(m,m+h.nodeSize,a.create(z0(p.attrs,e)))})})}),!0):!1},ZC=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),QC=()=>({tr:n,dispatch:e})=>{if(e){const t=new It(n.doc);n.setSelection(t)}return!0},eM=()=>({state:n,dispatch:e})=>m0(n,e),tM=()=>({state:n,dispatch:e})=>b0(n,e),nM=()=>({state:n,dispatch:e})=>$T(n,e),rM=()=>({state:n,dispatch:e})=>VT(n,e),iM=()=>({state:n,dispatch:e})=>UT(n,e);function sM(n,e,t={},r={}){return Nl(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}const oM=(n,e=!1,t={},r={})=>({editor:i,tr:o,dispatch:a,commands:c})=>{var f,h;const{doc:m}=o;if(t.preserveWhitespace!=="full"){const p=sM(n,i.schema,t,{errorOnInvalidContent:(f=r.errorOnInvalidContent)!==null&&f!==void 0?f:i.options.enableContentCheck});return a&&o.replaceWith(0,m.content.size,p).setMeta("preventUpdate",!e),!0}return a&&o.setMeta("preventUpdate",!e),c.insertContentAt({from:0,to:m.content.size},n,{parseOptions:t,errorOnInvalidContent:(h=r.errorOnInvalidContent)!==null&&h!==void 0?h:i.options.enableContentCheck})};function B0(n,e){const t=hn(e,n.schema),{from:r,to:i,empty:o}=n.selection,a=[];o?(n.storedMarks&&a.push(...n.storedMarks),a.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,f=>{a.push(...f.marks)});const c=a.find(f=>f.type.name===t.name);return c?{...c.attrs}:{}}function lM(n,e){const t=new D_(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function aM(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function cM(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,o)=>{t(i)&&r.push({node:i,pos:o})}),r}function uM(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function gf(n){return e=>uM(e.$from,n)}function fM(n,e){const t=Pi.resolve(n);return M0(t,e)}function hM(n,e){const t=Ue(e,n.schema),{from:r,to:i}=n.selection,o=[];n.doc.nodesBetween(r,i,c=>{o.push(c)});const a=o.reverse().find(c=>c.type.name===t.name);return a?{...a.attrs}:{}}function dM(n,e){const t=mf(typeof e=="string"?e:e.name,n.schema);return t==="node"?hM(n,e):t==="mark"?B0(n,e):{}}function pM(n,e=JSON.stringify){const t={};return n.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function mM(n){const e=pM(n);return e.length===1?e:e.filter((t,r)=>!e.filter((o,a)=>a!==r).some(o=>t.oldRange.from>=o.oldRange.from&&t.oldRange.to<=o.oldRange.to&&t.newRange.from>=o.newRange.from&&t.newRange.to<=o.newRange.to))}function gM(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,o)=>{const a=[];if(i.ranges.length)i.forEach((c,f)=>{a.push({from:c,to:f})});else{const{from:c,to:f}=t[o];if(c===void 0||f===void 0)return;a.push({from:c,to:f})}a.forEach(({from:c,to:f})=>{const h=e.slice(o).map(c,-1),m=e.slice(o).map(f),p=e.invert().map(h,-1),g=e.invert().map(m);r.push({oldRange:{from:p,to:g},newRange:{from:h,to:m}})})}),mM(r)}function F0(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const o=t.resolve(n),a=hf(o,i.type);a&&r.push({mark:i,...a})}):t.nodesBetween(n,e,(i,o)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(a=>({from:o,to:o+i.nodeSize,mark:a})))}),r}function Rl(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}function yM(n,e,t={}){const{empty:r,ranges:i}=n.selection,o=e?hn(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(p=>o?o.name===p.type.name:!0).find(p=>Il(p.attrs,t,{strict:!1}));let a=0;const c=[];if(i.forEach(({$from:p,$to:g})=>{const b=p.pos,S=g.pos;n.doc.nodesBetween(b,S,(k,C)=>{if(!k.isText&&!k.marks.length)return;const M=Math.max(b,C),P=Math.min(S,C+k.nodeSize),F=P-M;a+=F,c.push(...k.marks.map($=>({mark:$,from:M,to:P})))})}),a===0)return!1;const f=c.filter(p=>o?o.name===p.mark.type.name:!0).filter(p=>Il(p.mark.attrs,t,{strict:!1})).reduce((p,g)=>p+g.to-g.from,0),h=c.filter(p=>o?p.mark.type!==o&&p.mark.type.excludes(o):!0).reduce((p,g)=>p+g.to-g.from,0);return(f>0?f+h:f)>=a}function H0(n,e){const{nodeExtensions:t}=_l(e),r=t.find(a=>a.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=le(K(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function $0(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!==null&&r!==void 0?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let i=!0;return n.content.forEach(o=>{i!==!1&&($0(o,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function bM(n,e,t){var r;const{selection:i}=e;let o=null;if(L0(i)&&(o=i.$cursor),o){const c=(r=n.storedMarks)!==null&&r!==void 0?r:o.marks();return!!t.isInSet(c)||!c.some(f=>f.type.excludes(t))}const{ranges:a}=i;return a.some(({$from:c,$to:f})=>{let h=c.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(c.pos,f.pos,(m,p,g)=>{if(h)return!1;if(m.isInline){const b=!g||g.type.allowsMarkType(t),S=!!t.isInSet(m.marks)||!m.marks.some(k=>k.type.excludes(t));h=b&&S}return!h}),h})}const vM=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:o}=t,{empty:a,ranges:c}=o,f=hn(n,r.schema);if(i)if(a){const h=B0(r,f);t.addStoredMark(f.create({...h,...e}))}else c.forEach(h=>{const m=h.$from.pos,p=h.$to.pos;r.doc.nodesBetween(m,p,(g,b)=>{const S=Math.max(b,m),k=Math.min(b+g.nodeSize,p);g.marks.find(M=>M.type===f)?g.marks.forEach(M=>{f===M.type&&t.addMark(S,k,f.create({...M.attrs,...e}))}):t.addMark(S,k,f.create(e))})});return bM(r,t,f)},wM=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),SM=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const o=Ue(n,t.schema);let a;return t.selection.$anchor.sameParent(t.selection.$head)&&(a=t.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:c})=>E0(o,{...a,...e})(t)?!0:c.clearNodes()).command(({state:c})=>E0(o,{...a,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},xM=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=Ur(n,0,r.content.size),o=Y.create(r,i);e.setSelection(o)}return!0},kM=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:o}=typeof n=="number"?{from:n,to:n}:n,a=ae.atStart(r).from,c=ae.atEnd(r).to,f=Ur(i,a,c),h=Ur(o,a,c),m=ae.create(r,f,h);e.setSelection(m)}return!0},EM=n=>({state:e,dispatch:t})=>{const r=Ue(n,e.schema);return ZT(r)(e,t)};function W0(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(i=>e?.includes(i.type.name));n.tr.ensureMarks(r)}}const _M=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:o,doc:a}=e,{$from:c,$to:f}=o,h=i.extensionManager.attributes,m=Rl(h,c.node().type.name,c.node().attrs);if(o instanceof Y&&o.node.isBlock)return!c.parentOffset||!Dn(a,c.pos)?!1:(r&&(n&&W0(t,i.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const p=f.parentOffset===f.parent.content.size,g=c.depth===0?void 0:aM(c.node(-1).contentMatchAt(c.indexAfter(-1)));let b=p&&g?[{type:g,attrs:m}]:void 0,S=Dn(e.doc,e.mapping.map(c.pos),1,b);if(!b&&!S&&Dn(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(S=!0,b=g?[{type:g,attrs:m}]:void 0),r){if(S&&(o instanceof ae&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,b),g&&!p&&!c.parentOffset&&c.parent.type!==g)){const k=e.mapping.map(c.before()),C=e.doc.resolve(k);c.node(-1).canReplaceWith(C.index(),C.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}n&&W0(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return S},TM=(n,e={})=>({tr:t,state:r,dispatch:i,editor:o})=>{var a;const c=Ue(n,r.schema),{$from:f,$to:h}=r.selection,m=r.selection.node;if(m&&m.isBlock||f.depth<2||!f.sameParent(h))return!1;const p=f.node(-1);if(p.type!==c)return!1;const g=o.extensionManager.attributes;if(f.parent.content.size===0&&f.node(-1).childCount===f.indexAfter(-1)){if(f.depth===2||f.node(-3).type!==c||f.index(-2)!==f.node(-2).childCount-1)return!1;if(i){let M=L.empty;const P=f.index(-1)?1:f.index(-2)?2:3;for(let be=f.depth-P;be>=f.depth-3;be-=1)M=L.from(f.node(be).copy(M));const F=f.indexAfter(-1)<f.node(-2).childCount?1:f.indexAfter(-2)<f.node(-3).childCount?2:3,$={...Rl(g,f.node().type.name,f.node().attrs),...e},U=((a=c.contentMatch.defaultType)===null||a===void 0?void 0:a.createAndFill($))||void 0;M=M.append(L.from(c.createAndFill(null,U)||void 0));const ce=f.before(f.depth-(P-1));t.replace(ce,f.after(-F),new W(M,4-P,0));let fe=-1;t.doc.nodesBetween(ce,t.doc.content.size,(be,bt)=>{if(fe>-1)return!1;be.isTextblock&&be.content.size===0&&(fe=bt+1)}),fe>-1&&t.setSelection(ae.near(t.doc.resolve(fe))),t.scrollIntoView()}return!0}const b=h.pos===f.end()?p.contentMatchAt(0).defaultType:null,S={...Rl(g,p.type.name,p.attrs),...e},k={...Rl(g,f.node().type.name,f.node().attrs),...e};t.delete(f.pos,h.pos);const C=b?[{type:c,attrs:S},{type:b,attrs:k}]:[{type:c,attrs:S}];if(!Dn(t.doc,f.pos,2))return!1;if(i){const{selection:M,storedMarks:P}=r,{splittableMarks:F}=o.extensionManager,$=P||M.$to.parentOffset&&M.$from.marks();if(t.split(f.pos,2,C).scrollIntoView(),!$||!i)return!0;const U=$.filter(ce=>F.includes(ce.type.name));t.ensureMarks(U)}return!0},yf=(n,e)=>{const t=gf(a=>a.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&fr(n.doc,t.pos)&&n.join(t.pos),!0},bf=(n,e)=>{const t=gf(a=>a.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&fr(n.doc,r)&&n.join(r),!0},CM=(n,e,t,r={})=>({editor:i,tr:o,state:a,dispatch:c,chain:f,commands:h,can:m})=>{const{extensions:p,splittableMarks:g}=i.extensionManager,b=Ue(n,a.schema),S=Ue(e,a.schema),{selection:k,storedMarks:C}=a,{$from:M,$to:P}=k,F=M.blockRange(P),$=C||k.$to.parentOffset&&k.$from.marks();if(!F)return!1;const U=gf(ce=>H0(ce.type.name,p))(k);if(F.depth>=1&&U&&F.depth-U.depth<=1){if(U.node.type===b)return h.liftListItem(S);if(H0(U.node.type.name,p)&&b.validContent(U.node.content)&&c)return f().command(()=>(o.setNodeMarkup(U.pos,b),!0)).command(()=>yf(o,b)).command(()=>bf(o,b)).run()}return!t||!$||!c?f().command(()=>m().wrapInList(b,r)?!0:h.clearNodes()).wrapInList(b,r).command(()=>yf(o,b)).command(()=>bf(o,b)).run():f().command(()=>{const ce=m().wrapInList(b,r),fe=$.filter(be=>g.includes(be.type.name));return o.ensureMarks(fe),ce?!0:h.clearNodes()}).wrapInList(b,r).command(()=>yf(o,b)).command(()=>bf(o,b)).run()},MM=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=t,a=hn(n,r.schema);return yM(r,a,e)?i.unsetMark(a,{extendEmptyMarkRange:o}):i.setMark(a,e)},AM=(n,e,t={})=>({state:r,commands:i})=>{const o=Ue(n,r.schema),a=Ue(e,r.schema),c=pf(r,o,t);let f;return r.selection.$anchor.sameParent(r.selection.$head)&&(f=r.selection.$anchor.parent.attrs),c?i.setNode(a,f):i.setNode(o,{...f,...t})},IM=(n,e={})=>({state:t,commands:r})=>{const i=Ue(n,t.schema);return pf(t,i,e)?r.lift(i):r.wrapIn(i,e)},OM=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const i=t[r];let o;if(i.spec.isInputRules&&(o=i.getState(n))){if(e){const a=n.tr,c=o.transform;for(let f=c.steps.length-1;f>=0;f-=1)a.step(c.steps[f].invert(c.docs[f]));if(o.text){const f=a.doc.resolve(o.from).marks();a.replaceWith(o.from,o.to,n.schema.text(o.text,f))}else a.delete(o.from,o.to)}return!0}}return!1},NM=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(o=>{n.removeMark(o.$from.pos,o.$to.pos)}),!0},RM=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:a=!1}=e,{selection:c}=t,f=hn(n,r.schema),{$from:h,empty:m,ranges:p}=c;if(!i)return!0;if(m&&a){let{from:g,to:b}=c;const S=(o=h.marks().find(C=>C.type===f))===null||o===void 0?void 0:o.attrs,k=hf(h,f,S);k&&(g=k.from,b=k.to),t.removeMark(g,b,f)}else p.forEach(g=>{t.removeMark(g.$from.pos,g.$to.pos,f)});return t.removeStoredMark(f),!0},LM=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let o=null,a=null;const c=mf(typeof n=="string"?n:n.name,r.schema);return c?(c==="node"&&(o=Ue(n,r.schema)),c==="mark"&&(a=hn(n,r.schema)),i&&t.selection.ranges.forEach(f=>{const h=f.$from.pos,m=f.$to.pos;let p,g,b,S;t.selection.empty?r.doc.nodesBetween(h,m,(k,C)=>{o&&o===k.type&&(b=Math.max(C,h),S=Math.min(C+k.nodeSize,m),p=C,g=k)}):r.doc.nodesBetween(h,m,(k,C)=>{C<h&&o&&o===k.type&&(b=Math.max(C,h),S=Math.min(C+k.nodeSize,m),p=C,g=k),C>=h&&C<=m&&(o&&o===k.type&&t.setNodeMarkup(C,void 0,{...k.attrs,...e}),a&&k.marks.length&&k.marks.forEach(M=>{if(a===M.type){const P=Math.max(C,h),F=Math.min(C+k.nodeSize,m);t.addMark(P,F,a.create({...M.attrs,...e}))}}))}),g&&(p!==void 0&&t.setNodeMarkup(p,void 0,{...g.attrs,...e}),a&&g.marks.length&&g.marks.forEach(k=>{a===k.type&&t.addMark(b,S,a.create({...k.attrs,...e}))}))}),!0):!1},PM=(n,e={})=>({state:t,dispatch:r})=>{const i=Ue(n,t.schema);return KT(i,e)(t,r)},DM=(n,e={})=>({state:t,dispatch:r})=>{const i=Ue(n,t.schema);return GT(i,e)(t,r)};var zM=Object.freeze({__proto__:null,blur:mC,clearContent:gC,clearNodes:yC,command:bC,createParagraphNear:vC,cut:wC,deleteCurrentNode:SC,deleteNode:xC,deleteRange:kC,deleteSelection:EC,enter:_C,exitCode:TC,extendMarkRange:CC,first:MC,focus:OC,forEach:NC,insertContent:RC,insertContentAt:DC,joinBackward:FC,joinDown:BC,joinForward:HC,joinItemBackward:$C,joinItemForward:WC,joinTextblockBackward:UC,joinTextblockForward:VC,joinUp:zC,keyboardShortcut:GC,lift:JC,liftEmptyBlock:qC,liftListItem:jC,newlineInCode:YC,resetAttributes:XC,scrollIntoView:ZC,selectAll:QC,selectNodeBackward:eM,selectNodeForward:tM,selectParentNode:nM,selectTextblockEnd:rM,selectTextblockStart:iM,setContent:oM,setMark:vM,setMeta:wM,setNode:SM,setNodeSelection:xM,setTextSelection:kM,sinkListItem:EM,splitBlock:_M,splitListItem:TM,toggleList:CM,toggleMark:MM,toggleNode:AM,toggleWrap:IM,undoInputRule:OM,unsetAllMarks:NM,unsetMark:RM,updateAttributes:LM,wrapIn:PM,wrapInList:DM});Ie.create({name:"commands",addCommands(){return{...zM}}}),Ie.create({name:"drop",addProseMirrorPlugins(){return[new at({key:new Ct("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),Ie.create({name:"editable",addProseMirrorPlugins(){return[new at({key:new Ct("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Ie.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new at({key:new Ct("focusEvents"),props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Ie.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:a})=>[()=>a.undoInputRule(),()=>a.command(({tr:c})=>{const{selection:f,doc:h}=c,{empty:m,$anchor:p}=f,{pos:g,parent:b}=p,S=p.parent.isTextblock&&g>0?c.doc.resolve(g-1):p,k=S.parent.type.spec.isolating,C=p.pos-p.parentOffset,M=k&&S.parent.childCount===1?C===p.pos:de.atStart(h).from===g;return!m||!b.type.isTextblock||b.textContent.length||!M||M&&p.parent.type.name==="paragraph"?!1:a.clearNodes()}),()=>a.deleteSelection(),()=>a.joinBackward(),()=>a.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:a})=>[()=>a.deleteSelection(),()=>a.deleteCurrentNode(),()=>a.joinForward(),()=>a.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:a})=>[()=>a.newlineInCode(),()=>a.createParagraphNear(),()=>a.liftEmptyBlock(),()=>a.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},o={...r,"Ctrl-h":n,"Alt-Backspace":n,"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 df()||D0()?o:i},addProseMirrorPlugins(){return[new at({key:new Ct("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(k=>k.getMeta("composition")))return;const r=n.some(k=>k.docChanged)&&!e.doc.eq(t.doc),i=n.some(k=>k.getMeta("preventClearDocument"));if(!r||i)return;const{empty:o,from:a,to:c}=e.selection,f=de.atStart(e.doc).from,h=de.atEnd(e.doc).to;if(o||!(a===f&&c===h)||!$0(t.doc))return;const g=t.tr,b=El({state:t,transaction:g}),{commands:S}=new af({editor:this.editor,state:b});if(S.clearNodes(),!!g.steps.length)return g}})]}}),Ie.create({name:"paste",addProseMirrorPlugins(){return[new at({key:new Ct("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),Ie.create({name:"tabindex",addProseMirrorPlugins(){return[new at({key:new Ct("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});function BM(n){return new O0({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),o=le(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,o)}})}function FM(n){return new O0({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const o=le(n.getAttributes,void 0,r)||{},a=e.tr.delete(t.from,t.to),f=a.doc.resolve(t.from).blockRange(),h=f&&Ru(f,n.type,o);if(!h)return null;if(a.wrap(f,h),n.keepMarks&&n.editor){const{selection:p,storedMarks:g}=e,{splittableMarks:b}=n.editor.extensionManager,S=g||p.$to.parentOffset&&p.$from.marks();if(S){const k=S.filter(C=>b.includes(C.type.name));a.ensureMarks(k)}}if(n.keepAttributes){const p=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(p,o).run()}const m=a.doc.resolve(t.from-1).nodeBefore;m&&m.type===n.type&&fr(a.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,m))&&a.join(t.from-1)}})}class Gn{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=le(K(this,"addOptions",{name:this.name}))),this.storage=le(K(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Gn(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Ml(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Gn(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=le(K(t,"addOptions",{name:t.name})),t.storage=le(K(t,"addStorage",{name:t.name,options:t.options})),t}}function HM(n){return new lC({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const o=le(n.getAttributes,void 0,r,i);if(o===!1||o===null)return null;const{tr:a}=e,c=r[r.length-1],f=r[0];let h=t.to;if(c){const m=f.search(/\S/),p=t.from+f.indexOf(c),g=p+c.length;if(F0(t.from,t.to,e.doc).filter(S=>S.mark.type.excluded.find(C=>C===n.type&&C!==S.mark.type)).filter(S=>S.to>p).length)return null;g<t.to&&a.delete(g,t.to),p>t.from&&a.delete(t.from+m,p),h=t.from+m+c.length,a.addMark(t.from+m,h,n.type.create(o||{})),a.removeStoredMark(n.type)}}})}const $M=Gn.create({name:"text",group:"inline"});var Ll=200,Ve=function(){};Ve.prototype.append=function(e){return e.length?(e=Ve.from(e),!this.length&&e||e.length<Ll&&this.leafAppend(e)||this.length<Ll&&e.leafPrepend(this)||this.appendInner(e)):this},Ve.prototype.prepend=function(e){return e.length?Ve.from(e).append(this):this},Ve.prototype.appendInner=function(e){return new WM(this,e)},Ve.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Ve.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Ve.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Ve.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)},Ve.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,a){return i.push(e(o,a))},t,r),i},Ve.from=function(e){return e instanceof Ve?e:e&&e.length?new U0(e):Ve.empty};var U0=function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,a,c){for(var f=o;f<a;f++)if(i(this.values[f],c+f)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,a,c){for(var f=o-1;f>=a;f--)if(i(this.values[f],c+f)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Ll)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Ll)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(Ve);Ve.empty=new U0([]);var WM=function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.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,o,a){var c=this.left.length;if(i<c&&this.left.forEachInner(r,i,Math.min(o,c),a)===!1||o>c&&this.right.forEachInner(r,Math.max(i-c,0),Math.min(this.length,o)-c,a+c)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,a){var c=this.left.length;if(i>c&&this.right.forEachInvertedInner(r,i-c,Math.max(o,c)-c,a+c)===!1||o<c&&this.left.forEachInvertedInner(r,Math.min(i,c),o,a)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},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}(Ve);const UM=500;class rn{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;t&&(i=this.remapping(r,this.items.length),o=i.maps.length);let a=e.tr,c,f,h=[],m=[];return this.items.forEach((p,g)=>{if(!p.step){i||(i=this.remapping(r,g+1),o=i.maps.length),o--,m.push(p);return}if(i){m.push(new gn(p.map));let b=p.step.map(i.slice(o)),S;b&&a.maybeStep(b).doc&&(S=a.mapping.maps[a.mapping.maps.length-1],h.push(new gn(S,void 0,void 0,h.length+m.length))),o--,S&&i.appendMap(S,o)}else a.maybeStep(p.step);if(p.selection)return c=i?p.selection.map(i.slice(o)):p.selection,f=new rn(this.items.slice(0,r).append(m.reverse().concat(h)),this.eventCount-1),!1},this.items.length,0),{remaining:f,transform:a,selection:c}}addTransform(e,t,r,i){let o=[],a=this.eventCount,c=this.items,f=!i&&c.length?c.get(c.length-1):null;for(let m=0;m<e.steps.length;m++){let p=e.steps[m].invert(e.docs[m]),g=new gn(e.mapping.maps[m],p,t),b;(b=f&&f.merge(g))&&(g=b,m?o.pop():c=c.slice(0,c.length-1)),o.push(g),t&&(a++,t=void 0),i||(f=g)}let h=a-r.depth;return h>KM&&(c=VM(c,h),a-=h),new rn(c.append(o),a)}remapping(e,t){let r=new Di;return this.items.forEach((i,o)=>{let a=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,a)},e,t),r}addMaps(e){return this.eventCount==0?this:new rn(this.items.append(e.map(t=>new gn(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),o=e.mapping,a=e.steps.length,c=this.eventCount;this.items.forEach(g=>{g.selection&&c--},i);let f=t;this.items.forEach(g=>{let b=o.getMirror(--f);if(b==null)return;a=Math.min(a,b);let S=o.maps[b];if(g.step){let k=e.steps[b].invert(e.docs[b]),C=g.selection&&g.selection.map(o.slice(f+1,b));C&&c++,r.push(new gn(S,k,C))}else r.push(new gn(S))},i);let h=[];for(let g=t;g<a;g++)h.push(new gn(o.maps[g]));let m=this.items.slice(0,i).append(h).append(r),p=new rn(m,c);return p.emptyItemCount()>UM&&(p=p.compress(this.items.length-r.length)),p}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,i=[],o=0;return this.items.forEach((a,c)=>{if(c>=e)i.push(a),a.selection&&o++;else if(a.step){let f=a.step.map(t.slice(r)),h=f&&f.getMap();if(r--,h&&t.appendMap(h,r),f){let m=a.selection&&a.selection.map(t.slice(r));m&&o++;let p=new gn(h.invert(),f,m),g,b=i.length-1;(g=i.length&&i[b].merge(p))?i[b]=g:i.push(p)}}else a.map&&r--},this.items.length,0),new rn(Ve.from(i.reverse()),o)}}rn.empty=new rn(Ve.empty,0);function VM(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class gn{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new gn(t.getMap().invert(),t,this.selection)}}}class yr{constructor(e,t,r,i,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const KM=20;function GM(n,e,t,r){let i=t.getMeta(Vr),o;if(i)return i.historyState;t.getMeta(jM)&&(n=new yr(n.done,n.undone,null,0,-1));let a=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(a&&a.getMeta(Vr))return a.getMeta(Vr).redo?new yr(n.done.addTransform(t,void 0,r,Pl(e)),n.undone,V0(t.mapping.maps),n.prevTime,n.prevComposition):new yr(n.done,n.undone.addTransform(t,void 0,r,Pl(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(a&&a.getMeta("addToHistory")===!1)){let c=t.getMeta("composition"),f=n.prevTime==0||!a&&n.prevComposition!=c&&(n.prevTime<(t.time||0)-r.newGroupDelay||!JM(t,n.prevRanges)),h=a?vf(n.prevRanges,t.mapping):V0(t.mapping.maps);return new yr(n.done.addTransform(t,f?e.selection.getBookmark():void 0,r,Pl(e)),rn.empty,h,t.time,c??n.prevComposition)}else return(o=t.getMeta("rebased"))?new yr(n.done.rebased(t,o),n.undone.rebased(t,o),vf(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new yr(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),vf(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function JM(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(t=!0)}),t}function V0(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,o,a)=>e.push(o,a));return e}function vf(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),o=e.map(n[r+1],-1);i<=o&&t.push(i,o)}return t}function qM(n,e,t){let r=Pl(e),i=Vr.get(e).spec.config,o=(t?n.undone:n.done).popEvent(e,r);if(!o)return null;let a=o.selection.resolve(o.transform.doc),c=(t?n.done:n.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),f=new yr(t?c:o.remaining,t?o.remaining:c,null,0,-1);return o.transform.setSelection(a).setMeta(Vr,{redo:t,historyState:f})}let wf=!1,K0=null;function Pl(n){let e=n.plugins;if(K0!=e){wf=!1,K0=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){wf=!0;break}}return wf}const Vr=new Ct("history"),jM=new Ct("closeHistory");function YM(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new at({key:Vr,state:{init(){return new yr(rn.empty,rn.empty,null,0,-1)},apply(e,t,r){return GM(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?J0:r=="historyRedo"?q0:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function G0(n,e){return(t,r)=>{let i=Vr.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let o=qM(i,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const J0=G0(!1,!0),q0=G0(!0,!0),XM=Ie.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>J0(n,e),redo:()=>({state:n,dispatch:e})=>q0(n,e)}},addProseMirrorPlugins(){return[YM(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}});var j0=(n=>(n.COMMON="common",n.DESKTOP="desktop",n.TABLET="tablet",n.MOBILE="mobile",n))(j0||{});const ZM=["common","mobile","tablet","desktop"],Sf={...j0,values:ZM};var Y0=(n=>(n.UPPERCASE="uppercase",n.LOWERCASE="lowercase",n.CAPITALIZE="capitalize",n))(Y0||{});const xf=Y0;var X0=(n=>(n.LEFT="left",n.CENTER="center",n.RIGHT="right",n.JUSTIFY="justify",n))(X0||{});const QM=["left","center","right","justify"],br={...X0,values:QM};var Re=(n=>(n.DOCUMENT="doc",n.PARAGRAPH="paragraph",n.HEADING="heading",n.LIST="list",n.LIST_ITEM="listItem",n.TEXT="text",n))(Re||{});const eA=["paragraph","list","heading"],Ce=Object.freeze({...Re,blocks:eA});var Ut=(n=>(n.DISC="disc",n.CIRCLE="circle",n.SQUARE="square",n.DECIMAL="decimal",n.ROMAN="roman",n.LATIN="latin",n))(Ut||{});const tA=["disc","circle","square","decimal","roman","latin"],nA=["decimal","roman","latin"];({...Ut});var kf=(n=>(n.ALIGNMENT="alignment",n.BACKGROUND_COLOR="background_color",n.FONT_COLOR="font_color",n.FONT_FAMILY="font_family",n.FONT_SIZE="font_size",n.FONT_STYLE="font_style",n.FONT_WEIGHT="font_weight",n.LINE_HEIGHT="line_height",n.TEXT_DECORATION="text_decoration",n.SUPERSCRIPT="superscript",n.MARGIN="margin",n.LINK="link",n.STYLE_PRESET="style_preset",n))(kf||{});const rA=["alignment","line_height","margin"],iA=["line_height"],Z0=["text_decoration","link","superscript","background_color"],sA=["background_color","font_color","font_family","font_size","font_style","font_weight","text_decoration","superscript"],me={...kf,attributes:rA,presetAttributes:iA,inlineMarks:Z0,marks:sA};var Ef=(n=>(n.SETTINGS="settings",n.ALL="_",n))(Ef||{});const dn=Ef;var Q0=(n=>(n.BLANK="_blank",n.SELF="_self",n))(Q0||{});const e1=Q0;var t1=(n=>(n.URL="url",n.BLOCK="block",n))(t1||{});const Cs=t1;class _f{static create(e,t){const r=new this(e,t||{});return new at({key:new Ct(this.name),props:r._buildProps()})}constructor(e,t){this.options=t,this.editor=e}_buildProps(){const t=Object.entries(this.addProps()).map(([r,i])=>[r,i.bind(this)]);return Object.fromEntries(t)}addProps(){return{}}}class oA extends _f{addProps(){return{transformPastedHTML:this._transformPastedHTML,handlePaste:this._handlePaste}}_transformPastedHTML(e){if(e.includes("data-pm-slice")&&e.includes("zw-style"))return e;const t=Ia.build(e);return t.normalizeHTML(),this._removeDeprecatedStyles(t),t.normalizedHTML}_removeDeprecatedStyles(e){const t=e.dom.querySelectorAll('[style*="margin"]');for(const r of Array.from(t))r.style.removeProperty("margin"),r.style.removeProperty("margin-top"),r.style.removeProperty("margin-right"),r.style.removeProperty("margin-bottom"),r.style.removeProperty("margin-left")}_handlePaste(e,t,r){const i=this._insertPastedContent(e,r).scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste");return e.dispatch(i),!0}_insertPastedContent({state:e},t){return this._isFullBlockSelected(e)?e.tr.replaceSelectionWith(t.content,!1):e.tr.replaceSelection(t)}_isFullBlockSelected(e){const t=this._expandSelectionToBlocks(e),r=this._isMatchPosition(t.from,e.selection.from),i=this._isMatchPosition(t.to,e.selection.to);return r&&i}_expandSelectionToBlocks({selection:e,doc:t}){let r=e.from,i=e.to;return t.nodesBetween(r,i,(o,a,c)=>{c.type.name===Ce.DOCUMENT&&(r=Math.min(r,a+1),i=Math.max(i,a+o.nodeSize-1))}),{from:r,to:i}}_isMatchPosition(e,t){return Math.abs(e-t)<5}}class lA extends _f{addProps(){return{decorations:this._buildDecorations}}_buildDecorations({doc:e}){const t=[];if(!this.editor.isEditable)return null;if(!(e.childCount>1))return e.descendants((r,i)=>{if(!r.childCount){const o=vn.node(i,i+r.nodeSize,{class:"zw-wysiwyg__placeholder","data-placeholder":"Type your text here..."});t.push(o)}return!1}),qe.create(e,t)}}const aA="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",cA="\u03B5\u03BB1\u03C52\u0431\u04331\u0435\u043B3\u0434\u0435\u0442\u04384\u0435\u044E2\u043A\u0430\u0442\u043E\u043B\u0438\u043A6\u043E\u043C3\u043C\u043A\u04342\u043E\u043D1\u0441\u043A\u0432\u04306\u043E\u043D\u043B\u0430\u0439\u043D5\u0440\u04333\u0440\u0443\u04412\u04442\u0441\u0430\u0439\u04423\u0440\u04313\u0443\u043A\u04403\u049B\u0430\u04373\u0570\u0561\u05753\u05D9\u05E9\u05E8\u05D0\u05DC5\u05E7\u05D5\u05DD3\u0627\u0628\u0648\u0638\u0628\u064A5\u0631\u0627\u0645\u0643\u06485\u0644\u0627\u0631\u062F\u06464\u0628\u062D\u0631\u064A\u06465\u062C\u0632\u0627\u0626\u06315\u0633\u0639\u0648\u062F\u064A\u06296\u0639\u0644\u064A\u0627\u06465\u0645\u063A\u0631\u06285\u0645\u0627\u0631\u0627\u062A5\u06CC\u0631\u0627\u06465\u0628\u0627\u0631\u062A2\u0632\u0627\u06314\u064A\u062A\u06433\u06BE\u0627\u0631\u062A5\u062A\u0648\u0646\u06334\u0633\u0648\u062F\u0627\u06463\u0631\u064A\u06295\u0634\u0628\u0643\u06294\u0639\u0631\u0627\u06422\u06282\u0645\u0627\u06464\u0641\u0644\u0633\u0637\u064A\u06466\u0642\u0637\u06313\u0643\u0627\u062B\u0648\u0644\u064A\u06436\u0648\u06453\u0645\u0635\u06312\u0644\u064A\u0633\u064A\u06275\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u06277\u0642\u06394\u0647\u0645\u0631\u0627\u06475\u067E\u0627\u06A9\u0633\u062A\u0627\u06467\u0680\u0627\u0631\u062A4\u0915\u0949\u092E3\u0928\u0947\u091F3\u092D\u093E\u0930\u09240\u092E\u094D3\u094B\u09245\u0938\u0902\u0917\u0920\u09285\u09AC\u09BE\u0982\u09B2\u09BE5\u09AD\u09BE\u09B0\u09A42\u09F0\u09A44\u0A2D\u0A3E\u0A30\u0A244\u0AAD\u0ABE\u0AB0\u0AA44\u0B2D\u0B3E\u0B30\u0B244\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE6\u0BB2\u0B99\u0BCD\u0B95\u0BC86\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD11\u0C2D\u0C3E\u0C30\u0C24\u0C4D5\u0CAD\u0CBE\u0CB0\u0CA44\u0D2D\u0D3E\u0D30\u0D24\u0D025\u0DBD\u0D82\u0D9A\u0DCF4\u0E04\u0E2D\u0E213\u0E44\u0E17\u0E223\u0EA5\u0EB2\u0EA73\u10D2\u10D42\u307F\u3093\u306A3\u30A2\u30DE\u30BE\u30F34\u30AF\u30E9\u30A6\u30C94\u30B0\u30FC\u30B0\u30EB4\u30B3\u30E02\u30B9\u30C8\u30A23\u30BB\u30FC\u30EB3\u30D5\u30A1\u30C3\u30B7\u30E7\u30F36\u30DD\u30A4\u30F3\u30C84\u4E16\u754C2\u4E2D\u4FE11\u56FD1\u570B1\u6587\u7F513\u4E9A\u9A6C\u900A3\u4F01\u4E1A2\u4F5B\u5C712\u4FE1\u606F2\u5065\u5EB72\u516B\u53662\u516C\u53F81\u76CA2\u53F0\u6E7E1\u70632\u5546\u57CE1\u5E971\u68072\u5609\u91CC0\u5927\u9152\u5E975\u5728\u7EBF2\u5927\u62FF2\u5929\u4E3B\u65593\u5A31\u4E502\u5BB6\u96FB2\u5E7F\u4E1C2\u5FAE\u535A2\u6148\u55842\u6211\u7231\u4F603\u624B\u673A2\u62DB\u80582\u653F\u52A11\u5E9C2\u65B0\u52A0\u57612\u95FB2\u65F6\u5C1A2\u66F8\u7C4D2\u673A\u67842\u6DE1\u9A6C\u95213\u6E38\u620F2\u6FB3\u95802\u70B9\u770B2\u79FB\u52A82\u7EC4\u7EC7\u673A\u67844\u7F51\u57401\u5E971\u7AD91\u7EDC2\u8054\u901A2\u8C37\u6B4C2\u8D2D\u72692\u901A\u8CA92\u96C6\u56E22\u96FB\u8A0A\u76C8\u79D14\u98DE\u5229\u6D663\u98DF\u54C12\u9910\u53852\u9999\u683C\u91CC\u62C93\u6E2F2\uB2F7\uB1371\uCEF42\uC0BC\uC1312\uD55C\uAD6D2",Ii=(n,e)=>{for(const t in e)n[t]=e[t];return n},Tf="numeric",Cf="ascii",Mf="alpha",Ms="asciinumeric",As="alphanumeric",Af="domain",n1="emoji",uA="scheme",fA="slashscheme",If="whitespace";function hA(n,e){return n in e||(e[n]=[]),e[n]}function Kr(n,e,t){e[Tf]&&(e[Ms]=!0,e[As]=!0),e[Cf]&&(e[Ms]=!0,e[Mf]=!0),e[Ms]&&(e[As]=!0),e[Mf]&&(e[As]=!0),e[As]&&(e[Af]=!0),e[n1]&&(e[Af]=!0);for(const r in e){const i=hA(r,t);i.indexOf(n)<0&&i.push(n)}}function dA(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function yt(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}yt.groups={},yt.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],o=e.jr[r][1];if(o&&i.test(n))return o}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let i=0;i<n.length;i++)this.tt(n[i],e,t,r)},tr(n,e,t,r){r=r||yt.groups;let i;return e&&e.j?i=e:(i=new yt(e),t&&r&&Kr(e,t,r)),this.jr.push([n,i]),i},ts(n,e,t,r){let i=this;const o=n.length;if(!o)return i;for(let a=0;a<o-1;a++)i=i.tt(n[a]);return i.tt(n[o-1],e,t,r)},tt(n,e,t,r){r=r||yt.groups;const i=this;if(e&&e.j)return i.j[n]=e,e;const o=e;let a,c=i.go(n);if(c?(a=new yt,Ii(a.j,c.j),a.jr.push.apply(a.jr,c.jr),a.jd=c.jd,a.t=c.t):a=new yt,o){if(r)if(a.t&&typeof a.t=="string"){const f=Ii(dA(a.t,r),t);Kr(o,f,r)}else t&&Kr(o,t,r);a.t=o}return i.j[n]=a,a}};const te=(n,e,t,r,i)=>n.ta(e,t,r,i),Ae=(n,e,t,r,i)=>n.tr(e,t,r,i),r1=(n,e,t,r,i)=>n.ts(e,t,r,i),D=(n,e,t,r,i)=>n.tt(e,t,r,i),zn="WORD",Of="UWORD",i1="ASCIINUMERICAL",s1="ALPHANUMERICAL",Is="LOCALHOST",Nf="TLD",Rf="UTLD",Dl="SCHEME",Oi="SLASH_SCHEME",Lf="NUM",Pf="WS",Df="NL",Os="OPENBRACE",Ns="CLOSEBRACE",zl="OPENBRACKET",Bl="CLOSEBRACKET",Fl="OPENPAREN",Hl="CLOSEPAREN",$l="OPENANGLEBRACKET",Wl="CLOSEANGLEBRACKET",Ul="FULLWIDTHLEFTPAREN",Vl="FULLWIDTHRIGHTPAREN",Kl="LEFTCORNERBRACKET",Gl="RIGHTCORNERBRACKET",Jl="LEFTWHITECORNERBRACKET",ql="RIGHTWHITECORNERBRACKET",jl="FULLWIDTHLESSTHAN",Yl="FULLWIDTHGREATERTHAN",Xl="AMPERSAND",zf="APOSTROPHE",Zl="ASTERISK",vr="AT",Ql="BACKSLASH",ea="BACKTICK",ta="CARET",wr="COLON",Bf="COMMA",na="DOLLAR",pn="DOT",ra="EQUALS",Ff="EXCLAMATION",Vt="HYPHEN",Rs="PERCENT",ia="PIPE",sa="PLUS",oa="POUND",Ls="QUERY",Hf="QUOTE",o1="FULLWIDTHMIDDLEDOT",$f="SEMI",mn="SLASH",Ps="TILDE",la="UNDERSCORE",l1="EMOJI",aa="SYM";var a1=Object.freeze({__proto__:null,WORD:zn,UWORD:Of,ASCIINUMERICAL:i1,ALPHANUMERICAL:s1,LOCALHOST:Is,TLD:Nf,UTLD:Rf,SCHEME:Dl,SLASH_SCHEME:Oi,NUM:Lf,WS:Pf,NL:Df,OPENBRACE:Os,CLOSEBRACE:Ns,OPENBRACKET:zl,CLOSEBRACKET:Bl,OPENPAREN:Fl,CLOSEPAREN:Hl,OPENANGLEBRACKET:$l,CLOSEANGLEBRACKET:Wl,FULLWIDTHLEFTPAREN:Ul,FULLWIDTHRIGHTPAREN:Vl,LEFTCORNERBRACKET:Kl,RIGHTCORNERBRACKET:Gl,LEFTWHITECORNERBRACKET:Jl,RIGHTWHITECORNERBRACKET:ql,FULLWIDTHLESSTHAN:jl,FULLWIDTHGREATERTHAN:Yl,AMPERSAND:Xl,APOSTROPHE:zf,ASTERISK:Zl,AT:vr,BACKSLASH:Ql,BACKTICK:ea,CARET:ta,COLON:wr,COMMA:Bf,DOLLAR:na,DOT:pn,EQUALS:ra,EXCLAMATION:Ff,HYPHEN:Vt,PERCENT:Rs,PIPE:ia,PLUS:sa,POUND:oa,QUERY:Ls,QUOTE:Hf,FULLWIDTHMIDDLEDOT:o1,SEMI:$f,SLASH:mn,TILDE:Ps,UNDERSCORE:la,EMOJI:l1,SYM:aa});const Bn=/[a-z]/,Ds=/\p{L}/u,Wf=/\p{Emoji}/u,Fn=/\d/,Uf=/\s/,c1="\r",Vf=`
17
+ `,pA="\uFE0F",mA="\u200D",Kf="\uFFFC";let ca=null,ua=null;function gA(n=[]){const e={};yt.groups=e;const t=new yt;ca==null&&(ca=f1(aA)),ua==null&&(ua=f1(cA)),D(t,"'",zf),D(t,"{",Os),D(t,"}",Ns),D(t,"[",zl),D(t,"]",Bl),D(t,"(",Fl),D(t,")",Hl),D(t,"<",$l),D(t,">",Wl),D(t,"\uFF08",Ul),D(t,"\uFF09",Vl),D(t,"\u300C",Kl),D(t,"\u300D",Gl),D(t,"\u300E",Jl),D(t,"\u300F",ql),D(t,"\uFF1C",jl),D(t,"\uFF1E",Yl),D(t,"&",Xl),D(t,"*",Zl),D(t,"@",vr),D(t,"`",ea),D(t,"^",ta),D(t,":",wr),D(t,",",Bf),D(t,"$",na),D(t,".",pn),D(t,"=",ra),D(t,"!",Ff),D(t,"-",Vt),D(t,"%",Rs),D(t,"|",ia),D(t,"+",sa),D(t,"#",oa),D(t,"?",Ls),D(t,'"',Hf),D(t,"/",mn),D(t,";",$f),D(t,"~",Ps),D(t,"_",la),D(t,"\\",Ql),D(t,"\u30FB",o1);const r=Ae(t,Fn,Lf,{[Tf]:!0});Ae(r,Fn,r);const i=Ae(r,Bn,i1,{[Ms]:!0}),o=Ae(r,Ds,s1,{[As]:!0}),a=Ae(t,Bn,zn,{[Cf]:!0});Ae(a,Fn,i),Ae(a,Bn,a),Ae(i,Fn,i),Ae(i,Bn,i);const c=Ae(t,Ds,Of,{[Mf]:!0});Ae(c,Bn),Ae(c,Fn,o),Ae(c,Ds,c),Ae(o,Fn,o),Ae(o,Bn),Ae(o,Ds,o);const f=D(t,Vf,Df,{[If]:!0}),h=D(t,c1,Pf,{[If]:!0}),m=Ae(t,Uf,Pf,{[If]:!0});D(t,Kf,m),D(h,Vf,f),D(h,Kf,m),Ae(h,Uf,m),D(m,c1),D(m,Vf),Ae(m,Uf,m),D(m,Kf,m);const p=Ae(t,Wf,l1,{[n1]:!0});D(p,"#"),Ae(p,Wf,p),D(p,pA,p);const g=D(p,mA);D(g,"#"),Ae(g,Wf,p);const b=[[Bn,a],[Fn,i]],S=[[Bn,null],[Ds,c],[Fn,o]];for(let k=0;k<ca.length;k++)Sr(t,ca[k],Nf,zn,b);for(let k=0;k<ua.length;k++)Sr(t,ua[k],Rf,Of,S);Kr(Nf,{tld:!0,ascii:!0},e),Kr(Rf,{utld:!0,alpha:!0},e),Sr(t,"file",Dl,zn,b),Sr(t,"mailto",Dl,zn,b),Sr(t,"http",Oi,zn,b),Sr(t,"https",Oi,zn,b),Sr(t,"ftp",Oi,zn,b),Sr(t,"ftps",Oi,zn,b),Kr(Dl,{scheme:!0,ascii:!0},e),Kr(Oi,{slashscheme:!0,ascii:!0},e),n=n.sort((k,C)=>k[0]>C[0]?1:-1);for(let k=0;k<n.length;k++){const C=n[k][0],P=n[k][1]?{[uA]:!0}:{[fA]:!0};C.indexOf("-")>=0?P[Af]=!0:Bn.test(C)?Fn.test(C)?P[Ms]=!0:P[Cf]=!0:P[Tf]=!0,r1(t,C,C,P)}return r1(t,"localhost",Is,{ascii:!0}),t.jd=new yt(aa),{start:t,tokens:Ii({groups:e},a1)}}function u1(n,e){const t=yA(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=t.length,i=[];let o=0,a=0;for(;a<r;){let c=n,f=null,h=0,m=null,p=-1,g=-1;for(;a<r&&(f=c.go(t[a]));)c=f,c.accepts()?(p=0,g=0,m=c):p>=0&&(p+=t[a].length,g++),h+=t[a].length,o+=t[a].length,a++;o-=p,a-=g,h-=p,i.push({t:m.t,v:e.slice(o-h,o),s:o-h,e:o})}return i}function yA(n){const e=[],t=n.length;let r=0;for(;r<t;){let i=n.charCodeAt(r),o,a=i<55296||i>56319||r+1===t||(o=n.charCodeAt(r+1))<56320||o>57343?n[r]:n.slice(r,r+2);e.push(a),r+=a.length}return e}function Sr(n,e,t,r,i){let o;const a=e.length;for(let c=0;c<a-1;c++){const f=e[c];n.j[f]?o=n.j[f]:(o=new yt(r),o.jr=i.slice(),n.j[f]=o),n=o}return o=new yt(t),o.jr=i.slice(),n.j[e[a-1]]=o,o}function f1(n){const e=[],t=[];let r=0,i="0123456789";for(;r<n.length;){let o=0;for(;i.indexOf(n[r+o])>=0;)o++;if(o>0){e.push(t.join(""));for(let a=parseInt(n.substring(r,r+o),10);a>0;a--)t.pop();r+=o}else t.push(n[r]),r++}return e}const zs={defaultProtocol:"http",events:null,format:h1,formatHref:h1,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Gf(n,e=null){let t=Ii({},zs);n&&(t=Ii(t,n instanceof Gf?n.o:n));const r=t.ignoreTags,i=[];for(let o=0;o<r.length;o++)i.push(r[o].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}Gf.prototype={o:zs,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let i=this.o[n];return i&&(typeof i=="object"?(i=t.t in i?i[t.t]:zs[n],typeof i=="function"&&r&&(i=i(e,t))):typeof i=="function"&&r&&(i=i(e,t.t,t)),i)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function h1(n){return n}function d1(n,e){this.t="token",this.v=n,this.tk=e}d1.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"\u2026":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=zs.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),i=n.get("tagName",t,e),o=this.toFormattedString(n),a={},c=n.get("className",t,e),f=n.get("target",t,e),h=n.get("rel",t,e),m=n.getObj("attributes",t,e),p=n.getObj("events",t,e);return a.href=r,c&&(a.class=c),f&&(a.target=f),h&&(a.rel=h),m&&Ii(a,m),{tagName:i,attributes:a,content:o,eventListeners:p}}};function fa(n,e){class t extends d1{constructor(i,o){super(i,o),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const p1=fa("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),m1=fa("text"),bA=fa("nl"),ha=fa("url",{isLink:!0,toHref(n=zs.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Is&&n[1].t===wr}}),Kt=n=>new yt(n);function vA({groups:n}){const e=n.domain.concat([Xl,Zl,vr,Ql,ea,ta,na,ra,Vt,Lf,Rs,ia,sa,oa,mn,aa,Ps,la]),t=[wr,Bf,pn,Ff,Rs,Ls,Hf,$f,$l,Wl,Os,Ns,Bl,zl,Fl,Hl,Ul,Vl,Kl,Gl,Jl,ql,jl,Yl],r=[Xl,zf,Zl,Ql,ea,ta,na,ra,Vt,Os,Ns,Rs,ia,sa,oa,Ls,mn,aa,Ps,la],i=Kt(),o=D(i,Ps);te(o,r,o),te(o,n.domain,o);const a=Kt(),c=Kt(),f=Kt();te(i,n.domain,a),te(i,n.scheme,c),te(i,n.slashscheme,f),te(a,r,o),te(a,n.domain,a);const h=D(a,vr);D(o,vr,h),D(c,vr,h),D(f,vr,h);const m=D(o,pn);te(m,r,o),te(m,n.domain,o);const p=Kt();te(h,n.domain,p),te(p,n.domain,p);const g=D(p,pn);te(g,n.domain,p);const b=Kt(p1);te(g,n.tld,b),te(g,n.utld,b),D(h,Is,b);const S=D(p,Vt);D(S,Vt,S),te(S,n.domain,p),te(b,n.domain,p),D(b,pn,g),D(b,Vt,S);const k=D(b,wr);te(k,n.numeric,p1);const C=D(a,Vt),M=D(a,pn);D(C,Vt,C),te(C,n.domain,a),te(M,r,o),te(M,n.domain,a);const P=Kt(ha);te(M,n.tld,P),te(M,n.utld,P),te(P,n.domain,a),te(P,r,o),D(P,pn,M),D(P,Vt,C),D(P,vr,h);const F=D(P,wr),$=Kt(ha);te(F,n.numeric,$);const U=Kt(ha),ce=Kt();te(U,e,U),te(U,t,ce),te(ce,e,U),te(ce,t,ce),D(P,mn,U),D($,mn,U);const fe=D(c,wr),be=D(f,wr),bt=D(be,mn),Jn=D(bt,mn);te(c,n.domain,a),D(c,pn,M),D(c,Vt,C),te(f,n.domain,a),D(f,pn,M),D(f,Vt,C),te(fe,n.domain,U),D(fe,mn,U),D(fe,Ls,U),te(Jn,n.domain,U),te(Jn,e,U),D(Jn,mn,U);const sn=[[Os,Ns],[zl,Bl],[Fl,Hl],[$l,Wl],[Ul,Vl],[Kl,Gl],[Jl,ql],[jl,Yl]];for(let qn=0;qn<sn.length;qn++){const[Zr,on]=sn[qn],wn=D(U,Zr);D(ce,Zr,wn),D(wn,on,U);const He=Kt(ha);te(wn,e,He);const vt=Kt();te(wn,t),te(He,e,He),te(He,t,vt),te(vt,e,He),te(vt,t,vt),D(He,on,U),D(vt,on,U)}return D(i,Is,P),D(i,Df,bA),{start:i,tokens:a1}}function wA(n,e,t){let r=t.length,i=0,o=[],a=[];for(;i<r;){let c=n,f=null,h=null,m=0,p=null,g=-1;for(;i<r&&!(f=c.go(t[i].t));)a.push(t[i++]);for(;i<r&&(h=f||c.go(t[i].t));)f=null,c=h,c.accepts()?(g=0,p=c):g>=0&&g++,i++,m++;if(g<0)i-=m,i<r&&(a.push(t[i]),i++);else{a.length>0&&(o.push(Jf(m1,e,a)),a=[]),i-=g,m-=g;const b=p.t,S=t.slice(i-m,i);o.push(Jf(b,e,S))}}return a.length>0&&o.push(Jf(m1,e,a)),o}function Jf(n,e,t){const r=t[0].s,i=t[t.length-1].e,o=e.slice(r,i);return new n(o,t)}const SA=typeof console<"u"&&console&&console.warn||(()=>{}),xA="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ke={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function kA(){return yt.groups={},ke.scanner=null,ke.parser=null,ke.tokenQueue=[],ke.pluginQueue=[],ke.customSchemes=[],ke.initialized=!1,ke}function g1(n,e=!1){if(ke.initialized&&SA(`linkifyjs: already initialized - will not register custom scheme "${n}" ${xA}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
18
18
  1. Must only contain digits, lowercase ASCII letters or "-"
19
19
  2. Cannot start or end with "-"
20
- 3. "-" cannot repeat`);_e.customSchemes.push([n,e])}function TA(){_e.scanner=bA(_e.customSchemes);for(let n=0;n<_e.tokenQueue.length;n++)_e.tokenQueue[n][1]({scanner:_e.scanner});_e.parser=xA(_e.scanner.tokens);for(let n=0;n<_e.pluginQueue.length;n++)_e.pluginQueue[n][1]({scanner:_e.scanner,parser:_e.parser});return _e.initialized=!0,_e}function pa(n){return _e.initialized||TA(),kA(_e.parser.start,n,f1(_e.scanner.start,n))}pa.scan=f1;function b1(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new Gf(t),i=pa(n),o=[];for(let a=0;a<i.length;a++){const u=i[a];u.isLink&&(!e||u.t===e)&&r.check(u)&&o.push(u.toFormattedObject(r))}return o}function CA(n,e=null){const t=pa(n);return t.length===1&&t[0].isLink&&(!e||t[0].t===e)}class MA extends vf{addProps(){return{handlePaste:this._handlePaste}}_handlePaste(e,t,r){if(e.state.selection.empty)return!1;const i=r.content.textBetween(0,r.content.size).trim(),o=CA(i);if(!i||!o)return!1;const a=this._createLinkAttrs(i,r.content);return this.editor.commands.applyLink(a),!0}_createLinkAttrs(e,t){return yd.query(t,{typeName:de.TEXT,mark:{typeName:me.LINK},getMark:{typeName:me.LINK}})?.attrs||{href:e}}}function z(n){return(...e)=>t=>n(t,...e)}function ma(n){const e=Object.entries(n).reduce((t,[r,i])=>{if(!i)return t;const o=r.replace(/_/g,"-");return`${t}--zw-${o}:${i};`},"");return e?{style:e}:null}function Jr(n){const e=ma(n);return["span",e?{...e,class:"zw-style"}:{},0]}function AA(n){return n.toLowerCase().replace(/(?:^|\s)\S/g,e=>e.toUpperCase())}function Kt(n,...e){return({editor:t})=>(t.commands[n](...e),!0)}var IA=Object.defineProperty,OA=(n,e,t)=>e in n?IA(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Hn=(n,e,t)=>OA(n,typeof e!="symbol"?e+"":e,t),w1,S1,x1;function ze(n,e){let t=n.length;Array.isArray(n[0])||(n=[n]),Array.isArray(e[0])||(e=e.map(a=>[a]));let r=e[0].length,i=e[0].map((a,u)=>e.map(f=>f[u])),o=n.map(a=>i.map(u=>{let f=0;if(!Array.isArray(a)){for(let d of u)f+=a*d;return f}for(let d=0;d<a.length;d++)f+=a[d]*(u[d]||0);return f}));return t===1&&(o=o[0]),r===1?o.map(a=>a[0]):o}function k1(n){return Fs(n)==="string"}function Fs(n){return(Object.prototype.toString.call(n).match(/^\[object\s+(.*?)\]$/)[1]||"").toLowerCase()}function qf(n,{precision:e,unit:t}){return jf(n)?"none":NA(n,e)+(t??"")}function jf(n){return Number.isNaN(n)||n instanceof Number&&n?.none}function NA(n,e){if(n===0)return 0;let t=~~n,r=0;t&&e&&(r=~~Math.log10(Math.abs(t))+1);const i=10**(e-r);return Math.floor(n*i+.5)/i}const RA={deg:1,grad:.9,rad:180/Math.PI,turn:360};function LA(n){if(!n)return;n=n.trim();const e=/^([a-z]+)\((.+?)\)$/i,t=/^-?[\d.]+$/,r=/%|deg|g?rad|turn$/,i=/\/?\s*(none|[-\w.]+(?:%|deg|g?rad|turn)?)/g;let o=n.match(e);if(o){let a=[];return o[2].replace(i,(u,f)=>{let d=f.match(r),m=f;if(d){let p=d[0],g=m.slice(0,-p.length);p==="%"?(m=new Number(g/100),m.type="<percentage>"):(m=new Number(g*RA[p]),m.type="<angle>",m.unit=p)}else t.test(m)?(m=new Number(m),m.type="<number>"):m==="none"&&(m=new Number(NaN),m.none=!0);u.startsWith("/")&&(m=m instanceof Number?m:new Number(m),m.alpha=!0),typeof m=="object"&&m instanceof Number&&(m.raw=f),a.push(m)}),{name:o[1].toLowerCase(),rawName:o[1],rawArgs:o[2],args:a}}}function PA(n){return n[n.length-1]}function E1(n,e,t){return isNaN(n)?e:isNaN(e)?n:n+(e-n)*t}function DA(n,e,t){return(t-n)/(e-n)}function _1(n,e,t){return E1(e[0],e[1],DA(n[0],n[1],t))}function zA(n){return n.map(e=>e.split("|").map(t=>{t=t.trim();let r=t.match(/^(<[a-z]+>)\[(-?[.\d]+),\s*(-?[.\d]+)\]?$/);if(r){let i=new String(r[1]);return i.range=[+r[2],+r[3]],i}return t}))}function BA(n,e,t){return Math.max(Math.min(t,e),n)}function Yf(n,e){return Math.sign(n)===Math.sign(e)?n:-n}function $n(n,e){return Yf(Math.abs(n)**e,n)}function v1(n,e){return e===0?0:n/e}function FA(n,e,t=0,r=n.length){for(;t<r;){const i=t+r>>1;n[i]<e?t=i+1:r=i}return t}class HA{add(e,t,r){if(typeof arguments[0]!="string"){for(var e in arguments[0])this.add(e,arguments[0][e],arguments[1]);return}(Array.isArray(e)?e:[e]).forEach(function(i){this[i]=this[i]||[],t&&this[i][r?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(r){r.call(t&&t.context?t.context:t,t)})}}const ga=new HA,Wn={D50:[.3457/.3585,1,(1-.3457-.3585)/.3585],D65:[.3127/.329,1,(1-.3127-.329)/.329]};function Xf(n){return Array.isArray(n)?n:Wn[n]}function ya(n,e,t,r={}){if(n=Xf(n),e=Xf(e),!n||!e)throw new TypeError(`Missing white point to convert ${n?"":"from"}${!n&&!e?"/":""}${e?"":"to"}`);if(n===e)return t;let i={W1:n,W2:e,XYZ:t,options:r};if(ga.run("chromatic-adaptation-start",i),i.M||(i.W1===Wn.D65&&i.W2===Wn.D50?i.M=[[1.0479297925449969,.022946870601609652,-.05019226628920524],[.02962780877005599,.9904344267538799,-.017073799063418826],[-.009243040646204504,.015055191490298152,.7518742814281371]]:i.W1===Wn.D50&&i.W2===Wn.D65&&(i.M=[[.955473421488075,-.02309845494876471,.06325924320057072],[-.0283697093338637,1.0099953980813041,.021041441191917323],[.012314014864481998,-.020507649298898964,1.330365926242124]])),ga.run("chromatic-adaptation-end",i),i.M)return ze(i.M,i.XYZ);throw new TypeError("Only Bradford CAT with white points D50 and D65 supported for now.")}const Hs={gamut_mapping:"css",precision:5,deltaE:"76",verbose:((x1=(S1=(w1=globalThis?.process)==null?void 0:w1.env)==null?void 0:S1.NODE_ENV)==null?void 0:x1.toLowerCase())!=="test",warn:function(e){var t,r;this.verbose&&((r=(t=globalThis?.console)==null?void 0:t.warn)==null||r.call(t,e))}},$A=new Set(["<number>","<percentage>","<angle>"]);function T1(n,e,t,r){return Object.entries(n.coords).map(([o,a],u)=>{let f=e.coordGrammar[u],d=r[u],m=d?.type,p;if(d.none?p=f.find(x=>$A.has(x)):p=f.find(x=>x==m),!p){let x=a.name||o;throw new TypeError(`${m??d.raw} not allowed for ${x} in ${t}()`)}let g=p.range;m==="<percentage>"&&(g||(g=[0,1]));let b=a.range||a.refRange;return g&&b&&(r[u]=_1(g,b,r[u])),p})}function C1(n,{meta:e}={}){var t,r,i,o;let a={str:(t=String(n))==null?void 0:t.trim()};if(ga.run("parse-start",a),a.color)return a.color;if(a.parsed=LA(a.str),a.parsed){let u=a.parsed.name;if(u==="color"){let f=a.parsed.args.shift(),d=f.startsWith("--")?f.substring(2):`--${f}`,m=[f,d],p=a.parsed.rawArgs.indexOf("/")>0?a.parsed.args.pop():1;for(let x of re.all){let E=x.getFormat("color");if(E&&(m.includes(E.id)||(r=E.ids)!=null&&r.filter(C=>m.includes(C)).length)){const C=Object.keys(x.coords).map((P,F)=>a.parsed.args[F]||0);let M;return E.coordGrammar&&(M=T1(x,E,"color",C)),e&&Object.assign(e,{formatId:"color",types:M}),E.id.startsWith("--")&&!f.startsWith("--")&&Hs.warn(`${x.name} is a non-standard space and not currently supported in the CSS spec. Use prefixed color(${E.id}) instead of color(${f}).`),f.startsWith("--")&&!E.id.startsWith("--")&&Hs.warn(`${x.name} is a standard space and supported in the CSS spec. Use color(${E.id}) instead of prefixed color(${f}).`),{spaceId:x.id,coords:C,alpha:p}}}let g="",b=f in re.registry?f:d;if(b in re.registry){let x=(o=(i=re.registry[b].formats)==null?void 0:i.color)==null?void 0:o.id;x&&(g=`Did you mean color(${x})?`)}throw new TypeError(`Cannot parse color(${f}). `+(g||"Missing a plugin?"))}else for(let f of re.all){let d=f.getFormat(u);if(d&&d.type==="function"){let m=1;(d.lastAlpha||PA(a.parsed.args).alpha)&&(m=a.parsed.args.pop());let p=a.parsed.args,g;return d.coordGrammar&&(g=T1(f,d,u,p)),e&&Object.assign(e,{formatId:d.name,types:g}),{spaceId:f.id,coords:p,alpha:m}}}}else for(let u of re.all)for(let f in u.formats){let d=u.formats[f];if(d.type!=="custom"||d.test&&!d.test(a.str))continue;let m=d.parse(a.str);if(m)return m.alpha??(m.alpha=1),e&&(e.formatId=f),m}throw new TypeError(`Could not parse ${n} as a color. Missing a plugin?`)}function Ve(n){if(Array.isArray(n))return n.map(Ve);if(!n)throw new TypeError("Empty color reference");k1(n)&&(n=C1(n));let e=n.space||n.spaceId;return e instanceof re||(n.space=re.get(e)),n.alpha===void 0&&(n.alpha=1),n}const WA=75e-6,Zf=class nn{constructor(e){var t;this.id=e.id,this.name=e.name,this.base=e.base?nn.get(e.base):null,this.aliases=e.aliases,this.base&&(this.fromBase=e.fromBase,this.toBase=e.toBase);let r=e.coords??this.base.coords;for(let o in r)"name"in r[o]||(r[o].name=o);this.coords=r;let i=e.white??this.base.white??"D65";this.white=Xf(i),this.formats=e.formats??{};for(let o in this.formats){let a=this.formats[o];a.type||(a.type="function"),a.name||(a.name=o)}(t=this.formats.color)!=null&&t.id||(this.formats.color={...this.formats.color??{},id:e.cssId||this.id}),e.gamutSpace?this.gamutSpace=e.gamutSpace==="self"?this:nn.get(e.gamutSpace):this.isPolar?this.gamutSpace=this.base:this.gamutSpace=this,this.gamutSpace.isUnbounded&&(this.inGamut=(o,a)=>!0),this.referred=e.referred,Object.defineProperty(this,"path",{value:UA(this).reverse(),writable:!1,enumerable:!0,configurable:!0}),ga.run("colorspace-init-end",this)}inGamut(e,{epsilon:t=WA}={}){if(!this.equals(this.gamutSpace))return e=this.to(this.gamutSpace,e),this.gamutSpace.inGamut(e,{epsilon:t});let r=Object.values(this.coords);return e.every((i,o)=>{let a=r[o];if(a.type!=="angle"&&a.range){if(Number.isNaN(i))return!0;let[u,f]=a.range;return(u===void 0||i>=u-t)&&(f===void 0||i<=f+t)}return!0})}get isUnbounded(){return Object.values(this.coords).every(e=>!("range"in e))}get cssId(){var e,t;return((t=(e=this.formats)==null?void 0:e.color)==null?void 0:t.id)||this.id}get isPolar(){for(let e in this.coords)if(this.coords[e].type==="angle")return!0;return!1}getFormat(e){if(typeof e=="object")return e=M1(e,this),e;let t;return e==="default"?t=Object.values(this.formats)[0]:t=this.formats[e],t?(t=M1(t,this),t):null}equals(e){return e?this===e||this.id===e||this.id===e.id:!1}to(e,t){if(arguments.length===1){const u=Ve(e);[e,t]=[u.space,u.coords]}if(e=nn.get(e),this.equals(e))return t;t=t.map(u=>Number.isNaN(u)?0:u);let r=this.path,i=e.path,o,a;for(let u=0;u<r.length&&r[u].equals(i[u]);u++)o=r[u],a=u;if(!o)throw new Error(`Cannot convert between color spaces ${this} and ${e}: no connection space was found`);for(let u=r.length-1;u>a;u--)t=r[u].toBase(t);for(let u=a+1;u<i.length;u++)t=i[u].fromBase(t);return t}from(e,t){if(arguments.length===1){const r=Ve(e);[e,t]=[r.space,r.coords]}return e=nn.get(e),e.to(this,t)}toString(){return`${this.name} (${this.id})`}getMinCoords(){let e=[];for(let t in this.coords){let r=this.coords[t],i=r.range||r.refRange;e.push(i?.min??0)}return e}static get all(){return[...new Set(Object.values(nn.registry))]}static register(e,t){if(arguments.length===1&&(t=arguments[0],e=t.id),t=this.get(t),this.registry[e]&&this.registry[e]!==t)throw new Error(`Duplicate color space registration: '${e}'`);if(this.registry[e]=t,arguments.length===1&&t.aliases)for(let r of t.aliases)this.register(r,t);return t}static get(e,...t){if(!e||e instanceof nn)return e;if(Fs(e)==="string"){let i=nn.registry[e.toLowerCase()];if(!i)throw new TypeError(`No color space found with id = "${e}"`);return i}if(t.length)return nn.get(...t);throw new TypeError(`${e} is not a valid color space`)}static resolveCoord(e,t){var r;let i=Fs(e),o,a;if(i==="string"?e.includes(".")?[o,a]=e.split("."):[o,a]=[,e]:Array.isArray(e)?[o,a]=e:(o=e.space,a=e.coordId),o=nn.get(o),o||(o=t),!o)throw new TypeError(`Cannot resolve coordinate reference ${e}: No color space specified and relative references are not allowed here`);if(i=Fs(a),i==="number"||i==="string"&&a>=0){let d=Object.entries(o.coords)[a];if(d)return{space:o,id:d[0],index:a,...d[1]}}o=nn.get(o);let u=a.toLowerCase(),f=0;for(let d in o.coords){let m=o.coords[d];if(d.toLowerCase()===u||((r=m.name)==null?void 0:r.toLowerCase())===u)return{space:o,id:d,index:f,...m};f++}throw new TypeError(`No "${a}" coordinate found in ${o.name}. Its coordinates are: ${Object.keys(o.coords).join(", ")}`)}};Hn(Zf,"registry",{}),Hn(Zf,"DEFAULT_FORMAT",{type:"functions",name:"color"});let re=Zf;function UA(n){let e=[n];for(let t=n;t=t.base;)e.push(t);return e}function M1(n,{coords:e}={}){if(n.coords&&!n.coordGrammar){n.type||(n.type="function"),n.name||(n.name="color"),n.coordGrammar=zA(n.coords);let t=Object.entries(e).map(([r,i],o)=>{let a=n.coordGrammar[o][0],u=i.range||i.refRange,f=a.range,d="";return a=="<percentage>"?(f=[0,100],d="%"):a=="<angle>"&&(d="deg"),{fromRange:u,toRange:f,suffix:d}});n.serializeCoords=(r,i)=>r.map((o,a)=>{let{fromRange:u,toRange:f,suffix:d}=t[a];return u&&f&&(o=_1(u,f,o)),o=qf(o,{precision:i,unit:d}),o})}return n}const Un=new re({id:"xyz-d65",name:"XYZ D65",coords:{x:{name:"X"},y:{name:"Y"},z:{name:"Z"}},white:"D65",formats:{color:{ids:["xyz-d65","xyz"]}},aliases:["xyz"]});class A1 extends re{constructor(e){e.coords||(e.coords={r:{range:[0,1],name:"Red"},g:{range:[0,1],name:"Green"},b:{range:[0,1],name:"Blue"}}),e.base||(e.base=Un),e.toXYZ_M&&e.fromXYZ_M&&(e.toBase??(e.toBase=t=>{let r=ze(e.toXYZ_M,t);return this.white!==this.base.white&&(r=ya(this.white,this.base.white,r)),r}),e.fromBase??(e.fromBase=t=>(t=ya(this.base.white,this.white,t),ze(e.fromXYZ_M,t)))),e.referred??(e.referred="display"),super(e)}}function Qf(n,e){return n=Ve(n),!e||n.space.equals(e)?n.coords.slice():(e=re.get(e),e.from(n))}function Vn(n,e){n=Ve(n);let{space:t,index:r}=re.resolveCoord(e,n.space);return Qf(n,t)[r]}function I1(n,e,t){return n=Ve(n),e=re.get(e),n.coords=e.to(n.space,t),n}I1.returns="color";function ed(n,e,t){if(n=Ve(n),arguments.length===2&&Fs(arguments[1])==="object"){let r=arguments[1];for(let i in r)ed(n,i,r[i])}else{typeof t=="function"&&(t=t(Vn(n,e)));let{space:r,index:i}=re.resolveCoord(e,n.space),o=Qf(n,r);o[i]=t,I1(n,r,o)}return n}ed.returns="color";const VA=new re({id:"xyz-d50",name:"XYZ D50",white:"D50",base:Un,fromBase:n=>ya(Un.white,"D50",n),toBase:n=>ya("D50",Un.white,n)}),KA=216/24389,O1=24/116,ba=24389/27;let td=Wn.D50;const Kn=new re({id:"lab",name:"Lab",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:td,base:VA,fromBase(n){let t=n.map((r,i)=>r/td[i]).map(r=>r>KA?Math.cbrt(r):(ba*r+16)/116);return[116*t[1]-16,500*(t[0]-t[1]),200*(t[1]-t[2])]},toBase(n){let e=[];return e[1]=(n[0]+16)/116,e[0]=n[1]/500+e[1],e[2]=e[1]-n[2]/200,[e[0]>O1?Math.pow(e[0],3):(116*e[0]-16)/ba,n[0]>8?Math.pow((n[0]+16)/116,3):n[0]/ba,e[2]>O1?Math.pow(e[2],3):(116*e[2]-16)/ba].map((r,i)=>r*td[i])},formats:{lab:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function qr(n){return(n%360+360)%360}const wa=new re({id:"lch",name:"LCH",coords:{l:{refRange:[0,100],name:"Lightness"},c:{refRange:[0,150],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:Kn,fromBase(n){let[e,t,r]=n,i;const o=.02;return Math.abs(t)<o&&Math.abs(r)<o?i=NaN:i=Math.atan2(r,t)*180/Math.PI,[e,Math.sqrt(t**2+r**2),qr(i)]},toBase(n){let[e,t,r]=n;return t<0&&(t=0),isNaN(r)&&(r=0),[e,t*Math.cos(r*Math.PI/180),t*Math.sin(r*Math.PI/180)]},formats:{lch:{coords:["<number> | <percentage>","<number> | <percentage>","<number> | <angle>"]}}}),N1=25**7,Sa=Math.PI,R1=180/Sa,Ri=Sa/180;function L1(n){const e=n*n;return e*e*e*n}function P1(n,e,{kL:t=1,kC:r=1,kH:i=1}={}){[n,e]=Ve([n,e]);let[o,a,u]=Kn.from(n),f=wa.from(Kn,[o,a,u])[1],[d,m,p]=Kn.from(e),g=wa.from(Kn,[d,m,p])[1];f<0&&(f=0),g<0&&(g=0);let b=(f+g)/2,x=L1(b),E=.5*(1-Math.sqrt(x/(x+N1))),C=(1+E)*a,M=(1+E)*m,P=Math.sqrt(C**2+u**2),F=Math.sqrt(M**2+p**2),$=C===0&&u===0?0:Math.atan2(u,C),U=M===0&&p===0?0:Math.atan2(p,M);$<0&&($+=2*Sa),U<0&&(U+=2*Sa),$*=R1,U*=R1;let ue=d-o,fe=F-P,we=U-$,yt=$+U,Jn=Math.abs(we),sn;P*F===0?sn=0:Jn<=180?sn=we:we>180?sn=we-360:we<-180?sn=we+360:Hs.warn("the unthinkable has happened");let qn=2*Math.sqrt(F*P)*Math.sin(sn*Ri/2),Qr=(o+d)/2,on=(P+F)/2,wn=L1(on),Fe;P*F===0?Fe=yt:Jn<=180?Fe=yt/2:yt<360?Fe=(yt+360)/2:Fe=(yt-360)/2;let bt=(Qr-50)**2,jn=1+.015*bt/Math.sqrt(20+bt),Js=1+.045*on,ln=1;ln-=.17*Math.cos((Fe-30)*Ri),ln+=.24*Math.cos(2*Fe*Ri),ln+=.32*Math.cos((3*Fe+6)*Ri),ln-=.2*Math.cos((4*Fe-63)*Ri);let wt=1+.015*on*ln,Na=30*Math.exp(-1*((Fe-275)/25)**2),Ra=2*Math.sqrt(wn/(wn+N1)),La=-1*Math.sin(2*Na*Ri)*Ra,Gt=(ue/(t*jn))**2;return Gt+=(fe/(r*Js))**2,Gt+=(qn/(i*wt))**2,Gt+=La*(fe/(r*Js))*(qn/(i*wt)),Math.sqrt(Gt)}const GA=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],JA=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],qA=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],jA=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],xa=new re({id:"oklab",name:"Oklab",coords:{l:{refRange:[0,1],name:"Lightness"},a:{refRange:[-.4,.4]},b:{refRange:[-.4,.4]}},white:"D65",base:Un,fromBase(n){let t=ze(GA,n).map(r=>Math.cbrt(r));return ze(qA,t)},toBase(n){let t=ze(jA,n).map(r=>r**3);return ze(JA,t)},formats:{oklab:{coords:["<percentage> | <number>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function nd(n,e){[n,e]=Ve([n,e]);let[t,r,i]=xa.from(n),[o,a,u]=xa.from(e),f=t-o,d=r-a,m=i-u;return Math.sqrt(f**2+d**2+m**2)}const YA=75e-6;function Li(n,e,{epsilon:t=YA}={}){n=Ve(n),e||(e=n.space),e=re.get(e);let r=n.coords;return e!==n.space&&(r=e.from(n)),e.inGamut(r,{epsilon:t})}function rd(n){return{space:n.space,coords:n.coords.slice(),alpha:n.alpha}}function XA(n,e,t="lab"){t=re.get(t);let r=t.from(n),i=t.from(e);return Math.sqrt(r.reduce((o,a,u)=>{let f=i[u];return isNaN(a)||isNaN(f)?o:o+(f-a)**2},0))}function ZA(n,e){return XA(n,e,"lab")}const QA=Math.PI,D1=QA/180;function eI(n,e,{l:t=2,c:r=1}={}){[n,e]=Ve([n,e]);let[i,o,a]=Kn.from(n),[,u,f]=wa.from(Kn,[i,o,a]),[d,m,p]=Kn.from(e),g=wa.from(Kn,[d,m,p])[1];u<0&&(u=0),g<0&&(g=0);let b=i-d,x=u-g,E=o-m,C=a-p,M=E**2+C**2-x**2,P=.511;i>=16&&(P=.040975*i/(1+.01765*i));let F=.0638*u/(1+.0131*u)+.638,$;Number.isNaN(f)&&(f=0),f>=164&&f<=345?$=.56+Math.abs(.2*Math.cos((f+168)*D1)):$=.36+Math.abs(.4*Math.cos((f+35)*D1));let U=Math.pow(u,4),ue=Math.sqrt(U/(U+1900)),fe=F*(ue*$+1-ue),we=(b/(t*P))**2;return we+=(x/(r*F))**2,we+=M/fe**2,Math.sqrt(we)}const z1=203,B1=new re({id:"xyz-abs-d65",cssId:"--xyz-abs-d65",name:"Absolute XYZ D65",coords:{x:{refRange:[0,9504.7],name:"Xa"},y:{refRange:[0,1e4],name:"Ya"},z:{refRange:[0,10888.3],name:"Za"}},base:Un,fromBase(n){return n.map(e=>Math.max(e*z1,0))},toBase(n){return n.map(e=>Math.max(e/z1,0))}}),ka=1.15,Ea=.66,F1=2610/2**14,tI=2**14/2610,H1=3424/2**12,$1=2413/2**7,W1=2392/2**7,nI=1.7*2523/2**5,U1=2**5/(1.7*2523),_a=-.56,id=16295499532821565e-27,rI=[[.41478972,.579999,.014648],[-.20151,1.120649,.0531008],[-.0166008,.2648,.6684799]],iI=[[1.9242264357876067,-1.0047923125953657,.037651404030618],[.35031676209499907,.7264811939316552,-.06538442294808501],[-.09098281098284752,-.3127282905230739,1.5227665613052603]],sI=[[.5,.5,0],[3.524,-4.066708,.542708],[.199076,1.096799,-1.295875]],oI=[[1,.1386050432715393,.05804731615611886],[.9999999999999999,-.1386050432715393,-.05804731615611886],[.9999999999999998,-.09601924202631895,-.8118918960560388]],lI=new re({id:"jzazbz",name:"Jzazbz",coords:{jz:{refRange:[0,1],name:"Jz"},az:{refRange:[-.5,.5]},bz:{refRange:[-.5,.5]}},base:B1,fromBase(n){let[e,t,r]=n,i=ka*e-(ka-1)*r,o=Ea*t-(Ea-1)*e,u=ze(rI,[i,o,r]).map(function(g){let b=H1+$1*(g/1e4)**F1,x=1+W1*(g/1e4)**F1;return(b/x)**nI}),[f,d,m]=ze(sI,u);return[(1+_a)*f/(1+_a*f)-id,d,m]},toBase(n){let[e,t,r]=n,i=(e+id)/(1+_a-_a*(e+id)),a=ze(oI,[i,t,r]).map(function(g){let b=H1-g**U1,x=W1*g**U1-$1;return 1e4*(b/x)**tI}),[u,f,d]=ze(iI,a),m=(u+(ka-1)*d)/ka,p=(f+(Ea-1)*m)/Ea;return[m,p,d]},formats:{color:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}}),V1=new re({id:"jzczhz",name:"JzCzHz",coords:{jz:{refRange:[0,1],name:"Jz"},cz:{refRange:[0,1],name:"Chroma"},hz:{refRange:[0,360],type:"angle",name:"Hue"}},base:lI,fromBase(n){let[e,t,r]=n,i;const o=2e-4;return Math.abs(t)<o&&Math.abs(r)<o?i=NaN:i=Math.atan2(r,t)*180/Math.PI,[e,Math.sqrt(t**2+r**2),qr(i)]},toBase(n){return[n[0],n[1]*Math.cos(n[2]*Math.PI/180),n[1]*Math.sin(n[2]*Math.PI/180)]}});function aI(n,e){[n,e]=Ve([n,e]);let[t,r,i]=V1.from(n),[o,a,u]=V1.from(e),f=t-o,d=r-a;Number.isNaN(i)&&Number.isNaN(u)?(i=0,u=0):Number.isNaN(i)?i=u:Number.isNaN(u)&&(u=i);let m=i-u,p=2*Math.sqrt(r*a)*Math.sin(m/2*(Math.PI/180));return Math.sqrt(f**2+d**2+p**2)}const K1=3424/4096,G1=2413/128,J1=2392/128,q1=2610/16384,uI=2523/32,cI=16384/2610,j1=32/2523,fI=[[.3592832590121217,.6976051147779502,-.035891593232029],[-.1920808463704993,1.100476797037432,.0753748658519118],[.0070797844607479,.0748396662186362,.8433265453898765]],dI=[[2048/4096,2048/4096,0],[6610/4096,-13613/4096,7003/4096],[17933/4096,-17390/4096,-543/4096]],hI=[[.9999999999999998,.0086090370379328,.111029625003026],[.9999999999999998,-.0086090370379328,-.1110296250030259],[.9999999999999998,.5600313357106791,-.3206271749873188]],pI=[[2.0701522183894223,-1.3263473389671563,.2066510476294053],[.3647385209748072,.6805660249472273,-.0453045459220347],[-.0497472075358123,-.0492609666966131,1.1880659249923042]],Y1=new re({id:"ictcp",name:"ICTCP",coords:{i:{refRange:[0,1],name:"I"},ct:{refRange:[-.5,.5],name:"CT"},cp:{refRange:[-.5,.5],name:"CP"}},base:B1,fromBase(n){let e=ze(fI,n);return mI(e)},toBase(n){let e=gI(n);return ze(pI,e)}});function mI(n){let e=n.map(function(t){let r=K1+G1*(t/1e4)**q1,i=1+J1*(t/1e4)**q1;return(r/i)**uI});return ze(dI,e)}function gI(n){return ze(hI,n).map(function(r){let i=Math.max(r**j1-K1,0),o=G1-J1*r**j1;return 1e4*(i/o)**cI})}function yI(n,e){[n,e]=Ve([n,e]);let[t,r,i]=Y1.from(n),[o,a,u]=Y1.from(e);return 720*Math.sqrt((t-o)**2+.25*(r-a)**2+(i-u)**2)}const bI=Wn.D65,X1=.42,Z1=1/X1,sd=2*Math.PI,Q1=[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],wI=[[1.8620678550872327,-1.0112546305316843,.14918677544445175],[.38752654323613717,.6214474419314753,-.008973985167612518],[-.015841498849333856,-.03412293802851557,1.0499644368778496]],SI=[[460,451,288],[460,-891,-261],[460,-220,-6300]],xI={dark:[.8,.525,.8],dim:[.9,.59,.9],average:[1,.69,1]},jr={h:[20.14,90,164.25,237.53,380.14],e:[.8,.7,1,1.2,.8],H:[0,100,200,300,400]},kI=180/Math.PI,ey=Math.PI/180;function ty(n,e){return n.map(r=>{const i=$n(e*Math.abs(r)*.01,X1);return 400*Yf(i,r)/(i+27.13)})}function EI(n,e){const t=100/e*27.13**Z1;return n.map(r=>{const i=Math.abs(r);return Yf(t*$n(i/(400-i),Z1),r)})}function _I(n){let e=qr(n);e<=jr.h[0]&&(e+=360);const t=FA(jr.h,e)-1,[r,i]=jr.h.slice(t,t+2),[o,a]=jr.e.slice(t,t+2),u=jr.H[t],f=(e-r)/o;return u+100*f/(f+(i-e)/a)}function vI(n){let e=(n%400+400)%400;const t=Math.floor(.01*e);e=e%100;const[r,i]=jr.h.slice(t,t+2),[o,a]=jr.e.slice(t,t+2);return qr((e*(a*r-o*i)-100*r*a)/(e*(a-o)-100*a))}function ny(n,e,t,r,i){const o={};o.discounting=i,o.refWhite=n,o.surround=r;const a=n.map(E=>E*100);o.la=e,o.yb=t;const u=a[1],f=ze(Q1,a);r=xI[o.surround];const d=r[0];o.c=r[1],o.nc=r[2];const p=(1/(5*o.la+1))**4;o.fl=p*o.la+.1*(1-p)*(1-p)*Math.cbrt(5*o.la),o.flRoot=o.fl**.25,o.n=o.yb/u,o.z=1.48+Math.sqrt(o.n),o.nbb=.725*o.n**-.2,o.ncb=o.nbb;const g=Math.max(Math.min(d*(1-1/3.6*Math.exp((-o.la-42)/92)),1),0);o.dRgb=f.map(E=>E1(1,u/E,g)),o.dRgbInv=o.dRgb.map(E=>1/E);const b=f.map((E,C)=>E*o.dRgb[C]),x=ty(b,o.fl);return o.aW=o.nbb*(2*x[0]+x[1]+.05*x[2]),o}const ry=ny(bI,64/Math.PI*.2,20,"average",!1);function od(n,e){if(!(n.J!==void 0^n.Q!==void 0))throw new Error("Conversion requires one and only one: 'J' or 'Q'");if(!(n.C!==void 0^n.M!==void 0^n.s!==void 0))throw new Error("Conversion requires one and only one: 'C', 'M' or 's'");if(!(n.h!==void 0^n.H!==void 0))throw new Error("Conversion requires one and only one: 'h' or 'H'");if(n.J===0||n.Q===0)return[0,0,0];let t=0;n.h!==void 0?t=qr(n.h)*ey:t=vI(n.H)*ey;const r=Math.cos(t),i=Math.sin(t);let o=0;n.J!==void 0?o=$n(n.J,1/2)*.1:n.Q!==void 0&&(o=.25*e.c*n.Q/((e.aW+4)*e.flRoot));let a=0;n.C!==void 0?a=n.C/o:n.M!==void 0?a=n.M/e.flRoot/o:n.s!==void 0&&(a=4e-4*n.s**2*(e.aW+4)/e.c);const u=$n(a*Math.pow(1.64-Math.pow(.29,e.n),-.73),10/9),f=.25*(Math.cos(t+2)+3.8),d=e.aW*$n(o,2/e.c/e.z),m=5e4/13*e.nc*e.ncb*f,p=d/e.nbb,g=23*(p+.305)*v1(u,23*m+u*(11*r+108*i)),b=g*r,x=g*i,E=EI(ze(SI,[p,b,x]).map(C=>C*1/1403),e.fl);return ze(wI,E.map((C,M)=>C*e.dRgbInv[M])).map(C=>C/100)}function iy(n,e){const t=n.map(F=>F*100),r=ty(ze(Q1,t).map((F,$)=>F*e.dRgb[$]),e.fl),i=r[0]+(-12*r[1]+r[2])/11,o=(r[0]+r[1]-2*r[2])/9,a=(Math.atan2(o,i)%sd+sd)%sd,u=.25*(Math.cos(a+2)+3.8),f=5e4/13*e.nc*e.ncb*v1(u*Math.sqrt(i**2+o**2),r[0]+r[1]+1.05*r[2]+.305),d=$n(f,.9)*Math.pow(1.64-Math.pow(.29,e.n),.73),m=e.nbb*(2*r[0]+r[1]+.05*r[2]),p=$n(m/e.aW,.5*e.c*e.z),g=100*$n(p,2),b=4/e.c*p*(e.aW+4)*e.flRoot,x=d*p,E=x*e.flRoot,C=qr(a*kI),M=_I(C),P=50*$n(e.c*d/(e.aW+4),1/2);return{J:g,C:x,h:C,s:P,Q:b,M:E,H:M}}new re({id:"cam16-jmh",cssId:"--cam16-jmh",name:"CAM16-JMh",coords:{j:{refRange:[0,100],name:"J"},m:{refRange:[0,105],name:"Colorfulness"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:Un,fromBase(n){const e=iy(n,ry);return[e.J,e.M,e.h]},toBase(n){return od({J:n[0],M:n[1],h:n[2]},ry)}});const TI=Wn.D65,CI=216/24389,sy=24389/27;function MI(n){return 116*(n>CI?Math.cbrt(n):(sy*n+16)/116)-16}function ld(n){return n>8?Math.pow((n+16)/116,3):n/sy}function AI(n,e){let[t,r,i]=n,o=[],a=0;if(i===0)return[0,0,0];let u=ld(i);i>0?a=.00379058511492914*i**2+.608983189401032*i+.9155088574762233:a=9514440756550361e-21*i**2+.08693057439788597*i-21.928975842194614;const f=2e-12,d=15;let m=0,p=1/0;for(;m<=d;){o=od({J:a,C:r,h:t},e);const g=Math.abs(o[1]-u);if(g<p){if(g<=f)return o;p=g}a=a-(o[1]-u)*a/(2*o[1]),m+=1}return od({J:a,C:r,h:t},e)}function II(n,e){const t=MI(n[1]);if(t===0)return[0,0,0];const r=iy(n,ad);return[qr(r.h),r.C,t]}const ad=ny(TI,200/Math.PI*ld(50),ld(50)*100,"average",!1),va=new re({id:"hct",name:"HCT",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},c:{refRange:[0,145],name:"Colorfulness"},t:{refRange:[0,100],name:"Tone"}},base:Un,fromBase(n){return II(n)},toBase(n){return AI(n,ad)},formats:{color:{id:"--hct",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),OI=Math.PI/180,oy=[1,.007,.0228];function ly(n){n[1]<0&&(n=va.fromBase(va.toBase(n)));const e=Math.log(Math.max(1+oy[2]*n[1]*ad.flRoot,1))/oy[2],t=n[0]*OI,r=e*Math.cos(t),i=e*Math.sin(t);return[n[2],r,i]}function NI(n,e){[n,e]=Ve([n,e]);let[t,r,i]=ly(va.from(n)),[o,a,u]=ly(va.from(e));return Math.sqrt((t-o)**2+(r-a)**2+(i-u)**2)}const ay={deltaE76:ZA,deltaECMC:eI,deltaE2000:P1,deltaEJz:aI,deltaEITP:yI,deltaEOK:nd,deltaEHCT:NI};function RI(n){const e=n?Math.floor(Math.log10(Math.abs(n))):0;return Math.max(parseFloat(`1e${e-2}`),1e-6)}const uy={hct:{method:"hct.c",jnd:2,deltaEMethod:"hct",blackWhiteClamp:{}},"hct-tonal":{method:"hct.c",jnd:0,deltaEMethod:"hct",blackWhiteClamp:{channel:"hct.t",min:0,max:100}}};function $s(n,{method:e=Hs.gamut_mapping,space:t=void 0,deltaEMethod:r="",jnd:i=2,blackWhiteClamp:o={}}={}){if(n=Ve(n),k1(arguments[1])?t=arguments[1]:t||(t=n.space),t=re.get(t),Li(n,t,{epsilon:0}))return n;let a;if(e==="css")a=LI(n,{space:t});else{if(e!=="clip"&&!Li(n,t)){Object.prototype.hasOwnProperty.call(uy,e)&&({method:e,jnd:i,deltaEMethod:r,blackWhiteClamp:o}=uy[e]);let u=P1;if(r!==""){for(let d in ay)if("deltae"+r.toLowerCase()===d.toLowerCase()){u=ay[d];break}}let f=$s(Be(n,t),{method:"clip",space:t});if(u(n,f)>i){if(Object.keys(o).length===3){let P=re.resolveCoord(o.channel),F=Vn(Be(n,P.space),P.id);if(jf(F)&&(F=0),F>=o.max)return Be({space:"xyz-d65",coords:Wn.D65},n.space);if(F<=o.min)return Be({space:"xyz-d65",coords:[0,0,0]},n.space)}let d=re.resolveCoord(e),m=d.space,p=d.id,g=Be(n,m);g.coords.forEach((P,F)=>{jf(P)&&(g.coords[F]=0)});let x=(d.range||d.refRange)[0],E=RI(i),C=x,M=Vn(g,p);for(;M-C>E;){let P=rd(g);P=$s(P,{space:t,method:"clip"}),u(g,P)-i<E?C=Vn(g,p):M=Vn(g,p),ed(g,p,(C+M)/2)}a=Be(g,t)}else a=f}else a=Be(n,t);if(e==="clip"||!Li(a,t,{epsilon:0})){let u=Object.values(t.coords).map(f=>f.range||[]);a.coords=a.coords.map((f,d)=>{let[m,p]=u[d];return m!==void 0&&(f=Math.max(m,f)),p!==void 0&&(f=Math.min(f,p)),f})}}return t!==n.space&&(a=Be(a,n.space)),n.coords=a.coords,n}$s.returns="color";const cy={WHITE:{space:xa,coords:[1,0,0]},BLACK:{space:xa,coords:[0,0,0]}};function LI(n,{space:e}={}){n=Ve(n),e||(e=n.space),e=re.get(e);const i=re.get("oklch");if(e.isUnbounded)return Be(n,e);const o=Be(n,i);let a=o.coords[0];if(a>=1){const x=Be(cy.WHITE,e);return x.alpha=n.alpha,Be(x,e)}if(a<=0){const x=Be(cy.BLACK,e);return x.alpha=n.alpha,Be(x,e)}if(Li(o,e,{epsilon:0}))return Be(o,e);function u(x){const E=Be(x,e),C=Object.values(e.coords);return E.coords=E.coords.map((M,P)=>{if("range"in C[P]){const[F,$]=C[P].range;return BA(F,M,$)}return M}),E}let f=0,d=o.coords[1],m=!0,p=rd(o),g=u(p),b=nd(g,p);if(b<.02)return g;for(;d-f>1e-4;){const x=(f+d)/2;if(p.coords[1]=x,m&&Li(p,e,{epsilon:0}))f=x;else if(g=u(p),b=nd(g,p),b<.02){if(.02-b<1e-4)break;m=!1,f=x}else d=x}return g}function Be(n,e,{inGamut:t}={}){n=Ve(n),e=re.get(e);let r=e.from(n),i={space:e,coords:r,alpha:n.alpha};return t&&(i=$s(i,t===!0?void 0:t)),i}Be.returns="color";function PI(n,{precision:e=Hs.precision,format:t="default",inGamut:r=!0,...i}={}){var o;let a;n=Ve(n);let u=t;t=n.space.getFormat(t)??n.space.getFormat("default")??re.DEFAULT_FORMAT;let f=n.coords.slice();if(r||(r=t.toGamut),r&&!Li(n)&&(f=$s(rd(n),r===!0?void 0:r).coords),t.type==="custom")if(i.precision=e,t.serialize)a=t.serialize(f,n.alpha,i);else throw new TypeError(`format ${u} can only be used to parse colors, not for serialization`);else{let d=t.name||"color";t.serializeCoords?f=t.serializeCoords(f,e):e!==null&&(f=f.map(b=>qf(b,{precision:e})));let m=[...f];if(d==="color"){let b=t.id||((o=t.ids)==null?void 0:o[0])||n.space.id;m.unshift(b)}let p=n.alpha;e!==null&&(p=qf(p,{precision:e}));let g=n.alpha>=1||t.noAlpha?"":`${t.commas?",":" /"} ${p}`;a=`${d}(${m.join(t.commas?", ":" ")}${g})`}return a}const DI=[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],zI=[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]],BI=new A1({id:"srgb-linear",name:"Linear sRGB",white:"D65",toXYZ_M:DI,fromXYZ_M:zI}),fy={aliceblue:[240/255,248/255,1],antiquewhite:[250/255,235/255,215/255],aqua:[0,1,1],aquamarine:[127/255,1,212/255],azure:[240/255,1,1],beige:[245/255,245/255,220/255],bisque:[1,228/255,196/255],black:[0,0,0],blanchedalmond:[1,235/255,205/255],blue:[0,0,1],blueviolet:[138/255,43/255,226/255],brown:[165/255,42/255,42/255],burlywood:[222/255,184/255,135/255],cadetblue:[95/255,158/255,160/255],chartreuse:[127/255,1,0],chocolate:[210/255,105/255,30/255],coral:[1,127/255,80/255],cornflowerblue:[100/255,149/255,237/255],cornsilk:[1,248/255,220/255],crimson:[220/255,20/255,60/255],cyan:[0,1,1],darkblue:[0,0,139/255],darkcyan:[0,139/255,139/255],darkgoldenrod:[184/255,134/255,11/255],darkgray:[169/255,169/255,169/255],darkgreen:[0,100/255,0],darkgrey:[169/255,169/255,169/255],darkkhaki:[189/255,183/255,107/255],darkmagenta:[139/255,0,139/255],darkolivegreen:[85/255,107/255,47/255],darkorange:[1,140/255,0],darkorchid:[153/255,50/255,204/255],darkred:[139/255,0,0],darksalmon:[233/255,150/255,122/255],darkseagreen:[143/255,188/255,143/255],darkslateblue:[72/255,61/255,139/255],darkslategray:[47/255,79/255,79/255],darkslategrey:[47/255,79/255,79/255],darkturquoise:[0,206/255,209/255],darkviolet:[148/255,0,211/255],deeppink:[1,20/255,147/255],deepskyblue:[0,191/255,1],dimgray:[105/255,105/255,105/255],dimgrey:[105/255,105/255,105/255],dodgerblue:[30/255,144/255,1],firebrick:[178/255,34/255,34/255],floralwhite:[1,250/255,240/255],forestgreen:[34/255,139/255,34/255],fuchsia:[1,0,1],gainsboro:[220/255,220/255,220/255],ghostwhite:[248/255,248/255,1],gold:[1,215/255,0],goldenrod:[218/255,165/255,32/255],gray:[128/255,128/255,128/255],green:[0,128/255,0],greenyellow:[173/255,1,47/255],grey:[128/255,128/255,128/255],honeydew:[240/255,1,240/255],hotpink:[1,105/255,180/255],indianred:[205/255,92/255,92/255],indigo:[75/255,0,130/255],ivory:[1,1,240/255],khaki:[240/255,230/255,140/255],lavender:[230/255,230/255,250/255],lavenderblush:[1,240/255,245/255],lawngreen:[124/255,252/255,0],lemonchiffon:[1,250/255,205/255],lightblue:[173/255,216/255,230/255],lightcoral:[240/255,128/255,128/255],lightcyan:[224/255,1,1],lightgoldenrodyellow:[250/255,250/255,210/255],lightgray:[211/255,211/255,211/255],lightgreen:[144/255,238/255,144/255],lightgrey:[211/255,211/255,211/255],lightpink:[1,182/255,193/255],lightsalmon:[1,160/255,122/255],lightseagreen:[32/255,178/255,170/255],lightskyblue:[135/255,206/255,250/255],lightslategray:[119/255,136/255,153/255],lightslategrey:[119/255,136/255,153/255],lightsteelblue:[176/255,196/255,222/255],lightyellow:[1,1,224/255],lime:[0,1,0],limegreen:[50/255,205/255,50/255],linen:[250/255,240/255,230/255],magenta:[1,0,1],maroon:[128/255,0,0],mediumaquamarine:[102/255,205/255,170/255],mediumblue:[0,0,205/255],mediumorchid:[186/255,85/255,211/255],mediumpurple:[147/255,112/255,219/255],mediumseagreen:[60/255,179/255,113/255],mediumslateblue:[123/255,104/255,238/255],mediumspringgreen:[0,250/255,154/255],mediumturquoise:[72/255,209/255,204/255],mediumvioletred:[199/255,21/255,133/255],midnightblue:[25/255,25/255,112/255],mintcream:[245/255,1,250/255],mistyrose:[1,228/255,225/255],moccasin:[1,228/255,181/255],navajowhite:[1,222/255,173/255],navy:[0,0,128/255],oldlace:[253/255,245/255,230/255],olive:[128/255,128/255,0],olivedrab:[107/255,142/255,35/255],orange:[1,165/255,0],orangered:[1,69/255,0],orchid:[218/255,112/255,214/255],palegoldenrod:[238/255,232/255,170/255],palegreen:[152/255,251/255,152/255],paleturquoise:[175/255,238/255,238/255],palevioletred:[219/255,112/255,147/255],papayawhip:[1,239/255,213/255],peachpuff:[1,218/255,185/255],peru:[205/255,133/255,63/255],pink:[1,192/255,203/255],plum:[221/255,160/255,221/255],powderblue:[176/255,224/255,230/255],purple:[128/255,0,128/255],rebeccapurple:[102/255,51/255,153/255],red:[1,0,0],rosybrown:[188/255,143/255,143/255],royalblue:[65/255,105/255,225/255],saddlebrown:[139/255,69/255,19/255],salmon:[250/255,128/255,114/255],sandybrown:[244/255,164/255,96/255],seagreen:[46/255,139/255,87/255],seashell:[1,245/255,238/255],sienna:[160/255,82/255,45/255],silver:[192/255,192/255,192/255],skyblue:[135/255,206/255,235/255],slateblue:[106/255,90/255,205/255],slategray:[112/255,128/255,144/255],slategrey:[112/255,128/255,144/255],snow:[1,250/255,250/255],springgreen:[0,1,127/255],steelblue:[70/255,130/255,180/255],tan:[210/255,180/255,140/255],teal:[0,128/255,128/255],thistle:[216/255,191/255,216/255],tomato:[1,99/255,71/255],turquoise:[64/255,224/255,208/255],violet:[238/255,130/255,238/255],wheat:[245/255,222/255,179/255],white:[1,1,1],whitesmoke:[245/255,245/255,245/255],yellow:[1,1,0],yellowgreen:[154/255,205/255,50/255]};let dy=Array(3).fill("<percentage> | <number>[0, 255]"),hy=Array(3).fill("<number>[0, 255]");const py=new A1({id:"srgb",name:"sRGB",base:BI,fromBase:n=>n.map(e=>{let t=e<0?-1:1,r=e*t;return r>.0031308?t*(1.055*r**(1/2.4)-.055):12.92*e}),toBase:n=>n.map(e=>{let t=e<0?-1:1,r=e*t;return r<=.04045?e/12.92:t*((r+.055)/1.055)**2.4}),formats:{rgb:{coords:dy},rgb_number:{name:"rgb",commas:!0,coords:hy,noAlpha:!0},color:{},rgba:{coords:dy,commas:!0,lastAlpha:!0},rgba_number:{name:"rgba",commas:!0,coords:hy},hex:{type:"custom",toGamut:!0,test:n=>/^#([a-f0-9]{3,4}){1,2}$/i.test(n),parse(n){n.length<=5&&(n=n.replace(/[a-f0-9]/gi,"$&$&"));let e=[];return n.replace(/[a-f0-9]{2}/gi,t=>{e.push(parseInt(t,16)/255)}),{spaceId:"srgb",coords:e.slice(0,3),alpha:e.slice(3)[0]}},serialize:(n,e,{collapse:t=!0}={})=>{e<1&&n.push(e),n=n.map(o=>Math.round(o*255));let r=t&&n.every(o=>o%17===0);return"#"+n.map(o=>r?(o/17).toString(16):o.toString(16).padStart(2,"0")).join("")}},keyword:{type:"custom",test:n=>/^[a-z]+$/i.test(n),parse(n){n=n.toLowerCase();let e={spaceId:"srgb",coords:null,alpha:1};if(n==="transparent"?(e.coords=fy.black,e.alpha=0):e.coords=fy[n],e.coords)return e}}}});function FI(n){return Vn(n,[Un,"y"])}const my=new re({id:"hsl",name:"HSL",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:py,fromBase:n=>{let e=Math.max(...n),t=Math.min(...n),[r,i,o]=n,[a,u,f]=[NaN,0,(t+e)/2],d=e-t;if(d!==0){switch(u=f===0||f===1?0:(e-f)/Math.min(f,1-f),e){case r:a=(i-o)/d+(i<o?6:0);break;case i:a=(o-r)/d+2;break;case o:a=(r-i)/d+4}a=a*60}return u<0&&(a+=180,u=Math.abs(u)),a>=360&&(a-=360),[a,u*100,f*100]},toBase:n=>{let[e,t,r]=n;e=e%360,e<0&&(e+=360),t/=100,r/=100;function i(o){let a=(o+e/30)%12,u=t*Math.min(r,1-r);return r-u*Math.max(-1,Math.min(a-3,9-a,1))}return[i(0),i(8),i(4)]},formats:{hsl:{coords:["<number> | <angle>","<percentage>","<percentage>"]},hsla:{coords:["<number> | <angle>","<percentage>","<percentage>"],commas:!0,lastAlpha:!0}}}),HI=new re({id:"hsv",name:"HSV",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},v:{range:[0,100],name:"Value"}},base:my,fromBase(n){let[e,t,r]=n;t/=100,r/=100;let i=r+t*Math.min(r,1-r);return[e,i===0?0:200*(1-r/i),100*i]},toBase(n){let[e,t,r]=n;t/=100,r/=100;let i=r*(1-t/2);return[e,i===0||i===1?0:(r-i)/Math.min(i,1-i)*100,i*100]},formats:{color:{id:"--hsv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});class Ot{constructor(e){Hn(this,"data"),this.data=Be(e,"srgb")}static fromTransparent(){return new Ot({spaceId:"srgb",coords:[1,1,1],alpha:0})}static fromBlack(){return new Ot({spaceId:"srgb",coords:[0,0,0],alpha:1})}static fromWhite(){return new Ot({spaceId:"srgb",coords:[1,1,1],alpha:1})}get r(){return Math.round(this.data.coords[0]*255)}get g(){return Math.round(this.data.coords[1]*255)}get b(){return Math.round(this.data.coords[2]*255)}get h(){return Vn(this.data,"hsv.h")}get s(){return Vn(this.data,"hsv.s")}get v(){return Vn(this.data,"hsv.v")}get alpha(){return this.data.alpha.valueOf()}get alphaPercent(){return Math.round(this.alpha*100)}get isTransparent(){return this.alpha===0}get isDark(){return FI(this.data)<.5}withAlpha(e){return new Ot({...this.data,alpha:e})}withRgb(e){const t=this.alpha===0?1:this.alpha;return new Ot({spaceId:"srgb",alpha:e.a??t,coords:[e.r?e.r/255:this.data.coords[0],e.g?e.g/255:this.data.coords[1],e.b?e.b/255:this.data.coords[2]]})}withHsv(e){const r=Qf(this.data,"hsv"),i=Math.max(e.s??r[1],1e-5),o=Math.max(e.v??r[2],1e-5),a=this.alpha===0?1:this.alpha;return new Ot({alpha:a,spaceId:"hsv",coords:[e.h??r[0],i,o]})}toString(){return this.alpha===1?this.toHexString():this.toRgbaString()}toHexString(){const e=PI(this.data,{format:"hex"}).toUpperCase();return e.length===4?`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`:e.slice(0,7)}toRgbaString(){return`rgba(${this.r}, ${this.g}, ${this.b}, ${this.alphaPercent}%)`}clone(){return new Ot(this.data)}}class $I{constructor(e){Hn(this,"_color"),Hn(this,"isEmpty",!1),this.update(e)}get color(){return this._color}setColor(e){this._color=e}setEmpty(e){this.isEmpty=e}toString(){return this.isEmpty?"":this.color.toString()}isEqual(e){return this.toString()===e}update({solidColor:e,isEmpty:t}){this.setColor(e),this.setEmpty(t)}}let gy=999;function WI(){return gy+=1,gy}function UI(n){return n?n.startsWith("linear-gradient("):!1}function VI(){const n=Ot.fromTransparent();return{isEmpty:!0,isGradient:!1,solidColor:n,angle:0,transitions:[{color:n.clone(),offset:0},{color:n.clone(),offset:100}]}}re.register(py),re.register(HI),re.register(my);function yy(n){if(!n)return Ot.fromTransparent();try{return new Ot(Be(C1(n),"srgb"))}catch(e){return console.warn(e),Ot.fromBlack()}}function KI(n){const e={"to top":0,"to top right":45,"to right":90,"to bottom right":135,"to bottom":180,"to bottom left":225,"to left":270,"to top left":315};return e[n]?e[n]:n.includes("deg")?Number.parseInt(n.trim().replace("deg","")):0}function GI(n){return n.map(e=>{const[t,r]=e.trim().split(/\s+(?![^(]*\))/);return{color:yy(t),offset:Number.parseFloat(r.replace("%",""))}})}function JI(n){const e=n.indexOf("("),t=n.lastIndexOf(")"),[r,...i]=n.slice(e+1,t).split(/,(?![^(]*\))/),o=GI(i),a=KI(r);return{isEmpty:!1,isGradient:!0,solidColor:o[0].color,angle:a,transitions:o}}function qI(n){const e=yy(n),t=Ot.fromWhite();return{isEmpty:!1,isGradient:!1,solidColor:e,angle:0,transitions:[{color:t,offset:0},{color:e.withAlpha(1),offset:100}]}}function jI(n,e=!0){if(!n)return VI();const t=UI(n)?JI(n):qI(n);return t.isGradient&&!e?{...t,isGradient:!1}:t}class md{constructor(e,t=0){Hn(this,"id"),this.color=e,this.offset=t,this.id=WI()}setOffset(e){this.offset=e}toString(){return`${this.color.toString()} ${this.offset}%`}clone(e){return new md(this.color.clone(),e)}}class YI{constructor(e){Hn(this,"isEmpty",!1),Hn(this,"_angle",0),Hn(this,"_transitions",[]),this.update(e)}get transitions(){return this._transitions}get canAddTransition(){return this.transitions.length<5}get canRemoveTransition(){return this.transitions.length>2}get angle(){return this._angle}setAngle(e){this._angle=e}setEmpty(e){this.isEmpty=e}addTransition(e){this.transitions.push(e),this.sortTransitions()}removeTransition(e){this._transitions=this.transitions.filter(({id:t})=>t!==e.id)}sortTransitions(){this._transitions=this.transitions.sort((e,t)=>e.offset-t.offset)}toString(e){if(this.isEmpty)return"";const t=this.transitions.map(r=>r.toString());return`linear-gradient(${e??this.angle}deg, ${t.join(", ")})`}isEqual(e){return this.toString()===e}update(e){this._angle=e.angle,this._transitions=e.transitions.map(({color:t,offset:r})=>new md(t,r)),this.setEmpty(e.isEmpty)}hasTransition(e){return this.transitions.some(t=>t.id===e.id)}}function XI(n){const e=jI(n);return(e.isGradient?new YI(e):new $I(e)).toString()}function by(n){return XI(n)}function wy(n,e){if(!n.includes("em"))return parseInt(n);const t=Pi.getComputedStyle(e).fontSize,r=parseFloat(n)*parseFloat(t);return Math.round(r)}function ZI(n,e){return(n.firstElementChild||n).style.fontSize||Pi.getComputedStyle(e).fontSize}function QI(n,e,t){if(!n.includes("px"))return n;const r=ZI(e,t),i=wy(r,t);return i?(parseInt(n)/i).toFixed(2):null}const eO={start:wr.LEFT,end:wr.RIGHT};function tO(n){const e=eO[n]||n;return wr.values.includes(e)?e:null}const Sy=(n,e,t,r)=>({from:Math.max(r,n.pos),to:Math.min(r+t.nodeSize,e.pos)});function xy(n,e){return n.resolve(e).depth+1}function nO(n,e,t,r){const i=xy(n,r),o=e.from-i<=r,a=e.to+i>=t.nodeSize+r;return o&&a}const rO=(n,e)=>n.eq(e);function iO(n,e,t,r=rO){const i=n.resolve(e).path.slice().reverse();for(const o of i)if(typeof o!="number"){for(const a of o.marks)if(r(a,t))return!0}return!1}function sO(n,e){const t=typeof e=="string"?e:e.name;return n.find(r=>r.type.name===t)}var Ta=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ws={exports:{}};var oO=Ws.exports,ky;function lO(){return ky||(ky=1,function(n,e){(function(){var t,r="4.17.21",i=200,o="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",u="Invalid `variable` option passed into `_.template`",f="__lodash_hash_undefined__",d=500,m="__lodash_placeholder__",p=1,g=2,b=4,x=1,E=2,C=1,M=2,P=4,F=8,$=16,U=32,ue=64,fe=128,we=256,yt=512,Jn=30,sn="...",qn=800,Qr=16,on=1,wn=2,Fe=3,bt=1/0,jn=9007199254740991,Js=17976931348623157e292,ln=NaN,wt=4294967295,Na=wt-1,Ra=wt>>>1,La=[["ary",fe],["bind",C],["bindKey",M],["curry",F],["curryRight",$],["flip",yt],["partial",U],["partialRight",ue],["rearg",we]],Gt="[object Arguments]",qs="[object Array]",Iy="[object AsyncFunction]",Hi="[object Boolean]",$i="[object Date]",Oy="[object DOMException]",js="[object Error]",Ys="[object Function]",bd="[object GeneratorFunction]",Jt="[object Map]",Wi="[object Number]",Ny="[object Null]",Sn="[object Object]",wd="[object Promise]",Ry="[object Proxy]",Ui="[object RegExp]",qt="[object Set]",Vi="[object String]",Xs="[object Symbol]",Ly="[object Undefined]",Ki="[object WeakMap]",Py="[object WeakSet]",Gi="[object ArrayBuffer]",ei="[object DataView]",Pa="[object Float32Array]",Da="[object Float64Array]",za="[object Int8Array]",Ba="[object Int16Array]",Fa="[object Int32Array]",Ha="[object Uint8Array]",$a="[object Uint8ClampedArray]",Wa="[object Uint16Array]",Ua="[object Uint32Array]",Dy=/\b__p \+= '';/g,zy=/\b(__p \+=) '' \+/g,By=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Sd=/&(?:amp|lt|gt|quot|#39);/g,xd=/[&<>"']/g,Fy=RegExp(Sd.source),Hy=RegExp(xd.source),$y=/<%-([\s\S]+?)%>/g,Wy=/<%([\s\S]+?)%>/g,kd=/<%=([\s\S]+?)%>/g,Uy=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Vy=/^\w*$/,Ky=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Va=/[\\^$.*+?()[\]{}|]/g,Gy=RegExp(Va.source),Ka=/^\s+/,Jy=/\s/,qy=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,jy=/\{\n\/\* \[wrapped with (.+)\] \*/,Yy=/,? & /,Xy=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Zy=/[()=,{}\[\]\/\s]/,Qy=/\\(\\)?/g,eb=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ed=/\w*$/,tb=/^[-+]0x[0-9a-f]+$/i,nb=/^0b[01]+$/i,rb=/^\[object .+?Constructor\]$/,ib=/^0o[0-7]+$/i,sb=/^(?:0|[1-9]\d*)$/,ob=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Zs=/($^)/,lb=/['\n\r\u2028\u2029\\]/g,Qs="\\ud800-\\udfff",ab="\\u0300-\\u036f",ub="\\ufe20-\\ufe2f",cb="\\u20d0-\\u20ff",_d=ab+ub+cb,vd="\\u2700-\\u27bf",Td="a-z\\xdf-\\xf6\\xf8-\\xff",fb="\\xac\\xb1\\xd7\\xf7",db="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",hb="\\u2000-\\u206f",pb=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Cd="A-Z\\xc0-\\xd6\\xd8-\\xde",Md="\\ufe0e\\ufe0f",Ad=fb+db+hb+pb,Ga="['\u2019]",mb="["+Qs+"]",Id="["+Ad+"]",eo="["+_d+"]",Od="\\d+",gb="["+vd+"]",Nd="["+Td+"]",Rd="[^"+Qs+Ad+Od+vd+Td+Cd+"]",Ja="\\ud83c[\\udffb-\\udfff]",yb="(?:"+eo+"|"+Ja+")",Ld="[^"+Qs+"]",qa="(?:\\ud83c[\\udde6-\\uddff]){2}",ja="[\\ud800-\\udbff][\\udc00-\\udfff]",ti="["+Cd+"]",Pd="\\u200d",Dd="(?:"+Nd+"|"+Rd+")",bb="(?:"+ti+"|"+Rd+")",zd="(?:"+Ga+"(?:d|ll|m|re|s|t|ve))?",Bd="(?:"+Ga+"(?:D|LL|M|RE|S|T|VE))?",Fd=yb+"?",Hd="["+Md+"]?",wb="(?:"+Pd+"(?:"+[Ld,qa,ja].join("|")+")"+Hd+Fd+")*",Sb="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",xb="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",$d=Hd+Fd+wb,kb="(?:"+[gb,qa,ja].join("|")+")"+$d,Eb="(?:"+[Ld+eo+"?",eo,qa,ja,mb].join("|")+")",_b=RegExp(Ga,"g"),vb=RegExp(eo,"g"),Ya=RegExp(Ja+"(?="+Ja+")|"+Eb+$d,"g"),Tb=RegExp([ti+"?"+Nd+"+"+zd+"(?="+[Id,ti,"$"].join("|")+")",bb+"+"+Bd+"(?="+[Id,ti+Dd,"$"].join("|")+")",ti+"?"+Dd+"+"+zd,ti+"+"+Bd,xb,Sb,Od,kb].join("|"),"g"),Cb=RegExp("["+Pd+Qs+_d+Md+"]"),Mb=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Ab=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Ib=-1,Ee={};Ee[Pa]=Ee[Da]=Ee[za]=Ee[Ba]=Ee[Fa]=Ee[Ha]=Ee[$a]=Ee[Wa]=Ee[Ua]=!0,Ee[Gt]=Ee[qs]=Ee[Gi]=Ee[Hi]=Ee[ei]=Ee[$i]=Ee[js]=Ee[Ys]=Ee[Jt]=Ee[Wi]=Ee[Sn]=Ee[Ui]=Ee[qt]=Ee[Vi]=Ee[Ki]=!1;var ke={};ke[Gt]=ke[qs]=ke[Gi]=ke[ei]=ke[Hi]=ke[$i]=ke[Pa]=ke[Da]=ke[za]=ke[Ba]=ke[Fa]=ke[Jt]=ke[Wi]=ke[Sn]=ke[Ui]=ke[qt]=ke[Vi]=ke[Xs]=ke[Ha]=ke[$a]=ke[Wa]=ke[Ua]=!0,ke[js]=ke[Ys]=ke[Ki]=!1;var Ob={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Nb={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Rb={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Lb={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Pb=parseFloat,Db=parseInt,Wd=typeof Ta=="object"&&Ta&&Ta.Object===Object&&Ta,zb=typeof self=="object"&&self&&self.Object===Object&&self,qe=Wd||zb||Function("return this")(),Xa=e&&!e.nodeType&&e,Tr=Xa&&!0&&n&&!n.nodeType&&n,Ud=Tr&&Tr.exports===Xa,Za=Ud&&Wd.process,Nt=function(){try{var v=Tr&&Tr.require&&Tr.require("util").types;return v||Za&&Za.binding&&Za.binding("util")}catch{}}(),Vd=Nt&&Nt.isArrayBuffer,Kd=Nt&&Nt.isDate,Gd=Nt&&Nt.isMap,Jd=Nt&&Nt.isRegExp,qd=Nt&&Nt.isSet,jd=Nt&&Nt.isTypedArray;function St(v,I,A){switch(A.length){case 0:return v.call(I);case 1:return v.call(I,A[0]);case 2:return v.call(I,A[0],A[1]);case 3:return v.call(I,A[0],A[1],A[2])}return v.apply(I,A)}function Bb(v,I,A,V){for(var X=-1,ge=v==null?0:v.length;++X<ge;){var Pe=v[X];I(V,Pe,A(Pe),v)}return V}function Rt(v,I){for(var A=-1,V=v==null?0:v.length;++A<V&&I(v[A],A,v)!==!1;);return v}function Fb(v,I){for(var A=v==null?0:v.length;A--&&I(v[A],A,v)!==!1;);return v}function Yd(v,I){for(var A=-1,V=v==null?0:v.length;++A<V;)if(!I(v[A],A,v))return!1;return!0}function Yn(v,I){for(var A=-1,V=v==null?0:v.length,X=0,ge=[];++A<V;){var Pe=v[A];I(Pe,A,v)&&(ge[X++]=Pe)}return ge}function to(v,I){var A=v==null?0:v.length;return!!A&&ni(v,I,0)>-1}function Qa(v,I,A){for(var V=-1,X=v==null?0:v.length;++V<X;)if(A(I,v[V]))return!0;return!1}function ve(v,I){for(var A=-1,V=v==null?0:v.length,X=Array(V);++A<V;)X[A]=I(v[A],A,v);return X}function Xn(v,I){for(var A=-1,V=I.length,X=v.length;++A<V;)v[X+A]=I[A];return v}function eu(v,I,A,V){var X=-1,ge=v==null?0:v.length;for(V&&ge&&(A=v[++X]);++X<ge;)A=I(A,v[X],X,v);return A}function Hb(v,I,A,V){var X=v==null?0:v.length;for(V&&X&&(A=v[--X]);X--;)A=I(A,v[X],X,v);return A}function tu(v,I){for(var A=-1,V=v==null?0:v.length;++A<V;)if(I(v[A],A,v))return!0;return!1}var $b=nu("length");function Wb(v){return v.split("")}function Ub(v){return v.match(Xy)||[]}function Xd(v,I,A){var V;return A(v,function(X,ge,Pe){if(I(X,ge,Pe))return V=ge,!1}),V}function no(v,I,A,V){for(var X=v.length,ge=A+(V?1:-1);V?ge--:++ge<X;)if(I(v[ge],ge,v))return ge;return-1}function ni(v,I,A){return I===I?t2(v,I,A):no(v,Zd,A)}function Vb(v,I,A,V){for(var X=A-1,ge=v.length;++X<ge;)if(V(v[X],I))return X;return-1}function Zd(v){return v!==v}function Qd(v,I){var A=v==null?0:v.length;return A?iu(v,I)/A:ln}function nu(v){return function(I){return I==null?t:I[v]}}function ru(v){return function(I){return v==null?t:v[I]}}function eh(v,I,A,V,X){return X(v,function(ge,Pe,xe){A=V?(V=!1,ge):I(A,ge,Pe,xe)}),A}function Kb(v,I){var A=v.length;for(v.sort(I);A--;)v[A]=v[A].value;return v}function iu(v,I){for(var A,V=-1,X=v.length;++V<X;){var ge=I(v[V]);ge!==t&&(A=A===t?ge:A+ge)}return A}function su(v,I){for(var A=-1,V=Array(v);++A<v;)V[A]=I(A);return V}function Gb(v,I){return ve(I,function(A){return[A,v[A]]})}function th(v){return v&&v.slice(0,sh(v)+1).replace(Ka,"")}function xt(v){return function(I){return v(I)}}function ou(v,I){return ve(I,function(A){return v[A]})}function Ji(v,I){return v.has(I)}function nh(v,I){for(var A=-1,V=v.length;++A<V&&ni(I,v[A],0)>-1;);return A}function rh(v,I){for(var A=v.length;A--&&ni(I,v[A],0)>-1;);return A}function Jb(v,I){for(var A=v.length,V=0;A--;)v[A]===I&&++V;return V}var qb=ru(Ob),jb=ru(Nb);function Yb(v){return"\\"+Lb[v]}function Xb(v,I){return v==null?t:v[I]}function ri(v){return Cb.test(v)}function Zb(v){return Mb.test(v)}function Qb(v){for(var I,A=[];!(I=v.next()).done;)A.push(I.value);return A}function lu(v){var I=-1,A=Array(v.size);return v.forEach(function(V,X){A[++I]=[X,V]}),A}function ih(v,I){return function(A){return v(I(A))}}function Zn(v,I){for(var A=-1,V=v.length,X=0,ge=[];++A<V;){var Pe=v[A];(Pe===I||Pe===m)&&(v[A]=m,ge[X++]=A)}return ge}function ro(v){var I=-1,A=Array(v.size);return v.forEach(function(V){A[++I]=V}),A}function e2(v){var I=-1,A=Array(v.size);return v.forEach(function(V){A[++I]=[V,V]}),A}function t2(v,I,A){for(var V=A-1,X=v.length;++V<X;)if(v[V]===I)return V;return-1}function n2(v,I,A){for(var V=A+1;V--;)if(v[V]===I)return V;return V}function ii(v){return ri(v)?i2(v):$b(v)}function jt(v){return ri(v)?s2(v):Wb(v)}function sh(v){for(var I=v.length;I--&&Jy.test(v.charAt(I)););return I}var r2=ru(Rb);function i2(v){for(var I=Ya.lastIndex=0;Ya.test(v);)++I;return I}function s2(v){return v.match(Ya)||[]}function o2(v){return v.match(Tb)||[]}var l2=function v(I){I=I==null?qe:si.defaults(qe.Object(),I,si.pick(qe,Ab));var A=I.Array,V=I.Date,X=I.Error,ge=I.Function,Pe=I.Math,xe=I.Object,au=I.RegExp,a2=I.String,Lt=I.TypeError,io=A.prototype,u2=ge.prototype,oi=xe.prototype,so=I["__core-js_shared__"],oo=u2.toString,Se=oi.hasOwnProperty,c2=0,oh=function(){var s=/[^.]+$/.exec(so&&so.keys&&so.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}(),lo=oi.toString,f2=oo.call(xe),d2=qe._,h2=au("^"+oo.call(Se).replace(Va,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ao=Ud?I.Buffer:t,Qn=I.Symbol,uo=I.Uint8Array,lh=ao?ao.allocUnsafe:t,co=ih(xe.getPrototypeOf,xe),ah=xe.create,uh=oi.propertyIsEnumerable,fo=io.splice,ch=Qn?Qn.isConcatSpreadable:t,qi=Qn?Qn.iterator:t,Cr=Qn?Qn.toStringTag:t,ho=function(){try{var s=Nr(xe,"defineProperty");return s({},"",{}),s}catch{}}(),p2=I.clearTimeout!==qe.clearTimeout&&I.clearTimeout,m2=V&&V.now!==qe.Date.now&&V.now,g2=I.setTimeout!==qe.setTimeout&&I.setTimeout,po=Pe.ceil,mo=Pe.floor,uu=xe.getOwnPropertySymbols,y2=ao?ao.isBuffer:t,fh=I.isFinite,b2=io.join,w2=ih(xe.keys,xe),De=Pe.max,Qe=Pe.min,S2=V.now,x2=I.parseInt,dh=Pe.random,k2=io.reverse,cu=Nr(I,"DataView"),ji=Nr(I,"Map"),fu=Nr(I,"Promise"),li=Nr(I,"Set"),Yi=Nr(I,"WeakMap"),Xi=Nr(xe,"create"),go=Yi&&new Yi,ai={},E2=Rr(cu),_2=Rr(ji),v2=Rr(fu),T2=Rr(li),C2=Rr(Yi),yo=Qn?Qn.prototype:t,Zi=yo?yo.valueOf:t,hh=yo?yo.toString:t;function w(s){if(Me(s)&&!Z(s)&&!(s instanceof se)){if(s instanceof Pt)return s;if(Se.call(s,"__wrapped__"))return pp(s)}return new Pt(s)}var ui=function(){function s(){}return function(l){if(!Ce(l))return{};if(ah)return ah(l);s.prototype=l;var c=new s;return s.prototype=t,c}}();function bo(){}function Pt(s,l){this.__wrapped__=s,this.__actions__=[],this.__chain__=!!l,this.__index__=0,this.__values__=t}w.templateSettings={escape:$y,evaluate:Wy,interpolate:kd,variable:"",imports:{_:w}},w.prototype=bo.prototype,w.prototype.constructor=w,Pt.prototype=ui(bo.prototype),Pt.prototype.constructor=Pt;function se(s){this.__wrapped__=s,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=wt,this.__views__=[]}function M2(){var s=new se(this.__wrapped__);return s.__actions__=ut(this.__actions__),s.__dir__=this.__dir__,s.__filtered__=this.__filtered__,s.__iteratees__=ut(this.__iteratees__),s.__takeCount__=this.__takeCount__,s.__views__=ut(this.__views__),s}function A2(){if(this.__filtered__){var s=new se(this);s.__dir__=-1,s.__filtered__=!0}else s=this.clone(),s.__dir__*=-1;return s}function I2(){var s=this.__wrapped__.value(),l=this.__dir__,c=Z(s),h=l<0,y=c?s.length:0,S=Ww(0,y,this.__views__),k=S.start,_=S.end,T=_-k,O=h?_:k-1,N=this.__iteratees__,R=N.length,H=0,G=Qe(T,this.__takeCount__);if(!c||!h&&y==T&&G==T)return zh(s,this.__actions__);var q=[];e:for(;T--&&H<G;){O+=l;for(var ee=-1,j=s[O];++ee<R;){var ie=N[ee],ce=ie.iteratee,_t=ie.type,rt=ce(j);if(_t==wn)j=rt;else if(!rt){if(_t==on)continue e;break e}}q[H++]=j}return q}se.prototype=ui(bo.prototype),se.prototype.constructor=se;function Mr(s){var l=-1,c=s==null?0:s.length;for(this.clear();++l<c;){var h=s[l];this.set(h[0],h[1])}}function O2(){this.__data__=Xi?Xi(null):{},this.size=0}function N2(s){var l=this.has(s)&&delete this.__data__[s];return this.size-=l?1:0,l}function R2(s){var l=this.__data__;if(Xi){var c=l[s];return c===f?t:c}return Se.call(l,s)?l[s]:t}function L2(s){var l=this.__data__;return Xi?l[s]!==t:Se.call(l,s)}function P2(s,l){var c=this.__data__;return this.size+=this.has(s)?0:1,c[s]=Xi&&l===t?f:l,this}Mr.prototype.clear=O2,Mr.prototype.delete=N2,Mr.prototype.get=R2,Mr.prototype.has=L2,Mr.prototype.set=P2;function xn(s){var l=-1,c=s==null?0:s.length;for(this.clear();++l<c;){var h=s[l];this.set(h[0],h[1])}}function D2(){this.__data__=[],this.size=0}function z2(s){var l=this.__data__,c=wo(l,s);if(c<0)return!1;var h=l.length-1;return c==h?l.pop():fo.call(l,c,1),--this.size,!0}function B2(s){var l=this.__data__,c=wo(l,s);return c<0?t:l[c][1]}function F2(s){return wo(this.__data__,s)>-1}function H2(s,l){var c=this.__data__,h=wo(c,s);return h<0?(++this.size,c.push([s,l])):c[h][1]=l,this}xn.prototype.clear=D2,xn.prototype.delete=z2,xn.prototype.get=B2,xn.prototype.has=F2,xn.prototype.set=H2;function kn(s){var l=-1,c=s==null?0:s.length;for(this.clear();++l<c;){var h=s[l];this.set(h[0],h[1])}}function $2(){this.size=0,this.__data__={hash:new Mr,map:new(ji||xn),string:new Mr}}function W2(s){var l=Oo(this,s).delete(s);return this.size-=l?1:0,l}function U2(s){return Oo(this,s).get(s)}function V2(s){return Oo(this,s).has(s)}function K2(s,l){var c=Oo(this,s),h=c.size;return c.set(s,l),this.size+=c.size==h?0:1,this}kn.prototype.clear=$2,kn.prototype.delete=W2,kn.prototype.get=U2,kn.prototype.has=V2,kn.prototype.set=K2;function Ar(s){var l=-1,c=s==null?0:s.length;for(this.__data__=new kn;++l<c;)this.add(s[l])}function G2(s){return this.__data__.set(s,f),this}function J2(s){return this.__data__.has(s)}Ar.prototype.add=Ar.prototype.push=G2,Ar.prototype.has=J2;function Yt(s){var l=this.__data__=new xn(s);this.size=l.size}function q2(){this.__data__=new xn,this.size=0}function j2(s){var l=this.__data__,c=l.delete(s);return this.size=l.size,c}function Y2(s){return this.__data__.get(s)}function X2(s){return this.__data__.has(s)}function Z2(s,l){var c=this.__data__;if(c instanceof xn){var h=c.__data__;if(!ji||h.length<i-1)return h.push([s,l]),this.size=++c.size,this;c=this.__data__=new kn(h)}return c.set(s,l),this.size=c.size,this}Yt.prototype.clear=q2,Yt.prototype.delete=j2,Yt.prototype.get=Y2,Yt.prototype.has=X2,Yt.prototype.set=Z2;function ph(s,l){var c=Z(s),h=!c&&Lr(s),y=!c&&!h&&sr(s),S=!c&&!h&&!y&&hi(s),k=c||h||y||S,_=k?su(s.length,a2):[],T=_.length;for(var O in s)(l||Se.call(s,O))&&!(k&&(O=="length"||y&&(O=="offset"||O=="parent")||S&&(O=="buffer"||O=="byteLength"||O=="byteOffset")||Tn(O,T)))&&_.push(O);return _}function mh(s){var l=s.length;return l?s[ku(0,l-1)]:t}function Q2(s,l){return No(ut(s),Ir(l,0,s.length))}function ew(s){return No(ut(s))}function du(s,l,c){(c!==t&&!Xt(s[l],c)||c===t&&!(l in s))&&En(s,l,c)}function Qi(s,l,c){var h=s[l];(!(Se.call(s,l)&&Xt(h,c))||c===t&&!(l in s))&&En(s,l,c)}function wo(s,l){for(var c=s.length;c--;)if(Xt(s[c][0],l))return c;return-1}function tw(s,l,c,h){return er(s,function(y,S,k){l(h,y,c(y),k)}),h}function gh(s,l){return s&&un(l,He(l),s)}function nw(s,l){return s&&un(l,ft(l),s)}function En(s,l,c){l=="__proto__"&&ho?ho(s,l,{configurable:!0,enumerable:!0,value:c,writable:!0}):s[l]=c}function hu(s,l){for(var c=-1,h=l.length,y=A(h),S=s==null;++c<h;)y[c]=S?t:Ju(s,l[c]);return y}function Ir(s,l,c){return s===s&&(c!==t&&(s=s<=c?s:c),l!==t&&(s=s>=l?s:l)),s}function Dt(s,l,c,h,y,S){var k,_=l&p,T=l&g,O=l&b;if(c&&(k=y?c(s,h,y,S):c(s)),k!==t)return k;if(!Ce(s))return s;var N=Z(s);if(N){if(k=Vw(s),!_)return ut(s,k)}else{var R=et(s),H=R==Ys||R==bd;if(sr(s))return Hh(s,_);if(R==Sn||R==Gt||H&&!y){if(k=T||H?{}:sp(s),!_)return T?Rw(s,nw(k,s)):Nw(s,gh(k,s))}else{if(!ke[R])return y?s:{};k=Kw(s,R,_)}}S||(S=new Yt);var G=S.get(s);if(G)return G;S.set(s,k),Lp(s)?s.forEach(function(j){k.add(Dt(j,l,c,j,s,S))}):Np(s)&&s.forEach(function(j,ie){k.set(ie,Dt(j,l,c,ie,s,S))});var q=O?T?Ru:Nu:T?ft:He,ee=N?t:q(s);return Rt(ee||s,function(j,ie){ee&&(ie=j,j=s[ie]),Qi(k,ie,Dt(j,l,c,ie,s,S))}),k}function rw(s){var l=He(s);return function(c){return yh(c,s,l)}}function yh(s,l,c){var h=c.length;if(s==null)return!h;for(s=xe(s);h--;){var y=c[h],S=l[y],k=s[y];if(k===t&&!(y in s)||!S(k))return!1}return!0}function bh(s,l,c){if(typeof s!="function")throw new Lt(a);return ls(function(){s.apply(t,c)},l)}function es(s,l,c,h){var y=-1,S=to,k=!0,_=s.length,T=[],O=l.length;if(!_)return T;c&&(l=ve(l,xt(c))),h?(S=Qa,k=!1):l.length>=i&&(S=Ji,k=!1,l=new Ar(l));e:for(;++y<_;){var N=s[y],R=c==null?N:c(N);if(N=h||N!==0?N:0,k&&R===R){for(var H=O;H--;)if(l[H]===R)continue e;T.push(N)}else S(l,R,h)||T.push(N)}return T}var er=Kh(an),wh=Kh(mu,!0);function iw(s,l){var c=!0;return er(s,function(h,y,S){return c=!!l(h,y,S),c}),c}function So(s,l,c){for(var h=-1,y=s.length;++h<y;){var S=s[h],k=l(S);if(k!=null&&(_===t?k===k&&!Et(k):c(k,_)))var _=k,T=S}return T}function sw(s,l,c,h){var y=s.length;for(c=Q(c),c<0&&(c=-c>y?0:y+c),h=h===t||h>y?y:Q(h),h<0&&(h+=y),h=c>h?0:Dp(h);c<h;)s[c++]=l;return s}function Sh(s,l){var c=[];return er(s,function(h,y,S){l(h,y,S)&&c.push(h)}),c}function je(s,l,c,h,y){var S=-1,k=s.length;for(c||(c=Jw),y||(y=[]);++S<k;){var _=s[S];l>0&&c(_)?l>1?je(_,l-1,c,h,y):Xn(y,_):h||(y[y.length]=_)}return y}var pu=Gh(),xh=Gh(!0);function an(s,l){return s&&pu(s,l,He)}function mu(s,l){return s&&xh(s,l,He)}function xo(s,l){return Yn(l,function(c){return Cn(s[c])})}function Or(s,l){l=rr(l,s);for(var c=0,h=l.length;s!=null&&c<h;)s=s[cn(l[c++])];return c&&c==h?s:t}function kh(s,l,c){var h=l(s);return Z(s)?h:Xn(h,c(s))}function tt(s){return s==null?s===t?Ly:Ny:Cr&&Cr in xe(s)?$w(s):eS(s)}function gu(s,l){return s>l}function ow(s,l){return s!=null&&Se.call(s,l)}function lw(s,l){return s!=null&&l in xe(s)}function aw(s,l,c){return s>=Qe(l,c)&&s<De(l,c)}function yu(s,l,c){for(var h=c?Qa:to,y=s[0].length,S=s.length,k=S,_=A(S),T=1/0,O=[];k--;){var N=s[k];k&&l&&(N=ve(N,xt(l))),T=Qe(N.length,T),_[k]=!c&&(l||y>=120&&N.length>=120)?new Ar(k&&N):t}N=s[0];var R=-1,H=_[0];e:for(;++R<y&&O.length<T;){var G=N[R],q=l?l(G):G;if(G=c||G!==0?G:0,!(H?Ji(H,q):h(O,q,c))){for(k=S;--k;){var ee=_[k];if(!(ee?Ji(ee,q):h(s[k],q,c)))continue e}H&&H.push(q),O.push(G)}}return O}function uw(s,l,c,h){return an(s,function(y,S,k){l(h,c(y),S,k)}),h}function ts(s,l,c){l=rr(l,s),s=up(s,l);var h=s==null?s:s[cn(Bt(l))];return h==null?t:St(h,s,c)}function Eh(s){return Me(s)&&tt(s)==Gt}function cw(s){return Me(s)&&tt(s)==Gi}function fw(s){return Me(s)&&tt(s)==$i}function ns(s,l,c,h,y){return s===l?!0:s==null||l==null||!Me(s)&&!Me(l)?s!==s&&l!==l:dw(s,l,c,h,ns,y)}function dw(s,l,c,h,y,S){var k=Z(s),_=Z(l),T=k?qs:et(s),O=_?qs:et(l);T=T==Gt?Sn:T,O=O==Gt?Sn:O;var N=T==Sn,R=O==Sn,H=T==O;if(H&&sr(s)){if(!sr(l))return!1;k=!0,N=!1}if(H&&!N)return S||(S=new Yt),k||hi(s)?np(s,l,c,h,y,S):Fw(s,l,T,c,h,y,S);if(!(c&x)){var G=N&&Se.call(s,"__wrapped__"),q=R&&Se.call(l,"__wrapped__");if(G||q){var ee=G?s.value():s,j=q?l.value():l;return S||(S=new Yt),y(ee,j,c,h,S)}}return H?(S||(S=new Yt),Hw(s,l,c,h,y,S)):!1}function hw(s){return Me(s)&&et(s)==Jt}function bu(s,l,c,h){var y=c.length,S=y,k=!h;if(s==null)return!S;for(s=xe(s);y--;){var _=c[y];if(k&&_[2]?_[1]!==s[_[0]]:!(_[0]in s))return!1}for(;++y<S;){_=c[y];var T=_[0],O=s[T],N=_[1];if(k&&_[2]){if(O===t&&!(T in s))return!1}else{var R=new Yt;if(h)var H=h(O,N,T,s,l,R);if(!(H===t?ns(N,O,x|E,h,R):H))return!1}}return!0}function _h(s){if(!Ce(s)||jw(s))return!1;var l=Cn(s)?h2:rb;return l.test(Rr(s))}function pw(s){return Me(s)&&tt(s)==Ui}function mw(s){return Me(s)&&et(s)==qt}function gw(s){return Me(s)&&Bo(s.length)&&!!Ee[tt(s)]}function vh(s){return typeof s=="function"?s:s==null?dt:typeof s=="object"?Z(s)?Mh(s[0],s[1]):Ch(s):Jp(s)}function wu(s){if(!ss(s))return w2(s);var l=[];for(var c in xe(s))Se.call(s,c)&&c!="constructor"&&l.push(c);return l}function yw(s){if(!Ce(s))return Qw(s);var l=ss(s),c=[];for(var h in s)h=="constructor"&&(l||!Se.call(s,h))||c.push(h);return c}function Su(s,l){return s<l}function Th(s,l){var c=-1,h=ct(s)?A(s.length):[];return er(s,function(y,S,k){h[++c]=l(y,S,k)}),h}function Ch(s){var l=Pu(s);return l.length==1&&l[0][2]?lp(l[0][0],l[0][1]):function(c){return c===s||bu(c,s,l)}}function Mh(s,l){return zu(s)&&op(l)?lp(cn(s),l):function(c){var h=Ju(c,s);return h===t&&h===l?qu(c,s):ns(l,h,x|E)}}function ko(s,l,c,h,y){s!==l&&pu(l,function(S,k){if(y||(y=new Yt),Ce(S))bw(s,l,k,c,ko,h,y);else{var _=h?h(Fu(s,k),S,k+"",s,l,y):t;_===t&&(_=S),du(s,k,_)}},ft)}function bw(s,l,c,h,y,S,k){var _=Fu(s,c),T=Fu(l,c),O=k.get(T);if(O){du(s,c,O);return}var N=S?S(_,T,c+"",s,l,k):t,R=N===t;if(R){var H=Z(T),G=!H&&sr(T),q=!H&&!G&&hi(T);N=T,H||G||q?Z(_)?N=_:Oe(_)?N=ut(_):G?(R=!1,N=Hh(T,!0)):q?(R=!1,N=$h(T,!0)):N=[]:as(T)||Lr(T)?(N=_,Lr(_)?N=zp(_):(!Ce(_)||Cn(_))&&(N=sp(T))):R=!1}R&&(k.set(T,N),y(N,T,h,S,k),k.delete(T)),du(s,c,N)}function Ah(s,l){var c=s.length;if(c)return l+=l<0?c:0,Tn(l,c)?s[l]:t}function Ih(s,l,c){l.length?l=ve(l,function(S){return Z(S)?function(k){return Or(k,S.length===1?S[0]:S)}:S}):l=[dt];var h=-1;l=ve(l,xt(J()));var y=Th(s,function(S,k,_){var T=ve(l,function(O){return O(S)});return{criteria:T,index:++h,value:S}});return Kb(y,function(S,k){return Ow(S,k,c)})}function ww(s,l){return Oh(s,l,function(c,h){return qu(s,h)})}function Oh(s,l,c){for(var h=-1,y=l.length,S={};++h<y;){var k=l[h],_=Or(s,k);c(_,k)&&rs(S,rr(k,s),_)}return S}function Sw(s){return function(l){return Or(l,s)}}function xu(s,l,c,h){var y=h?Vb:ni,S=-1,k=l.length,_=s;for(s===l&&(l=ut(l)),c&&(_=ve(s,xt(c)));++S<k;)for(var T=0,O=l[S],N=c?c(O):O;(T=y(_,N,T,h))>-1;)_!==s&&fo.call(_,T,1),fo.call(s,T,1);return s}function Nh(s,l){for(var c=s?l.length:0,h=c-1;c--;){var y=l[c];if(c==h||y!==S){var S=y;Tn(y)?fo.call(s,y,1):vu(s,y)}}return s}function ku(s,l){return s+mo(dh()*(l-s+1))}function xw(s,l,c,h){for(var y=-1,S=De(po((l-s)/(c||1)),0),k=A(S);S--;)k[h?S:++y]=s,s+=c;return k}function Eu(s,l){var c="";if(!s||l<1||l>jn)return c;do l%2&&(c+=s),l=mo(l/2),l&&(s+=s);while(l);return c}function ne(s,l){return Hu(ap(s,l,dt),s+"")}function kw(s){return mh(pi(s))}function Ew(s,l){var c=pi(s);return No(c,Ir(l,0,c.length))}function rs(s,l,c,h){if(!Ce(s))return s;l=rr(l,s);for(var y=-1,S=l.length,k=S-1,_=s;_!=null&&++y<S;){var T=cn(l[y]),O=c;if(T==="__proto__"||T==="constructor"||T==="prototype")return s;if(y!=k){var N=_[T];O=h?h(N,T,_):t,O===t&&(O=Ce(N)?N:Tn(l[y+1])?[]:{})}Qi(_,T,O),_=_[T]}return s}var Rh=go?function(s,l){return go.set(s,l),s}:dt,_w=ho?function(s,l){return ho(s,"toString",{configurable:!0,enumerable:!1,value:Yu(l),writable:!0})}:dt;function vw(s){return No(pi(s))}function zt(s,l,c){var h=-1,y=s.length;l<0&&(l=-l>y?0:y+l),c=c>y?y:c,c<0&&(c+=y),y=l>c?0:c-l>>>0,l>>>=0;for(var S=A(y);++h<y;)S[h]=s[h+l];return S}function Tw(s,l){var c;return er(s,function(h,y,S){return c=l(h,y,S),!c}),!!c}function Eo(s,l,c){var h=0,y=s==null?h:s.length;if(typeof l=="number"&&l===l&&y<=Ra){for(;h<y;){var S=h+y>>>1,k=s[S];k!==null&&!Et(k)&&(c?k<=l:k<l)?h=S+1:y=S}return y}return _u(s,l,dt,c)}function _u(s,l,c,h){var y=0,S=s==null?0:s.length;if(S===0)return 0;l=c(l);for(var k=l!==l,_=l===null,T=Et(l),O=l===t;y<S;){var N=mo((y+S)/2),R=c(s[N]),H=R!==t,G=R===null,q=R===R,ee=Et(R);if(k)var j=h||q;else O?j=q&&(h||H):_?j=q&&H&&(h||!G):T?j=q&&H&&!G&&(h||!ee):G||ee?j=!1:j=h?R<=l:R<l;j?y=N+1:S=N}return Qe(S,Na)}function Lh(s,l){for(var c=-1,h=s.length,y=0,S=[];++c<h;){var k=s[c],_=l?l(k):k;if(!c||!Xt(_,T)){var T=_;S[y++]=k===0?0:k}}return S}function Ph(s){return typeof s=="number"?s:Et(s)?ln:+s}function kt(s){if(typeof s=="string")return s;if(Z(s))return ve(s,kt)+"";if(Et(s))return hh?hh.call(s):"";var l=s+"";return l=="0"&&1/s==-1/0?"-0":l}function nr(s,l,c){var h=-1,y=to,S=s.length,k=!0,_=[],T=_;if(c)k=!1,y=Qa;else if(S>=i){var O=l?null:zw(s);if(O)return ro(O);k=!1,y=Ji,T=new Ar}else T=l?[]:_;e:for(;++h<S;){var N=s[h],R=l?l(N):N;if(N=c||N!==0?N:0,k&&R===R){for(var H=T.length;H--;)if(T[H]===R)continue e;l&&T.push(R),_.push(N)}else y(T,R,c)||(T!==_&&T.push(R),_.push(N))}return _}function vu(s,l){return l=rr(l,s),s=up(s,l),s==null||delete s[cn(Bt(l))]}function Dh(s,l,c,h){return rs(s,l,c(Or(s,l)),h)}function _o(s,l,c,h){for(var y=s.length,S=h?y:-1;(h?S--:++S<y)&&l(s[S],S,s););return c?zt(s,h?0:S,h?S+1:y):zt(s,h?S+1:0,h?y:S)}function zh(s,l){var c=s;return c instanceof se&&(c=c.value()),eu(l,function(h,y){return y.func.apply(y.thisArg,Xn([h],y.args))},c)}function Tu(s,l,c){var h=s.length;if(h<2)return h?nr(s[0]):[];for(var y=-1,S=A(h);++y<h;)for(var k=s[y],_=-1;++_<h;)_!=y&&(S[y]=es(S[y]||k,s[_],l,c));return nr(je(S,1),l,c)}function Bh(s,l,c){for(var h=-1,y=s.length,S=l.length,k={};++h<y;){var _=h<S?l[h]:t;c(k,s[h],_)}return k}function Cu(s){return Oe(s)?s:[]}function Mu(s){return typeof s=="function"?s:dt}function rr(s,l){return Z(s)?s:zu(s,l)?[s]:hp(ye(s))}var Cw=ne;function ir(s,l,c){var h=s.length;return c=c===t?h:c,!l&&c>=h?s:zt(s,l,c)}var Fh=p2||function(s){return qe.clearTimeout(s)};function Hh(s,l){if(l)return s.slice();var c=s.length,h=lh?lh(c):new s.constructor(c);return s.copy(h),h}function Au(s){var l=new s.constructor(s.byteLength);return new uo(l).set(new uo(s)),l}function Mw(s,l){var c=l?Au(s.buffer):s.buffer;return new s.constructor(c,s.byteOffset,s.byteLength)}function Aw(s){var l=new s.constructor(s.source,Ed.exec(s));return l.lastIndex=s.lastIndex,l}function Iw(s){return Zi?xe(Zi.call(s)):{}}function $h(s,l){var c=l?Au(s.buffer):s.buffer;return new s.constructor(c,s.byteOffset,s.length)}function Wh(s,l){if(s!==l){var c=s!==t,h=s===null,y=s===s,S=Et(s),k=l!==t,_=l===null,T=l===l,O=Et(l);if(!_&&!O&&!S&&s>l||S&&k&&T&&!_&&!O||h&&k&&T||!c&&T||!y)return 1;if(!h&&!S&&!O&&s<l||O&&c&&y&&!h&&!S||_&&c&&y||!k&&y||!T)return-1}return 0}function Ow(s,l,c){for(var h=-1,y=s.criteria,S=l.criteria,k=y.length,_=c.length;++h<k;){var T=Wh(y[h],S[h]);if(T){if(h>=_)return T;var O=c[h];return T*(O=="desc"?-1:1)}}return s.index-l.index}function Uh(s,l,c,h){for(var y=-1,S=s.length,k=c.length,_=-1,T=l.length,O=De(S-k,0),N=A(T+O),R=!h;++_<T;)N[_]=l[_];for(;++y<k;)(R||y<S)&&(N[c[y]]=s[y]);for(;O--;)N[_++]=s[y++];return N}function Vh(s,l,c,h){for(var y=-1,S=s.length,k=-1,_=c.length,T=-1,O=l.length,N=De(S-_,0),R=A(N+O),H=!h;++y<N;)R[y]=s[y];for(var G=y;++T<O;)R[G+T]=l[T];for(;++k<_;)(H||y<S)&&(R[G+c[k]]=s[y++]);return R}function ut(s,l){var c=-1,h=s.length;for(l||(l=A(h));++c<h;)l[c]=s[c];return l}function un(s,l,c,h){var y=!c;c||(c={});for(var S=-1,k=l.length;++S<k;){var _=l[S],T=h?h(c[_],s[_],_,c,s):t;T===t&&(T=s[_]),y?En(c,_,T):Qi(c,_,T)}return c}function Nw(s,l){return un(s,Du(s),l)}function Rw(s,l){return un(s,rp(s),l)}function vo(s,l){return function(c,h){var y=Z(c)?Bb:tw,S=l?l():{};return y(c,s,J(h,2),S)}}function ci(s){return ne(function(l,c){var h=-1,y=c.length,S=y>1?c[y-1]:t,k=y>2?c[2]:t;for(S=s.length>3&&typeof S=="function"?(y--,S):t,k&&nt(c[0],c[1],k)&&(S=y<3?t:S,y=1),l=xe(l);++h<y;){var _=c[h];_&&s(l,_,h,S)}return l})}function Kh(s,l){return function(c,h){if(c==null)return c;if(!ct(c))return s(c,h);for(var y=c.length,S=l?y:-1,k=xe(c);(l?S--:++S<y)&&h(k[S],S,k)!==!1;);return c}}function Gh(s){return function(l,c,h){for(var y=-1,S=xe(l),k=h(l),_=k.length;_--;){var T=k[s?_:++y];if(c(S[T],T,S)===!1)break}return l}}function Lw(s,l,c){var h=l&C,y=is(s);function S(){var k=this&&this!==qe&&this instanceof S?y:s;return k.apply(h?c:this,arguments)}return S}function Jh(s){return function(l){l=ye(l);var c=ri(l)?jt(l):t,h=c?c[0]:l.charAt(0),y=c?ir(c,1).join(""):l.slice(1);return h[s]()+y}}function fi(s){return function(l){return eu(Kp(Vp(l).replace(_b,"")),s,"")}}function is(s){return function(){var l=arguments;switch(l.length){case 0:return new s;case 1:return new s(l[0]);case 2:return new s(l[0],l[1]);case 3:return new s(l[0],l[1],l[2]);case 4:return new s(l[0],l[1],l[2],l[3]);case 5:return new s(l[0],l[1],l[2],l[3],l[4]);case 6:return new s(l[0],l[1],l[2],l[3],l[4],l[5]);case 7:return new s(l[0],l[1],l[2],l[3],l[4],l[5],l[6])}var c=ui(s.prototype),h=s.apply(c,l);return Ce(h)?h:c}}function Pw(s,l,c){var h=is(s);function y(){for(var S=arguments.length,k=A(S),_=S,T=di(y);_--;)k[_]=arguments[_];var O=S<3&&k[0]!==T&&k[S-1]!==T?[]:Zn(k,T);if(S-=O.length,S<c)return Zh(s,l,To,y.placeholder,t,k,O,t,t,c-S);var N=this&&this!==qe&&this instanceof y?h:s;return St(N,this,k)}return y}function qh(s){return function(l,c,h){var y=xe(l);if(!ct(l)){var S=J(c,3);l=He(l),c=function(_){return S(y[_],_,y)}}var k=s(l,c,h);return k>-1?y[S?l[k]:k]:t}}function jh(s){return vn(function(l){var c=l.length,h=c,y=Pt.prototype.thru;for(s&&l.reverse();h--;){var S=l[h];if(typeof S!="function")throw new Lt(a);if(y&&!k&&Io(S)=="wrapper")var k=new Pt([],!0)}for(h=k?h:c;++h<c;){S=l[h];var _=Io(S),T=_=="wrapper"?Lu(S):t;T&&Bu(T[0])&&T[1]==(fe|F|U|we)&&!T[4].length&&T[9]==1?k=k[Io(T[0])].apply(k,T[3]):k=S.length==1&&Bu(S)?k[_]():k.thru(S)}return function(){var O=arguments,N=O[0];if(k&&O.length==1&&Z(N))return k.plant(N).value();for(var R=0,H=c?l[R].apply(this,O):N;++R<c;)H=l[R].call(this,H);return H}})}function To(s,l,c,h,y,S,k,_,T,O){var N=l&fe,R=l&C,H=l&M,G=l&(F|$),q=l&yt,ee=H?t:is(s);function j(){for(var ie=arguments.length,ce=A(ie),_t=ie;_t--;)ce[_t]=arguments[_t];if(G)var rt=di(j),vt=Jb(ce,rt);if(h&&(ce=Uh(ce,h,y,G)),S&&(ce=Vh(ce,S,k,G)),ie-=vt,G&&ie<O){var Ne=Zn(ce,rt);return Zh(s,l,To,j.placeholder,c,ce,Ne,_,T,O-ie)}var Zt=R?c:this,An=H?Zt[s]:s;return ie=ce.length,_?ce=tS(ce,_):q&&ie>1&&ce.reverse(),N&&T<ie&&(ce.length=T),this&&this!==qe&&this instanceof j&&(An=ee||is(An)),An.apply(Zt,ce)}return j}function Yh(s,l){return function(c,h){return uw(c,s,l(h),{})}}function Co(s,l){return function(c,h){var y;if(c===t&&h===t)return l;if(c!==t&&(y=c),h!==t){if(y===t)return h;typeof c=="string"||typeof h=="string"?(c=kt(c),h=kt(h)):(c=Ph(c),h=Ph(h)),y=s(c,h)}return y}}function Iu(s){return vn(function(l){return l=ve(l,xt(J())),ne(function(c){var h=this;return s(l,function(y){return St(y,h,c)})})})}function Mo(s,l){l=l===t?" ":kt(l);var c=l.length;if(c<2)return c?Eu(l,s):l;var h=Eu(l,po(s/ii(l)));return ri(l)?ir(jt(h),0,s).join(""):h.slice(0,s)}function Dw(s,l,c,h){var y=l&C,S=is(s);function k(){for(var _=-1,T=arguments.length,O=-1,N=h.length,R=A(N+T),H=this&&this!==qe&&this instanceof k?S:s;++O<N;)R[O]=h[O];for(;T--;)R[O++]=arguments[++_];return St(H,y?c:this,R)}return k}function Xh(s){return function(l,c,h){return h&&typeof h!="number"&&nt(l,c,h)&&(c=h=t),l=Mn(l),c===t?(c=l,l=0):c=Mn(c),h=h===t?l<c?1:-1:Mn(h),xw(l,c,h,s)}}function Ao(s){return function(l,c){return typeof l=="string"&&typeof c=="string"||(l=Ft(l),c=Ft(c)),s(l,c)}}function Zh(s,l,c,h,y,S,k,_,T,O){var N=l&F,R=N?k:t,H=N?t:k,G=N?S:t,q=N?t:S;l|=N?U:ue,l&=~(N?ue:U),l&P||(l&=-4);var ee=[s,l,y,G,R,q,H,_,T,O],j=c.apply(t,ee);return Bu(s)&&cp(j,ee),j.placeholder=h,fp(j,s,l)}function Ou(s){var l=Pe[s];return function(c,h){if(c=Ft(c),h=h==null?0:Qe(Q(h),292),h&&fh(c)){var y=(ye(c)+"e").split("e"),S=l(y[0]+"e"+(+y[1]+h));return y=(ye(S)+"e").split("e"),+(y[0]+"e"+(+y[1]-h))}return l(c)}}var zw=li&&1/ro(new li([,-0]))[1]==bt?function(s){return new li(s)}:Qu;function Qh(s){return function(l){var c=et(l);return c==Jt?lu(l):c==qt?e2(l):Gb(l,s(l))}}function _n(s,l,c,h,y,S,k,_){var T=l&M;if(!T&&typeof s!="function")throw new Lt(a);var O=h?h.length:0;if(O||(l&=-97,h=y=t),k=k===t?k:De(Q(k),0),_=_===t?_:Q(_),O-=y?y.length:0,l&ue){var N=h,R=y;h=y=t}var H=T?t:Lu(s),G=[s,l,c,h,y,N,R,S,k,_];if(H&&Zw(G,H),s=G[0],l=G[1],c=G[2],h=G[3],y=G[4],_=G[9]=G[9]===t?T?0:s.length:De(G[9]-O,0),!_&&l&(F|$)&&(l&=-25),!l||l==C)var q=Lw(s,l,c);else l==F||l==$?q=Pw(s,l,_):(l==U||l==(C|U))&&!y.length?q=Dw(s,l,c,h):q=To.apply(t,G);var ee=H?Rh:cp;return fp(ee(q,G),s,l)}function ep(s,l,c,h){return s===t||Xt(s,oi[c])&&!Se.call(h,c)?l:s}function tp(s,l,c,h,y,S){return Ce(s)&&Ce(l)&&(S.set(l,s),ko(s,l,t,tp,S),S.delete(l)),s}function Bw(s){return as(s)?t:s}function np(s,l,c,h,y,S){var k=c&x,_=s.length,T=l.length;if(_!=T&&!(k&&T>_))return!1;var O=S.get(s),N=S.get(l);if(O&&N)return O==l&&N==s;var R=-1,H=!0,G=c&E?new Ar:t;for(S.set(s,l),S.set(l,s);++R<_;){var q=s[R],ee=l[R];if(h)var j=k?h(ee,q,R,l,s,S):h(q,ee,R,s,l,S);if(j!==t){if(j)continue;H=!1;break}if(G){if(!tu(l,function(ie,ce){if(!Ji(G,ce)&&(q===ie||y(q,ie,c,h,S)))return G.push(ce)})){H=!1;break}}else if(!(q===ee||y(q,ee,c,h,S))){H=!1;break}}return S.delete(s),S.delete(l),H}function Fw(s,l,c,h,y,S,k){switch(c){case ei:if(s.byteLength!=l.byteLength||s.byteOffset!=l.byteOffset)return!1;s=s.buffer,l=l.buffer;case Gi:return!(s.byteLength!=l.byteLength||!S(new uo(s),new uo(l)));case Hi:case $i:case Wi:return Xt(+s,+l);case js:return s.name==l.name&&s.message==l.message;case Ui:case Vi:return s==l+"";case Jt:var _=lu;case qt:var T=h&x;if(_||(_=ro),s.size!=l.size&&!T)return!1;var O=k.get(s);if(O)return O==l;h|=E,k.set(s,l);var N=np(_(s),_(l),h,y,S,k);return k.delete(s),N;case Xs:if(Zi)return Zi.call(s)==Zi.call(l)}return!1}function Hw(s,l,c,h,y,S){var k=c&x,_=Nu(s),T=_.length,O=Nu(l),N=O.length;if(T!=N&&!k)return!1;for(var R=T;R--;){var H=_[R];if(!(k?H in l:Se.call(l,H)))return!1}var G=S.get(s),q=S.get(l);if(G&&q)return G==l&&q==s;var ee=!0;S.set(s,l),S.set(l,s);for(var j=k;++R<T;){H=_[R];var ie=s[H],ce=l[H];if(h)var _t=k?h(ce,ie,H,l,s,S):h(ie,ce,H,s,l,S);if(!(_t===t?ie===ce||y(ie,ce,c,h,S):_t)){ee=!1;break}j||(j=H=="constructor")}if(ee&&!j){var rt=s.constructor,vt=l.constructor;rt!=vt&&"constructor"in s&&"constructor"in l&&!(typeof rt=="function"&&rt instanceof rt&&typeof vt=="function"&&vt instanceof vt)&&(ee=!1)}return S.delete(s),S.delete(l),ee}function vn(s){return Hu(ap(s,t,yp),s+"")}function Nu(s){return kh(s,He,Du)}function Ru(s){return kh(s,ft,rp)}var Lu=go?function(s){return go.get(s)}:Qu;function Io(s){for(var l=s.name+"",c=ai[l],h=Se.call(ai,l)?c.length:0;h--;){var y=c[h],S=y.func;if(S==null||S==s)return y.name}return l}function di(s){var l=Se.call(w,"placeholder")?w:s;return l.placeholder}function J(){var s=w.iteratee||Xu;return s=s===Xu?vh:s,arguments.length?s(arguments[0],arguments[1]):s}function Oo(s,l){var c=s.__data__;return qw(l)?c[typeof l=="string"?"string":"hash"]:c.map}function Pu(s){for(var l=He(s),c=l.length;c--;){var h=l[c],y=s[h];l[c]=[h,y,op(y)]}return l}function Nr(s,l){var c=Xb(s,l);return _h(c)?c:t}function $w(s){var l=Se.call(s,Cr),c=s[Cr];try{s[Cr]=t;var h=!0}catch{}var y=lo.call(s);return h&&(l?s[Cr]=c:delete s[Cr]),y}var Du=uu?function(s){return s==null?[]:(s=xe(s),Yn(uu(s),function(l){return uh.call(s,l)}))}:ec,rp=uu?function(s){for(var l=[];s;)Xn(l,Du(s)),s=co(s);return l}:ec,et=tt;(cu&&et(new cu(new ArrayBuffer(1)))!=ei||ji&&et(new ji)!=Jt||fu&&et(fu.resolve())!=wd||li&&et(new li)!=qt||Yi&&et(new Yi)!=Ki)&&(et=function(s){var l=tt(s),c=l==Sn?s.constructor:t,h=c?Rr(c):"";if(h)switch(h){case E2:return ei;case _2:return Jt;case v2:return wd;case T2:return qt;case C2:return Ki}return l});function Ww(s,l,c){for(var h=-1,y=c.length;++h<y;){var S=c[h],k=S.size;switch(S.type){case"drop":s+=k;break;case"dropRight":l-=k;break;case"take":l=Qe(l,s+k);break;case"takeRight":s=De(s,l-k);break}}return{start:s,end:l}}function Uw(s){var l=s.match(jy);return l?l[1].split(Yy):[]}function ip(s,l,c){l=rr(l,s);for(var h=-1,y=l.length,S=!1;++h<y;){var k=cn(l[h]);if(!(S=s!=null&&c(s,k)))break;s=s[k]}return S||++h!=y?S:(y=s==null?0:s.length,!!y&&Bo(y)&&Tn(k,y)&&(Z(s)||Lr(s)))}function Vw(s){var l=s.length,c=new s.constructor(l);return l&&typeof s[0]=="string"&&Se.call(s,"index")&&(c.index=s.index,c.input=s.input),c}function sp(s){return typeof s.constructor=="function"&&!ss(s)?ui(co(s)):{}}function Kw(s,l,c){var h=s.constructor;switch(l){case Gi:return Au(s);case Hi:case $i:return new h(+s);case ei:return Mw(s,c);case Pa:case Da:case za:case Ba:case Fa:case Ha:case $a:case Wa:case Ua:return $h(s,c);case Jt:return new h;case Wi:case Vi:return new h(s);case Ui:return Aw(s);case qt:return new h;case Xs:return Iw(s)}}function Gw(s,l){var c=l.length;if(!c)return s;var h=c-1;return l[h]=(c>1?"& ":"")+l[h],l=l.join(c>2?", ":" "),s.replace(qy,`{
20
+ 3. "-" cannot repeat`);ke.customSchemes.push([n,e])}function EA(){ke.scanner=gA(ke.customSchemes);for(let n=0;n<ke.tokenQueue.length;n++)ke.tokenQueue[n][1]({scanner:ke.scanner});ke.parser=vA(ke.scanner.tokens);for(let n=0;n<ke.pluginQueue.length;n++)ke.pluginQueue[n][1]({scanner:ke.scanner,parser:ke.parser});return ke.initialized=!0,ke}function da(n){return ke.initialized||EA(),wA(ke.parser.start,n,u1(ke.scanner.start,n))}da.scan=u1;function y1(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new Gf(t),i=da(n),o=[];for(let a=0;a<i.length;a++){const c=i[a];c.isLink&&(!e||c.t===e)&&r.check(c)&&o.push(c.toFormattedObject(r))}return o}function _A(n,e=null){const t=da(n);return t.length===1&&t[0].isLink&&(!e||t[0].t===e)}class TA extends _f{addProps(){return{handlePaste:this._handlePaste}}_handlePaste(e,t,r){if(e.state.selection.empty)return!1;const i=r.content.textBetween(0,r.content.size).trim(),o=_A(i);if(!i||!o)return!1;const a=this._createLinkAttrs(i,r.content);return this.editor.commands.applyLink(a),!0}_createLinkAttrs(e,t){return yh.query(t,{typeName:Ce.TEXT,mark:{typeName:me.LINK},getMark:{typeName:me.LINK}})?.attrs||{href:e}}}function z(n){return(...e)=>t=>n(t,...e)}function pa(n){const e=Object.entries(n).reduce((t,[r,i])=>{if(!i)return t;const o=r.replace(/_/g,"-");return`${t}--zw-${o}:${i};`},"");return e?{style:e}:null}function Gr(n){const e=pa(n);return["span",e?{...e,class:"zw-style"}:{},0]}function CA(n){return n.toLowerCase().replace(/(?:^|\s)\S/g,e=>e.toUpperCase())}function Gt(n,...e){return({editor:t})=>(t.commands[n](...e),!0)}var MA=Object.defineProperty,AA=(n,e,t)=>e in n?MA(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Hn=(n,e,t)=>AA(n,typeof e!="symbol"?e+"":e,t),b1,v1,w1;function Be(n,e){let t=n.length;Array.isArray(n[0])||(n=[n]),Array.isArray(e[0])||(e=e.map(a=>[a]));let r=e[0].length,i=e[0].map((a,c)=>e.map(f=>f[c])),o=n.map(a=>i.map(c=>{let f=0;if(!Array.isArray(a)){for(let h of c)f+=a*h;return f}for(let h=0;h<a.length;h++)f+=a[h]*(c[h]||0);return f}));return t===1&&(o=o[0]),r===1?o.map(a=>a[0]):o}function S1(n){return Bs(n)==="string"}function Bs(n){return(Object.prototype.toString.call(n).match(/^\[object\s+(.*?)\]$/)[1]||"").toLowerCase()}function qf(n,{precision:e,unit:t}){return jf(n)?"none":IA(n,e)+(t??"")}function jf(n){return Number.isNaN(n)||n instanceof Number&&n?.none}function IA(n,e){if(n===0)return 0;let t=~~n,r=0;t&&e&&(r=~~Math.log10(Math.abs(t))+1);const i=10**(e-r);return Math.floor(n*i+.5)/i}const OA={deg:1,grad:.9,rad:180/Math.PI,turn:360};function NA(n){if(!n)return;n=n.trim();const e=/^([a-z]+)\((.+?)\)$/i,t=/^-?[\d.]+$/,r=/%|deg|g?rad|turn$/,i=/\/?\s*(none|[-\w.]+(?:%|deg|g?rad|turn)?)/g;let o=n.match(e);if(o){let a=[];return o[2].replace(i,(c,f)=>{let h=f.match(r),m=f;if(h){let p=h[0],g=m.slice(0,-p.length);p==="%"?(m=new Number(g/100),m.type="<percentage>"):(m=new Number(g*OA[p]),m.type="<angle>",m.unit=p)}else t.test(m)?(m=new Number(m),m.type="<number>"):m==="none"&&(m=new Number(NaN),m.none=!0);c.startsWith("/")&&(m=m instanceof Number?m:new Number(m),m.alpha=!0),typeof m=="object"&&m instanceof Number&&(m.raw=f),a.push(m)}),{name:o[1].toLowerCase(),rawName:o[1],rawArgs:o[2],args:a}}}function RA(n){return n[n.length-1]}function x1(n,e,t){return isNaN(n)?e:isNaN(e)?n:n+(e-n)*t}function LA(n,e,t){return(t-n)/(e-n)}function k1(n,e,t){return x1(e[0],e[1],LA(n[0],n[1],t))}function PA(n){return n.map(e=>e.split("|").map(t=>{t=t.trim();let r=t.match(/^(<[a-z]+>)\[(-?[.\d]+),\s*(-?[.\d]+)\]?$/);if(r){let i=new String(r[1]);return i.range=[+r[2],+r[3]],i}return t}))}function DA(n,e,t){return Math.max(Math.min(t,e),n)}function Yf(n,e){return Math.sign(n)===Math.sign(e)?n:-n}function $n(n,e){return Yf(Math.abs(n)**e,n)}function E1(n,e){return e===0?0:n/e}function zA(n,e,t=0,r=n.length){for(;t<r;){const i=t+r>>1;n[i]<e?t=i+1:r=i}return t}class BA{add(e,t,r){if(typeof arguments[0]!="string"){for(var e in arguments[0])this.add(e,arguments[0][e],arguments[1]);return}(Array.isArray(e)?e:[e]).forEach(function(i){this[i]=this[i]||[],t&&this[i][r?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(r){r.call(t&&t.context?t.context:t,t)})}}const ma=new BA,Wn={D50:[.3457/.3585,1,(1-.3457-.3585)/.3585],D65:[.3127/.329,1,(1-.3127-.329)/.329]};function Xf(n){return Array.isArray(n)?n:Wn[n]}function ga(n,e,t,r={}){if(n=Xf(n),e=Xf(e),!n||!e)throw new TypeError(`Missing white point to convert ${n?"":"from"}${!n&&!e?"/":""}${e?"":"to"}`);if(n===e)return t;let i={W1:n,W2:e,XYZ:t,options:r};if(ma.run("chromatic-adaptation-start",i),i.M||(i.W1===Wn.D65&&i.W2===Wn.D50?i.M=[[1.0479297925449969,.022946870601609652,-.05019226628920524],[.02962780877005599,.9904344267538799,-.017073799063418826],[-.009243040646204504,.015055191490298152,.7518742814281371]]:i.W1===Wn.D50&&i.W2===Wn.D65&&(i.M=[[.955473421488075,-.02309845494876471,.06325924320057072],[-.0283697093338637,1.0099953980813041,.021041441191917323],[.012314014864481998,-.020507649298898964,1.330365926242124]])),ma.run("chromatic-adaptation-end",i),i.M)return Be(i.M,i.XYZ);throw new TypeError("Only Bradford CAT with white points D50 and D65 supported for now.")}const Fs={gamut_mapping:"css",precision:5,deltaE:"76",verbose:((w1=(v1=(b1=globalThis?.process)==null?void 0:b1.env)==null?void 0:v1.NODE_ENV)==null?void 0:w1.toLowerCase())!=="test",warn:function(e){var t,r;this.verbose&&((r=(t=globalThis?.console)==null?void 0:t.warn)==null||r.call(t,e))}},FA=new Set(["<number>","<percentage>","<angle>"]);function _1(n,e,t,r){return Object.entries(n.coords).map(([o,a],c)=>{let f=e.coordGrammar[c],h=r[c],m=h?.type,p;if(h.none?p=f.find(S=>FA.has(S)):p=f.find(S=>S==m),!p){let S=a.name||o;throw new TypeError(`${m??h.raw} not allowed for ${S} in ${t}()`)}let g=p.range;m==="<percentage>"&&(g||(g=[0,1]));let b=a.range||a.refRange;return g&&b&&(r[c]=k1(g,b,r[c])),p})}function T1(n,{meta:e}={}){var t,r,i,o;let a={str:(t=String(n))==null?void 0:t.trim()};if(ma.run("parse-start",a),a.color)return a.color;if(a.parsed=NA(a.str),a.parsed){let c=a.parsed.name;if(c==="color"){let f=a.parsed.args.shift(),h=f.startsWith("--")?f.substring(2):`--${f}`,m=[f,h],p=a.parsed.rawArgs.indexOf("/")>0?a.parsed.args.pop():1;for(let S of re.all){let k=S.getFormat("color");if(k&&(m.includes(k.id)||(r=k.ids)!=null&&r.filter(C=>m.includes(C)).length)){const C=Object.keys(S.coords).map((P,F)=>a.parsed.args[F]||0);let M;return k.coordGrammar&&(M=_1(S,k,"color",C)),e&&Object.assign(e,{formatId:"color",types:M}),k.id.startsWith("--")&&!f.startsWith("--")&&Fs.warn(`${S.name} is a non-standard space and not currently supported in the CSS spec. Use prefixed color(${k.id}) instead of color(${f}).`),f.startsWith("--")&&!k.id.startsWith("--")&&Fs.warn(`${S.name} is a standard space and supported in the CSS spec. Use color(${k.id}) instead of prefixed color(${f}).`),{spaceId:S.id,coords:C,alpha:p}}}let g="",b=f in re.registry?f:h;if(b in re.registry){let S=(o=(i=re.registry[b].formats)==null?void 0:i.color)==null?void 0:o.id;S&&(g=`Did you mean color(${S})?`)}throw new TypeError(`Cannot parse color(${f}). `+(g||"Missing a plugin?"))}else for(let f of re.all){let h=f.getFormat(c);if(h&&h.type==="function"){let m=1;(h.lastAlpha||RA(a.parsed.args).alpha)&&(m=a.parsed.args.pop());let p=a.parsed.args,g;return h.coordGrammar&&(g=_1(f,h,c,p)),e&&Object.assign(e,{formatId:h.name,types:g}),{spaceId:f.id,coords:p,alpha:m}}}}else for(let c of re.all)for(let f in c.formats){let h=c.formats[f];if(h.type!=="custom"||h.test&&!h.test(a.str))continue;let m=h.parse(a.str);if(m)return m.alpha??(m.alpha=1),e&&(e.formatId=f),m}throw new TypeError(`Could not parse ${n} as a color. Missing a plugin?`)}function Ke(n){if(Array.isArray(n))return n.map(Ke);if(!n)throw new TypeError("Empty color reference");S1(n)&&(n=T1(n));let e=n.space||n.spaceId;return e instanceof re||(n.space=re.get(e)),n.alpha===void 0&&(n.alpha=1),n}const HA=75e-6,Zf=class nn{constructor(e){var t;this.id=e.id,this.name=e.name,this.base=e.base?nn.get(e.base):null,this.aliases=e.aliases,this.base&&(this.fromBase=e.fromBase,this.toBase=e.toBase);let r=e.coords??this.base.coords;for(let o in r)"name"in r[o]||(r[o].name=o);this.coords=r;let i=e.white??this.base.white??"D65";this.white=Xf(i),this.formats=e.formats??{};for(let o in this.formats){let a=this.formats[o];a.type||(a.type="function"),a.name||(a.name=o)}(t=this.formats.color)!=null&&t.id||(this.formats.color={...this.formats.color??{},id:e.cssId||this.id}),e.gamutSpace?this.gamutSpace=e.gamutSpace==="self"?this:nn.get(e.gamutSpace):this.isPolar?this.gamutSpace=this.base:this.gamutSpace=this,this.gamutSpace.isUnbounded&&(this.inGamut=(o,a)=>!0),this.referred=e.referred,Object.defineProperty(this,"path",{value:$A(this).reverse(),writable:!1,enumerable:!0,configurable:!0}),ma.run("colorspace-init-end",this)}inGamut(e,{epsilon:t=HA}={}){if(!this.equals(this.gamutSpace))return e=this.to(this.gamutSpace,e),this.gamutSpace.inGamut(e,{epsilon:t});let r=Object.values(this.coords);return e.every((i,o)=>{let a=r[o];if(a.type!=="angle"&&a.range){if(Number.isNaN(i))return!0;let[c,f]=a.range;return(c===void 0||i>=c-t)&&(f===void 0||i<=f+t)}return!0})}get isUnbounded(){return Object.values(this.coords).every(e=>!("range"in e))}get cssId(){var e,t;return((t=(e=this.formats)==null?void 0:e.color)==null?void 0:t.id)||this.id}get isPolar(){for(let e in this.coords)if(this.coords[e].type==="angle")return!0;return!1}getFormat(e){if(typeof e=="object")return e=C1(e,this),e;let t;return e==="default"?t=Object.values(this.formats)[0]:t=this.formats[e],t?(t=C1(t,this),t):null}equals(e){return e?this===e||this.id===e||this.id===e.id:!1}to(e,t){if(arguments.length===1){const c=Ke(e);[e,t]=[c.space,c.coords]}if(e=nn.get(e),this.equals(e))return t;t=t.map(c=>Number.isNaN(c)?0:c);let r=this.path,i=e.path,o,a;for(let c=0;c<r.length&&r[c].equals(i[c]);c++)o=r[c],a=c;if(!o)throw new Error(`Cannot convert between color spaces ${this} and ${e}: no connection space was found`);for(let c=r.length-1;c>a;c--)t=r[c].toBase(t);for(let c=a+1;c<i.length;c++)t=i[c].fromBase(t);return t}from(e,t){if(arguments.length===1){const r=Ke(e);[e,t]=[r.space,r.coords]}return e=nn.get(e),e.to(this,t)}toString(){return`${this.name} (${this.id})`}getMinCoords(){let e=[];for(let t in this.coords){let r=this.coords[t],i=r.range||r.refRange;e.push(i?.min??0)}return e}static get all(){return[...new Set(Object.values(nn.registry))]}static register(e,t){if(arguments.length===1&&(t=arguments[0],e=t.id),t=this.get(t),this.registry[e]&&this.registry[e]!==t)throw new Error(`Duplicate color space registration: '${e}'`);if(this.registry[e]=t,arguments.length===1&&t.aliases)for(let r of t.aliases)this.register(r,t);return t}static get(e,...t){if(!e||e instanceof nn)return e;if(Bs(e)==="string"){let i=nn.registry[e.toLowerCase()];if(!i)throw new TypeError(`No color space found with id = "${e}"`);return i}if(t.length)return nn.get(...t);throw new TypeError(`${e} is not a valid color space`)}static resolveCoord(e,t){var r;let i=Bs(e),o,a;if(i==="string"?e.includes(".")?[o,a]=e.split("."):[o,a]=[,e]:Array.isArray(e)?[o,a]=e:(o=e.space,a=e.coordId),o=nn.get(o),o||(o=t),!o)throw new TypeError(`Cannot resolve coordinate reference ${e}: No color space specified and relative references are not allowed here`);if(i=Bs(a),i==="number"||i==="string"&&a>=0){let h=Object.entries(o.coords)[a];if(h)return{space:o,id:h[0],index:a,...h[1]}}o=nn.get(o);let c=a.toLowerCase(),f=0;for(let h in o.coords){let m=o.coords[h];if(h.toLowerCase()===c||((r=m.name)==null?void 0:r.toLowerCase())===c)return{space:o,id:h,index:f,...m};f++}throw new TypeError(`No "${a}" coordinate found in ${o.name}. Its coordinates are: ${Object.keys(o.coords).join(", ")}`)}};Hn(Zf,"registry",{}),Hn(Zf,"DEFAULT_FORMAT",{type:"functions",name:"color"});let re=Zf;function $A(n){let e=[n];for(let t=n;t=t.base;)e.push(t);return e}function C1(n,{coords:e}={}){if(n.coords&&!n.coordGrammar){n.type||(n.type="function"),n.name||(n.name="color"),n.coordGrammar=PA(n.coords);let t=Object.entries(e).map(([r,i],o)=>{let a=n.coordGrammar[o][0],c=i.range||i.refRange,f=a.range,h="";return a=="<percentage>"?(f=[0,100],h="%"):a=="<angle>"&&(h="deg"),{fromRange:c,toRange:f,suffix:h}});n.serializeCoords=(r,i)=>r.map((o,a)=>{let{fromRange:c,toRange:f,suffix:h}=t[a];return c&&f&&(o=k1(c,f,o)),o=qf(o,{precision:i,unit:h}),o})}return n}const Un=new re({id:"xyz-d65",name:"XYZ D65",coords:{x:{name:"X"},y:{name:"Y"},z:{name:"Z"}},white:"D65",formats:{color:{ids:["xyz-d65","xyz"]}},aliases:["xyz"]});class M1 extends re{constructor(e){e.coords||(e.coords={r:{range:[0,1],name:"Red"},g:{range:[0,1],name:"Green"},b:{range:[0,1],name:"Blue"}}),e.base||(e.base=Un),e.toXYZ_M&&e.fromXYZ_M&&(e.toBase??(e.toBase=t=>{let r=Be(e.toXYZ_M,t);return this.white!==this.base.white&&(r=ga(this.white,this.base.white,r)),r}),e.fromBase??(e.fromBase=t=>(t=ga(this.base.white,this.white,t),Be(e.fromXYZ_M,t)))),e.referred??(e.referred="display"),super(e)}}function Qf(n,e){return n=Ke(n),!e||n.space.equals(e)?n.coords.slice():(e=re.get(e),e.from(n))}function Vn(n,e){n=Ke(n);let{space:t,index:r}=re.resolveCoord(e,n.space);return Qf(n,t)[r]}function A1(n,e,t){return n=Ke(n),e=re.get(e),n.coords=e.to(n.space,t),n}A1.returns="color";function eh(n,e,t){if(n=Ke(n),arguments.length===2&&Bs(arguments[1])==="object"){let r=arguments[1];for(let i in r)eh(n,i,r[i])}else{typeof t=="function"&&(t=t(Vn(n,e)));let{space:r,index:i}=re.resolveCoord(e,n.space),o=Qf(n,r);o[i]=t,A1(n,r,o)}return n}eh.returns="color";const WA=new re({id:"xyz-d50",name:"XYZ D50",white:"D50",base:Un,fromBase:n=>ga(Un.white,"D50",n),toBase:n=>ga("D50",Un.white,n)}),UA=216/24389,I1=24/116,ya=24389/27;let th=Wn.D50;const Kn=new re({id:"lab",name:"Lab",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:th,base:WA,fromBase(n){let t=n.map((r,i)=>r/th[i]).map(r=>r>UA?Math.cbrt(r):(ya*r+16)/116);return[116*t[1]-16,500*(t[0]-t[1]),200*(t[1]-t[2])]},toBase(n){let e=[];return e[1]=(n[0]+16)/116,e[0]=n[1]/500+e[1],e[2]=e[1]-n[2]/200,[e[0]>I1?Math.pow(e[0],3):(116*e[0]-16)/ya,n[0]>8?Math.pow((n[0]+16)/116,3):n[0]/ya,e[2]>I1?Math.pow(e[2],3):(116*e[2]-16)/ya].map((r,i)=>r*th[i])},formats:{lab:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function Jr(n){return(n%360+360)%360}const ba=new re({id:"lch",name:"LCH",coords:{l:{refRange:[0,100],name:"Lightness"},c:{refRange:[0,150],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:Kn,fromBase(n){let[e,t,r]=n,i;const o=.02;return Math.abs(t)<o&&Math.abs(r)<o?i=NaN:i=Math.atan2(r,t)*180/Math.PI,[e,Math.sqrt(t**2+r**2),Jr(i)]},toBase(n){let[e,t,r]=n;return t<0&&(t=0),isNaN(r)&&(r=0),[e,t*Math.cos(r*Math.PI/180),t*Math.sin(r*Math.PI/180)]},formats:{lch:{coords:["<number> | <percentage>","<number> | <percentage>","<number> | <angle>"]}}}),O1=25**7,va=Math.PI,N1=180/va,Ni=va/180;function R1(n){const e=n*n;return e*e*e*n}function L1(n,e,{kL:t=1,kC:r=1,kH:i=1}={}){[n,e]=Ke([n,e]);let[o,a,c]=Kn.from(n),f=ba.from(Kn,[o,a,c])[1],[h,m,p]=Kn.from(e),g=ba.from(Kn,[h,m,p])[1];f<0&&(f=0),g<0&&(g=0);let b=(f+g)/2,S=R1(b),k=.5*(1-Math.sqrt(S/(S+O1))),C=(1+k)*a,M=(1+k)*m,P=Math.sqrt(C**2+c**2),F=Math.sqrt(M**2+p**2),$=C===0&&c===0?0:Math.atan2(c,C),U=M===0&&p===0?0:Math.atan2(p,M);$<0&&($+=2*va),U<0&&(U+=2*va),$*=N1,U*=N1;let ce=h-o,fe=F-P,be=U-$,bt=$+U,Jn=Math.abs(be),sn;P*F===0?sn=0:Jn<=180?sn=be:be>180?sn=be-360:be<-180?sn=be+360:Fs.warn("the unthinkable has happened");let qn=2*Math.sqrt(F*P)*Math.sin(sn*Ni/2),Zr=(o+h)/2,on=(P+F)/2,wn=R1(on),He;P*F===0?He=bt:Jn<=180?He=bt/2:bt<360?He=(bt+360)/2:He=(bt-360)/2;let vt=(Zr-50)**2,jn=1+.015*vt/Math.sqrt(20+vt),Gs=1+.045*on,ln=1;ln-=.17*Math.cos((He-30)*Ni),ln+=.24*Math.cos(2*He*Ni),ln+=.32*Math.cos((3*He+6)*Ni),ln-=.2*Math.cos((4*He-63)*Ni);let wt=1+.015*on*ln,Oa=30*Math.exp(-1*((He-275)/25)**2),Na=2*Math.sqrt(wn/(wn+O1)),Ra=-1*Math.sin(2*Oa*Ni)*Na,Jt=(ce/(t*jn))**2;return Jt+=(fe/(r*Gs))**2,Jt+=(qn/(i*wt))**2,Jt+=Ra*(fe/(r*Gs))*(qn/(i*wt)),Math.sqrt(Jt)}const VA=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],KA=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],GA=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],JA=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],wa=new re({id:"oklab",name:"Oklab",coords:{l:{refRange:[0,1],name:"Lightness"},a:{refRange:[-.4,.4]},b:{refRange:[-.4,.4]}},white:"D65",base:Un,fromBase(n){let t=Be(VA,n).map(r=>Math.cbrt(r));return Be(GA,t)},toBase(n){let t=Be(JA,n).map(r=>r**3);return Be(KA,t)},formats:{oklab:{coords:["<percentage> | <number>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function nh(n,e){[n,e]=Ke([n,e]);let[t,r,i]=wa.from(n),[o,a,c]=wa.from(e),f=t-o,h=r-a,m=i-c;return Math.sqrt(f**2+h**2+m**2)}const qA=75e-6;function Ri(n,e,{epsilon:t=qA}={}){n=Ke(n),e||(e=n.space),e=re.get(e);let r=n.coords;return e!==n.space&&(r=e.from(n)),e.inGamut(r,{epsilon:t})}function rh(n){return{space:n.space,coords:n.coords.slice(),alpha:n.alpha}}function jA(n,e,t="lab"){t=re.get(t);let r=t.from(n),i=t.from(e);return Math.sqrt(r.reduce((o,a,c)=>{let f=i[c];return isNaN(a)||isNaN(f)?o:o+(f-a)**2},0))}function YA(n,e){return jA(n,e,"lab")}const XA=Math.PI,P1=XA/180;function ZA(n,e,{l:t=2,c:r=1}={}){[n,e]=Ke([n,e]);let[i,o,a]=Kn.from(n),[,c,f]=ba.from(Kn,[i,o,a]),[h,m,p]=Kn.from(e),g=ba.from(Kn,[h,m,p])[1];c<0&&(c=0),g<0&&(g=0);let b=i-h,S=c-g,k=o-m,C=a-p,M=k**2+C**2-S**2,P=.511;i>=16&&(P=.040975*i/(1+.01765*i));let F=.0638*c/(1+.0131*c)+.638,$;Number.isNaN(f)&&(f=0),f>=164&&f<=345?$=.56+Math.abs(.2*Math.cos((f+168)*P1)):$=.36+Math.abs(.4*Math.cos((f+35)*P1));let U=Math.pow(c,4),ce=Math.sqrt(U/(U+1900)),fe=F*(ce*$+1-ce),be=(b/(t*P))**2;return be+=(S/(r*F))**2,be+=M/fe**2,Math.sqrt(be)}const D1=203,z1=new re({id:"xyz-abs-d65",cssId:"--xyz-abs-d65",name:"Absolute XYZ D65",coords:{x:{refRange:[0,9504.7],name:"Xa"},y:{refRange:[0,1e4],name:"Ya"},z:{refRange:[0,10888.3],name:"Za"}},base:Un,fromBase(n){return n.map(e=>Math.max(e*D1,0))},toBase(n){return n.map(e=>Math.max(e/D1,0))}}),Sa=1.15,xa=.66,B1=2610/2**14,QA=2**14/2610,F1=3424/2**12,H1=2413/2**7,$1=2392/2**7,eI=1.7*2523/2**5,W1=2**5/(1.7*2523),ka=-.56,ih=16295499532821565e-27,tI=[[.41478972,.579999,.014648],[-.20151,1.120649,.0531008],[-.0166008,.2648,.6684799]],nI=[[1.9242264357876067,-1.0047923125953657,.037651404030618],[.35031676209499907,.7264811939316552,-.06538442294808501],[-.09098281098284752,-.3127282905230739,1.5227665613052603]],rI=[[.5,.5,0],[3.524,-4.066708,.542708],[.199076,1.096799,-1.295875]],iI=[[1,.1386050432715393,.05804731615611886],[.9999999999999999,-.1386050432715393,-.05804731615611886],[.9999999999999998,-.09601924202631895,-.8118918960560388]],sI=new re({id:"jzazbz",name:"Jzazbz",coords:{jz:{refRange:[0,1],name:"Jz"},az:{refRange:[-.5,.5]},bz:{refRange:[-.5,.5]}},base:z1,fromBase(n){let[e,t,r]=n,i=Sa*e-(Sa-1)*r,o=xa*t-(xa-1)*e,c=Be(tI,[i,o,r]).map(function(g){let b=F1+H1*(g/1e4)**B1,S=1+$1*(g/1e4)**B1;return(b/S)**eI}),[f,h,m]=Be(rI,c);return[(1+ka)*f/(1+ka*f)-ih,h,m]},toBase(n){let[e,t,r]=n,i=(e+ih)/(1+ka-ka*(e+ih)),a=Be(iI,[i,t,r]).map(function(g){let b=F1-g**W1,S=$1*g**W1-H1;return 1e4*(b/S)**QA}),[c,f,h]=Be(nI,a),m=(c+(Sa-1)*h)/Sa,p=(f+(xa-1)*m)/xa;return[m,p,h]},formats:{color:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}}),U1=new re({id:"jzczhz",name:"JzCzHz",coords:{jz:{refRange:[0,1],name:"Jz"},cz:{refRange:[0,1],name:"Chroma"},hz:{refRange:[0,360],type:"angle",name:"Hue"}},base:sI,fromBase(n){let[e,t,r]=n,i;const o=2e-4;return Math.abs(t)<o&&Math.abs(r)<o?i=NaN:i=Math.atan2(r,t)*180/Math.PI,[e,Math.sqrt(t**2+r**2),Jr(i)]},toBase(n){return[n[0],n[1]*Math.cos(n[2]*Math.PI/180),n[1]*Math.sin(n[2]*Math.PI/180)]}});function oI(n,e){[n,e]=Ke([n,e]);let[t,r,i]=U1.from(n),[o,a,c]=U1.from(e),f=t-o,h=r-a;Number.isNaN(i)&&Number.isNaN(c)?(i=0,c=0):Number.isNaN(i)?i=c:Number.isNaN(c)&&(c=i);let m=i-c,p=2*Math.sqrt(r*a)*Math.sin(m/2*(Math.PI/180));return Math.sqrt(f**2+h**2+p**2)}const V1=3424/4096,K1=2413/128,G1=2392/128,J1=2610/16384,lI=2523/32,aI=16384/2610,q1=32/2523,cI=[[.3592832590121217,.6976051147779502,-.035891593232029],[-.1920808463704993,1.100476797037432,.0753748658519118],[.0070797844607479,.0748396662186362,.8433265453898765]],uI=[[2048/4096,2048/4096,0],[6610/4096,-13613/4096,7003/4096],[17933/4096,-17390/4096,-543/4096]],fI=[[.9999999999999998,.0086090370379328,.111029625003026],[.9999999999999998,-.0086090370379328,-.1110296250030259],[.9999999999999998,.5600313357106791,-.3206271749873188]],hI=[[2.0701522183894223,-1.3263473389671563,.2066510476294053],[.3647385209748072,.6805660249472273,-.0453045459220347],[-.0497472075358123,-.0492609666966131,1.1880659249923042]],j1=new re({id:"ictcp",name:"ICTCP",coords:{i:{refRange:[0,1],name:"I"},ct:{refRange:[-.5,.5],name:"CT"},cp:{refRange:[-.5,.5],name:"CP"}},base:z1,fromBase(n){let e=Be(cI,n);return dI(e)},toBase(n){let e=pI(n);return Be(hI,e)}});function dI(n){let e=n.map(function(t){let r=V1+K1*(t/1e4)**J1,i=1+G1*(t/1e4)**J1;return(r/i)**lI});return Be(uI,e)}function pI(n){return Be(fI,n).map(function(r){let i=Math.max(r**q1-V1,0),o=K1-G1*r**q1;return 1e4*(i/o)**aI})}function mI(n,e){[n,e]=Ke([n,e]);let[t,r,i]=j1.from(n),[o,a,c]=j1.from(e);return 720*Math.sqrt((t-o)**2+.25*(r-a)**2+(i-c)**2)}const gI=Wn.D65,Y1=.42,X1=1/Y1,sh=2*Math.PI,Z1=[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],yI=[[1.8620678550872327,-1.0112546305316843,.14918677544445175],[.38752654323613717,.6214474419314753,-.008973985167612518],[-.015841498849333856,-.03412293802851557,1.0499644368778496]],bI=[[460,451,288],[460,-891,-261],[460,-220,-6300]],vI={dark:[.8,.525,.8],dim:[.9,.59,.9],average:[1,.69,1]},qr={h:[20.14,90,164.25,237.53,380.14],e:[.8,.7,1,1.2,.8],H:[0,100,200,300,400]},wI=180/Math.PI,Q1=Math.PI/180;function ey(n,e){return n.map(r=>{const i=$n(e*Math.abs(r)*.01,Y1);return 400*Yf(i,r)/(i+27.13)})}function SI(n,e){const t=100/e*27.13**X1;return n.map(r=>{const i=Math.abs(r);return Yf(t*$n(i/(400-i),X1),r)})}function xI(n){let e=Jr(n);e<=qr.h[0]&&(e+=360);const t=zA(qr.h,e)-1,[r,i]=qr.h.slice(t,t+2),[o,a]=qr.e.slice(t,t+2),c=qr.H[t],f=(e-r)/o;return c+100*f/(f+(i-e)/a)}function kI(n){let e=(n%400+400)%400;const t=Math.floor(.01*e);e=e%100;const[r,i]=qr.h.slice(t,t+2),[o,a]=qr.e.slice(t,t+2);return Jr((e*(a*r-o*i)-100*r*a)/(e*(a-o)-100*a))}function ty(n,e,t,r,i){const o={};o.discounting=i,o.refWhite=n,o.surround=r;const a=n.map(k=>k*100);o.la=e,o.yb=t;const c=a[1],f=Be(Z1,a);r=vI[o.surround];const h=r[0];o.c=r[1],o.nc=r[2];const p=(1/(5*o.la+1))**4;o.fl=p*o.la+.1*(1-p)*(1-p)*Math.cbrt(5*o.la),o.flRoot=o.fl**.25,o.n=o.yb/c,o.z=1.48+Math.sqrt(o.n),o.nbb=.725*o.n**-.2,o.ncb=o.nbb;const g=Math.max(Math.min(h*(1-1/3.6*Math.exp((-o.la-42)/92)),1),0);o.dRgb=f.map(k=>x1(1,c/k,g)),o.dRgbInv=o.dRgb.map(k=>1/k);const b=f.map((k,C)=>k*o.dRgb[C]),S=ey(b,o.fl);return o.aW=o.nbb*(2*S[0]+S[1]+.05*S[2]),o}const ny=ty(gI,64/Math.PI*.2,20,"average",!1);function oh(n,e){if(!(n.J!==void 0^n.Q!==void 0))throw new Error("Conversion requires one and only one: 'J' or 'Q'");if(!(n.C!==void 0^n.M!==void 0^n.s!==void 0))throw new Error("Conversion requires one and only one: 'C', 'M' or 's'");if(!(n.h!==void 0^n.H!==void 0))throw new Error("Conversion requires one and only one: 'h' or 'H'");if(n.J===0||n.Q===0)return[0,0,0];let t=0;n.h!==void 0?t=Jr(n.h)*Q1:t=kI(n.H)*Q1;const r=Math.cos(t),i=Math.sin(t);let o=0;n.J!==void 0?o=$n(n.J,1/2)*.1:n.Q!==void 0&&(o=.25*e.c*n.Q/((e.aW+4)*e.flRoot));let a=0;n.C!==void 0?a=n.C/o:n.M!==void 0?a=n.M/e.flRoot/o:n.s!==void 0&&(a=4e-4*n.s**2*(e.aW+4)/e.c);const c=$n(a*Math.pow(1.64-Math.pow(.29,e.n),-.73),10/9),f=.25*(Math.cos(t+2)+3.8),h=e.aW*$n(o,2/e.c/e.z),m=5e4/13*e.nc*e.ncb*f,p=h/e.nbb,g=23*(p+.305)*E1(c,23*m+c*(11*r+108*i)),b=g*r,S=g*i,k=SI(Be(bI,[p,b,S]).map(C=>C*1/1403),e.fl);return Be(yI,k.map((C,M)=>C*e.dRgbInv[M])).map(C=>C/100)}function ry(n,e){const t=n.map(F=>F*100),r=ey(Be(Z1,t).map((F,$)=>F*e.dRgb[$]),e.fl),i=r[0]+(-12*r[1]+r[2])/11,o=(r[0]+r[1]-2*r[2])/9,a=(Math.atan2(o,i)%sh+sh)%sh,c=.25*(Math.cos(a+2)+3.8),f=5e4/13*e.nc*e.ncb*E1(c*Math.sqrt(i**2+o**2),r[0]+r[1]+1.05*r[2]+.305),h=$n(f,.9)*Math.pow(1.64-Math.pow(.29,e.n),.73),m=e.nbb*(2*r[0]+r[1]+.05*r[2]),p=$n(m/e.aW,.5*e.c*e.z),g=100*$n(p,2),b=4/e.c*p*(e.aW+4)*e.flRoot,S=h*p,k=S*e.flRoot,C=Jr(a*wI),M=xI(C),P=50*$n(e.c*h/(e.aW+4),1/2);return{J:g,C:S,h:C,s:P,Q:b,M:k,H:M}}new re({id:"cam16-jmh",cssId:"--cam16-jmh",name:"CAM16-JMh",coords:{j:{refRange:[0,100],name:"J"},m:{refRange:[0,105],name:"Colorfulness"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:Un,fromBase(n){const e=ry(n,ny);return[e.J,e.M,e.h]},toBase(n){return oh({J:n[0],M:n[1],h:n[2]},ny)}});const EI=Wn.D65,_I=216/24389,iy=24389/27;function TI(n){return 116*(n>_I?Math.cbrt(n):(iy*n+16)/116)-16}function lh(n){return n>8?Math.pow((n+16)/116,3):n/iy}function CI(n,e){let[t,r,i]=n,o=[],a=0;if(i===0)return[0,0,0];let c=lh(i);i>0?a=.00379058511492914*i**2+.608983189401032*i+.9155088574762233:a=9514440756550361e-21*i**2+.08693057439788597*i-21.928975842194614;const f=2e-12,h=15;let m=0,p=1/0;for(;m<=h;){o=oh({J:a,C:r,h:t},e);const g=Math.abs(o[1]-c);if(g<p){if(g<=f)return o;p=g}a=a-(o[1]-c)*a/(2*o[1]),m+=1}return oh({J:a,C:r,h:t},e)}function MI(n,e){const t=TI(n[1]);if(t===0)return[0,0,0];const r=ry(n,ah);return[Jr(r.h),r.C,t]}const ah=ty(EI,200/Math.PI*lh(50),lh(50)*100,"average",!1),Ea=new re({id:"hct",name:"HCT",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},c:{refRange:[0,145],name:"Colorfulness"},t:{refRange:[0,100],name:"Tone"}},base:Un,fromBase(n){return MI(n)},toBase(n){return CI(n,ah)},formats:{color:{id:"--hct",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),AI=Math.PI/180,sy=[1,.007,.0228];function oy(n){n[1]<0&&(n=Ea.fromBase(Ea.toBase(n)));const e=Math.log(Math.max(1+sy[2]*n[1]*ah.flRoot,1))/sy[2],t=n[0]*AI,r=e*Math.cos(t),i=e*Math.sin(t);return[n[2],r,i]}function II(n,e){[n,e]=Ke([n,e]);let[t,r,i]=oy(Ea.from(n)),[o,a,c]=oy(Ea.from(e));return Math.sqrt((t-o)**2+(r-a)**2+(i-c)**2)}const ly={deltaE76:YA,deltaECMC:ZA,deltaE2000:L1,deltaEJz:oI,deltaEITP:mI,deltaEOK:nh,deltaEHCT:II};function OI(n){const e=n?Math.floor(Math.log10(Math.abs(n))):0;return Math.max(parseFloat(`1e${e-2}`),1e-6)}const ay={hct:{method:"hct.c",jnd:2,deltaEMethod:"hct",blackWhiteClamp:{}},"hct-tonal":{method:"hct.c",jnd:0,deltaEMethod:"hct",blackWhiteClamp:{channel:"hct.t",min:0,max:100}}};function Hs(n,{method:e=Fs.gamut_mapping,space:t=void 0,deltaEMethod:r="",jnd:i=2,blackWhiteClamp:o={}}={}){if(n=Ke(n),S1(arguments[1])?t=arguments[1]:t||(t=n.space),t=re.get(t),Ri(n,t,{epsilon:0}))return n;let a;if(e==="css")a=NI(n,{space:t});else{if(e!=="clip"&&!Ri(n,t)){Object.prototype.hasOwnProperty.call(ay,e)&&({method:e,jnd:i,deltaEMethod:r,blackWhiteClamp:o}=ay[e]);let c=L1;if(r!==""){for(let h in ly)if("deltae"+r.toLowerCase()===h.toLowerCase()){c=ly[h];break}}let f=Hs(Fe(n,t),{method:"clip",space:t});if(c(n,f)>i){if(Object.keys(o).length===3){let P=re.resolveCoord(o.channel),F=Vn(Fe(n,P.space),P.id);if(jf(F)&&(F=0),F>=o.max)return Fe({space:"xyz-d65",coords:Wn.D65},n.space);if(F<=o.min)return Fe({space:"xyz-d65",coords:[0,0,0]},n.space)}let h=re.resolveCoord(e),m=h.space,p=h.id,g=Fe(n,m);g.coords.forEach((P,F)=>{jf(P)&&(g.coords[F]=0)});let S=(h.range||h.refRange)[0],k=OI(i),C=S,M=Vn(g,p);for(;M-C>k;){let P=rh(g);P=Hs(P,{space:t,method:"clip"}),c(g,P)-i<k?C=Vn(g,p):M=Vn(g,p),eh(g,p,(C+M)/2)}a=Fe(g,t)}else a=f}else a=Fe(n,t);if(e==="clip"||!Ri(a,t,{epsilon:0})){let c=Object.values(t.coords).map(f=>f.range||[]);a.coords=a.coords.map((f,h)=>{let[m,p]=c[h];return m!==void 0&&(f=Math.max(m,f)),p!==void 0&&(f=Math.min(f,p)),f})}}return t!==n.space&&(a=Fe(a,n.space)),n.coords=a.coords,n}Hs.returns="color";const cy={WHITE:{space:wa,coords:[1,0,0]},BLACK:{space:wa,coords:[0,0,0]}};function NI(n,{space:e}={}){n=Ke(n),e||(e=n.space),e=re.get(e);const i=re.get("oklch");if(e.isUnbounded)return Fe(n,e);const o=Fe(n,i);let a=o.coords[0];if(a>=1){const S=Fe(cy.WHITE,e);return S.alpha=n.alpha,Fe(S,e)}if(a<=0){const S=Fe(cy.BLACK,e);return S.alpha=n.alpha,Fe(S,e)}if(Ri(o,e,{epsilon:0}))return Fe(o,e);function c(S){const k=Fe(S,e),C=Object.values(e.coords);return k.coords=k.coords.map((M,P)=>{if("range"in C[P]){const[F,$]=C[P].range;return DA(F,M,$)}return M}),k}let f=0,h=o.coords[1],m=!0,p=rh(o),g=c(p),b=nh(g,p);if(b<.02)return g;for(;h-f>1e-4;){const S=(f+h)/2;if(p.coords[1]=S,m&&Ri(p,e,{epsilon:0}))f=S;else if(g=c(p),b=nh(g,p),b<.02){if(.02-b<1e-4)break;m=!1,f=S}else h=S}return g}function Fe(n,e,{inGamut:t}={}){n=Ke(n),e=re.get(e);let r=e.from(n),i={space:e,coords:r,alpha:n.alpha};return t&&(i=Hs(i,t===!0?void 0:t)),i}Fe.returns="color";function RI(n,{precision:e=Fs.precision,format:t="default",inGamut:r=!0,...i}={}){var o;let a;n=Ke(n);let c=t;t=n.space.getFormat(t)??n.space.getFormat("default")??re.DEFAULT_FORMAT;let f=n.coords.slice();if(r||(r=t.toGamut),r&&!Ri(n)&&(f=Hs(rh(n),r===!0?void 0:r).coords),t.type==="custom")if(i.precision=e,t.serialize)a=t.serialize(f,n.alpha,i);else throw new TypeError(`format ${c} can only be used to parse colors, not for serialization`);else{let h=t.name||"color";t.serializeCoords?f=t.serializeCoords(f,e):e!==null&&(f=f.map(b=>qf(b,{precision:e})));let m=[...f];if(h==="color"){let b=t.id||((o=t.ids)==null?void 0:o[0])||n.space.id;m.unshift(b)}let p=n.alpha;e!==null&&(p=qf(p,{precision:e}));let g=n.alpha>=1||t.noAlpha?"":`${t.commas?",":" /"} ${p}`;a=`${h}(${m.join(t.commas?", ":" ")}${g})`}return a}const LI=[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],PI=[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]],DI=new M1({id:"srgb-linear",name:"Linear sRGB",white:"D65",toXYZ_M:LI,fromXYZ_M:PI}),uy={aliceblue:[240/255,248/255,1],antiquewhite:[250/255,235/255,215/255],aqua:[0,1,1],aquamarine:[127/255,1,212/255],azure:[240/255,1,1],beige:[245/255,245/255,220/255],bisque:[1,228/255,196/255],black:[0,0,0],blanchedalmond:[1,235/255,205/255],blue:[0,0,1],blueviolet:[138/255,43/255,226/255],brown:[165/255,42/255,42/255],burlywood:[222/255,184/255,135/255],cadetblue:[95/255,158/255,160/255],chartreuse:[127/255,1,0],chocolate:[210/255,105/255,30/255],coral:[1,127/255,80/255],cornflowerblue:[100/255,149/255,237/255],cornsilk:[1,248/255,220/255],crimson:[220/255,20/255,60/255],cyan:[0,1,1],darkblue:[0,0,139/255],darkcyan:[0,139/255,139/255],darkgoldenrod:[184/255,134/255,11/255],darkgray:[169/255,169/255,169/255],darkgreen:[0,100/255,0],darkgrey:[169/255,169/255,169/255],darkkhaki:[189/255,183/255,107/255],darkmagenta:[139/255,0,139/255],darkolivegreen:[85/255,107/255,47/255],darkorange:[1,140/255,0],darkorchid:[153/255,50/255,204/255],darkred:[139/255,0,0],darksalmon:[233/255,150/255,122/255],darkseagreen:[143/255,188/255,143/255],darkslateblue:[72/255,61/255,139/255],darkslategray:[47/255,79/255,79/255],darkslategrey:[47/255,79/255,79/255],darkturquoise:[0,206/255,209/255],darkviolet:[148/255,0,211/255],deeppink:[1,20/255,147/255],deepskyblue:[0,191/255,1],dimgray:[105/255,105/255,105/255],dimgrey:[105/255,105/255,105/255],dodgerblue:[30/255,144/255,1],firebrick:[178/255,34/255,34/255],floralwhite:[1,250/255,240/255],forestgreen:[34/255,139/255,34/255],fuchsia:[1,0,1],gainsboro:[220/255,220/255,220/255],ghostwhite:[248/255,248/255,1],gold:[1,215/255,0],goldenrod:[218/255,165/255,32/255],gray:[128/255,128/255,128/255],green:[0,128/255,0],greenyellow:[173/255,1,47/255],grey:[128/255,128/255,128/255],honeydew:[240/255,1,240/255],hotpink:[1,105/255,180/255],indianred:[205/255,92/255,92/255],indigo:[75/255,0,130/255],ivory:[1,1,240/255],khaki:[240/255,230/255,140/255],lavender:[230/255,230/255,250/255],lavenderblush:[1,240/255,245/255],lawngreen:[124/255,252/255,0],lemonchiffon:[1,250/255,205/255],lightblue:[173/255,216/255,230/255],lightcoral:[240/255,128/255,128/255],lightcyan:[224/255,1,1],lightgoldenrodyellow:[250/255,250/255,210/255],lightgray:[211/255,211/255,211/255],lightgreen:[144/255,238/255,144/255],lightgrey:[211/255,211/255,211/255],lightpink:[1,182/255,193/255],lightsalmon:[1,160/255,122/255],lightseagreen:[32/255,178/255,170/255],lightskyblue:[135/255,206/255,250/255],lightslategray:[119/255,136/255,153/255],lightslategrey:[119/255,136/255,153/255],lightsteelblue:[176/255,196/255,222/255],lightyellow:[1,1,224/255],lime:[0,1,0],limegreen:[50/255,205/255,50/255],linen:[250/255,240/255,230/255],magenta:[1,0,1],maroon:[128/255,0,0],mediumaquamarine:[102/255,205/255,170/255],mediumblue:[0,0,205/255],mediumorchid:[186/255,85/255,211/255],mediumpurple:[147/255,112/255,219/255],mediumseagreen:[60/255,179/255,113/255],mediumslateblue:[123/255,104/255,238/255],mediumspringgreen:[0,250/255,154/255],mediumturquoise:[72/255,209/255,204/255],mediumvioletred:[199/255,21/255,133/255],midnightblue:[25/255,25/255,112/255],mintcream:[245/255,1,250/255],mistyrose:[1,228/255,225/255],moccasin:[1,228/255,181/255],navajowhite:[1,222/255,173/255],navy:[0,0,128/255],oldlace:[253/255,245/255,230/255],olive:[128/255,128/255,0],olivedrab:[107/255,142/255,35/255],orange:[1,165/255,0],orangered:[1,69/255,0],orchid:[218/255,112/255,214/255],palegoldenrod:[238/255,232/255,170/255],palegreen:[152/255,251/255,152/255],paleturquoise:[175/255,238/255,238/255],palevioletred:[219/255,112/255,147/255],papayawhip:[1,239/255,213/255],peachpuff:[1,218/255,185/255],peru:[205/255,133/255,63/255],pink:[1,192/255,203/255],plum:[221/255,160/255,221/255],powderblue:[176/255,224/255,230/255],purple:[128/255,0,128/255],rebeccapurple:[102/255,51/255,153/255],red:[1,0,0],rosybrown:[188/255,143/255,143/255],royalblue:[65/255,105/255,225/255],saddlebrown:[139/255,69/255,19/255],salmon:[250/255,128/255,114/255],sandybrown:[244/255,164/255,96/255],seagreen:[46/255,139/255,87/255],seashell:[1,245/255,238/255],sienna:[160/255,82/255,45/255],silver:[192/255,192/255,192/255],skyblue:[135/255,206/255,235/255],slateblue:[106/255,90/255,205/255],slategray:[112/255,128/255,144/255],slategrey:[112/255,128/255,144/255],snow:[1,250/255,250/255],springgreen:[0,1,127/255],steelblue:[70/255,130/255,180/255],tan:[210/255,180/255,140/255],teal:[0,128/255,128/255],thistle:[216/255,191/255,216/255],tomato:[1,99/255,71/255],turquoise:[64/255,224/255,208/255],violet:[238/255,130/255,238/255],wheat:[245/255,222/255,179/255],white:[1,1,1],whitesmoke:[245/255,245/255,245/255],yellow:[1,1,0],yellowgreen:[154/255,205/255,50/255]};let fy=Array(3).fill("<percentage> | <number>[0, 255]"),hy=Array(3).fill("<number>[0, 255]");const dy=new M1({id:"srgb",name:"sRGB",base:DI,fromBase:n=>n.map(e=>{let t=e<0?-1:1,r=e*t;return r>.0031308?t*(1.055*r**(1/2.4)-.055):12.92*e}),toBase:n=>n.map(e=>{let t=e<0?-1:1,r=e*t;return r<=.04045?e/12.92:t*((r+.055)/1.055)**2.4}),formats:{rgb:{coords:fy},rgb_number:{name:"rgb",commas:!0,coords:hy,noAlpha:!0},color:{},rgba:{coords:fy,commas:!0,lastAlpha:!0},rgba_number:{name:"rgba",commas:!0,coords:hy},hex:{type:"custom",toGamut:!0,test:n=>/^#([a-f0-9]{3,4}){1,2}$/i.test(n),parse(n){n.length<=5&&(n=n.replace(/[a-f0-9]/gi,"$&$&"));let e=[];return n.replace(/[a-f0-9]{2}/gi,t=>{e.push(parseInt(t,16)/255)}),{spaceId:"srgb",coords:e.slice(0,3),alpha:e.slice(3)[0]}},serialize:(n,e,{collapse:t=!0}={})=>{e<1&&n.push(e),n=n.map(o=>Math.round(o*255));let r=t&&n.every(o=>o%17===0);return"#"+n.map(o=>r?(o/17).toString(16):o.toString(16).padStart(2,"0")).join("")}},keyword:{type:"custom",test:n=>/^[a-z]+$/i.test(n),parse(n){n=n.toLowerCase();let e={spaceId:"srgb",coords:null,alpha:1};if(n==="transparent"?(e.coords=uy.black,e.alpha=0):e.coords=uy[n],e.coords)return e}}}});function zI(n){return Vn(n,[Un,"y"])}const py=new re({id:"hsl",name:"HSL",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:dy,fromBase:n=>{let e=Math.max(...n),t=Math.min(...n),[r,i,o]=n,[a,c,f]=[NaN,0,(t+e)/2],h=e-t;if(h!==0){switch(c=f===0||f===1?0:(e-f)/Math.min(f,1-f),e){case r:a=(i-o)/h+(i<o?6:0);break;case i:a=(o-r)/h+2;break;case o:a=(r-i)/h+4}a=a*60}return c<0&&(a+=180,c=Math.abs(c)),a>=360&&(a-=360),[a,c*100,f*100]},toBase:n=>{let[e,t,r]=n;e=e%360,e<0&&(e+=360),t/=100,r/=100;function i(o){let a=(o+e/30)%12,c=t*Math.min(r,1-r);return r-c*Math.max(-1,Math.min(a-3,9-a,1))}return[i(0),i(8),i(4)]},formats:{hsl:{coords:["<number> | <angle>","<percentage>","<percentage>"]},hsla:{coords:["<number> | <angle>","<percentage>","<percentage>"],commas:!0,lastAlpha:!0}}}),BI=new re({id:"hsv",name:"HSV",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},v:{range:[0,100],name:"Value"}},base:py,fromBase(n){let[e,t,r]=n;t/=100,r/=100;let i=r+t*Math.min(r,1-r);return[e,i===0?0:200*(1-r/i),100*i]},toBase(n){let[e,t,r]=n;t/=100,r/=100;let i=r*(1-t/2);return[e,i===0||i===1?0:(r-i)/Math.min(i,1-i)*100,i*100]},formats:{color:{id:"--hsv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});class Nt{constructor(e){Hn(this,"data"),this.data=Fe(e,"srgb")}static fromTransparent(){return new Nt({spaceId:"srgb",coords:[1,1,1],alpha:0})}static fromBlack(){return new Nt({spaceId:"srgb",coords:[0,0,0],alpha:1})}static fromWhite(){return new Nt({spaceId:"srgb",coords:[1,1,1],alpha:1})}get r(){return Math.round(this.data.coords[0]*255)}get g(){return Math.round(this.data.coords[1]*255)}get b(){return Math.round(this.data.coords[2]*255)}get h(){return Vn(this.data,"hsv.h")}get s(){return Vn(this.data,"hsv.s")}get v(){return Vn(this.data,"hsv.v")}get alpha(){return this.data.alpha.valueOf()}get alphaPercent(){return Math.round(this.alpha*100)}get isTransparent(){return this.alpha===0}get isDark(){return zI(this.data)<.5}withAlpha(e){return new Nt({...this.data,alpha:e})}withRgb(e){const t=this.alpha===0?1:this.alpha;return new Nt({spaceId:"srgb",alpha:e.a??t,coords:[e.r?e.r/255:this.data.coords[0],e.g?e.g/255:this.data.coords[1],e.b?e.b/255:this.data.coords[2]]})}withHsv(e){const r=Qf(this.data,"hsv"),i=Math.max(e.s??r[1],1e-5),o=Math.max(e.v??r[2],1e-5),a=this.alpha===0?1:this.alpha;return new Nt({alpha:a,spaceId:"hsv",coords:[e.h??r[0],i,o]})}toString(){return this.alpha===1?this.toHexString():this.toRgbaString()}toHexString(){const e=RI(this.data,{format:"hex"}).toUpperCase();return e.length===4?`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`:e.slice(0,7)}toRgbaString(){return`rgba(${this.r}, ${this.g}, ${this.b}, ${this.alphaPercent}%)`}clone(){return new Nt(this.data)}}class FI{constructor(e){Hn(this,"_color"),Hn(this,"isEmpty",!1),this.update(e)}get color(){return this._color}setColor(e){this._color=e}setEmpty(e){this.isEmpty=e}toString(){return this.isEmpty?"":this.color.toString()}isEqual(e){return this.toString()===e}update({solidColor:e,isEmpty:t}){this.setColor(e),this.setEmpty(t)}}let my=999;function HI(){return my+=1,my}function $I(n){return n?n.startsWith("linear-gradient("):!1}function WI(){const n=Nt.fromTransparent();return{isEmpty:!0,isGradient:!1,solidColor:n,angle:0,transitions:[{color:n.clone(),offset:0},{color:n.clone(),offset:100}]}}re.register(dy),re.register(BI),re.register(py);function gy(n){if(!n)return Nt.fromTransparent();try{return new Nt(Fe(T1(n),"srgb"))}catch(e){return console.warn(e),Nt.fromBlack()}}function UI(n){const e={"to top":0,"to top right":45,"to right":90,"to bottom right":135,"to bottom":180,"to bottom left":225,"to left":270,"to top left":315};return e[n]?e[n]:n.includes("deg")?Number.parseInt(n.trim().replace("deg","")):0}function VI(n){return n.map(e=>{const[t,r]=e.trim().split(/\s+(?![^(]*\))/);return{color:gy(t),offset:Number.parseFloat(r.replace("%",""))}})}function KI(n){const e=n.indexOf("("),t=n.lastIndexOf(")"),[r,...i]=n.slice(e+1,t).split(/,(?![^(]*\))/),o=VI(i),a=UI(r);return{isEmpty:!1,isGradient:!0,solidColor:o[0].color,angle:a,transitions:o}}function GI(n){const e=gy(n),t=Nt.fromWhite();return{isEmpty:!1,isGradient:!1,solidColor:e,angle:0,transitions:[{color:t,offset:0},{color:e.withAlpha(1),offset:100}]}}function JI(n,e=!0){if(!n)return WI();const t=$I(n)?KI(n):GI(n);return t.isGradient&&!e?{...t,isGradient:!1}:t}class mh{constructor(e,t=0){Hn(this,"id"),this.color=e,this.offset=t,this.id=HI()}setOffset(e){this.offset=e}toString(){return`${this.color.toString()} ${this.offset}%`}clone(e){return new mh(this.color.clone(),e)}}class qI{constructor(e){Hn(this,"isEmpty",!1),Hn(this,"_angle",0),Hn(this,"_transitions",[]),this.update(e)}get transitions(){return this._transitions}get canAddTransition(){return this.transitions.length<5}get canRemoveTransition(){return this.transitions.length>2}get angle(){return this._angle}setAngle(e){this._angle=e}setEmpty(e){this.isEmpty=e}addTransition(e){this.transitions.push(e),this.sortTransitions()}removeTransition(e){this._transitions=this.transitions.filter(({id:t})=>t!==e.id)}sortTransitions(){this._transitions=this.transitions.sort((e,t)=>e.offset-t.offset)}toString(e){if(this.isEmpty)return"";const t=this.transitions.map(r=>r.toString());return`linear-gradient(${e??this.angle}deg, ${t.join(", ")})`}isEqual(e){return this.toString()===e}update(e){this._angle=e.angle,this._transitions=e.transitions.map(({color:t,offset:r})=>new mh(t,r)),this.setEmpty(e.isEmpty)}hasTransition(e){return this.transitions.some(t=>t.id===e.id)}}function jI(n){const e=JI(n);return(e.isGradient?new qI(e):new FI(e)).toString()}function yy(n){return jI(n)}function by(n,e){if(!n.includes("em"))return parseInt(n);const t=Li.getComputedStyle(e).fontSize,r=parseFloat(n)*parseFloat(t);return Math.round(r)}function YI(n,e){return(n.firstElementChild||n).style.fontSize||Li.getComputedStyle(e).fontSize}function XI(n,e,t){if(!n.includes("px"))return n;const r=YI(e,t),i=by(r,t);return i?(parseInt(n)/i).toFixed(2):null}const ZI={start:br.LEFT,end:br.RIGHT};function QI(n){const e=ZI[n]||n;return br.values.includes(e)?e:null}const vy=(n,e,t,r)=>({from:Math.max(r,n.pos),to:Math.min(r+t.nodeSize,e.pos)});function wy(n,e){return n.resolve(e).depth+1}function eO(n,e,t,r){const i=wy(n,r),o=e.from-i<=r,a=e.to+i>=t.nodeSize+r;return o&&a}const tO=(n,e)=>n.eq(e);function nO(n,e,t,r=tO){const i=n.resolve(e).path.slice().reverse();for(const o of i)if(typeof o!="number"){for(const a of o.marks)if(r(a,t))return!0}return!1}function rO(n,e){const t=typeof e=="string"?e:e.name;return n.find(r=>r.type.name===t)}var _a=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},$s={exports:{}};var iO=$s.exports,Sy;function sO(){return Sy||(Sy=1,function(n,e){(function(){var t,r="4.17.21",i=200,o="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",c="Invalid `variable` option passed into `_.template`",f="__lodash_hash_undefined__",h=500,m="__lodash_placeholder__",p=1,g=2,b=4,S=1,k=2,C=1,M=2,P=4,F=8,$=16,U=32,ce=64,fe=128,be=256,bt=512,Jn=30,sn="...",qn=800,Zr=16,on=1,wn=2,He=3,vt=1/0,jn=9007199254740991,Gs=17976931348623157e292,ln=NaN,wt=4294967295,Oa=wt-1,Na=wt>>>1,Ra=[["ary",fe],["bind",C],["bindKey",M],["curry",F],["curryRight",$],["flip",bt],["partial",U],["partialRight",ce],["rearg",be]],Jt="[object Arguments]",Js="[object Array]",Ay="[object AsyncFunction]",Fi="[object Boolean]",Hi="[object Date]",Iy="[object DOMException]",qs="[object Error]",js="[object Function]",bh="[object GeneratorFunction]",qt="[object Map]",$i="[object Number]",Oy="[object Null]",Sn="[object Object]",vh="[object Promise]",Ny="[object Proxy]",Wi="[object RegExp]",jt="[object Set]",Ui="[object String]",Ys="[object Symbol]",Ry="[object Undefined]",Vi="[object WeakMap]",Ly="[object WeakSet]",Ki="[object ArrayBuffer]",Qr="[object DataView]",La="[object Float32Array]",Pa="[object Float64Array]",Da="[object Int8Array]",za="[object Int16Array]",Ba="[object Int32Array]",Fa="[object Uint8Array]",Ha="[object Uint8ClampedArray]",$a="[object Uint16Array]",Wa="[object Uint32Array]",Py=/\b__p \+= '';/g,Dy=/\b(__p \+=) '' \+/g,zy=/(__e\(.*?\)|\b__t\)) \+\n'';/g,wh=/&(?:amp|lt|gt|quot|#39);/g,Sh=/[&<>"']/g,By=RegExp(wh.source),Fy=RegExp(Sh.source),Hy=/<%-([\s\S]+?)%>/g,$y=/<%([\s\S]+?)%>/g,xh=/<%=([\s\S]+?)%>/g,Wy=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Uy=/^\w*$/,Vy=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ua=/[\\^$.*+?()[\]{}|]/g,Ky=RegExp(Ua.source),Va=/^\s+/,Gy=/\s/,Jy=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,qy=/\{\n\/\* \[wrapped with (.+)\] \*/,jy=/,? & /,Yy=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Xy=/[()=,{}\[\]\/\s]/,Zy=/\\(\\)?/g,Qy=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,kh=/\w*$/,eb=/^[-+]0x[0-9a-f]+$/i,tb=/^0b[01]+$/i,nb=/^\[object .+?Constructor\]$/,rb=/^0o[0-7]+$/i,ib=/^(?:0|[1-9]\d*)$/,sb=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Xs=/($^)/,ob=/['\n\r\u2028\u2029\\]/g,Zs="\\ud800-\\udfff",lb="\\u0300-\\u036f",ab="\\ufe20-\\ufe2f",cb="\\u20d0-\\u20ff",Eh=lb+ab+cb,_h="\\u2700-\\u27bf",Th="a-z\\xdf-\\xf6\\xf8-\\xff",ub="\\xac\\xb1\\xd7\\xf7",fb="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",hb="\\u2000-\\u206f",db=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ch="A-Z\\xc0-\\xd6\\xd8-\\xde",Mh="\\ufe0e\\ufe0f",Ah=ub+fb+hb+db,Ka="['\u2019]",pb="["+Zs+"]",Ih="["+Ah+"]",Qs="["+Eh+"]",Oh="\\d+",mb="["+_h+"]",Nh="["+Th+"]",Rh="[^"+Zs+Ah+Oh+_h+Th+Ch+"]",Ga="\\ud83c[\\udffb-\\udfff]",gb="(?:"+Qs+"|"+Ga+")",Lh="[^"+Zs+"]",Ja="(?:\\ud83c[\\udde6-\\uddff]){2}",qa="[\\ud800-\\udbff][\\udc00-\\udfff]",ei="["+Ch+"]",Ph="\\u200d",Dh="(?:"+Nh+"|"+Rh+")",yb="(?:"+ei+"|"+Rh+")",zh="(?:"+Ka+"(?:d|ll|m|re|s|t|ve))?",Bh="(?:"+Ka+"(?:D|LL|M|RE|S|T|VE))?",Fh=gb+"?",Hh="["+Mh+"]?",bb="(?:"+Ph+"(?:"+[Lh,Ja,qa].join("|")+")"+Hh+Fh+")*",vb="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",wb="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",$h=Hh+Fh+bb,Sb="(?:"+[mb,Ja,qa].join("|")+")"+$h,xb="(?:"+[Lh+Qs+"?",Qs,Ja,qa,pb].join("|")+")",kb=RegExp(Ka,"g"),Eb=RegExp(Qs,"g"),ja=RegExp(Ga+"(?="+Ga+")|"+xb+$h,"g"),_b=RegExp([ei+"?"+Nh+"+"+zh+"(?="+[Ih,ei,"$"].join("|")+")",yb+"+"+Bh+"(?="+[Ih,ei+Dh,"$"].join("|")+")",ei+"?"+Dh+"+"+zh,ei+"+"+Bh,wb,vb,Oh,Sb].join("|"),"g"),Tb=RegExp("["+Ph+Zs+Eh+Mh+"]"),Cb=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Mb=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Ab=-1,xe={};xe[La]=xe[Pa]=xe[Da]=xe[za]=xe[Ba]=xe[Fa]=xe[Ha]=xe[$a]=xe[Wa]=!0,xe[Jt]=xe[Js]=xe[Ki]=xe[Fi]=xe[Qr]=xe[Hi]=xe[qs]=xe[js]=xe[qt]=xe[$i]=xe[Sn]=xe[Wi]=xe[jt]=xe[Ui]=xe[Vi]=!1;var Se={};Se[Jt]=Se[Js]=Se[Ki]=Se[Qr]=Se[Fi]=Se[Hi]=Se[La]=Se[Pa]=Se[Da]=Se[za]=Se[Ba]=Se[qt]=Se[$i]=Se[Sn]=Se[Wi]=Se[jt]=Se[Ui]=Se[Ys]=Se[Fa]=Se[Ha]=Se[$a]=Se[Wa]=!0,Se[qs]=Se[js]=Se[Vi]=!1;var Ib={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Ob={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Nb={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Rb={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Lb=parseFloat,Pb=parseInt,Wh=typeof _a=="object"&&_a&&_a.Object===Object&&_a,Db=typeof self=="object"&&self&&self.Object===Object&&self,je=Wh||Db||Function("return this")(),Ya=e&&!e.nodeType&&e,_r=Ya&&!0&&n&&!n.nodeType&&n,Uh=_r&&_r.exports===Ya,Xa=Uh&&Wh.process,Rt=function(){try{var _=_r&&_r.require&&_r.require("util").types;return _||Xa&&Xa.binding&&Xa.binding("util")}catch{}}(),Vh=Rt&&Rt.isArrayBuffer,Kh=Rt&&Rt.isDate,Gh=Rt&&Rt.isMap,Jh=Rt&&Rt.isRegExp,qh=Rt&&Rt.isSet,jh=Rt&&Rt.isTypedArray;function St(_,I,A){switch(A.length){case 0:return _.call(I);case 1:return _.call(I,A[0]);case 2:return _.call(I,A[0],A[1]);case 3:return _.call(I,A[0],A[1],A[2])}return _.apply(I,A)}function zb(_,I,A,V){for(var X=-1,pe=_==null?0:_.length;++X<pe;){var De=_[X];I(V,De,A(De),_)}return V}function Lt(_,I){for(var A=-1,V=_==null?0:_.length;++A<V&&I(_[A],A,_)!==!1;);return _}function Bb(_,I){for(var A=_==null?0:_.length;A--&&I(_[A],A,_)!==!1;);return _}function Yh(_,I){for(var A=-1,V=_==null?0:_.length;++A<V;)if(!I(_[A],A,_))return!1;return!0}function Yn(_,I){for(var A=-1,V=_==null?0:_.length,X=0,pe=[];++A<V;){var De=_[A];I(De,A,_)&&(pe[X++]=De)}return pe}function eo(_,I){var A=_==null?0:_.length;return!!A&&ti(_,I,0)>-1}function Za(_,I,A){for(var V=-1,X=_==null?0:_.length;++V<X;)if(A(I,_[V]))return!0;return!1}function Ee(_,I){for(var A=-1,V=_==null?0:_.length,X=Array(V);++A<V;)X[A]=I(_[A],A,_);return X}function Xn(_,I){for(var A=-1,V=I.length,X=_.length;++A<V;)_[X+A]=I[A];return _}function Qa(_,I,A,V){var X=-1,pe=_==null?0:_.length;for(V&&pe&&(A=_[++X]);++X<pe;)A=I(A,_[X],X,_);return A}function Fb(_,I,A,V){var X=_==null?0:_.length;for(V&&X&&(A=_[--X]);X--;)A=I(A,_[X],X,_);return A}function ec(_,I){for(var A=-1,V=_==null?0:_.length;++A<V;)if(I(_[A],A,_))return!0;return!1}var Hb=tc("length");function $b(_){return _.split("")}function Wb(_){return _.match(Yy)||[]}function Xh(_,I,A){var V;return A(_,function(X,pe,De){if(I(X,pe,De))return V=pe,!1}),V}function to(_,I,A,V){for(var X=_.length,pe=A+(V?1:-1);V?pe--:++pe<X;)if(I(_[pe],pe,_))return pe;return-1}function ti(_,I,A){return I===I?e2(_,I,A):to(_,Zh,A)}function Ub(_,I,A,V){for(var X=A-1,pe=_.length;++X<pe;)if(V(_[X],I))return X;return-1}function Zh(_){return _!==_}function Qh(_,I){var A=_==null?0:_.length;return A?rc(_,I)/A:ln}function tc(_){return function(I){return I==null?t:I[_]}}function nc(_){return function(I){return _==null?t:_[I]}}function ed(_,I,A,V,X){return X(_,function(pe,De,we){A=V?(V=!1,pe):I(A,pe,De,we)}),A}function Vb(_,I){var A=_.length;for(_.sort(I);A--;)_[A]=_[A].value;return _}function rc(_,I){for(var A,V=-1,X=_.length;++V<X;){var pe=I(_[V]);pe!==t&&(A=A===t?pe:A+pe)}return A}function ic(_,I){for(var A=-1,V=Array(_);++A<_;)V[A]=I(A);return V}function Kb(_,I){return Ee(I,function(A){return[A,_[A]]})}function td(_){return _&&_.slice(0,sd(_)+1).replace(Va,"")}function xt(_){return function(I){return _(I)}}function sc(_,I){return Ee(I,function(A){return _[A]})}function Gi(_,I){return _.has(I)}function nd(_,I){for(var A=-1,V=_.length;++A<V&&ti(I,_[A],0)>-1;);return A}function rd(_,I){for(var A=_.length;A--&&ti(I,_[A],0)>-1;);return A}function Gb(_,I){for(var A=_.length,V=0;A--;)_[A]===I&&++V;return V}var Jb=nc(Ib),qb=nc(Ob);function jb(_){return"\\"+Rb[_]}function Yb(_,I){return _==null?t:_[I]}function ni(_){return Tb.test(_)}function Xb(_){return Cb.test(_)}function Zb(_){for(var I,A=[];!(I=_.next()).done;)A.push(I.value);return A}function oc(_){var I=-1,A=Array(_.size);return _.forEach(function(V,X){A[++I]=[X,V]}),A}function id(_,I){return function(A){return _(I(A))}}function Zn(_,I){for(var A=-1,V=_.length,X=0,pe=[];++A<V;){var De=_[A];(De===I||De===m)&&(_[A]=m,pe[X++]=A)}return pe}function no(_){var I=-1,A=Array(_.size);return _.forEach(function(V){A[++I]=V}),A}function Qb(_){var I=-1,A=Array(_.size);return _.forEach(function(V){A[++I]=[V,V]}),A}function e2(_,I,A){for(var V=A-1,X=_.length;++V<X;)if(_[V]===I)return V;return-1}function t2(_,I,A){for(var V=A+1;V--;)if(_[V]===I)return V;return V}function ri(_){return ni(_)?r2(_):Hb(_)}function Yt(_){return ni(_)?i2(_):$b(_)}function sd(_){for(var I=_.length;I--&&Gy.test(_.charAt(I)););return I}var n2=nc(Nb);function r2(_){for(var I=ja.lastIndex=0;ja.test(_);)++I;return I}function i2(_){return _.match(ja)||[]}function s2(_){return _.match(_b)||[]}var o2=function _(I){I=I==null?je:ii.defaults(je.Object(),I,ii.pick(je,Mb));var A=I.Array,V=I.Date,X=I.Error,pe=I.Function,De=I.Math,we=I.Object,lc=I.RegExp,l2=I.String,Pt=I.TypeError,ro=A.prototype,a2=pe.prototype,si=we.prototype,io=I["__core-js_shared__"],so=a2.toString,ve=si.hasOwnProperty,c2=0,od=function(){var s=/[^.]+$/.exec(io&&io.keys&&io.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}(),oo=si.toString,u2=so.call(we),f2=je._,h2=lc("^"+so.call(ve).replace(Ua,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),lo=Uh?I.Buffer:t,Qn=I.Symbol,ao=I.Uint8Array,ld=lo?lo.allocUnsafe:t,co=id(we.getPrototypeOf,we),ad=we.create,cd=si.propertyIsEnumerable,uo=ro.splice,ud=Qn?Qn.isConcatSpreadable:t,Ji=Qn?Qn.iterator:t,Tr=Qn?Qn.toStringTag:t,fo=function(){try{var s=Or(we,"defineProperty");return s({},"",{}),s}catch{}}(),d2=I.clearTimeout!==je.clearTimeout&&I.clearTimeout,p2=V&&V.now!==je.Date.now&&V.now,m2=I.setTimeout!==je.setTimeout&&I.setTimeout,ho=De.ceil,po=De.floor,ac=we.getOwnPropertySymbols,g2=lo?lo.isBuffer:t,fd=I.isFinite,y2=ro.join,b2=id(we.keys,we),ze=De.max,et=De.min,v2=V.now,w2=I.parseInt,hd=De.random,S2=ro.reverse,cc=Or(I,"DataView"),qi=Or(I,"Map"),uc=Or(I,"Promise"),oi=Or(I,"Set"),ji=Or(I,"WeakMap"),Yi=Or(we,"create"),mo=ji&&new ji,li={},x2=Nr(cc),k2=Nr(qi),E2=Nr(uc),_2=Nr(oi),T2=Nr(ji),go=Qn?Qn.prototype:t,Xi=go?go.valueOf:t,dd=go?go.toString:t;function v(s){if(Me(s)&&!Z(s)&&!(s instanceof se)){if(s instanceof Dt)return s;if(ve.call(s,"__wrapped__"))return pp(s)}return new Dt(s)}var ai=function(){function s(){}return function(l){if(!Te(l))return{};if(ad)return ad(l);s.prototype=l;var u=new s;return s.prototype=t,u}}();function yo(){}function Dt(s,l){this.__wrapped__=s,this.__actions__=[],this.__chain__=!!l,this.__index__=0,this.__values__=t}v.templateSettings={escape:Hy,evaluate:$y,interpolate:xh,variable:"",imports:{_:v}},v.prototype=yo.prototype,v.prototype.constructor=v,Dt.prototype=ai(yo.prototype),Dt.prototype.constructor=Dt;function se(s){this.__wrapped__=s,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=wt,this.__views__=[]}function C2(){var s=new se(this.__wrapped__);return s.__actions__=ut(this.__actions__),s.__dir__=this.__dir__,s.__filtered__=this.__filtered__,s.__iteratees__=ut(this.__iteratees__),s.__takeCount__=this.__takeCount__,s.__views__=ut(this.__views__),s}function M2(){if(this.__filtered__){var s=new se(this);s.__dir__=-1,s.__filtered__=!0}else s=this.clone(),s.__dir__*=-1;return s}function A2(){var s=this.__wrapped__.value(),l=this.__dir__,u=Z(s),d=l<0,y=u?s.length:0,w=$v(0,y,this.__views__),x=w.start,E=w.end,T=E-x,O=d?E:x-1,N=this.__iteratees__,R=N.length,H=0,G=et(T,this.__takeCount__);if(!u||!d&&y==T&&G==T)return zd(s,this.__actions__);var q=[];e:for(;T--&&H<G;){O+=l;for(var ee=-1,j=s[O];++ee<R;){var ie=N[ee],ue=ie.iteratee,_t=ie.type,it=ue(j);if(_t==wn)j=it;else if(!it){if(_t==on)continue e;break e}}q[H++]=j}return q}se.prototype=ai(yo.prototype),se.prototype.constructor=se;function Cr(s){var l=-1,u=s==null?0:s.length;for(this.clear();++l<u;){var d=s[l];this.set(d[0],d[1])}}function I2(){this.__data__=Yi?Yi(null):{},this.size=0}function O2(s){var l=this.has(s)&&delete this.__data__[s];return this.size-=l?1:0,l}function N2(s){var l=this.__data__;if(Yi){var u=l[s];return u===f?t:u}return ve.call(l,s)?l[s]:t}function R2(s){var l=this.__data__;return Yi?l[s]!==t:ve.call(l,s)}function L2(s,l){var u=this.__data__;return this.size+=this.has(s)?0:1,u[s]=Yi&&l===t?f:l,this}Cr.prototype.clear=I2,Cr.prototype.delete=O2,Cr.prototype.get=N2,Cr.prototype.has=R2,Cr.prototype.set=L2;function xn(s){var l=-1,u=s==null?0:s.length;for(this.clear();++l<u;){var d=s[l];this.set(d[0],d[1])}}function P2(){this.__data__=[],this.size=0}function D2(s){var l=this.__data__,u=bo(l,s);if(u<0)return!1;var d=l.length-1;return u==d?l.pop():uo.call(l,u,1),--this.size,!0}function z2(s){var l=this.__data__,u=bo(l,s);return u<0?t:l[u][1]}function B2(s){return bo(this.__data__,s)>-1}function F2(s,l){var u=this.__data__,d=bo(u,s);return d<0?(++this.size,u.push([s,l])):u[d][1]=l,this}xn.prototype.clear=P2,xn.prototype.delete=D2,xn.prototype.get=z2,xn.prototype.has=B2,xn.prototype.set=F2;function kn(s){var l=-1,u=s==null?0:s.length;for(this.clear();++l<u;){var d=s[l];this.set(d[0],d[1])}}function H2(){this.size=0,this.__data__={hash:new Cr,map:new(qi||xn),string:new Cr}}function $2(s){var l=Io(this,s).delete(s);return this.size-=l?1:0,l}function W2(s){return Io(this,s).get(s)}function U2(s){return Io(this,s).has(s)}function V2(s,l){var u=Io(this,s),d=u.size;return u.set(s,l),this.size+=u.size==d?0:1,this}kn.prototype.clear=H2,kn.prototype.delete=$2,kn.prototype.get=W2,kn.prototype.has=U2,kn.prototype.set=V2;function Mr(s){var l=-1,u=s==null?0:s.length;for(this.__data__=new kn;++l<u;)this.add(s[l])}function K2(s){return this.__data__.set(s,f),this}function G2(s){return this.__data__.has(s)}Mr.prototype.add=Mr.prototype.push=K2,Mr.prototype.has=G2;function Xt(s){var l=this.__data__=new xn(s);this.size=l.size}function J2(){this.__data__=new xn,this.size=0}function q2(s){var l=this.__data__,u=l.delete(s);return this.size=l.size,u}function j2(s){return this.__data__.get(s)}function Y2(s){return this.__data__.has(s)}function X2(s,l){var u=this.__data__;if(u instanceof xn){var d=u.__data__;if(!qi||d.length<i-1)return d.push([s,l]),this.size=++u.size,this;u=this.__data__=new kn(d)}return u.set(s,l),this.size=u.size,this}Xt.prototype.clear=J2,Xt.prototype.delete=q2,Xt.prototype.get=j2,Xt.prototype.has=Y2,Xt.prototype.set=X2;function pd(s,l){var u=Z(s),d=!u&&Rr(s),y=!u&&!d&&ir(s),w=!u&&!d&&!y&&hi(s),x=u||d||y||w,E=x?ic(s.length,l2):[],T=E.length;for(var O in s)(l||ve.call(s,O))&&!(x&&(O=="length"||y&&(O=="offset"||O=="parent")||w&&(O=="buffer"||O=="byteLength"||O=="byteOffset")||Cn(O,T)))&&E.push(O);return E}function md(s){var l=s.length;return l?s[Sc(0,l-1)]:t}function Z2(s,l){return Oo(ut(s),Ar(l,0,s.length))}function Q2(s){return Oo(ut(s))}function fc(s,l,u){(u!==t&&!Zt(s[l],u)||u===t&&!(l in s))&&En(s,l,u)}function Zi(s,l,u){var d=s[l];(!(ve.call(s,l)&&Zt(d,u))||u===t&&!(l in s))&&En(s,l,u)}function bo(s,l){for(var u=s.length;u--;)if(Zt(s[u][0],l))return u;return-1}function ev(s,l,u,d){return er(s,function(y,w,x){l(d,y,u(y),x)}),d}function gd(s,l){return s&&cn(l,$e(l),s)}function tv(s,l){return s&&cn(l,ht(l),s)}function En(s,l,u){l=="__proto__"&&fo?fo(s,l,{configurable:!0,enumerable:!0,value:u,writable:!0}):s[l]=u}function hc(s,l){for(var u=-1,d=l.length,y=A(d),w=s==null;++u<d;)y[u]=w?t:Gc(s,l[u]);return y}function Ar(s,l,u){return s===s&&(u!==t&&(s=s<=u?s:u),l!==t&&(s=s>=l?s:l)),s}function zt(s,l,u,d,y,w){var x,E=l&p,T=l&g,O=l&b;if(u&&(x=y?u(s,d,y,w):u(s)),x!==t)return x;if(!Te(s))return s;var N=Z(s);if(N){if(x=Uv(s),!E)return ut(s,x)}else{var R=tt(s),H=R==js||R==bh;if(ir(s))return Hd(s,E);if(R==Sn||R==Jt||H&&!y){if(x=T||H?{}:sp(s),!E)return T?Nv(s,tv(x,s)):Ov(s,gd(x,s))}else{if(!Se[R])return y?s:{};x=Vv(s,R,E)}}w||(w=new Xt);var G=w.get(s);if(G)return G;w.set(s,x),Lp(s)?s.forEach(function(j){x.add(zt(j,l,u,j,s,w))}):Np(s)&&s.forEach(function(j,ie){x.set(ie,zt(j,l,u,ie,s,w))});var q=O?T?Nc:Oc:T?ht:$e,ee=N?t:q(s);return Lt(ee||s,function(j,ie){ee&&(ie=j,j=s[ie]),Zi(x,ie,zt(j,l,u,ie,s,w))}),x}function nv(s){var l=$e(s);return function(u){return yd(u,s,l)}}function yd(s,l,u){var d=u.length;if(s==null)return!d;for(s=we(s);d--;){var y=u[d],w=l[y],x=s[y];if(x===t&&!(y in s)||!w(x))return!1}return!0}function bd(s,l,u){if(typeof s!="function")throw new Pt(a);return ss(function(){s.apply(t,u)},l)}function Qi(s,l,u,d){var y=-1,w=eo,x=!0,E=s.length,T=[],O=l.length;if(!E)return T;u&&(l=Ee(l,xt(u))),d?(w=Za,x=!1):l.length>=i&&(w=Gi,x=!1,l=new Mr(l));e:for(;++y<E;){var N=s[y],R=u==null?N:u(N);if(N=d||N!==0?N:0,x&&R===R){for(var H=O;H--;)if(l[H]===R)continue e;T.push(N)}else w(l,R,d)||T.push(N)}return T}var er=Kd(an),vd=Kd(pc,!0);function rv(s,l){var u=!0;return er(s,function(d,y,w){return u=!!l(d,y,w),u}),u}function vo(s,l,u){for(var d=-1,y=s.length;++d<y;){var w=s[d],x=l(w);if(x!=null&&(E===t?x===x&&!Et(x):u(x,E)))var E=x,T=w}return T}function iv(s,l,u,d){var y=s.length;for(u=Q(u),u<0&&(u=-u>y?0:y+u),d=d===t||d>y?y:Q(d),d<0&&(d+=y),d=u>d?0:Dp(d);u<d;)s[u++]=l;return s}function wd(s,l){var u=[];return er(s,function(d,y,w){l(d,y,w)&&u.push(d)}),u}function Ye(s,l,u,d,y){var w=-1,x=s.length;for(u||(u=Gv),y||(y=[]);++w<x;){var E=s[w];l>0&&u(E)?l>1?Ye(E,l-1,u,d,y):Xn(y,E):d||(y[y.length]=E)}return y}var dc=Gd(),Sd=Gd(!0);function an(s,l){return s&&dc(s,l,$e)}function pc(s,l){return s&&Sd(s,l,$e)}function wo(s,l){return Yn(l,function(u){return Mn(s[u])})}function Ir(s,l){l=nr(l,s);for(var u=0,d=l.length;s!=null&&u<d;)s=s[un(l[u++])];return u&&u==d?s:t}function xd(s,l,u){var d=l(s);return Z(s)?d:Xn(d,u(s))}function nt(s){return s==null?s===t?Ry:Oy:Tr&&Tr in we(s)?Hv(s):Qv(s)}function mc(s,l){return s>l}function sv(s,l){return s!=null&&ve.call(s,l)}function ov(s,l){return s!=null&&l in we(s)}function lv(s,l,u){return s>=et(l,u)&&s<ze(l,u)}function gc(s,l,u){for(var d=u?Za:eo,y=s[0].length,w=s.length,x=w,E=A(w),T=1/0,O=[];x--;){var N=s[x];x&&l&&(N=Ee(N,xt(l))),T=et(N.length,T),E[x]=!u&&(l||y>=120&&N.length>=120)?new Mr(x&&N):t}N=s[0];var R=-1,H=E[0];e:for(;++R<y&&O.length<T;){var G=N[R],q=l?l(G):G;if(G=u||G!==0?G:0,!(H?Gi(H,q):d(O,q,u))){for(x=w;--x;){var ee=E[x];if(!(ee?Gi(ee,q):d(s[x],q,u)))continue e}H&&H.push(q),O.push(G)}}return O}function av(s,l,u,d){return an(s,function(y,w,x){l(d,u(y),w,x)}),d}function es(s,l,u){l=nr(l,s),s=cp(s,l);var d=s==null?s:s[un(Ft(l))];return d==null?t:St(d,s,u)}function kd(s){return Me(s)&&nt(s)==Jt}function cv(s){return Me(s)&&nt(s)==Ki}function uv(s){return Me(s)&&nt(s)==Hi}function ts(s,l,u,d,y){return s===l?!0:s==null||l==null||!Me(s)&&!Me(l)?s!==s&&l!==l:fv(s,l,u,d,ts,y)}function fv(s,l,u,d,y,w){var x=Z(s),E=Z(l),T=x?Js:tt(s),O=E?Js:tt(l);T=T==Jt?Sn:T,O=O==Jt?Sn:O;var N=T==Sn,R=O==Sn,H=T==O;if(H&&ir(s)){if(!ir(l))return!1;x=!0,N=!1}if(H&&!N)return w||(w=new Xt),x||hi(s)?np(s,l,u,d,y,w):Bv(s,l,T,u,d,y,w);if(!(u&S)){var G=N&&ve.call(s,"__wrapped__"),q=R&&ve.call(l,"__wrapped__");if(G||q){var ee=G?s.value():s,j=q?l.value():l;return w||(w=new Xt),y(ee,j,u,d,w)}}return H?(w||(w=new Xt),Fv(s,l,u,d,y,w)):!1}function hv(s){return Me(s)&&tt(s)==qt}function yc(s,l,u,d){var y=u.length,w=y,x=!d;if(s==null)return!w;for(s=we(s);y--;){var E=u[y];if(x&&E[2]?E[1]!==s[E[0]]:!(E[0]in s))return!1}for(;++y<w;){E=u[y];var T=E[0],O=s[T],N=E[1];if(x&&E[2]){if(O===t&&!(T in s))return!1}else{var R=new Xt;if(d)var H=d(O,N,T,s,l,R);if(!(H===t?ts(N,O,S|k,d,R):H))return!1}}return!0}function Ed(s){if(!Te(s)||qv(s))return!1;var l=Mn(s)?h2:nb;return l.test(Nr(s))}function dv(s){return Me(s)&&nt(s)==Wi}function pv(s){return Me(s)&&tt(s)==jt}function mv(s){return Me(s)&&zo(s.length)&&!!xe[nt(s)]}function _d(s){return typeof s=="function"?s:s==null?dt:typeof s=="object"?Z(s)?Md(s[0],s[1]):Cd(s):Jp(s)}function bc(s){if(!is(s))return b2(s);var l=[];for(var u in we(s))ve.call(s,u)&&u!="constructor"&&l.push(u);return l}function gv(s){if(!Te(s))return Zv(s);var l=is(s),u=[];for(var d in s)d=="constructor"&&(l||!ve.call(s,d))||u.push(d);return u}function vc(s,l){return s<l}function Td(s,l){var u=-1,d=ft(s)?A(s.length):[];return er(s,function(y,w,x){d[++u]=l(y,w,x)}),d}function Cd(s){var l=Lc(s);return l.length==1&&l[0][2]?lp(l[0][0],l[0][1]):function(u){return u===s||yc(u,s,l)}}function Md(s,l){return Dc(s)&&op(l)?lp(un(s),l):function(u){var d=Gc(u,s);return d===t&&d===l?Jc(u,s):ts(l,d,S|k)}}function So(s,l,u,d,y){s!==l&&dc(l,function(w,x){if(y||(y=new Xt),Te(w))yv(s,l,x,u,So,d,y);else{var E=d?d(Bc(s,x),w,x+"",s,l,y):t;E===t&&(E=w),fc(s,x,E)}},ht)}function yv(s,l,u,d,y,w,x){var E=Bc(s,u),T=Bc(l,u),O=x.get(T);if(O){fc(s,u,O);return}var N=w?w(E,T,u+"",s,l,x):t,R=N===t;if(R){var H=Z(T),G=!H&&ir(T),q=!H&&!G&&hi(T);N=T,H||G||q?Z(E)?N=E:Oe(E)?N=ut(E):G?(R=!1,N=Hd(T,!0)):q?(R=!1,N=$d(T,!0)):N=[]:ls(T)||Rr(T)?(N=E,Rr(E)?N=zp(E):(!Te(E)||Mn(E))&&(N=sp(T))):R=!1}R&&(x.set(T,N),y(N,T,d,w,x),x.delete(T)),fc(s,u,N)}function Ad(s,l){var u=s.length;if(u)return l+=l<0?u:0,Cn(l,u)?s[l]:t}function Id(s,l,u){l.length?l=Ee(l,function(w){return Z(w)?function(x){return Ir(x,w.length===1?w[0]:w)}:w}):l=[dt];var d=-1;l=Ee(l,xt(J()));var y=Td(s,function(w,x,E){var T=Ee(l,function(O){return O(w)});return{criteria:T,index:++d,value:w}});return Vb(y,function(w,x){return Iv(w,x,u)})}function bv(s,l){return Od(s,l,function(u,d){return Jc(s,d)})}function Od(s,l,u){for(var d=-1,y=l.length,w={};++d<y;){var x=l[d],E=Ir(s,x);u(E,x)&&ns(w,nr(x,s),E)}return w}function vv(s){return function(l){return Ir(l,s)}}function wc(s,l,u,d){var y=d?Ub:ti,w=-1,x=l.length,E=s;for(s===l&&(l=ut(l)),u&&(E=Ee(s,xt(u)));++w<x;)for(var T=0,O=l[w],N=u?u(O):O;(T=y(E,N,T,d))>-1;)E!==s&&uo.call(E,T,1),uo.call(s,T,1);return s}function Nd(s,l){for(var u=s?l.length:0,d=u-1;u--;){var y=l[u];if(u==d||y!==w){var w=y;Cn(y)?uo.call(s,y,1):Ec(s,y)}}return s}function Sc(s,l){return s+po(hd()*(l-s+1))}function wv(s,l,u,d){for(var y=-1,w=ze(ho((l-s)/(u||1)),0),x=A(w);w--;)x[d?w:++y]=s,s+=u;return x}function xc(s,l){var u="";if(!s||l<1||l>jn)return u;do l%2&&(u+=s),l=po(l/2),l&&(s+=s);while(l);return u}function ne(s,l){return Fc(ap(s,l,dt),s+"")}function Sv(s){return md(di(s))}function xv(s,l){var u=di(s);return Oo(u,Ar(l,0,u.length))}function ns(s,l,u,d){if(!Te(s))return s;l=nr(l,s);for(var y=-1,w=l.length,x=w-1,E=s;E!=null&&++y<w;){var T=un(l[y]),O=u;if(T==="__proto__"||T==="constructor"||T==="prototype")return s;if(y!=x){var N=E[T];O=d?d(N,T,E):t,O===t&&(O=Te(N)?N:Cn(l[y+1])?[]:{})}Zi(E,T,O),E=E[T]}return s}var Rd=mo?function(s,l){return mo.set(s,l),s}:dt,kv=fo?function(s,l){return fo(s,"toString",{configurable:!0,enumerable:!1,value:jc(l),writable:!0})}:dt;function Ev(s){return Oo(di(s))}function Bt(s,l,u){var d=-1,y=s.length;l<0&&(l=-l>y?0:y+l),u=u>y?y:u,u<0&&(u+=y),y=l>u?0:u-l>>>0,l>>>=0;for(var w=A(y);++d<y;)w[d]=s[d+l];return w}function _v(s,l){var u;return er(s,function(d,y,w){return u=l(d,y,w),!u}),!!u}function xo(s,l,u){var d=0,y=s==null?d:s.length;if(typeof l=="number"&&l===l&&y<=Na){for(;d<y;){var w=d+y>>>1,x=s[w];x!==null&&!Et(x)&&(u?x<=l:x<l)?d=w+1:y=w}return y}return kc(s,l,dt,u)}function kc(s,l,u,d){var y=0,w=s==null?0:s.length;if(w===0)return 0;l=u(l);for(var x=l!==l,E=l===null,T=Et(l),O=l===t;y<w;){var N=po((y+w)/2),R=u(s[N]),H=R!==t,G=R===null,q=R===R,ee=Et(R);if(x)var j=d||q;else O?j=q&&(d||H):E?j=q&&H&&(d||!G):T?j=q&&H&&!G&&(d||!ee):G||ee?j=!1:j=d?R<=l:R<l;j?y=N+1:w=N}return et(w,Oa)}function Ld(s,l){for(var u=-1,d=s.length,y=0,w=[];++u<d;){var x=s[u],E=l?l(x):x;if(!u||!Zt(E,T)){var T=E;w[y++]=x===0?0:x}}return w}function Pd(s){return typeof s=="number"?s:Et(s)?ln:+s}function kt(s){if(typeof s=="string")return s;if(Z(s))return Ee(s,kt)+"";if(Et(s))return dd?dd.call(s):"";var l=s+"";return l=="0"&&1/s==-1/0?"-0":l}function tr(s,l,u){var d=-1,y=eo,w=s.length,x=!0,E=[],T=E;if(u)x=!1,y=Za;else if(w>=i){var O=l?null:Dv(s);if(O)return no(O);x=!1,y=Gi,T=new Mr}else T=l?[]:E;e:for(;++d<w;){var N=s[d],R=l?l(N):N;if(N=u||N!==0?N:0,x&&R===R){for(var H=T.length;H--;)if(T[H]===R)continue e;l&&T.push(R),E.push(N)}else y(T,R,u)||(T!==E&&T.push(R),E.push(N))}return E}function Ec(s,l){return l=nr(l,s),s=cp(s,l),s==null||delete s[un(Ft(l))]}function Dd(s,l,u,d){return ns(s,l,u(Ir(s,l)),d)}function ko(s,l,u,d){for(var y=s.length,w=d?y:-1;(d?w--:++w<y)&&l(s[w],w,s););return u?Bt(s,d?0:w,d?w+1:y):Bt(s,d?w+1:0,d?y:w)}function zd(s,l){var u=s;return u instanceof se&&(u=u.value()),Qa(l,function(d,y){return y.func.apply(y.thisArg,Xn([d],y.args))},u)}function _c(s,l,u){var d=s.length;if(d<2)return d?tr(s[0]):[];for(var y=-1,w=A(d);++y<d;)for(var x=s[y],E=-1;++E<d;)E!=y&&(w[y]=Qi(w[y]||x,s[E],l,u));return tr(Ye(w,1),l,u)}function Bd(s,l,u){for(var d=-1,y=s.length,w=l.length,x={};++d<y;){var E=d<w?l[d]:t;u(x,s[d],E)}return x}function Tc(s){return Oe(s)?s:[]}function Cc(s){return typeof s=="function"?s:dt}function nr(s,l){return Z(s)?s:Dc(s,l)?[s]:dp(ge(s))}var Tv=ne;function rr(s,l,u){var d=s.length;return u=u===t?d:u,!l&&u>=d?s:Bt(s,l,u)}var Fd=d2||function(s){return je.clearTimeout(s)};function Hd(s,l){if(l)return s.slice();var u=s.length,d=ld?ld(u):new s.constructor(u);return s.copy(d),d}function Mc(s){var l=new s.constructor(s.byteLength);return new ao(l).set(new ao(s)),l}function Cv(s,l){var u=l?Mc(s.buffer):s.buffer;return new s.constructor(u,s.byteOffset,s.byteLength)}function Mv(s){var l=new s.constructor(s.source,kh.exec(s));return l.lastIndex=s.lastIndex,l}function Av(s){return Xi?we(Xi.call(s)):{}}function $d(s,l){var u=l?Mc(s.buffer):s.buffer;return new s.constructor(u,s.byteOffset,s.length)}function Wd(s,l){if(s!==l){var u=s!==t,d=s===null,y=s===s,w=Et(s),x=l!==t,E=l===null,T=l===l,O=Et(l);if(!E&&!O&&!w&&s>l||w&&x&&T&&!E&&!O||d&&x&&T||!u&&T||!y)return 1;if(!d&&!w&&!O&&s<l||O&&u&&y&&!d&&!w||E&&u&&y||!x&&y||!T)return-1}return 0}function Iv(s,l,u){for(var d=-1,y=s.criteria,w=l.criteria,x=y.length,E=u.length;++d<x;){var T=Wd(y[d],w[d]);if(T){if(d>=E)return T;var O=u[d];return T*(O=="desc"?-1:1)}}return s.index-l.index}function Ud(s,l,u,d){for(var y=-1,w=s.length,x=u.length,E=-1,T=l.length,O=ze(w-x,0),N=A(T+O),R=!d;++E<T;)N[E]=l[E];for(;++y<x;)(R||y<w)&&(N[u[y]]=s[y]);for(;O--;)N[E++]=s[y++];return N}function Vd(s,l,u,d){for(var y=-1,w=s.length,x=-1,E=u.length,T=-1,O=l.length,N=ze(w-E,0),R=A(N+O),H=!d;++y<N;)R[y]=s[y];for(var G=y;++T<O;)R[G+T]=l[T];for(;++x<E;)(H||y<w)&&(R[G+u[x]]=s[y++]);return R}function ut(s,l){var u=-1,d=s.length;for(l||(l=A(d));++u<d;)l[u]=s[u];return l}function cn(s,l,u,d){var y=!u;u||(u={});for(var w=-1,x=l.length;++w<x;){var E=l[w],T=d?d(u[E],s[E],E,u,s):t;T===t&&(T=s[E]),y?En(u,E,T):Zi(u,E,T)}return u}function Ov(s,l){return cn(s,Pc(s),l)}function Nv(s,l){return cn(s,rp(s),l)}function Eo(s,l){return function(u,d){var y=Z(u)?zb:ev,w=l?l():{};return y(u,s,J(d,2),w)}}function ci(s){return ne(function(l,u){var d=-1,y=u.length,w=y>1?u[y-1]:t,x=y>2?u[2]:t;for(w=s.length>3&&typeof w=="function"?(y--,w):t,x&&rt(u[0],u[1],x)&&(w=y<3?t:w,y=1),l=we(l);++d<y;){var E=u[d];E&&s(l,E,d,w)}return l})}function Kd(s,l){return function(u,d){if(u==null)return u;if(!ft(u))return s(u,d);for(var y=u.length,w=l?y:-1,x=we(u);(l?w--:++w<y)&&d(x[w],w,x)!==!1;);return u}}function Gd(s){return function(l,u,d){for(var y=-1,w=we(l),x=d(l),E=x.length;E--;){var T=x[s?E:++y];if(u(w[T],T,w)===!1)break}return l}}function Rv(s,l,u){var d=l&C,y=rs(s);function w(){var x=this&&this!==je&&this instanceof w?y:s;return x.apply(d?u:this,arguments)}return w}function Jd(s){return function(l){l=ge(l);var u=ni(l)?Yt(l):t,d=u?u[0]:l.charAt(0),y=u?rr(u,1).join(""):l.slice(1);return d[s]()+y}}function ui(s){return function(l){return Qa(Kp(Vp(l).replace(kb,"")),s,"")}}function rs(s){return function(){var l=arguments;switch(l.length){case 0:return new s;case 1:return new s(l[0]);case 2:return new s(l[0],l[1]);case 3:return new s(l[0],l[1],l[2]);case 4:return new s(l[0],l[1],l[2],l[3]);case 5:return new s(l[0],l[1],l[2],l[3],l[4]);case 6:return new s(l[0],l[1],l[2],l[3],l[4],l[5]);case 7:return new s(l[0],l[1],l[2],l[3],l[4],l[5],l[6])}var u=ai(s.prototype),d=s.apply(u,l);return Te(d)?d:u}}function Lv(s,l,u){var d=rs(s);function y(){for(var w=arguments.length,x=A(w),E=w,T=fi(y);E--;)x[E]=arguments[E];var O=w<3&&x[0]!==T&&x[w-1]!==T?[]:Zn(x,T);if(w-=O.length,w<u)return Zd(s,l,_o,y.placeholder,t,x,O,t,t,u-w);var N=this&&this!==je&&this instanceof y?d:s;return St(N,this,x)}return y}function qd(s){return function(l,u,d){var y=we(l);if(!ft(l)){var w=J(u,3);l=$e(l),u=function(E){return w(y[E],E,y)}}var x=s(l,u,d);return x>-1?y[w?l[x]:x]:t}}function jd(s){return Tn(function(l){var u=l.length,d=u,y=Dt.prototype.thru;for(s&&l.reverse();d--;){var w=l[d];if(typeof w!="function")throw new Pt(a);if(y&&!x&&Ao(w)=="wrapper")var x=new Dt([],!0)}for(d=x?d:u;++d<u;){w=l[d];var E=Ao(w),T=E=="wrapper"?Rc(w):t;T&&zc(T[0])&&T[1]==(fe|F|U|be)&&!T[4].length&&T[9]==1?x=x[Ao(T[0])].apply(x,T[3]):x=w.length==1&&zc(w)?x[E]():x.thru(w)}return function(){var O=arguments,N=O[0];if(x&&O.length==1&&Z(N))return x.plant(N).value();for(var R=0,H=u?l[R].apply(this,O):N;++R<u;)H=l[R].call(this,H);return H}})}function _o(s,l,u,d,y,w,x,E,T,O){var N=l&fe,R=l&C,H=l&M,G=l&(F|$),q=l&bt,ee=H?t:rs(s);function j(){for(var ie=arguments.length,ue=A(ie),_t=ie;_t--;)ue[_t]=arguments[_t];if(G)var it=fi(j),Tt=Gb(ue,it);if(d&&(ue=Ud(ue,d,y,G)),w&&(ue=Vd(ue,w,x,G)),ie-=Tt,G&&ie<O){var Ne=Zn(ue,it);return Zd(s,l,_o,j.placeholder,u,ue,Ne,E,T,O-ie)}var Qt=R?u:this,In=H?Qt[s]:s;return ie=ue.length,E?ue=ew(ue,E):q&&ie>1&&ue.reverse(),N&&T<ie&&(ue.length=T),this&&this!==je&&this instanceof j&&(In=ee||rs(In)),In.apply(Qt,ue)}return j}function Yd(s,l){return function(u,d){return av(u,s,l(d),{})}}function To(s,l){return function(u,d){var y;if(u===t&&d===t)return l;if(u!==t&&(y=u),d!==t){if(y===t)return d;typeof u=="string"||typeof d=="string"?(u=kt(u),d=kt(d)):(u=Pd(u),d=Pd(d)),y=s(u,d)}return y}}function Ac(s){return Tn(function(l){return l=Ee(l,xt(J())),ne(function(u){var d=this;return s(l,function(y){return St(y,d,u)})})})}function Co(s,l){l=l===t?" ":kt(l);var u=l.length;if(u<2)return u?xc(l,s):l;var d=xc(l,ho(s/ri(l)));return ni(l)?rr(Yt(d),0,s).join(""):d.slice(0,s)}function Pv(s,l,u,d){var y=l&C,w=rs(s);function x(){for(var E=-1,T=arguments.length,O=-1,N=d.length,R=A(N+T),H=this&&this!==je&&this instanceof x?w:s;++O<N;)R[O]=d[O];for(;T--;)R[O++]=arguments[++E];return St(H,y?u:this,R)}return x}function Xd(s){return function(l,u,d){return d&&typeof d!="number"&&rt(l,u,d)&&(u=d=t),l=An(l),u===t?(u=l,l=0):u=An(u),d=d===t?l<u?1:-1:An(d),wv(l,u,d,s)}}function Mo(s){return function(l,u){return typeof l=="string"&&typeof u=="string"||(l=Ht(l),u=Ht(u)),s(l,u)}}function Zd(s,l,u,d,y,w,x,E,T,O){var N=l&F,R=N?x:t,H=N?t:x,G=N?w:t,q=N?t:w;l|=N?U:ce,l&=~(N?ce:U),l&P||(l&=-4);var ee=[s,l,y,G,R,q,H,E,T,O],j=u.apply(t,ee);return zc(s)&&up(j,ee),j.placeholder=d,fp(j,s,l)}function Ic(s){var l=De[s];return function(u,d){if(u=Ht(u),d=d==null?0:et(Q(d),292),d&&fd(u)){var y=(ge(u)+"e").split("e"),w=l(y[0]+"e"+(+y[1]+d));return y=(ge(w)+"e").split("e"),+(y[0]+"e"+(+y[1]-d))}return l(u)}}var Dv=oi&&1/no(new oi([,-0]))[1]==vt?function(s){return new oi(s)}:Zc;function Qd(s){return function(l){var u=tt(l);return u==qt?oc(l):u==jt?Qb(l):Kb(l,s(l))}}function _n(s,l,u,d,y,w,x,E){var T=l&M;if(!T&&typeof s!="function")throw new Pt(a);var O=d?d.length:0;if(O||(l&=-97,d=y=t),x=x===t?x:ze(Q(x),0),E=E===t?E:Q(E),O-=y?y.length:0,l&ce){var N=d,R=y;d=y=t}var H=T?t:Rc(s),G=[s,l,u,d,y,N,R,w,x,E];if(H&&Xv(G,H),s=G[0],l=G[1],u=G[2],d=G[3],y=G[4],E=G[9]=G[9]===t?T?0:s.length:ze(G[9]-O,0),!E&&l&(F|$)&&(l&=-25),!l||l==C)var q=Rv(s,l,u);else l==F||l==$?q=Lv(s,l,E):(l==U||l==(C|U))&&!y.length?q=Pv(s,l,u,d):q=_o.apply(t,G);var ee=H?Rd:up;return fp(ee(q,G),s,l)}function ep(s,l,u,d){return s===t||Zt(s,si[u])&&!ve.call(d,u)?l:s}function tp(s,l,u,d,y,w){return Te(s)&&Te(l)&&(w.set(l,s),So(s,l,t,tp,w),w.delete(l)),s}function zv(s){return ls(s)?t:s}function np(s,l,u,d,y,w){var x=u&S,E=s.length,T=l.length;if(E!=T&&!(x&&T>E))return!1;var O=w.get(s),N=w.get(l);if(O&&N)return O==l&&N==s;var R=-1,H=!0,G=u&k?new Mr:t;for(w.set(s,l),w.set(l,s);++R<E;){var q=s[R],ee=l[R];if(d)var j=x?d(ee,q,R,l,s,w):d(q,ee,R,s,l,w);if(j!==t){if(j)continue;H=!1;break}if(G){if(!ec(l,function(ie,ue){if(!Gi(G,ue)&&(q===ie||y(q,ie,u,d,w)))return G.push(ue)})){H=!1;break}}else if(!(q===ee||y(q,ee,u,d,w))){H=!1;break}}return w.delete(s),w.delete(l),H}function Bv(s,l,u,d,y,w,x){switch(u){case Qr:if(s.byteLength!=l.byteLength||s.byteOffset!=l.byteOffset)return!1;s=s.buffer,l=l.buffer;case Ki:return!(s.byteLength!=l.byteLength||!w(new ao(s),new ao(l)));case Fi:case Hi:case $i:return Zt(+s,+l);case qs:return s.name==l.name&&s.message==l.message;case Wi:case Ui:return s==l+"";case qt:var E=oc;case jt:var T=d&S;if(E||(E=no),s.size!=l.size&&!T)return!1;var O=x.get(s);if(O)return O==l;d|=k,x.set(s,l);var N=np(E(s),E(l),d,y,w,x);return x.delete(s),N;case Ys:if(Xi)return Xi.call(s)==Xi.call(l)}return!1}function Fv(s,l,u,d,y,w){var x=u&S,E=Oc(s),T=E.length,O=Oc(l),N=O.length;if(T!=N&&!x)return!1;for(var R=T;R--;){var H=E[R];if(!(x?H in l:ve.call(l,H)))return!1}var G=w.get(s),q=w.get(l);if(G&&q)return G==l&&q==s;var ee=!0;w.set(s,l),w.set(l,s);for(var j=x;++R<T;){H=E[R];var ie=s[H],ue=l[H];if(d)var _t=x?d(ue,ie,H,l,s,w):d(ie,ue,H,s,l,w);if(!(_t===t?ie===ue||y(ie,ue,u,d,w):_t)){ee=!1;break}j||(j=H=="constructor")}if(ee&&!j){var it=s.constructor,Tt=l.constructor;it!=Tt&&"constructor"in s&&"constructor"in l&&!(typeof it=="function"&&it instanceof it&&typeof Tt=="function"&&Tt instanceof Tt)&&(ee=!1)}return w.delete(s),w.delete(l),ee}function Tn(s){return Fc(ap(s,t,yp),s+"")}function Oc(s){return xd(s,$e,Pc)}function Nc(s){return xd(s,ht,rp)}var Rc=mo?function(s){return mo.get(s)}:Zc;function Ao(s){for(var l=s.name+"",u=li[l],d=ve.call(li,l)?u.length:0;d--;){var y=u[d],w=y.func;if(w==null||w==s)return y.name}return l}function fi(s){var l=ve.call(v,"placeholder")?v:s;return l.placeholder}function J(){var s=v.iteratee||Yc;return s=s===Yc?_d:s,arguments.length?s(arguments[0],arguments[1]):s}function Io(s,l){var u=s.__data__;return Jv(l)?u[typeof l=="string"?"string":"hash"]:u.map}function Lc(s){for(var l=$e(s),u=l.length;u--;){var d=l[u],y=s[d];l[u]=[d,y,op(y)]}return l}function Or(s,l){var u=Yb(s,l);return Ed(u)?u:t}function Hv(s){var l=ve.call(s,Tr),u=s[Tr];try{s[Tr]=t;var d=!0}catch{}var y=oo.call(s);return d&&(l?s[Tr]=u:delete s[Tr]),y}var Pc=ac?function(s){return s==null?[]:(s=we(s),Yn(ac(s),function(l){return cd.call(s,l)}))}:Qc,rp=ac?function(s){for(var l=[];s;)Xn(l,Pc(s)),s=co(s);return l}:Qc,tt=nt;(cc&&tt(new cc(new ArrayBuffer(1)))!=Qr||qi&&tt(new qi)!=qt||uc&&tt(uc.resolve())!=vh||oi&&tt(new oi)!=jt||ji&&tt(new ji)!=Vi)&&(tt=function(s){var l=nt(s),u=l==Sn?s.constructor:t,d=u?Nr(u):"";if(d)switch(d){case x2:return Qr;case k2:return qt;case E2:return vh;case _2:return jt;case T2:return Vi}return l});function $v(s,l,u){for(var d=-1,y=u.length;++d<y;){var w=u[d],x=w.size;switch(w.type){case"drop":s+=x;break;case"dropRight":l-=x;break;case"take":l=et(l,s+x);break;case"takeRight":s=ze(s,l-x);break}}return{start:s,end:l}}function Wv(s){var l=s.match(qy);return l?l[1].split(jy):[]}function ip(s,l,u){l=nr(l,s);for(var d=-1,y=l.length,w=!1;++d<y;){var x=un(l[d]);if(!(w=s!=null&&u(s,x)))break;s=s[x]}return w||++d!=y?w:(y=s==null?0:s.length,!!y&&zo(y)&&Cn(x,y)&&(Z(s)||Rr(s)))}function Uv(s){var l=s.length,u=new s.constructor(l);return l&&typeof s[0]=="string"&&ve.call(s,"index")&&(u.index=s.index,u.input=s.input),u}function sp(s){return typeof s.constructor=="function"&&!is(s)?ai(co(s)):{}}function Vv(s,l,u){var d=s.constructor;switch(l){case Ki:return Mc(s);case Fi:case Hi:return new d(+s);case Qr:return Cv(s,u);case La:case Pa:case Da:case za:case Ba:case Fa:case Ha:case $a:case Wa:return $d(s,u);case qt:return new d;case $i:case Ui:return new d(s);case Wi:return Mv(s);case jt:return new d;case Ys:return Av(s)}}function Kv(s,l){var u=l.length;if(!u)return s;var d=u-1;return l[d]=(u>1?"& ":"")+l[d],l=l.join(u>2?", ":" "),s.replace(Jy,`{
21
21
  /* [wrapped with `+l+`] */
22
- `)}function Jw(s){return Z(s)||Lr(s)||!!(ch&&s&&s[ch])}function Tn(s,l){var c=typeof s;return l=l??jn,!!l&&(c=="number"||c!="symbol"&&sb.test(s))&&s>-1&&s%1==0&&s<l}function nt(s,l,c){if(!Ce(c))return!1;var h=typeof l;return(h=="number"?ct(c)&&Tn(l,c.length):h=="string"&&l in c)?Xt(c[l],s):!1}function zu(s,l){if(Z(s))return!1;var c=typeof s;return c=="number"||c=="symbol"||c=="boolean"||s==null||Et(s)?!0:Vy.test(s)||!Uy.test(s)||l!=null&&s in xe(l)}function qw(s){var l=typeof s;return l=="string"||l=="number"||l=="symbol"||l=="boolean"?s!=="__proto__":s===null}function Bu(s){var l=Io(s),c=w[l];if(typeof c!="function"||!(l in se.prototype))return!1;if(s===c)return!0;var h=Lu(c);return!!h&&s===h[0]}function jw(s){return!!oh&&oh in s}var Yw=so?Cn:tc;function ss(s){var l=s&&s.constructor,c=typeof l=="function"&&l.prototype||oi;return s===c}function op(s){return s===s&&!Ce(s)}function lp(s,l){return function(c){return c==null?!1:c[s]===l&&(l!==t||s in xe(c))}}function Xw(s){var l=Do(s,function(h){return c.size===d&&c.clear(),h}),c=l.cache;return l}function Zw(s,l){var c=s[1],h=l[1],y=c|h,S=y<(C|M|fe),k=h==fe&&c==F||h==fe&&c==we&&s[7].length<=l[8]||h==(fe|we)&&l[7].length<=l[8]&&c==F;if(!(S||k))return s;h&C&&(s[2]=l[2],y|=c&C?0:P);var _=l[3];if(_){var T=s[3];s[3]=T?Uh(T,_,l[4]):_,s[4]=T?Zn(s[3],m):l[4]}return _=l[5],_&&(T=s[5],s[5]=T?Vh(T,_,l[6]):_,s[6]=T?Zn(s[5],m):l[6]),_=l[7],_&&(s[7]=_),h&fe&&(s[8]=s[8]==null?l[8]:Qe(s[8],l[8])),s[9]==null&&(s[9]=l[9]),s[0]=l[0],s[1]=y,s}function Qw(s){var l=[];if(s!=null)for(var c in xe(s))l.push(c);return l}function eS(s){return lo.call(s)}function ap(s,l,c){return l=De(l===t?s.length-1:l,0),function(){for(var h=arguments,y=-1,S=De(h.length-l,0),k=A(S);++y<S;)k[y]=h[l+y];y=-1;for(var _=A(l+1);++y<l;)_[y]=h[y];return _[l]=c(k),St(s,this,_)}}function up(s,l){return l.length<2?s:Or(s,zt(l,0,-1))}function tS(s,l){for(var c=s.length,h=Qe(l.length,c),y=ut(s);h--;){var S=l[h];s[h]=Tn(S,c)?y[S]:t}return s}function Fu(s,l){if(!(l==="constructor"&&typeof s[l]=="function")&&l!="__proto__")return s[l]}var cp=dp(Rh),ls=g2||function(s,l){return qe.setTimeout(s,l)},Hu=dp(_w);function fp(s,l,c){var h=l+"";return Hu(s,Gw(h,nS(Uw(h),c)))}function dp(s){var l=0,c=0;return function(){var h=S2(),y=Qr-(h-c);if(c=h,y>0){if(++l>=qn)return arguments[0]}else l=0;return s.apply(t,arguments)}}function No(s,l){var c=-1,h=s.length,y=h-1;for(l=l===t?h:l;++c<l;){var S=ku(c,y),k=s[S];s[S]=s[c],s[c]=k}return s.length=l,s}var hp=Xw(function(s){var l=[];return s.charCodeAt(0)===46&&l.push(""),s.replace(Ky,function(c,h,y,S){l.push(y?S.replace(Qy,"$1"):h||c)}),l});function cn(s){if(typeof s=="string"||Et(s))return s;var l=s+"";return l=="0"&&1/s==-1/0?"-0":l}function Rr(s){if(s!=null){try{return oo.call(s)}catch{}try{return s+""}catch{}}return""}function nS(s,l){return Rt(La,function(c){var h="_."+c[0];l&c[1]&&!to(s,h)&&s.push(h)}),s.sort()}function pp(s){if(s instanceof se)return s.clone();var l=new Pt(s.__wrapped__,s.__chain__);return l.__actions__=ut(s.__actions__),l.__index__=s.__index__,l.__values__=s.__values__,l}function rS(s,l,c){(c?nt(s,l,c):l===t)?l=1:l=De(Q(l),0);var h=s==null?0:s.length;if(!h||l<1)return[];for(var y=0,S=0,k=A(po(h/l));y<h;)k[S++]=zt(s,y,y+=l);return k}function iS(s){for(var l=-1,c=s==null?0:s.length,h=0,y=[];++l<c;){var S=s[l];S&&(y[h++]=S)}return y}function sS(){var s=arguments.length;if(!s)return[];for(var l=A(s-1),c=arguments[0],h=s;h--;)l[h-1]=arguments[h];return Xn(Z(c)?ut(c):[c],je(l,1))}var oS=ne(function(s,l){return Oe(s)?es(s,je(l,1,Oe,!0)):[]}),lS=ne(function(s,l){var c=Bt(l);return Oe(c)&&(c=t),Oe(s)?es(s,je(l,1,Oe,!0),J(c,2)):[]}),aS=ne(function(s,l){var c=Bt(l);return Oe(c)&&(c=t),Oe(s)?es(s,je(l,1,Oe,!0),t,c):[]});function uS(s,l,c){var h=s==null?0:s.length;return h?(l=c||l===t?1:Q(l),zt(s,l<0?0:l,h)):[]}function cS(s,l,c){var h=s==null?0:s.length;return h?(l=c||l===t?1:Q(l),l=h-l,zt(s,0,l<0?0:l)):[]}function fS(s,l){return s&&s.length?_o(s,J(l,3),!0,!0):[]}function dS(s,l){return s&&s.length?_o(s,J(l,3),!0):[]}function hS(s,l,c,h){var y=s==null?0:s.length;return y?(c&&typeof c!="number"&&nt(s,l,c)&&(c=0,h=y),sw(s,l,c,h)):[]}function mp(s,l,c){var h=s==null?0:s.length;if(!h)return-1;var y=c==null?0:Q(c);return y<0&&(y=De(h+y,0)),no(s,J(l,3),y)}function gp(s,l,c){var h=s==null?0:s.length;if(!h)return-1;var y=h-1;return c!==t&&(y=Q(c),y=c<0?De(h+y,0):Qe(y,h-1)),no(s,J(l,3),y,!0)}function yp(s){var l=s==null?0:s.length;return l?je(s,1):[]}function pS(s){var l=s==null?0:s.length;return l?je(s,bt):[]}function mS(s,l){var c=s==null?0:s.length;return c?(l=l===t?1:Q(l),je(s,l)):[]}function gS(s){for(var l=-1,c=s==null?0:s.length,h={};++l<c;){var y=s[l];h[y[0]]=y[1]}return h}function bp(s){return s&&s.length?s[0]:t}function yS(s,l,c){var h=s==null?0:s.length;if(!h)return-1;var y=c==null?0:Q(c);return y<0&&(y=De(h+y,0)),ni(s,l,y)}function bS(s){var l=s==null?0:s.length;return l?zt(s,0,-1):[]}var wS=ne(function(s){var l=ve(s,Cu);return l.length&&l[0]===s[0]?yu(l):[]}),SS=ne(function(s){var l=Bt(s),c=ve(s,Cu);return l===Bt(c)?l=t:c.pop(),c.length&&c[0]===s[0]?yu(c,J(l,2)):[]}),xS=ne(function(s){var l=Bt(s),c=ve(s,Cu);return l=typeof l=="function"?l:t,l&&c.pop(),c.length&&c[0]===s[0]?yu(c,t,l):[]});function kS(s,l){return s==null?"":b2.call(s,l)}function Bt(s){var l=s==null?0:s.length;return l?s[l-1]:t}function ES(s,l,c){var h=s==null?0:s.length;if(!h)return-1;var y=h;return c!==t&&(y=Q(c),y=y<0?De(h+y,0):Qe(y,h-1)),l===l?n2(s,l,y):no(s,Zd,y,!0)}function _S(s,l){return s&&s.length?Ah(s,Q(l)):t}var vS=ne(wp);function wp(s,l){return s&&s.length&&l&&l.length?xu(s,l):s}function TS(s,l,c){return s&&s.length&&l&&l.length?xu(s,l,J(c,2)):s}function CS(s,l,c){return s&&s.length&&l&&l.length?xu(s,l,t,c):s}var MS=vn(function(s,l){var c=s==null?0:s.length,h=hu(s,l);return Nh(s,ve(l,function(y){return Tn(y,c)?+y:y}).sort(Wh)),h});function AS(s,l){var c=[];if(!(s&&s.length))return c;var h=-1,y=[],S=s.length;for(l=J(l,3);++h<S;){var k=s[h];l(k,h,s)&&(c.push(k),y.push(h))}return Nh(s,y),c}function $u(s){return s==null?s:k2.call(s)}function IS(s,l,c){var h=s==null?0:s.length;return h?(c&&typeof c!="number"&&nt(s,l,c)?(l=0,c=h):(l=l==null?0:Q(l),c=c===t?h:Q(c)),zt(s,l,c)):[]}function OS(s,l){return Eo(s,l)}function NS(s,l,c){return _u(s,l,J(c,2))}function RS(s,l){var c=s==null?0:s.length;if(c){var h=Eo(s,l);if(h<c&&Xt(s[h],l))return h}return-1}function LS(s,l){return Eo(s,l,!0)}function PS(s,l,c){return _u(s,l,J(c,2),!0)}function DS(s,l){var c=s==null?0:s.length;if(c){var h=Eo(s,l,!0)-1;if(Xt(s[h],l))return h}return-1}function zS(s){return s&&s.length?Lh(s):[]}function BS(s,l){return s&&s.length?Lh(s,J(l,2)):[]}function FS(s){var l=s==null?0:s.length;return l?zt(s,1,l):[]}function HS(s,l,c){return s&&s.length?(l=c||l===t?1:Q(l),zt(s,0,l<0?0:l)):[]}function $S(s,l,c){var h=s==null?0:s.length;return h?(l=c||l===t?1:Q(l),l=h-l,zt(s,l<0?0:l,h)):[]}function WS(s,l){return s&&s.length?_o(s,J(l,3),!1,!0):[]}function US(s,l){return s&&s.length?_o(s,J(l,3)):[]}var VS=ne(function(s){return nr(je(s,1,Oe,!0))}),KS=ne(function(s){var l=Bt(s);return Oe(l)&&(l=t),nr(je(s,1,Oe,!0),J(l,2))}),GS=ne(function(s){var l=Bt(s);return l=typeof l=="function"?l:t,nr(je(s,1,Oe,!0),t,l)});function JS(s){return s&&s.length?nr(s):[]}function qS(s,l){return s&&s.length?nr(s,J(l,2)):[]}function jS(s,l){return l=typeof l=="function"?l:t,s&&s.length?nr(s,t,l):[]}function Wu(s){if(!(s&&s.length))return[];var l=0;return s=Yn(s,function(c){if(Oe(c))return l=De(c.length,l),!0}),su(l,function(c){return ve(s,nu(c))})}function Sp(s,l){if(!(s&&s.length))return[];var c=Wu(s);return l==null?c:ve(c,function(h){return St(l,t,h)})}var YS=ne(function(s,l){return Oe(s)?es(s,l):[]}),XS=ne(function(s){return Tu(Yn(s,Oe))}),ZS=ne(function(s){var l=Bt(s);return Oe(l)&&(l=t),Tu(Yn(s,Oe),J(l,2))}),QS=ne(function(s){var l=Bt(s);return l=typeof l=="function"?l:t,Tu(Yn(s,Oe),t,l)}),e5=ne(Wu);function t5(s,l){return Bh(s||[],l||[],Qi)}function n5(s,l){return Bh(s||[],l||[],rs)}var r5=ne(function(s){var l=s.length,c=l>1?s[l-1]:t;return c=typeof c=="function"?(s.pop(),c):t,Sp(s,c)});function xp(s){var l=w(s);return l.__chain__=!0,l}function i5(s,l){return l(s),s}function Ro(s,l){return l(s)}var s5=vn(function(s){var l=s.length,c=l?s[0]:0,h=this.__wrapped__,y=function(S){return hu(S,s)};return l>1||this.__actions__.length||!(h instanceof se)||!Tn(c)?this.thru(y):(h=h.slice(c,+c+(l?1:0)),h.__actions__.push({func:Ro,args:[y],thisArg:t}),new Pt(h,this.__chain__).thru(function(S){return l&&!S.length&&S.push(t),S}))});function o5(){return xp(this)}function l5(){return new Pt(this.value(),this.__chain__)}function a5(){this.__values__===t&&(this.__values__=Pp(this.value()));var s=this.__index__>=this.__values__.length,l=s?t:this.__values__[this.__index__++];return{done:s,value:l}}function u5(){return this}function c5(s){for(var l,c=this;c instanceof bo;){var h=pp(c);h.__index__=0,h.__values__=t,l?y.__wrapped__=h:l=h;var y=h;c=c.__wrapped__}return y.__wrapped__=s,l}function f5(){var s=this.__wrapped__;if(s instanceof se){var l=s;return this.__actions__.length&&(l=new se(this)),l=l.reverse(),l.__actions__.push({func:Ro,args:[$u],thisArg:t}),new Pt(l,this.__chain__)}return this.thru($u)}function d5(){return zh(this.__wrapped__,this.__actions__)}var h5=vo(function(s,l,c){Se.call(s,c)?++s[c]:En(s,c,1)});function p5(s,l,c){var h=Z(s)?Yd:iw;return c&&nt(s,l,c)&&(l=t),h(s,J(l,3))}function m5(s,l){var c=Z(s)?Yn:Sh;return c(s,J(l,3))}var g5=qh(mp),y5=qh(gp);function b5(s,l){return je(Lo(s,l),1)}function w5(s,l){return je(Lo(s,l),bt)}function S5(s,l,c){return c=c===t?1:Q(c),je(Lo(s,l),c)}function kp(s,l){var c=Z(s)?Rt:er;return c(s,J(l,3))}function Ep(s,l){var c=Z(s)?Fb:wh;return c(s,J(l,3))}var x5=vo(function(s,l,c){Se.call(s,c)?s[c].push(l):En(s,c,[l])});function k5(s,l,c,h){s=ct(s)?s:pi(s),c=c&&!h?Q(c):0;var y=s.length;return c<0&&(c=De(y+c,0)),Fo(s)?c<=y&&s.indexOf(l,c)>-1:!!y&&ni(s,l,c)>-1}var E5=ne(function(s,l,c){var h=-1,y=typeof l=="function",S=ct(s)?A(s.length):[];return er(s,function(k){S[++h]=y?St(l,k,c):ts(k,l,c)}),S}),_5=vo(function(s,l,c){En(s,c,l)});function Lo(s,l){var c=Z(s)?ve:Th;return c(s,J(l,3))}function v5(s,l,c,h){return s==null?[]:(Z(l)||(l=l==null?[]:[l]),c=h?t:c,Z(c)||(c=c==null?[]:[c]),Ih(s,l,c))}var T5=vo(function(s,l,c){s[c?0:1].push(l)},function(){return[[],[]]});function C5(s,l,c){var h=Z(s)?eu:eh,y=arguments.length<3;return h(s,J(l,4),c,y,er)}function M5(s,l,c){var h=Z(s)?Hb:eh,y=arguments.length<3;return h(s,J(l,4),c,y,wh)}function A5(s,l){var c=Z(s)?Yn:Sh;return c(s,zo(J(l,3)))}function I5(s){var l=Z(s)?mh:kw;return l(s)}function O5(s,l,c){(c?nt(s,l,c):l===t)?l=1:l=Q(l);var h=Z(s)?Q2:Ew;return h(s,l)}function N5(s){var l=Z(s)?ew:vw;return l(s)}function R5(s){if(s==null)return 0;if(ct(s))return Fo(s)?ii(s):s.length;var l=et(s);return l==Jt||l==qt?s.size:wu(s).length}function L5(s,l,c){var h=Z(s)?tu:Tw;return c&&nt(s,l,c)&&(l=t),h(s,J(l,3))}var P5=ne(function(s,l){if(s==null)return[];var c=l.length;return c>1&&nt(s,l[0],l[1])?l=[]:c>2&&nt(l[0],l[1],l[2])&&(l=[l[0]]),Ih(s,je(l,1),[])}),Po=m2||function(){return qe.Date.now()};function D5(s,l){if(typeof l!="function")throw new Lt(a);return s=Q(s),function(){if(--s<1)return l.apply(this,arguments)}}function _p(s,l,c){return l=c?t:l,l=s&&l==null?s.length:l,_n(s,fe,t,t,t,t,l)}function vp(s,l){var c;if(typeof l!="function")throw new Lt(a);return s=Q(s),function(){return--s>0&&(c=l.apply(this,arguments)),s<=1&&(l=t),c}}var Uu=ne(function(s,l,c){var h=C;if(c.length){var y=Zn(c,di(Uu));h|=U}return _n(s,h,l,c,y)}),Tp=ne(function(s,l,c){var h=C|M;if(c.length){var y=Zn(c,di(Tp));h|=U}return _n(l,h,s,c,y)});function Cp(s,l,c){l=c?t:l;var h=_n(s,F,t,t,t,t,t,l);return h.placeholder=Cp.placeholder,h}function Mp(s,l,c){l=c?t:l;var h=_n(s,$,t,t,t,t,t,l);return h.placeholder=Mp.placeholder,h}function Ap(s,l,c){var h,y,S,k,_,T,O=0,N=!1,R=!1,H=!0;if(typeof s!="function")throw new Lt(a);l=Ft(l)||0,Ce(c)&&(N=!!c.leading,R="maxWait"in c,S=R?De(Ft(c.maxWait)||0,l):S,H="trailing"in c?!!c.trailing:H);function G(Ne){var Zt=h,An=y;return h=y=t,O=Ne,k=s.apply(An,Zt),k}function q(Ne){return O=Ne,_=ls(ie,l),N?G(Ne):k}function ee(Ne){var Zt=Ne-T,An=Ne-O,qp=l-Zt;return R?Qe(qp,S-An):qp}function j(Ne){var Zt=Ne-T,An=Ne-O;return T===t||Zt>=l||Zt<0||R&&An>=S}function ie(){var Ne=Po();if(j(Ne))return ce(Ne);_=ls(ie,ee(Ne))}function ce(Ne){return _=t,H&&h?G(Ne):(h=y=t,k)}function _t(){_!==t&&Fh(_),O=0,h=T=y=_=t}function rt(){return _===t?k:ce(Po())}function vt(){var Ne=Po(),Zt=j(Ne);if(h=arguments,y=this,T=Ne,Zt){if(_===t)return q(T);if(R)return Fh(_),_=ls(ie,l),G(T)}return _===t&&(_=ls(ie,l)),k}return vt.cancel=_t,vt.flush=rt,vt}var z5=ne(function(s,l){return bh(s,1,l)}),B5=ne(function(s,l,c){return bh(s,Ft(l)||0,c)});function F5(s){return _n(s,yt)}function Do(s,l){if(typeof s!="function"||l!=null&&typeof l!="function")throw new Lt(a);var c=function(){var h=arguments,y=l?l.apply(this,h):h[0],S=c.cache;if(S.has(y))return S.get(y);var k=s.apply(this,h);return c.cache=S.set(y,k)||S,k};return c.cache=new(Do.Cache||kn),c}Do.Cache=kn;function zo(s){if(typeof s!="function")throw new Lt(a);return function(){var l=arguments;switch(l.length){case 0:return!s.call(this);case 1:return!s.call(this,l[0]);case 2:return!s.call(this,l[0],l[1]);case 3:return!s.call(this,l[0],l[1],l[2])}return!s.apply(this,l)}}function H5(s){return vp(2,s)}var $5=Cw(function(s,l){l=l.length==1&&Z(l[0])?ve(l[0],xt(J())):ve(je(l,1),xt(J()));var c=l.length;return ne(function(h){for(var y=-1,S=Qe(h.length,c);++y<S;)h[y]=l[y].call(this,h[y]);return St(s,this,h)})}),Vu=ne(function(s,l){var c=Zn(l,di(Vu));return _n(s,U,t,l,c)}),Ip=ne(function(s,l){var c=Zn(l,di(Ip));return _n(s,ue,t,l,c)}),W5=vn(function(s,l){return _n(s,we,t,t,t,l)});function U5(s,l){if(typeof s!="function")throw new Lt(a);return l=l===t?l:Q(l),ne(s,l)}function V5(s,l){if(typeof s!="function")throw new Lt(a);return l=l==null?0:De(Q(l),0),ne(function(c){var h=c[l],y=ir(c,0,l);return h&&Xn(y,h),St(s,this,y)})}function K5(s,l,c){var h=!0,y=!0;if(typeof s!="function")throw new Lt(a);return Ce(c)&&(h="leading"in c?!!c.leading:h,y="trailing"in c?!!c.trailing:y),Ap(s,l,{leading:h,maxWait:l,trailing:y})}function G5(s){return _p(s,1)}function J5(s,l){return Vu(Mu(l),s)}function q5(){if(!arguments.length)return[];var s=arguments[0];return Z(s)?s:[s]}function j5(s){return Dt(s,b)}function Y5(s,l){return l=typeof l=="function"?l:t,Dt(s,b,l)}function X5(s){return Dt(s,p|b)}function Z5(s,l){return l=typeof l=="function"?l:t,Dt(s,p|b,l)}function Q5(s,l){return l==null||yh(s,l,He(l))}function Xt(s,l){return s===l||s!==s&&l!==l}var ex=Ao(gu),tx=Ao(function(s,l){return s>=l}),Lr=Eh(function(){return arguments}())?Eh:function(s){return Me(s)&&Se.call(s,"callee")&&!uh.call(s,"callee")},Z=A.isArray,nx=Vd?xt(Vd):cw;function ct(s){return s!=null&&Bo(s.length)&&!Cn(s)}function Oe(s){return Me(s)&&ct(s)}function rx(s){return s===!0||s===!1||Me(s)&&tt(s)==Hi}var sr=y2||tc,ix=Kd?xt(Kd):fw;function sx(s){return Me(s)&&s.nodeType===1&&!as(s)}function ox(s){if(s==null)return!0;if(ct(s)&&(Z(s)||typeof s=="string"||typeof s.splice=="function"||sr(s)||hi(s)||Lr(s)))return!s.length;var l=et(s);if(l==Jt||l==qt)return!s.size;if(ss(s))return!wu(s).length;for(var c in s)if(Se.call(s,c))return!1;return!0}function lx(s,l){return ns(s,l)}function ax(s,l,c){c=typeof c=="function"?c:t;var h=c?c(s,l):t;return h===t?ns(s,l,t,c):!!h}function Ku(s){if(!Me(s))return!1;var l=tt(s);return l==js||l==Oy||typeof s.message=="string"&&typeof s.name=="string"&&!as(s)}function ux(s){return typeof s=="number"&&fh(s)}function Cn(s){if(!Ce(s))return!1;var l=tt(s);return l==Ys||l==bd||l==Iy||l==Ry}function Op(s){return typeof s=="number"&&s==Q(s)}function Bo(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=jn}function Ce(s){var l=typeof s;return s!=null&&(l=="object"||l=="function")}function Me(s){return s!=null&&typeof s=="object"}var Np=Gd?xt(Gd):hw;function cx(s,l){return s===l||bu(s,l,Pu(l))}function fx(s,l,c){return c=typeof c=="function"?c:t,bu(s,l,Pu(l),c)}function dx(s){return Rp(s)&&s!=+s}function hx(s){if(Yw(s))throw new X(o);return _h(s)}function px(s){return s===null}function mx(s){return s==null}function Rp(s){return typeof s=="number"||Me(s)&&tt(s)==Wi}function as(s){if(!Me(s)||tt(s)!=Sn)return!1;var l=co(s);if(l===null)return!0;var c=Se.call(l,"constructor")&&l.constructor;return typeof c=="function"&&c instanceof c&&oo.call(c)==f2}var Gu=Jd?xt(Jd):pw;function gx(s){return Op(s)&&s>=-9007199254740991&&s<=jn}var Lp=qd?xt(qd):mw;function Fo(s){return typeof s=="string"||!Z(s)&&Me(s)&&tt(s)==Vi}function Et(s){return typeof s=="symbol"||Me(s)&&tt(s)==Xs}var hi=jd?xt(jd):gw;function yx(s){return s===t}function bx(s){return Me(s)&&et(s)==Ki}function wx(s){return Me(s)&&tt(s)==Py}var Sx=Ao(Su),xx=Ao(function(s,l){return s<=l});function Pp(s){if(!s)return[];if(ct(s))return Fo(s)?jt(s):ut(s);if(qi&&s[qi])return Qb(s[qi]());var l=et(s),c=l==Jt?lu:l==qt?ro:pi;return c(s)}function Mn(s){if(!s)return s===0?s:0;if(s=Ft(s),s===bt||s===-1/0){var l=s<0?-1:1;return l*Js}return s===s?s:0}function Q(s){var l=Mn(s),c=l%1;return l===l?c?l-c:l:0}function Dp(s){return s?Ir(Q(s),0,wt):0}function Ft(s){if(typeof s=="number")return s;if(Et(s))return ln;if(Ce(s)){var l=typeof s.valueOf=="function"?s.valueOf():s;s=Ce(l)?l+"":l}if(typeof s!="string")return s===0?s:+s;s=th(s);var c=nb.test(s);return c||ib.test(s)?Db(s.slice(2),c?2:8):tb.test(s)?ln:+s}function zp(s){return un(s,ft(s))}function kx(s){return s?Ir(Q(s),-9007199254740991,jn):s===0?s:0}function ye(s){return s==null?"":kt(s)}var Ex=ci(function(s,l){if(ss(l)||ct(l)){un(l,He(l),s);return}for(var c in l)Se.call(l,c)&&Qi(s,c,l[c])}),Bp=ci(function(s,l){un(l,ft(l),s)}),Ho=ci(function(s,l,c,h){un(l,ft(l),s,h)}),_x=ci(function(s,l,c,h){un(l,He(l),s,h)}),vx=vn(hu);function Tx(s,l){var c=ui(s);return l==null?c:gh(c,l)}var Cx=ne(function(s,l){s=xe(s);var c=-1,h=l.length,y=h>2?l[2]:t;for(y&&nt(l[0],l[1],y)&&(h=1);++c<h;)for(var S=l[c],k=ft(S),_=-1,T=k.length;++_<T;){var O=k[_],N=s[O];(N===t||Xt(N,oi[O])&&!Se.call(s,O))&&(s[O]=S[O])}return s}),Mx=ne(function(s){return s.push(t,tp),St(Fp,t,s)});function Ax(s,l){return Xd(s,J(l,3),an)}function Ix(s,l){return Xd(s,J(l,3),mu)}function Ox(s,l){return s==null?s:pu(s,J(l,3),ft)}function Nx(s,l){return s==null?s:xh(s,J(l,3),ft)}function Rx(s,l){return s&&an(s,J(l,3))}function Lx(s,l){return s&&mu(s,J(l,3))}function Px(s){return s==null?[]:xo(s,He(s))}function Dx(s){return s==null?[]:xo(s,ft(s))}function Ju(s,l,c){var h=s==null?t:Or(s,l);return h===t?c:h}function zx(s,l){return s!=null&&ip(s,l,ow)}function qu(s,l){return s!=null&&ip(s,l,lw)}var Bx=Yh(function(s,l,c){l!=null&&typeof l.toString!="function"&&(l=lo.call(l)),s[l]=c},Yu(dt)),Fx=Yh(function(s,l,c){l!=null&&typeof l.toString!="function"&&(l=lo.call(l)),Se.call(s,l)?s[l].push(c):s[l]=[c]},J),Hx=ne(ts);function He(s){return ct(s)?ph(s):wu(s)}function ft(s){return ct(s)?ph(s,!0):yw(s)}function $x(s,l){var c={};return l=J(l,3),an(s,function(h,y,S){En(c,l(h,y,S),h)}),c}function Wx(s,l){var c={};return l=J(l,3),an(s,function(h,y,S){En(c,y,l(h,y,S))}),c}var Ux=ci(function(s,l,c){ko(s,l,c)}),Fp=ci(function(s,l,c,h){ko(s,l,c,h)}),Vx=vn(function(s,l){var c={};if(s==null)return c;var h=!1;l=ve(l,function(S){return S=rr(S,s),h||(h=S.length>1),S}),un(s,Ru(s),c),h&&(c=Dt(c,p|g|b,Bw));for(var y=l.length;y--;)vu(c,l[y]);return c});function Kx(s,l){return Hp(s,zo(J(l)))}var Gx=vn(function(s,l){return s==null?{}:ww(s,l)});function Hp(s,l){if(s==null)return{};var c=ve(Ru(s),function(h){return[h]});return l=J(l),Oh(s,c,function(h,y){return l(h,y[0])})}function Jx(s,l,c){l=rr(l,s);var h=-1,y=l.length;for(y||(y=1,s=t);++h<y;){var S=s==null?t:s[cn(l[h])];S===t&&(h=y,S=c),s=Cn(S)?S.call(s):S}return s}function qx(s,l,c){return s==null?s:rs(s,l,c)}function jx(s,l,c,h){return h=typeof h=="function"?h:t,s==null?s:rs(s,l,c,h)}var $p=Qh(He),Wp=Qh(ft);function Yx(s,l,c){var h=Z(s),y=h||sr(s)||hi(s);if(l=J(l,4),c==null){var S=s&&s.constructor;y?c=h?new S:[]:Ce(s)?c=Cn(S)?ui(co(s)):{}:c={}}return(y?Rt:an)(s,function(k,_,T){return l(c,k,_,T)}),c}function Xx(s,l){return s==null?!0:vu(s,l)}function Zx(s,l,c){return s==null?s:Dh(s,l,Mu(c))}function Qx(s,l,c,h){return h=typeof h=="function"?h:t,s==null?s:Dh(s,l,Mu(c),h)}function pi(s){return s==null?[]:ou(s,He(s))}function ek(s){return s==null?[]:ou(s,ft(s))}function tk(s,l,c){return c===t&&(c=l,l=t),c!==t&&(c=Ft(c),c=c===c?c:0),l!==t&&(l=Ft(l),l=l===l?l:0),Ir(Ft(s),l,c)}function nk(s,l,c){return l=Mn(l),c===t?(c=l,l=0):c=Mn(c),s=Ft(s),aw(s,l,c)}function rk(s,l,c){if(c&&typeof c!="boolean"&&nt(s,l,c)&&(l=c=t),c===t&&(typeof l=="boolean"?(c=l,l=t):typeof s=="boolean"&&(c=s,s=t)),s===t&&l===t?(s=0,l=1):(s=Mn(s),l===t?(l=s,s=0):l=Mn(l)),s>l){var h=s;s=l,l=h}if(c||s%1||l%1){var y=dh();return Qe(s+y*(l-s+Pb("1e-"+((y+"").length-1))),l)}return ku(s,l)}var ik=fi(function(s,l,c){return l=l.toLowerCase(),s+(c?Up(l):l)});function Up(s){return ju(ye(s).toLowerCase())}function Vp(s){return s=ye(s),s&&s.replace(ob,qb).replace(vb,"")}function sk(s,l,c){s=ye(s),l=kt(l);var h=s.length;c=c===t?h:Ir(Q(c),0,h);var y=c;return c-=l.length,c>=0&&s.slice(c,y)==l}function ok(s){return s=ye(s),s&&Hy.test(s)?s.replace(xd,jb):s}function lk(s){return s=ye(s),s&&Gy.test(s)?s.replace(Va,"\\$&"):s}var ak=fi(function(s,l,c){return s+(c?"-":"")+l.toLowerCase()}),uk=fi(function(s,l,c){return s+(c?" ":"")+l.toLowerCase()}),ck=Jh("toLowerCase");function fk(s,l,c){s=ye(s),l=Q(l);var h=l?ii(s):0;if(!l||h>=l)return s;var y=(l-h)/2;return Mo(mo(y),c)+s+Mo(po(y),c)}function dk(s,l,c){s=ye(s),l=Q(l);var h=l?ii(s):0;return l&&h<l?s+Mo(l-h,c):s}function hk(s,l,c){s=ye(s),l=Q(l);var h=l?ii(s):0;return l&&h<l?Mo(l-h,c)+s:s}function pk(s,l,c){return c||l==null?l=0:l&&(l=+l),x2(ye(s).replace(Ka,""),l||0)}function mk(s,l,c){return(c?nt(s,l,c):l===t)?l=1:l=Q(l),Eu(ye(s),l)}function gk(){var s=arguments,l=ye(s[0]);return s.length<3?l:l.replace(s[1],s[2])}var yk=fi(function(s,l,c){return s+(c?"_":"")+l.toLowerCase()});function bk(s,l,c){return c&&typeof c!="number"&&nt(s,l,c)&&(l=c=t),c=c===t?wt:c>>>0,c?(s=ye(s),s&&(typeof l=="string"||l!=null&&!Gu(l))&&(l=kt(l),!l&&ri(s))?ir(jt(s),0,c):s.split(l,c)):[]}var wk=fi(function(s,l,c){return s+(c?" ":"")+ju(l)});function Sk(s,l,c){return s=ye(s),c=c==null?0:Ir(Q(c),0,s.length),l=kt(l),s.slice(c,c+l.length)==l}function xk(s,l,c){var h=w.templateSettings;c&&nt(s,l,c)&&(l=t),s=ye(s),l=Ho({},l,h,ep);var y=Ho({},l.imports,h.imports,ep),S=He(y),k=ou(y,S),_,T,O=0,N=l.interpolate||Zs,R="__p += '",H=au((l.escape||Zs).source+"|"+N.source+"|"+(N===kd?eb:Zs).source+"|"+(l.evaluate||Zs).source+"|$","g"),G="//# sourceURL="+(Se.call(l,"sourceURL")?(l.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Ib+"]")+`
23
- `;s.replace(H,function(j,ie,ce,_t,rt,vt){return ce||(ce=_t),R+=s.slice(O,vt).replace(lb,Yb),ie&&(_=!0,R+=`' +
22
+ `)}function Gv(s){return Z(s)||Rr(s)||!!(ud&&s&&s[ud])}function Cn(s,l){var u=typeof s;return l=l??jn,!!l&&(u=="number"||u!="symbol"&&ib.test(s))&&s>-1&&s%1==0&&s<l}function rt(s,l,u){if(!Te(u))return!1;var d=typeof l;return(d=="number"?ft(u)&&Cn(l,u.length):d=="string"&&l in u)?Zt(u[l],s):!1}function Dc(s,l){if(Z(s))return!1;var u=typeof s;return u=="number"||u=="symbol"||u=="boolean"||s==null||Et(s)?!0:Uy.test(s)||!Wy.test(s)||l!=null&&s in we(l)}function Jv(s){var l=typeof s;return l=="string"||l=="number"||l=="symbol"||l=="boolean"?s!=="__proto__":s===null}function zc(s){var l=Ao(s),u=v[l];if(typeof u!="function"||!(l in se.prototype))return!1;if(s===u)return!0;var d=Rc(u);return!!d&&s===d[0]}function qv(s){return!!od&&od in s}var jv=io?Mn:eu;function is(s){var l=s&&s.constructor,u=typeof l=="function"&&l.prototype||si;return s===u}function op(s){return s===s&&!Te(s)}function lp(s,l){return function(u){return u==null?!1:u[s]===l&&(l!==t||s in we(u))}}function Yv(s){var l=Po(s,function(d){return u.size===h&&u.clear(),d}),u=l.cache;return l}function Xv(s,l){var u=s[1],d=l[1],y=u|d,w=y<(C|M|fe),x=d==fe&&u==F||d==fe&&u==be&&s[7].length<=l[8]||d==(fe|be)&&l[7].length<=l[8]&&u==F;if(!(w||x))return s;d&C&&(s[2]=l[2],y|=u&C?0:P);var E=l[3];if(E){var T=s[3];s[3]=T?Ud(T,E,l[4]):E,s[4]=T?Zn(s[3],m):l[4]}return E=l[5],E&&(T=s[5],s[5]=T?Vd(T,E,l[6]):E,s[6]=T?Zn(s[5],m):l[6]),E=l[7],E&&(s[7]=E),d&fe&&(s[8]=s[8]==null?l[8]:et(s[8],l[8])),s[9]==null&&(s[9]=l[9]),s[0]=l[0],s[1]=y,s}function Zv(s){var l=[];if(s!=null)for(var u in we(s))l.push(u);return l}function Qv(s){return oo.call(s)}function ap(s,l,u){return l=ze(l===t?s.length-1:l,0),function(){for(var d=arguments,y=-1,w=ze(d.length-l,0),x=A(w);++y<w;)x[y]=d[l+y];y=-1;for(var E=A(l+1);++y<l;)E[y]=d[y];return E[l]=u(x),St(s,this,E)}}function cp(s,l){return l.length<2?s:Ir(s,Bt(l,0,-1))}function ew(s,l){for(var u=s.length,d=et(l.length,u),y=ut(s);d--;){var w=l[d];s[d]=Cn(w,u)?y[w]:t}return s}function Bc(s,l){if(!(l==="constructor"&&typeof s[l]=="function")&&l!="__proto__")return s[l]}var up=hp(Rd),ss=m2||function(s,l){return je.setTimeout(s,l)},Fc=hp(kv);function fp(s,l,u){var d=l+"";return Fc(s,Kv(d,tw(Wv(d),u)))}function hp(s){var l=0,u=0;return function(){var d=v2(),y=Zr-(d-u);if(u=d,y>0){if(++l>=qn)return arguments[0]}else l=0;return s.apply(t,arguments)}}function Oo(s,l){var u=-1,d=s.length,y=d-1;for(l=l===t?d:l;++u<l;){var w=Sc(u,y),x=s[w];s[w]=s[u],s[u]=x}return s.length=l,s}var dp=Yv(function(s){var l=[];return s.charCodeAt(0)===46&&l.push(""),s.replace(Vy,function(u,d,y,w){l.push(y?w.replace(Zy,"$1"):d||u)}),l});function un(s){if(typeof s=="string"||Et(s))return s;var l=s+"";return l=="0"&&1/s==-1/0?"-0":l}function Nr(s){if(s!=null){try{return so.call(s)}catch{}try{return s+""}catch{}}return""}function tw(s,l){return Lt(Ra,function(u){var d="_."+u[0];l&u[1]&&!eo(s,d)&&s.push(d)}),s.sort()}function pp(s){if(s instanceof se)return s.clone();var l=new Dt(s.__wrapped__,s.__chain__);return l.__actions__=ut(s.__actions__),l.__index__=s.__index__,l.__values__=s.__values__,l}function nw(s,l,u){(u?rt(s,l,u):l===t)?l=1:l=ze(Q(l),0);var d=s==null?0:s.length;if(!d||l<1)return[];for(var y=0,w=0,x=A(ho(d/l));y<d;)x[w++]=Bt(s,y,y+=l);return x}function rw(s){for(var l=-1,u=s==null?0:s.length,d=0,y=[];++l<u;){var w=s[l];w&&(y[d++]=w)}return y}function iw(){var s=arguments.length;if(!s)return[];for(var l=A(s-1),u=arguments[0],d=s;d--;)l[d-1]=arguments[d];return Xn(Z(u)?ut(u):[u],Ye(l,1))}var sw=ne(function(s,l){return Oe(s)?Qi(s,Ye(l,1,Oe,!0)):[]}),ow=ne(function(s,l){var u=Ft(l);return Oe(u)&&(u=t),Oe(s)?Qi(s,Ye(l,1,Oe,!0),J(u,2)):[]}),lw=ne(function(s,l){var u=Ft(l);return Oe(u)&&(u=t),Oe(s)?Qi(s,Ye(l,1,Oe,!0),t,u):[]});function aw(s,l,u){var d=s==null?0:s.length;return d?(l=u||l===t?1:Q(l),Bt(s,l<0?0:l,d)):[]}function cw(s,l,u){var d=s==null?0:s.length;return d?(l=u||l===t?1:Q(l),l=d-l,Bt(s,0,l<0?0:l)):[]}function uw(s,l){return s&&s.length?ko(s,J(l,3),!0,!0):[]}function fw(s,l){return s&&s.length?ko(s,J(l,3),!0):[]}function hw(s,l,u,d){var y=s==null?0:s.length;return y?(u&&typeof u!="number"&&rt(s,l,u)&&(u=0,d=y),iv(s,l,u,d)):[]}function mp(s,l,u){var d=s==null?0:s.length;if(!d)return-1;var y=u==null?0:Q(u);return y<0&&(y=ze(d+y,0)),to(s,J(l,3),y)}function gp(s,l,u){var d=s==null?0:s.length;if(!d)return-1;var y=d-1;return u!==t&&(y=Q(u),y=u<0?ze(d+y,0):et(y,d-1)),to(s,J(l,3),y,!0)}function yp(s){var l=s==null?0:s.length;return l?Ye(s,1):[]}function dw(s){var l=s==null?0:s.length;return l?Ye(s,vt):[]}function pw(s,l){var u=s==null?0:s.length;return u?(l=l===t?1:Q(l),Ye(s,l)):[]}function mw(s){for(var l=-1,u=s==null?0:s.length,d={};++l<u;){var y=s[l];d[y[0]]=y[1]}return d}function bp(s){return s&&s.length?s[0]:t}function gw(s,l,u){var d=s==null?0:s.length;if(!d)return-1;var y=u==null?0:Q(u);return y<0&&(y=ze(d+y,0)),ti(s,l,y)}function yw(s){var l=s==null?0:s.length;return l?Bt(s,0,-1):[]}var bw=ne(function(s){var l=Ee(s,Tc);return l.length&&l[0]===s[0]?gc(l):[]}),vw=ne(function(s){var l=Ft(s),u=Ee(s,Tc);return l===Ft(u)?l=t:u.pop(),u.length&&u[0]===s[0]?gc(u,J(l,2)):[]}),ww=ne(function(s){var l=Ft(s),u=Ee(s,Tc);return l=typeof l=="function"?l:t,l&&u.pop(),u.length&&u[0]===s[0]?gc(u,t,l):[]});function Sw(s,l){return s==null?"":y2.call(s,l)}function Ft(s){var l=s==null?0:s.length;return l?s[l-1]:t}function xw(s,l,u){var d=s==null?0:s.length;if(!d)return-1;var y=d;return u!==t&&(y=Q(u),y=y<0?ze(d+y,0):et(y,d-1)),l===l?t2(s,l,y):to(s,Zh,y,!0)}function kw(s,l){return s&&s.length?Ad(s,Q(l)):t}var Ew=ne(vp);function vp(s,l){return s&&s.length&&l&&l.length?wc(s,l):s}function _w(s,l,u){return s&&s.length&&l&&l.length?wc(s,l,J(u,2)):s}function Tw(s,l,u){return s&&s.length&&l&&l.length?wc(s,l,t,u):s}var Cw=Tn(function(s,l){var u=s==null?0:s.length,d=hc(s,l);return Nd(s,Ee(l,function(y){return Cn(y,u)?+y:y}).sort(Wd)),d});function Mw(s,l){var u=[];if(!(s&&s.length))return u;var d=-1,y=[],w=s.length;for(l=J(l,3);++d<w;){var x=s[d];l(x,d,s)&&(u.push(x),y.push(d))}return Nd(s,y),u}function Hc(s){return s==null?s:S2.call(s)}function Aw(s,l,u){var d=s==null?0:s.length;return d?(u&&typeof u!="number"&&rt(s,l,u)?(l=0,u=d):(l=l==null?0:Q(l),u=u===t?d:Q(u)),Bt(s,l,u)):[]}function Iw(s,l){return xo(s,l)}function Ow(s,l,u){return kc(s,l,J(u,2))}function Nw(s,l){var u=s==null?0:s.length;if(u){var d=xo(s,l);if(d<u&&Zt(s[d],l))return d}return-1}function Rw(s,l){return xo(s,l,!0)}function Lw(s,l,u){return kc(s,l,J(u,2),!0)}function Pw(s,l){var u=s==null?0:s.length;if(u){var d=xo(s,l,!0)-1;if(Zt(s[d],l))return d}return-1}function Dw(s){return s&&s.length?Ld(s):[]}function zw(s,l){return s&&s.length?Ld(s,J(l,2)):[]}function Bw(s){var l=s==null?0:s.length;return l?Bt(s,1,l):[]}function Fw(s,l,u){return s&&s.length?(l=u||l===t?1:Q(l),Bt(s,0,l<0?0:l)):[]}function Hw(s,l,u){var d=s==null?0:s.length;return d?(l=u||l===t?1:Q(l),l=d-l,Bt(s,l<0?0:l,d)):[]}function $w(s,l){return s&&s.length?ko(s,J(l,3),!1,!0):[]}function Ww(s,l){return s&&s.length?ko(s,J(l,3)):[]}var Uw=ne(function(s){return tr(Ye(s,1,Oe,!0))}),Vw=ne(function(s){var l=Ft(s);return Oe(l)&&(l=t),tr(Ye(s,1,Oe,!0),J(l,2))}),Kw=ne(function(s){var l=Ft(s);return l=typeof l=="function"?l:t,tr(Ye(s,1,Oe,!0),t,l)});function Gw(s){return s&&s.length?tr(s):[]}function Jw(s,l){return s&&s.length?tr(s,J(l,2)):[]}function qw(s,l){return l=typeof l=="function"?l:t,s&&s.length?tr(s,t,l):[]}function $c(s){if(!(s&&s.length))return[];var l=0;return s=Yn(s,function(u){if(Oe(u))return l=ze(u.length,l),!0}),ic(l,function(u){return Ee(s,tc(u))})}function wp(s,l){if(!(s&&s.length))return[];var u=$c(s);return l==null?u:Ee(u,function(d){return St(l,t,d)})}var jw=ne(function(s,l){return Oe(s)?Qi(s,l):[]}),Yw=ne(function(s){return _c(Yn(s,Oe))}),Xw=ne(function(s){var l=Ft(s);return Oe(l)&&(l=t),_c(Yn(s,Oe),J(l,2))}),Zw=ne(function(s){var l=Ft(s);return l=typeof l=="function"?l:t,_c(Yn(s,Oe),t,l)}),Qw=ne($c);function eS(s,l){return Bd(s||[],l||[],Zi)}function tS(s,l){return Bd(s||[],l||[],ns)}var nS=ne(function(s){var l=s.length,u=l>1?s[l-1]:t;return u=typeof u=="function"?(s.pop(),u):t,wp(s,u)});function Sp(s){var l=v(s);return l.__chain__=!0,l}function rS(s,l){return l(s),s}function No(s,l){return l(s)}var iS=Tn(function(s){var l=s.length,u=l?s[0]:0,d=this.__wrapped__,y=function(w){return hc(w,s)};return l>1||this.__actions__.length||!(d instanceof se)||!Cn(u)?this.thru(y):(d=d.slice(u,+u+(l?1:0)),d.__actions__.push({func:No,args:[y],thisArg:t}),new Dt(d,this.__chain__).thru(function(w){return l&&!w.length&&w.push(t),w}))});function sS(){return Sp(this)}function oS(){return new Dt(this.value(),this.__chain__)}function lS(){this.__values__===t&&(this.__values__=Pp(this.value()));var s=this.__index__>=this.__values__.length,l=s?t:this.__values__[this.__index__++];return{done:s,value:l}}function aS(){return this}function cS(s){for(var l,u=this;u instanceof yo;){var d=pp(u);d.__index__=0,d.__values__=t,l?y.__wrapped__=d:l=d;var y=d;u=u.__wrapped__}return y.__wrapped__=s,l}function uS(){var s=this.__wrapped__;if(s instanceof se){var l=s;return this.__actions__.length&&(l=new se(this)),l=l.reverse(),l.__actions__.push({func:No,args:[Hc],thisArg:t}),new Dt(l,this.__chain__)}return this.thru(Hc)}function fS(){return zd(this.__wrapped__,this.__actions__)}var hS=Eo(function(s,l,u){ve.call(s,u)?++s[u]:En(s,u,1)});function dS(s,l,u){var d=Z(s)?Yh:rv;return u&&rt(s,l,u)&&(l=t),d(s,J(l,3))}function pS(s,l){var u=Z(s)?Yn:wd;return u(s,J(l,3))}var mS=qd(mp),gS=qd(gp);function yS(s,l){return Ye(Ro(s,l),1)}function bS(s,l){return Ye(Ro(s,l),vt)}function vS(s,l,u){return u=u===t?1:Q(u),Ye(Ro(s,l),u)}function xp(s,l){var u=Z(s)?Lt:er;return u(s,J(l,3))}function kp(s,l){var u=Z(s)?Bb:vd;return u(s,J(l,3))}var wS=Eo(function(s,l,u){ve.call(s,u)?s[u].push(l):En(s,u,[l])});function SS(s,l,u,d){s=ft(s)?s:di(s),u=u&&!d?Q(u):0;var y=s.length;return u<0&&(u=ze(y+u,0)),Bo(s)?u<=y&&s.indexOf(l,u)>-1:!!y&&ti(s,l,u)>-1}var xS=ne(function(s,l,u){var d=-1,y=typeof l=="function",w=ft(s)?A(s.length):[];return er(s,function(x){w[++d]=y?St(l,x,u):es(x,l,u)}),w}),kS=Eo(function(s,l,u){En(s,u,l)});function Ro(s,l){var u=Z(s)?Ee:Td;return u(s,J(l,3))}function ES(s,l,u,d){return s==null?[]:(Z(l)||(l=l==null?[]:[l]),u=d?t:u,Z(u)||(u=u==null?[]:[u]),Id(s,l,u))}var _S=Eo(function(s,l,u){s[u?0:1].push(l)},function(){return[[],[]]});function TS(s,l,u){var d=Z(s)?Qa:ed,y=arguments.length<3;return d(s,J(l,4),u,y,er)}function CS(s,l,u){var d=Z(s)?Fb:ed,y=arguments.length<3;return d(s,J(l,4),u,y,vd)}function MS(s,l){var u=Z(s)?Yn:wd;return u(s,Do(J(l,3)))}function AS(s){var l=Z(s)?md:Sv;return l(s)}function IS(s,l,u){(u?rt(s,l,u):l===t)?l=1:l=Q(l);var d=Z(s)?Z2:xv;return d(s,l)}function OS(s){var l=Z(s)?Q2:Ev;return l(s)}function NS(s){if(s==null)return 0;if(ft(s))return Bo(s)?ri(s):s.length;var l=tt(s);return l==qt||l==jt?s.size:bc(s).length}function RS(s,l,u){var d=Z(s)?ec:_v;return u&&rt(s,l,u)&&(l=t),d(s,J(l,3))}var LS=ne(function(s,l){if(s==null)return[];var u=l.length;return u>1&&rt(s,l[0],l[1])?l=[]:u>2&&rt(l[0],l[1],l[2])&&(l=[l[0]]),Id(s,Ye(l,1),[])}),Lo=p2||function(){return je.Date.now()};function PS(s,l){if(typeof l!="function")throw new Pt(a);return s=Q(s),function(){if(--s<1)return l.apply(this,arguments)}}function Ep(s,l,u){return l=u?t:l,l=s&&l==null?s.length:l,_n(s,fe,t,t,t,t,l)}function _p(s,l){var u;if(typeof l!="function")throw new Pt(a);return s=Q(s),function(){return--s>0&&(u=l.apply(this,arguments)),s<=1&&(l=t),u}}var Wc=ne(function(s,l,u){var d=C;if(u.length){var y=Zn(u,fi(Wc));d|=U}return _n(s,d,l,u,y)}),Tp=ne(function(s,l,u){var d=C|M;if(u.length){var y=Zn(u,fi(Tp));d|=U}return _n(l,d,s,u,y)});function Cp(s,l,u){l=u?t:l;var d=_n(s,F,t,t,t,t,t,l);return d.placeholder=Cp.placeholder,d}function Mp(s,l,u){l=u?t:l;var d=_n(s,$,t,t,t,t,t,l);return d.placeholder=Mp.placeholder,d}function Ap(s,l,u){var d,y,w,x,E,T,O=0,N=!1,R=!1,H=!0;if(typeof s!="function")throw new Pt(a);l=Ht(l)||0,Te(u)&&(N=!!u.leading,R="maxWait"in u,w=R?ze(Ht(u.maxWait)||0,l):w,H="trailing"in u?!!u.trailing:H);function G(Ne){var Qt=d,In=y;return d=y=t,O=Ne,x=s.apply(In,Qt),x}function q(Ne){return O=Ne,E=ss(ie,l),N?G(Ne):x}function ee(Ne){var Qt=Ne-T,In=Ne-O,qp=l-Qt;return R?et(qp,w-In):qp}function j(Ne){var Qt=Ne-T,In=Ne-O;return T===t||Qt>=l||Qt<0||R&&In>=w}function ie(){var Ne=Lo();if(j(Ne))return ue(Ne);E=ss(ie,ee(Ne))}function ue(Ne){return E=t,H&&d?G(Ne):(d=y=t,x)}function _t(){E!==t&&Fd(E),O=0,d=T=y=E=t}function it(){return E===t?x:ue(Lo())}function Tt(){var Ne=Lo(),Qt=j(Ne);if(d=arguments,y=this,T=Ne,Qt){if(E===t)return q(T);if(R)return Fd(E),E=ss(ie,l),G(T)}return E===t&&(E=ss(ie,l)),x}return Tt.cancel=_t,Tt.flush=it,Tt}var DS=ne(function(s,l){return bd(s,1,l)}),zS=ne(function(s,l,u){return bd(s,Ht(l)||0,u)});function BS(s){return _n(s,bt)}function Po(s,l){if(typeof s!="function"||l!=null&&typeof l!="function")throw new Pt(a);var u=function(){var d=arguments,y=l?l.apply(this,d):d[0],w=u.cache;if(w.has(y))return w.get(y);var x=s.apply(this,d);return u.cache=w.set(y,x)||w,x};return u.cache=new(Po.Cache||kn),u}Po.Cache=kn;function Do(s){if(typeof s!="function")throw new Pt(a);return function(){var l=arguments;switch(l.length){case 0:return!s.call(this);case 1:return!s.call(this,l[0]);case 2:return!s.call(this,l[0],l[1]);case 3:return!s.call(this,l[0],l[1],l[2])}return!s.apply(this,l)}}function FS(s){return _p(2,s)}var HS=Tv(function(s,l){l=l.length==1&&Z(l[0])?Ee(l[0],xt(J())):Ee(Ye(l,1),xt(J()));var u=l.length;return ne(function(d){for(var y=-1,w=et(d.length,u);++y<w;)d[y]=l[y].call(this,d[y]);return St(s,this,d)})}),Uc=ne(function(s,l){var u=Zn(l,fi(Uc));return _n(s,U,t,l,u)}),Ip=ne(function(s,l){var u=Zn(l,fi(Ip));return _n(s,ce,t,l,u)}),$S=Tn(function(s,l){return _n(s,be,t,t,t,l)});function WS(s,l){if(typeof s!="function")throw new Pt(a);return l=l===t?l:Q(l),ne(s,l)}function US(s,l){if(typeof s!="function")throw new Pt(a);return l=l==null?0:ze(Q(l),0),ne(function(u){var d=u[l],y=rr(u,0,l);return d&&Xn(y,d),St(s,this,y)})}function VS(s,l,u){var d=!0,y=!0;if(typeof s!="function")throw new Pt(a);return Te(u)&&(d="leading"in u?!!u.leading:d,y="trailing"in u?!!u.trailing:y),Ap(s,l,{leading:d,maxWait:l,trailing:y})}function KS(s){return Ep(s,1)}function GS(s,l){return Uc(Cc(l),s)}function JS(){if(!arguments.length)return[];var s=arguments[0];return Z(s)?s:[s]}function qS(s){return zt(s,b)}function jS(s,l){return l=typeof l=="function"?l:t,zt(s,b,l)}function YS(s){return zt(s,p|b)}function XS(s,l){return l=typeof l=="function"?l:t,zt(s,p|b,l)}function ZS(s,l){return l==null||yd(s,l,$e(l))}function Zt(s,l){return s===l||s!==s&&l!==l}var QS=Mo(mc),e5=Mo(function(s,l){return s>=l}),Rr=kd(function(){return arguments}())?kd:function(s){return Me(s)&&ve.call(s,"callee")&&!cd.call(s,"callee")},Z=A.isArray,t5=Vh?xt(Vh):cv;function ft(s){return s!=null&&zo(s.length)&&!Mn(s)}function Oe(s){return Me(s)&&ft(s)}function n5(s){return s===!0||s===!1||Me(s)&&nt(s)==Fi}var ir=g2||eu,r5=Kh?xt(Kh):uv;function i5(s){return Me(s)&&s.nodeType===1&&!ls(s)}function s5(s){if(s==null)return!0;if(ft(s)&&(Z(s)||typeof s=="string"||typeof s.splice=="function"||ir(s)||hi(s)||Rr(s)))return!s.length;var l=tt(s);if(l==qt||l==jt)return!s.size;if(is(s))return!bc(s).length;for(var u in s)if(ve.call(s,u))return!1;return!0}function o5(s,l){return ts(s,l)}function l5(s,l,u){u=typeof u=="function"?u:t;var d=u?u(s,l):t;return d===t?ts(s,l,t,u):!!d}function Vc(s){if(!Me(s))return!1;var l=nt(s);return l==qs||l==Iy||typeof s.message=="string"&&typeof s.name=="string"&&!ls(s)}function a5(s){return typeof s=="number"&&fd(s)}function Mn(s){if(!Te(s))return!1;var l=nt(s);return l==js||l==bh||l==Ay||l==Ny}function Op(s){return typeof s=="number"&&s==Q(s)}function zo(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=jn}function Te(s){var l=typeof s;return s!=null&&(l=="object"||l=="function")}function Me(s){return s!=null&&typeof s=="object"}var Np=Gh?xt(Gh):hv;function c5(s,l){return s===l||yc(s,l,Lc(l))}function u5(s,l,u){return u=typeof u=="function"?u:t,yc(s,l,Lc(l),u)}function f5(s){return Rp(s)&&s!=+s}function h5(s){if(jv(s))throw new X(o);return Ed(s)}function d5(s){return s===null}function p5(s){return s==null}function Rp(s){return typeof s=="number"||Me(s)&&nt(s)==$i}function ls(s){if(!Me(s)||nt(s)!=Sn)return!1;var l=co(s);if(l===null)return!0;var u=ve.call(l,"constructor")&&l.constructor;return typeof u=="function"&&u instanceof u&&so.call(u)==u2}var Kc=Jh?xt(Jh):dv;function m5(s){return Op(s)&&s>=-9007199254740991&&s<=jn}var Lp=qh?xt(qh):pv;function Bo(s){return typeof s=="string"||!Z(s)&&Me(s)&&nt(s)==Ui}function Et(s){return typeof s=="symbol"||Me(s)&&nt(s)==Ys}var hi=jh?xt(jh):mv;function g5(s){return s===t}function y5(s){return Me(s)&&tt(s)==Vi}function b5(s){return Me(s)&&nt(s)==Ly}var v5=Mo(vc),w5=Mo(function(s,l){return s<=l});function Pp(s){if(!s)return[];if(ft(s))return Bo(s)?Yt(s):ut(s);if(Ji&&s[Ji])return Zb(s[Ji]());var l=tt(s),u=l==qt?oc:l==jt?no:di;return u(s)}function An(s){if(!s)return s===0?s:0;if(s=Ht(s),s===vt||s===-1/0){var l=s<0?-1:1;return l*Gs}return s===s?s:0}function Q(s){var l=An(s),u=l%1;return l===l?u?l-u:l:0}function Dp(s){return s?Ar(Q(s),0,wt):0}function Ht(s){if(typeof s=="number")return s;if(Et(s))return ln;if(Te(s)){var l=typeof s.valueOf=="function"?s.valueOf():s;s=Te(l)?l+"":l}if(typeof s!="string")return s===0?s:+s;s=td(s);var u=tb.test(s);return u||rb.test(s)?Pb(s.slice(2),u?2:8):eb.test(s)?ln:+s}function zp(s){return cn(s,ht(s))}function S5(s){return s?Ar(Q(s),-9007199254740991,jn):s===0?s:0}function ge(s){return s==null?"":kt(s)}var x5=ci(function(s,l){if(is(l)||ft(l)){cn(l,$e(l),s);return}for(var u in l)ve.call(l,u)&&Zi(s,u,l[u])}),Bp=ci(function(s,l){cn(l,ht(l),s)}),Fo=ci(function(s,l,u,d){cn(l,ht(l),s,d)}),k5=ci(function(s,l,u,d){cn(l,$e(l),s,d)}),E5=Tn(hc);function _5(s,l){var u=ai(s);return l==null?u:gd(u,l)}var T5=ne(function(s,l){s=we(s);var u=-1,d=l.length,y=d>2?l[2]:t;for(y&&rt(l[0],l[1],y)&&(d=1);++u<d;)for(var w=l[u],x=ht(w),E=-1,T=x.length;++E<T;){var O=x[E],N=s[O];(N===t||Zt(N,si[O])&&!ve.call(s,O))&&(s[O]=w[O])}return s}),C5=ne(function(s){return s.push(t,tp),St(Fp,t,s)});function M5(s,l){return Xh(s,J(l,3),an)}function A5(s,l){return Xh(s,J(l,3),pc)}function I5(s,l){return s==null?s:dc(s,J(l,3),ht)}function O5(s,l){return s==null?s:Sd(s,J(l,3),ht)}function N5(s,l){return s&&an(s,J(l,3))}function R5(s,l){return s&&pc(s,J(l,3))}function L5(s){return s==null?[]:wo(s,$e(s))}function P5(s){return s==null?[]:wo(s,ht(s))}function Gc(s,l,u){var d=s==null?t:Ir(s,l);return d===t?u:d}function D5(s,l){return s!=null&&ip(s,l,sv)}function Jc(s,l){return s!=null&&ip(s,l,ov)}var z5=Yd(function(s,l,u){l!=null&&typeof l.toString!="function"&&(l=oo.call(l)),s[l]=u},jc(dt)),B5=Yd(function(s,l,u){l!=null&&typeof l.toString!="function"&&(l=oo.call(l)),ve.call(s,l)?s[l].push(u):s[l]=[u]},J),F5=ne(es);function $e(s){return ft(s)?pd(s):bc(s)}function ht(s){return ft(s)?pd(s,!0):gv(s)}function H5(s,l){var u={};return l=J(l,3),an(s,function(d,y,w){En(u,l(d,y,w),d)}),u}function $5(s,l){var u={};return l=J(l,3),an(s,function(d,y,w){En(u,y,l(d,y,w))}),u}var W5=ci(function(s,l,u){So(s,l,u)}),Fp=ci(function(s,l,u,d){So(s,l,u,d)}),U5=Tn(function(s,l){var u={};if(s==null)return u;var d=!1;l=Ee(l,function(w){return w=nr(w,s),d||(d=w.length>1),w}),cn(s,Nc(s),u),d&&(u=zt(u,p|g|b,zv));for(var y=l.length;y--;)Ec(u,l[y]);return u});function V5(s,l){return Hp(s,Do(J(l)))}var K5=Tn(function(s,l){return s==null?{}:bv(s,l)});function Hp(s,l){if(s==null)return{};var u=Ee(Nc(s),function(d){return[d]});return l=J(l),Od(s,u,function(d,y){return l(d,y[0])})}function G5(s,l,u){l=nr(l,s);var d=-1,y=l.length;for(y||(y=1,s=t);++d<y;){var w=s==null?t:s[un(l[d])];w===t&&(d=y,w=u),s=Mn(w)?w.call(s):w}return s}function J5(s,l,u){return s==null?s:ns(s,l,u)}function q5(s,l,u,d){return d=typeof d=="function"?d:t,s==null?s:ns(s,l,u,d)}var $p=Qd($e),Wp=Qd(ht);function j5(s,l,u){var d=Z(s),y=d||ir(s)||hi(s);if(l=J(l,4),u==null){var w=s&&s.constructor;y?u=d?new w:[]:Te(s)?u=Mn(w)?ai(co(s)):{}:u={}}return(y?Lt:an)(s,function(x,E,T){return l(u,x,E,T)}),u}function Y5(s,l){return s==null?!0:Ec(s,l)}function X5(s,l,u){return s==null?s:Dd(s,l,Cc(u))}function Z5(s,l,u,d){return d=typeof d=="function"?d:t,s==null?s:Dd(s,l,Cc(u),d)}function di(s){return s==null?[]:sc(s,$e(s))}function Q5(s){return s==null?[]:sc(s,ht(s))}function ex(s,l,u){return u===t&&(u=l,l=t),u!==t&&(u=Ht(u),u=u===u?u:0),l!==t&&(l=Ht(l),l=l===l?l:0),Ar(Ht(s),l,u)}function tx(s,l,u){return l=An(l),u===t?(u=l,l=0):u=An(u),s=Ht(s),lv(s,l,u)}function nx(s,l,u){if(u&&typeof u!="boolean"&&rt(s,l,u)&&(l=u=t),u===t&&(typeof l=="boolean"?(u=l,l=t):typeof s=="boolean"&&(u=s,s=t)),s===t&&l===t?(s=0,l=1):(s=An(s),l===t?(l=s,s=0):l=An(l)),s>l){var d=s;s=l,l=d}if(u||s%1||l%1){var y=hd();return et(s+y*(l-s+Lb("1e-"+((y+"").length-1))),l)}return Sc(s,l)}var rx=ui(function(s,l,u){return l=l.toLowerCase(),s+(u?Up(l):l)});function Up(s){return qc(ge(s).toLowerCase())}function Vp(s){return s=ge(s),s&&s.replace(sb,Jb).replace(Eb,"")}function ix(s,l,u){s=ge(s),l=kt(l);var d=s.length;u=u===t?d:Ar(Q(u),0,d);var y=u;return u-=l.length,u>=0&&s.slice(u,y)==l}function sx(s){return s=ge(s),s&&Fy.test(s)?s.replace(Sh,qb):s}function ox(s){return s=ge(s),s&&Ky.test(s)?s.replace(Ua,"\\$&"):s}var lx=ui(function(s,l,u){return s+(u?"-":"")+l.toLowerCase()}),ax=ui(function(s,l,u){return s+(u?" ":"")+l.toLowerCase()}),cx=Jd("toLowerCase");function ux(s,l,u){s=ge(s),l=Q(l);var d=l?ri(s):0;if(!l||d>=l)return s;var y=(l-d)/2;return Co(po(y),u)+s+Co(ho(y),u)}function fx(s,l,u){s=ge(s),l=Q(l);var d=l?ri(s):0;return l&&d<l?s+Co(l-d,u):s}function hx(s,l,u){s=ge(s),l=Q(l);var d=l?ri(s):0;return l&&d<l?Co(l-d,u)+s:s}function dx(s,l,u){return u||l==null?l=0:l&&(l=+l),w2(ge(s).replace(Va,""),l||0)}function px(s,l,u){return(u?rt(s,l,u):l===t)?l=1:l=Q(l),xc(ge(s),l)}function mx(){var s=arguments,l=ge(s[0]);return s.length<3?l:l.replace(s[1],s[2])}var gx=ui(function(s,l,u){return s+(u?"_":"")+l.toLowerCase()});function yx(s,l,u){return u&&typeof u!="number"&&rt(s,l,u)&&(l=u=t),u=u===t?wt:u>>>0,u?(s=ge(s),s&&(typeof l=="string"||l!=null&&!Kc(l))&&(l=kt(l),!l&&ni(s))?rr(Yt(s),0,u):s.split(l,u)):[]}var bx=ui(function(s,l,u){return s+(u?" ":"")+qc(l)});function vx(s,l,u){return s=ge(s),u=u==null?0:Ar(Q(u),0,s.length),l=kt(l),s.slice(u,u+l.length)==l}function wx(s,l,u){var d=v.templateSettings;u&&rt(s,l,u)&&(l=t),s=ge(s),l=Fo({},l,d,ep);var y=Fo({},l.imports,d.imports,ep),w=$e(y),x=sc(y,w),E,T,O=0,N=l.interpolate||Xs,R="__p += '",H=lc((l.escape||Xs).source+"|"+N.source+"|"+(N===xh?Qy:Xs).source+"|"+(l.evaluate||Xs).source+"|$","g"),G="//# sourceURL="+(ve.call(l,"sourceURL")?(l.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Ab+"]")+`
23
+ `;s.replace(H,function(j,ie,ue,_t,it,Tt){return ue||(ue=_t),R+=s.slice(O,Tt).replace(ob,jb),ie&&(E=!0,R+=`' +
24
24
  __e(`+ie+`) +
25
- '`),rt&&(T=!0,R+=`';
26
- `+rt+`;
27
- __p += '`),ce&&(R+=`' +
28
- ((__t = (`+ce+`)) == null ? '' : __t) +
29
- '`),O=vt+j.length,j}),R+=`';
30
- `;var q=Se.call(l,"variable")&&l.variable;if(!q)R=`with (obj) {
25
+ '`),it&&(T=!0,R+=`';
26
+ `+it+`;
27
+ __p += '`),ue&&(R+=`' +
28
+ ((__t = (`+ue+`)) == null ? '' : __t) +
29
+ '`),O=Tt+j.length,j}),R+=`';
30
+ `;var q=ve.call(l,"variable")&&l.variable;if(!q)R=`with (obj) {
31
31
  `+R+`
32
32
  }
33
- `;else if(Zy.test(q))throw new X(u);R=(T?R.replace(Dy,""):R).replace(zy,"$1").replace(By,"$1;"),R="function("+(q||"obj")+`) {
33
+ `;else if(Xy.test(q))throw new X(c);R=(T?R.replace(Py,""):R).replace(Dy,"$1").replace(zy,"$1;"),R="function("+(q||"obj")+`) {
34
34
  `+(q?"":`obj || (obj = {});
35
- `)+"var __t, __p = ''"+(_?", __e = _.escape":"")+(T?`, __j = Array.prototype.join;
35
+ `)+"var __t, __p = ''"+(E?", __e = _.escape":"")+(T?`, __j = Array.prototype.join;
36
36
  function print() { __p += __j.call(arguments, '') }
37
37
  `:`;
38
38
  `)+R+`return __p
39
- }`;var ee=Gp(function(){return ge(S,G+"return "+R).apply(t,k)});if(ee.source=R,Ku(ee))throw ee;return ee}function kk(s){return ye(s).toLowerCase()}function Ek(s){return ye(s).toUpperCase()}function _k(s,l,c){if(s=ye(s),s&&(c||l===t))return th(s);if(!s||!(l=kt(l)))return s;var h=jt(s),y=jt(l),S=nh(h,y),k=rh(h,y)+1;return ir(h,S,k).join("")}function vk(s,l,c){if(s=ye(s),s&&(c||l===t))return s.slice(0,sh(s)+1);if(!s||!(l=kt(l)))return s;var h=jt(s),y=rh(h,jt(l))+1;return ir(h,0,y).join("")}function Tk(s,l,c){if(s=ye(s),s&&(c||l===t))return s.replace(Ka,"");if(!s||!(l=kt(l)))return s;var h=jt(s),y=nh(h,jt(l));return ir(h,y).join("")}function Ck(s,l){var c=Jn,h=sn;if(Ce(l)){var y="separator"in l?l.separator:y;c="length"in l?Q(l.length):c,h="omission"in l?kt(l.omission):h}s=ye(s);var S=s.length;if(ri(s)){var k=jt(s);S=k.length}if(c>=S)return s;var _=c-ii(h);if(_<1)return h;var T=k?ir(k,0,_).join(""):s.slice(0,_);if(y===t)return T+h;if(k&&(_+=T.length-_),Gu(y)){if(s.slice(_).search(y)){var O,N=T;for(y.global||(y=au(y.source,ye(Ed.exec(y))+"g")),y.lastIndex=0;O=y.exec(N);)var R=O.index;T=T.slice(0,R===t?_:R)}}else if(s.indexOf(kt(y),_)!=_){var H=T.lastIndexOf(y);H>-1&&(T=T.slice(0,H))}return T+h}function Mk(s){return s=ye(s),s&&Fy.test(s)?s.replace(Sd,r2):s}var Ak=fi(function(s,l,c){return s+(c?" ":"")+l.toUpperCase()}),ju=Jh("toUpperCase");function Kp(s,l,c){return s=ye(s),l=c?t:l,l===t?Zb(s)?o2(s):Ub(s):s.match(l)||[]}var Gp=ne(function(s,l){try{return St(s,t,l)}catch(c){return Ku(c)?c:new X(c)}}),Ik=vn(function(s,l){return Rt(l,function(c){c=cn(c),En(s,c,Uu(s[c],s))}),s});function Ok(s){var l=s==null?0:s.length,c=J();return s=l?ve(s,function(h){if(typeof h[1]!="function")throw new Lt(a);return[c(h[0]),h[1]]}):[],ne(function(h){for(var y=-1;++y<l;){var S=s[y];if(St(S[0],this,h))return St(S[1],this,h)}})}function Nk(s){return rw(Dt(s,p))}function Yu(s){return function(){return s}}function Rk(s,l){return s==null||s!==s?l:s}var Lk=jh(),Pk=jh(!0);function dt(s){return s}function Xu(s){return vh(typeof s=="function"?s:Dt(s,p))}function Dk(s){return Ch(Dt(s,p))}function zk(s,l){return Mh(s,Dt(l,p))}var Bk=ne(function(s,l){return function(c){return ts(c,s,l)}}),Fk=ne(function(s,l){return function(c){return ts(s,c,l)}});function Zu(s,l,c){var h=He(l),y=xo(l,h);c==null&&!(Ce(l)&&(y.length||!h.length))&&(c=l,l=s,s=this,y=xo(l,He(l)));var S=!(Ce(c)&&"chain"in c)||!!c.chain,k=Cn(s);return Rt(y,function(_){var T=l[_];s[_]=T,k&&(s.prototype[_]=function(){var O=this.__chain__;if(S||O){var N=s(this.__wrapped__),R=N.__actions__=ut(this.__actions__);return R.push({func:T,args:arguments,thisArg:s}),N.__chain__=O,N}return T.apply(s,Xn([this.value()],arguments))})}),s}function Hk(){return qe._===this&&(qe._=d2),this}function Qu(){}function $k(s){return s=Q(s),ne(function(l){return Ah(l,s)})}var Wk=Iu(ve),Uk=Iu(Yd),Vk=Iu(tu);function Jp(s){return zu(s)?nu(cn(s)):Sw(s)}function Kk(s){return function(l){return s==null?t:Or(s,l)}}var Gk=Xh(),Jk=Xh(!0);function ec(){return[]}function tc(){return!1}function qk(){return{}}function jk(){return""}function Yk(){return!0}function Xk(s,l){if(s=Q(s),s<1||s>jn)return[];var c=wt,h=Qe(s,wt);l=J(l),s-=wt;for(var y=su(h,l);++c<s;)l(c);return y}function Zk(s){return Z(s)?ve(s,cn):Et(s)?[s]:ut(hp(ye(s)))}function Qk(s){var l=++c2;return ye(s)+l}var eE=Co(function(s,l){return s+l},0),tE=Ou("ceil"),nE=Co(function(s,l){return s/l},1),rE=Ou("floor");function iE(s){return s&&s.length?So(s,dt,gu):t}function sE(s,l){return s&&s.length?So(s,J(l,2),gu):t}function oE(s){return Qd(s,dt)}function lE(s,l){return Qd(s,J(l,2))}function aE(s){return s&&s.length?So(s,dt,Su):t}function uE(s,l){return s&&s.length?So(s,J(l,2),Su):t}var cE=Co(function(s,l){return s*l},1),fE=Ou("round"),dE=Co(function(s,l){return s-l},0);function hE(s){return s&&s.length?iu(s,dt):0}function pE(s,l){return s&&s.length?iu(s,J(l,2)):0}return w.after=D5,w.ary=_p,w.assign=Ex,w.assignIn=Bp,w.assignInWith=Ho,w.assignWith=_x,w.at=vx,w.before=vp,w.bind=Uu,w.bindAll=Ik,w.bindKey=Tp,w.castArray=q5,w.chain=xp,w.chunk=rS,w.compact=iS,w.concat=sS,w.cond=Ok,w.conforms=Nk,w.constant=Yu,w.countBy=h5,w.create=Tx,w.curry=Cp,w.curryRight=Mp,w.debounce=Ap,w.defaults=Cx,w.defaultsDeep=Mx,w.defer=z5,w.delay=B5,w.difference=oS,w.differenceBy=lS,w.differenceWith=aS,w.drop=uS,w.dropRight=cS,w.dropRightWhile=fS,w.dropWhile=dS,w.fill=hS,w.filter=m5,w.flatMap=b5,w.flatMapDeep=w5,w.flatMapDepth=S5,w.flatten=yp,w.flattenDeep=pS,w.flattenDepth=mS,w.flip=F5,w.flow=Lk,w.flowRight=Pk,w.fromPairs=gS,w.functions=Px,w.functionsIn=Dx,w.groupBy=x5,w.initial=bS,w.intersection=wS,w.intersectionBy=SS,w.intersectionWith=xS,w.invert=Bx,w.invertBy=Fx,w.invokeMap=E5,w.iteratee=Xu,w.keyBy=_5,w.keys=He,w.keysIn=ft,w.map=Lo,w.mapKeys=$x,w.mapValues=Wx,w.matches=Dk,w.matchesProperty=zk,w.memoize=Do,w.merge=Ux,w.mergeWith=Fp,w.method=Bk,w.methodOf=Fk,w.mixin=Zu,w.negate=zo,w.nthArg=$k,w.omit=Vx,w.omitBy=Kx,w.once=H5,w.orderBy=v5,w.over=Wk,w.overArgs=$5,w.overEvery=Uk,w.overSome=Vk,w.partial=Vu,w.partialRight=Ip,w.partition=T5,w.pick=Gx,w.pickBy=Hp,w.property=Jp,w.propertyOf=Kk,w.pull=vS,w.pullAll=wp,w.pullAllBy=TS,w.pullAllWith=CS,w.pullAt=MS,w.range=Gk,w.rangeRight=Jk,w.rearg=W5,w.reject=A5,w.remove=AS,w.rest=U5,w.reverse=$u,w.sampleSize=O5,w.set=qx,w.setWith=jx,w.shuffle=N5,w.slice=IS,w.sortBy=P5,w.sortedUniq=zS,w.sortedUniqBy=BS,w.split=bk,w.spread=V5,w.tail=FS,w.take=HS,w.takeRight=$S,w.takeRightWhile=WS,w.takeWhile=US,w.tap=i5,w.throttle=K5,w.thru=Ro,w.toArray=Pp,w.toPairs=$p,w.toPairsIn=Wp,w.toPath=Zk,w.toPlainObject=zp,w.transform=Yx,w.unary=G5,w.union=VS,w.unionBy=KS,w.unionWith=GS,w.uniq=JS,w.uniqBy=qS,w.uniqWith=jS,w.unset=Xx,w.unzip=Wu,w.unzipWith=Sp,w.update=Zx,w.updateWith=Qx,w.values=pi,w.valuesIn=ek,w.without=YS,w.words=Kp,w.wrap=J5,w.xor=XS,w.xorBy=ZS,w.xorWith=QS,w.zip=e5,w.zipObject=t5,w.zipObjectDeep=n5,w.zipWith=r5,w.entries=$p,w.entriesIn=Wp,w.extend=Bp,w.extendWith=Ho,Zu(w,w),w.add=eE,w.attempt=Gp,w.camelCase=ik,w.capitalize=Up,w.ceil=tE,w.clamp=tk,w.clone=j5,w.cloneDeep=X5,w.cloneDeepWith=Z5,w.cloneWith=Y5,w.conformsTo=Q5,w.deburr=Vp,w.defaultTo=Rk,w.divide=nE,w.endsWith=sk,w.eq=Xt,w.escape=ok,w.escapeRegExp=lk,w.every=p5,w.find=g5,w.findIndex=mp,w.findKey=Ax,w.findLast=y5,w.findLastIndex=gp,w.findLastKey=Ix,w.floor=rE,w.forEach=kp,w.forEachRight=Ep,w.forIn=Ox,w.forInRight=Nx,w.forOwn=Rx,w.forOwnRight=Lx,w.get=Ju,w.gt=ex,w.gte=tx,w.has=zx,w.hasIn=qu,w.head=bp,w.identity=dt,w.includes=k5,w.indexOf=yS,w.inRange=nk,w.invoke=Hx,w.isArguments=Lr,w.isArray=Z,w.isArrayBuffer=nx,w.isArrayLike=ct,w.isArrayLikeObject=Oe,w.isBoolean=rx,w.isBuffer=sr,w.isDate=ix,w.isElement=sx,w.isEmpty=ox,w.isEqual=lx,w.isEqualWith=ax,w.isError=Ku,w.isFinite=ux,w.isFunction=Cn,w.isInteger=Op,w.isLength=Bo,w.isMap=Np,w.isMatch=cx,w.isMatchWith=fx,w.isNaN=dx,w.isNative=hx,w.isNil=mx,w.isNull=px,w.isNumber=Rp,w.isObject=Ce,w.isObjectLike=Me,w.isPlainObject=as,w.isRegExp=Gu,w.isSafeInteger=gx,w.isSet=Lp,w.isString=Fo,w.isSymbol=Et,w.isTypedArray=hi,w.isUndefined=yx,w.isWeakMap=bx,w.isWeakSet=wx,w.join=kS,w.kebabCase=ak,w.last=Bt,w.lastIndexOf=ES,w.lowerCase=uk,w.lowerFirst=ck,w.lt=Sx,w.lte=xx,w.max=iE,w.maxBy=sE,w.mean=oE,w.meanBy=lE,w.min=aE,w.minBy=uE,w.stubArray=ec,w.stubFalse=tc,w.stubObject=qk,w.stubString=jk,w.stubTrue=Yk,w.multiply=cE,w.nth=_S,w.noConflict=Hk,w.noop=Qu,w.now=Po,w.pad=fk,w.padEnd=dk,w.padStart=hk,w.parseInt=pk,w.random=rk,w.reduce=C5,w.reduceRight=M5,w.repeat=mk,w.replace=gk,w.result=Jx,w.round=fE,w.runInContext=v,w.sample=I5,w.size=R5,w.snakeCase=yk,w.some=L5,w.sortedIndex=OS,w.sortedIndexBy=NS,w.sortedIndexOf=RS,w.sortedLastIndex=LS,w.sortedLastIndexBy=PS,w.sortedLastIndexOf=DS,w.startCase=wk,w.startsWith=Sk,w.subtract=dE,w.sum=hE,w.sumBy=pE,w.template=xk,w.times=Xk,w.toFinite=Mn,w.toInteger=Q,w.toLength=Dp,w.toLower=kk,w.toNumber=Ft,w.toSafeInteger=kx,w.toString=ye,w.toUpper=Ek,w.trim=_k,w.trimEnd=vk,w.trimStart=Tk,w.truncate=Ck,w.unescape=Mk,w.uniqueId=Qk,w.upperCase=Ak,w.upperFirst=ju,w.each=kp,w.eachRight=Ep,w.first=bp,Zu(w,function(){var s={};return an(w,function(l,c){Se.call(w.prototype,c)||(s[c]=l)}),s}(),{chain:!1}),w.VERSION=r,Rt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(s){w[s].placeholder=w}),Rt(["drop","take"],function(s,l){se.prototype[s]=function(c){c=c===t?1:De(Q(c),0);var h=this.__filtered__&&!l?new se(this):this.clone();return h.__filtered__?h.__takeCount__=Qe(c,h.__takeCount__):h.__views__.push({size:Qe(c,wt),type:s+(h.__dir__<0?"Right":"")}),h},se.prototype[s+"Right"]=function(c){return this.reverse()[s](c).reverse()}}),Rt(["filter","map","takeWhile"],function(s,l){var c=l+1,h=c==on||c==Fe;se.prototype[s]=function(y){var S=this.clone();return S.__iteratees__.push({iteratee:J(y,3),type:c}),S.__filtered__=S.__filtered__||h,S}}),Rt(["head","last"],function(s,l){var c="take"+(l?"Right":"");se.prototype[s]=function(){return this[c](1).value()[0]}}),Rt(["initial","tail"],function(s,l){var c="drop"+(l?"":"Right");se.prototype[s]=function(){return this.__filtered__?new se(this):this[c](1)}}),se.prototype.compact=function(){return this.filter(dt)},se.prototype.find=function(s){return this.filter(s).head()},se.prototype.findLast=function(s){return this.reverse().find(s)},se.prototype.invokeMap=ne(function(s,l){return typeof s=="function"?new se(this):this.map(function(c){return ts(c,s,l)})}),se.prototype.reject=function(s){return this.filter(zo(J(s)))},se.prototype.slice=function(s,l){s=Q(s);var c=this;return c.__filtered__&&(s>0||l<0)?new se(c):(s<0?c=c.takeRight(-s):s&&(c=c.drop(s)),l!==t&&(l=Q(l),c=l<0?c.dropRight(-l):c.take(l-s)),c)},se.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},se.prototype.toArray=function(){return this.take(wt)},an(se.prototype,function(s,l){var c=/^(?:filter|find|map|reject)|While$/.test(l),h=/^(?:head|last)$/.test(l),y=w[h?"take"+(l=="last"?"Right":""):l],S=h||/^find/.test(l);y&&(w.prototype[l]=function(){var k=this.__wrapped__,_=h?[1]:arguments,T=k instanceof se,O=_[0],N=T||Z(k),R=function(ie){var ce=y.apply(w,Xn([ie],_));return h&&H?ce[0]:ce};N&&c&&typeof O=="function"&&O.length!=1&&(T=N=!1);var H=this.__chain__,G=!!this.__actions__.length,q=S&&!H,ee=T&&!G;if(!S&&N){k=ee?k:new se(this);var j=s.apply(k,_);return j.__actions__.push({func:Ro,args:[R],thisArg:t}),new Pt(j,H)}return q&&ee?s.apply(this,_):(j=this.thru(R),q?h?j.value()[0]:j.value():j)})}),Rt(["pop","push","shift","sort","splice","unshift"],function(s){var l=io[s],c=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",h=/^(?:pop|shift)$/.test(s);w.prototype[s]=function(){var y=arguments;if(h&&!this.__chain__){var S=this.value();return l.apply(Z(S)?S:[],y)}return this[c](function(k){return l.apply(Z(k)?k:[],y)})}}),an(se.prototype,function(s,l){var c=w[l];if(c){var h=c.name+"";Se.call(ai,h)||(ai[h]=[]),ai[h].push({name:l,func:c})}}),ai[To(t,M).name]=[{name:"wrapper",func:t}],se.prototype.clone=M2,se.prototype.reverse=A2,se.prototype.value=I2,w.prototype.at=s5,w.prototype.chain=o5,w.prototype.commit=l5,w.prototype.next=a5,w.prototype.plant=c5,w.prototype.reverse=f5,w.prototype.toJSON=w.prototype.valueOf=w.prototype.value=d5,w.prototype.first=w.prototype.head,qi&&(w.prototype[qi]=u5),w},si=l2();Tr?((Tr.exports=si)._=si,Xa._=si):qe._=si}).call(oO)}(Ws,Ws.exports)),Ws.exports}var Ey=lO();function ud(n){return n.type.create(Ey.cloneDeep(n.attrs))}function cd({tr:n,node:e,position:t,mark:r}){return e.isText?n.removeMark(t,t+e.nodeSize,r):n.removeNodeMark(t,r)}const aO=Ie.create({name:"node_processor",addCommands(){return{setBlockAttributes:z(({commands:n,state:e},t,r,i={})=>{const o=B(n.getBlockAttributes(t))??{},{doc:a,tr:u}=e,{from:f,to:d}=u.selection;a.nodesBetween(f,d,(m,p)=>{de.blocks.includes(m.type.name)&&u.setNodeAttribute(p,t,{...i,...o,...r})})}),getBlockAttributes:z(({editor:n},e,t)=>he(()=>{let r=Object.assign({},t||{});for(const i of de.blocks)Object.assign(r,n.getAttributes(i)?.[e]||{});return Object.keys(r).length?r:null})),removeBlockAttributes:z(({commands:n},e)=>{for(const t of de.blocks)n.resetAttributes(t,e)}),applyMark:z(({state:n,commands:e},t,r,i={})=>{const{tr:o,doc:a,schema:u}=n,{$from:f,$to:d}=o.selection,m=dn(me.LINK,u),p=dn(t,u);if(!(p.spec.group||"").includes(tn.SETTINGS))return e.setMark(t,r);if(f.pos===d.pos)return;const b=x=>{if(!i.onAppliedToParent||i.onAppliedToParent(x)===!1){const{tr:E,node:C,position:M,mark:P}=x;cd({tr:E,node:C,position:M,mark:P.type})}};a.nodesBetween(f.pos,d.pos,(x,E)=>{if(x.type.name===de.LIST)return;const C=sO(x.marks,t),M=p.create({...C?.attrs||{},...r}),P=Sy(f,d,x,E);if(!m.isInSet(x.marks)&&iO(o.doc,E,M,i.isAppliedToParent))return b({tr:o,node:x,position:E,mark:M});if(x.isText){o.addMark(P.from,P.to,M);return}nO(o.doc,o.selection,x,E)&&o.addNodeMark(E,M)})}),getMarks:z(({editor:n},e)=>{const t=bi(n,"state");return he(()=>{const{selection:r,doc:i}=B(t),{from:o,to:a}=B(r),u=[];return i.nodesBetween(o,a,f=>{for(const d of f.marks)d.type.name===e&&u.unshift(d.attrs)}),u})}),getMark:z(({commands:n},e)=>{const t=n.getMarks(e);return he(()=>B(t)[0]??null)}),hasMark:z(({commands:n},e)=>{const t=n.getMark(e);return he(()=>!!B(t))}),getCommonSettingMark:z(({commands:n},e,t)=>{const r=n.getMark(e);return he(()=>B(r)?.value??B(t))}),getDeviceSettingMark:z(({commands:n},e,t)=>{const r=n.getMarks(e),i=n.getDevice();return he(()=>{for(const o of B(r)){const a=o[B(i)];if(a)return a}return B(t)})}),removeAllMarks:z(({state:n})=>{const{tr:e,doc:t}=n,{from:r,to:i}=e.selection;t.nodesBetween(r,i,(o,a)=>{for(const u of o.marks)cd({tr:e,node:o,position:a,mark:u})})}),removeMarks:z(({state:n},e)=>{const{tr:t,doc:r}=n,{from:i,to:o}=t.selection;r.nodesBetween(i,o,(a,u)=>{const f=a.marks.filter(d=>e.includes(d.type.name));for(const d of f)cd({tr:t,node:a,position:u,mark:d})})})}}}),uO=Ie.create({name:"text_processor",addCommands(){return{getSelectedText:z(({state:n})=>{const{from:e,to:t}=n.selection;return n.doc.textBetween(e,t," ")}),transformText:z(({state:n},e)=>{const{$from:t,$to:r}=n.tr.selection;t.pos!==r.pos&&n.doc.nodesBetween(t.pos,r.pos,(i,o)=>{if(!i.isText)return;const a=Sy(t,r,i,o),u=Math.max(0,t.pos-o),f=Math.max(0,r.pos-o),d=e({text:i.textContent.substring(u,f)}),m=n.schema.text(d,i.marks);n.tr.replaceWith(a.from,a.to,m)})})}}}),cO=Ie.create({name:"selection_processor",addStorage:()=>({selection:null}),addCommands(){return{storeSelection:z(({state:n})=>{this.storage.selection=n.selection}),restoreSelection:z(({commands:n})=>{this.storage.selection&&n.setTextSelection(this.storage.selection)}),expandSelection:z(({tr:n,commands:e},t)=>{let r=n.selection.from,i=n.selection.to;n.doc.nodesBetween(r,i,(o,a,u)=>{if(t({node:o,parent:u})){const f=o.isText?0:xy(n.doc,a);r=Math.min(r,a+f),i=Math.max(i,a+o.nodeSize-f)}}),e.setTextSelection({from:r,to:i})}),expandSelectionToBlock:z(({commands:n})=>{n.expandSelection(({parent:e})=>e.type.name===de.DOCUMENT)})}}}),fO=Gn.create({name:"doc",topNode:!0,content:"block+"});class Gs extends $e{constructor(e,t,r,i="SetDocAttr"){super(),this.key=e,this.value=t,this.schema=r,this.stepType=i}apply(e){this.prevValue=e.attrs.meta[this.key];const t=fr.fromJSON(this.schema,e.toJSON());return t.attrs.meta[this.key]=this.value,Re.ok(t)}invert(){return new Gs(this.key,this.prevValue,this.schema,"revertSetDocAttr")}map(){return null}toJSON(){return{stepType:this.stepType,key:this.key,value:this.value}}static fromJSON(e){return new Gs(e.key,e.value,e.stepType)}}$e.jsonID("setDocAttr",Gs);const dO=fO.extend({marks:tn.SETTINGS,addAttributes:()=>({meta:{default:{}}}),onCreate(){this.editor.view.dom.addEventListener("click",n=>{n.target.closest("a")&&n.preventDefault()})},addCommands(){return{setDocMetaAttributes:z(({state:n},e,t)=>{n.tr.step(new Gs(e,t,n.schema))})}}}),hO=Gn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Ii(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),pO=hO.extend({marks:tn.ALL,addOptions:()=>({HTMLAttributes:{class:"zw-style"}})}),mO=Gn.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(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,Ii(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>FM({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),gO=mO.extend({marks:tn.ALL,addOptions:()=>({levels:[1,2,3,4],HTMLAttributes:{class:"zw-style"}})}),yO=Ie.create({name:"prose_mirror_plugins",addProseMirrorPlugins(){return[aA.create(this.editor),uA.create(this.editor)]}}),bO=()=>[dO,pO,gO,WM,ZM,aO,uO,cO,yO],wO=Mt.create({name:me.FONT_FAMILY,group:tn.SETTINGS,addOptions:()=>({fonts:[]}),addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontFamily:z(({commands:n},e)=>{n.applyMark(this.name,{value:e});const t=n.findFontByName(e);let r=B(n.getFontWeight());t.isWeightSupported(r)||(r=t.findClosestWeight(r),n.applyFontWeight(r));const i=n.isSettingCustomized(me.FONT_STYLE).value;!t.isItalicSupported(r)&&i&&n.removeItalic()}),getFont:z(({commands:n})=>{const e=B(this.options.defaultPreset),t=n.findFontByName(e.common.font_family),r=n.getFontFamily();return he(()=>n.findFontByName(B(r))||t)}),findFontByName:z((n,e)=>B(this.options.fonts).find(t=>t.name===e)??this.options.defaultFont),getFontFamily:z(({commands:n})=>n.getCommonSettingMark(this.name,n.getDefaultFontFamily())),getDefaultFontFamily:z(({commands:n})=>{const e=n.getPreset();return he(()=>B(e).common.font_family)})}},parseHTML(){const n=e=>({value:e.replace(/["']/g,"")});return[{style:"--zw-font-family",getAttrs:n},{style:"font-family",getAttrs:n}]},renderHTML({HTMLAttributes:n}){const e=n.value?`"${n.value}"`:null;return Jr({font_family:e})}}),SO=Ie.create({name:me.STYLE_PRESET,addGlobalAttributes(){return[{types:[de.PARAGRAPH,de.HEADING],attributes:{preset:{isRequired:!1,default:{id:B(this.options.defaultId)},parseHTML:n=>{const e=B(this.options.presets);if(n.parentElement.tagName==="LI")return null;for(const{id:t,node:r,fallbackClass:i}of e){if(i&&n.classList.contains(i))return{id:t};const o=B(this.options.styleRenderer).makePresetCssClass({id:t});if(n.matches(o))return{id:t};if(n.tagName===`H${r?.level}`)return{id:t}}return n.tagName==="P"?{id:B(this.options.defaultId)}:null},renderHTML:n=>n.preset?{class:B(this.options.styleRenderer).makePresetHtmlClass(n.preset)}:null}}}]},addCommands(){function n(t,r){return t.find(i=>r===i.id)}function e(t,r){const i={};for(const o of Object.keys(t)){const a=t[o],u=r[o],f=!u||u.toLowerCase()==="inherit";i[o]=f?a:u}return i}return{getPresetList:z(()=>he(()=>B(this.options.presets).filter(t=>!t.hidden))),getPreset:z(({commands:t})=>{const r=t.getBlockAttributes("preset",{id:B(this.options.defaultId)}),i=t.getPresetList(),o=t.isLink(),a=t.getLinkPreset();return he(()=>{const u=n(B(i),B(r).id);if(!B(o))return u;const f=B(a);return{id:u.id,common:e(u.common,f.common),mobile:e(u.mobile,f.mobile),tablet:e(u.tablet,f.tablet),desktop:e(u.desktop,f.desktop)}})}),applyPreset:z(({commands:t,chain:r},i)=>{const o=B(t.getPresetList()),a=n(o,i),u=a.node?.type??de.PARAGRAPH,f={preset:{id:i}};a.node&&(f.level=a.node.level);for(const d of me.attributes)f[d]=B(t.getBlockAttributes(d));r().removeList().setNode(u,f).run()}),applyDefaultPreset:z(({commands:t})=>{t.applyPreset(B(this.options.defaultId))}),removePreset:z(({commands:t})=>{t.setNode(de.PARAGRAPH,{preset:null})}),getPresetCustomization:z(({editor:t,commands:r})=>{const i=bi(t,"state");return he(()=>{const{selection:o,doc:a}=B(i),{from:u,to:f}=o;return r._getSettingCustomization(a,u,f)})}),isSettingCustomized:z(({commands:t},r)=>{const i=t.getPresetCustomization(),o=me.presetAttributes.includes(r)?"attributes":"marks";return he(()=>B(i)[o]?.includes(r)??!1)}),getContentCustomization:z(({editor:t,commands:r})=>{const i=bi(t,"state");return he(()=>{const{doc:o}=B(i);return r._getSettingCustomization(o,0,o.content.size)})}),_getSettingCustomization:z((t,r,i,o)=>{const a=new Set,u=new Set;return r.nodesBetween(i,o,f=>{for(const[d,m]of Object.entries(f.attrs))me.presetAttributes.includes(d)&&m&&u.add(d);for(const{type:d}of f.marks)me.marks.includes(d.name)&&a.add(d.name)}),{attributes:Array.from(u),marks:Array.from(a)}}),removePresetCustomization:z(({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeMarks(me.marks).resetAttributes(de.PARAGRAPH,me.presetAttributes).resetAttributes(de.HEADING,me.presetAttributes).restoreSelection().run()}),removeFormat:z(({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeAllMarks().applyDefaultPreset().restoreSelection().run()})}},onCreate(){this.options.styleRenderer.inject(Pi.head,B(this.options.presets))}}),xO=Mt.create({name:me.FONT_WEIGHT,group:tn.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontWeight:z(({commands:n},e)=>{n.applyMark(this.name,{value:e}),B(n.getFont()).isItalicSupported(e)||n.removeItalic()}),toggleBold:z(({commands:n})=>{const e=B(n.getFontWeight()),t=B(n.getFont()),i=Number(e)>=600?"400":"700",o=t.findClosestWeight(i);n.applyFontWeight(o)}),getFontWeight:z(({commands:n})=>{const e=n.getCommonSettingMark(this.name,n.getDefaultFontWeight()),t=n.getFont();return he(()=>{const r=B(e),i=B(t);return i.isWeightSupported(r)?r:i.findClosestWeight(r)})}),getDefaultFontWeight:z(({commands:n})=>{const e=n.getPreset();return he(()=>B(e).common.font_weight)})}},addKeyboardShortcuts:()=>({"Mod-b":Kt("toggleBold"),"Mod-B":Kt("toggleBold")}),parseHTML(){const n=e=>e==="bold"?{value:"700"}:Number(e)?{value:e}:!1;return[{style:"--zw-font-weight",getAttrs:n},{style:"font-weight",getAttrs:n},{tag:"b",attrs:{value:"700"}},{tag:"strong",attrs:{value:"700"}}]},renderHTML({HTMLAttributes:n}){return Jr({font_weight:n.value})}}),kO=Mt.create({name:me.FONT_SIZE,group:tn.SETTINGS,addOptions:()=>({minSize:1,maxSize:100}),addAttributes(){return{mobile:{default:null},tablet:{default:null},desktop:{default:null}}},addCommands(){return{getFontSize:z(({commands:n})=>n.getDeviceSettingMark(this.name,n.getDefaultFontSize())),getDefaultFontSize:z(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return he(()=>B(t)[B(e)].font_size.replace("px",""))}),applyFontSize:z(({commands:n},e)=>{const t=B(n.getDevice());n.applyMark(this.name,{[t]:e},{isAppliedToParent:(r,i)=>r.type.name!==i.type.name?!1:r.attrs[t]===i.attrs[t],onAppliedToParent:({tr:r,node:i,position:o,mark:a})=>{const u={...a.attrs,[t]:null};if(!Object.values(u).some(m=>!!m))return!1;const d=a.type.create(u);if(i.isText){r.addMark(o,o+i.nodeSize,d);return}r.addNodeMark(o,d)}})}),increaseFontSize:z(({commands:n})=>{const e=Number(B(n.getFontSize())),t=Math.min(e+1,B(this.options.maxSize));n.applyFontSize(String(t))}),decreaseFontSize:z(({commands:n})=>{const e=Number(B(n.getFontSize())),t=Math.max(e-1,B(this.options.minSize));n.applyFontSize(String(t))})}},addKeyboardShortcuts:()=>({"Mod-Shift-=":Kt("increaseFontSize"),"Mod-Shift--":Kt("decreaseFontSize")}),parseHTML(){const n=e=>{if(!e)return null;const t=B(this.options.wrapperRef),r=wy(e,t);return String(r)};return[{tag:'[style*="--zw-font-size"]',getAttrs:({style:e})=>({mobile:n(e.getPropertyValue("--zw-font-size-mobile")),tablet:n(e.getPropertyValue("--zw-font-size-tablet")),desktop:n(e.getPropertyValue("--zw-font-size-desktop"))})},{style:"font-size",getAttrs:e=>{const t=n(e);return{desktop:t,tablet:t,mobile:null}}}]},renderHTML({HTMLAttributes:n}){const e=t=>t?`${t}px`:null;return Jr({font_size_mobile:e(n.mobile),font_size_tablet:e(n.tablet),font_size_desktop:e(n.desktop)})}}),EO=Mt.create({name:me.FONT_COLOR,group:tn.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getFontColor:z(({commands:n})=>n.getCommonSettingMark(this.name,n.getDefaultFontColor())),getDefaultFontColor:z(({commands:n})=>{const e=n.getPreset();return he(()=>B(e).common.color)}),applyFontColor:z(({commands:n},e)=>{n.applyMark(this.name,{value:e})})}},parseHTML(){const n=e=>({value:by(e)});return[{style:"--zw-font-color",getAttrs:n},{style:"color",getAttrs:n}]},renderHTML({HTMLAttributes:n}){return Jr({font_color:n.value})}}),_O=Mt.create({name:me.BACKGROUND_COLOR,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getBackgroundColor:z(({commands:n})=>n.getCommonSettingMark(this.name,"rgba(255, 255, 255, 0%)")),applyBackgroundColor:z(({commands:n},e)=>{n.applyMark(this.name,{value:e})})}},parseHTML(){const n=e=>({value:by(e)});return[{style:"--zw-background-color",getAttrs:n},{style:"background-color",getAttrs:n}]},renderHTML({HTMLAttributes:n}){return Jr({background_color:n.value})}}),vO=Ie.create({name:"device_manager",addCommands(){return{getDevice:z(()=>bi(this.options,"device"))}}}),TO=Mt.create({name:me.FONT_STYLE,group:tn.SETTINGS,addAttributes:()=>({italic:{required:!0}}),addCommands(){return{isItalic:z(({commands:n})=>{const e=n.getMark(this.name),t=n.getDefaultFontStyle();return he(()=>B(e)?.italic??B(t).italic)}),isItalicAvailable:z(({commands:n})=>{const e=n.getFont(),t=n.getFontWeight();return he(()=>{const r=B(e),i=B(t);return r.isItalicSupported(i)&&!r.isWeightItalicOnly(i)})}),getDefaultFontStyle:z(({commands:n})=>{const e=n.getPreset();return he(()=>({italic:B(e).common.font_style==="italic"}))}),toggleItalic:z(({commands:n})=>{B(n.isItalicAvailable())&&(B(n.isItalic())?n.removeItalic():n.applyItalic())}),applyItalic:z(({commands:n})=>{n.applyMark(this.name,{italic:!0})}),removeItalic:z(({commands:n})=>{n.applyMark(this.name,{italic:!1})})}},addKeyboardShortcuts:()=>({"Mod-i":Kt("toggleItalic"),"Mod-I":Kt("toggleItalic")}),parseHTML(){const n=e=>({italic:e.includes("italic")});return[{tag:"i",attrs:{italic:!0}},{style:"--zw-font-style",getAttrs:n},{style:"font-style",getAttrs:n}]},renderHTML({HTMLAttributes:n}){const e=n.italic?"italic":"normal";return Jr({font_style:e})}}),CO=Mt.create({name:me.TEXT_DECORATION,priority:1e3,addAttributes:()=>({underline:{default:!1},strike_through:{default:!1}}),addCommands(){return{isUnderline:z(({commands:n})=>{const e=n.getTextDecoration();return he(()=>B(e).underline)}),isStrikeThrough:z(({commands:n})=>{const e=n.getTextDecoration();return he(()=>B(e).strike_through)}),getTextDecoration:z(({commands:n})=>{const e=n.getMark(this.name),t=n.getDefaultTextDecoration();return he(()=>{const r=B(e)??{},i=B(t);return{underline:r.underline||i.underline,strike_through:r.strike_through||i.strike_through}})}),isUnderlineCustomized:z(({commands:n})=>{const e=n.isUnderline(),t=n.getDefaultTextDecoration();return he(()=>B(e)!==B(t).underline)}),getDefaultTextDecoration:z(({commands:n})=>{const e=n.getPreset();return he(()=>{const{text_decoration:t}=B(e).common;return{underline:t.includes("underline"),strike_through:t.includes("line-through")}})}),toggleUnderline:z(({commands:n})=>{n.toggleTextDecoration("underline")}),toggleStrikeThrough:z(({commands:n})=>{n.toggleTextDecoration("strike_through")}),toggleTextDecoration:z(({commands:n},e,t=null)=>{const r=B(n.getTextDecoration()),i=t??!r[e];n.applyMark(this.name,{[e]:i})}),applyTextDecoration:z(({commands:n},e)=>{n.toggleTextDecoration(e,!0)}),removeTextDecoration:z(({commands:n},e)=>{n.toggleTextDecoration(e,!1)})}},addKeyboardShortcuts:()=>({"Mod-u":Kt("toggleUnderline"),"Mod-U":Kt("toggleUnderline")}),parseHTML(){const n=e=>{const t=e.includes("underline"),r=e.includes("line-through");return!t&&!r?!1:{underline:t,strike_through:r}};return[{style:"--zw-text-decoration",getAttrs:n},{style:"text-decoration-line",getAttrs:n},{style:"text-decoration",getAttrs:n},{tag:"s",attrs:{underline:!1,strike_through:!0}},{tag:"u",attrs:{underline:!0,strike_through:!1}}]},renderHTML({HTMLAttributes:n}){const e=[];return n.underline&&e.push("underline"),n.strike_through&&e.push("line-through"),e.length||e.push("none"),Jr({text_decoration:e.join(" ")})}}),MO=Ie.create({name:"case_style",addCommands(){return{applyCaseStyle:z(({commands:n},e)=>{switch(e){case Ef.CAPITALIZE:return n.applyCapitalize();case Ef.LOWERCASE:return n.applyLowerCase();case Ef.UPPERCASE:return n.applyUpperCase()}}),applyCapitalize:z(({commands:n})=>{n.transformText(({text:e})=>AA(e))}),applyLowerCase:z(({commands:n})=>{n.transformText(({text:e})=>e.toLowerCase())}),applyUpperCase:z(({commands:n})=>{n.transformText(({text:e})=>e.toUpperCase())})}}}),_y={mobile:null,tablet:null,desktop:null},AO=Ie.create({name:me.ALIGNMENT,addGlobalAttributes:()=>[{types:[de.PARAGRAPH,de.HEADING],attributes:{[me.ALIGNMENT]:{isRequired:!1,parseHTML({style:n}){const e=tO(n.textAlign);if(e)return{desktop:e,tablet:e,mobile:e};const t=n.getPropertyValue("--zw-alignment-mobile")||null,r=n.getPropertyValue("--zw-alignment-tablet")||null,i=n.getPropertyValue("--zw-alignment-desktop")||null;return!t&&!r&&!i?null:{desktop:i,tablet:r,mobile:t}},renderHTML(n){return n.alignment?ma({alignment_mobile:n.alignment.mobile,alignment_tablet:n.alignment.tablet,alignment_desktop:n.alignment.desktop}):null}}}}],addCommands(){return{applyAlignment:z(({commands:n},e)=>{const t=B(n.getDevice());n.setBlockAttributes(this.name,{[t]:e},_y)}),removeAlignment:z(({commands:n})=>n.removeBlockAttributes(this.name)),getAlignment:z(({commands:n})=>{const e=n.getBlockAttributes(this.name,_y),t=n.getDevice(),r=n.getDefaultAlignment();return he(()=>B(e)?.[B(t)]??B(r))}),getDefaultAlignment:z(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return he(()=>B(t)[B(e)].alignment??wr.LEFT)})}},addKeyboardShortcuts:()=>({"Mod-Shift-l":Kt("applyAlignment",wr.LEFT),"Mod-Shift-e":Kt("applyAlignment",wr.CENTER),"Mod-Shift-r":Kt("applyAlignment",wr.RIGHT),"Mod-Shift-j":Kt("applyAlignment",wr.JUSTIFY)})}),vy={mobile:null,tablet:null,desktop:null},IO=Ie.create({name:me.LINE_HEIGHT,addGlobalAttributes(){return[{types:[de.PARAGRAPH,de.HEADING],attributes:{[me.LINE_HEIGHT]:{isRequired:!1,parseHTML:n=>{if(n.matches('[style*="--zw-line-height"]')){const o=n.style.getPropertyValue("--zw-line-height-tablet")||null,a=n.style.getPropertyValue("--zw-line-height-desktop")||null;return{mobile:null,tablet:o,desktop:a}}const e=n.style.lineHeight;if(!e)return null;const t=B(this.options.wrapperRef),r=QI(e,n,t);return r?{desktop:r,tablet:r,mobile:null}:null},renderHTML(n){return n.line_height?ma({line_height_mobile:n.line_height.mobile,line_height_tablet:n.line_height.tablet,line_height_desktop:n.line_height.desktop}):null}}}}]},addCommands(){return{getLineHeight:z(({commands:n})=>{const e=n.getBlockAttributes(this.name,vy),t=n.getDevice(),r=n.getDefaultLineHeight();return he(()=>B(e)?.[B(t)]??B(r))}),getDefaultLineHeight:z(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return he(()=>B(t)[B(e)].line_height)}),applyLineHeight:z(({commands:n},e)=>{const t=B(n.getDevice());n.setBlockAttributes(this.name,{[t]:e},vy)})}}}),OO=Gn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Ii(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),NO=OO.extend({name:de.LIST_ITEM,marks:tn.SETTINGS,addCommands(){const n=({selection:e})=>e.$cursor.before(e.$cursor.depth-1);return{listItemNewline:z(({commands:e,tr:t})=>{const r=t.doc.nodeAt(n(t));if(!t.selection.$cursor.node().textContent)return!1;e.splitListItem(this.name);const o=n(t);for(const a of r.marks)t.addNodeMark(o,ud(a));return!0})}},addOptions:()=>({HTMLAttributes:{class:"zw-style"}}),addKeyboardShortcuts:()=>({Enter:n=>{const{state:e,commands:t}=n.editor;if(e.selection.$cursor?.path.some(i=>i.type?.name===de.LIST))return t.listItemNewline()}})});function RO(n,e){if(me.inlineMarks.includes(e.type)||e.type.isInSet(n.marks))return!1;for(const t of n.content.content)if(t.childCount&&(!t.marks||!e.isInSet(t.marks)))return!1;return!0}function LO({doc:n,selection:e}){const t=e.$from.start(),r=e.$to.end();n.nodesBetween(t,r,(i,o)=>{if(i.type.name===de.LIST)return;if(i.type.name!==de.LIST_ITEM)return!1;const a=[];return i.forEach(u=>{for(const f of u.marks){if(f.isInSet(a)){tr.removeNodeMark(o+1,f);continue}RO(i,f)&&(tr.removeNodeMark(o+1,f),tr.addNodeMark(o,ud(f)),a.push(f))}}),!1})}const PO=Gn.create({name:de.LIST,content:`${de.LIST_ITEM}+`,group:"block list",marks:tn.SETTINGS,addExtensions:()=>[NO],addOptions:()=>({baseClass:"",presetClass:""}),addAttributes:()=>({bullet:{default:{type:Wt.DISC}}}),parseHTML(){const n={a:Wt.ROMAN,i:Wt.LATIN,1:Wt.DECIMAL},e=t=>{for(const r of Wt.values){const i=`.${B(this.options.baseClass)}${r}`;if(t.matches(i)||n[t.type.toLowerCase()]===r)return r}};return[{tag:"ol",getAttrs:t=>({bullet:{type:e(t)||Wt.DECIMAL}})},{tag:"ul",getAttrs:t=>({bullet:{type:e(t)||Wt.DISC}})}]},renderHTML({HTMLAttributes:n}){const e=[B(this.options.baseClass)+n.bullet.type,B(this.options.presetClass)];return[Wt.ordered.includes(n.bullet.type)?"ol":"ul",{class:e.join(" ")},0]},addCommands(){return{getListType:z(({commands:n})=>{const e=n.getBlockAttributes("bullet",{type:null});return he(()=>B(e).type??null)}),applyList:z(({commands:n,chain:e},t)=>B(n.getListType())===t?n.removeList():e().applyDefaultPreset().toggleList(de.LIST,de.LIST_ITEM).setBlockAttributes("bullet",{type:t}).command(({tr:i})=>LO(i)).run()),removeList:z(({chain:n})=>n().command(({tr:e,commands:t})=>{const r=e.selection.$from.start(),i=e.selection.$to.end();let o;return e.doc.nodesBetween(r,i,(a,u,f)=>{if(a.isText&&!o&&(o=u),[de.LIST,de.LIST_ITEM].includes(a.type.name))return;if(f.type.name!==de.LIST_ITEM)return!1;const d=f.marks.filter(m=>!m.type.isInSet(a.marks));for(const m of d)e.addNodeMark(u,ud(m));return!1}),t.setTextSelection({from:o,to:i})}).liftListItem(de.LIST_ITEM).run())}},addInputRules(){const n=(e,t)=>HM({find:t,type:this.type,getAttributes:{bullet:{type:e}},joinPredicate:(r,{attrs:i})=>i.bullet.type===e});return[n(Wt.DISC,/^\s*([-+*])\s$/),n(Wt.DECIMAL,/^(\d+)\.\s$/),n(Wt.LATIN,/^([ivx]{1,3})\.\s$/i),n(Wt.ROMAN,/^([a-z])\.\s$/i)]}});function DO(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function zO(n){return new lt({key:new Tt("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(d=>d.docChanged)&&!t.doc.eq(r.doc),o=e.some(d=>d.getMeta("preventAutolink"));if(!i||o)return;const{tr:a}=r,u=aM(t.doc,[...e]);if(yM(u).forEach(({newRange:d})=>{const m=cM(r.doc,d,b=>b.isTextblock);let p,g;if(m.length>1?(p=m[0],g=r.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ")):m.length&&r.doc.textBetween(d.from,d.to," "," ").endsWith(" ")&&(p=m[0],g=r.doc.textBetween(p.pos,d.to,void 0," ")),p&&g){const b=g.split(" ").filter(M=>M!=="");if(b.length<=0)return!1;const x=b[b.length-1],E=p.pos+g.lastIndexOf(x);if(!x)return!1;const C=pa(x).map(M=>M.toObject(n.defaultProtocol));if(!DO(C))return!1;C.filter(M=>M.isLink).map(M=>({...M,from:E+M.start+1,to:E+M.end+1})).filter(M=>r.schema.marks.code?!r.doc.rangeHasMark(M.from,M.to,r.schema.marks.code):!0).filter(M=>n.validate(M.value)).filter(M=>n.shouldAutoLink(M.value)).forEach(M=>{F0(M.from,M.to,r.doc).some(P=>P.mark.type===n.type)||a.addMark(M.from,M.to,n.type.create({href:M.href}))})}}),!!a.steps.length)return a}})}function BO(n){return new lt({key:new Tt("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,o;if(r.button!==0||!e.editable)return!1;let a=r.target;const u=[];for(;a.nodeName!=="DIV";)u.push(a),a=a.parentNode;if(!u.find(g=>g.nodeName==="A"))return!1;const f=pM(e.state,n.type.name),d=r.target,m=(i=d?.href)!==null&&i!==void 0?i:f.href,p=(o=d?.target)!==null&&o!==void 0?o:f.target;return d&&m?(window.open(m,p),!0):!1}}})}function FO(n){return new lt({key:new Tt("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:i}=e,{selection:o}=i,{empty:a}=o;if(a)return!1;let u="";r.content.forEach(d=>{u+=d.textContent});const f=b1(u,{defaultProtocol:n.defaultProtocol}).find(d=>d.isLink&&d.value===u);return!u||!f?!1:n.editor.commands.setMark(n.type,{href:f.href})}}})}const HO=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function Yr(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&t.push(i)}),!n||n.replace(HO,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const $O=Mt.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(n=>{if(typeof n=="string"){y1(n);return}y1(n.scheme,n.optionalSlashes)})},onDestroy(){vA()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!Yr(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!Yr(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!Yr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Ii(this.options.HTMLAttributes,n),0]:["a",Ii(this.options.HTMLAttributes,{...n,href:""}),0]},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!Yr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!Yr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[$M({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,i=b1(n).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:a=>!!Yr(a,t),protocols:t,defaultProtocol:r}));i.length&&i.forEach(o=>e.push({text:o.value,data:{href:o.href},index:o.start}))}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(zO({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Yr(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(BO({type:this.type})),this.options.linkOnPaste&&n.push(FO({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}}),WO=$O.extend({name:me.LINK,addOptions(){return{...this.parent?.(),openOnClick:!1,linkOnPaste:!1}},addAttributes(){return{href:{default:null,parseHTML:n=>{const e=n.getAttribute("href");return e.startsWith("#")?parseFloat(n.getAttribute("href").replace("#","")):e}},target:{default:t1.SELF,parseHTML:n=>n.getAttribute("target")||t1.SELF},destination:{default:Ms.URL,parseHTML:n=>{const e=n.getAttribute("href");if(!e.startsWith("#"))return Ms.URL;const t=e.replace("#","");return B(this.options.pageBlocks).find(o=>o.id===parseInt(t))?Ms.BLOCK:Ms.URL}}}},addCommands(){const{unsetLink:n}=this.parent();return{removeLink:n,applyLink:z(({commands:e,chain:t},r)=>(e.setMeta("preventAutolink",!0),e.getSelectedText()?t().applyMark(this.name,r).expandSelectionToLink().command(({tr:i})=>(r.text&&i.insertText(r.text,i.selection.from,i.selection.to),!0)).run():e.insertContent(Cy.text(r.text,[Cy.mark(me.LINK,r)])))),expandSelectionToLink:z(({commands:e})=>{e.expandSelection(({node:t})=>this.type.isInSet(t.marks))}),isLink:z(({commands:e})=>e.hasMark(this.name)),getLinkPreset:z(()=>he(()=>B(this.options.preset)))}},addProseMirrorPlugins(){return[...this.parent(),MA.create(this.editor)]},renderHTML({HTMLAttributes:n}){const e=n.destination===Ms.BLOCK?`#${n.href}`:n.href,t=B(this.options.basePresetClass)+B(this.options.preset).id;return["a",{href:e,target:n.target,class:`${t} zw-style`},0]}}),UO=Mt.create({name:me.SUPERSCRIPT,addCommands(){return{applySuperscript:z(({commands:n})=>{n.setMark(this.name)}),removeSuperscript:z(({commands:n})=>{n.unsetMark(this.name)}),toggleSuperscript:z(({commands:n})=>{B(n.isSuperscript())?n.removeSuperscript():n.applySuperscript()}),isSuperscript:z(({commands:n})=>{const e=n.getMark(this.name);return he(()=>!!B(e))})}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs:n=>n!=="super"?!1:null}]},renderHTML(){return["sup",{class:"zw-superscript"},0]}}),VO=Ie.create({name:me.MARGIN,addGlobalAttributes:()=>[{types:[de.PARAGRAPH,de.HEADING],attributes:{[me.MARGIN]:{isRequired:!1,parseHTML(n){const{margin:e,marginTop:t,marginRight:r,marginBottom:i,marginLeft:o}=n.style;return[e,t,r,i,o].some(f=>!!f)?e?{value:e}:{value:[t||0,r||0,i||0,o||0].join(" ")}:null},renderHTML(n){return n.margin?ma({margin:n.margin.value}):null}}}}]});function KO(n){const e=r=>n.presetsRef.value.find(i=>i.id===r),t=yc({default:null,link:null});return C_(n.presetsRef,()=>{t.default=e(n.defaultPresetId),t.link=e(n.linkPresetId)},{immediate:!0,deep:!0}),bO().concat([SO.configure({presets:n.presetsRef,defaultId:n.defaultPresetId,styleRenderer:new YO({baseClass:n.basePresetClass,makeVariable:n.makePresetVariable,linkPresetId:n.linkPresetId})}),PO.configure({baseClass:n.baseListClass,presetClass:n.basePresetClass+n.defaultPresetId}),vO.configure({device:n.deviceRef}),kO.configure({minSize:n.minFontSize,maxSize:n.maxFontSize,wrapperRef:n.wrapperRef}),wO.configure({fonts:n.fonts,defaultPreset:bi(t,"default"),defaultFont:n.defaultFont}),xO,EO,_O,TO,CO,MO,UO,AO,IO.configure({wrapperRef:n.wrapperRef}),WO.configure({preset:bi(t,"link"),basePresetClass:n.basePresetClass,pageBlocks:n.pageBlocksRef}),VO])}class GO{_domParser=new DOMParser;types=window;parse(e){return this._domParser.parseFromString(e,"text/html")}}class Ty{content;constructor({content:e}){this.content=e}normalize(){throw new Error("Implement abstract method")}}class gn extends Ty{static BLOCK_NODE_NAMES=["P","H1","H2","H3","H4"];static ROOT_NODE_NAMES=gn.BLOCK_NODE_NAMES.concat("UL","OL");static BLOCK_STYLES=["text-align","line-height","margin","margin-top","margin-bottom","margin-left","margin-right"];_parser;constructor({content:e,parser:t}){super({content:e}),this._parser=t,this.dom=null}normalize(){return this.normalizeHTML(),this.normalizedHTML}normalizeHTML(){this.dom=this._parser.parse(this.content.replace(/(\r)?\n/g,"")),this._removeComments(),this._normalizeRootTags(),this._iterateNodes(this._normalizeBreakLines,e=>e.tagName==="BR"),this._iterateNodes(this._removeEmptyNodes,this._isBlockNode),this._iterateNodes(this._normalizeListItems,e=>e.tagName==="LI"),this._normalizeBlockTextDecoration(),this._normalizeBlockBackgroundColor()}get normalizedHTML(){return this.dom.body.innerHTML}get _NodeFilter(){return this._parser.types.NodeFilter}get _Node(){return this._parser.types.Node}_removeComments(){const e=this._createNodeIterator(this._NodeFilter.SHOW_COMMENT);this._runIterator(e,t=>t.remove())}_normalizeRootTags(){const e=Array.from(this.dom.body.childNodes),t=this.dom.createDocumentFragment();let r;for(const i of e){if(this._isRootNode(i)){t.append(i),r=null;continue}r||(r=this.dom.createElement("p"),t.append(r)),r.append(i)}this.dom.body.innerHTML="",this.dom.body.append(t)}_createNodeIterator(e,t){return this.dom.createNodeIterator(this.dom.body,e,t)}_iterateNodes(e,t=()=>!0){const r=o=>o.tagName!=="BODY"&&t.call(this,o),i=this._createNodeIterator(this._NodeFilter.SHOW_ELEMENT,{acceptNode:o=>r(o)?this._NodeFilter.FILTER_ACCEPT:this._NodeFilter.FILTER_REJECT});this._runIterator(i,e)}_runIterator(e,t){let r=e.nextNode();for(;r;)t.call(this,r),r=e.nextNode()}_removeEmptyNodes(e){e.innerHTML.trim()||e.remove()}_normalizeListItems(e){const t=this.dom.createDocumentFragment(),r=Array.from(e.childNodes);let i,o;const a=u=>{this._assignElementProperties(u,e,gn.BLOCK_STYLES),t.append(u)};this._assignElementProperties(e,e.parentElement,gn.BLOCK_STYLES);for(const u of r){if(this._isBlockNode(u)){a(u),i=null,o=u;continue}if(u.tagName==="BR"&&o&&o?.tagName!=="BR"){u.remove(),o=u;continue}if(u.tagName==="BR"){const f=this.dom.createElement("p");f.append(u),a(f),i=null,o=u;continue}i||(i=this.dom.createElement("p"),a(i)),i.append(u),o=u}e.append(t),this._removeStyleProperties(e,gn.BLOCK_STYLES),this._removeStyleProperties(e.parentElement,gn.BLOCK_STYLES),this._assignElementProperties(e,e.parentElement),e.parentElement.lastElementChild===e&&this._removeStyleProperties(e.parentElement)}_isBlockNode(e){return gn.BLOCK_NODE_NAMES.includes(e.tagName)}_isRootNode(e){return gn.ROOT_NODE_NAMES.includes(e.tagName)}_assignElementProperties(e,t,r=Array.from(t.style)){for(const i of r){const o=t.style.getPropertyValue(i);o&&!e.style.getPropertyValue(i)&&e.style.setProperty(i,o)}}_removeStyleProperties(e,t=Array.from(e.style)){for(const r of t)e.style.removeProperty(r);e.style.length===0&&e.removeAttribute("style")}_normalizeBreakLines({parentElement:e}){if(!this._isBlockNode(e)||!e.textContent)return;const t=this.dom.createDocumentFragment(),r=Array.from(e.childNodes),i=e.cloneNode(!0);i.innerHTML="";let o=i.cloneNode();const a=u=>{this._assignElementProperties(u,e,gn.BLOCK_STYLES),t.append(u)};for(const u of r){if(u.tagName==="BR"){a(o),o=i.cloneNode();continue}o.append(u)}t.append(o),e.replaceWith(t)}_normalizeBlockTextDecoration(){const e=this.dom.querySelectorAll('[style*="text-decoration"]:where(p, h1, h2, h3, h4, li)');for(const t of e)this._moveTextDecorationToChildren(t)}_moveTextDecorationToChildren(e){const t=this._parseTextDecoration(e);if(e.style.removeProperty("text-decoration-line"),e.style.removeProperty("text-decoration"),e.style.cssText||e.removeAttribute("style"),!t.none)for(const r of e.childNodes){const i=this._wrapTextNode(e,r),o=this._parseTextDecoration(i),a={underline:o.underline||t.underline,line_through:o.line_through||t.line_through};i.style.removeProperty("text-decoration-line"),i.style.removeProperty("text-decoration"),i.style.textDecoration=Object.entries(a).filter(([,u])=>u).map(([u])=>u.replace("_","-")).join(" ")}}_parseTextDecoration(e){const{textDecoration:t,textDecorationLine:r}=e.style,i=t||r||"";return{none:i.includes("none"),underline:i.includes("underline"),line_through:i.includes("line-through")}}_normalizeBlockBackgroundColor(){const e=this.dom.querySelectorAll('[style*="background-color"]:where(p, h1, h2, h3, h4, li)');for(const t of e)this._moveBackgroundColorToChildren(t)}_moveBackgroundColorToChildren(e){const t=e.style.backgroundColor;e.style.removeProperty("background-color"),e.style.cssText||e.removeAttribute("style");for(const r of e.childNodes){const i=this._wrapTextNode(e,r),o=i.style.backgroundColor||t;i.style.backgroundColor=o}}_wrapTextNode(e,t){if(t.nodeType!==this._Node.TEXT_NODE)return t;const r=this.dom.createElement("span");return r.append(t.cloneNode()),e.replaceChild(r,t),r}}class JO extends Ty{normalize(){return this._iterateNodes(this._bubbleMarks),this.content}_iterateNodes(e){this._iterateChildNodes(this.content,e)}_iterateChildNodes(e,t){for(const r of e.content)r.content&&this._iterateChildNodes(r,t),t.call(this,r)}_bubbleMarks(e){if(e.content&&e.type!==de.LIST){for(const t of e.content)if(!this._isLink(t)&&t.marks)for(const r of t.marks.slice()){if(this._includesMark(e,r)){this._removeMark(t,r);continue}this._canBubbleMark(e,r)&&(this._removeMark(t,r),this._addMark(e,r))}}}_canBubbleMark(e,t){if(me.inlineMarks.includes(t.type)||this._includesMarkType(e,t.type))return!1;for(const r of e.content)if(!(!r.content&&e.type===de.LIST_ITEM)&&(!r.marks||!this._includesMark(r,t)))return!1;return!0}_includesMark(e,t){return e.marks?.some(r=>Ey.isEqual(r,t))??!1}_includesMarkType(e,t){return e.marks?.some(r=>r.type===t)??!1}_isLink(e){return e.type===de.TEXT&&this._includesMarkType(e,me.LINK)}_removeMark(e,t){if(!e.marks)return;const r=this._findMarkIndexByType(e,t.type);r>=0&&e.marks.splice(r,1),e.marks.length||delete e.marks}_addMark(e,t){this._removeMark(e,t),e.marks??=[],e.marks.push(t)}_findMarkIndexByType(e,t){return e.marks?.findIndex(r=>r.type===t)??null}}class Oa{static build(e,t={}){return typeof e=="string"?this._buildHtml(e,t):this._buildJson(e)}static _buildHtml(e,t){return new gn({content:e,parser:t.parser||new GO})}static _buildJson(e){return new JO({content:e})}static normalize(e,t={}){return Oa.build(e,t).normalize()}}class Pi{static window=globalThis.window;static use(e){this.window=e}static get document(){return this.window.document}static get body(){return this.document.body}static get head(){return this.document.head}static getComputedStyle(e){return this.window.getComputedStyle(e)}}class gd{static build({config:e,nodeDomParser:t}){const r=KO({fonts:e.fonts,minFontSize:0,maxFontSize:0,presetsRef:jo(e.presets),defaultPresetId:e.defaultPresetId,linkPresetId:e.linkPresetId,makePresetVariable:()=>"",basePresetClass:e.basePresetClass,baseListClass:e.baseListClass,deviceRef:jo(kf.DESKTOP),pageBlocksRef:jo([]),wrapperRef:Pi.document.createElement("p")}),i=dM(r);return new gd({schema:i,domParser:ws.fromSchema(i),nodeDomParser:t})}_schema;_domParser;_nodeDomParser;constructor({schema:e,domParser:t,nodeDomParser:r}){this._schema=e,this._domParser=t,this._nodeDomParser=r}toJSON(e){const t=Oa.build(e,{parser:this._nodeDomParser});return t.normalizeHTML(),this._domParser.parse(t.dom.body).toJSON()}}function qO(n,e){return n.type===e}function jO(n){return typeof n=="string"}class Cy{static doc(e){return{type:Dn.DOCUMENT,content:e}}static list(e,t){return{type:Dn.LIST,attrs:{bullet:{type:e}},content:t.map(r=>qO(r,Dn.LIST_ITEM)?r:this.listItem([r].flat()))}}static listItem(...e){const{attrs:t,content:r,marks:i}=this.normalizeTextBlockArgs(e);return{type:Dn.LIST_ITEM,...t?{attrs:t}:{},...i?{marks:i}:{},content:[r].flat().map(o=>jO(o)?this.paragraph(o):o)}}static heading(e,...t){const r=this.textBlock(t);return r.attrs??={},r.attrs.level=e,{type:Dn.HEADING,...r}}static paragraph(...e){return{type:Dn.PARAGRAPH,...this.textBlock(e)}}static textBlock(e){const{attrs:t,content:r,marks:i}=this.normalizeTextBlockArgs(e);return{content:typeof r=="string"?[this.text(r)]:[r].flat(),...t?{attrs:t}:{},...i?{marks:i}:{}}}static normalizeTextBlockArgs(e){return e.length===1?{attrs:null,marks:null,content:e[0]}:e.length===2?{attrs:e[0],marks:null,content:e[1]}:{attrs:e[0],marks:e[1],content:e[2]}}static text(e,t){return{type:Dn.TEXT,...t?{marks:t}:{},text:e}}static link(e,t,r=[]){return this.text(e,[this.mark(_f.LINK,t),...r])}static mark(e,t){return{type:e,attrs:t}}static populateAllDevices(e){return{mobile:e,tablet:e,desktop:e}}}class YO{_baseClass;_makeVariable;_linkPresetId;constructor({baseClass:e,makeVariable:t,linkPresetId:r}){this._baseClass=e,this._makeVariable=t,this._linkPresetId=r}inject(e,t){let r=e.querySelector("[data-zw-styles]");r||(r=Pi.document.createElement("style"),r.dataset.zwStyles="",r.innerHTML=this.render(t),e.append(r))}render(e){let t="";for(const r of e){const i=r.id===this._linkPresetId,o=this.makePresetCssClass(r);t+=` ${o} {`;for(const a of kf.values)for(const u of Object.keys(r[a])){const f=this._makeVariable({device:a,preset:r,property:u}),d=this._makeInternalVariableName(u,a);if(t+=`${d}: var(${f}, inherit);`,i&&!me.attributes.includes(u)){const m=d.replace("preset-","");t+=`${m}: var(${d});`}}t+="}"}return t}_makeInternalVariableName(e,t){const r=e==="color"?"font-color":e.replace(/_/i,"-"),i=t===kf.COMMON?"":`-${t}`;return`--zw-preset-${r}${i}`}makePresetHtmlClass(e){return this._baseClass+e.id}makePresetCssClass(e){return this.makePresetHtmlClass(e).split(" ").map(t=>`.${t}`).join("")}}class yd{static _instance;static get instance(){return this._instance??=new yd,this._instance}static query(e,t){return this.instance.query(e,t)}query(e,t){let r=null;return e.descendants(i=>{if(r)return!1;if(this.matchNode(i,t))return r=i,!1}),r?t.getMark?this.getMark(r,t.getMark):r:null}matchNode(e,t){return!(t.typeName&&t.typeName!==e.type.name||t.mark&&!this.getMark(e,t.mark))}getMark(e,t){return e.marks.find(r=>this.matchMark(r,t))||null}matchMark(e,t){return e.type.name===t.typeName}}class XO{static createWindow(){return new jp.JSDOM().window}types;parse(e){const{window:t}=new jp.JSDOM(e);return this.types=t,t.document}}exports.ContentSerializer=gd,exports.ContextWindow=Pi,exports.NodeDomParser=XO;
39
+ }`;var ee=Gp(function(){return pe(w,G+"return "+R).apply(t,x)});if(ee.source=R,Vc(ee))throw ee;return ee}function Sx(s){return ge(s).toLowerCase()}function xx(s){return ge(s).toUpperCase()}function kx(s,l,u){if(s=ge(s),s&&(u||l===t))return td(s);if(!s||!(l=kt(l)))return s;var d=Yt(s),y=Yt(l),w=nd(d,y),x=rd(d,y)+1;return rr(d,w,x).join("")}function Ex(s,l,u){if(s=ge(s),s&&(u||l===t))return s.slice(0,sd(s)+1);if(!s||!(l=kt(l)))return s;var d=Yt(s),y=rd(d,Yt(l))+1;return rr(d,0,y).join("")}function _x(s,l,u){if(s=ge(s),s&&(u||l===t))return s.replace(Va,"");if(!s||!(l=kt(l)))return s;var d=Yt(s),y=nd(d,Yt(l));return rr(d,y).join("")}function Tx(s,l){var u=Jn,d=sn;if(Te(l)){var y="separator"in l?l.separator:y;u="length"in l?Q(l.length):u,d="omission"in l?kt(l.omission):d}s=ge(s);var w=s.length;if(ni(s)){var x=Yt(s);w=x.length}if(u>=w)return s;var E=u-ri(d);if(E<1)return d;var T=x?rr(x,0,E).join(""):s.slice(0,E);if(y===t)return T+d;if(x&&(E+=T.length-E),Kc(y)){if(s.slice(E).search(y)){var O,N=T;for(y.global||(y=lc(y.source,ge(kh.exec(y))+"g")),y.lastIndex=0;O=y.exec(N);)var R=O.index;T=T.slice(0,R===t?E:R)}}else if(s.indexOf(kt(y),E)!=E){var H=T.lastIndexOf(y);H>-1&&(T=T.slice(0,H))}return T+d}function Cx(s){return s=ge(s),s&&By.test(s)?s.replace(wh,n2):s}var Mx=ui(function(s,l,u){return s+(u?" ":"")+l.toUpperCase()}),qc=Jd("toUpperCase");function Kp(s,l,u){return s=ge(s),l=u?t:l,l===t?Xb(s)?s2(s):Wb(s):s.match(l)||[]}var Gp=ne(function(s,l){try{return St(s,t,l)}catch(u){return Vc(u)?u:new X(u)}}),Ax=Tn(function(s,l){return Lt(l,function(u){u=un(u),En(s,u,Wc(s[u],s))}),s});function Ix(s){var l=s==null?0:s.length,u=J();return s=l?Ee(s,function(d){if(typeof d[1]!="function")throw new Pt(a);return[u(d[0]),d[1]]}):[],ne(function(d){for(var y=-1;++y<l;){var w=s[y];if(St(w[0],this,d))return St(w[1],this,d)}})}function Ox(s){return nv(zt(s,p))}function jc(s){return function(){return s}}function Nx(s,l){return s==null||s!==s?l:s}var Rx=jd(),Lx=jd(!0);function dt(s){return s}function Yc(s){return _d(typeof s=="function"?s:zt(s,p))}function Px(s){return Cd(zt(s,p))}function Dx(s,l){return Md(s,zt(l,p))}var zx=ne(function(s,l){return function(u){return es(u,s,l)}}),Bx=ne(function(s,l){return function(u){return es(s,u,l)}});function Xc(s,l,u){var d=$e(l),y=wo(l,d);u==null&&!(Te(l)&&(y.length||!d.length))&&(u=l,l=s,s=this,y=wo(l,$e(l)));var w=!(Te(u)&&"chain"in u)||!!u.chain,x=Mn(s);return Lt(y,function(E){var T=l[E];s[E]=T,x&&(s.prototype[E]=function(){var O=this.__chain__;if(w||O){var N=s(this.__wrapped__),R=N.__actions__=ut(this.__actions__);return R.push({func:T,args:arguments,thisArg:s}),N.__chain__=O,N}return T.apply(s,Xn([this.value()],arguments))})}),s}function Fx(){return je._===this&&(je._=f2),this}function Zc(){}function Hx(s){return s=Q(s),ne(function(l){return Ad(l,s)})}var $x=Ac(Ee),Wx=Ac(Yh),Ux=Ac(ec);function Jp(s){return Dc(s)?tc(un(s)):vv(s)}function Vx(s){return function(l){return s==null?t:Ir(s,l)}}var Kx=Xd(),Gx=Xd(!0);function Qc(){return[]}function eu(){return!1}function Jx(){return{}}function qx(){return""}function jx(){return!0}function Yx(s,l){if(s=Q(s),s<1||s>jn)return[];var u=wt,d=et(s,wt);l=J(l),s-=wt;for(var y=ic(d,l);++u<s;)l(u);return y}function Xx(s){return Z(s)?Ee(s,un):Et(s)?[s]:ut(dp(ge(s)))}function Zx(s){var l=++c2;return ge(s)+l}var Qx=To(function(s,l){return s+l},0),ek=Ic("ceil"),tk=To(function(s,l){return s/l},1),nk=Ic("floor");function rk(s){return s&&s.length?vo(s,dt,mc):t}function ik(s,l){return s&&s.length?vo(s,J(l,2),mc):t}function sk(s){return Qh(s,dt)}function ok(s,l){return Qh(s,J(l,2))}function lk(s){return s&&s.length?vo(s,dt,vc):t}function ak(s,l){return s&&s.length?vo(s,J(l,2),vc):t}var ck=To(function(s,l){return s*l},1),uk=Ic("round"),fk=To(function(s,l){return s-l},0);function hk(s){return s&&s.length?rc(s,dt):0}function dk(s,l){return s&&s.length?rc(s,J(l,2)):0}return v.after=PS,v.ary=Ep,v.assign=x5,v.assignIn=Bp,v.assignInWith=Fo,v.assignWith=k5,v.at=E5,v.before=_p,v.bind=Wc,v.bindAll=Ax,v.bindKey=Tp,v.castArray=JS,v.chain=Sp,v.chunk=nw,v.compact=rw,v.concat=iw,v.cond=Ix,v.conforms=Ox,v.constant=jc,v.countBy=hS,v.create=_5,v.curry=Cp,v.curryRight=Mp,v.debounce=Ap,v.defaults=T5,v.defaultsDeep=C5,v.defer=DS,v.delay=zS,v.difference=sw,v.differenceBy=ow,v.differenceWith=lw,v.drop=aw,v.dropRight=cw,v.dropRightWhile=uw,v.dropWhile=fw,v.fill=hw,v.filter=pS,v.flatMap=yS,v.flatMapDeep=bS,v.flatMapDepth=vS,v.flatten=yp,v.flattenDeep=dw,v.flattenDepth=pw,v.flip=BS,v.flow=Rx,v.flowRight=Lx,v.fromPairs=mw,v.functions=L5,v.functionsIn=P5,v.groupBy=wS,v.initial=yw,v.intersection=bw,v.intersectionBy=vw,v.intersectionWith=ww,v.invert=z5,v.invertBy=B5,v.invokeMap=xS,v.iteratee=Yc,v.keyBy=kS,v.keys=$e,v.keysIn=ht,v.map=Ro,v.mapKeys=H5,v.mapValues=$5,v.matches=Px,v.matchesProperty=Dx,v.memoize=Po,v.merge=W5,v.mergeWith=Fp,v.method=zx,v.methodOf=Bx,v.mixin=Xc,v.negate=Do,v.nthArg=Hx,v.omit=U5,v.omitBy=V5,v.once=FS,v.orderBy=ES,v.over=$x,v.overArgs=HS,v.overEvery=Wx,v.overSome=Ux,v.partial=Uc,v.partialRight=Ip,v.partition=_S,v.pick=K5,v.pickBy=Hp,v.property=Jp,v.propertyOf=Vx,v.pull=Ew,v.pullAll=vp,v.pullAllBy=_w,v.pullAllWith=Tw,v.pullAt=Cw,v.range=Kx,v.rangeRight=Gx,v.rearg=$S,v.reject=MS,v.remove=Mw,v.rest=WS,v.reverse=Hc,v.sampleSize=IS,v.set=J5,v.setWith=q5,v.shuffle=OS,v.slice=Aw,v.sortBy=LS,v.sortedUniq=Dw,v.sortedUniqBy=zw,v.split=yx,v.spread=US,v.tail=Bw,v.take=Fw,v.takeRight=Hw,v.takeRightWhile=$w,v.takeWhile=Ww,v.tap=rS,v.throttle=VS,v.thru=No,v.toArray=Pp,v.toPairs=$p,v.toPairsIn=Wp,v.toPath=Xx,v.toPlainObject=zp,v.transform=j5,v.unary=KS,v.union=Uw,v.unionBy=Vw,v.unionWith=Kw,v.uniq=Gw,v.uniqBy=Jw,v.uniqWith=qw,v.unset=Y5,v.unzip=$c,v.unzipWith=wp,v.update=X5,v.updateWith=Z5,v.values=di,v.valuesIn=Q5,v.without=jw,v.words=Kp,v.wrap=GS,v.xor=Yw,v.xorBy=Xw,v.xorWith=Zw,v.zip=Qw,v.zipObject=eS,v.zipObjectDeep=tS,v.zipWith=nS,v.entries=$p,v.entriesIn=Wp,v.extend=Bp,v.extendWith=Fo,Xc(v,v),v.add=Qx,v.attempt=Gp,v.camelCase=rx,v.capitalize=Up,v.ceil=ek,v.clamp=ex,v.clone=qS,v.cloneDeep=YS,v.cloneDeepWith=XS,v.cloneWith=jS,v.conformsTo=ZS,v.deburr=Vp,v.defaultTo=Nx,v.divide=tk,v.endsWith=ix,v.eq=Zt,v.escape=sx,v.escapeRegExp=ox,v.every=dS,v.find=mS,v.findIndex=mp,v.findKey=M5,v.findLast=gS,v.findLastIndex=gp,v.findLastKey=A5,v.floor=nk,v.forEach=xp,v.forEachRight=kp,v.forIn=I5,v.forInRight=O5,v.forOwn=N5,v.forOwnRight=R5,v.get=Gc,v.gt=QS,v.gte=e5,v.has=D5,v.hasIn=Jc,v.head=bp,v.identity=dt,v.includes=SS,v.indexOf=gw,v.inRange=tx,v.invoke=F5,v.isArguments=Rr,v.isArray=Z,v.isArrayBuffer=t5,v.isArrayLike=ft,v.isArrayLikeObject=Oe,v.isBoolean=n5,v.isBuffer=ir,v.isDate=r5,v.isElement=i5,v.isEmpty=s5,v.isEqual=o5,v.isEqualWith=l5,v.isError=Vc,v.isFinite=a5,v.isFunction=Mn,v.isInteger=Op,v.isLength=zo,v.isMap=Np,v.isMatch=c5,v.isMatchWith=u5,v.isNaN=f5,v.isNative=h5,v.isNil=p5,v.isNull=d5,v.isNumber=Rp,v.isObject=Te,v.isObjectLike=Me,v.isPlainObject=ls,v.isRegExp=Kc,v.isSafeInteger=m5,v.isSet=Lp,v.isString=Bo,v.isSymbol=Et,v.isTypedArray=hi,v.isUndefined=g5,v.isWeakMap=y5,v.isWeakSet=b5,v.join=Sw,v.kebabCase=lx,v.last=Ft,v.lastIndexOf=xw,v.lowerCase=ax,v.lowerFirst=cx,v.lt=v5,v.lte=w5,v.max=rk,v.maxBy=ik,v.mean=sk,v.meanBy=ok,v.min=lk,v.minBy=ak,v.stubArray=Qc,v.stubFalse=eu,v.stubObject=Jx,v.stubString=qx,v.stubTrue=jx,v.multiply=ck,v.nth=kw,v.noConflict=Fx,v.noop=Zc,v.now=Lo,v.pad=ux,v.padEnd=fx,v.padStart=hx,v.parseInt=dx,v.random=nx,v.reduce=TS,v.reduceRight=CS,v.repeat=px,v.replace=mx,v.result=G5,v.round=uk,v.runInContext=_,v.sample=AS,v.size=NS,v.snakeCase=gx,v.some=RS,v.sortedIndex=Iw,v.sortedIndexBy=Ow,v.sortedIndexOf=Nw,v.sortedLastIndex=Rw,v.sortedLastIndexBy=Lw,v.sortedLastIndexOf=Pw,v.startCase=bx,v.startsWith=vx,v.subtract=fk,v.sum=hk,v.sumBy=dk,v.template=wx,v.times=Yx,v.toFinite=An,v.toInteger=Q,v.toLength=Dp,v.toLower=Sx,v.toNumber=Ht,v.toSafeInteger=S5,v.toString=ge,v.toUpper=xx,v.trim=kx,v.trimEnd=Ex,v.trimStart=_x,v.truncate=Tx,v.unescape=Cx,v.uniqueId=Zx,v.upperCase=Mx,v.upperFirst=qc,v.each=xp,v.eachRight=kp,v.first=bp,Xc(v,function(){var s={};return an(v,function(l,u){ve.call(v.prototype,u)||(s[u]=l)}),s}(),{chain:!1}),v.VERSION=r,Lt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(s){v[s].placeholder=v}),Lt(["drop","take"],function(s,l){se.prototype[s]=function(u){u=u===t?1:ze(Q(u),0);var d=this.__filtered__&&!l?new se(this):this.clone();return d.__filtered__?d.__takeCount__=et(u,d.__takeCount__):d.__views__.push({size:et(u,wt),type:s+(d.__dir__<0?"Right":"")}),d},se.prototype[s+"Right"]=function(u){return this.reverse()[s](u).reverse()}}),Lt(["filter","map","takeWhile"],function(s,l){var u=l+1,d=u==on||u==He;se.prototype[s]=function(y){var w=this.clone();return w.__iteratees__.push({iteratee:J(y,3),type:u}),w.__filtered__=w.__filtered__||d,w}}),Lt(["head","last"],function(s,l){var u="take"+(l?"Right":"");se.prototype[s]=function(){return this[u](1).value()[0]}}),Lt(["initial","tail"],function(s,l){var u="drop"+(l?"":"Right");se.prototype[s]=function(){return this.__filtered__?new se(this):this[u](1)}}),se.prototype.compact=function(){return this.filter(dt)},se.prototype.find=function(s){return this.filter(s).head()},se.prototype.findLast=function(s){return this.reverse().find(s)},se.prototype.invokeMap=ne(function(s,l){return typeof s=="function"?new se(this):this.map(function(u){return es(u,s,l)})}),se.prototype.reject=function(s){return this.filter(Do(J(s)))},se.prototype.slice=function(s,l){s=Q(s);var u=this;return u.__filtered__&&(s>0||l<0)?new se(u):(s<0?u=u.takeRight(-s):s&&(u=u.drop(s)),l!==t&&(l=Q(l),u=l<0?u.dropRight(-l):u.take(l-s)),u)},se.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},se.prototype.toArray=function(){return this.take(wt)},an(se.prototype,function(s,l){var u=/^(?:filter|find|map|reject)|While$/.test(l),d=/^(?:head|last)$/.test(l),y=v[d?"take"+(l=="last"?"Right":""):l],w=d||/^find/.test(l);y&&(v.prototype[l]=function(){var x=this.__wrapped__,E=d?[1]:arguments,T=x instanceof se,O=E[0],N=T||Z(x),R=function(ie){var ue=y.apply(v,Xn([ie],E));return d&&H?ue[0]:ue};N&&u&&typeof O=="function"&&O.length!=1&&(T=N=!1);var H=this.__chain__,G=!!this.__actions__.length,q=w&&!H,ee=T&&!G;if(!w&&N){x=ee?x:new se(this);var j=s.apply(x,E);return j.__actions__.push({func:No,args:[R],thisArg:t}),new Dt(j,H)}return q&&ee?s.apply(this,E):(j=this.thru(R),q?d?j.value()[0]:j.value():j)})}),Lt(["pop","push","shift","sort","splice","unshift"],function(s){var l=ro[s],u=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",d=/^(?:pop|shift)$/.test(s);v.prototype[s]=function(){var y=arguments;if(d&&!this.__chain__){var w=this.value();return l.apply(Z(w)?w:[],y)}return this[u](function(x){return l.apply(Z(x)?x:[],y)})}}),an(se.prototype,function(s,l){var u=v[l];if(u){var d=u.name+"";ve.call(li,d)||(li[d]=[]),li[d].push({name:l,func:u})}}),li[_o(t,M).name]=[{name:"wrapper",func:t}],se.prototype.clone=C2,se.prototype.reverse=M2,se.prototype.value=A2,v.prototype.at=iS,v.prototype.chain=sS,v.prototype.commit=oS,v.prototype.next=lS,v.prototype.plant=cS,v.prototype.reverse=uS,v.prototype.toJSON=v.prototype.valueOf=v.prototype.value=fS,v.prototype.first=v.prototype.head,Ji&&(v.prototype[Ji]=aS),v},ii=o2();_r?((_r.exports=ii)._=ii,Ya._=ii):je._=ii}).call(iO)}($s,$s.exports)),$s.exports}var xy=sO();function ch(n){return n.type.create(xy.cloneDeep(n.attrs))}function uh({tr:n,node:e,position:t,mark:r}){return e.isText?n.removeMark(t,t+e.nodeSize,r):n.removeNodeMark(t,r)}const oO=Ie.create({name:"node_processor",addCommands(){return{setBlockAttributes:z(({commands:n,state:e},t,r,i={})=>{const o=B(n.getBlockAttributes(t))??{},{doc:a,tr:c}=e,{from:f,to:h}=c.selection;a.nodesBetween(f,h,(m,p)=>{Ce.blocks.includes(m.type.name)&&c.setNodeAttribute(p,t,{...i,...o,...r})})}),getBlockAttributes:z(({editor:n},e,t)=>he(()=>{let r=Object.assign({},t||{});for(const i of Ce.blocks)Object.assign(r,n.getAttributes(i)?.[e]||{});return Object.keys(r).length?r:null})),removeBlockAttributes:z(({commands:n},e)=>{for(const t of Ce.blocks)n.resetAttributes(t,e)}),applyMark:z(({state:n,commands:e},t,r,i={})=>{const{tr:o,doc:a,schema:c}=n,{$from:f,$to:h}=o.selection,m=hn(me.LINK,c),p=hn(t,c);if(!(p.spec.group||"").includes(dn.SETTINGS))return e.setMark(t,r);if(f.pos===h.pos)return;const b=S=>{if(!i.onAppliedToParent||i.onAppliedToParent(S)===!1){const{tr:k,node:C,position:M,mark:P}=S;uh({tr:k,node:C,position:M,mark:P.type})}};a.nodesBetween(f.pos,h.pos,(S,k)=>{if(S.type.name===Ce.LIST)return;const C=rO(S.marks,t),M=p.create({...C?.attrs||{},...r}),P=vy(f,h,S,k);if(!m.isInSet(S.marks)&&nO(o.doc,k,M,i.isAppliedToParent))return b({tr:o,node:S,position:k,mark:M});if(S.isText){o.addMark(P.from,P.to,M);return}eO(o.doc,o.selection,S,k)&&o.addNodeMark(k,M)})}),getMarks:z(({editor:n},e)=>{const t=yi(n,"state");return he(()=>{const{selection:r,doc:i}=B(t),{from:o,to:a}=B(r),c=[];return i.nodesBetween(o,a,f=>{for(const h of f.marks)h.type.name===e&&c.unshift(h.attrs)}),c})}),getMark:z(({commands:n},e)=>{const t=n.getMarks(e);return he(()=>B(t)[0]??null)}),hasMark:z(({commands:n},e)=>{const t=n.getMark(e);return he(()=>!!B(t))}),getCommonSettingMark:z(({commands:n},e,t)=>{const r=n.getMark(e);return he(()=>B(r)?.value??B(t))}),getDeviceSettingMark:z(({commands:n},e,t)=>{const r=n.getMarks(e),i=n.getDevice();return he(()=>{for(const o of B(r)){const a=o[B(i)];if(a)return a}return B(t)})}),removeAllMarks:z(({state:n})=>{const{tr:e,doc:t}=n,{from:r,to:i}=e.selection;t.nodesBetween(r,i,(o,a)=>{for(const c of o.marks)uh({tr:e,node:o,position:a,mark:c})})}),removeMarks:z(({state:n},e)=>{const{tr:t,doc:r}=n,{from:i,to:o}=t.selection;r.nodesBetween(i,o,(a,c)=>{const f=a.marks.filter(h=>e.includes(h.type.name));for(const h of f)uh({tr:t,node:a,position:c,mark:h})})})}}}),lO=Ie.create({name:"text_processor",addCommands(){return{getSelectedText:z(({state:n})=>{const{from:e,to:t}=n.selection;return n.doc.textBetween(e,t," ")}),transformText:z(({state:n},e)=>{const{$from:t,$to:r}=n.tr.selection;t.pos!==r.pos&&n.doc.nodesBetween(t.pos,r.pos,(i,o)=>{if(!i.isText)return;const a=vy(t,r,i,o),c=Math.max(0,t.pos-o),f=Math.max(0,r.pos-o),h=e({text:i.textContent.substring(c,f)}),m=n.schema.text(h,i.marks);n.tr.replaceWith(a.from,a.to,m)})})}}}),aO=Ie.create({name:"selection_processor",addStorage:()=>({selection:null}),addCommands(){return{storeSelection:z(({state:n})=>{this.storage.selection=n.selection}),restoreSelection:z(({commands:n})=>{this.storage.selection&&n.setTextSelection(this.storage.selection)}),expandSelection:z(({tr:n,commands:e},t)=>{let r=n.selection.from,i=n.selection.to;return n.doc.nodesBetween(r,i,(o,a,c)=>{if(t({node:o,parent:c})){const f=o.isText?0:wy(n.doc,a);r=Math.min(r,a+f),i=Math.max(i,a+o.nodeSize-f)}}),e.setTextSelection({from:r,to:i})}),expandSelectionToBlock:z(({commands:n})=>n.expandSelection(({parent:e})=>e.type.name===Re.DOCUMENT))}}}),cO=Gn.create({name:"doc",topNode:!0,content:"block+"});class Ks extends We{constructor(e,t,r,i="SetDocAttr"){super(),this.key=e,this.value=t,this.schema=r,this.stepType=i}apply(e){this.prevValue=e.attrs.meta[this.key];const t=ur.fromJSON(this.schema,e.toJSON());return t.attrs.meta[this.key]=this.value,Le.ok(t)}invert(){return new Ks(this.key,this.prevValue,this.schema,"revertSetDocAttr")}map(){return null}toJSON(){return{stepType:this.stepType,key:this.key,value:this.value}}static fromJSON(e){return new Ks(e.key,e.value,e.stepType)}}We.jsonID("setDocAttr",Ks);const uO=cO.extend({marks:dn.SETTINGS,addAttributes:()=>({meta:{default:{}}}),onCreate(){this.editor.view.dom.addEventListener("click",n=>{n.target.closest("a")&&n.preventDefault()})},addCommands(){return{setDocMetaAttributes:z(({state:n},e,t)=>{n.tr.step(new Ks(e,t,n.schema))})}}}),fO=Gn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Ai(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),hO=fO.extend({marks:dn.ALL,addOptions:()=>({HTMLAttributes:{class:"zw-style"}})}),dO=Gn.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(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,Ai(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>BM({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),pO=dO.extend({marks:dn.ALL,addOptions:()=>({levels:[1,2,3,4],HTMLAttributes:{class:"zw-style"}})}),mO=Ie.create({name:"prose_mirror_plugins",addProseMirrorPlugins(){return[oA.create(this.editor),lA.create(this.editor)]}}),gO=()=>[uO,hO,pO,$M,XM,oO,lO,aO,mO],yO=At.create({name:me.FONT_FAMILY,group:dn.SETTINGS,addOptions:()=>({fonts:[]}),addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontFamily:z(({commands:n},e)=>{n.applyMark(this.name,{value:e});const t=n.findFontByName(e);let r=B(n.getFontWeight());t.isWeightSupported(r)||(r=t.findClosestWeight(r),n.applyFontWeight(r));const i=n.isSettingCustomized(me.FONT_STYLE).value;!t.isItalicSupported(r)&&i&&n.removeItalic()}),getFont:z(({commands:n})=>{const e=B(this.options.defaultPreset),t=n.findFontByName(e.common.font_family),r=n.getFontFamily();return he(()=>n.findFontByName(B(r))||t)}),findFontByName:z((n,e)=>B(this.options.fonts).find(t=>t.name===e)??this.options.defaultFont),getFontFamily:z(({commands:n})=>n.getCommonSettingMark(this.name,n.getDefaultFontFamily())),getDefaultFontFamily:z(({commands:n})=>{const e=n.getPreset();return he(()=>B(e).common.font_family)})}},parseHTML(){const n=e=>({value:e.replace(/["']/g,"")});return[{style:"--zw-font-family",getAttrs:n},{style:"font-family",getAttrs:n}]},renderHTML({HTMLAttributes:n}){const e=n.value?`"${n.value}"`:null;return Gr({font_family:e})}}),bO=Ie.create({name:me.STYLE_PRESET,addGlobalAttributes(){return[{types:[Ce.PARAGRAPH,Ce.HEADING],attributes:{preset:{isRequired:!1,default:{id:B(this.options.defaultId)},parseHTML:n=>{const e=B(this.options.presets);if(n.parentElement.tagName==="LI")return null;for(const{id:t,node:r,fallbackClass:i}of e){if(i&&n.classList.contains(i))return{id:t};const o=B(this.options.styleRenderer).makePresetCssClass({id:t});if(n.matches(o))return{id:t};if(n.tagName===`H${r?.level}`)return{id:t}}return n.tagName==="P"?{id:B(this.options.defaultId)}:null},renderHTML:n=>n.preset?{class:B(this.options.styleRenderer).makePresetHtmlClass(n.preset)}:null}}}]},addCommands(){function n(t,r){return t.find(i=>r===i.id)}function e(t,r){const i={};for(const o of Object.keys(t)){const a=t[o],c=r[o],f=!c||c.toLowerCase()==="inherit";i[o]=f?a:c}return i}return{getPresetList:z(()=>he(()=>B(this.options.presets).filter(t=>!t.hidden))),getPreset:z(({commands:t})=>{const r=t.getBlockAttributes("preset",{id:B(this.options.defaultId)}),i=t.getPresetList(),o=t.isLink(),a=t.getLinkPreset();return he(()=>{const c=n(B(i),B(r).id);if(!B(o))return c;const f=B(a);return{id:c.id,common:e(c.common,f.common),mobile:e(c.mobile,f.mobile),tablet:e(c.tablet,f.tablet),desktop:e(c.desktop,f.desktop)}})}),applyPreset:z(({commands:t,chain:r},i)=>{const o=B(t.getPresetList()),a=n(o,i),c=a.node?.type??Ce.PARAGRAPH,f={preset:{id:i}};a.node&&(f.level=a.node.level);for(const h of me.attributes)f[h]=B(t.getBlockAttributes(h));r().removeList().setNode(c,f).run()}),applyDefaultPreset:z(({commands:t})=>{t.applyPreset(B(this.options.defaultId))}),removePreset:z(({commands:t})=>{t.setNode(Ce.PARAGRAPH,{preset:null})}),getPresetCustomization:z(({editor:t,commands:r})=>{const i=yi(t,"state");return he(()=>{const{selection:o,doc:a}=B(i),{from:c,to:f}=o;return r._getSettingCustomization(a,c,f)})}),isSettingCustomized:z(({commands:t},r)=>{const i=t.getPresetCustomization(),o=me.presetAttributes.includes(r)?"attributes":"marks";return he(()=>B(i)[o]?.includes(r)??!1)}),getContentCustomization:z(({editor:t,commands:r})=>{const i=yi(t,"state");return he(()=>{const{doc:o}=B(i);return r._getSettingCustomization(o,0,o.content.size)})}),_getSettingCustomization:z((t,r,i,o)=>{const a=new Set,c=new Set;return r.nodesBetween(i,o,f=>{for(const[h,m]of Object.entries(f.attrs))me.presetAttributes.includes(h)&&m&&c.add(h);for(const{type:h}of f.marks)me.marks.includes(h.name)&&a.add(h.name)}),{attributes:Array.from(c),marks:Array.from(a)}}),removePresetCustomization:z(({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeMarks(me.marks).resetAttributes(Ce.PARAGRAPH,me.presetAttributes).resetAttributes(Ce.HEADING,me.presetAttributes).restoreSelection().run()}),removeFormat:z(({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeAllMarks().applyDefaultPreset().restoreSelection().run()})}},onCreate(){this.options.styleRenderer.inject(Li.head,B(this.options.presets))}}),vO=At.create({name:me.FONT_WEIGHT,group:dn.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontWeight:z(({commands:n},e)=>{n.applyMark(this.name,{value:e}),B(n.getFont()).isItalicSupported(e)||n.removeItalic()}),toggleBold:z(({commands:n})=>{const e=B(n.getFontWeight()),t=B(n.getFont()),i=Number(e)>=600?"400":"700",o=t.findClosestWeight(i);n.applyFontWeight(o)}),getFontWeight:z(({commands:n})=>{const e=n.getCommonSettingMark(this.name,n.getDefaultFontWeight()),t=n.getFont();return he(()=>{const r=B(e),i=B(t);return i.isWeightSupported(r)?r:i.findClosestWeight(r)})}),getDefaultFontWeight:z(({commands:n})=>{const e=n.getPreset();return he(()=>B(e).common.font_weight)})}},addKeyboardShortcuts:()=>({"Mod-b":Gt("toggleBold"),"Mod-B":Gt("toggleBold")}),parseHTML(){const n=e=>e==="bold"?{value:"700"}:Number(e)?{value:e}:!1;return[{style:"--zw-font-weight",getAttrs:n},{style:"font-weight",getAttrs:n},{tag:"b",attrs:{value:"700"}},{tag:"strong",attrs:{value:"700"}}]},renderHTML({HTMLAttributes:n}){return Gr({font_weight:n.value})}}),wO=At.create({name:me.FONT_SIZE,group:dn.SETTINGS,addOptions:()=>({minSize:1,maxSize:100}),addAttributes(){return{mobile:{default:null},tablet:{default:null},desktop:{default:null}}},addCommands(){return{getFontSize:z(({commands:n})=>n.getDeviceSettingMark(this.name,n.getDefaultFontSize())),getDefaultFontSize:z(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return he(()=>B(t)[B(e)].font_size.replace("px",""))}),applyFontSize:z(({commands:n},e)=>{const t=B(n.getDevice());n.applyMark(this.name,{[t]:e},{isAppliedToParent:(r,i)=>r.type.name!==i.type.name?!1:r.attrs[t]===i.attrs[t],onAppliedToParent:({tr:r,node:i,position:o,mark:a})=>{const c={...a.attrs,[t]:null};if(!Object.values(c).some(m=>!!m))return!1;const h=a.type.create(c);if(i.isText){r.addMark(o,o+i.nodeSize,h);return}r.addNodeMark(o,h)}})}),increaseFontSize:z(({commands:n})=>{const e=Number(B(n.getFontSize())),t=Math.min(e+1,B(this.options.maxSize));n.applyFontSize(String(t))}),decreaseFontSize:z(({commands:n})=>{const e=Number(B(n.getFontSize())),t=Math.max(e-1,B(this.options.minSize));n.applyFontSize(String(t))})}},addKeyboardShortcuts:()=>({"Mod-Shift-=":Gt("increaseFontSize"),"Mod-Shift--":Gt("decreaseFontSize")}),parseHTML(){const n=e=>{if(!e)return null;const t=B(this.options.wrapperRef),r=by(e,t);return String(r)};return[{tag:'[style*="--zw-font-size"]',getAttrs:({style:e})=>({mobile:n(e.getPropertyValue("--zw-font-size-mobile")),tablet:n(e.getPropertyValue("--zw-font-size-tablet")),desktop:n(e.getPropertyValue("--zw-font-size-desktop"))})},{style:"font-size",getAttrs:e=>{const t=n(e);return{desktop:t,tablet:t,mobile:null}}}]},renderHTML({HTMLAttributes:n}){const e=t=>t?`${t}px`:null;return Gr({font_size_mobile:e(n.mobile),font_size_tablet:e(n.tablet),font_size_desktop:e(n.desktop)})}}),SO=At.create({name:me.FONT_COLOR,group:dn.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getFontColor:z(({commands:n})=>n.getCommonSettingMark(this.name,n.getDefaultFontColor())),getDefaultFontColor:z(({commands:n})=>{const e=n.getPreset();return he(()=>B(e).common.color)}),applyFontColor:z(({commands:n},e)=>{n.applyMark(this.name,{value:e})})}},parseHTML(){const n=e=>({value:yy(e)});return[{style:"--zw-font-color",getAttrs:n},{style:"color",getAttrs:n}]},renderHTML({HTMLAttributes:n}){return Gr({font_color:n.value})}}),xO=At.create({name:me.BACKGROUND_COLOR,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getBackgroundColor:z(({commands:n})=>n.getCommonSettingMark(this.name,"rgba(255, 255, 255, 0%)")),applyBackgroundColor:z(({commands:n},e)=>{n.applyMark(this.name,{value:e})})}},parseHTML(){const n=e=>({value:yy(e)});return[{style:"--zw-background-color",getAttrs:n},{style:"background-color",getAttrs:n}]},renderHTML({HTMLAttributes:n}){return Gr({background_color:n.value})}}),kO=Ie.create({name:"device_manager",addCommands(){return{getDevice:z(()=>yi(this.options,"device"))}}}),EO=At.create({name:me.FONT_STYLE,group:dn.SETTINGS,addAttributes:()=>({italic:{required:!0}}),addCommands(){return{isItalic:z(({commands:n})=>{const e=n.getMark(this.name),t=n.getDefaultFontStyle();return he(()=>B(e)?.italic??B(t).italic)}),isItalicAvailable:z(({commands:n})=>{const e=n.getFont(),t=n.getFontWeight();return he(()=>{const r=B(e),i=B(t);return r.isItalicSupported(i)&&!r.isWeightItalicOnly(i)})}),getDefaultFontStyle:z(({commands:n})=>{const e=n.getPreset();return he(()=>({italic:B(e).common.font_style==="italic"}))}),toggleItalic:z(({commands:n})=>{B(n.isItalicAvailable())&&(B(n.isItalic())?n.removeItalic():n.applyItalic())}),applyItalic:z(({commands:n})=>{n.applyMark(this.name,{italic:!0})}),removeItalic:z(({commands:n})=>{n.applyMark(this.name,{italic:!1})})}},addKeyboardShortcuts:()=>({"Mod-i":Gt("toggleItalic"),"Mod-I":Gt("toggleItalic")}),parseHTML(){const n=e=>({italic:e.includes("italic")});return[{tag:"i",attrs:{italic:!0}},{style:"--zw-font-style",getAttrs:n},{style:"font-style",getAttrs:n}]},renderHTML({HTMLAttributes:n}){const e=n.italic?"italic":"normal";return Gr({font_style:e})}}),_O=At.create({name:me.TEXT_DECORATION,priority:1e3,addAttributes:()=>({underline:{default:!1},strike_through:{default:!1}}),addCommands(){return{isUnderline:z(({commands:n})=>{const e=n.getTextDecoration();return he(()=>B(e).underline)}),isStrikeThrough:z(({commands:n})=>{const e=n.getTextDecoration();return he(()=>B(e).strike_through)}),getTextDecoration:z(({commands:n})=>{const e=n.getMark(this.name),t=n.getDefaultTextDecoration();return he(()=>{const r=B(e)??{},i=B(t);return{underline:r.underline||i.underline,strike_through:r.strike_through||i.strike_through}})}),isUnderlineCustomized:z(({commands:n})=>{const e=n.isUnderline(),t=n.getDefaultTextDecoration();return he(()=>B(e)!==B(t).underline)}),getDefaultTextDecoration:z(({commands:n})=>{const e=n.getPreset();return he(()=>{const{text_decoration:t}=B(e).common;return{underline:t.includes("underline"),strike_through:t.includes("line-through")}})}),toggleUnderline:z(({commands:n})=>{n.toggleTextDecoration("underline")}),toggleStrikeThrough:z(({commands:n})=>{n.toggleTextDecoration("strike_through")}),toggleTextDecoration:z(({commands:n},e,t=null)=>{const r=B(n.getTextDecoration()),i=t??!r[e];n.applyMark(this.name,{[e]:i})}),applyTextDecoration:z(({commands:n},e)=>{n.toggleTextDecoration(e,!0)}),removeTextDecoration:z(({commands:n},e)=>{n.toggleTextDecoration(e,!1)})}},addKeyboardShortcuts:()=>({"Mod-u":Gt("toggleUnderline"),"Mod-U":Gt("toggleUnderline")}),parseHTML(){const n=e=>{const t=e.includes("underline"),r=e.includes("line-through");return!t&&!r?!1:{underline:t,strike_through:r}};return[{style:"--zw-text-decoration",getAttrs:n},{style:"text-decoration-line",getAttrs:n},{style:"text-decoration",getAttrs:n},{tag:"s",attrs:{underline:!1,strike_through:!0}},{tag:"u",attrs:{underline:!0,strike_through:!1}}]},renderHTML({HTMLAttributes:n}){const e=[];return n.underline&&e.push("underline"),n.strike_through&&e.push("line-through"),e.length||e.push("none"),Gr({text_decoration:e.join(" ")})}}),TO=Ie.create({name:"case_style",addCommands(){return{applyCaseStyle:z(({commands:n},e)=>{switch(e){case xf.CAPITALIZE:return n.applyCapitalize();case xf.LOWERCASE:return n.applyLowerCase();case xf.UPPERCASE:return n.applyUpperCase()}}),applyCapitalize:z(({commands:n})=>{n.transformText(({text:e})=>CA(e))}),applyLowerCase:z(({commands:n})=>{n.transformText(({text:e})=>e.toLowerCase())}),applyUpperCase:z(({commands:n})=>{n.transformText(({text:e})=>e.toUpperCase())})}}}),ky={mobile:null,tablet:null,desktop:null},CO=Ie.create({name:me.ALIGNMENT,addGlobalAttributes:()=>[{types:[Ce.PARAGRAPH,Ce.HEADING],attributes:{[me.ALIGNMENT]:{isRequired:!1,parseHTML({style:n}){const e=QI(n.textAlign);if(e)return{desktop:e,tablet:e,mobile:e};const t=n.getPropertyValue("--zw-alignment-mobile")||null,r=n.getPropertyValue("--zw-alignment-tablet")||null,i=n.getPropertyValue("--zw-alignment-desktop")||null;return!t&&!r&&!i?null:{desktop:i,tablet:r,mobile:t}},renderHTML(n){return n.alignment?pa({alignment_mobile:n.alignment.mobile,alignment_tablet:n.alignment.tablet,alignment_desktop:n.alignment.desktop}):null}}}}],addCommands(){return{applyAlignment:z(({commands:n},e)=>{const t=B(n.getDevice());n.setBlockAttributes(this.name,{[t]:e},ky)}),removeAlignment:z(({commands:n})=>n.removeBlockAttributes(this.name)),getAlignment:z(({commands:n})=>{const e=n.getBlockAttributes(this.name,ky),t=n.getDevice(),r=n.getDefaultAlignment();return he(()=>B(e)?.[B(t)]??B(r))}),getDefaultAlignment:z(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return he(()=>B(t)[B(e)].alignment??br.LEFT)})}},addKeyboardShortcuts:()=>({"Mod-Shift-l":Gt("applyAlignment",br.LEFT),"Mod-Shift-e":Gt("applyAlignment",br.CENTER),"Mod-Shift-r":Gt("applyAlignment",br.RIGHT),"Mod-Shift-j":Gt("applyAlignment",br.JUSTIFY)})}),Ey={mobile:null,tablet:null,desktop:null},MO=Ie.create({name:me.LINE_HEIGHT,addGlobalAttributes(){return[{types:[Ce.PARAGRAPH,Ce.HEADING],attributes:{[me.LINE_HEIGHT]:{isRequired:!1,parseHTML:n=>{if(n.matches('[style*="--zw-line-height"]')){const o=n.style.getPropertyValue("--zw-line-height-tablet")||null,a=n.style.getPropertyValue("--zw-line-height-desktop")||null;return{mobile:null,tablet:o,desktop:a}}const e=n.style.lineHeight;if(!e)return null;const t=B(this.options.wrapperRef),r=XI(e,n,t);return r?{desktop:r,tablet:r,mobile:null}:null},renderHTML(n){return n.line_height?pa({line_height_mobile:n.line_height.mobile,line_height_tablet:n.line_height.tablet,line_height_desktop:n.line_height.desktop}):null}}}}]},addCommands(){return{getLineHeight:z(({commands:n})=>{const e=n.getBlockAttributes(this.name,Ey),t=n.getDevice(),r=n.getDefaultLineHeight();return he(()=>B(e)?.[B(t)]??B(r))}),getDefaultLineHeight:z(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return he(()=>B(t)[B(e)].line_height)}),applyLineHeight:z(({commands:n},e)=>{const t=B(n.getDevice());n.setBlockAttributes(this.name,{[t]:e},Ey)})}}}),AO=Gn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Ai(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),IO=AO.extend({name:Ce.LIST_ITEM,marks:dn.SETTINGS,addCommands(){const n=({selection:e})=>e.$cursor.before(e.$cursor.depth-1);return{listItemNewline:z(({commands:e,tr:t})=>{const r=t.doc.nodeAt(n(t));if(!t.selection.$cursor.node().textContent)return!1;e.splitListItem(this.name);const o=n(t);for(const a of r.marks)t.addNodeMark(o,ch(a));return!0})}},addOptions:()=>({HTMLAttributes:{class:"zw-style"}}),addKeyboardShortcuts:()=>({Enter:n=>{const{state:e,commands:t}=n.editor;if(e.selection.$cursor?.path.some(i=>i.type?.name===Ce.LIST))return t.listItemNewline()}})});function OO(n,e){if(Z0.includes(e.type)||e.type.isInSet(n.marks))return!1;for(const t of n.content.content)if(t.childCount&&(!t.marks||!e.isInSet(t.marks)))return!1;return!0}function NO(n){const e=n.selection.$from.start(),t=n.selection.$to.end();n.doc.nodesBetween(e,t,(r,i)=>{if(r.type.name===Re.LIST)return;if(r.type.name!==Re.LIST_ITEM)return!1;const o=[];return r.forEach(a=>{for(const c of a.marks){if(c.isInSet(o)){n.removeNodeMark(i+1,c);continue}OO(r,c)&&(n.removeNodeMark(i+1,c),n.addNodeMark(i,ch(c)),o.push(c))}}),!1})}const RO=Gn.create({name:Re.LIST,content:`${Re.LIST_ITEM}+`,group:"block list",marks:Ef.SETTINGS,addExtensions:()=>[IO],addOptions:()=>({baseClass:"",presetClass:""}),addAttributes:()=>({bullet:{default:{type:Ut.DISC}}}),parseHTML(){const n={a:Ut.ROMAN,i:Ut.LATIN,1:Ut.DECIMAL},e=t=>{for(const r of tA){const i=`.${B(this.options.baseClass)}${r}`;if(t.matches(i)||n[t.type.toLowerCase()]===r)return r}};return[{tag:"ol",getAttrs:t=>({bullet:{type:e(t)||Ut.DECIMAL}})},{tag:"ul",getAttrs:t=>({bullet:{type:e(t)||Ut.DISC}})}]},renderHTML({HTMLAttributes:n}){const e=[B(this.options.baseClass)+n.bullet.type,B(this.options.presetClass)];return[nA.includes(n.bullet.type)?"ol":"ul",{class:e.join(" ")},0]},addCommands(){return{getListType:z(({commands:n})=>{const e=n.getBlockAttributes("bullet",{type:null});return he(()=>B(e).type??null)}),applyList:z(({commands:n,chain:e},t)=>B(n.getListType())===t?n.removeList():e().applyDefaultPreset().toggleList(Re.LIST,Re.LIST_ITEM).setBlockAttributes("bullet",{type:t}).command(({tr:i})=>NO(i)).run()),removeList:z(({chain:n})=>n().expandSelection(({parent:e})=>e.type.name===Re.LIST).command(({tr:e})=>{const t=e.selection.$from.start(),r=e.selection.$to.end();return e.doc.nodesBetween(t,r,(i,o,a)=>{if([Re.LIST,Re.LIST_ITEM].includes(i.type.name))return;if(a.type.name!==Re.LIST_ITEM)return!1;const c=a.marks.filter(f=>!f.type.isInSet(i.marks));for(const f of c)e.addNodeMark(o,ch(f));return!1}),!0}).liftListItem(Re.LIST_ITEM).run())}},addInputRules(){const n=(e,t)=>FM({find:t,type:this.type,getAttributes:{bullet:{type:e}},joinPredicate:(r,{attrs:i})=>i.bullet.type===e});return[n(Ut.DISC,/^\s*([-+*])\s$/),n(Ut.DECIMAL,/^(\d+)\.\s$/),n(Ut.LATIN,/^([ivx]{1,3})\.\s$/i),n(Ut.ROMAN,/^([a-z])\.\s$/i)]}});function LO(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function PO(n){return new at({key:new Ct("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(h=>h.docChanged)&&!t.doc.eq(r.doc),o=e.some(h=>h.getMeta("preventAutolink"));if(!i||o)return;const{tr:a}=r,c=lM(t.doc,[...e]);if(gM(c).forEach(({newRange:h})=>{const m=cM(r.doc,h,b=>b.isTextblock);let p,g;if(m.length>1?(p=m[0],g=r.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ")):m.length&&r.doc.textBetween(h.from,h.to," "," ").endsWith(" ")&&(p=m[0],g=r.doc.textBetween(p.pos,h.to,void 0," ")),p&&g){const b=g.split(" ").filter(M=>M!=="");if(b.length<=0)return!1;const S=b[b.length-1],k=p.pos+g.lastIndexOf(S);if(!S)return!1;const C=da(S).map(M=>M.toObject(n.defaultProtocol));if(!LO(C))return!1;C.filter(M=>M.isLink).map(M=>({...M,from:k+M.start+1,to:k+M.end+1})).filter(M=>r.schema.marks.code?!r.doc.rangeHasMark(M.from,M.to,r.schema.marks.code):!0).filter(M=>n.validate(M.value)).filter(M=>n.shouldAutoLink(M.value)).forEach(M=>{F0(M.from,M.to,r.doc).some(P=>P.mark.type===n.type)||a.addMark(M.from,M.to,n.type.create({href:M.href}))})}}),!!a.steps.length)return a}})}function DO(n){return new at({key:new Ct("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,o;if(r.button!==0||!e.editable)return!1;let a=r.target;const c=[];for(;a.nodeName!=="DIV";)c.push(a),a=a.parentNode;if(!c.find(g=>g.nodeName==="A"))return!1;const f=dM(e.state,n.type.name),h=r.target,m=(i=h?.href)!==null&&i!==void 0?i:f.href,p=(o=h?.target)!==null&&o!==void 0?o:f.target;return h&&m?(window.open(m,p),!0):!1}}})}function zO(n){return new at({key:new Ct("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:i}=e,{selection:o}=i,{empty:a}=o;if(a)return!1;let c="";r.content.forEach(h=>{c+=h.textContent});const f=y1(c,{defaultProtocol:n.defaultProtocol}).find(h=>h.isLink&&h.value===c);return!c||!f?!1:n.editor.commands.setMark(n.type,{href:f.href})}}})}const BO=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function jr(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&t.push(i)}),!n||n.replace(BO,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const FO=At.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(n=>{if(typeof n=="string"){g1(n);return}g1(n.scheme,n.optionalSlashes)})},onDestroy(){kA()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!jr(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!jr(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!jr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Ai(this.options.HTMLAttributes,n),0]:["a",Ai(this.options.HTMLAttributes,{...n,href:""}),0]},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!jr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!jr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[HM({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,i=y1(n).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:a=>!!jr(a,t),protocols:t,defaultProtocol:r}));i.length&&i.forEach(o=>e.push({text:o.value,data:{href:o.href},index:o.start}))}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(PO({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!jr(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(DO({type:this.type})),this.options.linkOnPaste&&n.push(zO({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}}),HO=FO.extend({name:me.LINK,addOptions(){return{...this.parent?.(),openOnClick:!1,linkOnPaste:!1}},addAttributes(){return{href:{default:null,parseHTML:n=>{const e=n.getAttribute("href");return e.startsWith("#")?parseFloat(n.getAttribute("href").replace("#","")):e}},target:{default:e1.SELF,parseHTML:n=>n.getAttribute("target")||e1.SELF},destination:{default:Cs.URL,parseHTML:n=>{const e=n.getAttribute("href");if(!e.startsWith("#"))return Cs.URL;const t=e.replace("#","");return B(this.options.pageBlocks).find(o=>o.id===parseInt(t))?Cs.BLOCK:Cs.URL}}}},addCommands(){const{unsetLink:n}=this.parent();return{removeLink:n,applyLink:z(({commands:e,chain:t},r)=>(e.setMeta("preventAutolink",!0),e.getSelectedText()?t().applyMark(this.name,r).expandSelectionToLink().command(({tr:i})=>(r.text&&i.insertText(r.text,i.selection.from,i.selection.to),!0)).run():e.insertContent(Ty.text(r.text,[Ty.mark(me.LINK,r)])))),expandSelectionToLink:z(({commands:e})=>{e.expandSelection(({node:t})=>this.type.isInSet(t.marks))}),isLink:z(({commands:e})=>e.hasMark(this.name)),getLinkPreset:z(()=>he(()=>B(this.options.preset)))}},addProseMirrorPlugins(){return[...this.parent(),TA.create(this.editor)]},renderHTML({HTMLAttributes:n}){const e=n.destination===Cs.BLOCK?`#${n.href}`:n.href,t=B(this.options.basePresetClass)+B(this.options.preset).id;return["a",{href:e,target:n.target,class:`${t} zw-style`},0]}}),$O=At.create({name:me.SUPERSCRIPT,addCommands(){return{applySuperscript:z(({commands:n})=>{n.setMark(this.name)}),removeSuperscript:z(({commands:n})=>{n.unsetMark(this.name)}),toggleSuperscript:z(({commands:n})=>{B(n.isSuperscript())?n.removeSuperscript():n.applySuperscript()}),isSuperscript:z(({commands:n})=>{const e=n.getMark(this.name);return he(()=>!!B(e))})}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs:n=>n!=="super"?!1:null}]},renderHTML(){return["sup",{class:"zw-superscript"},0]}}),WO=Ie.create({name:me.MARGIN,addGlobalAttributes:()=>[{types:[Ce.PARAGRAPH,Ce.HEADING],attributes:{[me.MARGIN]:{isRequired:!1,parseHTML(n){const{margin:e,marginTop:t,marginRight:r,marginBottom:i,marginLeft:o}=n.style;return[e,t,r,i,o].some(f=>!!f)?e?{value:e}:{value:[t||0,r||0,i||0,o||0].join(" ")}:null},renderHTML(n){return n.margin?pa({margin:n.margin.value}):null}}}}]});function UO(n){const e=r=>n.presetsRef.value.find(i=>i.id===r),t=gu({default:null,link:null});return TE(n.presetsRef,()=>{t.default=e(n.defaultPresetId),t.link=e(n.linkPresetId)},{immediate:!0,deep:!0}),gO().concat([bO.configure({presets:n.presetsRef,defaultId:n.defaultPresetId,styleRenderer:new qO({baseClass:n.basePresetClass,makeVariable:n.makePresetVariable,linkPresetId:n.linkPresetId})}),RO.configure({baseClass:n.baseListClass,presetClass:n.basePresetClass+n.defaultPresetId}),kO.configure({device:n.deviceRef}),wO.configure({minSize:n.minFontSize,maxSize:n.maxFontSize,wrapperRef:n.wrapperRef}),yO.configure({fonts:n.fonts,defaultPreset:yi(t,"default"),defaultFont:n.defaultFont}),vO,SO,xO,EO,_O,TO,$O,CO,MO.configure({wrapperRef:n.wrapperRef}),HO.configure({preset:yi(t,"link"),basePresetClass:n.basePresetClass,pageBlocks:n.pageBlocksRef}),WO])}class VO{_domParser=new DOMParser;types=window;parse(e){return this._domParser.parseFromString(e,"text/html")}}class _y{content;constructor({content:e}){this.content=e}normalize(){throw new Error("Implement abstract method")}}class yn extends _y{static BLOCK_NODE_NAMES=["P","H1","H2","H3","H4"];static ROOT_NODE_NAMES=yn.BLOCK_NODE_NAMES.concat("UL","OL");static BLOCK_STYLES=["text-align","line-height","margin","margin-top","margin-bottom","margin-left","margin-right"];_parser;constructor({content:e,parser:t}){super({content:e}),this._parser=t,this.dom=null}normalize(){return this.normalizeHTML(),this.normalizedHTML}normalizeHTML(){this.dom=this._parser.parse(this.content.replace(/(\r)?\n/g,"")),this._removeComments(),this._normalizeRootTags(),this._iterateNodes(this._normalizeBreakLines,e=>e.tagName==="BR"),this._iterateNodes(this._removeEmptyNodes,this._isBlockNode),this._iterateNodes(this._normalizeListItems,e=>e.tagName==="LI"),this._normalizeBlockTextDecoration(),this._normalizeBlockBackgroundColor()}get normalizedHTML(){return this.dom.body.innerHTML}get _NodeFilter(){return this._parser.types.NodeFilter}get _Node(){return this._parser.types.Node}_removeComments(){const e=this._createNodeIterator(this._NodeFilter.SHOW_COMMENT);this._runIterator(e,t=>t.remove())}_normalizeRootTags(){const e=Array.from(this.dom.body.childNodes),t=this.dom.createDocumentFragment();let r;for(const i of e){if(this._isRootNode(i)){t.append(i),r=null;continue}r||(r=this.dom.createElement("p"),t.append(r)),r.append(i)}this.dom.body.innerHTML="",this.dom.body.append(t)}_createNodeIterator(e,t){return this.dom.createNodeIterator(this.dom.body,e,t)}_iterateNodes(e,t=()=>!0){const r=o=>o.tagName!=="BODY"&&t.call(this,o),i=this._createNodeIterator(this._NodeFilter.SHOW_ELEMENT,{acceptNode:o=>r(o)?this._NodeFilter.FILTER_ACCEPT:this._NodeFilter.FILTER_REJECT});this._runIterator(i,e)}_runIterator(e,t){let r=e.nextNode();for(;r;)t.call(this,r),r=e.nextNode()}_removeEmptyNodes(e){e.innerHTML.trim()||e.remove()}_normalizeListItems(e){const t=this.dom.createDocumentFragment(),r=Array.from(e.childNodes);let i,o;const a=c=>{this._assignElementProperties(c,e,yn.BLOCK_STYLES),t.append(c)};this._assignElementProperties(e,e.parentElement,yn.BLOCK_STYLES);for(const c of r){if(this._isBlockNode(c)){a(c),i=null,o=c;continue}if(c.tagName==="BR"&&o&&o?.tagName!=="BR"){c.remove(),o=c;continue}if(c.tagName==="BR"){const f=this.dom.createElement("p");f.append(c),a(f),i=null,o=c;continue}i||(i=this.dom.createElement("p"),a(i)),i.append(c),o=c}e.append(t),this._removeStyleProperties(e,yn.BLOCK_STYLES),this._removeStyleProperties(e.parentElement,yn.BLOCK_STYLES),this._assignElementProperties(e,e.parentElement),e.parentElement.lastElementChild===e&&this._removeStyleProperties(e.parentElement)}_isBlockNode(e){return yn.BLOCK_NODE_NAMES.includes(e.tagName)}_isRootNode(e){return yn.ROOT_NODE_NAMES.includes(e.tagName)}_assignElementProperties(e,t,r=Array.from(t.style)){for(const i of r){const o=t.style.getPropertyValue(i);o&&!e.style.getPropertyValue(i)&&e.style.setProperty(i,o)}}_removeStyleProperties(e,t=Array.from(e.style)){for(const r of t)e.style.removeProperty(r);e.style.length===0&&e.removeAttribute("style")}_normalizeBreakLines({parentElement:e}){if(!this._isBlockNode(e)||!e.textContent)return;const t=this.dom.createDocumentFragment(),r=Array.from(e.childNodes),i=e.cloneNode(!0);i.innerHTML="";let o=i.cloneNode();const a=c=>{this._assignElementProperties(c,e,yn.BLOCK_STYLES),t.append(c)};for(const c of r){if(c.tagName==="BR"){a(o),o=i.cloneNode();continue}o.append(c)}t.append(o),e.replaceWith(t)}_normalizeBlockTextDecoration(){const e=this.dom.querySelectorAll('[style*="text-decoration"]:where(p, h1, h2, h3, h4, li)');for(const t of e)this._moveTextDecorationToChildren(t)}_moveTextDecorationToChildren(e){const t=this._parseTextDecoration(e);if(e.style.removeProperty("text-decoration-line"),e.style.removeProperty("text-decoration"),e.style.cssText||e.removeAttribute("style"),!t.none)for(const r of e.childNodes){const i=this._wrapTextNode(e,r),o=this._parseTextDecoration(i),a={underline:o.underline||t.underline,line_through:o.line_through||t.line_through};i.style.removeProperty("text-decoration-line"),i.style.removeProperty("text-decoration"),i.style.textDecoration=Object.entries(a).filter(([,c])=>c).map(([c])=>c.replace("_","-")).join(" ")}}_parseTextDecoration(e){const{textDecoration:t,textDecorationLine:r}=e.style,i=t||r||"";return{none:i.includes("none"),underline:i.includes("underline"),line_through:i.includes("line-through")}}_normalizeBlockBackgroundColor(){const e=this.dom.querySelectorAll('[style*="background-color"]:where(p, h1, h2, h3, h4, li)');for(const t of e)this._moveBackgroundColorToChildren(t)}_moveBackgroundColorToChildren(e){const t=e.style.backgroundColor;e.style.removeProperty("background-color"),e.style.cssText||e.removeAttribute("style");for(const r of e.childNodes){const i=this._wrapTextNode(e,r),o=i.style.backgroundColor||t;i.style.backgroundColor=o}}_wrapTextNode(e,t){if(t.nodeType!==this._Node.TEXT_NODE)return t;const r=this.dom.createElement("span");return r.append(t.cloneNode()),e.replaceChild(r,t),r}}class KO extends _y{normalize(){return this._iterateNodes(this._bubbleMarks),this.content}_iterateNodes(e){this._iterateChildNodes(this.content,e)}_iterateChildNodes(e,t){for(const r of e.content)r.content&&this._iterateChildNodes(r,t),t.call(this,r)}_bubbleMarks(e){if(e.content&&e.type!==Ce.LIST){for(const t of e.content)if(!this._isLink(t)&&t.marks)for(const r of t.marks.slice()){if(this._includesMark(e,r)){this._removeMark(t,r);continue}this._canBubbleMark(e,r)&&(this._removeMark(t,r),this._addMark(e,r))}}}_canBubbleMark(e,t){if(me.inlineMarks.includes(t.type)||this._includesMarkType(e,t.type))return!1;for(const r of e.content)if(!(!r.content&&e.type===Ce.LIST_ITEM)&&(!r.marks||!this._includesMark(r,t)))return!1;return!0}_includesMark(e,t){return e.marks?.some(r=>xy.isEqual(r,t))??!1}_includesMarkType(e,t){return e.marks?.some(r=>r.type===t)??!1}_isLink(e){return e.type===Ce.TEXT&&this._includesMarkType(e,me.LINK)}_removeMark(e,t){if(!e.marks)return;const r=this._findMarkIndexByType(e,t.type);r>=0&&e.marks.splice(r,1),e.marks.length||delete e.marks}_addMark(e,t){this._removeMark(e,t),e.marks??=[],e.marks.push(t)}_findMarkIndexByType(e,t){return e.marks?.findIndex(r=>r.type===t)??null}}class Ia{static build(e,t={}){return typeof e=="string"?this._buildHtml(e,t):this._buildJson(e)}static _buildHtml(e,t){return new yn({content:e,parser:t.parser||new VO})}static _buildJson(e){return new KO({content:e})}static normalize(e,t={}){return Ia.build(e,t).normalize()}}class Li{static window=globalThis.window;static use(e){this.window=e}static get document(){return this.window.document}static get body(){return this.document.body}static get head(){return this.document.head}static getComputedStyle(e){return this.window.getComputedStyle(e)}}class gh{static build({config:e,nodeDomParser:t}){const r=UO({fonts:e.fonts,minFontSize:0,maxFontSize:0,presetsRef:qo(e.presets),defaultPresetId:e.defaultPresetId,linkPresetId:e.linkPresetId,makePresetVariable:()=>"",basePresetClass:e.basePresetClass,baseListClass:e.baseListClass,deviceRef:qo(Sf.DESKTOP),pageBlocksRef:qo([]),wrapperRef:Li.document.createElement("p")}),i=fM(r);return new gh({schema:i,domParser:bs.fromSchema(i),nodeDomParser:t})}_schema;_domParser;_nodeDomParser;constructor({schema:e,domParser:t,nodeDomParser:r}){this._schema=e,this._domParser=t,this._nodeDomParser=r}toJSON(e){const t=Ia.build(e,{parser:this._nodeDomParser});return t.normalizeHTML(),this._domParser.parse(t.dom.body).toJSON()}}function GO(n,e){return n.type===e}function JO(n){return typeof n=="string"}class Ty{static doc(e){return{type:Re.DOCUMENT,content:e}}static list(e,t){return{type:Re.LIST,attrs:{bullet:{type:e}},content:t.map(r=>GO(r,Re.LIST_ITEM)?r:this.listItem([r].flat()))}}static listItem(...e){const{attrs:t,content:r,marks:i}=this.normalizeTextBlockArgs(e);return{type:Re.LIST_ITEM,...t?{attrs:t}:{},...i?{marks:i}:{},content:[r].flat().map(o=>JO(o)?this.paragraph(o):o)}}static heading(e,...t){const r=this.textBlock(t);return r.attrs??={},r.attrs.level=e,{type:Re.HEADING,...r}}static paragraph(...e){return{type:Re.PARAGRAPH,...this.textBlock(e)}}static textBlock(e){const{attrs:t,content:r,marks:i}=this.normalizeTextBlockArgs(e);return{content:typeof r=="string"?[this.text(r)]:[r].flat(),...t?{attrs:t}:{},...i?{marks:i}:{}}}static normalizeTextBlockArgs(e){return e.length===1?{attrs:null,marks:null,content:e[0]}:e.length===2?{attrs:e[0],marks:null,content:e[1]}:{attrs:e[0],marks:e[1],content:e[2]}}static text(e,t){return{type:Re.TEXT,...t?{marks:t}:{},text:e}}static link(e,t,r=[]){return this.text(e,[this.mark(kf.LINK,t),...r])}static mark(e,t){return{type:e,attrs:t}}static populateAllDevices(e){return{mobile:e,tablet:e,desktop:e}}}class qO{_baseClass;_makeVariable;_linkPresetId;constructor({baseClass:e,makeVariable:t,linkPresetId:r}){this._baseClass=e,this._makeVariable=t,this._linkPresetId=r}inject(e,t){let r=e.querySelector("[data-zw-styles]");r||(r=Li.document.createElement("style"),r.dataset.zwStyles="",r.innerHTML=this.render(t),e.append(r))}render(e){let t="";for(const r of e){const i=r.id===this._linkPresetId,o=this.makePresetCssClass(r);t+=` ${o} {`;for(const a of Sf.values)for(const c of Object.keys(r[a])){const f=this._makeVariable({device:a,preset:r,property:c}),h=this._makeInternalVariableName(c,a);if(t+=`${h}: var(${f}, inherit);`,i&&!me.attributes.includes(c)){const m=h.replace("preset-","");t+=`${m}: var(${h});`}}t+="}"}return t}_makeInternalVariableName(e,t){const r=e==="color"?"font-color":e.replace(/_/i,"-"),i=t===Sf.COMMON?"":`-${t}`;return`--zw-preset-${r}${i}`}makePresetHtmlClass(e){return this._baseClass+e.id}makePresetCssClass(e){return this.makePresetHtmlClass(e).split(" ").map(t=>`.${t}`).join("")}}class yh{static _instance;static get instance(){return this._instance??=new yh,this._instance}static query(e,t){return this.instance.query(e,t)}query(e,t){let r=null;return e.descendants(i=>{if(r)return!1;if(this.matchNode(i,t))return r=i,!1}),r?t.getMark?this.getMark(r,t.getMark):r:null}matchNode(e,t){return!(t.typeName&&t.typeName!==e.type.name||t.mark&&!this.getMark(e,t.mark))}getMark(e,t){return e.marks.find(r=>this.matchMark(r,t))||null}matchMark(e,t){return e.type.name===t.typeName}}class jO{static createWindow(){return new jp.JSDOM().window}types;parse(e){const{window:t}=new jp.JSDOM(e);return this.types=t,t.document}}exports.ContentSerializer=gh,exports.ContextWindow=Li,exports.NodeDomParser=jO;