229 lines
548 KiB
JavaScript
229 lines
548 KiB
JavaScript
var vg=Object.defineProperty;var Cg=(n,e,t)=>e in n?vg(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var ce=(n,e,t)=>Cg(n,typeof e!="symbol"?e+"":e,t);function sd(n,e){return function(){return n.apply(e,arguments)}}const{toString:Eg}=Object.prototype,{getPrototypeOf:ao}=Object,{iterator:lo,toStringTag:od}=Symbol,co=(n=>e=>{const t=Eg.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Rt=n=>(n=n.toLowerCase(),e=>co(e)===n),uo=n=>e=>typeof e===n,{isArray:jn}=Array,xr=uo("undefined");function Or(n){return n!==null&&!xr(n)&&n.constructor!==null&&!xr(n.constructor)&&nt(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const ad=Rt("ArrayBuffer");function Mg(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&ad(n.buffer),e}const Ag=uo("string"),nt=uo("function"),ld=uo("number"),wi=n=>n!==null&&typeof n=="object",Og=n=>n===!0||n===!1,as=n=>{if(co(n)!=="object")return!1;const e=ao(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(od in n)&&!(lo in n)},Rg=n=>{if(!wi(n)||Or(n))return!1;try{return Object.keys(n).length===0&&Object.getPrototypeOf(n)===Object.prototype}catch{return!1}},Ng=Rt("Date"),Dg=Rt("File"),Pg=n=>!!(n&&typeof n.uri<"u"),Ig=n=>n&&typeof n.getParts<"u",Lg=Rt("Blob"),Bg=Rt("FileList"),_g=n=>wi(n)&&nt(n.pipe);function zg(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const cu=zg(),uu=typeof cu.FormData<"u"?cu.FormData:void 0,$g=n=>{if(!n)return!1;if(uu&&n instanceof uu)return!0;const e=ao(n);if(!e||e===Object.prototype||!nt(n.append))return!1;const t=co(n);return t==="formdata"||t==="object"&&nt(n.toString)&&n.toString()==="[object FormData]"},jg=Rt("URLSearchParams"),[Fg,Hg,Vg,qg]=["ReadableStream","Request","Response","Headers"].map(Rt),Ug=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ti(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let r,i;if(typeof n!="object"&&(n=[n]),jn(n))for(r=0,i=n.length;r<i;r++)e.call(null,n[r],r,n);else{if(Or(n))return;const s=t?Object.getOwnPropertyNames(n):Object.keys(n),o=s.length;let a;for(r=0;r<o;r++)a=s[r],e.call(null,n[a],a,n)}}function cd(n,e){if(Or(n))return null;e=e.toLowerCase();const t=Object.keys(n);let r=t.length,i;for(;r-- >0;)if(i=t[r],e===i.toLowerCase())return i;return null}const An=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ud=n=>!xr(n)&&n!==An;function Ia(...n){const{caseless:e,skipUndefined:t}=ud(this)&&this||{},r={},i=(s,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=e&&typeof o=="string"&&cd(r,o)||o,c=La(r,a)?r[a]:void 0;as(c)&&as(s)?r[a]=Ia(c,s):as(s)?r[a]=Ia({},s):jn(s)?r[a]=s.slice():(!t||!xr(s))&&(r[a]=s)};for(let s=0,o=n.length;s<o;s++){const a=n[s];if(!a||Or(a)||(Ti(a,i),typeof a!="object"||jn(a)))continue;const c=Object.getOwnPropertySymbols(a);for(let u=0;u<c.length;u++){const d=c[u];ry.call(a,d)&&i(a[d],d)}}return r}const Wg=(n,e,t,{allOwnKeys:r}={})=>(Ti(e,(i,s)=>{t&&nt(i)?Object.defineProperty(n,s,{__proto__:null,value:sd(i,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(n,s,{__proto__:null,value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),n),Kg=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),Jg=(n,e,t,r)=>{n.prototype=Object.create(e.prototype,r),Object.defineProperty(n.prototype,"constructor",{__proto__:null,value:n,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(n,"super",{__proto__:null,value:e.prototype}),t&&Object.assign(n.prototype,t)},Gg=(n,e,t,r)=>{let i,s,o;const a={};if(e=e||{},n==null)return e;do{for(i=Object.getOwnPropertyNames(n),s=i.length;s-- >0;)o=i[s],(!r||r(o,n,e))&&!a[o]&&(e[o]=n[o],a[o]=!0);n=t!==!1&&ao(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},Xg=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;const r=n.indexOf(e,t);return r!==-1&&r===t},Qg=n=>{if(!n)return null;if(jn(n))return n;let e=n.length;if(!ld(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},Yg=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&ao(Uint8Array)),Zg=(n,e)=>{const r=(n&&n[lo]).call(n);let i;for(;(i=r.next())&&!i.done;){const s=i.value;e.call(n,s[0],s[1])}},ey=(n,e)=>{let t;const r=[];for(;(t=n.exec(e))!==null;)r.push(t);return r},ty=Rt("HTMLFormElement"),ny=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,r,i){return r.toUpperCase()+i}),La=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),{propertyIsEnumerable:ry}=Object.prototype,iy=Rt("RegExp"),fd=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),r={};Ti(t,(i,s)=>{let o;(o=e(i,s,n))!==!1&&(r[s]=o||i)}),Object.defineProperties(n,r)},sy=n=>{fd(n,(e,t)=>{if(nt(n)&&["arguments","caller","callee"].includes(t))return!1;const r=n[t];if(nt(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},oy=(n,e)=>{const t={},r=i=>{i.forEach(s=>{t[s]=!0})};return jn(n)?r(n):r(String(n).split(e)),t},ay=()=>{},ly=(n,e)=>n!=null&&Number.isFinite(n=+n)?n:e;function cy(n){return!!(n&&nt(n.append)&&n[od]==="FormData"&&n[lo])}const uy=n=>{const e=new WeakSet,t=r=>{if(wi(r)){if(e.has(r))return;if(Or(r))return r;if(!("toJSON"in r)){e.add(r);const i=jn(r)?[]:{};return Ti(r,(s,o)=>{const a=t(s);!xr(a)&&(i[o]=a)}),e.delete(r),i}}return r};return t(n)},fy=Rt("AsyncFunction"),dy=n=>n&&(wi(n)||nt(n))&&nt(n.then)&&nt(n.catch),dd=((n,e)=>n?setImmediate:e?((t,r)=>(An.addEventListener("message",({source:i,data:s})=>{i===An&&s===t&&r.length&&r.shift()()},!1),i=>{r.push(i),An.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",nt(An.postMessage)),hy=typeof queueMicrotask<"u"?queueMicrotask.bind(An):typeof process<"u"&&process.nextTick||dd,py=n=>n!=null&&nt(n[lo]),R={isArray:jn,isArrayBuffer:ad,isBuffer:Or,isFormData:$g,isArrayBufferView:Mg,isString:Ag,isNumber:ld,isBoolean:Og,isObject:wi,isPlainObject:as,isEmptyObject:Rg,isReadableStream:Fg,isRequest:Hg,isResponse:Vg,isHeaders:qg,isUndefined:xr,isDate:Ng,isFile:Dg,isReactNativeBlob:Pg,isReactNative:Ig,isBlob:Lg,isRegExp:iy,isFunction:nt,isStream:_g,isURLSearchParams:jg,isTypedArray:Yg,isFileList:Bg,forEach:Ti,merge:Ia,extend:Wg,trim:Ug,stripBOM:Kg,inherits:Jg,toFlatObject:Gg,kindOf:co,kindOfTest:Rt,endsWith:Xg,toArray:Qg,forEachEntry:Zg,matchAll:ey,isHTMLForm:ty,hasOwnProperty:La,hasOwnProp:La,reduceDescriptors:fd,freezeMethods:sy,toObjectSet:oy,toCamelCase:ny,noop:ay,toFiniteNumber:ly,findKey:cd,global:An,isContextDefined:ud,isSpecCompliantForm:cy,toJSONObject:uy,isAsyncFn:fy,isThenable:dy,setImmediate:dd,asap:hy,isIterable:py},my=R.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),gy=n=>{const e={};let t,r,i;return n&&n.split(`
|
||
`).forEach(function(o){i=o.indexOf(":"),t=o.substring(0,i).trim().toLowerCase(),r=o.substring(i+1).trim(),!(!t||e[t]&&my[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)}),e};function yy(n){let e=0,t=n.length;for(;e<t;){const r=n.charCodeAt(e);if(r!==9&&r!==32)break;e+=1}for(;t>e;){const r=n.charCodeAt(t-1);if(r!==9&&r!==32)break;t-=1}return e===0&&t===n.length?n:n.slice(e,t)}const by=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),ky=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function yl(n,e){return R.isArray(n)?n.map(t=>yl(t,e)):yy(String(n).replace(e,""))}const xy=n=>yl(n,by),wy=n=>yl(n,ky);function hd(n){const e=Object.create(null);return R.forEach(n.toJSON(),(t,r)=>{e[r]=wy(t)}),e}const fu=Symbol("internals");function $r(n){return n&&String(n).trim().toLowerCase()}function ls(n){return n===!1||n==null?n:R.isArray(n)?n.map(ls):xy(String(n))}function Ty(n){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=t.exec(n);)e[r[1]]=r[2];return e}const Sy=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function na(n,e,t,r,i){if(R.isFunction(r))return r.call(this,e,t);if(i&&(e=t),!!R.isString(e)){if(R.isString(r))return e.indexOf(r)!==-1;if(R.isRegExp(r))return r.test(e)}}function vy(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}function Cy(n,e){const t=R.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(n,r+t,{__proto__:null,value:function(i,s,o){return this[r].call(this,e,i,s,o)},configurable:!0})})}let Ke=class{constructor(e){e&&this.set(e)}set(e,t,r){const i=this;function s(a,c,u){const d=$r(c);if(!d)return;const p=R.findKey(i,d);(!p||i[p]===void 0||u===!0||u===void 0&&i[p]!==!1)&&(i[p||c]=ls(a))}const o=(a,c)=>R.forEach(a,(u,d)=>s(u,d,c));if(R.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(R.isString(e)&&(e=e.trim())&&!Sy(e))o(gy(e),t);else if(R.isObject(e)&&R.isIterable(e)){let a={},c,u;for(const d of e){if(!R.isArray(d))throw new TypeError("Object iterator must return a key-value pair");a[u=d[0]]=(c=a[u])?R.isArray(c)?[...c,d[1]]:[c,d[1]]:d[1]}o(a,t)}else e!=null&&s(t,e,r);return this}get(e,t){if(e=$r(e),e){const r=R.findKey(this,e);if(r){const i=this[r];if(!t)return i;if(t===!0)return Ty(i);if(R.isFunction(t))return t.call(this,i,r);if(R.isRegExp(t))return t.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=$r(e),e){const r=R.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||na(this,this[r],r,t)))}return!1}delete(e,t){const r=this;let i=!1;function s(o){if(o=$r(o),o){const a=R.findKey(r,o);a&&(!t||na(r,r[a],a,t))&&(delete r[a],i=!0)}}return R.isArray(e)?e.forEach(s):s(e),i}clear(e){const t=Object.keys(this);let r=t.length,i=!1;for(;r--;){const s=t[r];(!e||na(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const t=this,r={};return R.forEach(this,(i,s)=>{const o=R.findKey(r,s);if(o){t[o]=ls(i),delete t[s];return}const a=e?vy(s):String(s).trim();a!==s&&delete t[s],t[a]=ls(i),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return R.forEach(this,(r,i)=>{r!=null&&r!==!1&&(t[i]=e&&R.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
|
||
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[fu]=this[fu]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=$r(o);r[a]||(Cy(i,o),r[a]=!0)}return R.isArray(e)?e.forEach(s):s(e),this}};Ke.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);R.reduceDescriptors(Ke.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(r){this[t]=r}}});R.freezeMethods(Ke);const Ey="[REDACTED ****]";function My(n){if(R.hasOwnProp(n,"toJSON"))return!0;let e=Object.getPrototypeOf(n);for(;e&&e!==Object.prototype;){if(R.hasOwnProp(e,"toJSON"))return!0;e=Object.getPrototypeOf(e)}return!1}function Ay(n,e){const t=new Set(e.map(s=>String(s).toLowerCase())),r=[],i=s=>{if(s===null||typeof s!="object"||R.isBuffer(s))return s;if(r.indexOf(s)!==-1)return;s instanceof Ke&&(s=s.toJSON()),r.push(s);let o;if(R.isArray(s))o=[],s.forEach((a,c)=>{const u=i(a);R.isUndefined(u)||(o[c]=u)});else{if(!R.isPlainObject(s)&&My(s))return r.pop(),s;o=Object.create(null);for(const[a,c]of Object.entries(s)){const u=t.has(a.toLowerCase())?Ey:i(c);R.isUndefined(u)||(o[a]=u)}}return r.pop(),o};return i(n)}let K=class pd extends Error{static from(e,t,r,i,s,o){const a=new pd(e.message,t||e.code,r,i,s);return a.cause=e,a.name=e.name,e.status!=null&&a.status==null&&(a.status=e.status),o&&Object.assign(a,o),a}constructor(e,t,r,i,s){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),s&&(this.response=s,this.status=s.status)}toJSON(){const e=this.config,t=e&&R.hasOwnProp(e,"redact")?e.redact:void 0,r=R.isArray(t)&&t.length>0?Ay(e,t):R.toJSONObject(e);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:r,code:this.code,status:this.status}}};K.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";K.ERR_BAD_OPTION="ERR_BAD_OPTION";K.ECONNABORTED="ECONNABORTED";K.ETIMEDOUT="ETIMEDOUT";K.ECONNREFUSED="ECONNREFUSED";K.ERR_NETWORK="ERR_NETWORK";K.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";K.ERR_DEPRECATED="ERR_DEPRECATED";K.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";K.ERR_BAD_REQUEST="ERR_BAD_REQUEST";K.ERR_CANCELED="ERR_CANCELED";K.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";K.ERR_INVALID_URL="ERR_INVALID_URL";K.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const Oy=null;function Ba(n){return R.isPlainObject(n)||R.isArray(n)}function md(n){return R.endsWith(n,"[]")?n.slice(0,-2):n}function ra(n,e,t){return n?n.concat(e).map(function(i,s){return i=md(i),!t&&s?"["+i+"]":i}).join(t?".":""):e}function Ry(n){return R.isArray(n)&&!n.some(Ba)}const Ny=R.toFlatObject(R,{},null,function(e){return/^is[A-Z]/.test(e)});function fo(n,e,t){if(!R.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=R.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(S,C){return!R.isUndefined(C[S])});const r=t.metaTokens,i=t.visitor||p,s=t.dots,o=t.indexes,a=t.Blob||typeof Blob<"u"&&Blob,c=t.maxDepth===void 0?100:t.maxDepth,u=a&&R.isSpecCompliantForm(e);if(!R.isFunction(i))throw new TypeError("visitor must be a function");function d(T){if(T===null)return"";if(R.isDate(T))return T.toISOString();if(R.isBoolean(T))return T.toString();if(!u&&R.isBlob(T))throw new K("Blob is not supported. Use a Buffer instead.");return R.isArrayBuffer(T)||R.isTypedArray(T)?u&&typeof Blob=="function"?new Blob([T]):Buffer.from(T):T}function p(T,S,C){let I=T;if(R.isReactNative(e)&&R.isReactNativeBlob(T))return e.append(ra(C,S,s),d(T)),!1;if(T&&!C&&typeof T=="object"){if(R.endsWith(S,"{}"))S=r?S:S.slice(0,-2),T=JSON.stringify(T);else if(R.isArray(T)&&Ry(T)||(R.isFileList(T)||R.endsWith(S,"[]"))&&(I=R.toArray(T)))return S=md(S),I.forEach(function(B,z){!(R.isUndefined(B)||B===null)&&e.append(o===!0?ra([S],z,s):o===null?S:S+"[]",d(B))}),!1}return Ba(T)?!0:(e.append(ra(C,S,s),d(T)),!1)}const y=[],g=Object.assign(Ny,{defaultVisitor:p,convertValue:d,isVisitable:Ba});function w(T,S,C=0){if(!R.isUndefined(T)){if(C>c)throw new K("Object is too deeply nested ("+C+" levels). Max depth: "+c,K.ERR_FORM_DATA_DEPTH_EXCEEDED);if(y.indexOf(T)!==-1)throw new Error("Circular reference detected in "+S.join("."));y.push(T),R.forEach(T,function(_,B){(!(R.isUndefined(_)||_===null)&&i.call(e,_,R.isString(B)?B.trim():B,S,g))===!0&&w(_,S?S.concat(B):[B],C+1)}),y.pop()}}if(!R.isObject(n))throw new TypeError("data must be an object");return w(n),e}function du(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(n).replace(/[!'()~]|%20/g,function(r){return e[r]})}function bl(n,e){this._pairs=[],n&&fo(n,this,e)}const gd=bl.prototype;gd.append=function(e,t){this._pairs.push([e,t])};gd.toString=function(e){const t=e?function(r){return e.call(this,r,du)}:du;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};function Dy(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function yd(n,e,t){if(!e)return n;const r=t&&t.encode||Dy,i=R.isFunction(t)?{serialize:t}:t,s=i&&i.serialize;let o;if(s?o=s(e,i):o=R.isURLSearchParams(e)?e.toString():new bl(e,i).toString(r),o){const a=n.indexOf("#");a!==-1&&(n=n.slice(0,a)),n+=(n.indexOf("?")===-1?"?":"&")+o}return n}class hu{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){R.forEach(this.handlers,function(r){r!==null&&e(r)})}}const kl={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1},Py=typeof URLSearchParams<"u"?URLSearchParams:bl,Iy=typeof FormData<"u"?FormData:null,Ly=typeof Blob<"u"?Blob:null,By={isBrowser:!0,classes:{URLSearchParams:Py,FormData:Iy,Blob:Ly},protocols:["http","https","file","blob","url","data"]},xl=typeof window<"u"&&typeof document<"u",_a=typeof navigator=="object"&&navigator||void 0,_y=xl&&(!_a||["ReactNative","NativeScript","NS"].indexOf(_a.product)<0),zy=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",$y=xl&&window.location.href||"http://localhost",jy=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:xl,hasStandardBrowserEnv:_y,hasStandardBrowserWebWorkerEnv:zy,navigator:_a,origin:$y},Symbol.toStringTag,{value:"Module"})),Be={...jy,...By};function Fy(n,e){return fo(n,new Be.classes.URLSearchParams,{visitor:function(t,r,i,s){return Be.isNode&&R.isBuffer(t)?(this.append(r,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},...e})}function Hy(n){return R.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Vy(n){const e={},t=Object.keys(n);let r;const i=t.length;let s;for(r=0;r<i;r++)s=t[r],e[s]=n[s];return e}function bd(n){function e(t,r,i,s){let o=t[s++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),c=s>=t.length;return o=!o&&R.isArray(i)?i.length:o,c?(R.hasOwnProp(i,o)?i[o]=R.isArray(i[o])?i[o].concat(r):[i[o],r]:i[o]=r,!a):((!R.hasOwnProp(i,o)||!R.isObject(i[o]))&&(i[o]=[]),e(t,r,i[o],s)&&R.isArray(i[o])&&(i[o]=Vy(i[o])),!a)}if(R.isFormData(n)&&R.isFunction(n.entries)){const t={};return R.forEachEntry(n,(r,i)=>{e(Hy(r),i,t,0)}),t}return null}const ur=(n,e)=>n!=null&&R.hasOwnProp(n,e)?n[e]:void 0;function qy(n,e,t){if(R.isString(n))try{return(e||JSON.parse)(n),R.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(n)}const Si={transitional:kl,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",i=r.indexOf("application/json")>-1,s=R.isObject(e);if(s&&R.isHTMLForm(e)&&(e=new FormData(e)),R.isFormData(e))return i?JSON.stringify(bd(e)):e;if(R.isArrayBuffer(e)||R.isBuffer(e)||R.isStream(e)||R.isFile(e)||R.isBlob(e)||R.isReadableStream(e))return e;if(R.isArrayBufferView(e))return e.buffer;if(R.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){const c=ur(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return Fy(e,c).toString();if((a=R.isFileList(e))||r.indexOf("multipart/form-data")>-1){const u=ur(this,"env"),d=u&&u.FormData;return fo(a?{"files[]":e}:e,d&&new d,c)}}return s||i?(t.setContentType("application/json",!1),qy(e)):e}],transformResponse:[function(e){const t=ur(this,"transitional")||Si.transitional,r=t&&t.forcedJSONParsing,i=ur(this,"responseType"),s=i==="json";if(R.isResponse(e)||R.isReadableStream(e))return e;if(e&&R.isString(e)&&(r&&!i||s)){const a=!(t&&t.silentJSONParsing)&&s;try{return JSON.parse(e,ur(this,"parseReviver"))}catch(c){if(a)throw c.name==="SyntaxError"?K.from(c,K.ERR_BAD_RESPONSE,this,null,ur(this,"response")):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Be.classes.FormData,Blob:Be.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};R.forEach(["delete","get","head","post","put","patch","query"],n=>{Si.headers[n]={}});function ia(n,e){const t=this||Si,r=e||t,i=Ke.from(r.headers);let s=r.data;return R.forEach(n,function(a){s=a.call(t,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function kd(n){return!!(n&&n.__CANCEL__)}let vi=class extends K{constructor(e,t,r){super(e??"canceled",K.ERR_CANCELED,t,r),this.name="CanceledError",this.__CANCEL__=!0}};function xd(n,e,t){const r=t.config.validateStatus;!t.status||!r||r(t.status)?n(t):e(new K("Request failed with status code "+t.status,t.status>=400&&t.status<500?K.ERR_BAD_REQUEST:K.ERR_BAD_RESPONSE,t.config,t.request,t))}function Uy(n){const e=/^([-+\w]{1,25}):(?:\/\/)?/.exec(n);return e&&e[1]||""}function Wy(n,e){n=n||10;const t=new Array(n),r=new Array(n);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(c){const u=Date.now(),d=r[s];o||(o=u),t[i]=c,r[i]=u;let p=s,y=0;for(;p!==i;)y+=t[p++],p=p%n;if(i=(i+1)%n,i===s&&(s=(s+1)%n),u-o<e)return;const g=d&&u-d;return g?Math.round(y*1e3/g):void 0}}function Ky(n,e){let t=0,r=1e3/e,i,s;const o=(u,d=Date.now())=>{t=d,i=null,s&&(clearTimeout(s),s=null),n(...u)};return[(...u)=>{const d=Date.now(),p=d-t;p>=r?o(u,d):(i=u,s||(s=setTimeout(()=>{s=null,o(i)},r-p)))},()=>i&&o(i)]}const ms=(n,e,t=3)=>{let r=0;const i=Wy(50,250);return Ky(s=>{if(!s||typeof s.loaded!="number")return;const o=s.loaded,a=s.lengthComputable?s.total:void 0,c=a!=null?Math.min(o,a):o,u=Math.max(0,c-r),d=i(u);r=Math.max(r,c);const p={loaded:c,total:a,progress:a?c/a:void 0,bytes:u,rate:d||void 0,estimated:d&&a?(a-c)/d:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};n(p)},t)},pu=(n,e)=>{const t=n!=null;return[r=>e[0]({lengthComputable:t,total:n,loaded:r}),e[1]]},mu=n=>(...e)=>R.asap(()=>n(...e)),Jy=Be.hasStandardBrowserEnv?((n,e)=>t=>(t=new URL(t,Be.origin),n.protocol===t.protocol&&n.host===t.host&&(e||n.port===t.port)))(new URL(Be.origin),Be.navigator&&/(msie|trident)/i.test(Be.navigator.userAgent)):()=>!0,Gy=Be.hasStandardBrowserEnv?{write(n,e,t,r,i,s,o){if(typeof document>"u")return;const a=[`${n}=${encodeURIComponent(e)}`];R.isNumber(t)&&a.push(`expires=${new Date(t).toUTCString()}`),R.isString(r)&&a.push(`path=${r}`),R.isString(i)&&a.push(`domain=${i}`),s===!0&&a.push("secure"),R.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(n){if(typeof document>"u")return null;const e=document.cookie.split(";");for(let t=0;t<e.length;t++){const r=e[t].replace(/^\s+/,""),i=r.indexOf("=");if(i!==-1&&r.slice(0,i)===n)return decodeURIComponent(r.slice(i+1))}return null},remove(n){this.write(n,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Xy(n){return typeof n!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function Qy(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function wd(n,e,t){let r=!Xy(e);return n&&(r||t===!1)?Qy(n,e):e}const gu=n=>n instanceof Ke?{...n}:n;function Fn(n,e){e=e||{};const t=Object.create(null);Object.defineProperty(t,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(u,d,p,y){return R.isPlainObject(u)&&R.isPlainObject(d)?R.merge.call({caseless:y},u,d):R.isPlainObject(d)?R.merge({},d):R.isArray(d)?d.slice():d}function i(u,d,p,y){if(R.isUndefined(d)){if(!R.isUndefined(u))return r(void 0,u,p,y)}else return r(u,d,p,y)}function s(u,d){if(!R.isUndefined(d))return r(void 0,d)}function o(u,d){if(R.isUndefined(d)){if(!R.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function a(u,d,p){if(R.hasOwnProp(e,p))return r(u,d);if(R.hasOwnProp(n,p))return r(void 0,u)}const c={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,allowedSocketPaths:o,responseEncoding:o,validateStatus:a,headers:(u,d,p)=>i(gu(u),gu(d),p,!0)};return R.forEach(Object.keys({...n,...e}),function(d){if(d==="__proto__"||d==="constructor"||d==="prototype")return;const p=R.hasOwnProp(c,d)?c[d]:i,y=R.hasOwnProp(n,d)?n[d]:void 0,g=R.hasOwnProp(e,d)?e[d]:void 0,w=p(y,g,d);R.isUndefined(w)&&p!==a||(t[d]=w)}),t}const Yy=["content-type","content-length"];function Zy(n,e,t){if(t!=="content-only"){n.set(e);return}Object.entries(e).forEach(([r,i])=>{Yy.includes(r.toLowerCase())&&n.set(r,i)})}const e0=n=>encodeURIComponent(n).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16)));function Td(n){const e=Fn({},n),t=y=>R.hasOwnProp(e,y)?e[y]:void 0,r=t("data");let i=t("withXSRFToken");const s=t("xsrfHeaderName"),o=t("xsrfCookieName");let a=t("headers");const c=t("auth"),u=t("baseURL"),d=t("allowAbsoluteUrls"),p=t("url");if(e.headers=a=Ke.from(a),e.url=yd(wd(u,p,d),t("params"),t("paramsSerializer")),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?e0(c.password):""))),R.isFormData(r)&&(Be.hasStandardBrowserEnv||Be.hasStandardBrowserWebWorkerEnv||R.isReactNative(r)?a.setContentType(void 0):R.isFunction(r.getHeaders)&&Zy(a,r.getHeaders(),t("formDataHeaderPolicy"))),Be.hasStandardBrowserEnv&&(R.isFunction(i)&&(i=i(e)),i===!0||i==null&&Jy(e.url))){const g=s&&o&&Gy.read(o);g&&a.set(s,g)}return e}const t0=typeof XMLHttpRequest<"u",n0=t0&&function(n){return new Promise(function(t,r){const i=Td(n);let s=i.data;const o=Ke.from(i.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:u}=i,d,p,y,g,w;function T(){g&&g(),w&&w(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let S=new XMLHttpRequest;S.open(i.method.toUpperCase(),i.url,!0),S.timeout=i.timeout;function C(){if(!S)return;const _=Ke.from("getAllResponseHeaders"in S&&S.getAllResponseHeaders()),z={data:!a||a==="text"||a==="json"?S.responseText:S.response,status:S.status,statusText:S.statusText,headers:_,config:n,request:S};xd(function($){t($),T()},function($){r($),T()},z),S=null}"onloadend"in S?S.onloadend=C:S.onreadystatechange=function(){!S||S.readyState!==4||S.status===0&&!(S.responseURL&&S.responseURL.startsWith("file:"))||setTimeout(C)},S.onabort=function(){S&&(r(new K("Request aborted",K.ECONNABORTED,n,S)),T(),S=null)},S.onerror=function(B){const z=B&&B.message?B.message:"Network Error",b=new K(z,K.ERR_NETWORK,n,S);b.event=B||null,r(b),T(),S=null},S.ontimeout=function(){let B=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const z=i.transitional||kl;i.timeoutErrorMessage&&(B=i.timeoutErrorMessage),r(new K(B,z.clarifyTimeoutError?K.ETIMEDOUT:K.ECONNABORTED,n,S)),T(),S=null},s===void 0&&o.setContentType(null),"setRequestHeader"in S&&R.forEach(hd(o),function(B,z){S.setRequestHeader(z,B)}),R.isUndefined(i.withCredentials)||(S.withCredentials=!!i.withCredentials),a&&a!=="json"&&(S.responseType=i.responseType),u&&([y,w]=ms(u,!0),S.addEventListener("progress",y)),c&&S.upload&&([p,g]=ms(c),S.upload.addEventListener("progress",p),S.upload.addEventListener("loadend",g)),(i.cancelToken||i.signal)&&(d=_=>{S&&(r(!_||_.type?new vi(null,n,S):_),S.abort(),T(),S=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const I=Uy(i.url);if(I&&!Be.protocols.includes(I)){r(new K("Unsupported protocol "+I+":",K.ERR_BAD_REQUEST,n));return}S.send(s||null)})},r0=(n,e)=>{if(n=n?n.filter(Boolean):[],!e&&!n.length)return;const t=new AbortController;let r=!1;const i=function(c){if(!r){r=!0,o();const u=c instanceof Error?c:this.reason;t.abort(u instanceof K?u:new vi(u instanceof Error?u.message:u))}};let s=e&&setTimeout(()=>{s=null,i(new K(`timeout of ${e}ms exceeded`,K.ETIMEDOUT))},e);const o=()=>{n&&(s&&clearTimeout(s),s=null,n.forEach(c=>{c.unsubscribe?c.unsubscribe(i):c.removeEventListener("abort",i)}),n=null)};n.forEach(c=>c.addEventListener("abort",i));const{signal:a}=t;return a.unsubscribe=()=>R.asap(o),a},i0=function*(n,e){let t=n.byteLength;if(t<e){yield n;return}let r=0,i;for(;r<t;)i=r+e,yield n.slice(r,i),r=i},s0=async function*(n,e){for await(const t of o0(n))yield*i0(t,e)},o0=async function*(n){if(n[Symbol.asyncIterator]){yield*n;return}const e=n.getReader();try{for(;;){const{done:t,value:r}=await e.read();if(t)break;yield r}}finally{await e.cancel()}},yu=(n,e,t,r)=>{const i=s0(n,e);let s=0,o,a=c=>{o||(o=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:u,value:d}=await i.next();if(u){a(),c.close();return}let p=d.byteLength;if(t){let y=s+=p;t(y)}c.enqueue(new Uint8Array(d))}catch(u){throw a(u),u}},cancel(c){return a(c),i.return()}},{highWaterMark:2})};function a0(n){if(!n||typeof n!="string"||!n.startsWith("data:"))return 0;const e=n.indexOf(",");if(e<0)return 0;const t=n.slice(5,e),r=n.slice(e+1);if(/;base64/i.test(t)){let o=r.length;const a=r.length;for(let g=0;g<a;g++)if(r.charCodeAt(g)===37&&g+2<a){const w=r.charCodeAt(g+1),T=r.charCodeAt(g+2);(w>=48&&w<=57||w>=65&&w<=70||w>=97&&w<=102)&&(T>=48&&T<=57||T>=65&&T<=70||T>=97&&T<=102)&&(o-=2,g+=2)}let c=0,u=a-1;const d=g=>g>=2&&r.charCodeAt(g-2)===37&&r.charCodeAt(g-1)===51&&(r.charCodeAt(g)===68||r.charCodeAt(g)===100);u>=0&&(r.charCodeAt(u)===61?(c++,u--):d(u)&&(c++,u-=3)),c===1&&u>=0&&(r.charCodeAt(u)===61||d(u))&&c++;const y=Math.floor(o/4)*3-(c||0);return y>0?y:0}if(typeof Buffer<"u"&&typeof Buffer.byteLength=="function")return Buffer.byteLength(r,"utf8");let s=0;for(let o=0,a=r.length;o<a;o++){const c=r.charCodeAt(o);if(c<128)s+=1;else if(c<2048)s+=2;else if(c>=55296&&c<=56319&&o+1<a){const u=r.charCodeAt(o+1);u>=56320&&u<=57343?(s+=4,o++):s+=3}else s+=3}return s}const wl="1.17.0",bu=64*1024,{isFunction:qi}=R,l0=n=>encodeURIComponent(n).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))),ku=n=>{if(!R.isString(n))return n;try{return decodeURIComponent(n)}catch{return n}},xu=(n,...e)=>{try{return!!n(...e)}catch{return!1}},c0=n=>{const e=n.indexOf("://");let t=n;return e!==-1&&(t=t.slice(e+3)),t.includes("@")||t.includes(":")},u0=n=>{const e=R.global!==void 0&&R.global!==null?R.global:globalThis,{ReadableStream:t,TextEncoder:r}=e;n=R.merge.call({skipUndefined:!0},{Request:e.Request,Response:e.Response},n);const{fetch:i,Request:s,Response:o}=n,a=i?qi(i):typeof fetch=="function",c=qi(s),u=qi(o);if(!a)return!1;const d=a&&qi(t),p=a&&(typeof r=="function"?(C=>I=>C.encode(I))(new r):async C=>new Uint8Array(await new s(C).arrayBuffer())),y=c&&d&&xu(()=>{let C=!1;const I=new s(Be.origin,{body:new t,method:"POST",get duplex(){return C=!0,"half"}}),_=I.headers.has("Content-Type");return I.body!=null&&I.body.cancel(),C&&!_}),g=u&&d&&xu(()=>R.isReadableStream(new o("").body)),w={stream:g&&(C=>C.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(C=>{!w[C]&&(w[C]=(I,_)=>{let B=I&&I[C];if(B)return B.call(I);throw new K(`Response type '${C}' is not supported`,K.ERR_NOT_SUPPORT,_)})});const T=async C=>{if(C==null)return 0;if(R.isBlob(C))return C.size;if(R.isSpecCompliantForm(C))return(await new s(Be.origin,{method:"POST",body:C}).arrayBuffer()).byteLength;if(R.isArrayBufferView(C)||R.isArrayBuffer(C))return C.byteLength;if(R.isURLSearchParams(C)&&(C=C+""),R.isString(C))return(await p(C)).byteLength},S=async(C,I)=>{const _=R.toFiniteNumber(C.getContentLength());return _??T(I)};return async C=>{let{url:I,method:_,data:B,signal:z,cancelToken:b,timeout:$,onDownloadProgress:q,onUploadProgress:H,responseType:ee,headers:ge,withCredentials:Se="same-origin",fetchOptions:ue,maxContentLength:se,maxBodyLength:fe}=Td(C);const ze=R.isNumber(se)&&se>-1,Nt=R.isNumber(fe)&&fe>-1,Do=he=>R.hasOwnProp(C,he)?C[he]:void 0;let xn=i||fetch;ee=ee?(ee+"").toLowerCase():"text";let ct=r0([z,b&&b.toAbortSignal()],$),qe=null;const Dt=ct&&ct.unsubscribe&&(()=>{ct.unsubscribe()});let Qn;try{let he;const kt=Do("auth");if(kt){const Y=kt.username||"",ft=kt.password||"";he={username:Y,password:ft}}if(c0(I)){const Y=new URL(I,Be.origin);if(!he&&(Y.username||Y.password)){const ft=ku(Y.username),wt=ku(Y.password);he={username:ft,password:wt}}(Y.username||Y.password)&&(Y.username="",Y.password="",I=Y.href)}if(he&&(ge.delete("authorization"),ge.set("Authorization","Basic "+btoa(l0((he.username||"")+":"+(he.password||""))))),ze&&typeof I=="string"&&I.startsWith("data:")&&a0(I)>se)throw new K("maxContentLength size of "+se+" exceeded",K.ERR_BAD_RESPONSE,C,qe);if(Nt&&_!=="get"&&_!=="head"){const Y=await S(ge,B);if(typeof Y=="number"&&isFinite(Y)&&Y>fe)throw new K("Request body larger than maxBodyLength limit",K.ERR_BAD_REQUEST,C,qe)}if(H&&y&&_!=="get"&&_!=="head"&&(Qn=await S(ge,B))!==0){let Y=new s(I,{method:"POST",body:B,duplex:"half"}),ft;if(R.isFormData(B)&&(ft=Y.headers.get("content-type"))&&ge.setContentType(ft),Y.body){const[wt,Xe]=pu(Qn,ms(mu(H)));B=yu(Y.body,bu,wt,Xe)}}R.isString(Se)||(Se=Se?"include":"omit");const Po=c&&"credentials"in s.prototype;if(R.isFormData(B)){const Y=ge.getContentType();Y&&/^multipart\/form-data/i.test(Y)&&!/boundary=/i.test(Y)&&ge.delete("content-type")}ge.set("User-Agent","axios/"+wl,!1);const xt={...ue,signal:ct,method:_.toUpperCase(),headers:hd(ge.normalize()),body:B,duplex:"half",credentials:Po?Se:void 0};qe=c&&new s(I,xt);let $e=await(c?xn(qe,ue):xn(I,xt));if(ze){const Y=R.toFiniteNumber($e.headers.get("content-length"));if(Y!=null&&Y>se)throw new K("maxContentLength size of "+se+" exceeded",K.ERR_BAD_RESPONSE,C,qe)}const Dr=g&&(ee==="stream"||ee==="response");if(g&&$e.body&&(q||ze||Dr&&Dt)){const Y={};["status","statusText","headers"].forEach(wn=>{Y[wn]=$e[wn]});const ft=R.toFiniteNumber($e.headers.get("content-length")),[wt,Xe]=q&&pu(ft,ms(mu(q),!0))||[];let it=0;const Io=wn=>{if(ze&&(it=wn,it>se))throw new K("maxContentLength size of "+se+" exceeded",K.ERR_BAD_RESPONSE,C,qe);wt&&wt(wn)};$e=new o(yu($e.body,bu,Io,()=>{Xe&&Xe(),Dt&&Dt()}),Y)}ee=ee||"text";let ut=await w[R.findKey(w,ee)||"text"]($e,C);if(ze&&!g&&!Dr){let Y;if(ut!=null&&(typeof ut.byteLength=="number"?Y=ut.byteLength:typeof ut.size=="number"?Y=ut.size:typeof ut=="string"&&(Y=typeof r=="function"?new r().encode(ut).byteLength:ut.length)),typeof Y=="number"&&Y>se)throw new K("maxContentLength size of "+se+" exceeded",K.ERR_BAD_RESPONSE,C,qe)}return!Dr&&Dt&&Dt(),await new Promise((Y,ft)=>{xd(Y,ft,{data:ut,headers:Ke.from($e.headers),status:$e.status,statusText:$e.statusText,config:C,request:qe})})}catch(he){if(Dt&&Dt(),ct&&ct.aborted&&ct.reason instanceof K){const kt=ct.reason;throw kt.config=C,qe&&(kt.request=qe),he!==kt&&(kt.cause=he),kt}throw he&&he.name==="TypeError"&&/Load failed|fetch/i.test(he.message)?Object.assign(new K("Network Error",K.ERR_NETWORK,C,qe,he&&he.response),{cause:he.cause||he}):K.from(he,he&&he.code,C,qe,he&&he.response)}}},f0=new Map,Sd=n=>{let e=n&&n.env||{};const{fetch:t,Request:r,Response:i}=e,s=[r,i,t];let o=s.length,a=o,c,u,d=f0;for(;a--;)c=s[a],u=d.get(c),u===void 0&&d.set(c,u=a?new Map:u0(e)),d=u;return u};Sd();const Tl={http:Oy,xhr:n0,fetch:{get:Sd}};R.forEach(Tl,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{__proto__:null,value:e})}catch{}Object.defineProperty(n,"adapterName",{__proto__:null,value:e})}});const wu=n=>`- ${n}`,d0=n=>R.isFunction(n)||n===null||n===!1;function h0(n,e){n=R.isArray(n)?n:[n];const{length:t}=n;let r,i;const s={};for(let o=0;o<t;o++){r=n[o];let a;if(i=r,!d0(r)&&(i=Tl[(a=String(r)).toLowerCase()],i===void 0))throw new K(`Unknown adapter '${a}'`);if(i&&(R.isFunction(i)||(i=i.get(e))))break;s[a||"#"+o]=i}if(!i){const o=Object.entries(s).map(([c,u])=>`adapter ${c} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=t?o.length>1?`since :
|
||
`+o.map(wu).join(`
|
||
`):" "+wu(o[0]):"as no adapter specified";throw new K("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return i}const vd={getAdapter:h0,adapters:Tl};function sa(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new vi(null,n)}function Tu(n){return sa(n),n.headers=Ke.from(n.headers),n.data=ia.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),vd.getAdapter(n.adapter||Si.adapter,n)(n).then(function(r){sa(n),n.response=r;try{r.data=ia.call(n,n.transformResponse,r)}finally{delete n.response}return r.headers=Ke.from(r.headers),r},function(r){if(!kd(r)&&(sa(n),r&&r.response)){n.response=r.response;try{r.response.data=ia.call(n,n.transformResponse,r.response)}finally{delete n.response}r.response.headers=Ke.from(r.response.headers)}return Promise.reject(r)})}const ho={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{ho[n]=function(r){return typeof r===n||"a"+(e<1?"n ":" ")+n}});const Su={};ho.transitional=function(e,t,r){function i(s,o){return"[Axios v"+wl+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return(s,o,a)=>{if(e===!1)throw new K(i(o," has been removed"+(t?" in "+t:"")),K.ERR_DEPRECATED);return t&&!Su[o]&&(Su[o]=!0,console.warn(i(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(s,o,a):!0}};ho.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function p0(n,e,t){if(typeof n!="object")throw new K("options must be an object",K.ERR_BAD_OPTION_VALUE);const r=Object.keys(n);let i=r.length;for(;i-- >0;){const s=r[i],o=Object.prototype.hasOwnProperty.call(e,s)?e[s]:void 0;if(o){const a=n[s],c=a===void 0||o(a,s,n);if(c!==!0)throw new K("option "+s+" must be "+c,K.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new K("Unknown option "+s,K.ERR_BAD_OPTION)}}const cs={assertOptions:p0,validators:ho},et=cs.validators;let In=class{constructor(e){this.defaults=e||{},this.interceptors={request:new hu,response:new hu}}async request(e,t){try{return await this._request(e,t)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=(()=>{if(!i.stack)return"";const o=i.stack.indexOf(`
|
||
`);return o===-1?"":i.stack.slice(o+1)})();try{if(!r.stack)r.stack=s;else if(s){const o=s.indexOf(`
|
||
`),a=o===-1?-1:s.indexOf(`
|
||
`,o+1),c=a===-1?"":s.slice(a+1);String(r.stack).endsWith(c)||(r.stack+=`
|
||
`+s)}}catch{}}throw r}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Fn(this.defaults,t);const{transitional:r,paramsSerializer:i,headers:s}=t;r!==void 0&&cs.assertOptions(r,{silentJSONParsing:et.transitional(et.boolean),forcedJSONParsing:et.transitional(et.boolean),clarifyTimeoutError:et.transitional(et.boolean),legacyInterceptorReqResOrdering:et.transitional(et.boolean),advertiseZstdAcceptEncoding:et.transitional(et.boolean)},!1),i!=null&&(R.isFunction(i)?t.paramsSerializer={serialize:i}:cs.assertOptions(i,{encode:et.function,serialize:et.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),cs.assertOptions(t,{baseUrl:et.spelling("baseURL"),withXsrfToken:et.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&R.merge(s.common,s[t.method]);s&&R.forEach(["delete","get","head","post","put","patch","query","common"],w=>{delete s[w]}),t.headers=Ke.concat(o,s);const a=[];let c=!0;this.interceptors.request.forEach(function(T){if(typeof T.runWhen=="function"&&T.runWhen(t)===!1)return;c=c&&T.synchronous;const S=t.transitional||kl;S&&S.legacyInterceptorReqResOrdering?a.unshift(T.fulfilled,T.rejected):a.push(T.fulfilled,T.rejected)});const u=[];this.interceptors.response.forEach(function(T){u.push(T.fulfilled,T.rejected)});let d,p=0,y;if(!c){const w=[Tu.bind(this),void 0];for(w.unshift(...a),w.push(...u),y=w.length,d=Promise.resolve(t);p<y;)d=d.then(w[p++],w[p++]);return d}y=a.length;let g=t;for(;p<y;){const w=a[p++],T=a[p++];try{g=w(g)}catch(S){T.call(this,S);break}}try{d=Tu.call(this,g)}catch(w){return Promise.reject(w)}for(p=0,y=u.length;p<y;)d=d.then(u[p++],u[p++]);return d}getUri(e){e=Fn(this.defaults,e);const t=wd(e.baseURL,e.url,e.allowAbsoluteUrls);return yd(t,e.params,e.paramsSerializer)}};R.forEach(["delete","get","head","options"],function(e){In.prototype[e]=function(t,r){return this.request(Fn(r||{},{method:e,url:t,data:(r||{}).data}))}});R.forEach(["post","put","patch","query"],function(e){function t(r){return function(s,o,a){return this.request(Fn(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}In.prototype[e]=t(),e!=="query"&&(In.prototype[e+"Form"]=t(!0))});let m0=class Cd{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(s){t=s});const r=this;this.promise.then(i=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{r.subscribe(a),s=a}).then(i);return o.cancel=function(){r.unsubscribe(s)},o},e(function(s,o,a){r.reason||(r.reason=new vi(s,o,a),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=r=>{e.abort(r)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Cd(function(i){e=i}),cancel:e}}};function g0(n){return function(t){return n.apply(null,t)}}function y0(n){return R.isObject(n)&&n.isAxiosError===!0}const za={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(za).forEach(([n,e])=>{za[e]=n});function Ed(n){const e=new In(n),t=sd(In.prototype.request,e);return R.extend(t,In.prototype,e,{allOwnKeys:!0}),R.extend(t,e,null,{allOwnKeys:!0}),t.create=function(i){return Ed(Fn(n,i))},t}const ve=Ed(Si);ve.Axios=In;ve.CanceledError=vi;ve.CancelToken=m0;ve.isCancel=kd;ve.VERSION=wl;ve.toFormData=fo;ve.AxiosError=K;ve.Cancel=ve.CanceledError;ve.all=function(e){return Promise.all(e)};ve.spread=g0;ve.isAxiosError=y0;ve.mergeConfig=Fn;ve.AxiosHeaders=Ke;ve.formToJSON=n=>bd(R.isHTMLForm(n)?new FormData(n):n);ve.getAdapter=vd.getAdapter;ve.HttpStatusCode=za;ve.default=ve;const{Axios:Pv,AxiosError:Iv,CanceledError:Lv,isCancel:Bv,CancelToken:_v,VERSION:zv,all:$v,Cancel:jv,isAxiosError:Fv,spread:Hv,toFormData:Vv,AxiosHeaders:qv,HttpStatusCode:Uv,formToJSON:Wv,getAdapter:Kv,mergeConfig:Jv,create:Gv}=ve;window.axios=ve;window.axios.defaults.headers.common["X-Requested-With"]="XMLHttpRequest";/*!
|
||
* jQuery JavaScript Library v4.0.0
|
||
* https://jquery.com/
|
||
*
|
||
* Copyright OpenJS Foundation and other contributors
|
||
* Released under the MIT license
|
||
* https://jquery.com/license/
|
||
*
|
||
* Date: 2026-01-18T00:20Z
|
||
*/function b0(n,e){if(typeof n>"u"||!n.document)throw new Error("jQuery requires a window with a document");var t=[],r=Object.getPrototypeOf,i=t.slice,s=t.flat?function(l){return t.flat.call(l)}:function(l){return t.concat.apply([],l)},o=t.push,a=t.indexOf,c={},u=c.toString,d=c.hasOwnProperty,p=d.toString,y=p.call(Object),g={};function w(l){return l==null?l+"":typeof l=="object"?c[u.call(l)]||"object":typeof l}function T(l){return l!=null&&l===l.window}function S(l){var f=!!l&&l.length,h=w(l);return typeof l=="function"||T(l)?!1:h==="array"||f===0||typeof f=="number"&&f>0&&f-1 in l}var C=n.document,I={type:!0,src:!0,nonce:!0,noModule:!0};function _(l,f,h){h=h||C;var m,k=h.createElement("script");k.text=l;for(m in I)f&&f[m]&&(k[m]=f[m]);h.head.appendChild(k).parentNode&&k.parentNode.removeChild(k)}var B="4.0.0",z=/HTML$/i,b=function(l,f){return new b.fn.init(l,f)};b.fn=b.prototype={jquery:B,constructor:b,length:0,toArray:function(){return i.call(this)},get:function(l){return l==null?i.call(this):l<0?this[l+this.length]:this[l]},pushStack:function(l){var f=b.merge(this.constructor(),l);return f.prevObject=this,f},each:function(l){return b.each(this,l)},map:function(l){return this.pushStack(b.map(this,function(f,h){return l.call(f,h,f)}))},slice:function(){return this.pushStack(i.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(b.grep(this,function(l,f){return(f+1)%2}))},odd:function(){return this.pushStack(b.grep(this,function(l,f){return f%2}))},eq:function(l){var f=this.length,h=+l+(l<0?f:0);return this.pushStack(h>=0&&h<f?[this[h]]:[])},end:function(){return this.prevObject||this.constructor()}},b.extend=b.fn.extend=function(){var l,f,h,m,k,x,v=arguments[0]||{},M=1,E=arguments.length,A=!1;for(typeof v=="boolean"&&(A=v,v=arguments[M]||{},M++),typeof v!="object"&&typeof v!="function"&&(v={}),M===E&&(v=this,M--);M<E;M++)if((l=arguments[M])!=null)for(f in l)m=l[f],!(f==="__proto__"||v===m)&&(A&&m&&(b.isPlainObject(m)||(k=Array.isArray(m)))?(h=v[f],k&&!Array.isArray(h)?x=[]:!k&&!b.isPlainObject(h)?x={}:x=h,k=!1,v[f]=b.extend(A,x,m)):m!==void 0&&(v[f]=m));return v},b.extend({expando:"jQuery"+(B+Math.random()).replace(/\D/g,""),isReady:!0,error:function(l){throw new Error(l)},noop:function(){},isPlainObject:function(l){var f,h;return!l||u.call(l)!=="[object Object]"?!1:(f=r(l),f?(h=d.call(f,"constructor")&&f.constructor,typeof h=="function"&&p.call(h)===y):!0)},isEmptyObject:function(l){var f;for(f in l)return!1;return!0},globalEval:function(l,f,h){_(l,{nonce:f&&f.nonce},h)},each:function(l,f){var h,m=0;if(S(l))for(h=l.length;m<h&&f.call(l[m],m,l[m])!==!1;m++);else for(m in l)if(f.call(l[m],m,l[m])===!1)break;return l},text:function(l){var f,h="",m=0,k=l.nodeType;if(!k)for(;f=l[m++];)h+=b.text(f);return k===1||k===11?l.textContent:k===9?l.documentElement.textContent:k===3||k===4?l.nodeValue:h},makeArray:function(l,f){var h=f||[];return l!=null&&(S(Object(l))?b.merge(h,typeof l=="string"?[l]:l):o.call(h,l)),h},inArray:function(l,f,h){return f==null?-1:a.call(f,l,h)},isXMLDoc:function(l){var f=l&&l.namespaceURI,h=l&&(l.ownerDocument||l).documentElement;return!z.test(f||h&&h.nodeName||"HTML")},contains:function(l,f){var h=f&&f.parentNode;return l===h||!!(h&&h.nodeType===1&&(l.contains?l.contains(h):l.compareDocumentPosition&&l.compareDocumentPosition(h)&16))},merge:function(l,f){for(var h=+f.length,m=0,k=l.length;m<h;m++)l[k++]=f[m];return l.length=k,l},grep:function(l,f,h){for(var m,k=[],x=0,v=l.length,M=!h;x<v;x++)m=!f(l[x],x),m!==M&&k.push(l[x]);return k},map:function(l,f,h){var m,k,x=0,v=[];if(S(l))for(m=l.length;x<m;x++)k=f(l[x],x,h),k!=null&&v.push(k);else for(x in l)k=f(l[x],x,h),k!=null&&v.push(k);return s(v)},guid:1,support:g}),typeof Symbol=="function"&&(b.fn[Symbol.iterator]=t[Symbol.iterator]),b.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(l,f){c["[object "+f+"]"]=f.toLowerCase()});function $(l,f){return l.nodeName&&l.nodeName.toLowerCase()===f.toLowerCase()}var q=t.pop,H="[\\x20\\t\\r\\n\\f]",ee=C.documentMode,ge=ee&&new RegExp(":enabled|:disabled|\\["+H+"*name"+H+"*="+H+`*(?:''|"")`),Se=new RegExp("^"+H+"+|((?:^|[^\\\\])(?:\\\\.)*)"+H+"+$","g"),ue="(?:\\\\[\\da-fA-F]{1,6}"+H+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",se=new RegExp("^"+H+"*([>+~]|"+H+")"+H+"*"),fe=new RegExp(H+"|>"),ze=/[+~]/,Nt=C.documentElement,Do=Nt.matches||Nt.msMatchesSelector;function xn(){var l=[];function f(h,m){return l.push(h+" ")>b.expr.cacheLength&&delete f[l.shift()],f[h+" "]=m}return f}function ct(l){return l&&typeof l.getElementsByTagName<"u"&&l}var qe="\\["+H+"*("+ue+")(?:"+H+"*([*^$|!~]?=)"+H+`*(?:'((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)"|(`+ue+"))|)"+H+"*\\]",Dt=":("+ue+`)(?:\\((('((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)")|((?:\\\\.|[^\\\\()[\\]]|`+qe+")*)|.*)\\)|)",Qn={ID:new RegExp("^#("+ue+")"),CLASS:new RegExp("^\\.("+ue+")"),TAG:new RegExp("^("+ue+"|[*])"),ATTR:new RegExp("^"+qe),PSEUDO:new RegExp("^"+Dt),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+H+"*(even|odd|(([+-]|)(\\d*)n|)"+H+"*(?:([+-]|)"+H+"*(\\d+)|))"+H+"*\\)|)","i")},he=new RegExp(Dt),kt=new RegExp("\\\\[\\da-fA-F]{1,6}"+H+"?|\\\\([^\\r\\n\\f])","g"),Po=function(l,f){var h="0x"+l.slice(1)-65536;return f||(h<0?String.fromCharCode(h+65536):String.fromCharCode(h>>10|55296,h&1023|56320))};function xt(l){return l.replace(kt,Po)}function $e(l){b.error("Syntax error, unrecognized expression: "+l)}var Dr=new RegExp("^"+H+"*,"+H+"*"),ut=xn();function Y(l,f){var h,m,k,x,v,M,E,A=ut[l+" "];if(A)return f?0:A.slice(0);for(v=l,M=[],E=b.expr.preFilter;v;){(!h||(m=Dr.exec(v)))&&(m&&(v=v.slice(m[0].length)||v),M.push(k=[])),h=!1,(m=se.exec(v))&&(h=m.shift(),k.push({value:h,type:m[0].replace(Se," ")}),v=v.slice(h.length));for(x in Qn)(m=b.expr.match[x].exec(v))&&(!E[x]||(m=E[x](m)))&&(h=m.shift(),k.push({value:h,type:x,matches:m}),v=v.slice(h.length));if(!h)break}return f?v.length:v?$e(l):ut(l,M).slice(0)}var ft={ATTR:function(l){return l[1]=xt(l[1]),l[3]=xt(l[3]||l[4]||l[5]||""),l[2]==="~="&&(l[3]=" "+l[3]+" "),l.slice(0,4)},CHILD:function(l){return l[1]=l[1].toLowerCase(),l[1].slice(0,3)==="nth"?(l[3]||$e(l[0]),l[4]=+(l[4]?l[5]+(l[6]||1):2*(l[3]==="even"||l[3]==="odd")),l[5]=+(l[7]+l[8]||l[3]==="odd")):l[3]&&$e(l[0]),l},PSEUDO:function(l){var f,h=!l[6]&&l[2];return Qn.CHILD.test(l[0])?null:(l[3]?l[2]=l[4]||l[5]||"":h&&he.test(h)&&(f=Y(h,!0))&&(f=h.indexOf(")",h.length-f)-h.length)&&(l[0]=l[0].slice(0,f),l[2]=h.slice(0,f)),l.slice(0,3))}};function wt(l){for(var f=0,h=l.length,m="";f<h;f++)m+=l[f].value;return m}function Xe(l,f,h,m,k,x,v){var M=0,E=l.length,A=h==null;if(w(h)==="object"){k=!0;for(M in h)Xe(l,f,M,h[M],!0,x,v)}else if(m!==void 0&&(k=!0,typeof m!="function"&&(v=!0),A&&(v?(f.call(l,m),f=null):(A=f,f=function(N,L,O){return A.call(b(N),O)})),f))for(;M<E;M++)f(l[M],h,v?m:m.call(l[M],M,f(l[M],h)));return k?l:A?f.call(l):E?f(l[0],h):x}var it=/[^\x20\t\r\n\f]+/g;b.fn.extend({attr:function(l,f){return Xe(this,b.attr,l,f,arguments.length>1)},removeAttr:function(l){return this.each(function(){b.removeAttr(this,l)})}}),b.extend({attr:function(l,f,h){var m,k,x=l.nodeType;if(!(x===3||x===8||x===2)){if(typeof l.getAttribute>"u")return b.prop(l,f,h);if((x!==1||!b.isXMLDoc(l))&&(k=b.attrHooks[f.toLowerCase()]),h!==void 0){if(h===null||h===!1&&f.toLowerCase().indexOf("aria-")!==0){b.removeAttr(l,f);return}return k&&"set"in k&&(m=k.set(l,h,f))!==void 0?m:(l.setAttribute(f,h),h)}return k&&"get"in k&&(m=k.get(l,f))!==null?m:(m=l.getAttribute(f),m??void 0)}},attrHooks:{},removeAttr:function(l,f){var h,m=0,k=f&&f.match(it);if(k&&l.nodeType===1)for(;h=k[m++];)l.removeAttribute(h)}}),ee&&(b.attrHooks.type={set:function(l,f){if(f==="radio"&&$(l,"input")){var h=l.value;return l.setAttribute("type",f),h&&(l.value=h),f}}});var Io=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;function wn(l,f){return f?l==="\0"?"<EFBFBD>":l.slice(0,-1)+"\\"+l.charCodeAt(l.length-1).toString(16)+" ":"\\"+l}b.escapeSelector=function(l){return(l+"").replace(Io,wn)};var ym=t.sort,bm=t.splice,Lo;function km(l,f){if(l===f)return Lo=!0,0;var h=!l.compareDocumentPosition-!f.compareDocumentPosition;return h||(h=(l.ownerDocument||l)==(f.ownerDocument||f)?l.compareDocumentPosition(f):1,h&1?l==C||l.ownerDocument==C&&b.contains(C,l)?-1:f==C||f.ownerDocument==C&&b.contains(C,f)?1:0:h&4?-1:1)}b.uniqueSort=function(l){var f,h=[],m=0,k=0;if(Lo=!1,ym.call(l,km),Lo){for(;f=l[k++];)f===l[k]&&(m=h.push(k));for(;m--;)bm.call(l,h[m],1)}return l},b.fn.uniqueSort=function(){return this.pushStack(b.uniqueSort(i.apply(this)))};var Yn,Oi,st,gc,Ft,Ht=0,xm=0,yc=xn(),bc=xn(),Ri=xn(),wm=new RegExp(H+"+","g"),Tm=new RegExp("^"+ue+"$"),kc=b.extend({needsContext:new RegExp("^"+H+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+H+"*((?:-\\d)?\\d*)"+H+"*\\)|)(?=[^-]|$)","i")},Qn),Sm=/^(?:input|select|textarea|button)$/i,vm=/^h\d$/i,Cm=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Em=function(){Zn()},Mm=Ni(function(l){return l.disabled===!0&&$(l,"fieldset")},{dir:"parentNode",next:"legend"});function Tt(l,f,h,m){var k,x,v,M,E,A,N,L=f&&f.ownerDocument,O=f?f.nodeType:9;if(h=h||[],typeof l!="string"||!l||O!==1&&O!==9&&O!==11)return h;if(!m&&(Zn(f),f=f||st,Ft)){if(O!==11&&(E=Cm.exec(l)))if(k=E[1]){if(O===9)return(v=f.getElementById(k))&&o.call(h,v),h;if(L&&(v=L.getElementById(k))&&b.contains(f,v))return o.call(h,v),h}else{if(E[2])return o.apply(h,f.getElementsByTagName(l)),h;if((k=E[3])&&f.getElementsByClassName)return o.apply(h,f.getElementsByClassName(k)),h}if(!Ri[l+" "]&&(!ge||!ge.test(l))){if(N=l,L=f,O===1&&(fe.test(l)||se.test(l))){for(L=ze.test(l)&&ct(f.parentNode)||f,(L!=f||ee)&&((M=f.getAttribute("id"))?M=b.escapeSelector(M):f.setAttribute("id",M=b.expando)),A=Y(l),x=A.length;x--;)A[x]=(M?"#"+M:":scope")+" "+wt(A[x]);N=A.join(",")}try{return o.apply(h,L.querySelectorAll(N)),h}catch{Ri(l,!0)}finally{M===b.expando&&f.removeAttribute("id")}}}return Tc(l.replace(Se,"$1"),f,h,m)}function Pt(l){return l[b.expando]=!0,l}function Am(l){return function(f){return $(f,"input")&&f.type===l}}function Om(l){return function(f){return($(f,"input")||$(f,"button"))&&f.type===l}}function xc(l){return function(f){return"form"in f?f.parentNode&&f.disabled===!1?"label"in f?"label"in f.parentNode?f.parentNode.disabled===l:f.disabled===l:f.isDisabled===l||f.isDisabled!==!l&&Mm(f)===l:f.disabled===l:"label"in f?f.disabled===l:!1}}function Tn(l){return Pt(function(f){return f=+f,Pt(function(h,m){for(var k,x=l([],h.length,f),v=x.length;v--;)h[k=x[v]]&&(h[k]=!(m[k]=h[k]))})})}function Zn(l){var f,h=l?l.ownerDocument||l:C;h==st||h.nodeType!==9||(st=h,gc=st.documentElement,Ft=!b.isXMLDoc(st),ee&&C!=st&&(f=st.defaultView)&&f.top!==f&&f.addEventListener("unload",Em))}Tt.matches=function(l,f){return Tt(l,null,null,f)},Tt.matchesSelector=function(l,f){if(Zn(l),Ft&&!Ri[f+" "]&&(!ge||!ge.test(f)))try{return Do.call(l,f)}catch{Ri(f,!0)}return Tt(f,st,null,[l]).length>0},b.expr={cacheLength:50,createPseudo:Pt,match:kc,find:{ID:function(l,f){if(typeof f.getElementById<"u"&&Ft){var h=f.getElementById(l);return h?[h]:[]}},TAG:function(l,f){return typeof f.getElementsByTagName<"u"?f.getElementsByTagName(l):f.querySelectorAll(l)},CLASS:function(l,f){if(typeof f.getElementsByClassName<"u"&&Ft)return f.getElementsByClassName(l)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:ft,filter:{ID:function(l){var f=xt(l);return function(h){return h.getAttribute("id")===f}},TAG:function(l){var f=xt(l).toLowerCase();return l==="*"?function(){return!0}:function(h){return $(h,f)}},CLASS:function(l){var f=yc[l+" "];return f||(f=new RegExp("(^|"+H+")"+l+"("+H+"|$)"))&&yc(l,function(h){return f.test(typeof h.className=="string"&&h.className||typeof h.getAttribute<"u"&&h.getAttribute("class")||"")})},ATTR:function(l,f,h){return function(m){var k=b.attr(m,l);return k==null?f==="!=":f?(k+="",f==="="?k===h:f==="!="?k!==h:f==="^="?h&&k.indexOf(h)===0:f==="*="?h&&k.indexOf(h)>-1:f==="$="?h&&k.slice(-h.length)===h:f==="~="?(" "+k.replace(wm," ")+" ").indexOf(h)>-1:f==="|="?k===h||k.slice(0,h.length+1)===h+"-":!1):!0}},CHILD:function(l,f,h,m,k){var x=l.slice(0,3)!=="nth",v=l.slice(-4)!=="last",M=f==="of-type";return m===1&&k===0?function(E){return!!E.parentNode}:function(E,A,N){var L,O,P,U,Q,G=x!==v?"nextSibling":"previousSibling",ye=E.parentNode,pe=M&&E.nodeName.toLowerCase(),Ze=!N&&!M,je=!1;if(ye){if(x){for(;G;){for(P=E;P=P[G];)if(M?$(P,pe):P.nodeType===1)return!1;Q=G=l==="only"&&!Q&&"nextSibling"}return!0}if(Q=[v?ye.firstChild:ye.lastChild],v&&Ze){for(O=ye[b.expando]||(ye[b.expando]={}),L=O[l]||[],U=L[0]===Ht&&L[1],je=U&&L[2],P=U&&ye.childNodes[U];P=++U&&P&&P[G]||(je=U=0)||Q.pop();)if(P.nodeType===1&&++je&&P===E){O[l]=[Ht,U,je];break}}else if(Ze&&(O=E[b.expando]||(E[b.expando]={}),L=O[l]||[],U=L[0]===Ht&&L[1],je=U),je===!1)for(;(P=++U&&P&&P[G]||(je=U=0)||Q.pop())&&!((M?$(P,pe):P.nodeType===1)&&++je&&(Ze&&(O=P[b.expando]||(P[b.expando]={}),O[l]=[Ht,je]),P===E)););return je-=k,je===m||je%m===0&&je/m>=0}}},PSEUDO:function(l,f){var h=b.expr.pseudos[l]||b.expr.setFilters[l.toLowerCase()]||$e("unsupported pseudo: "+l);return h[b.expando]?h(f):h}},pseudos:{not:Pt(function(l){var f=[],h=[],m=$o(l.replace(Se,"$1"));return m[b.expando]?Pt(function(k,x,v,M){for(var E,A=m(k,null,M,[]),N=k.length;N--;)(E=A[N])&&(k[N]=!(x[N]=E))}):function(k,x,v){return f[0]=k,m(f,null,v,h),f[0]=null,!h.pop()}}),has:Pt(function(l){return function(f){return Tt(l,f).length>0}}),contains:Pt(function(l){return l=xt(l),function(f){return(f.textContent||b.text(f)).indexOf(l)>-1}}),lang:Pt(function(l){return Tm.test(l||"")||$e("unsupported lang: "+l),l=xt(l).toLowerCase(),function(f){var h;do if(h=Ft?f.lang:f.getAttribute("xml:lang")||f.getAttribute("lang"))return h=h.toLowerCase(),h===l||h.indexOf(l+"-")===0;while((f=f.parentNode)&&f.nodeType===1);return!1}}),target:function(l){var f=n.location&&n.location.hash;return f&&f.slice(1)===l.id},root:function(l){return l===gc},focus:function(l){return l===st.activeElement&&st.hasFocus()&&!!(l.type||l.href||~l.tabIndex)},enabled:xc(!1),disabled:xc(!0),checked:function(l){return $(l,"input")&&!!l.checked||$(l,"option")&&!!l.selected},selected:function(l){return ee&&l.parentNode&&l.parentNode.selectedIndex,l.selected===!0},empty:function(l){for(l=l.firstChild;l;l=l.nextSibling)if(l.nodeType<6)return!1;return!0},parent:function(l){return!b.expr.pseudos.empty(l)},header:function(l){return vm.test(l.nodeName)},input:function(l){return Sm.test(l.nodeName)},button:function(l){return $(l,"input")&&l.type==="button"||$(l,"button")},text:function(l){return $(l,"input")&&l.type==="text"},first:Tn(function(){return[0]}),last:Tn(function(l,f){return[f-1]}),eq:Tn(function(l,f,h){return[h<0?h+f:h]}),even:Tn(function(l,f){for(var h=0;h<f;h+=2)l.push(h);return l}),odd:Tn(function(l,f){for(var h=1;h<f;h+=2)l.push(h);return l}),lt:Tn(function(l,f,h){var m;for(h<0?m=h+f:h>f?m=f:m=h;--m>=0;)l.push(m);return l}),gt:Tn(function(l,f,h){for(var m=h<0?h+f:h;++m<f;)l.push(m);return l})}},b.expr.pseudos.nth=b.expr.pseudos.eq;for(Yn in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})b.expr.pseudos[Yn]=Am(Yn);for(Yn in{submit:!0,reset:!0})b.expr.pseudos[Yn]=Om(Yn);function wc(){}wc.prototype=b.expr.pseudos,b.expr.setFilters=new wc;function Ni(l,f,h){var m=f.dir,k=f.next,x=k||m,v=h&&x==="parentNode",M=xm++;return f.first?function(E,A,N){for(;E=E[m];)if(E.nodeType===1||v)return l(E,A,N);return!1}:function(E,A,N){var L,O,P=[Ht,M];if(N){for(;E=E[m];)if((E.nodeType===1||v)&&l(E,A,N))return!0}else for(;E=E[m];)if(E.nodeType===1||v)if(O=E[b.expando]||(E[b.expando]={}),k&&$(E,k))E=E[m]||E;else{if((L=O[x])&&L[0]===Ht&&L[1]===M)return P[2]=L[2];if(O[x]=P,P[2]=l(E,A,N))return!0}return!1}}function Bo(l){return l.length>1?function(f,h,m){for(var k=l.length;k--;)if(!l[k](f,h,m))return!1;return!0}:l[0]}function Rm(l,f,h){for(var m=0,k=f.length;m<k;m++)Tt(l,f[m],h);return h}function Di(l,f,h,m,k){for(var x,v=[],M=0,E=l.length,A=f!=null;M<E;M++)(x=l[M])&&(!h||h(x,m,k))&&(v.push(x),A&&f.push(M));return v}function _o(l,f,h,m,k,x){return m&&!m[b.expando]&&(m=_o(m)),k&&!k[b.expando]&&(k=_o(k,x)),Pt(function(v,M,E,A){var N,L,O,P,U=[],Q=[],G=M.length,ye=v||Rm(f||"*",E.nodeType?[E]:E,[]),pe=l&&(v||!f)?Di(ye,U,l,E,A):ye;if(h?(P=k||(v?l:G||m)?[]:M,h(pe,P,E,A)):P=pe,m)for(N=Di(P,Q),m(N,[],E,A),L=N.length;L--;)(O=N[L])&&(P[Q[L]]=!(pe[Q[L]]=O));if(v){if(k||l){if(k){for(N=[],L=P.length;L--;)(O=P[L])&&N.push(pe[L]=O);k(null,P=[],N,A)}for(L=P.length;L--;)(O=P[L])&&(N=k?a.call(v,O):U[L])>-1&&(v[N]=!(M[N]=O))}}else P=Di(P===M?P.splice(G,P.length):P),k?k(null,M,P,A):o.apply(M,P)})}function zo(l){for(var f,h,m,k=l.length,x=b.expr.relative[l[0].type],v=x||b.expr.relative[" "],M=x?1:0,E=Ni(function(L){return L===f},v,!0),A=Ni(function(L){return a.call(f,L)>-1},v,!0),N=[function(L,O,P){var U=!x&&(P||O!=Oi)||((f=O).nodeType?E(L,O,P):A(L,O,P));return f=null,U}];M<k;M++)if(h=b.expr.relative[l[M].type])N=[Ni(Bo(N),h)];else{if(h=b.expr.filter[l[M].type].apply(null,l[M].matches),h[b.expando]){for(m=++M;m<k&&!b.expr.relative[l[m].type];m++);return _o(M>1&&Bo(N),M>1&&wt(l.slice(0,M-1).concat({value:l[M-2].type===" "?"*":""})).replace(Se,"$1"),h,M<m&&zo(l.slice(M,m)),m<k&&zo(l=l.slice(m)),m<k&&wt(l))}N.push(h)}return Bo(N)}function Nm(l,f){var h=f.length>0,m=l.length>0,k=function(x,v,M,E,A){var N,L,O,P=0,U="0",Q=x&&[],G=[],ye=Oi,pe=x||m&&b.expr.find.TAG("*",A),Ze=Ht+=ye==null?1:Math.random()||.1;for(A&&(Oi=v==st||v||A);(N=pe[U])!=null;U++){if(m&&N){for(L=0,!v&&N.ownerDocument!=st&&(Zn(N),M=!Ft);O=l[L++];)if(O(N,v||st,M)){o.call(E,N);break}A&&(Ht=Ze)}h&&((N=!O&&N)&&P--,x&&Q.push(N))}if(P+=U,h&&U!==P){for(L=0;O=f[L++];)O(Q,G,v,M);if(x){if(P>0)for(;U--;)Q[U]||G[U]||(G[U]=q.call(E));G=Di(G)}o.apply(E,G),A&&!x&&G.length>0&&P+f.length>1&&b.uniqueSort(E)}return A&&(Ht=Ze,Oi=ye),Q};return h?Pt(k):k}function $o(l,f){var h,m=[],k=[],x=bc[l+" "];if(!x){for(f||(f=Y(l)),h=f.length;h--;)x=zo(f[h]),x[b.expando]?m.push(x):k.push(x);x=bc(l,Nm(k,m)),x.selector=l}return x}function Tc(l,f,h,m){var k,x,v,M,E,A=typeof l=="function"&&l,N=!m&&Y(l=A.selector||l);if(h=h||[],N.length===1){if(x=N[0]=N[0].slice(0),x.length>2&&(v=x[0]).type==="ID"&&f.nodeType===9&&Ft&&b.expr.relative[x[1].type]){if(f=(b.expr.find.ID(xt(v.matches[0]),f)||[])[0],f)A&&(f=f.parentNode);else return h;l=l.slice(x.shift().value.length)}for(k=kc.needsContext.test(l)?0:x.length;k--&&(v=x[k],!b.expr.relative[M=v.type]);)if((E=b.expr.find[M])&&(m=E(xt(v.matches[0]),ze.test(x[0].type)&&ct(f.parentNode)||f))){if(x.splice(k,1),l=m.length&&wt(x),!l)return o.apply(h,m),h;break}}return(A||$o(l,N))(m,f,!Ft,h,!f||ze.test(l)&&ct(f.parentNode)||f),h}Zn(),b.find=Tt,Tt.compile=$o,Tt.select=Tc,Tt.setDocument=Zn,Tt.tokenize=Y;function er(l,f,h){for(var m=[],k=h!==void 0;(l=l[f])&&l.nodeType!==9;)if(l.nodeType===1){if(k&&b(l).is(h))break;m.push(l)}return m}function Sc(l,f){for(var h=[];l;l=l.nextSibling)l.nodeType===1&&l!==f&&h.push(l);return h}var vc=b.expr.match.needsContext,Cc=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function Ec(l){return l[0]==="<"&&l[l.length-1]===">"&&l.length>=3}function jo(l,f,h){return typeof f=="function"?b.grep(l,function(m,k){return!!f.call(m,k,m)!==h}):f.nodeType?b.grep(l,function(m){return m===f!==h}):typeof f!="string"?b.grep(l,function(m){return a.call(f,m)>-1!==h}):b.filter(f,l,h)}b.filter=function(l,f,h){var m=f[0];return h&&(l=":not("+l+")"),f.length===1&&m.nodeType===1?b.find.matchesSelector(m,l)?[m]:[]:b.find.matches(l,b.grep(f,function(k){return k.nodeType===1}))},b.fn.extend({find:function(l){var f,h,m=this.length,k=this;if(typeof l!="string")return this.pushStack(b(l).filter(function(){for(f=0;f<m;f++)if(b.contains(k[f],this))return!0}));for(h=this.pushStack([]),f=0;f<m;f++)b.find(l,k[f],h);return m>1?b.uniqueSort(h):h},filter:function(l){return this.pushStack(jo(this,l||[],!1))},not:function(l){return this.pushStack(jo(this,l||[],!0))},is:function(l){return!!jo(this,typeof l=="string"&&vc.test(l)?b(l):l||[],!1).length}});var Pi,Dm=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,Pm=b.fn.init=function(l,f){var h,m;if(!l)return this;if(l.nodeType)return this[0]=l,this.length=1,this;if(typeof l=="function")return Pi.ready!==void 0?Pi.ready(l):l(b);if(h=l+"",Ec(h))h=[null,l,null];else if(typeof l=="string")h=Dm.exec(l);else return b.makeArray(l,this);if(h&&(h[1]||!f))if(h[1]){if(f=f instanceof b?f[0]:f,b.merge(this,b.parseHTML(h[1],f&&f.nodeType?f.ownerDocument||f:C,!0)),Cc.test(h[1])&&b.isPlainObject(f))for(h in f)typeof this[h]=="function"?this[h](f[h]):this.attr(h,f[h]);return this}else return m=C.getElementById(h[2]),m&&(this[0]=m,this.length=1),this;else return!f||f.jquery?(f||Pi).find(l):this.constructor(f).find(l)};Pm.prototype=b.fn,Pi=b(C);var Im=/^(?:parents|prev(?:Until|All))/,Lm={children:!0,contents:!0,next:!0,prev:!0};b.fn.extend({has:function(l){var f=b(l,this),h=f.length;return this.filter(function(){for(var m=0;m<h;m++)if(b.contains(this,f[m]))return!0})},closest:function(l,f){var h,m=0,k=this.length,x=[],v=typeof l!="string"&&b(l);if(!vc.test(l)){for(;m<k;m++)for(h=this[m];h&&h!==f;h=h.parentNode)if(h.nodeType<11&&(v?v.index(h)>-1:h.nodeType===1&&b.find.matchesSelector(h,l))){x.push(h);break}}return this.pushStack(x.length>1?b.uniqueSort(x):x)},index:function(l){return l?typeof l=="string"?a.call(b(l),this[0]):a.call(this,l.jquery?l[0]:l):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(l,f){return this.pushStack(b.uniqueSort(b.merge(this.get(),b(l,f))))},addBack:function(l){return this.add(l==null?this.prevObject:this.prevObject.filter(l))}});function Mc(l,f){for(;(l=l[f])&&l.nodeType!==1;);return l}b.each({parent:function(l){var f=l.parentNode;return f&&f.nodeType!==11?f:null},parents:function(l){return er(l,"parentNode")},parentsUntil:function(l,f,h){return er(l,"parentNode",h)},next:function(l){return Mc(l,"nextSibling")},prev:function(l){return Mc(l,"previousSibling")},nextAll:function(l){return er(l,"nextSibling")},prevAll:function(l){return er(l,"previousSibling")},nextUntil:function(l,f,h){return er(l,"nextSibling",h)},prevUntil:function(l,f,h){return er(l,"previousSibling",h)},siblings:function(l){return Sc((l.parentNode||{}).firstChild,l)},children:function(l){return Sc(l.firstChild)},contents:function(l){return l.contentDocument!=null&&r(l.contentDocument)?l.contentDocument:($(l,"template")&&(l=l.content||l),b.merge([],l.childNodes))}},function(l,f){b.fn[l]=function(h,m){var k=b.map(this,f,h);return l.slice(-5)!=="Until"&&(m=h),m&&typeof m=="string"&&(k=b.filter(m,k)),this.length>1&&(Lm[l]||b.uniqueSort(k),Im.test(l)&&k.reverse()),this.pushStack(k)}});function Bm(l){var f={};return b.each(l.match(it)||[],function(h,m){f[m]=!0}),f}b.Callbacks=function(l){l=typeof l=="string"?Bm(l):b.extend({},l);var f,h,m,k,x=[],v=[],M=-1,E=function(){for(k=k||l.once,m=f=!0;v.length;M=-1)for(h=v.shift();++M<x.length;)x[M].apply(h[0],h[1])===!1&&l.stopOnFalse&&(M=x.length,h=!1);l.memory||(h=!1),f=!1,k&&(h?x=[]:x="")},A={add:function(){return x&&(h&&!f&&(M=x.length-1,v.push(h)),(function N(L){b.each(L,function(O,P){typeof P=="function"?(!l.unique||!A.has(P))&&x.push(P):P&&P.length&&w(P)!=="string"&&N(P)})})(arguments),h&&!f&&E()),this},remove:function(){return b.each(arguments,function(N,L){for(var O;(O=b.inArray(L,x,O))>-1;)x.splice(O,1),O<=M&&M--}),this},has:function(N){return N?b.inArray(N,x)>-1:x.length>0},empty:function(){return x&&(x=[]),this},disable:function(){return k=v=[],x=h="",this},disabled:function(){return!x},lock:function(){return k=v=[],!h&&!f&&(x=h=""),this},locked:function(){return!!k},fireWith:function(N,L){return k||(L=L||[],L=[N,L.slice?L.slice():L],v.push(L),f||E()),this},fire:function(){return A.fireWith(this,arguments),this},fired:function(){return!!m}};return A};function tr(l){return l}function Ii(l){throw l}function Ac(l,f,h,m){var k;try{l&&typeof(k=l.promise)=="function"?k.call(l).done(f).fail(h):l&&typeof(k=l.then)=="function"?k.call(l,f,h):f.apply(void 0,[l].slice(m))}catch(x){h(x)}}b.extend({Deferred:function(l){var f=[["notify","progress",b.Callbacks("memory"),b.Callbacks("memory"),2],["resolve","done",b.Callbacks("once memory"),b.Callbacks("once memory"),0,"resolved"],["reject","fail",b.Callbacks("once memory"),b.Callbacks("once memory"),1,"rejected"]],h="pending",m={state:function(){return h},always:function(){return k.done(arguments).fail(arguments),this},catch:function(x){return m.then(null,x)},pipe:function(){var x=arguments;return b.Deferred(function(v){b.each(f,function(M,E){var A=typeof x[E[4]]=="function"&&x[E[4]];k[E[1]](function(){var N=A&&A.apply(this,arguments);N&&typeof N.promise=="function"?N.promise().progress(v.notify).done(v.resolve).fail(v.reject):v[E[0]+"With"](this,A?[N]:arguments)})}),x=null}).promise()},then:function(x,v,M){var E=0;function A(N,L,O,P){return function(){var U=this,Q=arguments,G=function(){var pe,Ze;if(!(N<E)){if(pe=O.apply(U,Q),pe===L.promise())throw new TypeError("Thenable self-resolution");Ze=pe&&(typeof pe=="object"||typeof pe=="function")&&pe.then,typeof Ze=="function"?P?Ze.call(pe,A(E,L,tr,P),A(E,L,Ii,P)):(E++,Ze.call(pe,A(E,L,tr,P),A(E,L,Ii,P),A(E,L,tr,L.notifyWith))):(O!==tr&&(U=void 0,Q=[pe]),(P||L.resolveWith)(U,Q))}},ye=P?G:function(){try{G()}catch(pe){b.Deferred.exceptionHook&&b.Deferred.exceptionHook(pe,ye.error),N+1>=E&&(O!==Ii&&(U=void 0,Q=[pe]),L.rejectWith(U,Q))}};N?ye():(b.Deferred.getErrorHook&&(ye.error=b.Deferred.getErrorHook()),n.setTimeout(ye))}}return b.Deferred(function(N){f[0][3].add(A(0,N,typeof M=="function"?M:tr,N.notifyWith)),f[1][3].add(A(0,N,typeof x=="function"?x:tr)),f[2][3].add(A(0,N,typeof v=="function"?v:Ii))}).promise()},promise:function(x){return x!=null?b.extend(x,m):m}},k={};return b.each(f,function(x,v){var M=v[2],E=v[5];m[v[1]]=M.add,E&&M.add(function(){h=E},f[3-x][2].disable,f[3-x][3].disable,f[0][2].lock,f[0][3].lock),M.add(v[3].fire),k[v[0]]=function(){return k[v[0]+"With"](this===k?void 0:this,arguments),this},k[v[0]+"With"]=M.fireWith}),m.promise(k),l&&l.call(k,k),k},when:function(l){var f=arguments.length,h=f,m=Array(h),k=i.call(arguments),x=b.Deferred(),v=function(M){return function(E){m[M]=this,k[M]=arguments.length>1?i.call(arguments):E,--f||x.resolveWith(m,k)}};if(f<=1&&(Ac(l,x.done(v(h)).resolve,x.reject,!f),x.state()==="pending"||typeof(k[h]&&k[h].then)=="function"))return x.then();for(;h--;)Ac(k[h],v(h),x.reject);return x.promise()}});var _m=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;b.Deferred.exceptionHook=function(l,f){l&&_m.test(l.name)&&n.console.warn("jQuery.Deferred exception",l,f)},b.readyException=function(l){n.setTimeout(function(){throw l})};var Fo=b.Deferred();b.fn.ready=function(l){return Fo.then(l).catch(function(f){b.readyException(f)}),this},b.extend({isReady:!1,readyWait:1,ready:function(l){(l===!0?--b.readyWait:b.isReady)||(b.isReady=!0,!(l!==!0&&--b.readyWait>0)&&Fo.resolveWith(C,[b]))}}),b.ready.then=Fo.then;function Li(){C.removeEventListener("DOMContentLoaded",Li),n.removeEventListener("load",Li),b.ready()}C.readyState!=="loading"?n.setTimeout(b.ready):(C.addEventListener("DOMContentLoaded",Li),n.addEventListener("load",Li));var zm=/-([a-z])/g;function $m(l,f){return f.toUpperCase()}function Sn(l){return l.replace(zm,$m)}function Pr(l){return l.nodeType===1||l.nodeType===9||!+l.nodeType}function Ir(){this.expando=b.expando+Ir.uid++}Ir.uid=1,Ir.prototype={cache:function(l){var f=l[this.expando];return f||(f=Object.create(null),Pr(l)&&(l.nodeType?l[this.expando]=f:Object.defineProperty(l,this.expando,{value:f,configurable:!0}))),f},set:function(l,f,h){var m,k=this.cache(l);if(typeof f=="string")k[Sn(f)]=h;else for(m in f)k[Sn(m)]=f[m];return h},get:function(l,f){return f===void 0?this.cache(l):l[this.expando]&&l[this.expando][Sn(f)]},access:function(l,f,h){return f===void 0||f&&typeof f=="string"&&h===void 0?this.get(l,f):(this.set(l,f,h),h!==void 0?h:f)},remove:function(l,f){var h,m=l[this.expando];if(m!==void 0){if(f!==void 0)for(Array.isArray(f)?f=f.map(Sn):(f=Sn(f),f=f in m?[f]:f.match(it)||[]),h=f.length;h--;)delete m[f[h]];(f===void 0||b.isEmptyObject(m))&&(l.nodeType?l[this.expando]=void 0:delete l[this.expando])}},hasData:function(l){var f=l[this.expando];return f!==void 0&&!b.isEmptyObject(f)}};var Z=new Ir,Qe=new Ir,jm=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Fm=/[A-Z]/g;function Hm(l){return l==="true"?!0:l==="false"?!1:l==="null"?null:l===+l+""?+l:jm.test(l)?JSON.parse(l):l}function Oc(l,f,h){var m;if(h===void 0&&l.nodeType===1)if(m="data-"+f.replace(Fm,"-$&").toLowerCase(),h=l.getAttribute(m),typeof h=="string"){try{h=Hm(h)}catch{}Qe.set(l,f,h)}else h=void 0;return h}b.extend({hasData:function(l){return Qe.hasData(l)||Z.hasData(l)},data:function(l,f,h){return Qe.access(l,f,h)},removeData:function(l,f){Qe.remove(l,f)},_data:function(l,f,h){return Z.access(l,f,h)},_removeData:function(l,f){Z.remove(l,f)}}),b.fn.extend({data:function(l,f){var h,m,k,x=this[0],v=x&&x.attributes;if(l===void 0){if(this.length&&(k=Qe.get(x),x.nodeType===1&&!Z.get(x,"hasDataAttrs"))){for(h=v.length;h--;)v[h]&&(m=v[h].name,m.indexOf("data-")===0&&(m=Sn(m.slice(5)),Oc(x,m,k[m])));Z.set(x,"hasDataAttrs",!0)}return k}return typeof l=="object"?this.each(function(){Qe.set(this,l)}):Xe(this,function(M){var E;if(x&&M===void 0)return E=Qe.get(x,l),E!==void 0||(E=Oc(x,l),E!==void 0)?E:void 0;this.each(function(){Qe.set(this,l,M)})},null,f,arguments.length>1,null,!0)},removeData:function(l){return this.each(function(){Qe.remove(this,l)})}}),b.extend({queue:function(l,f,h){var m;if(l)return f=(f||"fx")+"queue",m=Z.get(l,f),h&&(!m||Array.isArray(h)?m=Z.set(l,f,b.makeArray(h)):m.push(h)),m||[]},dequeue:function(l,f){f=f||"fx";var h=b.queue(l,f),m=h.length,k=h.shift(),x=b._queueHooks(l,f),v=function(){b.dequeue(l,f)};k==="inprogress"&&(k=h.shift(),m--),k&&(f==="fx"&&h.unshift("inprogress"),delete x.stop,k.call(l,v,x)),!m&&x&&x.empty.fire()},_queueHooks:function(l,f){var h=f+"queueHooks";return Z.get(l,h)||Z.set(l,h,{empty:b.Callbacks("once memory").add(function(){Z.remove(l,[f+"queue",h])})})}}),b.fn.extend({queue:function(l,f){var h=2;return typeof l!="string"&&(f=l,l="fx",h--),arguments.length<h?b.queue(this[0],l):f===void 0?this:this.each(function(){var m=b.queue(this,l,f);b._queueHooks(this,l),l==="fx"&&m[0]!=="inprogress"&&b.dequeue(this,l)})},dequeue:function(l){return this.each(function(){b.dequeue(this,l)})},clearQueue:function(l){return this.queue(l||"fx",[])},promise:function(l,f){var h,m=1,k=b.Deferred(),x=this,v=this.length,M=function(){--m||k.resolveWith(x,[x])};for(typeof l!="string"&&(f=l,l=void 0),l=l||"fx";v--;)h=Z.get(x[v],l+"queueHooks"),h&&h.empty&&(m++,h.empty.add(M));return M(),k.promise(f)}});var Rc=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,Lr=new RegExp("^(?:([+-])=|)("+Rc+")([a-z%]*)$","i"),en=["Top","Right","Bottom","Left"];function Bi(l,f){return l=f||l,l.style.display==="none"||l.style.display===""&&b.css(l,"display")==="none"}var Vm=/^[a-z]/,qm=/^(?:Border(?:Top|Right|Bottom|Left)?(?:Width|)|(?:Margin|Padding)?(?:Top|Right|Bottom|Left)?|(?:Min|Max)?(?:Width|Height))$/;function _i(l){return Vm.test(l)&&qm.test(l[0].toUpperCase()+l.slice(1))}function Nc(l,f,h,m){var k,x,v=20,M=m?function(){return m.cur()}:function(){return b.css(l,f,"")},E=M(),A=h&&h[3]||(_i(f)?"px":""),N=l.nodeType&&(!_i(f)||A!=="px"&&+E)&&Lr.exec(b.css(l,f));if(N&&N[3]!==A){for(E=E/2,A=A||N[3],N=+E||1;v--;)b.style(l,f,N+A),(1-x)*(1-(x=M()/E||.5))<=0&&(v=0),N=N/x;N=N*2,b.style(l,f,N+A),h=h||[]}return h&&(N=+N||+E||0,k=h[1]?N+(h[1]+1)*h[2]:+h[2],m&&(m.unit=A,m.start=N,m.end=k)),k}var Um=/^-ms-/;function Ho(l){return Sn(l.replace(Um,"ms-"))}var Dc={};function Wm(l){var f,h=l.ownerDocument,m=l.nodeName,k=Dc[m];return k||(f=h.body.appendChild(h.createElement(m)),k=b.css(f,"display"),f.parentNode.removeChild(f),k==="none"&&(k="block"),Dc[m]=k,k)}function nr(l,f){for(var h,m,k=[],x=0,v=l.length;x<v;x++)m=l[x],m.style&&(h=m.style.display,f?(h==="none"&&(k[x]=Z.get(m,"display")||null,k[x]||(m.style.display="")),m.style.display===""&&Bi(m)&&(k[x]=Wm(m))):h!=="none"&&(k[x]="none",Z.set(m,"display",h)));for(x=0;x<v;x++)k[x]!=null&&(l[x].style.display=k[x]);return l}b.fn.extend({show:function(){return nr(this,!0)},hide:function(){return nr(this)},toggle:function(l){return typeof l=="boolean"?l?this.show():this.hide():this.each(function(){Bi(this)?b(this).show():b(this).hide()})}});var Br=function(l){return b.contains(l.ownerDocument,l)||l.getRootNode(Km)===l.ownerDocument},Km={composed:!0};Nt.getRootNode||(Br=function(l){return b.contains(l.ownerDocument,l)});var Pc=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,Vt={thead:["table"],col:["colgroup","table"],tr:["tbody","table"],td:["tr","tbody","table"]};Vt.tbody=Vt.tfoot=Vt.colgroup=Vt.caption=Vt.thead,Vt.th=Vt.td;function Ye(l,f){var h;return typeof l.getElementsByTagName<"u"?h=t.slice.call(l.getElementsByTagName(f||"*")):typeof l.querySelectorAll<"u"?h=l.querySelectorAll(f||"*"):h=[],f===void 0||f&&$(l,f)?b.merge([l],h):h}var Ic=/^$|^module$|\/(?:java|ecma)script/i;function Vo(l,f){for(var h=0,m=l.length;h<m;h++)Z.set(l[h],"globalEval",!f||Z.get(f[h],"globalEval"))}var Jm=/<|&#?\w+;/;function Lc(l,f,h,m,k){for(var x,v,M,E,A,N,L=f.createDocumentFragment(),O=[],P=0,U=l.length;P<U;P++)if(x=l[P],x||x===0)if(w(x)==="object"&&(x.nodeType||S(x)))b.merge(O,x.nodeType?[x]:x);else if(!Jm.test(x))O.push(f.createTextNode(x));else{for(v=v||L.appendChild(f.createElement("div")),M=(Pc.exec(x)||["",""])[1].toLowerCase(),E=Vt[M]||t,N=E.length;--N>-1;)v=v.appendChild(f.createElement(E[N]));v.innerHTML=b.htmlPrefilter(x),b.merge(O,v.childNodes),v=L.firstChild,v.textContent=""}for(L.textContent="",P=0;x=O[P++];){if(m&&b.inArray(x,m)>-1){k&&k.push(x);continue}if(A=Br(x),v=Ye(L.appendChild(x),"script"),A&&Vo(v),h)for(N=0;x=v[N++];)Ic.test(x.type||"")&&h.push(x)}return L}function Gm(l){return l.type=(l.getAttribute("type")!==null)+"/"+l.type,l}function Xm(l){return(l.type||"").slice(0,5)==="true/"?l.type=l.type.slice(5):l.removeAttribute("type"),l}function rr(l,f,h,m){f=s(f);var k,x,v,M,E,A,N=0,L=l.length,O=L-1,P=f[0],U=typeof P=="function";if(U)return l.each(function(Q){var G=l.eq(Q);f[0]=P.call(this,Q,G.html()),rr(G,f,h,m)});if(L&&(k=Lc(f,l[0].ownerDocument,!1,l,m),x=k.firstChild,k.childNodes.length===1&&(k=x),x||m)){for(v=b.map(Ye(k,"script"),Gm),M=v.length;N<L;N++)E=k,N!==O&&(E=b.clone(E,!0,!0),M&&b.merge(v,Ye(E,"script"))),h.call(l[N],E,N);if(M)for(A=v[v.length-1].ownerDocument,b.map(v,Xm),N=0;N<M;N++)E=v[N],Ic.test(E.type||"")&&!Z.get(E,"globalEval")&&b.contains(A,E)&&(E.src&&(E.type||"").toLowerCase()!=="module"?b._evalUrl&&!E.noModule&&b._evalUrl(E.src,{nonce:E.nonce,crossOrigin:E.crossOrigin},A):_(E.textContent,E,A))}return l}var zi=/^(?:checkbox|radio)$/i,Bc=/^([^.]*)(?:\.(.+)|)/;function ir(){return!0}function sr(){return!1}function qo(l,f,h,m,k,x){var v,M;if(typeof f=="object"){typeof h!="string"&&(m=m||h,h=void 0);for(M in f)qo(l,M,h,m,f[M],x);return l}if(m==null&&k==null?(k=h,m=h=void 0):k==null&&(typeof h=="string"?(k=m,m=void 0):(k=m,m=h,h=void 0)),k===!1)k=sr;else if(!k)return l;return x===1&&(v=k,k=function(E){return b().off(E),v.apply(this,arguments)},k.guid=v.guid||(v.guid=b.guid++)),l.each(function(){b.event.add(this,f,k,m,h)})}b.event={add:function(l,f,h,m,k){var x,v,M,E,A,N,L,O,P,U,Q,G=Z.get(l);if(Pr(l))for(h.handler&&(x=h,h=x.handler,k=x.selector),k&&b.find.matchesSelector(Nt,k),h.guid||(h.guid=b.guid++),(E=G.events)||(E=G.events=Object.create(null)),(v=G.handle)||(v=G.handle=function(ye){return typeof b<"u"&&b.event.triggered!==ye.type?b.event.dispatch.apply(l,arguments):void 0}),f=(f||"").match(it)||[""],A=f.length;A--;)M=Bc.exec(f[A])||[],P=Q=M[1],U=(M[2]||"").split(".").sort(),P&&(L=b.event.special[P]||{},P=(k?L.delegateType:L.bindType)||P,L=b.event.special[P]||{},N=b.extend({type:P,origType:Q,data:m,handler:h,guid:h.guid,selector:k,needsContext:k&&b.expr.match.needsContext.test(k),namespace:U.join(".")},x),(O=E[P])||(O=E[P]=[],O.delegateCount=0,(!L.setup||L.setup.call(l,m,U,v)===!1)&&l.addEventListener&&l.addEventListener(P,v)),L.add&&(L.add.call(l,N),N.handler.guid||(N.handler.guid=h.guid)),k?O.splice(O.delegateCount++,0,N):O.push(N))},remove:function(l,f,h,m,k){var x,v,M,E,A,N,L,O,P,U,Q,G=Z.hasData(l)&&Z.get(l);if(!(!G||!(E=G.events))){for(f=(f||"").match(it)||[""],A=f.length;A--;){if(M=Bc.exec(f[A])||[],P=Q=M[1],U=(M[2]||"").split(".").sort(),!P){for(P in E)b.event.remove(l,P+f[A],h,m,!0);continue}for(L=b.event.special[P]||{},P=(m?L.delegateType:L.bindType)||P,O=E[P]||[],M=M[2]&&new RegExp("(^|\\.)"+U.join("\\.(?:.*\\.|)")+"(\\.|$)"),v=x=O.length;x--;)N=O[x],(k||Q===N.origType)&&(!h||h.guid===N.guid)&&(!M||M.test(N.namespace))&&(!m||m===N.selector||m==="**"&&N.selector)&&(O.splice(x,1),N.selector&&O.delegateCount--,L.remove&&L.remove.call(l,N));v&&!O.length&&((!L.teardown||L.teardown.call(l,U,G.handle)===!1)&&b.removeEvent(l,P,G.handle),delete E[P])}b.isEmptyObject(E)&&Z.remove(l,"handle events")}},dispatch:function(l){var f,h,m,k,x,v,M=new Array(arguments.length),E=b.event.fix(l),A=(Z.get(this,"events")||Object.create(null))[E.type]||[],N=b.event.special[E.type]||{};for(M[0]=E,f=1;f<arguments.length;f++)M[f]=arguments[f];if(E.delegateTarget=this,!(N.preDispatch&&N.preDispatch.call(this,E)===!1)){for(v=b.event.handlers.call(this,E,A),f=0;(k=v[f++])&&!E.isPropagationStopped();)for(E.currentTarget=k.elem,h=0;(x=k.handlers[h++])&&!E.isImmediatePropagationStopped();)(!E.rnamespace||x.namespace===!1||E.rnamespace.test(x.namespace))&&(E.handleObj=x,E.data=x.data,m=((b.event.special[x.origType]||{}).handle||x.handler).apply(k.elem,M),m!==void 0&&(E.result=m)===!1&&(E.preventDefault(),E.stopPropagation()));return N.postDispatch&&N.postDispatch.call(this,E),E.result}},handlers:function(l,f){var h,m,k,x,v,M=[],E=f.delegateCount,A=l.target;if(E&&!(l.type==="click"&&l.button>=1)){for(;A!==this;A=A.parentNode||this)if(A.nodeType===1&&!(l.type==="click"&&A.disabled===!0)){for(x=[],v={},h=0;h<E;h++)m=f[h],k=m.selector+" ",v[k]===void 0&&(v[k]=m.needsContext?b(k,this).index(A)>-1:b.find(k,this,null,[A]).length),v[k]&&x.push(m);x.length&&M.push({elem:A,handlers:x})}}return A=this,E<f.length&&M.push({elem:A,handlers:f.slice(E)}),M},addProp:function(l,f){Object.defineProperty(b.Event.prototype,l,{enumerable:!0,configurable:!0,get:typeof f=="function"?function(){if(this.originalEvent)return f(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[l]},set:function(h){Object.defineProperty(this,l,{enumerable:!0,configurable:!0,writable:!0,value:h})}})},fix:function(l){return l[b.expando]?l:new b.Event(l)},special:b.extend(Object.create(null),{load:{noBubble:!0},click:{setup:function(l){var f=this||l;return zi.test(f.type)&&f.click&&$(f,"input")&&$i(f,"click",!0),!1},trigger:function(l){var f=this||l;return zi.test(f.type)&&f.click&&$(f,"input")&&$i(f,"click"),!0},_default:function(l){var f=l.target;return zi.test(f.type)&&f.click&&$(f,"input")&&Z.get(f,"click")||$(f,"a")}},beforeunload:{postDispatch:function(l){l.result!==void 0&&l.preventDefault()}}})};function $i(l,f,h){if(!h){Z.get(l,f)===void 0&&b.event.add(l,f,ir);return}Z.set(l,f,!1),b.event.add(l,f,{namespace:!1,handler:function(m){var k,x=Z.get(this,f);if(m.isTrigger&1&&this[f]){if(x.length)(b.event.special[f]||{}).delegateType&&m.stopPropagation();else if(x=i.call(arguments),Z.set(this,f,x),this[f](),k=Z.get(this,f),Z.set(this,f,!1),x!==k)return m.stopImmediatePropagation(),m.preventDefault(),k&&k.value}else x.length&&(Z.set(this,f,{value:b.event.trigger(x[0],x.slice(1),this)}),m.stopPropagation(),m.isImmediatePropagationStopped=ir)}})}b.removeEvent=function(l,f,h){l.removeEventListener&&l.removeEventListener(f,h)},b.Event=function(l,f){if(!(this instanceof b.Event))return new b.Event(l,f);l&&l.type?(this.originalEvent=l,this.type=l.type,this.isDefaultPrevented=l.defaultPrevented?ir:sr,this.target=l.target,this.currentTarget=l.currentTarget,this.relatedTarget=l.relatedTarget):this.type=l,f&&b.extend(this,f),this.timeStamp=l&&l.timeStamp||Date.now(),this[b.expando]=!0},b.Event.prototype={constructor:b.Event,isDefaultPrevented:sr,isPropagationStopped:sr,isImmediatePropagationStopped:sr,isSimulated:!1,preventDefault:function(){var l=this.originalEvent;this.isDefaultPrevented=ir,l&&!this.isSimulated&&l.preventDefault()},stopPropagation:function(){var l=this.originalEvent;this.isPropagationStopped=ir,l&&!this.isSimulated&&l.stopPropagation()},stopImmediatePropagation:function(){var l=this.originalEvent;this.isImmediatePropagationStopped=ir,l&&!this.isSimulated&&l.stopImmediatePropagation(),this.stopPropagation()}},b.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,char:!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:!0},b.event.addProp),b.each({focus:"focusin",blur:"focusout"},function(l,f){function h(m){var k=b.event.fix(m);k.type=m.type==="focusin"?"focus":"blur",k.isSimulated=!0,k.target===k.currentTarget&&Z.get(this,"handle")(k)}b.event.special[l]={setup:function(){if($i(this,l,!0),ee)this.addEventListener(f,h);else return!1},trigger:function(){return $i(this,l),!0},teardown:function(){if(ee)this.removeEventListener(f,h);else return!1},_default:function(m){return Z.get(m.target,l)},delegateType:f}}),b.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(l,f){b.event.special[l]={delegateType:f,bindType:f,handle:function(h){var m,k=this,x=h.relatedTarget,v=h.handleObj;return(!x||x!==k&&!b.contains(k,x))&&(h.type=v.origType,m=v.handler.apply(this,arguments),h.type=f),m}}}),b.fn.extend({on:function(l,f,h,m){return qo(this,l,f,h,m)},one:function(l,f,h,m){return qo(this,l,f,h,m,1)},off:function(l,f,h){var m,k;if(l&&l.preventDefault&&l.handleObj)return m=l.handleObj,b(l.delegateTarget).off(m.namespace?m.origType+"."+m.namespace:m.origType,m.selector,m.handler),this;if(typeof l=="object"){for(k in l)this.off(k,f,l[k]);return this}return(f===!1||typeof f=="function")&&(h=f,f=void 0),h===!1&&(h=sr),this.each(function(){b.event.remove(this,l,h,f)})}});var Qm=/<script|<style|<link/i;function _c(l,f){return $(l,"table")&&$(f.nodeType!==11?f:f.firstChild,"tr")&&b(l).children("tbody")[0]||l}function zc(l,f){var h,m,k,x=Z.get(l,"events");if(f.nodeType===1){if(x){Z.remove(f,"handle events");for(h in x)for(m=0,k=x[h].length;m<k;m++)b.event.add(f,h,x[h][m])}Qe.hasData(l)&&Qe.set(f,b.extend({},Qe.get(l)))}}function $c(l,f,h){for(var m,k=f?b.filter(f,l):l,x=0;(m=k[x])!=null;x++)!h&&m.nodeType===1&&b.cleanData(Ye(m)),m.parentNode&&(h&&Br(m)&&Vo(Ye(m,"script")),m.parentNode.removeChild(m));return l}b.extend({htmlPrefilter:function(l){return l},clone:function(l,f,h){var m,k,x,v,M=l.cloneNode(!0),E=Br(l);if(ee&&(l.nodeType===1||l.nodeType===11)&&!b.isXMLDoc(l))for(v=Ye(M),x=Ye(l),m=0,k=x.length;m<k;m++)$(v[m],"textarea")&&(v[m].defaultValue=x[m].defaultValue);if(f)if(h)for(x=x||Ye(l),v=v||Ye(M),m=0,k=x.length;m<k;m++)zc(x[m],v[m]);else zc(l,M);return v=Ye(M,"script"),v.length>0&&Vo(v,!E&&Ye(l,"script")),M},cleanData:function(l){for(var f,h,m,k=b.event.special,x=0;(h=l[x])!==void 0;x++)if(Pr(h)){if(f=h[Z.expando]){if(f.events)for(m in f.events)k[m]?b.event.remove(h,m):b.removeEvent(h,m,f.handle);h[Z.expando]=void 0}h[Qe.expando]&&(h[Qe.expando]=void 0)}}}),b.fn.extend({detach:function(l){return $c(this,l,!0)},remove:function(l){return $c(this,l)},text:function(l){return Xe(this,function(f){return f===void 0?b.text(this):this.empty().each(function(){(this.nodeType===1||this.nodeType===11||this.nodeType===9)&&(this.textContent=f)})},null,l,arguments.length)},append:function(){return rr(this,arguments,function(l){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var f=_c(this,l);f.appendChild(l)}})},prepend:function(){return rr(this,arguments,function(l){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var f=_c(this,l);f.insertBefore(l,f.firstChild)}})},before:function(){return rr(this,arguments,function(l){this.parentNode&&this.parentNode.insertBefore(l,this)})},after:function(){return rr(this,arguments,function(l){this.parentNode&&this.parentNode.insertBefore(l,this.nextSibling)})},empty:function(){for(var l,f=0;(l=this[f])!=null;f++)l.nodeType===1&&(b.cleanData(Ye(l,!1)),l.textContent="");return this},clone:function(l,f){return l=l??!1,f=f??l,this.map(function(){return b.clone(this,l,f)})},html:function(l){return Xe(this,function(f){var h=this[0]||{},m=0,k=this.length;if(f===void 0&&h.nodeType===1)return h.innerHTML;if(typeof f=="string"&&!Qm.test(f)&&!Vt[(Pc.exec(f)||["",""])[1].toLowerCase()]){f=b.htmlPrefilter(f);try{for(;m<k;m++)h=this[m]||{},h.nodeType===1&&(b.cleanData(Ye(h,!1)),h.innerHTML=f);h=0}catch{}}h&&this.empty().append(f)},null,l,arguments.length)},replaceWith:function(){var l=[];return rr(this,arguments,function(f){var h=this.parentNode;b.inArray(this,l)<0&&(b.cleanData(Ye(this)),h&&h.replaceChild(f,this))},l)}}),b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(l,f){b.fn[l]=function(h){for(var m,k=[],x=b(h),v=x.length-1,M=0;M<=v;M++)m=M===v?this:this.clone(!0),b(x[M])[f](m),o.apply(k,m);return this.pushStack(k)}});var Ym=new RegExp("^("+Rc+")(?!px)[a-z%]+$","i"),Uo=/^--/;function ji(l){var f=l.ownerDocument.defaultView;return f||(f=n),f.getComputedStyle(l)}function Zm(l,f,h){var m,k,x={};for(k in f)x[k]=l.style[k],l.style[k]=f[k];m=h.call(l);for(k in f)l.style[k]=x[k];return m}function jc(l,f,h){var m,k=Uo.test(f);return h=h||ji(l),h&&(m=h.getPropertyValue(f)||h[f],k&&m&&(m=m.replace(Se,"$1")||void 0),m===""&&!Br(l)&&(m=b.style(l,f))),m!==void 0?m+"":m}var Fc=["Webkit","Moz","ms"],Hc=C.createElement("div").style;function eg(l){for(var f=l[0].toUpperCase()+l.slice(1),h=Fc.length;h--;)if(l=Fc[h]+f,l in Hc)return l}function Wo(l){return l in Hc?l:eg(l)||l}var Vc,qc,tn=C.createElement("table");function Uc(){if(!(!tn||!tn.style)){var l,f=C.createElement("col"),h=C.createElement("tr"),m=C.createElement("td");if(tn.style.cssText="position:absolute;left:-11111px;border-collapse:separate;border-spacing:0",h.style.cssText="box-sizing:content-box;border:1px solid;height:1px",m.style.cssText="height:9px;width:9px;padding:0",f.span=2,Nt.appendChild(tn).appendChild(f).parentNode.appendChild(h).appendChild(m).parentNode.appendChild(m.cloneNode(!0)),tn.offsetWidth===0){Nt.removeChild(tn);return}l=n.getComputedStyle(h),qc=ee||Math.round(parseFloat(n.getComputedStyle(f).width))===18,Vc=Math.round(parseFloat(l.height)+parseFloat(l.borderTopWidth)+parseFloat(l.borderBottomWidth))===h.offsetHeight,Nt.removeChild(tn),tn=null}}b.extend(g,{reliableTrDimensions:function(){return Uc(),Vc},reliableColDimensions:function(){return Uc(),qc}});var tg={position:"absolute",visibility:"hidden",display:"block"},Wc={letterSpacing:"0",fontWeight:"400"};function Kc(l,f,h){var m=Lr.exec(f);return m?Math.max(0,m[2]-(h||0))+(m[3]||"px"):f}function Jc(l,f,h,m,k,x){var v=f==="width"?1:0,M=0,E=0,A=0;if(h===(m?"border":"content"))return 0;for(;v<4;v+=2)h==="margin"&&(A+=b.css(l,h+en[v],!0,k)),m?(h==="content"&&(E-=b.css(l,"padding"+en[v],!0,k)),h!=="margin"&&(E-=b.css(l,"border"+en[v]+"Width",!0,k))):(E+=b.css(l,"padding"+en[v],!0,k),h!=="padding"?E+=b.css(l,"border"+en[v]+"Width",!0,k):M+=b.css(l,"border"+en[v]+"Width",!0,k));return!m&&x>=0&&(E+=Math.max(0,Math.ceil(l["offset"+f[0].toUpperCase()+f.slice(1)]-x-E-M-.5))||0),E+A}function Gc(l,f,h){var m=ji(l),k=ee||h,x=k&&b.css(l,"boxSizing",!1,m)==="border-box",v=x,M=jc(l,f,m),E="offset"+f[0].toUpperCase()+f.slice(1);if(Ym.test(M)){if(!h)return M;M="auto"}return(M==="auto"||ee&&x||!g.reliableColDimensions()&&$(l,"col")||!g.reliableTrDimensions()&&$(l,"tr"))&&l.getClientRects().length&&(x=b.css(l,"boxSizing",!1,m)==="border-box",v=E in l,v&&(M=l[E])),M=parseFloat(M)||0,M+Jc(l,f,h||(x?"border":"content"),v,m,M)+"px"}b.extend({cssHooks:{},style:function(l,f,h,m){if(!(!l||l.nodeType===3||l.nodeType===8||!l.style)){var k,x,v,M=Ho(f),E=Uo.test(f),A=l.style;if(E||(f=Wo(M)),v=b.cssHooks[f]||b.cssHooks[M],h!==void 0){if(x=typeof h,x==="string"&&(k=Lr.exec(h))&&k[1]&&(h=Nc(l,f,k),x="number"),h==null||h!==h)return;x==="number"&&(h+=k&&k[3]||(_i(M)?"px":"")),ee&&h===""&&f.indexOf("background")===0&&(A[f]="inherit"),(!v||!("set"in v)||(h=v.set(l,h,m))!==void 0)&&(E?A.setProperty(f,h):A[f]=h)}else return v&&"get"in v&&(k=v.get(l,!1,m))!==void 0?k:A[f]}},css:function(l,f,h,m){var k,x,v,M=Ho(f),E=Uo.test(f);return E||(f=Wo(M)),v=b.cssHooks[f]||b.cssHooks[M],v&&"get"in v&&(k=v.get(l,!0,h)),k===void 0&&(k=jc(l,f,m)),k==="normal"&&f in Wc&&(k=Wc[f]),h===""||h?(x=parseFloat(k),h===!0||isFinite(x)?x||0:k):k}}),b.each(["height","width"],function(l,f){b.cssHooks[f]={get:function(h,m,k){if(m)return b.css(h,"display")==="none"?Zm(h,tg,function(){return Gc(h,f,k)}):Gc(h,f,k)},set:function(h,m,k){var x,v=ji(h),M=k&&b.css(h,"boxSizing",!1,v)==="border-box",E=k?Jc(h,f,k,M,v):0;return E&&(x=Lr.exec(m))&&(x[3]||"px")!=="px"&&(h.style[f]=m,m=b.css(h,f)),Kc(h,m,E)}}}),b.each({margin:"",padding:"",border:"Width"},function(l,f){b.cssHooks[l+f]={expand:function(h){for(var m=0,k={},x=typeof h=="string"?h.split(" "):[h];m<4;m++)k[l+en[m]+f]=x[m]||x[m-2]||x[0];return k}},l!=="margin"&&(b.cssHooks[l+f].set=Kc)}),b.fn.extend({css:function(l,f){return Xe(this,function(h,m,k){var x,v,M={},E=0;if(Array.isArray(m)){for(x=ji(h),v=m.length;E<v;E++)M[m[E]]=b.css(h,m[E],!1,x);return M}return k!==void 0?b.style(h,m,k):b.css(h,m)},l,f,arguments.length>1)}});function dt(l,f,h,m,k){return new dt.prototype.init(l,f,h,m,k)}b.Tween=dt,dt.prototype={constructor:dt,init:function(l,f,h,m,k,x){this.elem=l,this.prop=h,this.easing=k||b.easing._default,this.options=f,this.start=this.now=this.cur(),this.end=m,this.unit=x||(_i(h)?"px":"")},cur:function(){var l=dt.propHooks[this.prop];return l&&l.get?l.get(this):dt.propHooks._default.get(this)},run:function(l){var f,h=dt.propHooks[this.prop];return this.options.duration?this.pos=f=b.easing[this.easing](l,this.options.duration*l,0,1,this.options.duration):this.pos=f=l,this.now=(this.end-this.start)*f+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),h&&h.set?h.set(this):dt.propHooks._default.set(this),this}},dt.prototype.init.prototype=dt.prototype,dt.propHooks={_default:{get:function(l){var f;return l.elem.nodeType!==1||l.elem[l.prop]!=null&&l.elem.style[l.prop]==null?l.elem[l.prop]:(f=b.css(l.elem,l.prop,""),!f||f==="auto"?0:f)},set:function(l){b.fx.step[l.prop]?b.fx.step[l.prop](l):l.elem.nodeType===1&&(b.cssHooks[l.prop]||l.elem.style[Wo(l.prop)]!=null)?b.style(l.elem,l.prop,l.now+l.unit):l.elem[l.prop]=l.now}}},b.easing={linear:function(l){return l},swing:function(l){return .5-Math.cos(l*Math.PI)/2},_default:"swing"},b.fx=dt.prototype.init,b.fx.step={};var or,Fi,ng=/^(?:toggle|show|hide)$/,rg=/queueHooks$/;function Ko(){Fi&&(C.hidden===!1&&n.requestAnimationFrame?n.requestAnimationFrame(Ko):n.setTimeout(Ko,13),b.fx.tick())}function Xc(){return n.setTimeout(function(){or=void 0}),or=Date.now()}function Hi(l,f){var h,m=0,k={height:l};for(f=f?1:0;m<4;m+=2-f)h=en[m],k["margin"+h]=k["padding"+h]=l;return f&&(k.opacity=k.width=l),k}function Qc(l,f,h){for(var m,k=(St.tweeners[f]||[]).concat(St.tweeners["*"]),x=0,v=k.length;x<v;x++)if(m=k[x].call(h,f,l))return m}function ig(l,f,h){var m,k,x,v,M,E,A,N,L="width"in f||"height"in f,O=this,P={},U=l.style,Q=l.nodeType&&Bi(l),G=Z.get(l,"fxshow");h.queue||(v=b._queueHooks(l,"fx"),v.unqueued==null&&(v.unqueued=0,M=v.empty.fire,v.empty.fire=function(){v.unqueued||M()}),v.unqueued++,O.always(function(){O.always(function(){v.unqueued--,b.queue(l,"fx").length||v.empty.fire()})}));for(m in f)if(k=f[m],ng.test(k)){if(delete f[m],x=x||k==="toggle",k===(Q?"hide":"show"))if(k==="show"&&G&&G[m]!==void 0)Q=!0;else continue;P[m]=G&&G[m]||b.style(l,m)}if(E=!b.isEmptyObject(f),!(!E&&b.isEmptyObject(P))){L&&l.nodeType===1&&(h.overflow=[U.overflow,U.overflowX,U.overflowY],A=G&&G.display,A==null&&(A=Z.get(l,"display")),N=b.css(l,"display"),N==="none"&&(A?N=A:(nr([l],!0),A=l.style.display||A,N=b.css(l,"display"),nr([l]))),(N==="inline"||N==="inline-block"&&A!=null)&&b.css(l,"float")==="none"&&(E||(O.done(function(){U.display=A}),A==null&&(N=U.display,A=N==="none"?"":N)),U.display="inline-block")),h.overflow&&(U.overflow="hidden",O.always(function(){U.overflow=h.overflow[0],U.overflowX=h.overflow[1],U.overflowY=h.overflow[2]})),E=!1;for(m in P)E||(G?"hidden"in G&&(Q=G.hidden):G=Z.set(l,"fxshow",{display:A}),x&&(G.hidden=!Q),Q&&nr([l],!0),O.done(function(){Q||nr([l]),Z.remove(l,"fxshow");for(m in P)b.style(l,m,P[m])})),E=Qc(Q?G[m]:0,m,O),m in G||(G[m]=E.start,Q&&(E.end=E.start,E.start=0))}}function sg(l,f){var h,m,k,x,v;for(h in l)if(m=Ho(h),k=f[m],x=l[h],Array.isArray(x)&&(k=x[1],x=l[h]=x[0]),h!==m&&(l[m]=x,delete l[h]),v=b.cssHooks[m],v&&"expand"in v){x=v.expand(x),delete l[m];for(h in x)h in l||(l[h]=x[h],f[h]=k)}else f[m]=k}function St(l,f,h){var m,k,x=0,v=St.prefilters.length,M=b.Deferred().always(function(){delete E.elem}),E=function(){if(k)return!1;for(var L=or||Xc(),O=Math.max(0,A.startTime+A.duration-L),P=1-(O/A.duration||0),U=0,Q=A.tweens.length;U<Q;U++)A.tweens[U].run(P);return M.notifyWith(l,[A,P,O]),P<1&&Q?O:(Q||M.notifyWith(l,[A,1,0]),M.resolveWith(l,[A]),!1)},A=M.promise({elem:l,props:b.extend({},f),opts:b.extend(!0,{specialEasing:{},easing:b.easing._default},h),originalProperties:f,originalOptions:h,startTime:or||Xc(),duration:h.duration,tweens:[],createTween:function(L,O){var P=b.Tween(l,A.opts,L,O,A.opts.specialEasing[L]||A.opts.easing);return A.tweens.push(P),P},stop:function(L){var O=0,P=L?A.tweens.length:0;if(k)return this;for(k=!0;O<P;O++)A.tweens[O].run(1);return L?(M.notifyWith(l,[A,1,0]),M.resolveWith(l,[A,L])):M.rejectWith(l,[A,L]),this}}),N=A.props;for(sg(N,A.opts.specialEasing);x<v;x++)if(m=St.prefilters[x].call(A,l,N,A.opts),m)return typeof m.stop=="function"&&(b._queueHooks(A.elem,A.opts.queue).stop=m.stop.bind(m)),m;return b.map(N,Qc,A),typeof A.opts.start=="function"&&A.opts.start.call(l,A),A.progress(A.opts.progress).done(A.opts.done,A.opts.complete).fail(A.opts.fail).always(A.opts.always),b.fx.timer(b.extend(E,{elem:l,anim:A,queue:A.opts.queue})),A}b.Animation=b.extend(St,{tweeners:{"*":[function(l,f){var h=this.createTween(l,f);return Nc(h.elem,l,Lr.exec(f),h),h}]},tweener:function(l,f){typeof l=="function"?(f=l,l=["*"]):l=l.match(it);for(var h,m=0,k=l.length;m<k;m++)h=l[m],St.tweeners[h]=St.tweeners[h]||[],St.tweeners[h].unshift(f)},prefilters:[ig],prefilter:function(l,f){f?St.prefilters.unshift(l):St.prefilters.push(l)}}),b.speed=function(l,f,h){var m=l&&typeof l=="object"?b.extend({},l):{complete:h||f||typeof l=="function"&&l,duration:l,easing:h&&f||f&&typeof f!="function"&&f};return b.fx.off?m.duration=0:typeof m.duration!="number"&&(m.duration in b.fx.speeds?m.duration=b.fx.speeds[m.duration]:m.duration=b.fx.speeds._default),(m.queue==null||m.queue===!0)&&(m.queue="fx"),m.old=m.complete,m.complete=function(){typeof m.old=="function"&&m.old.call(this),m.queue&&b.dequeue(this,m.queue)},m},b.fn.extend({fadeTo:function(l,f,h,m){return this.filter(Bi).css("opacity",0).show().end().animate({opacity:f},l,h,m)},animate:function(l,f,h,m){var k=b.isEmptyObject(l),x=b.speed(f,h,m),v=function(){var M=St(this,b.extend({},l),x);(k||Z.get(this,"finish"))&&M.stop(!0)};return v.finish=v,k||x.queue===!1?this.each(v):this.queue(x.queue,v)},stop:function(l,f,h){var m=function(k){var x=k.stop;delete k.stop,x(h)};return typeof l!="string"&&(h=f,f=l,l=void 0),f&&this.queue(l||"fx",[]),this.each(function(){var k=!0,x=l!=null&&l+"queueHooks",v=b.timers,M=Z.get(this);if(x)M[x]&&M[x].stop&&m(M[x]);else for(x in M)M[x]&&M[x].stop&&rg.test(x)&&m(M[x]);for(x=v.length;x--;)v[x].elem===this&&(l==null||v[x].queue===l)&&(v[x].anim.stop(h),k=!1,v.splice(x,1));(k||!h)&&b.dequeue(this,l)})},finish:function(l){return l!==!1&&(l=l||"fx"),this.each(function(){var f,h=Z.get(this),m=h[l+"queue"],k=h[l+"queueHooks"],x=b.timers,v=m?m.length:0;for(h.finish=!0,b.queue(this,l,[]),k&&k.stop&&k.stop.call(this,!0),f=x.length;f--;)x[f].elem===this&&x[f].queue===l&&(x[f].anim.stop(!0),x.splice(f,1));for(f=0;f<v;f++)m[f]&&m[f].finish&&m[f].finish.call(this);delete h.finish})}}),b.each(["toggle","show","hide"],function(l,f){var h=b.fn[f];b.fn[f]=function(m,k,x){return m==null||typeof m=="boolean"?h.apply(this,arguments):this.animate(Hi(f,!0),m,k,x)}}),b.each({slideDown:Hi("show"),slideUp:Hi("hide"),slideToggle:Hi("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(l,f){b.fn[l]=function(h,m,k){return this.animate(f,h,m,k)}}),b.timers=[],b.fx.tick=function(){var l,f=0,h=b.timers;for(or=Date.now();f<h.length;f++)l=h[f],!l()&&h[f]===l&&h.splice(f--,1);h.length||b.fx.stop(),or=void 0},b.fx.timer=function(l){b.timers.push(l),b.fx.start()},b.fx.start=function(){Fi||(Fi=!0,Ko())},b.fx.stop=function(){Fi=null},b.fx.speeds={slow:600,fast:200,_default:400},b.fn.delay=function(l,f){return l=b.fx&&b.fx.speeds[l]||l,f=f||"fx",this.queue(f,function(h,m){var k=n.setTimeout(h,l);m.stop=function(){n.clearTimeout(k)}})};var og=/^(?:input|select|textarea|button)$/i,ag=/^(?:a|area)$/i;b.fn.extend({prop:function(l,f){return Xe(this,b.prop,l,f,arguments.length>1)},removeProp:function(l){return this.each(function(){delete this[b.propFix[l]||l]})}}),b.extend({prop:function(l,f,h){var m,k,x=l.nodeType;if(!(x===3||x===8||x===2))return(x!==1||!b.isXMLDoc(l))&&(f=b.propFix[f]||f,k=b.propHooks[f]),h!==void 0?k&&"set"in k&&(m=k.set(l,h,f))!==void 0?m:l[f]=h:k&&"get"in k&&(m=k.get(l,f))!==null?m:l[f]},propHooks:{tabIndex:{get:function(l){var f=l.getAttribute("tabindex");return f?parseInt(f,10):og.test(l.nodeName)||ag.test(l.nodeName)&&l.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),ee&&(b.propHooks.selected={get:function(l){var f=l.parentNode;return f&&f.parentNode&&f.parentNode.selectedIndex,null},set:function(l){var f=l.parentNode;f&&(f.selectedIndex,f.parentNode&&f.parentNode.selectedIndex)}}),b.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){b.propFix[this.toLowerCase()]=this});function vn(l){var f=l.match(it)||[];return f.join(" ")}function ar(l){return l.getAttribute&&l.getAttribute("class")||""}function Jo(l){return Array.isArray(l)?l:typeof l=="string"?l.match(it)||[]:[]}b.fn.extend({addClass:function(l){var f,h,m,k,x,v;return typeof l=="function"?this.each(function(M){b(this).addClass(l.call(this,M,ar(this)))}):(f=Jo(l),f.length?this.each(function(){if(m=ar(this),h=this.nodeType===1&&" "+vn(m)+" ",h){for(x=0;x<f.length;x++)k=f[x],h.indexOf(" "+k+" ")<0&&(h+=k+" ");v=vn(h),m!==v&&this.setAttribute("class",v)}}):this)},removeClass:function(l){var f,h,m,k,x,v;return typeof l=="function"?this.each(function(M){b(this).removeClass(l.call(this,M,ar(this)))}):arguments.length?(f=Jo(l),f.length?this.each(function(){if(m=ar(this),h=this.nodeType===1&&" "+vn(m)+" ",h){for(x=0;x<f.length;x++)for(k=f[x];h.indexOf(" "+k+" ")>-1;)h=h.replace(" "+k+" "," ");v=vn(h),m!==v&&this.setAttribute("class",v)}}):this):this.attr("class","")},toggleClass:function(l,f){var h,m,k,x;return typeof l=="function"?this.each(function(v){b(this).toggleClass(l.call(this,v,ar(this),f),f)}):typeof f=="boolean"?f?this.addClass(l):this.removeClass(l):(h=Jo(l),h.length?this.each(function(){for(x=b(this),k=0;k<h.length;k++)m=h[k],x.hasClass(m)?x.removeClass(m):x.addClass(m)}):this)},hasClass:function(l){var f,h,m=0;for(f=" "+l+" ";h=this[m++];)if(h.nodeType===1&&(" "+vn(ar(h))+" ").indexOf(f)>-1)return!0;return!1}}),b.fn.extend({val:function(l){var f,h,m,k=this[0];return arguments.length?(m=typeof l=="function",this.each(function(x){var v;this.nodeType===1&&(m?v=l.call(this,x,b(this).val()):v=l,v==null?v="":typeof v=="number"?v+="":Array.isArray(v)&&(v=b.map(v,function(M){return M==null?"":M+""})),f=b.valHooks[this.type]||b.valHooks[this.nodeName.toLowerCase()],(!f||!("set"in f)||f.set(this,v,"value")===void 0)&&(this.value=v))})):k?(f=b.valHooks[k.type]||b.valHooks[k.nodeName.toLowerCase()],f&&"get"in f&&(h=f.get(k,"value"))!==void 0?h:(h=k.value,h??"")):void 0}}),b.extend({valHooks:{select:{get:function(l){var f,h,m,k=l.options,x=l.selectedIndex,v=l.type==="select-one",M=v?null:[],E=v?x+1:k.length;for(x<0?m=E:m=v?x:0;m<E;m++)if(h=k[m],h.selected&&!h.disabled&&(!h.parentNode.disabled||!$(h.parentNode,"optgroup"))){if(f=b(h).val(),v)return f;M.push(f)}return M},set:function(l,f){for(var h,m,k=l.options,x=b.makeArray(f),v=k.length;v--;)m=k[v],(m.selected=b.inArray(b(m).val(),x)>-1)&&(h=!0);return h||(l.selectedIndex=-1),x}}}}),ee&&(b.valHooks.option={get:function(l){var f=l.getAttribute("value");return f??vn(b.text(l))}}),b.each(["radio","checkbox"],function(){b.valHooks[this]={set:function(l,f){if(Array.isArray(f))return l.checked=b.inArray(b(l).val(),f)>-1}}});var Yc=/^(?:focusinfocus|focusoutblur)$/,Zc=function(l){l.stopPropagation()};b.extend(b.event,{trigger:function(l,f,h,m){var k,x,v,M,E,A,N,L,O=[h||C],P=d.call(l,"type")?l.type:l,U=d.call(l,"namespace")?l.namespace.split("."):[];if(x=L=v=h=h||C,!(h.nodeType===3||h.nodeType===8)&&!Yc.test(P+b.event.triggered)&&(P.indexOf(".")>-1&&(U=P.split("."),P=U.shift(),U.sort()),E=P.indexOf(":")<0&&"on"+P,l=l[b.expando]?l:new b.Event(P,typeof l=="object"&&l),l.isTrigger=m?2:3,l.namespace=U.join("."),l.rnamespace=l.namespace?new RegExp("(^|\\.)"+U.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,l.result=void 0,l.target||(l.target=h),f=f==null?[l]:b.makeArray(f,[l]),N=b.event.special[P]||{},!(!m&&N.trigger&&N.trigger.apply(h,f)===!1))){if(!m&&!N.noBubble&&!T(h)){for(M=N.delegateType||P,Yc.test(M+P)||(x=x.parentNode);x;x=x.parentNode)O.push(x),v=x;v===(h.ownerDocument||C)&&O.push(v.defaultView||v.parentWindow||n)}for(k=0;(x=O[k++])&&!l.isPropagationStopped();)L=x,l.type=k>1?M:N.bindType||P,A=(Z.get(x,"events")||Object.create(null))[l.type]&&Z.get(x,"handle"),A&&A.apply(x,f),A=E&&x[E],A&&A.apply&&Pr(x)&&(l.result=A.apply(x,f),l.result===!1&&l.preventDefault());return l.type=P,!m&&!l.isDefaultPrevented()&&(!N._default||N._default.apply(O.pop(),f)===!1)&&Pr(h)&&E&&typeof h[P]=="function"&&!T(h)&&(v=h[E],v&&(h[E]=null),b.event.triggered=P,l.isPropagationStopped()&&L.addEventListener(P,Zc),h[P](),l.isPropagationStopped()&&L.removeEventListener(P,Zc),b.event.triggered=void 0,v&&(h[E]=v)),l.result}},simulate:function(l,f,h){var m=b.extend(new b.Event,h,{type:l,isSimulated:!0});b.event.trigger(m,null,f)}}),b.fn.extend({trigger:function(l,f){return this.each(function(){b.event.trigger(l,f,this)})},triggerHandler:function(l,f){var h=this[0];if(h)return b.event.trigger(l,f,h,!0)}});var _r=n.location,eu={guid:Date.now()},Go=/\?/;b.parseXML=function(l){var f,h;if(!l||typeof l!="string")return null;try{f=new n.DOMParser().parseFromString(l,"text/xml")}catch{}return h=f&&f.getElementsByTagName("parsererror")[0],(!f||h)&&b.error("Invalid XML: "+(h?b.map(h.childNodes,function(m){return m.textContent}).join(`
|
||
`):l)),f};var lg=/\[\]$/,tu=/\r?\n/g,cg=/^(?:submit|button|image|reset|file)$/i,ug=/^(?:input|select|textarea|keygen)/i;function Xo(l,f,h,m){var k;if(Array.isArray(f))b.each(f,function(x,v){h||lg.test(l)?m(l,v):Xo(l+"["+(typeof v=="object"&&v!=null?x:"")+"]",v,h,m)});else if(!h&&w(f)==="object")for(k in f)Xo(l+"["+k+"]",f[k],h,m);else m(l,f)}b.param=function(l,f){var h,m=[],k=function(x,v){var M=typeof v=="function"?v():v;m[m.length]=encodeURIComponent(x)+"="+encodeURIComponent(M??"")};if(l==null)return"";if(Array.isArray(l)||l.jquery&&!b.isPlainObject(l))b.each(l,function(){k(this.name,this.value)});else for(h in l)Xo(h,l[h],f,k);return m.join("&")},b.fn.extend({serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var l=b.prop(this,"elements");return l?b.makeArray(l):this}).filter(function(){var l=this.type;return this.name&&!b(this).is(":disabled")&&ug.test(this.nodeName)&&!cg.test(l)&&(this.checked||!zi.test(l))}).map(function(l,f){var h=b(this).val();return h==null?null:Array.isArray(h)?b.map(h,function(m){return{name:f.name,value:m.replace(tu,`\r
|
||
`)}}):{name:f.name,value:h.replace(tu,`\r
|
||
`)}}).get()}});var fg=/%20/g,dg=/#.*$/,hg=/([?&])_=[^&]*/,pg=/^(.*?):[ \t]*([^\r\n]*)$/mg,mg=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,gg=/^(?:GET|HEAD)$/,yg=/^\/\//,nu={},Qo={},ru="*/".concat("*"),Yo=C.createElement("a");Yo.href=_r.href;function iu(l){return function(f,h){typeof f!="string"&&(h=f,f="*");var m,k=0,x=f.toLowerCase().match(it)||[];if(typeof h=="function")for(;m=x[k++];)m[0]==="+"?(m=m.slice(1)||"*",(l[m]=l[m]||[]).unshift(h)):(l[m]=l[m]||[]).push(h)}}function su(l,f,h,m){var k={},x=l===Qo;function v(M){var E;return k[M]=!0,b.each(l[M]||[],function(A,N){var L=N(f,h,m);if(typeof L=="string"&&!x&&!k[L])return f.dataTypes.unshift(L),v(L),!1;if(x)return!(E=L)}),E}return v(f.dataTypes[0])||!k["*"]&&v("*")}function Zo(l,f){var h,m,k=b.ajaxSettings.flatOptions||{};for(h in f)f[h]!==void 0&&((k[h]?l:m||(m={}))[h]=f[h]);return m&&b.extend(!0,l,m),l}function bg(l,f,h){for(var m,k,x,v,M=l.contents,E=l.dataTypes;E[0]==="*";)E.shift(),m===void 0&&(m=l.mimeType||f.getResponseHeader("Content-Type"));if(m){for(k in M)if(M[k]&&M[k].test(m)){E.unshift(k);break}}if(E[0]in h)x=E[0];else{for(k in h){if(!E[0]||l.converters[k+" "+E[0]]){x=k;break}v||(v=k)}x=x||v}if(x)return x!==E[0]&&E.unshift(x),h[x]}function kg(l,f,h,m){var k,x,v,M,E,A={},N=l.dataTypes.slice();if(N[1])for(v in l.converters)A[v.toLowerCase()]=l.converters[v];for(x=N.shift();x;)if(l.responseFields[x]&&(h[l.responseFields[x]]=f),!E&&m&&l.dataFilter&&(f=l.dataFilter(f,l.dataType)),E=x,x=N.shift(),x){if(x==="*")x=E;else if(E!=="*"&&E!==x){if(v=A[E+" "+x]||A["* "+x],!v){for(k in A)if(M=k.split(" "),M[1]===x&&(v=A[E+" "+M[0]]||A["* "+M[0]],v)){v===!0?v=A[k]:A[k]!==!0&&(x=M[0],N.unshift(M[1]));break}}if(v!==!0)if(v&&l.throws)f=v(f);else try{f=v(f)}catch(L){return{state:"parsererror",error:v?L:"No conversion from "+E+" to "+x}}}}return{state:"success",data:f}}b.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:_r.href,type:"GET",isLocal:mg.test(_r.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":ru,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":b.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(l,f){return f?Zo(Zo(l,b.ajaxSettings),f):Zo(b.ajaxSettings,l)},ajaxPrefilter:iu(nu),ajaxTransport:iu(Qo),ajax:function(l,f){typeof l=="object"&&(f=l,l=void 0),f=f||{};var h,m,k,x,v,M,E,A,N,L,O=b.ajaxSetup({},f),P=O.context||O,U=O.context&&(P.nodeType||P.jquery)?b(P):b.event,Q=b.Deferred(),G=b.Callbacks("once memory"),ye=O.statusCode||{},pe={},Ze={},je="canceled",ie={readyState:0,getResponseHeader:function(oe){var Ce;if(E){if(!x)for(x={};Ce=pg.exec(k);)x[Ce[1].toLowerCase()+" "]=(x[Ce[1].toLowerCase()+" "]||[]).concat(Ce[2]);Ce=x[oe.toLowerCase()+" "]}return Ce==null?null:Ce.join(", ")},getAllResponseHeaders:function(){return E?k:null},setRequestHeader:function(oe,Ce){return E==null&&(oe=Ze[oe.toLowerCase()]=Ze[oe.toLowerCase()]||oe,pe[oe]=Ce),this},overrideMimeType:function(oe){return E==null&&(O.mimeType=oe),this},statusCode:function(oe){var Ce;if(oe)if(E)ie.always(oe[ie.status]);else for(Ce in oe)ye[Ce]=[ye[Ce],oe[Ce]];return this},abort:function(oe){var Ce=oe||je;return h&&h.abort(Ce),Vi(0,Ce),this}};if(Q.promise(ie),O.url=((l||O.url||_r.href)+"").replace(yg,_r.protocol+"//"),O.type=f.method||f.type||O.method||O.type,O.dataTypes=(O.dataType||"*").toLowerCase().match(it)||[""],O.crossDomain==null){M=C.createElement("a");try{M.href=O.url,M.href=M.href,O.crossDomain=Yo.protocol+"//"+Yo.host!=M.protocol+"//"+M.host}catch{O.crossDomain=!0}}if(su(nu,O,f,ie),O.data&&O.processData&&typeof O.data!="string"&&(O.data=b.param(O.data,O.traditional)),E)return ie;A=b.event&&O.global,A&&b.active++===0&&b.event.trigger("ajaxStart"),O.type=O.type.toUpperCase(),O.hasContent=!gg.test(O.type),m=O.url.replace(dg,""),O.hasContent?O.data&&O.processData&&(O.contentType||"").indexOf("application/x-www-form-urlencoded")===0&&(O.data=O.data.replace(fg,"+")):(L=O.url.slice(m.length),O.data&&(O.processData||typeof O.data=="string")&&(m+=(Go.test(m)?"&":"?")+O.data,delete O.data),O.cache===!1&&(m=m.replace(hg,"$1"),L=(Go.test(m)?"&":"?")+"_="+eu.guid+++L),O.url=m+L),O.ifModified&&(b.lastModified[m]&&ie.setRequestHeader("If-Modified-Since",b.lastModified[m]),b.etag[m]&&ie.setRequestHeader("If-None-Match",b.etag[m])),(O.data&&O.hasContent&&O.contentType!==!1||f.contentType)&&ie.setRequestHeader("Content-Type",O.contentType),ie.setRequestHeader("Accept",O.dataTypes[0]&&O.accepts[O.dataTypes[0]]?O.accepts[O.dataTypes[0]]+(O.dataTypes[0]!=="*"?", "+ru+"; q=0.01":""):O.accepts["*"]);for(N in O.headers)ie.setRequestHeader(N,O.headers[N]);if(O.beforeSend&&(O.beforeSend.call(P,ie,O)===!1||E))return ie.abort();if(je="abort",G.add(O.complete),ie.done(O.success),ie.fail(O.error),h=su(Qo,O,f,ie),!h)Vi(-1,"No Transport");else{if(ie.readyState=1,A&&U.trigger("ajaxSend",[ie,O]),E)return ie;O.async&&O.timeout>0&&(v=n.setTimeout(function(){ie.abort("timeout")},O.timeout));try{E=!1,h.send(pe,Vi)}catch(oe){if(E)throw oe;Vi(-1,oe)}}function Vi(oe,Ce,lu,Sg){var nn,ta,zr,lr,cr,It=Ce;E||(E=!0,v&&n.clearTimeout(v),h=void 0,k=Sg||"",ie.readyState=oe>0?4:0,nn=oe>=200&&oe<300||oe===304,lu&&(lr=bg(O,ie,lu)),!nn&&b.inArray("script",O.dataTypes)>-1&&b.inArray("json",O.dataTypes)<0&&(O.converters["text script"]=function(){}),lr=kg(O,lr,ie,nn),nn?(O.ifModified&&(cr=ie.getResponseHeader("Last-Modified"),cr&&(b.lastModified[m]=cr),cr=ie.getResponseHeader("etag"),cr&&(b.etag[m]=cr)),oe===204||O.type==="HEAD"?It="nocontent":oe===304?It="notmodified":(It=lr.state,ta=lr.data,zr=lr.error,nn=!zr)):(zr=It,(oe||!It)&&(It="error",oe<0&&(oe=0))),ie.status=oe,ie.statusText=(Ce||It)+"",nn?Q.resolveWith(P,[ta,It,ie]):Q.rejectWith(P,[ie,It,zr]),ie.statusCode(ye),ye=void 0,A&&U.trigger(nn?"ajaxSuccess":"ajaxError",[ie,O,nn?ta:zr]),G.fireWith(P,[ie,It]),A&&(U.trigger("ajaxComplete",[ie,O]),--b.active||b.event.trigger("ajaxStop")))}return ie},getJSON:function(l,f,h){return b.get(l,f,h,"json")},getScript:function(l,f){return b.get(l,void 0,f,"script")}}),b.each(["get","post"],function(l,f){b[f]=function(h,m,k,x){return(typeof m=="function"||m===null)&&(x=x||k,k=m,m=void 0),b.ajax(b.extend({url:h,type:f,dataType:x,data:m,success:k},b.isPlainObject(h)&&h))}}),b.ajaxPrefilter(function(l){var f;for(f in l.headers)f.toLowerCase()==="content-type"&&(l.contentType=l.headers[f]||"")}),b._evalUrl=function(l,f,h){return b.ajax({url:l,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,scriptAttrs:f.crossOrigin?{crossOrigin:f.crossOrigin}:void 0,converters:{"text script":function(){}},dataFilter:function(m){b.globalEval(m,f,h)}})},b.fn.extend({wrapAll:function(l){var f;return this[0]&&(typeof l=="function"&&(l=l.call(this[0])),f=b(l,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&f.insertBefore(this[0]),f.map(function(){for(var h=this;h.firstElementChild;)h=h.firstElementChild;return h}).append(this)),this},wrapInner:function(l){return typeof l=="function"?this.each(function(f){b(this).wrapInner(l.call(this,f))}):this.each(function(){var f=b(this),h=f.contents();h.length?h.wrapAll(l):f.append(l)})},wrap:function(l){var f=typeof l=="function";return this.each(function(h){b(this).wrapAll(f?l.call(this,h):l)})},unwrap:function(l){return this.parent(l).not("body").each(function(){b(this).replaceWith(this.childNodes)}),this}}),b.expr.pseudos.hidden=function(l){return!b.expr.pseudos.visible(l)},b.expr.pseudos.visible=function(l){return!!(l.offsetWidth||l.offsetHeight||l.getClientRects().length)},b.ajaxSettings.xhr=function(){return new n.XMLHttpRequest};var xg={0:200};b.ajaxTransport(function(l){var f;return{send:function(h,m){var k,x=l.xhr();if(x.open(l.type,l.url,l.async,l.username,l.password),l.xhrFields)for(k in l.xhrFields)x[k]=l.xhrFields[k];l.mimeType&&x.overrideMimeType&&x.overrideMimeType(l.mimeType),!l.crossDomain&&!h["X-Requested-With"]&&(h["X-Requested-With"]="XMLHttpRequest");for(k in h)x.setRequestHeader(k,h[k]);f=function(v){return function(){f&&(f=x.onload=x.onerror=x.onabort=x.ontimeout=null,v==="abort"?x.abort():v==="error"?m(x.status,x.statusText):m(xg[x.status]||x.status,x.statusText,(x.responseType||"text")==="text"?{text:x.responseText}:{binary:x.response},x.getAllResponseHeaders()))}},x.onload=f(),x.onabort=x.onerror=x.ontimeout=f("error"),f=f("abort");try{x.send(l.hasContent&&l.data||null)}catch(v){if(f)throw v}},abort:function(){f&&f()}}});function ou(l){return l.scriptAttrs||!l.headers&&(l.crossDomain||l.async&&b.inArray("json",l.dataTypes)<0)}b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},converters:{"text script":function(l){return b.globalEval(l),l}}}),b.ajaxPrefilter("script",function(l){l.cache===void 0&&(l.cache=!1),ou(l)&&(l.type="GET")}),b.ajaxTransport("script",function(l){if(ou(l)){var f,h;return{send:function(m,k){f=b("<script>").attr(l.scriptAttrs||{}).prop({charset:l.scriptCharset,src:l.url}).on("load error",h=function(x){f.remove(),h=null,x&&k(x.type==="error"?404:200,x.type)}),C.head.appendChild(f[0])},abort:function(){h&&h()}}}});var au=[],ea=/(=)\?(?=&|$)|\?\?/;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var l=au.pop()||b.expando+"_"+eu.guid++;return this[l]=!0,l}}),b.ajaxPrefilter("jsonp",function(l,f,h){var m,k,x,v=l.jsonp!==!1&&(ea.test(l.url)?"url":typeof l.data=="string"&&(l.contentType||"").indexOf("application/x-www-form-urlencoded")===0&&ea.test(l.data)&&"data");return m=l.jsonpCallback=typeof l.jsonpCallback=="function"?l.jsonpCallback():l.jsonpCallback,v?l[v]=l[v].replace(ea,"$1"+m):l.jsonp!==!1&&(l.url+=(Go.test(l.url)?"&":"?")+l.jsonp+"="+m),l.converters["script json"]=function(){return x||b.error(m+" was not called"),x[0]},l.dataTypes[0]="json",k=n[m],n[m]=function(){x=arguments},h.always(function(){k===void 0?b(n).removeProp(m):n[m]=k,l[m]&&(l.jsonpCallback=f.jsonpCallback,au.push(m)),x&&typeof k=="function"&&k(x[0]),x=k=void 0}),"script"}),b.ajaxPrefilter(function(l,f){typeof l.data!="string"&&!b.isPlainObject(l.data)&&!Array.isArray(l.data)&&!("processData"in f)&&(l.processData=!1),l.data instanceof n.FormData&&(l.contentType=!1)}),b.parseHTML=function(l,f,h){if(typeof l!="string"&&!Ec(l+""))return[];typeof f=="boolean"&&(h=f,f=!1);var m,k;return f||(f=new n.DOMParser().parseFromString("","text/html")),m=Cc.exec(l),k=!h&&[],m?[f.createElement(m[1])]:(m=Lc([l],f,k),k&&k.length&&b(k).remove(),b.merge([],m.childNodes))},b.fn.load=function(l,f,h){var m,k,x,v=this,M=l.indexOf(" ");return M>-1&&(m=vn(l.slice(M)),l=l.slice(0,M)),typeof f=="function"?(h=f,f=void 0):f&&typeof f=="object"&&(k="POST"),v.length>0&&b.ajax({url:l,type:k||"GET",dataType:"html",data:f}).done(function(E){x=arguments,v.html(m?b("<div>").append(b.parseHTML(E)).find(m):E)}).always(h&&function(E,A){v.each(function(){h.apply(this,x||[E.responseText,A,E])})}),this},b.expr.pseudos.animated=function(l){return b.grep(b.timers,function(f){return l===f.elem}).length},b.offset={setOffset:function(l,f,h){var m,k,x,v,M,E,A,N=b.css(l,"position"),L=b(l),O={};N==="static"&&(l.style.position="relative"),M=L.offset(),x=b.css(l,"top"),E=b.css(l,"left"),A=(N==="absolute"||N==="fixed")&&(x+E).indexOf("auto")>-1,A?(m=L.position(),v=m.top,k=m.left):(v=parseFloat(x)||0,k=parseFloat(E)||0),typeof f=="function"&&(f=f.call(l,h,b.extend({},M))),f.top!=null&&(O.top=f.top-M.top+v),f.left!=null&&(O.left=f.left-M.left+k),"using"in f?f.using.call(l,O):L.css(O)}},b.fn.extend({offset:function(l){if(arguments.length)return l===void 0?this:this.each(function(k){b.offset.setOffset(this,l,k)});var f,h,m=this[0];if(m)return m.getClientRects().length?(f=m.getBoundingClientRect(),h=m.ownerDocument.defaultView,{top:f.top+h.pageYOffset,left:f.left+h.pageXOffset}):{top:0,left:0}},position:function(){if(this[0]){var l,f,h,m=this[0],k={top:0,left:0};if(b.css(m,"position")==="fixed")f=m.getBoundingClientRect();else{for(f=this.offset(),h=m.ownerDocument,l=m.offsetParent||h.documentElement;l&&l!==h.documentElement&&b.css(l,"position")==="static";)l=l.offsetParent||h.documentElement;l&&l!==m&&l.nodeType===1&&b.css(l,"position")!=="static"&&(k=b(l).offset(),k.top+=b.css(l,"borderTopWidth",!0),k.left+=b.css(l,"borderLeftWidth",!0))}return{top:f.top-k.top-b.css(m,"marginTop",!0),left:f.left-k.left-b.css(m,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var l=this.offsetParent;l&&b.css(l,"position")==="static";)l=l.offsetParent;return l||Nt})}}),b.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(l,f){var h=f==="pageYOffset";b.fn[l]=function(m){return Xe(this,function(k,x,v){var M;if(T(k)?M=k:k.nodeType===9&&(M=k.defaultView),v===void 0)return M?M[f]:k[x];M?M.scrollTo(h?M.pageXOffset:v,h?v:M.pageYOffset):k[x]=v},l,m,arguments.length)}}),b.each({Height:"height",Width:"width"},function(l,f){b.each({padding:"inner"+l,content:f,"":"outer"+l},function(h,m){b.fn[m]=function(k,x){var v=arguments.length&&(h||typeof k!="boolean"),M=h||(k===!0||x===!0?"margin":"border");return Xe(this,function(E,A,N){var L;return T(E)?m.indexOf("outer")===0?E["inner"+l]:E.document.documentElement["client"+l]:E.nodeType===9?(L=E.documentElement,Math.max(E.body["scroll"+l],L["scroll"+l],E.body["offset"+l],L["offset"+l],L["client"+l])):N===void 0?b.css(E,A,M):b.style(E,A,N,M)},f,v?k:void 0,v)}})}),b.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(l,f){b.fn[f]=function(h){return this.on(f,h)}}),b.fn.extend({bind:function(l,f,h){return this.on(l,null,f,h)},unbind:function(l,f){return this.off(l,null,f)},delegate:function(l,f,h,m){return this.on(f,l,h,m)},undelegate:function(l,f,h){return arguments.length===1?this.off(l,"**"):this.off(f,l||"**",h)},hover:function(l,f){return this.on("mouseenter",l).on("mouseleave",f||l)}}),b.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(l,f){b.fn[f]=function(h,m){return arguments.length>0?this.on(f,null,h,m):this.trigger(f)}}),b.proxy=function(l,f){var h,m,k;if(typeof f=="string"&&(h=l[f],f=l,l=h),typeof l=="function")return m=i.call(arguments,2),k=function(){return l.apply(f||this,m.concat(i.call(arguments)))},k.guid=l.guid=l.guid||b.guid++,k},b.holdReady=function(l){l?b.readyWait++:b.ready(!0)},b.expr[":"]=b.expr.filters=b.expr.pseudos,typeof define=="function"&&define.amd&&define("jquery",[],function(){return b});var wg=n.jQuery,Tg=n.$;return b.noConflict=function(l){return n.$===b&&(n.$=Tg),l&&n.jQuery===b&&(n.jQuery=wg),b},b}var D=b0(window);D(document).on("change","select.js-condition-value",function(){D(".js-custom-condition-filter").trigger("click")});D(document).on("click",".js-custom-condition-del, .js-custom-condition-add",function(){D(this).attr("action","1"),D(".js-custom-condition-filter").trigger("click")});D(document).on("change",".js-custom-condition-select",function(){let n=D(this),e=n.val();n.closest(".js-custom-condition").find(".js-custom-condition-value").attr("js-condition-field",e)});D(document).on("change",".js-condition-operator-select",function(){let n=D(this);n.closest(".js-custom-condition").find(".js-custom-condition-value").attr("js-condition-operator",n.val())});D(document).on("keydown",".js-custom-condition, .js-condition",function(n){(n.key==="Enter"||n.which===13)&&(n.preventDefault(),D(".js-custom-condition-filter").trigger("click"))});D(document).on("click",".js-page-prev",function(){let n=D(".js-page-jump"),t=(parseInt(n.val(),10)||1)-1;n.attr("action","1").val(t),D(".js-custom-condition-filter").trigger("click")});D(document).on("click",".js-page-next",function(){let n=D(".js-page-jump"),t=(parseInt(n.val(),10)||1)+1;n.attr("action","1").val(t),D(".js-custom-condition-filter").trigger("click")});D(document).on("keydown",".js-page-jump-text",function(n){n.which===13&&(n.preventDefault(),D(".js-page-jump").attr("action","1").val(D(this).val()),D(".js-custom-condition-filter").trigger("click"))});D(document).on("keydown",".js-page-limit-text",function(n){n.which===13&&(n.preventDefault(),D(".js-custom-condition-filter").trigger("click"))});D(document).on("click",".js-custom-condition-filter",function(){let n=new URL(window.location.href),e=[];n.searchParams.forEach(function(s,o){(o.startsWith("c__")||o.startsWith("cc__")||o.startsWith("ob__"))&&e.push(o)}),e.forEach(function(s){n.searchParams.delete(s)}),D(".js-condition-value").each(function(){let s=D(this).attr("js-condition-field"),o=D(this).attr("js-condition-operator"),a=D(this).val();n.searchParams.set("c__"+s+"__"+o,a)}),D(".js-custom-condition-value").each(function(){let s=D(this).attr("js-condition-field"),o=D(this).attr("js-condition-operator"),a=D(this).val();n.searchParams.set("cc__"+s+"__"+o,a)}),D(".js-custom-condition-add").attr("action")=="1"&&n.searchParams.set(D(".js-custom-condition-add").attr("cc-next"),""),D('.js-custom-condition-del[action="1"]').each(function(s,o){let u=D(this).closest(".js-custom-condition").find(".js-custom-condition-value"),d=u.attr("js-condition-field"),p=u.attr("js-condition-operator");n.searchParams.delete("cc__"+d+"__"+p)});let t=D(".js-page-limit-text").val();n.searchParams.set("limit",t),D(".js-page-orderby").each(function(){let s=D(this).find(".js-page-orderby-field").val(),o=D(this).find(".js-page-orderby-sort").val();(!(!s||s==="")||!(!o||o===""))&&n.searchParams.set("ob__"+s,o)});let r=D('.js-page-jump[action="1"]').eq(0),i=(r.val()||"").trim();if(i!==""&&!isNaN(i)){let s=parseInt(r.attr("max"))||parseInt(r.attr("data-last-page"))||1;i<1&&(i=1),i>s&&(i=s),n.searchParams.set("page",i)}n.searchParams.has("page")||n.searchParams.set("page",1),window.location.href=n.toString()});const Md={init(){this.oTomAlert=D(".tom-alert"),this.oTomAlert.removeAttr("hidden"),this.registerEvents()},show(n={}){let e=D("<span></span>").attr({"tom-alert-type":n.sType||"info","tom-alert-msg":n.sMsg||"","tom-alert-confirm":n.sConfirm||"false","tom-alert-url":n.sUrl||"false","tom-alert-icon-visible":n.sIconVisible||"true","tom-alert-border-variant":n.sBorderVariant||"true"});typeof n.fConfirmed=="function"&&e.on("tomAlert:confirmed",n.fConfirmed),this.render(e)},render(n){let e=D(n),t=e.attr("tom-alert-type"),r=e.attr("tom-alert-msg"),i={success:"ri-checkbox-circle-line",danger:"ri-close-circle-line",warning:"ri-alert-line",info:"ri-information-2-line"},s={success:"text-success",danger:"text-danger",warning:"text-warning",info:"text-info"},o=i[t]||"",a=s[t]||"",c=D(".tom-alert-icon");c.attr("class","tom-alert-icon "+o+" "+a),e.attr("tom-alert-icon-visible")=="false"?c.hide():c.show(),e.attr("tom-alert-border-variant")=="false"?this.oTomAlert.find(".tom-alert-inner").attr("class","tom-alert-inner"):this.oTomAlert.find(".tom-alert-inner").attr("class","tom-alert-inner border-"+t),this.oTomAlert.find(".mac-btn-primary").attr("class","mac-btn-primary bg-"+t);let p=this.oTomAlert.find(".tom-alert-footer .mac-btn-primary"),y=this.oTomAlert.find(".tom-alert-footer .mac-btn-secondary"),g=e.attr("tom-alert-url"),w=e.attr("tom-alert-confirm");this.oTomAlert.data("oCurrentTrigger",e),this.oTomAlert.attr("data-current-url",g||""),w==="false"?y.hide():y.show(),p.addClass("js-tom-alert-submit"),y.addClass("js-tom-alert-cancel"),D(".tom-alert-msg").html(r),this.oTomAlert.addClass("is-active"),this.oTomAlert.focus()},registerEvents(){const n=this;D(document).on("keydown",".tom-alert",function(e){if(e.which===13)return e.preventDefault(),n.oTomAlert.find(".js-tom-alert-submit").trigger("click"),!1}),D(document).on("keydown",".tom-alert",function(e){if(e.which===27)return e.preventDefault(),n.oTomAlert.find(".js-tom-alert-cancel").trigger("click"),!1}),D(document).on("click",".js-tom-alert-trigger",function(){n.render(this)}),D(document).on("click",".js-tom-alert-cancel",function(){n.oTomAlert.removeClass("is-active");let e=D(".tom-modal.is-active").last();e.length!==0&&e.focus()}),D(document).on("click",".js-tom-alert-submit",function(){let e=n.oTomAlert.data("oCurrentTrigger"),t=n.oTomAlert.attr("data-current-url");n.oTomAlert.removeClass("is-active"),e&&e.trigger("tomAlert:confirmed",[{sUrl:t}]),t&&t!=="false"&&(window.location.href=t);let r=D(".tom-modal.is-active").last();r.length!==0&&r.focus()})}};Md.init();typeof window<"u"&&(window.TomAlert=Md);D(".tom-modal").removeAttr("hidden");D(document).on("keydown",".tom-modal",function(n){if(n.which===27)return n.preventDefault(),D(this).find(".js-tom-modal-close").click(),!1});D(document).on("click",".js-tom-modal-save",function(){let n=D(this).attr("tom-modal-save-id"),e=D(this),t=D(this).attr("tom-modal-save-url"),r=D(this).attr("tom-modal-save-close"),i=t;n&&(i=i+n);let s=D("#api_path").val(),o={};D(this).closest(".tom-modal").find(".js-tom-modal-save-checked:checked").each(function(){let u=D(this).attr("field");if(!u)return!0;let d=D('.js-tom-modal-save-input[field="'+u+'"]').val();typeof d=="string"&&(d=d.trim()),o[u]=d});let a=D(".js-tom-alert-success-simple").first();o.api_path=s,o.site_www=D("#site_www").val(),D.ajax({url:i,type:"PUT",dataType:"json",data:o,success:function(c){c&&c.sMsg&&(c.sMsg=c.sMsg+"",a.attr("tom-alert-msg",c.sMsg),a.trigger("click")),r!="false"&&a.one("tomAlert:confirmed",function(){D(".tom-modal.is-active").find(".js-tom-modal-close").trigger("click"),D(".js-custom-condition-filter").trigger("click")})},error:function(c,u,d){alert(u==="timeout"?"📡 网络极度拥堵,请求超时,请稍后再试!":"炸了,错误代码: "+c.status)},complete:function(){e.prop("disabled",!1).removeClass("is-loading")}})});D(document).on("click",".js-tom-modal-open",function(n){D("body").addClass("overflow-hide");let e=D(this).attr("tom-modal-open");Ad(e,D(this).attr("tom-modal-data-id"))});D(document).on("click",".js-tom-modal-close",function(){D("body").removeClass("overflow-hide"),D(this).closest(".tom-modal").removeClass("is-active")});D(document).on("click",".tom-modal",function(n){let e=D(this);n.target!==n.currentTarget||e.attr("tom-modal-lock")==="true"||(e.removeClass("is-active"),D("body").removeClass("overflow-hide"))});function Ad(n,e=""){let t=D('.tom-modal[tom-modal-name="'+n+'"]');t.addClass("is-active"),t.attr("tom-modal-data-id",e),t.focus()}window.tomModalShow=Ad;function k0(n){D('.tom-modal[tom-modal-name="'+n+'"]').removeClass("is-active")}window.tomModalHide=k0;function x0(){let n=D('.tom-modal[tom-modal-name="article"]'),e=n.find("#div-modal-editor").html();n.find(".js-tom-modal-save-input").val(e)}window.f_list_article=x0;D(document).on("click",".js-tom-modal-open-article",function(n){let e=D('.tom-modal[tom-modal-name="article"]'),t=D(this).attr("tom-modal-save-id"),r=D(this).attr("tom-modal-field");e.attr("tom-modal-data-id",t),e.find(".js-tom-modal-save").attr("tom-modal-save-id",t),e.find("textarea").attr("field",r),e.find("input").attr("field",r);let i=D("#api_path").val(),s="/nasa/list/hit/"+t+"/"+r;D.ajax({url:s,type:"GET",dataType:"json",data:{api_path:i,site_www:D("#site_www").val()},success:function(o){tomModalShow("article"),window.initModalEditor(o.aData.sHit)},error:function(o,a,c){alert(a==="timeout"?"📡 网络极度拥堵,请求超时,请稍后再试!":"💀 系统核心暴裂,错误代码: "+o.status)},complete:function(){}})});D(document).on("click",".js-tom-modal-open-text",function(n){let e=D('.tom-modal[tom-modal-name="text"]'),t=D(this).attr("tom-modal-save-id"),r=D(this).attr("tom-modal-field");e.attr("tom-modal-data-id",t),e.find(".js-tom-modal-save").attr("tom-modal-save-id",t),e.find("textarea").attr("field",r),e.find("input").attr("field",r);let i=D("#api_path").val(),s="/nasa/list/hit/"+t+"/"+r;D.ajax({url:s,type:"GET",dataType:"json",data:{sHitType:"text",api_path:i,site_www:D("#site_www").val()},success:function(o){e.find("textarea").val(o.aData.sHit),tomModalShow("text")},error:function(o,a,c){alert(a==="timeout"?"📡 网络极度拥堵,请求超时,请稍后再试!":"💀 系统核心暴裂,错误代码: "+o.status)},complete:function(){}})});D(document).on("click",".js-tom-modal-open-json",function(n){let e=D('.tom-modal[tom-modal-name="json"]'),t=D(this).attr("tom-modal-save-id"),r=D(this).attr("tom-modal-field");e.attr("tom-modal-data-id",t),e.find(".js-tom-modal-save").attr("tom-modal-save-id",t),e.find("textarea").attr("field",r),e.find("input").attr("field",r);let i=D("#api_path").val(),s="/nasa/list/hit/"+t+"/"+r;D.ajax({url:s,type:"GET",dataType:"json",data:{sHitType:"json",api_path:i,site_www:D("#site_www").val()},success:function(o){e.find("textarea").val(o.aData.sHit),tomModalShow("json")},error:function(o,a,c){alert(a==="timeout"?"📡 网络极度拥堵,请求超时,请稍后再试!":"💀 系统核心暴裂,错误代码: "+o.status)},complete:function(){}})});D(document).on("click",".js-list-tool-clone-trigger",function(n){let e=D(this).closest(".tom-modal"),t=e.attr("tom-modal-data-id"),r=D("#api_path").val(),i="/nasa/list/clone/"+t;D.ajax({url:i,type:"GET",dataType:"html",data:{api_path:r,site_www:D("#site_www").val()},success:function(s){D('.tom-modal[tom-modal-name="clone"]').html(s),tomModalShow("clone"),setTimeout(function(){e.find(".js-tom-modal-close").trigger("click")},50)},error:function(s,o,a){alert(o==="timeout"?"📡 网络极度拥堵,请求超时,请稍后再试!":"💀 系统核心暴裂,错误代码: "+s.status)},complete:function(){}})});D(document).on("click",".js-list-add-trigger",function(n){let e=D("#api_path").val();D.ajax({url:"/nasa/list/add",type:"GET",dataType:"html",data:{api_path:e,site_www:D("#site_www").val()},success:function(r){D('.tom-modal[tom-modal-name="add"]').html(r),tomModalShow("add")},error:function(r,i,s){alert(i==="timeout"?"📡 网络极度拥堵,请求超时,请稍后再试!":"💀 系统核心暴裂,错误代码: "+r.status)},complete:function(){}})});D(document).on("tomAlert:confirmed",".js-list-delete-trigger",function(n,e){let t=D("#api_path").val(),i="/nasa/list/delete/"+D(this).closest(".tom-modal").attr("tom-modal-data-id");D.ajax({url:i,type:"DELETE",dataType:"json",data:{api_path:t,site_www:D("#site_www").val()},success:function(s){TomAlert.show({sMsg:s.sMsg,sType:"success",sIconVisible:"false",sBorderVariant:"false",fConfirmed:function(o,a){D(".tom-modal.is-active").find(".js-tom-modal-close").trigger("click"),D(".js-custom-condition-filter").trigger("click")}})},error:function(s,o,a){alert(o==="timeout"?"📡 网络极度拥堵,请求超时,请稍后再试!":"💀 系统核心暴裂,错误代码: "+s.status)}})});D(document).on("keydown",".tom-modal",function(n){if(n.which===13&&(n.metaKey||n.ctrlKey))return n.preventDefault(),D(this).find(".js-tom-modal-save").trigger("click"),!1});D(document).on("keydown",".js-tom-modal-save-input",function(n){if(n.which===13){if(n.metaKey||n.ctrlKey)return;n.preventDefault();let t=D(this),r=t.attr("field"),i=t.closest(".tom-modal").find('.js-tom-modal-save-checked[field="'+r+'"]');if(i.is("[lock]")||i.length===0)return;let s=i.prop("checked");i.prop("checked",!s),i.val(s?"0":"1")}});D(document).on("click",".js-open-detail",function(n){let e=D("#api_path").val(),t=D("#site_www").val(),r=D(this).attr("open-detail-id"),i=D(this),s="/nasa/list/detail/"+r;D.ajax({url:s,type:"GET",dataType:"html",data:{api_path:e,site_www:t},success:function(o){D('.tom-modal[tom-modal-name="detail"]').html(o),tomModalShow("detail")},error:function(o,a,c){alert(a==="timeout"?"📡 网络极度拥堵,请求超时,请稍后再试!":"💀 系统核心暴裂,错误代码: "+o.status)},complete:function(){i.prop("disabled",!1).removeClass("is-loading")}})});D(document).on("click",".js-login",function(n){let e=D(".js-login-uname").val(),t=D(".js-login-pwd").val();D.ajax({url:"/nasa/auth/in",type:"POST",dataType:"json",data:{sUserName:e,sPwd:t},success:function(i){i.iCode==200?TomAlert.show({sType:"success",sMsg:i.sMessage,fConfirmed:function(){location.href="/nasa"}}):TomAlert.show({sType:"danger",sMsg:i.sMessage})},error:function(i,s,o){alert(s==="timeout"?"📡 网络极度拥堵,请求超时,请稍后再试!":o)}})});D(document).on("keydown","body",function(n){if(n.which===13){if(!(n.metaKey||n.ctrlKey))return;n.preventDefault(),D(".js-login").trigger("click")}});function Pe(n){this.content=n}Pe.prototype={constructor:Pe,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),s=r.content.slice();return i==-1?s.push(t||n,e):(s[i+1]=e,t&&(s[i]=t)),new Pe(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Pe(t)},addToStart:function(n,e){return new Pe([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Pe(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),s=r.find(n);return i.splice(s==-1?i.length:s,0,e,t),new Pe(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=Pe.from(n),n.size?new Pe(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Pe.from(n),n.size?new Pe(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Pe.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}};Pe.from=function(n){if(n instanceof Pe)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Pe(e)};function Od(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),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=Od(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Rd(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),a=e.child(--s),c=o.nodeSize;if(o==a){t-=c,r-=c;continue}if(!o.sameMarkup(a))return{a:t,b:r};if(o.isText&&o.text!=a.text){let u=0,d=Math.min(o.text.length,a.text.length);for(;u<d&&o.text[o.text.length-u-1]==a.text[a.text.length-u-1];)u++,t--,r--;return{a:t,b:r}}if(o.content.size||a.content.size){let u=Rd(o.content,a.content,t-1,r-1);if(u)return u}t-=c,r-=c}}class j{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,s){for(let o=0,a=0;a<t;o++){let c=this.content[o],u=a+c.nodeSize;if(u>e&&r(c,i+a,s||null,o)!==!1&&c.content.size){let d=a+1;c.nodesBetween(Math.max(0,e-d),Math.min(c.content.size,t-d),r,i+d)}a=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(a,c)=>{let u=a.isText?a.text.slice(Math.max(e,c)-c,t-c):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=u},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new j(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 s=0,o=0;o<t;s++){let a=this.content[s],c=o+a.nodeSize;c>e&&((o<e||c>t)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),r.push(a),i+=a.nodeSize),o=c}return new j(r,i)}cutByIndex(e,t){return e==t?j.empty:e==0&&t==this.content.length?this:new j(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new j(i,s)}addToStart(e){return new j([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new j(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 Od(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Rd(this,e,t,r)}findIndex(e){if(e==0)return Ui(0,e);if(e==this.size)return Ui(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let i=this.child(t),s=r+i.nodeSize;if(s>=e)return s==e?Ui(t+1,s):Ui(t,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return j.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return j.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return j.empty;let t,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new j(t||e,r)}static from(e){if(!e)return j.empty;if(e instanceof j)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new j([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}j.empty=new j([],0);const oa={index:0,offset:0};function Ui(n,e){return oa.index=n,oa.offset=e,oa}function gs(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(!gs(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!gs(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let de=class $a{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}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&&gs(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 $a.none;if(e instanceof $a)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};de.none=[];class ys extends Error{}class V{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=Dd(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return r&&new V(r,this.openStart,this.openEnd)}removeBetween(e,t){return new V(Nd(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 V.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 V(j.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new V(e,r,i)}}V.empty=new V(j.empty,0,0);function Nd(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:a}=n.findIndex(t);if(i==e||s.isText){if(a!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(Nd(s.content,e-i-1,t-i-1)))}function Dd(n,e,t,r,i,s){let{index:o,offset:a}=n.findIndex(e),c=n.maybeChild(o);if(a==e||c.isText)return s&&r<=0&&i<=0&&!s.canReplace(o,o,t)?null:n.cut(0,e).append(t).append(n.cut(e));let u=Dd(c.content,e-a-1,t,o==0?r-1:0,o==n.childCount-1?i-1:0,c);return u&&n.replaceChild(o,c.copy(u))}function w0(n,e,t){if(t.openStart>n.depth)throw new ys("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new ys("Inconsistent open depths");return Pd(n,e,t,0)}function Pd(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let o=Pd(n,e,t,r+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,a=o.content;return Bn(o,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=T0(t,n);return Bn(s,Ld(n,o,a,e,r))}else return Bn(s,bs(n,e,r))}function Id(n,e){if(!e.type.compatibleContent(n.type))throw new ys("Cannot join "+e.type.name+" onto "+n.type.name)}function ja(n,e,t){let r=n.node(t);return Id(r,e.node(t)),r}function Ln(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 Yr(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(Ln(n.nodeAfter,r),s++));for(let a=s;a<o;a++)Ln(i.child(a),r);e&&e.depth==t&&e.textOffset&&Ln(e.nodeBefore,r)}function Bn(n,e){return n.type.checkContent(e),n.copy(e)}function Ld(n,e,t,r,i){let s=n.depth>i&&ja(n,e,i+1),o=r.depth>i&&ja(t,r,i+1),a=[];return Yr(null,n,i,a),s&&o&&e.index(i)==t.index(i)?(Id(s,o),Ln(Bn(s,Ld(n,e,t,r,i+1)),a)):(s&&Ln(Bn(s,bs(n,e,i+1)),a),Yr(e,t,i,a),o&&Ln(Bn(o,bs(t,r,i+1)),a)),Yr(r,null,i,a),new j(a)}function bs(n,e,t){let r=[];if(Yr(null,n,t,r),n.depth>t){let i=ja(n,e,t+1);Ln(Bn(i,bs(n,e,t+1)),r)}return Yr(e,null,t,r),new j(r)}function T0(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(j.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class li{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 s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return de.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let a=r;r=i,i=a}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let 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 ks(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,s=t;for(let o=e;;){let{index:a,offset:c}=o.content.findIndex(s),u=s-c;if(r.push(o,a,i+c),!u||(o=o.child(a),o.isText))break;s=u-1,i+=c+1}return new li(t,r,s)}static resolveCached(e,t){let r=vu.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==t)return o}else vu.set(e,r=new S0);let i=r.elts[r.i]=li.resolve(e,t);return r.i=(r.i+1)%v0,i}}class S0{constructor(){this.elts=[],this.i=0}}const v0=12,vu=new WeakMap;class ks{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 C0=Object.create(null);class Ot{constructor(e,t,r,i=de.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||j.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&&gs(this.attrs,t||e.defaultAttrs||C0)&&de.sameSet(this.marks,r||de.none)}copy(e=null){return e==this.content?this:new Ot(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ot(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 V.empty;let i=this.resolve(e),s=this.resolve(t),o=r?0:i.sharedDepth(t),a=i.start(o),u=i.node(o).content.cut(i.pos-a,s.pos-a);return new V(u,i.depth-o,s.depth-o)}replace(e,t,r){return w0(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 li.resolveCached(this,e)}resolveNoCache(e){return li.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Bd(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=j.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let c=i;c<s;c++)if(!this.type.allowsMarks(r.child(c).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=de.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(!de.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=j.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,r);return s.type.checkAttrs(s.attrs),s}}Ot.prototype.text=void 0;class xs extends Ot{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):Bd(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 xs(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new xs(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 Bd(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Hn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new E0(e,t);if(r.next==null)return Hn.empty;let i=_d(r);r.next&&r.err("Unexpected trailing text");let s=P0(D0(i));return I0(s,r),s}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 s=t;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type: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 s(o,a){let c=o.matchFragment(e,r);if(c&&(!t||c.validEnd))return j.from(a.map(u=>u.createAndFill()));for(let u=0;u<o.next.length;u++){let{type:d,next:p}=o.next[u];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(p)==-1){i.push(p);let y=s(p,a.concat(d));if(y)return y}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let 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(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:c}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!i.type||c.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function 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 s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
|
||
`)}}Hn.empty=new Hn(!0);class E0{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 _d(n){let e=[];do e.push(M0(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function M0(n){let e=[];do e.push(A0(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function A0(n){let e=N0(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=O0(n,e);else break;return e}function Cu(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function O0(n,e){let t=Cu(n),r=t;return n.eat(",")&&(n.next!="}"?r=Cu(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function R0(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function N0(n){if(n.eat("(")){let e=_d(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=R0(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 D0(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(o,a,c){let u={term:c,to:a};return e[o].push(u),u}function i(o,a){o.forEach(c=>c.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((c,u)=>c.concat(s(u,a)),[]);if(o.type=="seq")for(let c=0;;c++){let u=s(o.exprs[c],a);if(c==o.exprs.length-1)return u;i(u,a=t())}else if(o.type=="star"){let c=t();return r(a,c),i(s(o.expr,c),c),[r(c)]}else if(o.type=="plus"){let c=t();return i(s(o.expr,a),c),i(s(o.expr,c),c),[r(c)]}else{if(o.type=="opt")return[r(a)].concat(s(o.expr,a));if(o.type=="range"){let c=a;for(let u=0;u<o.min;u++){let d=t();i(s(o.expr,c),d),c=d}if(o.max==-1)i(s(o.expr,c),c);else for(let u=o.min;u<o.max;u++){let d=t();r(c,d),i(s(o.expr,c),d),c=d}return[r(c)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function zd(n,e){return e-n}function Eu(n,e){let t=[];return r(e),t.sort(zd);function r(i){let s=n[i];if(s.length==1&&!s[0].term)return r(s[0].to);t.push(i);for(let o=0;o<s.length;o++){let{term:a,to:c}=s[o];!a&&t.indexOf(c)==-1&&r(c)}}}function P0(n){let e=Object.create(null);return t(Eu(n,0));function t(r){let i=[];r.forEach(o=>{n[o].forEach(({term:a,to:c})=>{if(!a)return;let u;for(let d=0;d<i.length;d++)i[d][0]==a&&(u=i[d][1]);Eu(n,c).forEach(d=>{u||i.push([a,u=[]]),u.indexOf(d)==-1&&u.push(d)})})});let s=e[r.join(",")]=new Hn(r.indexOf(n.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(zd);s.next.push({type:i[o][0],next:e[a.join(",")]||t(a)})}return s}}function I0(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:c,next:u}=i.next[a];o.push(c.name),s&&!(c.isText||c.hasRequiredAttrs())&&(s=!1),r.indexOf(u)==-1&&r.push(u)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function $d(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 jd(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let s=n[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function Fd(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 s=n[i];s.validate&&s.validate(e[i])}}function Hd(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new B0(n,r,e[r]);return t}let Mu=class Vd{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=Hd(e,r.attrs),this.defaultAttrs=$d(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==Hn.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:jd(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ot(this,this.computeAttrs(e),j.from(t),de.setFrom(r))}createChecked(e=null,t,r){return t=j.from(t),this.checkContent(t),new Ot(this,this.computeAttrs(e),t,de.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=j.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(j.empty,!0);return s?new Ot(this,e,t.append(s),de.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){Fd(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:de.none:e}static compile(e,t){let r=Object.create(null);e.forEach((s,o)=>r[s]=new Vd(s,t,o));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 s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function L0(n,e,t){let r=t.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${s}`)}}class B0{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?L0(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class po{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Hd(e,i.attrs),this.excluded=null;let s=$d(this.attrs);this.instance=s?new de(this,s):null}create(e=null){return!e&&this.instance?this.instance:new de(this,jd(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new po(s,i++,t,o)),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){Fd(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class qd{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=Pe.from(e.nodes),t.marks=Pe.from(e.marks||{}),this.nodes=Mu.compile(this.spec.nodes,this),this.marks=po.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=Hn.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?Au(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:Au(this,o.split(" "))}this.nodeFromJSON=i=>Ot.fromJSON(this,i),this.markFromJSON=i=>de.fromJSON(this,i),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 Mu){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 xs(r,r.defaultAttrs,e,de.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Au(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],s=n.marks[i],o=s;if(s)t.push(s);else for(let a in n.marks){let c=n.marks[a];(i=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=c)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function _0(n){return n.tag!=null}function z0(n){return n.style!=null}class Xt{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(_0(i))this.tags.push(i);else if(z0(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let r=new Ru(this,t,!1);return r.addAll(e,de.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Ru(this,t,!0);return r.addAll(e,de.none,t.from,t.to),V.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(F0(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(o.getAttrs){let c=o.getAttrs(t);if(c===!1)continue;o.attrs=c||void 0}return o}}}static schemaRules(e){let t=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let a=t[o];if((a.priority==null?50:a.priority)<s)break}t.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=Nu(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=Nu(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Xt(e,Xt.schemaRules(e)))}}const Ud={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},$0={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Wd={ol:!0,ul:!0},ci=1,Fa=2,Zr=4;function Ou(n,e,t){return e!=null?(e?ci:0)|(e==="full"?Fa:0):n&&n.whitespace=="pre"?ci|Fa:t&~Zr}class Wi{constructor(e,t,r,i,s,o){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=de.none,this.match=s||(o&Zr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(j.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&ci)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=j.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(j.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&&!Ud.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Ru{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,o=Ou(null,t.preserveWhitespace,0)|(r?Zr:0);i?s=new Wi(i.type,i.attrs,de.none,!0,t.topMatch||i.type.contentMatch,o):r?s=new Wi(null,null,de.none,!0,null,o):s=new Wi(e.schema.topNodeType,null,de.none,!0,null,o),this.nodes=[s],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,s=i.options&Fa?"full":this.localPreserveWS||(i.options&ci)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
|
||
`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let c=0;c<a.length;c++)c&&this.insertNode(o.linebreakReplacement.create(),t,!0),a[c]&&this.insertNode(o.text(a[c]),t,!/\S/.test(a[c]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=i.content[i.content.length-1],c=e.previousSibling;(!a||c&&c.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;Wd.hasOwnProperty(o)&&this.parser.normalizeLists&&j0(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(c?c.ignore:$0.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!c||c.skip||c.closeParent){c&&c.closeParent?this.open=Math.max(0,this.open-1):c&&c.skip.nodeType&&(e=c.skip);let u,d=this.needsBlock;if(Ud.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),u=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let p=c&&c.skip?t:this.readStyles(e,t);p&&this.addAll(e,p),u&&this.sync(s),this.needsBlock=d}else{let u=this.readStyles(e,t);u&&this.addElementByRule(e,c,u,c.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
||
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let a=void 0;;){let c=this.parser.matchStyle(s,o,this,a);if(!c)break;if(c.ignore)return null;if(c.clearMark?t=t.filter(u=>!c.clearMark(u)):t=t.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)a=c;else break}}return t}addElementByRule(e,t,r,i){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let c=this.enter(o,t.attrs||null,r,t.preserveWhitespace);c&&(s=!0,r=c)}else{let c=this.parser.schema.marks[t.mark];r=r.concat(c.create(t.attrs))}let a=this.top;if(o&&o.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(c=>this.insertNode(c,r,!1));else{let c=e;typeof t.contentElement=="string"?c=e.querySelector(t.contentElement):typeof t.contentElement=="function"?c=t.contentElement(e):t.contentElement&&(c=t.contentElement),this.findAround(e,c,!0),this.addAll(c,r),this.findAround(e,c,!1)}s&&this.sync(a)&&this.open--}addAll(e,t,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t,r){let i,s;for(let o=this.open,a=0;o>=0;o--){let c=this.nodes[o],u=c.findWrapping(e);if(u&&(!i||i.length>u.length+a)&&(i=u,s=c,!u.length))break;if(c.solid){if(r)break;a+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)t=this.enterInner(i[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let i=this.findPlace(e,t,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=de.none;for(let a of i.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):Du(a.type,e.type))&&(o=a.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,t,r,i){let s=this.findPlace(e.create(t),r,!1);return s&&(s=this.enterInner(e,t,r,!0,i)),s}enterInner(e,t,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=Ou(e,s,o.options);o.options&Zr&&o.content.length==0&&(a|=Zr);let c=de.none;return r=r.filter(u=>(o.type?o.type.allowsMarkType(u.type):Du(u.type,e))?(c=u.addToSet(c),!1):!0),this.nodes.push(new Wi(e,t,c,i,null,a)),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|=ci)}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),s=-(r?r.depth+1:0)+(i?0:1),o=(a,c)=>{for(;a>=0;a--){let u=t[a];if(u==""){if(a==t.length-1||a==0)continue;for(;c>=s;c--)if(o(a-1,c))return!0;return!1}else{let d=c>0||c==0&&i?this.nodes[c].type:r&&c>=s?r.node(c-s).type:null;if(!d||d.name!=u&&!d.isInGroup(u))return!1;c--}}return!0};return o(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 j0(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Wd.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function F0(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Nu(n){let e={};for(let t in n)e[t]=n[t];return e}function Du(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],o=a=>{s.push(a);for(let c=0;c<a.edgeCount;c++){let{type:u,next:d}=a.edge(c);if(u==e||s.indexOf(d)<0&&o(d))return!0}};if(o(i.contentMatch))return!0}}class Jn{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Ki(t).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,c=0;for(;a<s.length&&c<o.marks.length;){let u=o.marks[c];if(!this.marks[u.type.name]){c++;continue}if(!u.eq(s[a][0])||u.type.spec.spanning===!1)break;a++,c++}for(;a<s.length;)i=s.pop()[1];for(;c<o.marks.length;){let u=o.marks[c++],d=this.serializeMark(u,o.isInline,t);d&&(s.push([u,i]),i.appendChild(d.dom),i=d.contentDOM||d.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){if(e.isText)return Ki(t).createTextNode(e.text);let{dom:r,contentDOM:i}=us(Ki(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 s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&us(Ki(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return typeof t=="string"?{dom:e.createTextNode(t)}:us(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Jn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Pu(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Pu(e.marks)}}function Pu(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Ki(n){return n.document||window.document}const Iu=new WeakMap;function H0(n){let e=Iu.get(n);return e===void 0&&Iu.set(n,e=V0(n)),e}function V0(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 us(n,e,t,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=H0(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let a,c=t?n.createElementNS(t,i):n.createElement(i),u=e[1],d=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){d=2;for(let p in u)if(u[p]!=null){let y=p.indexOf(" ");y>0?c.setAttributeNS(p.slice(0,y),p.slice(y+1),u[p]):p=="style"&&c.style?c.style.cssText=u[p]:c.setAttribute(p,u[p])}}for(let p=d;p<e.length;p++){let y=e[p];if(y===0){if(p<e.length-1||p>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else if(typeof y=="string")c.appendChild(n.createTextNode(y));else{let{dom:g,contentDOM:w}=us(n,y,t,r);if(c.appendChild(g),w){if(a)throw new RangeError("Multiple content holes");a=w}}}return{dom:c,contentDOM:a}}const Kd=65535,Jd=Math.pow(2,16);function q0(n,e){return n+e*Jd}function Lu(n){return n&Kd}function U0(n){return(n-(n&Kd))/Jd}const Gd=1,Xd=2,fs=4,Qd=8;class Ha{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Qd)>0}get deletedBefore(){return(this.delInfo&(Gd|fs))>0}get deletedAfter(){return(this.delInfo&(Xd|fs))>0}get deletedAcross(){return(this.delInfo&fs)>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=Lu(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+U0(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,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?i:0);if(c>e)break;let u=this.ranges[a+s],d=this.ranges[a+o],p=c+u;if(e<=p){let y=u?e==c?-1:e==p?1:t:t,g=c+i+(y<0?0:d);if(r)return g;let w=e==(t<0?c:p)?null:q0(a/3,e-c),T=e==c?Xd:e==p?Gd:fs;return(t<0?e!=c:e!=p)&&(T|=Qd),new Ha(g,T,w)}i+=d-u}return r?e+i:new Ha(e+i,0,null)}touches(e,t){let r=0,i=Lu(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?r:0);if(c>e)break;let u=this.ranges[a+s],d=c+u;if(e<=d&&a==i*3)return!0;r+=this.ranges[a+o]-u}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),c=o+(this.inverted?0:s),u=this.ranges[i+t],d=this.ranges[i+r];e(a,a+u,c,c+d),s+=d-u}}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 ui{constructor(e,t,r=0,i=e?e.length:0){this.mirror=t,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new ui(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),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 ui;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 s=this.from;s<this.to;s++){let o=this._maps[s],a=o.mapResult(e,t);if(a.recover!=null){let c=this.getMirror(s);if(c!=null&&c>s&&c<this.to){s=c,e=this._maps[c].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new Ha(e,i,null)}}const aa=Object.create(null);class Ve{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=aa[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 aa)throw new RangeError("Duplicate use of step JSON ID "+e);return aa[e]=t,t.prototype.jsonID=e,t}}class Me{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Me(e,null)}static fail(e){return new Me(null,e)}static fromReplace(e,t,r,i){try{return Me.ok(e.replace(t,r,i))}catch(s){if(s instanceof ys)return Me.fail(s.message);throw s}}}function Sl(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let s=n.child(i);s.content.size&&(s=s.copy(Sl(s.content,e,s))),s.isInline&&(s=e(s,t,i)),r.push(s)}return j.fromArray(r)}class un extends Ve{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)),s=new V(Sl(t.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return Me.fromReplace(e,this.from,this.to,s)}invert(){return new At(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 un(t.pos,r.pos,this.mark)}merge(e){return e instanceof un&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new un(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 un(t.from,t.to,e.markFromJSON(t.mark))}}Ve.jsonID("addMark",un);class At extends Ve{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 V(Sl(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return Me.fromReplace(e,this.from,this.to,r)}invert(){return new un(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 At(t.pos,r.pos,this.mark)}merge(e){return e instanceof At&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new At(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 At(t.from,t.to,e.markFromJSON(t.mark))}}Ve.jsonID("removeMark",At);class fn extends Ve{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Me.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Me.fromReplace(e,this.pos,this.pos+1,new V(j.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 fn(this.pos,t.marks[i]);return new fn(this.pos,this.mark)}}return new Vn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new fn(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 fn(t.pos,e.markFromJSON(t.mark))}}Ve.jsonID("addNodeMark",fn);class Vn extends Ve{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Me.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Me.fromReplace(e,this.pos,this.pos+1,new V(j.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new fn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Vn(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 Vn(t.pos,e.markFromJSON(t.mark))}}Ve.jsonID("removeNodeMark",Vn);class Ee extends Ve{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&Va(e,this.from,this.to)?Me.fail("Structure replace would overwrite content"):Me.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 Ee(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),r=this.from==this.to&&Ee.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new Ee(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ee)||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?V.empty:new V(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ee(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?V.empty:new V(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ee(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 Ee(t.from,t.to,V.fromJSON(e,t.slice),!!t.structure)}}Ee.MAP_BIAS=1;Ve.jsonID("replace",Ee);class Ne extends Ve{constructor(e,t,r,i,s,o,a=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(Va(e,this.from,this.gapFrom)||Va(e,this.gapTo,this.to)))return Me.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Me.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?Me.fromReplace(e,this.from,this.to,r):Me.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 Ne(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),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||s>r.pos?null:new Ne(t.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,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 Ne(t.from,t.to,t.gapFrom,t.gapTo,V.fromJSON(e,t.slice),t.insert,!!t.structure)}}Ve.jsonID("replaceAround",Ne);function Va(n,e,t){let r=n.resolve(e),i=t-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function W0(n,e,t,r){let i=[],s=[],o,a;n.doc.nodesBetween(e,t,(c,u,d)=>{if(!c.isInline)return;let p=c.marks;if(!r.isInSet(p)&&d.type.allowsMarkType(r.type)){let y=Math.max(u,e),g=Math.min(u+c.nodeSize,t),w=r.addToSet(p);for(let T=0;T<p.length;T++)p[T].isInSet(w)||(o&&o.to==y&&o.mark.eq(p[T])?o.to=g:i.push(o=new At(y,g,p[T])));a&&a.to==y?a.to=g:s.push(a=new un(y,g,r))}}),i.forEach(c=>n.step(c)),s.forEach(c=>n.step(c))}function K0(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,a)=>{if(!o.isInline)return;s++;let c=null;if(r instanceof po){let u=o.marks,d;for(;d=r.isInSet(u);)(c||(c=[])).push(d),u=d.removeFromSet(u)}else r?r.isInSet(o.marks)&&(c=[r]):c=o.marks;if(c&&c.length){let u=Math.min(a+o.nodeSize,t);for(let d=0;d<c.length;d++){let p=c[d],y;for(let g=0;g<i.length;g++){let w=i[g];w.step==s-1&&p.eq(i[g].style)&&(y=w)}y?(y.to=u,y.step=s):i.push({style:p,from:Math.max(a,e),to:u,step:s})}}}),i.forEach(o=>n.step(new At(o.from,o.to,o.style)))}function vl(n,e,t,r=t.contentMatch,i=!0){let s=n.doc.nodeAt(e),o=[],a=e+1;for(let c=0;c<s.childCount;c++){let u=s.child(c),d=a+u.nodeSize,p=r.matchType(u.type);if(!p)o.push(new Ee(a,d,V.empty));else{r=p;for(let y=0;y<u.marks.length;y++)t.allowsMarkType(u.marks[y].type)||n.step(new At(a,d,u.marks[y]));if(i&&u.isText&&t.whitespace!="pre"){let y,g=/\r?\n|\r/g,w;for(;y=g.exec(u.text);)w||(w=new V(j.from(t.schema.text(" ",t.allowedMarks(u.marks))),0,0)),o.push(new Ee(a+y.index,a+y.index+y[0].length,w))}}a=d}if(!r.validEnd){let c=r.fillBefore(j.empty,!0);n.replace(a,a,new V(c,0,0))}for(let c=o.length-1;c>=0;c--)n.step(o[c])}function J0(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Rr(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,i=0,s=0;;--r){let o=n.$from.node(r),a=n.$from.index(r)+i,c=n.$to.indexAfter(r)-s;if(r<n.depth&&o.canReplace(a,c,t))return r;if(r==0||o.type.spec.isolating||!J0(o,a,c))break;a&&(i=1),c<o.childCount&&(s=1)}return null}function G0(n,e,t){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),a=i.after(s+1),c=o,u=a,d=j.empty,p=0;for(let w=s,T=!1;w>t;w--)T||r.index(w)>0?(T=!0,d=j.from(r.node(w).copy(d)),p++):c--;let y=j.empty,g=0;for(let w=s,T=!1;w>t;w--)T||i.after(w+1)<i.end(w)?(T=!0,y=j.from(i.node(w).copy(y)),g++):u++;n.step(new Ne(c,u,o,a,new V(d.append(y),p,g),d.size-p,!0))}function Cl(n,e,t=null,r=n){let i=X0(n,e),s=i&&Q0(r,e);return s?i.map(Bu).concat({type:e,attrs:t}).concat(s.map(Bu)):null}function Bu(n){return{type:n,attrs:null}}function X0(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(r,i,o)?s:null}function Q0(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let c=(o.length?o[o.length-1]:e).contentMatch;for(let u=r;c&&u<i;u++)c=c.matchType(t.child(u).type);return!c||!c.validEnd?null:o}function Y0(n,e,t){let r=j.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let a=t[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=j.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new Ne(i,s,i,s,new V(r,0,0),t.length,!0))}function Z0(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,a)=>{let c=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,c)&&eb(n.doc,n.mapping.slice(s).map(a),r)){let u=null;if(r.schema.linebreakReplacement){let g=r.whitespace=="pre",w=!!r.contentMatch.matchType(r.schema.linebreakReplacement);g&&!w?u=!1:!g&&w&&(u=!0)}u===!1&&Zd(n,o,a,s),vl(n,n.mapping.slice(s).map(a,1),r,void 0,u===null);let d=n.mapping.slice(s),p=d.map(a,1),y=d.map(a+o.nodeSize,1);return n.step(new Ne(p,y,p+1,y-1,new V(j.from(r.create(c,null,o.marks)),0,0),1,!0)),u===!0&&Yd(n,o,a,s),!1}})}function Yd(n,e,t,r){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let c=n.mapping.slice(r).map(t+1+s+o.index);n.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function Zd(n,e,t,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+s);n.replaceWith(o,o+1,e.type.schema.text(`
|
||
`))}})}function eb(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function tb(n,e,t,r,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Ne(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new V(j.from(o),0,0),1,!0))}function Qt(n,e,t=1,r){let i=n.resolve(e),s=i.depth-t,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let u=i.depth-1,d=t-2;u>s;u--,d--){let p=i.node(u),y=i.index(u);if(p.type.spec.isolating)return!1;let g=p.content.cutByIndex(y,p.childCount),w=r&&r[d+1];w&&(g=g.replaceChild(0,w.type.create(w.attrs)));let T=r&&r[d]||p;if(!p.canReplace(y+1,p.childCount)||!T.type.validContent(g))return!1}let a=i.indexAfter(s),c=r&&r[0];return i.node(s).canReplaceWith(a,a,c?c.type:i.node(s+1).type)}function nb(n,e,t=1,r){let i=n.doc.resolve(e),s=j.empty,o=j.empty;for(let a=i.depth,c=i.depth-t,u=t-1;a>c;a--,u--){s=j.from(i.node(a).copy(s));let d=r&&r[u];o=j.from(d?d.type.create(d.attrs,o):i.node(a).copy(o))}n.step(new Ee(e,e,new V(s.append(o),t,t),!0))}function bn(n,e){let t=n.resolve(e),r=t.index();return eh(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function rb(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 s=e.child(i),o=s.type==r?n.type.schema.nodes.text:s.type;if(t=t.matchType(o),!t||!n.type.allowsMarks(s.marks))return!1}return t.validEnd}function eh(n,e){return!!(n&&e&&!n.isLeaf&&rb(n,e))}function mo(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let s,o,a=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):t>0?(s=r.node(i+1),a++,o=r.node(i).maybeChild(a)):(s=r.node(i).maybeChild(a-1),o=r.node(i+1)),s&&!s.isTextblock&&eh(s,o)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function ib(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,s=n.doc.resolve(e-t),o=s.node().type;if(i&&o.inlineContent){let d=o.whitespace=="pre",p=!!o.contentMatch.matchType(i);d&&!p?r=!1:!d&&p&&(r=!0)}let a=n.steps.length;if(r===!1){let d=n.doc.resolve(e+t);Zd(n,d.node(),d.before(),a)}o.inlineContent&&vl(n,e+t-1,o,s.node().contentMatchAt(s.index()),r==null);let c=n.mapping.slice(a),u=c.map(e-t);if(n.step(new Ee(u,c.map(e+t,-1),V.empty,!0)),r===!0){let d=n.doc.resolve(u);Yd(n,d.node(),d.before(),n.steps.length)}return n}function sb(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 s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,t))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function th(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let s=0;s<t.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,c=r.index(o)+(a>0?1:0),u=r.node(o),d=!1;if(s==1)d=u.canReplace(c,c,i);else{let p=u.contentMatchAt(c).findWrapping(i.firstChild.type);d=p&&u.canReplaceWith(c,c,p[0])}if(d)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function go(n,e,t=e,r=V.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return nh(i,s,r)?new Ee(e,t,r):new ob(i,s,r).fit()}function nh(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class ob{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=j.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=j.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):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 s=this.placed,o=r.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let c=new V(s,o,a);return e>-1?new Ne(r.pos,e,this.$to.pos,this.$to.end(),c,t):c.size||r.pos!=this.$to.pos?new Ee(r.pos,i.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=la(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:c,match:u}=this.frontier[a],d,p=null;if(t==1&&(o?u.matchType(o.type)||(p=u.fillBefore(j.from(o),!1)):s&&c.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:p};if(t==2&&o&&(d=u.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:d};if(s&&u.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=la(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new V(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=la(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new V(Ur(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new V(Ur(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let T=0;T<s.length;T++)this.openFrontierNode(s[T]);let o=this.unplaced,a=r?r.content:o.content,c=o.openStart-e,u=0,d=[],{match:p,type:y}=this.frontier[t];if(i){for(let T=0;T<i.childCount;T++)d.push(i.child(T));p=p.matchFragment(i)}let g=a.size+e-(o.content.size-o.openEnd);for(;u<a.childCount;){let T=a.child(u),S=p.matchType(T.type);if(!S)break;u++,(u>1||c==0||T.content.size)&&(p=S,d.push(rh(T.mark(y.allowedMarks(T.marks)),u==1?c:0,u==a.childCount?g:-1)))}let w=u==a.childCount;w||(g=-1),this.placed=Wr(this.placed,t,j.from(d)),this.frontier[t].match=p,w&&g<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let T=0,S=a;T<g;T++){let C=S.lastChild;this.frontier.push({type:C.type,match:C.contentMatchAt(C.childCount)}),S=C.content}this.unplaced=w?e==0?V.empty:new V(Ur(o.content,e-1,1),e-1,g<0?o.openEnd:e-1):new V(Ur(o.content,e,u),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!ca(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],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=ca(e,t,i,r,s);if(o){for(let a=t-1;a>=0;a--){let{match:c,type:u}=this.frontier[a],d=ca(e,a,u,c,!0);if(!d||d.childCount)continue e}return{depth:t,fit:o,move:s?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=Wr(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Wr(this.placed,this.depth,j.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(j.empty,!0);t.childCount&&(this.placed=Wr(this.placed,this.frontier.length,t))}}function Ur(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Ur(n.firstChild.content,e-1,t)))}function Wr(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Wr(n.lastChild.content,e-1,t)))}function la(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function rh(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,rh(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(j.empty,!0)))),n.copy(r)}function ca(n,e,t,r,i){let s=n.node(e),o=i?n.indexAfter(e):n.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!ab(t,s.content,o)?a:null}function ab(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function lb(n){return n.spec.defining||n.spec.definingForContent}function cb(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),s=n.doc.resolve(t);if(nh(i,s,r))return n.step(new Ee(e,t,r));let o=sh(i,s);o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let y=i.depth,g=i.pos-1;y>0;y--,g--){let w=i.node(y).type.spec;if(w.defining||w.definingAsContext||w.isolating)break;o.indexOf(y)>-1?a=y:i.before(y)==g&&o.splice(1,0,-y)}let c=o.indexOf(a),u=[],d=r.openStart;for(let y=r.content,g=0;;g++){let w=y.firstChild;if(u.push(w),g==r.openStart)break;y=w.content}for(let y=d-1;y>=0;y--){let g=u[y],w=lb(g.type);if(w&&!g.sameMarkup(i.node(Math.abs(a)-1)))d=y;else if(w||!g.type.isTextblock)break}for(let y=r.openStart;y>=0;y--){let g=(y+d+1)%(r.openStart+1),w=u[g];if(w)for(let T=0;T<o.length;T++){let S=o[(T+c)%o.length],C=!0;S<0&&(C=!1,S=-S);let I=i.node(S-1),_=i.index(S-1);if(I.canReplaceWith(_,_,w.type,w.marks))return n.replace(i.before(S),C?s.after(S):t,new V(ih(r.content,0,r.openStart,g),g,r.openEnd))}}let p=n.steps.length;for(let y=o.length-1;y>=0&&(n.replace(e,t,r),!(n.steps.length>p));y--){let g=o[y];g<0||(e=i.before(g),t=s.after(g))}}function ih(n,e,t,r,i){if(e<t){let s=n.firstChild;n=n.replaceChild(0,s.copy(ih(s.content,e+1,t,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(n).append(n);n=o.append(s.matchFragment(o).fillBefore(j.empty,!0))}return n}function ub(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=sb(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new V(j.from(r),0,0))}function fb(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let o=r.sharedDepth(t),a=!1;for(let c=r.depth;c>o;c--)r.node(c).type.spec.isolating&&(a=!0);for(let c=i.depth;c>o;c--)i.node(c).type.spec.isolating&&(a=!0);if(!a){for(let c=r.depth;c>0&&e==r.start(c);c--)e=r.before(c);for(let c=i.depth;c>0&&t==i.start(c);c--)t=i.before(c);r=n.doc.resolve(e),i=n.doc.resolve(t)}}let s=sh(r,i);for(let o=0;o<s.length;o++){let a=s[o],c=o==s.length-1;if(c&&a==0||r.node(a).type.contentMatch.validEnd)return n.delete(r.start(a),i.end(a));if(a>0&&(c||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return n.delete(r.before(a),i.after(a))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&t>r.end(o)&&i.end(o)-t!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return n.delete(r.before(o),t);n.delete(e,t)}function sh(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(s<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;(s==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class yr extends Ve{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 Me.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return Me.fromReplace(e,this.pos,this.pos+1,new V(j.from(i),0,t.isLeaf?0:1))}getMap(){return ot.empty}invert(e){return new yr(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 yr(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 yr(t.pos,t.attr,t.value)}}Ve.jsonID("attr",yr);class fi extends Ve{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 Me.ok(r)}getMap(){return ot.empty}invert(e){return new fi(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 fi(t.attr,t.value)}}Ve.jsonID("docAttr",fi);let wr=class extends Error{};wr=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};wr.prototype=Object.create(Error.prototype);wr.prototype.constructor=wr;wr.prototype.name="TransformError";class oh{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ui}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new wr(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}changedRange(){let e=1e9,t=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),t=i.map(t,-1)),i.forEach((s,o,a,c)=>{e=Math.min(e,a),t=Math.max(t,c)})}return e==1e9?null:{from:e,to:t}}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=V.empty){let i=go(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new V(j.from(r),0,0))}delete(e,t){return this.replace(e,t,V.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return cb(this,e,t,r),this}replaceRangeWith(e,t,r){return ub(this,e,t,r),this}deleteRange(e,t){return fb(this,e,t),this}lift(e,t){return G0(this,e,t),this}join(e,t=1){return ib(this,e,t),this}wrap(e,t){return Y0(this,e,t),this}setBlockType(e,t=e,r,i=null){return Z0(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return tb(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new yr(e,t,r)),this}setDocAttribute(e,t){return this.step(new fi(e,t)),this}addNodeMark(e,t){return this.step(new fn(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof de)t.isInSet(r.marks)&&this.step(new Vn(e,t));else{let i=r.marks,s,o=[];for(;s=t.isInSet(i);)o.push(new Vn(e,s)),i=s.removeFromSet(i);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,t=1,r){return nb(this,e,t,r),this}addMark(e,t,r){return W0(this,e,t,r),this}removeMark(e,t,r){return K0(this,e,t,r),this}clearIncompatible(e,t,r){return vl(this,e,t,r),this}}const ua=Object.create(null);class te{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new db(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=V.empty){let r=t.content.lastChild,i=null;for(let a=0;a<t.openEnd;a++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:c,$to:u}=o[a],d=e.mapping.slice(s);e.replaceRange(d.map(c.pos),d.map(u.pos),a?V.empty:t),a==0&&$u(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:a}=i[s],c=e.mapping.slice(r),u=c.map(o.pos),d=c.map(a.pos);s?e.deleteRange(u,d):(e.replaceRangeWith(u,d,t),$u(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new X(e):hr(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=t<0?hr(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):hr(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(o)return o}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 hr(e,e,0,0,1)||new at(e)}static atEnd(e){return hr(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=ua[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 ua)throw new RangeError("Duplicate use of selection JSON ID "+e);return ua[e]=t,t.prototype.jsonID=e,t}getBookmark(){return X.between(this.$anchor,this.$head).getBookmark()}}te.prototype.visible=!0;class db{constructor(e,t){this.$from=e,this.$to=t}}let _u=!1;function zu(n){!_u&&!n.parent.inlineContent&&(_u=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class X extends te{constructor(e,t=e){zu(e),zu(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 te.near(r);let i=e.resolve(t.map(this.anchor));return new X(i.parent.inlineContent?i:r,r)}replace(e,t=V.empty){if(super.replace(e,t),t==V.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof X&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new yo(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 X(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 s=te.findFrom(t,r,!0)||te.findFrom(t,-r,!0);if(s)t=s.$head;else return te.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(te.findFrom(e,-r,!0)||te.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new X(e,t)}}te.jsonID("text",X);class yo{constructor(e,t){this.anchor=e,this.head=t}map(e){return new yo(e.map(this.anchor),e.map(this.head))}resolve(e){return X.between(e.resolve(this.anchor),e.resolve(this.head))}}class J extends te{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),s=e.resolve(i);return r?te.near(s):new J(s)}content(){return new V(j.from(this.node),0,0)}eq(e){return e instanceof J&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new El(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new J(e.resolve(t.anchor))}static create(e,t){return new J(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}J.prototype.visible=!1;te.jsonID("node",J);class El{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new yo(r,r):new El(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&J.isSelectable(r)?new J(t):te.near(t)}}class at extends te{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=V.empty){if(t==V.empty){e.delete(0,e.doc.content.size);let r=te.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 hb}}te.jsonID("all",at);const hb={map(){return this},resolve(n){return new at(n)}};function hr(n,e,t,r,i,s=!1){if(e.inlineContent)return X.create(n,t);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&J.isSelectable(a))return J.create(n,t-(i<0?a.nodeSize:0))}else{let c=hr(n,a,t+i,i<0?a.childCount:0,i,s);if(c)return c}t+=a.nodeSize*i}return null}function $u(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof Ee||i instanceof Ne))return;let s=n.mapping.maps[r],o;s.forEach((a,c,u,d)=>{o==null&&(o=d)}),n.setSelection(te.near(n.doc.resolve(o),t))}const ju=1,Ji=2,Fu=4;class pb extends oh{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|ju)&~Ji,this.storedMarks=null,this}get selectionSet(){return(this.updated&ju)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Ji,this}ensureMarks(e){return de.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Ji)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Ji,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||de.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),!e)return this.deleteRange(t,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,s)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(te.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Fu,this}get scrolledIntoView(){return(this.updated&Fu)>0}}function Hu(n,e){return!e||!n?n:n.bind(e)}class Kr{constructor(e,t,r){this.name=e,this.init=Hu(t.init,r),this.apply=Hu(t.apply,r)}}const mb=[new Kr("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Kr("selection",{init(n,e){return n.selection||te.atStart(e.doc)},apply(n){return n.selection}}),new Kr("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Kr("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class fa{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=mb.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Kr(r.key,r.spec.state,r))})}}class gr{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let c=i?i[o].n:0,u=i?i[o].state:this,d=c<t.length&&a.spec.appendTransaction.call(a,c?t.slice(c):t,u,r);if(d&&r.filterTransaction(d,o)){if(d.setMeta("appendedTransaction",e),!i){i=[];for(let p=0;p<this.config.plugins.length;p++)i.push(p<o?{state:r,n:t.length}:{state:this,n:0})}t.push(d),r=r.applyInner(d),s=!0}i&&(i[o]={state:r,n:t.length})}}if(!s)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new gr(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new pb(this)}static create(e){let t=new fa(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new gr(t);for(let i=0;i<t.fields.length;i++)r[t.fields[i].name]=t.fields[i].init(e,r);return r}reconfigure(e){let t=new fa(this.schema,e.plugins),r=t.fields,i=new gr(t);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(t[r]=s.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new fa(e.schema,e.plugins),s=new gr(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=Ot.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=te.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let c=r[a],u=c.spec.state;if(c.key==o.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){s[o.name]=u.fromJSON.call(c,e,t[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function ah(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=ah(i,e,{})),t[r]=i}return t}class ke{constructor(e){this.spec=e,this.props={},e.props&&ah(e.props,this,this.props),this.key=e.key?e.key.key:lh("plugin")}getState(e){return e[this.key]}}const da=Object.create(null);function lh(n){return n in da?n+"$"+ ++da[n]:(da[n]=0,n+"$")}class Re{constructor(e="key"){this.key=lh(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const ch=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function uh(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const fh=(n,e,t)=>{let r=uh(n,t);if(!r)return!1;let i=Ml(r);if(!i){let o=r.blockRange(),a=o&&Rr(o);return a==null?!1:(e&&e(n.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(xh(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Tr(s,"end")||J.isSelectable(s)))for(let o=r.depth;;o--){let a=go(n.doc,r.before(o),r.after(o),V.empty);if(a&&a.slice.size<a.to-a.from){if(e){let c=n.tr.step(a);c.setSelection(Tr(s,"end")?te.findFrom(c.doc.resolve(c.mapping.map(i.pos,-1)),-1):J.create(c.doc,i.pos-s.nodeSize)),e(c.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},gb=(n,e,t)=>{let r=uh(n,t);if(!r)return!1;let i=Ml(r);return i?dh(n,i,e):!1},yb=(n,e,t)=>{let r=ph(n,t);if(!r)return!1;let i=Al(r);return i?dh(n,i,e):!1};function dh(n,e,t){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let d=i.lastChild;if(!d)return!1;i=d}let o=e.nodeAfter,a=o,c=e.pos+1;for(;!a.isTextblock;c++){if(a.type.spec.isolating)return!1;let d=a.firstChild;if(!d)return!1;a=d}let u=go(n.doc,s,c,V.empty);if(!u||u.from!=s||u instanceof Ee&&u.slice.size>=c-s)return!1;if(t){let d=n.tr.step(u);d.setSelection(X.create(d.doc,s)),t(d.scrollIntoView())}return!0}function Tr(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 hh=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;s=Ml(r)}let o=s&&s.nodeBefore;return!o||!J.isSelectable(o)?!1:(e&&e(n.tr.setSelection(J.create(n.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function Ml(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 ph(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const mh=(n,e,t)=>{let r=ph(n,t);if(!r)return!1;let i=Al(r);if(!i)return!1;let s=i.nodeAfter;if(xh(n,i,e,1))return!0;if(r.parent.content.size==0&&(Tr(s,"start")||J.isSelectable(s))){let o=go(n.doc,r.before(),r.after(),V.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=n.tr.step(o);a.setSelection(Tr(s,"start")?te.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):J.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},gh=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;s=Al(r)}let o=s&&s.nodeAfter;return!o||!J.isSelectable(o)?!1:(e&&e(n.tr.setSelection(J.create(n.doc,s.pos)).scrollIntoView()),!0)};function Al(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 bb=(n,e)=>{let t=n.selection,r=t instanceof J,i;if(r){if(t.node.isTextblock||!bn(n.doc,t.from))return!1;i=t.from}else if(i=mo(n.doc,t.from,-1),i==null)return!1;if(e){let s=n.tr.join(i);r&&s.setSelection(J.create(s.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},kb=(n,e)=>{let t=n.selection,r;if(t instanceof J){if(t.node.isTextblock||!bn(n.doc,t.to))return!1;r=t.to}else if(r=mo(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},xb=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),s=i&&Rr(i);return s==null?!1:(e&&e(n.tr.lift(i,s).scrollIntoView()),!0)},yh=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
|
||
`).scrollIntoView()),!0)};function Ol(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 wb=(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),s=t.indexAfter(-1),o=Ol(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=t.after(),c=n.tr.replaceWith(a,a,o.createAndFill());c.setSelection(te.near(c.doc.resolve(a),1)),e(c.scrollIntoView())}return!0},bh=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof at||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=Ol(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=n.tr.insert(o,s.createAndFill());a.setSelection(X.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},kh=(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 s=t.before();if(Qt(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let r=t.blockRange(),i=r&&Rr(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};function Tb(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof J&&e.selection.node.isBlock)return!r.parentOffset||!Qt(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,a,c=!1,u=!1;for(let g=r.depth;;g--)if(r.node(g).isBlock){c=r.end(g)==r.pos+(r.depth-g),u=r.start(g)==r.pos-(r.depth-g),a=Ol(r.node(g-1).contentMatchAt(r.indexAfter(g-1))),s.unshift(c&&a?{type:a}:null),o=g;break}else{if(g==1)return!1;s.unshift(null)}let d=e.tr;(e.selection instanceof X||e.selection instanceof at)&&d.deleteSelection();let p=d.mapping.map(r.pos),y=Qt(d.doc,p,s.length,s);if(y||(s[0]=a?{type:a}:null,y=Qt(d.doc,p,s.length,s)),!y)return!1;if(d.split(p,s.length,s),!c&&u&&r.node(o).type!=a){let g=d.mapping.map(r.before(o)),w=d.doc.resolve(g);a&&r.node(o-1).canReplaceWith(w.index(),w.index()+1,a)&&d.setNodeMarkup(d.mapping.map(r.before(o)),a)}return t&&t(d.scrollIntoView()),!0}}const Sb=Tb(),vb=(n,e)=>{let{$from:t,to:r}=n.selection,i,s=t.sharedDepth(r);return s==0?!1:(i=t.before(s),e&&e(n.tr.setSelection(J.create(n.doc,i))),!0)};function Cb(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||bn(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function xh(n,e,t,r){let i=e.nodeBefore,s=e.nodeAfter,o,a,c=i.type.spec.isolating||s.type.spec.isolating;if(!c&&Cb(n,e,t))return!0;let u=!c&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&a.matchType(o[0]||s.type).validEnd){if(t){let g=e.pos+s.nodeSize,w=j.empty;for(let C=o.length-1;C>=0;C--)w=j.from(o[C].create(null,w));w=j.from(i.copy(w));let T=n.tr.step(new Ne(e.pos-1,g,e.pos,g,new V(w,1,0),o.length,!0)),S=T.doc.resolve(g+2*o.length);S.nodeAfter&&S.nodeAfter.type==i.type&&bn(T.doc,S.pos)&&T.join(S.pos),t(T.scrollIntoView())}return!0}let d=s.type.spec.isolating||r>0&&c?null:te.findFrom(e,1),p=d&&d.$from.blockRange(d.$to),y=p&&Rr(p);if(y!=null&&y>=e.depth)return t&&t(n.tr.lift(p,y).scrollIntoView()),!0;if(u&&Tr(s,"start",!0)&&Tr(i,"end")){let g=i,w=[];for(;w.push(g),!g.isTextblock;)g=g.lastChild;let T=s,S=1;for(;!T.isTextblock;T=T.firstChild)S++;if(g.canReplace(g.childCount,g.childCount,T.content)){if(t){let C=j.empty;for(let _=w.length-1;_>=0;_--)C=j.from(w[_].copy(C));let I=n.tr.step(new Ne(e.pos-w.length,e.pos+s.nodeSize,e.pos+S,e.pos+s.nodeSize-S,new V(C,w.length,0),0,!0));t(I.scrollIntoView())}return!0}}return!1}function wh(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(X.create(e.doc,n<0?i.start(s):i.end(s)))),!0):!1}}const Eb=wh(-1),Mb=wh(1);function Ab(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),a=o&&Cl(o,n,e);return a?(r&&r(t.tr.wrap(o,a).scrollIntoView()),!0):!1}}function Vu(n,e=null){return function(t,r){let i=!1;for(let s=0;s<t.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=t.selection.ranges[s];t.doc.nodesBetween(o,a,(c,u)=>{if(i)return!1;if(!(!c.isTextblock||c.hasMarkup(n,e)))if(c.type==n)i=!0;else{let d=t.doc.resolve(u),p=d.index();i=d.parent.canReplaceWith(p,p+1,n)}})}if(!i)return!1;if(r){let s=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:c}}=t.selection.ranges[o];s.setBlockType(a,c,n,e)}r(s.scrollIntoView())}return!0}}function Rl(...n){return function(e,t,r){for(let i=0;i<n.length;i++)if(n[i](e,t,r))return!0;return!1}}Rl(ch,fh,hh);Rl(ch,mh,gh);Rl(yh,bh,kh,Sb);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Ob(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s);if(!o)return!1;let a=r?t.tr:null;return Rb(a,o,n,e)?(r&&r(a.scrollIntoView()),!0):!1}}function Rb(n,e,t,r=null){let i=!1,s=e,o=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 c=o.resolve(e.start-2);s=new ks(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new ks(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=Cl(s,t,r,e);return a?(n&&Nb(n,e,a,i,t),!0):!1}function Nb(n,e,t,r,i){let s=j.empty;for(let d=t.length-1;d>=0;d--)s=j.from(t[d].type.create(t[d].attrs,s));n.step(new Ne(e.start-(r?2:0),e.end,e.start,e.end,new V(s,0,0),t.length,!0));let o=0;for(let d=0;d<t.length;d++)t[d].type==i&&(o=d+1);let a=t.length-o,c=e.start+t.length-(r?2:0),u=e.parent;for(let d=e.startIndex,p=e.endIndex,y=!0;d<p;d++,y=!1)!y&&Qt(n.doc,c,a)&&(n.split(c,a),c+=2*a),c+=u.child(d).nodeSize;return n}function Db(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==n);return s?t?r.node(s.depth-1).type==n?Pb(e,t,n,s):Ib(e,t,s):!0:!1}}function Pb(n,e,t,r){let i=n.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new Ne(s-1,o,s,o,new V(j.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new ks(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const a=Rr(r);if(a==null)return!1;i.lift(r,a);let c=i.doc.resolve(i.mapping.map(s,-1)-1);return bn(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),e(i.scrollIntoView()),!0}function Ib(n,e,t){let r=n.tr,i=t.parent;for(let g=t.end,w=t.endIndex-1,T=t.startIndex;w>T;w--)g-=i.child(w).nodeSize,r.delete(g-1,g+1);let s=r.doc.resolve(t.start),o=s.nodeAfter;if(r.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,c=t.endIndex==i.childCount,u=s.node(-1),d=s.index(-1);if(!u.canReplace(d+(a?0:1),d+1,o.content.append(c?j.empty:j.from(i))))return!1;let p=s.pos,y=p+o.nodeSize;return r.step(new Ne(p-(a?1:0),y+(c?1:0),p+1,y-1,new V((a?j.empty:j.from(i.copy(j.empty))).append(c?j.empty:j.from(i.copy(j.empty))),a?0:1,c?0:1),a?0:1)),e(r.scrollIntoView()),!0}function Lb(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,u=>u.childCount>0&&u.firstChild.type==n);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,c=a.child(o-1);if(c.type!=n)return!1;if(t){let u=c.lastChild&&c.lastChild.type==a.type,d=j.from(u?n.create():null),p=new V(j.from(n.create(null,j.from(a.type.create(null,d)))),u?3:1,0),y=s.start,g=s.end;t(e.tr.step(new Ne(y-(u?3:1),g,y,g,p,1,!0)).scrollIntoView())}return!0}}const Ie=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Sr=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let qa=null;const Jt=function(n,e,t){let r=qa||(qa=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},Bb=function(){qa=null},qn=function(n,e,t,r){return t&&(qu(n,e,t,r,-1)||qu(n,e,t,r,1))},_b=/^(img|br|input|textarea|hr)$/i;function qu(n,e,t,r,i){for(var s;;){if(n==t&&e==r)return!0;if(e==(i<0?0:gt(n))){let o=n.parentNode;if(!o||o.nodeType!=1||Ci(n)||_b.test(n.nodeName)||n.contentEditable=="false")return!1;e=Ie(n)+(i<0?0:1),n=o}else if(n.nodeType==1){let o=n.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else n=o,e=i<0?gt(n):0}else return!1}}function gt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function zb(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=gt(n)}else if(n.parentNode&&!Ci(n))e=Ie(n),n=n.parentNode;else return null}}function $b(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!Ci(n))e=Ie(n)+1,n=n.parentNode;else return null}}function jb(n,e,t){for(let r=e==0,i=e==gt(n);r||i;){if(n==t)return!0;let s=Ie(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,i=i&&s==gt(n)}}function Ci(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 bo=function(n){return n.focusNode&&qn(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function En(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Fb(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Hb(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(gt(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(gt(r.startContainer),r.startOffset)}}}const $t=typeof navigator<"u"?navigator:null,Uu=typeof document<"u"?document:null,kn=$t&&$t.userAgent||"",Ua=/Edge\/(\d+)/.exec(kn),Th=/MSIE \d/.exec(kn),Wa=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(kn),rt=!!(Th||Wa||Ua),hn=Th?document.documentMode:Wa?+Wa[1]:Ua?+Ua[1]:0,yt=!rt&&/gecko\/(\d+)/i.test(kn);yt&&+(/Firefox\/(\d+)/.exec(kn)||[0,0])[1];const Ka=!rt&&/Chrome\/(\d+)/.exec(kn),_e=!!Ka,Sh=Ka?+Ka[1]:0,He=!rt&&!!$t&&/Apple Computer/.test($t.vendor),vr=He&&(/Mobile\/\w+/.test(kn)||!!$t&&$t.maxTouchPoints>2),mt=vr||($t?/Mac/.test($t.platform):!1),vh=$t?/Win/.test($t.platform):!1,Gt=/Android \d/.test(kn),Ei=!!Uu&&"webkitFontSmoothing"in Uu.documentElement.style,Vb=Ei?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function qb(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function qt(n,e){return typeof n=="number"?n:n[e]}function Ub(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function Wu(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let o=t||n.dom;o;){if(o.nodeType!=1){o=Sr(o);continue}let a=o,c=a==s.body,u=c?qb(s):Ub(a),d=0,p=0;if(e.top<u.top+qt(r,"top")?p=-(u.top-e.top+qt(i,"top")):e.bottom>u.bottom-qt(r,"bottom")&&(p=e.bottom-e.top>u.bottom-u.top?e.top+qt(i,"top")-u.top:e.bottom-u.bottom+qt(i,"bottom")),e.left<u.left+qt(r,"left")?d=-(u.left-e.left+qt(i,"left")):e.right>u.right-qt(r,"right")&&(d=e.right-u.right+qt(i,"right")),d||p)if(c)s.defaultView.scrollBy(d,p);else{let g=a.scrollLeft,w=a.scrollTop;p&&(a.scrollTop+=p),d&&(a.scrollLeft+=d);let T=a.scrollLeft-g,S=a.scrollTop-w;e={left:e.left-T,top:e.top-S,right:e.right-T,bottom:e.bottom-S}}let y=c?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(y))break;o=y=="absolute"?o.offsetParent:Sr(o)}}function Wb(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=t+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=n.root.elementFromPoint(s,o);if(!a||a==n.dom||!n.dom.contains(a))continue;let c=a.getBoundingClientRect();if(c.top>=t-20){r=a,i=c.top;break}}return{refDOM:r,refTop:i,stack:Ch(n.dom)}}function Ch(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Sr(r));return e}function Kb({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;Eh(t,r==0?0:r-e)}function Eh(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:i,left:s}=n[t];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let fr=null;function Jb(n){if(n.setActive)return n.setActive();if(fr)return n.focus(fr);let e=Ch(n);n.focus(fr==null?{get preventScroll(){return fr={preventScroll:!0},!0}}:void 0),fr||(fr=!1,Eh(e,0))}function Mh(n,e){let t,r=2e8,i,s=0,o=e.top,a=e.top,c,u;for(let d=n.firstChild,p=0;d;d=d.nextSibling,p++){let y;if(d.nodeType==1)y=d.getClientRects();else if(d.nodeType==3)y=Jt(d).getClientRects();else continue;for(let g=0;g<y.length;g++){let w=y[g];if(w.top<=o&&w.bottom>=a){o=Math.max(w.bottom,o),a=Math.min(w.top,a);let T=w.left>e.left?w.left-e.left:w.right<e.left?e.left-w.right:0;if(T<r){t=d,r=T,i=T&&t.nodeType==3?{left:w.right<e.left?w.right:w.left,top:e.top}:e,d.nodeType==1&&T&&(s=p+(e.left>=(w.left+w.right)/2?1:0));continue}}else w.top>e.top&&!c&&w.left<=e.left&&w.right>=e.left&&(c=d,u={left:Math.max(w.left,Math.min(w.right,e.left)),top:w.top});!t&&(e.left>=w.right&&e.top>=w.top||e.left>=w.left&&e.top>=w.bottom)&&(s=p+1)}}return!t&&c&&(t=c,i=u,r=0),t&&t.nodeType==3?Gb(t,i):!t||r&&t.nodeType==1?{node:n,offset:s}:Mh(t,i)}function Gb(n,e){let t=n.nodeValue.length,r=document.createRange(),i;for(let s=0;s<t;s++){r.setEnd(n,s+1),r.setStart(n,s);let o=sn(r,1);if(o.top!=o.bottom&&Nl(e,o)){i={node:n,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:n,offset:0}}function Nl(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function Xb(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function Qb(n,e,t){let{node:r,offset:i}=Mh(e,t),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(r,i,s)}function Yb(n,e,t,r){let i=-1;for(let s=e,o=!1;s!=n.dom;){let a=n.docView.nearestDesc(s,!0),c;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((c=a.dom.getBoundingClientRect()).width||c.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&c.left>r.left||c.top>r.top?i=a.posBefore:(!o&&c.right<r.left||c.bottom<r.top)&&(i=a.posAfter),o=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?r.top<(c.top+c.bottom)/2:r.left<(c.left+c.right)/2)?a.posBefore:a.posAfter;s=a.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function Ah(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),s=i;;){let o=n.childNodes[s];if(o.nodeType==1){let a=o.getClientRects();for(let c=0;c<a.length;c++){let u=a[c];if(Nl(e,u))return Ah(o,e,u)}}if((s=(s+1)%r)==i)break}return n}function Zb(n,e){let t=n.dom.ownerDocument,r,i=0,s=Hb(t,e.left,e.top);s&&({node:r,offset:i}=s);let o=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),a;if(!o||!n.dom.contains(o.nodeType!=1?o.parentNode:o)){let u=n.dom.getBoundingClientRect();if(!Nl(e,u)||(o=Ah(n.dom,e,u),!o))return null}if(He)for(let u=o;r&&u;u=Sr(u))u.draggable&&(r=void 0);if(o=Xb(o,e),r){if(yt&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let d=r.childNodes[i],p;d.nodeName=="IMG"&&(p=d.getBoundingClientRect()).right<=e.left&&p.bottom>e.top&&i++}let u;Ei&&i&&r.nodeType==1&&(u=r.childNodes[i-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=Yb(n,r,i,e))}a==null&&(a=Qb(n,o,e));let c=n.docView.nearestDesc(o,!0);return{pos:a,inside:c?c.posAtStart-c.border:-1}}function Ku(n){return n.top<n.bottom||n.left<n.right}function sn(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(Ku(r))return r}return Array.prototype.find.call(t,Ku)||n.getBoundingClientRect()}const ek=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Oh(n,e,t){let{node:r,offset:i,atom:s}=n.docView.domFromPos(e,t<0?-1:1),o=Ei||yt;if(r.nodeType==3)if(o&&(ek.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let c=sn(Jt(r,i,i),t);if(yt&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let u=sn(Jt(r,i-1,i-1),-1);if(u.top==c.top){let d=sn(Jt(r,i,i+1),-1);if(d.top!=c.top)return jr(d,d.left<u.left)}}return c}else{let c=i,u=i,d=t<0?1:-1;return t<0&&!i?(u++,d=-1):t>=0&&i==r.nodeValue.length?(c--,d=1):t<0?c--:u++,jr(sn(Jt(r,c,u),d),d<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==gt(r))){let c=r.childNodes[i-1];if(c.nodeType==1)return ha(c.getBoundingClientRect(),!1)}if(s==null&&i<gt(r)){let c=r.childNodes[i];if(c.nodeType==1)return ha(c.getBoundingClientRect(),!0)}return ha(r.getBoundingClientRect(),t>=0)}if(s==null&&i&&(t<0||i==gt(r))){let c=r.childNodes[i-1],u=c.nodeType==3?Jt(c,gt(c)-(o?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(u)return jr(sn(u,1),!1)}if(s==null&&i<gt(r)){let c=r.childNodes[i];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let u=c?c.nodeType==3?Jt(c,0,o?0:1):c.nodeType==1?c:null:null;if(u)return jr(sn(u,-1),!0)}return jr(sn(r.nodeType==3?Jt(r):r,-t),t>=0)}function jr(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function ha(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function Rh(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function tk(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return Rh(n,e,()=>{let{node:s}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let a=n.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=Oh(n,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let c;if(a.nodeType==1)c=a.getClientRects();else if(a.nodeType==3)c=Jt(a,0,a.nodeValue.length).getClientRects();else continue;for(let u=0;u<c.length;u++){let d=c[u];if(d.bottom>d.top+1&&(t=="up"?o.top-d.top>(d.bottom-o.top)*2:d.bottom-o.bottom>(o.bottom-d.top)*2))return!1}}return!0})}const nk=/[\u0590-\u08ac]/;function rk(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,a=n.domSelection();return a?!nk.test(r.parent.textContent)||!a.modify?t=="left"||t=="backward"?s:o:Rh(n,e,()=>{let{focusNode:c,focusOffset:u,anchorNode:d,anchorOffset:p}=n.domSelectionRange(),y=a.caretBidiLevel;a.modify("move",t,"character");let g=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:w,focusOffset:T}=n.domSelectionRange(),S=w&&!g.contains(w.nodeType==1?w:w.parentNode)||c==w&&u==T;try{a.collapse(d,p),c&&(c!=d||u!=p)&&a.extend&&a.extend(c,u)}catch{}return y!=null&&(a.caretBidiLevel=y),S}):r.pos==r.start()||r.pos==r.end()}let Ju=null,Gu=null,Xu=!1;function ik(n,e,t){return Ju==e&&Gu==t?Xu:(Ju=e,Gu=t,Xu=t=="up"||t=="down"?tk(n,e,t):rk(n,e,t))}const bt=0,Qu=1,On=2,jt=3;class Mi{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=bt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let i=this.children[t];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>Ie(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let i=this.children[t],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let a=i.children[o];if(a.size){i=a;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],a=s+o.size;if(a>e||o instanceof Dh){i=e-s;break}s=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof Nh&&s.side>=0;r--);if(t<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?Ie(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,t):{node:this.contentDOM,offset:s?Ie(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,a=0;;a++){let c=this.children[a],u=o+c.size;if(i==-1&&e<=u){let d=o+c.border;if(e>=d&&t<=u-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,t,d);e=o;for(let p=a;p>0;p--){let y=this.children[p-1];if(y.size&&y.dom.parentNode==this.contentDOM&&!y.emptyChildAt(1)){i=Ie(y.dom)+1;break}e-=y.size}i==-1&&(i=0)}if(i>-1&&(u>t||a==this.children.length-1)){t=u;for(let d=a+1;d<this.children.length;d++){let p=this.children[d];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(-1)){s=Ie(p.dom);break}t+=p.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=u}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,i=!1){let s=Math.min(e,t),o=Math.max(e,t);for(let g=0,w=0;g<this.children.length;g++){let T=this.children[g],S=w+T.size;if(s>w&&o<S)return T.setSelection(e-w-T.border,t-w-T.border,r,i);w=S}let a=this.domFromPos(e,e?-1:1),c=t==e?a:this.domFromPos(t,t?-1:1),u=r.root.getSelection(),d=r.domSelectionRange(),p=!1;if((yt||He)&&e==t){let{node:g,offset:w}=a;if(g.nodeType==3){if(p=!!(w&&g.nodeValue[w-1]==`
|
||
`),p&&w==g.nodeValue.length)for(let T=g,S;T;T=T.parentNode){if(S=T.nextSibling){S.nodeName=="BR"&&(a=c={node:S.parentNode,offset:Ie(S)+1});break}let C=T.pmViewDesc;if(C&&C.node&&C.node.isBlock)break}}else{let T=g.childNodes[w-1];p=T&&(T.nodeName=="BR"||T.contentEditable=="false")}}if(yt&&d.focusNode&&d.focusNode!=c.node&&d.focusNode.nodeType==1){let g=d.focusNode.childNodes[d.focusOffset];g&&g.contentEditable=="false"&&(i=!0)}if(!(i||p&&He)&&qn(a.node,a.offset,d.anchorNode,d.anchorOffset)&&qn(c.node,c.offset,d.focusNode,d.focusOffset))return;let y=!1;if((u.extend||e==t)&&!(p&&yt)){u.collapse(a.node,a.offset);try{e!=t&&u.extend(c.node,c.offset),y=!0}catch{}}if(!y){if(e>t){let w=a;a=c,c=w}let g=document.createRange();g.setEnd(c.node,c.offset),g.setStart(a.node,a.offset),u.removeAllRanges(),u.addRange(g)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&t>=r:e<o&&t>r){let a=r+s.border,c=o-s.border;if(e>=a&&t<=c){this.dirty=e==r||t==o?On:Qu,e==a&&t==c&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=jt:s.markDirty(e-a,t-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?On:jt}r=o}this.dirty=On}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?On:Qu;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Nh extends Mi{constructor(e,t,r,i){let s,o=t.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==bt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class sk extends Mi{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Un extends Mi{constructor(e,t,r,i,s){super(e,[],r,i),this.mark=t,this.spec=s}static create(e,t,r,i){let s=i.nodeViews[t.type.name],o=s&&s(t,i,r);return(!o||!o.dom)&&(o=Jn.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new Un(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&jt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=jt&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=bt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=bt}}slice(e,t,r){let i=Un.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;t<o&&(s=Ga(s,t,o,r)),e>0&&(s=Ga(s,0,e,r));for(let a=0;a<s.length;a++)s[a].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class pn extends Mi{constructor(e,t,r,i,s,o,a,c,u){super(e,[],s,o),this.node=t,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,t,r,i,s,o){let a=s.nodeViews[t.type.name],c,u=a&&a(t,s,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,i),d=u&&u.dom,p=u&&u.contentDOM;if(t.isText){if(!d)d=document.createTextNode(t.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:p}=Jn.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!p&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let y=d;return d=Lh(d,r,t),u?c=new ok(e,t,r,i,d,p||null,y,u,s,o+1):t.isText?new ko(e,t,r,i,d,y,s):new pn(e,t,r,i,d,p||null,y,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>j.empty)}return e}matchesNode(e,t,r){return this.dirty==bt&&e.eq(this.node)&&ws(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,i=t,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,c=new lk(this,o&&o.node,e);fk(this.node,this.innerDeco,(u,d,p)=>{u.spec.marks?c.syncToMarks(u.spec.marks,r,e,d):u.type.side>=0&&!p&&c.syncToMarks(d==this.node.childCount?de.none:this.node.child(d).marks,r,e,d),c.placeWidget(u,e,i)},(u,d,p,y)=>{c.syncToMarks(u.marks,r,e,y);let g;c.findNodeMatch(u,d,p,y)||a&&e.state.selection.from>i&&e.state.selection.to<i+u.nodeSize&&(g=c.findIndexWithChild(s.node))>-1&&c.updateNodeAt(u,d,p,g,e)||c.updateNextNode(u,d,p,e,y,i)||c.addNode(u,d,p,e,i),i+=u.nodeSize}),c.syncToMarks([],r,e,0),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==On)&&(o&&this.protectLocalComposition(e,o),Ph(this.contentDOM,this.children,e),vr&&dk(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof X)||r<t||i>t+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,a=hk(this.node.content,o,r-t,i-t);return a<0?null:{node:s,pos:a,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new sk(this,s,t,i);e.input.compositionNodes.push(o),this.children=Ga(this.children,r,r+i.length,e,o)}update(e,t,r,i){return this.dirty==jt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=bt}updateOuterDeco(e){if(ws(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Ih(this.dom,this.nodeDOM,Ja(this.outerDeco,this.node,t),Ja(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Yu(n,e,t,r,i){Lh(r,e,n);let s=new pn(void 0,n,e,t,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class ko extends pn{constructor(e,t,r,i,s,o,a){super(e,t,r,i,s,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,i){return this.dirty==jt||this.dirty!=bt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=bt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=bt,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let i=this.node.cut(e,t),s=document.createTextNode(i.text);return new ko(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=jt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Dh extends Mi{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==bt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class ok extends pn{constructor(e,t,r,i,s,o,a,c,u,d){super(e,t,r,i,s,o,a,u,d),this.spec=c}update(e,t,r,i){if(this.dirty==jt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,t,r);return s&&this.updateInner(e,t,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Ph(n,e,t){let r=n.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],a=o.dom;if(a.parentNode==n){for(;a!=r;)r=Zu(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(a,r);if(o instanceof Un){let c=r?r.previousSibling:n.lastChild;Ph(o.contentDOM,o.children,t),r=c?c.nextSibling:n.firstChild}}for(;r;)r=Zu(r),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}const ei=function(n){n&&(this.nodeName=n)};ei.prototype=Object.create(null);const Rn=[new ei];function Ja(n,e,t){if(n.length==0)return Rn;let r=t?Rn[0]:new ei,i=[r];for(let s=0;s<n.length;s++){let o=n[s].type.attrs;if(o){o.nodeName&&i.push(r=new ei(o.nodeName));for(let a in o){let c=o[a];c!=null&&(t&&i.length==1&&i.push(r=new ei(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+c:a=="style"?r.style=(r.style?r.style+";":"")+c:a!="nodeName"&&(r[a]=c))}}}return i}function Ih(n,e,t,r){if(t==Rn&&r==Rn)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],a=t[s];if(s){let c;a&&a.nodeName==o.nodeName&&i!=n&&(c=i.parentNode)&&c.nodeName.toLowerCase()==o.nodeName||(c=document.createElement(o.nodeName),c.pmIsDeco=!0,c.appendChild(i),a=Rn[0]),i=c}ak(i,a||Rn[0],o)}return i}function ak(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&n.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&n.classList.add(i[s]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)n.style.removeProperty(i[1])}t.style&&(n.style.cssText+=t.style)}}function Lh(n,e,t){return Ih(n,n,Rn,Ja(e,t,n.nodeType!=1))}function ws(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function Zu(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class lk{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=ck(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r,i){let s=0,o=this.stack.length>>1,a=Math.min(o,e.length);for(;s<a&&(s==o-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<o;)this.destroyRest(),this.top.dirty=bt,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let c=-1,u=this.top.children.length;i<this.preMatch.index&&(u=Math.min(this.index+3,u));for(let d=this.index;d<u;d++){let p=this.top.children[d];if(p.matchesMark(e[o])&&!this.isLocked(p.dom)){c=d;break}}if(c>-1)c>this.index&&(this.changed=!0,this.destroyBetween(this.index,c)),this.top=this.top.children[this.index];else{let d=Un.create(this.top,e[o],t,r);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,r))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,c=Math.min(this.top.children.length,a+5);a<c;a++){let u=this.top.children[a];if(u.matchesNode(e,t,r)&&!this.preMatch.matched.has(u)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,t,r,i,s){let o=this.top.children[i];return o.dirty==jt&&o.dom==o.contentDOM&&(o.dirty=On),o.update(e,t,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=t}}updateNextNode(e,t,r,i,s,o){for(let a=this.index;a<this.top.children.length;a++){let c=this.top.children[a];if(c instanceof pn){let u=this.preMatch.matched.get(c);if(u!=null&&u!=s)return!1;let d=c.dom,p,y=this.isLocked(d)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=jt&&ws(t,c.outerDeco));if(!y&&c.update(e,t,r,i))return this.destroyBetween(this.index,a),c.dom!=d&&(this.changed=!0),this.index++,!0;if(!y&&(p=this.recreateWrapper(c,e,t,r,i,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=p,p.contentDOM&&(p.dirty=On,p.updateChildren(i,o+1),p.dirty=bt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,i,s,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!ws(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=pn.create(this.top,t,r,i,s,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let c of a.children)c.parent=a}return e.destroy(),a}addNode(e,t,r,i,s){let o=pn.create(this.top,e,t,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new Nh(this.top,e,t,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Un;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof ko)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((He||_e)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new Dh(this.top,[],r,null);t!=this.top?t.children.push(i):t.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function ck(n,e){let t=e,r=t.children.length,i=n.childCount,s=new Map,o=[];e:for(;i>0;){let a;for(;;)if(r){let u=t.children[r-1];if(u instanceof Un)t=u,r=u.children.length;else{a=u,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let c=a.node;if(c){if(c!=n.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function uk(n,e){return n.type.side-e.type.side}function fk(n,e,t,r){let i=e.locals(n),s=0;if(i.length==0){for(let u=0;u<n.childCount;u++){let d=n.child(u);r(d,i,e.forChild(s,d),u),s+=d.nodeSize}return}let o=0,a=[],c=null;for(let u=0;;){let d,p;for(;o<i.length&&i[o].to==s;){let S=i[o++];S.widget&&(d?(p||(p=[d])).push(S):d=S)}if(d)if(p){p.sort(uk);for(let S=0;S<p.length;S++)t(p[S],u,!!c)}else t(d,u,!!c);let y,g;if(c)g=-1,y=c,c=null;else if(u<n.childCount)g=u,y=n.child(u++);else break;for(let S=0;S<a.length;S++)a[S].to<=s&&a.splice(S--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let w=s+y.nodeSize;if(y.isText){let S=w;o<i.length&&i[o].from<S&&(S=i[o].from);for(let C=0;C<a.length;C++)a[C].to<S&&(S=a[C].to);S<w&&(c=y.cut(S-s),y=y.cut(0,S-s),w=S,g=-1)}else for(;o<i.length&&i[o].to<w;)o++;let T=y.isInline&&!y.isLeaf?a.filter(S=>!S.inline):a.slice();r(y,T,e.forChild(s,y),g),s=w}}function dk(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function hk(n,e,t,r){for(let i=0,s=0;i<n.childCount&&s<=r;){let o=n.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let c=o.text;for(;i<n.childCount;){let u=n.child(i++);if(s+=u.nodeSize,!u.isText)break;c+=u.text}if(s>=t){if(s>=r&&c.slice(r-e.length-a,r-a)==e)return r-e.length;let u=a<r?c.lastIndexOf(e,r-a-1):-1;if(u>=0&&u+e.length+a>=t)return a+u;if(t==r&&c.length>=r+e.length-a&&c.slice(r-a,r-a+e.length)==e)return r}}return-1}function Ga(n,e,t,r,i){let s=[];for(let o=0,a=0;o<n.length;o++){let c=n[o],u=a,d=a+=c.size;u>=t||d<=e?s.push(c):(u<e&&s.push(c.slice(0,e-u,r)),i&&(s.push(i),i=void 0),d>t&&s.push(c.slice(t-u,c.size,r)))}return s}function Dl(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let a=r.resolve(o),c,u;if(bo(t)){for(c=o;i&&!i.node;)i=i.parent;let p=i.node;if(i&&p.isAtom&&J.isSelectable(p)&&i.parent&&!(p.isInline&&jb(t.focusNode,t.focusOffset,i.dom))){let y=i.posBefore;u=new J(o==y?a:r.resolve(y))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let p=o,y=o;for(let g=0;g<t.rangeCount;g++){let w=t.getRangeAt(g);p=Math.min(p,n.docView.posFromDOM(w.startContainer,w.startOffset,1)),y=Math.max(y,n.docView.posFromDOM(w.endContainer,w.endOffset,-1))}if(p<0)return null;[c,o]=y==n.state.selection.anchor?[y,p]:[p,y],a=r.resolve(o)}else c=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(c<0)return null}let d=r.resolve(c);if(!u){let p=e=="pointer"||n.state.selection.head<a.pos&&!s?1:-1;u=Pl(n,d,a,p)}return u}function Bh(n){return n.editable?n.hasFocus():zh(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Yt(n,e=!1){let t=n.state.selection;if(_h(n,t),!!Bh(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&_e){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&qn(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)mk(n);else{let{anchor:r,head:i}=t,s,o;ef&&!(t instanceof X)&&(t.$from.parent.inlineContent||(s=tf(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=tf(n,t.to))),n.docView.setSelection(r,i,n,e),ef&&(s&&nf(s),o&&nf(o)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&pk(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const ef=He||_e&&Sh<63;function tf(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,s=r?t.childNodes[r-1]:null;if(He&&i&&i.contentEditable=="false")return pa(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return pa(i);if(s)return pa(s)}}function pa(n){return n.contentEditable="true",He&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function nf(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function pk(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(()=>{(!Bh(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function mk(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,Ie(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&rt&&hn<=11&&(t.disabled=!0,t.disabled=!1)}function _h(n,e){if(e instanceof J){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(rf(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else rf(n)}function rf(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Pl(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||X.between(e,t,r)}function sf(n){return n.editable&&!n.hasFocus()?!1:zh(n)}function zh(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 gk(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return qn(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Xa(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),s=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return s&&te.findFrom(s,e)}function on(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function of(n,e,t){let r=n.state.selection;if(r instanceof X)if(t.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=n.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return on(n,new X(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=Xa(n.state,e);return i&&i instanceof J?on(n,i):!1}else if(!(mt&&t.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=n.docView.descAt(a))&&!o.contentDOM?J.isSelectable(s)?on(n,new J(e<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):Ei?on(n,new X(n.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof J&&r.node.isInline)return on(n,new X(e>0?r.$to:r.$from));{let i=Xa(n.state,e);return i?on(n,i):!1}}}function Ts(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function ti(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function dr(n,e){return e<0?yk(n):bk(n)}function yk(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,s,o=!1;for(yt&&t.nodeType==1&&r<Ts(t)&&ti(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(t.nodeType!=1)break;{let a=t.childNodes[r-1];if(ti(a,-1))i=t,s=--r;else if(a.nodeType==3)t=a,r=t.nodeValue.length;else break}}else{if($h(t))break;{let a=t.previousSibling;for(;a&&ti(a,-1);)i=t.parentNode,s=Ie(a),a=a.previousSibling;if(a)t=a,r=Ts(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?Qa(n,t,r):i&&Qa(n,i,s)}function bk(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=Ts(t),s,o;for(;;)if(r<i){if(t.nodeType!=1)break;let a=t.childNodes[r];if(ti(a,1))s=t,o=++r;else break}else{if($h(t))break;{let a=t.nextSibling;for(;a&&ti(a,1);)s=a.parentNode,o=Ie(a)+1,a=a.nextSibling;if(a)t=a,r=0,i=Ts(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}s&&Qa(n,s,o)}function $h(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function kk(n,e){for(;n&&e==n.childNodes.length&&!Ci(n);)e=Ie(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 xk(n,e){for(;n&&!e&&!Ci(n);)e=Ie(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 Qa(n,e,t){if(e.nodeType!=3){let s,o;(o=kk(e,t))?(e=o,t=0):(s=xk(e,t))&&(e=s,t=s.nodeValue.length)}let r=n.domSelection();if(!r)return;if(bo(r)){let s=document.createRange();s.setEnd(e,t),s.setStart(e,t),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&Yt(n)},50)}function af(n,e){let t=n.state.doc.resolve(e);if(!(_e||vh)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<t.end()){let s=n.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function lf(n,e,t){let r=n.state.selection;if(r instanceof X&&!r.empty||t.indexOf("s")>-1||mt&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=Xa(n.state,e);if(o&&o instanceof J)return on(n,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=r instanceof at?te.near(o,e):te.findFrom(o,e);return a?on(n,a):!1}return!1}function cf(n,e){if(!(n.state.selection instanceof X))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 s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=n.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),n.dispatch(o),!0}return!1}function uf(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function wk(n){if(!He||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;uf(n,r,"true"),setTimeout(()=>uf(n,r,"false"),20)}return!1}function Tk(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Sk(n,e){let t=e.keyCode,r=Tk(e);if(t==8||mt&&t==72&&r=="c")return cf(n,-1)||dr(n,-1);if(t==46&&!e.shiftKey||mt&&t==68&&r=="c")return cf(n,1)||dr(n,1);if(t==13||t==27)return!0;if(t==37||mt&&t==66&&r=="c"){let i=t==37?af(n,n.state.selection.from)=="ltr"?-1:1:-1;return of(n,i,r)||dr(n,i)}else if(t==39||mt&&t==70&&r=="c"){let i=t==39?af(n,n.state.selection.from)=="ltr"?1:-1:1;return of(n,i,r)||dr(n,i)}else{if(t==38||mt&&t==80&&r=="c")return lf(n,-1,r)||dr(n,-1);if(t==40||mt&&t==78&&r=="c")return wk(n)||lf(n,1,r)||dr(n,1);if(r==(mt?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Il(n,e){n.someProp("transformCopied",g=>{e=g(e,n)});let t=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let g=r.firstChild;t.push(g.type.name,g.attrs!=g.type.defaultAttrs?g.attrs:null),r=g.content}let o=n.someProp("clipboardSerializer")||Jn.fromSchema(n.state.schema),a=Uh(),c=a.createElement("div");c.appendChild(o.serializeFragment(r,{document:a}));let u=c.firstChild,d,p=0;for(;u&&u.nodeType==1&&(d=qh[u.nodeName.toLowerCase()]);){for(let g=d.length-1;g>=0;g--){let w=a.createElement(d[g]);for(;c.firstChild;)w.appendChild(c.firstChild);c.appendChild(w),p++}u=c.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${i} ${s}${p?` -${p}`:""} ${JSON.stringify(t)}`);let y=n.someProp("clipboardTextSerializer",g=>g(e,n))||e.content.textBetween(0,e.content.size,`
|
||
|
||
`);return{dom:c,text:y,slice:e}}function jh(n,e,t,r,i){let s=i.parent.type.spec.code,o,a;if(!t&&!e)return null;let c=!!e&&(r||s||!t);if(c){if(n.someProp("transformPastedText",y=>{e=y(e,s||r,n)}),s)return a=new V(j.from(n.state.schema.text(e.replace(/\r\n?/g,`
|
||
`))),0,0),n.someProp("transformPasted",y=>{a=y(a,n,!0)}),a;let p=n.someProp("clipboardTextParser",y=>y(e,i,r,n));if(p)a=p;else{let y=i.marks(),{schema:g}=n.state,w=Jn.fromSchema(g);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(T=>{let S=o.appendChild(document.createElement("p"));T&&S.appendChild(w.serializeNode(g.text(T,y)))})}}else n.someProp("transformPastedHTML",p=>{t=p(t,n)}),o=Mk(t),Ei&&Ak(o);let u=o&&o.querySelector("[data-pm-slice]"),d=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let p=+d[3];p>0;p--){let y=o.firstChild;for(;y&&y.nodeType!=1;)y=y.nextSibling;if(!y)break;o=y}if(a||(a=(n.someProp("clipboardParser")||n.someProp("domParser")||Xt.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||d),context:i,ruleFromNode(y){return y.nodeName=="BR"&&!y.nextSibling&&y.parentNode&&!vk.test(y.parentNode.nodeName)?{ignore:!0}:null}})),d)a=Ok(ff(a,+d[1],+d[2]),d[4]);else if(a=V.maxOpen(Ck(a.content,i),!0),a.openStart||a.openEnd){let p=0,y=0;for(let g=a.content.firstChild;p<a.openStart&&!g.type.spec.isolating;p++,g=g.firstChild);for(let g=a.content.lastChild;y<a.openEnd&&!g.type.spec.isolating;y++,g=g.lastChild);a=ff(a,p,y)}return n.someProp("transformPasted",p=>{a=p(a,n,c)}),a}const vk=/^(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 Ck(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)),s,o=[];if(n.forEach(a=>{if(!o)return;let c=i.findWrapping(a.type),u;if(!c)return o=null;if(u=o.length&&s.length&&Hh(c,s,a,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=Vh(o[o.length-1],s.length));let d=Fh(a,c);o.push(d),i=i.matchType(d.type),s=c}}),o)return j.from(o)}return n}function Fh(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,j.from(n));return n}function Hh(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let s=Hh(n,e,t,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(j.from(Fh(t,n,i+1))))}}function Vh(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Vh(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(j.empty,!0);return n.copy(t.append(r))}function Ya(n,e,t,r,i,s){let o=e<0?n.firstChild:n.lastChild,a=o.content;return n.childCount>1&&(s=0),i<r-1&&(a=Ya(a,e,t,r,i+1,s)),i>=t&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(j.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(a))}function ff(n,e,t){return e<n.openStart&&(n=new V(Ya(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new V(Ya(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const qh={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let df=null;function Uh(){return df||(df=document.implementation.createHTMLDocument("title"))}let ma=null;function Ek(n){let e=window.trustedTypes;return e?(ma||(ma=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),ma.createHTML(n)):n}function Mk(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Uh().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&qh[r[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=Ek(n),i)for(let s=0;s<i.length;s++)t=t.querySelector(i[s])||t;return t}function Ak(n){let e=n.querySelectorAll(_e?"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==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function Ok(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:s,openEnd:o}=n;for(let a=r.length-2;a>=0;a-=2){let c=t.nodes[r[a]];if(!c||c.hasRequiredAttrs())break;i=j.from(c.create(r[a+1],i)),s++,o++}return new V(i,s,o)}const Je={},Ge={},Rk={touchstart:!0,touchmove:!0};class Nk{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Dk(n){for(let e in Je){let t=Je[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{Ik(n,r)&&!Ll(n,r)&&(n.editable||!(r.type in Ge))&&t(n,r)},Rk[e]?{passive:!0}:void 0)}He&&n.dom.addEventListener("input",()=>null),Za(n)}function dn(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Pk(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Za(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Ll(n,r))})}function Ll(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function Ik(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function Lk(n,e){!Ll(n,e)&&Je[e.type]&&(n.editable||!(e.type in Ge))&&Je[e.type](n,e)}Ge.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Kh(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Gt&&_e&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),vr&&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,En(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Sk(n,t)?t.preventDefault():dn(n,"key")};Ge.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};Ge.keypress=(n,e)=>{let t=e;if(Kh(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||mt&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof X)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode),s=()=>n.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i,s))&&n.dispatch(s()),t.preventDefault()}};function xo(n){return{left:n.clientX,top:n.clientY}}function Bk(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Bl(n,e,t,r,i){if(r==-1)return!1;let s=n.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(n.someProp(e,a=>o>s.depth?a(n,t,s.nodeAfter,s.before(o),i,!0):a(n,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function br(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 _k(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&J.isSelectable(r)?(br(n,new J(t)),!0):!1}function zk(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof J&&(r=t.node);let s=n.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(J.isSelectable(a)){r&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(br(n,J.create(n.state.doc,i)),!0):!1}function $k(n,e,t,r,i){return Bl(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(i?zk(n,t):_k(n,t))}function jk(n,e,t,r){return Bl(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function Fk(n,e,t,r){return Bl(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||Hk(n,t,r)}function Hk(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(br(n,X.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)br(n,X.create(r,a+1,a+1+o.content.size));else if(J.isSelectable(o))br(n,J.create(r,a));else continue;return!0}}function _l(n){return Ss(n)}const Wh=mt?"metaKey":"ctrlKey";Je.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=_l(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&Bk(t,n.input.lastClick)&&!t[Wh]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s,button:t.button};let o=n.posAtCoords(xo(t));o&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Vk(n,o,t,!!r)):(s=="doubleClick"?jk:Fk)(n,o.pos,o.inside,t)?t.preventDefault():dn(n,"pointer"))};class Vk{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[Wh],this.allowDefault=r.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let d=e.state.doc.resolve(t.pos);s=d.parent,o=d.depth?d.before():0}const a=i?null:r.target,c=a?e.docView.nearestDesc(a,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:u}=e.state;r.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||u instanceof J&&u.from<=o&&u.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&yt&&!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)),dn(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(()=>Yt(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(xo(e))),this.updateAllowDefault(e),this.allowDefault||!t?dn(this.view,"pointer"):$k(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||He&&this.mightDrag&&!this.mightDrag.node.isAtom||_e&&!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)?(br(this.view,te.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):dn(this.view,"pointer")}move(e){this.updateAllowDefault(e),dn(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)}}Je.touchstart=n=>{n.input.lastTouch=Date.now(),_l(n),dn(n,"pointer")};Je.touchmove=n=>{n.input.lastTouch=Date.now(),dn(n,"pointer")};Je.contextmenu=n=>_l(n);function Kh(n,e){return n.composing?!0:He&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const qk=Gt?5e3:-1;Ge.compositionstart=Ge.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof X&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||_e&&vh&&Uk(n)))n.markCursor=n.state.storedMarks||t.marks(),Ss(n,!0),n.markCursor=null;else if(Ss(n,!e.selection.empty),yt&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let a=n.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}n.input.composing=!0}Jh(n,qk)};function Uk(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let r=e.childNodes[t];return r.nodeType==1&&r.contentEditable=="false"}Ge.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.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,Jh(n,20))};function Jh(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Ss(n),e))}function Gh(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Kk());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Wk(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=zb(e.focusNode,e.focusOffset),r=$b(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc,s=n.domObserver.lastChangedTextNode;if(t==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return r}}return t||r}function Kk(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Ss(n,e=!1){if(!(Gt&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Gh(n),e||n.docView&&n.docView.dirty){let t=Dl(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function Jk(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 di=rt&&hn<15||vr&&Vb<604;Je.copy=Ge.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let s=di?null:t.clipboardData,o=r.content(),{dom:a,text:c}=Il(n,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",c)):Jk(n,a),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Gk(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Xk(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?hi(n,r.value,null,i,e):hi(n,r.textContent,r.innerHTML,i,e)},50)}function hi(n,e,t,r,i){let s=jh(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",c=>c(n,i,s||V.empty)))return!0;if(!s)return!1;let o=Gk(s),a=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(s);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Xh(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," "):""}Ge.paste=(n,e)=>{let t=e;if(n.composing&&!Gt)return;let r=di?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&hi(n,Xh(r),r.getData("text/html"),i,t)?t.preventDefault():Xk(n,t)};class Qh{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const Qk=mt?"altKey":"ctrlKey";function Yh(n,e){let t;return n.someProp("dragCopies",r=>{t=t||r(e)}),t!=null?!t:!e[Qk]}Je.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,s=i.empty?null:n.posAtCoords(xo(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof J?i.to-1:i.to))){if(r&&r.mightDrag)o=J.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&&(o=J.create(n.state.doc,p.posBefore))}}let a=(o||n.state.selection).content(),{dom:c,text:u,slice:d}=Il(n,a);(!t.dataTransfer.files.length||!_e||Sh>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(di?"Text":"text/html",c.innerHTML),t.dataTransfer.effectAllowed="copyMove",di||t.dataTransfer.setData("text/plain",u),n.dragging=new Qh(d,Yh(n,t),o)};Je.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};Ge.dragover=Ge.dragenter=(n,e)=>e.preventDefault();Ge.drop=(n,e)=>{try{Yk(n,e,n.dragging)}finally{n.dragging=null}};function Yk(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(xo(e));if(!r)return;let i=n.state.doc.resolve(r.pos),s=t&&t.slice;s?n.someProp("transformPasted",g=>{s=g(s,n,!1)}):s=jh(n,Xh(e.dataTransfer),di?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(t&&Yh(n,e));if(n.someProp("handleDrop",g=>g(n,e,s||V.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let a=s?th(n.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let c=n.state.tr;if(o){let{node:g}=t;g?g.replace(c):c.deleteSelection()}let u=c.mapping.map(a),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,p=c.doc;if(d?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(p))return;let y=c.doc.resolve(u);if(d&&J.isSelectable(s.content.firstChild)&&y.nodeAfter&&y.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new J(y));else{let g=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((w,T,S,C)=>g=C),c.setSelection(Pl(n,y,c.doc.resolve(g)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))}Je.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())&&Yt(n)},20))};Je.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)};Je.beforeinput=(n,e)=>{if(_e&&Gt&&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",s=>s(n,En(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 Ge)Je[n]=Ge[n];function pi(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 vs{constructor(e,t){this.toDOM=e,this.spec=t||_n,this.side=this.spec.side||0}map(e,t,r,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new Ue(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof vs&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&pi(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class mn{constructor(e,t){this.attrs=e,this.spec=t||_n}map(e,t,r,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new Ue(s,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof mn&&pi(this.attrs,e.attrs)&&pi(this.spec,e.spec)}static is(e){return e.type instanceof mn}destroy(){}}class zl{constructor(e,t){this.attrs=e,this.spec=t||_n}map(e,t,r,i){let s=e.mapResult(t.from+i,1);if(s.deleted)return null;let o=e.mapResult(t.to+i,-1);return o.deleted||o.pos<=s.pos?null:new Ue(s.pos-r,o.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),s;return i==t.from&&!(s=e.child(r)).isText&&i+s.nodeSize==t.to}eq(e){return this==e||e instanceof zl&&pi(this.attrs,e.attrs)&&pi(this.spec,e.spec)}destroy(){}}class Ue{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Ue(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 Ue(e,e,new vs(t,r))}static inline(e,t,r,i){return new Ue(e,t,new mn(r,i))}static node(e,t,r,i){return new Ue(e,t,new zl(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof mn}get widget(){return this.type instanceof vs}}const pr=[],_n={};class be{constructor(e,t){this.local=e.length?e:pr,this.children=t.length?t:pr}static create(e,t){return t.length?Cs(t,e,0,_n):Fe}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=t&&a.to>=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,t-a,r,i+a,s)}}map(e,t,r){return this==Fe||e.maps.length==0?this:this.mapInner(e,t,0,0,r||_n)}mapInner(e,t,r,i,s){let o;for(let a=0;a<this.local.length;a++){let c=this.local[a].map(e,r,i);c&&c.type.valid(t,c)?(o||(o=[])).push(c):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?Zk(this.children,o||[],e,t,r,i,s):o?new be(o.sort(zn),pr):Fe}add(e,t){return t.length?this==Fe?be.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,s=0;e.forEach((a,c)=>{let u=c+r,d;if(d=ep(t,a,u)){for(i||(i=this.children.slice());s<i.length&&i[s]<c;)s+=3;i[s]==c?i[s+2]=i[s+2].addInner(a,d,u+1):i.splice(s,0,c,c+a.nodeSize,Cs(d,a,u+1,_n)),s+=3}});let o=Zh(s?tp(t):t,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new be(o.length?this.local.concat(o).sort(zn):this.local,i||this.children)}remove(e){return e.length==0||this==Fe?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,a=r[s]+t,c=r[s+1]+t;for(let d=0,p;d<e.length;d++)(p=e[d])&&p.from>a&&p.to<c&&(e[d]=null,(o||(o=[])).push(p));if(!o)continue;r==this.children&&(r=this.children.slice());let u=r[s+2].removeInner(o,a+1);u!=Fe?r[s+2]=u:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,t)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new be(i,r):Fe}forChild(e,t){if(this==Fe)return this;if(t.isLeaf)return be.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,o=s+t.content.size;for(let a=0;a<this.local.length;a++){let c=this.local[a];if(c.from<o&&c.to>s&&c.type instanceof mn){let u=Math.max(s,c.from)-s,d=Math.min(o,c.to)-s;u<d&&(i||(i=[])).push(c.copy(u,d))}}if(i){let a=new be(i.sort(zn),pr);return r?new cn([a,r]):a}return r||Fe}eq(e){if(this==e)return!0;if(!(e instanceof be)||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 $l(this.localsInner(e))}localsInner(e){if(this==Fe)return pr;if(e.inlineContent||!this.local.some(mn.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof mn||t.push(this.local[r]);return t}forEachSet(e){e(this)}}be.empty=new be([],[]);be.removeOverlap=$l;const Fe=be.empty;class cn{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,_n));return cn.from(r)}forChild(e,t){if(t.isLeaf)return be.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,t);s!=Fe&&(s instanceof cn?r=r.concat(s.members):r.push(s))}return cn.from(r)}eq(e){if(!(e instanceof cn)||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 s=this.members[i].localsInner(e);if(s.length)if(!t)t=s;else{r&&(t=t.slice(),r=!1);for(let o=0;o<s.length;o++)t.push(s[o])}}return t?$l(r?t:t.sort(zn)):pr}static from(e){switch(e.length){case 0:return Fe;case 1:return e[0];default:return new cn(e.every(t=>t instanceof be)?e:e.reduce((t,r)=>t.concat(r instanceof be?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Zk(n,e,t,r,i,s,o){let a=n.slice();for(let u=0,d=s;u<t.maps.length;u++){let p=0;t.maps[u].forEach((y,g,w,T)=>{let S=T-w-(g-y);for(let C=0;C<a.length;C+=3){let I=a[C+1];if(I<0||y>I+d-p)continue;let _=a[C]+d-p;g>=_?a[C+1]=y<=_?-2:-1:y>=d&&S&&(a[C]+=S,a[C+1]+=S)}p+=S}),d=t.maps[u].map(d,-1)}let c=!1;for(let u=0;u<a.length;u+=3)if(a[u+1]<0){if(a[u+1]==-2){c=!0,a[u+1]=-1;continue}let d=t.map(n[u]+s),p=d-i;if(p<0||p>=r.content.size){c=!0;continue}let y=t.map(n[u+1]+s,-1),g=y-i,{index:w,offset:T}=r.content.findIndex(p),S=r.maybeChild(w);if(S&&T==p&&T+S.nodeSize==g){let C=a[u+2].mapInner(t,S,d+1,n[u]+s+1,o);C!=Fe?(a[u]=p,a[u+1]=g,a[u+2]=C):(a[u+1]=-2,c=!0)}else c=!0}if(c){let u=ex(a,n,e,t,i,s,o),d=Cs(u,r,0,o);e=d.local;for(let p=0;p<a.length;p+=3)a[p+1]<0&&(a.splice(p,3),p-=3);for(let p=0,y=0;p<d.children.length;p+=3){let g=d.children[p];for(;y<a.length&&a[y]<g;)y+=3;a.splice(y,0,d.children[p],d.children[p+1],d.children[p+2])}}return new be(e.sort(zn),a)}function Zh(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 Ue(i.from+e,i.to+e,i.type))}return t}function ex(n,e,t,r,i,s,o){function a(c,u){for(let d=0;d<c.local.length;d++){let p=c.local[d].map(r,i,u);p?t.push(p):o.onRemove&&o.onRemove(c.local[d].spec)}for(let d=0;d<c.children.length;d+=3)a(c.children[d+2],c.children[d]+u+1)}for(let c=0;c<n.length;c+=3)n[c+1]==-1&&a(n[c+2],e[c]+s+1);return t}function ep(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let s=0,o;s<n.length;s++)(o=n[s])&&o.from>t&&o.to<r&&((i||(i=[])).push(o),n[s]=null);return i}function tp(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Cs(n,e,t,r){let i=[],s=!1;e.forEach((a,c)=>{let u=ep(n,a,c+t);if(u){s=!0;let d=Cs(u,a,t+c+1,r);d!=Fe&&i.push(c,c+a.nodeSize,d)}});let o=Zh(s?tp(n):n,-t).sort(zn);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new be(o,i):Fe}function zn(n,e){return n.from-e.from||n.to-e.to}function $l(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 s=e[i];if(s.from==r.from){s.to!=r.to&&(e==n&&(e=n.slice()),e[i]=s.copy(s.from,r.to),hf(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,s.from),hf(e,i,r.copy(s.from,r.to)));break}}}return e}function hf(n,e,t){for(;e<n.length&&zn(t,n[e])>0;)e++;n.splice(e,0,t)}function ga(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=Fe&&e.push(r)}),n.cursorWrapper&&e.push(be.create(n.state.doc,[n.cursorWrapper.deco])),cn.from(e)}const tx={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},nx=rt&&hn<=11;class rx{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class ix{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new rx,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);rt&&hn<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():He&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),nx&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,tx)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(sf(this.view)){if(this.suppressingSelectionUpdates)return Yt(this.view);if(rt&&hn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&qn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let s=e.focusNode;s;s=Sr(s))t.add(s);for(let s=e.anchorNode;s;s=Sr(s))if(t.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&sf(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,a=!1,c=[];if(e.editable)for(let d=0;d<t.length;d++){let p=this.registerMutation(t[d],c);p&&(s=s<0?p.from:Math.min(p.from,s),o=o<0?p.to:Math.max(p.to,o),p.typeOver&&(a=!0))}if(c.some(d=>d.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let d of c)if(d.nodeName=="BR"&&d.parentNode){let p=d.nextSibling;for(;p&&p.nodeType==1;){if(p.contentEditable=="false"){d.parentNode.removeChild(d);break}p=p.firstChild}}}else if(yt&&c.length){let d=c.filter(p=>p.nodeName=="BR");if(d.length==2){let[p,y]=d;p.parentNode&&p.parentNode.parentNode==y.parentNode?y.remove():p.remove()}else{let{focusNode:p}=this.currentSelection;for(let y of d){let g=y.parentNode;g&&g.nodeName=="LI"&&(!p||ax(e,p)!=g)&&y.remove()}}}let u=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&bo(r)&&(u=Dl(e))&&u.eq(te.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Yt(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),sx(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,lx(e,c)),this.handleDOMChange(s,o,a,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Yt(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let p=e.addedNodes[d];t.push(p),p.nodeType==3&&(this.lastChangedTextNode=p)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(rt&&hn<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:p,nextSibling:y}=e.addedNodes[d];(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(i=p),(!y||Array.prototype.indexOf.call(e.addedNodes,y)<0)&&(s=y)}let o=i&&i.parentNode==e.target?Ie(i)+1:0,a=r.localPosFromDOM(e.target,o,-1),c=s&&s.parentNode==e.target?Ie(s):e.target.childNodes.length,u=r.localPosFromDOM(e.target,c,1);return{from:a,to:u}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let pf=new WeakMap,mf=!1;function sx(n){if(!pf.has(n)&&(pf.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=yt,mf)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),mf=!0}}function gf(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=n.domAtPos(n.state.selection.anchor);return qn(o.node,o.offset,i,s)&&([t,r,i,s]=[i,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}}function ox(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return gf(n,i)}let t;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?gf(n,t):null}function ax(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function lx(n,e){var t;let{focusNode:r,focusOffset:i}=n.domSelectionRange();for(let s of e)if(((t=s.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let o=s.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let a=o;for(;;){let c=a.firstChild;if(!c||c.nodeType!=1||c.contentEditable=="false"||/^(BR|IMG)$/.test(c.nodeName))break;a=c}a.insertBefore(s,a.firstChild),r==s&&n.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function cx(n,e,t){let{node:r,fromOffset:i,toOffset:s,from:o,to:a}=n.docView.parseRange(e,t),c=n.domSelectionRange(),u,d=c.anchorNode;if(d&&n.dom.contains(d.nodeType==1?d:d.parentNode)&&(u=[{node:d,offset:c.anchorOffset}],bo(c)||u.push({node:c.focusNode,offset:c.focusOffset})),_e&&n.input.lastKeyCode===8)for(let S=s;S>i;S--){let C=r.childNodes[S-1],I=C.pmViewDesc;if(C.nodeName=="BR"&&!I){s=S;break}if(!I||I.size)break}let p=n.state.doc,y=n.someProp("domParser")||Xt.fromSchema(n.state.schema),g=p.resolve(o),w=null,T=y.parse(r,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:i,to:s,preserveWhitespace:g.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:ux,context:g});if(u&&u[0].pos!=null){let S=u[0].pos,C=u[1]&&u[1].pos;C==null&&(C=S),w={anchor:S+o,head:C+o}}return{doc:T,sel:w,from:o,to:a}}function ux(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(He&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||He&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const fx=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function dx(n,e,t,r,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let $=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,q=Dl(n,$);if(q&&!n.state.selection.eq(q)){if(_e&&Gt&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",ee=>ee(n,En(13,"Enter"))))return;let H=n.state.tr.setSelection(q);$=="pointer"?H.setMeta("pointer",!0):$=="key"&&H.scrollIntoView(),s&&H.setMeta("composition",s),n.dispatch(H)}return}let o=n.state.doc.resolve(e),a=o.sharedDepth(t);e=o.before(a+1),t=n.state.doc.resolve(t).after(a+1);let c=n.state.selection,u=cx(n,e,t),d=n.state.doc,p=d.slice(u.from,u.to),y,g;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(y=n.state.selection.to,g="end"):(y=n.state.selection.from,g="start"),n.input.lastKeyCode=null;let w=mx(p.content,u.doc.content,u.from,y,g);if(w&&n.input.domChangeCount++,(vr&&n.input.lastIOSEnter>Date.now()-225||Gt)&&i.some($=>$.nodeType==1&&!fx.test($.nodeName))&&(!w||w.endA>=w.endB)&&n.someProp("handleKeyDown",$=>$(n,En(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!w)if(r&&c instanceof X&&!c.empty&&c.$head.sameParent(c.$anchor)&&!n.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))w={start:c.from,endA:c.to,endB:c.to};else{if(u.sel){let $=yf(n,n.state.doc,u.sel);if($&&!$.eq(n.state.selection)){let q=n.state.tr.setSelection($);s&&q.setMeta("composition",s),n.dispatch(q)}}return}n.state.selection.from<n.state.selection.to&&w.start==w.endB&&n.state.selection instanceof X&&(w.start>n.state.selection.from&&w.start<=n.state.selection.from+2&&n.state.selection.from>=u.from?w.start=n.state.selection.from:w.endA<n.state.selection.to&&w.endA>=n.state.selection.to-2&&n.state.selection.to<=u.to&&(w.endB+=n.state.selection.to-w.endA,w.endA=n.state.selection.to)),rt&&hn<=11&&w.endB==w.start+1&&w.endA==w.start&&w.start>u.from&&u.doc.textBetween(w.start-u.from-1,w.start-u.from+1)==" "&&(w.start--,w.endA--,w.endB--);let T=u.doc.resolveNoCache(w.start-u.from),S=u.doc.resolveNoCache(w.endB-u.from),C=d.resolve(w.start),I=T.sameParent(S)&&T.parent.inlineContent&&C.end()>=w.endA;if((vr&&n.input.lastIOSEnter>Date.now()-225&&(!I||i.some($=>$.nodeName=="DIV"||$.nodeName=="P"))||!I&&T.pos<u.doc.content.size&&(!T.sameParent(S)||!T.parent.inlineContent)&&T.pos<S.pos&&!/\S/.test(u.doc.textBetween(T.pos,S.pos,"","")))&&n.someProp("handleKeyDown",$=>$(n,En(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>w.start&&px(d,w.start,w.endA,T,S)&&n.someProp("handleKeyDown",$=>$(n,En(8,"Backspace")))){Gt&&_e&&n.domObserver.suppressSelectionUpdates();return}_e&&w.endB==w.start&&(n.input.lastChromeDelete=Date.now()),Gt&&!I&&T.start()!=S.start()&&S.parentOffset==0&&T.depth==S.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==w.endA&&(w.endB-=2,S=u.doc.resolveNoCache(w.endB-u.from),setTimeout(()=>{n.someProp("handleKeyDown",function($){return $(n,En(13,"Enter"))})},20));let _=w.start,B=w.endA,z=$=>{let q=$||n.state.tr.replace(_,B,u.doc.slice(w.start-u.from,w.endB-u.from));if(u.sel){let H=yf(n,q.doc,u.sel);H&&!(_e&&n.composing&&H.empty&&(w.start!=w.endB||n.input.lastChromeDelete<Date.now()-100)&&(H.head==_||H.head==q.mapping.map(B)-1)||rt&&H.empty&&H.head==_)&&q.setSelection(H)}return s&&q.setMeta("composition",s),q.scrollIntoView()},b;if(I)if(T.pos==S.pos){rt&&hn<=11&&T.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Yt(n),20));let $=z(n.state.tr.delete(_,B)),q=d.resolve(w.start).marksAcross(d.resolve(w.endA));q&&$.ensureMarks(q),n.dispatch($)}else if(w.endA==w.endB&&(b=hx(T.parent.content.cut(T.parentOffset,S.parentOffset),C.parent.content.cut(C.parentOffset,w.endA-C.start())))){let $=z(n.state.tr);b.type=="add"?$.addMark(_,B,b.mark):$.removeMark(_,B,b.mark),n.dispatch($)}else if(T.parent.child(T.index()).isText&&T.index()==S.index()-(S.textOffset?0:1)){let $=T.parent.textBetween(T.parentOffset,S.parentOffset),q=()=>z(n.state.tr.insertText($,_,B));n.someProp("handleTextInput",H=>H(n,_,B,$,q))||n.dispatch(q())}else n.dispatch(z());else n.dispatch(z())}function yf(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Pl(n,e.resolve(t.anchor),e.resolve(t.head))}function hx(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,s=r,o,a,c;for(let d=0;d<r.length;d++)i=r[d].removeFromSet(i);for(let d=0;d<t.length;d++)s=t[d].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],o="add",c=d=>d.mark(a.addToSet(d.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",c=d=>d.mark(a.removeFromSet(d.marks));else return null;let u=[];for(let d=0;d<e.childCount;d++)u.push(c(e.child(d)));if(j.from(u).eq(n))return{mark:a,type:o}}function px(n,e,t,r,i){if(t-e<=i.pos-r.pos||ya(r,!0,!1)<i.pos)return!1;let s=n.resolve(e);if(!r.parent.isTextblock){let a=s.nodeAfter;return a!=null&&t==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=n.resolve(ya(s,!0,!0));return!o.parent.isTextblock||o.pos>t||ya(o,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function ya(n,e,t){let r=n.depth,i=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let s=n.node(r).maybeChild(n.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function mx(n,e,t,r,i){let s=n.findDiffStart(e,t);if(s==null)return null;let{a:o,b:a}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let c=Math.max(0,s-Math.min(o,a));r-=o+c-s}if(o<s&&n.size<e.size){let c=r<=s&&r>=o?s-r:0;s-=c,s&&s<e.size&&bf(e.textBetween(s-1,s+1))&&(s+=c?1:-1),a=s+(a-o),o=s}else if(a<s){let c=r<=s&&r>=a?s-r:0;s-=c,s&&s<n.size&&bf(n.textBetween(s-1,s+1))&&(s+=c?1:-1),o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}function bf(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class np{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Nk,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Sf),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=wf(this),xf(this),this.nodeViews=Tf(this),this.docView=Yu(this.state.doc,kf(this),ga(this),this.dom,this),this.domObserver=new ix(this,(r,i,s,o)=>dx(this,r,i,s,o)),this.domObserver.start(),Dk(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Za(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Sf),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(Gh(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let g=Tf(this);yx(g,this.nodeViews)&&(this.nodeViews=g,s=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Za(this),this.editable=wf(this),xf(this);let c=ga(this),u=kf(this),d=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",p=s||!this.docView.matchesNode(e.doc,u,c);(p||!e.selection.eq(i.selection))&&(o=!0);let y=d=="preserve"&&o&&this.dom.style.overflowAnchor==null&&Wb(this);if(o){this.domObserver.stop();let g=p&&(rt||_e)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&gx(i.selection,e.selection);if(p){let w=_e?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Wk(this)),(s||!this.docView.update(e.doc,u,c,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=Yu(e.doc,u,c,this.dom,this)),w&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(g=!0)}g||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&gk(this))?Yt(this,g):(_h(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():y&&Kb(y)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof J){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Wu(this,t.getBoundingClientRect(),e)}else Wu(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){let r=e.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-t.doc.content.size);(s>0&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new Qh(e.slice,e.move,i<0?void 0:J.create(this.state.doc,i))}someProp(e,t){let r=this._props&&this._props[e],i;if(r!=null&&(i=t?t(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=t?t(a):a))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let a=s[o].props[e];if(a!=null&&(i=t?t(a):a))return i}}hasFocus(){if(rt){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Jb(this.dom),Yt(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Zb(this,e)}coordsAtPos(e,t=1){return Oh(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let i=this.docView.posFromDOM(e,t,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return ik(this,t||this.state,e)}pasteHTML(e,t){return hi(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return hi(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Il(this,e)}destroy(){this.docView&&(Pk(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ga(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Bb())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Lk(this,e)}domSelectionRange(){let e=this.domSelection();return e?He&&this.root.nodeType===11&&Fb(this.dom.ownerDocument)==this.dom&&ox(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}np.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function kf(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[Ue.node(0,n.state.doc.content.size,e)]}function xf(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:Ue.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function wf(n){return!n.someProp("editable",e=>e(n.state)===!1)}function gx(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function Tf(n){let e=Object.create(null);function t(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function yx(n,e){let t=0,r=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)r++;return t!=r}function Sf(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var gn={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:"'"},Es={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},bx=typeof navigator<"u"&&/Mac/.test(navigator.platform),kx=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Le=0;Le<10;Le++)gn[48+Le]=gn[96+Le]=String(Le);for(var Le=1;Le<=24;Le++)gn[Le+111]="F"+Le;for(var Le=65;Le<=90;Le++)gn[Le]=String.fromCharCode(Le+32),Es[Le]=String.fromCharCode(Le);for(var ba in gn)Es.hasOwnProperty(ba)||(Es[ba]=gn[ba]);function xx(n){var e=bx&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||kx&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Es:gn)[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 wx=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Tx=typeof navigator<"u"&&/Win/.test(navigator.platform);function Sx(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,s,o;for(let a=0;a<e.length-1;a++){let c=e[a];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))s=!0;else if(/^mod$/i.test(c))wx?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),o&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function vx(n){let e=Object.create(null);for(let t in n)e[Sx(t)]=n[t];return e}function ka(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 Cx(n){return new ke({props:{handleKeyDown:rp(n)}})}function rp(n){let e=vx(n);return function(t,r){let i=xx(r),s,o=e[ka(i,r)];if(o&&o(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[ka(i,r,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Tx&&r.ctrlKey&&r.altKey)&&(s=gn[r.keyCode])&&s!=i){let a=e[ka(s,r)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}var Ex=Object.defineProperty,jl=(n,e)=>{for(var t in e)Ex(n,t,{get:e[t],enumerable:!0})};function wo(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:s}=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 s},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,s=t.storedMarks,t}}}var To=class{constructor(n){this.editor=n.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=n.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:n,editor:e,state:t}=this,{view:r}=e,{tr:i}=t,s=this.buildProps(i);return Object.fromEntries(Object.entries(n).map(([o,a])=>[o,(...u)=>{const d=a(...u)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(n,e=!0){const{rawCommands:t,editor:r,state:i}=this,{view:s}=r,o=[],a=!!n,c=n||i.tr,u=()=>(!a&&e&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(c),o.every(p=>p===!0)),d={...Object.fromEntries(Object.entries(t).map(([p,y])=>[p,(...w)=>{const T=this.buildProps(c,e),S=y(...w)(T);return o.push(S),d}])),run:u};return d}createCan(n){const{rawCommands:e,state:t}=this,r=!1,i=n||t.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([a,c])=>[a,(...u)=>c(...u)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(n,e=!0){const{rawCommands:t,editor:r,state:i}=this,{view:s}=r,o={tr:n,editor:r,view:s,state:wo({state:i,transaction:n}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(n,e),can:()=>this.createCan(n),get commands(){return Object.fromEntries(Object.entries(t).map(([a,c])=>[a,(...u)=>c(...u)(o)]))}};return o}},vt={};jl(vt,{blur:()=>Mx,clearContent:()=>Ax,clearNodes:()=>Ox,command:()=>Rx,createParagraphNear:()=>Nx,cut:()=>Dx,deleteCurrentNode:()=>Px,deleteNode:()=>Ix,deleteRange:()=>Lx,deleteSelection:()=>zx,enter:()=>$x,exitCode:()=>jx,extendMarkRange:()=>Fx,first:()=>Hx,focus:()=>qx,forEach:()=>Ux,insertContent:()=>Wx,insertContentAt:()=>Gx,joinBackward:()=>Yx,joinDown:()=>Qx,joinForward:()=>Zx,joinItemBackward:()=>ew,joinItemForward:()=>tw,joinTextblockBackward:()=>nw,joinTextblockForward:()=>rw,joinUp:()=>Xx,keyboardShortcut:()=>sw,lift:()=>ow,liftEmptyBlock:()=>aw,liftListItem:()=>lw,newlineInCode:()=>cw,resetAttributes:()=>uw,scrollIntoView:()=>fw,selectAll:()=>dw,selectNodeBackward:()=>hw,selectNodeForward:()=>pw,selectParentNode:()=>mw,selectTextblockEnd:()=>gw,selectTextblockStart:()=>yw,setContent:()=>bw,setMark:()=>$w,setMeta:()=>jw,setNode:()=>Fw,setNodeSelection:()=>Hw,setTextDirection:()=>Vw,setTextSelection:()=>qw,sinkListItem:()=>Uw,splitBlock:()=>Ww,splitListItem:()=>Kw,toggleList:()=>Gw,toggleMark:()=>Xw,toggleNode:()=>Qw,toggleWrap:()=>Yw,undoInputRule:()=>Zw,unsetAllMarks:()=>e1,unsetMark:()=>t1,unsetTextDirection:()=>n1,updateAttributes:()=>r1,wrapIn:()=>i1,wrapInList:()=>s1});var Mx=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())==null||t.removeAllRanges())}),!0),Ax=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),Ox=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:s,$to:o})=>{n.doc.nodesBetween(s.pos,o.pos,(a,c)=>{if(a.type.isText)return;const{doc:u,mapping:d}=e,p=u.resolve(d.map(c)),y=u.resolve(d.map(c+a.nodeSize)),g=p.blockRange(y);if(!g)return;const w=Rr(g);if(a.type.isTextblock){const{defaultType:T}=p.parent.contentMatchAt(p.index());e.setNodeMarkup(g.start,T)}(w||w===0)&&e.lift(g,w)})}),!0},Rx=n=>e=>n(e),Nx=()=>({state:n,dispatch:e})=>bh(n,e),Dx=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,s=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new X(r.doc.resolve(Math.max(o-1,0)))),!0},Px=()=>({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 s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const a=i.before(s),c=i.after(s);n.delete(a,c).scrollIntoView()}return!0}return!1};function Ae(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}var Ix=n=>({tr:e,state:t,dispatch:r})=>{const i=Ae(n,t.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const c=s.before(o),u=s.after(o);e.delete(c,u).scrollIntoView()}return!0}return!1},Lx=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},Bx=n=>n.content?/^text(\*|\+)/.test(n.content):!1,vf=(n,e,t)=>{if(!n.parent.isInline||t==="left"&&n.pos>n.start()||t==="right"&&n.pos<n.end())return n.pos;const r=e.nodes[n.parent.type.name].spec;return Bx(r)?t==="left"?n.start()-1:n.end()+1:n.pos},_x=(n,e,t)=>{const r=vf(n,t,"left"),i=vf(e,t,"right");return{from:r,to:i}},zx=()=>({state:n,dispatch:e})=>{const{$from:t,$to:r}=n.selection;if(n.selection.empty)return!1;const{from:i,to:s}=_x(t,r,n.schema);return e&&(n.tr.deleteRange(i,s).scrollIntoView(),e(n.tr)),!0},$x=()=>({commands:n})=>n.keyboardShortcut("Enter"),jx=()=>({state:n,dispatch:e})=>wb(n,e);function Fl(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function Ms(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:Fl(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function ip(n,e,t={}){return n.find(r=>r.type===e&&Ms(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function Cf(n,e,t={}){return!!ip(n,e,t)}function Hl(n,e,t){if(!n||!e)return;let r=n.parent.childAfter(n.parentOffset);if((!r.node||!r.node.marks.some(u=>u.type===e))&&(r=n.parent.childBefore(n.parentOffset)),!r.node||!r.node.marks.some(u=>u.type===e))return;if(!t){const u=r.node.marks.find(d=>d.type===e);u&&(t=u.attrs)}if(!ip([...r.node.marks],e,t))return;let s=r.index,o=n.start()+r.offset,a=s+1,c=o+r.node.nodeSize;for(;s>0&&Cf([...n.parent.child(s-1).marks],e,t);)s-=1,o-=n.parent.child(s).nodeSize;for(;a<n.parent.childCount&&Cf([...n.parent.child(a).marks],e,t);)c+=n.parent.child(a).nodeSize,a+=1;return{from:o,to:c}}function Zt(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}var Fx=(n,e)=>({tr:t,state:r,dispatch:i})=>{const s=Zt(n,r.schema),{doc:o,selection:a}=t,{$from:c,from:u,to:d}=a;if(i){const p=Hl(c,s,e);if(p&&p.from<=u&&p.to>=d){const y=X.create(o,p.from,p.to);t.setSelection(y)}}return!0},Hx=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 sp(n){return n instanceof X}function Nn(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function op(n,e=null){if(!e)return null;const t=te.atStart(n),r=te.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const i=t.from,s=r.to;return e==="all"?X.create(n,Nn(0,i,s),Nn(n.content.size,i,s)):X.create(n,Nn(e,i,s),Nn(e,i,s))}function Ef(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function As(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Vx(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var qx=(n=null,e={})=>({editor:t,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(As()||Ef())&&r.dom.focus(),Vx()&&!As()&&!Ef()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&t.commands.scrollIntoView())})};try{if(r.hasFocus()&&n===null||n===!1)return!0}catch{return!1}if(s&&n===null&&!sp(t.state.selection))return o(),!0;const a=op(i.doc,n)||t.state.selection,c=t.state.selection.eq(a);return s&&(c||i.setSelection(a),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},Ux=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),Wx=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),ap=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&&ap(r)}return n};function Jr(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return ap(t)}function mi(n,e,t){if(n instanceof Ot||n instanceof j)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 j.fromArray(n.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(n);return t.errorOnInvalidContent&&o.check(),o}catch(s){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",s),mi("",e,t)}if(i){if(t.errorOnInvalidContent){let o=!1,a="";const c=new qd({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:u=>(o=!0,a=typeof u=="string"?u:u.outerHTML,null)}]}})});if(t.slice?Xt.fromSchema(c).parseSlice(Jr(n),t.parseOptions):Xt.fromSchema(c).parse(Jr(n),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=Xt.fromSchema(e);return t.slice?s.parseSlice(Jr(n),t.parseOptions).content:s.parse(Jr(n),t.parseOptions)}return mi("",e,t)}function Kx(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof Ee||i instanceof Ne))return;const s=n.mapping.maps[r];let o=0;s.forEach((a,c,u,d)=>{o===0&&(o=d)}),n.setSelection(te.near(n.doc.resolve(o),t))}var Jx=n=>!("type"in n),Gx=(n,e,t)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){t={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;const c=S=>{s.emit("contentError",{editor:s,error:S,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{mi(e,s.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(S){c(S)}try{a=mi(e,s.schema,{parseOptions:u,errorOnInvalidContent:(o=t.errorOnInvalidContent)!=null?o:s.options.enableContentCheck})}catch(S){return c(S),!1}let{from:d,to:p}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},y=!0,g=!0;if((Jx(a)?a:[a]).forEach(S=>{S.check(),y=y?S.isText&&S.marks.length===0:!1,g=g?S.isBlock:!1}),d===p&&g){const{parent:S}=r.doc.resolve(d);S.isTextblock&&!S.type.spec.code&&!S.childCount&&(d-=1,p+=1)}let T;if(y){if(Array.isArray(e))T=e.map(S=>S.text||"").join("");else if(e instanceof j){let S="";e.forEach(C=>{C.text&&(S+=C.text)}),T=S}else typeof e=="object"&&e&&e.text?T=e.text:T=e;r.insertText(T,d,p)}else{T=a;const S=r.doc.resolve(d),C=S.node(),I=S.parentOffset===0,_=C.isText||C.isTextblock,B=C.content.size>0;I&&_&&B&&g&&(d=Math.max(0,d-1)),r.replaceWith(d,p,T)}t.updateSelection&&Kx(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:T}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:T})}return!0},Xx=()=>({state:n,dispatch:e})=>bb(n,e),Qx=()=>({state:n,dispatch:e})=>kb(n,e),Yx=()=>({state:n,dispatch:e})=>fh(n,e),Zx=()=>({state:n,dispatch:e})=>mh(n,e),ew=()=>({state:n,dispatch:e,tr:t})=>{try{const r=mo(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},tw=()=>({state:n,dispatch:e,tr:t})=>{try{const r=mo(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},nw=()=>({state:n,dispatch:e})=>gb(n,e),rw=()=>({state:n,dispatch:e})=>yb(n,e);function lp(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function iw(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,s,o;for(let a=0;a<e.length-1;a+=1){const c=e[a];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))s=!0;else if(/^mod$/i.test(c))As()||lp()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return r&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),o&&(t=`Meta-${t}`),s&&(t=`Shift-${t}`),t}var sw=n=>({editor:e,view:t,tr:r,dispatch:i})=>{const s=iw(n).split(/-(?!$)/),o=s.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{t.someProp("handleKeyDown",u=>u(t,a))});return c==null||c.steps.forEach(u=>{const d=u.map(r.mapping);d&&i&&r.maybeStep(d)}),!0};function yn(n,e,t={}){const{from:r,to:i,empty:s}=n.selection,o=e?Ae(e,n.schema):null,a=[];n.doc.nodesBetween(r,i,(p,y)=>{if(p.isText)return;const g=Math.max(r,y),w=Math.min(i,y+p.nodeSize);a.push({node:p,from:g,to:w})});const c=i-r,u=a.filter(p=>o?o.name===p.node.type.name:!0).filter(p=>Ms(p.node.attrs,t,{strict:!1}));return s?!!u.length:u.reduce((p,y)=>p+y.to-y.from,0)>=c}var ow=(n,e={})=>({state:t,dispatch:r})=>{const i=Ae(n,t.schema);return yn(t,i,e)?xb(t,r):!1},aw=()=>({state:n,dispatch:e})=>kh(n,e),lw=n=>({state:e,dispatch:t})=>{const r=Ae(n,e.schema);return Db(r)(e,t)},cw=()=>({state:n,dispatch:e})=>yh(n,e);function So(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Mf(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}var uw=(n,e)=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const a=So(typeof n=="string"?n:n.name,r.schema);if(!a)return!1;a==="node"&&(s=Ae(n,r.schema)),a==="mark"&&(o=Zt(n,r.schema));let c=!1;return t.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(d,p)=>{s&&s===d.type&&(c=!0,i&&t.setNodeMarkup(p,void 0,Mf(d.attrs,e))),o&&d.marks.length&&d.marks.forEach(y=>{o===y.type&&(c=!0,i&&t.addMark(p,p+d.nodeSize,o.create(Mf(y.attrs,e))))})})}),c},fw=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),dw=()=>({tr:n,dispatch:e})=>{if(e){const t=new at(n.doc);n.setSelection(t)}return!0},hw=()=>({state:n,dispatch:e})=>hh(n,e),pw=()=>({state:n,dispatch:e})=>gh(n,e),mw=()=>({state:n,dispatch:e})=>vb(n,e),gw=()=>({state:n,dispatch:e})=>Mb(n,e),yw=()=>({state:n,dispatch:e})=>Eb(n,e);function el(n,e,t={},r={}){return mi(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}var bw=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:o,commands:a})=>{const{doc:c}=s;if(r.preserveWhitespace!=="full"){const u=el(n,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return o&&s.replaceWith(0,c.content.size,u).setMeta("preventUpdate",!t),!0}return o&&s.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:c.content.size},n,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function cp(n,e){const t=Zt(e,n.schema),{from:r,to:i,empty:s}=n.selection,o=[];s?(n.storedMarks&&o.push(...n.storedMarks),o.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,c=>{o.push(...c.marks)});const a=o.find(c=>c.type.name===t.name);return a?{...a.attrs}:{}}function up(n,e){const t=new oh(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function kw(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 xw(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,s)=>{t(i)&&r.push({node:i,pos:s})}),r}function ww(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 vo(n){return e=>ww(e.$from,n)}function W(n,e,t){return n.config[e]===void 0&&n.parent?W(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?W(n.parent,e,t):null}):n.config[e]}function Co(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},r=W(e,"addExtensions",t);return r?[e,...Co(r())]:e}).flat(10)}function Vl(n,e){const t=Jn.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}function fp(n){return typeof n=="function"}function ae(n,e=void 0,...t){return fp(n)?e?n.bind(e)(...t):n(...t):n}function Tw(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Cr(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 dp(n){const e=[],{nodeExtensions:t,markExtensions:r}=Cr(n),i=[...t,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=t.filter(u=>u.name!=="text").map(u=>u.name),a=r.map(u=>u.name),c=[...o,...a];return n.forEach(u=>{const d={name:u.name,options:u.options,storage:u.storage,extensions:i},p=W(u,"addGlobalAttributes",d);if(!p)return;p().forEach(g=>{let w;Array.isArray(g.types)?w=g.types:g.types==="*"?w=c:g.types==="nodes"?w=o:g.types==="marks"?w=a:w=[],w.forEach(T=>{Object.entries(g.attributes).forEach(([S,C])=>{e.push({type:T,name:S,attribute:{...s,...C}})})})})}),i.forEach(u=>{const d={name:u.name,options:u.options,storage:u.storage},p=W(u,"addAttributes",d);if(!p)return;const y=p();Object.entries(y).forEach(([g,w])=>{const T={...s,...w};typeof(T==null?void 0:T.default)=="function"&&(T.default=T.default()),T!=null&&T.isRequired&&(T==null?void 0:T.default)===void 0&&delete T.default,e.push({type:u.name,name:g,attribute:T})})}),e}function Sw(n){const e=[];let t="",r=!1,i=!1,s=0;const o=n.length;for(let a=0;a<o;a+=1){const c=n[a];if(c==="'"&&!i){r=!r,t+=c;continue}if(c==='"'&&!r){i=!i,t+=c;continue}if(!r&&!i){if(c==="("){s+=1,t+=c;continue}if(c===")"&&s>0){s-=1,t+=c;continue}if(c===";"&&s===0){e.push(t),t="";continue}}t+=c}return t&&e.push(t),e}function Af(n){const e=[],t=Sw(n||""),r=t.length;for(let i=0;i<r;i+=1){const s=t[i],o=s.indexOf(":");if(o===-1)continue;const a=s.slice(0,o).trim(),c=s.slice(o+1).trim();a&&c&&e.push([a,c])}return e}function Oe(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const a=s?String(s).split(" "):[],c=r[i]?r[i].split(" "):[],u=a.filter(d=>!c.includes(d));r[i]=[...c,...u].join(" ")}else if(i==="style"){const a=new Map([...Af(r[i]),...Af(s)]);r[i]=Array.from(a.entries()).map(([c,u])=>`${c}: ${u}`).join("; ")}else r[i]=s}),r},{})}function gi(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)=>Oe(t,r),{})}function vw(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function Of(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((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(t):vw(t.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...r,...i}}}}function Rf(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&Tw(t)?!1:t!=null))}function Nf(n){var e,t;const r={};return!((e=n==null?void 0:n.attribute)!=null&&e.isRequired)&&"default"in((n==null?void 0:n.attribute)||{})&&(r.default=n.attribute.default),((t=n==null?void 0:n.attribute)==null?void 0:t.validate)!==void 0&&(r.validate=n.attribute.validate),[n.name,r]}function hp(n,e){var t;const r=dp(n),{nodeExtensions:i,markExtensions:s}=Cr(n),o=(t=i.find(u=>W(u,"topNode")))==null?void 0:t.name,a=Object.fromEntries(i.map(u=>{const d=r.filter(C=>C.type===u.name),p={name:u.name,options:u.options,storage:u.storage,editor:e},y=n.reduce((C,I)=>{const _=W(I,"extendNodeSchema",p);return{...C,..._?_(u):{}}},{}),g=Rf({...y,content:ae(W(u,"content",p)),marks:ae(W(u,"marks",p)),group:ae(W(u,"group",p)),inline:ae(W(u,"inline",p)),atom:ae(W(u,"atom",p)),selectable:ae(W(u,"selectable",p)),draggable:ae(W(u,"draggable",p)),code:ae(W(u,"code",p)),whitespace:ae(W(u,"whitespace",p)),linebreakReplacement:ae(W(u,"linebreakReplacement",p)),defining:ae(W(u,"defining",p)),isolating:ae(W(u,"isolating",p)),attrs:Object.fromEntries(d.map(Nf))}),w=ae(W(u,"parseHTML",p));w&&(g.parseDOM=w.map(C=>Of(C,d)));const T=W(u,"renderHTML",p);T&&(g.toDOM=C=>T({node:C,HTMLAttributes:gi(C,d)}));const S=W(u,"renderText",p);return S&&(g.toText=S),[u.name,g]})),c=Object.fromEntries(s.map(u=>{const d=r.filter(S=>S.type===u.name),p={name:u.name,options:u.options,storage:u.storage,editor:e},y=n.reduce((S,C)=>{const I=W(C,"extendMarkSchema",p);return{...S,...I?I(u):{}}},{}),g=Rf({...y,inclusive:ae(W(u,"inclusive",p)),excludes:ae(W(u,"excludes",p)),group:ae(W(u,"group",p)),spanning:ae(W(u,"spanning",p)),code:ae(W(u,"code",p)),attrs:Object.fromEntries(d.map(Nf))}),w=ae(W(u,"parseHTML",p));w&&(g.parseDOM=w.map(S=>Of(S,d)));const T=W(u,"renderHTML",p);return T&&(g.toDOM=S=>T({mark:S,HTMLAttributes:gi(S,d)})),[u.name,g]}));return new qd({topNode:o,nodes:a,marks:c})}function Cw(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function kr(n){return n.sort((t,r)=>{const i=W(t,"priority")||100,s=W(r,"priority")||100;return i>s?-1:i<s?1:0})}function ql(n){const e=kr(Co(n)),t=Cw(e.map(r=>r.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function pp(n,e){const t=ql(n);return hp(t,e)}function Ew(n,e){const t=pp(e),r=Jr(n);return Xt.fromSchema(t).parse(r).toJSON()}function mp(n,e,t){const{from:r,to:i}=e,{blockSeparator:s=`
|
||
|
||
`,textSerializers:o={}}=t||{};let a="";return n.nodesBetween(r,i,(c,u,d,p)=>{var y;c.isBlock&&u>r&&(a+=s);const g=o==null?void 0:o[c.type.name];if(g)return d&&(a+=g({node:c,pos:u,parent:d,index:p,range:e})),!1;c.isText&&(a+=(y=c==null?void 0:c.text)==null?void 0:y.slice(Math.max(r,u)-u,i-u))}),a}function Mw(n,e){const t={from:0,to:n.content.size};return mp(n,t,e)}function gp(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Aw(n,e){const t=Ae(e,n.schema),{from:r,to:i}=n.selection,s=[];n.doc.nodesBetween(r,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===t.name);return o?{...o.attrs}:{}}function yp(n,e){const t=So(typeof e=="string"?e:e.name,n.schema);return t==="node"?Aw(n,e):t==="mark"?cp(n,e):{}}function Ow(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 Rw(n){const e=Ow(n);return e.length===1?e:e.filter((t,r)=>!e.filter((s,o)=>o!==r).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function bp(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((a,c)=>{o.push({from:a,to:c})});else{const{from:a,to:c}=t[s];if(a===void 0||c===void 0)return;o.push({from:a,to:c})}o.forEach(({from:a,to:c})=>{const u=e.slice(s).map(a,-1),d=e.slice(s).map(c),p=e.invert().map(u,-1),y=e.invert().map(d);r.push({oldRange:{from:p,to:y},newRange:{from:u,to:d}})})}),Rw(r)}function Ul(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const s=t.resolve(n),o=Hl(s,i.type);o&&r.push({mark:i,...o})}):t.nodesBetween(n,e,(i,s)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}var Nw=(n,e,t,r=20)=>{const i=n.doc.resolve(t);let s=r,o=null;for(;s>0&&o===null;){const a=i.node(s);(a==null?void 0:a.type.name)===e?o=a:s-=1}return[o,s]};function Fr(n,e){return e.nodes[n]||e.marks[n]||null}function ds(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}var Dw=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,a)=>{var c,u;const d=((u=(c=i.type.spec).toText)==null?void 0:u.call(c,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?d:d.slice(0,Math.max(0,r-s))}),t};function tl(n,e,t={}){const{empty:r,ranges:i}=n.selection,s=e?Zt(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(p=>s?s.name===p.type.name:!0).find(p=>Ms(p.attrs,t,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:p,$to:y})=>{const g=p.pos,w=y.pos;n.doc.nodesBetween(g,w,(T,S)=>{if(s&&T.inlineContent&&!T.type.allowsMarkType(s))return!1;if(!T.isText&&!T.marks.length)return;const C=Math.max(g,S),I=Math.min(w,S+T.nodeSize),_=I-C;o+=_,a.push(...T.marks.map(B=>({mark:B,from:C,to:I})))})}),o===0)return!1;const c=a.filter(p=>s?s.name===p.mark.type.name:!0).filter(p=>Ms(p.mark.attrs,t,{strict:!1})).reduce((p,y)=>p+y.to-y.from,0),u=a.filter(p=>s?p.mark.type!==s&&p.mark.type.excludes(s):!0).reduce((p,y)=>p+y.to-y.from,0);return(c>0?c+u:c)>=o}function Pw(n,e,t={}){if(!e)return yn(n,null,t)||tl(n,null,t);const r=So(e,n.schema);return r==="node"?yn(n,e,t):r==="mark"?tl(n,e,t):!1}var Iw=(n,e)=>{const{$from:t,$to:r,$anchor:i}=n.selection;if(e){const s=vo(a=>a.type.name===e)(n.selection);if(!s)return!1;const o=n.doc.resolve(s.pos+1);return i.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||t.pos!==r.pos)},Lw=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function Df(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function xa(n,e){const{nodeExtensions:t}=Cr(e),r=t.find(o=>o.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=ae(W(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function yi(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return!/\S/.test((r=n.text)!=null?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(s=>{i!==!1&&(yi(s,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function kp(n){return n instanceof J}var xp=class wp{constructor(e){this.position=e}static fromJSON(e){return new wp(e.position)}toJSON(){return{position:this.position}}};function Bw(n,e){const t=e.mapping.mapResult(n.position);return{position:new xp(t.pos),mapResult:t}}function _w(n){return new xp(n)}function zw(n,e,t){var r;const{selection:i}=e;let s=null;if(sp(i)&&(s=i.$cursor),s){const a=(r=n.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(t)&&(!!t.isInSet(a)||!a.some(u=>u.type.excludes(t)))}const{ranges:o}=i;return o.some(({$from:a,$to:c})=>{let u=a.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(a.pos,c.pos,(d,p,y)=>{if(u)return!1;if(d.isInline){const g=!y||y.type.allowsMarkType(t),w=!!t.isInSet(d.marks)||!d.marks.some(T=>T.type.excludes(t));u=g&&w}return!u}),u})}var $w=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:s}=t,{empty:o,ranges:a}=s,c=Zt(n,r.schema);if(i)if(o){const u=cp(r,c);t.addStoredMark(c.create({...u,...e}))}else a.forEach(u=>{const d=u.$from.pos,p=u.$to.pos;r.doc.nodesBetween(d,p,(y,g)=>{const w=Math.max(g,d),T=Math.min(g+y.nodeSize,p);y.marks.find(C=>C.type===c)?y.marks.forEach(C=>{c===C.type&&t.addMark(w,T,c.create({...C.attrs,...e}))}):t.addMark(w,T,c.create(e))})});return zw(r,t,c)},jw=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),Fw=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const s=Ae(n,t.schema);let o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:a})=>Vu(s,{...o,...e})(t)?!0:a.clearNodes()).command(({state:a})=>Vu(s,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Hw=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=Nn(n,0,r.content.size),s=J.create(r,i);e.setSelection(s)}return!0},Vw=(n,e)=>({tr:t,state:r,dispatch:i})=>{const{selection:s}=r;let o,a;return typeof e=="number"?(o=e,a=e):e&&"from"in e&&"to"in e?(o=e.from,a=e.to):(o=s.from,a=s.to),i&&t.doc.nodesBetween(o,a,(c,u)=>{c.isText||t.setNodeMarkup(u,void 0,{...c.attrs,dir:n})}),!0},qw=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:s}=typeof n=="number"?{from:n,to:n}:n,o=X.atStart(r).from,a=X.atEnd(r).to,c=Nn(i,o,a),u=Nn(s,o,a),d=X.create(r,c,u);e.setSelection(d)}return!0},Uw=n=>({state:e,dispatch:t})=>{const r=Ae(n,e.schema);return Lb(r)(e,t)};function Pf(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(i=>e==null?void 0:e.includes(i.type.name));n.tr.ensureMarks(r)}}var Ww=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:c}=s,u=i.extensionManager.attributes,d=ds(u,a.node().type.name,a.node().attrs);if(s instanceof J&&s.node.isBlock)return!a.parentOffset||!Qt(o,a.pos)?!1:(r&&(n&&Pf(t,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const p=c.parentOffset===c.parent.content.size,y=a.depth===0?void 0:kw(a.node(-1).contentMatchAt(a.indexAfter(-1)));let g=p&&y?[{type:y,attrs:d}]:void 0,w=Qt(e.doc,e.mapping.map(a.pos),1,g);if(!g&&!w&&Qt(e.doc,e.mapping.map(a.pos),1,y?[{type:y}]:void 0)&&(w=!0,g=y?[{type:y,attrs:d}]:void 0),r){if(w&&(s instanceof X&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,g),y&&!p&&!a.parentOffset&&a.parent.type!==y)){const T=e.mapping.map(a.before()),S=e.doc.resolve(T);a.node(-1).canReplaceWith(S.index(),S.index()+1,y)&&e.setNodeMarkup(e.mapping.map(a.before()),y)}n&&Pf(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return w},Kw=(n,e={})=>({tr:t,state:r,dispatch:i,editor:s})=>{var o;const a=Ae(n,r.schema),{$from:c,$to:u}=r.selection,d=r.selection.node;if(d&&d.isBlock||c.depth<2||!c.sameParent(u))return!1;const p=c.node(-1);if(p.type!==a)return!1;const y=s.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==a||c.index(-2)!==c.node(-2).childCount-1)return!1;if(i){let C=j.empty;const I=c.index(-1)?1:c.index(-2)?2:3;for(let q=c.depth-I;q>=c.depth-3;q-=1)C=j.from(c.node(q).copy(C));const _=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,B={...ds(y,c.node().type.name,c.node().attrs),...e},z=((o=a.contentMatch.defaultType)==null?void 0:o.createAndFill(B))||void 0;C=C.append(j.from(a.createAndFill(null,z)||void 0));const b=c.before(c.depth-(I-1));t.replace(b,c.after(-_),new V(C,4-I,0));let $=-1;t.doc.nodesBetween(b,t.doc.content.size,(q,H)=>{if($>-1)return!1;q.isTextblock&&q.content.size===0&&($=H+1)}),$>-1&&t.setSelection(X.near(t.doc.resolve($))),t.scrollIntoView()}return!0}const g=u.pos===c.end()?p.contentMatchAt(0).defaultType:null,w={...ds(y,p.type.name,p.attrs),...e},T={...ds(y,c.node().type.name,c.node().attrs),...e};t.delete(c.pos,u.pos);const S=g?[{type:a,attrs:w},{type:g,attrs:T}]:[{type:a,attrs:w}];if(!Qt(t.doc,c.pos,2))return!1;if(i){const{selection:C,storedMarks:I}=r,{splittableMarks:_}=s.extensionManager,B=I||C.$to.parentOffset&&C.$from.marks();if(t.split(c.pos,2,S).scrollIntoView(),!B||!i)return!0;const z=B.filter(b=>_.includes(b.type.name));t.ensureMarks(z)}return!0},wa=(n,e)=>{const t=vo(o=>o.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==null?void 0:i.type)&&bn(n.doc,t.pos)&&n.join(t.pos),!0},Ta=(n,e)=>{const t=vo(o=>o.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==null?void 0:i.type)&&bn(n.doc,r)&&n.join(r),!0};function Jw(n){const e=n.doc,t=e.firstChild;if(!t)return null;const r=e.resolve(1),i=e.resolve(t.nodeSize-1);return X.between(r,i)}var Gw=(n,e,t,r={})=>({editor:i,tr:s,state:o,dispatch:a,chain:c,commands:u,can:d})=>{const{extensions:p,splittableMarks:y}=i.extensionManager,g=Ae(n,o.schema),w=Ae(e,o.schema),{selection:T,storedMarks:S}=o,{$from:C,$to:I}=T,_=C.blockRange(I),B=S||T.$to.parentOffset&&T.$from.marks();if(!_)return!1;const z=vo(ue=>xa(ue.type.name,p))(T),b=T.from===0&&T.to===o.doc.content.size,$=o.doc.content.content,q=$.length===1?$[0]:null,H=b&&q&&xa(q.type.name,p)?{node:q,pos:0}:null,ee=z??H,ge=!!z&&_.depth>=1&&_.depth-z.depth<=1,Se=!!H;if((ge||Se)&&ee){if(ee.node.type===g)return b&&Se?c().command(({tr:ue,dispatch:se})=>{const fe=Jw(ue);return fe?(ue.setSelection(fe),se&&se(ue),!0):!1}).liftListItem(w).run():u.liftListItem(w);if(xa(ee.node.type.name,p)&&g.validContent(ee.node.content))return c().command(()=>(s.setNodeMarkup(ee.pos,g),!0)).command(()=>wa(s,g)).command(()=>Ta(s,g)).run()}return!t||!B||!a?c().command(()=>d().wrapInList(g,r)?!0:u.clearNodes()).wrapInList(g,r).command(()=>wa(s,g)).command(()=>Ta(s,g)).run():c().command(()=>{const ue=d().wrapInList(g,r),se=B.filter(fe=>y.includes(fe.type.name));return s.ensureMarks(se),ue?!0:u.clearNodes()}).wrapInList(g,r).command(()=>wa(s,g)).command(()=>Ta(s,g)).run()},Xw=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,o=Zt(n,r.schema);return tl(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},Qw=(n,e,t={})=>({state:r,commands:i})=>{const s=Ae(n,r.schema),o=Ae(e,r.schema),a=yn(r,s,t);let c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),a?i.setNode(o,c):i.setNode(s,{...c,...t})},Yw=(n,e={})=>({state:t,commands:r})=>{const i=Ae(n,t.schema);return yn(t,i,e)?r.lift(i):r.wrapIn(i,e)},Zw=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const i=t[r];let s;if(i.spec.isInputRules&&(s=i.getState(n))){if(e){const o=n.tr,a=s.transform;for(let c=a.steps.length-1;c>=0;c-=1)o.step(a.steps[c].invert(a.docs[c]));if(s.text){const c=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,n.schema.text(s.text,c))}else o.delete(s.from,s.to)}return!0}}return!1},e1=(n={})=>({tr:e,dispatch:t,editor:r})=>{const{ignoreClearable:i=!1}=n,{selection:s}=e,{empty:o,ranges:a}=s;if(o)return!0;const{nonClearableMarks:c}=r.extensionManager;if(t){const u=Object.values(r.schema.marks).filter(d=>i||!c.includes(d.name));a.forEach(d=>{for(const p of u)e.removeMark(d.$from.pos,d.$to.pos,p)})}return!0},t1=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=t,c=Zt(n,r.schema),{$from:u,empty:d,ranges:p}=a;if(!i)return!0;if(d&&o){let{from:y,to:g}=a;const w=(s=u.marks().find(S=>S.type===c))==null?void 0:s.attrs,T=Hl(u,c,w);T&&(y=T.from,g=T.to),t.removeMark(y,g,c)}else p.forEach(y=>{t.removeMark(y.$from.pos,y.$to.pos,c)});return t.removeStoredMark(c),!0},n1=n=>({tr:e,state:t,dispatch:r})=>{const{selection:i}=t;let s,o;return typeof n=="number"?(s=n,o=n):n&&"from"in n&&"to"in n?(s=n.from,o=n.to):(s=i.from,o=i.to),r&&e.doc.nodesBetween(s,o,(a,c)=>{if(a.isText)return;const u={...a.attrs};delete u.dir,e.setNodeMarkup(c,void 0,u)}),!0},r1=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const a=So(typeof n=="string"?n:n.name,r.schema);if(!a)return!1;a==="node"&&(s=Ae(n,r.schema)),a==="mark"&&(o=Zt(n,r.schema));let c=!1;return t.selection.ranges.forEach(u=>{const d=u.$from.pos,p=u.$to.pos;let y,g,w,T;t.selection.empty?r.doc.nodesBetween(d,p,(S,C)=>{s&&s===S.type&&(c=!0,w=Math.max(C,d),T=Math.min(C+S.nodeSize,p),y=C,g=S)}):r.doc.nodesBetween(d,p,(S,C)=>{C<d&&s&&s===S.type&&(c=!0,w=Math.max(C,d),T=Math.min(C+S.nodeSize,p),y=C,g=S),C>=d&&C<=p&&(s&&s===S.type&&(c=!0,i&&t.setNodeMarkup(C,void 0,{...S.attrs,...e})),o&&S.marks.length&&S.marks.forEach(I=>{if(o===I.type&&(c=!0,i)){const _=Math.max(C,d),B=Math.min(C+S.nodeSize,p);t.addMark(_,B,o.create({...I.attrs,...e}))}}))}),g&&(y!==void 0&&i&&t.setNodeMarkup(y,void 0,{...g.attrs,...e}),o&&g.marks.length&&g.marks.forEach(S=>{o===S.type&&i&&t.addMark(w,T,o.create({...S.attrs,...e}))}))}),c},i1=(n,e={})=>({state:t,dispatch:r})=>{const i=Ae(n,t.schema);return Ab(i,e)(t,r)},s1=(n,e={})=>({state:t,dispatch:r})=>{const i=Ae(n,t.schema);return Ob(i,e)(t,r)},o1=class{constructor(){this.callbacks={}}on(n,e){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(e),this}emit(n,...e){const t=this.callbacks[n];return t&&t.forEach(r=>r.apply(this,e)),this}off(n,e){const t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(r=>r!==e):delete this.callbacks[n]),this}once(n,e){const t=(...r)=>{this.off(n,t),e.apply(this,r)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}},Eo=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},a1=(n,e)=>{if(Fl(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 Gi(n){var e;const{editor:t,from:r,to:i,text:s,rules:o,plugin:a}=n,{view:c}=t;if(c.composing)return!1;const u=c.state.doc.resolve(r);if(u.parent.type.spec.code||(e=u.nodeBefore||u.nodeAfter)!=null&&e.marks.find(y=>y.type.spec.code))return!1;let d=!1;const p=Dw(u)+s;return o.forEach(y=>{if(d)return;const g=a1(p,y.find);if(!g)return;const w=c.state.tr,T=wo({state:c.state,transaction:w}),S={from:r-(g[0].length-s.length),to:i},{commands:C,chain:I,can:_}=new To({editor:t,state:T});y.handler({state:T,range:S,match:g,commands:C,chain:I,can:_})===null||!w.steps.length||(y.undoable&&w.setMeta(a,{transform:w,from:r,to:i,text:s}),c.dispatch(w),d=!0)}),d}function l1(n){const{editor:e,rules:t}=n,r=new ke({state:{init(){return null},apply(i,s,o){const a=i.getMeta(r);if(a)return a;const c=i.getMeta("applyInputRules");return!!c&&setTimeout(()=>{let{text:d}=c;typeof d=="string"?d=d:d=Vl(j.from(d),o.schema);const{from:p}=c,y=p+d.length;Gi({editor:e,from:p,to:y,text:d,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return Gi({editor:e,from:s,to:o,text:a,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Gi({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?Gi({editor:e,from:o.pos,to:o.pos,text:`
|
||
`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function c1(n){return Object.prototype.toString.call(n).slice(8,-1)}function Xi(n){return c1(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Tp(n,e){const t={...n};return Xi(n)&&Xi(e)&&Object.keys(e).forEach(r=>{Xi(e[r])&&Xi(n[r])?t[r]=Tp(n[r],e[r]):t[r]=e[r]}),t}var Wl=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{...ae(W(this,"addOptions",{name:this.name}))}}get storage(){return{...ae(W(this,"addStorage",{name:this.name,options:this.options}))}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>Tp(this.options,n)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(n={}){const e=new this.constructor({...this.config,...n});return e.parent=this,this.child=e,e.name="name"in n?n.name:e.parent.name,e}},Gn=class Sp extends Wl{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new Sp(t)}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(u=>(u==null?void 0:u.type.name)===t.name))return!1;const c=o.find(u=>(u==null?void 0:u.type.name)===t.name);return c&&r.removeStoredMark(c),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function u1(n){return typeof n=="number"}var f1=class{constructor(n){this.find=n.find,this.handler=n.handler}},d1=(n,e,t)=>{if(Fl(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=n,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function h1(n){const{editor:e,state:t,from:r,to:i,rule:s,pasteEvent:o,dropEvent:a}=n,{commands:c,chain:u,can:d}=new To({editor:e,state:t}),p=[];return t.doc.nodesBetween(r,i,(g,w)=>{var T,S,C,I,_;if((S=(T=g.type)==null?void 0:T.spec)!=null&&S.code||!(g.isText||g.isTextblock||g.isInline))return;const B=(_=(I=(C=g.content)==null?void 0:C.size)!=null?I:g.nodeSize)!=null?_:0,z=Math.max(r,w),b=Math.min(i,w+B);if(z>=b)return;const $=g.isText?g.text||"":g.textBetween(z-w,b-w,void 0,"");d1($,s.find,o).forEach(H=>{if(H.index===void 0)return;const ee=z+H.index+1,ge=ee+H[0].length,Se={from:t.tr.mapping.map(ee),to:t.tr.mapping.map(ge)},ue=s.handler({state:t,range:Se,match:H,commands:c,chain:u,can:d,pasteEvent:o,dropEvent:a});p.push(ue)})}),p.every(g=>g!==null)}var Qi=null,p1=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function m1(n){const{editor:e,rules:t}=n;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const c=({state:d,from:p,to:y,rule:g,pasteEvt:w})=>{const T=d.tr,S=wo({state:d,transaction:T});if(!(!h1({editor:e,state:S,from:Math.max(p-1,0),to:y.b-1,rule:g,pasteEvent:w,dropEvent:a})||!T.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,T}};return t.map(d=>new ke({view(p){const y=w=>{var T;r=(T=p.dom.parentElement)!=null&&T.contains(w.target)?p.dom.parentElement:null,r&&(Qi=e)},g=()=>{Qi&&(Qi=null)};return window.addEventListener("dragstart",y),window.addEventListener("dragend",g),{destroy(){window.removeEventListener("dragstart",y),window.removeEventListener("dragend",g)}}},props:{handleDOMEvents:{drop:(p,y)=>{if(s=r===p.dom.parentElement,a=y,!s){const g=Qi;g!=null&&g.isEditable&&setTimeout(()=>{const w=g.state.selection;w&&g.commands.deleteRange({from:w.from,to:w.to})},10)}return!1},paste:(p,y)=>{var g;const w=(g=y.clipboardData)==null?void 0:g.getData("text/html");return o=y,i=!!(w!=null&&w.includes("data-pm-slice")),!1}}},appendTransaction:(p,y,g)=>{const w=p[0],T=w.getMeta("uiEvent")==="paste"&&!i,S=w.getMeta("uiEvent")==="drop"&&!s,C=w.getMeta("applyPasteRules"),I=!!C;if(!T&&!S&&!I)return;if(I){let{text:z}=C;typeof z=="string"?z=z:z=Vl(j.from(z),g.schema);const{from:b}=C,$=b+z.length,q=p1(z);return c({rule:d,state:g,from:b,to:{b:$},pasteEvt:q})}const _=y.doc.content.findDiffStart(g.doc.content),B=y.doc.content.findDiffEnd(g.doc.content);if(!(!u1(_)||!B||_===B.b))return c({rule:d,state:g,from:_,to:B,pasteEvt:o})}}))}var Mo=class{constructor(n,e){this.splittableMarks=[],this.nonClearableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=ql(n),this.schema=hp(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Fr(e.name,this.schema)},r=W(e,"addCommands",t);return r?{...n,...r()}:n},{})}get plugins(){const{editor:n}=this;return kr([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:Fr(r.name,this.schema)},s=[],o=W(r,"addKeyboardShortcuts",i);let a={};if(r.type==="mark"&&W(r,"exitable",i)&&(a.ArrowRight=()=>Gn.handleExit({editor:n,mark:r})),o){const y=Object.fromEntries(Object.entries(o()).map(([g,w])=>[g,()=>w({editor:n})]));a={...a,...y}}const c=Cx(a);s.push(c);const u=W(r,"addInputRules",i);if(Df(r,n.options.enableInputRules)&&u){const y=u();if(y&&y.length){const g=l1({editor:n,rules:y}),w=Array.isArray(g)?g:[g];s.push(...w)}}const d=W(r,"addPasteRules",i);if(Df(r,n.options.enablePasteRules)&&d){const y=d();if(y&&y.length){const g=m1({editor:n,rules:y});s.push(...g)}}const p=W(r,"addProseMirrorPlugins",i);if(p){const y=p();s.push(...y)}return s})}get attributes(){return dp(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=Cr(this.extensions);return Object.fromEntries(e.filter(t=>!!W(t,"addNodeView")).map(t=>{const r=this.attributes.filter(c=>c.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:Ae(t.name,this.schema)},s=W(t,"addNodeView",i);if(!s)return[];const o=s();if(!o)return[];const a=(c,u,d,p,y)=>{const g=gi(c,r);return o({node:c,view:u,getPos:d,decorations:p,innerDecorations:y,editor:n,extension:t,HTMLAttributes:g})};return[t.name,a]}))}dispatchTransaction(n){const{editor:e}=this;return kr([...this.extensions].reverse()).reduceRight((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Fr(i.name,this.schema)},o=W(i,"dispatchTransaction",s);return o?a=>{o.call(s,{transaction:a,next:r})}:r},n)}transformPastedHTML(n){const{editor:e}=this;return kr([...this.extensions]).reduce((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Fr(i.name,this.schema)},o=W(i,"transformPastedHTML",s);return o?(a,c)=>{const u=r(a,c);return o.call(s,u)}:r},n||(r=>r))}get markViews(){const{editor:n}=this,{markExtensions:e}=Cr(this.extensions);return Object.fromEntries(e.filter(t=>!!W(t,"addMarkView")).map(t=>{const r=this.attributes.filter(a=>a.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:Zt(t.name,this.schema)},s=W(t,"addMarkView",i);if(!s)return[];const o=(a,c,u)=>{const d=gi(a,r);return s()({mark:a,view:c,inline:u,editor:n,extension:t,HTMLAttributes:d,updateAttributes:p=>{N1(a,n,p)}})};return[t.name,o]}))}destroy(){this.extensions.forEach(n=>{let e=n;for(;e.parent;){const t=e.parent;t.child===e&&(t.child=null),e=t}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{var t,r;const i={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Fr(e.name,this.schema)};e.type==="mark"&&(((t=ae(W(e,"keepOnSplit",i)))==null||t)&&this.splittableMarks.push(e.name),(r=ae(W(e,"clearable",i)))==null||r||this.nonClearableMarks.push(e.name));const s=W(e,"onBeforeCreate",i),o=W(e,"onCreate",i),a=W(e,"onUpdate",i),c=W(e,"onSelectionUpdate",i),u=W(e,"onTransaction",i),d=W(e,"onFocus",i),p=W(e,"onBlur",i),y=W(e,"onDestroy",i);s&&this.editor.on("beforeCreate",s),o&&this.editor.on("create",o),a&&this.editor.on("update",a),c&&this.editor.on("selectionUpdate",c),u&&this.editor.on("transaction",u),d&&this.editor.on("focus",d),p&&this.editor.on("blur",p),y&&this.editor.on("destroy",y)})}};Mo.resolve=ql;Mo.sort=kr;Mo.flatten=Co;var g1={};jl(g1,{ClipboardTextSerializer:()=>Cp,Commands:()=>Ep,Delete:()=>Mp,Drop:()=>Ap,Editable:()=>Op,FocusEvents:()=>Np,Keymap:()=>Dp,Paste:()=>Pp,Tabindex:()=>Ip,TextDirection:()=>Lp,focusEventsPluginKey:()=>Rp});var xe=class vp extends Wl{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new vp(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},Cp=xe.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ke({key:new Re("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,s=gp(t),{blockSeparator:o}=this.options,a={...o!==void 0?{blockSeparator:o}:{},textSerializers:s};return[...i.ranges].sort((u,d)=>u.$from.pos-d.$from.pos).map(({$from:u,$to:d})=>mp(r,{from:u.pos,to:d.pos},a)).join(o??`
|
||
|
||
`)}}})]}}),Ep=xe.create({name:"commands",addCommands(){return{...vt}}}),Mp=xe.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,r,i;const s=()=>{var o,a,c,u;if((u=(c=(a=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:a.filterTransaction)==null?void 0:c.call(a,n))!=null?u:n.getMeta("y-sync$"))return;const d=up(n.before,[n,...e]);bp(d).forEach(g=>{d.mapping.mapResult(g.oldRange.from).deletedAfter&&d.mapping.mapResult(g.oldRange.to).deletedBefore&&d.before.nodesBetween(g.oldRange.from,g.oldRange.to,(w,T)=>{const S=T+w.nodeSize-2,C=g.oldRange.from<=T&&S<=g.oldRange.to;this.editor.emit("delete",{type:"node",node:w,from:T,to:S,newFrom:d.mapping.map(T),newTo:d.mapping.map(S),deletedRange:g.oldRange,newRange:g.newRange,partial:!C,editor:this.editor,transaction:n,combinedTransform:d})})});const y=d.mapping;d.steps.forEach((g,w)=>{var T,S;if(g instanceof At){const C=y.slice(w).map(g.from,-1),I=y.slice(w).map(g.to),_=y.invert().map(C,-1),B=y.invert().map(I),z=C>0?(T=d.doc.nodeAt(C-1))==null?void 0:T.marks.some($=>$.eq(g.mark)):!1,b=(S=d.doc.nodeAt(I))==null?void 0:S.marks.some($=>$.eq(g.mark));this.editor.emit("delete",{type:"mark",mark:g.mark,from:g.from,to:g.to,deletedRange:{from:_,to:B},newRange:{from:C,to:I},partial:!!(b||z),editor:this.editor,transaction:n,combinedTransform:d})}})};(i=(r=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:r.async)==null||i?setTimeout(s,0):s()}}),Ap=xe.create({name:"drop",addProseMirrorPlugins(){return[new ke({key:new Re("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),Op=xe.create({name:"editable",addProseMirrorPlugins(){return[new ke({key:new Re("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Rp=new Re("focusEvents"),Np=xe.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new ke({key:Rp,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}}}})]}}),Dp=xe.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:c,doc:u}=a,{empty:d,$anchor:p}=c,{pos:y,parent:g}=p,w=p.parent.isTextblock&&y>0?a.doc.resolve(y-1):p,T=w.parent.type.spec.isolating,S=p.pos-p.parentOffset,C=T&&w.parent.childCount===1?S===p.pos:te.atStart(u).from===y;return!d||!g.type.isTextblock||g.textContent.length||!C||C&&p.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...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 As()||lp()?s:i},addProseMirrorPlugins(){return[new ke({key:new Re("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(T=>T.getMeta("composition")))return;const r=n.some(T=>T.docChanged)&&!e.doc.eq(t.doc),i=n.some(T=>T.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:a}=e.selection,c=te.atStart(e.doc).from,u=te.atEnd(e.doc).to;if(s||!(o===c&&a===u)||!yi(t.doc))return;const y=t.tr,g=wo({state:t,transaction:y}),{commands:w}=new To({editor:this.editor,state:g});if(w.clearNodes(),!!y.steps.length)return y}})]}}),Pp=xe.create({name:"paste",addProseMirrorPlugins(){return[new ke({key:new Re("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),Ip=xe.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new ke({key:new Re("tabindex"),props:{attributes:()=>{var n;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(n=this.options.value)!=null?n:"0"}}}})]}}),Lp=xe.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=Cr(this.extensions);return[{types:n.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return t&&(t==="ltr"||t==="rtl"||t==="auto")?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new ke({key:new Re("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}}),y1=class Gr{constructor(e,t,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new Gr(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Gr(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Gr(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const i=t.isBlock&&!t.isTextblock,s=t.isAtom&&!t.isText,o=t.isInline,a=this.pos+r+(s?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const c=this.resolvedPos.doc.resolve(a);if(!i&&!o&&c.depth<=this.depth)return;const u=new Gr(c,this.editor,i,i||o?t:null);i&&(u.actualDepth=this.depth+1),e.push(u)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(t).length>0){const s=i.node.attrs,o=Object.keys(t);for(let a=0;a<o.length;a+=1){const c=o[a];if(s[c]!==t[c])break}}else r=i;i=i.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(t);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(c=>t[c]===o.node.attrs[c])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,t,r))))}),i}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},b1=`.ProseMirror {
|
||
position: relative;
|
||
}
|
||
|
||
.ProseMirror {
|
||
word-wrap: break-word;
|
||
white-space: pre-wrap;
|
||
white-space: break-spaces;
|
||
-webkit-font-variant-ligatures: none;
|
||
font-variant-ligatures: none;
|
||
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
||
}
|
||
|
||
.ProseMirror [contenteditable="false"] {
|
||
white-space: normal;
|
||
}
|
||
|
||
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
||
white-space: pre-wrap;
|
||
}
|
||
|
||
.ProseMirror pre {
|
||
white-space: pre-wrap;
|
||
}
|
||
|
||
img.ProseMirror-separator {
|
||
display: inline !important;
|
||
border: none !important;
|
||
margin: 0 !important;
|
||
width: 0 !important;
|
||
height: 0 !important;
|
||
}
|
||
|
||
.ProseMirror-gapcursor {
|
||
display: none;
|
||
pointer-events: none;
|
||
position: absolute;
|
||
margin: 0;
|
||
}
|
||
|
||
.ProseMirror-gapcursor:after {
|
||
content: "";
|
||
display: block;
|
||
position: absolute;
|
||
top: -2px;
|
||
width: 20px;
|
||
border-top: 1px solid black;
|
||
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
||
}
|
||
|
||
@keyframes ProseMirror-cursor-blink {
|
||
to {
|
||
visibility: hidden;
|
||
}
|
||
}
|
||
|
||
.ProseMirror-hideselection *::selection {
|
||
background: transparent;
|
||
}
|
||
|
||
.ProseMirror-hideselection *::-moz-selection {
|
||
background: transparent;
|
||
}
|
||
|
||
.ProseMirror-hideselection * {
|
||
caret-color: transparent;
|
||
}
|
||
|
||
.ProseMirror-focused .ProseMirror-gapcursor {
|
||
display: block;
|
||
}`;function k1(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(i),i}var x1=class extends o1{constructor(n={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Bw,createMappablePosition:_w},this.setOptions(n),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:i,moved:s})=>this.options.onDrop(r,i,s)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const e=this.createDoc(),t=op(e,this.options.autofocus);this.editorState=gr.create({doc:e,schema:this.schema,selection:t||void 0}),this.options.element&&this.mount(this.options.element)}mount(n){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(n),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const n=this.editorView.dom;n!=null&&n.editor&&delete n.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(n){console.warn("Failed to remove CSS element:",n)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=k1(b1,this.options.injectNonce))}setOptions(n={}){this.options={...this.options,...n},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(n,e=!0){this.setOptions({editable:n}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:n=>{this.editorState=n},dispatch:n=>{this.dispatchTransaction(n)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(n,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in n)return Reflect.get(n,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(n,e){const t=fp(e)?e(n,[...this.state.plugins]):[...this.state.plugins,n],r=this.state.reconfigure({plugins:t});return this.view.updateState(r),r}unregisterPlugin(n){if(this.isDestroyed)return;const e=this.state.plugins;let t=e;if([].concat(n).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;t=t.filter(o=>!o.key.startsWith(s))}),e.length===t.length)return;const r=this.state.reconfigure({plugins:t});return this.view.updateState(r),r}createExtensionManager(){var n,e,t,r;const s=[...this.options.enableCoreExtensions?[Op,Cp.configure({blockSeparator:(e=(n=this.options.coreExtensionOptions)==null?void 0:n.clipboardTextSerializer)==null?void 0:e.blockSeparator}),Ep,Np,Dp,Ip.configure({value:(r=(t=this.options.coreExtensionOptions)==null?void 0:t.tabindex)==null?void 0:r.value}),Ap,Pp,Mp,Lp.configure({direction:this.options.textDirection})].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o==null?void 0:o.type));this.extensionManager=new Mo(s,this)}createCommandManager(){this.commandManager=new To({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let n;try{n=el(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(t=>t.name!=="collaboration"),this.createExtensionManager()}}),n=el(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return n}createView(n){const{editorProps:e,enableExtensionDispatchTransaction:t}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),i=t?this.extensionManager.dispatchTransaction(r):r,s=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(s);this.editorView=new np(n,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS();const c=this.view.dom;c.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(n){this.isCapturingTransaction=!0,n(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(n){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=n;return}n.steps.forEach(u=>{var d;return(d=this.capturedTransaction)==null?void 0:d.step(u)});return}const{state:e,transactions:t}=this.state.applyTransaction(n),r=!this.state.selection.eq(e.selection),i=t.includes(n),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:n,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:n,appendedTransactions:t.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:n});const o=t.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),a=o==null?void 0:o.getMeta("focus"),c=o==null?void 0:o.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:o}),c&&this.emit("blur",{editor:this,event:c.event,transaction:o}),!(n.getMeta("preventUpdate")||!t.some(u=>u.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:n,appendedTransactions:t.slice(1)})}getAttributes(n){return yp(this.state,n)}isActive(n,e){const t=typeof n=="string"?n:null,r=typeof n=="string"?e:n;return Pw(this.state,t,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Vl(this.state.doc.content,this.schema)}getText(n){const{blockSeparator:e=`
|
||
|
||
`,textSerializers:t={}}=n||{};return Mw(this.state.doc,{blockSeparator:e,textSerializers:{...gp(this.schema),...t}})}get isEmpty(){return yi(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var n,e;return(e=(n=this.editorView)==null?void 0:n.isDestroyed)!=null?e:!0}$node(n,e){var t;return((t=this.$doc)==null?void 0:t.querySelector(n,e))||null}$nodes(n,e){var t;return((t=this.$doc)==null?void 0:t.querySelectorAll(n,e))||null}$pos(n){const e=this.state.doc.resolve(n),t=n>0&&e.nodeAfter&&!e.nodeAfter.isText?e.nodeAfter:null;return new y1(e,this,!1,t)}get $doc(){return this.$pos(0)}};function Er(n){return new Eo({find:n.find,handler:({state:e,range:t,match:r})=>{const i=ae(n.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],a=r[0];if(o){const c=a.search(/\S/),u=t.from+a.indexOf(o),d=u+o.length;if(Ul(t.from,t.to,e.doc).filter(g=>g.mark.type.excluded.find(T=>T===n.type&&T!==g.mark.type)).filter(g=>g.to>u).length)return null;d<t.to&&s.delete(d,t.to),u>t.from&&s.delete(t.from+c,u);const y=t.from+c+o.length;s.addMark(t.from+c,y,n.type.create(i||{})),s.removeStoredMark(n.type)}},undoable:n.undoable})}function w1(n){return new Eo({find:n.find,handler:({state:e,range:t,match:r})=>{const i=ae(n.getAttributes,void 0,r)||{},{tr:s}=e,o=t.from;let a=t.to;const c=n.type.create(i);if(r[1]){const u=r[0].lastIndexOf(r[1]);let d=o+u;d>a?d=a:a=d+r[1].length;const p=r[0][r[0].length-1];s.insertText(p,o+r[0].length-1),s.replaceWith(d,a,c)}else if(r[0]){const u=n.type.isInline?o:o-1;s.insert(u,n.type.create(i)).delete(s.mapping.map(o),s.mapping.map(a))}s.scrollIntoView()},undoable:n.undoable})}function nl(n){return new Eo({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),s=ae(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,s)},undoable:n.undoable})}function Mr(n){return new Eo({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const s=ae(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),c=o.doc.resolve(t.from).blockRange(),u=c&&Cl(c,n.type,s);if(!u)return null;if(o.wrap(c,u),n.keepMarks&&n.editor){const{selection:p,storedMarks:y}=e,{splittableMarks:g}=n.editor.extensionManager,w=y||p.$to.parentOffset&&p.$from.marks();if(w){const T=w.filter(S=>g.includes(S.type.name));o.ensureMarks(T)}}if(n.keepAttributes){const p=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(p,s).run()}const d=o.doc.resolve(t.from-1).nodeBefore;d&&d.type===n.type&&bn(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,d))&&o.join(t.from-1)},undoable:n.undoable})}function Ar(n,e){if(n===e)return!0;if(!n||!e)return!1;const t=Object.keys(n),r=Object.keys(e);return t.length!==r.length?!1:t.every(i=>Object.prototype.hasOwnProperty.call(e,i)&&Object.is(n[i],e[i]))}function T1(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof J){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let i=r.depth;for(;i>=0;){const s=r.index(i);if(r.node(i).contentMatchAt(s).matchType(e))return!0;i-=1}return!1}function If(n){return n.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&")}function S1(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}var v1={};jl(v1,{createAtomBlockMarkdownSpec:()=>C1,createBlockMarkdownSpec:()=>E1,createInlineMarkdownSpec:()=>O1,parseAttributes:()=>Kl,parseIndentedBlocks:()=>rl,renderNestedMarkdownContent:()=>Gl,serializeAttributes:()=>Jl});function Kl(n){if(!(n!=null&&n.trim()))return{};const e={},t=[],r=n.replace(/["']([^"']*)["']/g,u=>(t.push(u),`__QUOTED_${t.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const u=i.map(d=>d.trim().slice(1));e.class=u.join(" ")}const s=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,u,d])=>{var p;const y=parseInt(((p=d.match(/__QUOTED_(\d+)__/))==null?void 0:p[1])||"0",10),g=t[y];g&&(e[u]=g.slice(1,-1))});const c=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return c&&c.split(/\s+/).filter(Boolean).forEach(d=>{d.match(/^[a-zA-Z][\w-]*$/)&&(e[d]=!0)}),e}function Jl(n){if(!n||Object.keys(n).length===0)return"";const e=[];return n.class&&String(n.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),n.id&&e.push(`#${n.id}`),Object.entries(n).forEach(([t,r])=>{t==="class"||t==="id"||(r===!0?e.push(t):r!==!1&&r!=null&&e.push(`${t}="${String(r)}"`))}),e.join(" ")}function C1(n){const{nodeName:e,name:t,parseAttributes:r=Kl,serializeAttributes:i=Jl,defaultAttributes:s={},requiredAttributes:o=[],allowedAttributes:a}=n,c=t||e,u=d=>{if(!a)return d;const p={};return a.forEach(y=>{y in d&&(p[y]=d[y])}),p};return{parseMarkdown:(d,p)=>{const y={...s,...d.attributes};return p.createNode(e,y,[])},markdownTokenizer:{name:e,level:"block",start(d){var p;const y=new RegExp(`^:::${c}(?:\\s|$)`,"m"),g=(p=d.match(y))==null?void 0:p.index;return g!==void 0?g:-1},tokenize(d,p,y){const g=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),w=d.match(g);if(!w)return;const T=w[1]||"",S=r(T);if(!o.find(I=>!(I in S)))return{type:e,raw:w[0],attributes:S}}},renderMarkdown:d=>{const p=u(d.attrs||{}),y=i(p),g=y?` {${y}}`:"";return`:::${c}${g} :::`}}}function E1(n){const{nodeName:e,name:t,getContent:r,parseAttributes:i=Kl,serializeAttributes:s=Jl,defaultAttributes:o={},content:a="block",allowedAttributes:c}=n,u=t||e,d=p=>{if(!c)return p;const y={};return c.forEach(g=>{g in p&&(y[g]=p[g])}),y};return{parseMarkdown:(p,y)=>{let g;if(r){const T=r(p);g=typeof T=="string"?[{type:"text",text:T}]:T}else a==="block"?g=y.parseChildren(p.tokens||[]):g=y.parseInline(p.tokens||[]);const w={...o,...p.attributes};return y.createNode(e,w,g)},markdownTokenizer:{name:e,level:"block",start(p){var y;const g=new RegExp(`^:::${u}`,"m"),w=(y=p.match(g))==null?void 0:y.index;return w!==void 0?w:-1},tokenize(p,y,g){var w;const T=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),S=p.match(T);if(!S)return;const[C,I=""]=S,_=i(I);let B=1;const z=C.length;let b="";const $=/^:::([\w-]*)(\s.*)?/gm,q=p.slice(z);for($.lastIndex=0;;){const H=$.exec(q);if(H===null)break;const ee=H.index,ge=H[1];if(!((w=H[2])!=null&&w.endsWith(":::"))){if(ge)B+=1;else if(B-=1,B===0){const Se=q.slice(0,ee);b=Se.trim();const ue=p.slice(0,z+ee+H[0].length);let se=[];if(b)if(a==="block")for(se=g.blockTokens(Se),se.forEach(fe=>{fe.text&&(!fe.tokens||fe.tokens.length===0)&&(fe.tokens=g.inlineTokens(fe.text))});se.length>0;){const fe=se[se.length-1];if(fe.type==="paragraph"&&(!fe.text||fe.text.trim()===""))se.pop();else break}else se=g.inlineTokens(b);return{type:e,raw:ue,attributes:_,content:b,tokens:se}}}}}},renderMarkdown:(p,y)=>{const g=d(p.attrs||{}),w=s(g),T=w?` {${w}}`:"",S=y.renderChildren(p.content||[],`
|
||
|
||
`);return`:::${u}${T}
|
||
|
||
${S}
|
||
|
||
:::`}}}function M1(n){if(!n.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=t.exec(n);for(;r!==null;){const[,i,s,o]=r;e[i]=s||o,r=t.exec(n)}return e}function A1(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function O1(n){const{nodeName:e,name:t,getContent:r,parseAttributes:i=M1,serializeAttributes:s=A1,defaultAttributes:o={},selfClosing:a=!1,allowedAttributes:c}=n,u=t||e,d=y=>{if(!c)return y;const g={};return c.forEach(w=>{const T=typeof w=="string"?w:w.name,S=typeof w=="string"?void 0:w.skipIfDefault;if(T in y){const C=y[T];if(S!==void 0&&C===S)return;g[T]=C}}),g},p=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(y,g)=>{const w={...o,...y.attributes};if(a)return g.createNode(e,w);const T=r?r(y):y.content||"";return T?g.createNode(e,w,[g.createTextNode(T)]):g.createNode(e,w,[])},markdownTokenizer:{name:e,level:"inline",start(y){const g=a?new RegExp(`\\[${p}\\s*[^\\]]*\\]`):new RegExp(`\\[${p}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${p}\\]`),w=y.match(g),T=w==null?void 0:w.index;return T!==void 0?T:-1},tokenize(y,g,w){const T=a?new RegExp(`^\\[${p}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${p}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${p}\\]`),S=y.match(T);if(!S)return;let C="",I="";if(a){const[,B]=S;I=B}else{const[,B,z]=S;I=B,C=z||""}const _=i(I.trim());return{type:e,raw:S[0],content:C.trim(),attributes:_}}},renderMarkdown:y=>{let g="";r?g=r(y):y.content&&y.content.length>0&&(g=y.content.filter(C=>C.type==="text").map(C=>C.text).join(""));const w=d(y.attrs||{}),T=s(w),S=T?` ${T}`:"";return a?`[${u}${S}]`:`[${u}${S}]${g}[/${u}]`}}}function rl(n,e,t){var r,i,s,o;const a=n.split(`
|
||
`),c=[];let u="",d=0;const p=e.baseIndentSize||2;for(;d<a.length;){const y=a[d],g=y.match(e.itemPattern);if(!g){if(c.length>0)break;if(y.trim()===""){d+=1,u=`${u}${y}
|
||
`;continue}else return}const w=e.extractItemData(g),{indentLevel:T,mainContent:S}=w;u=`${u}${y}
|
||
`;const C=[S];for(d+=1;d<a.length;){const z=a[d];if(z.trim()===""){const $=a.slice(d+1).findIndex(ee=>ee.trim()!=="");if($===-1)break;if((((i=(r=a[d+1+$].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>T){C.push(z),u=`${u}${z}
|
||
`,d+=1;continue}else break}if((((o=(s=z.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:o.length)||0)>T)C.push(z),u=`${u}${z}
|
||
`,d+=1;else break}let I;const _=C.slice(1);if(_.length>0){const z=_.map(b=>b.slice(T+p)).join(`
|
||
`);z.trim()&&(e.customNestedParser?I=e.customNestedParser(z):I=t.blockTokens(z))}const B=e.createToken(w,I);c.push(B)}if(c.length!==0)return{items:c,raw:u}}function Gl(n,e,t,r){if(!n||!Array.isArray(n.content))return"";const i=typeof t=="function"?t(r):t,[s,...o]=n.content,a=e.renderChildren([s]);let c=`${i}${a}`;return o&&o.length>0&&o.forEach((u,d)=>{var p,y;const g=(y=(p=e.renderChild)==null?void 0:p.call(e,u,d+1))!=null?y:e.renderChildren([u]);if(g!=null){const w=g.split(`
|
||
`).map(T=>T?e.indent(T):e.indent("")).join(`
|
||
`);c+=u.type==="paragraph"?`
|
||
|
||
${w}`:`
|
||
${w}`}}),c}function R1(n,e){return n.length!==e.length?!1:n.every((t,r)=>{const i=e[r];return t.type===i.type&&Ar(t.attrs,i.attrs)})}function N1(n,e,t={}){const{state:r}=e,{doc:i,tr:s}=r,o=n;i.descendants((a,c)=>{const u=s.mapping.map(c),d=s.mapping.map(c)+a.nodeSize;let p=null;if(a.marks.forEach(g=>{if(g!==o)return!1;p=g}),!p)return;let y=!1;if(Object.keys(t).forEach(g=>{t[g]!==p.attrs[g]&&(y=!0)}),y){const g=n.type.create({...n.attrs,...t});s.removeMark(u,d,n.type),s.addMark(u,d,g)}}),s.docChanged&&e.view.dispatch(s)}var lt=class Bp extends Wl{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new Bp(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function Wn(n){return new f1({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const s=ae(n.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,a=r[r.length-1],c=r[0];let u=t.to;if(a){const d=c.search(/\S/),p=t.from+c.indexOf(a),y=p+a.length;if(Ul(t.from,t.to,e.doc).filter(T=>T.mark.type.excluded.find(C=>C===n.type&&C!==T.mark.type)).filter(T=>T.to>p).length)return null;y<t.to&&o.delete(y,t.to),p>t.from&&o.delete(t.from+d,p),u=t.from+d+a.length,o.addMark(t.from+d,u,n.type.create(s||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(n.type)}}})}var Os=(n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);const{children:t,...r}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,r,t]},D1=/^\s*>\s$/,P1=lt.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return Os("blockquote",{...Oe(this.options.HTMLAttributes,n),children:Os("slot",{})})},parseMarkdown:(n,e)=>{var t;const r=(t=e.parseBlockChildren)!=null?t:e.parseChildren;return e.createNode("blockquote",void 0,r(n.tokens||[]))},renderMarkdown:(n,e)=>{if(!n.content)return"";const t=">",r=[];return n.content.forEach((i,s)=>{var o,a;const d=((a=(o=e.renderChild)==null?void 0:o.call(e,i,s))!=null?a:e.renderChildren([i])).split(`
|
||
`).map(p=>p.trim()===""?t:`${t} ${p}`);r.push(d.join(`
|
||
`))}),r.join(`
|
||
${t}
|
||
`)},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Mr({find:D1,type:this.type})]}}),I1=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,L1=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,B1=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,_1=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,z1=Gn.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return Os("strong",{...Oe(this.options.HTMLAttributes,n),children:Os("slot",{})})},markdownTokenName:"strong",parseMarkdown:(n,e)=>e.applyMark("bold",e.parseInline(n.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(n,e)=>`**${e.renderChildren(n)}**`,addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Er({find:I1,type:this.type}),Er({find:B1,type:this.type})]},addPasteRules(){return[Wn({find:L1,type:this.type}),Wn({find:_1,type:this.type})]}}),$1=n=>{const e=/`([^`]+)`(?!`)$/.exec(n);return!e||e.index>0&&n[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},j1=n=>{const e=/`([^`]+)`(?!`)/g,t=[];let r;for(;(r=e.exec(n))!==null;)r.index>0&&n[r.index-1]==="`"||t.push({index:r.index,text:r[0],replaceWith:r[1]});return t},F1=Gn.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",Oe(this.options.HTMLAttributes,n),0]},markdownTokenName:"codespan",parseMarkdown:(n,e)=>e.applyMark("code",[{type:"text",text:n.text||""}]),renderMarkdown:(n,e)=>n.content?`\`${e.renderChildren(n.content)}\``:"",addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Er({find:$1,type:this.type})]},addPasteRules(){return[Wn({find:j1,type:this.type})]}}),Sa=4,H1=/^```([a-z]+)?[\s\n]$/,V1=/^~~~([a-z]+)?[\s\n]$/,q1=lt.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Sa,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options;if(!t)return null;const s=[...((e=n.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(t)).map(o=>o.replace(t,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",Oe(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(n,e)=>{var t,r;return((t=n.raw)==null?void 0:t.startsWith("```"))===!1&&((r=n.raw)==null?void 0:r.startsWith("~~~"))===!1&&n.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:n.lang||null},n.text?[e.createTextNode(n.text)]:[])},renderMarkdown:(n,e)=>{var t;let r="";const i=((t=n.attrs)==null?void 0:t.language)||"";return n.content?r=[`\`\`\`${i}`,e.renderChildren(n.content),"```"].join(`
|
||
`):r=`\`\`\`${i}
|
||
|
||
\`\`\``,r},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:Sa,{state:r}=n,{selection:i}=r,{$from:s,empty:o}=i;if(s.parent.type!==this.type)return!1;const a=" ".repeat(t);return o?n.commands.insertContent(a):n.commands.command(({tr:c})=>{const{from:u,to:d}=i,g=r.doc.textBetween(u,d,`
|
||
`,`
|
||
`).split(`
|
||
`).map(w=>a+w).join(`
|
||
`);return c.replaceWith(u,d,r.schema.text(g)),!0})},"Shift-Tab":({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:Sa,{state:r}=n,{selection:i}=r,{$from:s,empty:o}=i;return s.parent.type!==this.type?!1:o?n.commands.command(({tr:a})=>{var c;const{pos:u}=s,d=s.start(),p=s.end(),g=r.doc.textBetween(d,p,`
|
||
`,`
|
||
`).split(`
|
||
`);let w=0,T=0;const S=u-d;for(let b=0;b<g.length;b+=1){if(T+g[b].length>=S){w=b;break}T+=g[b].length+1}const I=((c=g[w].match(/^ */))==null?void 0:c[0])||"",_=Math.min(I.length,t);if(_===0)return!0;let B=d;for(let b=0;b<w;b+=1)B+=g[b].length+1;return a.delete(B,B+_),u-B<=_&&a.setSelection(X.create(a.doc,B)),!0}):n.commands.command(({tr:a})=>{const{from:c,to:u}=i,y=r.doc.textBetween(c,u,`
|
||
`,`
|
||
`).split(`
|
||
`).map(g=>{var w;const T=((w=g.match(/^ */))==null?void 0:w[0])||"",S=Math.min(T.length,t);return g.slice(S)}).join(`
|
||
`);return a.replaceWith(c,u,r.schema.text(y)),!0})},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:i}=t;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
|
||
|
||
`);return!s||!o?!1:n.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:i,empty:s}=t;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const a=i.after();return a===void 0?!1:r.nodeAt(a)?n.commands.command(({tr:u})=>(u.setSelection(te.near(r.resolve(a))),!0)):n.commands.exitCode()}}},addInputRules(){return[nl({find:H1,type:this.type,getAttributes:n=>({language:n[1]})}),nl({find:V1,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new ke({key:new Re("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i==null?void 0:i.mode;if(!t||!s)return!1;const{tr:o,schema:a}=n.state,c=a.text(t.replace(/\r\n?/g,`
|
||
`));return o.replaceSelectionWith(this.type.create({language:s},c)),o.selection.$from.parent.type!==this.type&&o.setSelection(X.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),n.dispatch(o),!0}}})]}}),U1=lt.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
||
|
||
`):""}),W1=lt.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",Oe(this.options.HTMLAttributes,n)]},renderText(){return`
|
||
`},renderMarkdown:()=>`
|
||
`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:i,storedMarks:s}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,c=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:d})=>{if(d&&c&&o){const p=c.filter(y=>a.includes(y.type.name));u.ensureMarks(p)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),K1=lt.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]}`,Oe(this.options.HTMLAttributes,e),0]},parseMarkdown:(n,e)=>e.createNode("heading",{level:n.depth||1},e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>{var t;const r=(t=n.attrs)!=null&&t.level?parseInt(n.attrs.level,10):1,i="#".repeat(r);return n.content?`${i} ${e.renderChildren(n.content)}`:""},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=>nl({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),J1=lt.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",Oe(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!T1(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,i=n();return kp(t)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:s,tr:o,dispatch:a})=>{if(a){const{$to:c}=o.selection,u=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?o.setSelection(X.create(o.doc,c.pos+1)):c.nodeAfter.isBlock?o.setSelection(J.create(o.doc,c.pos)):o.setSelection(X.create(o.doc,c.pos));else{const d=s.schema.nodes[this.options.nextNodeType]||c.parent.type.contentMatch.defaultType,p=d==null?void 0:d.create();p&&(o.insert(u,p),o.setSelection(X.create(o.doc,u+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[w1({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),G1=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,X1=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Q1=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Y1=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Z1=Gn.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",Oe(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(n,e)=>e.applyMark("italic",e.parseInline(n.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(n,e)=>`*${e.renderChildren(n)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Er({find:G1,type:this.type}),Er({find:Q1,type:this.type})]},addPasteRules(){return[Wn({find:X1,type:this.type}),Wn({find:Y1,type:this.type})]}});const eT="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",tT="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",il="numeric",sl="ascii",ol="alpha",ni="asciinumeric",Xr="alphanumeric",al="domain",_p="emoji",nT="scheme",rT="slashscheme",va="whitespace";function iT(n,e){return n in e||(e[n]=[]),e[n]}function Dn(n,e,t){e[il]&&(e[ni]=!0,e[Xr]=!0),e[sl]&&(e[ni]=!0,e[ol]=!0),e[ni]&&(e[Xr]=!0),e[ol]&&(e[Xr]=!0),e[Xr]&&(e[al]=!0),e[_p]&&(e[al]=!0);for(const r in e){const i=iT(r,t);i.indexOf(n)<0&&i.push(n)}}function sT(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function tt(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}tt.groups={};tt.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],s=e.jr[r][1];if(s&&i.test(n))return s}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||tt.groups;let i;return e&&e.j?i=e:(i=new tt(e),t&&r&&Dn(e,t,r)),this.jr.push([n,i]),i},ts(n,e,t,r){let i=this;const s=n.length;if(!s)return i;for(let o=0;o<s-1;o++)i=i.tt(n[o]);return i.tt(n[s-1],e,t,r)},tt(n,e,t,r){r=r||tt.groups;const i=this;if(e&&e.j)return i.j[n]=e,e;const s=e;let o,a=i.go(n);if(a?(o=new tt,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new tt,s){if(r)if(o.t&&typeof o.t=="string"){const c=Object.assign(sT(o.t,r),t);Dn(s,c,r)}else t&&Dn(s,t,r);o.t=s}return i.j[n]=o,o}};const ne=(n,e,t,r,i)=>n.ta(e,t,r,i),we=(n,e,t,r,i)=>n.tr(e,t,r,i),Lf=(n,e,t,r,i)=>n.ts(e,t,r,i),F=(n,e,t,r,i)=>n.tt(e,t,r,i),Kt="WORD",ll="UWORD",zp="ASCIINUMERICAL",$p="ALPHANUMERICAL",bi="LOCALHOST",cl="TLD",ul="UTLD",hs="SCHEME",mr="SLASH_SCHEME",Xl="NUM",fl="WS",Ql="NL",ri="OPENBRACE",ii="CLOSEBRACE",Rs="OPENBRACKET",Ns="CLOSEBRACKET",Ds="OPENPAREN",Ps="CLOSEPAREN",Is="OPENANGLEBRACKET",Ls="CLOSEANGLEBRACKET",Bs="FULLWIDTHLEFTPAREN",_s="FULLWIDTHRIGHTPAREN",zs="LEFTCORNERBRACKET",$s="RIGHTCORNERBRACKET",js="LEFTWHITECORNERBRACKET",Fs="RIGHTWHITECORNERBRACKET",Hs="FULLWIDTHLESSTHAN",Vs="FULLWIDTHGREATERTHAN",qs="AMPERSAND",Us="APOSTROPHE",Ws="ASTERISK",an="AT",Ks="BACKSLASH",Js="BACKTICK",Gs="CARET",Pn="COLON",Yl="COMMA",Xs="DOLLAR",Bt="DOT",Qs="EQUALS",Zl="EXCLAMATION",pt="HYPHEN",si="PERCENT",Ys="PIPE",Zs="PLUS",eo="POUND",oi="QUERY",ec="QUOTE",jp="FULLWIDTHMIDDLEDOT",tc="SEMI",_t="SLASH",ai="TILDE",to="UNDERSCORE",Fp="EMOJI",no="SYM";var Hp=Object.freeze({__proto__:null,ALPHANUMERICAL:$p,AMPERSAND:qs,APOSTROPHE:Us,ASCIINUMERICAL:zp,ASTERISK:Ws,AT:an,BACKSLASH:Ks,BACKTICK:Js,CARET:Gs,CLOSEANGLEBRACKET:Ls,CLOSEBRACE:ii,CLOSEBRACKET:Ns,CLOSEPAREN:Ps,COLON:Pn,COMMA:Yl,DOLLAR:Xs,DOT:Bt,EMOJI:Fp,EQUALS:Qs,EXCLAMATION:Zl,FULLWIDTHGREATERTHAN:Vs,FULLWIDTHLEFTPAREN:Bs,FULLWIDTHLESSTHAN:Hs,FULLWIDTHMIDDLEDOT:jp,FULLWIDTHRIGHTPAREN:_s,HYPHEN:pt,LEFTCORNERBRACKET:zs,LEFTWHITECORNERBRACKET:js,LOCALHOST:bi,NL:Ql,NUM:Xl,OPENANGLEBRACKET:Is,OPENBRACE:ri,OPENBRACKET:Rs,OPENPAREN:Ds,PERCENT:si,PIPE:Ys,PLUS:Zs,POUND:eo,QUERY:oi,QUOTE:ec,RIGHTCORNERBRACKET:$s,RIGHTWHITECORNERBRACKET:Fs,SCHEME:hs,SEMI:tc,SLASH:_t,SLASH_SCHEME:mr,SYM:no,TILDE:ai,TLD:cl,UNDERSCORE:to,UTLD:ul,UWORD:ll,WORD:Kt,WS:fl});const Ut=/[a-z]/,Hr=new RegExp("\\p{L}","u"),Ca=new RegExp("\\p{Emoji}","u"),Wt=/\d/,Ea=/\s/,Bf="\r",Ma=`
|
||
`,oT="️",aT="",Aa="";let Yi=null,Zi=null;function lT(n=[]){const e={};tt.groups=e;const t=new tt;Yi==null&&(Yi=_f(eT)),Zi==null&&(Zi=_f(tT)),F(t,"'",Us),F(t,"{",ri),F(t,"}",ii),F(t,"[",Rs),F(t,"]",Ns),F(t,"(",Ds),F(t,")",Ps),F(t,"<",Is),F(t,">",Ls),F(t,"(",Bs),F(t,")",_s),F(t,"「",zs),F(t,"」",$s),F(t,"『",js),F(t,"』",Fs),F(t,"<",Hs),F(t,">",Vs),F(t,"&",qs),F(t,"*",Ws),F(t,"@",an),F(t,"`",Js),F(t,"^",Gs),F(t,":",Pn),F(t,",",Yl),F(t,"$",Xs),F(t,".",Bt),F(t,"=",Qs),F(t,"!",Zl),F(t,"-",pt),F(t,"%",si),F(t,"|",Ys),F(t,"+",Zs),F(t,"#",eo),F(t,"?",oi),F(t,'"',ec),F(t,"/",_t),F(t,";",tc),F(t,"~",ai),F(t,"_",to),F(t,"\\",Ks),F(t,"・",jp);const r=we(t,Wt,Xl,{[il]:!0});we(r,Wt,r);const i=we(r,Ut,zp,{[ni]:!0}),s=we(r,Hr,$p,{[Xr]:!0}),o=we(t,Ut,Kt,{[sl]:!0});we(o,Wt,i),we(o,Ut,o),we(i,Wt,i),we(i,Ut,i);const a=we(t,Hr,ll,{[ol]:!0});we(a,Ut),we(a,Wt,s),we(a,Hr,a),we(s,Wt,s),we(s,Ut),we(s,Hr,s);const c=F(t,Ma,Ql,{[va]:!0}),u=F(t,Bf,fl,{[va]:!0}),d=we(t,Ea,fl,{[va]:!0});F(t,Aa,d),F(u,Ma,c),F(u,Aa,d),we(u,Ea,d),F(d,Bf),F(d,Ma),we(d,Ea,d),F(d,Aa,d);const p=we(t,Ca,Fp,{[_p]:!0});F(p,"#"),we(p,Ca,p),F(p,oT,p);const y=F(p,aT);F(y,"#"),we(y,Ca,p);const g=[[Ut,o],[Wt,i]],w=[[Ut,null],[Hr,a],[Wt,s]];for(let T=0;T<Yi.length;T++)rn(t,Yi[T],cl,Kt,g);for(let T=0;T<Zi.length;T++)rn(t,Zi[T],ul,ll,w);Dn(cl,{tld:!0,ascii:!0},e),Dn(ul,{utld:!0,alpha:!0},e),rn(t,"file",hs,Kt,g),rn(t,"mailto",hs,Kt,g),rn(t,"http",mr,Kt,g),rn(t,"https",mr,Kt,g),rn(t,"ftp",mr,Kt,g),rn(t,"ftps",mr,Kt,g),Dn(hs,{scheme:!0,ascii:!0},e),Dn(mr,{slashscheme:!0,ascii:!0},e),n=n.sort((T,S)=>T[0]>S[0]?1:-1);for(let T=0;T<n.length;T++){const S=n[T][0],I=n[T][1]?{[nT]:!0}:{[rT]:!0};S.indexOf("-")>=0?I[al]=!0:Ut.test(S)?Wt.test(S)?I[ni]=!0:I[sl]=!0:I[il]=!0,Lf(t,S,S,I)}return Lf(t,"localhost",bi,{ascii:!0}),t.jd=new tt(no),{start:t,tokens:Object.assign({groups:e},Hp)}}function Vp(n,e){const t=cT(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=t.length,i=[];let s=0,o=0;for(;o<r;){let a=n,c=null,u=0,d=null,p=-1,y=-1;for(;o<r&&(c=a.go(t[o]));)a=c,a.accepts()?(p=0,y=0,d=a):p>=0&&(p+=t[o].length,y++),u+=t[o].length,s+=t[o].length,o++;s-=p,o-=y,u-=p,i.push({t:d.t,v:e.slice(s-u,s),s:s-u,e:s})}return i}function cT(n){const e=[],t=n.length;let r=0;for(;r<t;){let i=n.charCodeAt(r),s,o=i<55296||i>56319||r+1===t||(s=n.charCodeAt(r+1))<56320||s>57343?n[r]:n.slice(r,r+2);e.push(o),r+=o.length}return e}function rn(n,e,t,r,i){let s;const o=e.length;for(let a=0;a<o-1;a++){const c=e[a];n.j[c]?s=n.j[c]:(s=new tt(r),s.jr=i.slice(),n.j[c]=s),n=s}return s=new tt(t),s.jr=i.slice(),n.j[e[o-1]]=s,s}function _f(n){const e=[],t=[];let r=0,i="0123456789";for(;r<n.length;){let s=0;for(;i.indexOf(n[r+s])>=0;)s++;if(s>0){e.push(t.join(""));for(let o=parseInt(n.substring(r,r+s),10);o>0;o--)t.pop();r+=s}else t.push(n[r]),r++}return e}const ki={defaultProtocol:"http",events:null,format:zf,formatHref:zf,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function nc(n,e=null){let t=Object.assign({},ki);n&&(t=Object.assign(t,n instanceof nc?n.o:n));const r=t.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}nc.prototype={o:ki,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]:ki[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 zf(n){return n}function qp(n,e){this.t="token",this.v=n,this.tk=e}qp.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)+"…":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=ki.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),s=this.toFormattedString(n),o={},a=n.get("className",t,e),c=n.get("target",t,e),u=n.get("rel",t,e),d=n.getObj("attributes",t,e),p=n.getObj("events",t,e);return o.href=r,a&&(o.class=a),c&&(o.target=c),u&&(o.rel=u),d&&Object.assign(o,d),{tagName:i,attributes:o,content:s,eventListeners:p}}};function Ao(n,e){class t extends qp{constructor(i,s){super(i,s),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const uT=Ao("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),$f=Ao("text"),fT=Ao("nl"),es=Ao("url",{isLink:!0,toHref(n=ki.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==bi&&n[1].t===Pn}}),ht=n=>new tt(n);function dT({groups:n}){const e=n.domain.concat([qs,Ws,an,Ks,Js,Gs,Xs,Qs,pt,Xl,si,Ys,Zs,eo,_t,no,ai,to]),t=[Us,Pn,Yl,Bt,Zl,si,oi,ec,tc,Is,Ls,ri,ii,Ns,Rs,Ds,Ps,Bs,_s,zs,$s,js,Fs,Hs,Vs],r=[qs,Us,Ws,Ks,Js,Gs,Xs,Qs,pt,ri,ii,si,Ys,Zs,eo,oi,_t,no,ai,to],i=ht(),s=F(i,ai);ne(s,r,s),ne(s,n.domain,s);const o=ht(),a=ht(),c=ht();ne(i,n.domain,o),ne(i,n.scheme,a),ne(i,n.slashscheme,c),ne(o,r,s),ne(o,n.domain,o);const u=F(o,an);F(s,an,u),F(a,an,u),F(c,an,u);const d=F(s,Bt);ne(d,r,s),ne(d,n.domain,s);const p=ht();ne(u,n.domain,p),ne(p,n.domain,p);const y=F(p,Bt);ne(y,n.domain,p);const g=ht(uT);ne(y,n.tld,g),ne(y,n.utld,g),F(u,bi,g);const w=F(p,pt);F(w,pt,w),ne(w,n.domain,p),ne(g,n.domain,p),F(g,Bt,y),F(g,pt,w);const T=F(o,pt),S=F(o,Bt);F(T,pt,T),ne(T,n.domain,o),ne(S,r,s),ne(S,n.domain,o);const C=ht(es);ne(S,n.tld,C),ne(S,n.utld,C),ne(C,n.domain,o),ne(C,r,s),F(C,Bt,S),F(C,pt,T),F(C,an,u);const I=F(C,Pn),_=ht(es);ne(I,n.numeric,_);const B=ht(es),z=ht();ne(B,e,B),ne(B,t,z),ne(z,e,B),ne(z,t,z),F(C,_t,B),F(_,_t,B);const b=F(a,Pn),$=F(c,Pn),q=F($,_t),H=F(q,_t);ne(a,n.domain,o),F(a,Bt,S),F(a,pt,T),ne(c,n.domain,o),F(c,Bt,S),F(c,pt,T),ne(b,n.domain,B),F(b,_t,B),F(b,oi,B),ne(H,n.domain,B),ne(H,e,B),F(H,_t,B);const ee=[[ri,ii],[Rs,Ns],[Ds,Ps],[Is,Ls],[Bs,_s],[zs,$s],[js,Fs],[Hs,Vs]];for(let ge=0;ge<ee.length;ge++){const[Se,ue]=ee[ge],se=F(B,Se);F(z,Se,se);const fe=ht(es);ne(se,e,fe);const ze=ht();ne(se,t,ze),F(se,ue,B),ne(fe,e,fe),ne(fe,t,ze),ne(ze,e,fe),ne(ze,t,ze),F(fe,ue,B),F(ze,ue,B)}return F(i,bi,C),F(i,Ql,fT),{start:i,tokens:Hp}}function hT(n,e,t){let r=t.length,i=0,s=[],o=[];for(;i<r;){let a=n,c=null,u=null,d=0,p=null,y=-1;for(;i<r&&!(c=a.go(t[i].t));)o.push(t[i++]);for(;i<r&&(u=c||a.go(t[i].t));)c=null,a=u,a.accepts()?(y=0,p=a):y>=0&&y++,i++,d++;if(y<0)i-=d,i<r&&(o.push(t[i]),i++);else{o.length>0&&(s.push(Oa($f,e,o)),o=[]),i-=y,d-=y;const g=p.t,w=t.slice(i-d,i);s.push(Oa(g,e,w))}}return o.length>0&&s.push(Oa($f,e,o)),s}function Oa(n,e,t){const r=t[0].s,i=t[t.length-1].e,s=e.slice(r,i);return new n(s,t)}const pT=typeof console<"u"&&console&&console.warn||(()=>{}),mT="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",me={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function gT(){return tt.groups={},me.scanner=null,me.parser=null,me.tokenQueue=[],me.pluginQueue=[],me.customSchemes=[],me.initialized=!1,me}function jf(n,e=!1){if(me.initialized&&pT(`linkifyjs: already initialized - will not register custom scheme "${n}" ${mT}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
|
||
1. Must only contain digits, lowercase ASCII letters or "-"
|
||
2. Cannot start or end with "-"
|
||
3. "-" cannot repeat`);me.customSchemes.push([n,e])}function yT(){me.scanner=lT(me.customSchemes);for(let n=0;n<me.tokenQueue.length;n++)me.tokenQueue[n][1]({scanner:me.scanner});me.parser=dT(me.scanner.tokens);for(let n=0;n<me.pluginQueue.length;n++)me.pluginQueue[n][1]({scanner:me.scanner,parser:me.parser});return me.initialized=!0,me}function rc(n){return me.initialized||yT(),hT(me.parser.start,n,Vp(me.scanner.start,n))}rc.scan=Vp;function Up(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 nc(t),i=rc(n),s=[];for(let o=0;o<i.length;o++){const a=i[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&s.push(a.toFormattedObject(r))}return s}var ic="[\0- -\u2029 ]",bT=new RegExp(ic),kT=new RegExp(`${ic}$`),xT=new RegExp(ic,"g");function wT(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function TT(n){return new ke({key:new Re("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(u=>u.docChanged)&&!t.doc.eq(r.doc),s=e.some(u=>u.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,a=up(t.doc,[...e]);if(bp(a).forEach(({newRange:u})=>{const d=xw(r.doc,u,g=>g.isTextblock);let p,y;if(d.length>1)p=d[0],y=r.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ");else if(d.length){const g=r.doc.textBetween(u.from,u.to," "," ");if(!kT.test(g))return;p=d[0],y=r.doc.textBetween(p.pos,u.to,void 0," ")}if(p&&y){const g=y.split(bT).filter(Boolean);if(g.length<=0)return!1;const w=g[g.length-1],T=p.pos+y.lastIndexOf(w);if(!w)return!1;const S=rc(w).map(C=>C.toObject(n.defaultProtocol));if(!wT(S))return!1;S.filter(C=>C.isLink).map(C=>({...C,from:T+C.start+1,to:T+C.end+1})).filter(C=>r.schema.marks.code?!r.doc.rangeHasMark(C.from,C.to,r.schema.marks.code):!0).filter(C=>n.validate(C.value)).filter(C=>n.shouldAutoLink(C.value)).forEach(C=>{Ul(C.from,C.to,r.doc).some(I=>I.mark.type===n.type)||o.addMark(C.from,C.to,n.type.create({href:C.href}))})}}),!!o.steps.length)return o}})}function ST(n){return new ke({key:new Re("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const c=r.target;if(!c)return!1;const u=n.editor.view.dom;o=c.closest("a"),o&&!u.contains(o)&&(o=null)}if(!o)return!1;let a=!1;if(n.enableClickSelection&&(a=n.editor.commands.extendMarkRange(n.type.name)),n.openOnClick){const c=yp(e.state,n.type.name),u=(i=o.href)!=null?i:c.href,d=(s=o.target)!=null?s:c.target;u&&(window.open(u,d),a=!0)}return a}}})}function vT(n){return new ke({key:new Re("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{shouldAutoLink:i}=n,{state:s}=e,{selection:o}=s,{empty:a}=o;if(a)return!1;let c="";r.content.forEach(d=>{c+=d.textContent});const u=Up(c,{defaultProtocol:n.defaultProtocol}).find(d=>d.isLink&&d.value===c);return!c||!u||i!==void 0&&!i(u.value)?!1:n.editor.commands.setMark(n.type,{href:u.href})}}})}function Cn(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(xT,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var CT=Gn.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"){jf(n);return}jf(n.scheme,n.optionalSlashes)})},onDestroy(){gT()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!Cn(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(n),t=/^[a-z][a-z0-9+.-]*:/i.test(n);if(e||t&&!n.includes("@"))return!0;const i=(n.includes("@")?n.split("@").pop():n).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},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},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!Cn(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=>!!Cn(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Oe(this.options.HTMLAttributes,n),0]:["a",Oe(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:(n,e)=>e.applyMark("link",e.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),renderMarkdown:(n,e)=>{var t,r,i,s;const o=(r=(t=n.attrs)==null?void 0:t.href)!=null?r:"",a=(s=(i=n.attrs)==null?void 0:i.title)!=null?s:"",c=e.renderChildren(n);return a?`[${c}](${o} "${a}")`:`[${c}](${o})`},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!Cn(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 t&&!this.options.isAllowedUri(t,{defaultValidate:r=>!!Cn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Wn({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,i=Up(n).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:o=>!!Cn(o,t),protocols:t,defaultProtocol:r}));i.length&&i.forEach(s=>{this.options.shouldAutoLink(s.value)&&e.push({text:s.value,data:{href:s.href},index:s.start})})}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(TT({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Cn(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(ST({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(vT({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),ET=Object.defineProperty,MT=(n,e)=>{for(var t in e)ET(n,t,{get:e[t],enumerable:!0})},AT="listItem",Ff="textStyle",Hf=/^\s*([-+*])\s$/,Wp=lt.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",Oe(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
||
`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(AT,this.editor.getAttributes(Ff)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Mr({find:Hf,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Mr({find:Hf,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Ff),editor:this.editor})),[n]}}),OT=(n,e,t)=>{const{selection:r}=n;if(!r.empty)return null;const{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let s=-1;for(let g=i.depth;g>0;g-=1)if(i.node(g).type.name===e){s=g;break}if(s<0)return null;const o=i.node(s),a=i.index(s);if(a+1>=o.childCount)return null;const c=o.child(a+1);if(!t.includes(c.type.name))return null;const u=n.schema.nodes[e];let d=!1;if(c.forEach(g=>{g.type===u&&g.childCount>1&&(d=!0)}),!d)return null;const p=n.doc.resolve(i.after()).nodeAfter;if(!p||!t.includes(p.type.name))return null;const y=[];return p.forEach(g=>{y.push(g)}),y.length===0?null:{listItemDepth:s,nestedList:p,nestedListPos:i.after(),insertPos:i.after(s),items:y}},RT=(n,e,t,r)=>{const i=OT(n,t,r);if(!i)return!1;const{selection:s}=n,{nestedList:o,nestedListPos:a,insertPos:c,items:u}=i,d=n.tr;d.delete(a,a+o.nodeSize);const p=d.mapping.map(c);return d.insert(p,j.from(u)),d.setSelection(s.map(d.doc,d.mapping)),e&&e(d),!0},NT=(n,e,t)=>RT(n.state,n.view.dispatch,e,t),Kp=(n,e)=>xe.create({name:`${n}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const t=()=>NT(this.editor,n,e);return{Delete:t,"Mod-Delete":t}}});function DT(n){var e,t;const r=(e=n.tokens)==null?void 0:e[0];return!!(n.text&&((t=n.tokens)==null?void 0:t.length)===1&&(r==null?void 0:r.type)==="list"&&r.ordered&&r.raw===n.text)}function PT(n,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(n)):e.parseInline([{type:"text",raw:n,text:n}])}var Jp=lt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Oe(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,e)=>{var t;if(n.type!=="list_item")return[];const r=(t=e.parseBlockChildren)!=null?t:e.parseChildren;let i=[];if(n.tokens&&n.tokens.length>0){if(DT(n))return{type:"listItem",content:[{type:"paragraph",content:PT(n.text||"",e)}]};if(n.tokens.some(o=>o.type==="paragraph"))i=r(n.tokens);else{const o=n.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(i=[{type:"paragraph",content:e.parseInline(o.tokens)}],n.tokens.length>1){const c=n.tokens.slice(1),u=r(c);i.push(...u)}}else i=r(n.tokens)}}return i.length===0&&(i=[{type:"paragraph",content:[]}]),{type:"listItem",content:i}},renderMarkdown:(n,e,t)=>Gl(n,e,r=>{var i,s;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((s=(i=r.meta)==null?void 0:i.parentAttrs)==null?void 0:s.start)||1)+r.index}. `:"- "},t),addExtensions(){return[Kp(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),IT={};MT(IT,{findListItemPos:()=>Oo,getNextListDepth:()=>sc,handleBackspace:()=>dl,handleDelete:()=>hl,hasListBefore:()=>Gp,hasListItemAfter:()=>LT,hasListItemBefore:()=>BT,listItemHasSubList:()=>_T,nextListIsDeeper:()=>Xp,nextListIsHigher:()=>Qp});var Oo=(n,e)=>{const{$from:t}=e.selection,r=Ae(n,e.schema);let i=null,s=t.depth,o=t.pos,a=null;for(;s>0&&a===null;)i=t.node(s),i.type===r?a=s:(s-=1,o-=1);return a===null?null:{$pos:e.doc.resolve(o),depth:a}},sc=(n,e)=>{const t=Oo(n,e);if(!t)return!1;const[,r]=Nw(e,n,t.$pos.pos+4);return r},Gp=(n,e,t)=>{const{$anchor:r}=n.selection,i=Math.max(0,r.pos-2),s=n.doc.resolve(i).node();return!(!s||!t.includes(s.type.name))},dl=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!yn(n.state,e)&&Gp(n.state,e,t)){const{$anchor:r}=n.state.selection,i=n.state.doc.resolve(r.before()-1),s=[];i.node().descendants((c,u)=>{c.type.name===e&&s.push({node:c,pos:u})});const o=s.at(-1);if(!o)return!1;const a=n.state.doc.resolve(i.start()+o.pos+1);return n.chain().cut({from:r.start()-1,to:r.end()+1},a.end()).joinForward().run()}return!yn(n.state,e)||!Lw(n.state)?!1:n.chain().liftListItem(e).run()},Xp=(n,e)=>{const t=sc(n,e),r=Oo(n,e);return!r||!t?!1:t>r.depth},Qp=(n,e)=>{const t=sc(n,e),r=Oo(n,e);return!r||!t?!1:t<r.depth},hl=(n,e)=>{if(!yn(n.state,e)||!Iw(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:i}=t;return!t.empty&&r.sameParent(i)?!1:Xp(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():Qp(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},LT=(n,e)=>{var t;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((t=i.nodeAfter)==null?void 0:t.type.name)!==n)},BT=(n,e)=>{var t;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((t=i.nodeBefore)==null?void 0:t.type.name)!==n)},_T=(n,e,t)=>{if(!t)return!1;const r=Ae(n,e.schema);let i=!1;return t.descendants(s=>{s.type===r&&(i=!0)}),i},Yp=xe.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&hl(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&hl(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&dl(n,t,r)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&dl(n,t,r)&&(e=!0)}),e}}}}),Vf=/^(\s*)(\d+)\.\s+(.*)$/,zT=/^\s/;function $T(n){const e=n.trimStart();return/^[-+*]\s+/.test(e)||/^\d+\.\s+/.test(e)||/^>\s?/.test(e)||/^```/.test(e)||/^~~~/.test(e)}function jT(n){const e=[],t=[];let r=!1;return n.forEach(i=>{if(r){t.push(i);return}if(i.trim()===""){r=!0,t.push(i);return}if(e.length>0&&$T(i)){r=!0,t.push(i);return}e.push(i)}),{paragraphLines:e,blockLines:t}}function FT(n){const e=[];let t=0,r=0;for(;t<n.length;){const i=n[t],s=i.match(Vf);if(!s)break;const[,o,a,c]=s,u=o.length,d=[c];let p=t+1;const y=[i];let g=!1;for(;p<n.length;){const w=n[p];if(w.match(Vf))break;if(w.trim()==="")y.push(w),d.push(""),g=!0,p+=1;else if(w.match(zT))y.push(w),d.push(w.slice(u+2)),p+=1;else{if(g)break;y.push(w),d.push(w),p+=1}}e.push({indent:u,number:parseInt(a,10),content:d.join(`
|
||
`).trim(),contentLines:d,raw:y.join(`
|
||
`)}),r=p,t=p}return[e,r]}function Zp(n,e,t){const r=[];let i=0;for(;i<n.length;){const s=n[i];if(s.indent===e){const{paragraphLines:o,blockLines:a}=jT(s.contentLines),c=o.join(`
|
||
`).trim(),u=[];c&&u.push({type:"paragraph",raw:c,tokens:t.inlineTokens(c)});const d=a.join(`
|
||
`).trim();if(d){const g=t.blockTokens(d);u.push(...g)}let p=i+1;const y=[];for(;p<n.length&&n[p].indent>e;)y.push(n[p]),p+=1;if(y.length>0){const g=Math.min(...y.map(T=>T.indent)),w=Zp(y,g,t);u.push({type:"list",ordered:!0,start:y[0].number,items:w,raw:y.map(T=>T.raw).join(`
|
||
`)})}r.push({type:"list_item",raw:s.raw,tokens:u}),i=p}else i+=1}return r}function HT(n,e){return n.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const r=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const s=e.parseChildren([i]);r.push({type:"paragraph",content:s})}else{const s=e.parseChildren([i]);s.length>0&&r.push(...s)}}),{type:"listItem",content:r}})}var VT="listItem",qf="textStyle",Uf=/^(\d+)\.\s$/,em=lt.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",Oe(this.options.HTMLAttributes,t),0]:["ol",Oe(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>{if(n.type!=="list"||!n.ordered)return[];const t=n.start||1,r=n.items?HT(n.items,e):[];return t!==1?{type:"orderedList",attrs:{start:t},content:r}:{type:"orderedList",content:r}},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
||
`):"",markdownTokenizer:{name:"orderedList",level:"block",start:n=>{const e=n.match(/^(\s*)(\d+)\.\s+/),t=e==null?void 0:e.index;return t!==void 0?t:-1},tokenize:(n,e,t)=>{var r;const i=n.split(`
|
||
`),[s,o]=FT(i);if(s.length===0)return;const a=Zp(s,0,t);return a.length===0?void 0:{type:"list",ordered:!0,start:((r=s[0])==null?void 0:r.number)||1,items:a,raw:i.slice(0,o).join(`
|
||
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(VT,this.editor.getAttributes(qf)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Mr({find:Uf,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Mr({find:Uf,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(qf)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),qT=/^\s*(\[([( |x])?\])\s$/,UT=lt.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",Oe(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const r=e.parseChildren(n.nestedTokens);t.push(...r)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const i=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return Gl(n,e,i)},addExtensions(){return this.options.nested?[Kp(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),c=document.createElement("div"),u=p=>{var y,g;a.ariaLabel=((g=(y=this.options.a11y)==null?void 0:y.checkboxLabel)==null?void 0:g.call(y,p,a.checked))||`Task item checkbox for ${p.textContent||"empty task item"}`};u(n),s.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",p=>p.preventDefault()),a.addEventListener("change",p=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:y}=p.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:g})=>{const w=t();if(typeof w!="number")return!1;const T=g.doc.nodeAt(w);return g.setNodeMarkup(w,void 0,{...T==null?void 0:T.attrs,checked:y}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,y)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([p,y])=>{i.setAttribute(p,y)}),i.dataset.checked=n.attrs.checked,a.checked=n.attrs.checked,s.append(a,o),i.append(s,c),Object.entries(e).forEach(([p,y])=>{i.setAttribute(p,y)});let d=new Set(Object.keys(e));return{dom:i,contentDOM:c,update:p=>{if(p.type!==this.type)return!1;i.dataset.checked=p.attrs.checked,a.checked=p.attrs.checked,u(p);const y=r.extensionManager.attributes,g=gi(p,y),w=new Set(Object.keys(g)),T=this.options.HTMLAttributes;return d.forEach(S=>{w.has(S)||(S in T?i.setAttribute(S,T[S]):i.removeAttribute(S))}),Object.entries(g).forEach(([S,C])=>{C==null?S in T?i.setAttribute(S,T[S]):i.removeAttribute(S):i.setAttribute(S,C)}),d=w,!0}}}},addInputRules(){return[Mr({find:qT,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),WT=lt.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",Oe(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
||
`):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const r=s=>{const o=rl(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,c)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:t.inlineTokens(a.mainContent),nestedTokens:c}),customNestedParser:r},t);return o?[{type:"taskList",raw:o.raw,items:o.items}]:t.blockTokens(s)},i=rl(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,o)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:t.inlineTokens(s.mainContent),nestedTokens:o}),customNestedParser:r},t);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});xe.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(Wp.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(Jp.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(Yp.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(em.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(UT.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(WT.configure(this.options.taskList)),n}});var ts=" ",Ra=" ",KT=lt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Oe(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];if(t.length===1&&t[0].type==="image")return e.parseChildren([t[0]]);const r=e.parseInline(t);return t.length===1&&t[0].type==="text"&&(t[0].raw===ts||t[0].text===ts||t[0].raw===Ra||t[0].text===Ra)&&r.length===1&&r[0].type==="text"&&(r[0].text===ts||r[0].text===Ra)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(n,e,t)=>{var r,i;if(!n)return"";const s=Array.isArray(n.content)?n.content:[];if(s.length===0){const o=Array.isArray((r=t==null?void 0:t.previousNode)==null?void 0:r.content)?t.previousNode.content:[];return((i=t==null?void 0:t.previousNode)==null?void 0:i.type)==="paragraph"&&o.length===0?ts:""}return e.renderChildren(s)},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),JT=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,GT=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,XT=Gn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",Oe(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Er({find:JT,type:this.type})]},addPasteRules(){return[Wn({find:GT,type:this.type})]}}),QT=lt.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),YT=Gn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",Oe(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!i)return;const s=i[2].trim();return{type:"underline",raw:i[0],text:s,tokens:t.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function ZT(n={}){return new ke({view(e){return new eS(e,n)}})}class eS{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,a=s.height/i.offsetHeight;if(t){let p=e.nodeBefore,y=e.nodeAfter;if(p||y){let g=this.editorView.nodeDOM(this.cursorPos-(p?p.nodeSize:0));if(g){let w=g.getBoundingClientRect(),T=p?w.bottom:w.top;p&&y&&(T=(T+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let S=this.width/2*a;r={left:w.left,right:w.right,top:T-S,bottom:T+S}}}}if(!r){let p=this.editorView.coordsAtPos(this.cursorPos),y=this.width/2*o;r={left:p.left-y,right:p.left+y,top:p.top,bottom:p.bottom}}let c=this.editorView.dom.offsetParent;this.element||(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let u,d;if(!c||c==document.body&&getComputedStyle(c).position=="static")u=-pageXOffset,d=-pageYOffset;else{let p=c.getBoundingClientRect(),y=p.width/c.offsetWidth,g=p.height/c.offsetHeight;u=p.left-c.scrollLeft*y,d=p.top-c.scrollTop*g}this.element.style.left=(r.left-u)/o+"px",this.element.style.top=(r.top-d)/a+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!s){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=th(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Te extends te{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return Te.valid(r)?new Te(r):te.near(r)}content(){return V.empty}eq(e){return e instanceof Te&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Te(e.resolve(t.pos))}getBookmark(){return new oc(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!tS(e)||!nS(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&Te.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let a=e.node(o);if(t>0?e.indexAfter(o)<a.childCount:e.index(o)>0){s=a.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let c=e.doc.resolve(i);if(Te.valid(c))return c}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!J.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),r=!1;continue e}break}s=o,i+=t;let a=e.doc.resolve(i);if(Te.valid(a))return a}return null}}}Te.prototype.visible=!1;Te.findFrom=Te.findGapCursorFrom;te.jsonID("gapcursor",Te);class oc{constructor(e){this.pos=e}map(e){return new oc(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Te.valid(t)?new Te(t):te.near(t)}}function tm(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function tS(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||tm(i.type))return!0;if(i.inlineContent)return!1}}return!0}function nS(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||tm(i.type))return!0;if(i.inlineContent)return!1}}return!0}function rS(){return new ke({props:{decorations:aS,createSelectionBetween(n,e,t){return e.pos==t.pos&&Te.valid(t)?new Te(t):null},handleClick:sS,handleKeyDown:iS,handleDOMEvents:{beforeinput:oS}}})}const iS=rp({ArrowLeft:ns("horiz",-1),ArrowRight:ns("horiz",1),ArrowUp:ns("vert",-1),ArrowDown:ns("vert",1)});function ns(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,a=e>0?o.$to:o.$from,c=o.empty;if(o instanceof X){if(!s.endOfTextblock(t)||a.depth==0)return!1;c=!1,a=r.doc.resolve(e>0?a.after():a.before())}let u=Te.findGapCursorFrom(a,e,c);return u?(i&&i(r.tr.setSelection(new Te(u))),!0):!1}}function sS(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!Te.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&J.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new Te(r))),!0)}function oS(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof Te))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let i=j.empty;for(let o=r.length-1;o>=0;o--)i=j.from(r[o].createAndFill(null,i));let s=n.state.tr.replace(t.pos,t.pos,new V(i,0,0));return s.setSelection(X.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function aS(n){if(!(n.selection instanceof Te))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",be.create(n.doc,[Ue.widget(n.selection.head,e,{key:"gapcursor"})])}var ro=200,De=function(){};De.prototype.append=function(e){return e.length?(e=De.from(e),!this.length&&e||e.length<ro&&this.leafAppend(e)||this.length<ro&&e.leafPrepend(this)||this.appendInner(e)):this};De.prototype.prepend=function(e){return e.length?De.from(e).append(this):this};De.prototype.appendInner=function(e){return new lS(this,e)};De.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?De.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};De.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};De.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)};De.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,r),i};De.from=function(e){return e instanceof De?e:e&&e.length?new nm(e):De.empty};var nm=(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,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var c=s;c<o;c++)if(i(this.values[c],a+c)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){for(var c=s-1;c>=o;c--)if(i(this.values[c],a+c)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=ro)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=ro)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})(De);De.empty=new nm([]);var lS=(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,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(s,a),o)===!1||s>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(s,a)-a,o+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(De);const cS=500;class Mt{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,s;t&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,a,c,u=[],d=[];return this.items.forEach((p,y)=>{if(!p.step){i||(i=this.remapping(r,y+1),s=i.maps.length),s--,d.push(p);return}if(i){d.push(new zt(p.map));let g=p.step.map(i.slice(s)),w;g&&o.maybeStep(g).doc&&(w=o.mapping.maps[o.mapping.maps.length-1],u.push(new zt(w,void 0,void 0,u.length+d.length))),s--,w&&i.appendMap(w,s)}else o.maybeStep(p.step);if(p.selection)return a=i?p.selection.map(i.slice(s)):p.selection,c=new Mt(this.items.slice(0,r).append(d.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:a}}addTransform(e,t,r,i){let s=[],o=this.eventCount,a=this.items,c=!i&&a.length?a.get(a.length-1):null;for(let d=0;d<e.steps.length;d++){let p=e.steps[d].invert(e.docs[d]),y=new zt(e.mapping.maps[d],p,t),g;(g=c&&c.merge(y))&&(y=g,d?s.pop():a=a.slice(0,a.length-1)),s.push(y),t&&(o++,t=void 0),i||(c=y)}let u=o-r.depth;return u>fS&&(a=uS(a,u),o-=u),new Mt(a.append(s),o)}remapping(e,t){let r=new ui;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,t),r}addMaps(e){return this.eventCount==0?this:new Mt(this.items.append(e.map(t=>new zt(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(y=>{y.selection&&a--},i);let c=t;this.items.forEach(y=>{let g=s.getMirror(--c);if(g==null)return;o=Math.min(o,g);let w=s.maps[g];if(y.step){let T=e.steps[g].invert(e.docs[g]),S=y.selection&&y.selection.map(s.slice(c+1,g));S&&a++,r.push(new zt(w,T,S))}else r.push(new zt(w))},i);let u=[];for(let y=t;y<o;y++)u.push(new zt(s.maps[y]));let d=this.items.slice(0,i).append(u).append(r),p=new Mt(d,a);return p.emptyItemCount()>cS&&(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=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let c=o.step.map(t.slice(r)),u=c&&c.getMap();if(r--,u&&t.appendMap(u,r),c){let d=o.selection&&o.selection.map(t.slice(r));d&&s++;let p=new zt(u.invert(),c,d),y,g=i.length-1;(y=i.length&&i[g].merge(p))?i[g]=y:i.push(p)}}else o.map&&r--},this.items.length,0),new Mt(De.from(i.reverse()),s)}}Mt.empty=new Mt(De.empty,0);function uS(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class zt{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 zt(t.getMap().invert(),t,this.selection)}}}class ln{constructor(e,t,r,i,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const fS=20;function dS(n,e,t,r){let i=t.getMeta($n),s;if(i)return i.historyState;t.getMeta(mS)&&(n=new ln(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta($n))return o.getMeta($n).redo?new ln(n.done.addTransform(t,void 0,r,ps(e)),n.undone,Wf(t.mapping.maps),n.prevTime,n.prevComposition):new ln(n.done,n.undone.addTransform(t,void 0,r,ps(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),c=n.prevTime==0||!o&&n.prevComposition!=a&&(n.prevTime<(t.time||0)-r.newGroupDelay||!hS(t,n.prevRanges)),u=o?Na(n.prevRanges,t.mapping):Wf(t.mapping.maps);return new ln(n.done.addTransform(t,c?e.selection.getBookmark():void 0,r,ps(e)),Mt.empty,u,t.time,a??n.prevComposition)}else return(s=t.getMeta("rebased"))?new ln(n.done.rebased(t,s),n.undone.rebased(t,s),Na(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new ln(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Na(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function hS(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function Wf(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,s,o)=>e.push(s,o));return e}function Na(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),s=e.map(n[r+1],-1);i<=s&&t.push(i,s)}return t}function pS(n,e,t){let r=ps(e),i=$n.get(e).spec.config,s=(t?n.undone:n.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(t?n.done:n.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),c=new ln(t?a:s.remaining,t?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta($n,{redo:t,historyState:c})}let Da=!1,Kf=null;function ps(n){let e=n.plugins;if(Kf!=e){Da=!1,Kf=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Da=!0;break}}return Da}const $n=new Re("history"),mS=new Re("closeHistory");function gS(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new ke({key:$n,state:{init(){return new ln(Mt.empty,Mt.empty,null,0,-1)},apply(e,t,r){return dS(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?im:r=="historyRedo"?sm:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function rm(n,e){return(t,r)=>{let i=$n.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let s=pS(i,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}const im=rm(!1,!0),sm=rm(!0,!0);xe.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc;if(((n==null?void 0:n.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new ke({key:new Re("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const i=this.options.limit,s=this.options.autoTrim;if(i==null||i===0||s===!1){n=!0;return}const o=this.storage.characters({node:r.doc});if(o>i){const a=o-i,c=0,u=a;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const d=r.tr.deleteRange(c,u);return n=!0,d}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:t.doc}),s=this.storage.characters({node:e.doc});if(s<=r||i>r&&s>r&&s<=i)return!0;if(i>r&&s>r&&s>i||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,c=s-r,u=a-c,d=a;return e.deleteRange(u,d),!(this.storage.characters({node:e.doc})>r)}})]}});var yS=xe.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[ZT(this.options)]}});xe.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new ke({key:new Re("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!t||!r)return be.create(n,[]);let o=0;this.options.mode==="deepest"&&n.descendants((c,u)=>{if(c.isText)return;if(!(i>=u&&i<=u+c.nodeSize-1))return!1;o+=1});let a=0;return n.descendants((c,u)=>{if(c.isText||!(i>=u&&i<=u+c.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";s.push(Ue.node(u,u+c.nodeSize,{class:this.options.className}))}),be.create(n,s)}}})]}});var bS=xe.create({name:"gapCursor",addProseMirrorPlugins(){return[rS()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=ae(W(n,"allowGapCursor",t)))!=null?e:null}}}),om="placeholder",xi=new Re("tiptap__placeholder"),Jf=200;function Gf(n){const{editor:e,placeholder:t,dataAttribute:r,pos:i,node:s,isEmptyDoc:o,hasAnchor:a,classes:{emptyNode:c,emptyEditor:u}}=n,d=[c];return o&&d.push(u),Ue.node(i,i+s.nodeSize,{class:d.join(" "),[r]:typeof t=="function"?t({editor:e,node:s,pos:i,hasAnchor:a}):t})}function Xf(n,e){return typeof n=="function"?n(e):n}function kS({editor:n,options:e,dataAttribute:t,doc:r,selection:i}){var s,o;if(!(n.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:c}=i,u=[],d=n.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){const y=r.resolve(c),g=y.depth>0?y.node(1):y.nodeAfter,w=y.depth>0?y.before(1):c;if(g&&g.type.isTextblock&&yi(g)){const T=c>=w&&c<=w+g.nodeSize;u.push(Gf({editor:n,isEmptyDoc:d,dataAttribute:t,hasAnchor:T,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:Xf(e.emptyNodeClass,{editor:n,node:g,pos:w,hasAnchor:T})},node:g,pos:w}))}}else{const y=xi.getState(n.state),g=(s=y==null?void 0:y.topPos)!=null?s:0,w=(o=y==null?void 0:y.bottomPos)!=null?o:r.content.size;r.nodesBetween(g,w,(T,S)=>{const C=c>=S&&c<=S+T.nodeSize,I=!T.isLeaf&&yi(T);return T.type.isTextblock&&(C||!e.showOnlyCurrent)&&I&&u.push(Gf({editor:n,isEmptyDoc:d,dataAttribute:t,hasAnchor:C,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:Xf(e.emptyNodeClass,{editor:n,node:T,pos:S,hasAnchor:C})},node:T,pos:S})),e.includeChildren})}return be.create(r,u)}function xS(n){return n.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function wS(n){const e=getComputedStyle(n),t=`${e.overflow} ${e.overflowY} ${e.overflowX}`;return/auto|scroll|overlay/.test(t)}function TS(n){let e=n;for(;e;){if(wS(e))return e;const t=e.parentElement;if(!t){const r=e.getRootNode();if(r instanceof ShadowRoot){e=r.host;continue}return window}e=t}return window}function SS(n){return n===window?{top:0,bottom:window.innerHeight}:n.getBoundingClientRect()}function vS({doc:n,view:e,scrollContainer:t}){const r=e.dom.getBoundingClientRect(),i=t?SS(t):{top:0,bottom:window.innerHeight},s=Math.max(r.top,i.top)-Jf,o=Math.min(r.bottom,i.bottom)+Jf;if(s>=o)return{top:0,bottom:n.content.size};const c=getComputedStyle(e.dom).direction==="rtl"?Math.max(r.right-2,r.left+2):r.left+2,u=e.posAtCoords({left:c,top:s+2}),d=e.posAtCoords({left:c,top:o-2});return{top:u?u.pos:0,bottom:d?d.pos:n.content.size}}var CS={init(){return{topPos:null,bottomPos:null}},apply(n,e){const t=n.getMeta(xi);return t!=null&&t.positions?{topPos:t.positions.top,bottomPos:t.positions.bottom}:n.docChanged?{topPos:e.topPos!==null?n.mapping.map(e.topPos):null,bottomPos:e.bottomPos!==null?n.mapping.map(e.bottomPos):null}:e}};function ES(n){const e=TS(n.dom),t=()=>{const a=vS({view:n,doc:n.state.doc,scrollContainer:e}),c=xi.getState(n.state);if((c==null?void 0:c.topPos)===a.top&&(c==null?void 0:c.bottomPos)===a.bottom)return;const u=n.state.tr.setMeta(xi,{positions:a});n.dispatch(u)};let r=null,i=0;const s=150,o=()=>{r===null&&(r=requestAnimationFrame(()=>{r=null;const a=performance.now();a-i>=s?(i=a,t()):o()}))};return e.addEventListener("scroll",o,{passive:!0}),t(),{update(a,c){n.state.doc.content.size!==c.doc.content.size&&o()},destroy:()=>{r!==null&&cancelAnimationFrame(r),e.removeEventListener("scroll",o)}}}function MS({editor:n,options:e}){const t=e.dataAttribute?`data-${xS(e.dataAttribute)}`:`data-${om}`;return new ke({key:xi,state:CS,view:ES,props:{decorations:({doc:r,selection:i})=>kS({editor:n,options:e,dataAttribute:t,doc:r,selection:i})}})}xe.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:om,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[MS({editor:this.editor,options:this.options})]}});xe.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new ke({key:new Re("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||kp(t.selection)||n.view.dragging?null:be.create(t.doc,[Ue.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});var AS="skipTrailingNode";function Qf({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||(e==null?void 0:e.type)===n}var OS=xe.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new Re(this.name),t=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(t).includes(i.name));return[new ke({key:e,appendTransaction:(i,s,o)=>{const{doc:a,tr:c,schema:u}=o,d=e.getState(o),p=a.content.size,y=u.nodes[t];if(!i.some(g=>g.getMeta(AS))&&d)return c.insert(p,y.create())},state:{init:(i,s)=>{const o=s.tr.doc.lastChild;return!Qf({node:o,types:r})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const o=i.doc.lastChild;return!Qf({node:o,types:r})}}})]}}),RS=xe.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>im(n,e),redo:()=>({state:n,dispatch:e})=>sm(n,e)}},addProseMirrorPlugins(){return[gS(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),NS=xe.create({name:"starterKit",addExtensions(){var n,e,t,r;const i=[];return this.options.bold!==!1&&i.push(z1.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(P1.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(Wp.configure(this.options.bulletList)),this.options.code!==!1&&i.push(F1.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(q1.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(U1.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(yS.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(bS.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(W1.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(K1.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(RS.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(J1.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(Z1.configure(this.options.italic)),this.options.listItem!==!1&&i.push(Jp.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(Yp.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&i.push(CT.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(em.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(KT.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(XT.configure(this.options.strike)),this.options.text!==!1&&i.push(QT.configure(this.options.text)),this.options.underline!==!1&&i.push(YT.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&i.push(OS.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),DS=NS;function ac(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Xn=ac();function am(n){Xn=n}var Mn={exec:()=>null};function re(n,e=""){let t=typeof n=="string"?n:n.source,r={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(We.caret,"$1"),t=t.replace(i,o),r},getRegex:()=>new RegExp(t,e)};return r}var PS=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),We={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}#`),htmlBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}>`)},IS=/^(?:[ \t]*(?:\n|$))+/,LS=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,BS=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ai=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,_S=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,lc=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,lm=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,cm=re(lm).replace(/bull/g,lc).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),zS=re(lm).replace(/bull/g,lc).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),cc=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,$S=/^[^\n]+/,uc=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,jS=re(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",uc).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),FS=re(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,lc).getRegex(),Ro="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",fc=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,HS=re("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",fc).replace("tag",Ro).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),um=re(cc).replace("hr",Ai).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ro).getRegex(),VS=re(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",um).getRegex(),dc={blockquote:VS,code:LS,def:jS,fences:BS,heading:_S,hr:Ai,html:HS,lheading:cm,list:FS,newline:IS,paragraph:um,table:Mn,text:$S},Yf=re("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ai).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ro).getRegex(),qS={...dc,lheading:zS,table:Yf,paragraph:re(cc).replace("hr",Ai).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Yf).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ro).getRegex()},US={...dc,html:re(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",fc).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Mn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:re(cc).replace("hr",Ai).replace("heading",` *#{1,6} *[^
|
||
]`).replace("lheading",cm).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},WS=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,KS=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,fm=/^( {2,}|\\)\n(?!\s*$)/,JS=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Nr=/[\p{P}\p{S}]/u,No=/[\s\p{P}\p{S}]/u,hc=/[^\s\p{P}\p{S}]/u,GS=re(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,No).getRegex(),dm=/(?!~)[\p{P}\p{S}]/u,XS=/(?!~)[\s\p{P}\p{S}]/u,QS=/(?:[^\s\p{P}\p{S}]|~)/u,YS=re(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",PS?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),hm=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,ZS=re(hm,"u").replace(/punct/g,Nr).getRegex(),ev=re(hm,"u").replace(/punct/g,dm).getRegex(),pm="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",tv=re(pm,"gu").replace(/notPunctSpace/g,hc).replace(/punctSpace/g,No).replace(/punct/g,Nr).getRegex(),nv=re(pm,"gu").replace(/notPunctSpace/g,QS).replace(/punctSpace/g,XS).replace(/punct/g,dm).getRegex(),rv=re("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,hc).replace(/punctSpace/g,No).replace(/punct/g,Nr).getRegex(),iv=re(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Nr).getRegex(),sv="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",ov=re(sv,"gu").replace(/notPunctSpace/g,hc).replace(/punctSpace/g,No).replace(/punct/g,Nr).getRegex(),av=re(/\\(punct)/,"gu").replace(/punct/g,Nr).getRegex(),lv=re(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),cv=re(fc).replace("(?:-->|$)","-->").getRegex(),uv=re("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",cv).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),io=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,fv=re(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",io).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),mm=re(/^!?\[(label)\]\[(ref)\]/).replace("label",io).replace("ref",uc).getRegex(),gm=re(/^!?\[(ref)\](?:\[\])?/).replace("ref",uc).getRegex(),dv=re("reflink|nolink(?!\\()","g").replace("reflink",mm).replace("nolink",gm).getRegex(),Zf=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,pc={_backpedal:Mn,anyPunctuation:av,autolink:lv,blockSkip:YS,br:fm,code:KS,del:Mn,delLDelim:Mn,delRDelim:Mn,emStrongLDelim:ZS,emStrongRDelimAst:tv,emStrongRDelimUnd:rv,escape:WS,link:fv,nolink:gm,punctuation:GS,reflink:mm,reflinkSearch:dv,tag:uv,text:JS,url:Mn},hv={...pc,link:re(/^!?\[(label)\]\((.*?)\)/).replace("label",io).getRegex(),reflink:re(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",io).getRegex()},pl={...pc,emStrongRDelimAst:nv,emStrongLDelim:ev,delLDelim:iv,delRDelim:ov,url:re(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Zf).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:re(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Zf).getRegex()},pv={...pl,br:re(fm).replace("{2,}","*").getRegex(),text:re(pl.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},rs={normal:dc,gfm:qS,pedantic:US},Vr={normal:pc,gfm:pl,breaks:pv,pedantic:hv},mv={"&":"&","<":"<",">":">",'"':""","'":"'"},ed=n=>mv[n];function Lt(n,e){if(e){if(We.escapeTest.test(n))return n.replace(We.escapeReplace,ed)}else if(We.escapeTestNoEncode.test(n))return n.replace(We.escapeReplaceNoEncode,ed);return n}function td(n){try{n=encodeURI(n).replace(We.percentDecode,"%")}catch{return null}return n}function nd(n,e){var s;let t=n.replace(We.findPipe,(o,a,c)=>{let u=!1,d=a;for(;--d>=0&&c[d]==="\\";)u=!u;return u?"|":" |"}),r=t.split(We.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!((s=r.at(-1))!=null&&s.trim())&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(We.slashPipe,"|");return r}function qr(n,e,t){let r=n.length;if(r===0)return"";let i=0;for(;i<r&&n.charAt(r-i-1)===e;)i++;return n.slice(0,r-i)}function gv(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let r=0;r<n.length;r++)if(n[r]==="\\")r++;else if(n[r]===e[0])t++;else if(n[r]===e[1]&&(t--,t<0))return r;return t>0?-2:-1}function yv(n,e=0){let t=e,r="";for(let i of n)if(i===" "){let s=4-t%4;r+=" ".repeat(s),t+=s}else r+=i,t++;return r}function rd(n,e,t,r,i){let s=e.href,o=e.title||null,a=n[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let c={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:s,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,c}function bv(n,e,t){let r=n.match(t.other.indentCodeCompensation);if(r===null)return e;let i=r[1];return e.split(`
|
||
`).map(s=>{let o=s.match(t.other.beginningSpace);if(o===null)return s;let[a]=o;return a.length>=i.length?s.slice(i.length):s}).join(`
|
||
`)}var so=class{constructor(n){ce(this,"options");ce(this,"rules");ce(this,"lexer");this.options=n||Xn}space(n){let e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){let e=this.rules.block.code.exec(n);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:qr(t,`
|
||
`)}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],r=bv(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(n){let e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let r=qr(t,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(t=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(n){let e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:qr(e[0],`
|
||
`)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=qr(e[0],`
|
||
`).split(`
|
||
`),r="",i="",s=[];for(;t.length>0;){let o=!1,a=[],c;for(c=0;c<t.length;c++)if(this.rules.other.blockquoteStart.test(t[c]))a.push(t[c]),o=!0;else if(!o)a.push(t[c]);else break;t=t.slice(c);let u=a.join(`
|
||
`),d=u.replace(this.rules.other.blockquoteSetextReplace,`
|
||
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
|
||
${u}`:u,i=i?`${i}
|
||
${d}`:d;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(d,s,!0),this.lexer.state.top=p,t.length===0)break;let y=s.at(-1);if((y==null?void 0:y.type)==="code")break;if((y==null?void 0:y.type)==="blockquote"){let g=y,w=g.raw+`
|
||
`+t.join(`
|
||
`),T=this.blockquote(w);s[s.length-1]=T,r=r.substring(0,r.length-g.raw.length)+T.raw,i=i.substring(0,i.length-g.text.length)+T.text;break}else if((y==null?void 0:y.type)==="list"){let g=y,w=g.raw+`
|
||
`+t.join(`
|
||
`),T=this.list(w);s[s.length-1]=T,r=r.substring(0,r.length-y.raw.length)+T.raw,i=i.substring(0,i.length-g.raw.length)+T.raw,t=w.substring(s.at(-1).raw.length).split(`
|
||
`);continue}}return{type:"blockquote",raw:r,tokens:s,text:i}}}list(n){var t,r;let e=this.rules.block.list.exec(n);if(e){let i=e[1].trim(),s=i.length>1,o={type:"list",raw:"",ordered:s,start:s?+i.slice(0,-1):"",loose:!1,items:[]};i=s?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=s?i:"[*+-]");let a=this.rules.other.listItemRegex(i),c=!1;for(;n;){let d=!1,p="",y="";if(!(e=a.exec(n))||this.rules.block.hr.test(n))break;p=e[0],n=n.substring(p.length);let g=yv(e[2].split(`
|
||
`,1)[0],e[1].length),w=n.split(`
|
||
`,1)[0],T=!g.trim(),S=0;if(this.options.pedantic?(S=2,y=g.trimStart()):T?S=e[1].length+1:(S=g.search(this.rules.other.nonSpaceChar),S=S>4?1:S,y=g.slice(S),S+=e[1].length),T&&this.rules.other.blankLine.test(w)&&(p+=w+`
|
||
`,n=n.substring(w.length+1),d=!0),!d){let C=this.rules.other.nextBulletRegex(S),I=this.rules.other.hrRegex(S),_=this.rules.other.fencesBeginRegex(S),B=this.rules.other.headingBeginRegex(S),z=this.rules.other.htmlBeginRegex(S),b=this.rules.other.blockquoteBeginRegex(S);for(;n;){let $=n.split(`
|
||
`,1)[0],q;if(w=$,this.options.pedantic?(w=w.replace(this.rules.other.listReplaceNesting," "),q=w):q=w.replace(this.rules.other.tabCharGlobal," "),_.test(w)||B.test(w)||z.test(w)||b.test(w)||C.test(w)||I.test(w))break;if(q.search(this.rules.other.nonSpaceChar)>=S||!w.trim())y+=`
|
||
`+q.slice(S);else{if(T||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||_.test(g)||B.test(g)||I.test(g))break;y+=`
|
||
`+w}T=!w.trim(),p+=$+`
|
||
`,n=n.substring($.length+1),g=q.slice(S)}}o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(c=!0)),o.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(y),loose:!1,text:y,tokens:[]}),o.raw+=p}let u=o.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let d of o.items){if(this.lexer.state.top=!1,d.tokens=this.lexer.blockTokens(d.text,[]),d.task){if(d.text=d.text.replace(this.rules.other.listReplaceTask,""),((t=d.tokens[0])==null?void 0:t.type)==="text"||((r=d.tokens[0])==null?void 0:r.type)==="paragraph"){d.tokens[0].raw=d.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),d.tokens[0].text=d.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let y=this.lexer.inlineQueue.length-1;y>=0;y--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[y].src)){this.lexer.inlineQueue[y].src=this.lexer.inlineQueue[y].src.replace(this.rules.other.listReplaceTask,"");break}}let p=this.rules.other.listTaskCheckbox.exec(d.raw);if(p){let y={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};d.checked=y.checked,o.loose?d.tokens[0]&&["paragraph","text"].includes(d.tokens[0].type)&&"tokens"in d.tokens[0]&&d.tokens[0].tokens?(d.tokens[0].raw=y.raw+d.tokens[0].raw,d.tokens[0].text=y.raw+d.tokens[0].text,d.tokens[0].tokens.unshift(y)):d.tokens.unshift({type:"paragraph",raw:y.raw,text:y.raw,tokens:[y]}):d.tokens.unshift(y)}}if(!o.loose){let p=d.tokens.filter(g=>g.type==="space"),y=p.length>0&&p.some(g=>this.rules.other.anyLine.test(g.raw));o.loose=y}}if(o.loose)for(let d of o.items){d.loose=!0;for(let p of d.tokens)p.type==="text"&&(p.type="paragraph")}return o}}html(n){let e=this.rules.block.html.exec(n);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(n){let e=this.rules.block.def.exec(n);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:r,title:i}}}table(n){var o;let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=nd(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
||
`):[],s={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===r.length){for(let a of r)this.rules.other.tableAlignRight.test(a)?s.align.push("right"):this.rules.other.tableAlignCenter.test(a)?s.align.push("center"):this.rules.other.tableAlignLeft.test(a)?s.align.push("left"):s.align.push(null);for(let a=0;a<t.length;a++)s.header.push({text:t[a],tokens:this.lexer.inline(t[a]),header:!0,align:s.align[a]});for(let a of i)s.rows.push(nd(a,s.header.length).map((c,u)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:s.align[u]})));return s}}lheading(n){let e=this.rules.block.lheading.exec(n);if(e){let t=e[1].trim();return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(n){let e=this.rules.block.paragraph.exec(n);if(e){let t=e[1].charAt(e[1].length-1)===`
|
||
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let s=qr(t.slice(0,-1),"\\");if((t.length-s.length)%2===0)return}else{let s=gv(e[2],"()");if(s===-2)return;if(s>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let r=e[2],i="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],i=s[3])}else i=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?r=r.slice(1):r=r.slice(1,-1)),rd(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let r=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[r.toLowerCase()];if(!i){let s=t[0].charAt(0);return{type:"text",raw:s,text:s}}return rd(t,i,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let r=this.rules.inline.emStrongLDelim.exec(n);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!t||this.rules.inline.punctuation.exec(t))){let i=[...r[0]].length-1,s,o,a=i,c=0,u=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*n.length+i);(r=u.exec(e))!==null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(o=[...s].length,r[3]||r[4]){a+=o;continue}else if((r[5]||r[6])&&i%3&&!((i+o)%3)){c+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+c);let d=[...r[0]][0].length,p=n.slice(0,i+r.index+d+o);if(Math.min(i,o)%2){let g=p.slice(1,-1);return{type:"em",raw:p,text:g,tokens:this.lexer.inlineTokens(g)}}let y=p.slice(2,-2);return{type:"strong",raw:p,text:y,tokens:this.lexer.inlineTokens(y)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return r&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n,e,t=""){let r=this.rules.inline.delLDelim.exec(n);if(r&&(!r[1]||!t||this.rules.inline.punctuation.exec(t))){let i=[...r[0]].length-1,s,o,a=i,c=this.rules.inline.delRDelim;for(c.lastIndex=0,e=e.slice(-1*n.length+i);(r=c.exec(e))!==null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s||(o=[...s].length,o!==i))continue;if(r[3]||r[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let u=[...r[0]][0].length,d=n.slice(0,i+r.index+u+o),p=d.slice(i,-i);return{type:"del",raw:d,text:p,tokens:this.lexer.inlineTokens(p)}}}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let t,r;return e[2]==="@"?(t=e[1],r="mailto:"+t):(t=e[1],r=t),{type:"link",raw:e[0],text:t,href:r,tokens:[{type:"text",raw:t,text:t}]}}}url(n){var t;let e;if(e=this.rules.inline.url.exec(n)){let r,i;if(e[2]==="@")r=e[0],i="mailto:"+r;else{let s;do s=e[0],e[0]=((t=this.rules.inline._backpedal.exec(e[0]))==null?void 0:t[0])??"";while(s!==e[0]);r=e[0],e[1]==="www."?i="http://"+e[0]:i=e[0]}return{type:"link",raw:e[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},Ct=class ml{constructor(e){ce(this,"tokens");ce(this,"options");ce(this,"state");ce(this,"inlineQueue");ce(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Xn,this.options.tokenizer=this.options.tokenizer||new so,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:We,block:rs.normal,inline:Vr.normal};this.options.pedantic?(t.block=rs.pedantic,t.inline=Vr.pedantic):this.options.gfm&&(t.block=rs.gfm,this.options.breaks?t.inline=Vr.breaks:t.inline=Vr.gfm),this.tokenizer.rules=t}static get rules(){return{block:rs,inline:Vr}}static lex(e,t){return new ml(t).lex(e)}static lexInline(e,t){return new ml(t).inlineTokens(e)}lex(e){e=e.replace(We.carriageReturn,`
|
||
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let r=this.inlineQueue[t];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],r=!1){var i,s,o;for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(We.tabCharGlobal," ").replace(We.spaceLine,""));e;){let a;if((s=(i=this.options.extensions)==null?void 0:i.block)!=null&&s.some(u=>(a=u.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);let u=t.at(-1);a.raw.length===1&&u!==void 0?u.raw+=`
|
||
`:t.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);let u=t.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
|
||
`)?"":`
|
||
`)+a.raw,u.text+=`
|
||
`+a.text,this.inlineQueue.at(-1).src=u.text):t.push(a);continue}if(a=this.tokenizer.fences(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.heading(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.hr(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.blockquote(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.list(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.html(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.def(e)){e=e.substring(a.raw.length);let u=t.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
|
||
`)?"":`
|
||
`)+a.raw,u.text+=`
|
||
`+a.raw,this.inlineQueue.at(-1).src=u.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title},t.push(a));continue}if(a=this.tokenizer.table(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.lheading(e)){e=e.substring(a.raw.length),t.push(a);continue}let c=e;if((o=this.options.extensions)!=null&&o.startBlock){let u=1/0,d=e.slice(1),p;this.options.extensions.startBlock.forEach(y=>{p=y.call({lexer:this},d),typeof p=="number"&&p>=0&&(u=Math.min(u,p))}),u<1/0&&u>=0&&(c=e.substring(0,u+1))}if(this.state.top&&(a=this.tokenizer.paragraph(c))){let u=t.at(-1);r&&(u==null?void 0:u.type)==="paragraph"?(u.raw+=(u.raw.endsWith(`
|
||
`)?"":`
|
||
`)+a.raw,u.text+=`
|
||
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):t.push(a),r=c.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);let u=t.at(-1);(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
|
||
`)?"":`
|
||
`)+a.raw,u.text+=`
|
||
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):t.push(a);continue}if(e){let u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var c,u,d,p,y;this.tokenizer.lexer=this;let r=e,i=null;if(this.tokens.links){let g=Object.keys(this.tokens.links);if(g.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!==null;)g.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!==null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!==null;)s=i[2]?i[2].length:0,r=r.slice(0,i.index+s)+"["+"a".repeat(i[0].length-s-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=((u=(c=this.options.hooks)==null?void 0:c.emStrongMask)==null?void 0:u.call({lexer:this},r))??r;let o=!1,a="";for(;e;){o||(a=""),o=!1;let g;if((p=(d=this.options.extensions)==null?void 0:d.inline)!=null&&p.some(T=>(g=T.call({lexer:this},e,t))?(e=e.substring(g.raw.length),t.push(g),!0):!1))continue;if(g=this.tokenizer.escape(e)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.tag(e)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.link(e)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(g.raw.length);let T=t.at(-1);g.type==="text"&&(T==null?void 0:T.type)==="text"?(T.raw+=g.raw,T.text+=g.text):t.push(g);continue}if(g=this.tokenizer.emStrong(e,r,a)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.codespan(e)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.br(e)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.del(e,r,a)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.autolink(e)){e=e.substring(g.raw.length),t.push(g);continue}if(!this.state.inLink&&(g=this.tokenizer.url(e))){e=e.substring(g.raw.length),t.push(g);continue}let w=e;if((y=this.options.extensions)!=null&&y.startInline){let T=1/0,S=e.slice(1),C;this.options.extensions.startInline.forEach(I=>{C=I.call({lexer:this},S),typeof C=="number"&&C>=0&&(T=Math.min(T,C))}),T<1/0&&T>=0&&(w=e.substring(0,T+1))}if(g=this.tokenizer.inlineText(w)){e=e.substring(g.raw.length),g.raw.slice(-1)!=="_"&&(a=g.raw.slice(-1)),o=!0;let T=t.at(-1);(T==null?void 0:T.type)==="text"?(T.raw+=g.raw,T.text+=g.text):t.push(g);continue}if(e){let T="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(T);break}else throw new Error(T)}}return t}},oo=class{constructor(n){ce(this,"options");ce(this,"parser");this.options=n||Xn}space(n){return""}code({text:n,lang:e,escaped:t}){var s;let r=(s=(e||"").match(We.notSpaceStart))==null?void 0:s[0],i=n.replace(We.endingNewline,"")+`
|
||
`;return r?'<pre><code class="language-'+Lt(r)+'">'+(t?i:Lt(i,!0))+`</code></pre>
|
||
`:"<pre><code>"+(t?i:Lt(i,!0))+`</code></pre>
|
||
`}blockquote({tokens:n}){return`<blockquote>
|
||
${this.parser.parse(n)}</blockquote>
|
||
`}html({text:n}){return n}def(n){return""}heading({tokens:n,depth:e}){return`<h${e}>${this.parser.parseInline(n)}</h${e}>
|
||
`}hr(n){return`<hr>
|
||
`}list(n){let e=n.ordered,t=n.start,r="";for(let o=0;o<n.items.length;o++){let a=n.items[o];r+=this.listitem(a)}let i=e?"ol":"ul",s=e&&t!==1?' start="'+t+'"':"";return"<"+i+s+`>
|
||
`+r+"</"+i+`>
|
||
`}listitem(n){return`<li>${this.parser.parse(n.tokens)}</li>
|
||
`}checkbox({checked:n}){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:n}){return`<p>${this.parser.parseInline(n)}</p>
|
||
`}table(n){let e="",t="";for(let i=0;i<n.header.length;i++)t+=this.tablecell(n.header[i]);e+=this.tablerow({text:t});let r="";for(let i=0;i<n.rows.length;i++){let s=n.rows[i];t="";for(let o=0;o<s.length;o++)t+=this.tablecell(s[o]);r+=this.tablerow({text:t})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
|
||
<thead>
|
||
`+e+`</thead>
|
||
`+r+`</table>
|
||
`}tablerow({text:n}){return`<tr>
|
||
${n}</tr>
|
||
`}tablecell(n){let e=this.parser.parseInline(n.tokens),t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+`</${t}>
|
||
`}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${Lt(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:t}){let r=this.parser.parseInline(t),i=td(n);if(i===null)return r;n=i;let s='<a href="'+n+'"';return e&&(s+=' title="'+Lt(e)+'"'),s+=">"+r+"</a>",s}image({href:n,title:e,text:t,tokens:r}){r&&(t=this.parser.parseInline(r,this.parser.textRenderer));let i=td(n);if(i===null)return Lt(t);n=i;let s=`<img src="${n}" alt="${Lt(t)}"`;return e&&(s+=` title="${Lt(e)}"`),s+=">",s}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:Lt(n.text)}},mc=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}checkbox({raw:n}){return n}},Et=class gl{constructor(e){ce(this,"options");ce(this,"renderer");ce(this,"textRenderer");this.options=e||Xn,this.options.renderer=this.options.renderer||new oo,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new mc}static parse(e,t){return new gl(t).parse(e)}static parseInline(e,t){return new gl(t).parseInline(e)}parse(e){var r,i;this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let o=e[s];if((i=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&i[o.type]){let c=o,u=this.options.extensions.renderers[c.type].call({parser:this},c);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(c.type)){t+=u||"";continue}}let a=o;switch(a.type){case"space":{t+=this.renderer.space(a);break}case"hr":{t+=this.renderer.hr(a);break}case"heading":{t+=this.renderer.heading(a);break}case"code":{t+=this.renderer.code(a);break}case"table":{t+=this.renderer.table(a);break}case"blockquote":{t+=this.renderer.blockquote(a);break}case"list":{t+=this.renderer.list(a);break}case"checkbox":{t+=this.renderer.checkbox(a);break}case"html":{t+=this.renderer.html(a);break}case"def":{t+=this.renderer.def(a);break}case"paragraph":{t+=this.renderer.paragraph(a);break}case"text":{t+=this.renderer.text(a);break}default:{let c='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return t}parseInline(e,t=this.renderer){var i,s;this.renderer.parser=this;let r="";for(let o=0;o<e.length;o++){let a=e[o];if((s=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&s[a.type]){let u=this.options.extensions.renderers[a.type].call({parser:this},a);if(u!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){r+=u||"";continue}}let c=a;switch(c.type){case"escape":{r+=t.text(c);break}case"html":{r+=t.html(c);break}case"link":{r+=t.link(c);break}case"image":{r+=t.image(c);break}case"checkbox":{r+=t.checkbox(c);break}case"strong":{r+=t.strong(c);break}case"em":{r+=t.em(c);break}case"codespan":{r+=t.codespan(c);break}case"br":{r+=t.br(c);break}case"del":{r+=t.del(c);break}case"text":{r+=t.text(c);break}default:{let u='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return r}},ss,Qr=(ss=class{constructor(n){ce(this,"options");ce(this,"block");this.options=n||Xn}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(n=this.block){return n?Ct.lex:Ct.lexInline}provideParser(n=this.block){return n?Et.parse:Et.parseInline}},ce(ss,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ce(ss,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),ss),kv=class{constructor(...n){ce(this,"defaults",ac());ce(this,"options",this.setOptions);ce(this,"parse",this.parseMarkdown(!0));ce(this,"parseInline",this.parseMarkdown(!1));ce(this,"Parser",Et);ce(this,"Renderer",oo);ce(this,"TextRenderer",mc);ce(this,"Lexer",Ct);ce(this,"Tokenizer",so);ce(this,"Hooks",Qr);this.use(...n)}walkTokens(n,e){var r,i;let t=[];for(let s of n)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let o=s;for(let a of o.header)t=t.concat(this.walkTokens(a.tokens,e));for(let a of o.rows)for(let c of a)t=t.concat(this.walkTokens(c.tokens,e));break}case"list":{let o=s;t=t.concat(this.walkTokens(o.items,e));break}default:{let o=s;(i=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&i[o.type]?this.defaults.extensions.childTokens[o.type].forEach(a=>{let c=o[a].flat(1/0);t=t.concat(this.walkTokens(c,e))}):o.tokens&&(t=t.concat(this.walkTokens(o.tokens,e)))}}return t}use(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{let r={...t};if(r.async=this.defaults.async||r.async||!1,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=e.renderers[i.name];s?e.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=s.apply(this,o)),a}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=e[i.level];s?s.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),r.extensions=e),t.renderer){let i=this.defaults.renderer||new oo(this.defaults);for(let s in t.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let o=s,a=t.renderer[o],c=i[o];i[o]=(...u)=>{let d=a.apply(i,u);return d===!1&&(d=c.apply(i,u)),d||""}}r.renderer=i}if(t.tokenizer){let i=this.defaults.tokenizer||new so(this.defaults);for(let s in t.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let o=s,a=t.tokenizer[o],c=i[o];i[o]=(...u)=>{let d=a.apply(i,u);return d===!1&&(d=c.apply(i,u)),d}}r.tokenizer=i}if(t.hooks){let i=this.defaults.hooks||new Qr;for(let s in t.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let o=s,a=t.hooks[o],c=i[o];Qr.passThroughHooks.has(s)?i[o]=u=>{if(this.defaults.async&&Qr.passThroughHooksRespectAsync.has(s))return(async()=>{let p=await a.call(i,u);return c.call(i,p)})();let d=a.call(i,u);return c.call(i,d)}:i[o]=(...u)=>{if(this.defaults.async)return(async()=>{let p=await a.apply(i,u);return p===!1&&(p=await c.apply(i,u)),p})();let d=a.apply(i,u);return d===!1&&(d=c.apply(i,u)),d}}r.hooks=i}if(t.walkTokens){let i=this.defaults.walkTokens,s=t.walkTokens;r.walkTokens=function(o){let a=[];return a.push(s.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}this.defaults={...this.defaults,...r}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return Ct.lex(n,e??this.defaults)}parser(n,e){return Et.parse(n,e??this.defaults)}parseMarkdown(n){return(e,t)=>{let r={...t},i={...this.defaults,...r},s=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=n),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(e):e,a=await(i.hooks?await i.hooks.provideLexer(n):n?Ct.lex:Ct.lexInline)(o,i),c=i.hooks?await i.hooks.processAllTokens(a):a;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let u=await(i.hooks?await i.hooks.provideParser(n):n?Et.parse:Et.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(s);try{i.hooks&&(e=i.hooks.preprocess(e));let o=(i.hooks?i.hooks.provideLexer(n):n?Ct.lex:Ct.lexInline)(e,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let a=(i.hooks?i.hooks.provideParser(n):n?Et.parse:Et.parseInline)(o,i);return i.hooks&&(a=i.hooks.postprocess(a)),a}catch(o){return s(o)}}}onError(n,e){return t=>{if(t.message+=`
|
||
Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error occurred:</p><pre>"+Lt(t.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(t);throw t}}},Kn=new kv;function le(n,e){return Kn.parse(n,e)}le.options=le.setOptions=function(n){return Kn.setOptions(n),le.defaults=Kn.defaults,am(le.defaults),le};le.getDefaults=ac;le.defaults=Xn;le.use=function(...n){return Kn.use(...n),le.defaults=Kn.defaults,am(le.defaults),le};le.walkTokens=function(n,e){return Kn.walkTokens(n,e)};le.parseInline=Kn.parseInline;le.Parser=Et;le.parser=Et.parse;le.Renderer=oo;le.TextRenderer=mc;le.Lexer=Ct;le.lexer=Ct.lex;le.Tokenizer=so;le.Hooks=Qr;le.parse=le;le.options;le.setOptions;le.use;le.walkTokens;le.parseInline;Et.parse;Ct.lex;function xv(n,e){const r=e.split(`
|
||
`).flatMap(i=>[i,""]).map(i=>`${n}${i}`).join(`
|
||
`);return r.slice(0,r.length-1)}function wv(n,e){const t=[];return Array.from(n.entries()).forEach(([r,i])=>{if(!e){t.push(r);return}(e.marks||[]).find(o=>o.type===r&&Ar(o.attrs,i.attrs))||t.push(r)}),t}function Tv(n,e){const t=[];return Array.from(e.entries()).forEach(([r,i])=>{const s=n.get(r);(!s||!Ar(s.attrs,i.attrs))&&t.push({type:r,mark:i})}),t}function Sv(n,e,t,r){const i=!t,s=t&&(!t.marks||t.marks.length===0),o=t&&t.marks&&!r(e,new Map(t.marks.map(c=>[c.type,c]))),a=[];return(i||s||o)&&(t&&t.marks?Array.from(n.entries()).reverse().forEach(([c,u])=>{t.marks.find(p=>p.type===c&&Ar(p.attrs,u.attrs))||a.push(c)}):(i||s)&&a.push(...Array.from(n.keys()).reverse())),a}function vv(n,e){let t="";return Array.from(n.keys()).reverse().forEach(r=>{const i=n.get(r),s=e(r,i);s&&(t=s+t)}),n.clear(),t}function Cv(n,e,t){let r="";return Array.from(n.entries()).forEach(([i,s])=>{const o=t(i,s);o&&(r+=o),e.set(i,s)}),r}function Pa(n){const t=(n.raw||n.text||"").match(/^(\s*)[-+*]\s+\[([ xX])\]\s+/);return t?{isTask:!0,checked:t[2].toLowerCase()==="x",indentLevel:t[1].length}:{isTask:!1,indentLevel:0}}function is(n,e){return typeof n!="string"?"json":e}var Ev=n=>{const e=window.HTMLUnknownElement;return typeof e=="function"&&n instanceof e},Mv=class{constructor(n){this.activeParseLexer=null,this.extensionRanks=new Map,this.baseExtensions=[],this.extensions=[],this.codeTypes=new Set,this.schemaParseDomTagsCache=null,this.lastParseResult=null;var e,t,r,i,s;this.markedInstance=(e=n==null?void 0:n.marked)!=null?e:le,this.indentStyle=(r=(t=n==null?void 0:n.indentation)==null?void 0:t.style)!=null?r:"space",this.indentSize=(s=(i=n==null?void 0:n.indentation)==null?void 0:i.size)!=null?s:2,this.baseExtensions=(n==null?void 0:n.extensions)||[],n!=null&&n.markedOptions&&typeof this.markedInstance.setOptions=="function"&&this.markedInstance.setOptions(n.markedOptions),this.registry=new Map,this.nodeTypeRegistry=new Map,n!=null&&n.extensions&&(this.baseExtensions=n.extensions,kr(Co(n.extensions)).forEach(a=>this.registerExtension(a)))}get instance(){return this.markedInstance}get indentCharacter(){return this.indentStyle==="space"?" ":" "}get indentString(){return this.indentCharacter.repeat(this.indentSize)}hasMarked(){return!!this.markedInstance}registerExtension(n){var e,t;this.extensions.push(n);const r=ae(W(n,"code")),i=n.name;r&&this.codeTypes.add(i),this.extensionRanks.has(i)||this.extensionRanks.set(i,this.extensionRanks.size);const s=W(n,"markdownTokenName")||i,o=W(n,"parseMarkdown"),a=W(n,"renderMarkdown"),c=W(n,"markdownTokenizer"),u=(e=W(n,"markdownOptions"))!=null?e:null,d=(t=u==null?void 0:u.indentsContent)!=null?t:!1,p=u==null?void 0:u.htmlReopen,y={tokenName:s,nodeName:i,parseMarkdown:o,renderMarkdown:a,isIndenting:d,htmlReopen:p,tokenizer:c};if(s&&o){const g=this.registry.get(s)||[];g.push(y),this.registry.set(s,g)}if(a){const g=this.nodeTypeRegistry.get(i)||[];g.push(y),this.nodeTypeRegistry.set(i,g)}c&&this.hasMarked()&&this.registerTokenizer(c)}createLexer(){return new this.markedInstance.Lexer}createTokenizerHelpers(n){return{inlineTokens:e=>n.inlineTokens(e),blockTokens:e=>n.blockTokens(e)}}tokenizeInline(n){var e;return((e=this.activeParseLexer)!=null?e:this.createLexer()).inlineTokens(n)}registerTokenizer(n){if(!this.hasMarked())return;const{name:e,start:t,level:r="inline",tokenize:i}=n,s=this.createTokenizerHelpers.bind(this),o=this.createLexer.bind(this);let a;t?a=typeof t=="function"?t:u=>u.indexOf(t):a=u=>{const d=i(u,[],this.createTokenizerHelpers(this.createLexer()));return d&&d.raw?u.indexOf(d.raw):-1};const c={name:e,level:r,start:a,tokenizer(u,d){const p=this.lexer?s(this.lexer):s(o()),y=i(u,d,p);if(y&&y.type)return{...y,type:y.type||e,raw:y.raw||"",tokens:y.tokens||[]}},childTokens:[]};this.markedInstance.use({extensions:[c]})}getHandlersForToken(n){try{return this.registry.get(n)||[]}catch{return[]}}getHandlerForToken(n){const e=this.getHandlersForToken(n);if(e.length>0)return e[0];const t=this.getHandlersForNodeType(n);return t.length>0?t[0]:void 0}getHandlersForNodeType(n){try{return this.nodeTypeRegistry.get(n)||[]}catch{return[]}}serialize(n){if(!n)return"";const e=this.renderNodes(n,n);return this.isEmptyOutput(e)?"":e}isEmptyOutput(n){return!n||n.trim()===""?!0:n.replace(/ /g,"").replace(/\u00A0/g,"").trim()===""}parse(n){if(!this.hasMarked())throw new Error("No marked instance available for parsing");const e=this.activeParseLexer,t=this.createLexer();this.activeParseLexer=t;try{const r=t.lex(n);return{type:"doc",content:this.parseTokens(r,!0)}}finally{this.activeParseLexer=e}}parseTokens(n,e=!1){const t=n.reduce((s,o,a)=>(o.type!=="space"&&s.push(a),s),[]);let r=-1,i=0;return n.flatMap((s,o)=>{for(var a;i<t.length&&t[i]<o;)r=t[i],i+=1;if(e&&s.type==="space"){const u=(a=t[i])!=null?a:-1;return this.createImplicitEmptyParagraphsFromSpace(s,r,u)}const c=this.parseToken(s,e);return c===null?[]:Array.isArray(c)?c:[c]})}createImplicitEmptyParagraphsFromSpace(n,e,t){const r=this.countParagraphSeparators(n.raw||"");if(r===0)return[];const s=Math.max(r-(e===-1||t===-1?0:1),0);return Array.from({length:s},()=>({type:"paragraph",content:[]}))}countParagraphSeparators(n){return(n.replace(/\r\n/g,`
|
||
`).match(/\n\n/g)||[]).length}parseToken(n,e=!1){if(!n.type)return null;if(n.type==="list")return this.parseListToken(n);const t=this.getHandlersForToken(n.type),r=this.createParseHelpers();if(t.find(s=>{if(!s.parseMarkdown)return!1;const o=s.parseMarkdown(n,r),a=this.normalizeParseResult(o);return a&&(!Array.isArray(a)||a.length>0)?(this.lastParseResult=a,!0):!1})&&this.lastParseResult){const s=this.lastParseResult;return this.lastParseResult=null,s}return this.parseFallbackToken(n,e)}parseListToken(n){if(!n.items||n.items.length===0)return this.parseTokenWithHandlers(n);const e=n.items.some(a=>Pa(a).isTask),t=n.items.some(a=>!Pa(a).isTask);if(!e||!t||this.getHandlersForToken("taskList").length===0)return this.parseTokenWithHandlers(n);const r=[];let i=[],s=null;for(let a=0;a<n.items.length;a+=1){const c=n.items[a],{isTask:u,checked:d,indentLevel:p}=Pa(c);let y=c;if(u){const T=(c.raw||c.text||"").split(`
|
||
`),S=T[0].match(/^\s*[-+*]\s+\[([ xX])\]\s+(.*)$/),C=S?S[2]:"";let I=[];if(T.length>1&&T.slice(1).join(`
|
||
`).trim()){const B=T.slice(1),z=B.filter(b=>b.trim());if(z.length>0){const b=Math.min(...z.map(H=>H.length-H.trimStart().length)),q=B.map(H=>H.trim()?H.slice(b):"").join(`
|
||
`).trim();q&&(I=this.markedInstance.lexer(`${q}
|
||
`))}}y={type:"taskItem",raw:"",mainContent:C,indentLevel:p,checked:d??!1,text:C,tokens:this.tokenizeInline(C),nestedTokens:I}}const g=u?"taskList":"list";s!==g?(i.length>0&&r.push({type:s,items:i}),i=[y],s=g):i.push(y)}i.length>0&&r.push({type:s,items:i});const o=[];for(let a=0;a<r.length;a+=1){const c=r[a],u={...n,type:c.type,items:c.items},d=this.parseToken(u);d&&(Array.isArray(d)?o.push(...d):o.push(d))}return o.length>0?o:null}parseTokenWithHandlers(n){if(!n.type)return null;const e=this.getHandlersForToken(n.type),t=this.createParseHelpers();if(e.find(i=>{if(!i.parseMarkdown)return!1;const s=i.parseMarkdown(n,t),o=this.normalizeParseResult(s);return o&&(!Array.isArray(o)||o.length>0)?(this.lastParseResult=o,!0):!1})&&this.lastParseResult){const i=this.lastParseResult;return this.lastParseResult=null,i}return this.parseFallbackToken(n)}createParseHelpers(){return{parseInline:n=>this.parseInlineTokens(n),tokenizeInline:n=>this.tokenizeInline(n),parseChildren:n=>this.parseTokens(n),parseBlockChildren:n=>this.parseTokens(n,!0),createTextNode:(n,e)=>({type:"text",text:n,marks:e||void 0}),createNode:(n,e,t)=>{const r={type:n,attrs:e||void 0,content:t||void 0};return(!e||Object.keys(e).length===0)&&delete r.attrs,r},applyMark:(n,e,t)=>({mark:n,content:e,attrs:t&&Object.keys(t).length>0?t:void 0})}}escapeRegex(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}parseInlineTokens(n){var e,t,r,i;const s=[];for(let o=0;o<n.length;o+=1){const a=n[o];if(a.type==="text")s.push({type:"text",text:If(a.text||"")});else if(a.type==="escape")s.push({type:"text",text:a.text||""});else if(a.type==="html"){const c=((t=(e=a.raw)!=null?e:a.text)!=null?t:"").toString(),u=/^<\/[\s]*[\w-]+/i.test(c),d=c.match(/^<[\s]*([\w-]+)(\s|>|\/|$)/i);if(!u&&d&&!/\/>$/.test(c)){const y=d[1],g=this.escapeRegex(y),w=new RegExp(`^<\\/\\s*${g}\\b`,"i");let T=-1;const S=[c];for(let C=o+1;C<n.length;C+=1){const I=n[C],_=((i=(r=I.raw)!=null?r:I.text)!=null?i:"").toString();if(S.push(_),I.type==="html"&&w.test(_)){T=C;break}}if(T!==-1){const C=S.join(""),I={type:"html",raw:C,text:C,block:!1},_=this.parseHTMLToken(I);if(_){const B=this.normalizeParseResult(_);Array.isArray(B)?s.push(...B):B&&s.push(B)}o=T;continue}}const p=this.parseHTMLToken(a);if(p){const y=this.normalizeParseResult(p);Array.isArray(y)?s.push(...y):y&&s.push(y)}}else if(a.type){const c=this.getHandlerForToken(a.type);if(c&&c.parseMarkdown){const u=this.createParseHelpers(),d=c.parseMarkdown(a,u);if(this.isMarkResult(d)){const p=this.applyMarkToContent(d.mark,d.content,d.attrs);s.push(...p)}else{const p=this.normalizeParseResult(d);Array.isArray(p)?s.push(...p):p&&s.push(p)}}else a.tokens&&s.push(...this.parseInlineTokens(a.tokens))}}for(let o=s.length-1;o>0;o-=1){const a=s[o],c=s[o-1];if(a.type==="text"&&c.type==="text"){const u=a.marks||[],d=c.marks||[];R1(u,d)&&(c.text=(c.text||"")+(a.text||""),s.splice(o,1))}}return s}applyMarkToContent(n,e,t){return e.map(r=>{if(r.type==="text"){const i=r.marks||[],s=t?{type:n,attrs:t}:{type:n};return{...r,marks:[...i,s]}}return{...r,content:r.content?this.applyMarkToContent(n,r.content,t):void 0}})}isMarkResult(n){return n&&typeof n=="object"&&"mark"in n}normalizeParseResult(n){return n?this.isMarkResult(n)?n.content:n:null}parseFallbackToken(n,e=!1){switch(n.type){case"paragraph":return{type:"paragraph",content:n.tokens?this.parseInlineTokens(n.tokens):[]};case"heading":return{type:"heading",attrs:{level:n.depth||1},content:n.tokens?this.parseInlineTokens(n.tokens):[]};case"text":return{type:"text",text:If(n.text||"")};case"html":return this.parseHTMLToken(n);case"escape":return{type:"text",text:n.text||""};case"space":return null;default:return n.tokens?this.parseTokens(n.tokens,e):null}}parseHTMLToken(n){const e=n.text||n.raw||"";if(!e.trim())return null;if(typeof window>"u")return n.block?{type:"paragraph",content:[{type:"text",text:e}]}:{type:"text",text:e};if(this.isUnrecognizedHtml(e))return this.htmlAsLiteralText(e,!!n.block);try{const t=Ew(e,this.baseExtensions);return t.type==="doc"&&t.content?n.block?t.content:t.content.length===1&&t.content[0].type==="paragraph"&&t.content[0].content?t.content[0].content:t.content:t}catch(t){throw new Error(`Failed to parse HTML in markdown: ${t}`)}}isUnrecognizedHtml(n){if(typeof window>"u"||typeof window.DOMParser>"u")return!1;const t=new window.DOMParser().parseFromString(`<body>${n}</body>`,"text/html").body.querySelectorAll("*");if(t.length===0)return!1;const r=this.getSchemaParseDomTags();return Array.from(t).some(i=>{if(!Ev(i))return!1;const s=i.tagName.toLowerCase();return!r.has(s)})}getSchemaParseDomTags(){if(this.schemaParseDomTagsCache)return this.schemaParseDomTagsCache;const n=new Set;try{const e=pp(this.baseExtensions),t=r=>{const i=r==null?void 0:r.parseDOM;Array.isArray(i)&&i.forEach(s=>{if(typeof(s==null?void 0:s.tag)=="string"){const o=s.tag.match(/^[a-zA-Z][\w-]*/);o&&n.add(o[0].toLowerCase())}})};Object.values(e.nodes).forEach(r=>t(r.spec)),Object.values(e.marks).forEach(r=>t(r.spec))}catch{}return this.schemaParseDomTagsCache=n,n}htmlAsLiteralText(n,e){const t=n.replace(/\s+$/,"");return t?e?{type:"paragraph",content:[{type:"text",text:t}]}:{type:"text",text:t}:null}encodeTextForMarkdown(n,e,t){return(t==null?void 0:t.type)!=null&&this.codeTypes.has(t.type)||(e.marks||[]).some(i=>this.codeTypes.has(typeof i=="string"?i:i.type))?n:this.escapeMarkdownSyntax(S1(n))}escapeMarkdownSyntax(n){return n.replace(/([\\`*_[\]~])/g,"\\$1")}renderNodeToMarkdown(n,e,t=0,r=0,i={}){var s;if(n.type==="text")return this.encodeTextForMarkdown(n.text||"",n,e);if(!n.type)return"";const o=this.getHandlerForToken(n.type);if(!o)return"";const a=Array.isArray(e==null?void 0:e.content)&&t>0?e.content[t-1]:void 0,c={renderChildren:(p,y)=>{const g=o.isIndenting?r+1:r;return!Array.isArray(p)&&p.content?this.renderNodes(p.content,n,y||"",t,g):this.renderNodes(p,n,y||"",t,g)},renderChild:(p,y)=>{const g=o.isIndenting?r+1:r;return this.renderNodeToMarkdown(p,n,y,g)},indent:p=>this.indentString+p,wrapInBlock:xv},u={index:t,level:r,parentType:e==null?void 0:e.type,previousNode:a,meta:{parentAttrs:e==null?void 0:e.attrs,...i}};return((s=o.renderMarkdown)==null?void 0:s.call(o,n,c,u))||""}renderNodes(n,e,t="",r=0,i=0){return Array.isArray(n)?this.renderNodesWithMarkBoundaries(n,e,t,i):n.type?this.renderNodeToMarkdown(n,e,r,i):""}renderNodesWithMarkBoundaries(n,e,t="",r=0){const i=[],s=new Map,o=new Set,a=new Map;return n.forEach((c,u)=>{const d=u<n.length-1?n[u+1]:null;if(c.type)if(c.type==="text"){let p=this.encodeTextForMarkdown(c.text||"",c,e);const y=new Map((c.marks||[]).map(z=>[z.type,z])),g=this.getMarksToOpenForSerialization(s,y,d),w=wv(y,d),T=w.filter(z=>s.has(z)),S=T.length>0&&g.length>0;let C="";if(w.length>0&&!S){const z=p.match(/(\s+)$/);z&&(C=z[1],p=p.slice(0,-C.length))}S||w.slice().reverse().forEach(z=>{if(!s.has(z))return;const b=y.get(z),$=this.getMarkClosing(z,b,a.get(z));$&&(p+=$),s.has(z)&&(s.delete(z),a.delete(z))});let I="";if(g.length>0){const z=p.match(/^(\s+)/);z&&(I=z[1],p=p.slice(I.length))}g.forEach(({type:z,mark:b})=>{const $=o.has(z)?"html":"markdown",q=this.getMarkOpening(z,b,$);q&&(p=q+p),a.set(z,$),o.delete(z)}),S||g.slice().reverse().forEach(({type:z,mark:b})=>{s.set(z,b)}),p=I+p;let _;if(S){const z=new Set(((d==null?void 0:d.marks)||[]).map(q=>q.type));g.forEach(({type:q})=>{z.has(q)&&this.getHtmlReopenTags(q)&&o.add(q)});const b=Array.from(s.keys()),$=T.slice().sort((q,H)=>b.indexOf(H)-b.indexOf(q));_=[...g.map(q=>q.type),...$]}else _=Sv(s,y,d,this.markSetsEqual.bind(this));let B="";if(_.length>0){const z=p.match(/(\s+)$/);z&&(B=z[1],p=p.slice(0,-B.length))}_.forEach(z=>{var b;const $=(b=s.get(z))!=null?b:y.get(z),q=this.getMarkClosing(z,$,a.get(z));q&&(p+=q),s.delete(z),a.delete(z)}),p+=B,p+=C,i.push(p)}else{const p=new Set((c.marks||[]).map(C=>C.type)),y=new Map,g=new Map;s.forEach((C,I)=>{var _;p.has(I)&&(y.set(I,C),g.set(I,(_=a.get(I))!=null?_:"markdown"))});const w=vv(s,(C,I)=>this.getMarkClosing(C,I,a.get(C)));a.clear();const T=this.renderNodeToMarkdown(c,e,u,r),S=c.type==="hardBreak"?"":Cv(y,s,(C,I)=>{var _;const B=(_=g.get(C))!=null?_:"markdown";return a.set(C,B),this.getMarkOpening(C,I,B)});i.push(w+T+S)}}),i.join(t)}getMarkOpening(n,e,t="markdown"){var r;if(t==="html")return((r=this.getHtmlReopenTags(n))==null?void 0:r.open)||"";const i=this.getHandlersForNodeType(n),s=i.length>0?i[0]:void 0;if(!s||!s.renderMarkdown)return"";const o="__TIPTAP_MARKDOWN_PLACEHOLDER__",a={type:n,attrs:e.attrs||{},content:[{type:"text",text:o}]};try{const c=s.renderMarkdown(a,{renderChildren:()=>o,renderChild:()=>o,indent:d=>d,wrapInBlock:(d,p)=>d+p},{index:0,level:0,parentType:"text",meta:{}}),u=c.indexOf(o);return u>=0?c.substring(0,u):""}catch(c){throw new Error(`Failed to get mark opening for ${n}: ${c}`)}}getMarkClosing(n,e,t="markdown"){var r;if(t==="html")return((r=this.getHtmlReopenTags(n))==null?void 0:r.close)||"";const i=this.getHandlersForNodeType(n),s=i.length>0?i[0]:void 0;if(!s||!s.renderMarkdown)return"";const o="__TIPTAP_MARKDOWN_PLACEHOLDER__",a={type:n,attrs:e.attrs||{},content:[{type:"text",text:o}]};try{const c=s.renderMarkdown(a,{renderChildren:()=>o,renderChild:()=>o,indent:p=>p,wrapInBlock:(p,y)=>p+y},{index:0,level:0,parentType:"text",meta:{}}),u=c.indexOf(o),d=u+o.length;return u>=0?c.substring(d):""}catch(c){throw new Error(`Failed to get mark closing for ${n}: ${c}`)}}getHtmlReopenTags(n){const e=this.getHandlersForNodeType(n),t=e.length>0?e[0]:void 0;return t==null?void 0:t.htmlReopen}markSetsEqual(n,e){return n.size!==e.size?!1:Array.from(n.entries()).every(([t,r])=>{const i=e.get(t);return i&&Ar(r.attrs,i.attrs)})}getMarksToOpenForSerialization(n,e,t){const r=Tv(n,e);if(r.length<=1)return r;const i=(t==null?void 0:t.marks)||[],s=(u,d)=>i.some(p=>p.type===u&&Ar(p.attrs,d)),o=(u,d)=>{var p,y;const g=(p=this.extensionRanks.get(u.type))!=null?p:Number.MAX_SAFE_INTEGER,w=(y=this.extensionRanks.get(d.type))!=null?y:Number.MAX_SAFE_INTEGER;return g!==w?w-g:u.type.localeCompare(d.type)},a=r.filter(u=>!s(u.type,u.mark.attrs)).sort(o),c=r.filter(u=>s(u.type,u.mark.attrs)).sort(o);return[...a,...c]}},id=Mv,Av=xe.create({name:"markdown",addOptions(){return{indentation:{style:"space",size:2},marked:void 0,markedOptions:{}}},addCommands(){return{setContent:(n,e)=>{if(!(e!=null&&e.contentType)||is(n,e==null?void 0:e.contentType)!=="markdown"||!this.editor.markdown)return vt.setContent(n,e);const r=this.editor.markdown.parse(n);return vt.setContent(r,e)},insertContent:(n,e)=>{if(!(e!=null&&e.contentType)||is(n,e==null?void 0:e.contentType)!=="markdown"||!this.editor.markdown)return vt.insertContent(n,e);const r=this.editor.markdown.parse(n);return vt.insertContent(r,e)},insertContentAt:(n,e,t)=>{if(!(t!=null&&t.contentType)||is(e,t==null?void 0:t.contentType)!=="markdown"||!this.editor.markdown)return vt.insertContentAt(n,e,t);const i=this.editor.markdown.parse(e);return vt.insertContentAt(n,i,t)}}},addStorage(){return{manager:new id({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:[]})}},onBeforeCreate(){var n;if(this.editor.markdown){console.error("[tiptap][markdown]: There is already a `markdown` property on the editor instance. This might lead to unexpected behavior.");return}if(this.storage.manager=new id({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:this.editor.extensionManager.baseExtensions}),this.editor.markdown=this.storage.manager,this.editor.getMarkdown=()=>this.storage.manager.serialize(this.editor.getJSON()),!this.editor.options.contentType||is(this.editor.options.content,this.editor.options.contentType)!=="markdown")return;if(!this.editor.markdown)throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the Markdown extension is not added to the editor. Please add the Markdown extension to use this feature.');if(this.editor.options.content===void 0||typeof this.editor.options.content!="string")throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the initial content is not a string. Please provide the initial content as a markdown string.');const t=this.editor.markdown.parse(this.editor.options.content);(n=t.content)!=null&&n.length&&(this.editor.options.content=t)}});D.ajaxSetup({headers:{"X-CSRF-TOKEN":D('meta[name="csrf-token"]').attr("content")}});window.oModalEditor=null;window.initModalEditor=function(n=""){const e=document.querySelector("#div-modal-editor");if(e){if(window.oModalEditor){window.oModalEditor.commands.setContent(n,!1);return}window.oModalEditor=new x1({element:e,extensions:[DS,Av.configure({html:!1}),Highlight],content:n}),D(document).on("click",".js-tiptap-btn",function(t){t.preventDefault();const r=D(this).data("action"),i=window.oModalEditor.chain().focus();switch(r){case"bold":i.toggleBold().run();break;case"italic":i.toggleItalic().run();break;case"heading":i.toggleHeading({level:1}).run();break;case"highlight":i.toggleHighlight().run();break}})}};
|